MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateCPUBuffer

Method CreateCPUBuffer

tensorflow/contrib/verbs/rdma.cc:780–800  ·  view source on GitHub ↗

Allocate CPU memory for the Rdma buffer Args: size: to-be-allocated memory size lock: whether or not mutex_lock the process to protect concurrency. Returns: None

Source from the content-addressed store, hash-verified

778// Returns:
779// None
780void RdmaMessageBuffer::CreateCPUBuffer(size_t size, bool lock) {
781 CHECK(size > 0);
782 if (lock) {
783 mu_.lock();
784 }
785 if (local_status_ != none) {
786 // delete existing buffer
787 CHECK(!ibv_dereg_mr(self_)) << "ibv_dereg_mr failed";
788 FreeBuffer();
789 }
790 size_ = size;
791 buffer_ = malloc(size_);
792 self_ = ibv_reg_mr(channel_->adapter_->pd_, buffer_, size_,
793 IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
794 CHECK(self_) << "Failed to register memory region";
795 buffer_on_host_ = true;
796 local_status_ = idle;
797 if (lock) {
798 mu_.unlock();
799 }
800}
801
802// Set address of remote memory region
803// Args:

Callers 1

RdmaChannelMethod · 0.80

Calls 2

lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected