Fix CUDA AMR symmetry drift

This commit is contained in:
2026-05-17 23:46:15 +08:00
parent a0b43bae04
commit f2264989d8
5 changed files with 37 additions and 18 deletions

View File

@@ -1021,7 +1021,9 @@ void bssn_cuda_sync_level_bh_fields(MyList<Patch> *PatL,
while (BP)
{
Block *cg = BP->data;
if (myrank == cg->rank && !bssn_cuda_sync_bh_fields(cg, forx, fory, forz, false))
if (myrank == cg->rank &&
bssn_cuda_has_resident_state(cg) &&
!bssn_cuda_sync_bh_fields(cg, forx, fory, forz, false))
{
cout << "CUDA BH state subset download failed" << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
@@ -1058,7 +1060,7 @@ bool bssn_cuda_bh_interp_resident_enabled()
if (env)
enabled = (atoi(env) != 0) ? 1 : 0;
else
enabled = 1;
enabled = 0;
}
return enabled != 0;
}
@@ -8589,6 +8591,23 @@ void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, va
{
const int InList = 3;
#if USE_CUDA_BSSN
const bool use_resident_bh_interp = bssn_cuda_bh_interp_resident_enabled();
if (!use_resident_bh_interp && bssn_cuda_use_resident_sync(ilev))
{
MyList<var> *host_state_list = 0;
if (forx == Sfx0 && fory == Sfy0 && forz == Sfz0)
host_state_list = StateList;
else if (forx == Sfx && fory == Sfy && forz == Sfz)
host_state_list = SynchList_pre;
else if (forx == Sfx1 && fory == Sfy1 && forz == Sfz1)
host_state_list = SynchList_cor;
if (host_state_list)
bssn_cuda_download_level_state_if_present(GH->PatL[ilev], host_state_list, myrank);
}
#endif
MyList<var> *DG_List = new MyList<var>(forx);
DG_List->insert(fory);
DG_List->insert(forz);
@@ -8609,7 +8628,7 @@ void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, va
int lev = ilev;
#if USE_CUDA_BSSN
if (bssn_cuda_bh_interp_resident_enabled() &&
if (use_resident_bh_interp &&
bssn_cuda_use_resident_sync(lev) &&
bssn_cuda_interp_bh_point_resident(GH->PatL[lev], myrank, BH_PS[n], forx, fory, forz, Symmetry, shellf))
{