# Different results based on environment spacing

**URL:** <https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901>\
**Category:** Isaac Gym\
**Created:** [August 4, 2022, 8:04am UTC](https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901 "2022-08-04T08:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aart.stuurman](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aart.stuurman/32/136243_2.png) [@aart.stuurman](https://forums.developer.nvidia.com/u/aart.stuurman)\
**Post date:** [August 4, 2022, 8:04am UTC](https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901/1 "2022-08-04T08:04:00Z")

</div>

Performing the exact same simulation in two environments yields different results. If environment spacing is set to zero the differences disappear(lower bounds and upper bounds from `create_env` set to 0). With large environment spacing robots clearly drift even on a flat plane with no actuation. The drifting increases with changing position on the environment in the environment grid.

How can I resolve this problem? My workaround is setting environment size to 0, but this makes the simulation incredibly slow. See [Issue with Environment spacing and PxgDynamicsMemoryConfig::foundLostAggregatePairsCapacity](https://forums.developer.nvidia.com/t/issue-with-environment-spacing-and-pxgdynamicsmemoryconfig-foundlostaggregatepairscapacity/198272)

---

<div class="post-metadata">

**Author:** ![gstate](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/gstate/32/48225_2.png) [@gstate](https://forums.developer.nvidia.com/u/gstate)\
**Post date:** [August 14, 2022, 3:46am UTC](https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901/2 "2022-08-14T03:46:21Z")

</div>

Hi @aart.stuurman,

PhysX in Isaac Gym uses FP32 data for internal calculations. This means that there is no way to escape the fact that each individual environment spaced away from each other won’t end up having some small differences from one another due to floating point precision errors.

For RL, small deviations like this should typically not be a problem when training a policy in the loop, since you will generally be doing something else different in each environment in one way or another as your agents learn.

That said, I would not expect drifting behavior with no actuation assuming that there is some friction set up. We don’t see anything similar in our examples.

Take care,  
-Gav

---

<div class="post-metadata">

**Author:** ![aart.stuurman](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aart.stuurman/32/136243_2.png) [@aart.stuurman](https://forums.developer.nvidia.com/u/aart.stuurman)\
**Post date:** [August 15, 2022, 9:47am UTC](https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901/3 "2022-08-15T09:47:10Z")

</div>

Hi @gstate,

I understand your explanation of why the gym works like this. Sadly that makes gym not fit for our use case as we need fully reproducible evaluations for our research. As you said not spacing out individuals causes them to collide often under the hood, which in the total picture means that it is faster to use separate simple CPU sims (such as Mujoco) for each individual, as they have less startup overhead compared to gym with GPU.

Regarding the drifting I will try to make a minimal example.

Aart

---

<div class="post-metadata">

**Author:** ![gstate](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/gstate/32/48225_2.png) [@gstate](https://forums.developer.nvidia.com/u/gstate)\
**Post date:** [August 16, 2022, 4:44am UTC](https://forums.developer.nvidia.com/t/different-results-based-on-environment-spacing/222901/4 "2022-08-16T04:44:37Z")

</div>

Hi @aart.stuurman,

Note that results are deterministic overall, provided you pay attention to the notes [here](https://github.com/NVIDIA-Omniverse/IsaacGymEnvs/blob/main/docs/reproducibility.md), just not between two environments running in parallel.

Take care,  
-Gav
