Skip to content

listmode reconstruction speed-up: Distribute sensitivity calculation and caching#1030

Merged
KrisThielemans merged 32 commits intoUCL:masterfrom
NikEfth:speed_up_LM_recon_UCL
May 14, 2022
Merged

listmode reconstruction speed-up: Distribute sensitivity calculation and caching#1030
KrisThielemans merged 32 commits intoUCL:masterfrom
NikEfth:speed_up_LM_recon_UCL

Conversation

@NikEfth
Copy link
Copy Markdown
Collaborator

@NikEfth NikEfth commented Apr 27, 2022

This is the first speed-up step

NikEfth added 2 commits April 27, 2022 01:16
This is the first speed-up step
* parallel LM recon
* todo: corrections
@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented Apr 27, 2022

Now, LM reconstruction is shorter by several hours.
I still need to bring here the code for the corrections.

@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented Apr 29, 2022

Seriously, I don't know what its problem is. Both, in my laptop and PC it works fine.

@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented Apr 29, 2022

From this point, we can store the cache on the disk, with a very minimal footprint and restore it on the next reconstruction.
It is not very flexible, but the purposes of the TBP school should be almost alright.

@KrisThielemans KrisThielemans linked an issue Apr 29, 2022 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

quick review, not complete

Comment thread src/include/stir/IO/InputStreamWithRecords.inl
@KrisThielemans
Copy link
Copy Markdown
Collaborator

oops. probably some of these review-comments are outdated (as i hadn't pressed the button 1-2 days ago)

@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented Apr 29, 2022

No worries. But I would like to stress once more how much care you should have when you merge the TOF branch. If I fall into such trouble with a few mistaken lines .. chaos will follow. (let the record show that I write this on a Friday evening).

NikEfth and others added 2 commits April 30, 2022 00:28
@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented Apr 30, 2022

OK, I finished with your first round of comments.

Copy link
Copy Markdown
Collaborator

@robbietuk robbietuk left a comment

Choose a reason for hiding this comment

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

Hopefully some of these comments can improve the code. I havent check the methodology thoroughly

Comment thread src/include/stir/recon_buildblock/distributable.h Outdated
Comment thread src/recon_buildblock/distributable.cxx
NikEfth and others added 3 commits May 1, 2022 21:06
*. Fixed openmp LM guard in InputStream
*. New function for caching in objective function
*. Clean ups
@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented May 2, 2022

Hi Robbie, thank you for your comments and suggestions. I don't know if you want me to resolve the threads (as Kris) so I leave it you, if you are happy with the response.

Copy link
Copy Markdown
Collaborator

@robbietuk robbietuk left a comment

Choose a reason for hiding this comment

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

I have no major suggestions but I have not run it yet.

Copy link
Copy Markdown
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

some house-keeping, but this almost done I believe.

2 questions:

  • should we rename long_axial_fov variable to reduce_memory_usage or something? It's not so obvious what it means
  • cache_size seems to overlap with other ways to stop. we have the num_events_to_use. Do we really need another variable?

Comment thread src/recon_buildblock/distributable.cxx Outdated
Comment thread src/recon_buildblock/distributable.cxx Outdated
NikEfth and others added 4 commits May 12, 2022 08:17
…nAndListModeDataWithProjMatrixByBin.cxx

Co-authored-by: Kris Thielemans <[email protected]>
…nAndListModeDataWithProjMatrixByBin.cxx

Co-authored-by: Kris Thielemans <[email protected]>
@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented May 12, 2022

cache_size seems to overlap with other ways to stop. we have the num_events_to_use. Do we really need another variable?

I made this distinction, because at some point in the future multiple cache files will be supported.

NikEfth and others added 2 commits May 12, 2022 08:23
…nAndListModeDataWithProjMatrixByBin.cxx

Co-authored-by: Kris Thielemans <[email protected]>
* Housekeeping comments.  
* Helper structure ```BinWithCorr```. With this we can read the Additive projdata in parallel, as each bin is "bundled" with its respective correction. 
* Parallel reading of the additive factors. Too slow otherwise. 
* Can load multiple additive segments at each loop. Similar to LmToProjdata's segments in memory. - But I hardcode it to 1 for now.
* Can skip balanced subsets, if you know that they are balanced. 
* Sensible information printing on sensitivity calculation.
@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented May 12, 2022

At this point, I finished with all nonTOF features. Unless, github finds something wrong.
I have 2 minor leftover todos, but only the path adjustment needs to be addressed for the Summer school.

@KrisThielemans I would like your input especially for the BinWithCorr struct in Bin.h. It allows as to read the additive factors in parallel which geatly speeds up everything. Especially, when we'll need TOF support it is essential.

@KrisThielemans
Copy link
Copy Markdown
Collaborator

Looking good. I like the BinWithCorr idea.

@NikEfth
Copy link
Copy Markdown
Collaborator Author

NikEfth commented May 13, 2022

So, we are done here (until I find any bugs :P)

Copy link
Copy Markdown
Collaborator Author

@NikEfth NikEfth left a comment

Choose a reason for hiding this comment

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

I think we are good

@KrisThielemans KrisThielemans added this to the v5.1 milestone May 14, 2022
@KrisThielemans KrisThielemans changed the title Distribute sensitivity calculation listmode reconstruction speed-up: Distribute sensitivity calculation and caching May 14, 2022
@KrisThielemans KrisThielemans merged commit 8a83e48 into UCL:master May 14, 2022
KrisThielemans added a commit that referenced this pull request May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

multi-thread list mode sensitivity calculation

3 participants