Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for raft logger changes #6187

Merged
merged 17 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ if(BUILD_CUML_CPP_LIBRARY)
# These are always private:
list(APPEND _cuml_cpp_private_libs
raft::raft
rmm::rmm_logger_impl
raft::raft_logger_impl
$<TARGET_NAME_IF_EXISTS:GPUTreeShap::GPUTreeShap>
$<$<BOOL:${LINK_CUFFT}>:CUDA::cufft${_ctk_fft_static_suffix}>
${TREELITE_LIBS}
Expand Down Expand Up @@ -629,7 +631,6 @@ if(BUILD_CUML_CPP_LIBRARY)
PUBLIC rmm::rmm rmm::rmm_logger ${CUVS_LIB}
${_cuml_cpp_public_libs}
PRIVATE ${_cuml_cpp_private_libs}
rmm::rmm_logger_impl
)

# If we export the libdmlc symbols, they can lead to weird crashes with other
Expand Down
2 changes: 1 addition & 1 deletion cpp/bench/sg/kmeans.cu
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ std::vector<Params> getInputs()
p.kmeans.init = ML::kmeans::KMeansParams::InitMethod(0);
p.kmeans.max_iter = 300;
p.kmeans.tol = 1e-4;
p.kmeans.verbosity = RAFT_LEVEL_INFO;
p.kmeans.verbosity = raft::level_enum::info;
p.kmeans.metric = cuvs::distance::DistanceType::L2Expanded;
p.kmeans.rng_state = raft::random::RngState(p.blobs.seed);
p.kmeans.inertia_check = true;
Expand Down
5 changes: 4 additions & 1 deletion cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ function(ConfigureTest)
$<$<BOOL:${LINK_CUFFT}>:CUDA::cufft${_ctk_static_suffix_cufft}>
rmm::rmm
rmm::rmm_logger
rmm::rmm_logger_impl
raft::raft
raft::raft_logger
test_logger_impls
GTest::gtest
GTest::gtest_main
GTest::gmock
Expand Down Expand Up @@ -107,6 +108,8 @@ function(ConfigureTest)

endfunction()

add_library(test_logger_impls OBJECT)
target_link_libraries(test_logger_impls PRIVATE rmm::rmm_logger_impl raft::raft_logger_impl)

##############################################################################
# - build ml_test executable -------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion python/cuml/cuml/cluster/kmeans.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ IF GPUBUILD == 1:
from cuml.metrics.distance_type cimport DistanceType
from cuml.cluster.kmeans_utils cimport params as KMeansParams
from cuml.cluster.kmeans_utils cimport KMeansPlusPlus, Random, Array
from cuml.cluster cimport kmeans_utils

# Avoid potential future conflicts with cuml's level enum
ctypedef kmeans_utils.level_enum raft_level_enum

from cuml.internals.array import CumlArray
from cuml.common.array_descriptor import CumlArrayDescriptor
Expand Down Expand Up @@ -205,7 +209,7 @@ class KMeans(UniversalBase,
params.init = self._params_init
params.max_iter = <int>self.max_iter
params.tol = <double>self.tol
params.verbosity = <int>self.verbose
params.verbosity = <raft_level_enum>(<int>self.verbose)
params.rng_state.seed = self.random_state
params.metric = DistanceType.L2Expanded # distance metric as squared L2: @todo - support other metrics # noqa: E501
params.batch_samples = <int>self.max_samples_per_batch
Expand Down
14 changes: 13 additions & 1 deletion python/cuml/cuml/cluster/kmeans_utils.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,26 @@ cdef extern from "cuml/cluster/kmeans.hpp" namespace \
"cuvs::cluster::kmeans::params":
enum InitMethod:
KMeansPlusPlus, Random, Array

cdef extern from "raft/core/logger.hpp" namespace "raft":
vyasr marked this conversation as resolved.
Show resolved Hide resolved
cdef enum class level_enum:
trace
debug
info
warn
error
critical
off
n_levels

cdef extern from "cuvs/cluster/kmeans.hpp" namespace \
"cuvs::cluster::kmeans":
cdef struct params:
int n_clusters,
InitMethod init
int max_iter,
double tol,
int verbosity,
level_enum verbosity,
RngState rng_state,
DistanceType metric,
int n_init,
Expand Down
Loading