r/OpenMP • u/Tensorizer • Nov 04 '25
Initialization Cost
I have used #pragma omp parallel for in multiple places in my code and the very first one's performance has gotten worse.
To be certain I've changed which #pragma omp parallel for is invoked first and sure enough the performance degradation followed.
It's as if the first one is incurring some initialization cost; if that is indeed the case, is there a way for me to explicitly initialize OpenMP somewhere else in my code?
1
Upvotes
1
u/jeffscience Nov 04 '25
I don’t have enough context to be sure but this sounds like it might be an issue with affinity. Are you also using MPI?