Motivation
On HPC cluster (high performance computing/supercomputer), it is often to have multiple version of the same software installed. When the user want to use the specific software which the certain library, changing environment variable like $PATH manually is tedious and sometime difficult, the is the common errors during running job in HPC. To solve the problem, corresponding shell script would have to be written for multiple languages. All of these explicit steps are error prone and difficult to maintain. It is also no simple upgrade path. One exist solution is by using
modulefiles, a (Unix) tool for dynamic modification
of a user's environment.
Module Commands
Here are some module commands:
- module avail: to check available modulefiles
- module list: view current active modules
- module purge: delete currently loaded modules
- module load <package>: to load default module <package>
- module load <package/version>: to load module <package> on specific version.
- module unload <package>: unload the package
- module show <package>: display command triggered by module load
- module whatis <package>: display 1-line info about the module
- module help <package>: need a help?
Task/Exercise
Do the following task to load fftw3 package via modulefiles and test it with a job.
- Download FFTW3 and install the package on virtual server
- Create the a module for the FFTW package (filename: fftw3)
- Run the code within jobscript
Solution
Here the my solution for the given task (
code hosted in Github):
- Login to master/frontend on cluster as root
- Download the latest fftw3
3
- Make directory on /opt/fftw3
- Install fftw3 as single precision with:
$ ./configure --prefix=/opt//fftw3 --disable-shared \
--enable-static --enable-single --enable-fortran
$ make
$ make install
- Install fftw3 with double precision with:
make clean
$ ./configure --prefix=/opt/soft/libs/fftw3 --disable-shared \
--enable-static --enable-fortran
$ make
$ make install
- Set the prefix in file fftw according to installation path (/opt/fftw3)
- Move fftw to modulefiles path (/usr/share/Module/modulefiles, check it with module avail)
- Compile job
$ make all
- Load module
$ module load fftw3
- Make bash script for the jobb >> diffusion.sh
- Submit job to the cluster
$ qsub diffusion.sh
- Check if there is any error (XX is output number):
$ qstat -f>
$ more diffusion.sh.oXX