Debug an OpenMP Program

Debug an OpenMP Program

Hello everyone,

I am trying to trace the Intel OpenMP runtime function calls by using the build-in debugger. I followed the instructions given in the file (Build_With_CMake.txt) to compile the library, specifically the line below, and the library works fine.

cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang -DCMAKE_BUILD_TYPE=Debug -DLIBOMP_USE_DEBUGGER=on

However, when I run my openMP program, which is written in C, I do not see any debugging output. I wonder if what I am doing is correct. I just want to trace the function calls made when my program reaches an openMP directive. Is that possible?

Thank you

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Hello Nabil,

If you would like to get trace messages from the OpenMP library you need to enable them by setting special environment variable(s).

The debug messages are divided into several groups, you can find examples in the code - they look like KA_TRACE, KB_TRACE, etc.  

So, to enable KA_TRACE you need to set KMP_A_DEBUG=<n>  where 'n' is necessary level of trace messages. For example, to get  messages with level <=20 set KMP_A_DEBUG=20.

P.S. -DLIBOMP_USE_DEBUGGER=on is intended for different purpose. Namely, to use an external debugger for the OpenMP RTL. So, you don't need to specify it explicitly if your only wish to see traces.

Thanks a lot Olga. Works like a charm 

Leave a Comment

Please sign in to add a comment. Not a member? Join today