[Mesa-users] Opacity hook in parallel
Bill Paxton
paxton at kitp.ucsb.edu
Wed Jul 15 18:27:22 EDT 2020
> On Jul 15, 2020, at 2:57 PM, Buchele, Lynn via Mesa-users <mesa-users at lists.mesastar.org> wrote:
>
> I have, and it does show in output of the terminal that OPM_NUM_THREADS is set to 8. After doing a bit of poking around, it looks like MESA is running in parallel, but one thread is getting assigned all of the zones that call the external code. (Since this is a low-T code, it ends up getting called only for the outer layer of the star). Is there an easy way to change how those loops are allocated to each thread?
You might check with Google about the options for scheduling of OMP threads for loops. Then try changing this choice for the loop that does the calls for get_kap. You should find it in star/private/micro.f90 in subroutine set_micro_vars. It looks like this
!$OMP PARALLEL DO PRIVATE(k,op_err) SCHEDULE(guided)
do k = nzlo, nzhi
op_err = 0
call do1_neu_kap(s,k,op_err)
if (op_err /= 0) ierr = op_err
end do
!$OMP END PARALLEL DO
Try different choices for the SCHEDULE to see what gives what you want.
To test the different options, edit and save the file, cd star/test, do the mkx script to make and export the star library. Then cd to your working directory, remake your executable and run it.
Let us all know what you find.
Bill
>
> Lynn
>
>
> Pronouns: They/Them
> Some people identify with or use pronouns that may not be obvious based on their appearance. By stating mine clearly I hope to encourage others to share theirs. Please help make our culture more inclusive, safe, and comfortable for everyone.
> From: Aaron Dotter <aaron.dotter at gmail.com <mailto:aaron.dotter at gmail.com>>
> Sent: Tuesday, July 14, 2020 4:28 PM
> To: Buchele, Lynn <lmbuchele at shockers.wichita.edu <mailto:lmbuchele at shockers.wichita.edu>>
> Cc: mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org> <mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>>
> Subject: Re: [Mesa-users] Opacity hook in parallel
>
> Hi Lynn,
>
> Have you set OMP_NUM_THREADS to a number greater than 1 before you run MESA?
>
> The code that calls the opacity routine, whether the standard or the other version, is wrapped in an OMP PARALLEL loop. You can find examples of this in star/private/micro.f90 (look for do_kap_for_cell and routines that call it).
>
> Aaron
>
>
>
> On Tue, Jul 14, 2020 at 4:56 PM Buchele, Lynn via Mesa-users <mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>> wrote:
> Hi all,
> I am working on plugging an external opacity code into MESA. I have the code compiling and running, however when I use the other kap hook in run_star_extras.f, MESA seems to only be running one thread. When getting the external opacity code to run in parallel on its own, I did so by using a parallel do loop over the set of temperature and density points, but it seems like the other kap hook is only called for one zone at a time. My question is, can MESA call the other kap routine in parallel, or do I need to set up the kap routine to be parallelized internally?
>
> Some more details that might be important: I'm working with version 12778, and the most recent release of the SDK.
> Thanks for the help,
> Lynn Buchele
>
>
> Pronouns: They/Them
> Some people identify with or use pronouns that may not be obvious based on their appearance. By stating mine clearly I hope to encourage others to share theirs. Please help make our culture more inclusive, safe, and comfortable for everyone.
> _______________________________________________
> mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>
> https://lists.mesastar.org/mailman/listinfo/mesa-users <https://lists.mesastar.org/mailman/listinfo/mesa-users>
>
> _______________________________________________
> mesa-users at lists.mesastar.org <mailto:mesa-users at lists.mesastar.org>
> https://lists.mesastar.org/mailman/listinfo/mesa-users <https://lists.mesastar.org/mailman/listinfo/mesa-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20200715/44db1bda/attachment.htm>
More information about the Mesa-users
mailing list