- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
- Information contained in the HLRS Wiki is not legally binding and HLRS is not responsible for any damages that might result from its use -
CRAY XC40 Tools: Difference between revisions
Line 107: | Line 107: | ||
* '''[[CRAY_XC40_Tools#perftools|perftools]]''' (fully adjustable CrayPAT, using pat_build and pat_report) | * '''[[CRAY_XC40_Tools#perftools|perftools]]''' (fully adjustable CrayPAT, using pat_build and pat_report) | ||
===== CrayPAT | ===== CrayPAT ===== | ||
The | The perftools-lite modules provide a user-friendly way to auto-instrument your application for various profiling cases. The perftools module provide CrayPATs full functionality. As described below instrumentation and report generation can be triggered manually specifying various options. | ||
In the following | In the following descriptions we assume using a simple batch job script: | ||
<pre>$> cat job.pbs | <pre>$> cat job.pbs | ||
#!/bin/bash | #!/bin/bash | ||
Line 121: | Line 121: | ||
</pre> | </pre> | ||
An application is instrumented and run using the following commands: | |||
<pre>$> module load perftools-base | <pre>$> module load perftools-base | ||
$> module load | $> module load <CrayPAT-lite-module> | ||
$> make clean; make | $> make clean; make | ||
$> qsub job.pbs <span style="color:#808080"># no changes needed: aprun –n 24 app.exe >& job.out </span> | $> qsub job.pbs <span style="color:#808080"># no changes needed: aprun –n 24 app.exe >& job.out </span> | ||
Line 130: | Line 129: | ||
</pre> | </pre> | ||
As a result a *.rpt and a *.ap2 file are created and the report is additionally printed to stdout. | As a result a *.rpt and a *.ap2 file are created and the report is additionally printed to stdout. | ||
Additional information and representation can be gathered using '''pat_report''' with the produced *.ap2 file. | |||
<pre>$> pat_report <option> *.ap2 </pre> | |||
Descriptions of the available option can be obtained using ''man pat_report'' | |||
REMEMBER: After the experiment is complete, unload perftools-lite-XXX module to prevent further program instrumentation. The perftools-base module can be kept loaded. | |||
====== perftools-lite ====== | |||
This module is default CrayPat-lite profiling. It enables sampling of the application. | |||
Beside other information the Profiling by Function Group and Function is presented in the report: | Beside other information the Profiling by Function Group and Function is presented in the report: | ||
Line 152: | Line 160: | ||
</pre> | </pre> | ||
Where the stack trace of all processes are merged and the combined information is presented as relative and absolute values of the counted samples in the group/function and imbalances between processes. | Where the stack trace of all processes are merged and the combined information is presented as relative and absolute values of the counted samples in the group/function and imbalances between processes. | ||
====== perftools-lite-events ====== | |||
This module enables CrayPATs event tracing of applications. After loading the modules, re-compiled/linked the application and submitting the job as usual, the report is written in the above described way. | |||
In contrast to sampling, event tracing reports out real time in groups / functions. | |||
====== perftools-lite-loops ====== | |||
This module enables CrayPat-lite loop work estimates. It must be used with Cray compiler. After proceeding in the above described way, loop work estimates are sent to stdout and to .ap2 file. Performance data can be combined with source code information and compiler annotation using the .ap2 file with Reveal. | |||
The module modify the compile and link steps to include CCE’s –h profile_generate option and instrumenting the program for tracing (pat_build -w). Remember that –h profile_generate reduces compiler optimization levels. After experiment is complete, unload perftools-lite-loops to prevent further program instrumentation. | |||
<pre>Table 1: Inclusive and Exclusive Time in Loops (from -hprofile_generate) | |||
Loop | Loop Incl | Time | Loop | Loop | Loop | Loop |Function=/.LOOP[.] | |||
Incl | Time | (Loop | Hit | Trips | Trips | Trips | PE=HIDE | |||
Time% | | Adj.) | | Avg | Min | Max | | |||
|----------------------------------------------------------------------------- | |||
| 93.0% | 19.232051 | 0.000849 | 2 | 26.5 | 3 | 50 |jacobi.LOOP.1.li.236 | |||
| 77.8% | 16.092021 | 0.001350 | 53 | 255.0 | 255 | 255 |jacobi.LOOP.2.li.240 | |||
| 77.8% | 16.090671 | 0.110827 | 13515 | 255.0 | 255 | 255 |jacobi.LOOP.3.li.241 | |||
| 77.3% | 15.979844 | 15.979844 | 3446325 | 511.0 | 511 | 511 |jacobi.LOOP.4.li.242 | |||
| 14.1% | 2.906115 | 0.001238 | 53 | 255.0 | 255 | 255 |jacobi.LOOP.5.li.263 | |||
</pre> | |||
====== perftools ====== | |||
In contrast to the perftools-lite module, which automatically instrument and report, the perftools module require a manually instrumentation and report generation: | |||
<pre>$> module load perftools-base | |||
$> module load perftools | |||
$> make clean; make # If your application is already built with perftools loaded you do not have to rebuild when switching the experiment. | |||
$> pat_build <pat_options> app.exe # pat_options are described below; Creates instrumented binary app.exe+pat | |||
$> qsub job.pbs # ATTENTION: now you have to use the new instrumented binary "aprun <options> ./app.exe+pat" | |||
$> pat_report –o myrep.txt app.exe+pat+* | |||
</pre> | |||
Running the “+pat” binary creates a data file or directory. ''pat_report'' reads that data file and prints lots of human-readable performance data. It also creates an *.ap2 file which contains all profiling data. (The app.exe+pat+* file/directory can be deleted after the creation of the .ap2 file) | |||
The instrumentation can be adjusted using ''pat_build'' options, which are listed in '''man pat_build''', some few commonly used options are: | |||
{|border="1" cellpadding="2" | |||
!width="100"|Option | |||
!width="400"|Description | |||
|- | |||
| | |||
|Sampling profile | |||
|- | |||
| style="text-align:center;"| -u | |||
|tracing of functions in source file owned by the user | |||
|- | |||
| style="text-align:center;"| -w | |||
|Tracing is default experiment | |||
|- | |||
| style="text-align:center;"| -T <func> | |||
| Specifies a function which will be traced | |||
|- | |||
| style="text-align:center;"| -t <file> | |||
|All functions in the specified file will be traces | |||
|- | |||
| style="text-align:center;"| -g <group> | |||
|Instrument all functions belonging to the specified trace function group, e.g. blas, io, mpi, netcdf, syscall | |||
|} | |||
It should be noted, that only true function calls can be traced. Functions that are inlined by the compiler or that have local scope in a compilation unit cannot be traced. | |||
===== Reveal ===== | ===== Reveal ===== |
Revision as of 12:29, 30 October 2015
Cray provided tools
Cray does provide several official tools. Below is a list of some of the tools, you can get more information about them in the online manual (man atp for example).
At HLRS Cray also supports some tools with limited or no support. Currently available is the Cray Profiler
ATP : Abnormal Termination Processing
Abnormal Termination Processing (ATP) is a system that monitors Cray system user applications. If an application takes a system trap, ATP performs analysis on the dying application. All stack backtraces of the application processes are gathered into a merged stack backtrace tree and written to disk as the file, atpMergedBT.dot. The stack backtrace tree for the first process to die is sent to stderr as is the number of the signal that caused the application to fail. If Linux core dumping is enabled (see ulimit or limit in your shell documentation), a heuristically selected set of processes also dump their cores.
The atpMergedBT.dot file can be viewed with statview, (the Stack Trace Analysis Tool viewer), which is included in the Cray Debugger Support Tools (module load stat), or alternatively with the file viewer dotty, which can be found on most Linux systems. The merged stack backtrace tree provides a concise yet comprehensive view of what the application was doing at the time of its termination.
At HLRS ATP module is loaded by default. To use it you have to set ATP_ENABLED=1 in your batch script.
STAT : Stack Trace Analysis Tool
Stack Trace Analysis Tool (STAT) is a cross-platform tool from the University of Wisconsin-Madison. It gathers and merges stack traces from a running application’s parallel processes. It creates call graph prefix tree, which are a compressed representation, with scalable visualization and scalable analysis It is very useful when application seems to be stuck/hung. Full information including use cases is available at {http://www.paradyn.org/STAT/STAT.html paradyn}. STAT scales to many thousands of concurrent process.
To use it, you simply load the module and attach it to your running/hanging application.
$> module load stat $> qsub job.pbs #start the application e.g. using a batch script #Wait until application reaches the suspicious state $> STATGUI <JOBID> #Launches the graphical interface #Attach to the job #Shows the calltree $> qdel <JOBID> #Terminate the running application
IOBUF - I/O buffering library
IOBUF is an I/O buffering library that can reduce the I/O wait time for programs that read or write large files sequentially. IOBUF intercepts I/O system calls such as read and open and adds a layer of buffering, thus improving program performance by enabling asynchronous prefetching and caching of file data.
IOBUF can also gather runtime statistics and print a summary report of I/O activity for each file.
In general, no program source changes are needed in order to take advantage of IOBUF. Instead, IOBUF is implemented by following these steps:
Load the IOBUF module:
% module load iobuf
Relink the program. Set the IOBUF_PARAMS environment variable as needed.
% export IOBUF_PARAMS='*:verbose'
Execute the program.
If a memory allocation error occurs, buffering is reduced or disabled for that file and a diagnostic is printed to stderr. When the file is opened, a single buffer is allocated if buffering is enabled. The allocation of additional buffers is done when a buffer is needed. When a file is closed, its buffers are freed (unless asynchronous I/O is pending on the buffer and lazyclose is specified).
Please check the complete manual and all environment variables available by reading the man page (man iobuf, after loading the iobuf module)
IMPORTANT NOTICE : As iobuf is written for serial IO, its behavior is undefined when used for parallel I/O into a single file.
You should never use IOBUF in the case when several parallel processes operates on a single file.
Perftools : Performance Analysis Tool Kit
Description
The Cray Performance Measurement and Analysis Tools (or CrayPat) are a suite of optional utilities that enable you to capture and analyze performance data generated during the execution of your program on a Cray system. The information collected and analysis produced by use of these tools can help you to find answers to two fundamental programming questions: How fast is my program running? and How can I make it run faster? A detailed documantation about CrayPAT can be found in document S-2376-622. Here a short summary is presented, concentrating on the usage.
Profiling is mainly distinguished between two main run cases, sampling and tracing:
Sampling | Tracing |
---|---|
Advantages
|
Advantages
|
Disadvantages
|
Disadvantages
|
Using the fully adjustable CrayPAT, Automatic Profiling Analysis (APA) is a guided tracing combining the advantages of Sampling and tracing. Furthermore, the event tracing can be enhanced by using loop profiling.
Usage
Starting with perftools version 6.3.0 as a basis the module perftools-base should be loaded. This provides access to man pages, Reveal, Cray Apprentice2, and the new instrumentation modules. This module can be kept loaded without impact to applications. As instrumentation modules following is available:
- perftools-lite (sampling experiments)
- perftools-lite-events (tracing experimants)
- perftools-lite-loops (collect data for auto-parallelization / loop estimates in Reveal)
- perftools-lite-gpu (gpu kernel and data movemnets)
- perftools (fully adjustable CrayPAT, using pat_build and pat_report)
CrayPAT
The perftools-lite modules provide a user-friendly way to auto-instrument your application for various profiling cases. The perftools module provide CrayPATs full functionality. As described below instrumentation and report generation can be triggered manually specifying various options. In the following descriptions we assume using a simple batch job script:
$> cat job.pbs #!/bin/bash #PBS –l nodes=1:ppn=24 #PBS –l walltime=00:10:00 #PBS –j oe #PBS -o job.out cd $PBS_O_WORKDIR aprun –n 384 –N 24 <exe>
An application is instrumented and run using the following commands:
$> module load perftools-base $> module load <CrayPAT-lite-module> $> make clean; make $> qsub job.pbs <span style="color:#808080"># no changes needed: aprun –n 24 app.exe >& job.out </span> $> less job.out
As a result a *.rpt and a *.ap2 file are created and the report is additionally printed to stdout.
Additional information and representation can be gathered using pat_report with the produced *.ap2 file.
$> pat_report <option> *.ap2
Descriptions of the available option can be obtained using man pat_report
REMEMBER: After the experiment is complete, unload perftools-lite-XXX module to prevent further program instrumentation. The perftools-base module can be kept loaded.
perftools-lite
This module is default CrayPat-lite profiling. It enables sampling of the application.
Beside other information the Profiling by Function Group and Function is presented in the report:
Table 1: Profile by Function Group and Function (top 8 functions shown) Samp% | Samp | Imb. | Imb. |Group | | Samp | Samp% | Function | | | | PE=HIDE 100.0% | 263.4 | -- | -- |Total |---------------------------------------------------------------------- | 78.0% | 205.3 | -- | -- |MPI ||--------------------------------------------------------------------- || 62.4% | 164.4 | 115.6 | 42.2% |mpi_bcast || 10.4% | 27.4 | 186.6 | 89.1% |MPI_ALLREDUCE || 4.7% | 12.4 | 86.6 | 89.3% |MPI_IPROBE ||===================================================================== | 13.1% | 34.5 | -- | -- |USER ||--------------------------------------------------------------------- ... |======================================================================
Where the stack trace of all processes are merged and the combined information is presented as relative and absolute values of the counted samples in the group/function and imbalances between processes.
perftools-lite-events
This module enables CrayPATs event tracing of applications. After loading the modules, re-compiled/linked the application and submitting the job as usual, the report is written in the above described way. In contrast to sampling, event tracing reports out real time in groups / functions.
perftools-lite-loops
This module enables CrayPat-lite loop work estimates. It must be used with Cray compiler. After proceeding in the above described way, loop work estimates are sent to stdout and to .ap2 file. Performance data can be combined with source code information and compiler annotation using the .ap2 file with Reveal. The module modify the compile and link steps to include CCE’s –h profile_generate option and instrumenting the program for tracing (pat_build -w). Remember that –h profile_generate reduces compiler optimization levels. After experiment is complete, unload perftools-lite-loops to prevent further program instrumentation.
Table 1: Inclusive and Exclusive Time in Loops (from -hprofile_generate) Loop | Loop Incl | Time | Loop | Loop | Loop | Loop |Function=/.LOOP[.] Incl | Time | (Loop | Hit | Trips | Trips | Trips | PE=HIDE Time% | | Adj.) | | Avg | Min | Max | |----------------------------------------------------------------------------- | 93.0% | 19.232051 | 0.000849 | 2 | 26.5 | 3 | 50 |jacobi.LOOP.1.li.236 | 77.8% | 16.092021 | 0.001350 | 53 | 255.0 | 255 | 255 |jacobi.LOOP.2.li.240 | 77.8% | 16.090671 | 0.110827 | 13515 | 255.0 | 255 | 255 |jacobi.LOOP.3.li.241 | 77.3% | 15.979844 | 15.979844 | 3446325 | 511.0 | 511 | 511 |jacobi.LOOP.4.li.242 | 14.1% | 2.906115 | 0.001238 | 53 | 255.0 | 255 | 255 |jacobi.LOOP.5.li.263
perftools
In contrast to the perftools-lite module, which automatically instrument and report, the perftools module require a manually instrumentation and report generation:
$> module load perftools-base $> module load perftools $> make clean; make # If your application is already built with perftools loaded you do not have to rebuild when switching the experiment. $> pat_build <pat_options> app.exe # pat_options are described below; Creates instrumented binary app.exe+pat $> qsub job.pbs # ATTENTION: now you have to use the new instrumented binary "aprun <options> ./app.exe+pat" $> pat_report –o myrep.txt app.exe+pat+*
Running the “+pat” binary creates a data file or directory. pat_report reads that data file and prints lots of human-readable performance data. It also creates an *.ap2 file which contains all profiling data. (The app.exe+pat+* file/directory can be deleted after the creation of the .ap2 file)
The instrumentation can be adjusted using pat_build options, which are listed in man pat_build, some few commonly used options are:
Option | Description |
---|---|
Sampling profile | |
-u | tracing of functions in source file owned by the user |
-w | Tracing is default experiment |
-T <func> | Specifies a function which will be traced |
-t <file> | All functions in the specified file will be traces |
-g <group> | Instrument all functions belonging to the specified trace function group, e.g. blas, io, mpi, netcdf, syscall |
It should be noted, that only true function calls can be traced. Functions that are inlined by the compiler or that have local scope in a compilation unit cannot be traced.
Reveal
Apprentice2
Cray Profiler
The Cray profiler library is deprecated, but still available on the system. A description can be found here
Third party tools
Gnu-Tools
The module gnu-tools collects more recent versions of basic functionalities, including the GNU building system (autoconf, automake, libtool, m4), as well as bash, cmake, gperf, git, gwak, swig, and bison. The actual versions can be listed using
% module whatis tools/gnu-tools
To use the actual version of bash with full support of the module environment you can simply call
% bash -l myScript.sh
or define the absolute path in the first line of your script
#!/opt/hlrs/tools/gnu-tools/generic/bin/bash -l
Octave
GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. GNU Octave is normally used through its interactive interface (CLI and GUI), but it can also be used to write non-interactive programs. The GNU Octave language is quite similar to Matlab so that most programs are easily portable.
Octave is compiled to run on the compute nodes and can be launched e.g. in an interactive session:
% qsub -I [options] % module load tools/octave % aprun -n 1 -N 1 octave octave.script
PARPACK
With the module hlrs_PARPACK the collections of f77 routines designed to solve large scale eigenvalue problems (ARPACK) and the parallel version (PARPACK) are provided. To link these libraries you only have to load the module
numlib/hlrs_PARPACK
Important Features of ARPACK:
- Reverse Communication Interface.
- Single and Double Precision Real Arithmetic Versions for Symmetric, Non-symmetric,
- Standard or Generalized Problems.
- Single and Double Precision Complex Arithmetic Versions for Standard or Generalized Problems.
- Routines for Banded Matrices - Standard or Generalized Problems.
- Routines for The Singular Value Decomposition.
- Example driver routines that may be used as templates to implement numerous Shift-Invert strategies for all problem types, data types and precision.
Python
Actual versions of Python can be used loading the module tools/python.
SLEPc
The SLEPc (Scalable Library for Eigenvalue Problem Computations) is an extantion of PETSc for solving linear eigenvalue problems in either standard or generalized form. Furthermore, SLEPc can compute partial SVD of a large, sparse, rectangular matrix, and solve nonlinear eigenvalue problems (polynomial or general). Additionally, SLEPc provides solvers for the computation of the action of a matrix function on a vector. SLEPc can be used for real (default) and complex arithmetics, therefore two different modules are provided:
module load numlib/hlrs_SLEPc # deafault version
OR
module load numlib/hlrs_SLEPc/3.5.3-complex
As usual the modules provides all compiler and linker flags, thus ex1.c (containing SLEPc calls) can be simply compiled by
cc ex1.c -o ex1.exe
SVN
Subversion is installed with the following repository access (RA) modules: ra_svn, ra_local, ra_serf. Plaintext and GPG-Agent authentication credential caches are avaiable.
module load tools/svn
Utilities for processing netcdf files
The module tools/netcdf_utils contains the follwing tools:
- nco (see http://nco.sourceforge.net/)
- ncview (see http://meteora.ucsd.edu/~pierce/ncview_home_page.html)
- cdo (see https://code.zmaw.de/projects/cdo)
Third party scientific software
CP2K
CP2K is a freely available (GPL) program to perform atomistic and molecular simulations of solid state, liquid, molecular and biological systems. It provides a general framework for different methods such as e.g. density functional theory (DFT) using a mixed Gaussian and plane waves approach (GPW), and classical pair and many-body potentials. It is very well and consistently written, standards-conforming Fortran 95, parallelized with MPI and in some parts with hybrid OpenMP+MPI as an option.
CP2K provides state-of-the-art methods for efficient and accurate atomistic simulations, sources are freely available and actively improved. It has an active international development team, with the unofficial head quarters in the University of Zürich.
The molecular simulation package is installed, optimized for the present architecture, compiled with gfortran using optimized versions of libxc, libint and libsmm.
module load chem/cp2k
provide four versions of different kind of parallelizations:
cp2k.ssmp - only OpenMP cp2k.popt - only MPI cp2k.psmp - hybrid MPI + OpenMP cp2k.pdbg - only MPI compiled with debug flags
After loading the related module (chem/cp2k), the binary can be directly called in the job submission script, e.g.:
aprun -n 24 -N 24 cp2k.psmp myCp2kInputFile.inp > myOutput.out
Some examples for CP2K input files are provided on the CP2K homepage and there also exist the input reference.
Gromacs
GROMACS (GROningen MAchine for Chemical Simulations) is a molecular dynamics package which can be used by
module load chem/gromacs
LAMMPS
LAMMPS "LAMMPS Molecular Dynamics Simulator" is a molecular dynamics package which can be used by
module load chem/lammps
The executable is named lmp_CrayXC.
NAMD
NAMD (Scalable Molecular Dynamics) is a parallel molecular dynamics code designed for high-performance simulation of large biomolecular systems, based on Charm++ parallel objects. The package can be loaded using
module load chem/namd
A tutorial can be found here.
OpenFOAM
OpenFOAM (Open Field Operation and Manipulation) is an open source CFD software package. Multiple versions of OpenFOAM are available compiled with gnu and intel. Available versions can be listed using
module avail cae/openfoam
OpenFOAM can be used with PrgEnv-gnu and PrgEnv-intel, e.g.
module swap PrgEnv-cray PrgEnv-gnu module load cae/openfoam
Furthermore, Foam-extend is available but only for PrgEnv-gnu
module swap PrgEnv-cray PrgEnv-gnu module load cae/openfoam/3.0-extend
As a first example a test case of incompressible laminar flow in a cavity using blockMesh and icoFoam is provided, which can be found in the directory
/opt/hlrs/cae/fluid/OPENFOAM/ESM/CRAY-Versionen/hornet-example
To run this example you have to copy the directory and submit the prepareOF and runOF jobs.
It is also possible to use CrayPAT profiling for certain version of OpenFOAM. Therefore, specialized module exist providing relevant versions cae/openfoam/xxx-perftools, where xxx are version numbers. The related binaries still has to be instrumented using
pat_build $FOAM_APPBIN/icoFoam
As a result a binary icoFoam+pat is generated in the current directory. Using these binary in the batch script the profiling will be performed. To analyze the resulting profiling data pat_report and further tools can be used (Cray Performance Tools). If during the execution of your instrumented binary you notice that the MPI is not recognized, i.e. you see replicated output or several *.xf files not collected in a single directory in your workspace, you cat export PAT_BUILD_PROG_MODELS="0x1" in your shell and run the pat_build command again after removing the instrumented binary. Please file a ticket if this did not work for you.