Skip to content

Commit

Permalink
Merge pull request #4442 from Hyeondeok-Shin/deterministic_test
Browse files Browse the repository at this point in the history
Remove all QMC_CUDA dependencies on testsets
  • Loading branch information
ye-luo authored Feb 7, 2023
2 parents f437528 + c5b16e0 commit c00bdcb
Show file tree
Hide file tree
Showing 54 changed files with 7,329 additions and 8,319 deletions.
6 changes: 0 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ else()
set(SUCCESS_STATUS_OFFLOAD TRUE)
endif()

if(QMC_CUDA)
set(SUCCESS_STATUS_CUDA FALSE)
else()
set(SUCCESS_STATUS_CUDA TRUE)
endif()

if(BUILD_AFQMC)
include("${qmcpack_SOURCE_DIR}/CMake/python.cmake")
check_python_reqs("numpy;h5py;mpi4py;scipy;pyscf" afqmc_workflow add_tests)
Expand Down
4 changes: 2 additions & 2 deletions tests/afqmc/workflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function(ADD_AFQMC_PYSCF_WORKFLOW_TEST test_name input_dir TEST_SCALARS TEST_OBS
set(TESTNAME "converter_test_pyscf_to_afqmc_${test_name}")
add_test(
NAME ${TESTNAME}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${NPROC_INT} ${MPIEXEC_PREFLAGS}
${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/utils/afqmctools/bin/pyscf_to_afqmc.py ${ARGN}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${NPROC_INT} ${MPIEXEC_PREFLAGS} ${Python3_EXECUTABLE}
${PROJECT_SOURCE_DIR}/utils/afqmctools/bin/pyscf_to_afqmc.py ${ARGN}
WORKING_DIRECTORY ${TESTDIR})
set_tests_properties(${TESTNAME} PROPERTIES DEPENDS "converter_test_pyscf_${test_name}")
set_property(TEST ${TESTNAME} APPEND PROPERTY LABELS "converter;afqmc")
Expand Down
51 changes: 31 additions & 20 deletions tests/converter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,41 @@ function(ADD_CONVERTER_TEST test_name)
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
set(EXE_NAME $<TARGET_FILE:convert4qmc>)
if(HAVE_MPI)
set(EXE_NAME ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:convert4qmc>)
set(EXE_NAME ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:convert4qmc>)
string(REPLACE ";" " " EXE_NAME "${EXE_NAME}")
endif()
add_test(NAME converter_${test_name}
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/converter_test.py" "${CMAKE_CURRENT_BINARY_DIR}/${test_name}" --exe
"${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(converter_${test_name} PROPERTIES
FAIL_REGULAR_EXPRESSION " FAIL"
PASS_REGULAR_EXPRESSION " pass"
TIMEOUT 120 LABELS "converter;deterministic")
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/converter_test.py"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}" --exe "${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(
converter_${test_name}
PROPERTIES FAIL_REGULAR_EXPRESSION
" FAIL"
PASS_REGULAR_EXPRESSION
" pass"
TIMEOUT
120
LABELS
"converter;deterministic")
endfunction()

function(ADD_PWCONVERTER_TEST test_name)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
set(EXE_NAME $<TARGET_FILE:convertpw4qmc>)
add_test(NAME converter_${test_name}
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/pwconverter_test.py" "${CMAKE_CURRENT_BINARY_DIR}/${test_name}" --exe
"${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(converter_${test_name} PROPERTIES
FAIL_REGULAR_EXPRESSION " FAIL"
PASS_REGULAR_EXPRESSION " pass"
TIMEOUT 120 LABELS "converter;deterministic")
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/pwconverter_test.py"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}" --exe "${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(
converter_${test_name}
PROPERTIES FAIL_REGULAR_EXPRESSION
" FAIL"
PASS_REGULAR_EXPRESSION
" pass"
TIMEOUT
120
LABELS
"converter;deterministic")
endfunction()

execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/converter_test.py"
Expand Down Expand Up @@ -65,10 +76,10 @@ add_converter_test(test_diamond2_rmg)
add_converter_test(test_O_rmg)

