From bc7f60f78ecc82a4af1d94d4687e5c7a1b8a9ab8 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Mon, 30 Sep 2019 09:11:29 -0700 Subject: More optimization for GPU --- Source/Particles/Sorting/Partition.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/Particles/Sorting/Partition.cpp') 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 inexflag; + Gpu::DeviceVector inexflag; inexflag.resize(np); - Gpu::ManagedDeviceVector pid; + Gpu::DeviceVector 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( 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(); } -- cgit v1.2.3