File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,15 @@ RegisteredMemory::Impl::Impl(const std::vector<char>& serialization) {
277
277
278
278
RegisteredMemory::Impl::~Impl () {
279
279
// Close the CUDA IPC handle if it was opened during deserialization
280
- if (data && transports.has (Transport::CudaIpc) && getHostHash () == this ->hostHash && getPidHash () != this ->pidHash ) {
280
+ if (data && transports.has (Transport::CudaIpc) && getHostHash () == this ->hostHash ) {
281
+ if (getPidHash () == this ->pidHash ) {
282
+ // For local registered memory
283
+ if (fileDesc >= 0 ) {
284
+ close (fileDesc);
285
+ fileDesc = -1 ;
286
+ }
287
+ return ;
288
+ }
281
289
void * base = static_cast <char *>(data) - getTransportInfo (Transport::CudaIpc).cudaIpcOffsetFromBase ;
282
290
if (this ->isCuMemMapAlloc ) {
283
291
CUmemGenericAllocationHandle handle;
@@ -288,9 +296,6 @@ RegisteredMemory::Impl::~Impl() {
288
296
MSCCLPP_CULOG_WARN (cuMemUnmap ((CUdeviceptr)base, size));
289
297
MSCCLPP_CULOG_WARN (cuMemRelease (handle));
290
298
MSCCLPP_CULOG_WARN (cuMemAddressFree ((CUdeviceptr)base, size));
291
- if (getNvlsMemHandleType () == CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR && fileDesc >= 0 ) {
292
- close (fileDesc);
293
- }
294
299
} else {
295
300
cudaError_t err = cudaIpcCloseMemHandle (base);
296
301
if (err != cudaSuccess) {
You can’t perform that action at this time.
0 commit comments