Update container authored by Rémy Mozul's avatar Rémy Mozul
Important notice: in the following a generic name `lmgc90_user_xxxx` is used in the instruction, but each time the `xxxx` is met, it must be replaced by the real name of the version used. For example the `2020.rc1` or `2020`. Important notice: in the following a generic name `lmgc90_user_xxxx` is used in the instruction, but each time the `xxxx` is met, it must be replaced by the real name of the version used. For example the `2020.rc1` or `2020`.
# Singularity # Singularity
Here are provided some very basics directions on how to use LMGC90 in a Singularity container. 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://apptainer.org/). On how to install and use Singularity properly, check their [official website](https://apptainer.org/).
For a direct use, download the image file: For a direct use, download the image file:
* [lmgc90_user_2024_rc1.sif](https://seafile.lmgc.univ-montp2.fr/f/0213f8323051431d8744/?dl=1) * [lmgc90_user_2024_rc1.sif](https://seafile.lmgc.univ-montp2.fr/f/0213f8323051431d8744/?dl=1) (m5sum e58a398352a64b41567e0aaf816863df)
* [lmgc90_user_2023.sif](https://seafile.lmgc.univ-montp2.fr/f/577871f9c9344a7a8711/?dl=1) * [lmgc90_user_2023.sif](https://seafile.lmgc.univ-montp2.fr/f/577871f9c9344a7a8711/?dl=1)
* [lmgc90_user_2023_rc2.sif](https://seafile.lmgc.univ-montp2.fr/f/ffa27bb6a3e04016a72b/?dl=1) * [lmgc90_user_2023_rc2.sif](https://seafile.lmgc.univ-montp2.fr/f/ffa27bb6a3e04016a72b/?dl=1)
* [lmgc90_user_2023_rc1.sif](https://seafile.lmgc.univ-montp2.fr/f/1c75255d95f5460c9dee/?dl=1) * [lmgc90_user_2023_rc1.sif](https://seafile.lmgc.univ-montp2.fr/f/1c75255d95f5460c9dee/?dl=1)
On a server or computer with singularity installed, you can directly use the On a server or computer with singularity installed, you can directly use the
singularity image to run a single command with: singularity image to run a single command with:
```cmd ```cmd
cd path_to_example cd path_to_example
singularity run lmgc90_user_xxxx.sif python command.py singularity run lmgc90_user_xxxx.sif python command.py
``` ```
It is preferred to stay in the same image ; for example in order to It is preferred to stay in the same image ; for example in order to
run several python commands: run several python commands:
```cmd ```cmd
singularity shell lmgc90_user_xxxx.sif singularity shell lmgc90_user_xxxx.sif
python gen_sample.py --novisu && python command.py python gen_sample.py --novisu && python command.py
exit exit
``` ```
Beware, the `pylmgc90.pre.visuAvatars` function CANNOT work in this environment !!! Beware, the `pylmgc90.pre.visuAvatars` function CANNOT work in this environment !!!
In case it is desired to build image, the use the following content 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 create a `lmgc90.def` file (beware to beforehand adapt the path
to the source directory of lmgc90 in the `files` section: to the source directory of lmgc90 in the `files` section:
```file ```file
Bootstrap: docker Bootstrap: docker
From: ubuntu:jammy From: ubuntu:jammy
%files %files
lmgc90_user_xxxx /root/lmgc90 lmgc90_user_xxxx /root/lmgc90
%environment %environment
export SHELL=/bin/bash export SHELL=/bin/bash
%post %post
# install packages # install packages
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt update && apt -y upgrade apt update && apt -y upgrade
apt install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy cython3 python-is-python3 apt install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy cython3 python-is-python3
apt install -y python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph apt install -y python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph
apt install -y libhdf5-dev hdf5-tools python3-h5py apt install -y libhdf5-dev hdf5-tools python3-h5py
# build the sources # build the sources
cd /root/lmgc90/build cd /root/lmgc90/build
cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE
make && make install make && make install
# clean build and source directories # clean build and source directories
rm -rf /root/lmgc90 rm -rf /root/lmgc90
``` ```
Then the image file can be created with: Then the image file can be created with:
```cmd ```cmd
singularity build --fakeroot lmgc90_user_xxxx.sif lmgc90.def singularity build --fakeroot lmgc90_user_xxxx.sif lmgc90.def
``` ```
# Docker # Docker
Here are provided some very basics directions on how to use LMGC90 in a Docker container. 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/). 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. To build an image, use the following content to create a `docker_lmgc90` file.
```file ```file
FROM ubuntu:jammy FROM ubuntu:jammy
# install packages # install packages
RUN apt update -y RUN apt update -y
RUN apt upgrade -y RUN apt upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
RUN apt install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy cython3 python-is-python3 RUN apt install -y git cmake gcc g++ gfortran liblapack-dev swig python3-dev python3-numpy cython3 python-is-python3
RUN apt install -y python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph RUN apt install -y python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph
RUN apt install -y libhdf5-dev hdf5-tools python3-h5py RUN apt install -y libhdf5-dev hdf5-tools python3-h5py
# get the sources # get the sources
COPY lmgc90_user_xxxx /root/lmgc90 COPY lmgc90_user_xxxx /root/lmgc90
# build the sources # build the sources
WORKDIR /root/lmgc90/build WORKDIR /root/lmgc90/build
RUN cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE -DWITH_OPENMP=True RUN cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE -DWITH_OPENMP=True
RUN make && make install RUN make && make install
# clean build and source directories # clean build and source directories
WORKDIR /root/compute WORKDIR /root/compute
RUN rm -rf /root/lmgc90 RUN rm -rf /root/lmgc90
``` ```
Then build the docker image with (again replace the `xxxx` by your revision), do not forget the ending dot character: Then build the docker image with (again replace the `xxxx` by your revision), do not forget the ending dot character:
```cmd ```cmd
docker build -t lmgc90_user:xxxx -f docker_lmgc90 . docker build -t lmgc90_user:xxxx -f docker_lmgc90 .
``` ```
Then, next to a `example` directory containing a `gen_sample.py` (with Then, next to a `example` directory containing a `gen_sample.py` (with
NO `visuAvatars` command) and a `command.py`, a docker container NO `visuAvatars` command) and a `command.py`, a docker container
can be run sharing the `example` directory and run a single command with: can be run sharing the `example` directory and run a single command with:
```cmd ```cmd
docker run -it -v $PWD/example:/root/compute lmgc90_user:2022.rc1 python command.py docker run -it -v $PWD/example:/root/compute lmgc90_user:2022.rc1 python command.py
``` ```
To stay in the container for, let's say run python in interactive mode, or run To stay in the container for, let's say run python in interactive mode, or run
several commands, preferably use: several commands, preferably use:
```cmd ```cmd
docker run -it -v $PWD/example:/root/compute lmgc90_user:xxxx /bin/bash docker run -it -v $PWD/example:/root/compute lmgc90_user:xxxx /bin/bash
python gen_sample.py --novisu python gen_sample.py --novisu
python command.py python command.py
exit exit
``` ```
When using docker, it is good practice to sometime clean the When using docker, it is good practice to sometime clean the
container leftovers with: container leftovers with:
```cmd ```cmd
docker container prune docker container prune
``` ```
\ No newline at end of file