1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Fast init on GPU

This commit is contained in:
Peter Boyle 2024-08-27 11:22:33 -04:00
parent 6cfb90e99f
commit 06db4ddea2

View File

@ -236,17 +236,17 @@ public:
template<class sobj> inline Lattice<vobj> & operator = (const sobj & r){
vobj vtmp;
vtmp = r;
#if 1
auto me = View(CpuWrite);
thread_for(ss,me.size(),{
me[ss]= r;
});
#else
#if defined(GRID_HIP) || defined(GRID_CUDA) || defined (GRID_SYCL)
auto me = View(AcceleratorWrite);
accelerator_for(ss,me.size(),vobj::Nsimd(),{
auto stmp=coalescedRead(vtmp);
coalescedWrite(me[ss],stmp);
});
#else
auto me = View(CpuWrite);
thread_for(ss,me.size(),{
me[ss]= r;
});
#endif
me.ViewClose();
return *this;