Skip to content

Commit

Permalink
ci: add the possitility to use other build generators than ninja insi…
Browse files Browse the repository at this point in the history
…de the ci (#3276)

* Add possibility to use other build generators than ninja in ci.

---------

Co-authored-by: Gaetan <gaetan.fuss.fr@gmail.com>
Co-authored-by: Randolph Settgast <settgast1@llnl.gov>
  • Loading branch information
3 people committed Sep 17, 2024
1 parent 9b5fe5e commit 68c46fd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ on:
type: string
LOCAL_BASELINE_DIR:
required: false
type: string
type: string
BUILD_GENERATOR:
required: false
type: string
default: '--ninja'
secrets:
GOOGLE_CLOUD_GCP:
required: false
Expand Down Expand Up @@ -140,6 +144,10 @@ jobs:
script_args+=(--nproc ${NPROC})
fi
if [[ -n "${{ inputs.BUILD_GENERATOR }}" ]]; then
script_args+=(${{ inputs.BUILD_GENERATOR }})
fi
docker_args+=(${{ inputs.DOCKER_RUN_ARGS }})
COMMIT=${{ github.event.pull_request.head.sha }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ jobs:
- name: Ubuntu CUDA debug (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89)
BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema"
CMAKE_BUILD_TYPE: Debug
BUILD_GENERATOR: "--ninja"
DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89
ENABLE_HYPRE_DEVICE: CUDA
ENABLE_HYPRE: ON
Expand All @@ -288,6 +289,7 @@ jobs:
- name: Ubuntu CUDA (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89)
BUILD_AND_TEST_CLI_ARGS: "--no-install-schema"
CMAKE_BUILD_TYPE: Release
BUILD_GENERATOR: "--ninja"
DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89
ENABLE_HYPRE_DEVICE: CUDA
ENABLE_HYPRE: ON
Expand All @@ -297,10 +299,11 @@ jobs:
DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia --gpus all -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro"
DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates"
DOCKER_CERTS_UPDATE_COMMAND: "update-ca-certificates"

- name: Rockylinux CUDA (8, clang 17.0.6, cuda 12.5.1)
BUILD_AND_TEST_CLI_ARGS: "--no-install-schema"
CMAKE_BUILD_TYPE: Release
BUILD_GENERATOR: "--ninja"
ENABLE_HYPRE_DEVICE: CUDA
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
Expand All @@ -314,6 +317,7 @@ jobs:
- name: Rockylinux CUDA (8, gcc 8.5, cuda 12.5.1)
BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema"
CMAKE_BUILD_TYPE: Release
BUILD_GENERATOR: "--ninja"
ENABLE_HYPRE_DEVICE: CUDA
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
Expand All @@ -330,6 +334,7 @@ jobs:
with:
BUILD_AND_TEST_CLI_ARGS: ${{ matrix.BUILD_AND_TEST_CLI_ARGS }}
CMAKE_BUILD_TYPE: ${{ matrix.CMAKE_BUILD_TYPE }}
BUILD_GENERATOR: ${{ matrix.BUILD_GENERATOR }}
DOCKER_CERTS_DIR: ${{ matrix.DOCKER_CERTS_DIR }}
DOCKER_CERTS_UPDATE_COMMAND: ${{ matrix.DOCKER_CERTS_UPDATE_COMMAND }}
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }}
Expand Down
33 changes: 22 additions & 11 deletions scripts/ci_build_and_test_in_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Usage: $0
The host-config. Path is relative to the root of the repository.
--install-dir-basename GEOS-e42ffc1
GEOS installation basename.
--makefile
Use "Unix Makefiles" as build system generator.
--ninja
Use "Ninja" as build system generator.
--no-install-schema
Do not install the xsd schema.
--no-run-unit-tests
Expand All @@ -68,10 +72,11 @@ exit 1
or_die cd $(dirname $0)/..

# Parsing using getopt
args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,exchange-dir:,host-config:,install-dir-basename:,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@")
args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@")

