Begin moving `script` boiler plate from YAML to shell scripts.
authorM. Eric Irrgang <mei2n@virginia.edu>
Wed, 6 Oct 2021 16:03:56 +0000 (16:03 +0000)
committerM. Eric Irrgang <mei2n@virginia.edu>
Wed, 6 Oct 2021 16:03:56 +0000 (16:03 +0000)
Closes #4194

admin/ci-scripts/gromacs-base-build.sh [new file with mode: 0755]
admin/ci-scripts/gromacs-base-configure.sh [new file with mode: 0755]
admin/ci-scripts/gromacs-base-test.sh [new file with mode: 0755]
admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml

diff --git a/admin/ci-scripts/gromacs-base-build.sh b/admin/ci-scripts/gromacs-base-build.sh
new file mode 100755 (executable)
index 0000000..a49b78b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -e
+CMAKE=${CMAKE:-$(which cmake)}
+cd $BUILD_DIR
+$CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
+$CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
+awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log \
+      | grep -v "CMake" | tee buildErrors.log || true
+grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
+$CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
+if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
+for file in `find . -mindepth 1 -name "*.o" ! -type l` ; do echo $file ; rm $file ; done 2>&1 > remove-build-objects.log
+cd ..
diff --git a/admin/ci-scripts/gromacs-base-configure.sh b/admin/ci-scripts/gromacs-base-configure.sh
new file mode 100755 (executable)
index 0000000..8baec4c
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -e
+CMAKE=${CMAKE:-$(which cmake)}
+echo $CMAKE_COMPILER_SCRIPT
+echo $CMAKE_EXTRA_OPTIONS
+echo $CMAKE_SIMD_OPTIONS
+echo $CMAKE_GPU_OPTIONS
+echo $CMAKE_MPI_OPTIONS
+echo $CMAKE_PRECISION_OPTIONS
+echo $CMAKE_BUILD_TYPE_OPTIONS
+echo $CMAKE_GMXAPI_OPTIONS
+if [[ -d $BUILD_DIR ]] ; then
+      rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
+else
+      echo "Preparing new build directory" ;
+      mkdir $BUILD_DIR
+fi
+cd $BUILD_DIR
+$CMAKE .. \
+      -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+      $CMAKE_COMPILER_SCRIPT \
+      $CMAKE_EXTRA_OPTIONS \
+      $CMAKE_SIMD_OPTIONS \
+      $CMAKE_MPI_OPTIONS \
+      $CMAKE_PRECISION_OPTIONS \
+      $CMAKE_BUILD_TYPE_OPTIONS \
+      $CMAKE_GPU_OPTIONS \
+      $CMAKE_GMXAPI_OPTIONS \
+      -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON \
+      2>&1 | tee cmakeLog.log
+awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
+if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
+cd ..
diff --git a/admin/ci-scripts/gromacs-base-test.sh b/admin/ci-scripts/gromacs-base-test.sh
new file mode 100755 (executable)
index 0000000..fa5f514
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -e
+CMAKE=${CMAKE:-$(which cmake)}
+cd $BUILD_DIR
+export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=$CI_PROJECT_DIR/admin/ubsan-suppressions.txt
+# Needed to run MPI enabled code in the docker images, until we set up different users
+export OMPI_ALLOW_RUN_AS_ROOT=1
+export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
+export ASAN_OPTIONS="check_initialization_order=1:detect_invalid_pointer_pairs=1:strict_init_order=true:strict_string_checks=true:detect_stack_use_after_return=true"
+# If $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES is not set and we have GPUs, set it
+if [ -z $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES ] && [ -n $KUBERNETES_EXTENDED_RESOURCE_NAME ] ; then
+    if grep -q '/gpu$' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
+        echo "export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES=\"$KUBERNETES_EXTENDED_RESOURCE_LIMIT\"";
+        export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES="$KUBERNETES_EXTENDED_RESOURCE_LIMIT";
+    fi
+fi
+if grep -qF 'nvidia.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
+    nvidia-smi || true;
+fi
+if grep -qF 'amd.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
+    clinfo -l || true;
+fi
+if grep -qF 'intel.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
+    sycl-ls || true;
+fi
+ctest -D $CTEST_RUN_MODE --output-on-failure | tee ctestLog.log || true
+awk '/The following tests FAILED/,/^Errors while running CTest|^$/' ctestLog.log | tee ctestErrors.log
+xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/*.xml > JUnitTestResults.xml
+if [ -s ctestErrors.log ] ; then
+    echo "Error during running ctest";
+    exit 1;
+fi
+cd .
index 31cd3d223b24545490a98d2891d747f004bb7013..3cff82df39e0913ce23877e3982b2869e7af790f 100644 (file)
     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - echo $CMAKE_COMPILER_SCRIPT
-    - echo $CMAKE_EXTRA_OPTIONS
-    - echo $CMAKE_SIMD_OPTIONS
-    - echo $CMAKE_GPU_OPTIONS
-    - echo $CMAKE_MPI_OPTIONS
-    - echo $CMAKE_PRECISION_OPTIONS
-    - echo $CMAKE_BUILD_TYPE_OPTIONS
-    - echo $CMAKE_GMXAPI_OPTIONS
-    - if [[ -d $BUILD_DIR ]] ; then
-      rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
-      else
-      echo "Preparing new build directory" ;
-      mkdir $BUILD_DIR ;
-      fi
-    - cd $BUILD_DIR
-    - $CMAKE ..
-      -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-      $CMAKE_COMPILER_SCRIPT
-      $CMAKE_EXTRA_OPTIONS
-      $CMAKE_SIMD_OPTIONS
-      $CMAKE_MPI_OPTIONS
-      $CMAKE_PRECISION_OPTIONS
-      $CMAKE_BUILD_TYPE_OPTIONS
-      $CMAKE_GPU_OPTIONS
-      $CMAKE_GMXAPI_OPTIONS
-      -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
-      2>&1 | tee cmakeLog.log
-    - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
-    - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-configure.sh
   artifacts:
     when: always
     paths:
 .gromacs:base:build:
   stage: build
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - cd $BUILD_DIR
-    - $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
-    - $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
-    - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
-      | grep -v "CMake" | tee buildErrors.log || true
-    - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
-    - $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
-    - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
-    - for file in `find . -mindepth 1 -name "*.o" ! -type l` ; do echo $file ; rm $file ; done 2>&1 > remove-build-objects.log
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-build.sh
   artifacts:
     when: always
     paths:
   variables:
     CTEST_RUN_MODE: "ExperimentalTest"
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - cd $BUILD_DIR
-    - export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=$CI_PROJECT_DIR/admin/ubsan-suppressions.txt
-    # Needed to run MPI enabled code in the docker images, until we set up different users
-    - export OMPI_ALLOW_RUN_AS_ROOT=1
-    - export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
-    - export ASAN_OPTIONS="check_initialization_order=1:detect_invalid_pointer_pairs=1:strict_init_order=true:strict_string_checks=true:detect_stack_use_after_return=true"
-    # If $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES is not set and we have GPUs, set it
-    - if [ -z $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES ] && [ -n $KUBERNETES_EXTENDED_RESOURCE_NAME ] ; then
-      if grep -q '/gpu$' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      echo "export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES=\"$KUBERNETES_EXTENDED_RESOURCE_LIMIT\"";
-      export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES="$KUBERNETES_EXTENDED_RESOURCE_LIMIT";
-      fi
-      fi
-    - if grep -qF 'nvidia.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      nvidia-smi || true;
-      fi
-    - if grep -qF 'amd.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      clinfo -l || true;
-      fi
-    - if grep -qF 'intel.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      sycl-ls || true;
-      fi
-    - ctest -D $CTEST_RUN_MODE --output-on-failure | tee ctestLog.log || true
-    - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
-      ctestLog.log | tee ctestErrors.log
-    - xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/*.xml > JUnitTestResults.xml
-    - if [ -s ctestErrors.log ] ; then
-      echo "Error during running ctest";
-      exit 1;
-      fi
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-test.sh
   artifacts:
     reports:
       junit: $BUILD_DIR/JUnitTestResults.xml