From 0083a4d3b136063067d76f65511d6274ddd8dd13 Mon Sep 17 00:00:00 2001 From: Simon Adorf Date: Wed, 29 Jan 2025 07:21:51 -0800 Subject: [PATCH 1/2] Log UMAP arrays at trace verbosity level. --- cpp/src/umap/fuzzy_simpl_set/naive.cuh | 14 +++++++------- cpp/src/umap/simpl_set_embed/algo.cuh | 4 ++-- cpp/src/umap/supervised.cuh | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cpp/src/umap/fuzzy_simpl_set/naive.cuh b/cpp/src/umap/fuzzy_simpl_set/naive.cuh index 41e54f1f63..62ecf46530 100644 --- a/cpp/src/umap/fuzzy_simpl_set/naive.cuh +++ b/cpp/src/umap/fuzzy_simpl_set/naive.cuh @@ -314,12 +314,12 @@ void launcher(int n, raft::sparse::COO in(stream, n * n_neighbors, n, n); // check for logging in order to avoid the potentially costly `arr2Str` call! - if (ML::default_logger().should_log(ML::level_enum::debug)) { - CUML_LOG_DEBUG("Smooth kNN Distances"); + if (ML::default_logger().should_log(ML::level_enum::trace)) { + CUML_LOG_TRACE("Smooth kNN Distances"); auto str = raft::arr2Str(sigmas.data(), 25, "sigmas", stream); - CUML_LOG_DEBUG("%s", str.c_str()); + CUML_LOG_TRACE("%s", str.c_str()); str = raft::arr2Str(rhos.data(), 25, "rhos", stream); - CUML_LOG_DEBUG("%s", str.c_str()); + CUML_LOG_TRACE("%s", str.c_str()); } RAFT_CUDA_TRY(cudaPeekAtLastError()); @@ -342,11 +342,11 @@ void launcher(int n, n_neighbors); RAFT_CUDA_TRY(cudaPeekAtLastError()); - if (ML::default_logger().should_log(ML::level_enum::debug)) { - CUML_LOG_DEBUG("Compute Membership Strength"); + if (ML::default_logger().should_log(ML::level_enum::trace)) { + CUML_LOG_TRACE("Compute Membership Strength"); std::stringstream ss; ss << in; - CUML_LOG_DEBUG(ss.str().c_str()); + CUML_LOG_TRACE(ss.str().c_str()); } /** diff --git a/cpp/src/umap/simpl_set_embed/algo.cuh b/cpp/src/umap/simpl_set_embed/algo.cuh index 6be8b0235b..912b42bf77 100644 --- a/cpp/src/umap/simpl_set_embed/algo.cuh +++ b/cpp/src/umap/simpl_set_embed/algo.cuh @@ -341,10 +341,10 @@ void launcher( make_epochs_per_sample(out.vals(), out.nnz, n_epochs, epochs_per_sample.data(), stream); - if (ML::default_logger().should_log(ML::level_enum::debug)) { + if (ML::default_logger().should_log(ML::level_enum::trace)) { std::stringstream ss; ss << raft::arr2Str(epochs_per_sample.data(), out.nnz, "epochs_per_sample", stream); - CUML_LOG_DEBUG(ss.str().c_str()); + CUML_LOG_TRACE(ss.str().c_str()); } optimize_layout(embedding, diff --git a/cpp/src/umap/supervised.cuh b/cpp/src/umap/supervised.cuh index 1a9739f280..cb592dc90e 100644 --- a/cpp/src/umap/supervised.cuh +++ b/cpp/src/umap/supervised.cuh @@ -301,15 +301,15 @@ void perform_general_intersection(const raft::handle_t& handle, handle, y_inputs, y_inputs, knn_graph, params->target_n_neighbors, params, stream); RAFT_CUDA_TRY(cudaPeekAtLastError()); - if (ML::default_logger().should_log(ML::level_enum::debug)) { - CUML_LOG_DEBUG("Target kNN Graph"); + if (ML::default_logger().should_log(ML::level_enum::trace)) { + CUML_LOG_TRACE("Target kNN Graph"); std::stringstream ss1, ss2; ss1 << raft::arr2Str( y_knn_indices.data(), rgraph_coo->n_rows * params->target_n_neighbors, "knn_indices", stream); - CUML_LOG_DEBUG("%s", ss1.str().c_str()); + CUML_LOG_TRACE("%s", ss1.str().c_str()); ss2 << raft::arr2Str( y_knn_dists.data(), rgraph_coo->n_rows * params->target_n_neighbors, "knn_dists", stream); - CUML_LOG_DEBUG("%s", ss2.str().c_str()); + CUML_LOG_TRACE("%s", ss2.str().c_str()); } /** From 16f79b3998714872bc7f1a99a575b0e4d66c8dda Mon Sep 17 00:00:00 2001 From: Simon Adorf Date: Wed, 29 Jan 2025 07:58:25 -0800 Subject: [PATCH 2/2] Only log arrays at trace level. --- cpp/src/umap/fuzzy_simpl_set/naive.cuh | 4 ++-- cpp/src/umap/supervised.cuh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/src/umap/fuzzy_simpl_set/naive.cuh b/cpp/src/umap/fuzzy_simpl_set/naive.cuh index 62ecf46530..6513de468f 100644 --- a/cpp/src/umap/fuzzy_simpl_set/naive.cuh +++ b/cpp/src/umap/fuzzy_simpl_set/naive.cuh @@ -313,9 +313,9 @@ void launcher(int n, raft::sparse::COO in(stream, n * n_neighbors, n, n); + CUML_LOG_DEBUG("Smooth kNN Distances"); // check for logging in order to avoid the potentially costly `arr2Str` call! if (ML::default_logger().should_log(ML::level_enum::trace)) { - CUML_LOG_TRACE("Smooth kNN Distances"); auto str = raft::arr2Str(sigmas.data(), 25, "sigmas", stream); CUML_LOG_TRACE("%s", str.c_str()); str = raft::arr2Str(rhos.data(), 25, "rhos", stream); @@ -342,8 +342,8 @@ void launcher(int n, n_neighbors); RAFT_CUDA_TRY(cudaPeekAtLastError()); + CUML_LOG_DEBUG("Compute Membership Strength"); if (ML::default_logger().should_log(ML::level_enum::trace)) { - CUML_LOG_TRACE("Compute Membership Strength"); std::stringstream ss; ss << in; CUML_LOG_TRACE(ss.str().c_str()); diff --git a/cpp/src/umap/supervised.cuh b/cpp/src/umap/supervised.cuh index cb592dc90e..1b75ba3beb 100644 --- a/cpp/src/umap/supervised.cuh +++ b/cpp/src/umap/supervised.cuh @@ -301,8 +301,8 @@ void perform_general_intersection(const raft::handle_t& handle, handle, y_inputs, y_inputs, knn_graph, params->target_n_neighbors, params, stream); RAFT_CUDA_TRY(cudaPeekAtLastError()); + CUML_LOG_DEBUG("Target kNN Graph"); if (ML::default_logger().should_log(ML::level_enum::trace)) { - CUML_LOG_TRACE("Target kNN Graph"); std::stringstream ss1, ss2; ss1 << raft::arr2Str( y_knn_indices.data(), rgraph_coo->n_rows * params->target_n_neighbors, "knn_indices", stream);