Debian Codegraph @

debian/tests/adios2-mpi-examples

raw symbols SCIP
1 #!/bin/bash
2
3 # Check that selected examples can build and run without segfaulting
4
5 err_code=0
6
7 export PRTE_MCA_plm_ssh_agent=/bin/false
8 export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
9 # MPI is typically more efficient with 1 thread per process
10 export OMP_NUM_THREADS=1
11
12 DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
13 DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
14
15 cd examples
16 TEST_DIR=`pwd`
17
18 mkdir test_build
19 cd test_build
20
21 export HOME=${PWD}
22
23 # build examples
24 cmake -DCMAKE_PREFIX_PATH=/usr/lib/${DEB_HOST_MULTIARCH}/cmake/adios2/mpi \
25 -DCMAKE_CXX_COMPILER=mpicxx \
26 -DCMAKE_BUILD_TYPE=Debug \
27 -DCMAKE_VERBOSE_MAKEFILE=ON \
28 ..
29 err_code=$(( $? | err_code ))
30 make
31 err_code=$(( $? | err_code ))
32 echo
33
34 # don't run examples which do not run cleanly
35 declare -a SKIP_TEST_LIST
36 SKIP_TEST_LIST=(${SKIP_TEST_LIST[@]} \
37 adios2_simulations_gray-scott-struct adios2_simulations_gray-scott\
38 adios2_basics_queryWorker)
39
40 # plugin engine examples are not fully configured to run as-is (plugin name is mangled)
41 SKIP_TEST_LIST=(${SKIP_TEST_LIST[@]} adios2_plugins_examplePluginEngineRead \
42 adios2_plugins_examplePluginEngineWrite)
43
44 # insituGlobalArraysReaderNxN_mpi is flakey, Bug#1062356
45 SKIP_TEST_LIST=(${SKIP_TEST_LIST[@]} adios2_useCases_insituGlobalArraysReaderNxN_mpi \
46 adios2_basics_globalArray1DRead_*)
47
48 SKIP_TESTS=""
49 for t in ${SKIP_TEST_LIST[@]}; do
50 SKIP_TESTS="${SKIP_TESTS} -not -name $t"
51 done
52 echo "skipping examples: SKIP_TEST_LIST=${SKIP_TEST_LIST[@]}"
53
54 # *Write should be run before *Read to generate the test file needed to read
55 # and *Read before *Write_mpi or the read may fail
56 declare -a TEST_LIST
57 TEST_LIST=(`find . -maxdepth 3 -executable -type f \( -name *Write -o -name *Writer \) ${SKIP_TESTS}`)
58 TEST_LIST=(${TEST_LIST[@]} `find . -maxdepth 3 -executable -type f \( -name *Read -o -name *Reader \) ${SKIP_TESTS}`)
59 TEST_LIST=(${TEST_LIST[@]} `find . -maxdepth 3 -executable -type f -not -path "*CMakeFiles*" ${SKIP_TESTS}`)
60 # get a unique list (preserving order) cf. https://stackoverflow.com/questions/13648410/how-can-i-get-unique-values-from-an-array-in-bash#comment99138701_13648438
61 TEST_LIST=(`echo "${TEST_LIST[@]}" | tr " " "\n" | awk '!seen[$0]++'`)
62
63 # run examples
64 for f in ${TEST_LIST[@]}; do
65 echo Running $f
66 ADIOS2_PLUGIN_PATH=/usr/lib/${DEB_HOST_MULTIARCH}/adios2/mpi/plugins mpirun -n 3 $f 2>$f.err >$f.out
67 this_err=$?
68 if [ $this_err -ne 0 ]; then
69 echo "Error ${this_err} in $f"
70 cat $f.out
71 cat $f.err
72 else
73 echo "Passed: $f"
74 fi
75 err_code=$(( this_err | err_code ))
76 done
77
78 cd ..
79
80 # check python examples run successfully
81 # (only a couple of them run freely)
82 PYTHON_TESTS="hello/bpWriter/bpWriter.py hello/bpReader/bpReaderHeatMap2D.py"
83
84 # confirm MPI Python module is accessible
85 for pyver in `py3versions -sv`; do
86 echo -e "\nChecking Python $pyver installation"
87 mpirun -n 1 python$pyver -c "import adios2; print('adios2 version', adios2.__version__); assert adios2.is_built_with_mpi"
88 err_code=$(( $? | err_code ))
89 mpirun -n 3 python$pyver -c "import adios2; print('adios2 version', adios2.__version__); assert adios2.is_built_with_mpi"
90 err_code=$(( $? | err_code ))
91
92 for f in ${PYTHON_TESTS}; do
93 echo Running python$pyver example $f
94 cd `dirname $f`
95 pyscript=`basename $f`
96 ADIOS2_PLUGIN_PATH=/usr/lib/${DEB_HOST_MULTIARCH}/adios2/mpi/plugins mpirun -n 3 python$pyver $pyscript 2>$pyscript.err >$pyscript.out
97 this_err=$?
98 if [ $this_err -ne 0 ]; then
99 echo "Error ${this_err} in $f"
100 cat $pyscript.out
101 cat $pyscript.err
102 else
103 echo "Passed: $f"
104 fi
105 err_code=$(( this_err | err_code ))
106 cd $TEST_DIR
107 done
108 done
109
110 exit ${err_code}