GithubHelp home page GithubHelp logo

Slow performance of mdgrappa about pygrappa HOT 7 CLOSED

mckib2 avatar mckib2 commented on August 20, 2024
Slow performance of mdgrappa

from pygrappa.

Comments (7)

mckib2 avatar mckib2 commented on August 20, 2024 1

FYI: wheels for Windows/Mac/Linux are available from PyPI which may make installation/upgrade a little easier

from pygrappa.

mckib2 avatar mckib2 commented on August 20, 2024

@lukasfolle you're welcome - glad you are finding it helpful!

Would it be possible to accelerate this function by making use of mkl or openblas?

It may be -- depends on where the bottleneck is for your particular reconstruction. Will link to #80, I just haven't had a lot of time recently to devote here. What is the size the of the dataset you want to reconstruct? If you happen to know the nominal parameters you'd like to use, those would also be helpful in benchmarking and finding bottlenecks

from pygrappa.

lukasfolle avatar lukasfolle commented on August 20, 2024

Sure, I am using mdgrappa for a k-space of size 160x92x8 with a autocalibration signal of size 40x16x8 both with 15 channels and 5x5x5 kernel size.
Since I am doing this for multiple hundred k-spaces, this takes a considerable time for me.
As a CPU I am using a AMD Ryzen 7 3700X 8-Core Processor.
This takes about 12 seconds for me.

from pygrappa.

mckib2 avatar mckib2 commented on August 20, 2024

3D volumes will be more challenging. I assume all the reconstructions must be done in isolation (i.e., no way to do a joint estimate/recon between all of them). The calculations are mostly passed through to numpy's BLAS/LAPACK wrappers which are of course single threaded and will take advantage of only 1 of your 8 cores. There is no doubt performance on the table for the existing mdgrappa implementation, but I wonder if there's a suitable improvement for now if you use multiprocessing or joblib to run recons in parallel?

from pygrappa.

lukasfolle avatar lukasfolle commented on August 20, 2024

Yes, multiprocessing would be an option, thanks!
Can you confirm, that it takes approximately the same time for you? I want to rule out that I have numpy acceleration through some backend set up incorrectly.

from pygrappa.

mckib2 avatar mckib2 commented on August 20, 2024

Yes, multiprocessing would be an option, thanks! Can you confirm, that it takes approximately the same time for you? I want to rule out that I have numpy acceleration through some backend set up incorrectly.

That time doesn't raise any alarm bells for me -- it is a 3D volume relying on a mostly Python implementation with heavy use of generalized array slicing. It makes application of GRAPPA to n-dimensional data sets trivial, but this may be more costly than I originally thought.

I modified the basic_mdgrappa example to use a synthetic 160x92x8x15 example with the autocalibration region and kernel size you specified with Rx=Ry=2 undersampling. On my machine (Ryzen 7 5800x 8-core) I do even worse:

INFO:find_acs.py:Took 4.02927e-05 sec to find hyper-cube
INFO:find_acs.py:Took 0.000173092 sec to find hyper-rect
INFO:root:Took 0.193907 seconds to find geometries and holes
INFO:root:Took 26.2915 seconds to train weights
INFO:root:Took 1.97092 seconds to apply weights
Took 28.500443935394287 sec

The "train weights" step is predictably the offender here.

from pygrappa.

lukasfolle avatar lukasfolle commented on August 20, 2024

Alright, thanks for the confirmation!

from pygrappa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.