From 392a4a66292fc76ad247238a8e44d5c26238463e Mon Sep 17 00:00:00 2001 From: Brian Han Date: Thu, 8 Feb 2024 14:20:36 -0800 Subject: [PATCH] Add pygeosx unit tests to CI with Ubuntu 22 Images; apply disutils fix for pygeosx testing --- .devcontainer/devcontainer.json | 2 +- .github/workflows/build_and_test.yml | 9 +++++++++ .github/workflows/ci_tests.yml | 5 +++++ host-configs/environment.cmake | 11 +++++++++++ scripts/ci_build_and_test_in_container.sh | 23 ++++++++++++++++++++--- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e5df2d48955..f3bed3c5162 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "GEOS_TPL_TAG": "315-749" + "GEOS_TPL_TAG": "259-761" } }, "runArgs": [ diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f7805e9f0e4..d393db00b9f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -42,6 +42,9 @@ on: ENABLE_HYPRE_DEVICE: required: false type: string + ENABLE_PYGEOSX: + required: false + type: string ENABLE_TRILINOS: required: false type: string @@ -230,6 +233,12 @@ jobs: script_args+=(--enable-hypre-device "${{ inputs.ENABLE_HYPRE_DEVICE }}") fi + + # 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 }}) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index e1e7506540f..72476ce386d 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -183,6 +183,7 @@ jobs: GEOS_ENABLE_BOUNDS_CHECK: OFF GCP_BUCKET: geosx/ubuntu22.04-gcc11 HOST_CONFIG: /spack-generated.cmake + ENABLE_PYGEOSX: ON - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release @@ -193,6 +194,7 @@ jobs: BUILD_SHARED_LIBS: ON GEOS_ENABLE_BOUNDS_CHECK: ON HOST_CONFIG: /spack-generated.cmake + ENABLE_PYGEOSX: ON - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) - NO BOUNDS CHECK CMAKE_BUILD_TYPE: Release @@ -203,6 +205,7 @@ jobs: BUILD_SHARED_LIBS: ON GEOS_ENABLE_BOUNDS_CHECK: OFF HOST_CONFIG: /spack-generated.cmake + ENABLE_PYGEOSX: ON - name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release @@ -212,6 +215,7 @@ jobs: GEOS_ENABLE_BOUNDS_CHECK: ON BUILD_SHARED_LIBS: ON HOST_CONFIG: /spack-generated.cmake + ENABLE_PYGEOSX: ON - name: Sherlock CPU (centos 7.9.2009, gcc 10.1.0, open-mpi 4.1.2, openblas 0.3.10) CMAKE_BUILD_TYPE: Release @@ -231,6 +235,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 }} GEOS_ENABLE_BOUNDS_CHECK: ${{ matrix.GEOS_ENABLE_BOUNDS_CHECK }} GCP_BUCKET: ${{ matrix.GCP_BUCKET }} diff --git a/host-configs/environment.cmake b/host-configs/environment.cmake index 001d28cb425..18f93879210 100644 --- a/host-configs/environment.cmake +++ b/host-configs/environment.cmake @@ -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) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 1ca0066ccf9..5ce18e4b361 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -63,7 +63,9 @@ Usage: $0 --nproc N Number of cores to use for the build. --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 @@ -79,7 +81,7 @@ exit 1 # Then we'll move to the build dir. or_die cd $(dirname $0)/.. -args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,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 -- "$@") +args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-pygeosx-tests,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@") # Variables with default values BUILD_EXE_ONLY=false @@ -90,6 +92,7 @@ ENABLE_HYPRE=ON ENABLE_HYPRE_DEVICE=CPU GEOS_LA_INTERFACE=Hypre RUN_UNIT_TESTS=true +RUN_PYGEOSX_TESTS=false RUN_INTEGRATED_TESTS=false UPLOAD_TEST_BASELINES=false TEST_CODE_STYLE=false @@ -133,6 +136,7 @@ do --no-run-unit-tests) RUN_UNIT_TESTS=false; shift;; --nproc) NPROC=$2; shift 2;; --repository) GEOS_SRC_DIR=$2; shift 2;; + --run-pygeosx-tests) RUN_PYGEOSX_TESTS=true; shift;; --run-integrated-tests) RUN_INTEGRATED_TESTS=true; shift;; --upload-test-baselines) UPLOAD_TEST_BASELINES=true; shift;; --code-coverage) CODE_COVERAGE=true; shift;; @@ -225,6 +229,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=32 --ats openmpi_maxprocs=32\" -DPython3_ROOT_DIR=${ATS_PYTHON_HOME} -DPython3_EXECUTABLE=${ATS_PYTHON_HOME}/bin/python3 -DATS_BASELINE_DIR=${ATS_BASELINE_DIR} -DATS_WORKING_DIR=${ATS_WORKING_DIR}" fi +# Set CMake options for pygeosx testing +if [[ "${RUN_PYGEOSX_TESTS}" = true ]]; then + PYGEOSX_CMAKE_ARGS="-DENABLE_PYGEOSX=ON -DENABLE_PYLVARRAY=ON" +fi if [[ "${CODE_COVERAGE}" = true ]]; then or_die apt-get update @@ -260,7 +268,8 @@ or_die python3 scripts/config-build.py \ -DENABLE_COVERAGE=$([[ "${CODE_COVERAGE}" = true ]] && echo 1 || echo 0) \ -DGEOS_ENABLE_BOUNDS_CHECK=${GEOS_ENABLE_BOUNDS_CHECK} \ ${SCCACHE_CMAKE_ARGS} \ - ${ATS_CMAKE_ARGS} + ${ATS_CMAKE_ARGS} \ + ${PYGEOSX_CMAKE_ARGS} # The configuration step is now over, we can now move to the build directory for the build! or_die cd ${GEOS_BUILD_DIR} @@ -284,6 +293,14 @@ else or_die cmake --build . -j $NPROC or_die cmake --install . + if [[ "${RUN_PYGEOSX_TESTS}" = true ]]; then + # fix the setuptools/distutils conflict + export SETUPTOOLS_USE_DISTUTILS=stdlib + 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.