Skip to content
Snippets Groups Projects
score-p.md 3.79 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Hrbáč's avatar
    David Hrbáč committed
    # Score-P
    
    ## Introduction
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The [Score-P measurement infrastructure](http://www.vi-hps.org/projects/score-p/) is a highly scalable and easy-to-use tool suite for profiling, event tracing, and online analysis of HPC applications.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Score-P can be used as an instrumentation tool for [Scalasca](scalasca/).
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ## Installed versions
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    There are currently two versions of Score-P version 1.2.6 [modules](../../environment-and-modules/) installed on Anselm :
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    -   scorep/1.2.3-gcc-openmpi, for usage     with [GNU Compiler](../compilers/) and [OpenMPI](../mpi/Running_OpenMPI/)
    -   scorep/1.2.3-icc-impi, for usage with [Intel Compiler](../compilers.html)> and [Intel MPI](../mpi/running-mpich2/)>.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ## Instrumentation
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    There are three ways to instrument your parallel applications in order to enable performance data collection:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    1.  Automated instrumentation using compiler
    2.  Manual instrumentation using API calls
    3.  Manual instrumentation using directives
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Automated instrumentation
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    is the easiest method. Score-P will automatically add instrumentation to every routine entry and exit using compiler hooks, and will intercept MPI calls and OpenMP regions. This method might, however, produce a large number of data. If you want to focus on profiler a specific regions of your code, consider using the manual instrumentation methods. To use automated instrumentation, simply prepend scorep to your compilation command. For example, replace:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ mpif90 -c foo.f90
    $ mpif90 -c bar.f90
    $ mpif90 -o myapp foo.o bar.o
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    with:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ scorep  mpif90 -c foo.f90
    $ scorep  mpif90 -c bar.f90
    $ scorep  mpif90 -o myapp foo.o bar.o
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    Usually your program is compiled using a Makefile or similar script, so it advisable to add the  scorep command to your definition of variables  CC, CXX, FCC etc.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    It is important that  scorep is prepended also to the linking command, in order to link with Score-P instrumentation libraries.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    \###Manual instrumentation using API calls
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    To use this kind of instrumentation, use scorep with switch --user. You will then mark regions to be instrumented by inserting API calls.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    An example in C/C++ :
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```cpp
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        #include <scorep/SCOREP_User.h>
        void foo()
        {
            SCOREP_USER_REGION_DEFINE( my_region_handle )
            // more declarations
            SCOREP_USER_REGION_BEGIN( my_region_handle, "foo", SCOREP_USER_REGION_TYPE_COMMON )
            // do something
            SCOREP_USER_REGION_END( my_region_handle )
        }
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
     and Fortran :
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```cpp
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        #include "scorep/SCOREP_User.inc"
        subroutine foo
            SCOREP_USER_REGION_DEFINE( my_region_handle )
            ! more declarations
            SCOREP_USER_REGION_BEGIN( my_region_handle, "foo", SCOREP_USER_REGION_TYPE_COMMON )
            ! do something
            SCOREP_USER_REGION_END( my_region_handle )
        end subroutine foo
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Please refer to the [documentation for description of the API](https://silc.zih.tu-dresden.de/scorep-current/pdf/scorep.pdf).
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    \###Manual instrumentation using directives
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    This method uses POMP2 directives to mark regions to be instrumented. To use this method, use command  scorep --pomp.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Example directives in C/C++ :
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```cpp
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        void foo(...)
        {
            /* declarations */
            #pragma pomp inst begin(foo)
            ...
            if (<condition>)
            {
                #pragma pomp inst altend(foo)
                return;
            }
            ...
            #pragma pomp inst end(foo)
        }
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    and in Fortran :
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```cpp
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        subroutine foo(...)
            !declarations
            !POMP$ INST BEGIN(foo)
            ...
            if (<condition>) then
         !POMP$ INST ALTEND(foo)
         return
         end if
         ...
         !POMP$ INST END(foo)
        end subroutine foo
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The directives are ignored if the program is compiled without Score-P. Again, please refer to the [documentation](https://silc.zih.tu-dresden.de/scorep-current/pdf/scorep.pdf) for a more elaborate description.