int ft_alloc_active_res(struct fi_info *fi) { int ret; ret = ft_alloc_msgs(); if (ret) return ret; if (cq_attr.format == FI_CQ_FORMAT_UNSPEC) { if (fi->caps & FI_TAGGED) cq_attr.format = FI_CQ_FORMAT_TAGGED; else cq_attr.format = FI_CQ_FORMAT_CONTEXT; } if (opts.options & FT_OPT_TX_CQ) { ft_cq_set_wait_attr(); cq_attr.size = fi->tx_attr->size; ret = fi_cq_open(domain, &cq_attr, &txcq, &txcq); if (ret) { FT_PRINTERR("fi_cq_open", ret); return ret; } if (opts.comp_method == FT_COMP_WAIT_FD) { ret = fi_control(&txcq->fid, FI_GETWAIT, (void *) &tx_fd); if (ret) { FT_PRINTERR("fi_control(FI_GETWAIT)", ret); return ret; } } } if (opts.options & FT_OPT_TX_CNTR) { ft_cntr_set_wait_attr(); ret = fi_cntr_open(domain, &cntr_attr, &txcntr, &txcntr); if (ret) { FT_PRINTERR("fi_cntr_open", ret); return ret; } } if (opts.options & FT_OPT_RX_CQ) { ft_cq_set_wait_attr(); cq_attr.size = fi->rx_attr->size; ret = fi_cq_open(domain, &cq_attr, &rxcq, &rxcq); if (ret) { FT_PRINTERR("fi_cq_open", ret); return ret; } if (opts.comp_method == FT_COMP_WAIT_FD) { ret = fi_control(&rxcq->fid, FI_GETWAIT, (void *) &rx_fd); if (ret) { FT_PRINTERR("fi_control(FI_GETWAIT)", ret); return ret; } } } if (opts.options & FT_OPT_RX_CNTR) { ft_cntr_set_wait_attr(); ret = fi_cntr_open(domain, &cntr_attr, &rxcntr, &rxcntr); if (ret) { FT_PRINTERR("fi_cntr_open", ret); return ret; } } if (fi->ep_attr->type == FI_EP_RDM || fi->ep_attr->type == FI_EP_DGRAM) { if (fi->domain_attr->av_type != FI_AV_UNSPEC) av_attr.type = fi->domain_attr->av_type; if (opts.av_name) { av_attr.name = opts.av_name; } ret = fi_av_open(domain, &av_attr, &av, NULL); if (ret) { FT_PRINTERR("fi_av_open", ret); return ret; } } ret = fi_endpoint(domain, fi, &ep, NULL); if (ret) { FT_PRINTERR("fi_endpoint", ret); return ret; } return 0; }
int ft_alloc_ep_res(struct fi_info *fi) { int ret; if (hints->caps & FI_RMA) { ret = ft_set_rma_caps(fi, opts.rma_op); if (ret) return ret; } ret = ft_alloc_msgs(); if (ret) return ret; if (cq_attr.format == FI_CQ_FORMAT_UNSPEC) { if (fi->caps & FI_TAGGED) cq_attr.format = FI_CQ_FORMAT_TAGGED; else cq_attr.format = FI_CQ_FORMAT_CONTEXT; } if (opts.options & FT_OPT_TX_CQ) { ft_cq_set_wait_attr(); cq_attr.size = fi->tx_attr->size; ret = fi_cq_open(domain, &cq_attr, &txcq, &txcq); if (ret) { FT_PRINTERR("fi_cq_open", ret); return ret; } } if (opts.options & FT_OPT_TX_CNTR) { ft_cntr_set_wait_attr(); ret = fi_cntr_open(domain, &cntr_attr, &txcntr, &txcntr); if (ret) { FT_PRINTERR("fi_cntr_open", ret); return ret; } } if (opts.options & FT_OPT_RX_CQ) { ft_cq_set_wait_attr(); cq_attr.size = fi->rx_attr->size; ret = fi_cq_open(domain, &cq_attr, &rxcq, &rxcq); if (ret) { FT_PRINTERR("fi_cq_open", ret); return ret; } } if (opts.options & FT_OPT_RX_CNTR) { ft_cntr_set_wait_attr(); ret = fi_cntr_open(domain, &cntr_attr, &rxcntr, &rxcntr); if (ret) { FT_PRINTERR("fi_cntr_open", ret); return ret; } } if (fi->ep_attr->type == FI_EP_RDM || fi->ep_attr->type == FI_EP_DGRAM) { if (fi->domain_attr->av_type != FI_AV_UNSPEC) av_attr.type = fi->domain_attr->av_type; if (opts.av_name) { av_attr.name = opts.av_name; } ret = fi_av_open(domain, &av_attr, &av, NULL); if (ret) { FT_PRINTERR("fi_av_open", ret); return ret; } } return 0; }