how to transfer an allocated array on GPU to solver-apply #1132
-
The d_b and d_x is two double arraies which have been allocated on GPU. I want to know how to transfer it to the solver-apply. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Can you please let us know the following info:
|
Beta Was this translation helpful? Give feedback.
-
I copy my reply from the same discussion #1131 Are the type of
or create the Dense on the preallocated array |
Beta Was this translation helpful? Give feedback.
I copy my reply from the same discussion #1131
Are the type of
d_b
andd_x
double*
?If they are, the solver needs to use the
gko::matrix::Dense<double>*
type.You can create the Dense matrix by reading a mtx file.
ex.
gko::read<gko::matrix::Dense<>>(std::ifstream("filepath"), exec);
or create the Dense first then fill in the data
or create the Dense on the preallocated array
auto x = gko::matrix::Dense<>::create(exec, gko::dim<2>(n, 1), gko::array<double>::view(exec, n, d_x));
note. array view to indicate the size and location for the plain pointer.