From f5df720c2768805dcc78019f55e710c558b96b06 Mon Sep 17 00:00:00 2001 From: fae713 Date: Wed, 6 Aug 2025 17:48:55 +0100 Subject: [PATCH] fix: set multiprocessing start method to 'spawn' to prevent PyTorch shared memory timeout on CPU --- rgym_exp/runner/swarm_launcher.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rgym_exp/runner/swarm_launcher.py b/rgym_exp/runner/swarm_launcher.py index 479a1f70..dc9432c6 100644 --- a/rgym_exp/runner/swarm_launcher.py +++ b/rgym_exp/runner/swarm_launcher.py @@ -1,5 +1,10 @@ import os +# Set multiprocessing start method to 'spawn' safely +import torch.multiprocessing as mp +if mp.get_start_method(allow_none=True) != 'spawn': + mp.set_start_method('spawn', force=True) + import hydra from genrl.communication.communication import Communication from genrl.communication.hivemind.hivemind_backend import (