Test gmxapi and clients through Py 3.9.
authorM. Eric Irrgang <mei2n@virginia.edu>
Tue, 29 Jun 2021 14:36:44 +0000 (14:36 +0000)
committerAndrey Alekseenko <al42and@gmail.com>
Tue, 29 Jun 2021 14:36:44 +0000 (14:36 +0000)
* Begin moving to the new CI matrix config conventions.
* Clarify test intentions.
* Add testing for sample_restraint in master branch.
* Use the clang-8 build artifacts instead of gcc-10
  for faster gmxapi build.
* Adjust CMake options to get installed headers
  needed by consumers of the build artifact.

.gitlab-ci.yml
admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh
admin/ci-scripts/build-and-test-sample_restraint-2022.sh [new file with mode: 0644]
admin/gitlab-ci/api-client.matrix.gitlab-ci.yml [new file with mode: 0644]
admin/gitlab-ci/api-client.matrix/gromacs-master.gitlab-ci.yml [new file with mode: 0644]
admin/gitlab-ci/gromacs.matrix/gromacs.clang-8.gitlab-ci.yml
admin/gitlab-ci/gromacs.matrix/gromacs.clang-9-mpi.gitlab-ci.yml
admin/gitlab-ci/python-gmxapi.matrix.gitlab-ci.yml [new file with mode: 0644]
admin/gitlab-ci/python-gmxapi.matrix/gmxapi-0.3-gromacs-master.gitlab-ci.yml [moved from admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml with 58% similarity]
docs/dev-manual/gitlab-ci.rst

index 5512be09efb9eef388bb9dc0815e6b1e313d7eb0..5f80a76cc6ae13989cc0f7e3b1bac70ba47d204d 100644 (file)
@@ -42,13 +42,9 @@ include:
   - local: '/admin/gitlab-ci/global.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/rules.gitlab-ci.yml'
   # gmxapi Python package.
-  - local: '/admin/gitlab-ci/python-gmxapi01.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/python-gmxapi02.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/python-gmxapi.matrix.gitlab-ci.yml'
   # Further API validation and usability of sample gmxapi extension package.
-  - local: '/admin/gitlab-ci/sample_restraint.gitlab-ci.yml'
-  # API regression testing using sample gmxapi extension package.
-  - local: '/admin/gitlab-ci/sample_restraint-regression.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/api-client.matrix.gitlab-ci.yml'
   # Build and test GROMACS in a variety of environments and configurations.
   # To do: Consider expanding matrix here to improve transparency and reduce file sizes.
   # E.g. '/admin/gitlab-ci/matrix/clang-8.gitlab-ci.yml
index 556b4ccecdc804d03cb92ad7e4c21c9b85e5f0b5..acf105429c8cf54bf08679784dd034889958d641 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 #
-# Build, install, and test the gmxapi 0.2 Python package developed with
-# GROMACS 2021.
+# Build, install, and test the gmxapi 0.3 Python package developed with
+# GROMACS 2022.
 #
 # This script assumes an activated Python venv with the
 # gmxapi dependencies already installed, with `python` resolvable by the shell
@@ -23,7 +23,7 @@ pushd python_packaging/src
   # Ref: https://redmine.gromacs.org/issues/3273
   GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
       python setup.py sdist
-  # TODO: Identify SDIST
+  SDIST=dist/gmxapi*
 
   # Build and install from sdist.
   # Note that tool chain may be provided differently in GROMACS 2020 and 2021.
@@ -33,8 +33,7 @@ pushd python_packaging/src
           --no-deps \
           --no-index \
           --no-build-isolation \
-          dist/gmxapi*
-  # TODO: Build and install from $SDIST instead of wildcard.
+          $SDIST
 
 popd
 
