Skip to content

Commit

Permalink
Fixing cugraph for RAFT spectral/lap API changes (#2067)
Browse files Browse the repository at this point in the history
Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #2067
  • Loading branch information
cjnolet authored Feb 10, 2022
1 parent 2cbf6c5 commit 8c6a467
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
26 changes: 13 additions & 13 deletions cpp/src/community/legacy/spectral_clustering.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,15 +92,15 @@ void balancedCutClustering_impl(legacy::GraphCSRView<vertex_t, edge_t, weight_t>
using index_type = vertex_t;
using value_type = weight_t;

raft::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};
raft::spectral::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};

raft::eigen_solver_config_t<index_type, value_type> eig_cfg{
raft::spectral::eigen_solver_config_t<index_type, value_type> eig_cfg{
n_eig_vects, evs_max_it, restartIter_lanczos, evs_tol, reorthog, seed};
raft::lanczos_solver_t<index_type, value_type> eig_solver{eig_cfg};
raft::spectral::lanczos_solver_t<index_type, value_type> eig_solver{eig_cfg};

raft::cluster_solver_config_t<index_type, value_type> clust_cfg{
raft::spectral::cluster_solver_config_t<index_type, value_type> clust_cfg{
n_clusters, kmean_max_it, kmean_tol, seed};
raft::kmeans_solver_t<index_type, value_type> cluster_solver{clust_cfg};
raft::spectral::kmeans_solver_t<index_type, value_type> cluster_solver{clust_cfg};

raft::spectral::partition(
handle, r_csr_m, eig_solver, cluster_solver, clustering, eig_vals, eig_vects);
Expand Down Expand Up @@ -160,15 +160,15 @@ void spectralModularityMaximization_impl(
using index_type = vertex_t;
using value_type = weight_t;

raft::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};
raft::spectral::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};

raft::eigen_solver_config_t<index_type, value_type> eig_cfg{
raft::spectral::eigen_solver_config_t<index_type, value_type> eig_cfg{
n_eig_vects, evs_max_it, restartIter_lanczos, evs_tol, reorthog, seed};
raft::lanczos_solver_t<index_type, value_type> eig_solver{eig_cfg};
raft::spectral::lanczos_solver_t<index_type, value_type> eig_solver{eig_cfg};

raft::cluster_solver_config_t<index_type, value_type> clust_cfg{
raft::spectral::cluster_solver_config_t<index_type, value_type> clust_cfg{
n_clusters, kmean_max_it, kmean_tol, seed};
raft::kmeans_solver_t<index_type, value_type> cluster_solver{clust_cfg};
raft::spectral::kmeans_solver_t<index_type, value_type> cluster_solver{clust_cfg};

// not returned...
// auto result =
Expand All @@ -192,7 +192,7 @@ void analyzeModularityClustering_impl(legacy::GraphCSRView<vertex_t, edge_t, wei
using index_type = vertex_t;
using value_type = weight_t;

raft::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};
raft::spectral::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};

weight_t mod;
raft::spectral::analyzeModularity(handle, r_csr_m, n_clusters, clustering, mod);
Expand All @@ -218,7 +218,7 @@ void analyzeBalancedCut_impl(legacy::GraphCSRView<vertex_t, edge_t, weight_t> co
using index_type = vertex_t;
using value_type = weight_t;

raft::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};
raft::spectral::matrix::sparse_matrix_t<index_type, value_type> const r_csr_m{handle, graph};

raft::spectral::analyzePartition(handle, r_csr_m, n_clusters, clustering, edge_cut, cost);

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/linear_assignment/hungarian.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
#include <cugraph/legacy/graph.hpp>
#include <cugraph/utilities/error.hpp>

#include <raft/lap/lap.cuh>
#include <raft/lap/lap.hpp>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/device_uvector.hpp>
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/utilities/spmv_1D.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MGcsrmv<vertex_t, edge_t, weight_t>::~MGcsrmv()
template <typename vertex_t, typename edge_t, typename weight_t>
void MGcsrmv<vertex_t, edge_t, weight_t>::run(weight_t* x)
{
using namespace raft::matrix;
using namespace raft::spectral::matrix;

weight_t h_one = 1.0;
weight_t h_zero = 0.0;
Expand All @@ -64,11 +64,11 @@ void MGcsrmv<vertex_t, edge_t, weight_t>::run(weight_t* x)
static_cast<vertex_t>(v_glob_), // n_cols
static_cast<vertex_t>(e_loc_)}; // nnz

mat.mv(h_one, // alpha
x, // x
h_zero, // beta
y_loc_.data().get(), // y
sparse_mv_alg_t::SPARSE_MV_ALG2); // SpMV algorithm
mat.mv(h_one, // alpha
x, // x
h_zero, // beta
y_loc_.data().get(), // y
raft::spectral::matrix::sparse_mv_alg_t::SPARSE_MV_ALG2); // SpMV algorithm

auto stream = handle_.get_stream();

Expand Down

0 comments on commit 8c6a467

Please sign in to comment.