Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixing OpenMP with pthreads

My question is whether is it a good idea to mix OpenMP with pthreads. Are there applications out there which combine these two. Is it a good practice to mix these two? Or typical applications normally just use one of the two.

like image 499
MetallicPriest Avatar asked Sep 15 '11 15:09

MetallicPriest


1 Answers

Typically it's better to just use one or the other. But for myself at least, I do regularly mix the two and it's safe if it's done correctly.

The most common case I do this is where I have a lower-level library that is threaded using pthreads, but I'm calling it in a user application that uses OpenMP.

There are some cases where it isn't safe. If for example, you kill a pthread before you exit all OpenMP regions in that thread.

like image 82
Mysticial Avatar answered Sep 21 '22 04:09

Mysticial