score-p.md 4.33 KB
Newer Older
Lukáš Krupčík's avatar
Lukáš Krupčík committed
1 2 3 4 5 6 7 8 9 10 11 12
Score-P 
=======

Introduction
------------

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. 

Score-P can be used as an instrumentation tool for
Lukáš Krupčík's avatar
add  
Lukáš Krupčík committed
13
[Scalasca](scalasca.html).
Lukáš Krupčík's avatar
Lukáš Krupčík committed
14 15 16 17 18

Installed versions
------------------

There are currently two versions of Score-P version 1.2.6
Lukáš Krupčík's avatar
add  
Lukáš Krupčík committed
19
[modules](../../environment-and-modules.html) installed
Lukáš Krupčík's avatar
Lukáš Krupčík committed
20 21 22 23
on Anselm :

-   <span class="s1">scorep/1.2.3-gcc-openmpi<span>, for usage
    with </span>[GNU
Lukáš Krupčík's avatar
add  
Lukáš Krupčík committed
24
    Compiler](../compilers.html)<span> and </span>[OpenMPI](../mpi-1/Running_OpenMPI.html)<span>,</span></span>
Lukáš Krupčík's avatar
Lukáš Krupčík committed
25 26 27

-   <span class="s1">scorep/1.2.3-icc-impi<span>, for usage
    with </span>[Intel
Lukáš Krupčík's avatar
add  
Lukáš Krupčík committed
28 29
    Compiler](../compilers.html)<span> and </span>[Intel
    MPI](../mpi-1/running-mpich2.html)<span>.</span></span>
Lukáš Krupčík's avatar
Lukáš Krupčík committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148

Instrumentation
---------------

<span>There are three ways to instrument your parallel applications in
order to enable performance data collection :</span>

1.  <span>Automated instrumentation using compiler</span>
2.  <span>Manual instrumentation using API calls</span>
3.  <span>Manual instrumentation using directives</span>

### Automated instrumentation

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 <span
class="monospace">scorep</span> to your compilation command. For
example, replace : 

``` 
$ mpif90 -c foo.f90
$ mpif90 -c bar.f90
$ mpif90 -o myapp foo.o bar.o
```

with :

``` 
$ scorep  mpif90 -c foo.f90
$ scorep  mpif90 -c bar.f90
$ scorep  mpif90 -o myapp foo.o bar.o
```

Usually your program is compiled using a Makefile or similar script, so
it advisable to add the <span class="monospace">scorep</span> command to
your definition of variables <span class="monospace">CC</span>, <span
class="monospace">CXX</span><span class="monospace">FCC</span> etc.

It is important that <span class="monospace">scorep</span> is prepended
also to the linking command, in order to link with Score-P
instrumentation libraries.

### <span>Manual instrumentation using API calls</span>

To use this kind of instrumentation, use <span
class="monospace">scorep</span> with switch <span
class="monospace">--user</span>. You will then mark regions to be
instrumented by inserting API calls.

An example in C/C++ :

    #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 )
    }

 and Fortran :

    #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

Please refer to the [documentation for description of the
API](https://silc.zih.tu-dresden.de/scorep-current/pdf/scorep.pdf).

### <span>Manual instrumentation using directives</span>

This method uses POMP2 directives to mark regions to be instrumented. To
use this method, use command <span class="monospace">scorep
--pomp.</span>

Example directives in C/C++ :

    void foo(...)
    {
        /* declarations */
        #pragma pomp inst begin(foo)
        ...
        if (<condition>)
        {
            #pragma pomp inst altend(foo)
            return;
        }
        ...
        #pragma pomp inst end(foo)
    }

<span>and in Fortran :</span>

    subroutine foo(...)
        !declarations
        !POMP$ INST BEGIN(foo)
        ...
        if (<condition>) then
     !POMP$ INST ALTEND(foo)
     return
     end if
     ...
     !POMP$ INST END(foo)
    end subroutine foo

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.