Skip to content

Commit

Permalink
Add processors properties
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Jan 30, 2024
1 parent eaf75c5 commit 2cc27ef
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ if (USE_MPI)
else ()
set(num_ranks ${TEST_MPI_RANKS})
endif ()
math(EXPR test_processors "${num_ranks} * ${NUM_THREADS}")

message(
"Tests will run with ${num_ranks} MPI ranks and ${NUM_THREADS} OpenMP threads each"
)
else ()
set(test_processors ${NUM_THREADS})
endif ()

# =================================== DBCSR PERF TESTS
Expand Down Expand Up @@ -53,7 +57,10 @@ foreach (dbcsr_perf_test ${DBCSR_PERF_TESTS})
"${CMAKE_CURRENT_SOURCE_DIR}/${dbcsr_perf_test}")
endif ()
set_tests_properties(dbcsr_perf:${dbcsr_perf_test}
PROPERTIES ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS})
PROPERTIES
ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS}
PROCESSORS ${test_processors}
)
endforeach ()

# =================================== DBCSR CORRECTNESS TESTS Define all the
Expand Down Expand Up @@ -131,9 +138,12 @@ foreach (dbcsr_test ${DBCSR_TESTS_FTN})
endif ()
if (OpenMP_FOUND)
target_link_libraries(${dbcsr_test} OpenMP::OpenMP_Fortran)
set_tests_properties(${dbcsr_test}
PROPERTIES ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS})
endif ()
set_tests_properties(${dbcsr_test}
PROPERTIES
ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS}
PROCESSORS ${test_processors}
)
endforeach ()

# set the __SHORT_FILE__ per file for dbcsr sources
Expand Down Expand Up @@ -161,11 +171,11 @@ if (WITH_C_API)
else ()
add_test(NAME ${dbcsr_test_cpp_name} COMMAND ./${dbcsr_test_cpp_name})
endif ()
if (OpenMP_FOUND)
set_tests_properties(
${dbcsr_test_cpp_name} PROPERTIES ENVIRONMENT
OMP_NUM_THREADS=${NUM_THREADS})
endif ()
set_tests_properties(${dbcsr_test_cpp_name}
PROPERTIES
ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS}
PROCESSORS ${test_processors}
)
endforeach ()
endif ()

Expand All @@ -178,11 +188,11 @@ if (NOT USE_MPI)
target_link_libraries(${dbcsr_test_backend} PRIVATE dbcsr)
# register unittest executable with CMake
add_test(NAME ${dbcsr_test_backend} COMMAND ./${dbcsr_test_backend})
if (OpenMP_FOUND)
set_tests_properties(
${dbcsr_test_backend} PROPERTIES ENVIRONMENT
OMP_NUM_THREADS=${NUM_THREADS})
endif ()
set_tests_properties(${dbcsr_test_backend}
PROPERTIES
ENVIRONMENT OMP_NUM_THREADS=${NUM_THREADS}
PROCESSORS ${NUM_THREADS}
)
endforeach ()
endif ()

Expand Down

0 comments on commit 2cc27ef

Please sign in to comment.