Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a restart test #249

Merged
merged 3 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions CMake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ ENDMACRO()

# Runs qmcpack
# Note that TEST_ADDED is an output variable
FUNCTION( RUN_QMC_APP TESTNAME SRC_DIR PROCS THREADS TEST_ADDED ${ARGN} )
COPY_DIRECTORY_MAYBE_USING_SYMLINK( "${SRC_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}" )
#MESSAGE("RUN_QMC_APP2: TESTNAME = ${TESTNAME} SRC_DIR=${SRC_DIR} PROCS = ${PROCS} THREADS = ${THREADS}")
FUNCTION( RUN_QMC_APP_NO_COPY TESTNAME WORKDIR PROCS THREADS TEST_ADDED ${ARGN} )
MATH( EXPR TOT_PROCS "${PROCS} * ${THREADS}" )
SET( QMC_APP "${qmcpack_BINARY_DIR}/bin/qmcpack" )
SET( ${TEST_ADDED} FALSE PARENT_SCOPE )
Expand All @@ -252,20 +250,28 @@ FUNCTION( RUN_QMC_APP TESTNAME SRC_DIR PROCS THREADS TEST_ADDED ${ARGN} )
ELSEIF ( USE_MPI )
ADD_TEST( ${TESTNAME} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${PROCS} ${QMC_APP} ${ARGN} )
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGULAR_EXPRESSION}"
PROCESSORS ${TOT_PROCS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}"
PROCESSORS ${TOT_PROCS} WORKING_DIRECTORY ${WORKDIR}
ENVIRONMENT OMP_NUM_THREADS=${THREADS} )
SET( ${TEST_ADDED} TRUE PARENT_SCOPE )
ENDIF()
ELSE()
IF ( ( ${PROCS} STREQUAL "1" ) )
ADD_TEST( ${TESTNAME} ${QMC_APP} ${ARGN} )
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGULAR_EXPRESSION}"
PROCESSORS ${TOT_PROCS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}"
PROCESSORS ${TOT_PROCS} WORKING_DIRECTORY ${WORKDIR}
ENVIRONMENT OMP_NUM_THREADS=${THREADS} )
SET( ${TEST_ADDED} TRUE PARENT_SCOPE )
ENDIF()
ENDIF()
ENDFUNCTION()

# Runs qmcpack
# Note that TEST_ADDED is an output variable
FUNCTION( RUN_QMC_APP TESTNAME SRC_DIR PROCS THREADS TEST_ADDED ${ARGN} )
COPY_DIRECTORY_MAYBE_USING_SYMLINK( "${SRC_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME}" )
SET( TEST_ADDED_TEMP FALSE )
RUN_QMC_APP_NO_COPY( ${TESTNAME} ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME} ${PROCS} ${THREADS} TEST_ADDED_TEMP ${ARGN} )
SET( ${TEST_ADDED} ${TEST_ADDED_TEMP} PARENT_SCOPE )
ENDFUNCTION()


Expand Down
10 changes: 1 addition & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -883,17 +883,9 @@ ENDIF(QMC_ADIOS)

SUBDIRS(src)

SUBDIRS(tests/converter)
SUBDIRS(tests/system)
SUBDIRS(tests/estimator)
SUBDIRS(tests)
SUBDIRS(examples)

SUBDIRS(tests/performance)

IF(QE_BIN)
MESSAGE(STATUS "QE binary path ${QE_BIN}")
SUBDIRS(tests/pw2qmcpack)
ENDIF()
#ADD_CUSTOM_TARGET(print_settings ALL
# ${CMAKE_COMMAND} -E echo "Print build settings"
# VERBATIM)
Expand Down
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ensure that examples run

message("Adding example tests for QMCPACK")

SUBDIRS(molecules/H2O)
SUBDIRS(molecules/He)
IF (BUILD_AFQMC AND NOT QMC_COMPLEX)
Expand Down
6 changes: 6 additions & 0 deletions manual/installation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,12 @@ \subsubsection{NiO performance tests}
\end{center}
\end{table}

\subsection{Troubleshooting tests}
ctest reports briefly pass or fail of tests in printout and also collects all the standard outputs to help investigating how tests fail.
If the ctest execution is completed, look at \texttt{Testing/Temporary/LastTest.log}.
If you manually stop the testing (ctrl+c), look at \texttt{Testing/Temporary/LastTest.log.tmp}.
You can locate the failing tests by searching for the key word `Fail'.

\section{Automated testing of QMCPACK}

The QMCPACK developers run automatic tests of QMCPACK on several
Expand Down
2 changes: 1 addition & 1 deletion src/io/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SET(UTEST_EXE test_${SRC_DIR})
SET(UTEST_NAME unit_test_${SRC_DIR})

# Directory where input file is copied to, and working directory for unit test
SET(UTEST_DIR ${qmcpack_BINARY_DIR}/tests/io)
SET(UTEST_DIR ${qmcpack_BINARY_DIR}/tests/io/tmp)

ADD_EXECUTABLE(${UTEST_EXE} test_hdf_archive.cpp)
TARGET_LINK_LIBRARIES(${UTEST_EXE} qmcutil ${QMC_UTIL_LIBS} ${MPI_LIBRARY} )
Expand Down
10 changes: 10 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SUBDIRS(converter)
SUBDIRS(system)
SUBDIRS(estimator)
SUBDIRS(io)
SUBDIRS(performance)

IF(QE_BIN)
MESSAGE(STATUS "QE binary path ${QE_BIN}")
SUBDIRS(pw2qmcpack)
ENDIF()
52 changes: 52 additions & 0 deletions tests/io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#############################################################
# Add I/O tests to ctest
#############################################################

message("Adding I/O tests for QMCPACK")

function(RUN_RESTART_AND_CHECK base_name base_dir input_file procs threads check_script)

# "run restart and check" function does 3 things:
# 1. run qmcpack executable on $input_file.in.xml
# 1. run qmcpack executable on $input_file.restart.xml in the same folder
# 2. run $check_script located in the same folder

# build test name
set(full_name "${base_name}-${procs}-${threads}")
message("Adding test ${full_name}")

# add run (task 1)
set (test_added false)
RUN_QMC_APP(${full_name} ${base_dir} ${procs} ${threads} test_added ${input_file}.in.xml)
if ( test_added )

# add restart (task 2)
set(restart_name "${base_name}-${procs}-${threads}-restart")
#set (test_added false)
RUN_QMC_APP_NO_COPY( ${restart_name} ${CMAKE_CURRENT_BINARY_DIR}/${full_name} ${procs} ${threads} test_added ${input_file}.restart.xml )

# make restart depend on the initial run
set_property(TEST ${restart_name} APPEND PROPERTY DEPENDS ${full_name})

# set up command to run check, assume check_script is in the same folder as input
set(check_cmd ${CMAKE_CURRENT_BINARY_DIR}/${full_name}/${check_script})
#message(${check_cmd})

# add test (task 3)
set(test_name "${full_name}-check") # hard-code for single test
set(work_dir "${CMAKE_CURRENT_BINARY_DIR}/${full_name}")
#message(${work_dir})
add_test(NAME "${test_name}"
COMMAND "${check_cmd}"
WORKING_DIRECTORY "${work_dir}"
)

# make test depend on the restart run
set_property(TEST ${test_name} APPEND PROPERTY DEPENDS ${full_name})

endif()

endfunction()

RUN_RESTART_AND_CHECK( restart "${CMAKE_SOURCE_DIR}/tests/io/restart" qmc_short 8 2 check.sh)
RUN_RESTART_AND_CHECK( restart "${CMAKE_SOURCE_DIR}/tests/io/restart" qmc_short 1 16 check.sh)
1 change: 1 addition & 0 deletions tests/io/restart/C.BFD.xml
4 changes: 4 additions & 0 deletions tests/io/restart/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
sed "s/#//" qmc_short.s001.scalar.dat | awk '{print $5,$6,$7,$8}' > s001
sed "s/#//" qmc_short.s002.scalar.dat | awk '{print $5,$6,$7,$8}' > s002
diff s001 s002
1 change: 1 addition & 0 deletions tests/io/restart/pwscf.pwscf.h5
100 changes: 100 additions & 0 deletions tests/io/restart/qmc_short.in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<simulation>
<project id="qmc_short" series="0">
<application name="qmcapp" role="molecu" class="serial" version="1.0"/>
</project>
<random seed="49154"/>
<qmcsystem>
<simulationcell>
<parameter name="lattice" units="bohr">
3.37316115 3.37316115 0.00000000
0.00000000 3.37316115 3.37316115
3.37316115 0.00000000 3.37316115
</parameter>
<parameter name="bconds">
p p p
</parameter>
<parameter name="LR_dim_cutoff" > 15 </parameter>
</simulationcell>
<particleset name="e" random="yes">
<group name="u" size="4" mass="1.0">
<parameter name="charge" > -1 </parameter>
<parameter name="mass" > 1.0 </parameter>
</group>
<group name="d" size="4" mass="1.0">
<parameter name="charge" > -1 </parameter>
<parameter name="mass" > 1.0 </parameter>
</group>
</particleset>
<particleset name="ion0">
<group name="C" size="2" mass="21894.7135906">
<parameter name="charge" > 4 </parameter>
<parameter name="valence" > 4 </parameter>
<parameter name="atomicnumber" > 6 </parameter>
<parameter name="mass" > 21894.7135906 </parameter>
<attrib name="position" datatype="posArray" condition="0">
0.00000000 0.00000000 0.00000000
1.68658058 1.68658058 1.68658058
</attrib>
</group>
</particleset>
<wavefunction name="psi0" target="e">
<determinantset type="einspline" href="pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" meshfactor="1.0" precision="float">
<slaterdeterminant>
<determinant id="updet" size="4">
<occupation mode="ground" spindataset="0"/>
</determinant>
<determinant id="downdet" size="4">
<occupation mode="ground" spindataset="0"/>
</determinant>
</slaterdeterminant>
</determinantset>
<jastrow type="One-Body" name="J1" function="bspline" source="ion0" print="yes">
<correlation elementType="C" size="8" cusp="0.0">
<coefficients id="eC" type="Array">
-0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038
-0.04445345869 -0.02135082917
</coefficients>
</correlation>
</jastrow>
<jastrow type="Two-Body" name="J2" function="bspline" print="yes">
<correlation speciesA="u" speciesB="u" size="8">
<coefficients id="uu" type="Array">
0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936
0.02915953995 0.0122402581
</coefficients>
</correlation>
<correlation speciesA="u" speciesB="d" size="8">
<coefficients id="ud" type="Array">
0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174
0.04145899033 0.01690645936
</coefficients>
</correlation>
</jastrow>
</wavefunction>
<hamiltonian name="h0" type="generic" target="e">
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
<pairpot type="coulomb" name="IonIon" source="ion0" target="ion0"/>
<pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml">
<pseudo elementType="C" href="C.BFD.xml"/>
</pairpot>
<estimator type="flux" name="Flux"/>
</hamiltonian>
</qmcsystem>
<qmc method="vmc" move="pbyp" checkpoint="0">
<parameter name="walkers" > 16 </parameter>
<parameter name="blocks" > 10 </parameter>
<parameter name="steps" > 8.0 </parameter>
<parameter name="subSteps" > 2 </parameter>
<parameter name="timestep" > 0.3 </parameter>
<parameter name="warmupSteps" > 100 </parameter>
</qmc>
<qmc method="vmc" move="pbyp" checkpoint="-1">
<parameter name="walkers" > 16 </parameter>
<parameter name="blocks" > 1 </parameter>
<parameter name="steps" > 1 </parameter>
<parameter name="subSteps" > 0 </parameter>
<parameter name="timestep" > 0.0 </parameter>
<parameter name="warmupSteps" > 0 </parameter>
</qmc>
</simulation>
95 changes: 95 additions & 0 deletions tests/io/restart/qmc_short.restart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0"?>
<simulation>
<project id="qmc_short" series="2">
<application name="qmcapp" role="molecu" class="serial" version="1.0"/>
</project>
<random seed="49154"/>
<qmcsystem>
<simulationcell>
<parameter name="lattice" units="bohr">
3.37316115 3.37316115 0.00000000
0.00000000 3.37316115 3.37316115
3.37316115 0.00000000 3.37316115
</parameter>
<parameter name="bconds">
p p p
</parameter>
<parameter name="LR_dim_cutoff"> 15 </parameter>
</simulationcell>
<particleset name="e" random="yes">
<group name="u" size="4" mass="1.0">
<parameter name="charge"> -1 </parameter>
<parameter name="mass"> 1.0 </parameter>
</group>
<group name="d" size="4" mass="1.0">
<parameter name="charge"> -1 </parameter>
<parameter name="mass"> 1.0 </parameter>
</group>
</particleset>
<particleset name="ion0">
<group name="C" size="2" mass="21894.7135906">
<parameter name="charge"> 4 </parameter>
<parameter name="valence"> 4 </parameter>
<parameter name="atomicnumber"> 6 </parameter>
<parameter name="mass"> 21894.7135906 </parameter>
<attrib name="position" datatype="posArray" condition="0">
0.00000000 0.00000000 0.00000000
1.68658058 1.68658058 1.68658058
</attrib>
</group>
</particleset>
<wavefunction name="psi0" target="e">
<determinantset type="einspline" href="pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" meshfactor="1.0" precision="float">
<slaterdeterminant>
<determinant id="updet" size="4">
<occupation mode="ground" spindataset="0"/>
</determinant>
<determinant id="downdet" size="4">
<occupation mode="ground" spindataset="0"/>
</determinant>
</slaterdeterminant>
</determinantset>
<jastrow type="One-Body" name="J1" function="bspline" source="ion0" print="yes">
<correlation elementType="C" size="8" cusp="0.0">
<coefficients id="eC" type="Array">
-0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038
-0.04445345869 -0.02135082917
</coefficients>
</correlation>
</jastrow>
<jastrow type="Two-Body" name="J2" function="bspline" print="yes">
<correlation speciesA="u" speciesB="u" size="8">
<coefficients id="uu" type="Array">
0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936
0.02915953995 0.0122402581
</coefficients>
</correlation>
<correlation speciesA="u" speciesB="d" size="8">
<coefficients id="ud" type="Array">
0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174
0.04145899033 0.01690645936
</coefficients>
</correlation>
</jastrow>
</wavefunction>
<hamiltonian name="h0" type="generic" target="e">
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
<pairpot type="coulomb" name="IonIon" source="ion0" target="ion0"/>
<pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml">
<pseudo elementType="C" href="C.BFD.xml"/>
</pairpot>
<estimator type="flux" name="Flux"/>
</hamiltonian>
</qmcsystem>

<mcwalkerset fileroot="qmc_short.s000" node="-1" nprocs="4" version="3 0" collected="yes"/>

<qmc method="vmc" move="pbyp" checkpoint="-1">
<parameter name="walkers"> 16 </parameter>
<parameter name="blocks"> 1 </parameter>
<parameter name="steps"> 1 </parameter>
<parameter name="subSteps"> 0 </parameter>
<parameter name="timestep"> 0.0 </parameter>
<parameter name="warmupSteps"> 0 </parameter>
</qmc>
</simulation>