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

Option to run NAMD regtests in GPU-resident mode #559

Merged
merged 3 commits into from
Sep 21, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion namd/tests/library/Common/common.namd
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ if { [info exists xsc_file] > 0 } {
}

COMmotion no
zeroMomentum yes
# incompatible with CUDASOAIntegrate as of 09/2023
#zeroMomentum yes

timestep 1.0

Expand Down
9 changes: 8 additions & 1 deletion namd/tests/library/Common/test.namd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
# Note: see also test.restart.namd, test.legacy.namd, test.restart.legacy.namd

source ../Common/common.namd
source ../Common/measure_net_force_torque.tcl

if { [info exists env(NAMD_CUDASOA)] && $env(NAMD_CUDASOA) } {
CUDASOAIntegrate on
# incompatible with TclForces as of 07/2023
} else {
source ../Common/measure_net_force_torque.tcl
}


colvars on

Expand Down
1 change: 1 addition & 0 deletions namd/tests/library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This is the usage information for `run_tests.sh`:
```
Usage: ./run_tests.sh [-h] [-g] [path_to_namd2] [testdir1 [testdir2 ...]]
The -g option (re)generates reference outputs in the given directories
The -cudasoa option enables the GPU-resident NAMD3 code path (CUDASOAIntegrate)
If no executable is given, "namd2" is used
If no directories are given, all matches of [0-9][0-9][0-9]_* are used
```
Expand Down
13 changes: 9 additions & 4 deletions namd/tests/library/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export TMPDIR=${TMPDIR:-/tmp}

DIRLIST=''
BINARY=namd2
CUDASOA=0

while [ $# -ge 1 ]; do
if { echo $1 | grep -q namd ; }; then
echo "Using NAMD executable from $1"
Expand All @@ -22,13 +24,16 @@ while [ $# -ge 1 ]; do
gen_ref_output='yes'
echo "Generating reference output"
elif [ "x$1" = 'x-h' ]; then
echo "Usage: ./run_tests.sh [-h] [-g] [path_to_namd2] [testdir1 [testdir2 ...]]" >& 2
echo "Usage: ./run_tests.sh [-h] [-g] [-cudasoa] [path_to_namd2] [testdir1 [testdir2 ...]]" >& 2
echo " The -g option (re)generates reference outputs in the given directories" >& 2
echo " The -cudasoa option enables the GPU-resident NAMD3 code path (CUDASOAIntegrate)" >& 2
echo " If no executable is given, \"namd2\" is used" >& 2
echo " If no directories are given, all matches of [0-9][0-9][0-9]_* are used" >& 2
echo " This script relies on the executable spiff to be available, and will try to " >& 2
echo " download and build it into $TMPDIR if needed." >& 2
exit 0
elif [ "x$1" = 'x-cudasoa' ]; then
CUDASOA=1
else
DIRLIST=`echo ${DIRLIST} $1`
fi
Expand Down Expand Up @@ -164,7 +169,7 @@ for dir in ${DIRLIST} ; do

# Run the test (use a subshell to avoid cluttering stdout)
# Use multiple threads to test SMP code (TODO: move SMP tests to interface?)
$BINARY +p ${NUM_THREADS_THIS} $script > ${basename}.out
NAMD_CUDASOA=$CUDASOA $BINARY +p ${NUM_THREADS_THIS} $script > ${basename}.out

# Output of Colvars module, minus the version numbers
grep "^colvars:" ${basename}.out | grep -v 'Initializing the collective variables module' \
Expand Down Expand Up @@ -294,11 +299,11 @@ else
echo "$(${TPUT_RED})There were failed tests.$(${TPUT_CLEAR})"
if [ ${#failed_tests[@]} -gt 0 ]; then
echo "The following tests are failed:"
printf "%s\n" "${failed_tests[@]}"
printf "%s\n" "${failed_tests[@]}" | sort -u
fi
if [ ${#failed_tests_low_prec[@]} -gt 0 ]; then
echo "The following tests are failed, but passed at low precisions:"
printf "%s\n" "${failed_tests_low_prec[@]}"
printf "%s\n" "${failed_tests_low_prec[@]}" | sort -u
fi
exit 1
fi