Skip to content

Commit 9b92130

Browse files
committed
Add a Fine Grained Completion Routine: shmem_pe_quiet
1 parent 757a33e commit 9b92130

File tree

8 files changed

+243
-1
lines changed

8 files changed

+243
-1
lines changed

mpp/shmemx_c_func.h4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_heap_create(void *base, size_t size
105105
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_heap_preinit(void);
106106
SHMEM_FUNCTION_ATTRIBUTES int SHPRE()shmemx_heap_preinit_thread(int requested, int *provided);
107107
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_heap_postinit(void);
108+
109+
/* Memory Ordering Routines */
110+
SHMEM_FUNCTION_ATTRIBUTES void shmem_pe_quiet(const int *target_pes, int npes);
111+
SHMEM_FUNCTION_ATTRIBUTES void shmem_ctx_quiet(shmem_ctx_t ctx, const int *target_pes, int npes);

src/shmem_synchronization.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ shmem_internal_quiet(shmem_ctx_t ctx)
4040
shmem_transport_syncmem();
4141
}
4242

43+
static inline void
44+
shmem_internal_pe_quiet(shmem_ctx_t ctx, const int *target_pes, int npes)
45+
{
46+
int ret;
47+
48+
if (ctx == SHMEM_CTX_INVALID)
49+
return;
50+
51+
ret = shmem_transport_pe_quiet((shmem_transport_ctx_t *)ctx, target_pes, npes);
52+
if (0 != ret) { RAISE_ERROR(ret); }
53+
54+
shmem_internal_membar();
55+
56+
/* Transport level memory flush is required to make memory
57+
* changes (i.e. subsequent coherent load operations
58+
* performed via the shmem_ptr API, the result of atomics
59+
* that targeted the local process) visible */
60+
shmem_transport_syncmem();
61+
}
4362

4463
static inline void
4564
shmem_internal_fence(shmem_ctx_t ctx)

src/synchronization_f.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ FC_SHMEM_QUIET(void)
3737
shmem_internal_quiet(SHMEM_CTX_DEFAULT);
3838
}
3939

40+
#define FC_SHMEM_PE_QUIET FC_FUNC_(shmem_pe_quiet, SHMEM_PE_QUIET)
41+
void SHMEM_FUNCTION_ATTRIBUTES
42+
FC_SHMEM_PE_QUIET(const int *target_pes, int npes);
43+
void
44+
FC_SHMEM_PE_QUIET(const int *target_pes, int npes)
45+
{
46+
SHMEM_ERR_CHECK_INITIALIZED();
47+
48+
shmem_internal_pe_quiet(SHMEM_CTX_DEFAULT, target_pes, npes);
49+
}
50+
51+
#define FC_SHMEM_CTX_QUIET FC_FUNC_(shmem_ctx_quiet, SHMEM_CTX_QUIET)
52+
void SHMEM_FUNCTION_ATTRIBUTES
53+
FC_SHMEM_CTX_QUIET(shmem_ctx_t ctx, const int *target_pes, int npes);
54+
void
55+
FC_SHMEM_CTX_QUIET(shmem_ctx_t ctx, const int *target_pes, int npes)
56+
{
57+
SHMEM_ERR_CHECK_INITIALIZED();
58+
59+
shmem_internal_pe_quiet(ctx, target_pes, npes);
60+
}
61+
4062

4163
#define FC_SHMEM_FENCE FC_FUNC_(shmem_fence, SHMEM_FENCE)
4264
void SHMEM_FUNCTION_ATTRIBUTES

src/transport_none.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ shmem_transport_quiet(shmem_transport_ctx_t* ctx)
103103
return 0;
104104
}
105105

106+
static inline
107+
int
108+
shmem_transport_pe_quiet(shmem_transport_ctx_t* ctx, const int *target_pes, int npes)
109+
{
110+
return 0;
111+
}
112+
106113
static inline
107114
int
108115
shmem_transport_fence(shmem_transport_ctx_t* ctx)

src/transport_ofi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,11 @@ int shmem_transport_ctx_create(struct shmem_internal_team_t *team, long options,
20212021
#ifndef USE_CTX_LOCK
20222022
shmem_internal_cntr_write(&ctxp->pending_put_cntr, 0);
20232023
shmem_internal_cntr_write(&ctxp->pending_get_cntr, 0);
2024+
2025+
for (int i = 0; i < shmem_internal_num_pes; i++) {
2026+
shmem_internal_cntr_write(&ctx->pending_get_per_pe[i], 0);
2027+
shmem_internal_cntr_write(&ctx->pending_put_per_pe[i], 0);
2028+
}
20242029
#endif
20252030

20262031
ctxp->stx_idx = -1;

0 commit comments

Comments
 (0)