NVIDIA / NVIDIA/CUDALibrarySamples

memory was not free. nvcomp python api

Open
#206 1 comment 2 reactions 1 assignee View on GitHub

@naveenaero is already working on this.

Since Jun 11, 2025.

nvCOMP
Dominant language
Cuda
Stars
2.5k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

how to free gpu memory allocated by nvcomp? The code will allocate 24GB GPU memory and free until code end.

import numpy as np
from nvidia import nvcomp
import torch
import gc
alogs = ['lz4','ANS', "Cascaded"]
codec = nvcomp.Codec(algorithm=alogs[0])
data_gpu = torch.randn(4096*14336,dtype=torch.float16,device = "cuda:0")
nvarr_d = nvcomp.as_array(data_gpu)
com_arr = codec.encode(nvarr_d)
a = torch.tensor(com_arr.cpu(),dtype=torch.int8).cuda()
for i in range(32*8):
    
    
    b = nvcomp.as_array(a)
    dec_arr = codec.decode(b,data_type="<f2")
    
    del dec_arr
    
    torch.cuda.empty_cache()
    gc.collect()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.