Skip to content

Commit f023a04

Browse files
committed
Document a lil bit more the package
1 parent dca1b2d commit f023a04

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

README.md

+52-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,57 @@
11
# Extrae
22

3-
Julia bindings to `extrae` Basic API.
3+
Julia bindings to BSC's [`extrae`](https://tools.bsc.es/extrae) HPC profiler.
4+
5+
It supports automatic instrumentation (through `LD_PRELOAD` mechanism, DynInst is on the way) of MPI, CUDA and pthreads, and PAPI/PMAPI hardware counters and callstack sampling.
6+
Generated traces can be viewed with [Paraver](https://tools.bsc.es/paraver).
7+
8+
## Usage
9+
10+
First, you need to set the Extrae configuration using environment variables or XML configuration. An example configuration file can be found in `scripts/extrae.xml`.
11+
12+
### Event emision
13+
14+
Extrae's functionality is very basic: every registered event is just a tuple of 2 integers annotating the event type and the event value.
15+
Some events are automatically registered, such as MPI call names when you are tracing or PAPI hardware counters when performing sampling.
16+
But you can also emit your own custom events using `emit`:
17+
18+
```julia
19+
# emit event 80000 with value 4
20+
emit(80_000, 4)
21+
```
22+
23+
Event types are encoded with `Int32` and the values must always be a `Int64`.
24+
25+
If you want to assign a string descriptor to the event, you should call `Extrae.register` before initialization.
26+
27+
```julia
28+
const BANANAS_TYPECODE::Int32 = 80_000
29+
Extrae.register(BANANAS_TYPECODE, "Bananas")
30+
```
31+
32+
Alternatively, you can also add string descriptors to values.
33+
34+
```julia
35+
Extrae.register(Int32(80_001), "Monkey name", Int64[0,1,2], String["no monkey", "louis", "george"])
36+
```
37+
38+
### Initialization
39+
40+
`Extrae` can be initialized just by calling `Extrae.init()`. If you are planning to use `Distributed`, you should call
41+
42+
```julia
43+
@everywhere Extrae.init(Val(:Distributed))
44+
```
45+
46+
to properly initialize the profiler in all workers. If you plan to use MPI, you should use the `LD_PRELOAD` mechanism.
47+
48+
The profiling is finished with `Extrae.finish()`.
49+
50+
### Mark user functions
51+
52+
Many times, the profiler catches much more information than we want. One way to filter it is by marking which moments in the trace where devoted to user code. This can be done by calling `Extrae.user_function(1)` to start and `Extrae.user_function(0)` to end the marking region.
53+
54+
We also provide a `Extrae.@user_function` for code cleanliness.
455

556
## Example scripts
657

0 commit comments

Comments
 (0)