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

Julia code 6x slower than respective Python #8

Open
ll-portes opened this issue Dec 6, 2021 · 4 comments
Open

Julia code 6x slower than respective Python #8

ll-portes opened this issue Dec 6, 2021 · 4 comments

Comments

@ll-portes
Copy link

Hi,

I was using the Python version of the fdasrsf pkg. However, I tried to use the Julia version to see if I could speed up (or to get better memory management). I don't know if my example (attached) is correct, but to align the same data it took 6s-7s in Julia and 1s in Python. So, maybe there is something within the Julia code preventing it to be fast.

Remark: f.shape is just (100, 15) in the example.

julia-vs-python

@jdtuck
Copy link
Owner

jdtuck commented Dec 7, 2021

So I have not updated the Julia package in a long time. Additionally, the c interface is to an older Dynamic Programming which is slower than the one currently in use for Python.

@wadehenning
Copy link
Contributor

@jdtuck I see that he is calculating the Karcher mean. Does the Python version use parallel processing by default (I know the Julia version does not)?
@ll-portes , just to double check, are you timing the second run of the Julia implementation so that you are not timing the compile time included in the first run?

@jdtuck
Copy link
Owner

jdtuck commented Dec 7, 2021

It does not perform parallel processing by default as his number of sample points is <100. If his sample points >100 then it would kick of parallel processing. Also depending on the numpy version, there will also be openmp usage of the BLAS operations.

@ll-portes
Copy link
Author

Thank you for your reply!

Compilation + execution is 12.5 s. When a run for the second time, it gives me 6.4 s.
In Python, the omethod is 'DP2'. I tried the other methods to see if maybe DP (Python) would have the same 6s as found with the Julia version, and the results are:

  • DP, 0.41s (Python)
  • DP2, 0.22 (Python)
  • RBFGS, 0.33 (Python)

I've uploaded some notebooks (Julia and Python) here ll-portes/ElasticRegistration_studies with the data and timing tests (studing-fdasrvf-Python-2021-11-28.ipynb for Python and studing-fdasrvf-JULIA-2021-11-28.ipynb for Julia).

Remark - I'm glad to know that the Python version has the newer Dynamic Programming because I'm very comfortable in coding with Python (but not in Julia)! There is another issue linked with memory resulting in Python kernel crashing that I'll post at the fdasrvf Python channel.

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