[J3] FORM TEAM statement NEW_INDEX= specifier & failed images

Bill Long longb at cray.com
Mon May 6 18:27:42 EDT 2019

> On May 6, 2019, at 5:02 PM, Nathan Weeks via J3 <j3 at mailman.j3-fortran.org> wrote:
> I have two questions regarding the semantics of a FORM TEAM statement
> with the NEW_INDEX= specifier.
> (Question 1) N2146 states the following in section 11.6.9:
> 3    The value of the scalar-int-expr in a NEW_INDEX= specifier
> specifies the image index that the executing image will have in its
> new team. It shall be positive, less than or equal to the number of
> images in the team, and different from the value specified by every
> other image that belongs to that team.
> 4    If the NEW_INDEX= specifier does not appear, the image index of
> the executing image in the new team is
> processor dependent. This image index will be positive, less than or
> equal to the number of images in the team,
> and different from that of every other image in the team.
> Can some images specify NEW_INDEX=, and some images omit?


"If the FORM TEAM statement is executed on one image, the same statement shall be executed on all active images of the current team.”

It’s the same statement on all the participating images, so that statement either has or does not have a NEW_INDEX= specifier. 

> The phrase
> "different from the value specified by every other image that belongs
> to that team" almost seems to imply that the intent of the standard is
> for it to be specified by all images if specified by any.

Right. Keep in mind that the same source code is replicated for each image.  The “same statement” requirement above takes care of the rest.

> One scenario where this might occur is the case where one image
> specifies NEW_INDEX=1 (e.g., it has data to broadcast; or it will
> receive the results of a reduction; or it's a "master" in a
> master-worker pattern, and it doesn't matter what the image indexes of
> the workers are).
> (Question 2) 11.6.9 also states:
> 2     Successful execution of a FORM TEAM statement creates a new team
> for each unique team-number value specified by the active images of
> the current team...
> 6    If execution of a FORM TEAM statement assigns the value
> STAT_FAILED_IMAGE to the stat-variable, the effect is the same as for
> the successful execution of FORM TEAM except for the value assigned to
> stat-variable.
> What happens in the case where an image specifies both NEW_INDEX= and
> STAT= in a FORM TEAM statement, and the image index specified for
> NEW_INDEX= turns out to be greater than the number of images in the
> new team due to image failure during the execution of FORM TEAM? It
> seems that STAT_FAILED_IMAGE would be assigned to a stat-variable,
> but, as the new team can't have any missing image indexes (in section
> 5.3.4: "The image index that identifies an image is an integer value
> in the range one to the number of images in a team"), the effect of
> FORM TEAM would not be the same as a successful execution without the
> STAT_FAILED_IMAGE (e.g., in a successful execution, an executing image
> would have the value specified in the NEW_INDEX= specifier as its
> image index in the new team).

Reasonable question. That seems to not be spelled out explicitly in the text, though I’d be happy if someone pointed out text to the contrary.   I think that the intent is that the user does not have to check for failed images separately before executing FORM TEAM, so the image index values range would include numbers corresponding to the images that are discovered to be failed as part of executing the FORM TEAM statement.  Of course, one capability of FORM TEAM is to create a team the intentionally omits images previously detected to have failed.  In that case, this is not an issue for the team of still active images being formed. 


> Thanks,
> --
> Nathan

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425

More information about the J3 mailing list