Skip to content

Commit

Permalink
Support compilation with Thrust 1.15 (#4469)
Browse files Browse the repository at this point in the history
The following changes are required for compilation with Thrust 1.15, which is becoming the minimum required version across all of RAPIDS for 22.02.

The changes needed:
- Removal of global `using namespace std`. This makes calls to `cub::` ambigous as now thrust::cub ( new since 1.14? ) and cub both are valid.
- Updates from #4334, which fixes `cub::DeviceSegmentedReduce` signature changes

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

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

URL: #4469
  • Loading branch information
robertmaynard authored Jan 12, 2022
1 parent 416ce61 commit f5556ba
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 27 deletions.
6 changes: 1 addition & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
# Copyright (c) 2018-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.
Expand Down Expand Up @@ -189,10 +189,6 @@ endif()
# add third party dependencies using CPM
rapids_cpm_init()

message(STATUS "CUML: Overriding thrust settings to set alwas_download.")
include(${rapids-cmake-dir}/cpm/package_override.cmake)
rapids_cpm_package_override(${CMAKE_CURRENT_SOURCE_DIR}/cmake/override_cpm.json)

include(cmake/thirdparty/get_thrust.cmake)
include(cmake/thirdparty/get_rmm.cmake)

Expand Down
11 changes: 0 additions & 11 deletions cpp/cmake/override_cpm.json

This file was deleted.

6 changes: 3 additions & 3 deletions cpp/src/dbscan/adjgraph/algo.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION.
* Copyright (c) 2018-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.
Expand All @@ -25,8 +25,6 @@
#include <raft/cuda_utils.cuh>
#include <raft/sparse/convert/csr.hpp>

using namespace thrust;

namespace ML {
namespace Dbscan {
namespace AdjGraph {
Expand All @@ -44,6 +42,8 @@ void launcher(const raft::handle_t& handle,
Index_ batch_size,
cudaStream_t stream)
{
using namespace thrust;

device_ptr<Index_> dev_vd = device_pointer_cast(data.vd);
device_ptr<Index_> dev_ex_scan = device_pointer_cast(data.ex_scan);

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/dbscan/adjgraph/runner.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION.
* Copyright (c) 2018-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.
Expand Down Expand Up @@ -46,4 +46,4 @@ void run(const raft::handle_t& handle,

} // namespace AdjGraph
} // namespace Dbscan
} // namespace ML
} // namespace ML
6 changes: 3 additions & 3 deletions cpp/src/hdbscan/detail/membership.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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.
Expand Down Expand Up @@ -80,7 +80,7 @@ void get_probabilities(const raft::handle_t& handle,
n_clusters,
sorted_parents_offsets.data(),
stream,
cub::DeviceSegmentedReduce::Max<const value_t*, value_t*, const value_idx*>);
cub::DeviceSegmentedReduce::Max<const value_t*, value_t*, const value_idx*, const value_idx*>);

// Calculate probability per point
thrust::fill(exec_policy, probabilities, probabilities + n_leaves, 0.0f);
Expand All @@ -96,4 +96,4 @@ void get_probabilities(const raft::handle_t& handle,
}; // namespace Membership
}; // namespace detail
}; // namespace HDBSCAN
}; // namespace ML
}; // namespace ML
6 changes: 3 additions & 3 deletions cpp/src/hdbscan/detail/stabilities.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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.
Expand Down Expand Up @@ -102,7 +102,7 @@ void compute_stabilities(const raft::handle_t& handle,
n_clusters - 1,
sorted_parents_offsets.data() + 1,
stream,
cub::DeviceSegmentedReduce::Min<const value_t*, value_t*, const value_idx*>);
cub::DeviceSegmentedReduce::Min<const value_t*, value_t*, const value_idx*, const value_idx*>);
// finally, we find minimum between initialized births where parent=child
// and births of parents for their childrens
auto births_zip =
Expand Down Expand Up @@ -193,4 +193,4 @@ void get_stability_scores(const raft::handle_t& handle,
}; // namespace Stability
}; // namespace detail
}; // namespace HDBSCAN
}; // namespace ML
}; // namespace ML

0 comments on commit f5556ba

Please sign in to comment.