Last active
June 27, 2017 19:18
-
-
Save jonasschneider/d8bacaec035b99c7f303aafa4f67a0f3 to your computer and use it in GitHub Desktop.
mujoco-py 0.5.7 vs 1.50.0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mujoco_py | |
import timeit | |
T = 1000 | |
NSIM = 100 | |
def test(): | |
model = mujoco_py.load_model_from_path( | |
"/Users/jonas/code/openai/pymj/xmls/claw.xml") | |
pool = mujoco_py.MjSimPool([mujoco_py.MjSim(model) | |
for _ in range(NSIM)]) | |
for _ in range(T): | |
pool.step() | |
for sim in pool.sims: | |
sim.data.qpos | |
sim.data.qvel | |
sim.data.ctrl | |
sim.data.active_contacts_efc_pos | |
for i in range(5): | |
NSIM = 1 * 10**i | |
print(NSIM, timeit.timeit("test()", setup="from __main__ import test", number=1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mujoco_py | |
import timeit | |
import multiprocessing | |
T = 1000 | |
NSIM = 100 | |
def f(_): | |
model = mujoco_py.MjModel( | |
"/Users/jonas/code/openai/pymj/xmls/claw.xml") | |
for _ in range(T): | |
model.step() | |
model.data.qpos | |
model.data.qvel | |
model.data.ctrl | |
model.data.efc_pos[model.data.nefc] | |
def test_pool(): | |
pool = multiprocessing.Pool(processes=8) | |
pool.map(f, range(NSIM)) | |
def test_simple(): | |
for i in range(NSIM): | |
model = mujoco_py.MjModel( | |
"/Users/jonas/code/openai/pymj/xmls/claw.xml") | |
for _ in range(T): | |
model.step() | |
model.data.qpos | |
model.data.qvel | |
model.data.ctrl | |
model.data.efc_pos[model.data.nefc] | |
for i in range(5): | |
NSIM = 1 * 10**i | |
simple = timeit.timeit( | |
"test_simple()", setup="from __main__ import test_simple", number=1) | |
pool = timeit.timeit( | |
"test_pool()", setup="from __main__ import test_pool", number=1) | |
print(NSIM, simple, pool) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSIM | old single | old pool | new | |
---|---|---|---|---|
1 | 0.11581338301766664 | 0.13547717899200507 | 0.16044410099857487 | |
10 | 1.128183044027537 | 0.3996757059940137 | 0.2795658499817364 | |
100 | 11.032577594014583 | 4.138657283008797 | 1.8754566199786495 | |
1000 | 111.87427679199027 | 41.56060034601251 | 19.824343433981994 | |
10000 | 1152.050909216021 | 443.94346881398815 | 259.57786487799603 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment