Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pandoc:introduction-to-vsc:04_module_environment:01_modules [2018/01/31 11:10] – Pandoc Auto-commit pandocpandoc:introduction-to-vsc:04_module_environment:01_modules [2020/10/20 08:09] (current) – Pandoc Auto-commit pandoc
Line 1: Line 1:
 +====== Software management ======
 +
 +  * Article written by Markus Stöhr (VSC Team) <html><br></html>(last update 2017-10-09 by ms).
 +
 +
 +
 +===== Considerations =====
 +
 +  - Find a suitable **location and directory structure** for serveral versions of the same library/code
 +  - Manage the **user environment** to be able to access the correct version automatically
 +  - Manage different software stacks, e.g. use different compiler(-version) or different library versions to build another library (–> 1.)
 +
 +
 +----
 +
 +===== Location of compiled software =====
 +
 +<code>
 +mountpoint
 +└── processor architecture
 +    │
 +    └── glibc (C-library) of OS
 +        │   
 +        └── processor type
 +            │   
 +            └──program name
 +               │   
 +               └──program version
 +
 +</code>
 +
 +<code>
 +/opt/sw
 +└── x86_64
 +    │   
 +    └── glibc-2.17
 +        │   
 +        └── ivybridge-ep
 +            │   
 +            └──hdf5
 +               │   
 +               └──1.8.18-MPI
 +</code>
 +
 +
 +
 +----
 +
 +==== Details of hdf5/1.8.18-MPI ====
 +
 +<code>
 +tree -d -L 5 /opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5/1.8.18-MPI
 +</code>
 +<code>
 +/opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5/1.8.18-MPI
 +├── gcc
 +│   └── 5.3
 +│       └── intel-mpi
 +│           └── 5
 +│               ├── bin
 +│               ├── include
 +│               ├── lib
 +│               └── share
 +└── intel
 +    ├── 15
 +    │   └── intel-mpi
 +    │       └── 5
 +    │           ├── bin
 +    │           ├── include
 +    │           ├── lib
 +    │           └── share
 +    ├── 16
 +    │   └── intel-mpi
 +    │       └── 5
 +    │           ├── bin
 +    │           ├── include
 +    │           ├── lib
 +    │           └── share
 +    └── 17
 +        └── intel-mpi
 +            └── 2017
 +                ├── bin
 +                ├── include
 +                ├── lib
 +                └── share
 +</code>
 +Software used for compiling is reflected in the directory structure
 +
 +===== Environment Modules =====
 +
 +  * **environment**: global variables available to current and all sub-shells (‘env’/ ‘set’ )
 +  * http://modules.sourceforge.net/
 +  * **module**: all modifications (set and prepend to variables) in the user environment necessary for using a piece of software
 +  * handles additional software, which is not installed to default system paths
 +  * makes different versions of one piece of software available
 +  * **prerequisites**: loading a module may require loading other modules before
 +
 +
 +----
 +
 +<code>
 +module avail
 +</code>
 +  * shows available modules.
 +  * searches paths given by ''%%MODULEPATH%%''
 +
 +  * own modules can be added by extending ''%%MODULEPATH%%''
 +  * If multiple modules with the same name/version are present in different directories, the first found by ''%%MODULEPATH%%'' will be used.
 +
 +  * two parts:
 +    * software name (directory)
 +    * version (file with definitions)
 +
 +
 +<code>
 +ls /opt/sw/Modules/Libraries/hdf5
 +1.6.10  1.8.14      1.8.14-SERIAL  1.8.18      1.8.18-SERIAL
 +1.8.12  1.8.14-MPI  1.8.16         1.8.18-MPI
 +</code>
 +
 +
 +
 +----
 +
 +<code>
 +module load <modulename>
 +</code>
 +<code>
 +[markus@l33 ~]$ module load hdf5/1.8.18-MPI
 +
 +You are not meeting the prereq of this module. Currently loaded modules:
 +None
 +
 +The following modules combinations can be loaded:
 +(1): module load intel/15 intel-mpi/5 hdf5/1.8.18-MPI
 +(2): module load intel/16 intel-mpi/5 hdf5/1.8.18-MPI
 +(3): module load gcc/5.3 intel-mpi/5 hdf5/1.8.18-MPI
 +(4): module load intel/17 intel-mpi/2017 hdf5/1.8.18-MPI
 +
 +
 +</code>
 +Do copy and paste:
 +
 +<code>
 +module load intel/16 intel-mpi/5 hdf5/1.8.18-MPI
 +
 +</code>
 +
 +
 +
 +----
 +
 +<code>
 +module list
 +</code>
 +  * list currently loaded modules
 +
 +
 +----
 +
 +<code>
 +module purge 
 +</code>
 +  * remove all loaded modules;
 +  * recommended in job scripts before loading any modules (reproducibility)
 +
 +<code>
 +module remove <modulename> <modulename> ...
 +</code>
 +  * removes a list of modules
 +
 +
 +
 +
 +----
 +
 +<code>
 +module show  <modulename>
 +</code>
 +  * shows the variables added to your environment by a module
 +
 +<code>
 +module show hdf5/1.8.18-MPI
 +/opt/sw/Modules/Libraries/hdf5/1.8.18-MPI:
 +
 +conflict         hdf5 
 +setenv           VSC_HDF5_ROOT      /opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5/1.8.18-MPI/intel/16/intel-mpi/
 +
 +prepend-path     CPATH                  $VSC_HDF5_ROOT/include 
 +prepend-path     INCLUDE                $VSC_HDF5_ROOT/include 
 +setenv           VSC_HDF5_INCLUDE       $VSC_HDF5_ROOT/include 
 +
 +prepend-path     LD_LIBRARY_PATH        $VSC_HDF5_ROOT/lib 
 +prepend-path     LIBRARY_PATH           $VSC_HDF5_ROOT/lib 
 +setenv           VSC_HDF5_LIB           $VSC_HDF5_ROOT/lib 
 +
 +prepend-path     PATH                   $VSC_HDF5_ROOT/bin 
 +setenv           VSC_HDF5_BIN           $VSC_HDF5_ROOT/bin 
 +
 +setenv           VSC_HDF5_VERSION_MAJOR 1 
 +setenv           VSC_HDF5_VERSION_MINOR 8 
 +setenv           VSC_HDF5_VERSION_MICRO 18-MPI 
 +setenv           VSC_HDF5_VERSION 1.8 
 +-------------------------------------------------------------------
 +</code>
 +===== Exercises =====
 +
 +  * look at your user environment:
 +
 +<code>
 +env
 +env |grep PATH
 +echo $PATH |tr ':' '\n'
 +echo $LD_LIBRARY_PATH |tr ':' '\n'
 +echo $MODULEPATH |tr ':' '\n'
 +</code>
 +  * inspect the contents of the directories in MODULEPATH
 +  * look at directory structure of installed software, e.g.:
 +
 +<code>
 +tree -d /opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5
 +</code>
 +  * try the module commands
 +
 +<code>
 +module avail
 +module load hdf5/1.8.18-MPI #follow instructions in shell!
 +module list 
 +module show hdf5/1.8.18-MPI
 +module purge
 +</code>
 +  * compare ''%%PATH%%'' and ''%%LD_LIBRARY_PATH%%'' before and after loading a module
 +
 +===== Adding own gnuplot module =====
 +
 +  * setup your own modules directory and a directory for gnuplot
 +
 +<code>
 +mkdir ${HOME}/mymodules
 +mkdir ${HOME}/mymodules/gnuplot
 +</code>
 +  * prepend own module directory to ''%%MODULEPATH%%'':
 +
 +<code>
 +export MODULEPATH=${HOME}/mymodules:$MODULEPATH
 +</code>
 +
 +  * create module file: ''%%${HOME}/mymodules/gnuplot/5.0.5%%'':
 +
 +<code>
 +#%Module
 +set inst_base $env(HOME)/mysoftware/gnuplot/5.0.5
 +
 +prepend-path PATH $inst_base/bin
 +prepend-path LD_LIBRARY_PATH $inst_base/lib
 +append-path CPATH $inst_base/include
 +setenv MYVAR test1234
 +</code>
 +
 +
 +===== Exercises =====
 +
 +  * check how module is loaded by default VSC-3 modules
 +
 +<code>
 +module avail 2>& | less #search for gnuplot; use '/' within less for searching
 +module load gnuplot/5.0.5
 +module show gnuplot/5.0.5
 +
 +</code>
 +  * create own module environment as described on previous slide, create a directory within your training sub-folder
 +  * check again, how the module is loaded.
 +
 +
 +===== Simple example =====
 +
 +eg. from HDF5:
 +
 +<code>
 +EXAMPLE=$VSC_HDF5_ROOT/share/hdf5_examples/c/ph5example.c
 +</code>
 +
 +
 +Compile using Intel C Compiler ([[examples/compile-intel.sh|file]]):
 +
 +<code>
 +module purge
 +module load intel/16 \
 +    intel-mpi/5 hdf5/1.8.18-MPI
 +
 +cp $EXAMPLE .
 +mpiicc -lhdf5 ph5example.c -o ph5example
 +</code>
 +
 +
 +Compile using Gnu C Compiler ([[examples/compile-gnu.sh|file]]):
 +
 +<code>
 +module purge
 +module load gcc/5.3 \
 +    intel-mpi/5 hdf5/1.8.18-MPI
 +
 +cp $EXAMPLE .
 +mpicc -lhdf5 ph5example.c -o ph5example
 +</code>
 +
 +
 +
 +If needed add e.g. include directory explicitly:
 +
 +<code>
 +mpiicc -I$VSC_HDF5_INCLUDE -lhdf5 ph5example.c -o ph5example
 +</code>
 +
 +
 +
 +----
 +
 +===== Compiler names =====
 +
 +Hint:
 +
 +  * mpiifort
 +  * mpifort
 +  * mpicc
 +  * mpiicc
 +
  
  • pandoc/introduction-to-vsc/04_module_environment/01_modules.1517397052.txt.gz
  • Last modified: 2018/01/31 11:10
  • by pandoc