Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,13 @@ if(BUILD_CUML_CPP_LIBRARY)
INTERFACE_POSITION_INDEPENDENT_CODE ON
)

set_target_properties(
cuml_objs
PROPERTIES CXX_VISIBILITY_PRESET hidden
CUDA_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)

target_compile_definitions(cuml_objs PUBLIC DISABLE_CUSPARSE_DEPRECATED)

target_compile_options(
Expand Down
3 changes: 2 additions & 1 deletion cpp/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,8 @@ EXCLUDE_SYMLINKS = NO
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = columnWiseSort.cuh \
smoblocksolve.h
smoblocksolve.h \
export.hpp

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand Down
5 changes: 3 additions & 2 deletions cpp/bench/sg/svr.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -57,7 +57,8 @@ class SVR : public RegressionFixture<D> {
this->data.y.data(),
this->svm_param,
this->kernel,
*(this->model));
*(this->model),
static_cast<D*>(nullptr));
this->handle->sync_stream(this->stream);
ML::SVM::svmFreeBuffers(*this->handle, *(this->model));
});
Expand Down
7 changes: 4 additions & 3 deletions cpp/include/cuml/cluster/dbscan.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2018-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/distance_type.hpp>
#include <cuml/common/export.hpp>
#include <cuml/common/logger.hpp>

#include <cstddef>
Expand All @@ -15,7 +16,7 @@ namespace raft {
class handle_t;
}

