Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pycompilation if installed. #109

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

moorepants
Copy link
Member

No description provided.

@moorepants
Copy link
Member Author

The pycompilation caching seems to work. On the problem in https://github.com/brocksam/muscle-driven-bicycle-paper if I run the optimal control script twice in a row, the second run takes no time for the compilation step taking total time to instantiate the problem from 180 seconds to 54 seconds (approximately).

I did notice that if I open IPython and run the script twice in a row that the cached compilation did not seem to load (always took 180 seconds to complete). Not sure why.

@moorepants
Copy link
Member Author

To clarify:

python ocp.py
python ocp.py

shows the speed up on the second run but:

$ ipython
run ocp.py
run ocp.py

didn't.

@moorepants
Copy link
Member Author

Bjorn pointed out to me that a version of pycompilation is in sympy/utilities/_compilation.

I have it working but I don't know if it caches the compiled code.

@moorepants
Copy link
Member Author

In the sympy version the import_module_from_file has a kwarg only_if_newer_than. It may be a way to import an old complied version if some dependent files haven't changed.

@moorepants
Copy link
Member Author

SymPy includes pycompilation (private modules), so we could just use it from SymPy instead of the standalone package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant