PARALUTION  1.0.0
PARALUTION
cuda_kernels_dense.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_GPU_CUDA_KERNELS_DENSE_HPP_
2 #define PARALUTION_GPU_CUDA_KERNELS_DENSE_HPP_
3 
4 #include "../matrix_formats_ind.hpp"
5 
6 namespace paralution {
7 
8 // Replace column vector
9 template <typename ValueType, typename IndexType>
10 __global__ void kernel_dense_replace_column_vector(const ValueType *vec, const IndexType idx, const IndexType nrow,
11  const IndexType ncol, ValueType *mat) {
12 
13  IndexType ai = blockIdx.x * blockDim.x + threadIdx.x;
14 
15  if(ai < nrow)
16  mat[DENSE_IND(ai, idx, nrow, ncol)] = vec[ai];
17 
18 }
19 
20 // Replace row vector
21 template <typename ValueType, typename IndexType>
22 __global__ void kernel_dense_replace_row_vector(const ValueType *vec, const IndexType idx, const IndexType nrow,
23  const IndexType ncol, ValueType *mat) {
24 
25  IndexType aj = blockIdx.x * blockDim.x + threadIdx.x;
26 
27  if (aj < ncol)
28  mat[DENSE_IND(idx, aj, nrow, ncol)] = vec[aj];
29 
30 }
31 
32 // Extract column vector
33 template <typename ValueType, typename IndexType>
34 __global__ void kernel_dense_extract_column_vector(ValueType *vec, const IndexType idx, const IndexType nrow,
35  const IndexType ncol, const ValueType *mat) {
36 
37  IndexType ai = blockIdx.x * blockDim.x + threadIdx.x;
38 
39  if (ai < nrow)
40  vec[ai] = mat[DENSE_IND(ai, idx, nrow, ncol)];
41 
42 }
43 
44 // Extract row vector
45 template <typename ValueType, typename IndexType>
46 __global__ void kernel_dense_extract_row_vector(ValueType *vec, const IndexType idx, const IndexType nrow,
47  const IndexType ncol, const ValueType *mat) {
48 
49  IndexType aj = blockIdx.x * blockDim.x + threadIdx.x;
50 
51  if (aj < ncol)
52  vec[aj] = mat[DENSE_IND(idx, aj, nrow, ncol)];
53 
54 }
55 
56 
57 }
58 
59 #endif
__global__ void kernel_dense_extract_column_vector(ValueType *vec, const IndexType idx, const IndexType nrow, const IndexType ncol, const ValueType *mat)
Definition: cuda_kernels_dense.hpp:34
__global__ void kernel_dense_replace_column_vector(const ValueType *vec, const IndexType idx, const IndexType nrow, const IndexType ncol, ValueType *mat)
Definition: cuda_kernels_dense.hpp:10
const IndexType idx
Definition: cuda_kernels_coo.hpp:115
__global__ void kernel_dense_replace_row_vector(const ValueType *vec, const IndexType idx, const IndexType nrow, const IndexType ncol, ValueType *mat)
Definition: cuda_kernels_dense.hpp:22
#define DENSE_IND(ai, aj, nrow, ncol)
Definition: matrix_formats_ind.hpp:7
Definition: backend_manager.cpp:43
__global__ void kernel_dense_extract_row_vector(ValueType *vec, const IndexType idx, const IndexType nrow, const IndexType ncol, const ValueType *mat)
Definition: cuda_kernels_dense.hpp:46