if(HAVE_GPAW)
include("${qmcpack_SOURCE_DIR}/CMake/python.cmake")
check_python_reqs("numpy;h5py;ase;gpaw" gpaw4qmcpack_test add_tests)
if(add_tests)
message("Python dependencies met. Adding GPAW4QMCPACK tests")
add_subdirectory("gpaw")
endif()
include("${qmcpack_SOURCE_DIR}/CMake/python.cmake")
check_python_reqs("numpy;h5py;ase;gpaw" gpaw4qmcpack_test add_tests)
if(add_tests)
message("Python dependencies met. Adding GPAW4QMCPACK tests")
add_subdirectory("gpaw")
endif()
endif()
27 changes: 17 additions & 10 deletions tests/converter/gpaw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# add tests for GPAW4QMCPACK converter
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/gpaw4qmcpack_test.py ${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py SYMBOLIC)
file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/gpaw4qmcpack_test.py ${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py
SYMBOLIC)
function(ADD_GPAW4QMCPACK_TEST test_name)
set(EXE_NAME "${PROJECT_SOURCE_DIR}/src/QMCTools/gpaw4qmcpack.py")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}/restart.gpw"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}/restart.gpw" SYMBOLIC)
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}/restart.gpw" SYMBOLIC)
file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}/gold.orbs.h5"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}/gold.orbs.h5" SYMBOLIC)
add_test(NAME gpaw4qmcpack_test COMMAND "${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}"
--exe "${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(gpaw4qmcpack_test PROPERTIES
FAIL_REGULAR_EXPRESSION " FAIL"
PASS_REGULAR_EXPRESSION " pass"
TIMEOUT 120 LABELS "converter;deterministic")
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}/gold.orbs.h5" SYMBOLIC)
add_test(NAME gpaw4qmcpack_test
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py" "${CMAKE_CURRENT_BINARY_DIR}/${test_name}" --exe
"${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
set_tests_properties(
gpaw4qmcpack_test
PROPERTIES FAIL_REGULAR_EXPRESSION
" FAIL"
PASS_REGULAR_EXPRESSION
" pass"
TIMEOUT
120
LABELS
"converter;deterministic")
endfunction()
add_gpaw4qmcpack_test(test_Si_diamond)
12 changes: 4 additions & 8 deletions tests/estimator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,14 @@ if(add_test)
16
check_collectables_h5dat.py
dat-h5_allp)
simple_run_and_check(
estimator-acforce-legacy
"${qmcpack_SOURCE_DIR}/tests/estimator/acforce"
vmc.legacy.in.xml
1
16
check_forces.py)
simple_run_and_check(estimator-acforce-legacy "${qmcpack_SOURCE_DIR}/tests/estimator/acforce" vmc.legacy.in.xml 1 16
check_forces.py)
simple_run_and_check(
estimator-acforce-fast
"${qmcpack_SOURCE_DIR}/tests/estimator/acforce"
vmc.fast.in.xml
1
16
check_forces.py vmc.fast.s000.scalar.dat)
check_forces.py
vmc.fast.s000.scalar.dat)
endif()
22 changes: 9 additions & 13 deletions tests/heg/heg2d_4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
if(NOT QMC_CUDA)
if(NOT MIXED_PRECISION)
simple_run_and_check(deterministic-heg2d-4_ae-deriv "${qmcpack_SOURCE_DIR}/tests/heg/heg2d_4" deriv.xml 1 1
check_deriv.py)

simple_run_and_check(deterministic-heg2d-4_ae-grad_lap "${qmcpack_SOURCE_DIR}/tests/heg/heg2d_4" grad_lap.xml 1 1
check_grad_lap.py)

else()
message(VERBOSE "Skipping eg2d derivative tests in mixed precision (QMC_MIXED_PRECISION=1)")
endif(NOT MIXED_PRECISION)
if(NOT MIXED_PRECISION)
simple_run_and_check(deterministic-heg2d-4_ae-deriv "${qmcpack_SOURCE_DIR}/tests/heg/heg2d_4" deriv.xml 1 1
check_deriv.py)

simple_run_and_check(deterministic-heg2d-4_ae-grad_lap "${qmcpack_SOURCE_DIR}/tests/heg/heg2d_4" grad_lap.xml 1 1
check_grad_lap.py)

else()
message(VERBOSE "Skipping eg2d derivative tests because they are not supported by CUDA build (QMC_CUDA=1)")
endif(NOT QMC_CUDA)
message(VERBOSE "Skipping eg2d derivative tests in mixed precision (QMC_MIXED_PRECISION=1)")
endif(NOT MIXED_PRECISION)
Loading

0 comments on commit c00bdcb

Please sign in to comment.