diff --git a/admin/ci-scripts/build-and-test-sample_restraint-2022.sh b/admin/ci-scripts/build-and-test-sample_restraint-2022.sh
new file mode 100644 (file)
index 0000000..a813094
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+#
+# Build and test the sample_restraint package distributed with GROMACS 2022.
+#
+# This script is intended to support automated GROMACS testing infrastructure,
+# and may be removed without notice.
+#
+# WARNING: This script assumes OpenMPI mpiexec. Syntax for launch wrappers from
+# other implementations will need different syntax, and we should get a
+# MPIRUNNER from the environment, or something.
+
+# Make sure the script errors if any commands error.
+set -e
+
+pushd python_packaging/src
+  # Build and install gmxapi python package from local source.
+  # Note that tool chain may be provided differently across GROMACS versions.
+  if [ "2022" -eq "$GROMACS_MAJOR_VERSION" ]; then
+      GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
+          python -m pip install \
+              --no-cache-dir \
+              --no-deps \
+              --no-index \
+              --no-build-isolation \
+              .
+  # TODO: Get sdist artifact for other gmxapi versions.
+#    elif [ "2021" -eq "$GROMACS_MAJOR_VERSION" ]; then
+#      GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
+#          python -m pip install \
+#              --no-cache-dir \
+#              --no-deps \
+#              --no-index \
+#              --no-build-isolation \
+#              dist/gmxapi*
+  else
+      echo "Logic error in GROMACS version handling."
+      exit 1
+  fi
+popd
+
+. $INSTALL_DIR/bin/GMXRC
+pushd python_packaging/sample_restraint
+  mkdir build
+  pushd build
+    # TODO: Update with respect to https://gitlab.com/gromacs/gromacs/-/issues/3133
+    cmake .. \
+             -DDOWNLOAD_GOOGLETEST=ON \
+             -DGMXAPI_EXTENSION_DOWNLOAD_PYBIND=ON
+    make
+
+    make test
+    #TODO: Can we get ctest JUnitXML output here?
+
+    make install
+  popd
+
+  python -m pytest $PWD/tests --junitxml=$PLUGIN_TEST_XML --threads=2
+
+  # Note: Multiple pytest processes getting --junitxml output file argument
+  # may cause problems, so we set the option on only one of the launched processes.
+  # See also Multiple Instruction Multiple Data Model for OpenMPI mpirun:
+  # https://www.open-mpi.org/doc/v3.0/man1/mpiexec.1.php
+  PROGRAM=(`which python` -m mpi4py -m pytest \
+          -p no:cacheprovider \
+          $PWD/tests \
+          --threads=1)
+  # shellcheck disable=SC2068
+  if [ -x `which mpiexec` ]; then
+      PYTHONDONTWRITEBYTECODE=1 \
+      mpiexec --allow-run-as-root \
+        -x OMP_NUM_THREADS=1 \
+        --mca opal_warn_on_missing_libcuda 0 \
+        --mca orte_base_help_aggregate 0 \
+        -n 1 ${PROGRAM[@]} --junitxml=$PLUGIN_MPI_TEST_XML : \
+        -n 1 ${PROGRAM[@]}
+  fi
+popd
diff --git a/admin/gitlab-ci/api-client.matrix.gitlab-ci.yml b/admin/gitlab-ci/api-client.matrix.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..2e0c8af
--- /dev/null
@@ -0,0 +1,8 @@
+# Build and test GROMACS client code to monitor implementation of specified APIs.
+#
+# Job configurations are inside api-client.matrix/ directory.
+
+include:
+  - local: '/admin/gitlab-ci/api-client.matrix/gromacs-master.gitlab-ci.yml'
+# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/3563) Test against MPI builds.
+#  - local: '/admin/gitlab-ci/api-client.matrix/gromacs-master-mpi.gitlab-ci.yml'
diff --git a/admin/gitlab-ci/api-client.matrix/gromacs-master.gitlab-ci.yml b/admin/gitlab-ci/api-client.matrix/gromacs-master.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..863d742
--- /dev/null
@@ -0,0 +1,70 @@
+# Test goal: Continuous integration testing for gmxapi clients development branch.
+# Test intents:
+#   OS: Ubuntu oldest supported
+#   GPU: unspecified
+#   GROMACS: master
+#   gmxapi: as per GROMACS master
+#   client code: sample_restraint as bundled with GROMACS master
+#   Scope: build, install, test
+# Test implementation choices (free to change as needed):
+#   GROMACS branch: master
+#   gmxapi Python package: 0.3 alpha from GROMACS master
+#   compiler: clang-8
+
+
+.sample_restraint:clang-8:gmx2022:
+  extends:
+    - .variables:default
+    - .use-clang:base
+  image: ${CI_REGISTRY_IMAGE}/ci-ubuntu-20.04-llvm-8-cuda-11.0
+  stage: test
+  variables:
+    KUBERNETES_CPU_LIMIT: 2
+    KUBERNETES_CPU_REQUEST: 2
+    KUBERNETES_MEMORY_LIMIT: 2Gi
+    KUBERNETES_MEMORY_REQUEST: 2Gi
+    PLUGIN_TEST_XML: $CI_PROJECT_DIR/py-JUnitTestResults.xml
+    PLUGIN_MPI_TEST_XML: $CI_PROJECT_DIR/py-mpi-JUnitTestResults.xml
+    EXTRA_INSTALLS: "curl libbz2-dev libffi-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev llvm python-openssl tk-dev zlib1g-dev"
+    GROMACS_MAJOR_VERSION: 2022
+  script:
+    - source $INSTALL_DIR/bin/GMXRC
+    - source $VENVPATH/bin/activate
+    - INSTALL_DIR=$PWD/$INSTALL_DIR OMP_NUM_THREADS=1 bash admin/ci-scripts/build-and-test-sample_restraint-2022.sh
+  artifacts:
+    reports:
+      junit:
+        - $PLUGIN_TEST_XML
+        - $PLUGIN_MPI_TEST_XML
+    when: always
+    expire_in: 1 week
+  tags:
+    - k8s-scilifelab
+  # The dependency means we need to use the same tag restriction as upstream.
+  needs:
+    - job: gromacs:clang-8:build
+      artifacts: true
+
+sample_restraint:clang-8:gmx2022:py-3.7.7:
+  extends:
+    - .sample_restraint:clang-8:gmx2022
+    - .rules:merge-requests
+  variables:
+    VENVPATH: "/root/venv/py3.7"
+    PY_VER: "3.7.7"
+
+sample_restraint:clang-8:gmx2022:py-3.8.2:
+  extends:
+    - .sample_restraint:clang-8:gmx2022
+    - .rules:merge-requests
+  variables:
+    VENVPATH: "/root/venv/py3.8"
+    PY_VER: "3.8.2"
+
+sample_restraint:clang-8:gmx2022:py-3.9.1:
+  extends:
+    - .sample_restraint:clang-8:gmx2022
+    - .rules:merge-requests
+  variables:
+    VENVPATH: "/root/venv/py3.9"
+    PY_VER: "3.9.1"
index 6f8eb180d15246087ccb90f3017ef29534ca2845..1c3446dbaa5698465ba17fbcecd948bdb129ec39 100644 (file)
@@ -21,6 +21,7 @@ gromacs:clang-8:configure:
   image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-8-cuda-11.0
   variables:
     COMPILER_MAJOR_VERSION: 8
