Pack sync send buffers directly from GPU state
This commit is contained in:
@@ -306,6 +306,26 @@ void bssn_class::Step_MainPath_GPU(int lev, int YN)
|
||||
return true;
|
||||
};
|
||||
|
||||
auto can_pack_sync_from_device =
|
||||
[&](MyList<var> *var_list, Parallel::SyncCache &cache) -> bool {
|
||||
if (!cache.valid || !cache.combined_src || myrank < 0 || myrank >= cache.cpusize)
|
||||
return false;
|
||||
|
||||
MyList<Parallel::gridseg> *seg = cache.combined_src[myrank];
|
||||
while (seg)
|
||||
{
|
||||
MyList<var> *var_it = var_list;
|
||||
while (var_it)
|
||||
{
|
||||
if (!bssn_gpu_find_device_buffer(seg->data->Bg->fgfs[var_it->data->sgfn]))
|
||||
return false;
|
||||
var_it = var_it->next;
|
||||
}
|
||||
seg = seg->next;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
MyList<Patch> *Pp = GH->PatL[lev];
|
||||
while (Pp)
|
||||
{
|
||||
@@ -341,7 +361,7 @@ void bssn_class::Step_MainPath_GPU(int lev, int YN)
|
||||
Pp = Pp->next;
|
||||
}
|
||||
|
||||
if (!ERROR && sync_cache_pre[lev].valid)
|
||||
if (!ERROR && sync_cache_pre[lev].valid && !can_pack_sync_from_device(SynchList_pre, sync_cache_pre[lev]))
|
||||
refresh_stage_host_before_sync(SynchList_pre, sync_cache_pre[lev]);
|
||||
|
||||
MPI_Request err_req_pre;
|
||||
@@ -433,7 +453,8 @@ void bssn_class::Step_MainPath_GPU(int lev, int YN)
|
||||
Pp = Pp->next;
|
||||
}
|
||||
|
||||
if (!ERROR && sync_cache_cor[lev].valid && iter_count < 3)
|
||||
if (!ERROR && sync_cache_cor[lev].valid && iter_count < 3 &&
|
||||
!can_pack_sync_from_device(SynchList_cor, sync_cache_cor[lev]))
|
||||
refresh_stage_host_before_sync(SynchList_cor, sync_cache_cor[lev]);
|
||||
|
||||
MPI_Request err_req_cor;
|
||||
|
||||
Reference in New Issue
Block a user