Comment 0 for bug 1899199

Revision history for this message
Matheus Castro (matheuscastro) wrote : OMPT with LD_PRELOAD not working

This bug was observed on multiple versions of Ubuntu and clang.

Versions:
  Ubuntu: Ubuntu 18.04.5 LTS, Ubuntu 20.04.1 LTS
  clang: 8.0.0-3~ubuntu18.04.2, 9.0.0-2~ubuntu18.04.2, 10.0.0-4ubuntu1~18.04.2,
         9.0.1-12, 10.0.0-4ubuntu1

When trying to use OMPT (https://www.openmp.org/spec-html/5.0/openmpch4.html) by defining the corresponding functions in an shared object and loading it with LD_PRELOAD gives no result. The functions are not called, not even the first function: ompt_start_tool.

I have included a small code that shows the bug.

To run it just do:
make
make run

The expected output is (up to execution reordering):

ompt_start_tool was called
Hello from thread 0 of 4!
Hello from thread 3 of 4!
Hello from thread 2 of 4!
Hello from thread 1 of 4!

While Ubuntu outputs (up to execution reordering):

Hello from thread 0 of 4!
Hello from thread 3 of 4!
Hello from thread 2 of 4!
Hello from thread 1 of 4!

It does not call ompt_start_tool.

It works as expected on Fedora 32 with clang version 10.0.1-2. It also works as expected on Debian GNU/Linux bullseye/sid with clang version 9.0.1-14. Thus, it's a bug.