From b04301da4dfc926ecc8dada7e01ef6244ae8d97b Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Wed, 6 Oct 2021 16:03:56 +0000 Subject: [PATCH] Begin moving `script` boiler plate from YAML to shell scripts. Closes #4194 --- admin/ci-scripts/gromacs-base-build.sh | 13 ++++ admin/ci-scripts/gromacs-base-configure.sh | 33 +++++++++ admin/ci-scripts/gromacs-base-test.sh | 33 +++++++++ admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml | 77 +------------------- 4 files changed, 82 insertions(+), 74 deletions(-) create mode 100755 admin/ci-scripts/gromacs-base-build.sh create mode 100755 admin/ci-scripts/gromacs-base-configure.sh create mode 100755 admin/ci-scripts/gromacs-base-test.sh diff --git a/admin/ci-scripts/gromacs-base-build.sh b/admin/ci-scripts/gromacs-base-build.sh new file mode 100755 index 0000000000..a49b78b125 --- /dev/null +++ b/admin/ci-scripts/gromacs-base-build.sh @@ -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 index 0000000000..8baec4c8d3 --- /dev/null +++ b/admin/ci-scripts/gromacs-base-configure.sh @@ -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 index 0000000000..fa5f5142c5 --- /dev/null +++ b/admin/ci-scripts/gromacs-base-test.sh @@ -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 . diff --git a/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml b/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml index 31cd3d223b..3cff82df39 100644 --- a/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml +++ b/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml @@ -19,37 +19,7 @@ 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: @@ -143,17 +113,7 @@ .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: @@ -186,38 +146,7 @@ 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 -- 2.22.0