MR: Speed up FourierEncoding forward and backward - #1409
Draft
paskino wants to merge 2 commits into
Draft
Conversation
| int z = nz/2 - kz_lim.center + acq.idx().kspace_encode_step_2; | ||
|
|
||
| for (unsigned int c = 0; c < nc; c++) { | ||
| #pragma omp parallel for |
Member
There was a problem hiding this comment.
TBH, I'm not sure if this is thread-safe. I've read some things about aligning etc (to do +=, you need to fetch, compute, store, which if your computer does the fetch/store in a larger chunk than the data element, can get you into trouble). Can't find the reference though.
Alternative is atomic, but obviously slower.
BTW, you can collapse loops, but not in Visual Studio C++ (it support OpenMP 2), so you need some ugly ifdefs which I can point you to.
Also, in most compilers, #pragma omp will lead to compilation warnings when not using OpenMP, so in STIR, we put some more #ifdef around it...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes in this pull request
forwardandbackwardofFourierEncoding.cppto match shape from ISMRMRD.https://github.com/ismrmrd/ismrmrd/blob/65fa1d6a7522535c2302ad854224095c0d213aae/libsrc/ismrmrd.cpp#L1140-L1146
Testing performed
On the VM there is a sensible speed up in
d_undersampled_reconstruction.ipynbfrom SIRF-ExercisesRemains to test on a larger dataset. Probably the fact that the OMP threads are not useful comes from the fact that the test I did is with a very tiny dataset and the cost of thread creation is larger than the compute gain.
Related issues
Checklist before requesting a review
Contribution Notes
Please read and adhere to the contribution guidelines.
Please tick the following: