Skip to content

Commit

Permalink
Fix building cuml with CCCL main (#5886)
Browse files Browse the repository at this point in the history
Similar to rapidsai/cudf#15552, we are testing [building RAPIDS with CCCL's main branch](NVIDIA/cccl#1667) to get ahead of any breaking changes.

Authors:
  - Paul Taylor (https://github.com/trxcllnt)
  - Dante Gama Dessavre (https://github.com/dantegd)

Approvers:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #5886
  • Loading branch information
trxcllnt authored May 29, 2024
1 parent 326b049 commit 92f5830
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ FROM ${BASE} as pip-base

ENV DEFAULT_VIRTUAL_ENV=rapids

RUN apt update -y \
&& DEBIAN_FRONTEND=noninteractive apt install -y \
libblas-dev liblapack-dev \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/*;

FROM ${BASE} as conda-base

ENV DEFAULT_CONDA_ENV=rapids
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.8-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"runArgs": [
"--rm",
"--name",
"${localEnv:USER}-rapids-${localWorkspaceFolderBasename}-24.06-cuda11.8-conda"
"${localEnv:USER:anon}-rapids-${localWorkspaceFolderBasename}-24.06-cuda11.8-conda"
],
"hostRequirements": {"gpu": "optional"},
"features": {
Expand Down
8 changes: 2 additions & 6 deletions .devcontainer/cuda11.8-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@
"args": {
"CUDA": "11.8",
"PYTHON_PACKAGE_MANAGER": "pip",
"BASE": "rapidsai/devcontainers:24.06-cpp-cuda11.8-ubuntu22.04"
"BASE": "rapidsai/devcontainers:24.06-cpp-cuda11.8-ucx1.15.0-openmpi-ubuntu22.04"
}
},
"runArgs": [
"--rm",
"--name",
"${localEnv:USER}-rapids-${localWorkspaceFolderBasename}-24.06-cuda11.8-pip"
"${localEnv:USER:anon}-rapids-${localWorkspaceFolderBasename}-24.06-cuda11.8-pip"
],
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/ucx:24.6": {
"version": "1.15.0"
},
"ghcr.io/rapidsai/devcontainers/features/cuda:24.6": {
"version": "11.8",
"installcuBLAS": true,
Expand All @@ -28,7 +25,6 @@
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/ucx",
"ghcr.io/rapidsai/devcontainers/features/cuda",
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
],
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.2-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"runArgs": [
"--rm",
"--name",
"${localEnv:USER}-rapids-${localWorkspaceFolderBasename}-24.06-cuda12.2-conda"
"${localEnv:USER:anon}-rapids-${localWorkspaceFolderBasename}-24.06-cuda12.2-conda"
],
"hostRequirements": {"gpu": "optional"},
"features": {
Expand Down
8 changes: 2 additions & 6 deletions .devcontainer/cuda12.2-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@
"args": {
"CUDA": "12.2",
"PYTHON_PACKAGE_MANAGER": "pip",
"BASE": "rapidsai/devcontainers:24.06-cpp-cuda12.2-ubuntu22.04"
"BASE": "rapidsai/devcontainers:24.06-cpp-cuda12.2-ucx1.15.0-openmpi-ubuntu22.04"
}
},
"runArgs": [
"--rm",
"--name",
"${localEnv:USER}-rapids-${localWorkspaceFolderBasename}-24.06-cuda12.2-pip"
"${localEnv:USER:anon}-rapids-${localWorkspaceFolderBasename}-24.06-cuda12.2-pip"
],
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/ucx:24.6": {
"version": "1.15.0"
},
"ghcr.io/rapidsai/devcontainers/features/cuda:24.6": {
"version": "12.2",
"installcuBLAS": true,
Expand All @@ -28,7 +25,6 @@
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/ucx",
"ghcr.io/rapidsai/devcontainers/features/cuda",
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
],
Expand Down
6 changes: 5 additions & 1 deletion cpp/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,6 +61,10 @@ if(BUILD_CUML_BENCH)
set_target_properties(
${CUML_CPP_BENCH_TARGET}
PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
)

install(
Expand Down
6 changes: 3 additions & 3 deletions cpp/cmake/modules/ConfigureCUDA.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2018-2022, NVIDIA CORPORATION.
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,8 +31,8 @@ endif()
list(APPEND CUML_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations,-Wno-error=sign-compare)

if(DISABLE_DEPRECATION_WARNINGS)
list(APPEND CUML_CXX_FLAGS -Wno-deprecated-declarations)
list(APPEND CUML_CUDA_FLAGS -Wno-deprecated-declarations -Xcompiler=-Wno-deprecated-declarations)
list(APPEND CUML_CXX_FLAGS -Wno-deprecated-declarations -DRAFT_HIDE_DEPRECATION_WARNINGS)
list(APPEND CUML_CUDA_FLAGS -Wno-deprecated-declarations -Xcompiler=-Wno-deprecated-declarations -DRAFT_HIDE_DEPRECATION_WARNINGS)
endif()

# make sure we produce smallest binary size
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arima/batched_arima.cu
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct is_missing {
typedef T argument_type;
typedef T result_type;

__thrust_exec_check_disable__ __device__ const T operator()(const T& x) const { return isnan(x); }
__device__ const T operator()(const T& x) const { return isnan(x); }
}; // end is_missing

bool detect_missing(raft::handle_t& handle, const double* d_y, int n_elem)
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/hdbscan/condensed_hierarchy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <rmm/exec_policy.hpp>

#include <cub/cub.cuh>
#include <cuda/functional>
#include <thrust/copy.h>
#include <thrust/device_ptr.h>
#include <thrust/execution_policy.h>
Expand Down Expand Up @@ -156,7 +157,7 @@ void CondensedHierarchy<value_idx, value_t>::condense(value_idx* full_parents,
thrust::cuda::par.on(stream),
full_sizes,
full_sizes + size,
[=] __device__(value_idx a) { return a != -1; },
cuda::proclaim_return_type<bool>([=] __device__(value_idx a) -> bool { return a != -1; }),
0,
thrust::plus<value_idx>());

Expand Down
15 changes: 8 additions & 7 deletions cpp/src/hdbscan/detail/select.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,14 @@ void excess_of_mass(const raft::handle_t& handle,
value_t subtree_stability = 0.0;

if (indptr_h[node + 1] - indptr_h[node] > 0) {
subtree_stability = thrust::transform_reduce(
exec_policy,
children + indptr_h[node],
children + indptr_h[node + 1],
[=] __device__(value_idx a) { return stability[a]; },
0.0,
thrust::plus<value_t>());
subtree_stability =
thrust::transform_reduce(exec_policy,
children + indptr_h[node],
children + indptr_h[node + 1],
cuda::proclaim_return_type<value_t>(
[=] __device__(value_idx a) -> value_t { return stability[a]; }),
0.0,
thrust::plus<value_t>());
}

if (subtree_stability > node_stability || cluster_sizes_h[node] > max_cluster_size) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/hdbscan/detail/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Common::CondensedHierarchy<value_idx, value_t> make_cluster_tree(
thrust_policy,
sizes,
sizes + condensed_tree.get_n_edges(),
[=] __device__(value_idx a) { return a > 1; },
cuda::proclaim_return_type<bool>([=] __device__(value_idx a) -> bool { return a > 1; }),
0,
thrust::plus<value_idx>());

Expand Down
4 changes: 3 additions & 1 deletion cpp/src/tsne/distances.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

#include <cuda/functional>
#include <thrust/functional.h>
#include <thrust/transform_reduce.h>

Expand Down Expand Up @@ -162,7 +163,8 @@ void get_distances(const raft::handle_t& handle,
template <typename value_t>
void normalize_distances(value_t* distances, const size_t total_nn, cudaStream_t stream)
{
auto abs_f = [] __device__(const value_t& x) { return abs(x); };
auto abs_f = cuda::proclaim_return_type<value_t>(
[] __device__(const value_t& x) -> value_t { return abs(x); });
value_t maxNorm = thrust::transform_reduce(rmm::exec_policy(stream),
distances,
distances + total_nn,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/tsne/utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <sys/time.h>
#include <unistd.h>

#include <cfloat>
#include <chrono>
#include <iostream>

Expand Down
4 changes: 4 additions & 0 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ function(ConfigureTest)
set_target_properties(
${_CUML_TEST_NAME}
PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
)

set(_CUML_TEST_COMPONENT_NAME testing)
Expand Down

0 comments on commit 92f5830

Please sign in to comment.