3 # Build, install, and test the gmxapi 0.2 Python package developed with
6 # This script assumes an activated Python venv with the
7 # gmxapi dependencies already installed, with `python` resolvable by the shell
8 # to the appropriate Python interpreter.
10 # This script is intended to support automated GROMACS testing infrastructure,
11 # and may be removed without notice.
13 # WARNING: This script assumes OpenMPI mpiexec. Syntax for launch wrappers from
14 # other implementations will need different syntax, and we should get a
15 # MPIRUNNER from the environment, or something.
17 # Make sure the script errors if any commands error.
20 # Create "sdist" source distribution archive.
21 pushd python_packaging
/src
22 # TODO: Remove extraneous environment variable with resolution of #3273
23 # Ref: https://redmine.gromacs.org/issues/3273
24 GMXTOOLCHAINDIR
=$INSTALL_DIR/share
/cmake
/gromacs \
26 # TODO: Identify SDIST
28 # Build and install from sdist.
29 # Note that tool chain may be provided differently in GROMACS 2020 and 2021.
30 GMXTOOLCHAINDIR
=$INSTALL_DIR/share
/cmake
/gromacs \
31 python
-m pip
install \
35 --no-build-isolation \
37 # TODO: Build and install from $SDIST instead of wildcard.
41 # Run Python unit tests.
42 python
-m pytest python_packaging
/src
/test --junitxml=$PY_UNIT_TEST_XML --threads=2
44 # Note: Multiple pytest processes getting --junitxml output file argument
45 # may cause problems, so we set the option on only one of the launched processes.
46 # See also Multiple Instruction Multiple Data Model for OpenMPI mpirun:
47 # https://www.open-mpi.org/doc/v3.0/man1/mpiexec.1.php
48 PROGRAM
=(`which python` -m mpi4py
-m pytest \
50 $PWD/python_packaging
/src
/test \
52 # shellcheck disable=SC2068
53 if [ -x `which mpiexec` ]; then
54 PYTHONDONTWRITEBYTECODE
=1 \
55 mpiexec
--allow-run-as-root \
56 -x OMP_NUM_THREADS
=1 \
57 --mca opal_warn_on_missing_libcuda
0 \
58 --mca orte_base_help_aggregate
0 \
59 -n 1 ${PROGRAM[@]} --junitxml=$PLUGIN_MPI_TEST_XML : \
63 # Run Python acceptance tests.
64 python
-m pytest python_packaging
/test --junitxml=$PY_ACCEPTANCE_TEST_XML --threads=2
66 # Note: Multiple pytest processes getting --junitxml output file argument
67 # may cause problems, so we set the option on only one of the launched processes.
68 # See also Multiple Instruction Multiple Data Model for OpenMPI mpirun:
69 # https://www.open-mpi.org/doc/v3.0/man1/mpiexec.1.php
70 PROGRAM
=(`which python` -m mpi4py
-m pytest \
72 $PWD/python_packaging
/test \
74 # shellcheck disable=SC2068
75 if [ -x `which mpiexec` ]; then
76 PYTHONDONTWRITEBYTECODE
=1 \
77 mpiexec
--allow-run-as-root \
78 -x OMP_NUM_THREADS
=1 \
79 --mca opal_warn_on_missing_libcuda
0 \
80 --mca orte_base_help_aggregate
0 \
81 -n 1 ${PROGRAM[@]} --junitxml=$PLUGIN_MPI_TEST_XML : \