Skip to content

Commit 0630470

Browse files
committed
OSHMEM/MCA/SPML/UCX: implement put_signal and put_signal_nbi
Signed-off-by: Roie Danino <[email protected]>
1 parent 8f1f791 commit 0630470

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,19 +1644,56 @@ int mca_spml_ucx_put_all_nb(void *dest, const void *source, size_t size, long *c
16441644
return OSHMEM_SUCCESS;
16451645
}
16461646

1647-
/* This routine is not implemented */
1647+
static inline int mca_spml_ucx_signal_common(shmem_ctx_t ctx,
1648+
uint64_t *sig_addr,
1649+
uint64_t signal,
1650+
int sig_op,
1651+
int dst)
1652+
{
1653+
int res;
1654+
uint64_t dummy_prev;
1655+
1656+
if (sig_op == SHMEM_SIGNAL_SET) {
1657+
/* Use atomic swap to set the signal value */
1658+
res = MCA_ATOMIC_CALL(swap(ctx, (void*)sig_addr, (void*)&dummy_prev,
1659+
signal, sizeof(uint64_t), dst));
1660+
} else if (sig_op == SHMEM_SIGNAL_ADD) {
1661+
/* Use atomic add to add the signal value */
1662+
res = MCA_ATOMIC_CALL(add(ctx, (void*)sig_addr, signal,
1663+
sizeof(uint64_t), dst));
1664+
} else {
1665+
SPML_UCX_ERROR("Invalid signal operation: %d", sig_op);
1666+
return OSHMEM_ERROR;
1667+
}
1668+
1669+
return res;
1670+
}
1671+
16481672
int mca_spml_ucx_put_signal(shmem_ctx_t ctx, void* dst_addr, size_t size, void*
16491673
src_addr, uint64_t *sig_addr, uint64_t signal, int sig_op, int dst)
16501674
{
1651-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1675+
int res;
1676+
1677+
res = mca_spml_ucx_put(ctx, dst_addr, size, src_addr, dst);
1678+
if (OPAL_UNLIKELY(OSHMEM_SUCCESS != res)) {
1679+
return res;
1680+
}
1681+
1682+
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst);
16521683
}
16531684

1654-
/* This routine is not implemented */
16551685
int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
16561686
void* src_addr, uint64_t *sig_addr, uint64_t signal, int sig_op, int
16571687
dst)
16581688
{
1659-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1689+
int res;
1690+
1691+
res = mca_spml_ucx_put_nb(ctx, dst_addr, size, src_addr, dst, NULL);
1692+
if (OPAL_UNLIKELY(OSHMEM_SUCCESS != res)) {
1693+
return res;
1694+
}
1695+
1696+
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst);
16601697
}
16611698

16621699
/* This routine is not implemented */

0 commit comments

Comments
 (0)