|
|
# Singularity
|
|
|
|
|
|
# Docker |
|
|
\ No newline at end of file |
|
|
Here are provided some very basics directions on how to use LMGC90 in a Singularity container.
|
|
|
On how to install and use Singularity properly, check their [official website](https://sylabs.io/guides/3.6/user-guide/).
|
|
|
|
|
|
For a direct use, download the image file:
|
|
|
* [lmgc90_user_2020_rc1.sif](https://seafile.lmgc.univ-montp2.fr/f/989e8b26d2d14e4aac08/?dl=1)
|
|
|
|
|
|
On a server or computer with singularity installed, you can directly use the
|
|
|
singularity image to run a single command with:
|
|
|
```cmd
|
|
|
cd path_to_example
|
|
|
singularity run lmgc90_user_2020_rc1.sif python command.py
|
|
|
```
|
|
|
|
|
|
If it is prefered to stay in the image, for example in order to
|
|
|
run python several commands, then run:
|
|
|
```cmd
|
|
|
singularity shell lmgc90_user_2020_rc1.sif
|
|
|
python gen_sample.py --novisu && python command.py
|
|
|
exit
|
|
|
```
|
|
|
Beware, the `pylmgc90.pre.visuAvatars` function CANNOT work in this environment !!!
|
|
|
|
|
|
In case it is desired to build image, the use the following content
|
|
|
to create a `lmgc90.def` file (beware to beforehand adapt the path
|
|
|
to the source directory of lmgc90 in the `files` section:
|
|
|
```file
|
|
|
Bootstrap: docker
|
|
|
From: ubuntu:focal
|
|
|
|
|
|
%files
|
|
|
lmgc90_user_2020.rc1 /root/lmgc90
|
|
|
|
|
|
%environment
|
|
|
export SHELL=/bin/bash
|
|
|
|
|
|
%post
|
|
|
|
|
|
# install packages
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
apt update && apt -y upgrade
|
|
|
apt install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy python3-scipy python3-vtk7 python-is-python3
|
|
|
apt install -y cython3
|
|
|
apt install -y libhdf5-dev hdf5-tools python3-h5py
|
|
|
|
|
|
# build the sources
|
|
|
cd /root/lmgc90/build
|
|
|
cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE
|
|
|
make && make install
|
|
|
|
|
|
# clean build and source directories
|
|
|
rm -rf /root/lmgc90
|
|
|
```
|
|
|
Then the image file can be created with:
|
|
|
```cmd
|
|
|
singularity build --fakeroot lmgc90_user_2020_rc1.sif lmgc90.def
|
|
|
```
|
|
|
|
|
|
|
|
|
# Docker
|
|
|
|
|
|
Here are provided some very basics directions on how to use LMGC90 in a Docker container.
|
|
|
On how to install and use Docker properly, check their [official website](https://docs.docker.com/).
|
|
|
|
|
|
To build an image, use the following content to create a `docker_lmgc90` file.
|
|
|
Of course the `lmgc90_user_2020_rc1` must be replaced by the actual
|
|
|
path to the sources of lmgc90 to use:
|
|
|
```file
|
|
|
FROM ubuntu:focal
|
|
|
|
|
|
# install packages
|
|
|
RUN apt-get update -y
|
|
|
RUN apt-get upgrade -y
|
|
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
|
|
|
RUN apt-get install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy python3-scipy python3-vtk7 python-is-python3
|
|
|
RUN apt-get install -y cython3
|
|
|
RUN apt-get install -y libhdf5-dev hdf5-tools python3-h5py
|
|
|
|
|
|
# get the sources
|
|
|
COPY lmgc90_user_2020_rc1 /root/lmgc90
|
|
|
|
|
|
# build the sources
|
|
|
WORKDIR /root/lmgc90/build
|
|
|
RUN cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE
|
|
|
RUN make && make install
|
|
|
|
|
|
# clean build and source directories
|
|
|
WORKDIR /root/compute
|
|
|
RUN rm -rf /root/lmgc90
|
|
|
```
|
|
|
|
|
|
Then build the docker image with (again adapt `lmgc90_user:2020.rc1`
|
|
|
with something relevant to your sources directory):
|
|
|
```cmd
|
|
|
docker build -t lmgc90_user:2020.rc1 -f docker_lmgc90 .
|
|
|
```
|
|
|
|
|
|
Then, next to a `example` directory containing a `gen_sample.py` (with
|
|
|
NO `visuAvatars` command) and a `command.py`, a docker container
|
|
|
can be run sharing the `example` directory and run a single command with:
|
|
|
```cmd
|
|
|
docker run -it -v $PWD/example:/root/compute lmgc90_user:2020.rc1 python command.py
|
|
|
```
|
|
|
To stay in the container for, let's say run python in interactive mode, or run
|
|
|
several commands, preferably use:
|
|
|
```cmd
|
|
|
docker run -it -v $PWD/example:/root/compute lmgc90_user:2020.rc1 /bin/bash
|
|
|
python gen_sample.py --novisu
|
|
|
python command.py
|
|
|
exit
|
|
|
```
|
|
|
|
|
|
When using docker, it is good practice to sometime clean the
|
|
|
container leftovers with:
|
|
|
```cmd
|
|
|
docker container prune
|
|
|
``` |
|
|
\ No newline at end of file |