Skip to content

Commit

Permalink
bpls works without MPI_Init/Finalize
Browse files Browse the repository at this point in the history
on a simple BP3 file, anyway.
  • Loading branch information
germasch committed May 30, 2019
1 parent f59b135 commit 052058a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion source/adios2/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void Engine::Close(const int transportIndex)

if (transportIndex == -1)
{
helper::CheckMPIReturn(MPI_Comm_free(&m_MPIComm),
helper::CheckMPIReturn(mpi::MPI_Comm_free(&m_MPIComm),
"freeing comm in Engine " + m_Name +
", in call to Close");
m_IsClosed = true;
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/core/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Engine &IO::Open(const std::string &name, const Mode mode,
}

MPI_Comm mpiComm;
MPI_Comm_dup(mpiComm_orig, &mpiComm);
mpi::MPI_Comm_dup(mpiComm_orig, &mpiComm);
std::shared_ptr<Engine> engine;
const bool isDefaultEngine = m_EngineType.empty() ? true : false;
std::string engineTypeLC = m_EngineType;
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/helper/adiosMPIFunctions.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ size_t BroadcastValue(const size_t &input, MPI_Comm mpiComm,
output = input;
}

MPI_Bcast(&output, 1, ADIOS2_MPI_SIZE_T, rankSource, mpiComm);
mpi::MPI_Bcast(&output, 1, ADIOS2_MPI_SIZE_T, rankSource, mpiComm);

return output;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ void BroadcastVector(std::vector<char> &vector, MPI_Comm mpiComm,
const int rankSource)
{
int size;
MPI_Comm_size(mpiComm, &size);
mpi::MPI_Comm_size(mpiComm, &size);

if (size == 1)
{
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/toolkit/format/bp3/BP3Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const std::map<int, std::string> BP3Base::m_TransformTypesToNames = {
BP3Base::BP3Base(MPI_Comm mpiComm, const bool debugMode)
: m_MPIComm(mpiComm), m_DebugMode(debugMode)
{
MPI_Comm_rank(m_MPIComm, &m_RankMPI);
MPI_Comm_size(m_MPIComm, &m_SizeMPI);
mpi::MPI_Comm_rank(m_MPIComm, &m_RankMPI);
mpi::MPI_Comm_size(m_MPIComm, &m_SizeMPI);
m_Profiler.IsActive = true; // default
}

Expand Down
4 changes: 2 additions & 2 deletions source/adios2/toolkit/transport/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Transport::Transport(const std::string type, const std::string library,
MPI_Comm mpiComm, const bool debugMode)
: m_Type(type), m_Library(library), m_MPIComm(mpiComm), m_DebugMode(debugMode)
{
MPI_Comm_rank(m_MPIComm, &m_RankMPI);
MPI_Comm_size(m_MPIComm, &m_SizeMPI);
mpi::MPI_Comm_rank(m_MPIComm, &m_RankMPI);
mpi::MPI_Comm_size(m_MPIComm, &m_SizeMPI);
}

void Transport::IWrite(const char *buffer, size_t size, Status &status,
Expand Down
6 changes: 0 additions & 6 deletions source/utils/bpls/bpls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2931,9 +2931,6 @@ char *mystrndup(const char *s, size_t n)

int main(int argc, char *argv[])
{
#ifdef ADIOS2_HAVE_MPI
MPI_Init(&argc, &argv);
#endif
int retval = 1;
try
{
Expand All @@ -2944,8 +2941,5 @@ int main(int argc, char *argv[])
std::cout << "\nbpls caught an exception\n";
std::cout << e.what() << std::endl;
}
#ifdef ADIOS2_HAVE_MPI
MPI_Finalize();
#endif
return retval;
}

0 comments on commit 052058a

Please sign in to comment.