namespace ML {
namespace CUML_EXPORT ML {
namespace Dbscan {

enum EpsNnMethod { BRUTE_FORCE, RBC };
Expand Down Expand Up @@ -110,4 +111,4 @@ void fit(const raft::handle_t& handle,
/** @} */

} // namespace Dbscan
} // namespace ML
} // namespace CUML_EXPORT ML
7 changes: 4 additions & 3 deletions cpp/include/cuml/cluster/hdbscan.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/distance_type.hpp>
#include <cuml/common/export.hpp>

#include <raft/core/handle.hpp>

#include <rmm/device_uvector.hpp>

#include <cstddef>

namespace ML {
namespace CUML_EXPORT ML {
namespace HDBSCAN {
namespace Common {

Expand Down Expand Up @@ -573,4 +574,4 @@ void compute_inverse_label_map(const raft::handle_t& handle,
float cluster_selection_epsilon);

} // namespace HDBSCAN::HELPER
} // END namespace ML
} // END namespace CUML_EXPORT ML
7 changes: 4 additions & 3 deletions cpp/include/cuml/cluster/kmeans.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/cluster/kmeans_params.hpp>
#include <cuml/common/export.hpp>

namespace raft {
class handle_t;
}

namespace ML {
namespace CUML_EXPORT ML {

namespace kmeans {

Expand Down Expand Up @@ -188,4 +189,4 @@ void transform(const raft::handle_t& handle,
int64_t n_features,
double* X_new);
}; // end namespace kmeans
}; // end namespace ML
}; // end namespace CUML_EXPORT ML
8 changes: 5 additions & 3 deletions cpp/include/cuml/cluster/kmeans_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

#pragma once

#include <cuml/common/distance_type.hpp>
#include <cuml/common/export.hpp>

#include <raft/random/rng_state.hpp>

Expand All @@ -17,7 +17,8 @@ struct params;

} // end namespace cuvs::cluster::kmeans

namespace ML::kmeans {
namespace CUML_EXPORT ML {
namespace kmeans {

struct KMeansParams {
enum class InitMethod { KMeansPlusPlus, Random, Array };
Expand All @@ -36,4 +37,5 @@ struct KMeansParams {
cuvs::cluster::kmeans::params to_cuvs() const;
};

} // end namespace ML::kmeans
} // end namespace kmeans
} // end namespace CUML_EXPORT ML
7 changes: 4 additions & 3 deletions cpp/include/cuml/cluster/linkage.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2018-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/distance_type.hpp>
#include <cuml/common/export.hpp>

#include <raft/core/handle.hpp>

namespace ML {
namespace CUML_EXPORT ML {
namespace linkage {

/**
Expand Down Expand Up @@ -43,4 +44,4 @@ void single_linkage(const raft::handle_t& handle,
int c = 15);

}; // namespace linkage
}; // namespace ML
}; // namespace CUML_EXPORT ML
8 changes: 5 additions & 3 deletions cpp/include/cuml/cluster/spectral_clustering.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#include <cuml/common/export.hpp>

#include <raft/core/device_coo_matrix.hpp>
#include <raft/core/device_mdspan.hpp>
#include <raft/core/resources.hpp>

namespace ML {
namespace CUML_EXPORT ML {
namespace SpectralClustering {

/**
Expand Down Expand Up @@ -76,4 +78,4 @@ void fit_predict(raft::resources const& handle,
raft::device_vector_view<int, int> labels);

} // namespace SpectralClustering
} // namespace ML
} // namespace CUML_EXPORT ML
8 changes: 5 additions & 3 deletions cpp/include/cuml/common/callback.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2021, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/export.hpp>

#include <type_traits>

namespace ML {
namespace CUML_EXPORT ML {
namespace Internals {

class Callback {
Expand Down Expand Up @@ -36,4 +38,4 @@ class GraphBasedDimRedCallback : public Callback {
};

} // namespace Internals
} // namespace ML
} // namespace CUML_EXPORT ML
10 changes: 7 additions & 3 deletions cpp/include/cuml/common/distance_type.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

namespace ML::distance {
#include <cuml/common/export.hpp>

namespace CUML_EXPORT ML {
namespace distance {

enum class DistanceType {
L2Expanded = 0,
Expand All @@ -32,4 +35,5 @@ enum class DistanceType {
Precomputed = 100
};

} // end namespace ML::distance
} // end namespace distance
} // end namespace CUML_EXPORT ML
14 changes: 14 additions & 0 deletions cpp/include/cuml/common/export.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#if (defined(__GNUC__) && !defined(__MINGW32__) && !defined(__MINGW64__))
#define CUML_EXPORT __attribute__((visibility("default")))
#define CUML_HIDDEN __attribute__((visibility("hidden")))
Comment thread
vyasr marked this conversation as resolved.
#else
#define CUML_EXPORT
#define CUML_HIDDEN
#endif
7 changes: 4 additions & 3 deletions cpp/include/cuml/common/logger.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/export.hpp>
#include <cuml/common/logger_macros.hpp>

#include <rapids_logger/logger.hpp>

namespace ML {
namespace CUML_EXPORT ML {

/**
* @brief Returns the default sink for the global logger.
Expand Down Expand Up @@ -51,4 +52,4 @@ inline rapids_logger::logger& default_logger()
return logger_;
}

} // namespace ML
} // namespace CUML_EXPORT ML
24 changes: 15 additions & 9 deletions cpp/include/cuml/common/pinned_host_vector.hpp
Comment thread
vyasr marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/export.hpp>

#include <rmm/mr/pinned_host_memory_resource.hpp>

namespace ML {
namespace CUML_EXPORT ML {

template <typename T>
class pinned_host_vector {
public:
pinned_host_vector() = default;
pinned_host_vector() : data_{nullptr}, size_{0} {}

explicit pinned_host_vector(std::size_t n)
: size_{n}, data_{static_cast<T*>(pinned_mr.allocate_sync(n * sizeof(T)))}
{
std::uninitialized_fill(data_, data_ + n, static_cast<T>(0));
}
~pinned_host_vector() { pinned_mr.deallocate_sync(data_, size_ * sizeof(T)); }
~pinned_host_vector()
{
if (data_ != nullptr) { pinned_mr.deallocate_sync(data_, size_ * sizeof(T)); }
}

pinned_host_vector(pinned_host_vector const&) = delete;
pinned_host_vector(pinned_host_vector&&) = delete;
Expand All @@ -28,9 +33,10 @@ class pinned_host_vector {

void resize(std::size_t n)
{
if (data_ != nullptr) { pinned_mr.deallocate_sync(data_, size_ * sizeof(T)); }
size_ = n;
data_ = static_cast<T*>(pinned_mr.allocate_sync(n * sizeof(T)));
std::uninitialized_fill(data_, data_ + n, static_cast<T>(0));
data_ = (n == 0) ? nullptr : static_cast<T*>(pinned_mr.allocate_sync(n * sizeof(T)));
if (data_ != nullptr) { std::uninitialized_fill(data_, data_ + n, static_cast<T>(0)); }
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

T* data() { return data_; }
Expand All @@ -46,8 +52,8 @@ class pinned_host_vector {

private:
rmm::mr::pinned_host_memory_resource pinned_mr{};
T* data_;
std::size_t size_;
T* data_{nullptr};
std::size_t size_{0};
};

} // namespace ML
} // namespace CUML_EXPORT ML
3 changes: 2 additions & 1 deletion cpp/include/cuml/common/utils.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/export.hpp>
#include <cuml/common/logger.hpp>

#include <raft/core/error.hpp>
Expand Down
7 changes: 4 additions & 3 deletions cpp/include/cuml/datasets/make_arima.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2020-2021, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <cuml/common/export.hpp>
#include <cuml/tsa/arima_common.h>

namespace raft {
class handle_t;
}

namespace ML {
namespace CUML_EXPORT ML {
namespace Datasets {

/**
Expand Down Expand Up @@ -51,4 +52,4 @@ void make_arima(const raft::handle_t& handle,
/** @} */

} // namespace Datasets
} // namespace ML
} // namespace CUML_EXPORT ML
Loading
Loading