Multiprocessing/multithreading for custom CPU-heavy environments #1393
-
We're interested in using IsaacSim/Lab with environments that have lots of scalar CPU python code. For example, imagine a navigation task in a complex house scene where the reward calculation uses the ground-truth shortest path, which we compute using a CPU-based navmesh library. As another example, we might want to randomize the placement of clutter objects in a scene at episode start by doing a number of collision queries to find valid placements. IsaacLab's current approach to parallel environments is basically SIMD and likely to run on GPU: in a single CPU process, you enable multiple instances of an environment by doing all environment logic as tensors. In our case, our scalar CPU code can't be converted to tensors (see above examples). For best runtime perf, I'd like to have a python process per environment or otherwise utilize lots of CPU cores. This is the paradigm of traditional Gym environments, which were CPU-based and used multiprocessing to achieve parallel environment instances. There are variations here, e.g. a python thread per environment with a free-threading (nogil) python interpreter. One way forward is to instantiate an IsaacSim/Lab instance (SimulationApp) in each environment process, but this has drawbacks:
Any advice here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thanks for posting this. We're reviewing this with our engineering team and will post our best suggestion soon. |
Beta Was this translation helpful? Give feedback.
-
Hi there, thanks for the questions. Running multiple instances of SimulationApp in different processes is fine. We did observe some issues in the current isaac sim 4.2 release that may have some errors when launching multiple processes, but this will be fixed in the next Isaac sim release coming up in January. In general, there shouldn’t be any issues using this approach, we use a similar approach for multi GPU and multi node scaling. |
Beta Was this translation helpful? Give feedback.
Hi there, thanks for the questions. Running multiple instances of SimulationApp in different processes is fine. We did observe some issues in the current isaac sim 4.2 release that may have some errors when launching multiple processes, but this will be fixed in the next Isaac sim release coming up in January. In general, there shouldn’t be any issues using this approach, we use a similar approach for multi GPU and multi node scaling.