# Variables with default values
BUILD_EXE_ONLY=false
BUILD_GENERATOR=""
GEOS_INSTALL_SCHEMA=true
HOST_CONFIG="host-configs/environment.cmake"
RUN_UNIT_TESTS=true
Expand All @@ -91,6 +96,9 @@ do
RUN_UNIT_TESTS=false
shift;;
--cmake-build-type) CMAKE_BUILD_TYPE=$2; shift 2;;
--ninja)
BUILD_GENERATOR=$1;
shift;;
--data-basename)
DATA_BASENAME=$2
DATA_BASENAME_WE=${DATA_BASENAME%%.*}
Expand All @@ -104,6 +112,7 @@ do
--exchange-dir) DATA_EXCHANGE_DIR=$2; shift 2;;
--host-config) HOST_CONFIG=$2; shift 2;;
--install-dir-basename) GEOS_DIR=${GEOSX_TPL_DIR}/../$2; shift 2;;
--makefile) BUILD_GENERATOR=""; shift;;
--no-install-schema) GEOS_INSTALL_SCHEMA=false; shift;;
--no-run-unit-tests) RUN_UNIT_TESTS=false; shift;;
--nproc) NPROC=$2; shift 2;;
Expand Down Expand Up @@ -211,7 +220,7 @@ fi
# The option `--oversubscribe` tells OpenMPI to allow more MPI ranks than the node has cores.
# This is needed because our unit test `blt_mpi_smoke` is run in parallel with _hard coded_ 4 ranks.
# While some of our ci nodes may have less cores available.
#
#
# In case we have more powerful nodes, consider removing `--oversubscribe` and use `--use-hwthread-cpus` instead.
# This will tells OpenMPI to discover the number of hardware threads on the node,
# and use that as the number of slots available. (There is a distinction between threads and cores).
Expand All @@ -221,7 +230,7 @@ or_die python3 scripts/config-build.py \
-bt ${CMAKE_BUILD_TYPE} \
-bp ${GEOS_BUILD_DIR} \
-ip ${GEOS_DIR} \
--ninja \
${BUILD_GENERATOR} \
-DBLT_MPI_COMMAND_APPEND='"--allow-run-as-root;--oversubscribe"' \
-DGEOS_INSTALL_SCHEMA=${GEOS_INSTALL_SCHEMA} \
-DENABLE_COVERAGE=$([[ "${CODE_COVERAGE}" = true ]] && echo 1 || echo 0) \
Expand All @@ -245,10 +254,10 @@ fi

# Performing the requested build.
if [[ "${BUILD_EXE_ONLY}" = true ]]; then
or_die ninja -j $NPROC geosx
or_die cmake --build . -j $NPROC --target geosx
else
or_die ninja -j $NPROC
or_die ninja install
or_die cmake --build . -j $NPROC
or_die cmake --install .

if [[ ! -z "${DATA_BASENAME_WE}" ]]; then
# Here we pack the installation.
Expand All @@ -269,7 +278,7 @@ if [[ ! -z "${SCCACHE_CREDS}" ]]; then
fi

if [[ "${CODE_COVERAGE}" = true ]]; then
or_die ninja coreComponents_coverage
or_die cmake --build . --target coreComponents_coverage
cp -r ${GEOS_BUILD_DIR}/coreComponents_coverage.info.cleaned ${GEOS_SRC_DIR}/geos_coverage.info.cleaned
fi

Expand All @@ -284,9 +293,11 @@ fi

if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then
# We split the process in two steps. First installing the environment, then running the tests.
or_die ninja ats_environment

# The tests are not run using ninja (`ninja --verbose ats_run`) because it swallows the output while all the simulations are running.
or_die cmake --build . --target ats_environment

# The tests are not run using cmake (`cmake --build . --verbose --target ats_run`)
# because with ninja it swallows the output while all the
# simulations are running.
# We directly use the script instead...
echo "Available baselines:"
ls -lR /tmp/geos/baselines
Expand Down Expand Up @@ -321,7 +332,7 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then
fi

# Cleaning the build directory.
or_die ninja clean
or_die cmake --build . --target clean


# Clean the repository
Expand Down

0 comments on commit 68c46fd

Please sign in to comment.