diff --git a/cpp/bench/CMakeLists.txt b/cpp/bench/CMakeLists.txt deleted file mode 100644 index d92ccba8e3..0000000000 --- a/cpp/bench/CMakeLists.txt +++ /dev/null @@ -1,141 +0,0 @@ -# ============================================================================= -# Copyright (c) 2022-2023, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License -# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -# or implied. See the License for the specific language governing permissions and limitations under -# the License. -# ============================================================================= - -# ################################################################################################## -# * compiler function ----------------------------------------------------------------------------- - -function(ConfigureBench) - - set(options OPTIONAL LIB) - set(oneValueArgs NAME) - set(multiValueArgs PATH TARGETS CONFIGURATIONS) - - cmake_parse_arguments(ConfigureBench "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - set(BENCH_NAME ${ConfigureBench_NAME}) - - add_executable(${BENCH_NAME} ${ConfigureBench_PATH}) - - target_link_libraries( - ${BENCH_NAME} - PRIVATE raft::raft - raft_internal - $<$:raft::compiled> - benchmark::benchmark - Threads::Threads - $ - $ - ) - - set_target_properties( - ${BENCH_NAME} - PROPERTIES # set target compile options - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON - ) - - target_compile_options( - ${BENCH_NAME} PRIVATE "$<$:${RAFT_CXX_FLAGS}>" - "$<$:${RAFT_CUDA_FLAGS}>" - ) - - target_include_directories(${BENCH_NAME} PUBLIC "$") - - install( - TARGETS ${BENCH_NAME} - COMPONENT testing - DESTINATION bin/gbench/libraft - EXCLUDE_FROM_ALL - ) - -endfunction() - -if(BUILD_BENCH) - ConfigureBench( - NAME CLUSTER_BENCH PATH bench/cluster/kmeans_balanced.cu bench/cluster/kmeans.cu bench/main.cpp - OPTIONAL LIB - ) - - ConfigureBench( - NAME TUNE_DISTANCE PATH bench/distance/tune_pairwise/kernel.cu - bench/distance/tune_pairwise/bench.cu bench/main.cpp - ) - - ConfigureBench( - NAME - DISTANCE_BENCH - PATH - bench/distance/distance_cosine.cu - bench/distance/distance_exp_l2.cu - bench/distance/distance_l1.cu - bench/distance/distance_unexp_l2.cu - bench/distance/fused_l2_nn.cu - bench/distance/masked_nn.cu - bench/distance/kernels.cu - bench/main.cpp - OPTIONAL - LIB - ) - - ConfigureBench( - NAME - LINALG_BENCH - PATH - bench/linalg/add.cu - bench/linalg/map_then_reduce.cu - bench/linalg/matrix_vector_op.cu - bench/linalg/norm.cu - bench/linalg/normalize.cu - bench/linalg/reduce_cols_by_key.cu - bench/linalg/reduce_rows_by_key.cu - bench/linalg/reduce.cu - bench/main.cpp - ) - - ConfigureBench( - NAME MATRIX_BENCH PATH bench/matrix/argmin.cu bench/matrix/gather.cu bench/matrix/select_k.cu - bench/main.cpp OPTIONAL LIB - ) - - ConfigureBench( - NAME RANDOM_BENCH PATH bench/random/make_blobs.cu bench/random/permute.cu bench/random/rng.cu - bench/main.cpp - ) - - ConfigureBench(NAME SPARSE_BENCH PATH bench/sparse/convert_csr.cu bench/main.cpp) - - ConfigureBench( - NAME - NEIGHBORS_BENCH - PATH - bench/neighbors/knn/brute_force_float_int64_t.cu - bench/neighbors/knn/brute_force_float_uint32_t.cu - bench/neighbors/knn/ivf_flat_float_int64_t.cu - bench/neighbors/knn/ivf_flat_int8_t_int64_t.cu - bench/neighbors/knn/ivf_flat_uint8_t_int64_t.cu - bench/neighbors/knn/ivf_pq_float_int64_t.cu - bench/neighbors/knn/ivf_pq_int8_t_int64_t.cu - bench/neighbors/knn/ivf_pq_uint8_t_int64_t.cu - bench/neighbors/refine_float_int64_t.cu - bench/neighbors/refine_uint8_t_int64_t.cu - bench/main.cpp - OPTIONAL - LIB - ) -endif() diff --git a/cpp/bench/prims/CMakeLists.txt b/cpp/bench/prims/CMakeLists.txt index f03a552c1d..f6499623dd 100644 --- a/cpp/bench/prims/CMakeLists.txt +++ b/cpp/bench/prims/CMakeLists.txt @@ -55,7 +55,9 @@ function(ConfigureBench) "$<$:${RAFT_CUDA_FLAGS}>" ) - target_include_directories(${BENCH_NAME} PUBLIC "$") + target_include_directories( + ${BENCH_NAME} PUBLIC "$" + ) install( TARGETS ${BENCH_NAME} @@ -66,7 +68,7 @@ function(ConfigureBench) endfunction() -if(BUILD_BENCH) +if(BUILD_PRIMS_BENCH) ConfigureBench( NAME CLUSTER_BENCH PATH bench/prims/cluster/kmeans_balanced.cu bench/prims/cluster/kmeans.cu bench/prims/main.cpp OPTIONAL LIB diff --git a/cpp/bench/prims/neighbors/knn.cuh b/cpp/bench/prims/neighbors/knn.cuh index 6caf355034..8f0b1cb5d9 100644 --- a/cpp/bench/prims/neighbors/knn.cuh +++ b/cpp/bench/prims/neighbors/knn.cuh @@ -316,11 +316,11 @@ struct knn : public fixture { RAFT_CUDA_TRY(cudaHostGetDevicePointer(&data_ptr, data_host_.data(), 0)); break; case TransferStrategy::MANAGED: // sic! using std::memcpy rather than cuda copy - CUDA_CHECK(cudaMemAdvise( + RAFT_CUDA_TRY(cudaMemAdvise( data_ptr, allocation_size, cudaMemAdviseSetPreferredLocation, handle.get_device())); - CUDA_CHECK(cudaMemAdvise( + RAFT_CUDA_TRY(cudaMemAdvise( data_ptr, allocation_size, cudaMemAdviseSetAccessedBy, handle.get_device())); - CUDA_CHECK(cudaMemAdvise( + RAFT_CUDA_TRY(cudaMemAdvise( data_ptr, allocation_size, cudaMemAdviseSetReadMostly, handle.get_device())); std::memcpy(data_ptr, data_host_.data(), allocation_size); break; diff --git a/cpp/internal/CMakeLists.txt b/cpp/internal/CMakeLists.txt index 4d5c585c01..5d9e8c6f8b 100644 --- a/cpp/internal/CMakeLists.txt +++ b/cpp/internal/CMakeLists.txt @@ -12,7 +12,7 @@ # the License. # ============================================================================= -if(BUILD_TESTS OR BUILD_BENCH) +if(BUILD_TESTS OR BUILD_PRIMS_BENCH) add_library(raft_internal INTERFACE) target_include_directories( raft_internal INTERFACE "$" diff --git a/cpp/template/cmake/thirdparty/get_raft.cmake b/cpp/template/cmake/thirdparty/get_raft.cmake index 5463942adf..6128b5c43c 100644 --- a/cpp/template/cmake/thirdparty/get_raft.cmake +++ b/cpp/template/cmake/thirdparty/get_raft.cmake @@ -44,7 +44,8 @@ function(find_and_configure_raft) SOURCE_SUBDIR cpp OPTIONS "BUILD_TESTS OFF" - "BUILD_BENCH OFF" + "BUILD_PRIMS_BENCH OFF" + "BUILD_ANN_BENCH OFF" "RAFT_NVTX ${ENABLE_NVTX}" "RAFT_COMPILE_LIBRARY ${PKG_COMPILE_LIBRARY}" ) diff --git a/docs/source/build.md b/docs/source/build.md index e36f771682..9c0c61b544 100644 --- a/docs/source/build.md +++ b/docs/source/build.md @@ -154,9 +154,10 @@ RAFT's cmake has the following configurable flags available:. | Flag | Possible Values | Default Value | Behavior | |---------------------------|----------------------| --- | --- | | BUILD_TESTS | ON, OFF | ON | Compile Googletests | -| BUILD_BENCH | ON, OFF | OFF | Compile benchmarks | +| BUILD_PRIMS_BENCH | ON, OFF | OFF | Compile benchmarks | +| BUILD_ANN_BENCH | ON, OFF | OFF | Compile end-to-end ANN benchmarks | | raft_FIND_COMPONENTS | compiled distributed | | Configures the optional components as a space-separated list | -| RAFT_COMPILE_LIBRARY | ON, OFF | ON if either BUILD_TESTS or BUILD_BENCH is ON; otherwise OFF | Compiles all `libraft` shared libraries (these are required for Googletests) | +| RAFT_COMPILE_LIBRARY | ON, OFF | ON if either BUILD_TESTS or BUILD_PRIMS_BENCH is ON; otherwise OFF | Compiles all `libraft` shared libraries (these are required for Googletests) | | DETECT_CONDA_ENV | ON, OFF | ON | Enable detection of conda environment for dependencies | | RAFT_NVTX | ON, OFF | OFF | Enable NVTX Markers | | CUDA_ENABLE_KERNELINFO | ON, OFF | OFF | Enables `kernelinfo` in nvcc. This is useful for `compute-sanitizer` | @@ -315,7 +316,8 @@ function(find_and_configure_raft) FIND_PACKAGE_ARGUMENTS "COMPONENTS compiled distributed" OPTIONS "BUILD_TESTS OFF" - "BUILD_BENCH OFF" + "BUILD_PRIMS_BENCH OFF" + "BUILD_ANN_BENCH OFF" "RAFT_COMPILE_LIBRARY ${PKG_COMPILE_LIBRARY}" ) diff --git a/python/pylibraft/CMakeLists.txt b/python/pylibraft/CMakeLists.txt index a87b798eae..3c2b093362 100644 --- a/python/pylibraft/CMakeLists.txt +++ b/python/pylibraft/CMakeLists.txt @@ -61,7 +61,8 @@ if(NOT raft_FOUND) include("${CMAKE_PROJECT_pylibraft_INCLUDE}") set(BUILD_TESTS OFF) - set(BUILD_BENCH OFF) + set(BUILD_PRIMS_BENCH OFF) + set(BUILD_ANN_BENCH OFF) set(RAFT_COMPILE_LIBRARY ON) set(_exclude_from_all "") diff --git a/python/raft-dask/CMakeLists.txt b/python/raft-dask/CMakeLists.txt index 8486523226..49e7f50c27 100644 --- a/python/raft-dask/CMakeLists.txt +++ b/python/raft-dask/CMakeLists.txt @@ -55,7 +55,8 @@ if(NOT raft_FOUND) # raft-dask doesn't actually use raft libraries, it just needs the headers, so we can turn off all # library compilation and we don't need to install anything here. set(BUILD_TESTS OFF) - set(BUILD_BENCH OFF) + set(BUILD_ANN_BENCH OFF) + set(BUILD_PRIMS_BENCH OFF) set(RAFT_COMPILE_LIBRARIES OFF) set(RAFT_COMPILE_DIST_LIBRARY OFF) set(RAFT_COMPILE_NN_LIBRARY OFF)