@@ -155,6 +155,8 @@ public:
155155 void setNSolve (int flag) noexcept { do_nsolve = flag; }
156156 void setNSolveGridSize (int s) noexcept { nsolve_grid_size = s; }
157157
158+ void setNoGpuSync (bool do_not_sync) noexcept { do_no_sync_gpu = do_not_sync; }
159+
158160#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
159161 void setHypreInterface (Hypre::Interface f) noexcept {
160162 // must use ij interface for EB
@@ -287,6 +289,8 @@ private:
287289
288290 std::string print_ident;
289291
292+ bool do_no_sync_gpu = false ;
293+
290294 // ! Hypre
291295#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
292296 // Hypre::Interface hypre_interface = Hypre::Interface::structed;
@@ -374,6 +378,14 @@ MLMGT<MF>::solve (const Vector<AMF*>& a_sol, const Vector<AMF const*>& a_rhs,
374378{
375379 BL_PROFILE (" MLMG::solve()" );
376380
381+ bool prev_in_single_stream_region = false ;
382+ bool prev_in_nosync_region = false ;
383+
384+ if (do_no_sync_gpu) {
385+ prev_in_single_stream_region = Gpu::setSingleStreamRegion (true );
386+ prev_in_nosync_region = Gpu::setNoSyncRegion (true );
387+ }
388+
377389 if constexpr (std::is_same<AMF,MultiFab>()) {
378390 if (checkpoint_file != nullptr ) {
379391 checkPoint (a_sol, a_rhs, a_tol_rel, a_tol_abs, checkpoint_file);
@@ -553,6 +565,11 @@ MLMGT<MF>::solve (const Vector<AMF*>& a_sol, const Vector<AMF const*>& a_rhs,
553565
554566 ++solve_called;
555567
568+ if (do_no_sync_gpu) {
569+ (void )Gpu::setSingleStreamRegion (prev_in_single_stream_region);
570+ (void )Gpu::setNoSyncRegion (prev_in_nosync_region);
571+ }
572+
556573 return composite_norminf;
557574}
558575
0 commit comments