Skip to content
Snippets Groups Projects
Commit d6329c82 authored by Lars Bilke's avatar Lars Bilke
Browse files

Merge branch 'DataExplorerContainer' into 'master'

Simplified Data Explorer container

See merge request ogs/ogs!3751
parents 95243619 37cdaf27
No related branches found
No related tags found
No related merge requests found
...@@ -7,17 +7,25 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES}) ...@@ -7,17 +7,25 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES})
target_link_libraries( target_link_libraries(
ApplicationsLib ApplicationsLib
PUBLIC BaseLib GeoLib NumLib Processes PUBLIC BaseLib GeoLib NumLib
PRIVATE CMakeInfoLib PRIVATE CMakeInfoLib
MathLib MathLib
MeshLib MeshLib
MeshGeoToolsLib MeshGeoToolsLib
ParameterLib
ProcessLib
$<$<BOOL:${OGS_USE_PYTHON}>:pybind11::pybind11> $<$<BOOL:${OGS_USE_PYTHON}>:pybind11::pybind11>
$<$<BOOL:${OGS_USE_PETSC}>:petsc> $<$<BOOL:${OGS_USE_PETSC}>:petsc>
) )
if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
target_link_libraries(
ApplicationsLib
PUBLIC Processes
PRIVATE ParameterLib ProcessLib
)
elseif(OGS_BUILD_GUI)
target_link_libraries(ApplicationsLib PRIVATE nlohmann_json)
endif()
if(OGS_USE_LIS) if(OGS_USE_LIS)
target_include_directories(ApplicationsLib PUBLIC ${LIS_INCLUDE_DIR}) target_include_directories(ApplicationsLib PUBLIC ${LIS_INCLUDE_DIR})
endif() endif()
......
...@@ -7,7 +7,7 @@ container: ...@@ -7,7 +7,7 @@ container:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
- changes: - changes:
- scripts/ci/jobs/container.yml - scripts/ci/jobs/container.yml
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/ - if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
- when: manual - when: manual
allow_failure: true allow_failure: true
...@@ -28,16 +28,16 @@ container: ...@@ -28,16 +28,16 @@ container:
--cvode --ccache --cvode --ccache
--cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DOGS_BUILD_TESTING=OFF' --cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DOGS_BUILD_TESTING=OFF'
--base_image 'centos:8' --ompi 4.0.5 --mpi_benchmarks --base_image 'centos:8' --ompi 4.0.5 --mpi_benchmarks
- |
for sif in _out/images/*.sif; do
singularity exec $sif ogs --version
done
- > - >
poetry run ogscm compiler.py ogs.py -B -C -R --ogs ../.. poetry run ogscm compiler.py ogs.py -B -C -R --ogs ../..
--build_args ' --progress=plain' --build_args ' --progress=plain'
--cvode --ccache --cvode --ccache
--cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DOGS_BUILD_TESTING=OFF' --cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DOGS_BUILD_CLI=OFF -DOGS_BUILD_UTILS=OFF -DOGS_BUILD_TESTING=OFF'
--gui --gui
- |
for sif in _out/images/*.sif; do
singularity exec $sif ogs --version
done
artifacts: artifacts:
name: container name: container
paths: paths:
......
...@@ -39,16 +39,16 @@ Simply download an image from the [latest master-branch build](https://gitlab.op ...@@ -39,16 +39,16 @@ Simply download an image from the [latest master-branch build](https://gitlab.op
```bash ```bash
# Linux only: # Linux only:
singularity exec --app ogs ogs-6.2.2-serial.sif ogs some/path/project.prj singularity exec ogs-6.x.x-serial.sif ogs some/path/project.prj
``` ```
This starts the container, mounts your home directory inside the container, passes the current working directory and runs the ogs executable (in your home directory which is mounted inside the container) with the passed project file. Everything works as expected and is transparent to the user. When ogs finishes the container stops and returns to the host system. This starts the container, mounts your home directory inside the container, passes the current working directory and runs the ogs executable (in your home directory which is mounted inside the container) with the passed project file. Everything works as expected and is transparent to the user. When ogs finishes the container stops and returns to the host system.
The `--app ogs` selects a predefined execution environment in the container (i.e. setting the `PATH` to `/scif/apps/ogs/bin` in which all the executables are located). You could also (and **on macOS you have to**) run without the `--app`-parameter but then you had to specify the full executable path in the container: You can also specify the full executable path in the container:
```bash ```bash
# Works on macOS too: # Works on macOS too:
singularity exec ogs-6.2.2-serial.sif /scif/apps/ogs/bin/ogs ... singularity exec ogs-6.x.x-serial.sif /usr/local/ogs/bin/ogs ...
``` ```
Running a benchmark: Running a benchmark:
...@@ -57,29 +57,29 @@ Running a benchmark: ...@@ -57,29 +57,29 @@ Running a benchmark:
# Create output directories # Create output directories
mkdir -p _out _out_mpi mkdir -p _out _out_mpi
# Run serial benchmark # Run serial benchmark
singularity exec --app ogs ogs-6.2.2-serial.sif ogs -o _out [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj singularity exec ogs-6.x.x-serial.sif ogs -o _out [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
# Run serial benchmark with output validation (via vtkdiff) # Run serial benchmark with output validation (via vtkdiff)
singularity exec --app ogs ogs-6.2.2-serial.sif ogs -o _out -r [ogs-sources]/Tests/Data/Mechanics/Linear [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj singularity exec ogs-6.x.x-serial.sif ogs -o _out -r [ogs-sources]/Tests/Data/Mechanics/Linear [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
# Run parallel benchmark with MPI # Run parallel benchmark with MPI
mpirun -np 4 singularity exec --app ogs ogs-6.2.2-openmpi-2.1.2.sif ogs -o _out_mpi [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj mpirun -np 4 singularity ogs ogs-6.x.x-openmpi-2.1.2.sif ogs -o _out_mpi [ogs-sources]/Tests/Data/Mechanics/Linear/disc_with_hole.prj
``` ```
You can run other contained executables as well, e.g. `vtkdiff`: You can run other contained executables as well, e.g. `vtkdiff`:
```bash ```bash
singularity exec --app ogs ogs-6.2.2-serial.sif vtkdiff --help singularity exec ogs-6.x.x-serial.sif vtkdiff --help
``` ```
You can interactively explore the container with `singularity shell` (you can see that you are **in** the container because of the `Singularity [container image file]:...>` prefix of the shell): You can interactively explore the container with `singularity shell` (you can see that you are **in** the container because of the `Singularity [container image file]:...>` prefix of the shell):
```bash ```bash
# Shell into container # Shell into container
singularity shell ogs-6.2.2-serial.sif singularity shell ogs-6.x.x-serial.sif
# List files in the container # List files in the container
Singularity ogs-6.2.2-serial.sif:...> ls /scif/apps/ogs/bin Singularity ogs-6.x.x-serial.sif:...> ls /scif/apps/ogs/bin
... ogs tetgen vtkdiff ... ogs tetgen vtkdiff
# Exit the container and get back to your hosts shell # Exit the container and get back to your hosts shell
Singularity ogs-6.2.2-serial.sif:...> exit Singularity ogs-6.x.x-serial.sif:...> exit
``` ```
### Custom Python environment for the container ### Custom Python environment for the container
...@@ -100,13 +100,13 @@ exit ...@@ -100,13 +100,13 @@ exit
# Now outside the container # Now outside the container
# The virtualenv-directory .venv still persists # The virtualenv-directory .venv still persists
# If you want to run something in the container with exec, source the venv before: # If you want to run something in the container with exec, source the venv before:
singularity exec --app ogs my-container.sif bash -c 'source .venv/bin/activate && ogs ...' singularity exec my-container.sif bash -c 'source .venv/bin/activate && ogs ...'
``` ```
### Run the DataExplorer inside a Container ### Run the DataExplorer inside a Container
* Get a Singularity container with the DataExplorer (has `-gui` in its name) * Get a Singularity container with the DataExplorer (has `-gui` in its name)
* `singularity exec --app ogs ogs-xxx-gui-xxx.sif DataExplorer` * `singularity exec ogs-xxx-gui-xxx.sif DataExplorer`
You may use this container on e.g. `envinf1` with X11 forwarding (`ssh -XY envinf1`). You may use this container on e.g. `envinf1` with X11 forwarding (`ssh -XY envinf1`).
...@@ -124,15 +124,15 @@ Although Singularity is the preferred container runtime you can use [Docker](htt ...@@ -124,15 +124,15 @@ Although Singularity is the preferred container runtime you can use [Docker](htt
* Get the container: `docker pull registry.opengeosys.org/ogs/ogs/ogs-serial` * Get the container: `docker pull registry.opengeosys.org/ogs/ogs/ogs-serial`
* Start interactive container session: `docker run --rm -it registry.opengeosys.org/ogs/ogs/ogs-serial` * Start interactive container session: `docker run --rm -it registry.opengeosys.org/ogs/ogs/ogs-serial`
* Run ogs: `/scif/apps/ogs/bin/ogs --version` * Run ogs: `/usr/local/ogs/bin/ogs --version`
* Exit the container: `exit` * Exit the container: `exit`
You will notice that the interactive session in your container is isolated from your host, i.e. you do not have access to files on your host. You need to explicitly [mount](https://docs.docker.com/storage/bind-mounts/) them on `docker run`: You will notice that the interactive session in your container is isolated from your host, i.e. you do not have access to files on your host. You need to explicitly [mount](https://docs.docker.com/storage/bind-mounts/) them on `docker run`:
```bash ```bash
mkdir ~/ogs_out mkdir ~/ogs_out
docker run --rm -it -v $HOME/code/ogs6/ogs/Tests/Data:/tmp/data:ro -v $HOME/ogs_out:/tmp/out registry.opengeosys.org/ogs/ogs/ogs-seria docker run --rm -it -v $HOME/code/ogs6/ogs/Tests/Data:/tmp/data:ro -v $HOME/ogs_out:/tmp/out registry.opengeosys.org/ogs/ogs/ogs-serial
/scif/apps/ogs/bin/ogs -o /tmp/out /tmp/data/Elliptic/cube_1x1x1_SteadyStateDiffusion/cube_1e4.prj /usr/local/ogs/bin/ogs -o /tmp/out /tmp/data/Elliptic/cube_1x1x1_SteadyStateDiffusion/cube_1e4.prj
exit exit
ls ~/ogs_out ls ~/ogs_out
# [shows ogs generated output files] # [shows ogs generated output files]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment