Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

FORM TEAM Fortran 2015

jimdempseyatthecove
Honored Contributor III
732 Views

Steve,

I've read both ISO-IECJTC1-SC22-WG5_N2137_CD_revision_of_Fortran_standard_Cohen.pdf and ISO-IECJTC1-SC22-WG5_N2127_The_new_features_of_Fortran_2015_Reid.pdf and still do not completely understand the new Fortran 2015 statement FORM TEAM. Could you explain this in a manner such that someone .NOT. on the WG5 standards committee can understand.

My misunderstandings:

A thread, on some process in a 1 to N process application belongs to a team, the initial team has a team number of -1. From Reid:

The form team statement takes the general form
form team ( team-number, team-variable[, form-team-list] )
where team-number is a scalar integer expression whose value must be positive and team-variable
is a scalar variable of type team type whose values on all the images of a child team will be
defined with information about that child team. All the images of the current team that have
the same team-number value will be in the same child team. This value is the team number
for the child team and is used to identify it in statements executed in an image of another child
of the same parent. The team numbers of all the images of the initial team are always -1.

1) My interpretation is team-number is a new team number that is unique and global to all teams as oppose to an arbitrary number relative to the team forming the new team. Is this correct? Or are the new team numbers relative to the instantiating team context.

The form team statement is an image control statement. The same statement must be executed
by all active images of the current team and they synchronize.

2) My assumption is the synchronization point is at the FORM TEAM statement where all team members of the current team must reach in order to be synchronized. Statement execution following the FORM TEAM is ambiguous.

a) A new team is constructed that is (presumably) a subset of the existing team, what happens with the team members of the existing team that are not specified for the (or one of the) new team(s)?
.OR.
b) Does FORM TEAM behave somewhat like a N-way fork where portions of the existing team are distributed in a (specified) manner to each of the newly generated teams (an example was given of EVEN_ODD). IOW all former (existing) team members go somewhere.

Jim Dempsey

 

0 Kudos
16 Replies
Steve_Lionel
Honored Contributor III
732 Views

Jim, this is not an area I am an expert in. If you ask it in comp.lang.fortran I know that Bill Long from Cray, who knows this stuff better than anyone, often responds there.

0 Kudos
JohnNichols
Valued Contributor III
732 Views

We are talking about Rugby?

0 Kudos
JohnNichols
Valued Contributor III
732 Views

Dear Forum Controller:

1. Sounds like a Roman sports arena:  Louie bring out the lions etc...

Anyway I posted twice on a Topic called Hagar and they disappeared. This used to happen, but stopped but now is happening again.

Help.

John

0 Kudos
Jon_S_Intel1
Employee
732 Views

A FORM TEAM statement is executed by all images of the current team.  It forms one or more sub-teams, assigning each image to a sub-team.  The sub-team an image is assigned to is identified by the team number specified in the FORM TEAM statement the image executes.  The team number is a positive integer greater than 0.  The initial team is identified by the team number -1.  Different FORM TEAM statements may use team numbers used by other FORM TEAM numbers.  Team numbers are used to identifiy sibling teams, that is, teams created by execution of the same FORM TEAM statement. If only a team number is used, the reference is to  sibling team of the current team.  Otherwise, a team number may be used with a team variable; in this case the team number refers to the specified team in the set of teams described by the team variable.

A FORM TEAM statement is a collective operation; that is all images of the current team must execute it.  There is an implicit synchronization point in the FORM TEAM operation. Each image that executes it is assigned to a subteam.  The current team remains unchanged after the execution of a FORM TEAM statement, until a CHANGE TEAM statement is executed.

 

 

 

 

 

0 Kudos
JohnNichols
Valued Contributor III
732 Views

Jon S. wrote:

A FORM TEAM statement is executed by all images of the current team.  It forms one or more sub-teams, assigning each image to a sub-team.  The sub-team an image is assigned to is identified by the team number specified in the FORM TEAM statement the image executes.  The team number is a positive integer greater than 0.  The initial team is identified by the team number -1.  Different FORM TEAM statements may use team numbers used by other FORM TEAM numbers.  Team numbers are used to identifiy sibling teams, that is, teams created by execution of the same FORM TEAM statement. If only a team number is used, the reference is to  sibling team of the current team.  Otherwise, a team number may be used with a team variable; in this case the team number refers to the specified team in the set of teams described by the team variable.

A FORM TEAM statement is a collective operation; that is all images of the current team must execute it.  There is an implicit synchronization point in the FORM TEAM operation. Each image that executes it is assigned to a subteam.  The current team remains unchanged after the execution of a FORM TEAM statement, until a CHANGE TEAM statement is executed.

