Skip to content
Snippets Groups Projects
Commit 36dafba0 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Merge branch 'feature/mpi' of /media/delpino/Transcend/repos/pastis into feature/mpi

parents 67f83665 232997bf
No related branches found
No related tags found
1 merge request!11Feature/mpi
......@@ -33,7 +33,6 @@ SET("CMAKE_C_FLAGS_RELWITHDEBINFO"
FORCE )
# Add new build types
message("* Adding build types...")
SET(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 --coverage"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
......@@ -204,10 +203,14 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
set(GCOVR_OPTIONS --object-directory="${PASTIS_BINARY_DIR}" -r "${PASTIS_SOURCE_DIR}/src" ${GCOVR_EXCLUDE} ${GCOVR_EXTRA})
if(${PASTIS_HAS_MPI})
set(MPI_UNIT_TESTS mpi_unit_tests)
endif()
add_custom_target(run_unit_tests
ALL
COMMAND ${CMAKE_CTEST_COMMAND} -j ${PROCESSOR_COUNT}
DEPENDS unit_tests pastis
DEPENDS unit_tests ${MPI_UNIT_TESTS} pastis
COMMENT "Executing unit tests."
)
......
......@@ -13,6 +13,13 @@ add_executable (unit_tests
test_TinyVector.cpp
)
if (${PASTIS_HAS_MPI})
add_executable (mpi_unit_tests
mpi_test_main.cpp
mpi_test_Messenger.cpp
)
endif()
target_include_directories(Catch2 INTERFACE ${CATCH_INCLUDE_DIR})
target_link_libraries (unit_tests
......@@ -21,7 +28,29 @@ target_link_libraries (unit_tests
Catch2
)
if (${PASTIS_HAS_MPI})
target_link_libraries (mpi_unit_tests
PastisUtils
kokkos
${PARMETIS_LIBRARIES}
${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES}
Catch2
)
endif()
enable_testing()
#parse catch tests
ParseAndAddCatchTests(unit_tests)
if (${PASTIS_HAS_MPI})
add_test(mpi_unit_tests ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 3 "--oversubscribe"
${MPIEXEC_PREFLAGS}
${PASTIS_BINARY_DIR}/mpi_unit_tests
${MPIEXEC_POSTFLAGS})
# Should patch ParseAndAddCatchTests macro to allow additional command parameter
# to launch tests
set_tests_properties("mpi_unit_tests" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
LABELS "mpi")
endif()
#include <catch.hpp>
#include <Messenger.hpp>
#include <mpi.h>
TEST_CASE("Messenger", "[mpi]") {
SECTION("check for parallel test") {
{
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
REQUIRE(rank == commRank());
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
REQUIRE(size == commSize());
}
}
}
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <Kokkos_Core.hpp>
#include <Messenger.hpp>
int main( int argc, char* argv[] )
{
Messenger::create(argc, argv);
Kokkos::initialize({4,-1,-1,true});
int result = Catch::Session().run( argc, argv );
Kokkos::finalize();
Messenger::destroy();
return result;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment