[mesa-users] kap module and thread-safe conflict
Ehsan Moravveji
Ehsan.Moravveji at ster.kuleuven.be
Mon Jul 13 07:33:42 EDT 2015
Dear MESA users,
I am using and calling the kap module in an external code to get opacities for different temperatures and densities, using v.7678. Therefore, I have a nested do-loop that I can parallelise with OpenMP for (hopefully) faster fetching of opacities for a range of temperatures and densities.
With only one thread, the script runs OK, and the results are what I expect. The pseudo-code looks like
!$OMP parallel do default(none) private(…) shared(…)
do logT in a range of temperatures
do logR in a range of densities
kappa = get_kappa(logT, logR)
enddo
enddo
!$OMP end parallel do
However, setting OMP_NUM_THREADS > 1, also invokes the internal OMP constructs in the kap module; the result of this is a significant speed up, but very spaghetti results.
The problem is, by default MESA is installed with -fopenmp and I would like to keep it so, because of my other applications of MESA. However, my call to get_kappa() needs to be restricted to use only one thread.
Geert Jan Bex (in CC) and I also tried calling OMP_set_num_threads(1) before calling get_kappa(), but that did not work either.
So, my question is: Is it possible to use MESA modules in external programs that also include OpenMP directives, making sure that the whole computations are thread safe?
I would be grateful if you enlighten me with your comments and ideas.
Best regards
Ehsan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20150713/37b452e8/attachment.html>
More information about the Mesa-users
mailing list