... | ... | @@ -29,6 +29,7 @@ If you use only the 4 basic calls, those are the rules: |
|
|
|
|
|
# Topics
|
|
|
|
|
|
* [**Recommended** usage of `LIKWID_MARKER_REGISTER`](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#recommended-usage-of-likwid_marker_register)
|
|
|
* [Placement of `LIKWID_MARKER_INIT`](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#placement-of-likwid_marker_init)
|
|
|
* [My code region is quite short](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#my-code-region-is-quite-short)
|
|
|
* [The measured times for multiple threads vary although all perform the same operation](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#the-measured-times-for-multiple-threads-vary-although-all-perform-the-same-operation)
|
... | ... | @@ -38,6 +39,10 @@ If you use only the 4 basic calls, those are the rules: |
|
|
* [Resetting the results of a region](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#resetting-the-results-of-a-region)
|
|
|
* [LIKWID measures FP operations with MarkerAPI for non-FP code](https://github.com/RRZE-HPC/likwid/wiki/LikwidMarkerAPIPitfalls#likwid-measures-fp-operations-with-markerapi-for-non-fp-code)
|
|
|
|
|
|
# **Recommended** usage of `LIKWID_MARKER_REGISTER`
|
|
|
|
|
|
One of the major recommendation, that can solve already many problems you might have with the MarkerAPI, is the usage of `LIKWID_MARKER_REGISTER()`. With increasing core counts of modern CPU architectures, the overhead to start up the access layer of LIKWID can be quite high. If it is part of the first execution of `LIKWID_MARKER_START()`, it might skew the results. Therefore register all regions before in a separate parallel region spanning all threads with a barrier in the end/afterwards (The OpenMP parallel construct contains an implicit barrier in the end).
|
|
|
|
|
|
# Placement of `LIKWID_MARKER_INIT`
|
|
|
|
|
|
The MarkerAPI get initialized with `LIKWID_MARKER_INIT`. This does not only include the MarkerAPI logic itself but sets up the whole LIKWID stack including register access checks, starting of separate processes and other quite expensive operations. It is recommended to execute it **early** in the execution process (for C/C++ projects: put it in the beginning of main) because loaded libraries might affect this initialization. We got reports of deadlocks if `LIKWID_MARKER_INIT` is located after the first OpenMP call. So, to avoid problems, call `LIKWID_MARKER_INIT` early in the execution and `LIKWID_MARKER_CLOSE` late in the exection.
|
... | ... | |