unexpected dispatch of ompt_callback_task_dependences callback


I built the latest version of OpenMP runtime library (commit 07d9ad356558ea7700cc1794848a7e327f9192ea). I registered the callback function ompt_callback_task_dependences callback for task-dependences event. However, if a program does not contain any tasking construct (only contains a parallel region), the callback is still dispatched.

The call path is shown below:

Starting program: /home/yg31/data-race/pkgs-src/client-dev/more-test/test_sections
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib64/libthread_db.so.1”.
[0]: ompt initialize: finished
[New Thread 0x7fffed4aa780 (LWP 39448)]
[New Thread 0x7fffed0a9800 (LWP 39449)]
[Switching to Thread 0x7fffed4aa780 (LWP 39448)]

Breakpoint 1, TaskDependencesCallback (task_data=0x1, deps=0x1, ndeps=14896224) at /home/yg31/data-race/pkgs-src/ompt-race-dev/src/ompt_race.cpp:734
734 KA_TRACE(0, STDOUT, 0, “TaskDependencesCallback”, “called”, 0);
Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7_3.1.x86_64 glibc-2.17-196.el7_4.2.x86_64 libgcc-4.8.5-16.el7_4.1.x86_64 libgcc-4.8.5-16.el7_4.2.x86_64 libstdc+±4.8.5-16.el7_4.1.x86_64 libstdc+±4.8.5-16.el7_4.2.x86_64
(gdb) where
#0 TaskDependencesCallback (task_data=0x1, deps=0x1, ndeps=14896224) at /home/yg31/data-race/pkgs-src/ompt-race-dev/src/ompt_race.cpp:734
#1 0x00007fffee213c8f in __kmp_join_barrier(int) () from /home/yg31/data-race/pkgs/llvm-openmp-latest-2/lib/libomp.so
#2 0x00007fffee1ec783 in __kmp_launch_thread () from /home/yg31/data-race/pkgs/llvm-openmp-latest-2/lib/libomp.so
#3 0x00007fffee240332 in __kmp_launch_worker(void*) () from /home/yg31/data-race/pkgs/llvm-openmp-latest-2/lib/libomp.so
#4 0x00007fffedf98e25 in start_thread () from /lib64/libpthread.so.0
#5 0x00007fffedcc634d in clone () from /lib64/libc.so.6

I checked the code and it is related with the callback:

if (ompt_enabled.ompt_callback_sync_region) {
1500 ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
1501 ompt_sync_region_barrier, ompt_scope_end, my_parallel_data,
1502 my_task_data, return_address);
1503 }

In __kmp_join_barrier() of kmp_barrier.cpp.

It could be seen that the parameter task_data = 0x1 and deps = 0x1, which corresponds to to the ompt_sync_region_barrier (equals 1) and ompt_scope_end (equals 1).

May I have some suggestions on this issue? Thanks.

Best regards,

Hi Yizi,

this looks like something goes wrong when you register the callback.

In general, I suggest to use callback.h as a prototype for a tool:


Especially the register_callback macros introduce some type safety, which will also point you to interface changes for the callbacks, whenever we update the runtime implementation to a new version of the spec.

The main source for your issue is most probably that you rely on an outdated version of ompt.h.

While ompt_callback_task_dependences was 16 in TR4, it is now 18 as of TR6. This was updated more than a year ago. This was changed in the implementation before the clang/6.0 release.