PyDrag installation guide

This is the documentation about PyDrag project installation with all required dependencies. Some additional guidelines are also given. This guide has been written for Version5 revisions 5.0.7 to 5.0.10.

Developpement environnement

PyDrag is developped under the following environnement:

  • CentOS Linux release 7.8.2003 (Core)

  • Python 3.6.8 + virtualenv 20.17.0

  • GCC version 7.3.0

  • HDF5 version 1.8.12

Setting environnement variables

First, you need to set some variables used by Version5 and PyGan, by adding or modifying them in your .profile.perso file :

export FORTRANPATH=/soft/gcc/7.3.0/lib64/ #path to your gcc compiler directory containing libgfortran.a
export HDF5_API=/usr/lib64/               #path to your HDF5 directory containing libhdf5.a
module load gcc/7.3.0

This exemple works for RedHat users, but may be adapted to your own system architecture if it differs. Once it is done, re-source your .profile.perso file. On a side note, if you face difficulties to find the directory containing the libhdf5.a file, you can try using the command :

locate libhdf5.a

which will return the right path, to be exported as HDF5_API env variable.

Cloning PyDrag project

You can either clone the project through a direct HTTP protocole or by downloading the project as an archive. If you want to use the HTTP protocole:

  1. Clone the PyDrag project from GitLab into your local machine with the HTTP protocole :

git clone https://gitlab.extra.irsn.fr/PyDrag/PyDrag.git .

Note

GitLab.extra will ask you for your passwords if you want to commit your changes. If it is not working, you may create a PAT (Personal Access Token) in order to access the repository. If you do not own a GitLab Extra account, it is necessary to contact the IRSN admin team.

  1. It may be required to change branch, as the calculation scheme may be developped on different branches :

git checkout [branch_name]

Otherwise, if you want to download the archive :

  1. Download the PyDrag project from GitLab as a TAR (or TGZ) archive (be careful with the branch of the project you want to download!)

  2. Place the archive in the folder of your choice

  3. Unzip it with :

tar -xvzf PyDrag-main.tgz

Installing and compiling Version5

PyDrag is based on PyGan libraries from Version5 (currently, distribution number v5bev3142). You will need DRAGON-related codes and sources. There are two different situations :

  • you want to work with the original Version5 distribution. Then, you can use the ./src/Version5/ folder, containing every sources from this distribution (that is no longer available online). Use the following commands :

    cd ./src/Version5/Donjon/src/
    make
    make clean
    cd ../../Pygan/src/
    make
    
  • you want to work on your own distribution : you need to download the chosen archive from Version5 and compile it

    1. Download the latest TAR archive of Version5 and place it wherever you need

    2. Use the next commands (detailled here for the revision ev3142 and must be adapted to your revision number) :

      tar -xvzf Version5.0.9_ev3142.tgz
      cd Version5.0.9_ev3142/Donjon/src/
      make
      make clean
      cd ../../Pygan/src/
      make
      

By default, using the ‘make’ command in Donjon folder allows your system to compile Donjon code and all its depedencies. If there is any problem, you can try to make this process for each codes (in this exact order) : Utilib, Ganlib, Dragon, Donjon, PyGan.

Sourcing PyGan libraries

Source the PyGan library path in your .profile.perso file by adding the path to PyGan python libraries :

export PYTHONPATH=[my_personnal_folder]/src/Version5/PyGan/lib/Linux_x86_64/python/

where ‘[my_personnal_folder]’ is the path to the folder containing PyDrag project. At this step, you should have cloned PyDrag project and compiled/sourced PyGan.

Manage the Python virtual environnement

You will need Python3 to use PyDrag, as well as the built-in modules “os”, “math”, “sys”, “multiprocessing” and the module “numpy”. To ensure these requirements, you have to create a virtual environnement (unless you already have one).

Warning

For now, PyDrag does not work correctly on Conda forge environnements. In fact, there already is a module named “lcm” in most conda distribution, what comes into conflict with one of the PyDrag module. Moreover, the tested Conda env do not work with the global variable PYTHONPATH, that is required with PyGan modules.

  1. Create and enable a virtual environnement with virtualenv (see Virtual environnement configuration or Official virtualenv documentation)

  2. Install all the required official Python packages

pip install -r requirements.txt

Now, you should be able to use PyDrag !