Duplication of objects passed to OpenMDAO ExplicitComponent in Dymos phase? #1141
Replies: 2 comments 3 replies
-
We're still looking into this. ExplicitShooting should be instantiating two copies of the ODE...one is used in the wrapper for scipy,integrate, and the other is a vectorized one that is used to compute any ODE outputs at all of the nodes once the states have been propagated. We're still trying to track down the source of the memory issues here. Also, I noticed you're using jax. By far the easiest way to do this with OpenMDAO as of December 2024 is to use JaxExplicitComponent and JaxImplicitComponent. There's an example of a brachistochrone implementation that utilizes it here: https://openmdao.github.io/dymos/examples/implicit_duration/brachistochrone_implicit_duration.html#solving-the-brachistochrone-without-an-optimizer There are a few hoops to jump through if you need static component attributes or options in your compute_primal function that are explained here: https://openmdao.org/newdocs/versions/latest/features/experimental/jax_explicitcomp_api.html |
Beta Was this translation helpful? Give feedback.
-
Have you tried using |
Beta Was this translation helpful? Give feedback.
-
This is related to my previous question: #1138, but I think I've been able to isolate the potential issue after running more tests.
This leads me to the questions:
In the actual code below, I don't pass the Environment object itself but the reference to the 'get_vals' method. I thought that this might help if there is copying under the hood, e.g. only the method reference would be copied and not the whole object, but unfortunately the memory is still used up and the process is killed.
A simplified version of the code below shows the example dynamics, environment code and problem setup. Please let me know if anything's unclear.
Thank you for any assistance.
Environment code:
Dymos dynamics model code:
Setting up the Dymos model to optimise:
Beta Was this translation helpful? Give feedback.
All reactions