Compare commits
10 Commits
cjy-cassiu
...
cjy-goldst
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c31384b2f | |||
| e4e741caa1 | |||
| 65e0f95f40 | |||
| f9fbf97e64 | |||
| 968522995b | |||
| f3988ac8ca | |||
| e4c25eb21f | |||
| 4b10519876 | |||
| 3a58273501 | |||
| 5c65cea2f0 |
@@ -13,17 +13,14 @@ import numpy
|
||||
|
||||
## Setting MPI processes and the output file directory
|
||||
|
||||
File_directory = "GW150914" ## output file directory
|
||||
Output_directory = "binary_output" ## binary data file directory
|
||||
## The file directory name should not be too long
|
||||
MPI_processes = 64 ## number of mpi processes used in the simulation
|
||||
OMP_Threads = 3 ## number of OpenMP threads used by each MPI process
|
||||
MPI_hosts = ["localhost", "192.168.20.102"] ## MPI hosts for multi-node runs
|
||||
MPI_processes_per_node = 32 ## MPI ranks launched on each node in MPI_hosts
|
||||
|
||||
GPU_Calculation = "no" ## Use GPU or not
|
||||
## (prefer "no" in the current version, because the GPU part may have bugs when integrated in this Python interface)
|
||||
CPU_Part = 1.0
|
||||
File_directory = "GW150914" ## output file directory
|
||||
Output_directory = "binary_output" ## binary data file directory
|
||||
## The file directory name should not be too long
|
||||
MPI_processes = 64 ## number of mpi processes used in the simulation
|
||||
|
||||
GPU_Calculation = "no" ## Use GPU or not
|
||||
## (prefer "no" in the current version, because the GPU part may have bugs when integrated in this Python interface)
|
||||
CPU_Part = 1.0
|
||||
GPU_Part = 0.0
|
||||
|
||||
#################################################
|
||||
@@ -53,7 +50,7 @@ Check_Time = 100.0
|
||||
Dump_Time = 100.0 ## time inteval dT for dumping binary data
|
||||
D2_Dump_Time = 100.0 ## dump the ascii data for 2d surface after dT'
|
||||
Analysis_Time = 0.1 ## dump the puncture position and GW psi4 after dT"
|
||||
Evolution_Step_Number = 10000000 ## stop the calculation after the maximal step number
|
||||
Evolution_Step_Number = 10000000 ## stop the calculation after the maximal step number
|
||||
Courant_Factor = 0.5 ## Courant Factor
|
||||
Dissipation = 0.15 ## Kreiss-Oliger Dissipation Strength
|
||||
|
||||
|
||||
@@ -5253,10 +5253,10 @@ void Parallel::PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry)
|
||||
delete[] transfer_src;
|
||||
delete[] transfer_dst;
|
||||
}
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = ghost_width;
|
||||
@@ -5281,13 +5281,48 @@ double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
MPI_Allreduce(&dtvf, &tvf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
tvf = sqrt(tvf);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
void Parallel::L2Norm7(Patch *Pat, var **vf, double *norms)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf[7], dtvf[7];
|
||||
int BDW = ghost_width;
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] = 0;
|
||||
|
||||
MyList<Block> *BP = Pat->blb;
|
||||
while (BP)
|
||||
{
|
||||
Block *cg = BP->data;
|
||||
if (myrank == cg->rank)
|
||||
{
|
||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
||||
Pat->bbox[0], Pat->bbox[1], Pat->bbox[2],
|
||||
Pat->bbox[3], Pat->bbox[4], Pat->bbox[5],
|
||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] += tvf[i];
|
||||
}
|
||||
if (BP == Pat->ble)
|
||||
break;
|
||||
BP = BP->next;
|
||||
}
|
||||
|
||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
norms[i] = sqrt(tvf[i]);
|
||||
}
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = ghost_width;
|
||||
@@ -5312,12 +5347,47 @@ double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||
MPI_Allreduce(&dtvf, &tvf, 1, MPI_DOUBLE, MPI_SUM, Comm_here);
|
||||
|
||||
tvf = sqrt(tvf);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
void Parallel::checkgsl(MyList<Parallel::gridseg> *pp, bool first_only)
|
||||
{
|
||||
int myrank = 0;
|
||||
|
||||
return tvf;
|
||||
}
|
||||
void Parallel::L2Norm7(Patch *Pat, var **vf, double *norms, MPI_Comm Comm_here)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf[7], dtvf[7];
|
||||
int BDW = ghost_width;
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] = 0;
|
||||
|
||||
MyList<Block> *BP = Pat->blb;
|
||||
while (BP)
|
||||
{
|
||||
Block *cg = BP->data;
|
||||
if (myrank == cg->rank)
|
||||
{
|
||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
||||
Pat->bbox[0], Pat->bbox[1], Pat->bbox[2],
|
||||
Pat->bbox[3], Pat->bbox[4], Pat->bbox[5],
|
||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] += tvf[i];
|
||||
}
|
||||
if (BP == Pat->ble)
|
||||
break;
|
||||
BP = BP->next;
|
||||
}
|
||||
|
||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, Comm_here);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
norms[i] = sqrt(tvf[i]);
|
||||
}
|
||||
void Parallel::checkgsl(MyList<Parallel::gridseg> *pp, bool first_only)
|
||||
{
|
||||
int myrank = 0;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
if (myrank == 0)
|
||||
{
|
||||
|
||||
@@ -179,12 +179,13 @@ namespace Parallel
|
||||
MyList<Parallel::gridseg> *clone_gsl(MyList<Parallel::gridseg> *p, bool first_only);
|
||||
MyList<Parallel::gridseg> *build_bulk_gsl(Patch *Pat); // similar to build_owned_gsl0 but does not care rank issue
|
||||
MyList<Parallel::gridseg> *build_bulk_gsl(Block *bp, Patch *Pat);
|
||||
void build_PhysBD_gstl(Patch *Pat, MyList<Parallel::gridseg> *srci, MyList<Parallel::gridseg> *dsti,
|
||||
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
|
||||
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
||||
double L2Norm(Patch *Pat, var *vf);
|
||||
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
|
||||
void checkvarl(MyList<var> *pp, bool first_only);
|
||||
void build_PhysBD_gstl(Patch *Pat, MyList<Parallel::gridseg> *srci, MyList<Parallel::gridseg> *dsti,
|
||||
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
|
||||
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
||||
double L2Norm(Patch *Pat, var *vf);
|
||||
void L2Norm7(Patch *Pat, var **vf, double *norms);
|
||||
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
|
||||
void checkvarl(MyList<var> *pp, bool first_only);
|
||||
MyList<Parallel::gridseg> *divide_gsl(MyList<Parallel::gridseg> *p, Patch *Pat);
|
||||
MyList<Parallel::gridseg> *divide_gs(MyList<Parallel::gridseg> *p, Patch *Pat);
|
||||
void prepare_inter_time_level(Patch *Pat,
|
||||
@@ -216,11 +217,12 @@ namespace Parallel
|
||||
void aligncheck(double *bbox0, double *bboxl, int lev, double *DH0, int *shape);
|
||||
bool point_locat_gsl(double *pox, MyList<Parallel::gridseg> *gsl);
|
||||
void checkpatchlist(MyList<Patch> *PatL, bool buflog);
|
||||
|
||||
double L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here);
|
||||
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
|
||||
int NN, double **XX,
|
||||
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
||||
|
||||
double L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here);
|
||||
void L2Norm7(Patch *Pat, var **vf, double *norms, MPI_Comm Comm_here);
|
||||
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
|
||||
int NN, double **XX,
|
||||
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||
MyList<Block> *distribute(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfsi,
|
||||
bool periodic, int start_rank, int end_rank, int nodes = 0);
|
||||
|
||||
@@ -3439,10 +3439,10 @@ void ShellPatch::write_Pablo_file_ss(int *ext, double xmin, double xmax, double
|
||||
delete[] Z;
|
||||
}
|
||||
|
||||
double ShellPatch::L2Norm(var *vf)
|
||||
{
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = overghost;
|
||||
double ShellPatch::L2Norm(var *vf)
|
||||
{
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = overghost;
|
||||
|
||||
MyList<ss_patch> *sPp = PatL;
|
||||
while (sPp)
|
||||
@@ -3469,13 +3469,50 @@ double ShellPatch::L2Norm(var *vf)
|
||||
MPI_Allreduce(&dtvf, &tvf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
tvf = sqrt(tvf);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
|
||||
// find maximum of abstract value, XX store position for maximum, Shellf store maximum themselvs
|
||||
void ShellPatch::Find_Maximum(MyList<var> *VarList, double *XX,
|
||||
double *Shellf)
|
||||
|
||||
return tvf;
|
||||
}
|
||||
void ShellPatch::L2Norm7(var **vf, double *norms)
|
||||
{
|
||||
double tvf[7], dtvf[7];
|
||||
int BDW = overghost;
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] = 0;
|
||||
|
||||
MyList<ss_patch> *sPp = PatL;
|
||||
while (sPp)
|
||||
{
|
||||
MyList<Block> *Bp = sPp->data->blb;
|
||||
while (Bp)
|
||||
{
|
||||
Block *cg = Bp->data;
|
||||
if (myrank == cg->rank)
|
||||
{
|
||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
||||
sPp->data->bbox[0], sPp->data->bbox[1], sPp->data->bbox[2],
|
||||
sPp->data->bbox[3], sPp->data->bbox[4], sPp->data->bbox[5],
|
||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
||||
for (int i = 0; i < 7; i++)
|
||||
dtvf[i] += tvf[i];
|
||||
}
|
||||
if (Bp == sPp->data->ble)
|
||||
break;
|
||||
Bp = Bp->next;
|
||||
}
|
||||
sPp = sPp->next;
|
||||
}
|
||||
|
||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
norms[i] = sqrt(tvf[i]);
|
||||
}
|
||||
|
||||
// find maximum of abstract value, XX store position for maximum, Shellf store maximum themselvs
|
||||
void ShellPatch::Find_Maximum(MyList<var> *VarList, double *XX,
|
||||
double *Shellf)
|
||||
{
|
||||
MyList<var> *varl;
|
||||
int num_var = 0;
|
||||
|
||||
@@ -195,10 +195,11 @@ public:
|
||||
bool Interp_One_Point(MyList<var> *VarList,
|
||||
double *XX, /*input global Cartesian coordinate*/
|
||||
double *Shellf, int Symmetry);
|
||||
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
||||
char *filename, int sst);
|
||||
double L2Norm(var *vf);
|
||||
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
|
||||
};
|
||||
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
||||
char *filename, int sst);
|
||||
double L2Norm(var *vf);
|
||||
void L2Norm7(var **vf, double *norms);
|
||||
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
|
||||
};
|
||||
|
||||
#endif /* SHELLPATCH_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,10 +45,11 @@ public:
|
||||
int checkrun;
|
||||
char checkfilename[50];
|
||||
int Steps;
|
||||
double StartTime, TotalTime;
|
||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||
double LastAnas, LastConsOut;
|
||||
double Courant;
|
||||
double StartTime, TotalTime;
|
||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||
double LastAnas, LastConsOut;
|
||||
int *ConstraintRefreshLevels;
|
||||
double Courant;
|
||||
double numepss, numepsb, numepsh;
|
||||
int Symmetry;
|
||||
int maxl, decn;
|
||||
@@ -133,9 +134,9 @@ public:
|
||||
Parallel::SyncCache *sync_cache_restrict; // cached Restrict in RestrictProlong
|
||||
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
|
||||
|
||||
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
||||
monitor *ConVMonitor;
|
||||
surface_integral *Waveshell;
|
||||
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
||||
monitor *ConVMonitor, *TimingMonitor;
|
||||
surface_integral *Waveshell;
|
||||
checkpoint *CheckPoint;
|
||||
|
||||
public:
|
||||
|
||||
@@ -1891,7 +1891,7 @@ void bssn_class::Read_Ansorg()
|
||||
void bssn_class::Evolve(int Steps)
|
||||
{
|
||||
|
||||
double prev_clock = 0.0, curr_clock = 0.0;
|
||||
clock_t prev_clock, curr_clock;
|
||||
double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0;
|
||||
LastAnas = 0;
|
||||
#if 0
|
||||
@@ -2035,12 +2035,10 @@ void bssn_class::Evolve(int Steps)
|
||||
|
||||
GH->settrfls(trfls);
|
||||
|
||||
for (int ncount = 1; ncount < Steps + 1; ncount++)
|
||||
{
|
||||
if (myrank == 0)
|
||||
curr_clock = MPI_Wtime();
|
||||
cout << "Before Step: " << ncount << " My Rank: " << myrank
|
||||
<< " takes " << MPI_Wtime() - beg_time << " seconds!" << endl;
|
||||
for (int ncount = 1; ncount < Steps + 1; ncount++)
|
||||
{
|
||||
cout << "Before Step: " << ncount << " My Rank: " << myrank
|
||||
<< " takes " << MPI_Wtime() - beg_time << " seconds!" << endl;
|
||||
beg_time = MPI_Wtime();
|
||||
#if (PSTR == 0)
|
||||
RecursiveStep(0);
|
||||
@@ -2097,10 +2095,10 @@ void bssn_class::Evolve(int Steps)
|
||||
|
||||
if (myrank == 0)
|
||||
{
|
||||
prev_clock = curr_clock;
|
||||
curr_clock = MPI_Wtime();
|
||||
cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl;
|
||||
cout << "used " << (curr_clock - prev_clock) << " seconds!" << endl;
|
||||
prev_clock = curr_clock;
|
||||
curr_clock = clock();
|
||||
cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl;
|
||||
cout << "used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds!" << endl;
|
||||
}
|
||||
|
||||
if (PhysTime >= TotalTime)
|
||||
|
||||
@@ -22,19 +22,32 @@
|
||||
#define f_compute_rhs_Z4c_ss COMPUTE_RHS_Z4C_SS
|
||||
#define f_compute_constraint_fr COMPUTE_CONSTRAINT_FR
|
||||
#endif
|
||||
#ifdef fortran3
|
||||
#define f_compute_rhs_bssn compute_rhs_bssn_
|
||||
#ifdef fortran3
|
||||
#define f_compute_rhs_bssn compute_rhs_bssn_
|
||||
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
|
||||
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar_
|
||||
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss_
|
||||
#define f_compute_rhs_Z4c compute_rhs_z4c_
|
||||
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot_
|
||||
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
|
||||
#define f_compute_constraint_fr compute_constraint_fr_
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||
#define f_compute_constraint_fr compute_constraint_fr_
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
void f_bssn_rhs_kernel_timing_reset();
|
||||
int f_bssn_rhs_kernel_timing_bucket_count();
|
||||
const double *f_bssn_rhs_kernel_timing_local_seconds();
|
||||
const char *f_bssn_rhs_kernel_timing_label(int);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||
double *, double *, // chi, trK
|
||||
double *, double *, double *, double *, double *, double *, // gij
|
||||
double *, double *, double *, double *, double *, double *, // Aij
|
||||
|
||||
@@ -2,30 +2,88 @@
|
||||
#include "bssn_rhs.h"
|
||||
#include "share_func.h"
|
||||
#include "tool.h"
|
||||
|
||||
#ifdef _OPENMP
|
||||
#define BSSN_OMP_TASK_GROUP_BEGIN \
|
||||
_Pragma("omp parallel") \
|
||||
{ \
|
||||
_Pragma("omp single nowait") \
|
||||
{
|
||||
#define BSSN_OMP_TASK_CALL(...) \
|
||||
_Pragma("omp task") { __VA_ARGS__; }
|
||||
#define BSSN_OMP_TASK_GROUP_END \
|
||||
_Pragma("omp taskwait") \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define BSSN_OMP_TASK_GROUP_BEGIN {
|
||||
#define BSSN_OMP_TASK_CALL(...) { __VA_ARGS__; }
|
||||
#define BSSN_OMP_TASK_GROUP_END }
|
||||
#endif
|
||||
#include <time.h>
|
||||
// 0-based i,j,k
|
||||
// #define IDX_F(i,j,k,nx,ny) ((i) + (j)*(nx) + (k)*(nx)*(ny))
|
||||
// ex(1)=nx, ex(2)=ny, ex(3)=nz
|
||||
|
||||
// 用法:a[ IDX_F(i,j,k,nx,ny) ]
|
||||
|
||||
#ifndef BSSN_KERNEL_FINE_TIMING
|
||||
#define BSSN_KERNEL_FINE_TIMING 0
|
||||
#endif
|
||||
|
||||
#if BSSN_KERNEL_FINE_TIMING
|
||||
namespace rhs_kernel_timing
|
||||
{
|
||||
enum Bucket
|
||||
{
|
||||
KB_SETUP_DERIVS = 0,
|
||||
KB_GEOM_GAMMA,
|
||||
KB_RICCI_METRIC,
|
||||
KB_CHI_LAPSE,
|
||||
KB_AIJ_TRK_GAUGE,
|
||||
KB_KO_CONSTRAINT,
|
||||
KB_COUNT
|
||||
};
|
||||
|
||||
static double local_bucket_seconds[KB_COUNT];
|
||||
|
||||
static const char *bucket_labels[KB_COUNT] =
|
||||
{
|
||||
"setup_derivs",
|
||||
"geom_gamma",
|
||||
"ricci_metric",
|
||||
"chi_lapse",
|
||||
"aij_trk_gauge",
|
||||
"ko_constraint"
|
||||
};
|
||||
|
||||
static inline double now_seconds()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return double(ts.tv_sec) + 1.0e-9 * double(ts.tv_nsec);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void f_bssn_rhs_kernel_timing_reset()
|
||||
{
|
||||
for (int i = 0; i < rhs_kernel_timing::KB_COUNT; ++i)
|
||||
rhs_kernel_timing::local_bucket_seconds[i] = 0.0;
|
||||
}
|
||||
|
||||
extern "C" int f_bssn_rhs_kernel_timing_bucket_count()
|
||||
{
|
||||
return rhs_kernel_timing::KB_COUNT;
|
||||
}
|
||||
|
||||
extern "C" const double *f_bssn_rhs_kernel_timing_local_seconds()
|
||||
{
|
||||
return rhs_kernel_timing::local_bucket_seconds;
|
||||
}
|
||||
|
||||
extern "C" const char *f_bssn_rhs_kernel_timing_label(int bucket_index)
|
||||
{
|
||||
if (bucket_index < 0 || bucket_index >= rhs_kernel_timing::KB_COUNT)
|
||||
return "unknown";
|
||||
return rhs_kernel_timing::bucket_labels[bucket_index];
|
||||
}
|
||||
|
||||
#define RHS_KERNEL_TIMER_DECL(var_name) const double var_name = rhs_kernel_timing::now_seconds()
|
||||
#define RHS_KERNEL_TIMER_ADD(bucket_name, var_name) \
|
||||
rhs_kernel_timing::local_bucket_seconds[int(rhs_kernel_timing::bucket_name)] += \
|
||||
rhs_kernel_timing::now_seconds() - (var_name)
|
||||
#else
|
||||
extern "C" void f_bssn_rhs_kernel_timing_reset() {}
|
||||
extern "C" int f_bssn_rhs_kernel_timing_bucket_count() { return 0; }
|
||||
extern "C" const double *f_bssn_rhs_kernel_timing_local_seconds() { return 0; }
|
||||
extern "C" const char *f_bssn_rhs_kernel_timing_label(int) { return "disabled"; }
|
||||
|
||||
#define RHS_KERNEL_TIMER_DECL(var_name)
|
||||
#define RHS_KERNEL_TIMER_ADD(bucket_name, var_name)
|
||||
#endif
|
||||
|
||||
// C function that calculates the right-hand side for BSSN equations
|
||||
int f_compute_rhs_bssn(int *ex, double &T,
|
||||
double *X, double *Y, double *Z,
|
||||
@@ -120,26 +178,25 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
dY = Y[1] - Y[0];
|
||||
dZ = Z[1] - Z[0];
|
||||
|
||||
RHS_KERNEL_TIMER_DECL(timer_setup_derivs);
|
||||
// 1ms //
|
||||
for(int i=0;i<all;i+=1){
|
||||
alpn1[i] = Lap[i] + 1.0;
|
||||
chin1[i] = chi[i] + 1.0;
|
||||
}
|
||||
// 9ms //
|
||||
BSSN_OMP_TASK_GROUP_BEGIN
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,betax,betaxx,betaxy,betaxz,X,Y,Z,ANTI, SYM, SYM,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,betay,betayx,betayy,betayz,X,Y,Z, SYM,ANTI, SYM,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,betaz,betazx,betazy,betazz,X,Y,Z, SYM, SYM,ANTI,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Lap,Lapx,Lapy,Lapz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,trK,Kx,Ky,Kz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_GROUP_END
|
||||
fderivs(ex,betax,betaxx,betaxy,betaxz,X,Y,Z,ANTI, SYM, SYM,Symmetry,Lev);
|
||||
fderivs(ex,betay,betayx,betayy,betayz,X,Y,Z, SYM,ANTI, SYM,Symmetry,Lev);
|
||||
fderivs(ex,betaz,betazx,betazy,betazz,X,Y,Z, SYM, SYM,ANTI,Symmetry,Lev);
|
||||
fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev);
|
||||
fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev);
|
||||
fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,Lap,Lapx,Lapy,Lapz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
fderivs(ex,trK,Kx,Ky,Kz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
|
||||
// 3ms //
|
||||
for(int i=0;i<all;i+=1){
|
||||
@@ -161,6 +218,8 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
(dxx[i] + ONE) * betaxz[i] + gxy[i] * betayz[i] + gyz[i] * betayx[i]
|
||||
+ (dzz[i] + ONE) * betazx[i] - gxz[i] * betayy[i];
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_SETUP_DERIVS, timer_setup_derivs);
|
||||
RHS_KERNEL_TIMER_DECL(timer_geom_gamma);
|
||||
// Fused: inverse metric + Gamma constraint + Christoffel (3 loops -> 1)
|
||||
for(int i=0;i<all;i+=1){
|
||||
double det = (dxx[i] + ONE) * (dyy[i] + ONE) * (dzz[i] + ONE) + gxy[i] * gyz[i] * gxz[i] + gxz[i] * gxy[i] * gyz[i] -
|
||||
@@ -303,9 +362,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
+ ( gupxy[i]*gupyz[i] + gupyy[i]*gupxz[i] ) * Axy[i]
|
||||
+ ( gupxy[i]*gupzz[i] + gupyz[i]*gupxz[i] ) * Axz[i]
|
||||
+ ( gupyy[i]*gupzz[i] + gupyz[i]*gupyz[i] ) * Ayz[i];
|
||||
Rxx[i] = axx; Ryy[i] = ayy; Rzz[i] = azz;
|
||||
Rxy[i] = axy; Rxz[i] = axz; Ryz[i] = ayz;
|
||||
|
||||
Gamx_rhs[i] = - TWO * ( Lapx[i]*axx + Lapy[i]*axy + Lapz[i]*axz ) +
|
||||
TWO * alpn1[i] * (
|
||||
-F3o2/chin1[i] * ( chix[i]*axx + chiy[i]*axy + chiz[i]*axz ) -
|
||||
@@ -335,15 +391,18 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
+ TWO * ( Gamzxy[i]*axy + Gamzxz[i]*axz + Gamzyz[i]*ayz )
|
||||
);
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_GEOM_GAMMA, timer_geom_gamma);
|
||||
RHS_KERNEL_TIMER_DECL(timer_ricci_metric);
|
||||
// 22.3ms //
|
||||
BSSN_OMP_TASK_GROUP_BEGIN
|
||||
BSSN_OMP_TASK_CALL(fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fdderivs(ex,betay,gxxy,gxyy,gxzy,gyyy,gyzy,gzzy,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fdderivs(ex,betaz,gxxz,gxyz,gxzz,gyyz,gyzz,gzzz,X,Y,Z,SYM ,SYM, ANTI,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Gamx,Gamxx,Gamxy,Gamxz,X,Y,Z,ANTI,SYM ,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Gamy,Gamyx,Gamyy,Gamyz,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Gamz,Gamzx,Gamzy,Gamzz,X,Y,Z,SYM ,SYM ,ANTI,Symmetry,Lev))
|
||||
BSSN_OMP_TASK_GROUP_END
|
||||
fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,
|
||||
X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev);
|
||||
fdderivs(ex,betay,gxxy,gxyy,gxzy,gyyy,gyzy,gzzy,
|
||||
X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev);
|
||||
fdderivs(ex,betaz,gxxz,gxyz,gxzz,gyyz,gyzz,gzzz,
|
||||
X,Y,Z,SYM ,SYM, ANTI,Symmetry,Lev);
|
||||
fderivs(ex,Gamx,Gamxx,Gamxy,Gamxz,X,Y,Z,ANTI,SYM ,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,Gamy,Gamyx,Gamyy,Gamyz,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev);
|
||||
fderivs(ex,Gamz,Gamzx,Gamzy,Gamzz,X,Y,Z,SYM ,SYM ,ANTI,Symmetry,Lev);
|
||||
|
||||
// Fused: fxx/Gamxa + Gamma_rhs part 2 (2 loops -> 1)
|
||||
for(int i=0;i<all;i+=1){
|
||||
@@ -351,7 +410,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
double lfxx = gxxx[i] + gxyy[i] + gxzz[i];
|
||||
double lfxy = gxyx[i] + gyyy[i] + gyzz[i];
|
||||
double lfxz = gxzx[i] + gyzy[i] + gzzz[i];
|
||||
fxx[i] = lfxx; fxy[i] = lfxy; fxz[i] = lfxz;
|
||||
|
||||
double gxa = gupxx[i]*Gamxxx[i] + gupyy[i]*Gamxyy[i] + gupzz[i]*Gamxzz[i]
|
||||
+ TWO * ( gupxy[i]*Gamxxy[i] + gupxz[i]*Gamxxz[i] + gupyz[i]*Gamxyz[i] );
|
||||
@@ -705,69 +763,74 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
+ Gamxyz[i] * gzzx[i] + Gamyyz[i] * gzzy[i] + Gamzyz[i] * gzzz[i]
|
||||
);
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_RICCI_METRIC, timer_ricci_metric);
|
||||
|
||||
RHS_KERNEL_TIMER_DECL(timer_chi_lapse);
|
||||
// 22.3ms //
|
||||
fdderivs(ex,chi,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
|
||||
// 7ms //
|
||||
for (int i=0;i<all;i+=1) {
|
||||
fxx[i] = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
|
||||
fxy[i] = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
|
||||
fxz[i] = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
|
||||
fyy[i] = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
|
||||
fyz[i] = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
|
||||
fzz[i] = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
|
||||
f[i] =
|
||||
gupxx[i] * (fxx[i] - (F3o2 / chin1[i]) * chix[i] * chix[i])
|
||||
+ gupyy[i] * (fyy[i] - (F3o2 / chin1[i]) * chiy[i] * chiy[i])
|
||||
+ gupzz[i] * (fzz[i] - (F3o2 / chin1[i]) * chiz[i] * chiz[i])
|
||||
+ TWO * gupxy[i] * (fxy[i] - (F3o2 / chin1[i]) * chix[i] * chiy[i])
|
||||
+ TWO * gupxz[i] * (fxz[i] - (F3o2 / chin1[i]) * chix[i] * chiz[i])
|
||||
+ TWO * gupyz[i] * (fyz[i] - (F3o2 / chin1[i]) * chiy[i] * chiz[i]);
|
||||
Rxx[i] = Rxx[i] + ( fxx[i] - (chix[i] * chix[i]) / (chin1[i] * TWO) + (dxx[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||
Ryy[i] = Ryy[i] + ( fyy[i] - (chiy[i] * chiy[i]) / (chin1[i] * TWO) + (dyy[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||
Rzz[i] = Rzz[i] + ( fzz[i] - (chiz[i] * chiz[i]) / (chin1[i] * TWO) + (dzz[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||
const double inv_chin1 = ONE / chin1[i];
|
||||
const double half_inv_chin1 = HALF * inv_chin1;
|
||||
const double scaled_inv = F3o2 * inv_chin1;
|
||||
const double cxx = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
|
||||
const double cxy = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
|
||||
const double cxz = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
|
||||
const double cyy = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
|
||||
const double cyz = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
|
||||
const double czz = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
|
||||
const double ricci_chi =
|
||||
gupxx[i] * (cxx - scaled_inv * chix[i] * chix[i])
|
||||
+ gupyy[i] * (cyy - scaled_inv * chiy[i] * chiy[i])
|
||||
+ gupzz[i] * (czz - scaled_inv * chiz[i] * chiz[i])
|
||||
+ TWO * gupxy[i] * (cxy - scaled_inv * chix[i] * chiy[i])
|
||||
+ TWO * gupxz[i] * (cxz - scaled_inv * chix[i] * chiz[i])
|
||||
+ TWO * gupyz[i] * (cyz - scaled_inv * chiy[i] * chiz[i]);
|
||||
f[i] = ricci_chi;
|
||||
Rxx[i] = Rxx[i] + ( cxx - half_inv_chin1 * chix[i] * chix[i] + (dxx[i] + ONE) * ricci_chi ) * half_inv_chin1;
|
||||
Ryy[i] = Ryy[i] + ( cyy - half_inv_chin1 * chiy[i] * chiy[i] + (dyy[i] + ONE) * ricci_chi ) * half_inv_chin1;
|
||||
Rzz[i] = Rzz[i] + ( czz - half_inv_chin1 * chiz[i] * chiz[i] + (dzz[i] + ONE) * ricci_chi ) * half_inv_chin1;
|
||||
|
||||
Rxy[i] = Rxy[i] + ( fxy[i] - (chix[i] * chiy[i]) / (chin1[i] * TWO) + gxy[i] * f[i] ) / (chin1[i] * TWO);
|
||||
Rxz[i] = Rxz[i] + ( fxz[i] - (chix[i] * chiz[i]) / (chin1[i] * TWO) + gxz[i] * f[i] ) / (chin1[i] * TWO);
|
||||
Ryz[i] = Ryz[i] + ( fyz[i] - (chiy[i] * chiz[i]) / (chin1[i] * TWO) + gyz[i] * f[i] ) / (chin1[i] * TWO);
|
||||
Rxy[i] = Rxy[i] + ( cxy - half_inv_chin1 * chix[i] * chiy[i] + gxy[i] * ricci_chi ) * half_inv_chin1;
|
||||
Rxz[i] = Rxz[i] + ( cxz - half_inv_chin1 * chix[i] * chiz[i] + gxz[i] * ricci_chi ) * half_inv_chin1;
|
||||
Ryz[i] = Ryz[i] + ( cyz - half_inv_chin1 * chiy[i] * chiz[i] + gyz[i] * ricci_chi ) * half_inv_chin1;
|
||||
}
|
||||
|
||||
// 24ms //
|
||||
fdderivs(ex,Lap,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
fderivs(ex,chi,dtSfx_rhs,dtSfy_rhs,dtSfz_rhs,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||
|
||||
// 6ms //
|
||||
for (int i=0;i<all;i+=1) {
|
||||
/* gxxx,gxxy,gxxz (这里是“升指标后的chi导数/chi”那类量,你沿用原变量名即可) */
|
||||
gxxx[i] = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) / chin1[i];
|
||||
gxxy[i] = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) / chin1[i];
|
||||
gxxz[i] = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) / chin1[i];
|
||||
const double inv_chin1 = ONE / chin1[i];
|
||||
const double gchi_x = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) * inv_chin1;
|
||||
const double gchi_y = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) * inv_chin1;
|
||||
const double gchi_z = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) * inv_chin1;
|
||||
|
||||
/* Christoffel 修正项 */
|
||||
Gamxxx[i] = Gamxxx[i] - ( ((chix[i] + chix[i]) / chin1[i]) - (dxx[i] + ONE) * gxxx[i] ) * HALF;
|
||||
Gamyxx[i] = Gamyxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxy[i] ) * HALF; /* 原式只有 -gxx*gxxy */
|
||||
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxz[i] ) * HALF;
|
||||
Gamxxx[i] = Gamxxx[i] - ( ((chix[i] + chix[i]) * inv_chin1) - (dxx[i] + ONE) * gchi_x ) * HALF;
|
||||
Gamyxx[i] = Gamyxx[i] - ( 0.0 - (dxx[i] + ONE) * gchi_y ) * HALF; /* 原式只有 -gxx*gxxy */
|
||||
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gchi_z ) * HALF;
|
||||
|
||||
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gxxx[i] ) * HALF;
|
||||
Gamyyy[i] = Gamyyy[i] - ( ((chiy[i] + chiy[i]) / chin1[i]) - (dyy[i] + ONE) * gxxy[i] ) * HALF;
|
||||
Gamzyy[i] = Gamzyy[i] - ( 0.0 - (dyy[i] + ONE) * gxxz[i] ) * HALF;
|
||||
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gchi_x ) * HALF;
|
||||
Gamyyy[i] = Gamyyy[i] - ( ((chiy[i] + chiy[i]) * inv_chin1) - (dyy[i] + ONE) * gchi_y ) * HALF;
|
||||
Gamzyy[i] = Gamzyy[i] - ( 0.0 - (dyy[i] + ONE) * gchi_z ) * HALF;
|
||||
|
||||
Gamxzz[i] = Gamxzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxx[i] ) * HALF;
|
||||
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxy[i] ) * HALF;
|
||||
Gamzzz[i] = Gamzzz[i] - ( ((chiz[i] + chiz[i]) / chin1[i]) - (dzz[i] + ONE) * gxxz[i] ) * HALF;
|
||||
Gamxzz[i] = Gamxzz[i] - ( 0.0 - (dzz[i] + ONE) * gchi_x ) * HALF;
|
||||
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gchi_y ) * HALF;
|
||||
Gamzzz[i] = Gamzzz[i] - ( ((chiz[i] + chiz[i]) * inv_chin1) - (dzz[i] + ONE) * gchi_z ) * HALF;
|
||||
|
||||
Gamxxy[i] = Gamxxy[i] - ( ( chiy[i] / chin1[i]) - gxy[i] * gxxx[i] ) * HALF;
|
||||
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] / chin1[i]) - gxy[i] * gxxy[i] ) * HALF;
|
||||
Gamzxy[i] = Gamzxy[i] - ( 0.0 - gxy[i] * gxxz[i] ) * HALF;
|
||||
Gamxxy[i] = Gamxxy[i] - ( ( chiy[i] * inv_chin1) - gxy[i] * gchi_x ) * HALF;
|
||||
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] * inv_chin1) - gxy[i] * gchi_y ) * HALF;
|
||||
Gamzxy[i] = Gamzxy[i] - ( 0.0 - gxy[i] * gchi_z ) * HALF;
|
||||
|
||||
Gamxxz[i] = Gamxxz[i] - ( ( chiz[i] / chin1[i]) - gxz[i] * gxxx[i] ) * HALF;
|
||||
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gxxy[i] ) * HALF;
|
||||
Gamzxz[i] = Gamzxz[i] - ( ( chix[i] / chin1[i]) - gxz[i] * gxxz[i] ) * HALF;
|
||||
Gamxxz[i] = Gamxxz[i] - ( ( chiz[i] * inv_chin1) - gxz[i] * gchi_x ) * HALF;
|
||||
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gchi_y ) * HALF;
|
||||
Gamzxz[i] = Gamzxz[i] - ( ( chix[i] * inv_chin1) - gxz[i] * gchi_z ) * HALF;
|
||||
|
||||
Gamxyz[i] = Gamxyz[i] - ( 0.0 - gyz[i] * gxxx[i] ) * HALF;
|
||||
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] / chin1[i]) - gyz[i] * gxxy[i] ) * HALF;
|
||||
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] / chin1[i]) - gyz[i] * gxxz[i] ) * HALF;
|
||||
Gamxyz[i] = Gamxyz[i] - ( 0.0 - gyz[i] * gchi_x ) * HALF;
|
||||
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] * inv_chin1) - gyz[i] * gchi_y ) * HALF;
|
||||
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] * inv_chin1) - gyz[i] * gchi_z ) * HALF;
|
||||
|
||||
/* fxx..fyz 修正:减去 Γ * ∂Lap */
|
||||
fxx[i] = fxx[i] - Gamxxx[i] * Lapx[i] - Gamyxx[i] * Lapy[i] - Gamzxx[i] * Lapz[i];
|
||||
@@ -781,6 +844,8 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
trK_rhs[i] = gupxx[i] * fxx[i] + gupyy[i] * fyy[i] + gupzz[i] * fzz[i]
|
||||
+ TWO * ( gupxy[i] * fxy[i] + gupxz[i] * fxz[i] + gupyz[i] * fyz[i] );
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_CHI_LAPSE, timer_chi_lapse);
|
||||
RHS_KERNEL_TIMER_DECL(timer_aij_trk_gauge);
|
||||
// 2.5ms //
|
||||
for (int i=0;i<all;i+=1) {
|
||||
const double divb = betaxx[i] + betayy[i] + betazz[i];
|
||||
@@ -1081,33 +1146,33 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
dtSfz_rhs[i] = Gamz_rhs[i] - reta[i] * dtSfz[i];
|
||||
#endif
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_AIJ_TRK_GAUGE, timer_aij_trk_gauge);
|
||||
RHS_KERNEL_TIMER_DECL(timer_ko_constraint);
|
||||
// advection + KO dissipation with shared symmetry buffer
|
||||
BSSN_OMP_TASK_GROUP_BEGIN
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS,eps))
|
||||
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS,eps))
|
||||
BSSN_OMP_TASK_GROUP_END
|
||||
lopsided_kodis(ex,X,Y,Z,dxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,dyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,dzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS,eps);
|
||||
lopsided_kodis(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS,eps);
|
||||
// 2ms //
|
||||
if(co==0){
|
||||
for (int i=0;i<all;i+=1) {
|
||||
@@ -1154,14 +1219,12 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
}
|
||||
|
||||
// 1ms //
|
||||
BSSN_OMP_TASK_GROUP_BEGIN
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Axx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Axy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Axz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Ayy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Ayz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0))
|
||||
BSSN_OMP_TASK_CALL(fderivs(ex,Azz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
|
||||
BSSN_OMP_TASK_GROUP_END
|
||||
fderivs(ex,Axx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
|
||||
fderivs(ex,Axy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0);
|
||||
fderivs(ex,Axz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0);
|
||||
fderivs(ex,Ayy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
|
||||
fderivs(ex,Ayz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0);
|
||||
fderivs(ex,Azz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
|
||||
// 7ms //
|
||||
for (int i=0;i<all;i+=1) {
|
||||
gxxx[i] = gxxx[i] - ( Gamxxx[i] * Axx[i] + Gamyxx[i] * Axy[i] + Gamzxx[i] * Axz[i]
|
||||
@@ -1216,6 +1279,7 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
||||
movz_Res[i] = movz_Res[i] - F2o3*Kz[i] - F8*PI*Sz[i];
|
||||
}
|
||||
}
|
||||
RHS_KERNEL_TIMER_ADD(KB_KO_CONSTRAINT, timer_ko_constraint);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ void fdderivs(const int ex[3],
|
||||
const size_t nz = (size_t)ex3 + 2;
|
||||
const size_t fh_size = nx * ny * nz;
|
||||
|
||||
static thread_local double *fh = NULL;
|
||||
static thread_local size_t cap = 0;
|
||||
static double *fh = NULL;
|
||||
static size_t cap = 0;
|
||||
|
||||
if (fh_size > cap) {
|
||||
free(fh);
|
||||
|
||||
@@ -50,8 +50,8 @@ void fderivs(const int ex[3],
|
||||
const size_t ny = (size_t)ex2 + 2;
|
||||
const size_t nz = (size_t)ex3 + 2;
|
||||
const size_t fh_size = nx * ny * nz;
|
||||
static thread_local double *fh = NULL;
|
||||
static thread_local size_t cap = 0;
|
||||
static double *fh = NULL;
|
||||
static size_t cap = 0;
|
||||
|
||||
if (fh_size > cap) {
|
||||
free(fh);
|
||||
|
||||
@@ -1511,13 +1511,88 @@ deallocate(f_flat)
|
||||
|
||||
f_out = f_out*dX*dY*dZ
|
||||
|
||||
return
|
||||
|
||||
end subroutine l2normhelper
|
||||
!--------------------------------------------------------------------------------------
|
||||
! calculate L2norm especially for shell Blocks
|
||||
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
||||
f,f_out,gw,ogw,Symmetry)
|
||||
return
|
||||
|
||||
end subroutine l2normhelper
|
||||
!--------------------------------------------------------------------------------------
|
||||
subroutine l2normhelper7(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
||||
f1,f2,f3,f4,f5,f6,f7,f_out,gw)
|
||||
|
||||
implicit none
|
||||
!~~~~~~> Input parameters:
|
||||
integer,intent(in ):: ex(1:3)
|
||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3)),xmin,ymin,zmin,xmax,ymax,zmax
|
||||
integer,intent(in)::gw
|
||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: f1,f2,f3,f4,f5,f6,f7
|
||||
real*8, intent(out) :: f_out(7)
|
||||
!~~~~~~> Other variables:
|
||||
|
||||
real*8 :: dX, dY, dZ
|
||||
integer::imin,jmin,kmin
|
||||
integer::imax,jmax,kmax
|
||||
integer::i,j,k
|
||||
real*8 :: s1,s2,s3,s4,s5,s6,s7
|
||||
|
||||
dX = X(2) - X(1)
|
||||
dY = Y(2) - Y(1)
|
||||
dZ = Z(2) - Z(1)
|
||||
|
||||
! for ghost zone
|
||||
imin = gw+1
|
||||
jmin = gw+1
|
||||
kmin = gw+1
|
||||
|
||||
imax = ex(1) - gw
|
||||
jmax = ex(2) - gw
|
||||
kmax = ex(3) - gw
|
||||
|
||||
!for patch boundary (i.e., not ghost boundary)
|
||||
|
||||
if(dabs(X(ex(1))-xmax) < dX) imax = ex(1)
|
||||
if(dabs(Y(ex(2))-ymax) < dY) jmax = ex(2)
|
||||
if(dabs(Z(ex(3))-zmax) < dZ) kmax = ex(3)
|
||||
if(dabs(X(1)-xmin) < dX) imin = 1
|
||||
if(dabs(Y(1)-ymin) < dY) jmin = 1
|
||||
if(dabs(Z(1)-zmin) < dZ) kmin = 1
|
||||
|
||||
s1 = 0.d0
|
||||
s2 = 0.d0
|
||||
s3 = 0.d0
|
||||
s4 = 0.d0
|
||||
s5 = 0.d0
|
||||
s6 = 0.d0
|
||||
s7 = 0.d0
|
||||
|
||||
do k=kmin,kmax
|
||||
do j=jmin,jmax
|
||||
!DIR$ SIMD REDUCTION(+:s1,s2,s3,s4,s5,s6,s7)
|
||||
do i=imin,imax
|
||||
s1 = s1 + f1(i,j,k)*f1(i,j,k)
|
||||
s2 = s2 + f2(i,j,k)*f2(i,j,k)
|
||||
s3 = s3 + f3(i,j,k)*f3(i,j,k)
|
||||
s4 = s4 + f4(i,j,k)*f4(i,j,k)
|
||||
s5 = s5 + f5(i,j,k)*f5(i,j,k)
|
||||
s6 = s6 + f6(i,j,k)*f6(i,j,k)
|
||||
s7 = s7 + f7(i,j,k)*f7(i,j,k)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
f_out(1) = s1*dX*dY*dZ
|
||||
f_out(2) = s2*dX*dY*dZ
|
||||
f_out(3) = s3*dX*dY*dZ
|
||||
f_out(4) = s4*dX*dY*dZ
|
||||
f_out(5) = s5*dX*dY*dZ
|
||||
f_out(6) = s6*dX*dY*dZ
|
||||
f_out(7) = s7*dX*dY*dZ
|
||||
|
||||
return
|
||||
|
||||
end subroutine l2normhelper7
|
||||
!--------------------------------------------------------------------------------------
|
||||
! calculate L2norm especially for shell Blocks
|
||||
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
||||
f,f_out,gw,ogw,Symmetry)
|
||||
|
||||
implicit none
|
||||
!~~~~~~> Input parameters:
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
#define f_global_interpind global_interpind
|
||||
#define f_global_interpind2d global_interpind2d
|
||||
#define f_global_interpind1d global_interpind1d
|
||||
#define f_l2normhelper l2normhelper
|
||||
#define f_l2normhelper_sh l2normhelper_sh
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
||||
#define f_l2normhelper l2normhelper
|
||||
#define f_l2normhelper7 l2normhelper7
|
||||
#define f_l2normhelper_sh l2normhelper_sh
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
||||
#define f_average average
|
||||
#define f_average3 average3
|
||||
#define f_average2 average2
|
||||
@@ -41,9 +42,10 @@
|
||||
#define f_global_interpind GLOBAL_INTERPIND
|
||||
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
||||
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
||||
#define f_l2normhelper L2NORMHELPER
|
||||
#define f_l2normhelper_sh L2NORMHELPER_SH
|
||||
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
||||
#define f_l2normhelper L2NORMHELPER
|
||||
#define f_l2normhelper7 L2NORMHELPER7
|
||||
#define f_l2normhelper_sh L2NORMHELPER_SH
|
||||
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
||||
#define f_average AVERAGE
|
||||
#define f_average3 AVERAGE3
|
||||
#define f_average2 AVERAGE2
|
||||
@@ -70,9 +72,10 @@
|
||||
#define f_global_interpind global_interpind_
|
||||
#define f_global_interpind2d global_interpind2d_
|
||||
#define f_global_interpind1d global_interpind1d_
|
||||
#define f_l2normhelper l2normhelper_
|
||||
#define f_l2normhelper_sh l2normhelper_sh_
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
||||
#define f_l2normhelper l2normhelper_
|
||||
#define f_l2normhelper7 l2normhelper7_
|
||||
#define f_l2normhelper_sh l2normhelper_sh_
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
||||
#define f_average average_
|
||||
#define f_average3 average3_
|
||||
#define f_average2 average2_
|
||||
@@ -156,20 +159,29 @@ extern "C"
|
||||
int *, double *, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper_sh(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &, int &, int &);
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper7(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double *, double *, double *,
|
||||
double *, double *, double *, double *, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper_sh(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
||||
@@ -43,13 +43,7 @@ void lopsided_kodis(const int ex[3],
|
||||
const size_t nz = (size_t)ex3 + 3;
|
||||
const size_t fh_size = nx * ny * nz;
|
||||
|
||||
static thread_local double *fh = NULL;
|
||||
static thread_local size_t cap = 0;
|
||||
if (fh_size > cap) {
|
||||
free(fh);
|
||||
fh = (double*)aligned_alloc(64, fh_size * sizeof(double));
|
||||
cap = fh_size;
|
||||
}
|
||||
double *fh = (double*)malloc(fh_size * sizeof(double));
|
||||
if (!fh) return;
|
||||
|
||||
symmetry_bd(3, ex, f, fh, SoA);
|
||||
@@ -249,4 +243,6 @@ void lopsided_kodis(const int ex[3],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(fh);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,16 @@
|
||||
|
||||
#define REGLEV 0
|
||||
|
||||
#define BSSN_FINE_TIMING 0
|
||||
|
||||
#define BSSN_FINE_TIMING_EVERY 1
|
||||
|
||||
#define BSSN_FINE_TIMING_TOPN 8
|
||||
|
||||
#define BSSN_KERNEL_FINE_TIMING 0
|
||||
|
||||
#define BSSN_ENABLE_STDIN_ABORT_POLL 0
|
||||
|
||||
//#define USE_GPU
|
||||
|
||||
//#define CHECKDETAIL
|
||||
@@ -88,6 +98,21 @@
|
||||
// 0: for every level;
|
||||
// 1: for all
|
||||
//
|
||||
// define BSSN_FINE_TIMING
|
||||
// enable fine-grained per-timestep timing monitor
|
||||
//
|
||||
// define BSSN_FINE_TIMING_EVERY
|
||||
// report timing every N coarse timesteps
|
||||
//
|
||||
// define BSSN_FINE_TIMING_TOPN
|
||||
// number of hottest timing buckets shown in stdout
|
||||
//
|
||||
// define BSSN_KERNEL_FINE_TIMING
|
||||
// enable split timing inside compute_rhs_bssn
|
||||
//
|
||||
// define BSSN_ENABLE_STDIN_ABORT_POLL
|
||||
// poll stdin and broadcast abort flag every coarse step
|
||||
//
|
||||
// define USE_GPU
|
||||
// use gpu or not
|
||||
//
|
||||
@@ -142,4 +167,3 @@
|
||||
#define TINY 1e-10
|
||||
|
||||
#endif /* MICRODEF_H */
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ PROFDATA = /home/$(shell whoami)/AMSS-NCKU/pgo_profile/default.profdata
|
||||
ifeq ($(PGO_MODE),instrument)
|
||||
## Phase 1: instrumentation — omit -ipo/-fp-model fast=2 for faster build and numerical stability
|
||||
CXXAPPFLAGS = -O3 -xHost -fma -fprofile-instr-generate -ipo \
|
||||
-Dfortran3 -Dnewc -I${MKLROOT}/include $(INTERP_LB_FLAGS) $(OPENMP_FLAGS)
|
||||
-Dfortran3 -Dnewc -I${MKLROOT}/include $(INTERP_LB_FLAGS)
|
||||
f90appflags = -O3 -xHost -fma -fprofile-instr-generate -ipo \
|
||||
-align array64byte -fpp -I${MKLROOT}/include $(POLINT6_FLAG)
|
||||
else
|
||||
@@ -26,7 +26,7 @@ else
|
||||
|
||||
|
||||
CXXAPPFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||
-Dfortran3 -Dnewc -I${MKLROOT}/include $(INTERP_LB_FLAGS) $(OPENMP_FLAGS)
|
||||
-Dfortran3 -Dnewc -I${MKLROOT}/include $(INTERP_LB_FLAGS)
|
||||
f90appflags = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||
-align array64byte -fpp -I${MKLROOT}/include $(POLINT6_FLAG)
|
||||
endif
|
||||
|
||||
@@ -29,9 +29,6 @@ endif
|
||||
## instrument : PGO Phase 1 instrumentation to collect fresh profile data
|
||||
PGO_MODE ?= opt
|
||||
|
||||
## OpenMP switch for C/C++ kernels
|
||||
OPENMP_FLAGS ?= -qopenmp
|
||||
|
||||
## Interp_Points load balance profiling mode
|
||||
## off : (default) no load balance instrumentation
|
||||
## profile : Pass 1 — instrument Interp_Points to collect timing profile
|
||||
|
||||
@@ -317,9 +317,9 @@ void scalar_class::Setup_Initial_Data()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
void scalar_class::Evolve(int Steps)
|
||||
{
|
||||
double prev_clock = 0.0, curr_clock = 0.0;
|
||||
void scalar_class::Evolve(int Steps)
|
||||
{
|
||||
clock_t prev_clock, curr_clock;
|
||||
double LastDump = 0.0, LastCheck = 0.0;
|
||||
LastAnas = 0;
|
||||
|
||||
@@ -327,8 +327,8 @@ void scalar_class::Evolve(int Steps)
|
||||
|
||||
for (int ncount = 1; ncount < Steps + 1; ncount++)
|
||||
{
|
||||
if (myrank == 0)
|
||||
curr_clock = MPI_Wtime();
|
||||
if (myrank == 0)
|
||||
curr_clock = clock();
|
||||
RecursiveStep(0);
|
||||
|
||||
LastDump += dT_mon;
|
||||
@@ -343,13 +343,13 @@ void scalar_class::Evolve(int Steps)
|
||||
#endif
|
||||
LastDump = 0;
|
||||
}
|
||||
if (myrank == 0)
|
||||
{
|
||||
prev_clock = curr_clock;
|
||||
curr_clock = MPI_Wtime();
|
||||
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime
|
||||
<< " Computer used " << (curr_clock - prev_clock) << " seconds! " << endl;
|
||||
}
|
||||
if (myrank == 0)
|
||||
{
|
||||
prev_clock = curr_clock;
|
||||
curr_clock = clock();
|
||||
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime
|
||||
<< " Computer used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
|
||||
}
|
||||
if (PhysTime >= TotalTime)
|
||||
break;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,19 +27,24 @@ using namespace std;
|
||||
class surface_integral
|
||||
{
|
||||
|
||||
private:
|
||||
int Symmetry, factor;
|
||||
int N_theta, N_phi; // Number of points in Theta & Phi directions
|
||||
double dphi, dcostheta;
|
||||
double *arcostheta, *wtcostheta;
|
||||
int n_tot; // size of arrays
|
||||
|
||||
double *nx_g, *ny_g, *nz_g; // global list of unit normals
|
||||
int myrank, cpusize;
|
||||
|
||||
public:
|
||||
surface_integral(int iSymmetry);
|
||||
~surface_integral();
|
||||
private:
|
||||
int Symmetry, factor;
|
||||
int N_theta, N_phi; // Number of points in Theta & Phi directions
|
||||
double dphi, dcostheta;
|
||||
double *arcostheta, *wtcostheta;
|
||||
int n_tot; // size of arrays
|
||||
|
||||
double *nx_g, *ny_g, *nz_g; // global list of unit normals
|
||||
int myrank, cpusize;
|
||||
int wave_cache_spinw, wave_cache_maxl, wave_cache_modes;
|
||||
double *wave_theta_pos, *wave_theta_neg;
|
||||
double *wave_phi_cos, *wave_phi_sin;
|
||||
void clear_wave_cache();
|
||||
void build_wave_cache(int spinw, int maxl);
|
||||
|
||||
public:
|
||||
surface_integral(int iSymmetry);
|
||||
~surface_integral();
|
||||
|
||||
void surf_Wave(double rex, int lev, cgh *GH, var *Rpsi4, var *Ipsi4,
|
||||
int spinw, int maxl, int NN, double *RP, double *IP,
|
||||
@@ -77,21 +82,37 @@ public:
|
||||
double &, double &, double &, double &, double &, double &, double &,
|
||||
double &, double &, double &, double &, double &, double &,
|
||||
double &, double &)); // NN is the length of RP and IP
|
||||
void surf_MassPAng(double rex, int lev, cgh *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor);
|
||||
void surf_MassPAng(double rex, int lev, ShellPatch *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor);
|
||||
void surf_Wave(double rex, cgh *GH, ShellPatch *SH,
|
||||
var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
void surf_MassPAng(double rex, int lev, cgh *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
||||
void surf_MassPAng(double rex, int lev, ShellPatch *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
||||
void surf_WaveMassPAng(double rex, int lev, cgh *GH,
|
||||
var *Rpsi4, var *Ipsi4, int spinw, int maxl, int NN, double *RP, double *IP,
|
||||
var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
||||
void surf_WaveMassPAng(double rex, int lev, ShellPatch *GH,
|
||||
var *Rpsi4, var *Ipsi4, int spinw, int maxl, int NN, double *RP, double *IP,
|
||||
var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
||||
void surf_Wave(double rex, cgh *GH, ShellPatch *SH,
|
||||
var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *chix, var *chiy, var *chiz,
|
||||
var *trKx, var *trKy, var *trKz,
|
||||
@@ -110,12 +131,12 @@ public:
|
||||
bool SR_Interp_Points(MyList<var> *VarList, cgh *GH, ShellPatch *SH,
|
||||
int NN, double **XX, double *Shellf);
|
||||
|
||||
void surf_MassPAng(double rex, int lev, cgh *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs, // temparay memory for mass^i
|
||||
double *Rout, monitor *Monitor, MPI_Comm Comm_here);
|
||||
void surf_MassPAng(double rex, int lev, cgh *GH, var *chi, var *trK,
|
||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||
var *Gmx, var *Gmy, var *Gmz,
|
||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs, // temparay memory for mass^i
|
||||
double *Rout, monitor *Monitor, MPI_Comm Comm_here, bool refresh_mass_fields = true);
|
||||
void surf_Wave(double rex, int lev, cgh *GH, var *Rpsi4, var *Ipsi4,
|
||||
int spinw, int maxl, int NN, double *RP, double *IP,
|
||||
monitor *Monitor, MPI_Comm Comm_here);
|
||||
|
||||
@@ -144,6 +144,62 @@ def generate_macrodef_h():
|
||||
print( "#define REGLEV 0", file=file1 )
|
||||
print( file=file1 )
|
||||
|
||||
# Define fine-grained timing/debug macros.
|
||||
# All of them default to OFF so production builds do not pay profiling overhead.
|
||||
|
||||
fine_timing = getattr(input_data, "Fine_Timing",
|
||||
getattr(input_data, "Finegrained_Timing", "no"))
|
||||
kernel_fine_timing = getattr(input_data, "Kernel_Fine_Timing",
|
||||
getattr(input_data, "BSSN_Kernel_Fine_Timing", "no"))
|
||||
stdin_abort_poll = getattr(input_data, "Enable_Stdin_Abort_Poll",
|
||||
getattr(input_data, "Stdin_Abort_Poll", "no"))
|
||||
timing_report_every = max(1, int(getattr(
|
||||
input_data, "Timing_Every_Steps",
|
||||
getattr(input_data, "Timing_Report_Every", 1))))
|
||||
timing_top_hotspots = max(1, int(getattr(
|
||||
input_data, "Timing_Top_Hotspots", 8)))
|
||||
|
||||
if ( fine_timing == "yes" ):
|
||||
print( "#define BSSN_FINE_TIMING 1", file=file1 )
|
||||
print( file=file1 )
|
||||
elif ( fine_timing == "no" ):
|
||||
print( "#define BSSN_FINE_TIMING 0", file=file1 )
|
||||
print( file=file1 )
|
||||
else:
|
||||
print( "Fine_Timing setting error!!!" )
|
||||
print()
|
||||
print( "# Fine_Timing setting error!!!", file=file1 )
|
||||
print( file=file1 )
|
||||
|
||||
print( f"#define BSSN_FINE_TIMING_EVERY {timing_report_every}", file=file1 )
|
||||
print( file=file1 )
|
||||
print( f"#define BSSN_FINE_TIMING_TOPN {timing_top_hotspots}", file=file1 )
|
||||
print( file=file1 )
|
||||
|
||||
if ( kernel_fine_timing == "yes" ):
|
||||
print( "#define BSSN_KERNEL_FINE_TIMING 1", file=file1 )
|
||||
print( file=file1 )
|
||||
elif ( kernel_fine_timing == "no" ):
|
||||
print( "#define BSSN_KERNEL_FINE_TIMING 0", file=file1 )
|
||||
print( file=file1 )
|
||||
else:
|
||||
print( "Kernel_Fine_Timing setting error!!!" )
|
||||
print()
|
||||
print( "# Kernel_Fine_Timing setting error!!!", file=file1 )
|
||||
print( file=file1 )
|
||||
|
||||
if ( stdin_abort_poll == "yes" ):
|
||||
print( "#define BSSN_ENABLE_STDIN_ABORT_POLL 1", file=file1 )
|
||||
print( file=file1 )
|
||||
elif ( stdin_abort_poll == "no" ):
|
||||
print( "#define BSSN_ENABLE_STDIN_ABORT_POLL 0", file=file1 )
|
||||
print( file=file1 )
|
||||
else:
|
||||
print( "Enable_Stdin_Abort_Poll setting error!!!" )
|
||||
print()
|
||||
print( "# Enable_Stdin_Abort_Poll setting error!!!", file=file1 )
|
||||
print( file=file1 )
|
||||
|
||||
# Define macro USE_GPU
|
||||
# use GPU or not
|
||||
|
||||
@@ -224,6 +280,21 @@ def generate_macrodef_h():
|
||||
print( "// 0: for every level;", file=file1 )
|
||||
print( "// 1: for all", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define BSSN_FINE_TIMING", file=file1 )
|
||||
print( "// enable fine-grained per-timestep timing monitor", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define BSSN_FINE_TIMING_EVERY", file=file1 )
|
||||
print( "// report timing every N coarse timesteps", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define BSSN_FINE_TIMING_TOPN", file=file1 )
|
||||
print( "// number of hottest timing buckets shown in stdout", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define BSSN_KERNEL_FINE_TIMING", file=file1 )
|
||||
print( "// enable split timing inside compute_rhs_bssn", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define BSSN_ENABLE_STDIN_ABORT_POLL", file=file1 )
|
||||
print( "// poll stdin and broadcast abort flag every coarse step", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
print( "// define USE_GPU", file=file1 )
|
||||
print( "// use gpu or not", file=file1 )
|
||||
print( "//", file=file1 )
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
|
||||
import AMSS_NCKU_Input as input_data
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
@@ -55,44 +54,6 @@ NUMACTL_CPU_BIND = get_last_n_cores_per_socket(n=32)
|
||||
BUILD_JOBS = 64
|
||||
|
||||
|
||||
def build_abe_runtime_env():
|
||||
"""Inject OpenMP runtime settings only for the main ABE evolution run."""
|
||||
runtime_env = os.environ.copy()
|
||||
omp_threads = max(1, int(getattr(input_data, "OMP_Threads", 1)))
|
||||
runtime_env["OMP_NUM_THREADS"] = str(omp_threads)
|
||||
return runtime_env
|
||||
|
||||
|
||||
def build_twopuncture_runtime_env():
|
||||
"""Let TwoPunctureABE use the runtime default instead of the ABE OMP override."""
|
||||
runtime_env = os.environ.copy()
|
||||
runtime_env.pop("OMP_NUM_THREADS", None)
|
||||
runtime_env.pop("OMP_THREAD_LIMIT", None)
|
||||
return runtime_env
|
||||
|
||||
|
||||
def build_mpi_launch_args():
|
||||
"""Build optional host-distribution arguments for mpirun."""
|
||||
hosts = list(getattr(input_data, "MPI_hosts", []))
|
||||
ppn = int(getattr(input_data, "MPI_processes_per_node", 0))
|
||||
|
||||
if not hosts:
|
||||
return ""
|
||||
|
||||
if ppn > 0:
|
||||
expected = len(hosts) * ppn
|
||||
if int(input_data.MPI_processes) != expected:
|
||||
raise ValueError(
|
||||
f"MPI_processes={input_data.MPI_processes} does not match "
|
||||
f"len(MPI_hosts) * MPI_processes_per_node = {expected}"
|
||||
)
|
||||
|
||||
launch_args = f"-hosts {','.join(hosts)}"
|
||||
if ppn > 0:
|
||||
launch_args += f" -ppn {ppn}"
|
||||
return launch_args
|
||||
|
||||
|
||||
##################################################################
|
||||
|
||||
|
||||
@@ -182,38 +143,19 @@ def run_ABE():
|
||||
print( )
|
||||
print( " Running the AMSS-NCKU executable file ABE/ABEGPU " )
|
||||
print( )
|
||||
print( f" MPI processes = {input_data.MPI_processes}, OMP threads per process = {max(1, int(getattr(input_data, 'OMP_Threads', 1)))}" )
|
||||
if getattr(input_data, "MPI_hosts", []):
|
||||
print( f" MPI hosts = {getattr(input_data, 'MPI_hosts', [])}, MPI ranks per node = {int(getattr(input_data, 'MPI_processes_per_node', 0))}" )
|
||||
print( " Multi-node runs require the working directory to be visible on all MPI hosts. " )
|
||||
print( )
|
||||
|
||||
## Define the command to run; cast other values to strings as needed
|
||||
mpi_launch_args = build_mpi_launch_args()
|
||||
|
||||
if (input_data.GPU_Calculation == "no"):
|
||||
mpi_command = NUMACTL_CPU_BIND + " mpirun "
|
||||
if mpi_launch_args:
|
||||
mpi_command += mpi_launch_args + " "
|
||||
mpi_command += "-np " + str(input_data.MPI_processes) + " ./ABE"
|
||||
mpi_command = NUMACTL_CPU_BIND + " mpirun -np " + str(input_data.MPI_processes) + " ./ABE"
|
||||
#mpi_command = " mpirun -np " + str(input_data.MPI_processes) + " ./ABE"
|
||||
mpi_command_outfile = "ABE_out.log"
|
||||
elif (input_data.GPU_Calculation == "yes"):
|
||||
mpi_command = NUMACTL_CPU_BIND + " mpirun "
|
||||
if mpi_launch_args:
|
||||
mpi_command += mpi_launch_args + " "
|
||||
mpi_command += "-np " + str(input_data.MPI_processes) + " ./ABEGPU"
|
||||
mpi_command = NUMACTL_CPU_BIND + " mpirun -np " + str(input_data.MPI_processes) + " ./ABEGPU"
|
||||
mpi_command_outfile = "ABEGPU_out.log"
|
||||
|
||||
## Execute the MPI command and stream output
|
||||
mpi_process = subprocess.Popen(
|
||||
mpi_command,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
env=build_abe_runtime_env(),
|
||||
)
|
||||
mpi_process = subprocess.Popen(mpi_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||
|
||||
## Write ABE run output to file while printing to stdout
|
||||
with open(mpi_command_outfile, 'w') as file0:
|
||||
@@ -253,14 +195,7 @@ def run_TwoPunctureABE():
|
||||
TwoPuncture_command_outfile = "TwoPunctureABE_out.log"
|
||||
|
||||
## Execute the command with subprocess.Popen and stream output
|
||||
TwoPuncture_process = subprocess.Popen(
|
||||
TwoPuncture_command,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
env=build_twopuncture_runtime_env(),
|
||||
)
|
||||
TwoPuncture_process = subprocess.Popen(TwoPuncture_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||
|
||||
## Write TwoPunctureABE run output to file while printing to stdout
|
||||
with open(TwoPuncture_command_outfile, 'w') as file0:
|
||||
|
||||
24
setup.py
24
setup.py
@@ -65,14 +65,10 @@ def print_input_data( File_directory ):
|
||||
|
||||
print( "------------------------------------------------------------------------------------------" )
|
||||
print( )
|
||||
print( " Printing the basic parameter and setting in the AMSS-NCKU simulation " )
|
||||
print( )
|
||||
print( " The number of MPI processes in the AMSS-NCKU simulation = ", input_data.MPI_processes )
|
||||
print( " The number of OMP threads per MPI process = ", input_data.OMP_Threads )
|
||||
if getattr(input_data, "MPI_hosts", []):
|
||||
print( " The MPI host list in the AMSS-NCKU simulation = ", input_data.MPI_hosts )
|
||||
print( " The number of MPI ranks launched per host = ", input_data.MPI_processes_per_node )
|
||||
print( )
|
||||
print( " Printing the basic parameter and setting in the AMSS-NCKU simulation " )
|
||||
print( )
|
||||
print( " The number of MPI processes in the AMSS-NCKU simulation = ", input_data.MPI_processes )
|
||||
print( )
|
||||
print( " The form of computational equation = ", input_data.Equation_Class )
|
||||
print( " The initial data in this simulation = ", input_data.Initial_Data_Method )
|
||||
print( )
|
||||
@@ -144,14 +140,10 @@ def print_input_data( File_directory ):
|
||||
file0 = open(filepath, 'w')
|
||||
|
||||
print( file=file0 )
|
||||
print( " Printing the basic parameter and setting in the AMSS-NCKU simulation ", file=file0 )
|
||||
print( file=file0 )
|
||||
print( " The number of MPI processes in the AMSS-NCKU simulation = ", input_data.MPI_processes, file=file0 )
|
||||
print( " The number of OMP threads per MPI process = ", input_data.OMP_Threads, file=file0 )
|
||||
if getattr(input_data, "MPI_hosts", []):
|
||||
print( " The MPI host list in the AMSS-NCKU simulation = ", input_data.MPI_hosts, file=file0 )
|
||||
print( " The number of MPI ranks launched per host = ", input_data.MPI_processes_per_node, file=file0 )
|
||||
print( file=file0 )
|
||||
print( " Printing the basic parameter and setting in the AMSS-NCKU simulation ", file=file0 )
|
||||
print( file=file0 )
|
||||
print( " The number of MPI processes in the AMSS-NCKU simulation = ", input_data.MPI_processes, file=file0 )
|
||||
print( file=file0 )
|
||||
print( " The form of computational equation = ", input_data.Equation_Class, file=file0 )
|
||||
print( " The initial data in this simulation = ", input_data.Initial_Data_Method, file=file0 )
|
||||
print( file=file0 )
|
||||
|
||||
Reference in New Issue
Block a user