39 #include <GetoptWin64/Getopt.h>
69 inputFileName(
""), outputFileName (
""), checkpointFileName(
""),
71 numberOfThreads(omp_get_num_procs()),
78 progressPrintInterval(DEFAULT_PROGRESS_PRINT_INTERVAL),
79 compressionLevel(DEFAULT_COMPRESSION_LEVEL),
80 benchmarkFlag (false), benchmarkTimeStepCount(0),
81 checkpointInterval(0),
84 store_p_raw(false), store_p_rms(false), store_p_max(false), store_p_min(false),
85 store_p_max_all(false), store_p_min_all(false), store_p_final(false),
86 store_u_raw(false), store_u_non_staggered_raw(false),
87 store_u_rms(false), store_u_max(false), store_u_min(false),
88 store_u_max_all(false), store_u_min_all(false), store_u_final(false),
89 copySensorMask(false),
106 omp_get_num_procs());
162 string sampledQuantitiesList =
"";
167 sampledQuantitiesList +=
"p_raw, ";
171 sampledQuantitiesList +=
"p_rms, ";
175 sampledQuantitiesList +=
"p_max, ";
179 sampledQuantitiesList +=
"p_min, ";
183 sampledQuantitiesList +=
"p_max_all, ";
187 sampledQuantitiesList +=
"p_min_all, ";
191 sampledQuantitiesList +=
"p_final, ";
197 sampledQuantitiesList +=
"u_raw, ";
201 sampledQuantitiesList +=
"u_rms, ";
205 sampledQuantitiesList +=
"u_max, ";
209 sampledQuantitiesList +=
"u_min, ";
213 sampledQuantitiesList +=
"u_max_all, ";
217 sampledQuantitiesList +=
"u_min_all, ";
221 sampledQuantitiesList +=
"u_final, ";
226 sampledQuantitiesList +=
"u_non_staggered_raw, ";
230 if (sampledQuantitiesList.length() > 0)
232 sampledQuantitiesList.pop_back();
233 sampledQuantitiesList.pop_back();
260 bool checkpointFlag =
false;
262 const int errorLineIndentation = 9;
267 const char* shortOpts =
"i:o:r:c:t:g:puhs:";
269 const char* shortOpts =
"i:o:r:c:g:puhs:";
272 const struct option longOpts[] =
274 {
"benchmark", required_argument, NULL, 1 },
275 {
"copy_sensor_mask", no_argument, NULL, 2 },
276 {
"checkpoint_file" , required_argument, NULL, 3 },
277 {
"checkpoint_interval", required_argument, NULL, 4 },
278 {
"help", no_argument, NULL,
'h'},
279 {
"verbose", required_argument, NULL, 5 },
280 {
"version", no_argument, NULL, 6 },
282 {
"p_raw", no_argument, NULL,
'p' },
283 {
"p_rms", no_argument, NULL, 10 },
284 {
"p_max", no_argument, NULL, 11 },
285 {
"p_min", no_argument, NULL, 12 },
286 {
"p_max_all", no_argument, NULL, 13 },
287 {
"p_min_all", no_argument, NULL, 14 },
288 {
"p_final", no_argument, NULL, 15 },
290 {
"u_raw", no_argument, NULL,
'u' },
291 {
"u_rms", no_argument, NULL, 20},
292 {
"u_max", no_argument, NULL, 21},
293 {
"u_min", no_argument, NULL, 22},
294 {
"u_max_all", no_argument, NULL, 23},
295 {
"u_min_all", no_argument, NULL, 24},
296 {
"u_final", no_argument, NULL, 25},
297 {
"u_non_staggered_raw", no_argument, NULL, 26},
299 { NULL, no_argument, NULL, 0}
307 while ((c = getopt_long (argc, argv, shortOpts, longOpts, &longIndex )) != -1)
315 if ((optarg != NULL) &&
316 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
325 errorLineIndentation).c_str());
334 if ((optarg != NULL) &&
335 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
344 errorLineIndentation).c_str());
353 int convertedValue = std::stoi(optarg);
354 if ((convertedValue < 1) || (convertedValue > 100))
356 throw std::invalid_argument(
"-r");
365 errorLineIndentation).c_str());
374 if (std::stoi(optarg) < 1)
376 throw std::invalid_argument(
"-t");
385 errorLineIndentation).c_str());
397 throw std::invalid_argument(
"-g");
405 errorLineIndentation).c_str());
414 int covertedValue = std::stoi(optarg);
415 if ((covertedValue < 0) || (covertedValue > 9))
417 throw std::invalid_argument(
"-c");
426 errorLineIndentation).c_str());
441 if (std::stoll(optarg) < 1)
443 throw std::invalid_argument(
"-s");
452 errorLineIndentation).c_str());
462 if (std::stoll(optarg) <= 0)
464 throw std::invalid_argument(
"benchmark");
473 errorLineIndentation).c_str());
486 checkpointFlag =
true;
489 if ((optarg != NULL) &&
490 ((strlen(optarg) > 0) && (optarg[0] !=
'-')))
499 errorLineIndentation).c_str());
508 checkpointFlag =
true;
509 if (std::stoll(optarg) <= 0)
511 throw std::invalid_argument(
"checkpoint_interval");
520 errorLineIndentation).c_str());
529 int verboseLevel = std::stoi(optarg);
530 if ((verboseLevel < 0) || (verboseLevel > 2))
532 throw std::invalid_argument(
"verbose");
541 errorLineIndentation).c_str());
653 errorLineIndentation).c_str());
661 errorLineIndentation).c_str());
670 errorLineIndentation).c_str());
679 errorLineIndentation).c_str());
688 errorLineIndentation).c_str());
697 errorLineIndentation).c_str());
706 errorLineIndentation).c_str());
715 errorLineIndentation).c_str());
724 errorLineIndentation).c_str());
733 errorLineIndentation).c_str());
742 errorLineIndentation).c_str());
751 errorLineIndentation).c_str());
762 errorLineIndentation).c_str());
776 errorLineIndentation).c_str());
784 errorLineIndentation).c_str());
794 errorLineIndentation).c_str());
802 errorLineIndentation).c_str());
bool store_u_final
Store_u_final value.
bool store_p_max
Store_p_max value.
static std::string WordWrapString(const std::string &inputString, const std::string &delimiters, const int indentation=0, const int lineSize=65)
Wrap the line based on logger conventions.
TOutputMessage OUT_FMT_USAGE_PART_1
Usage massage.
TErrorMessage ERR_FMT_NO_BENCHMARK_STEP_SET
Command line parameters error message.
TErrorMessage ERR_FMT_PATH_DELIMITERS
delimiters for linux paths
bool copySensorMask
Copy sensor mask to the output file.
bool store_p_final
Store_p_final value.
TOutputMessage OUT_FMT_PRINT_PROGRESS_INTERVAL
Output message.
size_t numberOfThreads
Number of CPU threads value.
bool store_p_raw
Store_p_raw value.
bool store_p_min_all
Store_p_min_all value.
size_t checkpointInterval
Checkpoint interval in seconds.
bool store_u_non_staggered_raw
Store_u_non_staggered_raw value.
TOutputMessage OUT_FMT_CHECKPOINT_INTERVAL
Output message.
TErrorMessage ERR_FMT_NO_COMPRESSION_LEVEL
Command line parameters error message.
TOutputMessage OUT_FMT_USAGE_PART_2
Usage massage.
static void SetLevel(const TLogLevel actualLogLevel)
Set the log level.
TErrorMessage ERR_FMT_UNKNOW_PARAMETER_OR_ARGUMENT
Command line parameter error message.
void PrintComandlineParamers()
Print setup.
TErrorMessage ERR_FMT_NO_CHECKPOINT_FILE
Command line parameters error message.
bool benchmarkFlag
BenchmarkFlag value.
TErrorMessage ERR_FMT_NO_INPUT_FILE
Error message - input file was not specified.
int cudaDeviceIdx
Id of selected GPU devices.
TOutputMessage OUT_FMT_COMPRESSION_LEVEL
Output message.
static void ErrorAndTerminate(const std::string &errorMessage)
Log an error and terminate the execution.
bool store_p_min
Store_p_min value.
The header file containing the HDF5 related classes.
TOutputMessage OUT_FMT_SAMPLING_BEGINS_AT
Output message.
bool store_u_min_all
Store_u_min_all value.
bool printVersion
print version of the code and exit.
TOutputMessage OUT_FMT_OUTPUT_FILE
Output message.
bool IsCheckpointEnabled() const
Is checkpoint enabled?
TErrorMessage ERR_FMT_NO_THREAD_NUMBER
Command line parameters error message.
static const size_t DEFAULT_PROGRESS_PRINT_INTERVAL
Default progress print interval.
size_t progressPrintInterval
ProgressInterval value.
The header file containing a class responsible for printing out info and error messages (stdout...
TOutputMessage OUT_FMT_BENCHMARK_TIME_STEP
Output message.
std::string inputFileName
Input file name.
TOutputMessage OUT_FMT_USAGE_THREADS
Usage massage.
bool store_p_max_all
Store_p_max_all value.
bool store_u_max
Store_u_max value.
TErrorMessage FMT_NO_PROGRESS_PRINT_INTERVAL
Command line parameters error message.
std::string outputFileName
Output file name.
bool store_u_raw
Store_u_raw value.
size_t benchmarkTimeStepCount
BenchmarkTimeStepsCount value.
Basic (default) level of verbosity.
TCommandLineParameters()
Default constructor - only friend class can create an instance.
TErrorMessage ERR_FMT_NO_VERBOSE_LEVEL
Command line parameters error message.
bool store_u_max_all
Store_u_max_all value.
TErrorMessage ERR_FMT_NO_CHECKPOINT_INTERVAL
Command line parameters error message.
TErrorMessage ERR_FMT_NO_START_TIME_STEP
Command line parameters error message.
void PrintUsage()
Print usage..
bool store_p_rms
Store_p_rms value.
std::string checkpointFileName
Checkpoint file name.
TErrorMessage ERR_FMT_NO_OUTPUT_FILE
Command line parameters error message.
The header file containing the command line parameters.
Advanced level of verbosity.
TErrorMessage ERR_FMT_UNKNOWN_PARAMETER
Command line parameter error message.
static const size_t DEFAULT_COMPRESSION_LEVEL
Default compression level.
bool store_u_min
Store_u_min value.
static void Log(const TLogLevel queryLevel, const std::string &format, Args...args)
Log desired activity for a given log level, version with string format.
TOutputMessage OUT_FMT_SEPARATOR
Output message - separator.
TOutputMessage OUT_FMT_INPUT_FILE
Output message.
size_t startTimeStep
StartTimeStep value.
TErrorMessage ERR_FMT_NO_GPU_NUMBER
Command line parameters error message.
TOutputMessage OUT_FMT_SAMPLING_FLAGS
Output message.
TOutputMessage OUT_FMT_CHECKPOINT_FILE
Output message.
TOutputMessage OUT_FMT_COPY_SENSOR_MASK
Output message.
size_t compressionLevel
CompressionLevel value.
bool store_u_rms
Store_u_rms value.
void ParseCommandLine(int argc, char **argv)
Parse command line.