Skip to content

Commit

Permalink
Merge branch 'eve-guix' into 'master'
Browse files Browse the repository at this point in the history
[ci] Deploy guix container to eve

See merge request ogs/ogs!4722
  • Loading branch information
bilke committed Sep 1, 2023
2 parents 189e75b + 74b8dcf commit 212ff60
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 56 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ include(packaging/Pack)

# ---- Subdirectories ----
include_directories(${PROJECT_SOURCE_DIR})
# xdmfdiff
if(OGS_BUILD_TESTING)
add_subdirectory(Tests/xdmfdiff)
endif()

include(scripts/cmake/CheckHeaderCompilation.cmake)

add_subdirectory(Applications)
Expand All @@ -233,6 +228,7 @@ if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
add_subdirectory(ParameterLib)
add_subdirectory(MaterialLib)
add_subdirectory(ProcessLib)
add_subdirectory(Tests/xdmfdiff)
endif()
if(OGS_BUILD_TESTING AND NOT _IS_SUBPROJECT)
add_subdirectory(Tests)
Expand Down
46 changes: 44 additions & 2 deletions scripts/ci/jobs/build-guix.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,56 @@
variables:
GUIX_PETSC_CONTAINER: /data/ogs/apptainer/guix/ogs-petsc-ssd_head.squashfs
GUIX_COMMIT: v1.4.0

build guix:
stage: build
tags: [guix]
needs: []
variables:
GIT_SUBMODULE_STRATEGY: recursive
GUIX_COMMIT: v1.4.0
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
allow_failure: true
- when: manual
allow_failure: true
script:
- guix time-machine --commit=v1.4.0 -- build -L $PWD/.guix/modules ogs-ssd
- guix time-machine --commit=v1.4.0 -- build -L $PWD/.guix/modules ogs-petsc-ssd
# SteadyStateDiffusion only!
- guix time-machine --commit=${GUIX_COMMIT} -- build -L $PWD/.guix/modules ogs-ssd
- guix time-machine --commit=${GUIX_COMMIT} -- build -L $PWD/.guix/modules ogs-petsc-ssd

deploy guix container eve:
stage: build
tags: [guix]
needs: []
variables:
GIT_SUBMODULE_STRATEGY: recursive
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
# All processes.
- image=$( guix time-machine --commit=${GUIX_COMMIT} -- pack --no-substitutes -L $PWD/.guix/modules -S /bin=bin -RR --format=squashfs bash ogs-petsc | tee | tail -1 )
- echo "Image $image"
- ssh [email protected] rm -f ${GUIX_PETSC_CONTAINER}
- scp $image [email protected]:${GUIX_PETSC_CONTAINER}

test guix container eve:
stage: build
tags: [frontend2]
needs: ["deploy guix container eve"]
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- export work_dir=/work/$USER/builds/$CI_JOB_ID
- echo "Working directory is ${work_dir}"
- mkdir -p $work_dir
- cp -r ${CI_PROJECT_DIR}/Tests/Data/EllipticPETSc $work_dir/
- export prj_file=${work_dir}/EllipticPETSc/cube_1e3_XDMF_np3.prj
- jid=$(sbatch --chdir=${work_dir} --job-name=test-guix-container --mem-per-cpu=1G --ntasks=3 --output=/work/%u/%x_%j.out --parsable --time=1 --partition=rocky-9 --wrap="srun apptainer exec ${GUIX_PETSC_CONTAINER} ogs ${prj_file}")
# - touch /work/$USER/ci_log_$jid.out # required on frontend1, tail -F does not recognize file created
- while true; do grep "$jid" < <(squeue -hj "$jid") || break; sleep 10; done &> /dev/null & tail -F /work/$USER/test-guix-container_$jid.out --pid="$!" || true
- exit_code=$(sacct -j $jid.0 --format=ExitCode --noheader | cut -d':' -f1)
- cd $work_dir
- apptainer exec ${GUIX_PETSC_CONTAINER} xdmfdiff -a pressure -b pressure --rel 1e-3 --abs 1e-3 EllipticPETSc/cube_1e3_np3.xdmf cube_1e3_np3_cube_1x1x1_hex_1e3.xdmf
- apptainer exec ${GUIX_PETSC_CONTAINER} xdmfdiff -a v -b v --rel 1e-3 --abs 1e-3 EllipticPETSc/cube_1e3_np3.xdmf cube_1e3_np3_cube_1x1x1_hex_1e3.xdmf
- exit ${exit_code}
2 changes: 1 addition & 1 deletion scripts/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ if(OGS_USE_PETSC)
endif()
endif()

