From e890bbfd2dcabce6ee2ddd62335d6e11fd22b793 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 12 Nov 2024 13:48:28 -0500 Subject: [PATCH] Removing more tests --- .../spectral/cluster_solvers_deprecated.cuh | 90 ------------- cpp/test/linalg/eigen_solvers.cu | 119 ------------------ cpp/test/sparse/spectral_matrix.cu | 84 ------------- 3 files changed, 293 deletions(-) delete mode 100644 cpp/include/raft/spectral/cluster_solvers_deprecated.cuh delete mode 100644 cpp/test/linalg/eigen_solvers.cu delete mode 100644 cpp/test/sparse/spectral_matrix.cu diff --git a/cpp/include/raft/spectral/cluster_solvers_deprecated.cuh b/cpp/include/raft/spectral/cluster_solvers_deprecated.cuh deleted file mode 100644 index 40b0324548..0000000000 --- a/cpp/include/raft/spectral/cluster_solvers_deprecated.cuh +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019-2024, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Note: This file is deprecated and will be removed in a future release - * Please use include/raft/cluster/kmeans.cuh instead - */ - -#ifndef __CLUSTER_SOLVERS_deprecated_H -#define __CLUSTER_SOLVERS_deprecated_H - -#pragma once - -#include - -#include // for std::pair - -namespace raft { -namespace spectral { - -using namespace matrix; - -// aggregate of control params for Eigen Solver: -// -template -struct cluster_solver_config_deprecated_t { - size_type_t n_clusters; - size_type_t maxIter; - - value_type_t tol; - - unsigned long long seed{123456}; -}; - -template -struct kmeans_solver_deprecated_t { - explicit kmeans_solver_deprecated_t( - cluster_solver_config_deprecated_t const& config) - : config_(config) - { - } - - std::pair solve(raft::resources const& handle, - size_type_t n_obs_vecs, - size_type_t dim, - value_type_t const* __restrict__ obs, - index_type_t* __restrict__ codes) const - { - RAFT_EXPECTS(obs != nullptr, "Null obs buffer."); - RAFT_EXPECTS(codes != nullptr, "Null codes buffer."); - value_type_t residual{}; - index_type_t iters{}; - - raft::cluster::kmeans(handle, - n_obs_vecs, - dim, - config_.n_clusters, - config_.tol, - config_.maxIter, - obs, - codes, - residual, - iters, - config_.seed); - return std::make_pair(residual, iters); - } - - auto const& get_config(void) const { return config_; } - - private: - cluster_solver_config_deprecated_t config_; -}; - -} // namespace spectral -} // namespace raft - -#endif \ No newline at end of file diff --git a/cpp/test/linalg/eigen_solvers.cu b/cpp/test/linalg/eigen_solvers.cu deleted file mode 100644 index cf75ff89bf..0000000000 --- a/cpp/test/linalg/eigen_solvers.cu +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2020-2023, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace raft { -namespace spectral { - -TEST(Raft, EigenSolvers) -{ - common::nvtx::range fun_scope("test::EigenSolvers"); - using namespace matrix; - using index_type = int; - using value_type = double; - - raft::resources h; - ASSERT_EQ(0, resource::get_device_id(h)); - - index_type* ro{nullptr}; - index_type* ci{nullptr}; - value_type* vs{nullptr}; - index_type nnz = 0; - index_type nrows = 0; - - sparse_matrix_t sm1{h, ro, ci, vs, nrows, nnz}; - ASSERT_EQ(nullptr, sm1.row_offsets_); - - index_type neigvs{10}; - index_type maxiter{100}; - index_type restart_iter{10}; - value_type tol{1.0e-10}; - bool reorthog{true}; - - // nullptr expected to trigger exceptions: - // - value_type* eigvals{nullptr}; - value_type* eigvecs{nullptr}; - std::uint64_t seed{100110021003}; - - eigen_solver_config_t cfg{ - neigvs, maxiter, restart_iter, tol, reorthog, seed}; - - lanczos_solver_t eig_solver{cfg}; - - EXPECT_ANY_THROW(eig_solver.solve_smallest_eigenvectors(h, sm1, eigvals, eigvecs)); - - EXPECT_ANY_THROW(eig_solver.solve_largest_eigenvectors(h, sm1, eigvals, eigvecs)); -} - -TEST(Raft, SpectralSolvers) -{ - common::nvtx::range fun_scope("test::SpectralSolvers"); - using namespace matrix; - using index_type = int; - using value_type = double; - - raft::resources h; - ASSERT_EQ(0, resource::get_device_id(h) - - ); - - index_type neigvs{10}; - index_type maxiter{100}; - index_type restart_iter{10}; - value_type tol{1.0e-10}; - bool reorthog{true}; - - // nullptr expected to trigger exceptions: - // - index_type* clusters{nullptr}; - value_type* eigvals{nullptr}; - value_type* eigvecs{nullptr}; - - unsigned long long seed{100110021003}; - - eigen_solver_config_t eig_cfg{ - neigvs, maxiter, restart_iter, tol, reorthog, seed}; - lanczos_solver_t eig_solver{eig_cfg}; - - index_type k{5}; - - cluster_solver_config_t clust_cfg{k, maxiter, tol, seed}; - kmeans_solver_t cluster_solver{clust_cfg}; - - sparse_matrix_t sm{h, nullptr, nullptr, nullptr, 0, 0}; - EXPECT_ANY_THROW( - spectral::partition(h, sm, eig_solver, cluster_solver, clusters, eigvals, eigvecs)); - - value_type edgeCut{0}; - value_type cost{0}; - EXPECT_ANY_THROW(spectral::analyzePartition(h, sm, k, clusters, edgeCut, cost)); -} - -} // namespace spectral -} // namespace raft diff --git a/cpp/test/sparse/spectral_matrix.cu b/cpp/test/sparse/spectral_matrix.cu deleted file mode 100644 index 52f7eff10e..0000000000 --- a/cpp/test/sparse/spectral_matrix.cu +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2020-2024, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include - -#include - -#include -#include - -namespace raft { -namespace spectral { -namespace matrix { -namespace { -template -struct csr_view_t { - index_type* offsets; - index_type* indices; - value_type* edge_data; - index_type number_of_vertices; - index_type number_of_edges; -}; -} // namespace -TEST(Raft, SpectralMatrices) -{ - using index_type = int; - using value_type = double; - - raft::resources h; - ASSERT_EQ(0, raft::resource::get_device_id(h)); - - csr_view_t csr_v{nullptr, nullptr, nullptr, 0, 0}; - - int const sz = 10; - vector_t d_v{h, sz}; - - index_type* ro{nullptr}; - index_type* ci{nullptr}; - value_type* vs{nullptr}; - index_type nnz = 0; - index_type nrows = 0; - sparse_matrix_t sm1{h, ro, ci, vs, nrows, nnz}; - sparse_matrix_t sm2{h, csr_v}; - ASSERT_EQ(nullptr, sm1.row_offsets_); - ASSERT_EQ(nullptr, sm2.row_offsets_); - - auto stream = resource::get_cuda_stream(h); - - auto cnstr_lm1 = [&h, ro, ci, vs, nrows, nnz](void) { - laplacian_matrix_t lm1{h, ro, ci, vs, nrows, nnz}; - }; - EXPECT_ANY_THROW(cnstr_lm1()); // because of nullptr ptr args - - auto cnstr_lm2 = [&h, &sm2](void) { laplacian_matrix_t lm2{h, sm2}; }; - EXPECT_ANY_THROW(cnstr_lm2()); // because of nullptr ptr args - - auto cnstr_mm1 = [&h, ro, ci, vs, nrows, nnz](void) { - modularity_matrix_t mm1{h, ro, ci, vs, nrows, nnz}; - }; - EXPECT_ANY_THROW(cnstr_mm1()); // because of nullptr ptr args - - auto cnstr_mm2 = [&h, &sm2](void) { modularity_matrix_t mm2{h, sm2}; }; - EXPECT_ANY_THROW(cnstr_mm2()); // because of nullptr ptr args -} - -} // namespace matrix -} // namespace spectral -} // namespace raft