Skip to content

Commit

Permalink
prov/ucx: Support FI_OPT_CUDA_API_PERMITTED in fi_setopt()
Browse files Browse the repository at this point in the history
This is required for providers that support FI_HMEM.

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
  • Loading branch information
j-xiong committed Aug 29, 2024
1 parent a049095 commit 8b26d8c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions prov/ucx/src/ucx_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,29 @@ static int ucx_ep_setopt(fid_t fid, int level, int optname,
{
struct ucx_ep *ep;

if (level == FI_OPT_ENDPOINT &&
optname == FI_OPT_MIN_MULTI_RECV &&
optlen >= sizeof(size_t)) {
if (level != FI_OPT_ENDPOINT)
return -FI_ENOPROTOOPT;

if (optname == FI_OPT_MIN_MULTI_RECV && optlen >= sizeof(size_t)) {
ep = container_of(fid, struct ucx_ep, ep.ep_fid.fid);
ep->ep_opts.mrecv_min_size = *(size_t*)optval;
return FI_SUCCESS;
}

if (optname == FI_OPT_CUDA_API_PERMITTED) {
if (!hmem_ops[FI_HMEM_CUDA].initialized) {
FI_WARN(&ucx_prov, FI_LOG_EP_CTRL,
"Cannot set CUDA API permitted when"
"CUDA library or CUDA device is not available\n");
return -FI_EINVAL;
}

/* our HMEM support does not make calls to CUDA API,
* therefore we can accept any option for FI_OPT_CUDA_API_PERMITTED.
*/
return FI_SUCCESS;
}

return -FI_ENOPROTOOPT;
}

Expand Down

0 comments on commit 8b26d8c

Please sign in to comment.