diff options
author | 2020-03-27 09:43:04 -0700 | |
---|---|---|
committer | 2020-03-27 09:43:04 -0700 | |
commit | 035efd914eb3f3c92a126a47030061a1f0a191c6 (patch) | |
tree | 3d9286dda9f27fde67f4cdee3d788aefd00e02f1 /Source/Particles/WarpXParticleContainer.cpp | |
parent | 030ef79b6a302e32036bc2f0e355fbdc440cd898 (diff) | |
download | WarpX-035efd914eb3f3c92a126a47030061a1f0a191c6.tar.gz WarpX-035efd914eb3f3c92a126a47030061a1f0a191c6.tar.zst WarpX-035efd914eb3f3c92a126a47030061a1f0a191c6.zip |
Costs vector of (pointer to) vector (#829)
* [WIP] costs mf --> costs vector
* [WIP] costs vector
* [WIP] vector costs
* formatting
* makefile
* [WIP] costs vector
* [WIP] *= costs
* wts do not need to divide by num cells
* Tiling safety on CPU
* Add tests
* EOL
* Remove unneeded input
* Update Source/WarpX.H costs documentation
Co-Authored-By: MaxThevenet <mthevenet@lbl.gov>
* Update timers with times only if user Timers update
* warpx.-->WarpX::
* warpx.-->WarpX::
* warpx.-->WarpX::
* warpx.-->WarpX::
* warpx.-->WarpX::
* add dev synch
* Update Regression/WarpX-tests.ini
Co-Authored-By: MaxThevenet <mthevenet@lbl.gov>
* Delete inputs_loadbalance_costs_heuristic
* Update and rename inputs_loadbalancecosts_timers to inputs_loadbalancecosts
* Update WarpX-tests.ini
Co-authored-by: MaxThevenet <mthevenet@lbl.gov>
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index c98bc7098..65c7baeaa 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -1,7 +1,7 @@ /* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote * Jean-Luc Vay, Luca Fedeli, Maxence Thevenet - * Remi Lehe, Revathi Jambunathan, Weiqun Zhang - * Yinjian Zhao, levinem + * Michael Rowan, Remi Lehe, Revathi Jambunathan + * Weiqun Zhang, Yinjian Zhao, levinem * * This file is part of WarpX. * @@ -728,7 +728,7 @@ WarpXParticleContainer::PushX (int lev, amrex::Real dt) if (do_not_push) return; - MultiFab* cost = WarpX::getCosts(lev); + amrex::Vector<amrex::Real>* cost = WarpX::getCosts(lev); #ifdef _OPENMP #pragma omp parallel @@ -737,6 +737,10 @@ WarpXParticleContainer::PushX (int lev, amrex::Real dt) for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { + if (cost && WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Timers) + { + amrex::Gpu::synchronize(); + } Real wt = amrex::second(); // @@ -766,15 +770,11 @@ WarpXParticleContainer::PushX (int lev, amrex::Real dt) } ); - if (cost) { - const Box& tbx = pti.tilebox(); - wt = (amrex::second() - wt) / tbx.d_numPts(); - Array4<Real> const& costarr = cost->array(pti); - amrex::ParallelFor(tbx, - [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept - { - costarr(i,j,k) += wt; - }); + if (cost && WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Timers) + { + amrex::Gpu::synchronize(); + wt = amrex::second() - wt; + amrex::HostDevice::Atomic::Add( &(*cost)[pti.index()], wt); } } } |