-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharliecloud_tests.sh
executable file
·134 lines (114 loc) · 5.27 KB
/
charliecloud_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
#----------------------------------------------------------------------------
# environment
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
[ -f ${SCRIPTDIR}/sanitize_env.sh ] && . ${SCRIPTDIR}/sanitize_env.sh
[ -f ${SCRIPTDIR}/config_env.sh ] && . ${SCRIPTDIR}/config_env.sh || \
{ echo "cannot locate ${SCRIPTDIR}/config_env.sh"; exit 1; }
#----------------------------------------------------------------------------
# spack env activate -p container_env
clean_container_dirs
# process any command line args:
full_tests=false
build_tests=true
pull_tests=true
while [[ $# -gt 0 ]]; do
case $1 in
-a|--full-tests)
full_tests=true
;;
--build-tests)
build_tests=true
;;
--no-build-tests|--skip-build)
build_tests=false
;;
--pull-tests)
pull_tests=true
;;
--no-pull-tests|--skip-pull)
pull_tests=false
;;
*)
;;
esac
shift
done
#----------------------------------------------------------------------------
if [[ true == ${build_tests} ]]; then
clean_container_dirs
cd ${SCRIPTDIR}/openhpc || exit 1
#label="Charliecloud openhpc -- build"
#message_running ${label}
#ln -sf Dockerfile.ch Dockerfile
#
#try_command ch-image build --force fakeroot .
#try_command ch-image list
#try_command ch-convert openhpc ${CONTAINER_TMP_PREFIX}/${USER}/openhpc
#try_command ch-convert openhpc ./openhpc.sqfs
#
#label="Charliecloud openhpc -- directory image"
#message_running ${label}
#try_command ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- cat /etc/os-release /etc/ohpc-release
#try_command "ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- rpm -qa | sort | uniq"
#try_command ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- gcc --version
#
## Charliecloud internal SquashFUSE support - requires https://github.com/spack/spack/pull/34847
#label="Charliecloud openhpc -- SquashFUSE image"
#message_running ${label}
#try_command ch-run ./openhpc.sqfs -- cat /etc/os-release /etc/ohpc-release
#try_command ch-run ./openhpc.sqfs -- gcc --version
#try_command ch-run ./openhpc.sqfs -- bash -lc \
# '". /etc/profile.d/lmod.sh && module avail && module list && which mpicxx && mpicxx --version"'
label="Charliecloud openhpc+cuda -- build"
message_running ${label}
ln -sf Dockerfile-cuda.ch Dockerfile
try_command ch-image build --force fakeroot .
try_command ch-image list
try_command ch-convert openhpc ${CONTAINER_TMP_PREFIX}/${USER}/openhpc
try_command ch-convert openhpc ./openhpc.sqfs
label="Charliecloud openhpc+cuda -- directory image"
message_running ${label}
try_command ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- cat /etc/os-release /etc/ohpc-release
try_command "ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- rpm -qa | sort | uniq"
try_command ch-run ${CONTAINER_TMP_PREFIX}/${USER}/openhpc -- gcc --version
# Charliecloud internal SquashFUSE support - requires https://github.com/spack/spack/pull/34847
label="Charliecloud openhpc+cuda -- SquashFUSE image"
message_running ${label}
try_command ch-run ./openhpc.sqfs -- cat /etc/os-release /etc/ohpc-release
try_command ch-run ./openhpc.sqfs -- gcc --version
try_command ch-run ./openhpc.sqfs -- bash -lc \
'". /etc/profile.d/lmod.sh && module avail && module list && which mpicxx && mpicxx --version"'
clean_container_dirs
fi
if [[ true == ${pull_tests} ]]; then
clean_container_dirs
cd ${SCRIPTDIR}/rockylinux || exit 1
label="Charliecloud pull, convert (SquashFUSE), & run rocky8 image"
message_running ${label}
try_command ch-image pull benjaminkirk/rocky8-libmesh-prereqs:0.0.1
try_command ch-image list
rm -f ./rocky8-libmesh-prereqs.sqfs
try_command ch-convert benjaminkirk/rocky8-libmesh-prereqs:0.0.1 ./rocky8-libmesh-prereqs.sqfs
try_command ch-run ./rocky8-libmesh-prereqs.sqfs -- gcc --version
try_command ch-run ./rocky8-libmesh-prereqs.sqfs -- bash -lc \
'"module use /usr/share/modulefiles && module avail && module load mpi && module list && which mpicxx && mpicxx --version"'
label="Charliecloud pull, convert (SquashFUSE), & run rocky9 image"
message_running ${label}
try_command ch-image pull benjaminkirk/rocky9-libmesh:0.0.1
try_command ch-image list
rm -f ./rocky9-libmesh.sqfs
try_command ch-convert benjaminkirk/rocky9-libmesh:0.0.1 ./rocky9-libmesh.sqfs
try_command ch-run ./rocky9-libmesh.sqfs -- gcc --version
try_command ch-run ./rocky9-libmesh.sqfs -- bash -lc \
'"module use /usr/share/modulefiles && module avail && module load mpi && module list && which mpicxx && mpicxx --version"'
label+=" (MPI Inside container)"
message_running ${label}
try_command ch-run ./rocky9-libmesh.sqfs -- bash -lc \
'"module use /usr/share/modulefiles && module avail && module load mpi && module list && cd /tmp && touch foo && mpiexec -n 4 /opt/local/libmesh/1.8.0-pre-mpich-x86_64/examples/introduction/ex4/example-opt -d 3 -n 25"'
rm -f ./rocky9-libmesh.sqfs
clean_container_dirs
fi
# clean up
clean_container_dirs
exit 0