llvm-project/openmp/runtime/test
Jonas Hahnfeld d0ef19ef9b [OMPT] Provide initialization for Mac OS X
Traditionally, the library had a weak symbol for ompt_start_tool()
that served as fallback and disabled OMPT if called. Tools could
provide their own version and replace the default implementation
to register callbacks and lookup functions. This mechanism has
worked reasonably well on Linux systems where this interface was
initially developed.

On Darwin / Mac OS X the situation is a bit more complicated and
the weak symbol doesn't work out-of-the-box. In my tests, the
library with the tool needed to link against the OpenMP runtime
to make the process work. This would effectively mean that a tool
needed to choose a runtime library whereas one design goal of the
interface was to allow tools that are agnostic of the runtime.

The solution is to use dlsym() with the argument RTLD_DEFAULT so
that static implementations of ompt_start_tool() are found in the
main executable. This works because the linker on Mac OS X includes
all symbols of an executable in the global symbol table by default.
To use the same code path on Linux, the application would need to
be built with -Wl,--export-dynamic. To avoid this restriction, we
continue to use weak symbols on Linux systems as before.

Finally this patch extends the existing test to cover all possible
ways of initializing the tool as described by the standard. It
also fixes ompt_finalize() to not call omp_get_thread_num() when
the library is shut down which resulted in hangs on Darwin.
The changes have been tested on Linux to make sure that it passes
the current tests as well as the newly extended one.

Differential Revision: https://reviews.llvm.org/D39801

llvm-svn: 317980
2017-11-11 13:59:48 +00:00
..
api Fix memory error in case of reinit using kmp_set_defaults() for lock code. 2017-01-18 07:02:21 +00:00
atomic Remove trailing whitespace from tests 2016-05-17 21:08:52 +00:00
barrier omp_barrier.c test fixed in order to reliably and faster run on any number of processors 2016-01-25 16:52:10 +00:00
critical
env Fix implementation of OMP_THREAD_LIMIT 2017-07-27 20:58:41 +00:00
flush
lock Revert "Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)" 2017-11-03 18:28:19 +00:00
master Remove trailing whitespace from tests 2016-05-17 21:08:52 +00:00
misc_bugs Test cancellation_for_sections.c expectedly fails on GCC 2017-04-04 14:39:52 +00:00
ompt [OMPT] Provide initialization for Mac OS X 2017-11-11 13:59:48 +00:00
parallel Make test/parallel/omp_nested.c not use so many threads 2017-06-27 03:04:25 +00:00
tasking Add C++ support for testcases 2017-10-20 19:42:32 +00:00
threadprivate Remove trailing whitespace from tests 2016-05-17 21:08:52 +00:00
worksharing OpenMP 4.5: implemented support of schedule(simd:guided) and 2017-06-05 17:17:33 +00:00
CMakeLists.txt Update implementation of OMPT to the specification OpenMP 5.0 Preview 1 (TR4). 2017-11-01 10:08:30 +00:00
lit.cfg [OMPT] Provide initialization for Mac OS X 2017-11-11 13:59:48 +00:00
lit.site.cfg.in Update implementation of OMPT to the specification OpenMP 5.0 Preview 1 (TR4). 2017-11-01 10:08:30 +00:00
omp_my_sleep.h
omp_testsuite.h Allow unit testing on Windows 2016-05-23 17:50:32 +00:00