Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuqin1998 committed May 11, 2023
1 parent 25521de commit 39926ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paddle/fluid/memory/allocation/mmap_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ std::shared_ptr<MemoryMapAllocation> AllocateMemoryMapAllocationAndUnlink(
std::string handle = memory::allocation::GetIPCName();
AllocateMemoryMap(handle, flags, size, &ptr, &fd);
} else {
AllocateMemoryMap("", flags, size, &ptr, &fd);
ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
PADDLE_ENFORCE_NE(ptr,
MAP_FAILED,
platform::errors::Unavailable(
"Memory map failed when create shared memory."));
}
// 构造1个shmem的wapper
return std::make_shared<MemoryMapAllocation>(ptr, size, "", flags, fd);
Expand Down

0 comments on commit 39926ba

Please sign in to comment.