Skip to content

Commit

Permalink
[Core] Free CPU pinned memory on environment cleanup (vllm-project#10477
Browse files Browse the repository at this point in the history
)

Signed-off-by: Bowen Wang <[email protected]>
  • Loading branch information
janimo authored and abmfy committed Jan 24, 2025
1 parent 75b9e77 commit a8f69c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vllm/distributed/parallel_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,11 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
from vllm.platforms import current_platform
if not current_platform.is_cpu():
torch.cuda.empty_cache()
try:
torch._C._host_emptyCache()
except AttributeError:
logger.warning(
"torch._C._host_emptyCache() only available in Pytorch >=2.5")


def in_the_same_node_as(pg: Union[ProcessGroup, StatelessProcessGroup],
Expand Down

0 comments on commit a8f69c2

Please sign in to comment.