aboutsummaryrefslogtreecommitdiff
path: root/Source/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers2@gmail.com> 2018-10-18 14:31:44 -0700
committerGravatar Andrew Myers <atmyers2@gmail.com> 2018-10-18 14:31:44 -0700
commit14b546a821f76e7d2b424595cd457c408b8d6960 (patch)
treeaa770974d57136828558feed857c285269689303 /Source/PhysicalParticleContainer.cpp
parent7c9fc74b66f82da1115d2491bcda4ee2a7dfa79b (diff)
downloadWarpX-14b546a821f76e7d2b424595cd457c408b8d6960.tar.gz
WarpX-14b546a821f76e7d2b424595cd457c408b8d6960.tar.zst
WarpX-14b546a821f76e7d2b424595cd457c408b8d6960.zip
use thrust::fill here instead of the std::vector version when running on the GPU.
Diffstat (limited to 'Source/PhysicalParticleContainer.cpp')
-rw-r--r--Source/PhysicalParticleContainer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/PhysicalParticleContainer.cpp b/Source/PhysicalParticleContainer.cpp
index 4680043be..d9fd55afa 100644
--- a/Source/PhysicalParticleContainer.cpp
+++ b/Source/PhysicalParticleContainer.cpp
@@ -832,12 +832,21 @@ PhysicalParticleContainer::Evolve (int lev,
FArrayBox& jyfab = jy[pti];
FArrayBox& jzfab = jz[pti];
+#ifdef AMREX_USE_CUDA
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Exp.data()), thrust::device_ptr<Real>(Exp.data() + np), 0.0);
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Eyp.data()), thrust::device_ptr<Real>(Eyp.data() + np), 0.0);
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Ezp.data()), thrust::device_ptr<Real>(Ezp.data() + np), 0.0);
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Bxp.data()), thrust::device_ptr<Real>(Bxp.data() + np), WarpX::B_external[0]);
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Byp.data()), thrust::device_ptr<Real>(Byp.data() + np), WarpX::B_external[1]);
+ thrust::fill(thrust::device, thrust::device_ptr<Real>(Bzp.data()), thrust::device_ptr<Real>(Bzp.data() + np), WarpX::B_external[2]);
+#else
Exp.assign(np,0.0);
Eyp.assign(np,0.0);
Ezp.assign(np,0.0);
Bxp.assign(np,WarpX::B_external[0]);
Byp.assign(np,WarpX::B_external[1]);
Bzp.assign(np,WarpX::B_external[2]);
+#endif
giv.resize(np);