+    CMAKE_EXTRA_OPTIONS: -DGMX_INSTALL_LEGACY_API=ON
 
 gromacs:clang-8:build:
   extends:
index 9f3f5e477db4e9538e1a6b7d008914d6eb7353f9..d3010839981d0036cc39908e0fd78ef1c8fe4308 100644 (file)
@@ -27,7 +27,7 @@ gromacs:clang-9-mpi:configure:
     CMAKE: /usr/local/cmake-3.17.2/bin/cmake
     COMPILER_MAJOR_VERSION: 9
     CMAKE_PRECISION_OPTIONS: -DGMX_DOUBLE=ON
-    CMAKE_EXTRA_OPTIONS: -DGMX_CYCLE_SUBCOUNTERS=ON
+    CMAKE_EXTRA_OPTIONS: -DGMX_CYCLE_SUBCOUNTERS=ON -DGMX_INSTALL_LEGACY_API=ON
 
 gromacs:clang-9-mpi:build:
   # Test using configuration: gromacs:clang-9-mpi:configure
diff --git a/admin/gitlab-ci/python-gmxapi.matrix.gitlab-ci.yml b/admin/gitlab-ci/python-gmxapi.matrix.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..5ffa915
--- /dev/null
@@ -0,0 +1,8 @@
+# Build, test, and install Python gmxapi package.
+#
+# Job configurations are inside python-gmxapi.matrix/ directory.
+
+include:
+  - local: '/admin/gitlab-ci/python-gmxapi.matrix/gmxapi-0.3-gromacs-master.gitlab-ci.yml'
+# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/3563) Test against MPI builds.
+#  - local: '/admin/gitlab-ci/python-gmxapi.matrix/gmxapi-0.3-gromacs-master-mpi.gitlab-ci.yml'
similarity index 58%
rename from admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml
rename to admin/gitlab-ci/python-gmxapi.matrix/gmxapi-0.3-gromacs-master.gitlab-ci.yml
index 53a8605d01c98e0ee122e48135ca227aac530a47..8d08f0186e6ad22bb74a6766d1465839898886f6 100644 (file)
@@ -1,12 +1,21 @@
-#
-# Jobs to test gmxapi client (Python) packages
-#
+# Test goal: Continuous integration testing for gmxapi 0.3 and client Python package.
+# Test intents (should change rarely and conservatively):
+#   OS: Ubuntu oldest supported
+#   GPU: unspecified
+#   GROMACS: newest supported
+#   gmxapi: gmxapi 0.3
+#   Scope: build, install, test
+# Test implementation choices (free to change as needed):
+#   GROMACS branch: master
+#   gmxapi Python package: 0.3 alpha from GROMACS master
+#   compiler: clang-8
 
