Closed pgrinaway closed 9 years ago
Unit handling is slow with simtk.unit as well, but two orders of magnitude is surprising.
This suggests we should perhaps choose a standard consistent set of internal units and construct the pymc model in these units, wrapping the results back in units when done.
ureg.wraps
decorator can handle that automatically. I was planning to use that, see #8, since there is a chance of strange bugs with dimensionless units. If that gives us the speedup, then I will definitly make this higher priority.
It's surprising indeed! I should note that I did another thing here--I removed all accesses to self
(and other non-numpy objects in general) in the hot loops--I don't know if this should really make a difference, but it might.
+1 for the suggestions. This would really help, even just debugging.
Removing accesses to self
did not speed up the code. (It was actually a little slower). Going to wrap the units around the function and see if it speeds things up.
Got it. At least one order of magnitude speedup achieved. Here is the wrapper that handles units.
From 500 steps in 45 seconds to 22000. Closing.
Nice!
Hey,
I was messing around with the code and discovered that stripping the units from the
expected_injection_heats
improves performance by something like two orders of magnitude. In other words, calling the function below (with units stripped in a wrapper):