最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Is it possible to specify a source port in libfabric's DRMA client side? - Stack Overflow

programmeradmin5浏览0评论

I'm working with libfabric and trying to specify a source port for my application. I've set up my fi_info structure and assigned the source address and port, but it doesn't seem to be working as expected. Here's the relevant part of my code:

...
auto _hint = fi_allocinfo();
std::shared_ptr<fi_info> hint(_hint, std::bind(&fi_freeinfo, std::placeholders::_1));
hint->ep_attr->type = FI_EP_MSG;
hint->caps = FI_MSG;
hint->domain_attr->mr_mode = FI_MR_BASIC;
hint->mode = FI_LOCAL_MR;

// Define source (client) address
struct sockaddr_in *src_addr = new sockaddr_in{};
memset(src_addr, 0, sizeof(src_addr));
src_addr->sin_family = AF_INET;
src_addr->sin_addr.s_addr = htonl(INADDR_ANY);
src_addr->sin_port = htons(8899); // Source port

// Assign addresses to hints
hint->src_addr = src_addr;
hint->src_addrlen = sizeof(sockaddr_in);
hint->addr_format = FI_SOCKADDR_IN;

int ret = fi_getinfo(OFI_VERSION, address.c_str(), input.c_str(), 0, hint.get(), &_info);
if (ret) {
    std::cout << "connect():fi_getinfo failed" << std::endl;
    return nullptr;
}

...

My questions are:

  1. Is it possible to specify a source port in libfabric's verbs,DRMA?
  2. If so, what am I doing wrong in my code?
  3. Are there any additional steps or configurations required to make this work?

Any help or guidance would be greatly appreciated!

发布评论

评论列表(0)

  1. 暂无评论