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

Kamodo interpolation much slower than KameleonPlus Python wrapper interpolation #21

Closed
rweigel opened this issue Jun 25, 2020 · 2 comments

Comments

@rweigel
Copy link

rweigel commented Jun 25, 2020

I made a comparison of the time for interpolation using Kamodo and the KameleonPlus Python wrapper. See the two files at

See https://github.com/GaryQ-physics/magnetosphere/tree/master/misc/kameleon_kamodo_compare

The Kameleon version is ~10x faster. Given that they both are interfacing with CCMC.so, this is somewhat unexpected.

On a side note, I also did an experiment to determine how much faster it is to loop over a grid and calling the interpolator at each iteration in a C++ program than looping over the same grid in a Python program (the Kameleon Python wrapper only allows scalars to be passed). It is about 3x faster. This is sort of on the border of where I want to bother doing anything about it. If I do, I'll share the code.

@asherp
Copy link
Contributor

asherp commented Mar 24, 2021

The kamodo wrapper for kameleon was meant as a stop gap until we have fully kamodofied interpolators for each of the kameleon-supported models. Since kameleon was compiled for python27, the kamodo interface was using a bridge to run a separate python27 executable.

Kamodo just wraps whatever interpolator you are using, so it should not be the bottleneck. most of the time, you're using scipy functions. For some models, though, you have an optimized Fortran or C interpolator that's unique to the model's data structure. The job of a kamodo subclass is to hide all the ugly interface stuff for the model or data source from the end user, so all they see is just the functional form of the interpolator.

@rweigel
Copy link
Author

rweigel commented Jul 28, 2022

Could you post a demo that shows how to use the new functions? The script I used previously no longer works b/c I think the API changed.

I'm also interested in a demo that shows how to use the SWMF IE readers.

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

No branches or pull requests

3 participants