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

Reduce memory usage and speed things up when shimming #383

Merged
merged 7 commits into from May 3, 2022
Merged

Conversation

po09i
Copy link
Member

@po09i po09i commented Apr 19, 2022

Description

When shimming with large coil profiles and/or many target slices, we can end up using a large amount of memory (>10Gb). I have isolated the problem to be when we calculate the shimmed profiles. This causes Shimming toolbox to be really slow since it saturates the RAM.

This PR:

  • Removes variables that consumed lots of memory but were not used afterwards.
  • Adds a decorator to time a function and output it in debug logger mode
  • Improves the stability of the optimizer by scaling the output of the _residual function

@po09i po09i added the enhancement New feature or request label Apr 19, 2022
@po09i
Copy link
Member Author

po09i commented Apr 19, 2022

Current improvements using coil profiles (128x128x75), fieldmap (127x127x55), target (110x110x55). Here is the peak RAM usage.

Before: 14.5GB

After: 4.13GB

Total time to process 156s:

  • Sequencer: 134s
    • processing: 112s
    • Calculating theoretical shim: 22s
  • Plot coefs: 20s
  • Other: 2s

@po09i po09i marked this pull request as ready for review April 22, 2022 22:10
Copy link
Member

@gaspardcereza gaspardcereza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The timeit decorator idea is great !

@po09i po09i merged commit d14a3b6 into master May 3, 2022
@po09i po09i deleted the ad/speed-up branch May 3, 2022 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants