Add configurable analysis MAP cadence
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -57,6 +58,18 @@ bool amss_analysis_timing_enabled()
|
|||||||
}
|
}
|
||||||
return enabled != 0;
|
return enabled != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int amss_analysis_map_every()
|
||||||
|
{
|
||||||
|
static int every = -1;
|
||||||
|
if (every < 0)
|
||||||
|
{
|
||||||
|
const char *env = getenv("AMSS_ANALYSIS_MAP_EVERY");
|
||||||
|
every = (env && atoi(env) > 0) ? atoi(env) : 1;
|
||||||
|
}
|
||||||
|
return every;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile-time switch for per-timestep memory usage collection/printing.
|
// Compile-time switch for per-timestep memory usage collection/printing.
|
||||||
@@ -8172,6 +8185,16 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
bool shell_mass_prepared = false;
|
bool shell_mass_prepared = false;
|
||||||
#endif
|
#endif
|
||||||
|
const int analysis_map_every = amss_analysis_map_every();
|
||||||
|
static long long analysis_map_counter = 0;
|
||||||
|
static vector<double> cached_RoutMAP;
|
||||||
|
const bool map_cache_valid = int(cached_RoutMAP.size()) == decn * 7;
|
||||||
|
const bool refresh_map_this_analysis =
|
||||||
|
analysis_map_every <= 1 || !map_cache_valid ||
|
||||||
|
(analysis_map_counter % analysis_map_every) == 0;
|
||||||
|
if (!map_cache_valid)
|
||||||
|
cached_RoutMAP.assign(decn * 7, 0.0);
|
||||||
|
|
||||||
for (int i = 0; i < decn; i++)
|
for (int i = 0; i < decn; i++)
|
||||||
{
|
{
|
||||||
const double t_surface0 = analysis_timing ? MPI_Wtime() : 0.0;
|
const double t_surface0 = analysis_timing ? MPI_Wtime() : 0.0;
|
||||||
@@ -8247,14 +8270,37 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if (PSTR == 0)
|
#if (PSTR == 0)
|
||||||
Waveshell->surf_WaveMassPAng(Rex, lev, GH,
|
if (analysis_map_every <= 1)
|
||||||
Rpsi4, Ipsi4, 2, maxl, NN, RP, IP,
|
{
|
||||||
phi0, trK0,
|
Waveshell->surf_WaveMassPAng(Rex, lev, GH,
|
||||||
|
Rpsi4, Ipsi4, 2, maxl, NN, RP, IP,
|
||||||
|
phi0, trK0,
|
||||||
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
||||||
|
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
||||||
|
patch_mass_prepared = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor);
|
||||||
|
if (refresh_map_this_analysis)
|
||||||
|
{
|
||||||
|
Waveshell->surf_MassPAng(Rex, lev, GH, phi0, trK0,
|
||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
||||||
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
||||||
patch_mass_prepared = true;
|
patch_mass_prepared = true;
|
||||||
|
for (int q = 0; q < 7; q++)
|
||||||
|
cached_RoutMAP[i * 7 + q] = RoutMAP[q];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int q = 0; q < 7; q++)
|
||||||
|
RoutMAP[q] = cached_RoutMAP[i * 7 + q];
|
||||||
|
}
|
||||||
|
}
|
||||||
#elif (PSTR == 1 || PSTR == 2)
|
#elif (PSTR == 1 || PSTR == 2)
|
||||||
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor, GH->Commlev[lev]);
|
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor, GH->Commlev[lev]);
|
||||||
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"after surf_Wave");
|
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"after surf_Wave");
|
||||||
@@ -8298,6 +8344,8 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
MAPMonitor->writefile(PhysTime, 7, RoutMAP);
|
MAPMonitor->writefile(PhysTime, 7, RoutMAP);
|
||||||
Rex = Rex - drex;
|
Rex = Rex - drex;
|
||||||
}
|
}
|
||||||
|
if (analysis_map_every > 1)
|
||||||
|
analysis_map_counter++;
|
||||||
delete[] RP;
|
delete[] RP;
|
||||||
delete[] IP;
|
delete[] IP;
|
||||||
delete[] RoutMAP;
|
delete[] RoutMAP;
|
||||||
|
|||||||
Reference in New Issue
Block a user