diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f05dfad14b..a5aadd8fbb 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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( diff --git a/cpp/Doxyfile.in b/cpp/Doxyfile.in index b29f8ffca4..5486118f70 100644 --- a/cpp/Doxyfile.in +++ b/cpp/Doxyfile.in @@ -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 diff --git a/cpp/bench/sg/svr.cu b/cpp/bench/sg/svr.cu index ec0ef6033f..1db664945a 100644 --- a/cpp/bench/sg/svr.cu +++ b/cpp/bench/sg/svr.cu @@ -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 */ @@ -57,7 +57,8 @@ class SVR : public RegressionFixture { this->data.y.data(), this->svm_param, this->kernel, - *(this->model)); + *(this->model), + static_cast(nullptr)); this->handle->sync_stream(this->stream); ML::SVM::svmFreeBuffers(*this->handle, *(this->model)); }); diff --git a/cpp/include/cuml/cluster/dbscan.hpp b/cpp/include/cuml/cluster/dbscan.hpp index 6c0e7ccafb..9189fcd30a 100644 --- a/cpp/include/cuml/cluster/dbscan.hpp +++ b/cpp/include/cuml/cluster/dbscan.hpp @@ -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 +#include #include #include @@ -15,7 +16,7 @@ namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Dbscan { enum EpsNnMethod { BRUTE_FORCE, RBC }; @@ -110,4 +111,4 @@ void fit(const raft::handle_t& handle, /** @} */ } // namespace Dbscan -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/cluster/hdbscan.hpp b/cpp/include/cuml/cluster/hdbscan.hpp index 362a0e6877..dabaa2f572 100644 --- a/cpp/include/cuml/cluster/hdbscan.hpp +++ b/cpp/include/cuml/cluster/hdbscan.hpp @@ -1,11 +1,12 @@ /* - * 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 +#include #include @@ -13,7 +14,7 @@ #include -namespace ML { +namespace CUML_EXPORT ML { namespace HDBSCAN { namespace Common { @@ -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 diff --git a/cpp/include/cuml/cluster/kmeans.hpp b/cpp/include/cuml/cluster/kmeans.hpp index 0a7eed0c42..ada51ffc9b 100644 --- a/cpp/include/cuml/cluster/kmeans.hpp +++ b/cpp/include/cuml/cluster/kmeans.hpp @@ -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 +#include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace kmeans { @@ -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 diff --git a/cpp/include/cuml/cluster/kmeans_params.hpp b/cpp/include/cuml/cluster/kmeans_params.hpp index fc653b31b1..5ee03a660b 100644 --- a/cpp/include/cuml/cluster/kmeans_params.hpp +++ b/cpp/include/cuml/cluster/kmeans_params.hpp @@ -4,8 +4,8 @@ */ #pragma once - #include +#include #include @@ -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 }; @@ -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 diff --git a/cpp/include/cuml/cluster/linkage.hpp b/cpp/include/cuml/cluster/linkage.hpp index bb7695a7a7..ec89cd07c4 100644 --- a/cpp/include/cuml/cluster/linkage.hpp +++ b/cpp/include/cuml/cluster/linkage.hpp @@ -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 +#include #include -namespace ML { +namespace CUML_EXPORT ML { namespace linkage { /** @@ -43,4 +44,4 @@ void single_linkage(const raft::handle_t& handle, int c = 15); }; // namespace linkage -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/cluster/spectral_clustering.hpp b/cpp/include/cuml/cluster/spectral_clustering.hpp index b105368629..76785cd38b 100644 --- a/cpp/include/cuml/cluster/spectral_clustering.hpp +++ b/cpp/include/cuml/cluster/spectral_clustering.hpp @@ -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 + #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace SpectralClustering { /** @@ -76,4 +78,4 @@ void fit_predict(raft::resources const& handle, raft::device_vector_view labels); } // namespace SpectralClustering -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/common/callback.hpp b/cpp/include/cuml/common/callback.hpp index 4487393248..41acb2dd49 100644 --- a/cpp/include/cuml/common/callback.hpp +++ b/cpp/include/cuml/common/callback.hpp @@ -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 + #include -namespace ML { +namespace CUML_EXPORT ML { namespace Internals { class Callback { @@ -36,4 +38,4 @@ class GraphBasedDimRedCallback : public Callback { }; } // namespace Internals -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/common/distance_type.hpp b/cpp/include/cuml/common/distance_type.hpp index beda1f05e8..5da0bf8798 100644 --- a/cpp/include/cuml/common/distance_type.hpp +++ b/cpp/include/cuml/common/distance_type.hpp @@ -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 + +namespace CUML_EXPORT ML { +namespace distance { enum class DistanceType { L2Expanded = 0, @@ -32,4 +35,5 @@ enum class DistanceType { Precomputed = 100 }; -} // end namespace ML::distance +} // end namespace distance +} // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/common/export.hpp b/cpp/include/cuml/common/export.hpp new file mode 100644 index 0000000000..26bcc4a272 --- /dev/null +++ b/cpp/include/cuml/common/export.hpp @@ -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"))) +#else +#define CUML_EXPORT +#define CUML_HIDDEN +#endif diff --git a/cpp/include/cuml/common/logger.hpp b/cpp/include/cuml/common/logger.hpp index cb902255f9..a3592758a1 100644 --- a/cpp/include/cuml/common/logger.hpp +++ b/cpp/include/cuml/common/logger.hpp @@ -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 #include #include -namespace ML { +namespace CUML_EXPORT ML { /** * @brief Returns the default sink for the global logger. @@ -51,4 +52,4 @@ inline rapids_logger::logger& default_logger() return logger_; } -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/common/pinned_host_vector.hpp b/cpp/include/cuml/common/pinned_host_vector.hpp index c2c2ef9cfb..a5f51dc36b 100644 --- a/cpp/include/cuml/common/pinned_host_vector.hpp +++ b/cpp/include/cuml/common/pinned_host_vector.hpp @@ -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 + #include -namespace ML { +namespace CUML_EXPORT ML { template 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(pinned_mr.allocate_sync(n * sizeof(T)))} { std::uninitialized_fill(data_, data_ + n, static_cast(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; @@ -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(pinned_mr.allocate_sync(n * sizeof(T))); - std::uninitialized_fill(data_, data_ + n, static_cast(0)); + data_ = (n == 0) ? nullptr : static_cast(pinned_mr.allocate_sync(n * sizeof(T))); + if (data_ != nullptr) { std::uninitialized_fill(data_, data_ + n, static_cast(0)); } } T* data() { return data_; } @@ -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 diff --git a/cpp/include/cuml/common/utils.hpp b/cpp/include/cuml/common/utils.hpp index 475780bd01..0f7e72b2cf 100644 --- a/cpp/include/cuml/common/utils.hpp +++ b/cpp/include/cuml/common/utils.hpp @@ -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 #include #include diff --git a/cpp/include/cuml/datasets/make_arima.hpp b/cpp/include/cuml/datasets/make_arima.hpp index 78a7475aa4..421043ce8e 100644 --- a/cpp/include/cuml/datasets/make_arima.hpp +++ b/cpp/include/cuml/datasets/make_arima.hpp @@ -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 #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Datasets { /** @@ -51,4 +52,4 @@ void make_arima(const raft::handle_t& handle, /** @} */ } // namespace Datasets -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/datasets/make_blobs.hpp b/cpp/include/cuml/datasets/make_blobs.hpp index 3d7fddae99..216cfc35bc 100644 --- a/cpp/include/cuml/datasets/make_blobs.hpp +++ b/cpp/include/cuml/datasets/make_blobs.hpp @@ -1,17 +1,19 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2022, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include + #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Datasets { /** @@ -105,4 +107,4 @@ void make_blobs(const raft::handle_t& handle, /** @} */ } // namespace Datasets -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/datasets/make_regression.hpp b/cpp/include/cuml/datasets/make_regression.hpp index 2cecb8a572..44f40eeec1 100644 --- a/cpp/include/cuml/datasets/make_regression.hpp +++ b/cpp/include/cuml/datasets/make_regression.hpp @@ -1,17 +1,19 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2022, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include + #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Datasets { /** @@ -105,4 +107,4 @@ void make_regression(const raft::handle_t& handle, uint64_t seed = 0ULL); } // namespace Datasets -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/decomposition/params.hpp b/cpp/include/cuml/decomposition/params.hpp index aec8e7a67a..6465059f13 100644 --- a/cpp/include/cuml/decomposition/params.hpp +++ b/cpp/include/cuml/decomposition/params.hpp @@ -5,11 +5,13 @@ #pragma once +#include + #include #include -namespace ML { +namespace CUML_EXPORT ML { using solver = raft::linalg::solver; using mg_solver = raft::linalg::solver; @@ -87,4 +89,4 @@ inline raft::linalg::paramsPCA to_raft_params(const paramsPCATemplate + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { void pcaFit(const raft::handle_t& handle, float* input, @@ -84,4 +86,4 @@ void pcaTransform(const raft::handle_t& handle, double* mu, const paramsPCA& prms); -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/decomposition/pca_mg.hpp b/cpp/include/cuml/decomposition/pca_mg.hpp index dae4bb69fa..aae0d0b4ff 100644 --- a/cpp/include/cuml/decomposition/pca_mg.hpp +++ b/cpp/include/cuml/decomposition/pca_mg.hpp @@ -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 */ @@ -7,10 +7,11 @@ #include "pca.hpp" +#include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace PCA { namespace opg { @@ -176,4 +177,4 @@ void inverse_transform(raft::handle_t& handle, }; // end namespace opg }; // end namespace PCA -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/decomposition/sign_flip_mg.hpp b/cpp/include/cuml/decomposition/sign_flip_mg.hpp index d33236755e..b5dd12252d 100644 --- a/cpp/include/cuml/decomposition/sign_flip_mg.hpp +++ b/cpp/include/cuml/decomposition/sign_flip_mg.hpp @@ -1,16 +1,17 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace PCA { namespace opg { @@ -81,4 +82,4 @@ void sign_flip(raft::handle_t& handle, }; // end namespace opg }; // end namespace PCA -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/decomposition/tsvd.hpp b/cpp/include/cuml/decomposition/tsvd.hpp index 333886d39c..2827ec7c3d 100644 --- a/cpp/include/cuml/decomposition/tsvd.hpp +++ b/cpp/include/cuml/decomposition/tsvd.hpp @@ -7,11 +7,13 @@ #include "params.hpp" +#include + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { void tsvdFit(const raft::handle_t& handle, float* input, @@ -64,4 +66,4 @@ void tsvdFitTransform(const raft::handle_t& handle, const paramsTSVD& prms, bool flip_signs_based_on_U); -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/decomposition/tsvd_mg.hpp b/cpp/include/cuml/decomposition/tsvd_mg.hpp index 43dc8084b9..91eb534e42 100644 --- a/cpp/include/cuml/decomposition/tsvd_mg.hpp +++ b/cpp/include/cuml/decomposition/tsvd_mg.hpp @@ -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 */ @@ -7,10 +7,11 @@ #include "tsvd.hpp" +#include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace TSVD { namespace opg { @@ -149,4 +150,4 @@ void inverse_transform(raft::handle_t& handle, }; // end namespace opg }; // namespace TSVD -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/ensemble/randomforest.hpp b/cpp/include/cuml/ensemble/randomforest.hpp index 19acd25edd..6d3f1c1164 100644 --- a/cpp/include/cuml/ensemble/randomforest.hpp +++ b/cpp/include/cuml/ensemble/randomforest.hpp @@ -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 #include #include #include @@ -16,7 +17,7 @@ namespace raft { class handle_t; // forward decl } -namespace ML { +namespace CUML_EXPORT ML { enum RF_type { CLASSIFICATION, @@ -281,4 +282,4 @@ RF_metrics score(const raft::handle_t& user_handle, int n_rows, const double* predictions, rapids_logger::level_enum verbosity = rapids_logger::level_enum::info); -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/explainer/kernel_shap.hpp b/cpp/include/cuml/explainer/kernel_shap.hpp index 98c75cb39b..ed30017a54 100644 --- a/cpp/include/cuml/explainer/kernel_shap.hpp +++ b/cpp/include/cuml/explainer/kernel_shap.hpp @@ -5,13 +5,15 @@ #pragma once +#include + #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Explainer { /** @@ -79,4 +81,4 @@ void kernel_dataset(const raft::handle_t& handle, uint64_t seed = 0ULL); } // namespace Explainer -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/explainer/permutation_shap.hpp b/cpp/include/cuml/explainer/permutation_shap.hpp index c7a801df7c..092d13daed 100644 --- a/cpp/include/cuml/explainer/permutation_shap.hpp +++ b/cpp/include/cuml/explainer/permutation_shap.hpp @@ -1,15 +1,17 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Explainer { /** @@ -131,4 +133,4 @@ void update_perm_shap_values(const raft::handle_t& handle, const int* idx); } // namespace Explainer -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/explainer/tree_shap.hpp b/cpp/include/cuml/explainer/tree_shap.hpp index dee0a3dc8d..173e5b3c05 100644 --- a/cpp/include/cuml/explainer/tree_shap.hpp +++ b/cpp/include/cuml/explainer/tree_shap.hpp @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include #include #include @@ -12,7 +13,7 @@ #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace Explainer { template @@ -57,4 +58,4 @@ void gpu_treeshap_taylor_interactions(TreePathHandle path_info, std::size_t out_preds_size); } // namespace Explainer -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/genetic/common.h b/cpp/include/cuml/genetic/common.h index 93d61e361d..b5da2178ee 100644 --- a/cpp/include/cuml/genetic/common.h +++ b/cpp/include/cuml/genetic/common.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -7,12 +7,14 @@ #include "node.h" +#include + #include #include #include #include -namespace cuml { +namespace CUML_EXPORT cuml { namespace genetic { /** fitness metric types */ @@ -177,4 +179,4 @@ struct param { }; // struct param } // namespace genetic -} // namespace cuml +} // namespace CUML_EXPORT cuml diff --git a/cpp/include/cuml/genetic/genetic.h b/cpp/include/cuml/genetic/genetic.h index e61b9a28c9..1cbbdf9c31 100644 --- a/cpp/include/cuml/genetic/genetic.h +++ b/cpp/include/cuml/genetic/genetic.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -8,9 +8,11 @@ #include "common.h" #include "program.h" +#include + #include -namespace cuml { +namespace CUML_EXPORT cuml { namespace genetic { /** @@ -124,4 +126,4 @@ void symTransform(const raft::handle_t& handle, float* output); } // namespace genetic -} // namespace cuml +} // namespace CUML_EXPORT cuml diff --git a/cpp/include/cuml/genetic/node.h b/cpp/include/cuml/genetic/node.h index fa5647bfe2..58a2e9f028 100644 --- a/cpp/include/cuml/genetic/node.h +++ b/cpp/include/cuml/genetic/node.h @@ -1,14 +1,16 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2023, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include + #include #include -namespace cuml { +namespace CUML_EXPORT cuml { namespace genetic { /** @@ -153,4 +155,4 @@ struct node { }; // struct node } // namespace genetic -} // namespace cuml +} // namespace CUML_EXPORT cuml diff --git a/cpp/include/cuml/genetic/program.h b/cpp/include/cuml/genetic/program.h index d6cf080ef2..946935f4fc 100644 --- a/cpp/include/cuml/genetic/program.h +++ b/cpp/include/cuml/genetic/program.h @@ -11,7 +11,7 @@ #include -namespace cuml { +namespace CUML_EXPORT cuml { namespace genetic { /** @@ -276,4 +276,4 @@ void subtree_mutation(const program& prog, program& p_out, const param& params, */ void hoist_mutation(const program& prog, program& p_out, const param& params, std::mt19937& rng); } // namespace genetic -} // namespace cuml +} // namespace CUML_EXPORT cuml diff --git a/cpp/include/cuml/linear_model/glm.hpp b/cpp/include/cuml/linear_model/glm.hpp index a6dbd7305b..371219853f 100644 --- a/cpp/include/cuml/linear_model/glm.hpp +++ b/cpp/include/cuml/linear_model/glm.hpp @@ -1,14 +1,15 @@ /* - * 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 #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace GLM { /** @@ -305,4 +306,4 @@ void qnPredictSparse(const raft::handle_t& cuml_handle, T* preds); } // namespace GLM -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/linear_model/ols_mg.hpp b/cpp/include/cuml/linear_model/ols_mg.hpp index 69afe652fb..fb59eba32c 100644 --- a/cpp/include/cuml/linear_model/ols_mg.hpp +++ b/cpp/include/cuml/linear_model/ols_mg.hpp @@ -1,15 +1,16 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace OLS { namespace opg { @@ -82,4 +83,4 @@ void predict(raft::handle_t& handle, }; // end namespace opg }; // end namespace OLS -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/linear_model/preprocess_mg.hpp b/cpp/include/cuml/linear_model/preprocess_mg.hpp index 03e9dfe0bb..9161110982 100644 --- a/cpp/include/cuml/linear_model/preprocess_mg.hpp +++ b/cpp/include/cuml/linear_model/preprocess_mg.hpp @@ -1,17 +1,18 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include #include #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace GLM { namespace opg { @@ -65,4 +66,4 @@ void postProcessData(raft::handle_t& handle, }; // end namespace opg }; // namespace GLM -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/linear_model/qn.h b/cpp/include/cuml/linear_model/qn.h index 2e9153095e..bd8b84cdd2 100644 --- a/cpp/include/cuml/linear_model/qn.h +++ b/cpp/include/cuml/linear_model/qn.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,7 +7,9 @@ #include #ifdef __cplusplus -namespace ML::GLM { +#include +namespace CUML_EXPORT ML { +namespace GLM { extern "C" { #endif @@ -108,5 +110,6 @@ typedef struct qn_params qn_params; #ifdef __cplusplus } -} +} // end namespace GLM +} // end namespace CUML_EXPORT ML #endif diff --git a/cpp/include/cuml/linear_model/qn_mg.hpp b/cpp/include/cuml/linear_model/qn_mg.hpp index 05bd9086ac..a59a2e3fcc 100644 --- a/cpp/include/cuml/linear_model/qn_mg.hpp +++ b/cpp/include/cuml/linear_model/qn_mg.hpp @@ -1,8 +1,9 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -14,7 +15,7 @@ #include -namespace ML { +namespace CUML_EXPORT ML { namespace GLM { namespace opg { @@ -93,4 +94,4 @@ void qnFitSparse(raft::handle_t& handle, }; // namespace opg }; // namespace GLM -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/linear_model/ridge_mg.hpp b/cpp/include/cuml/linear_model/ridge_mg.hpp index 6443e555c6..3d0a25e0e5 100644 --- a/cpp/include/cuml/linear_model/ridge_mg.hpp +++ b/cpp/include/cuml/linear_model/ridge_mg.hpp @@ -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 */ @@ -7,10 +7,11 @@ #include "glm.hpp" +#include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace Ridge { namespace opg { @@ -89,4 +90,4 @@ void predict(raft::handle_t& handle, }; // end namespace opg }; // end namespace Ridge -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/manifold/common.hpp b/cpp/include/cuml/manifold/common.hpp index 9c10c40a36..83ded1bd3b 100644 --- a/cpp/include/cuml/manifold/common.hpp +++ b/cpp/include/cuml/manifold/common.hpp @@ -5,11 +5,13 @@ #pragma once +#include + #include #include -namespace ML { +namespace CUML_EXPORT ML { // Dense input uses int64_t until FAISS is updated typedef int64_t knn_indices_dense_t; @@ -123,4 +125,4 @@ struct manifold_precomputed_knn_inputs_t : public manifold_inputs_t { } }; -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/manifold/spectral_embedding.hpp b/cpp/include/cuml/manifold/spectral_embedding.hpp index 15b07be430..43fe9aeb2d 100644 --- a/cpp/include/cuml/manifold/spectral_embedding.hpp +++ b/cpp/include/cuml/manifold/spectral_embedding.hpp @@ -2,6 +2,9 @@ * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ +#pragma once + +#include #include #include @@ -15,7 +18,8 @@ struct params; } // end namespace cuvs::preprocessing::spectral_embedding -namespace ML::SpectralEmbedding { +namespace CUML_EXPORT ML { +namespace SpectralEmbedding { /** * @brief Parameters for spectral embedding algorithm @@ -56,4 +60,5 @@ void transform(raft::resources const& handle, raft::device_vector_view vals, raft::device_matrix_view embedding); -} // namespace ML::SpectralEmbedding +} // namespace SpectralEmbedding +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/manifold/tsne.h b/cpp/include/cuml/manifold/tsne.h index c72333b808..d0571d0680 100644 --- a/cpp/include/cuml/manifold/tsne.h +++ b/cpp/include/cuml/manifold/tsne.h @@ -1,18 +1,19 @@ /* - * 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 +#include #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { enum TSNE_ALGORITHM { EXACT, BARNES_HUT, FFT }; @@ -175,4 +176,4 @@ void TSNE_fit_sparse(const raft::handle_t& handle, float* kl_div = nullptr, int* n_iter = nullptr); -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/manifold/umap.hpp b/cpp/include/cuml/manifold/umap.hpp index e7ce780256..3da8c972ea 100644 --- a/cpp/include/cuml/manifold/umap.hpp +++ b/cpp/include/cuml/manifold/umap.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include #include @@ -20,7 +21,7 @@ namespace raft { class handle_t; } // namespace raft -namespace ML { +namespace CUML_EXPORT ML { class UMAPParams; namespace UMAP { @@ -256,4 +257,4 @@ void inverse_transform(const raft::handle_t& handle, int n_epochs); } // namespace UMAP -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/manifold/umapparams.h b/cpp/include/cuml/manifold/umapparams.h index 933494f373..c7d5d4b5d7 100644 --- a/cpp/include/cuml/manifold/umapparams.h +++ b/cpp/include/cuml/manifold/umapparams.h @@ -7,9 +7,10 @@ #include #include +#include #include -namespace ML { +namespace CUML_EXPORT ML { namespace graph_build_params { @@ -221,4 +222,4 @@ class UMAPParams { Internals::GraphBasedDimRedCallback* callback = nullptr; }; -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/matrix/kernel_params.hpp b/cpp/include/cuml/matrix/kernel_params.hpp index 7f030e1580..880974d9e2 100644 --- a/cpp/include/cuml/matrix/kernel_params.hpp +++ b/cpp/include/cuml/matrix/kernel_params.hpp @@ -5,13 +5,16 @@ #pragma once +#include + namespace cuvs::distance::kernels { struct KernelParams; } // end namespace cuvs::distance::kernels -namespace ML::matrix { +namespace CUML_EXPORT ML { +namespace matrix { enum class KernelType { LINEAR, POLYNOMIAL, RBF, TANH, PRECOMPUTED }; @@ -31,4 +34,5 @@ struct KernelParams { cuvs::distance::kernels::KernelParams to_cuvs() const; }; -} // end namespace ML::matrix +} // end namespace matrix +} // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/metrics/metrics.hpp b/cpp/include/cuml/metrics/metrics.hpp index 4d093780fd..788b3c7aa2 100644 --- a/cpp/include/cuml/metrics/metrics.hpp +++ b/cpp/include/cuml/metrics/metrics.hpp @@ -1,11 +1,12 @@ /* - * 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 +#include #include @@ -13,7 +14,7 @@ namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Metrics { @@ -425,4 +426,4 @@ double trustworthiness_score(const raft::handle_t& h, int batchSize = 512); } // namespace Metrics -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/neighbors/knn.hpp b/cpp/include/cuml/neighbors/knn.hpp index e6a5219465..78d8396360 100644 --- a/cpp/include/cuml/neighbors/knn.hpp +++ b/cpp/include/cuml/neighbors/knn.hpp @@ -6,6 +6,7 @@ #pragma once #include +#include #include #include @@ -15,7 +16,7 @@ namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { /** * @brief Flat C++ API function to perform a brute force knn on @@ -258,4 +259,4 @@ void knn_class_proba(raft::handle_t& handle, size_t n_query_rows, int k, float* sample_weight = nullptr); -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/neighbors/knn_mg.hpp b/cpp/include/cuml/neighbors/knn_mg.hpp index e1576feaa9..5632044d23 100644 --- a/cpp/include/cuml/neighbors/knn_mg.hpp +++ b/cpp/include/cuml/neighbors/knn_mg.hpp @@ -1,10 +1,10 @@ /* - * 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 #include #include @@ -12,7 +12,7 @@ #include -namespace ML { +namespace CUML_EXPORT ML { namespace KNN { namespace opg { @@ -126,4 +126,4 @@ void knn_regress(raft::handle_t& handle, }; // END namespace opg }; // namespace KNN -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/neighbors/knn_sparse.hpp b/cpp/include/cuml/neighbors/knn_sparse.hpp index acc91599bb..da5dcf9950 100644 --- a/cpp/include/cuml/neighbors/knn_sparse.hpp +++ b/cpp/include/cuml/neighbors/knn_sparse.hpp @@ -1,11 +1,12 @@ /* - * 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 +#include #include #include @@ -14,7 +15,7 @@ namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Sparse { constexpr int DEFAULT_BATCH_SIZE = 1 << 16; @@ -40,4 +41,4 @@ void brute_force_knn(raft::handle_t& handle, ML::distance::DistanceType metric = ML::distance::DistanceType::L2Expanded, float metricArg = 0); }; // end namespace Sparse -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/prims/opg/comm_utils.h b/cpp/include/cuml/prims/opg/comm_utils.h index 460c2649da..853dced7e9 100644 --- a/cpp/include/cuml/prims/opg/comm_utils.h +++ b/cpp/include/cuml/prims/opg/comm_utils.h @@ -1,14 +1,16 @@ /* - * 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 + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace opg { /** sum-reduce single float numbers across workers */ @@ -36,4 +38,4 @@ void allreduce_single_sum(T* out, } }; // end namespace opg -}; // end namespace MLCommon +}; // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/eig.hpp b/cpp/include/cuml/prims/opg/linalg/eig.hpp index 04cd02f972..2073842323 100644 --- a/cpp/include/cuml/prims/opg/linalg/eig.hpp +++ b/cpp/include/cuml/prims/opg/linalg/eig.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -62,4 +64,4 @@ void eigJacobi(const raft::handle_t& h, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/gemm.hpp b/cpp/include/cuml/prims/opg/linalg/gemm.hpp index 1647518622..d67509e2ee 100644 --- a/cpp/include/cuml/prims/opg/linalg/gemm.hpp +++ b/cpp/include/cuml/prims/opg/linalg/gemm.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,9 +7,11 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -58,4 +60,4 @@ void gemm(const raft::handle_t& h, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/lstsq.hpp b/cpp/include/cuml/prims/opg/linalg/lstsq.hpp index 09643afc8d..11007ff3e3 100644 --- a/cpp/include/cuml/prims/opg/linalg/lstsq.hpp +++ b/cpp/include/cuml/prims/opg/linalg/lstsq.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,9 +7,11 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -34,4 +36,4 @@ void lstsqEig(const raft::handle_t& handle, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/mean_squared_error.hpp b/cpp/include/cuml/prims/opg/linalg/mean_squared_error.hpp index fafbe9f72e..eecea5c369 100644 --- a/cpp/include/cuml/prims/opg/linalg/mean_squared_error.hpp +++ b/cpp/include/cuml/prims/opg/linalg/mean_squared_error.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -48,4 +50,4 @@ void meanSquaredError(float* out, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/mm_aTa.hpp b/cpp/include/cuml/prims/opg/linalg/mm_aTa.hpp index 4bd97d19c0..633ccab120 100644 --- a/cpp/include/cuml/prims/opg/linalg/mm_aTa.hpp +++ b/cpp/include/cuml/prims/opg/linalg/mm_aTa.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -39,4 +41,4 @@ void mm_aTa(const raft::handle_t& handle, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/mv_aTb.hpp b/cpp/include/cuml/prims/opg/linalg/mv_aTb.hpp index cab2635fd2..09547ceefb 100644 --- a/cpp/include/cuml/prims/opg/linalg/mv_aTb.hpp +++ b/cpp/include/cuml/prims/opg/linalg/mv_aTb.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -42,4 +44,4 @@ void mv_aTb(const raft::handle_t& handle, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/norm.hpp b/cpp/include/cuml/prims/opg/linalg/norm.hpp index e6bf8b4384..a4d1798d91 100644 --- a/cpp/include/cuml/prims/opg/linalg/norm.hpp +++ b/cpp/include/cuml/prims/opg/linalg/norm.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -47,4 +49,4 @@ void colNorm2NoSeq(const raft::handle_t& handle, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/linalg/svd.hpp b/cpp/include/cuml/prims/opg/linalg/svd.hpp index 0d03a534a7..d4f23d3b40 100644 --- a/cpp/include/cuml/prims/opg/linalg/svd.hpp +++ b/cpp/include/cuml/prims/opg/linalg/svd.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace LinAlg { namespace opg { @@ -37,4 +39,4 @@ void svdEig(const raft::handle_t& handle, } // end namespace opg } // end namespace LinAlg -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/matrix/data.hpp b/cpp/include/cuml/prims/opg/matrix/data.hpp index 4d05049450..93edc4529e 100644 --- a/cpp/include/cuml/prims/opg/matrix/data.hpp +++ b/cpp/include/cuml/prims/opg/matrix/data.hpp @@ -1,11 +1,13 @@ +#pragma once + /* - * 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 -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Matrix { /** @@ -41,4 +43,4 @@ typedef Data floatData_t; typedef Data doubleData_t; }; // end namespace Matrix -}; // end namespace MLCommon +}; // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/matrix/math.hpp b/cpp/include/cuml/prims/opg/matrix/math.hpp index 7ec6b941f4..2e381bc239 100644 --- a/cpp/include/cuml/prims/opg/matrix/math.hpp +++ b/cpp/include/cuml/prims/opg/matrix/math.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,9 +7,11 @@ #include "data.hpp" #include "part_descriptor.hpp" +#include + #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Matrix { namespace opg { @@ -49,4 +51,4 @@ void matrixVectorBinaryMult(std::vector*>& data, }; // namespace opg }; // end namespace Matrix -}; // end namespace MLCommon +}; // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/matrix/matrix_utils.hpp b/cpp/include/cuml/prims/opg/matrix/matrix_utils.hpp index 047142fa6b..f622a252f8 100644 --- a/cpp/include/cuml/prims/opg/matrix/matrix_utils.hpp +++ b/cpp/include/cuml/prims/opg/matrix/matrix_utils.hpp @@ -1,15 +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 "data.hpp" #include "part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Matrix { namespace opg { @@ -151,4 +154,4 @@ void print(const raft::handle_t& h, cudaStream_t stream); } // end namespace opg } // namespace Matrix -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/matrix/part_descriptor.hpp b/cpp/include/cuml/prims/opg/matrix/part_descriptor.hpp index 7ec8fa7825..7b288654f8 100644 --- a/cpp/include/cuml/prims/opg/matrix/part_descriptor.hpp +++ b/cpp/include/cuml/prims/opg/matrix/part_descriptor.hpp @@ -1,19 +1,21 @@ +#pragma once + /* - * 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 "data.hpp" +#include + #include #include #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Matrix { /** Describes the data layout */ @@ -98,4 +100,4 @@ std::ostream& operator<<(std::ostream& os, const PartDescriptor& desc); bool operator==(const PartDescriptor& a, const PartDescriptor& b); }; // end namespace Matrix -}; // end namespace MLCommon +}; // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/stats/cov.hpp b/cpp/include/cuml/prims/opg/stats/cov.hpp index 40d449d00d..5a024d1338 100644 --- a/cpp/include/cuml/prims/opg/stats/cov.hpp +++ b/cpp/include/cuml/prims/opg/stats/cov.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Stats { namespace opg { @@ -45,4 +47,4 @@ void cov(const raft::handle_t& handle, } // end namespace opg } // end namespace Stats -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/stats/mean.hpp b/cpp/include/cuml/prims/opg/stats/mean.hpp index 6efff30def..eb9630b3ca 100644 --- a/cpp/include/cuml/prims/opg/stats/mean.hpp +++ b/cpp/include/cuml/prims/opg/stats/mean.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Stats { namespace opg { @@ -39,4 +41,4 @@ void mean(const raft::handle_t& handle, } // end namespace opg } // end namespace Stats -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/stats/mean_center.hpp b/cpp/include/cuml/prims/opg/stats/mean_center.hpp index 4677d09680..919b278112 100644 --- a/cpp/include/cuml/prims/opg/stats/mean_center.hpp +++ b/cpp/include/cuml/prims/opg/stats/mean_center.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,9 +7,11 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Stats { namespace opg { @@ -61,4 +63,4 @@ void mean_add(const std::vector*>& data, } // end namespace opg } // end namespace Stats -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/prims/opg/stats/stddev.hpp b/cpp/include/cuml/prims/opg/stats/stddev.hpp index b3e357b14d..7c8ea59910 100644 --- a/cpp/include/cuml/prims/opg/stats/stddev.hpp +++ b/cpp/include/cuml/prims/opg/stats/stddev.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once @@ -7,10 +7,12 @@ #include "../matrix/data.hpp" #include "../matrix/part_descriptor.hpp" +#include + #include #include -namespace MLCommon { +namespace CUML_EXPORT MLCommon { namespace Stats { namespace opg { @@ -42,4 +44,4 @@ void var(const raft::handle_t& handle, } // end namespace opg } // end namespace Stats -} // end namespace MLCommon +} // namespace CUML_EXPORT MLCommon diff --git a/cpp/include/cuml/solvers/cd_mg.hpp b/cpp/include/cuml/solvers/cd_mg.hpp index bb7be93f83..220b60f4c0 100644 --- a/cpp/include/cuml/solvers/cd_mg.hpp +++ b/cpp/include/cuml/solvers/cd_mg.hpp @@ -1,15 +1,16 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace CD { namespace opg { @@ -95,4 +96,4 @@ void predict(raft::handle_t& handle, }; // end namespace opg }; // namespace CD -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/solvers/lars.hpp b/cpp/include/cuml/solvers/lars.hpp index a39a696b09..f8d19b3f88 100644 --- a/cpp/include/cuml/solvers/lars.hpp +++ b/cpp/include/cuml/solvers/lars.hpp @@ -5,11 +5,12 @@ #pragma once +#include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace Solver { namespace Lars { @@ -54,13 +55,13 @@ void larsFit(const raft::handle_t& handle, idx_t* active_idx, math_t* alphas, idx_t* n_active, - math_t* Gram, - int max_iter, - math_t* coef_path, - rapids_logger::level_enum verbosity, - idx_t ld_X, - idx_t ld_G, - math_t eps); + math_t* Gram = nullptr, + int max_iter = 500, + math_t* coef_path = nullptr, + rapids_logger::level_enum verbosity = rapids_logger::level_enum::off, + idx_t ld_X = 0, + idx_t ld_G = 0, + math_t eps = -1); /** * @brief Predict with LARS regressor. @@ -92,4 +93,4 @@ void larsPredict(const raft::handle_t& handle, math_t* preds); }; // namespace Lars }; // namespace Solver -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/solvers/params.hpp b/cpp/include/cuml/solvers/params.hpp index 35d0da530f..fe65dfd037 100644 --- a/cpp/include/cuml/solvers/params.hpp +++ b/cpp/include/cuml/solvers/params.hpp @@ -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 -namespace ML { +#include +namespace CUML_EXPORT ML { enum lr_type { OPTIMAL, @@ -22,4 +23,4 @@ enum loss_funct { enum penalty { NONE, L1, L2, ELASTICNET }; -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/solvers/solver.hpp b/cpp/include/cuml/solvers/solver.hpp index ee47e36370..f79fef0f9f 100644 --- a/cpp/include/cuml/solvers/solver.hpp +++ b/cpp/include/cuml/solvers/solver.hpp @@ -1,15 +1,17 @@ /* - * 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 + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Solver { void sgdFit(raft::handle_t& handle, @@ -188,4 +190,4 @@ void cdPredict(raft::handle_t& handle, int loss); }; // namespace Solver -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/svm/linear.hpp b/cpp/include/cuml/svm/linear.hpp index 1a20e47aa8..03775865f6 100644 --- a/cpp/include/cuml/svm/linear.hpp +++ b/cpp/include/cuml/svm/linear.hpp @@ -1,15 +1,16 @@ /* - * 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 #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace SVM { namespace linear { @@ -123,4 +124,4 @@ void computeProbabilities(const raft::handle_t& handle, } // namespace linear } // namespace SVM -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/svm/svc.hpp b/cpp/include/cuml/svm/svc.hpp index f7d986d8bb..f47f3ced26 100644 --- a/cpp/include/cuml/svm/svc.hpp +++ b/cpp/include/cuml/svm/svc.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -8,12 +8,13 @@ #include "svm_model.h" #include "svm_parameter.h" +#include #include #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace SVM { // Forward declarations of the stateless API @@ -272,4 +273,4 @@ class SVC { }; }; // end namespace SVM -}; // end namespace ML +} // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/svm/svm_model.h b/cpp/include/cuml/svm/svm_model.h index 6cd48b8047..3a4d987f50 100644 --- a/cpp/include/cuml/svm/svm_model.h +++ b/cpp/include/cuml/svm/svm_model.h @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2023, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include -namespace ML { +namespace CUML_EXPORT ML { namespace SVM { // Contains array(s) for matrix storage @@ -42,4 +43,4 @@ struct SvmModel { }; }; // namespace SVM -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/svm/svm_parameter.h b/cpp/include/cuml/svm/svm_parameter.h index 7a4bbeb1b0..58f96659af 100644 --- a/cpp/include/cuml/svm/svm_parameter.h +++ b/cpp/include/cuml/svm/svm_parameter.h @@ -1,12 +1,12 @@ /* - * 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 -namespace ML { +namespace CUML_EXPORT ML { namespace SVM { enum SvmType { C_SVC, NU_SVC, EPSILON_SVR, NU_SVR }; @@ -37,4 +37,4 @@ struct SvmParameter { }; }; // namespace SVM -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/svm/svr.hpp b/cpp/include/cuml/svm/svr.hpp index 56d60bbeb4..81a62e9ec8 100644 --- a/cpp/include/cuml/svm/svr.hpp +++ b/cpp/include/cuml/svm/svr.hpp @@ -1,15 +1,16 @@ /* - * 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 #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace SVM { template @@ -46,7 +47,7 @@ int svrFit(const raft::handle_t& handle, const SvmParameter& param, ML::matrix::KernelParams& kernel_params, SvmModel& model, - const math_t* sample_weight = nullptr); + const math_t* sample_weight); /** * @brief Fit a support vector regressor to the training data. @@ -82,9 +83,9 @@ int svrFitSparse(const raft::handle_t& handle, const SvmParameter& param, ML::matrix::KernelParams& kernel_params, SvmModel& model, - const math_t* sample_weight = nullptr); + const math_t* sample_weight); // For prediction we use svcPredict }; // end namespace SVM -}; // end namespace ML +}; // end namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tree/algo_helper.h b/cpp/include/cuml/tree/algo_helper.h index e68ab8183f..8c30af7aa1 100644 --- a/cpp/include/cuml/tree/algo_helper.h +++ b/cpp/include/cuml/tree/algo_helper.h @@ -1,11 +1,12 @@ /* - * 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 -namespace ML { +namespace CUML_EXPORT ML { enum CRITERION { GINI, ENTROPY, @@ -17,4 +18,4 @@ enum CRITERION { CRITERION_END, }; -}; // namespace ML +}; // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tree/decisiontree.hpp b/cpp/include/cuml/tree/decisiontree.hpp index f617737154..abbcf7b1e6 100644 --- a/cpp/include/cuml/tree/decisiontree.hpp +++ b/cpp/include/cuml/tree/decisiontree.hpp @@ -8,10 +8,12 @@ #include "algo_helper.h" #include "flatnode.h" +#include + #include #include -namespace ML { +namespace CUML_EXPORT ML { namespace DT { @@ -134,4 +136,4 @@ typedef TreeMetaDataNode TreeRegressorF; typedef TreeMetaDataNode TreeRegressorD; } // End namespace DT -} // End namespace ML +} // End namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/arima_common.h b/cpp/include/cuml/tsa/arima_common.h index 5b065ca25b..1f9c3f6ca6 100644 --- a/cpp/include/cuml/tsa/arima_common.h +++ b/cpp/include/cuml/tsa/arima_common.h @@ -5,6 +5,8 @@ #pragma once +#include + #include #include @@ -15,7 +17,7 @@ #include -namespace ML { +namespace CUML_EXPORT ML { /** * Structure to hold the ARIMA order (makes it easier to pass as an argument) @@ -275,4 +277,4 @@ struct ARIMAMemory { } }; -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/auto_arima.h b/cpp/include/cuml/tsa/auto_arima.h index dc9a6d5ec5..d0dd3b905e 100644 --- a/cpp/include/cuml/tsa/auto_arima.h +++ b/cpp/include/cuml/tsa/auto_arima.h @@ -1,15 +1,17 @@ /* - * 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 + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { /** * Batch division by mask step 1: build an index of the position of each series @@ -188,4 +190,4 @@ void merge_series(const raft::handle_t& handle, int n_sub, int n_obs); -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/batched_arima.hpp b/cpp/include/cuml/tsa/batched_arima.hpp index cbe2f0bafa..2923aa7f71 100644 --- a/cpp/include/cuml/tsa/batched_arima.hpp +++ b/cpp/include/cuml/tsa/batched_arima.hpp @@ -1,17 +1,18 @@ /* - * 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 #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { enum LoglikeMethod { CSS, MLE }; @@ -290,4 +291,4 @@ void estimate_x0(raft::handle_t& handle, const ARIMAOrder& order, bool missing); -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/batched_kalman.hpp b/cpp/include/cuml/tsa/batched_kalman.hpp index d80afd2735..1ae520b4f8 100644 --- a/cpp/include/cuml/tsa/batched_kalman.hpp +++ b/cpp/include/cuml/tsa/batched_kalman.hpp @@ -1,17 +1,18 @@ /* - * 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 #include namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { /** * An ARIMA specialized batched kalman filter to evaluate ARMA parameters and @@ -78,4 +79,4 @@ void batched_jones_transform(raft::handle_t& handle, bool isInv, const double* h_params, double* h_Tparams); -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/holtwinters.h b/cpp/include/cuml/tsa/holtwinters.h index 0a828d3a8a..6e0c46142c 100644 --- a/cpp/include/cuml/tsa/holtwinters.h +++ b/cpp/include/cuml/tsa/holtwinters.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2021, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -7,11 +7,13 @@ #include "holtwinters_params.h" +#include + namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace HoltWinters { /** @@ -142,4 +144,4 @@ void forecast(const raft::handle_t& handle, double* forecast_d); } // namespace HoltWinters -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/holtwinters_params.h b/cpp/include/cuml/tsa/holtwinters_params.h index d90a0673dd..a40b38fe67 100644 --- a/cpp/include/cuml/tsa/holtwinters_params.h +++ b/cpp/include/cuml/tsa/holtwinters_params.h @@ -1,11 +1,12 @@ /* - * 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 -namespace ML { +namespace CUML_EXPORT ML { // The type of season that represents the time-series // ADDITIVE is with stable trend and level over periods @@ -35,4 +36,4 @@ struct OptimParams { enum Norm { L0, L1, L2, LINF }; -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/include/cuml/tsa/stationarity.h b/cpp/include/cuml/tsa/stationarity.h index 71f0f34ae6..3fb1b661dd 100644 --- a/cpp/include/cuml/tsa/stationarity.h +++ b/cpp/include/cuml/tsa/stationarity.h @@ -1,15 +1,16 @@ /* - * 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 namespace raft { class handle_t; } -namespace ML { +namespace CUML_EXPORT ML { namespace Stationarity { @@ -48,4 +49,4 @@ void kpss_test(const raft::handle_t& handle, double pval_threshold); } // namespace Stationarity -} // namespace ML +} // namespace CUML_EXPORT ML diff --git a/cpp/src/arima/arima_common.cu b/cpp/src/arima/arima_common.cu index 1aa0c9bc12..d2caaaad1c 100644 --- a/cpp/src/arima/arima_common.cu +++ b/cpp/src/arima/arima_common.cu @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include @@ -95,6 +96,6 @@ void ARIMAParams::unpack(const ARIMAOrder& order, } // Explicit template instantiation -template struct ARIMAParams; +template struct CUML_EXPORT ARIMAParams; } // namespace ML diff --git a/cpp/src/decisiontree/batched-levelalgo/quantiles.cuh b/cpp/src/decisiontree/batched-levelalgo/quantiles.cuh index bdefc2db3e..493d164637 100644 --- a/cpp/src/decisiontree/batched-levelalgo/quantiles.cuh +++ b/cpp/src/decisiontree/batched-levelalgo/quantiles.cuh @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -7,6 +7,8 @@ #include "quantiles.h" +#include + #include #include #include @@ -57,7 +59,7 @@ using QuantileReturnValue = std::tuple, std::shared_ptr>>; template -QuantileReturnValue computeQuantiles( +CUML_EXPORT QuantileReturnValue computeQuantiles( const raft::handle_t& handle, const T* data, int max_n_bins, int n_rows, int n_cols) { raft::common::nvtx::push_range("computeQuantiles"); diff --git a/cpp/src/decisiontree/decisiontree.cu b/cpp/src/decisiontree/decisiontree.cu index 523c72ba81..2ccc16f21d 100644 --- a/cpp/src/decisiontree/decisiontree.cu +++ b/cpp/src/decisiontree/decisiontree.cu @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #include "decisiontree.cuh" +#include #include #include @@ -96,20 +97,20 @@ std::string get_tree_json(const TreeMetaDataNode* tree) } // Functions' specializations -template std::string get_tree_summary_text(const TreeClassifierF* tree); -template std::string get_tree_summary_text(const TreeClassifierD* tree); -template std::string get_tree_summary_text(const TreeRegressorF* tree); -template std::string get_tree_summary_text(const TreeRegressorD* tree); +template CUML_EXPORT std::string get_tree_summary_text(const TreeClassifierF* tree); +template CUML_EXPORT std::string get_tree_summary_text(const TreeClassifierD* tree); +template CUML_EXPORT std::string get_tree_summary_text(const TreeRegressorF* tree); +template CUML_EXPORT std::string get_tree_summary_text(const TreeRegressorD* tree); -template std::string get_tree_text(const TreeClassifierF* tree); -template std::string get_tree_text(const TreeClassifierD* tree); -template std::string get_tree_text(const TreeRegressorF* tree); -template std::string get_tree_text(const TreeRegressorD* tree); +template CUML_EXPORT std::string get_tree_text(const TreeClassifierF* tree); +template CUML_EXPORT std::string get_tree_text(const TreeClassifierD* tree); +template CUML_EXPORT std::string get_tree_text(const TreeRegressorF* tree); +template CUML_EXPORT std::string get_tree_text(const TreeRegressorD* tree); -template std::string get_tree_json(const TreeClassifierF* tree); -template std::string get_tree_json(const TreeClassifierD* tree); -template std::string get_tree_json(const TreeRegressorF* tree); -template std::string get_tree_json(const TreeRegressorD* tree); +template CUML_EXPORT std::string get_tree_json(const TreeClassifierF* tree); +template CUML_EXPORT std::string get_tree_json(const TreeClassifierD* tree); +template CUML_EXPORT std::string get_tree_json(const TreeRegressorF* tree); +template CUML_EXPORT std::string get_tree_json(const TreeRegressorD* tree); } // End namespace DT } // End namespace ML diff --git a/cpp/src/glm/glm.cu b/cpp/src/glm/glm.cu index 3ca90a9b2e..089e6d774b 100644 --- a/cpp/src/glm/glm.cu +++ b/cpp/src/glm/glm.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2018-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -141,32 +141,32 @@ void qnFit(const raft::handle_t& cuml_handle, cuml_handle, pams, X, X_col_major, y, N, D, C, w0, f, num_iters, sample_weight, svr_eps); } -template void qnFit(const raft::handle_t&, - const qn_params&, - float*, - bool, - float*, - int, - int, - int, - float*, - float*, - int*, - float*, - float); -template void qnFit(const raft::handle_t&, - const qn_params&, - double*, - bool, - double*, - int, - int, - int, - double*, - double*, - int*, - double*, - double); +template CUML_EXPORT void qnFit(const raft::handle_t&, + const qn_params&, + float*, + bool, + float*, + int, + int, + int, + float*, + float*, + int*, + float*, + float); +template CUML_EXPORT void qnFit(const raft::handle_t&, + const qn_params&, + double*, + bool, + double*, + int, + int, + int, + double*, + double*, + int*, + double*, + double); template void qnFitSparse(const raft::handle_t& cuml_handle, @@ -202,36 +202,36 @@ void qnFitSparse(const raft::handle_t& cuml_handle, svr_eps); } -template void qnFitSparse(const raft::handle_t&, - const qn_params&, - float*, - int*, - int*, - int, - float*, - int, - int, - int, - float*, - float*, - int*, - float*, - float); -template void qnFitSparse(const raft::handle_t&, - const qn_params&, - double*, - int*, - int*, - int, - double*, - int, - int, - int, - double*, - double*, - int*, - double*, - double); +template CUML_EXPORT void qnFitSparse(const raft::handle_t&, + const qn_params&, + float*, + int*, + int*, + int, + float*, + int, + int, + int, + float*, + float*, + int*, + float*, + float); +template CUML_EXPORT void qnFitSparse(const raft::handle_t&, + const qn_params&, + double*, + int*, + int*, + int, + double*, + int, + int, + int, + double*, + double*, + int*, + double*, + double); template void qnDecisionFunction(const raft::handle_t& cuml_handle, @@ -247,9 +247,9 @@ void qnDecisionFunction(const raft::handle_t& cuml_handle, detail::qnDecisionFunction(cuml_handle, pams, X, X_col_major, N, D, C, params, scores); } -template void qnDecisionFunction( +template CUML_EXPORT void qnDecisionFunction( const raft::handle_t&, const qn_params&, float*, bool, int, int, int, float*, float*); -template void qnDecisionFunction( +template CUML_EXPORT void qnDecisionFunction( const raft::handle_t&, const qn_params&, double*, bool, int, int, int, double*, double*); template @@ -269,19 +269,19 @@ void qnDecisionFunctionSparse(const raft::handle_t& cuml_handle, cuml_handle, pams, X_values, X_cols, X_row_ids, X_nnz, N, D, C, params, scores); } -template void qnDecisionFunctionSparse( +template CUML_EXPORT void qnDecisionFunctionSparse( const raft::handle_t&, const qn_params&, float*, int*, int*, int, int, int, int, float*, float*); -template void qnDecisionFunctionSparse(const raft::handle_t&, - const qn_params&, - double*, - int*, - int*, - int, - int, - int, - int, - double*, - double*); +template CUML_EXPORT void qnDecisionFunctionSparse(const raft::handle_t&, + const qn_params&, + double*, + int*, + int*, + int, + int, + int, + int, + double*, + double*); template void qnPredict(const raft::handle_t& cuml_handle, @@ -297,9 +297,9 @@ void qnPredict(const raft::handle_t& cuml_handle, detail::qnPredict(cuml_handle, pams, X, X_col_major, N, D, C, params, scores); } -template void qnPredict( +template CUML_EXPORT void qnPredict( const raft::handle_t&, const qn_params&, float*, bool, int, int, int, float*, float*); -template void qnPredict( +template CUML_EXPORT void qnPredict( const raft::handle_t&, const qn_params&, double*, bool, int, int, int, double*, double*); template @@ -319,19 +319,19 @@ void qnPredictSparse(const raft::handle_t& cuml_handle, cuml_handle, pams, X_values, X_cols, X_row_ids, X_nnz, N, D, C, params, preds); } -template void qnPredictSparse( +template CUML_EXPORT void qnPredictSparse( const raft::handle_t&, const qn_params&, float*, int*, int*, int, int, int, int, float*, float*); -template void qnPredictSparse(const raft::handle_t&, - const qn_params&, - double*, - int*, - int*, - int, - int, - int, - int, - double*, - double*); +template CUML_EXPORT void qnPredictSparse(const raft::handle_t&, + const qn_params&, + double*, + int*, + int*, + int, + int, + int, + int, + double*, + double*); } // namespace GLM } // namespace ML diff --git a/cpp/src/glm/qn_mg.cu b/cpp/src/glm/qn_mg.cu index 975b6a1efa..c6ac17a5c5 100644 --- a/cpp/src/glm/qn_mg.cu +++ b/cpp/src/glm/qn_mg.cu @@ -7,6 +7,7 @@ #include "qn/mg/standardization.cuh" #include "qn/simple_mat/dense.hpp" +#include #include #include #include @@ -183,13 +184,15 @@ std::vector getUniquelabelsMG(const raft::handle_t& handle, return distinct_mg(handle, data_y->ptr, n_rows); } -template std::vector getUniquelabelsMG(const raft::handle_t& handle, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels); +template CUML_EXPORT std::vector getUniquelabelsMG( + const raft::handle_t& handle, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels); -template std::vector getUniquelabelsMG(const raft::handle_t& handle, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels); +template CUML_EXPORT std::vector getUniquelabelsMG( + const raft::handle_t& handle, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels); template void qnFit(raft::handle_t& handle, @@ -217,29 +220,29 @@ void qnFit(raft::handle_t& handle, num_iters); } -template void qnFit(raft::handle_t& handle, - std::vector*>& input_data, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - float* coef, - const qn_params& pams, - bool X_col_major, - bool standardization, - int n_classes, - float* f, - int* num_iters); - -template void qnFit(raft::handle_t& handle, - std::vector*>& input_data, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - double* coef, - const qn_params& pams, - bool X_col_major, - bool standardization, - int n_classes, - double* f, - int* num_iters); +template CUML_EXPORT void qnFit(raft::handle_t& handle, + std::vector*>& input_data, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + float* coef, + const qn_params& pams, + bool X_col_major, + bool standardization, + int n_classes, + float* f, + int* num_iters); + +template CUML_EXPORT void qnFit(raft::handle_t& handle, + std::vector*>& input_data, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + double* coef, + const qn_params& pams, + bool X_col_major, + bool standardization, + int n_classes, + double* f, + int* num_iters); template void qnFitSparse_impl(const raft::handle_t& handle, @@ -331,61 +334,63 @@ void qnFitSparse(raft::handle_t& handle, input_desc.uniqueRanks().size()); } -template void qnFitSparse(raft::handle_t& handle, - std::vector*>& input_values, - int* input_cols, - int* input_row_ids, - int X_nnz, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - float* coef, - const qn_params& pams, - bool standardization, - int n_classes, - float* f, - int* num_iters); - -template void qnFitSparse(raft::handle_t& handle, - std::vector*>& input_values, - int* input_cols, - int* input_row_ids, - int X_nnz, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - double* coef, - const qn_params& pams, - bool standardization, - int n_classes, - double* f, - int* num_iters); - -template void qnFitSparse(raft::handle_t& handle, - std::vector*>& input_values, - int64_t* input_cols, - int64_t* input_row_ids, - int64_t X_nnz, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - float* coef, - const qn_params& pams, - bool standardization, - int n_classes, - float* f, - int* num_iters); - -template void qnFitSparse(raft::handle_t& handle, - std::vector*>& input_values, - int64_t* input_cols, - int64_t* input_row_ids, - int64_t X_nnz, - Matrix::PartDescriptor& input_desc, - std::vector*>& labels, - double* coef, - const qn_params& pams, - bool standardization, - int n_classes, - double* f, - int* num_iters); +template CUML_EXPORT void qnFitSparse(raft::handle_t& handle, + std::vector*>& input_values, + int* input_cols, + int* input_row_ids, + int X_nnz, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + float* coef, + const qn_params& pams, + bool standardization, + int n_classes, + float* f, + int* num_iters); + +template CUML_EXPORT void qnFitSparse(raft::handle_t& handle, + std::vector*>& input_values, + int* input_cols, + int* input_row_ids, + int X_nnz, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + double* coef, + const qn_params& pams, + bool standardization, + int n_classes, + double* f, + int* num_iters); + +template CUML_EXPORT void qnFitSparse( + raft::handle_t& handle, + std::vector*>& input_values, + int64_t* input_cols, + int64_t* input_row_ids, + int64_t X_nnz, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + float* coef, + const qn_params& pams, + bool standardization, + int n_classes, + float* f, + int* num_iters); + +template CUML_EXPORT void qnFitSparse( + raft::handle_t& handle, + std::vector*>& input_values, + int64_t* input_cols, + int64_t* input_row_ids, + int64_t X_nnz, + Matrix::PartDescriptor& input_desc, + std::vector*>& labels, + double* coef, + const qn_params& pams, + bool standardization, + int n_classes, + double* f, + int* num_iters); }; // namespace opg }; // namespace GLM diff --git a/cpp/src/kmeans/kmeans_fit.cu b/cpp/src/kmeans/kmeans_fit.cu index b4f3516d5e..c9ac66c9ed 100644 --- a/cpp/src/kmeans/kmeans_fit.cu +++ b/cpp/src/kmeans/kmeans_fit.cu @@ -1,8 +1,9 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include diff --git a/cpp/src/kmeans/kmeans_predict.cu b/cpp/src/kmeans/kmeans_predict.cu index 6a57cbb25d..b050079ea6 100644 --- a/cpp/src/kmeans/kmeans_predict.cu +++ b/cpp/src/kmeans/kmeans_predict.cu @@ -1,8 +1,9 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include diff --git a/cpp/src/kmeans/kmeans_transform.cu b/cpp/src/kmeans/kmeans_transform.cu index 67809879a0..5f3d940852 100644 --- a/cpp/src/kmeans/kmeans_transform.cu +++ b/cpp/src/kmeans/kmeans_transform.cu @@ -1,8 +1,9 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include diff --git a/cpp/src/matrix/kernel_params.cpp b/cpp/src/matrix/kernel_params.cpp index 4b325f5014..d1d734273f 100644 --- a/cpp/src/matrix/kernel_params.cpp +++ b/cpp/src/matrix/kernel_params.cpp @@ -7,7 +7,8 @@ #include -namespace ML::matrix { +namespace ML { +namespace CUML_EXPORT matrix { cuvs::distance::kernels::KernelParams KernelParams::to_cuvs() const { @@ -27,4 +28,5 @@ cuvs::distance::kernels::KernelParams KernelParams::to_cuvs() const return params; } -} // end namespace ML::matrix +} // end namespace CUML_EXPORT matrix +} // end namespace ML diff --git a/cpp/src/metrics/trustworthiness.cu b/cpp/src/metrics/trustworthiness.cu index 37d03bfbc5..e68b2fc9fe 100644 --- a/cpp/src/metrics/trustworthiness.cu +++ b/cpp/src/metrics/trustworthiness.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2018-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -47,15 +47,15 @@ double trustworthiness_score(const raft::handle_t& h, batchSize); } -template double trustworthiness_score( - const raft::handle_t& h, - const float* X, - float* X_embedded, - int n, - int m, - int d, - int n_neighbors, - int batchSize); +template CUML_EXPORT double +trustworthiness_score(const raft::handle_t& h, + const float* X, + float* X_embedded, + int n, + int m, + int d, + int n_neighbors, + int batchSize); }; // end namespace Metrics }; // end namespace ML diff --git a/cpp/src/randomforest/randomforest.cu b/cpp/src/randomforest/randomforest.cu index ae3ecf155a..f70eaf1597 100644 --- a/cpp/src/randomforest/randomforest.cu +++ b/cpp/src/randomforest/randomforest.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -780,89 +780,94 @@ void compute_feature_importances(const RandomForestMetaData* forest, T* im } } -template std::string get_rf_summary_text(const RandomForestClassifierF* forest); -template std::string get_rf_summary_text(const RandomForestClassifierD* forest); -template std::string get_rf_summary_text(const RandomForestRegressorF* forest); -template std::string get_rf_summary_text(const RandomForestRegressorD* forest); - -template std::string get_rf_detailed_text(const RandomForestClassifierF* forest); -template std::string get_rf_detailed_text(const RandomForestClassifierD* forest); -template std::string get_rf_detailed_text(const RandomForestRegressorF* forest); -template std::string get_rf_detailed_text(const RandomForestRegressorD* forest); - -template std::string get_rf_json(const RandomForestClassifierF* forest); -template std::string get_rf_json(const RandomForestClassifierD* forest); -template std::string get_rf_json(const RandomForestRegressorF* forest); -template std::string get_rf_json(const RandomForestRegressorD* forest); - -template void delete_rf_metadata(RandomForestClassifierF* forest); -template void delete_rf_metadata(RandomForestClassifierD* forest); -template void delete_rf_metadata(RandomForestRegressorF* forest); -template void delete_rf_metadata(RandomForestRegressorD* forest); - -template void build_treelite_forest(TreeliteModelHandle* model, - const RandomForestMetaData* forest, - int num_features); -template void build_treelite_forest(TreeliteModelHandle* model, - const RandomForestMetaData* forest, - int num_features); -template void build_treelite_forest(TreeliteModelHandle* model, - const RandomForestMetaData* forest, - int num_features); -template void build_treelite_forest( +template CUML_EXPORT std::string get_rf_summary_text( + const RandomForestClassifierF* forest); +template CUML_EXPORT std::string get_rf_summary_text( + const RandomForestClassifierD* forest); +template CUML_EXPORT std::string get_rf_summary_text( + const RandomForestRegressorF* forest); +template CUML_EXPORT std::string get_rf_summary_text( + const RandomForestRegressorD* forest); + +template CUML_EXPORT std::string get_rf_detailed_text( + const RandomForestClassifierF* forest); +template CUML_EXPORT std::string get_rf_detailed_text( + const RandomForestClassifierD* forest); +template CUML_EXPORT std::string get_rf_detailed_text( + const RandomForestRegressorF* forest); +template CUML_EXPORT std::string get_rf_detailed_text( + const RandomForestRegressorD* forest); + +template CUML_EXPORT std::string get_rf_json(const RandomForestClassifierF* forest); +template CUML_EXPORT std::string get_rf_json(const RandomForestClassifierD* forest); +template CUML_EXPORT std::string get_rf_json(const RandomForestRegressorF* forest); +template CUML_EXPORT std::string get_rf_json(const RandomForestRegressorD* forest); + +template CUML_EXPORT void delete_rf_metadata(RandomForestClassifierF* forest); +template CUML_EXPORT void delete_rf_metadata(RandomForestClassifierD* forest); +template CUML_EXPORT void delete_rf_metadata(RandomForestRegressorF* forest); +template CUML_EXPORT void delete_rf_metadata(RandomForestRegressorD* forest); + +template CUML_EXPORT void build_treelite_forest( + TreeliteModelHandle* model, const RandomForestMetaData* forest, int num_features); +template CUML_EXPORT void build_treelite_forest( + TreeliteModelHandle* model, const RandomForestMetaData* forest, int num_features); +template CUML_EXPORT void build_treelite_forest( + TreeliteModelHandle* model, const RandomForestMetaData* forest, int num_features); +template CUML_EXPORT void build_treelite_forest( TreeliteModelHandle* model, const RandomForestMetaData* forest, int num_features); // Template instantiations for get functions -template void compute_feature_importances( +template CUML_EXPORT void compute_feature_importances( const RandomForestMetaData* forest, float* importances); -template void compute_feature_importances( +template CUML_EXPORT void compute_feature_importances( const RandomForestMetaData* forest, double* importances); -template void compute_feature_importances( +template CUML_EXPORT void compute_feature_importances( const RandomForestMetaData* forest, float* importances); -template void compute_feature_importances( +template CUML_EXPORT void compute_feature_importances( const RandomForestMetaData* forest, double* importances); // Template instantiations for fit_treelite -template void fit_treelite(const raft::handle_t& user_handle, - TreeliteModelHandle* model, - float* input, - int n_rows, - int n_cols, - int* labels, - int n_unique_labels, - RF_params rf_params, - bool* bootstrap_masks, - float* feature_importances, - rapids_logger::level_enum verbosity); -template void fit_treelite(const raft::handle_t& user_handle, - TreeliteModelHandle* model, - double* input, - int n_rows, - int n_cols, - int* labels, - int n_unique_labels, - RF_params rf_params, - bool* bootstrap_masks, - double* feature_importances, - rapids_logger::level_enum verbosity); -template void fit_treelite(const raft::handle_t& user_handle, - TreeliteModelHandle* model, - float* input, - int n_rows, - int n_cols, - float* labels, - RF_params rf_params, - bool* bootstrap_masks, - float* feature_importances, - rapids_logger::level_enum verbosity); -template void fit_treelite(const raft::handle_t& user_handle, - TreeliteModelHandle* model, - double* input, - int n_rows, - int n_cols, - double* labels, - RF_params rf_params, - bool* bootstrap_masks, - double* feature_importances, - rapids_logger::level_enum verbosity); +template CUML_EXPORT void fit_treelite(const raft::handle_t& user_handle, + TreeliteModelHandle* model, + float* input, + int n_rows, + int n_cols, + int* labels, + int n_unique_labels, + RF_params rf_params, + bool* bootstrap_masks, + float* feature_importances, + rapids_logger::level_enum verbosity); +template CUML_EXPORT void fit_treelite(const raft::handle_t& user_handle, + TreeliteModelHandle* model, + double* input, + int n_rows, + int n_cols, + int* labels, + int n_unique_labels, + RF_params rf_params, + bool* bootstrap_masks, + double* feature_importances, + rapids_logger::level_enum verbosity); +template CUML_EXPORT void fit_treelite(const raft::handle_t& user_handle, + TreeliteModelHandle* model, + float* input, + int n_rows, + int n_cols, + float* labels, + RF_params rf_params, + bool* bootstrap_masks, + float* feature_importances, + rapids_logger::level_enum verbosity); +template CUML_EXPORT void fit_treelite(const raft::handle_t& user_handle, + TreeliteModelHandle* model, + double* input, + int n_rows, + int n_cols, + double* labels, + RF_params rf_params, + bool* bootstrap_masks, + double* feature_importances, + rapids_logger::level_enum verbosity); } // End namespace ML diff --git a/cpp/src/solver/lars.cu b/cpp/src/solver/lars.cu index 336eee8ddb..bf07cb6a53 100644 --- a/cpp/src/solver/lars.cu +++ b/cpp/src/solver/lars.cu @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ #include "lars_impl.cuh" +#include #include #include @@ -14,61 +15,61 @@ namespace Solver { namespace Lars { // Explicit instantiation -template void larsFit(const raft::handle_t& handle, - float* X, - int n_rows, - int n_cols, - const float* y, - float* beta, - int* active_idx, - float* alphas, - int* n_active, - float* Gram, - int max_iter, - float* coef_path, - rapids_logger::level_enum verbosity, - int ld_X, - int ld_G, - float eps); +template CUML_EXPORT void larsFit(const raft::handle_t& handle, + float* X, + int n_rows, + int n_cols, + const float* y, + float* beta, + int* active_idx, + float* alphas, + int* n_active, + float* Gram, + int max_iter, + float* coef_path, + rapids_logger::level_enum verbosity, + int ld_X, + int ld_G, + float eps); -template void larsFit(const raft::handle_t& handle, - double* X, - int n_rows, - int n_cols, - const double* y, - double* beta, - int* active_idx, - double* alphas, - int* n_active, - double* Gram, - int max_iter, - double* coef_path, - rapids_logger::level_enum verbosity, - int ld_X, - int ld_G, - double eps); +template CUML_EXPORT void larsFit(const raft::handle_t& handle, + double* X, + int n_rows, + int n_cols, + const double* y, + double* beta, + int* active_idx, + double* alphas, + int* n_active, + double* Gram, + int max_iter, + double* coef_path, + rapids_logger::level_enum verbosity, + int ld_X, + int ld_G, + double eps); -template void larsPredict(const raft::handle_t& handle, - const float* X, - int n_rows, - int n_cols, - int ld_X, - const float* beta, - int n_active, - int* active_idx, - float intercept, - float* preds); +template CUML_EXPORT void larsPredict(const raft::handle_t& handle, + const float* X, + int n_rows, + int n_cols, + int ld_X, + const float* beta, + int n_active, + int* active_idx, + float intercept, + float* preds); -template void larsPredict(const raft::handle_t& handle, - const double* X, - int n_rows, - int n_cols, - int ld_X, - const double* beta, - int n_active, - int* active_idx, - double intercept, - double* preds); +template CUML_EXPORT void larsPredict(const raft::handle_t& handle, + const double* X, + int n_rows, + int n_cols, + int ld_X, + const double* beta, + int n_active, + int* active_idx, + double intercept, + double* preds); }; // namespace Lars }; // namespace Solver }; // end namespace ML diff --git a/cpp/src/solver/lars_impl.cuh b/cpp/src/solver/lars_impl.cuh index 82b4fcb5d7..2f94f4566b 100644 --- a/cpp/src/solver/lars_impl.cuh +++ b/cpp/src/solver/lars_impl.cuh @@ -5,8 +5,10 @@ #pragma once +#include #include #include +#include #include #include @@ -872,13 +874,13 @@ void larsFit(const raft::handle_t& handle, idx_t* active_idx, math_t* alphas, idx_t* n_active, - math_t* Gram = nullptr, - int max_iter = 500, - math_t* coef_path = nullptr, - rapids_logger::level_enum verbosity = rapids_logger::level_enum::off, - idx_t ld_X = 0, - idx_t ld_G = 0, - math_t eps = -1) + math_t* Gram, + int max_iter, + math_t* coef_path, + rapids_logger::level_enum verbosity, + idx_t ld_X, + idx_t ld_G, + math_t eps) { ASSERT(n_cols > 0, "Parameter n_cols: number of columns cannot be less than one"); ASSERT(n_rows > 0, "Parameter n_rows: number of rows cannot be less than one"); diff --git a/cpp/src/svm/linear.cu b/cpp/src/svm/linear.cu index b24862f936..144d2cf96a 100644 --- a/cpp/src/svm/linear.cu +++ b/cpp/src/svm/linear.cu @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -419,40 +420,40 @@ void computeProbabilities(const raft::handle_t& handle, } // Explicit instantiations for library -template int fit(const raft::handle_t& handle, - const Params& params, - const std::size_t nRows, - const std::size_t nCols, - const int nClasses, - const float* classes, - const float* X, - const float* y, - const float* sampleWeight, - float* w, - float* probScale); -template int fit(const raft::handle_t& handle, - const Params& params, - const std::size_t nRows, - const std::size_t nCols, - const int nClasses, - const double* classes, - const double* X, - const double* y, - const double* sampleWeight, - double* w, - double* probScale); -template void computeProbabilities(const raft::handle_t& handle, - const std::size_t nRows, - const int nClasses, - const float* probScale, - float* scores, - float* out); -template void computeProbabilities(const raft::handle_t& handle, - const std::size_t nRows, - const int nClasses, - const double* probScale, - double* scores, - double* out); +template CUML_EXPORT int fit(const raft::handle_t& handle, + const Params& params, + const std::size_t nRows, + const std::size_t nCols, + const int nClasses, + const float* classes, + const float* X, + const float* y, + const float* sampleWeight, + float* w, + float* probScale); +template CUML_EXPORT int fit(const raft::handle_t& handle, + const Params& params, + const std::size_t nRows, + const std::size_t nCols, + const int nClasses, + const double* classes, + const double* X, + const double* y, + const double* sampleWeight, + double* w, + double* probScale); +template CUML_EXPORT void computeProbabilities(const raft::handle_t& handle, + const std::size_t nRows, + const int nClasses, + const float* probScale, + float* scores, + float* out); +template CUML_EXPORT void computeProbabilities(const raft::handle_t& handle, + const std::size_t nRows, + const int nClasses, + const double* probScale, + double* scores, + double* out); } // namespace linear } // namespace SVM diff --git a/cpp/src/svm/svc.cu b/cpp/src/svm/svc.cu index 61c6b1840b..4bc2a50a75 100644 --- a/cpp/src/svm/svc.cu +++ b/cpp/src/svm/svc.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -22,101 +22,101 @@ namespace SVM { using namespace MLCommon; // Explicit instantiation for the library -template int svcFit(const raft::handle_t& handle, - float* input, - int n_rows, - int n_cols, - float* labels, - const SvmParameter& param, - matrix::KernelParams& kernel_params, - SvmModel& model, - const float* sample_weight); - -template int svcFit(const raft::handle_t& handle, - double* input, - int n_rows, - int n_cols, - double* labels, - const SvmParameter& param, - matrix::KernelParams& kernel_params, - SvmModel& model, - const double* sample_weight); - -template int svcFitSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - float* data, - int n_rows, - int n_cols, - int nnz, - float* labels, - const SvmParameter& param, - matrix::KernelParams& kernel_params, - SvmModel& model, - const float* sample_weight); - -template int svcFitSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - double* data, - int n_rows, - int n_cols, - int nnz, - double* labels, - const SvmParameter& param, - matrix::KernelParams& kernel_params, - SvmModel& model, - const double* sample_weight); - -template void svcPredict(const raft::handle_t& handle, - float* input, - int n_rows, - int n_cols, - matrix::KernelParams& kernel_params, - const SvmModel& model, - float* preds, - float buffer_size, - bool predict_class); - -template void svcPredict(const raft::handle_t& handle, - double* input, - int n_rows, - int n_cols, - matrix::KernelParams& kernel_params, - const SvmModel& model, - double* preds, - double buffer_size, - bool predict_class); - -template void svcPredictSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - float* data, - int n_rows, - int n_cols, - int nnz, - matrix::KernelParams& kernel_params, - const SvmModel& model, - float* preds, - float buffer_size, - bool predict_class); - -template void svcPredictSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - double* data, +template CUML_EXPORT int svcFit(const raft::handle_t& handle, + float* input, int n_rows, int n_cols, - int nnz, + float* labels, + const SvmParameter& param, matrix::KernelParams& kernel_params, - const SvmModel& model, - double* preds, - double buffer_size, - bool predict_class); - -template void svmFreeBuffers(const raft::handle_t& handle, SvmModel& m); - -template void svmFreeBuffers(const raft::handle_t& handle, SvmModel& m); + SvmModel& model, + const float* sample_weight); + +template CUML_EXPORT int svcFit(const raft::handle_t& handle, + double* input, + int n_rows, + int n_cols, + double* labels, + const SvmParameter& param, + matrix::KernelParams& kernel_params, + SvmModel& model, + const double* sample_weight); + +template CUML_EXPORT int svcFitSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + float* data, + int n_rows, + int n_cols, + int nnz, + float* labels, + const SvmParameter& param, + matrix::KernelParams& kernel_params, + SvmModel& model, + const float* sample_weight); + +template CUML_EXPORT int svcFitSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + double* data, + int n_rows, + int n_cols, + int nnz, + double* labels, + const SvmParameter& param, + matrix::KernelParams& kernel_params, + SvmModel& model, + const double* sample_weight); + +template CUML_EXPORT void svcPredict(const raft::handle_t& handle, + float* input, + int n_rows, + int n_cols, + matrix::KernelParams& kernel_params, + const SvmModel& model, + float* preds, + float buffer_size, + bool predict_class); + +template CUML_EXPORT void svcPredict(const raft::handle_t& handle, + double* input, + int n_rows, + int n_cols, + matrix::KernelParams& kernel_params, + const SvmModel& model, + double* preds, + double buffer_size, + bool predict_class); + +template CUML_EXPORT void svcPredictSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + float* data, + int n_rows, + int n_cols, + int nnz, + matrix::KernelParams& kernel_params, + const SvmModel& model, + float* preds, + float buffer_size, + bool predict_class); + +template CUML_EXPORT void svcPredictSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + double* data, + int n_rows, + int n_cols, + int nnz, + matrix::KernelParams& kernel_params, + const SvmModel& model, + double* preds, + double buffer_size, + bool predict_class); + +template CUML_EXPORT void svmFreeBuffers(const raft::handle_t& handle, SvmModel& m); + +template CUML_EXPORT void svmFreeBuffers(const raft::handle_t& handle, SvmModel& m); template SVC::SVC(raft::handle_t& handle, @@ -169,8 +169,8 @@ void SVC::decisionFunction(math_t* input, int n_rows, int n_cols, math_t } // Instantiate templates for the shared library -template class SVC; -template class SVC; +template CUML_EXPORT class SVC; +template CUML_EXPORT class SVC; }; // namespace SVM }; // end namespace ML diff --git a/cpp/src/svm/svr.cu b/cpp/src/svm/svr.cu index ec735d0660..e73ae7eb7b 100644 --- a/cpp/src/svm/svr.cu +++ b/cpp/src/svm/svr.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -20,51 +21,51 @@ namespace ML { namespace SVM { // Explicit instantiation for the library -template int svrFit(const raft::handle_t& handle, - float* X, - int n_rows, - int n_cols, - float* y, - const SvmParameter& param, - ML::matrix::KernelParams& kernel_params, - SvmModel& model, - const float* sample_weight); +template CUML_EXPORT int svrFit(const raft::handle_t& handle, + float* X, + int n_rows, + int n_cols, + float* y, + const SvmParameter& param, + ML::matrix::KernelParams& kernel_params, + SvmModel& model, + const float* sample_weight); -template int svrFit(const raft::handle_t& handle, - double* X, - int n_rows, - int n_cols, - double* y, - const SvmParameter& param, - ML::matrix::KernelParams& kernel_params, - SvmModel& model, - const double* sample_weight); +template CUML_EXPORT int svrFit(const raft::handle_t& handle, + double* X, + int n_rows, + int n_cols, + double* y, + const SvmParameter& param, + ML::matrix::KernelParams& kernel_params, + SvmModel& model, + const double* sample_weight); -template int svrFitSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - float* data, - int n_rows, - int n_cols, - int nnz, - float* y, - const SvmParameter& param, - ML::matrix::KernelParams& kernel_params, - SvmModel& model, - const float* sample_weight); +template CUML_EXPORT int svrFitSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + float* data, + int n_rows, + int n_cols, + int nnz, + float* y, + const SvmParameter& param, + ML::matrix::KernelParams& kernel_params, + SvmModel& model, + const float* sample_weight); -template int svrFitSparse(const raft::handle_t& handle, - int* indptr, - int* indices, - double* data, - int n_rows, - int n_cols, - int nnz, - double* y, - const SvmParameter& param, - ML::matrix::KernelParams& kernel_params, - SvmModel& model, - const double* sample_weight); +template CUML_EXPORT int svrFitSparse(const raft::handle_t& handle, + int* indptr, + int* indices, + double* data, + int n_rows, + int n_cols, + int nnz, + double* y, + const SvmParameter& param, + ML::matrix::KernelParams& kernel_params, + SvmModel& model, + const double* sample_weight); }; // namespace SVM }; // end namespace ML