Open naveen-rn opened 4 years ago
@naveen-rn I think the first issue you're raising—whether shmem_ctx_destroy(SHMEM_CTX_INVALID)
is defined, non-erroneous behavior—should probably be raised on the main spec repo.
IIUC, for the second issue, you're saying the example needs modification because the two team-based contexts, ctx_2s
and ctx_3s
, may be invalid. Is that correct?
If I'm correct SHMEM_CTX_INVALID
is added after OpenSHMEM-1.4.
@nspark As you said, there are two issues I see here:
SHMEM_CTX_INVALID
. The shmem_ctx_destroy
API description in the current master branch of the specification says, If \VAR{ctx} has the value \CONST{SHMEM\_CTX\_INVALID}, no operation is performed.
, while the API notes say the following: It is invalid to pass \CONST{SHMEM\_CTX\_DEFAULT} to this routine.
To me this is confusing. I suppose the intent of this description is that, destroying SHMEM_CTX_INVALID
is not allowed and the implementation functionality on seeing this option is return without performing anything - so a silent error. Needs clarification.
If we follow the above semantics - then the context destroy in teams example (https://github.com/gmegan/specification/blob/teams/example_code/shmem_team_context.c) is incorrect. We should have a conditional check before destroying the context.
Yes, I forgot that I added SHMEM_CTX_INVALID
after OpenSHMEM 1.4
These two statements about shmem_ctx_destroy
are not in conflict:
If
ctx
has the valueSHMEM_CTX_INVALID
, no operation is performed.It is invalid to pass
SHMEM_CTX_DEFAULT
to this routine.
The former makes a call such as shmem_ctx_destroy(SHMEM_CTX_INVALID)
well-defined and non-erroneous, akin to the behavior of free(NULL)
.
The latter is referring to the default context—the now-implicit communication resources of the OpenSHMEM 1.3 API—which should not be destroyed by any user program.
The example code
https://github.com/gmegan/specification/blob/teams/example_code/shmem_team_context.c
is bit confusing. I'm not sure what is the requirement of the most recent spec where we are trying to destroy a context with SHMEM_CTX_INVALID option. Is it a silent error? Or is it invalid, or is it undefined. If invalid or undefined, then I think the example needs modification.