admin管理员组

文章数量:1388812

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!

本文标签: cIs it possible to specify a source port in libfabric39s DRMA client sideStack Overflow