Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMP inside pthread causes runtime SegF #41

Closed
rolandschulz opened this issue May 17, 2017 · 1 comment
Closed

OpenMP inside pthread causes runtime SegF #41

rolandschulz opened this issue May 17, 2017 · 1 comment

Comments

@rolandschulz
Copy link

rolandschulz commented May 17, 2017

Given

#include <thread>
void f() {
    #pragma omp parallel
    {
    }
}
int main() {
    std::thread t1(f);
    std::thread t2(f);
    t1.join();
    t2.join();
}

And Archer (dc4e363) build with out of source with LLVM 4.0 and OMP-TR4 I get a runtime SegFault:

#0  0x00007ffff73a1bd0 in pthread_mutex_lock () from /lib64/libpthread.so.0
#1  0x000000000043979f in __interceptor_pthread_mutex_lock ()
    at /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:3672
#2  0x00007ffff7bccd43 in __gthread_mutex_lock(pthread_mutex_t*) () from /home/schulzro/tools/archer/lib/libarcher.so
#3  0x00007ffff7bccbe5 in std::mutex::lock() () from /home/schulzro/tools/archer/lib/libarcher.so
#4  0x00007ffff7bccb69 in DataPool<ParallelData, 4>::getData() () from /home/schulzro/tools/archer/lib/libarcher.so
@jprotze
Copy link
Contributor

jprotze commented May 17, 2017

Roland,
thanks for reporting this issue.
The reason for your segfault is, that tool initialization for the created threads is skiped, because OMPT does not deliver any thread-creation callbacks.

I talked to OpenMP language advocates and they said, that OpenMP spec does not indicate that your program would be a valid OpenMP program (there is no notion of pthreads/C++11 threads in the spec).

Nevertheless, we are working with the OpenMP tools group to check whether the specification of OMPT is consistent with the OpenMP execution model. Since the OpenMP implementation supports your application behaviour, we think, that the OpenMP runtime should deliver a thread creation event.

Created an issue in the runtime repository:
OpenMPToolsInterface/LLVM-openmp#16

@jprotze jprotze closed this as completed May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants