Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
de82cd16
Commit
de82cd16
authored
4 years ago
by
Jean-Baptiste Keck
Browse files
Options
Downloads
Patches
Plain Diff
test for checkpointing
parent
19e3be21
No related branches found
No related tags found
1 merge request
!16
MPI operators
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/core/tests/test_checkpoint.sh
+158
-0
158 additions, 0 deletions
hysop/core/tests/test_checkpoint.sh
with
158 additions
and
0 deletions
hysop/core/tests/test_checkpoint.sh
0 → 100755
+
158
−
0
View file @
de82cd16
#!/usr/bin/env bash
set
-feu
-o
pipefail
PYTHON_EXECUTABLE
=
${
PYTHON_EXECUTABLE
:-
python2
.7
}
SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null 2>&1
&&
pwd
)
"
EXAMPLE_DIR
=
"
$(
realpath
${
SCRIPT_DIR
}
/../../../hysop_examples/examples
)
"
function
compare_files
{
if
[[
!
-f
"
$1
"
]]
;
then
echo
"File '
${
1
}
' does not exist."
exit
1
fi
if
[[
!
-f
"
$2
"
]]
;
then
echo
"File '
${
2
}
' does not exist."
exit
1
fi
# see https://stackoverflow.com/questions/3679296/only-get-hash-value-using-md5sum-without-filename
# for the bash array assignment trick (solution proposed by Peter O.)
A
=(
$(
sha1sum
"
${
1
}
"
)
)
B
=(
$(
sha1sum
"
${
2
}
"
)
)
if
[[
"
${
A
}
"
!=
"
${
B
}
"
]]
;
then
echo
"Could not match checksums between
${
1
}
and
${
2
}
."
exit
1
fi
}
#
# Basic test with 2D diffusion (serial)
#
#EXAMPLE_FILE="${EXAMPLE_DIR}/scalar_diffusion/scalar_diffusion.py"
#TEST_DIR='/tmp/hysop_tests/checkpoints/scalar_diffusion'
#COMMON_OPTIONS="-NC -impl opencl -cp fp32 -d64 --debug-dump-target dump -nu 0.02 -niter 20 -te 0.1 --dump-tstart 0.05 --dump-freq 1 "
#echo
#echo
#echo "TEST SCALAR DIFFUSION CHECKPOINT (SERIAL)"
#if [[ ! -f "${EXAMPLE_FILE}" ]]; then
#echo "Cannot find example file '${EXAMPLE_FILE}'."
#exit 1
#fi
#echo ' Running simulations...'
#"${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run0" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0
#"${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run1" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0
#echo ' Comparing solutions...'
#echo " >debug dumps match"
#compare_files "${TEST_DIR}/run0/dump/run.txt" "${TEST_DIR}/run1/dump/run.txt"
#for f0 in $(find "${TEST_DIR}/run0" -name '*.h5'); do
#f1=$(echo "${f0}" | sed 's/run0/run1/')
#compare_files "${f0}" "${f1}"
#echo " >$(basename ${f0}) match"
#done
#echo
#echo ' Running simulations from checkpoints...'
#"${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run2"
#"${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run3"
#echo ' Comparing solutions...'
#compare_files "${TEST_DIR}/run2/dump/run.txt" "${TEST_DIR}/run3/dump/run.txt"
#echo " >debug dumps match"
#for f0 in $(find "${TEST_DIR}/run2" -name '*.h5' | sort -n); do
#f1=$(echo "${f0}" | sed 's/run2/run3/')
#f2=$(echo "${f0}" | sed 's/run2/run0/')
#f3=$(echo "${f0}" | sed 's/run2/run1/')
#compare_files "${f0}" "${f1}"
#compare_files "${f0}" "${f2}"
#compare_files "${f0}" "${f3}"
#echo " >$(basename ${f0}) match"
#done
#Basic test with 2D diffusion (mpi)
#EXAMPLE_FILE="${EXAMPLE_DIR}/scalar_diffusion/scalar_diffusion.py"
#TEST_DIR='/tmp/hysop_tests/checkpoints/scalar_diffusion_mpi'
#COMMON_OPTIONS="-NC -impl opencl -cp fp32 -d64 --debug-dump-target dump -nu 0.02 -niter 20 -te 0.1 --dump-tstart 0.05 --dump-freq 1 "
#echo
#echo
#echo "TEST SCALAR DIFFUSION CHECKPOINT (MPI)"
#if [[ ! -f "${EXAMPLE_FILE}" ]]; then
#echo "Cannot find example file '${EXAMPLE_FILE}'."
#exit 1
#fi
#echo ' Running simulations...'
#mpirun -np 4 "${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run0" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0
#mpirun -np 4 "${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run1" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0
#echo ' Comparing solutions...'
#echo " >debug dumps match"
#compare_files "${TEST_DIR}/run0/dump/run.txt" "${TEST_DIR}/run1/dump/run.txt"
#for f0 in $(find "${TEST_DIR}/run0" -name '*.h5'); do
#f1=$(echo "${f0}" | sed 's/run0/run1/')
#compare_files "${f0}" "${f1}"
#echo " >$(basename ${f0}) match"
#done
#echo
#echo ' Running simulations from checkpoints...'
#mpirun -np 4 "${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run2"
#mpirun -np 4 "${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run3"
#echo ' Comparing solutions...'
#compare_files "${TEST_DIR}/run2/dump/run.txt" "${TEST_DIR}/run3/dump/run.txt"
#echo " >debug dumps match"
#for f0 in $(find "${TEST_DIR}/run2" -name '*.h5' | sort -n); do
#f1=$(echo "${f0}" | sed 's/run2/run3/')
#f2=$(echo "${f0}" | sed 's/run2/run0/')
#f3=$(echo "${f0}" | sed 's/run2/run1/')
#compare_files "${f0}" "${f1}"
#compare_files "${f0}" "${f2}"
#compare_files "${f0}" "${f3}"
#echo " >$(basename ${f0}) match"
#done
#
# Test 3D with taylor green (Fortran MPI backend)
#
EXAMPLE_FILE
=
"
${
EXAMPLE_DIR
}
/taylor_green/taylor_green.py"
TEST_DIR
=
'/tmp/hysop_tests/checkpoints/taylor_green'
COMMON_OPTIONS
=
"-NC -impl fortran -cp fp64 -d32 -te 0.5 --dump-tstart 0.25 --dump-freq 1 --hdf5-disable-slicing --hdf5-disable-compression"
echo
echo
echo
"TEST TAYLOR-GREEN CHECKPOINT (Fortran-MPI)"
if
[[
!
-f
"
${
EXAMPLE_FILE
}
"
]]
;
then
echo
"Cannot find example file '
${
EXAMPLE_FILE
}
'."
exit
1
fi
#mpirun -np 2 "${PYTHON_EXECUTABLE}" "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run0" --checkpoint-dump-time 0.25 --checkpoint-dump-freq 0
mpirun
-np
4
"
${
PYTHON_EXECUTABLE
}
"
"
${
EXAMPLE_FILE
}
"
${
COMMON_OPTIONS
}
-S
"
${
TEST_DIR
}
/checkpoint1.tar"
--dump-dir
"
${
TEST_DIR
}
/run1"
--checkpoint-dump-time
0.25
--checkpoint-dump-freq
0
exit
0
compare_files
"
${
TEST_DIR
}
/run0/parameters.txt"
"
${
TEST_DIR
}
/run1/parameters.txt"
for
f0
in
$(
find
"
${
TEST_DIR
}
/run0"
-name
'*.h5'
)
;
do
f1
=
$(
echo
"
${
f0
}
"
|
sed
's/run0/run1/'
)
compare_files
"
${
f0
}
"
"
${
f1
}
"
done
"
${
PYTHON_EXECUTABLE
}
"
"
${
EXAMPLE_FILE
}
"
${
COMMON_OPTIONS
}
-L
"
${
TEST_DIR
}
/A.tar"
-te
0.5
--dump-tstart
0.25
--dump-freq
1
--dump-dir
"
${
TEST_DIR
}
/run2"
"
${
PYTHON_EXECUTABLE
}
"
"
${
EXAMPLE_FILE
}
"
${
COMMON_OPTIONS
}
-L
"
${
TEST_DIR
}
/B.tar"
-te
0.5
--dump-tstart
0.25
--dump-freq
1
--dump-dir
"
${
TEST_DIR
}
/run3"
compare_files
"
${
TEST_DIR
}
/run2/parameters.txt"
"
${
TEST_DIR
}
/run3/parameters.txt"
for
f0
in
$(
find
"
${
TEST_DIR
}
/run2"
-name
'*.h5'
)
;
do
f1
=
$(
echo
"
${
f0
}
"
|
sed
's/run2/run3/'
)
f2
=
$(
echo
"
${
f0
}
"
|
sed
's/run2/run0/'
)
f3
=
$(
echo
"
${
f0
}
"
|
sed
's/run2/run1/'
)
compare_files
"
${
f0
}
"
"
${
f1
}
"
compare_files
"
${
f0
}
"
"
${
f2
}
"
compare_files
"
${
f0
}
"
"
${
f3
}
"
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment