From 501278282a04712b490eccc7519e23f71f20a3a7 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Wed, 10 May 2023 16:44:20 -0400 Subject: [PATCH 1/2] BP5: fixes memory error with IBM XL --- source/adios2/engine/bp5/BP5Writer.cpp | 8 +++++--- .../toolkit/format/bp5/BP5Serializer.cpp | 20 +++++++++++++------ .../adios2/toolkit/format/bp5/BP5Serializer.h | 14 +++---------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/source/adios2/engine/bp5/BP5Writer.cpp b/source/adios2/engine/bp5/BP5Writer.cpp index 7c5af59723..6c8e9293e6 100644 --- a/source/adios2/engine/bp5/BP5Writer.cpp +++ b/source/adios2/engine/bp5/BP5Writer.cpp @@ -547,12 +547,14 @@ void BP5Writer::EndStep() m_Profiler.Start("AWD"); // TSInfo destructor would delete the DataBuffer so we need to save it // for async IO and let the writer free it up when not needed anymore - adios2::format::BufferV *databuf = TSInfo.DataBuffer; - TSInfo.DataBuffer = NULL; m_AsyncWriteLock.lock(); m_flagRush = false; m_AsyncWriteLock.unlock(); - WriteData(databuf); + + // WriteData will free TSInfo.DataBuffer + WriteData(TSInfo.DataBuffer); + TSInfo.DataBuffer = NULL; + m_Profiler.Stop("AWD"); /* diff --git a/source/adios2/toolkit/format/bp5/BP5Serializer.cpp b/source/adios2/toolkit/format/bp5/BP5Serializer.cpp index 06d2176856..af4c780cf3 100644 --- a/source/adios2/toolkit/format/bp5/BP5Serializer.cpp +++ b/source/adios2/toolkit/format/bp5/BP5Serializer.cpp @@ -1333,19 +1333,27 @@ BP5Serializer::TimestepInfo BP5Serializer::CloseTimestep(int timestep, MBase->BitField = tmp; NewAttribute = false; - struct TimestepInfo Ret - { - Formats, Metadata, AttrData, CurDataBuffer - }; + struct TimestepInfo Ret; + Ret.NewMetaMetaBlocks = Formats; + Ret.MetaEncodeBuffer.reset(Metadata); + Ret.AttributeEncodeBuffer.reset(AttrData); + Ret.DataBuffer = CurDataBuffer; CurDataBuffer = NULL; + if (Info.AttributeFields) + { free_FMfield_list(Info.AttributeFields); - Info.AttributeFields = NULL; + Info.AttributeFields = NULL; + } Info.AttributeFieldCount = 0; + if (Info.AttributeData) + { free(Info.AttributeData); - Info.AttributeData = NULL; + Info.AttributeData = NULL; + } Info.AttributeSize = 0; + return Ret; } diff --git a/source/adios2/toolkit/format/bp5/BP5Serializer.h b/source/adios2/toolkit/format/bp5/BP5Serializer.h index 5ceeb54dad..b0f225b0df 100644 --- a/source/adios2/toolkit/format/bp5/BP5Serializer.h +++ b/source/adios2/toolkit/format/bp5/BP5Serializer.h @@ -36,17 +36,9 @@ class BP5Serializer : virtual public BP5Base struct TimestepInfo { std::vector NewMetaMetaBlocks; - Buffer *MetaEncodeBuffer; - Buffer *AttributeEncodeBuffer; - BufferV *DataBuffer; - - ~TimestepInfo() - { - delete MetaEncodeBuffer; - if (AttributeEncodeBuffer) - delete AttributeEncodeBuffer; - delete DataBuffer; - } + std::shared_ptr MetaEncodeBuffer; + std::shared_ptr AttributeEncodeBuffer; + BufferV* DataBuffer; }; typedef struct _MetadataInfo From cf7a879f54290a019228e2397e72a8e5e3d05fe1 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Fri, 5 May 2023 17:10:02 -0400 Subject: [PATCH 2/2] ci,ascent: enable ascent builds --- .gitlab/gitlab-ci-ascent.yml | 130 ++++++++++++++++++ .gitlab/gitlab-ci-gitlabdotcom.yml | 6 - .gitlab/gitlab-ci-olcf.yml | 28 ---- .gitlab/kokkos.sh | 30 ++++ .shellcheck_exclude_paths | 1 - CTestCustom.cmake.in | 2 + scripts/ci/cmake-v2/ci-ascent-cuda.cmake | 27 ++++ .../ci/cmake-v2/ci-ascent-kokkos-cuda.cmake | 32 +++++ scripts/ci/cmake-v2/ci-ascent-nvhpc.cmake | 30 ++++ .../ci/{cmake => cmake-v2}/ci-ascent-xl.cmake | 30 ++-- scripts/ci/cmake/ci-ascent-gcc.cmake | 38 ----- scripts/ci/gitlab-ci/run.sh | 73 +++++----- 12 files changed, 304 insertions(+), 123 deletions(-) create mode 100644 .gitlab/gitlab-ci-ascent.yml delete mode 100644 .gitlab/gitlab-ci-gitlabdotcom.yml delete mode 100644 .gitlab/gitlab-ci-olcf.yml create mode 100755 .gitlab/kokkos.sh create mode 100644 scripts/ci/cmake-v2/ci-ascent-cuda.cmake create mode 100644 scripts/ci/cmake-v2/ci-ascent-kokkos-cuda.cmake create mode 100644 scripts/ci/cmake-v2/ci-ascent-nvhpc.cmake rename scripts/ci/{cmake => cmake-v2}/ci-ascent-xl.cmake (53%) delete mode 100644 scripts/ci/cmake/ci-ascent-gcc.cmake diff --git a/.gitlab/gitlab-ci-ascent.yml b/.gitlab/gitlab-ci-ascent.yml new file mode 100644 index 0000000000..1d1e5c0a95 --- /dev/null +++ b/.gitlab/gitlab-ci-ascent.yml @@ -0,0 +1,130 @@ +# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Ascent. +.setup_env_ecpci: &setup_env_ecpci | + module purge + module load ${JOB_MODULES} + module list + export PATH="/gpfs/wolf/csc303/scratch/vbolea/ci/utils:$PATH" + +.ascent-common: + except: + - schedules + tags: + - batch + interruptible: true + variables: + CCACHE_BASEDIR: "/gpfs/wolf/" + CCACHE_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/ccache" + # -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it + CCACHE_IGNOREOPTIONS: "-isystem=*" + CCACHE_NOHASHDIR: "true" + + CUDAHOSTCXX: "g++" + CUSTOM_CI_BUILDS_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/adios2" + GITLAB_SITE: "OLCF Ascent" + SCHEDULER_PARAMETERS: -P CSC303 -W 1:00 -nnodes 1 -alloc_flags gpudefault + before_script: + - *setup_env_ecpci + - ccache -z + script: + - bash scripts/ci/gitlab-ci/run.sh update + - bash scripts/ci/gitlab-ci/run.sh configure + - jsrun -n1 -a1 -g1 -c40 -bpacked:40 bash scripts/ci/gitlab-ci/run.sh build + - jsrun -n1 -a1 -g1 -c2 bash scripts/ci/gitlab-ci/run.sh test + after_script: + - *setup_env_ecpci + - bash scripts/ci/gitlab-ci/run.sh submit + - ccache -s + +ascent-cuda: + variables: + # Order matters + JOB_MODULES: >- + DefApps + zstd + cuda/11.4.2 + git + gcc/10.2.0 + ninja + spectrum-mpi + lsf-tools + libffi + hdf5 + cmake + extends: + - .ascent-common + +ascent-kokkos-cuda: + variables: + # Order matters + JOB_MODULES: >- + DefApps + zstd + cuda/11.4.2 + git + gcc/10.2.0 + ninja + spectrum-mpi + lsf-tools + libffi + hdf5 + cmake + KOKKOS_OPTS: >- + -DKokkos_ARCH_POWER9=ON + -DKokkos_ARCH_VOLTA70=ON + -DKokkos_ENABLE_CUDA=ON + -DKokkos_ENABLE_CUDA_LAMBDA=ON + -DCMAKE_INSTALL_PREFIX:PATH=$CI_BUILDS_DIR/kokkos_install + + Kokkos_DIR: $CI_BUILDS_DIR/kokkos_install + before_script: + - *setup_env_ecpci + - ccache -z + - .gitlab/kokkos.sh "$CI_BUILDS_DIR" "3.7.01" $KOKKOS_OPTS + extends: + - .ascent-common + +ascent-nvhpc: + variables: + # Order matters + JOB_MODULES: >- + DefApps + zstd + nvhpc + git + spectrum-mpi + lsf-tools + libffi + hdf5 + cmake + extends: + - .ascent-common + +ascent-xl: + variables: + # Order matters + JOB_MODULES: >- + DefApps + zstd + cuda/11.4.2 + git + xl + ninja + spectrum-mpi + lsf-tools + libffi + hdf5 + cmake + extends: + - .ascent-common + +sync-github-prs: + tags: + - nobatch + only: + - schedules + variables: + GIT_STRATEGY: none + CUSTOM_CI_BUILDS_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/adios2" + script: + - export PATH="/gpfs/wolf/csc303/scratch/vbolea/ci/utils:$PATH" + - SpackCIBridge.py ornladios/ADIOS2 git@code.ornl.gov:ecpcitest/adios2.git https://code.ornl.gov/ ecpcitest/adios2 --prereq-check=format --prereq-check=git_checks diff --git a/.gitlab/gitlab-ci-gitlabdotcom.yml b/.gitlab/gitlab-ci-gitlabdotcom.yml deleted file mode 100644 index eba4958546..0000000000 --- a/.gitlab/gitlab-ci-gitlabdotcom.yml +++ /dev/null @@ -1,6 +0,0 @@ -sync-github-prs: - tags: linux - only: - - schedules - script: - - scripts/ci/scripts/github-prs-to-gitlab.sh ornladios/adios2 code.ornl.gov ecpcitest/adios2 diff --git a/.gitlab/gitlab-ci-olcf.yml b/.gitlab/gitlab-ci-olcf.yml deleted file mode 100644 index ac593185a1..0000000000 --- a/.gitlab/gitlab-ci-olcf.yml +++ /dev/null @@ -1,28 +0,0 @@ -.all-steps: - except: - - schedules - variables: - GITLAB_SITE: "OLCF GitLab" - CMAKE_ENV_MODULE: "cmake" - script: - - bash scripts/ci/gitlab-ci/run.sh update - - bash scripts/ci/gitlab-ci/run.sh configure - - bash scripts/ci/gitlab-ci/run.sh build - - bash scripts/ci/gitlab-ci/run.sh test - -ascent-xl: - extends: - - .all-steps - tags: [nobatch] - -ascent-gcc: - extends: - - .all-steps - tags: [nobatch] - -#ascent-xl-smpi: -# extends: -# - .all-steps -# tags: [batch] -# variables: -# SCHEDULER_PARAMETERS: "-P CSC303 -W 1:00 -nnodes 1" diff --git a/.gitlab/kokkos.sh b/.gitlab/kokkos.sh new file mode 100755 index 0000000000..698fe84ac7 --- /dev/null +++ b/.gitlab/kokkos.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -x + +WORKDIR="$1" +VERSION="$2" + +shift 2 + +if [ ! -d "$WORKDIR" ] || [ -z "$VERSION" ] +then + echo "[E] missing args: Invoke as .gitlab/ci/config/kokkos.sh [extra_args]" + exit 1 +fi + +# Build and install Kokkos +curl -L "https://github.com/kokkos/kokkos/archive/refs/tags/$VERSION.tar.gz" \ + | tar -C "$WORKDIR" -xzf - + +cmake -S "$WORKDIR/kokkos-$VERSION" -B "$WORKDIR/kokkos_build" \ + "-DBUILD_SHARED_LIBS=ON" \ + "-DCMAKE_BUILD_TYPE:STRING=release" \ + "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" \ + "-DCMAKE_CXX_STANDARD:STRING=17" \ + "-DCMAKE_CXX_EXTENSIONS:BOOL=OFF" \ + "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON" \ + "-DCMAKE_CXX_COMPILER:STRING=$WORKDIR/kokkos-$VERSION/bin/nvcc_wrapper" \ + $* + +cmake --build "$WORKDIR/kokkos_build" +cmake --install "$WORKDIR/kokkos_build" diff --git a/.shellcheck_exclude_paths b/.shellcheck_exclude_paths index a0e74e4ee1..1bd1cb33a0 100644 --- a/.shellcheck_exclude_paths +++ b/.shellcheck_exclude_paths @@ -8,7 +8,6 @@ scripts/ci/gh-actions/get-changed-files.sh scripts/ci/gh-actions/linux-setup.sh scripts/ci/gh-actions/macos-setup.sh scripts/ci/gh-actions/run.sh -scripts/ci/gitlab-ci/run.sh scripts/ci/images-v2/build-base.sh scripts/ci/images-v2/build-clang-base.sh scripts/ci/images-v2/build-clang.sh diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 3395c65291..e118eb3e31 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -22,6 +22,8 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "warning: template parameter ... is not used in declaring the parameter types of function template" "warning: command-line option '.*' is valid for Fortran but not for C" "Warning #20208-D: '.*' is treated as '.*' in device code" + "Warning: '.*' is treated as '.*' in device code" + ".*was specified as both a system and non-system include directory.*" ) list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE ".*/thirdparty/.*" diff --git a/scripts/ci/cmake-v2/ci-ascent-cuda.cmake b/scripts/ci/cmake-v2/ci-ascent-cuda.cmake new file mode 100644 index 0000000000..93febd6614 --- /dev/null +++ b/scripts/ci/cmake-v2/ci-ascent-cuda.cmake @@ -0,0 +1,27 @@ +# Client maintainer: vicente.bolea@kitware.com + +set(dashboard_cache " +ADIOS2_USE_BZip2:BOOL=OFF +ADIOS2_USE_CUDA:BOOL=ON +ADIOS2_USE_DataMan:BOOL=ON +ADIOS2_USE_Fortran:BOOL=ON +ADIOS2_USE_MPI:BOOL=OFF +ADIOS2_USE_PNG:BOOL=OFF +ADIOS2_USE_Python:BOOL=OFF +ADIOS2_USE_SST:BOOL=ON + +CMAKE_C_COMPILER_LAUNCHER=ccache +CMAKE_CXX_COMPILER_LAUNCHER=ccache +CMAKE_CUDA_COMPILER_LAUNCHER=ccache +CMAKE_DISABLE_FIND_PACKAGE_BISON=ON +CMAKE_DISABLE_FIND_PACKAGE_FLEX=ON +CMAKE_Fortran_FLAGS:STRING=-Wall +") + +set(CTEST_TEST_ARGS + PARALLEL_LEVEL 8 + EXCLUDE ".*/BPWRCUDA.ADIOS2BPCUDAWrong/.*BP4.Serial|.*/BPWRCUDA.ADIOS2BPCUDAMemSel/.*BP4.Serial" + ) +set(CTEST_CMAKE_GENERATOR "Ninja") +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/cmake-v2/ci-ascent-kokkos-cuda.cmake b/scripts/ci/cmake-v2/ci-ascent-kokkos-cuda.cmake new file mode 100644 index 0000000000..b906bed2e6 --- /dev/null +++ b/scripts/ci/cmake-v2/ci-ascent-kokkos-cuda.cmake @@ -0,0 +1,32 @@ +# Client maintainer: vicente.bolea@kitware.com + +set(kokkos_install_path $ENV{Kokkos_DIR}) + +set(ENV{CC} gcc) +set(ENV{CXX} g++) +set(ENV{FC} gfortran) + +set(dashboard_cache " +ADIOS2_USE_BZip2:BOOL=OFF +ADIOS2_USE_DataMan:BOOL=ON +ADIOS2_USE_Fortran:BOOL=OFF +ADIOS2_USE_MPI:BOOL=OFF +ADIOS2_USE_PNG:BOOL=OFF +ADIOS2_USE_Python:BOOL=OFF +ADIOS2_USE_SST:BOOL=ON +ADIOS2_USE_Kokkos=ON + +CMAKE_C_COMPILER_LAUNCHER=ccache +CMAKE_CXX_COMPILER_LAUNCHER=ccache +CMAKE_CUDA_COMPILER_LAUNCHER=ccache +CMAKE_DISABLE_FIND_PACKAGE_BISON=ON +CMAKE_DISABLE_FIND_PACKAGE_FLEX=ON +") + +set(CTEST_TEST_ARGS + PARALLEL_LEVEL 8 + EXCLUDE ".*/BPWRCUDA.ADIOS2BPCUDAWrong/.*BP4.Serial|.*/BPWRCUDA.ADIOS2BPCUDAMemSel/.*BP4.Serial|Engine.Staging.TestThreads.*" + ) +set(CTEST_CMAKE_GENERATOR "Ninja") +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/cmake-v2/ci-ascent-nvhpc.cmake b/scripts/ci/cmake-v2/ci-ascent-nvhpc.cmake new file mode 100644 index 0000000000..c6aa75d3b9 --- /dev/null +++ b/scripts/ci/cmake-v2/ci-ascent-nvhpc.cmake @@ -0,0 +1,30 @@ +# Client maintainer: vicente.bolea@kitware.com + +set(ENV{CC} nvc) +set(ENV{CXX} nvc++) +set(ENV{FC} nvfortran) + +set(dashboard_cache " +ADIOS2_USE_BZip2:BOOL=OFF +ADIOS2_USE_CUDA:BOOL=ON +ADIOS2_USE_DataMan:BOOL=ON +ADIOS2_USE_Fortran:BOOL=ON +ADIOS2_USE_MPI:BOOL=OFF +ADIOS2_USE_PNG:BOOL=OFF +ADIOS2_USE_Python:BOOL=OFF +ADIOS2_USE_SST:BOOL=ON + +CMAKE_C_COMPILER_LAUNCHER=ccache +CMAKE_CXX_COMPILER_LAUNCHER=ccache +CMAKE_DISABLE_FIND_PACKAGE_BISON=ON +CMAKE_DISABLE_FIND_PACKAGE_FLEX=ON +CMAKE_NINJA_FORCE_RESPONSE_FILE=OFF +") + +set(CTEST_TEST_ARGS + PARALLEL_LEVEL 8 + EXCLUDE ".*/BPWRCUDA.ADIOS2BPCUDAWrong/.*BP4.Serial|.*/BPWRCUDA.ADIOS2BPCUDAMemSel/.*BP4.Serial|Install.*Fortran" + ) +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/cmake/ci-ascent-xl.cmake b/scripts/ci/cmake-v2/ci-ascent-xl.cmake similarity index 53% rename from scripts/ci/cmake/ci-ascent-xl.cmake rename to scripts/ci/cmake-v2/ci-ascent-xl.cmake index fec3729755..9f73bab0de 100644 --- a/scripts/ci/cmake/ci-ascent-xl.cmake +++ b/scripts/ci/cmake-v2/ci-ascent-xl.cmake @@ -1,15 +1,4 @@ -# Client maintainer: chuck.atkins@kitware.com - -find_package(EnvModules REQUIRED) - -env_module(purge) -env_module(load git) -env_module(load xl) -env_module(load hdf5) -env_module(load libfabric) -env_module(load python/3.7.0) -env_module(load zfp) -env_module(load zeromq) +# Client maintainer: vicente.bolea@kitware.com set(ENV{CC} xlc) set(ENV{CXX} xlc++) @@ -17,20 +6,25 @@ set(ENV{FC} xlf) set(dashboard_cache " ADIOS2_USE_BZip2:BOOL=OFF -ADIOS2_USE_Blosc:BOOL=OFF ADIOS2_USE_DataMan:BOOL=ON -ADIOS2_USE_Fortran:BOOL=ON -ADIOS2_USE_HDF5:BOOL=ON +ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=OFF +ADIOS2_USE_PNG:BOOL=OFF ADIOS2_USE_Python:BOOL=OFF ADIOS2_USE_SST:BOOL=ON -ADIOS2_USE_SZ:BOOL=OFF -ADIOS2_USE_ZeroMQ:STRING=ON +ADIOS2_USE_ZeroMQ:STRING=OFF ADIOS2_USE_ZFP:BOOL=OFF +ADIOS2_USE_SZ:BOOL=OFF +ADIOS2_USE_Blosc:BOOL=OFF + +CMAKE_C_COMPILER_LAUNCHER=ccache +CMAKE_CXX_COMPILER_LAUNCHER=ccache +CMAKE_DISABLE_FIND_PACKAGE_BISON=ON +CMAKE_DISABLE_FIND_PACKAGE_FLEX=ON ") set(NCPUS 4) set(CTEST_TEST_ARGS PARALLEL_LEVEL 8) -set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_CMAKE_GENERATOR "Ninja") list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/cmake/ci-ascent-gcc.cmake b/scripts/ci/cmake/ci-ascent-gcc.cmake deleted file mode 100644 index ebf1fd0743..0000000000 --- a/scripts/ci/cmake/ci-ascent-gcc.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# Client maintainer: chuck.atkins@kitware.com - -find_package(EnvModules REQUIRED) - -env_module(purge) -env_module(load git) -env_module(load gcc/8.1.1) -env_module(load hdf5) -env_module(load libfabric) -env_module(load python/3.7.0) -env_module(load zfp) -env_module(load zeromq) - -set(ENV{CC} gcc) -set(ENV{CXX} g++) -set(ENV{FC} gfortran) - -set(dashboard_cache " -ADIOS2_USE_BZip2:BOOL=OFF -ADIOS2_USE_Blosc:BOOL=OFF -ADIOS2_USE_DataMan:BOOL=ON -ADIOS2_USE_Fortran:BOOL=ON -ADIOS2_USE_HDF5:BOOL=ON -ADIOS2_USE_MPI:BOOL=OFF -ADIOS2_USE_Python:BOOL=OFF -ADIOS2_USE_SST:BOOL=ON -ADIOS2_USE_SZ:BOOL=OFF -ADIOS2_USE_ZeroMQ:STRING=ON -ADIOS2_USE_ZFP:BOOL=OFF - -CMAKE_Fortran_FLAGS:STRING=-Wall -") - -set(NCPUS 4) -set(CTEST_TEST_ARGS PARALLEL_LEVEL 8) -set(CTEST_CMAKE_GENERATOR "Unix Makefiles") -list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") -include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake) diff --git a/scripts/ci/gitlab-ci/run.sh b/scripts/ci/gitlab-ci/run.sh index 05ccc39c9a..02ee8c630f 100755 --- a/scripts/ci/gitlab-ci/run.sh +++ b/scripts/ci/gitlab-ci/run.sh @@ -1,48 +1,57 @@ #!/bin/bash --login - -if [ -n "${GITLAB_SITE}" ] -then - export CI_SITE_NAME="${GITLAB_SITE}" -else - export CI_SITE_NAME="GitLab CI" -fi +set -e export CI_BUILD_NAME="${CI_COMMIT_BRANCH#github/}_${CI_JOB_NAME}" -export CI_SOURCE_DIR="${CI_PROJECT_DIR}" -export CI_ROOT_DIR="${CI_PROJECT_DIR}/.." -export CI_BIN_DIR="${CI_ROOT_DIR}/${CI_BUILD_NAME}" export CI_COMMIT_REF=${CI_COMMIT_SHA} +export CI_ROOT_DIR="${CI_PROJECT_DIR}/.." +export CI_SITE_NAME="${GITLAB_SITE}" +export CI_SOURCE_DIR="${CI_PROJECT_DIR}" -STEP=$1 -CTEST_SCRIPT=scripts/ci/cmake/ci-${CI_JOB_NAME}.cmake - -# Update and Test steps enable an extra step -CTEST_STEP_ARGS="" -case ${STEP} in - test) CTEST_STEP_ARGS="${CTEST_STEP_ARGS} -Ddashboard_do_end=ON" ;; -esac -CTEST_STEP_ARGS="${CTEST_STEP_ARGS} -Ddashboard_do_${STEP}=ON" +export CI_BIN_DIR="${CI_ROOT_DIR}/${CI_BUILD_NAME}" -if [ -n "${CMAKE_ENV_MODULE}" ] +readonly CTEST_SCRIPT=scripts/ci/cmake-v2/ci-${CI_JOB_NAME}.cmake +if [ ! -f "$CTEST_SCRIPT" ] then - module load ${CMAKE_ENV_MODULE} + echo "[E] Variable files does not exits: $CTEST_SCRIPT" + exit 1 +fi - echo "**********module avail Begin************" - module avail - echo "**********module avail End**************" +readonly STEP=$1 +if [ -z "$STEP" ] +then + echo "[E] No argument given: $*" + exit 2 fi -CTEST=ctest +# In OLCF Gitlab our PRs branches tip commit is not the head commit of the PR, +# it is instead the so called merged_commit_sha as described in the GitHub Rest +# API for pull requests. We need to report to the CDASH the original commit +# thus, we set it here using the CTEST_UPDATE_VERSION_OVERRIDE CMake variable +if [[ ${CI_COMMIT_BRANCH} =~ ^pr[0-9]+_.*$ ]] +then + # Original commit it is always its 2nd parent + original_sha=$(git rev-parse "${CI_COMMIT_REF}^2") + readonly UPDATE_ARGS="-DCTEST_UPDATE_VERSION_OVERRIDE=${original_sha}" +fi -echo "**********Env Begin**********" -env | sort -echo "**********Env End************" +declare -a CTEST_STEP_ARGS=("-Ddashboard_full=OFF") +case ${STEP} in + update) CTEST_STEP_ARGS+=("${UPDATE_ARGS}") ;; + build) CTEST_STEP_ARGS+=("-Ddashboard_do_submit=OFF") ;; + test) CTEST_STEP_ARGS+=("-Ddashboard_do_submit=OFF") ;; + submit) CTEST_STEP_ARGS+=("-Ddashboard_do_submit_only=ON" "-Ddashboard_do_build=ON" "-Ddashboard_do_test=ON") ;; +esac +CTEST_STEP_ARGS+=("-Ddashboard_do_${STEP}=ON") echo "**********CTest Begin**********" -${CTEST} --version -echo ${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS} -${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS} +echo "ctest -VV -S ${CTEST_SCRIPT} ${CTEST_STEP_ARGS[*]}" +ctest -VV -S "${CTEST_SCRIPT}" "${CTEST_STEP_ARGS[@]}" RET=$? echo "**********CTest End************" -exit ${RET} +# EC: 0-127 this script errors, 128-INF ctest errors +if [ $RET -ne 0 ] +then + (( RET += 127 )) +fi +exit $RET