-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-incorporate the teams example/tests from OpenSHMEM specification #907
Re-incorporate the teams example/tests from OpenSHMEM specification #907
Conversation
This reverts commit 90886c8.
Signed-off-by: Md <[email protected]>
shmemx_wait_until_all \ | ||
shmemx_wait_until_any \ | ||
shmemx_wait_until_some \ | ||
shmemx_test_all \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe shmemx_test_all
is actually a part of the spec, if that matters...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it looks like shmemx_test_all
is another case of using shmem_p
instead of shmem_atomic_set
.
@@ -31,26 +31,10 @@ check_PROGRAMS += \ | |||
atomic_nbi \ | |||
put_signal \ | |||
put_signal_nbi \ | |||
shmemx_wait_until_all \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shmemx_wait_until_all
looks like it's a little different than the spec example (it uses shmem_p
instead of shmem_atomic_set
). Do we want to update that in this PR or separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it looks like all the wait/test any/all/some routines have this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was updated upstream in the spec (wait/test clarification proposal). One motivation for separating out the spec tests is that this should make it easier for us to sync with the upstream sources.
@@ -31,26 +31,10 @@ check_PROGRAMS += \ | |||
atomic_nbi \ | |||
put_signal \ | |||
put_signal_nbi \ | |||
shmemx_wait_until_all \ | |||
shmemx_wait_until_any \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shmemx_wait_until_any
also looks like it uses shmem_p
instead of shmem_atomic_set
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed upstream in the OpenSHMEM spec. One reason for this change is to make it easier for us to pull in updates from the spec.
@@ -31,26 +31,10 @@ check_PROGRAMS += \ | |||
atomic_nbi \ | |||
put_signal \ | |||
put_signal_nbi \ | |||
shmemx_wait_until_all \ | |||
shmemx_wait_until_any \ | |||
shmemx_wait_until_some \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shmemx_wait_until_some
also looks like it uses shmem_p
instead of shmem_atomic_set
...
shmemx_wait_until_any \ | ||
shmemx_wait_until_some \ | ||
shmemx_test_all \ | ||
shmemx_test_any \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shmemx_test_any
is another case of using shmem_p
instead of shmem_atomic_set
...
shmemx_wait_until_some \ | ||
shmemx_test_all \ | ||
shmemx_test_any \ | ||
shmemx_test_some \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shmemx_test_some
is another case of using shmem_p
instead of shmem_atomic_set
.
(Yup, they all have that problem - my bad).
@davidozog Yes, I saw those differences. But, I still kept them here because there are enough similarities. And also, the text before the header suggests that these tests are derived from spec. I am ok with keeping them at either location. Other options might be, we can keep two versions of these tests if we want to, or we can change them to reflect the spec. |
@wrrobin Can you check for updates here: https://github.com/openshmem-org/specification/tree/master/example_code Also, I think a few of the test files have different names in SOS. We should fix this to match the spec, so it is easier for us to keep them in sync. |
@jdinan I noticed the name differences and I thought SOS has better names. Is it ok to change the file names in the spec repo? For example, many of the file names have |
@jdinan, I believe we should keep the exact same code from the spec, right? For example, if we see the diff in
It looks like one in SOS are better coded. Should we merge those changes in the spec then as doc edits? |
} | ||
shmemx_team_sync(SHMEMX_TEAM_WORLD); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the failure scenario for this test apart from the npes check?
…xamples Signed-off-by: Md <[email protected]>
Signed-off-by: Md <[email protected]>
Signed-off-by: Md <[email protected]>
if (status[i]) num_ignored++; \ | ||
} \ | ||
} \ | ||
if (nelems == 0 || num_ignored == nelems) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a unit test that exercises the num_ignored == nelems
case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I don't think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In such a unit test, we should just check whether wait_until_all
returns, right? There is no need to check the completion of the AMO since the wait set is empty.
Looking at the spec, there is one sentence at the end of the API description for wait_until_all which may not hold true in these cases.
Implementations must ensure that shmem_wait_until_all does not return before the update of the memory indicated by ivars is fully complete.
Do we have to add an unless clause indicating if the status array does not include all PEs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this sentence cover the issue?
If all elements in
status
are set to 1 ornelems
is 0, the wait set is empty and this routine returns immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does. But the last sentence in the API description is not covering the special case. I guess it was confusing to me since that line is written as a separate paragraph. It might be easier to merge this sentence to the end of the first paragraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see the confusion. It might be correct, since there is no "update of the memory" in this special case right? But yeah, it could use some clarification - if I understand correctly, your suggestion could be a doc edit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely doc edit should be sufficient. Similar edits may go to any/some/vector APIs as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wrrobin Could you separate out moving files and merging upstream changes? Many of the upstream changes are deleting a bunch of local changes that we need to keep (contexts and C99 compatibility, and error checking). I'd like to review those changes closely.
@jdinan To keep these checks, do we want these tests in both directories then? One in the spec_example would be exactly same as in the spec and the other one in unit would have all the checks. I have similar doubt in mind; so for the wait/test unit tests, I did not remove these extra checks and kept them different from the spec examples. |
…ompile/runs and other checks Signed-off-by: Md <[email protected]>
If we want to run the examples in the spec verbatim, we can do that off of the spec repository. It's useful to maintain copies in the SOS repository in cases where we make changes to adapt the examples into proper unit tests. Edit: Is it helpful to add a README file with the above info to the spec-example directory to explain the motivation and how we are maintaining these tests? |
Signed-off-by: Md <[email protected]>
@jdinan @davidozog Let me know if the changes look good. |
@@ -51,6 +51,8 @@ install -d %{testdir}/unit | |||
install test/unit/.libs/* %{testdir}/unit | |||
install -d %{testdir}/shmemx | |||
install test/shmemx/.libs/* %{testdir}/shmemx | |||
install -d %{testdir}/spec-example | |||
install test/spec-example/.libs/* %{testdir}/spec-example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am impressed that you remembered to update the spec file! 💯
@wrrobin Looks like there is a merge conflict that also needs to be resolved. |
Signed-off-by: Md <[email protected]>
…st in shmemx Signed-off-by: Md <[email protected]>
Apologies for multiple commits. Merge conflict is resolved now. |
@davidozog This looks good to me, please take a look and merge when you are ready. |
@davidozog Oh.. did not check that, Yes, please go ahead if you want to. |
Let's merge these changes and handle |
Oops. 🤕 |
@jdinan - ok, let me just finish my review, then I'll post the separate PR for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This reverts commit 90886c8, which removed some teams-related tests that are based on the examples from the specification. This PR is intended to resolve the outstanding issues with these tests.
test/shmemx/shmemx_team_split_2D.c
fails with 12 PEs on the split_2D at line 32 with the following error:test/shmemx/shmemx_team_context.c
fails with:test/shmemx/shmemx_team_sync.c
(andshmemx_reduce.c
?) also appears to have some bugs.Related issues:
openshmem-org/specification#302
openshmem-org/specification#313
#901