Open zb12138 opened 8 months ago
GPU memory leak when runing *sp1sp2**
import MinkowskiEngine as ME import numpy as np import os import psutil import pynvml pynvml.nvmlInit() gpu_id=0 handler = pynvml.nvmlDeviceGetHandleByIndex(gpu_id) device = 'cuda:0' coords = np.random.randint(0, 100, size=(10000, 3)) colors = np.random.randint(0, 255, size=(10000, 1)) feats = np.ones((colors.shape[0],1)) coords_batch, feats_batch = ME.utils.sparse_collate([coords], [feats]) spw = ME.SparseTensor(features=feats_batch.float(), coordinates=coords_batch,device=device,requires_grad=False) feats = colors coords_batch, feats_batch = ME.utils.sparse_collate([coords], [feats]) spc = ME.SparseTensor(features=feats_batch.float(), coordinates=coords_batch, coordinate_manager=spw.coordinate_manager,device=device) for i in range(100000000): s = spc*spw if i%1000==0: meminfo = pynvml.nvmlDeviceGetMemoryInfo(handler) used = round(meminfo.used / 1024 / 1024, 2) print(i,'GPU Mem used', used, 'MB')
GPU memory leak when runing *sp1sp2**