Skip to content

Commit 508ff1f

Browse files
committed
Free CPU pinned memory on environment cleanup
1 parent 343041c commit 508ff1f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vllm/distributed/parallel_state.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,11 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
11941194
gc.collect()
11951195
if not current_platform.is_cpu():
11961196
torch.cuda.empty_cache()
1197+
try:
1198+
torch._C._host_emptyCache()
1199+
except AttributeError:
1200+
logger.warning(
1201+
"torch._C._host_emptyCache() only available in Pytorch >=2.5")
11971202

11981203

11991204
def in_the_same_node_as(pg: ProcessGroup, source_rank: int = 0) -> List[bool]:

0 commit comments

Comments
 (0)