EFA API¶
Core API¶
efa: low-level Pythonic bindings for AWS EFA (SRD RDMA).
Quickstart (SRD is connectionless – no per-QP handshake, just exchange
EndpointInfo once):
import efa
dev = efa.get_efa_device_list()[0]
ctx = dev.open()
pd = ctx.alloc_pd()
cq = ctx.create_cq(256)
qp = pd.create_qp(efa.QPInitAttr(send_cq=cq, recv_cq=cq)).prepare(qkey=0x1234)
info = efa.local_endpoint_info(qp, qkey=0x1234)
# ... exchange info.to_bytes() with the peer out-of-band ...
peer = efa.EndpointInfo.from_bytes(remote_bytes).peer(pd)
mr = efa.reg_tensor(pd, tensor, efa.AccessFlags.LOCAL_WRITE)
qp.post_send(efa.SendWR(sg_list=[mr.sge()], opcode=efa.WROpcode.SEND,
send_flags=efa.SendFlags.SIGNALED, dest=peer))
The compiled fast paths live in efa._efa; enums in efa.enums;
address-exchange and tensor helpers in efa.helpers.
- class efa.CQ¶
Bases:
_CQBaseA classic completion queue (
ibv_cq).- close(self)¶
- class efa.CQAttr¶
Bases:
objectAn EFA completion queue’s direct layout from
efadv_query_cq.- buffer_addr¶
- doorbell_addr¶
- entry_size¶
- num_entries¶
- class efa.CQEx¶
Bases:
_CQBaseAn extended EFA completion queue (
efadv_create_cq).Functionally a
CQ, plus optional sender-GID reporting (sgid=True): SRD/UD receivers can identify previously unknown peers straight from the completion (seeWC.sgid).- close(self)¶
- poll(self, int num_entries) list¶
Poll up to
num_entriescompletions; return a list ofWC.- Return type:
- sgid_enabled¶
bool
- Type:
- unsolicited_enabled¶
bool
- Type:
- class efa.MR¶
Bases:
objectA registered memory region (
ibv_mr).- close(self)¶
- owner¶
- pd¶
- class efa.PD¶
Bases:
objectA protection domain (
ibv_pd).- close(self)¶
- context¶
- create_ah(self, addr, int sgid_index=0, int port_num=1) 'AH'¶
Create an address handle for a remote EFA device.
addrmay be anAHAttr, aGid, or 16 raw GID bytes.- Return type:
- create_qp(self, init_attr) 'QP'¶
Create an SRD (default) or UD queue pair.
SRD QPs go through
efadv_create_qp_ex; UD QPs throughibv_create_qp_ex. Both are created with the extended send-ops work-request API enabled (seeQPInitAttr).- Return type:
- reg_dmabuf_mr(self, offset, length, iova, int fd, int access) 'MR'¶
Register a dma-buf backed region (modern GPUDirect path).
- Return type:
- class efa.QP¶
Bases:
objectAn EFA queue pair (SRD or UD).
Sends go through the extended work-request API under the hood, so every supported opcode, including RDMA read/write on SRD, which the classic
ibv_post_sendcannot express on this provider, posts uniformly viapost_send().- close(self)¶
- modify(self, int attr_mask, **fields)¶
Low-level
ibv_modify_qp.attr_maskis an ORedQPAttrMask. Scalar attributes are passed as keywords (e.g.qp_state=,qkey=).
- pd¶
- post_send(self, wrs)¶
Post one or more
SendWRas a single batch.All work requests are queued between
wr_start/wr_complete, so either the whole batch is submitted or none of it is.EFA requires every send WR to carry
SIGNALED(or the QP must be created withsq_sig_all=True); an unsignaled WR fails the batch with EINVAL.
- prepare(self, qkey, int port=1, psn=0, rnr_retry=None)¶
Drive RESET -> INIT -> RTR -> RTS in one call.
SRD/UD are connectionless, so a QP is fully usable after this without any remote information; destinations are named per-send.
- qp_type¶
- query(self)¶
Return
(attrs, cap)for the queue pair as plain dict + QPCap.
- recv_cq¶
- send_cq¶
- send_ops_flags¶
- to_init(self, qkey, int port=1, int pkey_index=0)¶
Transition RESET -> INIT, binding the qkey.
- to_rtr(self)¶
Transition INIT -> RTR (connectionless: no remote info needed).
- class efa.AHAttr(dgid=None, sgid_index=0, port_num=1, hop_limit=1, traffic_class=0, flow_label=0, is_global=1)¶
Bases:
objectAddress-handle attributes.
EFA addresses are GIDs: only
dgid(the remote device’s GID),sgid_indexandport_nummatter; the rest exists for parity with generic verbs.- flow_label¶
‘uint32_t’
- Type:
- sgid_index¶
‘uint8_t’
- Type:
- traffic_class¶
‘uint8_t’
- Type:
- class efa.AsyncEvent¶
Bases:
objectAn asynchronous device event from
Context.get_async_event().- event_type¶
- event_type_str¶
str
- class efa.CompChannel¶
Bases:
objectA completion event channel (
ibv_comp_channel).- close(self)¶
- context¶
- fd¶
int
- Type:
- exception efa.CompletionError(wc)¶
Bases:
EfaErrorRaised by
WC.raise_for_status()for a failed completion.
- class efa.Context¶
Bases:
objectAn open device context (
ibv_context).- ack_async_event(self, AsyncEvent ev)¶
- async_fd¶
int
- Type:
- close(self)¶
- create_comp_channel(self) 'CompChannel'¶
- Return type:
- create_cq(self, int cqe, channel=None, int comp_vector=0) 'CQ'¶
Create a classic completion queue (
ibv_create_cq).- Return type:
- create_cq_ex(self, int cqe, channel=None, int comp_vector=0, wc_flags=None, bool sgid=False, bool unsolicited=False) 'CQEx'¶
Create an extended EFA completion queue (
efadv_create_cq).sgid=Truerequests sender-GID reporting on receive completions (needsCQ_WITH_SGID); the GID shows up asWC.sgidfor peers not matched by a local AH.unsolicited=Truerequests an indicator for unsolicited write-with-immediate receive completions (needsUNSOLICITED_WRITE_RECV).- Return type:
- get_async_event(self) 'AsyncEvent'¶
- Return type:
- name¶
- num_comp_vectors¶
int
- Type:
- query_device(self) DeviceAttr¶
- Return type:
- query_efa_device(self) EfaDeviceAttr¶
EFA capabilities (
efadv_query_device).Raises
EfaErrorif the device is not an EFA device.- Return type:
- class efa.Device(str name, uint64_t guid)¶
Bases:
objectAn RDMA device discovered by
get_device_list().- guid¶
- name¶
- class efa.DeviceAttr¶
Bases:
objectGeneric verbs device capabilities from
Context.query_device().- fw_ver¶
- hw_ver¶
- max_ah¶
- max_cq¶
- max_cqe¶
- max_mr¶
- max_mr_size¶
- max_pd¶
- max_pkeys¶
- max_qp¶
- max_qp_wr¶
- max_sge¶
- node_guid¶
- phys_port_cnt¶
- sys_image_guid¶
- vendor_id¶
- vendor_part_id¶
- class efa.EfaDeviceAttr¶
Bases:
objectEFA-specific capabilities from
Context.query_efa_device().- device_caps¶
- inline_buf_size¶
- max_rdma_size¶
- max_rq_sge¶
- max_rq_wr¶
- max_sq_sge¶
- max_sq_wr¶
- exception efa.EfaError(operation, err, detail=None)¶
Bases:
OSErrorRaised when a libibverbs/libefa call fails.
Subclasses
OSError, so.errnoand.strerrorare populated..operationnames the call that failed.
- class efa.Gid(bytes raw)¶
Bases:
objectA 16-byte GID (the EFA device address).
- interface_id¶
int
- Type:
- raw¶
- subnet_prefix¶
int
- Type:
- class efa.MRAttr¶
Bases:
objectEFA MR attributes from
MR.query_efa()(efadv_query_mr).- ic_id_validity¶
- rdma_read_ic_id¶
- rdma_recv_ic_id¶
- recv_ic_id¶
- class efa.PortAttr¶
Bases:
objectPort attributes from
Context.query_port().max_msg_szis the SEND size limit; RDMA read/write are limited byEfaDeviceAttr.max_rdma_sizeinstead.- active_mtu¶
- active_speed¶
- active_width¶
- gid_tbl_len¶
- lid¶
- link_layer¶
- max_msg_sz¶
- max_mtu¶
- pkey_tbl_len¶
- port_cap_flags¶
- state¶
- class efa.QPCap¶
Bases:
objectQueue-pair capacity limits.
- max_inline_data¶
- max_recv_sge¶
- max_recv_wr¶
- max_send_sge¶
- max_send_wr¶
- class efa.QPInitAttr(send_cq, recv_cq, qp_type=None, max_send_wr=128, max_recv_wr=128, max_send_sge=1, max_recv_sge=1, max_inline_data=0, sq_sig_all=False, send_ops_flags=None, sl=0, unsolicited_write_recv=False)¶
Bases:
objectParameters for
PD.create_qp().qp_typeisSRD(default) orUD.send_ops_flagsdefaults to every operation the QP type supports (SEND/SEND_WITH_IMM, plus the RDMA ops for SRD); pass an explicitQPExSendOpsFlagsmask to restrict it; the provider rejects masks including ops the device cannot do, so pass e.g.SEND | SEND_WITH_IMMon RDMA-less instance types.unsolicited_write_recvopts in to RDMA-write-with-imm completions that consume no posted recv (checkUNSOLICITED_WRITE_RECV).
- class efa.SendWR(wr_id=0, sg_list=None, opcode=2, send_flags=0, remote_addr=0, rkey=0, imm_data=0, ah=None, remote_qpn=0, remote_qkey=0, dest=None)¶
Bases:
objectA send work request.
SRD/UD is connectionless: every send names its destination. Set either
dest=(anything with.ah,.qp_numand.qkeyattributes, e.g.efa.helpers.Peer) or the explicitah/remote_qpn/remote_qkeytrio.Opcodes: SEND, SEND_WITH_IMM, RDMA_READ, RDMA_WRITE, RDMA_WRITE_WITH_IMM (RDMA opcodes additionally need
remote_addr/rkey).- remote_addr¶
‘uint64_t’
- Type:
- remote_qkey¶
‘uint32_t’
- Type:
- remote_qpn¶
‘uint32_t’
- Type:
- send_flags¶
‘unsigned int’
- Type:
- class efa.SGE(target, length, lkey=0, offset=0)¶
Bases:
objectA scatter/gather entry.
SGE(target, length, lkey=0, offset=0)wheretargetis either anMR(lkey/addrderived from it) or an integer address.- addr¶
- length¶
- lkey¶
- owner¶
- class efa.WC¶
Bases:
objectA work completion returned by
CQ.poll()/CQEx.poll().For completions from a
CQExcreated withsgid=True,sgidcarries the sender’s GID on receive completions from peers not covered by a local AH (elseNone).- byte_len¶
- imm_data¶
- is_success¶
bool
- Type:
- opcode¶
- qp_num¶
- raise_for_status(self)¶
Raise
CompletionErrorif this completion did not succeed.
- sgid¶
- src_qp¶
- status¶
- status_str¶
str
- Type:
- unsolicited¶
- vendor_err¶
- wc_flags¶
- wr_id¶
- class efa.WQAttr¶
Bases:
objectA work queue’s layout from
QP.query_wqs()(efadv_query_qp_wqs).- buffer_addr¶
- doorbell_addr¶
- entry_size¶
- max_batch¶
- num_entries¶
- efa.get_device_list() list¶
Return every RDMA
Deviceon this host (EFA or not).Use
get_efa_device_list()to keep only EFA devices.- Return type:
- efa.get_efa_device_list() list¶
Return the
Devicelist filtered to EFA devices.Each device is briefly opened and probed with
efadv_query_device.- Return type:
- class efa.AccessFlags(*values)¶
Bases:
IntFlagMemory-region access permissions (
IBV_ACCESS_*).- LOCAL_WRITE = 1¶
- REMOTE_WRITE = 2¶
- REMOTE_READ = 4¶
- RELAXED_ORDERING = 1048576¶
- class efa.CreateCQWCFlags(*values)¶
Bases:
IntFlagExtended-CQ per-completion fields (
IBV_WC_EX_WITH_*).STANDARDmatches what classicibv_poll_cqreports and is the default forcreate_cq_ex().- BYTE_LEN = 1¶
- IMM = 2¶
- QP_NUM = 4¶
- SRC_QP = 8¶
- SLID = 16¶
- SL = 32¶
- DLID_PATH_BITS = 64¶
- STANDARD = 127¶
- class efa.EfaDeviceCaps(*values)¶
Bases:
IntFlagEFA device capability bits (
EFADV_DEVICE_ATTR_CAPS_*).Test against
device_caps.- RDMA_READ = 1¶
- RNR_RETRY = 2¶
- CQ_WITH_SGID = 4¶
- RDMA_WRITE = 8¶
- UNSOLICITED_WRITE_RECV = 16¶
- CQ_WITH_EXT_MEM_DMABUF = 32¶
- class efa.MTU(*values)¶
Bases:
IntEnumPath MTU (
IBV_MTU_*).- MTU_256 = 1¶
- MTU_512 = 2¶
- MTU_1024 = 3¶
- MTU_2048 = 4¶
- MTU_4096 = 5¶
- class efa.PortState(*values)¶
Bases:
IntEnumPort state (
IBV_PORT_*).- NOP = 0¶
- DOWN = 1¶
- INIT = 2¶
- ARMED = 3¶
- ACTIVE = 4¶
- ACTIVE_DEFER = 5¶
- class efa.QPAttrMask(*values)¶
Bases:
IntFlagBitmask selecting which fields
modify_qpapplies (IBV_QP_*).- STATE = 1¶
- CUR_STATE = 2¶
- PKEY_INDEX = 16¶
- PORT = 32¶
- QKEY = 64¶
- RNR_RETRY = 2048¶
- RQ_PSN = 4096¶
- SQ_PSN = 65536¶
- class efa.QPExSendOpsFlags(*values)¶
Bases:
IntFlagExtended-QP send operations (
IBV_QP_EX_WITH_*).Passed as
QPInitAttr.send_ops_flags; the created QP can only post the opcodes enabled here.- RDMA_WRITE = 1¶
- RDMA_WRITE_WITH_IMM = 2¶
- SEND = 4¶
- SEND_WITH_IMM = 8¶
- RDMA_READ = 16¶
- class efa.QPState(*values)¶
Bases:
IntEnumQueue-pair state (
IBV_QPS_*).- RESET = 0¶
- INIT = 1¶
- RTR = 2¶
- RTS = 3¶
- SQD = 4¶
- SQE = 5¶
- ERR = 6¶
- UNKNOWN = 7¶
- class efa.QPType(*values)¶
Bases:
IntEnumEFA queue-pair type.
SRD(Scalable Reliable Datagram – reliable, connectionless, out-of-order; EFA’s native transport) orUD(unreliable datagram). SRD maps ontoIBV_QPT_DRIVERand is created through the EFA provider.- UD = 4¶
- SRD = 255¶
- class efa.SendFlags(*values)¶
Bases:
IntFlagSend work-request flags (
IBV_SEND_*).- FENCE = 1¶
- SIGNALED = 2¶
- SOLICITED = 4¶
- INLINE = 8¶
- class efa.WCFlags(*values)¶
Bases:
IntFlagWork-completion flags (
IBV_WC_*bit flags).- GRH = 1¶
- WITH_IMM = 2¶
- class efa.WCOpcode(*values)¶
Bases:
IntEnumWork-completion opcode (
IBV_WC_*).- SEND = 0¶
- RDMA_WRITE = 1¶
- RDMA_READ = 2¶
- RECV = 128¶
- RECV_RDMA_WITH_IMM = 129¶
- class efa.WCStatus(*values)¶
Bases:
IntEnumWork-completion status (
IBV_WC_*).- SUCCESS = 0¶
- LOC_LEN_ERR = 1¶
- LOC_QP_OP_ERR = 2¶
- LOC_EEC_OP_ERR = 3¶
- LOC_PROT_ERR = 4¶
- WR_FLUSH_ERR = 5¶
- MW_BIND_ERR = 6¶
- BAD_RESP_ERR = 7¶
- LOC_ACCESS_ERR = 8¶
- REM_INV_REQ_ERR = 9¶
- REM_ACCESS_ERR = 10¶
- REM_OP_ERR = 11¶
- RETRY_EXC_ERR = 12¶
- RNR_RETRY_EXC_ERR = 13¶
- LOC_RDD_VIOL_ERR = 14¶
- REM_INV_RD_REQ_ERR = 15¶
- REM_ABORT_ERR = 16¶
- INV_EECN_ERR = 17¶
- INV_EEC_STATE_ERR = 18¶
- FATAL_ERR = 19¶
- RESP_TIMEOUT_ERR = 20¶
- GENERAL_ERR = 21¶
- class efa.WROpcode(*values)¶
Bases:
IntEnumSend work-request opcode (
IBV_WR_*, the subset EFA supports).- RDMA_WRITE = 0¶
- RDMA_WRITE_WITH_IMM = 1¶
- SEND = 2¶
- SEND_WITH_IMM = 3¶
- RDMA_READ = 4¶
- class efa.EndpointInfo(gid, qp_num, qkey)¶
Bases:
objectThe minimum a peer needs to send to an SRD/UD queue pair.
Exchange this out-of-band (e.g. over a TCP socket or a distributed key-value store) during setup.
to_bytes()/from_bytes()give a fixed 24-byte wire layout so both ends agree regardless of platform endianness.
- class efa.Peer(ah, qp_num, qkey)¶
Bases:
objectA resolved remote endpoint: an AH plus QP number and qkey.
Pass as
dest=toSendWR. Owns the AH;close()(or use as a context manager) destroys it.- close()¶
- Return type:
None
- efa.local_endpoint_info(qp, qkey, *, gid=None, gid_index=0, port=1)¶
Build an
EndpointInfodescribingqpfor sending to a peer.qkeymust match what the QP was prepared with. The GID is queried from the QP’s device unless passed explicitly.- Parameters:
- Return type:
- efa.read_wrs(mr, dest, remote_addr, rkey, *, length=None, offset=0, chunk=1073741824, wr_id=0)¶
Like
write_wrs()but for RDMA reads intomr.
- efa.reg_tensor(pd, tensor, access)¶
Register a host (CPU) tensor’s memory as an MR via
reg_mr.Convenience for a contiguous torch CPU tensor or numpy array. For CUDA tensors use
efa.cuda.register_tensor()(dma-buf/GPUDirect) instead.
- efa.tensor_addr_len(tensor)¶
Return
(addr, nbytes)for a tensor-like object (torch or numpy).Works with a torch tensor (
data_ptr()+numel()*element_size()) or a numpy array (ctypes.data+nbytes). No import of either library is required; the object is duck-typed.
- efa.write_wrs(mr, dest, remote_addr, rkey, *, length=None, offset=0, chunk=1073741824, wr_id=0)¶
Build the
SendWRlist for a (possibly huge) RDMA write.EFA caps a single RDMA operation at
max_rdma_size(1 GiB on current hardware), so a tensor-sized transfer may need several work requests. This slicesmr[offset:offset+length]intochunk-sized writes targetingremote_addrat matching offsets. Every WR is SIGNALED (an EFA requirement), so expectlen(wrs)completions; they complete in posting order, and SRD completes a WR only once it is fully delivered.mrmay be anMRor a GpuMR-like object exposingaddr/length/lkey. Returns a list of SendWRs to pass topost_send();wr_idnumbers them sequentially.
Helpers¶
Thin, optional helpers for the common EFA/SRD workflow.
These build on the raw verbs in efa._efa. The raw QP.modify /
QP.to_init / QP.to_rtr / QP.to_rts remain available for callers
that want full control.
SRD is connectionless: unlike RC there is no per-QP connection handshake.
Bootstrap is a one-shot exchange of EndpointInfo (GID + QP number +
qkey) out-of-band, e.g. over a TCP socket or a torch distributed store,
after which EndpointInfo.peer() gives a Peer that any number
of sends can target.
- class efa.helpers.EndpointInfo(gid, qp_num, qkey)¶
Bases:
objectThe minimum a peer needs to send to an SRD/UD queue pair.
Exchange this out-of-band (e.g. over a TCP socket or a distributed key-value store) during setup.
to_bytes()/from_bytes()give a fixed 24-byte wire layout so both ends agree regardless of platform endianness.
- class efa.helpers.Peer(ah, qp_num, qkey)¶
Bases:
objectA resolved remote endpoint: an AH plus QP number and qkey.
Pass as
dest=toSendWR. Owns the AH;close()(or use as a context manager) destroys it.- close()¶
- Return type:
None
- efa.helpers.local_endpoint_info(qp, qkey, *, gid=None, gid_index=0, port=1)¶
Build an
EndpointInfodescribingqpfor sending to a peer.qkeymust match what the QP was prepared with. The GID is queried from the QP’s device unless passed explicitly.- Parameters:
- Return type:
- efa.helpers.tensor_addr_len(tensor)¶
Return
(addr, nbytes)for a tensor-like object (torch or numpy).Works with a torch tensor (
data_ptr()+numel()*element_size()) or a numpy array (ctypes.data+nbytes). No import of either library is required; the object is duck-typed.
- efa.helpers.reg_tensor(pd, tensor, access)¶
Register a host (CPU) tensor’s memory as an MR via
reg_mr.Convenience for a contiguous torch CPU tensor or numpy array. For CUDA tensors use
efa.cuda.register_tensor()(dma-buf/GPUDirect) instead.
- efa.helpers.write_wrs(mr, dest, remote_addr, rkey, *, length=None, offset=0, chunk=1073741824, wr_id=0)¶
Build the
SendWRlist for a (possibly huge) RDMA write.EFA caps a single RDMA operation at
max_rdma_size(1 GiB on current hardware), so a tensor-sized transfer may need several work requests. This slicesmr[offset:offset+length]intochunk-sized writes targetingremote_addrat matching offsets. Every WR is SIGNALED (an EFA requirement), so expectlen(wrs)completions; they complete in posting order, and SRD completes a WR only once it is fully delivered.mrmay be anMRor a GpuMR-like object exposingaddr/length/lkey. Returns a list of SendWRs to pass topost_send();wr_idnumbers them sequentially.
- efa.helpers.read_wrs(mr, dest, remote_addr, rkey, *, length=None, offset=0, chunk=1073741824, wr_id=0)¶
Like
write_wrs()but for RDMA reads intomr.
CUDA¶
Optional CUDA GPUDirect helpers for registering GPU tensors as memory regions.
This module lazily dlopen``s ``libcuda and imports no torch and links
no CUDA at build time, so it adds no required dependency. It is duck-typed:
anything exposing data_ptr() (e.g. a torch CUDA tensor) works.
For torch, allocate with the VMM allocator so the memory can be exported as a
dma-buf fd (the fd libibverbs needs for ibv_reg_dmabuf_mr):
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Typical use:
import efa, efa.cuda, torch
t = torch.zeros(1 << 20, dtype=torch.uint8, device="cuda")
gmr = efa.cuda.register_tensor(pd, t, efa.AccessFlags.LOCAL_WRITE)
qp.post_send(efa.SendWR(sg_list=[gmr.sge()], dest=peer, ...))
Before the NIC reads a tensor, synchronize the CUDA stream that produced it.
After an inbound completion, call flush_gpudirect_writes() before CUDA
work consumes the destination.
- class efa.cuda.GpuMR(mr, addr, length, tensor=None)¶
Bases:
objectA registered GPU memory region plus the info needed to address it.
ibv_mr.addris not meaningful for dma-buf MRs, so this wraps the real device virtual address. Usesge()for the local scatter/gather list andaddr/rkeyfor the remote side of an RDMA op.- property tensor¶
The tensor retained as this registration’s allocation owner.
- sge(length=None, offset=0)¶
- close()¶
- efa.cuda.dmabuf_fd(ptr, length)¶
Export a dma-buf fd for the device VA range
[ptr, ptr+length).ptrandlengthmust be page-aligned (register_tensor()handles alignment). The caller owns and mustos.closethe returned fd.
- efa.cuda.flush_gpudirect_writes(*, all_devices=False)¶
Make completed inbound GPUDirect RDMA writes visible to CUDA.
Call this after the relevant receive/completion or application-level remote-write notification, before launching CUDA work that consumes the destination tensor. The current thread must have the destination tensor’s CUDA context active.
- Parameters:
all_devices (bool)
- Return type:
None
- efa.cuda.tensor_ptr_len(tensor)¶
Return
(device_addr, nbytes)for a tensor-like object.
- efa.cuda.register_tensor(pd, tensor, access)¶
Register a CUDA
tensorfor RDMA and return aGpuMR.Prefers the dma-buf path (no kernel module needed) and transparently handles page alignment. Falls back to the raw
reg_mr(nvidia_peermem) path when dma-buf export or registration is unavailable. The returned object retainstensorso its allocation cannot be recycled while the MR is registered.- Return type:
Enums¶
Pythonic enums mirroring the libibverbs / libefa ABI constants.
These values are part of the stable rdma-core ABI. They are declared here as
enum.IntEnum / enum.IntFlag so they interoperate with plain
ints everywhere the low-level API accepts a flag or code.
- class efa.enums.AccessFlags(*values)¶
Bases:
IntFlagMemory-region access permissions (
IBV_ACCESS_*).- LOCAL_WRITE = 1¶
- REMOTE_WRITE = 2¶
- REMOTE_READ = 4¶
- RELAXED_ORDERING = 1048576¶
- class efa.enums.QPType(*values)¶
Bases:
IntEnumEFA queue-pair type.
SRD(Scalable Reliable Datagram – reliable, connectionless, out-of-order; EFA’s native transport) orUD(unreliable datagram). SRD maps ontoIBV_QPT_DRIVERand is created through the EFA provider.- UD = 4¶
- SRD = 255¶
- class efa.enums.QPState(*values)¶
Bases:
IntEnumQueue-pair state (
IBV_QPS_*).- RESET = 0¶
- INIT = 1¶
- RTR = 2¶
- RTS = 3¶
- SQD = 4¶
- SQE = 5¶
- ERR = 6¶
- UNKNOWN = 7¶
- class efa.enums.QPAttrMask(*values)¶
Bases:
IntFlagBitmask selecting which fields
modify_qpapplies (IBV_QP_*).- STATE = 1¶
- CUR_STATE = 2¶
- PKEY_INDEX = 16¶
- PORT = 32¶
- QKEY = 64¶
- RNR_RETRY = 2048¶
- RQ_PSN = 4096¶
- SQ_PSN = 65536¶
- class efa.enums.QPExSendOpsFlags(*values)¶
Bases:
IntFlagExtended-QP send operations (
IBV_QP_EX_WITH_*).Passed as
QPInitAttr.send_ops_flags; the created QP can only post the opcodes enabled here.- RDMA_WRITE = 1¶
- RDMA_WRITE_WITH_IMM = 2¶
- SEND = 4¶
- SEND_WITH_IMM = 8¶
- RDMA_READ = 16¶
- class efa.enums.WROpcode(*values)¶
Bases:
IntEnumSend work-request opcode (
IBV_WR_*, the subset EFA supports).- RDMA_WRITE = 0¶
- RDMA_WRITE_WITH_IMM = 1¶
- SEND = 2¶
- SEND_WITH_IMM = 3¶
- RDMA_READ = 4¶
- class efa.enums.SendFlags(*values)¶
Bases:
IntFlagSend work-request flags (
IBV_SEND_*).- FENCE = 1¶
- SIGNALED = 2¶
- SOLICITED = 4¶
- INLINE = 8¶
- class efa.enums.WCStatus(*values)¶
Bases:
IntEnumWork-completion status (
IBV_WC_*).- SUCCESS = 0¶
- LOC_LEN_ERR = 1¶
- LOC_QP_OP_ERR = 2¶
- LOC_EEC_OP_ERR = 3¶
- LOC_PROT_ERR = 4¶
- WR_FLUSH_ERR = 5¶
- MW_BIND_ERR = 6¶
- BAD_RESP_ERR = 7¶
- LOC_ACCESS_ERR = 8¶
- REM_INV_REQ_ERR = 9¶
- REM_ACCESS_ERR = 10¶
- REM_OP_ERR = 11¶
- RETRY_EXC_ERR = 12¶
- RNR_RETRY_EXC_ERR = 13¶
- LOC_RDD_VIOL_ERR = 14¶
- REM_INV_RD_REQ_ERR = 15¶
- REM_ABORT_ERR = 16¶
- INV_EECN_ERR = 17¶
- INV_EEC_STATE_ERR = 18¶
- FATAL_ERR = 19¶
- RESP_TIMEOUT_ERR = 20¶
- GENERAL_ERR = 21¶
- class efa.enums.WCOpcode(*values)¶
Bases:
IntEnumWork-completion opcode (
IBV_WC_*).- SEND = 0¶
- RDMA_WRITE = 1¶
- RDMA_READ = 2¶
- RECV = 128¶
- RECV_RDMA_WITH_IMM = 129¶
- class efa.enums.WCFlags(*values)¶
Bases:
IntFlagWork-completion flags (
IBV_WC_*bit flags).- GRH = 1¶
- WITH_IMM = 2¶
- class efa.enums.CreateCQWCFlags(*values)¶
Bases:
IntFlagExtended-CQ per-completion fields (
IBV_WC_EX_WITH_*).STANDARDmatches what classicibv_poll_cqreports and is the default forcreate_cq_ex().- BYTE_LEN = 1¶
- IMM = 2¶
- QP_NUM = 4¶
- SRC_QP = 8¶
- SLID = 16¶
- SL = 32¶
- DLID_PATH_BITS = 64¶
- STANDARD = 127¶
- class efa.enums.EfaDeviceCaps(*values)¶
Bases:
IntFlagEFA device capability bits (
EFADV_DEVICE_ATTR_CAPS_*).Test against
device_caps.- RDMA_READ = 1¶
- RNR_RETRY = 2¶
- CQ_WITH_SGID = 4¶
- RDMA_WRITE = 8¶
- UNSOLICITED_WRITE_RECV = 16¶
- CQ_WITH_EXT_MEM_DMABUF = 32¶