openshmem-org / specification

OpenSHMEM Application Programming Interface
http://www.openshmem.org
51 stars 40 forks source link

Should team strides be positive? #491

Open nspark opened 2 years ago

nspark commented 2 years ago

The current (1.5) definition of shmem_team_split_strided does not constrain the stride argument to be positive. As written, it may be negative or even zero, (potentially) allowing for the creation of the following teams:

shmem_team_t world_reversed;
shmem_team_split_strided(SHMEM_TEAM_WORLD,
                         /* start */ shmem_n_pes() - 1, /* stride */ -1, /* size */ shmem_n_pes(),
                         NULL, 0, &world_reversed);

shmem_team_t zero_stride;
shmem_team_split_strided(SHMEM_TEAM_WORLD,
                         /* start */ shmem_my_pe(), /* stride */ 0, /* size */ 4,
                         NULL, 0, &zero_stride); 

For the former, should a negative-stride team be permissible? This would allow for creating teams with reversed PE indices. (See also https://github.com/openshmem-org/specification/pull/488#issuecomment-1063408888.)

For the latter, what does a zero-stride team imply? Per 1.5, it seems that the only PE(s) in the team would be the starting PE, but what value is the size argument here? We can't create a team with, say, four instances of the same PE in it. If stride is zero, does size only serve to distinguish zero vs. nonzero?