Skip to content

Add marker region decorator#29

Open
max-models wants to merge 6 commits into
RRZE-HPC:masterfrom
max-models:add-marker-region-decorator
Open

Add marker region decorator#29
max-models wants to merge 6 commits into
RRZE-HPC:masterfrom
max-models:add-marker-region-decorator

Conversation

@max-models

@max-models max-models commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Added a @profile decorator so that functions can be profiled with

@profile
def my_func(): ...          # region name = "my_func"

or

@profile(region_name="work")
def my_func(): ...          # region name = "work"

instead of using pylikwid.markerstartregion("work") and pylikwid.markerstopregion("work")

This PR branches from #28 , so if you want to merge this, then we should do it after merging #28 .

@TomTheBear

Copy link
Copy Markdown
Member

Sounds like a good idea to use decorators.

@max-models

Copy link
Copy Markdown
Contributor Author

Sounds like a good idea to use decorators.

I think it is. Actually, I already did something similar in a separate project where I basically wrapped the pylikwid marker start and stop like this: https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/region_profiler.py#L303-L341

There, I profile regions using pylikwid either with a decorator or a context manager so for example:

with ProfileManager.profile_region("my_function"):
    call_func()

We ended up using this in struphy, see here, for example.

@TomTheBear

Copy link
Copy Markdown
Member

Do you think this PR can be merged?

@max-models

Copy link
Copy Markdown
Contributor Author

Do you think this PR can be merged?

Yes! To me it's finished :) Let me know if you need me to change anything. I just updated the readme and merged the last updates of master into this branch.

@max-models max-models marked this pull request as ready for review June 1, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants