MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / occupy_mem

Function occupy_mem

yolox/utils/metric.py:31–40  ·  view source on GitHub ↗

pre-allocate gpu memory for training to avoid memory Fragmentation.

(cuda_device, mem_ratio=0.95)

Source from the content-addressed store, hash-verified

29
30
31def occupy_mem(cuda_device, mem_ratio=0.95):
32 """
33 pre-allocate gpu memory for training to avoid memory Fragmentation.
34 """
35 total, used = get_total_and_free_memory_in_Mb(cuda_device)
36 max_mem = int(total * mem_ratio)
37 block_mem = max_mem - used
38 x = torch.cuda.FloatTensor(256, 1024, block_mem)
39 del x
40 time.sleep(5)
41
42
43def gpu_mem_usage():

Callers 1

before_trainMethod · 0.90

Calls 1

Tested by

no test coverage detected