Skip to content

Commit

Permalink
exclude unitialized warning, use right types
Browse files Browse the repository at this point in the history
  • Loading branch information
divyegala committed Jan 14, 2025
1 parent f0cfa33 commit ddd33a2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
19 changes: 19 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,25 @@ if(BUILD_CUML_CPP_LIBRARY)
src/hdbscan/hdbscan.cu
src/hdbscan/condensed_hierarchy.cu
src/hdbscan/prediction_data.cu)

set_property(
SOURCE src/hdbscan/condensed_hierarchy.cu
APPEND_STRING
PROPERTY COMPILE_FLAGS
" -Xcompiler=-Wno-maybe-uninitialized"
)
set_property(
SOURCE src/hdbscan/hdbscan.cu
APPEND_STRING
PROPERTY COMPILE_FLAGS
" -Xcompiler=-Wno-maybe-uninitialized"
)
set_property(
SOURCE src/hdbscan/prediction_data.cu
APPEND_STRING
PROPERTY COMPILE_FLAGS
" -Xcompiler=-Wno-maybe-uninitialized"
)
endif()

if(all_algo OR holtwinters_algo)
Expand Down
8 changes: 5 additions & 3 deletions cpp/src/hdbscan/condensed_hierarchy.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, 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 @@ -27,6 +27,7 @@

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

parents.resize(n_edges, stream);
Expand Down
8 changes: 5 additions & 3 deletions cpp/src/hdbscan/detail/utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, 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 @@ -34,6 +34,7 @@
#include <rmm/exec_policy.hpp>

#include <cub/cub.cuh>
#include <cuda/functional>
#include <thrust/copy.h>
#include <thrust/execution_policy.h>
#include <thrust/for_each.h>
Expand Down Expand Up @@ -114,8 +115,9 @@ Common::CondensedHierarchy<value_idx, value_t> make_cluster_tree(
thrust_policy,
sizes,
sizes + condensed_tree.get_n_edges(),
cuda::proclaim_return_type<bool>([=] __device__(value_idx a) -> bool { return a > 1; }),
0,
cuda::proclaim_return_type<value_idx>(
[=] __device__(value_idx a) -> value_idx { return static_cast<value_idx>(a > 1); }),
static_cast<value_idx>(0),
thrust::plus<value_idx>());

// remove leaves from condensed tree
Expand Down
8 changes: 7 additions & 1 deletion cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
# Copyright (c) 2018-2025, 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 @@ -149,6 +149,12 @@ if("${CMAKE_CUDA_COMPILER_VERSION}" VERSION_GREATER_EQUAL "11.2")
# An HDBSCAN gtest is failing w/ CUDA 11.2 for some reason.
if(all_algo OR hdbscan_algo)
ConfigureTest(PREFIX SG NAME HDBSCAN_TEST sg/hdbscan_test.cu ML_INCLUDE)
set_property(
SOURCE sg/hdbscan_test.cu
APPEND_STRING
PROPERTY COMPILE_FLAGS
" -Xcompiler=-Wno-maybe-uninitialized"
)
endif()
endif()

Expand Down

0 comments on commit ddd33a2

Please sign in to comment.