Debian Codegraph @

debian/tests/python-gyoto-mpi

raw
1 #!/bin/sh
2 set -e
3
4 # Name of this script
5 script=`basename "$0"`
6
7 # Handle case of manually running this script
8 if [ "$AUTOPKGTEST_TMP" = "" ]; then
9 AUTOPKGTEST_TMP=`mktemp -d --tmpdir "$script"-XXX`;
10 echo "AUTOPKGTEST_TMP is $AUTOPKGTEST_TMP";
11 fi
12 if [ "$ADT_ARTIFACTS" = "" ] ; then
13 ADT_ARTIFACTS=${AUTOPKGTEST_TMP}/artifacts
14 fi
15 mkdir -p "${AUTOPKGTEST_TMP}"
16 mkdir -p "${ADT_ARTIFACTS}"
17
18 # Save current directory (must be top of source tree)
19 SRC_ROOT=`pwd`
20
21 # Setup Python example tree structure
22 mkdir -p ${AUTOPKGTEST_TMP}/doc
23 cp -a doc/examples ${AUTOPKGTEST_TMP}/doc/
24 mkdir -p ${AUTOPKGTEST_TMP}/python
25 cd ${AUTOPKGTEST_TMP}/python
26 echo "backend : PDF" > matplotlibrc
27 cp ${SRC_ROOT}/plugins/python/doc/examples/* ./
28 cp ${SRC_ROOT}/python/example-mpi.py ./
29
30 # Get list of Python examples
31 BASE_NAMES=`basename -s.xml *.xml`
32
33 # Build Gyoto command line
34 GYOTO="/usr/bin/gyoto --nprocesses=4 --nthreads=1 --resolution=32"
35
36 # Determine default MPI implementation for this arch
37 HOSTFILE="${AUTOPKGTEST_TMP}"/hostfile.${script}
38 eval `grep ARCH_DEFAULT_MPI_IMPL /usr/share/mpi-default-dev/debian_defaults`
39 if [ "x$ARCH_DEFAULT_MPI_IMPL" = x"openmpi" ]
40 # Setup MPI environment to run on localhost with enough slots
41 then export OMPI_MCA_plm_rsh_agent=/bin/false
42 export OMPI_MCA_btl_tcp_if_include=lo
43 HOSTFILE="${AUTOPKGTEST_TMP}"/hostfile.${script}
44 echo localhost slots=5 > "${HOSTFILE}"
45 MPIRUN_CMD="mpirun.openmpi -np 1 --hostfile ${HOSTFILE} --oversubscribe"
46 elif [ "x$ARCH_DEFAULT_MPI_IMPL" = x"mpich" ]
47 then echo localhost > "${HOSTFILE}"
48 MPIRUN_CMD="mpirun.mpich -np 1 --hostfile ${HOSTFILE}"
49 else echo "unknown MPI implementation: " $ARCH_DEFAULT_MPI_IMPL
50 exit 1
51 fi
52
53 # Run each example in this environment
54 for python in python3 `py3versions -s` ; do
55 echo "**** Testing Python version: $python ****"
56 unset GYOTO_PLUGINS
57 ${MPIRUN_CMD} $python example-mpi.py ;
58 mkdir -p ${ADT_ARTIFACTS}/${python}-mpi
59 export GYOTO_PLUGINS=$python,stdplug
60 for base in ${BASE_NAMES} ; do
61 ${MPIRUN_CMD} ${GYOTO} \
62 ${base}.xml \
63 \!${ADT_ARTIFACTS}/${python}-mpi/${base}.fits ;
64 done ;
65 done
66
67 exit 0