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

Getting segfault when using HPX mutexes and condition variables #3

Closed
light2802 opened this issue Aug 15, 2023 · 4 comments
Closed

Comments

@light2802
Copy link

light2802 commented Aug 15, 2023

On replacing the pthread mutex and condition variable calls with hpxc the program leads to a segfault and race conditions (See PR #2 for code)

See following output (only a small part) of the hello world example with OMP_NUM_THREADS=100

Hello World, from thread: 0
Hello World, from thread: 29
Hello World, from thread: 87
Hello World, from thread: 78
Hello World, from thread: 90
Hello World, from thread: 3
Hello World, from thread: 77
Hello World, from thread: 79
Hello World, from thread: 54
Hello World, from thread: 6
Hello World, from thread: 84
Hello World, from thread: 86
Hello World, from thread: 76
Hello World, from thread: 53
Hello World, from thread: 85
Hello World, from thread: 52
Hello World, from thread: 30
Hello World, from thread: 32
Hello World, from thread: 89
Hello World, from thread: 87
Hello World, from thread: 79
Hello World, from thread: 83
Hello World, from thread: 6
Hello World, from thread: 86
Hello World, from thread: 76
Hello World, from thread: 53
Hello World, from thread: 88
Hello World, from thread: 85
Hello World, from thread: 3

See that some thread ids are repeated (like 3)

@light2802
Copy link
Author

We also get an occasional error message from openmp runtime (when OMP_NUM_THREADS is large, ~100)

Assertion failure at kmp_runtime.cpp(8012): KMP_MASTER_GTID(gtid).                                                 
OMP: Error #13: Assertion failure at kmp_runtime.cpp(8012).                                                        
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://bugs.llvm.org/.                             
Assertion failure at kmp_runtime.cpp(6922): temp_reg_status_file_name.                                             
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6922).                                                        
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://bugs.llvm.org/.                             
^CSegmentation fault (core dumped

Another observation is that the code is very very slow compared to the original OpenMP code. Check the hello world example for this.

@rtohid
Copy link

rtohid commented Aug 16, 2023

@Pansysk75 when you get the chance, can you please look into this?

@Pansysk75
Copy link
Member

Pansysk75 commented Aug 16, 2023

@Pansysk75 when you get the chance, can you please look into this?

Ah thanks for the mention, will do!

@Pansysk75
Copy link
Member

The two PRs above seem to fix both the segfaults and the race-condition-like behaviour mentioned here. The common case works for me, although I didn't have time to stress-test it yet.

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

3 participants