
# This file was generated by the build system used internally in the Yandex monorepo.
# Only simple modifications are allowed (adding source-files to targets, adding simple properties
# like target_include_directories). These modifications will be ported to original
# ya.make files by maintainers. Any complex modifications which can't be ported back to the
# original buildsystem will not be accepted.


find_package(CUDAToolkit REQUIRED)
add_subdirectory(ut)

add_library(catboost-cuda-methods)
target_cuda_sources(catboost-cuda-methods PRIVATE
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/linear_cusolver_stub.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_binary.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_half_byte.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_one_byte_5bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_one_byte_6bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_one_byte_7bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist2_one_byte_8bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_hist1.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pointwise_scores.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/linear_solver.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_binary.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_half_byte.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/exact_estimation.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/langevin_utils.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_5bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_6bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_7bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_8bit_atomics.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_5bit_one_hot.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_6bit_one_hot.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_7bit_one_hot.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/pairwise_hist_one_byte_8bit_atomics_one_hot.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/kernel/split_pairwise.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/gather_bins.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_one_byte.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_2_one_byte_5bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_2_one_byte_6bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_2_one_byte_7bit.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_half_byte.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/hist_binary.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/histogram_utils.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/split_points.cu
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/kernel/compute_scores.cu
)
target_link_libraries(catboost-cuda-methods PUBLIC
  contrib-libs-linux-headers
  contrib-libs-cxxsupp
  yutil
  catboost-cuda-ctrs
  catboost-cuda-cuda_lib
  catboost-cuda-cuda_util
  catboost-cuda-data
  catboost-cuda-gpu_data
  models
  catboost-cuda-targets
  private-libs-ctr_description
  catboost-libs-data
  catboost-libs-helpers
  private-libs-lapack
  catboost-libs-loggers
  catboost-libs-metrics
  catboost-libs-overfitting_detector
  cpp-threading-local_executor
  CUDA::toolkit
)
target_sources(catboost-cuda-methods PRIVATE
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/split_points.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/model_builder.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/compute_by_blocks_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/split_properties_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/greedy_subsets_searcher/greedy_search_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/add_oblivious_tree_model_feature_parallel.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/histograms_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/helpers.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pointwise_score_calcer.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/langevin_utils.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/feature_parallel_pointwise_oblivious_tree.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/oblivious_tree_structure_searcher.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/oblivious_tree_doc_parallel_structure_searcher.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/oblivious_tree_leaves_estimator.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/step_estimator.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/leaves_estimation_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/descent_helpers.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/doc_parallel_leaves_estimator.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/leaves_estimation/pointwise_oracle.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/boosting_progress_tracker.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/boosting_metric_calcer.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/tree_ctrs.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/ctr_from_tensor_calcer.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/batch_feature_tensor_builder.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/tree_ctrs_dataset.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/tree_ctr_datasets_visitor.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/serialization_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pointwise_optimization_subsets.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/update_feature_weights.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/stripe_target_wrapper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/pairwise_score_calcer_for_policy.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/pairwise_scores_calcer.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/blocked_histogram_helper.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/pairwise_oblivious_tree.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/pairwise_optimization_subsets.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_oblivious_trees/pairwise_structure_searcher.cpp
)
target_cuda_cflags(catboost-cuda-methods)
target_cuda_flags(catboost-cuda-methods
  -gencode
  arch=compute_35,code=sm_35
  -gencode
  arch=compute_50,code=compute_50
  -gencode
  arch=compute_52,code=sm_52
  -gencode
  arch=compute_60,code=compute_60
  -gencode
  arch=compute_61,code=compute_61
  -gencode
  arch=compute_61,code=sm_61
  -gencode
  arch=compute_70,code=sm_70
  -gencode
  arch=compute_70,code=compute_70
  --ptxas-options=-v
  -gencode=arch=compute_80,code=sm_80
  -gencode=arch=compute_86,code=sm_86
)

add_global_library_for(catboost-cuda-methods.global catboost-cuda-methods)
target_link_libraries(catboost-cuda-methods.global PUBLIC
  contrib-libs-linux-headers
  contrib-libs-cxxsupp
  yutil
  catboost-cuda-ctrs
  catboost-cuda-cuda_lib
  catboost-cuda-cuda_util
  catboost-cuda-data
  catboost-cuda-gpu_data
  models
  catboost-cuda-targets
  private-libs-ctr_description
  catboost-libs-data
  catboost-libs-helpers
  private-libs-lapack
  catboost-libs-loggers
  catboost-libs-metrics
  catboost-libs-overfitting_detector
  cpp-threading-local_executor
  CUDA::toolkit
)
target_sources(catboost-cuda-methods.global PRIVATE
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pointwise_kernels.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/pairwise_kernels.cpp
  ${CMAKE_SOURCE_DIR}/catboost/cuda/methods/exact_estimation.cpp
)