-.gmxapi-0.3:gcc-10:gmx2022:
+
+.gmxapi-0.3:clang-8:gmx2022:
   extends:
     - .variables:default
     - .use-clang:base
-  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-gcc-10
+  image: ${CI_REGISTRY_IMAGE}/ci-ubuntu-20.04-llvm-8-cuda-11.0
   stage: test
   variables:
     KUBERNETES_CPU_LIMIT: 2
         - $PY_MPI_UNIT_TEST_XML
         - $PY_ACCEPTANCE_TEST_XML
         - $PY_MPI_ACCEPTANCE_TEST_XML
+    paths:
+      - dist/
     when: always
     expire_in: 1 week
   tags:
     - k8s-scilifelab
   # The dependency means we need to use the same tag restriction as upstream.
   needs:
-    - job: gromacs:gcc-10:build
+    - job: gromacs:clang-8:build
       artifacts: true
 
-gmxapi-0.3:gcc-10:gmx2022:py-3.7.7:
+gmxapi-0.3:clang-8:gmx2022:py-3.7.7:
   extends:
-    - .gmxapi-0.3:gcc-10:gmx2022
+    - .gmxapi-0.3:clang-8:gmx2022
     - .rules:merge-requests:master
   variables:
     VENVPATH: "/root/venv/py3.7"
     PY_VER: "3.7.7"
 
-gmxapi-0.3:gcc-10:gmx2022:py-3.8.2:
+gmxapi-0.3:clang-8:gmx2022:py-3.8.2:
   extends:
-    - .gmxapi-0.3:gcc-10:gmx2022
+    - .gmxapi-0.3:clang-8:gmx2022
     - .rules:merge-requests:master
   variables:
     VENVPATH: "/root/venv/py3.8"
     PY_VER: "3.8.2"
+
+gmxapi-0.3:clang-8:gmx2022:py-3.9.1:
+  extends:
+    - .gmxapi-0.3:clang-8:gmx2022
+    - .rules:merge-requests:master
+  variables:
+    VENVPATH: "/root/venv/py3.9"
+    PY_VER: "3.9.1"
index 6f12994ed669e556a70bf8306d67912363adfffa..c03222cc719298101e8169e83ed041c102df6c15 100644 (file)
@@ -232,6 +232,14 @@ Other important variable keys are as follows.
     CMAKE_MPI_OPTIONS
         Provide CMake command line arguments to define GROMACS MPI build options.
 
+    GROMACS_MAJOR_VERSION
+        Read-only environment variable for CI scripts to check the
+        library API version to expect from the ``build`` job artifacts.
+        Initially, this variable is only defined in
+        :file:`admin/gitlab-ci/api-client.matrix/gromacs-master.gitlab-ci.yml`
+        but could be moved to :file:`admin/gitlab-ci/global.gitlab-ci.yml` if found
+        to be of general utility.
+
     GROMACS_RELEASE
         Read-only environment variable that can be checked to see if a job is
         executing in a pipeline for preparing a tagged release.