Programming Environments On Sahasrat (Cray-Xc40 System)
Programming Environments On Sahasrat (Cray-Xc40 System)
(Cray-XC40 system)
Dr. J. Lakshmi
SERC, Indian Institute of Science
Bangalore-12, India
SahasraT: Massively Parallel Processing Class
Machine
• Built to enable co-ordinated processing among multiple
processing elements.
• Hardware composed of several independent distributed nodes
interconnected with a high speed – high bandwidth network
and storage.
• Each node complemented with system software and libraries
to support parallel processing program executions.
Overview of Programming Envs. on SahasraT
Programming Programming Optimized Scientific
Languages Compilers Tools I/O Libraries
models Libraries
• Modules utility
– Consists of the module command and module files
– Initialized environment for a specific compiler
– Allows easy swapping of compilers and compiler versions
Cray Programming Environment
• The default compiler on XC system • Full integrated and optimized support
– Specifically designed for HPC applications for PGAS languages
– Takes advantage of Cray’s experience with – UPC 1.2 and Fortran 2008 coarray support
automatic vectorization and – No preprocessor involved
shared memory parallelization – Full debugger support (With Allinea DDT)
• Excellent standards support for multiple• OpenMP and automatic multithreading
languages and programming models fully integrated
– Fortran 2008 standards compliant – Share the same runtime and resource pool
– C++11 compliant – Aggressive loop restructuring and scalar
– OpenMP 4.5 optimization done in the presence of
– OpenACC 2.0 compliant OpenMP
– Consistent interface for managing OpenMP
and automatic multithreading
Introduction to modules
• On SahasraT runtime environment is established using environment modules
• Provides for the dynamic modification of a user's environment via modulefiles
• Each modulefile contains the information needed to configure the shell for an
application
– Typically alter or set shell environment variables such as PATH, MANPATH, etc.
• Modules can be loaded and unloaded dynamically and atomically, in an clean
fashion
• All popular shells are supported
– including bash,ksh, zsh, sh, csh, tcsh, as well as some scripting languages such
as perl and python
• Useful in managing different applications and versions of applications
• Can be bundled into metamodules
– load an entire suite of different applications
Runtime Environment Setup
• The Cray XC system uses modules in the user environment to support
multiple software versions and to create integrated software packages
• As new versions of the supported software and associated man pages
become available, they are added automatically to the Programming
Environment as a new version, while earlier versions are retained to
support legacy applications
• You can use the default version of an application, or you can choose
another version by using Modules system commands
• Users can create their own modules or admins can install site specific
modules available to many users
Module commands
SahasraT Modules
● Or removed entirely
e.g.: module unload perftools
Modifying the default environment
● In general, you should make use of the modules system rather than
embedding specific directory paths into your startup files, makefiles,
and scripts
What module does ?
“Meta”-Module PrgEnv-X
crayadm@login2:~> module show PrgEnv-cray
• PrgEnv-X is a “meta”-module -----------------------------------------------------
/opt/cray/pe/modulefiles/PrgEnv-cray/6.0.4:
– loading several modules, conflict PrgEnv
conflict PrgEnv-x1
• including the compiler, conflict PrgEnv-x2
conflict PrgEnv-gnu
• the corresponding mathematical libs, conflict PrgEnv-intel
conflict PrgEnv-pgi
• MPI, conflict PrgEnv-pathscale
conflict PrgEnv-cray
• system environment needed for the setenv PE_ENV CRAY
prepend-path PE_PRODUCT_LIST CRAY
compiler wrappers setenv cce_already_loaded 1
module load cce/8.7.3
setenv craype_already_loaded 1
module swap craype/2.5.15
module swap cray-mpich cray-mpich/7.7.2
module load cray-libsci
module load pmi
module load rca
module load atp
module load perftools-base
setenv CRAY_PRGENVCRAY loaded
Cray modules
● cray-mpich : Loads optimized MPICH3 module
● Cray XC system :
module load craype-haswell (Sahasrat – For CPU)
module load craype-ivybridge (Sahasrat – For GPU Host)
Note : x86_64 instruction will be loaded by default
● Accelerators
module load craype-mic-knl (Sahasrat – For KNL)
module load craype-accel-nvidia35 ( Sahasrat - Kepler GPU )
Summary
• Various applications in various versions
available • Metamodules feature bundles
$> module avail # lists all multiple modules
$> module avail cce # cce*
• Can create your own (meta)modules
• Dynamic modification of a user’s environment • Module tool takes care
$> module (un)load PRODUCT/MODULE – Environment variables
– E.g. PrgEnv-xxx changes compilers, linked
libraries, and environment variables
• PATH, MANPATH, LD_LIBRARY_PATH,
LM_LICENSE_FILE,....
• Version management – Compiler and linker arguments of
$> module switch prod_v1 prod_v2 loaded products
$> module switch PrgEnv-cray PrgEnv-gnu
$> module switch cce cce/8.7.0 • Include paths, linker paths, …
Compiling Applications
on SahasraT
Compiler Driver Wrappers
• All applications that will run in parallel on the Cray XC should be compiled
with the standard language wrappers.
• Compiler drivers for each language are:
– cc – wrapper around the C compiler
– CC – wrapper around the C++ compiler
– ftn – wrapper around the Fortran compiler
• Scripts will choose the required compiler version, target architecture options,
scientific libraries and their include files automatically from the current used
module environment
• Use them exactly like you would use the original compiler
E.g. To compile prog1.f90:
$> ftn –o myprog myprog.f90
Compiler Driver Wrappers (2)
• The scripts choose which compiler to use from the PrgEnv module loaded
PrgEnv Description Real Compilers
PrgEnv-cray Cray Compilation Environment crayftn, craycc, crayCC
PrgEnv-intel Intel Composer Suite ifort, icc, icpc
PrgEnv-gnu GNU Compiler Collection gfortran, gcc, g++
PrgEnv-pgi Portland Group Compilers pgf90, pgcc, pgCC
• PrgEnv-cray is loaded by default at login. This may differ on other Cray systems.
– use module list to check what is currently loaded
• This executable may not run on the login nodes (nor pre/post nodes)
– Login nodes do not support running distributed memory applications
– Some Cray architectures may have different processors in the login and compute
nodes. Typical error is ‘… illegal Instruction …’
1. Default – Follow the default Linux policy and at runtime use the system default version of
the shared libraries (so may change as and when system is upgraded)
2. pseudo-static – Hardcodes the path of each library into the binary at compile time.
Runtime will attempt to use this version when the application start (as long as lib is still
installed). Set CRAY_ADD_RPATH=yes at compile
3. Dynamic modules – Allow the currently loaded PE modules to select library version at
runtime. App must not be linked with CRAY_ADD_RPATH=yes and must add “export
LD_LIBRARY_PATH=$CRAY_LD_LIBRARY_PATH:$LD_LIBRARY_PATH” to run script
OpenMP
• OpenMP is support by all of the PrgEnvs.
– CCE (PrgEnv-cray) recognizes and interprets OpenMP directives by default. If you have OpenMP directives in
your application but do not wish to use them, disable OpenMP recognition with –hnoomp.
• To verify that you are using the correct version of a compiler, use:
– -V option on a cc, CC, or ftn command with PGI, Intel and Cray
– --version option on a cc, CC, or ftn command with GNU
Steps to compile application for CPU architecture
• Do not call compilers directly. Use cray compiler drivers
cc : For c programming language
CC : For C++ programming language
ftn : For fortran programming language
• Detailed information can be found in the corresponding man pages on the system
• The entire information about your simulation execution is contained in a batch script which is submitted via
qsub.
• The batch script contains one or more parallel job runs executed via aprun.
Any questions?
mailto: [email protected]
Thankyou and Happy computing!