Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ test/simple/no-disconnect
test/simple/nonzero
test/simple/add_host
test/simple/win_notify_multi
test/simple/notified_rma_paths

oshmem/include/shmem.h
oshmem/include/shmem_portable_platform.h
Expand Down
68 changes: 68 additions & 0 deletions ompi/mca/osc/rdma/osc_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,38 @@ struct ompi_osc_rdma_module_t {
/** memory alignment to be used for new windows */
size_t memory_alignment;

/** per-rank count of notification counters attached at each process in
* the window group, as last published by MPI_WIN_SET_NUM_NOTIFY. NULL
* until the first call to MPI_WIN_SET_NUM_NOTIFY (no counters attached
* anywhere). used by origins to validate notification indices against
* the target's attached count */
int *notify_counts;

/** notification counters created by the accelerated btl, one per
* attached notification index. when these are in use an origin notifies
* by sending the matching key along with the data movement (btl
* put_notify/get_notify), so no separate atomic (and no flush to order it)
* is needed. NULL entries are indices that are not attached. */
struct mca_btl_base_notification_t *notify_handles[OMPI_OSC_RDMA_NOTIFY_MAX];

/** raw value of each hardware counter at the last reset. the btl never
* resets a counter, so MPI_WIN_RESET_NOTIFY_VALUE records a base here and
* subsequent reads report the difference. */
uint64_t notify_reset_base[OMPI_OSC_RDMA_NOTIFY_MAX];

/** btl notification keys published by every rank for their notification
* counters, packed as [rank * notify_stride + notify]. NULL when counters
* are not in use. */
uint64_t *notify_peer_keys;

/** number of keys published per rank, i.e. the group-wide maximum number
* of attached notification counters */
int notify_stride;

/** true when this window notifies through btl notification counters
* rather than through atomics on the counters in the window state */
bool use_notify_counters;

/* ********************* sync data ************************ */

/** global sync object (PSCW, fence, lock all) */
Expand Down Expand Up @@ -325,6 +357,42 @@ OMPI_DECLSPEC extern ompi_osc_rdma_component_t mca_osc_rdma_component;

int ompi_osc_rdma_free (struct ompi_win_t *win);

/* notified communication (MPI Standard section 12.6) */

/** validate a notification index against the number of counters attached at
* {rank} (as last published by MPI_WIN_SET_NUM_NOTIFY). the standard makes
* it erroneous to reference a counter that is out of range at the target. */
#define OMPI_OSC_RDMA_CHECK_NOTIFY_IDX(module, notify, rank) \
if (OPAL_UNLIKELY(NULL == (module)->notify_counts || (notify) < 0 || \
(notify) >= (module)->notify_counts[(rank)])) { \
return MPI_ERR_RMA_NOTIFICATION; \
}

/**
* @brief btl notification key rank {rank} published for its notification counter {notify}
*
* An origin passes this key to the btl's put_notify/get_notify to make the
* target advance that counter once the operation has completed there. Only
* valid when module->use_notify_counters is set.
*/
static inline const uint64_t *
ompi_osc_rdma_peer_notify_key (ompi_osc_rdma_module_t *module, int rank, int notify)
{
return module->notify_peer_keys + (size_t) rank * (size_t) module->notify_stride + (size_t) notify;
}

void ompi_osc_rdma_notify_counters_destroy (ompi_osc_rdma_module_t *module);
int ompi_osc_rdma_win_get_notify_value (struct ompi_win_t *win, int notify,
OMPI_MPI_COUNT_TYPE *value);
int ompi_osc_rdma_win_reset_notify_value (struct ompi_win_t *win, int notify,
OMPI_MPI_COUNT_TYPE *value);
int ompi_osc_rdma_win_set_num_notify (struct ompi_win_t *win, struct opal_info_t *info,
int num_notifications);
int ompi_osc_rdma_win_get_notify_bounds (struct ompi_win_t *win, int *num_sb, int *num_ub,
OMPI_MPI_COUNT_TYPE *value_ub);
int ompi_osc_rdma_win_get_num_notify (struct ompi_win_t *win, int target_rank,
int *num_notifications);


/* peer functions */

Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/osc/rdma/osc_rdma_accumulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ static inline int ompi_osc_rdma_gacc_contig (ompi_osc_rdma_sync_t *sync, const v
}

if (&ompi_mpi_op_replace.op == op) {
return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, (void *) source, len, request);
return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, (void *) source, len, request, 0, NULL);
}

