Skip to content

Commit

Permalink
Updating RAFT linalg headers (rapidsai#4515)
Browse files Browse the repository at this point in the history
Depends on rapidsai/raft#383

Authors:
  - Divye Gala (https://github.com/divyegala)
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#4515
  • Loading branch information
divyegala authored Feb 8, 2022
1 parent 5671fa7 commit 94166bc
Show file tree
Hide file tree
Showing 129 changed files with 944 additions and 888 deletions.
4 changes: 2 additions & 2 deletions cpp/bench/prims/add.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@ -15,7 +15,7 @@
*/

#include <common/ml_benchmark.hpp>
#include <raft/linalg/add.cuh>
#include <raft/linalg/add.hpp>

namespace MLCommon {
namespace Bench {
Expand Down
2 changes: 1 addition & 1 deletion cpp/bench/prims/fused_l2_nn.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <raft/cudart_utils.h>
#include <raft/distance/fused_l2_nn.hpp>
#include <raft/handle.hpp>
#include <raft/linalg/norm.cuh>
#include <raft/linalg/norm.hpp>
#include <raft/random/rng.hpp>
#include <raft/spatial/knn/specializations.hpp>

Expand Down
3 changes: 2 additions & 1 deletion cpp/bench/prims/gram_matrix.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#include <matrix/grammatrix.cuh>
#include <matrix/kernelfactory.cuh>
#include <memory>
#include <raft/linalg/cublas_wrappers.h>
// #TODO: Replace with public header when ready
#include <raft/linalg/detail/cublas_wrappers.hpp>
#include <raft/random/rng.hpp>
#include <sstream>
#include <string>
Expand Down
4 changes: 2 additions & 2 deletions cpp/bench/prims/map_then_reduce.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@ -15,7 +15,7 @@
*/

#include <common/ml_benchmark.hpp>
#include <raft/linalg/map_then_reduce.cuh>
#include <raft/linalg/map_then_reduce.hpp>

namespace MLCommon {
namespace Bench {
Expand Down
4 changes: 2 additions & 2 deletions cpp/bench/prims/matrix_vector_op.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@ -15,7 +15,7 @@
*/

#include <common/ml_benchmark.hpp>
#include <raft/linalg/matrix_vector_op.cuh>
#include <raft/linalg/matrix_vector_op.hpp>

namespace MLCommon {
namespace Bench {
Expand Down
4 changes: 2 additions & 2 deletions cpp/bench/prims/reduce.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@ -15,7 +15,7 @@
*/

#include <common/ml_benchmark.hpp>
#include <raft/linalg/reduce.cuh>
#include <raft/linalg/reduce.hpp>

namespace MLCommon {
namespace Bench {
Expand Down
4 changes: 2 additions & 2 deletions cpp/bench/sg/dataset.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/linalg/transpose.h>
#include <raft/linalg/unary_op.cuh>
#include <raft/linalg/transpose.hpp>
#include <raft/linalg/unary_op.hpp>
#include <random/make_regression.cuh>
#include <sstream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion cpp/bench/sg/linkage.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "benchmark.cuh"
#include <cuml/cluster/linkage.hpp>
#include <cuml/common/logger.hpp>
#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>
#include <raft/sparse/hierarchy/common.h>
#include <utility>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/cluster/dbscan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>

#include <cuml/common/log_levels.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/cluster/hdbscan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>

#include <raft/handle.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/cluster/linkage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>
#include <raft/sparse/hierarchy/common.h>

#include <raft/handle.hpp>
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuml/metrics/metrics.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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 @@

#pragma once

#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>

#include <cstdint>

Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuml/neighbors/knn.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@

#pragma once

#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>
#include <raft/spatial/knn/ann_common.h>
#include <raft/spatial/knn/ball_cover_common.h>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/neighbors/knn_sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <cusparse_v2.h>

#include <cuml/neighbors/knn.hpp>
#include <raft/linalg/distance_type.h>
#include <raft/distance/distance_type.hpp>

namespace raft {
class handle_t;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arima/batched_arima.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/linalg/matrix_vector_op.cuh>
#include <raft/linalg/matrix_vector_op.hpp>
#include <rmm/device_uvector.hpp>
#include <timeSeries/arima_helpers.cuh>
#include <timeSeries/fillna.cuh>
Expand Down
83 changes: 43 additions & 40 deletions cpp/src/arima/batched_kalman.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/linalg/binary_op.cuh>
#include <raft/linalg/cublas_wrappers.h>
#include <raft/linalg/add.hpp>
// #TODO: Replace with public header when ready
#include <raft/linalg/detail/cublas_wrappers.hpp>
#include <rmm/device_uvector.hpp>

#include <linalg/batched/matrix.cuh>
Expand Down Expand Up @@ -1222,48 +1223,50 @@ void _batched_kalman_filter(raft::handle_t& handle,

double alpha = 1.0;
double beta = 0.0;
RAFT_CUBLAS_TRY(raft::linalg::cublasgemmStridedBatched(cublasHandle,
CUBLAS_OP_N,
CUBLAS_OP_N,
nobs,
1,
order.n_exog,
&alpha,
d_exog,
nobs,
nobs * order.n_exog,
d_beta,
order.n_exog,
order.n_exog,
&beta,
obs_intercept.data(),
nobs,
nobs,
batch_size,
stream));
// #TODO: Call from public API when ready
RAFT_CUBLAS_TRY(raft::linalg::detail::cublasgemmStridedBatched(cublasHandle,
CUBLAS_OP_N,
CUBLAS_OP_N,
nobs,
1,
order.n_exog,
&alpha,
d_exog,
nobs,
nobs * order.n_exog,
d_beta,
order.n_exog,
order.n_exog,
&beta,
obs_intercept.data(),
nobs,
nobs,
batch_size,
stream));

if (fc_steps > 0) {
obs_intercept_fut.resize(fc_steps * batch_size, stream);

RAFT_CUBLAS_TRY(raft::linalg::cublasgemmStridedBatched(cublasHandle,
CUBLAS_OP_N,
CUBLAS_OP_N,
fc_steps,
1,
order.n_exog,
&alpha,
d_exog_fut,
fc_steps,
fc_steps * order.n_exog,
d_beta,
order.n_exog,
order.n_exog,
&beta,
obs_intercept_fut.data(),
fc_steps,
fc_steps,
batch_size,
stream));
// #TODO: Call from public API when ready
RAFT_CUBLAS_TRY(raft::linalg::detail::cublasgemmStridedBatched(cublasHandle,
CUBLAS_OP_N,
CUBLAS_OP_N,
fc_steps,
1,
order.n_exog,
&alpha,
d_exog_fut,
fc_steps,
fc_steps * order.n_exog,
d_beta,
order.n_exog,
order.n_exog,
&beta,
obs_intercept_fut.data(),
fc_steps,
fc_steps,
batch_size,
stream));
}
}

Expand Down
6 changes: 4 additions & 2 deletions cpp/src/common/cumlHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

#include <cuml/common/logger.hpp>
#include <raft/cudart_utils.h>
#include <raft/linalg/cublas_wrappers.h>
#include <raft/linalg/cusolver_wrappers.h>
// #TODO: Replace with public header when ready
#include <raft/linalg/detail/cublas_wrappers.hpp>
// #TODO: Replace with public header when ready
#include <raft/linalg/detail/cusolver_wrappers.hpp>
#include <raft/mr/device/allocator.hpp>
#include <raft/mr/host/allocator.hpp>
#include <raft/sparse/cusparse_wrappers.h>
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/dbscan/vertexdeg/precomputed.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/device_atomics.cuh>
#include <raft/linalg/coalesced_reduction.cuh>
#include <raft/linalg/reduce.cuh>
#include <raft/linalg/coalesced_reduction.hpp>
#include <raft/linalg/reduce.hpp>

#include "pack.h"

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/decisiontree/batched-levelalgo/split.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#pragma once

#include <raft/cuda_utils.cuh>
#include <raft/linalg/unary_op.cuh>
#include <raft/linalg/unary_op.hpp>

namespace ML {
namespace DT {
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/genetic/fitness.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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 @@ -15,10 +15,10 @@
*/

#include <raft/cuda_utils.cuh>
#include <raft/linalg/eltwise.cuh>
#include <raft/linalg/matrix_vector_op.cuh>
#include <raft/linalg/strided_reduction.cuh>
#include <raft/linalg/unary_op.cuh>
#include <raft/linalg/eltwise.hpp>
#include <raft/linalg/matrix_vector_op.hpp>
#include <raft/linalg/strided_reduction.hpp>
#include <raft/linalg/unary_op.hpp>
#include <raft/matrix/math.hpp>
#include <raft/stats/mean.hpp>
#include <raft/stats/mean_center.hpp>
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/genetic/genetic.cu
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/linalg/binary_op.cuh>
#include <raft/linalg/unary_op.cuh>
#include <raft/linalg/add.hpp>
#include <raft/linalg/unary_op.hpp>
#include <raft/random/rng.hpp>

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/genetic/program.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cuml/genetic/node.h>
#include <cuml/genetic/program.h>
#include <raft/cudart_utils.h>
#include <raft/linalg/unary_op.cuh>
#include <raft/linalg/unary_op.hpp>
#include <rmm/device_uvector.hpp>

#include <algorithm>
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/glm/ols.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#pragma once

#include <linalg/lstsq.cuh>
#include <raft/linalg/add.cuh>
#include <raft/linalg/gemv.h>
#include <raft/linalg/norm.cuh>
#include <raft/linalg/subtract.cuh>
#include <raft/linalg/add.hpp>
#include <raft/linalg/gemv.hpp>
#include <raft/linalg/norm.hpp>
#include <raft/linalg/subtract.hpp>
#include <raft/matrix/math.hpp>
#include <raft/matrix/matrix.hpp>
#include <raft/stats/mean.hpp>
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/glm/ols_mg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#include <raft/comms/comms.hpp>
#include <raft/cuda_utils.cuh>
#include <raft/linalg/add.cuh>
#include <raft/linalg/gemm.cuh>
#include <raft/linalg/add.hpp>
#include <raft/linalg/gemm.hpp>
#include <raft/matrix/math.hpp>
#include <raft/matrix/matrix.hpp>
#include <raft/mr/device/allocator.hpp>
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/glm/preprocess.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION.
* Copyright (c) 2018-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 @@ -17,8 +17,8 @@
#pragma once

#include <raft/cudart_utils.h>
#include <raft/linalg/gemm.cuh>
#include <raft/linalg/norm.cuh>
#include <raft/linalg/gemm.hpp>
#include <raft/linalg/norm.hpp>
#include <raft/matrix/math.hpp>
#include <raft/matrix/matrix.hpp>
#include <raft/stats/mean.hpp>
Expand Down
Loading

0 comments on commit 94166bc

Please sign in to comment.