Skip to content

Commit

Permalink
Add pygeosx unit tests to CI; fix gcc version pragma in LvArray
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhan12 committed Mar 21, 2024
1 parent cb20b88 commit 08ce3f9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"GEOS_TPL_TAG": "260-235"
"GEOS_TPL_TAG": "259-158"
}
},
"runArgs": [
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ on:
ENABLE_HYPRE_DEVICE:
required: false
type: string
ENABLE_PYGEOSX:
required: false
type: string
ENABLE_TRILINOS:
required: false
type: string
Expand Down Expand Up @@ -149,6 +152,12 @@ jobs:
docker_args+=(-e ENABLE_HYPRE_DEVICE=${ENABLE_HYPRE_DEVICE:-CPU})
docker_args+=(-e ENABLE_TRILINOS=${ENABLE_TRILINOS:-ON})
# pygeosx testing
if [ "${{ inputs.ENABLE_PYGEOSX }}" == 'ON' ]; then
script_args+=(--run-pygeosx-tests)
fi
docker_args+=(--cap-add=SYS_PTRACE --rm)
script_args+=(--cmake-build-type ${{ inputs.CMAKE_BUILD_TYPE }})
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,32 @@ jobs:
- name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9
ENABLE_PYGEOSX: ON

- name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces
CMAKE_BUILD_TYPE: Debug
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10
ENABLE_PYGEOSX: ON

- name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10
ENABLE_PYGEOSX: ON

- name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
GCP_BUCKET: geosx/ubuntu22.04-gcc11
ENABLE_PYGEOSX: ON

- name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
ENABLE_PYGEOSX: ON

- name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
Expand Down Expand Up @@ -182,6 +187,7 @@ jobs:
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }}
DOCKER_REPOSITORY: ${{ matrix.DOCKER_REPOSITORY }}
ENABLE_HYPRE: ${{ matrix.ENABLE_HYPRE }}
ENABLE_PYGEOSX: ${{ matrix.ENABLE_PYGEOSX }}
ENABLE_TRILINOS: ${{ matrix.ENABLE_TRILINOS }}
GCP_BUCKET: ${{ matrix.GCP_BUCKET }}
HOST_CONFIG: ${{ matrix.HOST_CONFIG }}
Expand Down
11 changes: 11 additions & 0 deletions host-configs/environment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ else()
set(ENABLE_HYPRE OFF CACHE BOOL "" FORCE)
endif()

# pygeosx
if(NOT DEFINED ENABLE_PYGEOSX)
set(ENABLE_PYGEOSX "$ENV{ENABLE_PYGEOSX}" CACHE BOOL "" FORCE)
endif()
if(ENABLE_PYGEOSX)
set(Python3_EXECUTABLE /usr/bin/python3 CACHE PATH "")
set(ENABLE_PYLVARRAY ON CACHE BOOL "")
else()
set(ENABLE_PYGEOSX OFF CACHE BOOL "" FORCE)
endif()

# Same pattern
if(NOT DEFINED ENABLE_TRILINOS)
set(ENABLE_TRILINOS "$ENV{ENABLE_TRILINOS}" CACHE BOOL "" FORCE)
Expand Down
21 changes: 18 additions & 3 deletions scripts/ci_build_and_test_in_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ Usage: $0
--no-run-unit-tests
Do not run the unit tests (but they will be built).
--repository /path/to/repository
Internal mountpoint where the geos repository will be available.
Internal mountpoint where the geos repository will be available.
--run-pygeosx-tests
Runs the pygeosx tests.
--run-integrated-tests
Run the integrated tests. Then bundle and send the results to the cloud.
--sccache-credentials credentials.json
Expand All @@ -68,13 +70,14 @@ 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,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:,no-install-schema,no-run-unit-tests,repository:,run-pygeosx-tests,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@")

# Variables with default values
BUILD_EXE_ONLY=false
GEOSX_INSTALL_SCHEMA=true
HOST_CONFIG="host-configs/environment.cmake"
RUN_UNIT_TESTS=true
RUN_PYGEOSX_TESTS=false
RUN_INTEGRATED_TESTS=false
TEST_CODE_STYLE=false
TEST_DOCUMENTATION=false
Expand Down Expand Up @@ -105,6 +108,7 @@ do
--no-install-schema) GEOSX_INSTALL_SCHEMA=false; shift;;
--no-run-unit-tests) RUN_UNIT_TESTS=false; shift;;
--repository) GEOS_SRC_DIR=$2; shift 2;;
--run-pygeosx-tests) RUN_PYGEOSX_TESTS=true; shift;;
--run-integrated-tests) RUN_INTEGRATED_TESTS=true; shift;;
--code-coverage) CODE_COVERAGE=true; shift;;
--sccache-credentials) SCCACHE_CREDS=$2; shift 2;;
Expand Down Expand Up @@ -180,6 +184,10 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then
ATS_CMAKE_ARGS="-DATS_ARGUMENTS=\"--machine openmpi --ats openmpi_mpirun=/usr/bin/mpirun --ats openmpi_args=--allow-run-as-root --ats openmpi_procspernode=4 --ats openmpi_maxprocs=4\" -DPython3_ROOT_DIR=${ATS_PYTHON_HOME}"
fi

# Set CMake option for pygeosx
if [[ "${RUN_PYGEOSX_TESTS}" = true ]]; then
PYGEOSX_CMAKE_ARG="-DENABLE_PYGEOSX=ON"
fi

if [[ "${CODE_COVERAGE}" = true ]]; then
or_die apt-get update
Expand Down Expand Up @@ -212,7 +220,8 @@ or_die python3 scripts/config-build.py \
-DGEOSX_INSTALL_SCHEMA=${GEOSX_INSTALL_SCHEMA} \
-DENABLE_COVERAGE=$([[ "${CODE_COVERAGE}" = true ]] && echo 1 || echo 0) \
${SCCACHE_CMAKE_ARGS} \
${ATS_CMAKE_ARGS}
${ATS_CMAKE_ARGS} \
${PYGEOSX_CMAKE_ARG}

# The configuration step is now over, we can now move to the build directory for the build!
or_die cd ${GEOSX_BUILD_DIR}
Expand All @@ -236,6 +245,12 @@ else
or_die ninja -j $NPROC
or_die ninja install

if [[ "${RUN_PYGEOSX_TESTS}" = true ]]; then
or_die ninja pygeosx
or_die ninja geosx_python_tools
or_die ninja pygeosx_unit_tests
fi

if [[ ! -z "${DATA_BASENAME_WE}" ]]; then
# Here we pack the installation.
# The `--transform` parameter provides consistency between the tarball name and the unpacked folder.
Expand Down
1 change: 1 addition & 0 deletions scripts/spack_packages/packages/geosx/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None):

if '+pygeosx' in spec:
cfg.write(cmake_cache_option('ENABLE_PYGEOSX', True))
cfg.write(cmake_cache_option('ENABLE_PYLVARRAY', True))
else:
cfg.write(cmake_cache_option('ENABLE_PYGEOSX', False))

Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/LvArray

0 comments on commit 08ce3f9

Please sign in to comment.