Skip to content

Commit

Permalink
adding cmake parallelism flag (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirandaperera committed Aug 19, 2022
1 parent 035fd70 commit 0a489fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ if (CYLON_CUSTOM_MPIRUN)
endif (CYLON_CUSTOM_MPIRUN)
message(STATUS "MPI executable: ${MPIEXEC_EXECUTABLE}")

if (CYLON_MPIRUN_PARALLELISM_FLAG)
set(MPIEXEC_PARALLELISM_FLAG ${CYLON_MPIRUN_PARALLELISM_FLAG})
else ()
set(MPIEXEC_PARALLELISM_FLAG -np)
endif (CYLON_MPIRUN_PARALLELISM_FLAG)
message(STATUS "MPI parallelism flag: ${MPIEXEC_PARALLELISM_FLAG}")

if (CYLON_CUSTOM_MPIRUN_PARAMS)
set(MPIEXEC_EXECUTABLE_PARAMS ${CYLON_CUSTOM_MPIRUN_PARAMS})
else ()
Expand Down
16 changes: 11 additions & 5 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ file(DOWNLOAD ${catch2_url} "${CMAKE_CURRENT_BINARY_DIR}/catch.hpp"
EXPECTED_HASH SHA256=${CYLON_CATCH2_HEADER_HASH})
list(GET status 0 error)
if (error)
message(FATAL_ERROR "Could not download ${catch2_url}")
message(FATAL_ERROR "Could not download ${catch2_url}")
else ()
message(STATUS "Catch2 header downloaded to ${CMAKE_CURRENT_BINARY_DIR}/catch.hpp")
endif ()
Expand Down Expand Up @@ -73,11 +73,17 @@ endfunction(cylon_add_test)
function(cylon_run_test TESTNAME parallelism comm_args)
set(exec_name "${TESTNAME}_${parallelism}_${comm_args}")
if (WIN32)
set(test_params -n ${parallelism} "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/${TESTNAME}" --comm "${comm_args}")
set(test_params ${MPIEXEC_EXECUTABLE_PARAMS}
${MPIEXEC_PARALLELISM_FLAG} ${parallelism}
${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/${TESTNAME} --comm ${comm_args})
else ()
set(test_params -n ${parallelism} "${CMAKE_BINARY_DIR}/bin/${TESTNAME}" --comm "${comm_args}")
set(test_params ${MPIEXEC_EXECUTABLE_PARAMS}
${MPIEXEC_PARALLELISM_FLAG} ${parallelism}
${CMAKE_BINARY_DIR}/bin/${TESTNAME} --comm ${comm_args})
endif ()
add_test(NAME ${exec_name} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_EXECUTABLE_PARAMS} ${test_params})

message(STATUS ${test_params})
add_test(NAME ${exec_name} COMMAND ${MPIEXEC_EXECUTABLE} ${test_params})
endfunction(cylon_run_test)

#Add tests as follows ...
Expand Down Expand Up @@ -223,7 +229,7 @@ if (CYLON_GLOO)
cylon_run_test(aggregate_test 1 gloo-mpi)
cylon_run_test(aggregate_test 2 gloo-mpi)
cylon_run_test(aggregate_test 4 gloo-mpi)

cylon_run_test(sync_comms_test 1 gloo-mpi)
cylon_run_test(sync_comms_test 4 gloo-mpi)
endif (CYLON_GLOO)
Expand Down

0 comments on commit 0a489fc

Please sign in to comment.