opensim-org / opensim-moco

Solve optimal control problems for musculoskeletal models using OpenSim and direct collocation.
https://opensim.stanford.edu/moco
Apache License 2.0
54 stars 13 forks source link

Parallelize finite differences #10

Open chrisdembia opened 6 years ago

chrisdembia commented 6 years ago

This could help speed up test_double_pendulum, which takes 80 seconds in debug.

chrisdembia commented 6 years ago

I tried this and committed some preliminary support for this to the master branch (also, some notes are in parallel_finite_diff_comments). However, this didn't bring that big of a speedup (2x in debug, no speedup in release, for test_double_pendulum), so I rolled back the changes for now. Perhaps this will have a bigger effect with bigger systems. Also, there were diminishing returns after about 3 or 4 threads, and it was necessary to set the environment variable OMP_WAIT_POLICY=PASSIVE to get a good speedup on macOS.