# 3. Parallel Envs In this tutorial, we will show you how to use MetaSim to run multiple environments in parallel. ## Common Usage ```bash python get_started/3_parallel_envs.py --sim --num_envs ``` you can also render in the headless mode by adding `--headless` flag. By using this, there will be no window popping up and the rendering will also be faster. By running the above command, you will run multiple environments in parallel and it will automatically record a video. ### Examples #### IsaacSim ```bash python get_started/3_parallel_envs.py --sim isaacsim --num_envs 4 ``` #### Isaac Gym ```bash python get_started/3_parallel_envs.py --sim isaacgym --num_envs 4 ``` #### Genesis ```bash python get_started/3_parallel_envs.py --sim genesis --num_envs 4 ``` Note that we find the `headless` mode of Genesis is not stable. So we recommend using the `non-headless` mode. We can open multiple environments at the same time. You will get the following videos:

Isaac Lab

Isaac Gym

Genesis

## Code Highlights **Parallel Environment Setup**: Simply change `num_envs` to enable parallel execution: ```python scenario = ScenarioCfg( robots=["franka"], simulator=args.sim, num_envs=4, # Enable 4 parallel environments headless=args.headless, ) handler = get_handler(scenario) ``` **Simulator Handling**: - **Native parallel simulators** (IsaacSim, IsaacGym, Genesis): Directly use handler with multiple environments - **Single-environment simulators** (MuJoCo): Automatically wrapped with ParallelHandler for multi-threaded scheduling - **Same API**: All simulators provide identical interface regardless of underlying implementation