To: J3 J3/22-163 From: R. Bader Subject: F202Y feature request - extend collective semantics Date: 2022-July-14 References: 22-007r1 Formal Requirement ~~~~~~~~~~~~~~~~~~ The collective subroutines from Fortran 2018 should support execution in a team that is not the current team. Rationale ~~~~~~~~~ If e.g. a reduction operation across the initial team's images is needed within the context of a CHANGE TEAM construct, this is rather cumbersome to do with the Fortran 2018/2023 semantics. Either it is necessary to exit the CHANGE TEAM construct (this permits a single CO_REDUCE invocation but can impose significant overhead on handling of team- specific data), or the reduction must be manually performed in two phases: first, a team-specific call to CO_REDUCE, followed by a manual assembly across teams (this leads to code that is hard to understand and maintain). Also, the ability to perform a reduction on a subset of images corresponding to a defined team variable without needing to execute a CHANGE TEAM statement is considered useful. Specification ~~~~~~~~~~~~~ Add an optional TEAM argument of type TEAM_TYPE to all collective subroutines and say that execution of the subroutine applies for the specified team. Suggested edits (against 22-007r1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16.6 Collective subroutines, para 1: replace "the current team" by "of its specified team"; replace "its current team" by "its specified team"; 16.6 Collective subroutines, after para 1: add a new para reading "The team specified for an invocation of a collective subroutine is the current team if the TEAM argument is not present in that invocation. Otherwise, it is the team identified by the value of the TEAM argument; on all images that execute the collective subroutine, these values shall either be those of the initial team, or those of team variables defined by corresponding executions of the same FORM TEAM statement (11.7.9)." 16.6 Collective subroutines para 3, para 4 bullet 4, para 6 (twice): replace "the current team" by "the specified team". 16.9.54 CO_BROADCAST in the heading, replace "[, STAT, ERRMSG]" by "[, STAT, ERRMSG, TEAM]" in the description of A, replace "the current team" by "the specified team" in the description of SOURCE_IMAGE, replace "the current team" by "the specified team" after the description of ERRMSG in para 3, add "TEAM (optional) shall be a scalar of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. It is an INTENT(IN) argument." in para 4, replace "and ERRMSG" by ", ERRMSG and TEAM" 16.9.55 CO_MAX in the heading, replace "[, RESULT_IMAGE, STAT, ERRMSG]" by "[, RESULT_IMAGE, STAT, ERRMSG, TEAM]" in the description of RESULT_IMAGE, replace "the current team" by "the specified team" after the description of ERRMSG in para 3, add "TEAM (optional) shall be a scalar of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. It is an INTENT(IN) argument." in para 4, replace "and ERRMSG" by ", ERRMSG and TEAM" 16.9.56 CO_MIN in the heading, replace "[, RESULT_IMAGE, STAT, ERRMSG]" by "[, RESULT_IMAGE, STAT, ERRMSG, TEAM]" in the description of RESULT_IMAGE, replace "the current team" by "the specified team" after the description of ERRMSG in para 3, add "TEAM (optional) shall be a scalar of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. It is an INTENT(IN) argument." in para 4, replace "and ERRMSG" by ", ERRMSG and TEAM" 16.9.57 CO_REDUCE in the heading, replace "[, RESULT_IMAGE, STAT, ERRMSG]" by "[, RESULT_IMAGE, STAT, ERRMSG, TEAM]" in the description of RESULT_IMAGE, replace "the current team" by "the specified team" after the description of ERRMSG in para 3, add "TEAM (optional) shall be a scalar of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. It is an INTENT(IN) argument." in para 4, replace "and ERRMSG" by ", ERRMSG and TEAM" 16.9.58 CO_SUM in the heading, replace "[, RESULT_IMAGE, STAT, ERRMSG]" by "[, RESULT_IMAGE, STAT, ERRMSG, TEAM]" in the description of RESULT_IMAGE, replace "the current team" by "the specified team" after the description of ERRMSG in para 3, add "TEAM (optional) shall be a scalar of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. It is an INTENT(IN) argument." in para 4, replace "and ERRMSG" by ", ERRMSG and TEAM"