[FLASH-USERS] sum over all blocks

Ryan Farber rjfarber at umich.edu
Tue Jun 8 22:05:44 EDT 2021


Hi Maksim,

Since Fortran is case insensitive it is useful to do case
insensitive search in the object folder:

grep -in "MPI_ALLREDUCE" *.F90

which will return

Timers_getSummary.F90:292:  call mpi_allreduce(areSame, areSameReduction,
1, MPI_LOGICAL, &

amongst many other lines.

Regarding MPI_ALLREDUCE, here's the mpich manual entry and also the
relevant mpitutorial:
https://www.mpich.org/static/docs/latest/www3/MPI_Allreduce.html
https://mpitutorial.com/tutorials/mpi-reduce-and-allreduce/

Best,
--------
Ryan


On Tue, Jun 8, 2021 at 6:58 PM Maksim Kozlov <maksim.kozlov at nu.edu.kz>
wrote:

> Hi Ryan!
> Many thanks for your answer! I would really appreciate it if you tip me
> off on where I can read about this mysterious MPI_ALLREDUCE. This
> subroutine is not in the FLASH file system, there is no description of it
> in the FLASH user's manual yet I would really like to know where should I
> call it, what are its parameters (are they in or out parameters) and how it
> works at least in general (without going into details).
> Thank you again!
> Maksim
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Без
> вирусов. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_191896795465823594_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, Jun 9, 2021 at 2:49 AM Ryan Farber <rjfarber at umich.edu> wrote:
>
>> Hi Maksim,
>>
>> Something along the lines of
>>
>> call MPI_ALLREDUCE(local_total_mass_of_blocks,
>> global_total_mass_of_blocks, 1, FLASH_REAL, MPI_SUM, dr_globalComm, ierror)
>>
>> preceded by computing the local_total_mass_of_blocks on each processor
>> (via loop or Fortran intrinsic "sum" along with proper array indexing)
>> should do the trick for what you want.
>>
>> Don't forget
>>
>> #include "Flash_mpi.h"
>>
>>
>> and other variable declarations, etc.
>>
>> Best,
>> --------
>> Ryan
>>
>>
>> On Tue, Jun 8, 2021 at 2:58 AM Maksim Kozlov <maksim.kozlov at nu.edu.kz>
>> wrote:
>>
>>> Dear flash users,
>>> I need to sum some variable over all blocks of the computational domain.
>>> Blocks of the computational domain are divided between different processors
>>> for parallel computations. Variables blockCount in
>>> Simulation_adjustEvolution or count in  gr_expandDomain  take into account
>>> only blocks processed by one processor not all blocks in the computational
>>> domain. Cycles in these subroutines run only through blocks of one
>>> processor. I would really appreciate it if somebody gives me an idea on how
>>> I can run through all blocks of the computational domain to calculate the
>>> sum of some variable over all blocks (for example total volume of blocks or
>>> total mass of blocks).
>>> Thank you very much!
>>> Maksim Kozlov
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Без
>>> вирусов. www.avast.com
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>> <#m_191896795465823594_m_7222565064137780913_m_-5902009028444939821_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20210608/c6db0802/attachment-0001.htm>


More information about the flash-users mailing list