[mesa-users] kap module and thread-safe conflict
Michael Zingale
michael.zingale at stonybrook.edu
Mon Jul 13 09:10:07 EDT 2015
I haven't looked at this in 3+ years, so things may have changed.
On Mon, Jul 13, 2015 at 9:01 AM, Ehsan Moravveji <
Ehsan.Moravveji at ster.kuleuven.be> wrote:
> Thanks Michael for your very valuable input.
> I am a bit surprised that there are no alternatives to enforce using a
> single thread for the dynamic section of the parallel region, than
> recompiling MESA without -fopenmp. Yet, this is quite pragmatic.
>
> This brings me to anther question:
> It must be possible to checkout a fresh version of MESA, and only compile
> the kap module (and its dependencies without -fopenmp), and always link to
> that. This allows me to have a full (default) installation of MESA in a
> different directory, and an independent compilation of the kap module
> without -fopenmp in a separate directory for external use.
> If you find this a reasonable idea, can you perhaps tell me how to tweak
> the makefile to do it?
> If not, can you explain why not? ;-)
>
> Thanks again
> Ehsan.
>
> On 13 Jul 2015, at 14:37, Michael Zingale <michael.zingale at stonybrook.edu>
> wrote:
>
> we ran into this issue a long time ago when putting the EOS and
> reactions into our hydro code. It was a pain, but the solution was to
> compile those MESA libraries without OMP support so the code could handle
> it. Some notes on the install for a very old MESA are in Chapter 17 here:
>
>
> http://bender.astro.sunysb.edu/Maestro/staging/MAESTRO/Docs/MaestroUsersGuide.pdf
>
> On Mon, Jul 13, 2015 at 7:33 AM, Ehsan Moravveji <
> Ehsan.Moravveji at ster.kuleuven.be> wrote:
>
>> 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.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Don't Limit Your Business. Reach for the Cloud.
>> GigeNET's Cloud Solutions provide you with the tools and support that
>> you need to offload your IT needs and focus on growing your business.
>> Configured For All Businesses. Start Your Cloud Today.
>> https://www.gigenetcloud.com/
>> _______________________________________________
>> mesa-users mailing list
>> mesa-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mesa-users
>>
>>
>
>
> --
> Michael Zingale
> Associate Professor
>
> Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
> 11794-3800
> *phone*: 631-632-8225
> *e-mail*: Michael.Zingale at stonybrook.edu
> *web*: http://www.astro.sunysb.edu/mzingale
> github: http://github.com/zingale
>
>
>
>
--
Michael Zingale
Associate Professor
Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
11794-3800
*phone*: 631-632-8225
*e-mail*: Michael.Zingale at stonybrook.edu
*web*: http://www.astro.sunysb.edu/mzingale
github: http://github.com/zingale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20150713/2f219e42/attachment.html>
More information about the Mesa-users
mailing list