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
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.
For a direct use, download the image file:
- lmgc90_user_2024_rc1.sif (md5sum e58a398352a64b41567e0aaf816863df)
- lmgc90_user_2023.sif
- lmgc90_user_2023_rc2.sif
- lmgc90_user_2023_rc1.sif
On a server or computer with singularity installed, you can directly use the singularity image to run a single command with:
cd path_to_example
singularity run lmgc90_user_xxxx.sif python command.py
It is preferred to stay in the same image ; for example in order to run several python commands:
singularity shell lmgc90_user_xxxx.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:
Bootstrap: docker
From: ubuntu:jammy
%files
lmgc90_user_xxxx /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 cython3 python-is-python3
apt install -y python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph
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:
singularity build --fakeroot lmgc90_user_xxxx.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.
To build an image, use the following content to create a docker_lmgc90
file.
FROM ubuntu:jammy
# install packages
RUN apt update -y
RUN apt upgrade -y
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 python3-scipy python3-matplotlib python3-pandas python3-vtk9 python3-igraph
RUN apt install -y libhdf5-dev hdf5-tools python3-h5py
# get the sources
COPY lmgc90_user_xxxx /root/lmgc90
# build the sources
WORKDIR /root/lmgc90/build
RUN cmake ../ -DWITH_HDF5=ON -DNO_INSTALL=FALSE -DWITH_OPENMP=True
RUN make && make install
# clean build and source directories
WORKDIR /root/compute
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:
docker build -t lmgc90_user:xxxx -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:
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 several commands, preferably use:
docker run -it -v $PWD/example:/root/compute lmgc90_user:xxxx /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:
docker container prune