How to use OMPT ?

How to use OMPT ?


I tried to use OMPT with the last runtime release (rev 44646) but it seems that OMPT functions aren't in

I can use features of ompt.h, but there are no functions like describes in "OpenMP Technical Report 2 on the OMPT Interface".

Does someone can just give me an example of implementation to understand how to use OMPT, please ?

Maybe i just don't understand what is OMPT...

Thank you for reading,

Best regards,


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


By default OMPT support is turned off in OpenMP build. But you can add it by yourself.

If you use Makefile to build the library add the following lines to tools/

  # Setting defaults
+ ifeq "$(ompt)" "on"
+     build_args += --ompt-support=$(ompt)
+ endif
  ifeq "$(filter 32 32e 64 mic,$(arch))" ""

Then you can use $make ompt=on to build with OMPT support. You will find it in exports/<os_arch>.ompt folder.

If you use CMake to build the RTL you should use build option -DLIBOMP_OMPT_SUPPORT=on to turn on OMPT support.

Hope it will help.

Thank you.

Thank you for this answer.

I had build it with CMake, with -DLIBOMP_OMPT_SUPPORT=on.

I just tried with Make (as you showed) but this is the same thing.

This snippet for example:

#include <stdio.h>
#include <stdlib.h>
#include "ompt.h"

int main(int argc, char *argv[])
        ompt_thread_id_t id;
        ompt_state_t state;

        #pragma omp parallel private(id, state)
                id = ompt_get_thread_id();
                state = ompt_get_state(id);
                printf("Hello, i'm [%d] and my state is [%d]\n", id, state);

        return EXIT_SUCCESS;

But the compilation fails :

/tmp/iccVNUuOR.o: In function `main':
hello_ompt.c:(.text+0x127): undefined reference to `ompt_get_thread_id'
hello_ompt.c:(.text+0x13b): undefined reference to `ompt_get_state'

I don't understand why i'm able to use ompt_state_t but i can't use ompt_get_state() ?

Sorry to bother you.

Best Reply


OMPT API is supposed to be used as an interface between a performance tool and an OpenMP runtime. Most of ompt_* functions are hidden for a user because they are not intended to be called from the user code like you tried to do.

You need to implement the tool, then register it and initialize (please, refer to chapter 6 of OMPT API TR2). Then your tool will have to use 'lookup' function to get a pointer to an OMPT API function - there is an example in section 6.1.1 of TR2.

Hope it help.


Great answer, everything i need.

Thank you.


Thanks to you i was able to initialize my tool.

But i had some troubles. First, OMPT API TR2 describes ompt_initialize in type 'int' but in the runtime it's type 'void'.

Moreover the paper does'nt mention the ompt_tool() function which allows to register the performance tool.

Do you have a new documentation about that, please ?

Thank you again,


EDIT : Sorry for this post, i found


The fact is the OMPT API is being revised these days, so the final document will differ from the TR2. Some changes was already done in the runtime, so please refer to it for the actual state.

Thank you.


Leave a Comment

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