Fix BSSN-EM runtime crash
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
#include <string>
|
||||
using namespace std;
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <map.h>
|
||||
@@ -330,13 +331,15 @@ bool bssn_em_cuda_keep_resident_after_step(int lev, int trfls_in, int analysis_l
|
||||
static int keep_all_levels = -1;
|
||||
if (keep_all_levels < 0)
|
||||
{
|
||||
const char *env = getenv("AMSS_CUDA_KEEP_ALL_LEVELS");
|
||||
const char *env = getenv("AMSS_CUDA_EM_KEEP_ALL_LEVELS");
|
||||
keep_all_levels = (env && atoi(env) != 0) ? 1 : 0;
|
||||
}
|
||||
static int enabled = -1;
|
||||
if (enabled < 0)
|
||||
{
|
||||
const char *env = getenv("AMSS_CUDA_KEEP_RESIDENT_AFTER_STEP");
|
||||
const char *env = getenv("AMSS_CUDA_EM_KEEP_RESIDENT_AFTER_STEP");
|
||||
if (!env)
|
||||
env = getenv("AMSS_CUDA_KEEP_RESIDENT_AFTER_STEP");
|
||||
enabled = (env && atoi(env) != 0) ? 1 : 0;
|
||||
}
|
||||
if (!enabled)
|
||||
@@ -2334,17 +2337,7 @@ void bssnEM_class::Step(int lev, int YN)
|
||||
em_t0 = MPI_Wtime();
|
||||
const bool needs_resident_download =
|
||||
!bssn_em_cuda_keep_resident_after_step(lev, trfls, a_lev);
|
||||
const bool skip_zero_resident_download =
|
||||
needs_resident_download &&
|
||||
bssn_em_zero_resident_download_fastpath_enabled() &&
|
||||
bssn_em_resident_zero_fastpath_ready(GH->PatL[lev],
|
||||
#ifdef WithShell
|
||||
0,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
myrank);
|
||||
if (needs_resident_download && !skip_zero_resident_download)
|
||||
if (needs_resident_download)
|
||||
bssn_em_cuda_download_level_state(GH->PatL[lev], SynchList_cor, myrank, true);
|
||||
if (em_step_timing)
|
||||
em_t_resident += MPI_Wtime() - em_t0;
|
||||
@@ -2951,12 +2944,13 @@ void bssnEM_class::Interp_Constraint()
|
||||
}
|
||||
}
|
||||
|
||||
ofstream outfile;
|
||||
char filename[50];
|
||||
sprintf(filename, "%s/interp_constraint_%05d.dat", ErrorMonitor->out_dir.c_str(), int(PhysTime / dT + 0.5));
|
||||
// 0.5 for round off
|
||||
|
||||
outfile.open(filename);
|
||||
ofstream outfile;
|
||||
char suffix[64];
|
||||
sprintf(suffix, "/interp_constraint_%05d.dat", int(PhysTime / dT + 0.5));
|
||||
string filename = ErrorMonitor->out_dir + suffix;
|
||||
// 0.5 for round off
|
||||
|
||||
outfile.open(filename.c_str());
|
||||
outfile << "# corrdinate, H_Res, Px_Res, Py_Res, Pz_Res, Gx_Res, Gy_Res, Gz_Res, ...." << endl;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user