Dear Intel folks,
I am thinking of writing my own and very lighweight profiling tools and OpenMP is clearly in my radar.
I had a quick look at the source code trying to find how and where i could hook my profiler, and i could not find anything simple :-(
IMHO, the easiest way would be to use weak symbols.
This is what is done in MPI implementations : for example the user application will call MPI_Init. In the MPI library, MPI_Init is a weak symbol pointing to PMPI_Init. So instrumenting MPI_Init only requires to rewrite MPI_Init : do the instrumentation and call PMPI_Init. Then the application can be relinked or started with a preloaded library.
It would be great if for example __kmpc_barrier was a weak symbol.
Is there such a plan to use weak symbols ?
It is of course possible to play with preloads and dlsym but this is quite heavy weight and could be un-necessary.