From acc3dd44fcd96798bf527467951f14b0ff5db3b7 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 13 Oct 2022 18:57:04 -0400 Subject: [PATCH 1/2] Updates to fix cuml build --- ci/gpu/build.sh | 2 +- ci/release/update-version.sh | 3 ++- conda/environments/cuml_dev_cuda11.0.yml | 4 ++-- conda/environments/cuml_dev_cuda11.2.yml | 4 ++-- conda/environments/cuml_dev_cuda11.4.yml | 4 ++-- conda/environments/cuml_dev_cuda11.5.yml | 4 ++-- cpp/src/hdbscan/runner.h | 3 ++- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ci/gpu/build.sh b/ci/gpu/build.sh index 4543b31dab..a268c15f67 100644 --- a/ci/gpu/build.sh +++ b/ci/gpu/build.sh @@ -67,7 +67,7 @@ gpuci_mamba_retry install -c conda-forge -c rapidsai -c rapidsai-nightly -c nvid "dask-cuda=${MINOR_VERSION}" \ "ucx-py=${UCX_PY_VERSION}" \ "ucx-proc=*=gpu" \ - "xgboost=1.6.0dev.rapidsai${MINOR_VERSION}" \ + "xgboost=1.6.2dev.rapidsai${MINOR_VERSION}" \ "rapids-build-env=${MINOR_VERSION}.*" \ "rapids-notebook-env=${MINOR_VERSION}.*" \ "shap>=0.37,<=0.39" diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 8722741f16..3054db6fe7 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -50,7 +50,8 @@ for FILE in conda/environments/*.yml; do sed_runner "s/libraft-headers=${CURRENT_SHORT_TAG}/libraft-headers=${NEXT_SHORT_TAG}/g" ${FILE}; sed_runner "s/libraft-distance=${CURRENT_SHORT_TAG}/libraft-distance=${NEXT_SHORT_TAG}/g" ${FILE}; sed_runner "s/libraft-nn=${CURRENT_SHORT_TAG}/libraft-nn=${NEXT_SHORT_TAG}/g" ${FILE}; - sed_runner "s/pyraft=${CURRENT_SHORT_TAG}/pyraft=${NEXT_SHORT_TAG}/g" ${FILE}; + sed_runner "s/raft-dask=${CURRENT_SHORT_TAG}/raft-dask=${NEXT_SHORT_TAG}/g" ${FILE}; + sed_runner "s/pylibraft=${CURRENT_SHORT_TAG}/pylibraft=${NEXT_SHORT_TAG}/g" ${FILE}; sed_runner "s/rapids-build-env=${CURRENT_SHORT_TAG}/rapids-build-env=${NEXT_SHORT_TAG}/g" ${FILE}; sed_runner "s/rapids-notebook-env=${CURRENT_SHORT_TAG}/rapids-notebook-env=${NEXT_SHORT_TAG}/g" ${FILE}; sed_runner "s/rapids-doc-env=${CURRENT_SHORT_TAG}/rapids-doc-env=${NEXT_SHORT_TAG}/g" ${FILE}; diff --git a/conda/environments/cuml_dev_cuda11.0.yml b/conda/environments/cuml_dev_cuda11.0.yml index b1ee789a72..ed177b67a5 100644 --- a/conda/environments/cuml_dev_cuda11.0.yml +++ b/conda/environments/cuml_dev_cuda11.0.yml @@ -17,8 +17,8 @@ dependencies: - libraft-headers=22.12.* - libraft-distance=22.12.* - libraft-nn=22.12.* -- raft-dask=22.10.* -- pylibraft=22.10.* +- raft-dask=22.12.* +- pylibraft=22.12.* - dask-cudf=22.12.* - dask-cuda=22.12.* - ucx>=1.13.0 diff --git a/conda/environments/cuml_dev_cuda11.2.yml b/conda/environments/cuml_dev_cuda11.2.yml index 92b86cc02d..3cd414b061 100644 --- a/conda/environments/cuml_dev_cuda11.2.yml +++ b/conda/environments/cuml_dev_cuda11.2.yml @@ -17,8 +17,8 @@ dependencies: - libraft-headers=22.12.* - libraft-distance=22.12.* - libraft-nn=22.12.* -- raft-dask=22.10.* -- pylibraft=22.10.* +- raft-dask=22.12.* +- pylibraft=22.12.* - dask-cudf=22.12.* - dask-cuda=22.12.* - ucx>=1.13.0 diff --git a/conda/environments/cuml_dev_cuda11.4.yml b/conda/environments/cuml_dev_cuda11.4.yml index 04261632e1..9a7e65b7f5 100644 --- a/conda/environments/cuml_dev_cuda11.4.yml +++ b/conda/environments/cuml_dev_cuda11.4.yml @@ -17,8 +17,8 @@ dependencies: - libraft-headers=22.12.* - libraft-distance=22.12.* - libraft-nn=22.12.* -- raft-dask=22.10.* -- pylibraft=22.10.* +- raft-dask=22.12.* +- pylibraft=22.12.* - dask-cudf=22.12.* - dask-cuda=22.12.* - ucx>=1.13.0 diff --git a/conda/environments/cuml_dev_cuda11.5.yml b/conda/environments/cuml_dev_cuda11.5.yml index 59d5131e12..56dffdf45e 100644 --- a/conda/environments/cuml_dev_cuda11.5.yml +++ b/conda/environments/cuml_dev_cuda11.5.yml @@ -17,8 +17,8 @@ dependencies: - libraft-headers=22.12.* - libraft-distance=22.12.* - libraft-nn=22.12.* -- raft-dask=22.10.* -- pylibraft=22.10.* +- raft-dask=22.12.* +- pylibraft=22.12.* - dask-cudf=22.12.* - dask-cuda=22.12.* - ucx>=1.13.0 diff --git a/cpp/src/hdbscan/runner.h b/cpp/src/hdbscan/runner.h index 9385e5e5e2..d19938401d 100644 --- a/cpp/src/hdbscan/runner.h +++ b/cpp/src/hdbscan/runner.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -56,7 +57,7 @@ struct FixConnectivitiesRedOp { FixConnectivitiesRedOp(value_idx* colors_, value_t* core_dists_, value_idx m_) : colors(colors_), core_dists(core_dists_), m(m_){}; - typedef typename cub::KeyValuePair KVP; + typedef typename raft::KeyValuePair KVP; DI void operator()(value_idx rit, KVP* out, const KVP& other) { if (rit < m && other.value < std::numeric_limits::max() && From c74662addd7519d65959c1e771dc2b1f24267b88 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 13 Oct 2022 19:59:58 -0400 Subject: [PATCH 2/2] Removing unused benchmarks --- cpp/bench/CMakeLists.txt | 14 +--- cpp/bench/prims/add.cu | 69 ---------------- cpp/bench/prims/distance_common.cuh | 109 ------------------------ cpp/bench/prims/distance_cosine.cu | 27 ------ cpp/bench/prims/distance_exp_l2.cu | 28 ------- cpp/bench/prims/distance_l1.cu | 27 ------ cpp/bench/prims/distance_unexp_l2.cu | 28 ------- cpp/bench/prims/fused_l2_nn.cu | 114 ------------------------- cpp/bench/prims/make_blobs.cu | 92 --------------------- cpp/bench/prims/map_then_reduce.cu | 82 ------------------ cpp/bench/prims/matrix_vector_op.cu | 96 --------------------- cpp/bench/prims/permute.cu | 104 ----------------------- cpp/bench/prims/reduce.cu | 83 ------------------- cpp/bench/prims/rng.cu | 119 --------------------------- 14 files changed, 1 insertion(+), 991 deletions(-) delete mode 100644 cpp/bench/prims/add.cu delete mode 100644 cpp/bench/prims/distance_common.cuh delete mode 100644 cpp/bench/prims/distance_cosine.cu delete mode 100644 cpp/bench/prims/distance_exp_l2.cu delete mode 100644 cpp/bench/prims/distance_l1.cu delete mode 100644 cpp/bench/prims/distance_unexp_l2.cu delete mode 100644 cpp/bench/prims/fused_l2_nn.cu delete mode 100644 cpp/bench/prims/make_blobs.cu delete mode 100644 cpp/bench/prims/map_then_reduce.cu delete mode 100644 cpp/bench/prims/matrix_vector_op.cu delete mode 100644 cpp/bench/prims/permute.cu delete mode 100644 cpp/bench/prims/reduce.cu delete mode 100644 cpp/bench/prims/rng.cu diff --git a/cpp/bench/CMakeLists.txt b/cpp/bench/CMakeLists.txt index 3647f0ed8a..45b6b71346 100644 --- a/cpp/bench/CMakeLists.txt +++ b/cpp/bench/CMakeLists.txt @@ -74,20 +74,8 @@ endif() if(BUILD_CUML_PRIMS_BENCH) # (please keep the filenames in alphabetical order) add_executable(${PRIMS_BENCH_TARGET} - prims/add.cu - prims/distance_cosine.cu - prims/distance_exp_l2.cu - prims/distance_l1.cu - prims/distance_unexp_l2.cu - prims/fused_l2_nn.cu prims/gram_matrix.cu - prims/main.cpp - prims/make_blobs.cu - prims/map_then_reduce.cu - prims/matrix_vector_op.cu - prims/permute.cu - prims/reduce.cu - prims/rng.cu) + prims/main.cpp) target_compile_options(${PRIMS_BENCH_TARGET} PRIVATE "$<$:${CUML_CXX_FLAGS}>" diff --git a/cpp/bench/prims/add.cu b/cpp/bench/prims/add.cu deleted file mode 100644 index d3e89921e0..0000000000 --- a/cpp/bench/prims/add.cu +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include - -namespace MLCommon { -namespace Bench { -namespace LinAlg { - -struct AddParams { - int len; -}; // struct AddParams - -template -struct AddBench : public Fixture { - AddBench(const std::string& name, const AddParams& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - alloc(ptr0, params.len, true); - alloc(ptr1, params.len, true); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - dealloc(ptr0, params.len); - dealloc(ptr1, params.len); - } - - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { raft::linalg::add(ptr0, ptr0, ptr1, params.len, stream); }); - } - - private: - AddParams params; - T *ptr0, *ptr1; -}; // struct AddBench - -static std::vector getInputs() -{ - return { - {256 * 1024 * 1024}, - {256 * 1024 * 1024 + 2}, - {256 * 1024 * 1024 + 1}, - }; -} - -ML_BENCH_REGISTER(AddParams, AddBench, "", getInputs()); -ML_BENCH_REGISTER(AddParams, AddBench, "", getInputs()); - -} // namespace LinAlg -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/distance_common.cuh b/cpp/bench/prims/distance_common.cuh deleted file mode 100644 index 9ce14ff897..0000000000 --- a/cpp/bench/prims/distance_common.cuh +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include -#include -#include - -namespace MLCommon { -namespace Bench { -namespace Distance { - -struct Params { - int m, n, k; - bool isRowMajor; -}; // struct Params - -template -struct Distance : public Fixture { - Distance(const std::string& name, const Params& p) - : Fixture(name), params(p), x(0, stream), y(0, stream), out(0, stream), workspace(0, stream) - { - } - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - x.resize(params.m * params.k, stream); - y.resize(params.n * params.k, stream); - out.resize(params.m * params.n, stream); - RAFT_CUDA_TRY(cudaMemsetAsync(x.data(), 0, x.size() * sizeof(T), stream)); - RAFT_CUDA_TRY(cudaMemsetAsync(y.data(), 0, y.size() * sizeof(T), stream)); - RAFT_CUDA_TRY(cudaMemsetAsync(out.data(), 0, out.size() * sizeof(T), stream)); - worksize = raft::distance::getWorkspaceSize( - x.data(), y.data(), params.m, params.n, params.k); - workspace.resize(worksize, stream); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - x.release(); - y.release(); - out.release(); - workspace.release(); - } - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - raft::distance::distance(x.data(), - y.data(), - out.data(), - params.m, - params.n, - params.k, - (void*)workspace.data(), - worksize, - stream, - params.isRowMajor); - }); - } - - private: - Params params; - rmm::device_uvector x, y, out; - rmm::device_uvector workspace; - size_t worksize; -}; // struct Distance - -static std::vector getInputs() -{ - return { - {32, 16384, 16384, true}, {64, 16384, 16384, true}, {128, 16384, 16384, true}, - {256, 16384, 16384, true}, {512, 16384, 16384, true}, {1024, 16384, 16384, true}, - {16384, 32, 16384, true}, {16384, 64, 16384, true}, {16384, 128, 16384, true}, - {16384, 256, 16384, true}, {16384, 512, 16384, true}, {16384, 1024, 16384, true}, - {16384, 16384, 32, true}, {16384, 16384, 64, true}, {16384, 16384, 128, true}, - {16384, 16384, 256, true}, {16384, 16384, 512, true}, {16384, 16384, 1024, true}, - {16384, 16384, 16384, true}, {32, 16384, 16384, false}, {64, 16384, 16384, false}, - {128, 16384, 16384, false}, {256, 16384, 16384, false}, {512, 16384, 16384, false}, - {1024, 16384, 16384, false}, {16384, 32, 16384, false}, {16384, 64, 16384, false}, - {16384, 128, 16384, false}, {16384, 256, 16384, false}, {16384, 512, 16384, false}, - {16384, 1024, 16384, false}, {16384, 16384, 32, false}, {16384, 16384, 64, false}, - {16384, 16384, 128, false}, {16384, 16384, 256, false}, {16384, 16384, 512, false}, - {16384, 16384, 1024, false}, {16384, 16384, 16384, false}, - }; -} - -#define DIST_BENCH_REGISTER(Name, Metric) \ - using Name##F = Distance; \ - ML_BENCH_REGISTER(Params, Name##F, "", getInputs()); \ - using Name##D = Distance; \ - ML_BENCH_REGISTER(Params, Name##D, "", getInputs()) - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/distance_cosine.cu b/cpp/bench/prims/distance_cosine.cu deleted file mode 100644 index c3256f25bc..0000000000 --- a/cpp/bench/prims/distance_cosine.cu +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019-2021, 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. - */ - -#include "distance_common.cuh" - -namespace MLCommon { -namespace Bench { -namespace Distance { - -DIST_BENCH_REGISTER(DistanceCosine, raft::distance::DistanceType::CosineExpanded); - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/distance_exp_l2.cu b/cpp/bench/prims/distance_exp_l2.cu deleted file mode 100644 index fc4a854b2c..0000000000 --- a/cpp/bench/prims/distance_exp_l2.cu +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2019-2021, 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. - */ - -#include "distance_common.cuh" - -namespace MLCommon { -namespace Bench { -namespace Distance { - -DIST_BENCH_REGISTER(DistanceL2Sq, raft::distance::DistanceType::L2Expanded); -DIST_BENCH_REGISTER(DistanceL2Sqrt, raft::distance::DistanceType::L2SqrtExpanded); - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/distance_l1.cu b/cpp/bench/prims/distance_l1.cu deleted file mode 100644 index c14d653a5b..0000000000 --- a/cpp/bench/prims/distance_l1.cu +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019-2020, 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. - */ - -#include "distance_common.cuh" - -namespace MLCommon { -namespace Bench { -namespace Distance { - -DIST_BENCH_REGISTER(DistanceL1, raft::distance::DistanceType::L1); - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/distance_unexp_l2.cu b/cpp/bench/prims/distance_unexp_l2.cu deleted file mode 100644 index a26da4fe60..0000000000 --- a/cpp/bench/prims/distance_unexp_l2.cu +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2019-2021, 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. - */ - -#include "distance_common.cuh" - -namespace MLCommon { -namespace Bench { -namespace Distance { - -DIST_BENCH_REGISTER(DistanceUnexpL2Sq, raft::distance::DistanceType::L2Unexpanded); -DIST_BENCH_REGISTER(DistanceUnexpL2Sqrt, raft::distance::DistanceType::L2SqrtUnexpanded); - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/fused_l2_nn.cu b/cpp/bench/prims/fused_l2_nn.cu deleted file mode 100644 index 475f384081..0000000000 --- a/cpp/bench/prims/fused_l2_nn.cu +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace MLCommon { -namespace Bench { -namespace Distance { - -struct FLNParams { - int m, n, k; -}; // struct FLNParams - -template -struct FusedL2NN : public Fixture { - FusedL2NN(const std::string& name, const FLNParams& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - alloc(x, params.m * params.k); - alloc(y, params.n * params.k); - alloc(xn, params.m); - alloc(yn, params.n); - alloc(out, params.m); - alloc(workspace, params.m); - raft::random::Rng r(123456ULL); - raft::handle_t handle{stream}; - - r.uniform(x, params.m * params.k, T(-1.0), T(1.0), stream); - r.uniform(y, params.n * params.k, T(-1.0), T(1.0), stream); - raft::linalg::rowNorm(xn, x, params.k, params.m, raft::linalg::L2Norm, true, stream); - raft::linalg::rowNorm(yn, y, params.k, params.n, raft::linalg::L2Norm, true, stream); - raft::distance::initialize, int>( - handle, out, params.m, std::numeric_limits::max(), op); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - dealloc(x, params.m * params.k); - dealloc(y, params.n * params.k); - dealloc(xn, params.m); - dealloc(yn, params.n); - dealloc(out, params.m); - dealloc(workspace, params.m); - } - - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - // it is enough to only benchmark the L2-squared metric - raft::distance::fusedL2NN, int>(out, - x, - y, - xn, - yn, - params.m, - params.n, - params.k, - (void*)workspace, - op, - pairRedOp, - false, - false, - stream); - }); - } - - private: - FLNParams params; - T *x, *y, *xn, *yn; - cub::KeyValuePair* out; - int* workspace; - raft::distance::KVPMinReduce pairRedOp; - raft::distance::MinAndDistanceReduceOp op; -}; // struct FusedL2NN - -static std::vector getInputs() -{ - return { - {32, 16384, 16384}, {64, 16384, 16384}, {128, 16384, 16384}, {256, 16384, 16384}, - {512, 16384, 16384}, {1024, 16384, 16384}, {16384, 32, 16384}, {16384, 64, 16384}, - {16384, 128, 16384}, {16384, 256, 16384}, {16384, 512, 16384}, {16384, 1024, 16384}, - {16384, 16384, 32}, {16384, 16384, 64}, {16384, 16384, 128}, {16384, 16384, 256}, - {16384, 16384, 512}, {16384, 16384, 1024}, {16384, 16384, 16384}, - }; -} - -ML_BENCH_REGISTER(FLNParams, FusedL2NN, "", getInputs()); -ML_BENCH_REGISTER(FLNParams, FusedL2NN, "", getInputs()); - -} // namespace Distance -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/make_blobs.cu b/cpp/bench/prims/make_blobs.cu deleted file mode 100644 index 6b3beac598..0000000000 --- a/cpp/bench/prims/make_blobs.cu +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include - -namespace MLCommon { -namespace Bench { -namespace Random { - -struct Params { - int rows, cols, clusters; - bool row_major; -}; // struct Params - -template -struct MakeBlobs : public Fixture { - MakeBlobs(const std::string& name, const Params& p) - : Fixture(name), params(p), data(0, stream), labels(0, stream) - { - } - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - data.resize(params.rows * params.cols, stream); - labels.resize(params.rows, stream); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - data.release(); - labels.release(); - } - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - raft::random::make_blobs(data.data(), - labels.data(), - params.rows, - params.cols, - params.clusters, - this->stream, - params.row_major); - }); - } - - private: - Params params; - rmm::device_uvector data; - rmm::device_uvector labels; -}; // struct MakeBlobs - -static std::vector getInputs() -{ - std::vector out; - Params p; - for (auto rows : std::vector{100000, 1000000}) { - for (auto cols : std::vector{10, 100}) { - for (auto clusters : std::vector{2, 10, 100}) { - p.rows = rows; - p.cols = cols; - p.clusters = clusters; - p.row_major = true; - out.push_back(p); - p.row_major = false; - out.push_back(p); - } - } - } - return out; -} - -ML_BENCH_REGISTER(Params, MakeBlobs, "", getInputs()); -ML_BENCH_REGISTER(Params, MakeBlobs, "", getInputs()); - -} // namespace Random -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/map_then_reduce.cu b/cpp/bench/prims/map_then_reduce.cu deleted file mode 100644 index cb0c173750..0000000000 --- a/cpp/bench/prims/map_then_reduce.cu +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include - -namespace MLCommon { -namespace Bench { -namespace LinAlg { - -struct Params { - int len; -}; - -template -struct Identity { - HDI Type operator()(Type a) { return a; } -}; - -template -struct MapThenReduce : public Fixture { - MapThenReduce(const std::string& name, const Params& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - alloc(in, params.len, true); - alloc(out, 1, true); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - dealloc(in, params.len); - dealloc(out, 1); - } - - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - raft::linalg::mapThenSumReduce(out, params.len, Identity(), stream, in); - }); - } - - private: - Params params; - T *out, *in; -}; // struct MapThenReduce - -static std::vector getInputs() -{ - return { - {1024 * 1024}, - {32 * 1024 * 1024}, - {1024 * 1024 * 1024}, - {1024 * 1024 + 2}, - {32 * 1024 * 1024 + 2}, - {1024 * 1024 * 1024 + 2}, - {1024 * 1024 + 1}, - {32 * 1024 * 1024 + 1}, - {1024 * 1024 * 1024 + 1}, - }; -} - -ML_BENCH_REGISTER(Params, MapThenReduce, "", getInputs()); -ML_BENCH_REGISTER(Params, MapThenReduce, "", getInputs()); - -} // namespace LinAlg -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/matrix_vector_op.cu b/cpp/bench/prims/matrix_vector_op.cu deleted file mode 100644 index 168cd1a45d..0000000000 --- a/cpp/bench/prims/matrix_vector_op.cu +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include - -namespace MLCommon { -namespace Bench { -namespace LinAlg { - -struct Params { - int rows, cols; - bool rowMajor, bcastAlongRows; -}; // struct Params - -template -struct MatVecOp : public Fixture { - MatVecOp(const std::string& name, const Params& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - alloc(out, params.rows * params.cols, true); - alloc(in, params.rows * params.cols, true); - auto vecLen = params.bcastAlongRows ? params.cols : params.rows; - alloc(vec, vecLen, true); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - dealloc(out, params.rows * params.cols); - dealloc(in, params.rows * params.cols); - auto vecLen = params.bcastAlongRows ? params.cols : params.rows; - dealloc(vec, vecLen); - } - - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - raft::linalg::matrixVectorOp(out, - in, - vec, - params.cols, - params.rows, - params.rowMajor, - params.bcastAlongRows, - raft::Sum(), - stream); - }); - } - - private: - Params params; - T *out, *in, *vec; -}; // struct MatVecOp - -static std::vector getInputs() -{ - return { - {1024, 128, true, true}, {1024 * 1024, 128, true, true}, - {1024, 128 + 2, true, true}, {1024 * 1024, 128 + 2, true, true}, - {1024, 128 + 1, true, true}, {1024 * 1024, 128 + 1, true, true}, - - {1024, 128, true, false}, {1024 * 1024, 128, true, false}, - {1024, 128 + 2, true, false}, {1024 * 1024, 128 + 2, true, false}, - {1024, 128 + 1, true, false}, {1024 * 1024, 128 + 1, true, false}, - - {1024, 128, false, false}, {1024 * 1024, 128, false, false}, - {1024, 128 + 2, false, false}, {1024 * 1024, 128 + 2, false, false}, - {1024, 128 + 1, false, false}, {1024 * 1024, 128 + 1, false, false}, - - {1024, 128, false, true}, {1024 * 1024, 128, false, true}, - {1024, 128 + 2, false, true}, {1024 * 1024, 128 + 2, false, true}, - {1024, 128 + 1, false, true}, {1024 * 1024, 128 + 1, false, true}, - }; -} - -ML_BENCH_REGISTER(Params, MatVecOp, "", getInputs()); -ML_BENCH_REGISTER(Params, MatVecOp, "", getInputs()); - -} // namespace LinAlg -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/permute.cu b/cpp/bench/prims/permute.cu deleted file mode 100644 index 50888a5688..0000000000 --- a/cpp/bench/prims/permute.cu +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include -#include -#include - -namespace MLCommon { -namespace Bench { -namespace Random { - -struct Params { - int rows, cols; - bool needPerms, needShuffle, rowMajor; -}; // struct Params - -template -struct Permute : public Fixture { - Permute(const std::string& name, const Params& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - auto matLen = params.rows * params.cols; - auto vecLen = params.rows; - if (params.needPerms) { - alloc(perms, vecLen); - } else { - perms = nullptr; - } - raft::random::Rng r(123456ULL); - if (params.needShuffle) { - alloc(out, matLen); - alloc(in, matLen); - r.uniform(in, vecLen, T(-1.0), T(1.0), stream); - } else { - out = in = nullptr; - } - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - auto matLen = params.rows * params.cols; - auto vecLen = params.rows; - if (params.needShuffle) { - dealloc(out, matLen); - dealloc(in, matLen); - } - if (params.needPerms) { dealloc(perms, vecLen); } - } - - void runBenchmark(::benchmark::State& state) override - { - raft::random::Rng r(123456ULL); - loopOnState(state, [this, &r]() { - raft::random::permute(perms, out, in, params.cols, params.rows, params.rowMajor, stream); - }); - } - - private: - Params params; - T *out, *in; - int* perms; -}; // struct Permute - -static std::vector getInputs() -{ - return { - {32 * 1024, 128, true, true, true}, - {1024 * 1024, 128, true, true, true}, - {32 * 1024, 128 + 2, true, true, true}, - {1024 * 1024, 128 + 2, true, true, true}, - {32 * 1024, 128 + 1, true, true, true}, - {1024 * 1024, 128 + 1, true, true, true}, - - {32 * 1024, 128, true, true, false}, - {1024 * 1024, 128, true, true, false}, - {32 * 1024, 128 + 2, true, true, false}, - {1024 * 1024, 128 + 2, true, true, false}, - {32 * 1024, 128 + 1, true, true, false}, - {1024 * 1024, 128 + 1, true, true, false}, - }; -} - -ML_BENCH_REGISTER(Params, Permute, "", getInputs()); -ML_BENCH_REGISTER(Params, Permute, "", getInputs()); - -} // namespace Random -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/reduce.cu b/cpp/bench/prims/reduce.cu deleted file mode 100644 index f6df432dcf..0000000000 --- a/cpp/bench/prims/reduce.cu +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include - -namespace MLCommon { -namespace Bench { -namespace LinAlg { - -struct Params { - int rows, cols; - bool alongRows; -}; // struct Params - -template -struct Reduce : public Fixture { - Reduce(const std::string& name, const Params& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override - { - alloc(data, params.rows * params.cols, true); - alloc(dots, params.rows, true); - } - - void deallocateBuffers(const ::benchmark::State& state) override - { - dealloc(data, params.rows * params.cols); - dealloc(dots, params.rows); - } - - void runBenchmark(::benchmark::State& state) override - { - loopOnState(state, [this]() { - raft::linalg::reduce( - dots, data, params.cols, params.rows, T(0.f), true, params.alongRows, stream); - }); - } - - private: - Params params; - T *data, *dots; -}; // struct Reduce - -static std::vector getInputs() -{ - return { - {8 * 1024, 1024, false}, - {1024, 8 * 1024, false}, - {8 * 1024, 8 * 1024, false}, - {32 * 1024, 1024, false}, - {1024, 32 * 1024, false}, - {32 * 1024, 32 * 1024, false}, - - {8 * 1024, 1024, true}, - {1024, 8 * 1024, true}, - {8 * 1024, 8 * 1024, true}, - {32 * 1024, 1024, true}, - {1024, 32 * 1024, true}, - {32 * 1024, 32 * 1024, true}, - }; -} - -ML_BENCH_REGISTER(Params, Reduce, "", getInputs()); -ML_BENCH_REGISTER(Params, Reduce, "", getInputs()); - -} // namespace LinAlg -} // namespace Bench -} // namespace MLCommon diff --git a/cpp/bench/prims/rng.cu b/cpp/bench/prims/rng.cu deleted file mode 100644 index b8135198cf..0000000000 --- a/cpp/bench/prims/rng.cu +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2019-2022, 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. - */ - -#include -#include -#include - -namespace MLCommon { -namespace Bench { -namespace Random { - -enum RandomType { - RNG_Normal, - RNG_LogNormal, - RNG_Uniform, - RNG_Gumbel, - RNG_Logistic, - RNG_Exp, - RNG_Rayleigh, - RNG_Laplace, - RNG_Fill -}; // enum RandomType - -template -struct Params { - int len; - RandomType type; - raft::random::GeneratorType gtype; - T start, end; -}; // struct Params - -template -struct RngBench : public Fixture { - RngBench(const std::string& name, const Params& p) : Fixture(name), params(p) {} - - protected: - void allocateBuffers(const ::benchmark::State& state) override { alloc(ptr, params.len); } - - void deallocateBuffers(const ::benchmark::State& state) override { dealloc(ptr, params.len); } - - void runBenchmark(::benchmark::State& state) override - { - raft::random::Rng r(123456ULL, params.gtype); - loopOnState(state, [this, &r]() { - switch (params.type) { - case RNG_Normal: r.normal(ptr, params.len, params.start, params.end, stream); break; - case RNG_LogNormal: r.lognormal(ptr, params.len, params.start, params.end, stream); break; - case RNG_Uniform: r.uniform(ptr, params.len, params.start, params.end, stream); break; - case RNG_Gumbel: r.gumbel(ptr, params.len, params.start, params.end, stream); break; - case RNG_Logistic: r.logistic(ptr, params.len, params.start, params.end, stream); break; - case RNG_Exp: r.exponential(ptr, params.len, params.start, stream); break; - case RNG_Rayleigh: r.rayleigh(ptr, params.len, params.start, stream); break; - case RNG_Laplace: r.laplace(ptr, params.len, params.start, params.end, stream); break; - case RNG_Fill: r.fill(ptr, params.len, params.start, stream); break; - }; - }); - } - - private: - Params params; - T* ptr; -}; // struct RngBench - -template -static std::vector> getInputs() -{ - using namespace raft::random; - return { - {1024 * 1024, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 + 2, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 2, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 2, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 + 1, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 1, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 1, RNG_Uniform, GenPhilox, T(-1.0), T(1.0)}, - - {1024 * 1024, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {32 * 1024 * 1024, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {1024 * 1024 + 2, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 2, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 2, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {1024 * 1024 + 1, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 1, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 1, RNG_Uniform, GenPC, T(-1.0), T(1.0)}, - - {1024 * 1024, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 + 2, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 2, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 2, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 + 1, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {32 * 1024 * 1024 + 1, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - {1024 * 1024 * 1024 + 1, RNG_Fill, GenPhilox, T(-1.0), T(1.0)}, - }; -} - -ML_BENCH_REGISTER(Params, RngBench, "", getInputs()); -ML_BENCH_REGISTER(Params, RngBench, "", getInputs()); - -} // namespace Random -} // namespace Bench -} // namespace MLCommon