-
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
NOMERGE: Add bare-minimum Session API from proposal draft #1065
Open
davidozog
wants to merge
5
commits into
Sandia-OpenSHMEM:main
Choose a base branch
from
davidozog:wip/sessions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
726e73d
NOMERGE: Add bare-minimum Session APIs from proposal draft
davidozog 10b6e0e
Sessions: remove comments, fix UCX & Portals typos
davidozog b84c300
Sessions: fix typos (func attrs, transport_none)
davidozog 839bf8d
sessions: update to latest OpenSHMEM API proposal
davidozog 4a38b7b
sessions: fixup example code compilation issues
davidozog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* -*- C -*- | ||
* | ||
* Copyright (c) 2024 Intel Corporation. All rights reserved. | ||
* This software is available to you under the BSD license. | ||
* | ||
* This file is part of the Sandia OpenSHMEM software package. For license | ||
* information, see the LICENSE file in the top level directory of the | ||
* distribution. | ||
* | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
#define SHMEM_INTERNAL_INCLUDE | ||
#include "shmem.h" | ||
#include "shmem_internal.h" | ||
#include "transport.h" | ||
|
||
#ifdef ENABLE_PROFILING | ||
#include "pshmem.h" | ||
|
||
#pragma weak shmem_session_start = pshmem_session_start | ||
#define shmem_session_start pshmem_session_start | ||
|
||
#pragma weak shmem_session_stop = pshmem_session_stop | ||
#define shmem_session_stop pshmem_session_stop | ||
|
||
#endif /* ENABLE_PROFILING */ | ||
|
||
SHMEM_FUNCTION_ATTRIBUTES void | ||
shmem_session_start(shmem_ctx_t ctx, long options, const shmem_session_config_t *config, long config_mask) | ||
{ | ||
SHMEM_ERR_CHECK_INITIALIZED(); | ||
|
||
int ret = shmem_transport_session_start((shmem_transport_ctx_t *) ctx, options, config, config_mask); | ||
if (0 != ret) { | ||
DEBUG_MSG("Session did not start correctly (%d)\n", ret); | ||
} else { | ||
DEBUG_MSG("Session started correctly, but all hints are currently ignored\n"); | ||
} | ||
|
||
return; | ||
} | ||
|
||
SHMEM_FUNCTION_ATTRIBUTES void | ||
shmem_session_stop(shmem_ctx_t ctx) | ||
{ | ||
SHMEM_ERR_CHECK_INITIALIZED(); | ||
|
||
int ret = shmem_transport_session_stop((shmem_transport_ctx_t *) ctx); | ||
if (0 != ret) { | ||
DEBUG_MSG("Session didn't stop correctly (%d)\n", ret); | ||
} else { | ||
DEBUG_MSG("Session stopped successfully\n"); | ||
} | ||
|
||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* * This test program is derived from an example program in the | ||
* OpenSHMEM specification. | ||
*/ | ||
|
||
#include <shmem.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
#define N_UPDATES (1lu << 18) | ||
#define N_INDICES (1lu << 10) | ||
#define N_VALUES (1lu << 31) | ||
|
||
int main(void) { | ||
|
||
shmem_init(); | ||
|
||
uint64_t *table = shmem_calloc(N_INDICES, sizeof(uint64_t)); | ||
|
||
int mype = shmem_my_pe(); | ||
int npes = shmem_n_pes(); | ||
srand(mype); | ||
|
||
shmem_ctx_t ctx; | ||
int ret = shmem_ctx_create(0, &ctx); | ||
if (ret != 0) { | ||
printf("%d: Error creating context (%d)\n", mype, ret); | ||
shmem_global_exit(1); | ||
} | ||
|
||
shmem_session_config_t config; | ||
long config_mask; | ||
config.total_ops = N_UPDATES; | ||
config_mask = SHMEM_SESSION_TOTAL_OPS; | ||
|
||
shmem_session_start(ctx, SHMEM_SESSION_SAME_AMO, &config, config_mask); | ||
|
||
for (size_t i = 0; i < N_UPDATES; i++) { | ||
int random_pe = rand() % npes; | ||
size_t random_idx = rand() % N_INDICES; | ||
uint64_t random_val = rand() % N_VALUES; | ||
shmem_ctx_uint64_atomic_xor(ctx, &table[random_idx], random_val, random_pe); | ||
} | ||
|
||
shmem_session_stop(ctx); | ||
shmem_ctx_quiet(ctx); /* shmem_session_stop() does not quiet the context. */ | ||
shmem_sync_all(); /* shmem_session_stop() does not synchronize. */ | ||
|
||
/* At this point, it is safe to check and/or validate the table result... */ | ||
|
||
shmem_ctx_destroy(ctx); | ||
shmem_free(table); | ||
shmem_finalize(); | ||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Might have to move them to shmemx later.