Replies: 2 comments
-
Basic conceptAt the Hackathon on Hackathon on Efficient integration of SIRF/STIR/CIL with Pytorch we planned to work at making CIL's data containers agnostic on the actual array they wrap, by using the Python Array API The work in progress can be checked at I focused on making use of
Thanks to @purepani I found out that other people started to patch the Python Array API to add the missing functionality, see https://data-apis.org/array-api-extra/ ## Problems Once the original unittests passed, I added specific tests for Then, I tried to run the same It seems we would need to be able to specify the |
Beta Was this translation helpful? Give feedback.
-
|
This may be a better place to ping @lucascolley due to the discussion |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Before it gets lost, I am copying here a discord discussion.
I worked at extending the CIL
DataContainerto handle different backends than numpy, currently only cupy.I made an experiment comparing CIL's
TotalVariationwith backend C, numpy and cupy with the regularisation toolkitFGP_TVwith the CUDA implementation. The C backend refers to the calculation of theGradientOperatorinsideTotalVariation, for the rest it uses numpy.Experiment
Image size 128x128, number of TV iterations 1000. To reproduce these results I used the following script.
notice that the image is really small
Results
FGP_TVis 59 times faster than standard CILTotalVariationFGP_TVis 13.5 times faster than cupy CILTotalVariationTotalVariationis 4.4 times faster than the standard implementation with numpyGradientOperatordoes not seem to have any impact on the calculation ofTotalVariation(proximal)FGP_TVdoes not have the warm start functionalityChanges to CIL
I made a few changes to CIL to achieve these results.
23e59b6...paskino:CIL:cupy_array_copy
The biggest differences are:
modified
ImageGeometry/AcquisitionGeometry.allocateandDataContainer.fillmethods as numpy and cupy have slightly different ways of copying/creating data.added the concept of
backendand relative member toDataContainer(probably should be inferred by the memberarray, as currently it risks to get out of sync?)modified
__init__ofImageData. This should be done forAcquisitionDatatoo. Notice that thebackendis not passed on to the base class.added
backendparameter toImageGeometry.allocateto be able to allocate either numpy or cupy array. In turn this uses the__init__of the DataContainer. Notice that the same work should be done forAcquisitionGeometry.some other modifications to make sure that
TotalVariationknows it has to run on either backend.Beta Was this translation helpful? Give feedback.
All reactions