static int init_fabric(void) { int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; // set FI_MULTI_RECV flag for all recv operations fi->rx_attr->op_flags = FI_MULTI_RECV; ret = ft_open_fabric_res(); if (ret) return ret; ret = alloc_ep_res(fi); if (ret) return ret; ret = ft_init_ep(); if (ret) return ret; ret = fi_setopt(&ep->fid, FI_OPT_ENDPOINT, FI_OPT_MIN_MULTI_RECV, &tx_size, sizeof(tx_size)); if (ret) return ret; ret = post_multi_recv_buffer(); return ret; }
int ft_init_fabric(void) { int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; ret = ft_open_fabric_res(); if (ret) return ret; if (hints->caps & FI_RMA) { ret = ft_set_rma_caps(fi, opts.rma_op); if (ret) return ret; } ret = ft_alloc_active_res(fi); if (ret) return ret; ret = ft_init_ep(); if (ret) return ret; ret = ft_init_av(); if (ret) return ret; return 0; }
int ft_client_connect(void) { struct fi_eq_cm_entry entry; uint32_t event; ssize_t rd; int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; ret = ft_open_fabric_res(); if (ret) return ret; ret = ft_alloc_active_res(fi); if (ret) return ret; ret = ft_init_ep(); if (ret) return ret; ret = fi_connect(ep, fi->dest_addr, NULL, 0); if (ret) { FT_PRINTERR("fi_connect", ret); return ret; } rd = fi_eq_sread(eq, &event, &entry, sizeof entry, -1, 0); if (rd != sizeof entry) { FT_PROCESS_EQ_ERR(rd, eq, "fi_eq_sread", "connect"); ret = (int) rd; return ret; } if (event != FI_CONNECTED || entry.fid != &ep->fid) { fprintf(stderr, "Unexpected CM event %d fid %p (ep %p)\n", event, entry.fid, ep); ret = -FI_EOTHER; return ret; } return 0; }
static int init_fabric(void) { int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; ret = get_dupinfo(); if (ret) return ret; ret = ft_open_fabric_res(); if (ret) return ret; av_attr.count = ep_cnt; ret = alloc_ep_res(fi); if (ret) return ret; ret = alloc_ep(); if (ret) return ret; ret = bind_ep_array_res(); if (ret) return ret; /* Post recv */ if (rx_shared_ctx) ret = ft_post_rx(srx_ctx, MAX(rx_size, FT_MAX_CTRL_MSG), &rx_ctx); else ret = ft_post_rx(ep_array[0], MAX(rx_size, FT_MAX_CTRL_MSG), &rx_ctx); if (ret) return ret; ret = init_av(); return ret; }
int ft_start_server(void) { int ret; ret = ft_getinfo(hints, &fi_pep); if (ret) return ret; ret = fi_fabric(fi_pep->fabric_attr, &fabric, NULL); if (ret) { FT_PRINTERR("fi_fabric", ret); return ret; } ret = fi_eq_open(fabric, &eq_attr, &eq, NULL); if (ret) { FT_PRINTERR("fi_eq_open", ret); return ret; } ret = fi_passive_ep(fabric, fi_pep, &pep, NULL); if (ret) { FT_PRINTERR("fi_passive_ep", ret); return ret; } ret = fi_pep_bind(pep, &eq->fid, 0); if (ret) { FT_PRINTERR("fi_pep_bind", ret); return ret; } ret = fi_listen(pep); if (ret) { FT_PRINTERR("fi_listen", ret); return ret; } return 0; }
static int init_fabric(void) { int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; ret = ft_open_fabric_res(); if (ret) return ret; ret = alloc_ep_res(fi); if (ret) return ret; ret = ft_enable_ep_recv(); if (ret) return ret; return 0; }
static int init_fabric(void) { int ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; /* Check the optimal number of TX and RX contexts supported by the provider */ ctx_cnt = MIN(ctx_cnt, fi->domain_attr->tx_ctx_cnt); ctx_cnt = MIN(ctx_cnt, fi->domain_attr->rx_ctx_cnt); if (!ctx_cnt) { fprintf(stderr, "Provider doesn't support contexts\n"); return 1; } fi->ep_attr->tx_ctx_cnt = ctx_cnt; fi->ep_attr->rx_ctx_cnt = ctx_cnt; ret = ft_open_fabric_res(); if (ret) return ret; ret = fi_scalable_ep(domain, fi, &sep, NULL); if (ret) { FT_PRINTERR("fi_scalable_ep", ret); return ret; } ret = alloc_ep_res(sep); if (ret) return ret; ret = bind_ep_res(); return ret; }
static int client_connect(void) { struct fi_eq_cm_entry entry; uint32_t event; ssize_t rd; int i, ret; ret = ft_getinfo(hints, &fi); if (ret) return ret; ret = get_dupinfo(); if (ret) return ret; ret = ft_open_fabric_res(); if (ret) return ret; ret = alloc_ep_res(fi); if (ret) return ret; ret = alloc_ep(); if (ret) return ret; ret = bind_ep_array_res(); if (ret) return ret; for (i = 0; i < ep_cnt; i++) { ret = fi_connect(ep_array[i], fi->dest_addr, NULL, 0); if (ret) { FT_PRINTERR("fi_connect", ret); return ret; } rd = fi_eq_sread(eq, &event, &entry, sizeof entry, -1, 0); if (rd != sizeof entry) { FT_PROCESS_EQ_ERR(rd, eq, "fi_eq_sread", "connect"); ret = (int) rd; return ret; } if (event != FI_CONNECTED || entry.fid != &ep_array[i]->fid) { fprintf(stderr, "Unexpected CM event %d fid %p (ep %p)\n", event, entry.fid, ep); ret = -FI_EOTHER; return ret; } } /* Post recv */ if (rx_shared_ctx) ret = ft_post_rx(srx_ctx, MAX(rx_size, FT_MAX_CTRL_MSG), &rx_ctx); else ret = ft_post_rx(ep_array[0], MAX(rx_size, FT_MAX_CTRL_MSG), &rx_ctx); if (ret) return ret; return 0; }