Initialize cached sync runtime in derived evolvers
This commit is contained in:
@@ -113,20 +113,22 @@ void Z4c_class::Initialize()
|
|||||||
else
|
else
|
||||||
GH->compose_cgh(nprocs);
|
GH->compose_cgh(nprocs);
|
||||||
|
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
||||||
if (!checkrun)
|
if (!checkrun)
|
||||||
SH->matchcheck(GH->PatL[0]);
|
SH->matchcheck(GH->PatL[0]);
|
||||||
SH->compose_sh(nprocs);
|
SH->compose_sh(nprocs);
|
||||||
SH->setupcordtrans();
|
SH->setupcordtrans();
|
||||||
SH->Dump_xyz(0, 0, 1);
|
SH->Dump_xyz(0, 0, 1);
|
||||||
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
||||||
|
|
||||||
if (checkrun)
|
if (checkrun)
|
||||||
CheckPoint->readcheck_sh(SH, myrank);
|
CheckPoint->readcheck_sh(SH, myrank);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
Initialize_Level_Runtime();
|
||||||
|
|
||||||
|
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
||||||
for (int i = 1; i < dim; i++)
|
for (int i = 1; i < dim; i++)
|
||||||
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
||||||
dT = Courant * h;
|
dT = Courant * h;
|
||||||
|
|||||||
@@ -232,19 +232,21 @@ void bssnEM_class::Initialize()
|
|||||||
else
|
else
|
||||||
GH->compose_cgh(nprocs);
|
GH->compose_cgh(nprocs);
|
||||||
|
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
||||||
SH->matchcheck(GH->PatL[0]);
|
SH->matchcheck(GH->PatL[0]);
|
||||||
SH->compose_sh(nprocs);
|
SH->compose_sh(nprocs);
|
||||||
SH->setupcordtrans();
|
SH->setupcordtrans();
|
||||||
SH->Dump_xyz(0, 0, 1);
|
SH->Dump_xyz(0, 0, 1);
|
||||||
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
||||||
|
|
||||||
if (checkrun)
|
if (checkrun)
|
||||||
CheckPoint->readcheck_sh(SH, myrank);
|
CheckPoint->readcheck_sh(SH, myrank);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
Initialize_Level_Runtime();
|
||||||
|
|
||||||
|
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
||||||
for (int i = 1; i < dim; i++)
|
for (int i = 1; i < dim; i++)
|
||||||
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
||||||
dT = Courant * h;
|
dT = Courant * h;
|
||||||
|
|||||||
@@ -138,20 +138,22 @@ void bssnEScalar_class::Initialize()
|
|||||||
else
|
else
|
||||||
GH->compose_cgh(nprocs);
|
GH->compose_cgh(nprocs);
|
||||||
|
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
SH = new ShellPatch(0, ngfs, pname, Symmetry, myrank, ErrorMonitor);
|
||||||
if (!checkrun)
|
if (!checkrun)
|
||||||
SH->matchcheck(GH->PatL[0]);
|
SH->matchcheck(GH->PatL[0]);
|
||||||
SH->compose_sh(nprocs);
|
SH->compose_sh(nprocs);
|
||||||
SH->setupcordtrans();
|
SH->setupcordtrans();
|
||||||
SH->Dump_xyz(0, 0, 1);
|
SH->Dump_xyz(0, 0, 1);
|
||||||
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
SH->setupintintstuff(nprocs, GH->PatL[0], Symmetry);
|
||||||
|
|
||||||
if (checkrun)
|
if (checkrun)
|
||||||
CheckPoint->readcheck_sh(SH, myrank);
|
CheckPoint->readcheck_sh(SH, myrank);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
Initialize_Level_Runtime();
|
||||||
|
|
||||||
|
double h = GH->PatL[0]->data->blb->data->getdX(0);
|
||||||
for (int i = 1; i < dim; i++)
|
for (int i = 1; i < dim; i++)
|
||||||
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
h = Mymin(h, GH->PatL[0]->data->blb->data->getdX(i));
|
||||||
dT = Courant * h;
|
dT = Courant * h;
|
||||||
|
|||||||
@@ -784,6 +784,8 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
|||||||
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
||||||
#endif
|
#endif
|
||||||
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
||||||
|
sync_cache_pre(0), sync_cache_cor(0), sync_cache_rp_coarse(0), sync_cache_rp_fine(0),
|
||||||
|
sync_cache_restrict(0), sync_cache_outbd(0),
|
||||||
CheckPoint(0)
|
CheckPoint(0)
|
||||||
// CheckPoint(0)
|
// CheckPoint(0)
|
||||||
{
|
{
|
||||||
@@ -1409,6 +1411,38 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
|||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
|
||||||
|
void bssn_class::Initialize_Level_Runtime()
|
||||||
|
{
|
||||||
|
if (!GH)
|
||||||
|
{
|
||||||
|
if (ErrorMonitor && ErrorMonitor->outfile)
|
||||||
|
ErrorMonitor->outfile << "Initialize_Level_Runtime called before GH is initialized" << endl;
|
||||||
|
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ConstraintRefreshLevels)
|
||||||
|
{
|
||||||
|
ConstraintRefreshLevels = new int[GH->levels];
|
||||||
|
for (int il = 0; il < GH->levels; il++)
|
||||||
|
ConstraintRefreshLevels[il] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sync_cache_pre)
|
||||||
|
sync_cache_pre = new Parallel::SyncCache[GH->levels];
|
||||||
|
if (!sync_cache_cor)
|
||||||
|
sync_cache_cor = new Parallel::SyncCache[GH->levels];
|
||||||
|
if (!sync_cache_rp_coarse)
|
||||||
|
sync_cache_rp_coarse = new Parallel::SyncCache[GH->levels];
|
||||||
|
if (!sync_cache_rp_fine)
|
||||||
|
sync_cache_rp_fine = new Parallel::SyncCache[GH->levels];
|
||||||
|
if (!sync_cache_restrict)
|
||||||
|
sync_cache_restrict = new Parallel::SyncCache[GH->levels];
|
||||||
|
if (!sync_cache_outbd)
|
||||||
|
sync_cache_outbd = new Parallel::SyncCache[GH->levels];
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -1439,9 +1473,6 @@ void bssn_class::Initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
||||||
ConstraintRefreshLevels = new int[GH->levels];
|
|
||||||
for (int il = 0; il < GH->levels; il++)
|
|
||||||
ConstraintRefreshLevels[il] = 0;
|
|
||||||
if (checkrun)
|
if (checkrun)
|
||||||
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
||||||
else
|
else
|
||||||
@@ -1477,13 +1508,7 @@ void bssn_class::Initialize()
|
|||||||
Setup_Black_Hole_position();
|
Setup_Black_Hole_position();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize sync caches (per-level, for predictor and corrector)
|
Initialize_Level_Runtime();
|
||||||
sync_cache_pre = new Parallel::SyncCache[GH->levels];
|
|
||||||
sync_cache_cor = new Parallel::SyncCache[GH->levels];
|
|
||||||
sync_cache_rp_coarse = new Parallel::SyncCache[GH->levels];
|
|
||||||
sync_cache_rp_fine = new Parallel::SyncCache[GH->levels];
|
|
||||||
sync_cache_restrict = new Parallel::SyncCache[GH->levels];
|
|
||||||
sync_cache_outbd = new Parallel::SyncCache[GH->levels];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -1762,6 +1787,18 @@ bssn_class::~bssn_class()
|
|||||||
sync_cache_rp_fine[i].destroy();
|
sync_cache_rp_fine[i].destroy();
|
||||||
delete[] sync_cache_rp_fine;
|
delete[] sync_cache_rp_fine;
|
||||||
}
|
}
|
||||||
|
if (sync_cache_restrict)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GH->levels; i++)
|
||||||
|
sync_cache_restrict[i].destroy();
|
||||||
|
delete[] sync_cache_restrict;
|
||||||
|
}
|
||||||
|
if (sync_cache_outbd)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GH->levels; i++)
|
||||||
|
sync_cache_outbd[i].destroy();
|
||||||
|
delete[] sync_cache_outbd;
|
||||||
|
}
|
||||||
|
|
||||||
delete GH;
|
delete GH;
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
|
|||||||
@@ -178,14 +178,17 @@ public:
|
|||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Read_Ansorg();
|
virtual void Read_Ansorg();
|
||||||
virtual void Read_Pablo() {};
|
virtual void Read_Pablo() {};
|
||||||
virtual void Compute_Psi4(int lev);
|
virtual void Compute_Psi4(int lev);
|
||||||
virtual void Step(int lev, int YN);
|
virtual void Step(int lev, int YN);
|
||||||
virtual void Interp_Constraint(bool infg);
|
virtual void Interp_Constraint(bool infg);
|
||||||
virtual void Constraint_Out();
|
virtual void Constraint_Out();
|
||||||
virtual void Compute_Constraint();
|
virtual void Compute_Constraint();
|
||||||
|
|
||||||
#ifdef With_AHF
|
protected:
|
||||||
protected:
|
void Initialize_Level_Runtime();
|
||||||
|
|
||||||
|
#ifdef With_AHF
|
||||||
|
protected:
|
||||||
MyList<var> *AHList, *AHDList, *GaugeList;
|
MyList<var> *AHList, *AHDList, *GaugeList;
|
||||||
int AHfindevery;
|
int AHfindevery;
|
||||||
double AHdumptime;
|
double AHdumptime;
|
||||||
|
|||||||
Reference in New Issue
Block a user