Distinguish between local and global reduction handles

Issue #1001 resolved
Erik Schnetter created an issue

Local and global reduction handles both use small integers. This means that code may accidentally confuse one for the other.

To avoid this, 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.

Keyword:

Comments (10)

  1. Roland Haas

    Local and global here refer to the handles returned by

    int CCTK_ReductionHandle(const char *reduction_name);
    int CCTK_ReductionArrayHandle(const char *reduction_name);  
    

    respectively.

  2. Roland Haas

    Of note: CarpetReduce is one of the codes that confuses them, so this is by no means unlikely to happen 🙂. Fixed in rhaas/reductionhandles of CarpetReduce.

    There’ may be more thorns doing the same (often using CCTK_ReduceLocalScalar) leading to failed tests.

  3. Erik Schnetter reporter

    This looks good. Please apply, once all users of this code have been corrected. You might also want to announce this via email to warn people about this.

  4. Roland Haas

    Applied as git hash 458bded "NaNChecker: user correct reduction handle with ReduceLocalScalar" of cactusutils

    Applied as git hash 664a7f8d "Hydro_Analysis: use correct reduction handle with ReduceLocArrayToArray1D" of einsteinanalysis

    Applied as git hash 6482a628 "CarpetReduce: distinguish between array and gf reduction ops in test" of carpet

    Applied as git hash 32def5eb "Cactus: use different handle ranges for old-style array and grid reductions" of cactus

  5. Log in to comment