MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / optimize_memory_for_training

Function optimize_memory_for_training

verl/verl/utils/memory_utils.py:132–143  ·  view source on GitHub ↗

Optimize GPU memory usage for training

()

Source from the content-addressed store, hash-verified

130
131
132def optimize_memory_for_training() -> None:
133 """Optimize GPU memory usage for training"""
134 if not get_torch_device().is_available():
135 return
136
137 # Set a moderate memory allocation policy
138 get_torch_device().set_per_process_memory_fraction(0.9) # Use 90% of GPU memory
139
140 # Clear cache
141 aggressive_empty_cache(force_sync=False)
142
143 logger.info("Optimized GPU memory usage for training")
144
145
146def enable_memory_visualize(

Callers

nothing calls this directly

Calls 2

get_torch_deviceFunction · 0.90
aggressive_empty_cacheFunction · 0.85

Tested by

no test coverage detected