Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU memory leak when runing multiplication #575

Open
zb12138 opened this issue Jan 10, 2024 · 0 comments
Open

GPU memory leak when runing multiplication #575

zb12138 opened this issue Jan 10, 2024 · 0 comments

Comments

@zb12138
Copy link

zb12138 commented Jan 10, 2024

GPU memory leak when runing sp1*sp2

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')
@zb12138 zb12138 changed the title GPU memory leak when runing **sp1*sp2** GPU memory leak when runing multiplication Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant