Application development (Fimm)From Hpcdoc
ModulesEnvironment Modules allows you to dynamically modify your user environment by using information provided by "modulefiles". This make it easy to change between environments or settings, e.g. the Intel compiler environment and the PGI compiler environment. If you have problems during compiling, running the "module list" command could help you see if you have missing or wrong environment modules loaded. When writing a PBS job script (see Job execution for more information), the wanted environment has to be set inside the script using the modules command. The reason for this is that the user environment is not inherited by the PBS script. The same applies for interactive jobs (i.e. qsub -I). The "module" command have several subcommands, e.g. "module avail". The following list shows some of the subcommands used with "module".
To load the netcdf module into your environment you type: module load netcdf If you want a specific version of the module you instead specify: module load netcdf/3.6.2 Please avoid using version numbers unless strictly necessary since older versions of packages may be removed at a later time. If you want to change from the PGI compiler (default) to the Intel compiler you type: module swap pgi intel You should also use swap if you want to load a different version of the same module, this will e.g. replace your current pgi version with 8.0.6: module swap pgi pgi/8.0.6 A complete list of subcommands can be found in the module man page or here. Please note, if the module command does not work inside your job scripts, add the line "export -f module" to your ~/.bashrc file. This should be automatically set for new users and is only valid if your shell is bash. For other shells you may source the corresponding file in /opt/modules/default/init/ inside your qsub script before you use any "module" command. Compilers and programming languagesFour different compilers are available on Fimm:
To switch between compilers module command must be used: module switch pgi gnu By default the latest available version will be loaded. You can switch to another compiler version with e.g.: module switch pgi pgi/8.0.6 How to invoke the compilerCompiling an application for use on the compute node should be done by the wrappers specified below. Running the command "module list" will give you list of software which is already loaded properly to your environment. Compiling programsWhen using the compiler wrappers, the wrappers take care of MPI and all additional modules switches/settings automatically.
NOTE: These wrappers also handles MPI and openMP, so you should not compile with mpicc, mpif90 or similar, nor should you need to add any reference to MPI libraries in CFLAGS or similar variables. Compiling the C program test.c can be done by the command: cc -o test.out test.c Where test.out is my selected name of the executable file. Compiler version(s)Currently installed Programming Environments for compilers:
Frequently used compiler optionsCompiling OpenMP programs To activate OpenMP directives, compile and link with Fortran:
C and C++:
Recommended compiler optionsNormally if you use compiler wrappers all recommended options will be included. In some cases you may need to use "--enable-static" during configure for running on compute nodes. Usefull optimization flags for quadcore When using PGI the "-tp barcelona-64" flag will improve the performance of your code. For Pathscale the flag for optimizing for quadcore is "-march=barcelona". These options are automatically provided by the module xtpe-barcelona. Recommended environment variable settingsWe recommend you to have the module xtpe-barcelona loaded. It will automatically add recommended optimization flags. Additionally, the "xt-libsci" module contains optimized versions of common scientific/math libraries (e.g. LAPACK, BLAS). Debugging toolsstrace - trace system calls and signals. http://people.gnome.org/~newren/tutorials/developing-with-gnome/html/ch03s02.html gdb - The GNU Debugger http://www.gnu.org/software/gdb/ Local file systemsOn all compute nodes there are local disk which user can use compute-0-x compute-1-x compute-2-x compute-7-x 50 GB /state/partition1 compute-3-x compute-6-x 85 GB /state/partition1 Recommended reading | ||||||||||||||||||||||||||||||||||||||||||