[Trilinos-Users] Attempt to access inaccessible memory in Kokkos
Ashesh Chattopadhyay
ashesh6810 at gmail.com
Wed Apr 12 21:49:55 EDT 2017
Dear All,
I have been trying to use simple functors to write kokkos code for a dot
product of two vectors. I have been getting this runtime error
*:0: : block: [0,0,0], thread: [0,0,0] Assertion `Kokkos::View ERROR:
attempt to access inaccessible memory space` failed.*
the code is:
#include<Kokkos_Core.hpp>
#include<cstdio>
typedef Kokkos::CudaSpace memspace;
typedef Kokkos::View<double*,memspace> view_vectype;
struct fill_vec{
view_vectype::HostMirror b;
fill_vec(view_vectype::HostMirror b_) : b(b_){}
KOKKOS_INLINE_FUNCTION
void operator()(int i) const{
b(i)=i;
}
};
int main(int argc,char* argv[])
{
int N=1024;
Kokkos::initialize(argc,argv);
view_vectype devA("devA",N);
view_vectype devB("devB",N);
view_vectype::HostMirror A=Kokkos::create_mirror_view(devA);
view_vectype::HostMirror B=Kokkos::create_mirror_view(devB);
Kokkos::parallel_for(N,fill_vec(A));
Kokkos::parallel_for(N,fill_vec(B));
Kokkos::deep_copy(devA,A);
Kokkos::deep_copy(devB,B);
double result=0;
Kokkos::parallel_reduce(N,KOKKOS_LAMBDA(int j, double &update){
update+=devA(j)*devB(j);
},result);
printf("result is: %d", result);
Kindly suggest where I am going wrong in defining memory spaces.
Thanks
Ashesh
--
Research Assistant, Multi-Scale Multi-Physics Computation Lab
University of Texas at El Paso
Texas, El Paso, USA
(+1) 915-355-5013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170412/dd0b72f3/attachment.html>
More information about the Trilinos-Users
mailing list