Skip to content

Commit

Permalink
use test launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 28, 2024
1 parent 38baeae commit e5aa362
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
38 changes: 20 additions & 18 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
set_property(DIRECTORY PROPERTY LABELS "scalapack;unit")

add_executable(test_blacs blacs_helloworld.f90)
target_link_libraries(test_blacs PRIVATE blacs MPI::MPI_Fortran)
add_test(NAME scalapack_blacs
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 $<TARGET_FILE:test_blacs>
)
add_executable(scalapack_blacs blacs_helloworld.f90)
target_link_libraries(scalapack_blacs PRIVATE blacs MPI::MPI_Fortran)
add_test(NAME scalapack_blacs COMMAND scalapack_blacs)
set_property(TEST scalapack_blacs PROPERTY LABELS blacs)

if(BUILD_DOUBLE)
add_executable(test_scalapack_d test_scalapack_d.f90)
target_link_libraries(test_scalapack_d PRIVATE SCALAPACK::SCALAPACK)
add_executable(scalapack_real64 test_scalapack_d.f90)
target_link_libraries(scalapack_real64 PRIVATE SCALAPACK::SCALAPACK)

add_test(NAME scalapack_real64
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 $<TARGET_FILE:test_scalapack_d>
)
add_test(NAME scalapack_real64 COMMAND scalapack_real64)
endif()

cmake_host_system_information(RESULT Ncpu QUERY NUMBER_OF_PHYSICAL_CORES)
if(Ncpu LESS 2)
set(less2 true)
endif()
message(STATUS "Number of physical cores: ${Ncpu}")


get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)

set_property(TEST ${test_names} PROPERTY TIMEOUT 15)
set_property(TEST ${test_names} PROPERTY PROCESSORS 2)
set_property(TEST ${test_names} PROPERTY DISABLED $<BOOL:${less2}>)
set(_p ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${Ncpu})

foreach(t IN LISTS test_names)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
set_property(TARGET ${t} PROPERTY TEST_LAUNCHER ${_p})
else()
set_property(TARGET ${t} PROPERTY CROSSCOMPILING_EMULATOR ${_p})
endif()

set_property(TEST ${t} PROPERTY PROCESSORS ${Ncpu})
endforeach()

set_tests_properties(${test_names} PROPERTIES TIMEOUT 15)
5 changes: 3 additions & 2 deletions test/test_scalapack_d.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ program scalapack_d
real(real64) :: eps
real(real64), external :: pdlamch

! arbitrary test parameters
npcol = 2
nprow = 2

call blacs_pinfo(myid, nprocs)

npcol = nprocs

call blacs_get(-1, 0, ictxt)
call blacs_gridinit(ictxt, "C", nprocs, 1)

Expand Down

0 comments on commit e5aa362

Please sign in to comment.