1 #ifndef PARALUTION_OCL_KERNELS_HYB_HPP_
2 #define PARALUTION_OCL_KERNELS_HYB_HPP_
7 "__kernel void kernel_ell_nnz_coo(const int nrow, const int max_row,\n"
8 " __global const int *row_offset, __global int *nnz_coo) {\n"
10 " int gid = get_global_id(0);\n"
12 " if (gid < nrow) {\n"
14 " nnz_coo[gid] = 0;\n"
15 " int nnz_per_row = row_offset[gid+1] - row_offset[gid];\n"
17 " if (nnz_per_row > max_row)\n"
18 " nnz_coo[gid] = nnz_per_row - max_row;\n"
24 "__kernel void kernel_ell_fill_ell(const int nrow, const int max_row,\n"
25 " __global const int *row_offset, __global const int *col,\n"
26 " __global const ValueType *val, __global int *ELL_col,\n"
27 " __global ValueType *ELL_val, __global int *nnz_ell) {\n"
29 " int gid = get_global_id(0);\n"
31 " if (gid < nrow) {\n"
35 " for (int i=row_offset[gid]; i<row_offset[gid+1]; ++i) {\n"
37 " if (n >= max_row) break;\n"
39 " int idx = n * nrow + gid;\n"
41 " ELL_col[idx] = col[i];\n"
42 " ELL_val[idx] = val[i];\n"
48 " nnz_ell[gid] = n;\n"
54 "__kernel void kernel_ell_fill_coo(const int nrow, __global const int *row_offset,\n"
55 " __global const int *col, __global const ValueType *val,\n"
56 " __global const int *nnz_coo, __global const int *nnz_ell,\n"
57 " __global int *COO_row, __global int *COO_col, __global ValueType *COO_val) {\n"
59 " int gid = get_global_id(0);\n"
61 " if (gid < nrow) {\n"
63 " int row_ptr = row_offset[gid+1];\n"
65 " for (int i=row_ptr - nnz_coo[gid]; i<row_ptr; ++i) {\n"
67 " int idx = i - nnz_ell[gid];\n"
69 " COO_row[idx] = gid;\n"
70 " COO_col[idx] = col[i];\n"
71 " COO_val[idx] = val[i];\n"
82 #endif // PARALUTION_OCL_KERNELS_HYB_HPP_
const char * ocl_kernels_hyb
Definition: ocl_kernels_hyb.hpp:6
Definition: backend_manager.cpp:43