REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_writeJobInfo.cpp
Go to the documentation of this file.
1#include <REMORA.H>
2#include <AMReX_buildInfo.H>
3
4extern std::string inputs_name;
5
6void
7REMORA::writeJobInfo(const std::string& dir) const
8{
9 // job_info file with details about the run
10 std::ofstream jobInfoFile;
11 std::string FullPathJobInfoFile = dir;
12 FullPathJobInfoFile += "/job_info";
13 jobInfoFile.open(FullPathJobInfoFile.c_str(), std::ios::out);
14
15 std::string PrettyLine = "==================================================="
16 "============================\n";
17 std::string OtherLine = "----------------------------------------------------"
18 "----------------------------\n";
19 std::string SkipSpace = " ";
20
21 // job information
22 jobInfoFile << PrettyLine;
23 jobInfoFile << " REMORA Job Information\n";
24 jobInfoFile << PrettyLine;
25
26 jobInfoFile << "inputs file: " << inputs_name << "\n\n";
27
28 jobInfoFile << "number of MPI processes: "
29 << amrex::ParallelDescriptor::NProcs() << "\n";
30#ifdef _OPENMP
31 jobInfoFile << "number of threads: " << omp_get_max_threads() << "\n";
32#endif
33
34 jobInfoFile << "\n";
35 jobInfoFile << "CPU time used since start of simulation (CPU-hours): "
36 << getCPUTime() / 3600.0;
37
38 jobInfoFile << "\n\n";
39
40 // plotfile information
41 jobInfoFile << PrettyLine;
42 jobInfoFile << " Plotfile Information\n";
43 jobInfoFile << PrettyLine;
44
45 time_t now = time(0);
46
47 // Convert now to tm struct for local timezone
48 tm* localtm = localtime(&now);
49 jobInfoFile << "output data / time: " << asctime(localtm);
50
51 std::string currentDir = amrex::FileSystem::CurrentPath();
52 jobInfoFile << "output dir: " << currentDir << "\n";
53
54 jobInfoFile << "\n\n";
55
56 // build information
57 jobInfoFile << PrettyLine;
58 jobInfoFile << " Build Information\n";
59 jobInfoFile << PrettyLine;
60
61 jobInfoFile << "build date: " << amrex::buildInfoGetBuildDate() << "\n";
62 jobInfoFile << "build machine: " << amrex::buildInfoGetBuildMachine() << "\n";
63 jobInfoFile << "build dir: " << amrex::buildInfoGetBuildDir() << "\n";
64 jobInfoFile << "AMReX dir: " << amrex::buildInfoGetAMReXDir() << "\n";
65
66 jobInfoFile << "\n";
67
68 jobInfoFile << "COMP: " << amrex::buildInfoGetComp() << "\n";
69 jobInfoFile << "COMP version: " << amrex::buildInfoGetCompVersion() << "\n";
70
71 jobInfoFile << "\n";
72
73 for (int n = 1; n <= amrex::buildInfoGetNumModules(); n++) {
74 jobInfoFile << amrex::buildInfoGetModuleName(n) << ": "
75 << amrex::buildInfoGetModuleVal(n) << "\n";
76 }
77
78 jobInfoFile << "\n";
79
80 const char* githash1 = amrex::buildInfoGetGitHash(1);
81 const char* githash2 = amrex::buildInfoGetGitHash(2);
82 if (strlen(githash1) > 0) {
83 jobInfoFile << "REMORA git hash: " << githash1 << "\n";
84 }
85 if (strlen(githash2) > 0) {
86 jobInfoFile << "AMReX git hash: " << githash2 << "\n";
87 }
88
89 const char* buildgithash = amrex::buildInfoGetBuildGitHash();
90 const char* buildgitname = amrex::buildInfoGetBuildGitName();
91 if (strlen(buildgithash) > 0) {
92 jobInfoFile << buildgitname << " git hash: " << buildgithash << "\n";
93 }
94
95 jobInfoFile << "\n\n";
96
97 // grid information
98 jobInfoFile << PrettyLine;
99 jobInfoFile << " Grid Information\n";
100 jobInfoFile << PrettyLine;
101
102 int f_lev = finest_level;
103
104 for (int i = 0; i <= f_lev; i++) {
105 jobInfoFile << " level: " << i << "\n";
106 jobInfoFile << " number of boxes = " << grids[i].size() << "\n";
107 jobInfoFile << " maximum zones = ";
108 for (int n = 0; n < AMREX_SPACEDIM; n++) {
109 jobInfoFile << geom[i].Domain().length(n) << " ";
110 }
111 jobInfoFile << "\n\n";
112 }
113
114 jobInfoFile << " Boundary conditions\n";
115
116 jobInfoFile << " -x: " << domain_bc_type[0] << "\n";
117 jobInfoFile << " +x: " << domain_bc_type[3] << "\n";
118 jobInfoFile << " -y: " << domain_bc_type[1] << "\n";
119 jobInfoFile << " +y: " << domain_bc_type[4] << "\n";
120 jobInfoFile << " -z: " << domain_bc_type[2] << "\n";
121 jobInfoFile << " +z: " << domain_bc_type[5] << "\n";
122
123 jobInfoFile << "\n\n";
124
125 // runtime parameters
126 jobInfoFile << PrettyLine;
127 jobInfoFile << " Inputs File Parameters\n";
128 jobInfoFile << PrettyLine;
129
130 amrex::ParmParse::dumpTable(jobInfoFile, true);
131 jobInfoFile.close();
132}
133
134void
135REMORA::writeBuildInfo(std::ostream& os)
136{
137 std::string PrettyLine = std::string(78, '=') + "\n";
138 std::string OtherLine = std::string(78, '-') + "\n";
139 std::string SkipSpace = std::string(8, ' ');
140
141 // build information
142 os << PrettyLine;
143 os << " REMORA Build Information\n";
144 os << PrettyLine;
145
146 os << "build date: " << amrex::buildInfoGetBuildDate() << "\n";
147 os << "build machine: " << amrex::buildInfoGetBuildMachine() << "\n";
148 os << "build dir: " << amrex::buildInfoGetBuildDir() << "\n";
149 os << "AMReX dir: " << amrex::buildInfoGetAMReXDir() << "\n";
150
151 os << "\n";
152
153 os << "COMP: " << amrex::buildInfoGetComp() << "\n";
154 os << "COMP version: " << amrex::buildInfoGetCompVersion() << "\n";
155
156 os << "C++ compiler: " << amrex::buildInfoGetCXXName() << "\n";
157 os << "C++ flags: " << amrex::buildInfoGetCXXFlags() << "\n";
158
159 os << "\n";
160
161 os << "Link flags: " << amrex::buildInfoGetLinkFlags() << "\n";
162 os << "Libraries: " << amrex::buildInfoGetLibraries() << "\n";
163
164 os << "\n";
165
166 for (int n = 1; n <= amrex::buildInfoGetNumModules(); n++) {
167 os << amrex::buildInfoGetModuleName(n) << ": "
168 << amrex::buildInfoGetModuleVal(n) << "\n";
169 }
170
171 os << "\n";
172 const char* githash1 = amrex::buildInfoGetGitHash(1);
173 const char* githash2 = amrex::buildInfoGetGitHash(2);
174 if (strlen(githash1) > 0) {
175 os << "REMORA git hash: " << githash1 << "\n";
176 }
177 if (strlen(githash2) > 0) {
178 os << "AMReX git hash: " << githash2 << "\n";
179 }
180
181 const char* buildgithash = amrex::buildInfoGetBuildGitHash();
182 const char* buildgitname = amrex::buildInfoGetBuildGitName();
183 if (strlen(buildgithash) > 0) {
184 os << buildgitname << " git hash: " << buildgithash << "\n";
185 }
186
187 os << "\n";
188 os << " REMORA Compile time variables: \n";
189
190 os << "\n";
191 os << " REMORA Defines: \n";
192#ifdef _OPENMP
193 os << std::setw(35) << std::left << "_OPENMP " << std::setw(6) << "ON"
194 << std::endl;
195#else
196 os << std::setw(35) << std::left << "_OPENMP " << std::setw(6) << "OFF"
197 << std::endl;
198#endif
199
200#ifdef MPI_VERSION
201 os << std::setw(35) << std::left << "MPI_VERSION " << std::setw(6)
202 << MPI_VERSION << std::endl;
203#else
204 os << std::setw(35) << std::left << "MPI_VERSION " << std::setw(6)
205 << "UNDEFINED" << std::endl;
206#endif
207
208#ifdef MPI_SUBVERSION
209 os << std::setw(35) << std::left << "MPI_SUBVERSION " << std::setw(6)
210 << MPI_SUBVERSION << std::endl;
211#else
212 os << std::setw(35) << std::left << "MPI_SUBVERSION " << std::setw(6)
213 << "UNDEFINED" << std::endl;
214#endif
215
216 os << "\n\n";
217}
std::string inputs_name
Definition main.cpp:9
std::string inputs_name
Definition main.cpp:9
void writeJobInfo(const std::string &dir) const
Write job info to stdout.
static void writeBuildInfo(std::ostream &os)
Write build info to os.
amrex::Real getCPUTime() const
Get CPU time used.
Definition REMORA.H:1363
amrex::Array< std::string, 2 *AMREX_SPACEDIM > domain_bc_type
Array of strings describing domain boundary conditions.
Definition REMORA.H:1125
const char * buildInfoGetGitHash(int i)
const char * buildInfoGetBuildDate()
const char * buildInfoGetCompVersion()
const char * buildInfoGetComp()