Skip to content

Commit

Permalink
Merge pull request #3482 from pnorbert/iotest-sst-mpi
Browse files Browse the repository at this point in the history
Make adios_iotest work with SST again: add CurrentStep() to SstWriter…
  • Loading branch information
pnorbert authored and vicentebolea committed Feb 14, 2023
2 parents 865f74c + 5181f56 commit 5b7a404
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
2 changes: 2 additions & 0 deletions source/adios2/engine/sst/SstWriter.cpp
Expand Up @@ -183,6 +183,8 @@ StepStatus SstWriter::BeginStep(StepMode mode, const float timeout_sec)
return StepStatus::OK;
}

size_t SstWriter::CurrentStep() const { return m_WriterStep; }

void SstWriter::MarshalAttributes()
{
PERFSTUBS_SCOPED_TIMER_FUNC();
Expand Down
1 change: 1 addition & 0 deletions source/adios2/engine/sst/SstWriter.h
Expand Up @@ -38,6 +38,7 @@ class SstWriter : public Engine

StepStatus BeginStep(StepMode mode,
const float timeoutSeconds = -1.0) final;
size_t CurrentStep() const final;
void PerformPuts() final;
void EndStep() final;
void Flush(const int transportIndex = -1) final;
Expand Down
20 changes: 12 additions & 8 deletions source/utils/adios_iotest/adios_iotest.cpp
Expand Up @@ -18,23 +18,27 @@

int main(int argc, char *argv[])
{
Settings settings;

/* Check input arguments. Quit if something is wrong. */
if (settings.processArguments(argc, argv))
{
return 1;
}

int provided;
int threadSupportLevel = MPI_THREAD_SINGLE;

if (std::string(argv[1]) == "SST")
if (settings.multithreadedMPI)
{
threadSupportLevel = MPI_THREAD_MULTIPLE;
}

MPI_Init_thread(&argc, &argv, threadSupportLevel, &provided);

Settings settings;
settings.initDecomp(MPI_COMM_WORLD);

/* Check input arguments. Quit if something is wrong. */
if (settings.processArguments(argc, argv, MPI_COMM_WORLD) ||
settings.extraArgumentChecks())
// MPI-dependent argument checks
if (settings.extraArgumentChecks())
{
MPI_Finalize();
return 1;
}

Expand Down
23 changes: 21 additions & 2 deletions source/utils/adios_iotest/settings.cpp
Expand Up @@ -31,12 +31,13 @@ struct option options[] = {{"help", no_argument, NULL, 'h'},
{"weak-scaling", no_argument, NULL, 'w'},
{"timer", no_argument, NULL, 't'},
{"fixed", no_argument, NULL, 'F'},
{"multithreaded-mpi", no_argument, NULL, 'T'},
#ifdef ADIOS2_HAVE_HDF5_PARALLEL
{"hdf5", no_argument, NULL, 'H'},
#endif
{NULL, 0, NULL, 0}};

static const char *optstring = "-hvswtFHa:c:d:D:x:p:";
static const char *optstring = "-hvswtTFHa:c:d:D:x:p:";

size_t Settings::ndigits(size_t n) const
{
Expand Down Expand Up @@ -74,6 +75,7 @@ void Settings::displayHelp()
<< " -v increase verbosity\n"
<< " -h display this help\n"
<< " -F turn on fixed I/O pattern explicitly\n"
<< " -T turn on multi-threaded MPI (needed by SST/MPI)\n"
<< " -p specify the path of the output explicitly\n"
<< " -t print and dump the timing measured by the I/O "
"timer\n\n";
Expand Down Expand Up @@ -206,6 +208,9 @@ int Settings::processArgs(int argc, char *argv[])
case 'F':
fixedPattern = true;
break;
case 'T':
multithreadedMPI = true;
break;
case 'h':
if (!myRank)
{
Expand Down Expand Up @@ -318,13 +323,27 @@ int Settings::processArgs(int argc, char *argv[])
return 0;
}

int Settings::processArguments(int argc, char *argv[], MPI_Comm worldComm)
int Settings::processArguments(int argc, char *argv[])
{
int retval = 0;
try
{
retval = processArgs(argc, argv);
}
catch (std::exception &e) // command-line argument errors
{
std::cout << "ERROR : " << e.what() << std::endl;
displayHelp();
retval = 1;
}
return retval;
}

int Settings::initDecomp(MPI_Comm worldComm)
{
int retval = 0;
try
{
int wrank;
MPI_Comm_rank(worldComm, &wrank);
MPI_Comm_split(worldComm, static_cast<int>(appId), wrank, &appComm);
Expand Down
4 changes: 3 additions & 1 deletion source/utils/adios_iotest/settings.h
Expand Up @@ -42,6 +42,7 @@ class Settings
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,
Expand All @@ -56,7 +57,8 @@ class Settings

Settings() = default;
~Settings() = default;
int processArguments(int argc, char *argv[], MPI_Comm worldComm);
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);
Expand Down

0 comments on commit 5b7a404

Please sign in to comment.