1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* settings.h
*
* Created on: Oct 2018
* Author: Norbert Podhorszki
*/
#ifndef SETTINGS_H_
#define SETTINGS_H_
#include "adios2/common/ADIOSConfig.h"
#include <fstream>
#include <string>
#include <vector>
#include <mpi.h>
enum class IOLib
{
ADIOS
#ifdef ADIOS2_HAVE_HDF5_PARALLEL
,
HDF5
#endif
};
class Settings
{
public:
/* user arguments */
std::string configFileName;
std::string adiosConfigFileName;
std::string outputPath;
unsigned int verbose = 0;
size_t appId = 0;
bool isStrongScaling = true; // strong or weak scaling
bool ioTimer = false; // used to measure io time
bool fixedPattern = false; // should Lock definitions?
bool isRatioDecomp = false;
bool multithreadedMPI = false; // turn on MT-enabled MPI
IOLib iolib = IOLib::ADIOS;
// process decomposition
std::vector<size_t> processDecomp = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
/* public variables */
MPI_Comm appComm = MPI_COMM_WORLD; // will change to split communicator
size_t myRank = 0;
size_t nProc = 1;
std::ifstream configFile;
size_t nDecomp = 0;
Settings() = default;
~Settings() = default;
int processArguments(int argc, char *argv[]);
int initDecomp(MPI_Comm worldComm);
int extraArgumentChecks();
size_t stringToNumber(const std::string &varName, const char *arg) const;
int parseCSDecomp(const char *arg);
int rescaleDecomp();
size_t ndigits(size_t n) const;
private:
void displayHelp();
int processArgs(int argc, char *argv[]);
};
#endif /* SETTINGS_H_ */
|