Skip to content

Commit

Permalink
fixup! testing,examples,utils: MPI_Init to MPI_Init_thread
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Jun 10, 2022
1 parent 3539d17 commit 02c71d6
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 32 deletions.
3 changes: 1 addition & 2 deletions examples/heatTransfer/inline/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ void setupOutputIO(const Settings &s, MPI_Comm comm)

int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Init(&argc, &argv);

/* When writer and reader is launched together with a single mpirun command,
the world comm spans all applications. We have to split and create the
Expand Down
10 changes: 9 additions & 1 deletion examples/heatTransfer/read/heatRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ void Compute(const std::vector<double> &Tin, std::vector<double> &Tout,
int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
std::string engineName = std::string(argv[argc - 1]);

int threadSupportLevel = MPI_THREAD_SINGLE;
if (engineName == "SST")
{
threadSupportLevel = MPI_THREAD_MULTIPLE;
}

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

/* When writer and reader is launched together with a single mpirun command,
the world comm spans all applications. We have to split and create the
Expand Down
3 changes: 1 addition & 2 deletions examples/heatTransfer/read_fileonly/heatRead_adios1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Init(&argc, &argv);

if (argc < 2)
{
Expand Down
3 changes: 1 addition & 2 deletions examples/heatTransfer/read_fileonly/heatRead_adios2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Init(&argc, &argv);

if (argc < 2)
{
Expand Down
11 changes: 10 additions & 1 deletion examples/heatTransfer/write/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ void printUsage()
int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);

std::string engineName = std::string(argv[argc - 1]);

int threadSupportLevel = MPI_THREAD_SINGLE;
if (engineName == "SST")
{
threadSupportLevel = MPI_THREAD_MULTIPLE;
}

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

/* When writer and reader is launched together with a single mpirun command,
the world comm spans all applications. We have to split and create the
Expand Down
9 changes: 8 additions & 1 deletion source/utils/adios_iotest/adios_iotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
int main(int argc, char *argv[])
{
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
int threadSupportLevel = MPI_THREAD_SINGLE;

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

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

Settings settings;

Expand Down
11 changes: 9 additions & 2 deletions testing/adios2/engine/common/TestEngineCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,20 @@ int main(int argc, char **argv)
threadTimeout.detach();

int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
::testing::InitGoogleTest(&argc, argv);

engineName = std::string(argv[1]);

int threadSupportLevel = MPI_THREAD_SINGLE;
if (engineName == "SST")
{
threadSupportLevel = MPI_THREAD_MULTIPLE;
}

MPI_Init_thread(&argc, &argv, threadSupportLevel, &provided);
MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);

engineName = std::string(argv[1]);
unsigned int p = ParseUintParam("serializeWriterReader", argv[2]);
serializeWriterReader = (p != 0);

Expand Down
11 changes: 8 additions & 3 deletions testing/adios2/engine/staging-common/TestCommonReadF.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ program TestSstRead
integer(kind = 8), dimension(:), allocatable::shape_in

#if ADIOS2_USE_MPI
integer::key, color, testComm, provided
integer::key, color, testComm, provided, threadSupportLevel
#endif

allocate(variables(20))
Expand All @@ -67,15 +67,20 @@ program TestSstRead
insteps = 0;

#if ADIOS2_USE_MPI
threadSupportLevel = MPI_THREAD_SINGLE;
if (engine == "SST") then
threadSupportLevel = MPI_THREAD_MULTIPLE;
endif

!Launch MPI
call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided, ierr)
call MPI_Init_thread(threadSupportLevel, provided, ierr)

call MPI_Comm_rank(MPI_COMM_WORLD, key, ierr);

color = 2
call MPI_Comm_split(MPI_COMM_WORLD, color, key, testComm, ierr);

call MPI_Comm_rank(testComm, irank, ierr)
call MPI_Comm_rank(testComm, irank, ierr)
call MPI_Comm_size(testComm, isize, ierr)

!Create adios handler passing the communicator, debug mode and error flag
Expand Down
9 changes: 7 additions & 2 deletions testing/adios2/engine/staging-common/TestCommonWriteF.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ program TestSstWrite
integer(kind = 8)::localtime

#if ADIOS2_USE_MPI
integer::testComm, color, key, provided
integer::testComm, color, key, provided, threadSupportLevel
#endif

allocate(variables(20))
Expand All @@ -61,8 +61,13 @@ program TestSstWrite
endif

#if ADIOS2_USE_MPI
threadSupportLevel = MPI_THREAD_SINGLE;
if (engine == "SST") then
threadSupportLevel = MPI_THREAD_MULTIPLE;
endif

!Launch MPI
call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided, ierr)
call MPI_Init_thread(threadSupportLevel, provided, ierr)

call MPI_Comm_rank(MPI_COMM_WORLD, key, ierr);

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTBPMx1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.BP.Mx1
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 1
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp Read.bp 1 1
Write.bp Read.bp 1 1 SST
)
set_tests_properties(HeatTransfer.SST.BP.Mx1 PROPERTIES PROCESSORS 5)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTBPMxM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.BP.MxM
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp Read.bp 2 2
Write.bp Read.bp 2 2 SST
)
set_tests_properties(HeatTransfer.SST.BP.MxM PROPERTIES PROCESSORS 8)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTBPMxN.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.BP.MxN
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 3
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp.xml
Write.bp Read.bp 1 3
Write.bp Read.bp 1 3 SST
)
set_tests_properties(HeatTransfer.SST.BP.MxN PROPERTIES PROCESSORS 7)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTBPRDMAMxN.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.BP.RDMA.MxN
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp_rdma.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 3
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_bp_rdma.xml
Write.bp Read.bp 1 3
Write.bp Read.bp 1 3 SST
)
set_tests_properties(HeatTransfer.SST.BP.RDMA.MxN PROPERTIES PROCESSORS 7)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTFFSMx1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.FFS.Mx1
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 1
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp Read.bp 1 1
Write.bp Read.bp 1 1 SST
)
set_tests_properties(HeatTransfer.SST.FFS.Mx1 PROPERTIES PROCESSORS 5)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTFFSMxM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.FFS.MxM
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp Read.bp 2 2
Write.bp Read.bp 2 2 SST
)
set_tests_properties(HeatTransfer.SST.FFS.MxM PROPERTIES PROCESSORS 8)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTFFSMxN.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.FFS.MxN
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 3
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs.xml
Write.bp Read.bp 1 3
Write.bp Read.bp 1 3 SST
)
set_tests_properties(HeatTransfer.SST.FFS.MxN PROPERTIES PROCESSORS 7)

Expand Down
4 changes: 2 additions & 2 deletions testing/examples/heatTransfer/TestSSTFFSRDMAMxN.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ add_test(NAME HeatTransfer.SST.FFS.MxN
${MPIEXEC_NUMPROC_FLAG} 4
$<TARGET_FILE:heatTransfer_write_adios2>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs_rdma.xml
Write.bp 2 2 10 10 10 10
Write.bp 2 2 10 10 10 10 SST
:
${MPIEXEC_NUMPROC_FLAG} 3
$<TARGET_FILE:heatTransfer_read>
${PROJECT_SOURCE_DIR}/examples/heatTransfer/heat_sst_ffs_rdma.xml
Write.bp Read.bp 1 3
Write.bp Read.bp 1 3 SST
)
set_tests_properties(HeatTransfer.SST.FFS.MxN PROPERTIES PROCESSORS 7)

Expand Down

0 comments on commit 02c71d6

Please sign in to comment.