Let me ask a serious question, does this mean a Form Team could be used to operate a process, so we collect data from an accelerometer in 16384 unit blocks in about 7 seconds. then we push the data to a process that does the FFT, and other functions which has 7 seconds to complete before the next block comes in, which even for a Raspberry Pi is ok, I measure the speed of the FFT and other operations is usually for a modern NUC and a PI about 1 second and for an old NUC 3 seconds, so we use two threads.  The problem is scaling up the operation, as it is identical but the overhead becomes critical and messy. We have more processes planned so for one the new Intel Core i9 machines, we could run 4 accelerometers using 4 threads each and 2 threads left for control and communication.

The challenge of course is not the work, the challenge is that every student I have in engineering is now taught MATLAB. They will spend a week doing what can be done in Fortran in a few minutes.  Bring back Conte and DeBoore standard learning.

John

 

0 Kudos
Steve_Lionel
Honored Contributor III
732 Views

John,

Teams are an enhancement of the coarray feature introduced in Fortran 2008. In F2008, when a coarray program starts all of the parallel copies of the program (images) start at the same time, and operate in synchronization. The addition of teams allows one to partition the set of images to work on different parts of a problem.

Unless you structure your application to use coarrays, teams on their own are not likely to be a solution to your issue.

0 Kudos
jimdempseyatthecove
Honored Contributor III
732 Views

Nichols,

Your situation will be best served by using a single process that multi-threads using OpenMP (or TBB if you prefer). The Fortran FORM TEAMS statement is for use on multi-process (not processor) applications typically launched using MPI messaging. While you can run a multi-process application on a single multi-threaded CPU, it is not generally as effective as using a single process multi-threaded programming.

Jon S.

Assume team -1 has 16 ranks

Assume at some point in your code you desire to form a sub-team using 4 ranks of the 16.

a) You use a FORM TEAM to construct, say, team 1 with 4 of your 16 ranks. What happens to the other 12 ranks? Do they sit at the FORM TEAM as if they were at a barrier? Or do they continue independent of the other team members (of team -1).?

b) In the above scenario, is the FORM TEAM required to create 2 teams, say team 1 (4 ranks of 16), plus an additional team (default maybe team 2) with the remaining ranks. IOW both (all) formed teams continue independently.

Note, the FORM TEAM does not contain a procedure entry point, therefore the FORM TEAM must fall through the statement... in the context of the newly created TEAM(s). IOW the code will typically contain a "who am I?" and dispatch accordingly.

The description of CANGE TEAM is somewhat lacking, and seems somewhat analogous to a co-routine dispatch (without a procedure addreess).

I am not criticizing the design, rather I am criticizing the documentation that is written from the perspective that you already know what the statements do. It would be better to include a simplified sample code with instructive comments.

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
732 Views

c) or do the remaining 12 ranks fall through in the context of team -1? (and team -1 continuing to have 16 ranks, 4 of which are indisposed until they finish what they are doing).

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
732 Views

jimdempseyatthecove wrote:

Nichols,

Your situation will be best served by using a single process that multi-threads using OpenMP (or TBB if you prefer). The Fortran FORM TEAMS statement is for use on multi-process (not processor) applications typically launched using MPI messaging. While you can run a multi-process application on a single multi-threaded CPU, it is not generally as effective as using a single process multi-threaded programming.

Jon S.

 

Ok I see the point, at the moment I multithread the data collection, put it all into a dictionary type structure and pass it to the other thread.

The program on a small nuc handles about 4 billion data points in 12 hours quite nicely, do it on a PI as well.  A PI is a vey good little computer for 30 bucks.

I would show a picture but it will not let me

John

0 Kudos
JohnNichols
Valued Contributor III
732 Views

I would send a picture but I am not authorized to upload files -- help

John

0 Kudos
Steve_Lionel
Honored Contributor III
732 Views

Just testing to see if I can attach something, though this may not prove anything. I have asked the Intel folks to investigate attachment problems.

0 Kudos
andrew_4619
Honored Contributor II
732 Views

Hmm. If I click "attached files to post " the only option is the "browse" button which then gives "You are not authorized to access this page." That is in chrome BTW.

0 Kudos
andrew_4619
Honored Contributor II
732 Views

I used to be able to attach files.......

0 Kudos
Devorah_H_Intel
Moderator
732 Views

Nichols, John wrote:

I would send a picture but I am not authorized to upload files -- help

John

I apologize for the inconvenience. This issue with attachments is under investigation. It will be fixed ASAP. 

0 Kudos
Devorah_H_Intel
Moderator
732 Views

Attachments should work now.

0 Kudos
andrew_4619
Honored Contributor II
732 Views

Attach does now seem to work....

0 Kudos
Reply