I have an application which uses openmp. It is compiled (using Intel Composer XE 2017 update 5) for Suse but runs on Ubuntu Linux with real time extensions. Everything works fine but when the program is exiting from main, it hangs and never returns. I have a call stack of the application using GDB and it is below. As can be seen it looks like openmp is waiting on some lock and it forever hangs there. Any specific reason for the hang or some way to bypass this?
I do not see this problem when running in non-realtime systems. The one difference between realtime and non-realtime setup of openmp is that in case of realtime, I set the KMP_BLOCKTIME to 0 before the first call to openmp. In non-realtime case it is set to 100. Not sure if it has anything to do with the hang though.
0x00007f36c078382c in __lll_lock_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) bt
#0 0x00007f36c078382c in __lll_lock_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007f36c077f17c in _L_lock_982 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2 0x00007f36c077efcb in pthread_mutex_lock () from /lib/x86_64-linux-gnu/libpthread.so.0
#3 0x00007f36c0c64241 in __kmp_resume_64 ()
from /media/ext/adams_AGILEDEV_CL590147_suse11sp4/common/linux64/libiomp5.so
#4 0x00007f36c0c5ae34 in __kmp_release_64 ()
from /media/ext/adams_AGILEDEV_CL590147_suse11sp4/common/linux64/libiomp5.so
#5 0x00007f36c0c31b43 in __kmp_internal_end_library ()
from /media/ext/adams_AGILEDEV_CL590147_suse11sp4/common/linux64/libiomp5.so
#6 0x00007f36c4b2cf67 in ?? () from /lib64/ld-linux-x86-64.so.2
#7 0x00007f36c03e9121 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x00007f36c03e91a5 in exit () from /lib/x86_64-linux-gnu/libc.so.6
#9 0x00007f36c03ceeac in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#10 0x0000000000408be9 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)