STIR icon indicating copy to clipboard operation
STIR copied to clipboard

parallelproj backproj optimisation

Open KrisThielemans opened this issue 3 years ago • 1 comments

At present, even if we do only a subset, or a single RelatedViewgram, the CPU code will be backprojecting all of the data anyway as we pass all of it, see e.g. here

The parallelproj backprojector will not backproject zeroes, but it will have first copied all of the data to the GPU, which is costly.

Easiest work-around for now seems to make a copy in CPU memory of the relevant arrays with only the non-zero data, e.g.

- count number of non-zero entries
- allocate new arrays
- copy data
- call parallelproj_backproj

Alternatively we could keep a mask (updated in actual_back_project) of viewgrams or bins, and do the copy based on the mask (would skip counting, but needs more memory and more code).

KrisThielemans avatar May 12 '21 10:05 KrisThielemans

Related https://github.com/gschramm/parallelproj/issues/14

AnderBiguri avatar May 12 '21 10:05 AnderBiguri