Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/application/transport/rdma/providers/ibverbs/ibverbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// SOFTWARE.
#include "mori/application/transport/rdma/providers/ibverbs/ibverbs.hpp"

#include <cerrno>
#include <cstring>
#include <stdexcept>

#include "mori/application/utils/check.hpp"
#include "mori/utils/mori_log.hpp"
namespace mori {
Expand Down Expand Up @@ -69,7 +73,13 @@ RdmaEndpoint IBVerbsDeviceContext::CreateRdmaEndpoint(const RdmaEndpointConfig&
endpoint.ibvHandle.compCh = config.withCompChannel ? ibv_create_comp_channel(context) : nullptr;
endpoint.ibvHandle.cq =
ibv_create_cq(context, config.maxCqeNum, NULL, endpoint.ibvHandle.compCh, 0);
assert(endpoint.ibvHandle.cq);
if (!endpoint.ibvHandle.cq) {
MORI_APP_ERROR(
"ibv_create_cq failed: errno={} ({}); dev={} max_cqe={} dev_max_cqe={} cqs_in_pool={}",
errno, strerror(errno), GetRdmaDevice()->Name(), config.maxCqeNum,
deviceAttr->orig_attr.max_cqe, cqPool.size());
throw std::runtime_error("ibv_create_cq failed: " + std::string(strerror(errno)));
}
Comment on lines +76 to +82

// TODO: should also manage the lifecycle of completion channel && srq
if (config.withCompChannel)
Expand All @@ -92,7 +102,16 @@ RdmaEndpoint IBVerbsDeviceContext::CreateRdmaEndpoint(const RdmaEndpointConfig&
},
.qp_type = IBV_QPT_RC};
endpoint.ibvHandle.qp = ibv_create_qp(pd, &qpAttr);
assert(endpoint.ibvHandle.qp);
if (!endpoint.ibvHandle.qp) {
MORI_APP_ERROR(
"ibv_create_qp failed: errno={} ({}); dev={} port={} max_send_wr={} max_recv_wr={} "
"max_send_sge={} max_cqe={} dev_caps(max_qp_wr={} max_qp={} max_cqe={}) qps_in_pool={}",
errno, strerror(errno), GetRdmaDevice()->Name(), config.portId, qpAttr.cap.max_send_wr,
qpAttr.cap.max_recv_wr, qpAttr.cap.max_send_sge, config.maxCqeNum,
deviceAttr->orig_attr.max_qp_wr, deviceAttr->orig_attr.max_qp,
deviceAttr->orig_attr.max_cqe, qpPool.size());
throw std::runtime_error("ibv_create_qp failed: " + std::string(strerror(errno)));
}
Comment on lines +105 to +114
endpoint.handle.qpn = endpoint.ibvHandle.qp->qp_num;

if (config.enableSrq)
Expand Down Expand Up @@ -208,6 +227,10 @@ IBVerbsDevice::~IBVerbsDevice() {}

RdmaDeviceContext* IBVerbsDevice::CreateRdmaDeviceContext() {
ibv_pd* pd = ibv_alloc_pd(defaultContext);
if (!pd) {
MORI_APP_ERROR("ibv_alloc_pd failed: errno={} ({}); dev={}", errno, strerror(errno), Name());
throw std::runtime_error("ibv_alloc_pd failed: " + std::string(strerror(errno)));
}
Comment on lines 229 to +233
return new IBVerbsDeviceContext(this, pd);
}

Expand Down
3 changes: 2 additions & 1 deletion src/umbp/distributed/pool_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <unordered_map>

#include "mori/io/backend.hpp"
#include "mori/utils/env_utils.hpp"
#include "mori/utils/mori_log.hpp"
#include "umbp/common/env_time.h"
#include "umbp/distributed/master/master_metrics.h"
Expand Down Expand Up @@ -277,7 +278,7 @@ bool PoolClient::Init() {
io_engine_ = std::make_unique<mori::io::IOEngine>(config_.master_config.node_id, io_cfg);
mori::io::RdmaBackendConfig rdma_cfg;

rdma_cfg.qpPerTransfer = 16;
rdma_cfg.qpPerTransfer = mori::env::GetPositiveIntOr("MORI_UMBP_QP_PER_TRANSFER", 4);
rdma_cfg.enableTransferChunking = true;
rdma_cfg.numNicsPerTransfer = 4;
io_engine_->CreateBackend(mori::io::BackendType::RDMA, rdma_cfg);
Expand Down
Loading