diff options
author | 2019-09-30 09:11:29 -0700 | |
---|---|---|
committer | 2019-10-01 16:32:38 -0700 | |
commit | bc7f60f78ecc82a4af1d94d4687e5c7a1b8a9ab8 (patch) | |
tree | a92c635f0d9753abaf96c4a7019961745e9f8e68 /Source/Particles/Sorting/Partition.cpp | |
parent | a8a9bc61f495c260861ca2f39d342893ff4027cf (diff) | |
download | WarpX-bc7f60f78ecc82a4af1d94d4687e5c7a1b8a9ab8.tar.gz WarpX-bc7f60f78ecc82a4af1d94d4687e5c7a1b8a9ab8.tar.zst WarpX-bc7f60f78ecc82a4af1d94d4687e5c7a1b8a9ab8.zip |
More optimization for GPU
Diffstat (limited to 'Source/Particles/Sorting/Partition.cpp')
-rw-r--r-- | Source/Particles/Sorting/Partition.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Particles/Sorting/Partition.cpp b/Source/Particles/Sorting/Partition.cpp index 2b5d661e4..badd35f02 100644 --- a/Source/Particles/Sorting/Partition.cpp +++ b/Source/Particles/Sorting/Partition.cpp @@ -43,9 +43,9 @@ PhysicalParticleContainer::PartitionParticlesInBuffers( BL_PROFILE("PPC::Evolve::partition"); // Initialize temporary arrays - Gpu::ManagedDeviceVector<int> inexflag; + Gpu::DeviceVector<int> inexflag; inexflag.resize(np); - Gpu::ManagedDeviceVector<long> pid; + Gpu::DeviceVector<long> pid; pid.resize(np); // First, partition particles into the larger buffer @@ -138,5 +138,12 @@ PhysicalParticleContainer::PartitionParticlesInBuffers( std::swap(uyp, tmp); amrex::ParallelFor( np, copyAndReorder<Real>( uzp, tmp, pid ) ); std::swap(uzp, tmp); + + // Make sure that the temporary arrays are not destroyed before + // the GPU kernels finish running + Gpu::streamSynchronize(); } + // Make sure that the temporary arrays are not destroyed before + // the GPU kernels finish running + Gpu::streamSynchronize(); } |