got OpenCL Error when using itkGPUDemonsRegistrationFilter

hi, I used DemonsRegistrationFilter to do registration, and it workd fine. Then I noticed there has GPUDemonsRegistrationFilter, So I replaced the itkImage to itkGPUImage, everything runs well until it came to the code “filter->Update();”, the command window report erros:

OpenCL Error : CL_MEM_OBJECT_ALLOCATION_FAILURE

Here is the all output:

Total # of platform : 2
Platform 0 : Intel(R) OpenCL HD Graphics
Platform 1 : NVIDIA CUDA
NVIDIA GeForce GTX 1660 SUPER
Maximum Work Item Sizes : { 1024, 1024, 64 }
Maximum Work Group Size : 1024
Alignment in bits of the base address : 4096
Smallest alignment in bytes for any data type : 128
cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid
fixed_image spacing: [0.1073, 0.1073, 0.107296]
moving_image spacing: [0.275, 0.275, 0.747253]
here
D:\lib\itk53_20230522\source\Modules\Core\GPUCommon\src\itkGPUDataManager.cxx:151:
OpenCL Error : CL_MEM_OBJECT_ALLOCATION_FAILURE


E:\projectFiles\CPPcodes\GPURegistration\x64\Release\proj001.exe (process 46136) exited with code 0.
Press any key to close this window . . .

How cant I to fix the error? Thank you very much for your suggestions!

What is your dedicated GPU memory? How big are the images you are trying to register? If they are bigger than GPU memory, you need a better graphics card.

Also, your OpenCL devices are:

Platform 0 : Intel(R) OpenCL HD Graphics
Platform 1 : NVIDIA CUDA

I don’t know whether we can make OpenCL choose nVidia instead of Intel as the preferred one.

Thank you for your reply! My dedicated GPU memory is 6G, and fixed image’ s size is [515, 506, 496]. So, does the problem came out because OpenCL choose nVidia instead of Intel?

It is easy to check whether the memory is the issue: try downscaling your images 4x (to e.g. 130x125x120). If you still have the problem, it is not related to size of the images.

I expect nVidia to perform better as a GPU accelerator.

I have checked the memory is not the issue. Still have the problem, thank you anyway, I think I need to write orginal cuda codes. By the way, does ITK has GPU accelerating souce codes for reference?

Some filters are implemented, e.g. GradientNDAnisotropicDiffusion. You can find more by looking at folders with GPU in the name in filtering group and elsewhere, or by searching for GPU.

I’l try, thank you for your help!