if(OGS_BUILD_TESTING)
if(OGS_BUILD_TESTING OR OGS_BUILD_CLI OR OGS_BUILD_UTILS)
set(XDMF_LIBNAME OgsXdmf CACHE STRING "")
CPMAddPackage(
NAME xdmf
Expand Down
45 changes: 1 addition & 44 deletions web/content/docs/devguide/environments/working-on-eve/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,9 @@ aliases = ["/docs/devguide/advanced/working-on-eve"]

Members of the Department Environmental Informatics of the Helmholtz Centre for Environmental Research - UFZ can use the `frontend1`- and `frontend2`-machines from the Eve cluster system.

<div class='note'>
You need to opt-in to use the [EasyBuild modules](https://wiki.ufz.de/eve/index.php/EasyBuild)! To do so follow these steps:

- Login to `frontend1` or `frontend2`
- Run `touch ~/.easybuild-yes`
- `exit` and re-login

Also on eve the installed git module (2.10) is over 2 years old and we recommend using a newer module:

```bash
ml use /global/apps/modulefiles
ml git/2.20.1
```

</div>

## Run OGS within a container

Eve has [Singularity](https://www.sylabs.io/singularity) container runtime installed so you can simply download a prebuilt container and run OGS inside it. See the [user guide]({{< ref "container" >}}) for more information.
Eve has the [Apptainer/Singularity](https://apptainer.org) container runtime installed so you can simply download a prebuilt container and run OGS inside it. See the [user guide]({{< ref "container" >}}) for more information.

## Build OGS-6

Expand All @@ -44,30 +28,3 @@ source scripts/env/eve/cli.sh
```

Then do the [build configuration]({{< ref "build-configuration.md" >}}) and [build]({{< ref "/docs/devguide/getting-started/build.md" >}}) the project.

## Optional steps

### Install and use Conan

Follow the instructions on using Python's `virtualenv` [on the Eve-wiki](https://wiki.ufz.de/eve/index.php/Python#virtualenv) for setting up a local Python environment. Then you can `pip install conan` and use Conan.

### Additional Features

Generating Doxygen documentation:

```bash
module load Doxygen/1.8.14
```

You can build with Ninja:

```bash
module load ninja/1.9.0
```

## Build OGS-5

```bash
module load CMake/3.11.4
module load GCC/6.4.0-2.28
```
4 changes: 4 additions & 0 deletions web/content/docs/userguide/basics/container/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ To **build** OGS with the help of a container go to the [Developer Guide]({{< re

### Get a container image

#### Recommended option on EVE: use prebuilt images

On the EVE cluster system (UFZ) you can use prebuilt images which can be used for [PETSc-based cluster jobs]({{< ref "parallel_computing_mpi.md#2a-use-a-container-to-launch-mpi-ogs" >}}).

#### Option: Download a release image (preferred)

Simply download an image from the [releases]({{< ref "/releases" >}}) page.
Expand Down
21 changes: 17 additions & 4 deletions web/content/docs/userguide/features/parallel_computing_mpi.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,17 @@ Here is an example of a job script for the SLURM system on EVE:
#SBATCH [email protected]
#SBATCH --mail-type=BEGIN,END

###source /etc/profile.d/000-modules.sh
export MODULEPATH="/software/easybuild-broadwell/modules/all/Core:/software/modulefiles"
module load foss/2020b petsc-bilke/3.16.5_foss2020b
module load OpenMPI/4.0.5 HDF5/1.10.7 GMP/6.2.0

APP="/home/wwang/code/ogs6/exe_petsc/bin/ogs"
PRJ_FILE="/home/wwang/data_D/project/AREHS/HM_3D/simHM_glaciation.prj"
/bin/echo In directory: `pwd`
/bin/echo Number of CPUs: $SLURM_CPUS_PER_TASK
/bin/echo File name: $1

##load $APP

srun -n "$SLURM_NTASKS" $APP /home/wwang/data_D/project/AREHS/HM_3D/simHM_glaciation.prj -o /home/wwang/data_D/project/AREHS/HM_3D/output
srun $APP $PRJ_FILE -o /home/wwang/data_D/project/AREHS/HM_3D/output
```

In the job script for EVE, `module load foss/2020b` must be presented, and
Expand All @@ -190,6 +188,21 @@ Once the job script is ready, you can
For the detailed syntax of job script of SLURM for EVE, please visit <https://wiki.ufz.de/eve/>
(user login required).

### 2a. Use a container to launch MPI OGS

A prebuilt container with `ogs` (current master) is available at:

* `/data/ogs/apptainer/guix/ogs-petsc-ssd_head.squashfs`

You need to modify your submit script, e.g.:

```bash
...
#SBATCH ...

srun apptainer exec /data/ogs/apptainer/guix/ogs-petsc-ssd_head.squashfs ogs $PRJ_FILE
```

### 3. Check results

There are two output types available, VTK and XDMF.
Expand Down

0 comments on commit 212ff60

Please sign in to comment.