Add SyncBegin/SyncEnd to Parallel for MPI communication-computation overlap
Split the blocking Parallel::Sync into async SyncBegin (initiates local copy + MPI_Isend/Irecv) and SyncEnd (MPI_Waitall + unpack). This allows overlapping MPI ghost zone exchange with error checking and Shell patch computation. Modified Step() in bssn_class.C for both PSTR==0 and PSTR==1/2/3 versions to start Sync before error checks, overlapping the MPI_Allreduce with the ongoing ghost zone transfers. Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
This commit is contained in:
@@ -81,6 +81,32 @@ namespace Parallel
|
||||
int Symmetry);
|
||||
void Sync(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
||||
void Sync(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
|
||||
|
||||
// Async Sync: overlap MPI communication with computation
|
||||
struct TransferState
|
||||
{
|
||||
MPI_Request *reqs;
|
||||
MPI_Status *stats;
|
||||
int req_no;
|
||||
double **send_data;
|
||||
double **rec_data;
|
||||
int cpusize;
|
||||
MyList<gridseg> **transfer_src;
|
||||
MyList<gridseg> **transfer_dst;
|
||||
MyList<gridseg> **src;
|
||||
MyList<gridseg> *dst;
|
||||
MyList<var> *VarList1;
|
||||
MyList<var> *VarList2;
|
||||
int Symmetry;
|
||||
};
|
||||
struct SyncHandle
|
||||
{
|
||||
TransferState *states;
|
||||
int num_states;
|
||||
};
|
||||
SyncHandle *SyncBegin(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
||||
SyncHandle *SyncBegin(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
|
||||
void SyncEnd(SyncHandle *handle);
|
||||
void OutBdLow2Hi(Patch *Patc, Patch *Patf,
|
||||
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
|
||||
int Symmetry);
|
||||
|
||||
Reference in New Issue
Block a user