Sparsification gpu#22
Conversation
|
Interesting, but is it really worth implementing compaction on GPU, as we have to transfer the whole raw (and mostly zeroes) images ? |
|
Well, some of your tests droped from 40s to 1s runtime, without implementing the cumsum nor the copy of the comacted data in OpenCL. Sending 3000 frames to the GPU and launching this trivial kernel takes half a second and the cumsum+copy in numpy (unchanged) the other half. |
|
|
The cumsum approach implies to have the full stack in GPU memory, or that you slab in the stack in another dimension. It is not really compatible with an acquisition frame per frame or, with Eiger detectors, thousand frame per thousand frames. |
|
Yuriy's code does not pass the pylint test ... I find it really anoying working without CI ! |
|
The code is probably "fast enough" for the moment. Implementing the cumsum & copy on the GPU can bring at best a extra factor 2 in speed. |
|
If the OpenCL compressor is compatible (both in terms of results and API/usage) with the "numpy compressor", while being faster, then it's worthy. I haven't looked at the whole code for now, as it's difficult to isolate the OpenCL compressor code from all the files linting - perhaps a dedicated PR for linting would be best. It would also be interesting to see how this implementation performs on CPU. The reference numpy implementation is "naive" and sub-optimal, so I'm not surprised by the 40x speed-up. |
|
I merged the orthe PR which contains contains lint-ing ... it should make this PR much simpler. The code is not directly the same since the numpy class has a staticmethod which is not (cannot) be static in the OpenCL case. |
3 kernels will be needed:
Beside this, there are modification for the associated tests: