likwid icon indicating copy to clipboard operation
likwid copied to clipboard

[FeatureRequest] Sparse MarkerAPI measurements

Open rrzeschorscherl opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. Sometimes (i.e., when the region takes only a small amount of time) the overhead connected with starting and stopping counters via the marker API is prohibitive.

Describe the solution you'd like I would like a feature that allows me to configure "sparse measurements," ideally on a region-by-region basis. The default behavior would be as it is now, i.e., each call to LIKWID_MARKER_START/STOP does "the thing." However, a command line option, e.g., likwid-perfctr -g MEM -C 0 --sparse KERNEL:10 ./a.out would have the effect that the region named KERNEL would only be measured every 10th time it is executed. It could be possible to concatenate such specifications with commas: --sparse KERNEL:10,MVM:5. likwid-perfctr would then scale the counts with the appropriate factors so that the user gets the full counts, albeit with reduced accuracy/statistics.

Describe alternatives you've considered One can certainly achieve this by hand by enclosing the marker calls in loops, but this is clumsy and the automatic scaling feature would be a lot of work.

Additional context N/A

rrzeschorscherl avatar Jul 19 '21 15:07 rrzeschorscherl

Minor tweak that might have some appeal:

Create a new set of "sparse" macros for these situations, e.g. LIKWID_MARKER_SPARSE_START and be able to set a default "sparseness" (e.g. LIKWID_MARKER_SPARSE_DEFAULT("KERNEL", 10)). It might be an easier implementation on the LIKWID side and avoid adding (albeit minor) inherent overhead to the standard start/stop routines by avoiding unnecessary queries for whether the region is sparsed. These macros could just be lightweight "wrappers" around the non-sparse markers and the LIKWID_MARKER_SPARSE_STOP could just apply the scaling when its condition is true.

jrmadsen avatar Jul 19 '21 20:07 jrmadsen