RTKConsortium / RTK

Reconstruction Toolkit
Apache License 2.0
245 stars 145 forks source link

Cuda array interface #617

Open LucasGandel opened 2 months ago

LucasGandel commented 2 months ago

Implement changes required on the RTK side following the implementation of cuda_array_interface in CudaCommon

Requires ITKCudaCommon#42

LucasGandel commented 2 months ago

I would like to be able to compile both the CudaCommon latest release and master's head versions, following RTK's policy for ITK versions. In this case, it might be doable by testing whether GetGPUBufferPointerPtr is defined as is done in eb90fb4 for an ITK macro. Note the regular expression in the log. Do you want to give it a try or should I try to implement this?

Should we add a target_compile_definition in ITKCudaCommon to peform such a check (e.g. "CudaDataManagerHasGetGPUBufferPointerPtr")? Or do you prefer to use the CudaCommon_VERSION as suggested in https://github.com/RTKConsortium/ITKCudaCommon/pull/42 ? Or something else ?

SimonRit commented 2 months ago

Should we add a target_compile_definition in ITKCudaCommon to peform such a check (e.g. "CudaDataManagerHasGetGPUBufferPointerPtr")? Or do you prefer to use the CudaCommon_VERSION as suggested in RTKConsortium/ITKCudaCommon#42 ? Or something else ?

No preference, the second one sounds simpler to me. But it is not defined for the latest release so it will just be

#ifdef CUDA_COMMON_MAJOR_VERSION
#else
#endif

I guess

LucasGandel commented 2 months ago

@SimonRit To preserve backward compatibility with CudaCommon, it was also required to add checks in itkCudaImageRTK.wrap, as it uses CudaCommon_SOURCE_DIR which is undefined before CudaCommon 2.0. CudaCommon_SOURCE_DIR is now also used to check if cudaCommonConfiguration.h exists, which will define CUDACOMMON_VERSION_MAJOR.

The linter is unhappy with the new #ifdef, let me know if you have any other feedback before I fix the style.Thanks