To: J3 J3/17-196r2 From: Anton Shterenlikht Subject: C.6.7 Accessing coarrays in sibling teams - omission Date: 2017 October 19 References: N2137 Introduction: ~~~~~~~~~~~~~ Appendix C.6.7 shows how a programmer can access coarrays in sibling teams. The example program uses coarray-association in the CHANGE TEAM construct. The program is assumed to be run on 16 images. The program logic crucially depends on a particular image index numbering order inside the CHANGE TEAM construct. However, the FORM TEAM statement [562:17] does not specify image indices in new teams, i.e. the NEW_INDEX specifier is not used. Therefore, the new indices will be processor dependent, and might look e.g. like this: team UL team UR +---+---+ +---+---+ | 1 | 3 | | 4 | 3 | +---+---+ +---+---+ | 4 | 2 | | 2 | 1 | +---+---+ +---+---+ team LL team LR +---+---+ +---+---+ | 3 | 1 | | 2 | 4 | +---+---+ +---+---+ | 2 | 4 | | 1 | 3 | +---+---+ +---+---+ Therefore the code in lines [562:32] and [562:34] will not work as intended, because NEWPE==3 and NEWPE==4 in team UL are not guaranteed to be the 2 images on the right boundary of the grid. I think the use of NEW_INDEX in FORM TEAM [562:17] is necessary to make the code work as expected. I think extra code is needed to produce the desired image numbering in the new teams: team UL team UR +---+---+ +---+---+ | 1 | 3 | | 1 | 3 | +---+---+ +---+---+ | 2 | 4 | | 2 | 4 | +---+---+ +---+---+ team LL team LR +---+---+ +---+---+ | 1 | 3 | | 1 | 3 | +---+---+ +---+---+ | 2 | 4 | | 2 | 4 | +---+---+ +---+---+ Edit to N2137: ~~~~~~~~~~~~~~ All edits are in Annex C, C.6.7, Accessing coarrays in sibling teams. [562:3] In the example program statement "TYPE (TEAM_TYPE) :: t", change the final "t" to "T". {Use consistent case.} [562:7-10] Replace the declaration "INTEGER :: UL_IMAGE_LIST..." with (adjust indentation as needed): TYPE TRANS_T INTEGER :: NEW_TEAM(16), NEW_INDEX(16) END TYPE TYPE(TRANS_T) :: TRANS TRANS = TRANS_T( & [ UL, UL, LL, LL, UL, UL, LL, LL, UR, UR, LR, LR, UR, UR, LR, LR], & [ 1, 2, 1, 2, 3, 4, 3, 4, 1, 2, 1, 2, 3, 4, 3, 4]) [562:13-16] Delete four lines, each beginning "IF (ANY...". [562:17] replace FORM TEAM (TEAMNUM, T) with FORM TEAM (TRANS%NEW_TEAM(MYPE), T, NEW_INDEX=TRANS%NEW_INDEX(MYPE))