Reduce final GPU host downloads

This commit is contained in:
2026-04-12 18:46:42 +08:00
parent c8977d8356
commit db2d6978b2

View File

@@ -889,15 +889,13 @@ void bssn_class::Step_MainPath_GPU(int lev, int YN)
if (!ERROR && keep_stage_sync_on_device)
{
MyList<var> *final_host_lists[] = {StateList, OldStateList, SynchList_cor, SynchList_pre};
const int final_host_list_count = sizeof(final_host_lists) / sizeof(final_host_lists[0]);
for (int list_i = 0; list_i < final_host_list_count && !ERROR; ++list_i)
{
const double t0 = profile_enabled ? MPI_Wtime() : 0.0;
stage_download_patch_list(final_host_lists[list_i], true);
if (profile_enabled)
stage_profile_add(lev, STAGE_PROFILE_DOWNLOAD, MPI_Wtime() - t0);
}
// After the swaps above, only StateList points at arrays updated during this step.
// OldStateList/SynchList_cor remain valid on host because their backing arrays were
// read-only during the RK step, and SynchList_pre is reused only as scratch later.
const double t0 = profile_enabled ? MPI_Wtime() : 0.0;
stage_download_patch_list(StateList, true);
if (profile_enabled)
stage_profile_add(lev, STAGE_PROFILE_DOWNLOAD, MPI_Wtime() - t0);
}
if (profile_enabled)