rtkiterativefdk CUDA error

D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\src\itkCudaDataManager.cxx:177 @ unknown : Cuda Error : an illegal memory access was encountered

ExceptionObject caught with itk::WriteImage(IFDKOutputPointer, args_info.output_arg) in file D:\ITKRTK\RTK-2.4.1\applications\rtkiterativefdk\rtkiterativefdk.cxx line 118

itk::ExceptionObject (0000006750B6EFC0)
Location: "unknown"
File: D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\src\itkCudaDataManager.cxx
Line: 196
Description: ITK ERROR: CudaImageDataManager(000001C3619BF4D0): Exception occurred during CudaDataManager::UpdateCPUBuffer
D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\src\itkCudaDataManager.cxx:177:
Cuda Error : an illegal memory access was encountered

I tried to run this example using Varian’s reconstruction data, but there was a cuda error. How can I solve it

–hardware “cuda” --geometry D:\ITKRTK\VarlianData\varian\geometry.xml --regexp .*.hnd --path D:\ITKRTK\VarlianData\varian\Scan0 --output slice30.mha --verbose --spacing 0.25,0.25,0.25 --dimension 1024,10,1024 --origin -127.875,30,-127.875 -n “20” --output-every “5”
this is my command line

Is my GPU memory too small?

D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\include\itkCudaDataManager.h:71 @ unknown : Cuda Error : an illegal memory access was encountered

ExceptionObject caught with itk::WriteImage(streamingCUDA->GetOutput(), args_info.output_arg) in file D:\ITKRTK\RTK-2.4.1\applications\rtkiterativefdk\rtkiterativefdk.cxx line 129

itk::ExceptionObject (000000CE65BDEB10)
Location: “unknown”
File: D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\src\itkCudaDataManager.cxx
Line: 115
Description: ITK ERROR: CudaImageDataManager(00000207AC040660): Exception occurred during CudaDataManager::Free
D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\include\itkCudaDataManager.h:71:
Cuda Error : an illegal memory access was encountered

000001A78ED137C0::UpdateGPUBuffer CPU->GPU data copy 000001A781E8C880->00000007879E8C00 : 8200
000001A78ED0A900::Allocate Create GPU buffer of size 424704 Bytes : 0000000787A00000
000001A89AA782E0::Freed GPU buffer of size 917504 Bytes : 0000000787870000
Iteration 1 completed.000001A78EBD9F20::Allocate Create GPU buffer of size 2157969408 Bytes : 000000078EA00000
000001A89AA77D30::Allocate Create GPU buffer of size 5242880 Bytes : 0000000787200000
000001A78EBD9190::Freed GPU buffer of size 524288 Bytes : 0000000787968C00
D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\include\itkCudaDataManager.h:71 @ unknown : Cuda Error : an illegal memory access was encountered

ExceptionObject caught with itk::WriteImage(streamingCUDA->GetOutput(), args_info.output_arg) in file D:\ITKRTK\RTK-2.4.1\applications\rtkiterativefdk\rtkiterativefdk.cxx line 130

itk::ExceptionObject (000000690E6FE830)
Location: "unknown"
File: D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\src\itkCudaDataManager.cxx
Line: 115
Description: ITK ERROR: CudaImageDataManager(000001A78EA60E50): Exception occurred during CudaDataManager::Free
D:\ITKRTK\RTK-2.4.1\utilities\ITKCudaCommon\include\itkCudaDataManager.h:71:
Cuda Error : an illegal memory access was encountered

An error is reported after the first iteration

@simon.rit might answer some of your questions.

I tried your command line on my linux computer. Initially, I had Cuda Error : out of memory. After using every 10 projections (with --regexp .*0.hnd) it worked. Can you try with less projections? Have you tried rtkfdk first?

after i use “–regexp .*0.hnd” it is become ok. Is my GPU memory too small? my gpu memory is 6GB , projection image is 1GB.

It’s probably too small. According to the log you’ve sent, there is a 2157969408 (2.1 GB) buffer which probably contains your float projections. The forward projection will have the same size. With the rest, it’s probably too much memory. There is no streaming mechanism for this iterative algorithm which is rarely used, sorry… It would be great if you find where there is a GPU allocation which is not handled properly, you should normally get a more meaningful message.

Sorry, I’m not familiar with CUDA, the log above is what I found.He did work after I reduced the projected image.

Another solution to reduce the projection size is to bin the projections with the option --binning 2,2.

1 Like