if (&ompi_mpi_op_no_op.op != op) {
Expand All @@ -513,7 +513,7 @@ static inline int ompi_osc_rdma_gacc_contig (ompi_osc_rdma_sync_t *sync, const v
return ret;
}

return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, ptr, len, request);
return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, ptr, len, request, 0, NULL);
}

/* nothing more to do for this request */
Expand All @@ -522,7 +522,7 @@ static inline int ompi_osc_rdma_gacc_contig (ompi_osc_rdma_sync_t *sync, const v
return OMPI_SUCCESS;
}

return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, (void *) source, len, request);
return ompi_osc_rdma_put_contig (sync, peer, target_address, target_handle, (void *) source, len, request, 0, NULL);
}

static void ompi_osc_rdma_gacc_master_cleanup (ompi_osc_rdma_request_t *request)
Expand Down Expand Up @@ -913,7 +913,7 @@ static inline int cas_rdma (ompi_osc_rdma_sync_t *sync, const void *source_addr,
do {
ret = ompi_osc_rdma_btl_put(module, peer->data_btl_index, peer->data_endpoint,
ptr, target_address, local_handle, target_handle,
len, 0, MCA_BTL_NO_ORDER,
len, 0, MCA_BTL_NO_ORDER, NULL,
ompi_osc_rdma_cas_put_complete, (void *) &complete, NULL);
if (OPAL_SUCCESS == ret || (OPAL_ERR_OUT_OF_RESOURCE != ret && OPAL_ERR_TEMP_OUT_OF_RESOURCE != ret)) {
break;
Expand Down
19 changes: 17 additions & 2 deletions ompi/mca/osc/rdma/osc_rdma_btl_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,32 @@ void ompi_osc_rdma_atomic_complete(mca_btl_base_module_t *btl, struct mca_btl_ba
void *context, void *data, int status);


/* {notify_key}, when not NULL, notifies the target through btl notified RMA. that
* is only valid when the accelerated btl sets MCA_BTL_FLAGS_NOTIFIED_RMA, which
* module->use_notify_counters guarantees */
static inline int
ompi_osc_rdma_btl_put(ompi_osc_rdma_module_t *module, uint8_t btl_index,
struct mca_btl_base_endpoint_t *endpoint,
void *local_address, uint64_t remote_address,
struct mca_btl_base_registration_handle_t *local_handle,
struct mca_btl_base_registration_handle_t *remote_handle,
size_t size, int flags, int order,
size_t size, int flags, int order, const uint64_t *notify_key,
mca_btl_base_rdma_completion_fn_t cbfunc,
void *cbcontext, void *cbdata)
{
if (module->use_accelerated_btl) {
mca_btl_base_module_t *btl = ompi_osc_rdma_selected_btl(module, btl_index);
if (NULL != notify_key) {
return btl->btl_put_notify(btl, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
*notify_key, cbfunc, cbcontext, cbdata);
}
return btl->btl_put(btl, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
cbfunc, cbcontext, cbdata);
} else {
mca_btl_base_am_rdma_module_t *am_rdma = ompi_osc_rdma_selected_am_rdma(module, btl_index);
assert (NULL == notify_key);
return am_rdma->am_btl_put(am_rdma, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
cbfunc, cbcontext, cbdata);
Expand All @@ -56,18 +65,24 @@ ompi_osc_rdma_btl_get(ompi_osc_rdma_module_t *module, uint8_t btl_index,
void *local_address, uint64_t remote_address,
struct mca_btl_base_registration_handle_t *local_handle,
struct mca_btl_base_registration_handle_t *remote_handle,
size_t size, int flags, int order,
size_t size, int flags, int order, const uint64_t *notify_key,
mca_btl_base_rdma_completion_fn_t cbfunc,
void *cbcontext, void *cbdata)
{

if (module->use_accelerated_btl) {
mca_btl_base_module_t *btl = ompi_osc_rdma_selected_btl(module, btl_index);
if (NULL != notify_key) {
return btl->btl_get_notify(btl, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
*notify_key, cbfunc, cbcontext, cbdata);
}
return btl->btl_get(btl, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
cbfunc, cbcontext, cbdata);
} else {
mca_btl_base_am_rdma_module_t *am_rdma = ompi_osc_rdma_selected_am_rdma(module, btl_index);
assert (NULL == notify_key);
return am_rdma->am_btl_get(am_rdma, endpoint, local_address, remote_address,
local_handle, remote_handle, size, flags, order,
cbfunc, cbcontext, cbdata);
Expand Down
Loading
Loading