Skip to content
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

Add teams spec tests to "spec-example" directory #918

Merged
merged 7 commits into from
Jun 2, 2020

Conversation

davidozog
Copy link
Member

This is a spin-off PR of #907, which now adds the teams example programs as tests in the spec-example directory.

Currently, the tests/examples are not passing due to the issues mentioned in #907. Minor modifications have been made (shmem -> shmemx) so that the programs compile with SOS, but they are otherwise very similar to the upstream versions (including filenames).

@davidozog davidozog changed the title Readd teams spec tests to "spec-example" directory Add teams spec tests to "spec-example" directory Dec 12, 2019
@jdinan
Copy link
Member

jdinan commented Dec 13, 2019

Thanks for separating these out. Now we just need to fix the bugs in these tests. 😬

Copy link
Member

@jdinan jdinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are probably fine, but they don't make any sense. This is kind of a 🎣:tent:.

test/spec-example/shmem_reduce_example.c Outdated Show resolved Hide resolved

shmem_finalize();
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example makes no sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the upside, it looks like it will work now, which is great.

shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 3, (npes + 2) / 3, &conf, cmask, &team_3);

/* Create a context on team_2. */
int ret = shmemx_team_create_ctx(team_2, 0, &ctx_2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If team creation fails, we will end up passing SHMEM_TEAM_INVALID to context creation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check this and set the context to invalid if the team creation fails?

Copy link
Member Author

@davidozog davidozog Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this depends on the behavior of shmem_team_create_ctx when it's passed SHMEM_TEAM_INVALID, which is apparently not quite specified (openshmem-org/specification#324).

If shmem_team_create_ctx returns nonzero when passed SHMEM_TEAM_INVALID, then the context will be set to invalid here, correct? In that case, I'm not sure we would need a check for SHMEM_TEAM_INVALID here, at least after openshmem-org/specification#305 is ratified. (Side question: does a nonzero return value from shmem_split_strided imply the returned team objects are SHMEM_TEAM_INVALID?) Perhaps I'm missing something? If passing SHMEM_TEAM_INVALID to shmem_team_create_ctx is an error or undefined, then that's obviously a different story...


/* Sum the values among PEs that are in both team_2 and team_3 on PE 0 with ctx_2. */
if (team_3 != SHMEMX_TEAM_INVALID && team_2 != SHMEMX_TEAM_INVALID)
shmem_ctx_int_atomic_add(ctx_2, &sum, val_2 + val_3, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unreliable way to check, since context creation failure is local (not global)...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops - right. So I just need to include a check for ctx_2 != SHMEM_CTX_INVALID right? The test only wants PEs that are in both teams to do this atomic.

test/spec-example/shmem_team_split_2D.c Outdated Show resolved Hide resolved
@davidozog
Copy link
Member Author

I've recently made changes to these examples that should address all the issues discussed here. @jdinan, would you mind if I pushed those changes to this PR and then re-review? And I'm assuming you are still able to do the review? (I'd bet it'll be real easy since you probably reviewed this upstream.)

@jdinan
Copy link
Member

jdinan commented Apr 7, 2020

Sure, go for it.

@davidozog
Copy link
Member Author

@jdinan - I merge the upstream changes to these example programs. They are pretty much the same, with the usual shmem -> shmemx caveat. I also made the helper functions static to avoid a "no previous prototype" compiler warning... which might want to do upstream as well?

@jdinan
Copy link
Member

jdinan commented Apr 10, 2020

Sure, assuming the functions in question are not intended by the example to be externally callable, can you put the static change on my doc edits branch?

@davidozog
Copy link
Member Author

@jdinan I posted the doc-edit and this is ready for re-review, thanks!

@davidozog davidozog merged commit 27b4120 into Sandia-OpenSHMEM:master Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants