====== Software management ====== * Article written by Markus Stöhr (VSC Team)
(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 ===== mountpoint └── processor architecture │ └── glibc (C-library) of OS │      └── processor type │   └──program name │   └──program version /opt/sw └── x86_64 │   └── glibc-2.17 │   └── ivybridge-ep │   └──hdf5 │   └──1.8.18-MPI ---- ==== Details of hdf5/1.8.18-MPI ==== tree -d -L 5 /opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5/1.8.18-MPI /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 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 ---- module avail * 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) 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 ---- module load [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 Do copy and paste: module load intel/16 intel-mpi/5 hdf5/1.8.18-MPI ---- module list * list currently loaded modules ---- module purge * remove all loaded modules; * recommended in job scripts before loading any modules (reproducibility) module remove ... * removes a list of modules ---- module show * shows the variables added to your environment by a module 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/5 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 ------------------------------------------------------------------- ===== Exercises ===== * look at your user environment: env env |grep PATH echo $PATH |tr ':' '\n' echo $LD_LIBRARY_PATH |tr ':' '\n' echo $MODULEPATH |tr ':' '\n' * inspect the contents of the directories in MODULEPATH * look at directory structure of installed software, e.g.: tree -d /opt/sw/x86_64/glibc-2.17/ivybridge-ep/hdf5 * try the module commands module avail module load hdf5/1.8.18-MPI #follow instructions in shell! module list module show hdf5/1.8.18-MPI module purge * 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 mkdir ${HOME}/mymodules mkdir ${HOME}/mymodules/gnuplot * prepend own module directory to ''%%MODULEPATH%%'': export MODULEPATH=${HOME}/mymodules:$MODULEPATH * create module file: ''%%${HOME}/mymodules/gnuplot/5.0.5%%'': #%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 ===== Exercises ===== * check how module is loaded by default VSC-3 modules module avail 2>&1 | less #search for gnuplot; use '/' within less for searching module load gnuplot/5.0.5 module show gnuplot/5.0.5 * 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: EXAMPLE=$VSC_HDF5_ROOT/share/hdf5_examples/c/ph5example.c Compile using Intel C Compiler ([[examples/compile-intel.sh|file]]): module purge module load intel/16 \ intel-mpi/5 hdf5/1.8.18-MPI cp $EXAMPLE . mpiicc -lhdf5 ph5example.c -o ph5example Compile using Gnu C Compiler ([[examples/compile-gnu.sh|file]]): module purge module load gcc/5.3 \ intel-mpi/5 hdf5/1.8.18-MPI cp $EXAMPLE . mpicc -lhdf5 ph5example.c -o ph5example If needed add e.g. include directory explicitly: mpiicc -I$VSC_HDF5_INCLUDE -lhdf5 ph5example.c -o ph5example ---- ===== Compiler names ===== Hint: * mpiifort * mpifort * mpicc * mpiicc