| 537 | } |
| 538 | |
| 539 | Status GdrMemoryManager::CreateEndpoint(const string& host, const string& port, |
| 540 | RdmaEndpointPtr& endpoint) { |
| 541 | rdma_addrinfo* addrinfo; |
| 542 | rdma_addrinfo hints = {}; |
| 543 | hints.ai_port_space = RDMA_PS_TCP; |
| 544 | if (rdma_getaddrinfo(const_cast<char*>(host.c_str()), |
| 545 | const_cast<char*>(port.c_str()), &hints, &addrinfo)) { |
| 546 | return errors::InvalidArgument( |
| 547 | strerror(errno), ": ", "cannot connect to rdma://", host, ":", port); |
| 548 | } |
| 549 | |
| 550 | ibv_qp_init_attr init_attr = {}; |
| 551 | init_attr.qp_type = IBV_QPT_RC; |
| 552 | init_attr.cap.max_recv_wr = 1; |
| 553 | init_attr.cap.max_send_wr = 1024; |
| 554 | init_attr.cap.max_recv_sge = 1; |
| 555 | init_attr.cap.max_send_sge = 1; |
| 556 | |
| 557 | rdma_cm_id* id; |
| 558 | if (rdma_create_ep(&id, addrinfo, nullptr, &init_attr)) { |
| 559 | rdma_freeaddrinfo(addrinfo); |
| 560 | return errors::Unavailable(strerror(errno), ": ", |
| 561 | "cannot create endpoint to rdma://", host, ":", |
| 562 | port); |
| 563 | } |
| 564 | rdma_freeaddrinfo(addrinfo); |
| 565 | |
| 566 | if (rdma_connect(id, nullptr)) { |
| 567 | rdma_destroy_ep(id); |
| 568 | return errors::Unavailable(strerror(errno), ": ", |
| 569 | "cannot connect to rdma://", host, ":", port); |
| 570 | } |
| 571 | |
| 572 | LOG(INFO) << "RDMA endpoint connected to rdma://" << host << ":" << port; |
| 573 | endpoint = RdmaEndpointPtr(id, EndpointDeleter); |
| 574 | return Status::OK(); |
| 575 | } |
| 576 | |
| 577 | ibv_mr* GdrMemoryManager::FindMemoryRegion(const Tensor* tensor) { |
| 578 | const void* addr = DMAHelper::buffer(tensor)->data(); |
nothing calls this directly
no test coverage detected