(j3.2006) this_image( team=zzz), for zzz not current or an ancestor

John Reid John.Reid
Wed Jun 7 06:02:14 EDT 2017


Anton,


> And this modified program:
>
>  use iso_fortran_env
>  type( team_type ) :: team_new
>  form team( 1 + mod(this_image(),2), team_new )
>  print *, team_number( team_new )
>  end
>
> is probably also not conforming because
> CD 16.9.189p3 [434:21] has the same text:
> "TEAM ... scalar ... whose value identifies
> the current or an ancestor team."

Agreed.

> I'm just thinking about the implications
> of the fact that team-variable becomes
> defined after a successful execution of
> a FORM TEAM, but is essentially unusable until
> CHANGE TEAM.
>
> Are nested CHANGE TEAM statements conforming?
>
>  use iso_fortran_env
>  type( team_type ) :: t1, t2
>    form team( 1 + mod(this_image(), 2 ), t1 )
>    form team( 1 + mod(this_image(), 3 ), t2 )
>    change team(t1)
>      print *, team_number(t2) ! not conforming?
>                               ! t2 neither current nor ancestor

Agreed.

>      change team(t2)

Not conforming. The current team is t1 and t2 was formed when the 
initial team was current.

>        print *, team_number(t1) ! conforming?
>                                 ! t1 is an ancestor
>      end team
>    end team
>  end
>
> I find the first 2 sentences of
> CD 11.1.5.2p1 [188:4-7] confusing:
>
> "The team-values on the active images that
> execute the CHANGE TEAM statement shall
> be those of team variables defined by corresponding
> executions of the same FORM TEAM statement (11.6.9).
> When the CHANGE TEAM statement is executed,
> the current team shall be the team that was current
> when those team variables were defined."
>
> My feeling is that nested CHANGE TEAM statements
> violate somehow the above CD text, but I'm not sure.

Nesting is OK, but you need to do the form team in the right place, e.g.

  use iso_fortran_env
  type( team_type ) :: t1, t2
    form team( 1 + mod(this_image(), 2 ), t1 )
    change team(t1)
      form team( 1 + mod(this_image(), 3 ), t2 )
      print *, team_number(t2) ! not conforming because
                               ! t2 neither current nor ancestor
      change team(t2)
        print *, team_number(t1) ! conforming because
                                 ! t1 is an ancestor
      end team
    end team
  end


Cheers,

John.



More information about the J3 mailing list