[Users] CCTK_ReductionArrayHandle

Erik Schnetter schnetter at cct.lsu.edu
Thu Aug 2 07:19:16 CDT 2012


On 2012-08-02, at 4:26 , Luca Baiotti <baiotti at ile.osaka-u.ac.jp> wrote:

> On 8/2/12 4:11 PM, Roland Haas wrote:
>>> CCTK_ReductionArrayHandle is used in several thorns but it is not
>>> described in the ReferenceManual. Is it (still) supported?
>>> How is it different from CCTK_LocalArrayReductionHandle?
>> It's part of the "old" reduction interface. Which happens to be the one
>> Carpet supports, so it is widely used  :-). I doubt support will go away
>> anytime soon. The calls are documented in the User manual in section
>> C1.7.5 (page 84 in my build).
> 
> I see, so CCTK_ReductionArrayHandle is described in the User's Manual 
> but not in the Reference Manual.
> 
>> As for differences I'd consult this section and the reference manual. It
>> seems that one is a reduction over local arrays (ie double a[100]) while
>> the other reduces grid functions (or grid arrays or grid scalars most
>> likely).
> 
> I found no reference saying that CCTK_ReductionArrayHandle should be 
> used only for local arrays or only for grid functions.
> 
> Which of the two codes below is correct (in a subroutine called by the 
> scheduler)? Why?

For historic reasons, local reductions (where the caller passes in the grid size) and "regular" reductions (which use grid variables) have different operators. In principle, using the wrong operator should lead to an error message at run time.

What happens currently is likely that PUGHReduce and CarpetReduce register the same operators for both local and global reductions in the same order, and (by coincidence!) their handles are thus interchangeable.

Below, number (1) is correct, number (2) is wrong.

Number (2) obtains a handle for a global reduction operation. This handle will have a certain value, e.g. 15. Later, the code uses the _local_ reduction operation with handle 15, which (apparently) is also the local sum reduction.

We should correct this. For example, we could add large, different offsets for local and global handles, so that they would be different. We already do this for other integer IDs in the flesh.

-erik

> 1)
> 
> CCTK_REAL local_array_in,local_array_out;
> 
> CCTK_INT handle = CCTK_LocalArrayReductionHandle("sum");
> 
> CCTK_ReduceLocArrayToArray1D(cctkGH, -1, handle, &local_array_in,
>                          local_array_out, 4, CCTK_VARIABLE_REAL));
> 
> 
> 2)
> 
> CCTK_REAL local_array_in,local_array_out;
> 
> CCTK_INT handle_sum = CCTK_ReductionHandle("sum");
> 
> CCTK_ReduceLocArrayToArray1D(cctkGH, -1, handle, &local_array_in,
>                          local_array_out, 4, CCTK_VARIABLE_REAL));
> 
> 
> Best,
> Luca
> _______________________________________________
> Users mailing list
> Users at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/users

-- 
Erik Schnetter <eschnetter at perimeterinstitute.ca>
http://www.perimeterinstitute.ca/personal/eschnetter/
AIM: eschnett247, Skype: eschnett, Google Talk: schnetter at gmail.com



More information about the Users mailing list