Commit 843a788a authored by Ruonan Wang's avatar Ruonan Wang
Browse files

moved stream communicator creation back to SSC engine to pass windows build

parent 67a6946f
......@@ -162,7 +162,6 @@ endif()
if(ADIOS2_HAVE_SSC)
target_sources(adios2 PRIVATE
helper/adiosMpiHandshake.h helper/adiosMpiHandshake.cpp
engine/ssc/SscReader.cpp
engine/ssc/SscReader.tcc
engine/ssc/SscWriter.cpp
......@@ -232,6 +231,7 @@ if(ADIOS2_HAVE_MPI)
target_sources(adios2 PRIVATE
core/IOMPI.cpp
helper/adiosCommMPI.h helper/adiosCommMPI.cpp
helper/adiosMpiHandshake.h helper/adiosMpiHandshake.cpp
engine/insitumpi/InSituMPIWriter.cpp engine/insitumpi/InSituMPIWriter.tcc
engine/insitumpi/InSituMPIReader.cpp engine/insitumpi/InSituMPIReader.tcc
engine/insitumpi/InSituMPIFunctions.cpp engine/insitumpi/InSituMPISchedules.cpp
......
......@@ -198,7 +198,31 @@ void SscReader::SyncMpiPattern()
CommAsMPI(m_Comm));
m_MpiAllWritersGroup = m_MpiHandshake.GetAllWritersGroup(m_Name);
m_StreamComm = m_MpiHandshake.GetStreamComm(m_Name);
std::vector<int> allStreamRanks;
for (const auto &app : m_MpiHandshake.GetWriterMap(m_Name))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
for (const auto &app : m_MpiHandshake.GetReaderMap(m_Name))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
MPI_Group worldGroup;
MPI_Comm_group(MPI_COMM_WORLD, &worldGroup);
std::sort(allStreamRanks.begin(), allStreamRanks.end());
MPI_Group allWorkersGroup;
MPI_Group_incl(worldGroup, allStreamRanks.size(), allStreamRanks.data(),
&allWorkersGroup);
MPI_Comm_create_group(MPI_COMM_WORLD, allWorkersGroup, 0, &m_StreamComm);
}
void SscReader::SyncWritePattern()
......
......@@ -198,7 +198,31 @@ void SscWriter::SyncMpiPattern()
m_MpiAllReadersGroup = m_MpiHandshake.GetAllReadersGroup(m_Name);
m_StreamComm = m_MpiHandshake.GetStreamComm(m_Name);
std::vector<int> allStreamRanks;
for (const auto &app : m_MpiHandshake.GetWriterMap(m_Name))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
for (const auto &app : m_MpiHandshake.GetReaderMap(m_Name))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
MPI_Group worldGroup;
MPI_Comm_group(MPI_COMM_WORLD, &worldGroup);
std::sort(allStreamRanks.begin(), allStreamRanks.end());
MPI_Group allWorkersGroup;
MPI_Group_incl(worldGroup, allStreamRanks.size(), allStreamRanks.data(),
&allWorkersGroup);
MPI_Comm_create_group(MPI_COMM_WORLD, allWorkersGroup, 0, &m_StreamComm);
}
void SscWriter::SyncWritePattern()
......
......@@ -254,37 +254,6 @@ MpiHandshake::GetReaderMap(const std::string &filename)
return m_ReadersMap[filename];
}
MPI_Comm MpiHandshake::GetStreamComm(const std::string &filename)
{
std::vector<int> allStreamRanks;
for (const auto &app : GetWriterMap(filename))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
for (const auto &app : GetReaderMap(filename))
{
for (int rank : app.second)
{
allStreamRanks.push_back(rank);
}
}
MPI_Group worldGroup;
MPI_Comm_group(MPI_COMM_WORLD, &worldGroup);
std::sort(allStreamRanks.begin(), allStreamRanks.end());
MPI_Group allWorkersGroup;
MPI_Group_incl(worldGroup, allStreamRanks.size(), allStreamRanks.data(),
&allWorkersGroup);
MPI_Comm streamComm;
MPI_Comm_create_group(MPI_COMM_WORLD, allWorkersGroup, 0, &streamComm);
return streamComm;
}
MPI_Group MpiHandshake::GetAllReadersGroup(const std::string &filename)
{
std::vector<int> allReaderRanks;
......
......@@ -95,16 +95,6 @@ public:
static const std::map<int, std::vector<int>> &
GetReaderMap(const std::string &filename);
/**
* Get the MPI communicator for the stream, containing all writer ranks and
* reader ranks that work on the stream filename
*
* @param filename: name of the staging stream
*
* @return the communicator for the stream
*/
static MPI_Comm GetStreamComm(const std::string &filename);
/**
* Get the MPI group for all readers in the stream filename
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment