Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda memory error when using Cuda forward projector #594

Closed
ObaidullahRahman opened this issue Apr 29, 2024 · 11 comments · Fixed by #598
Closed

Cuda memory error when using Cuda forward projector #594

ObaidullahRahman opened this issue Apr 29, 2024 · 11 comments · Fixed by #598

Comments

@ObaidullahRahman
Copy link

My image size is 1264x1356x1356=2324162304
Projection size: (slice/row, view, column)=(1456,145,1840)
My GPU has 80 GB memory.
When I use CudaForwardProjectionImageFilter I get memory error (please refer to the attachment).

Simon confirmed that in line 115 of rtkCudaUtilities.cu, my image exceeds the predefined max size of the image.
Please increase the predefined max size for images.
(I'd like to be able to forward project 2000x2000x2000 image or as much as possible).
Thanks.

Best,
Obaid

Screenshot 2024-04-24 at 8 34 20 PM
SimonRit pushed a commit to SimonRit/RTK that referenced this issue May 12, 2024
Fixes RTKConsortium#594. Opened files with command line
$(find -type f -exec grep -lE 'cuda(Malloc|Memset|Memcpy)' {} \;)
and searched for occurences with vim regular expression
cuda\(Malloc\|Memset\|Memcpy\)
SimonRit pushed a commit that referenced this issue May 12, 2024
Fixes #594. Opened files with command line
$(find -type f -exec grep -lE 'cuda(Malloc|Memset|Memcpy)' {} \;)
and searched for occurences with vim regular expression
cuda\(Malloc\|Memset\|Memcpy\)
@SimonRit
Copy link
Collaborator

SimonRit commented May 15, 2024 via email

@ObaidullahRahman
Copy link
Author

Hi Simon,
I was able to install it. I also had to install the right itk (5.3.0) but that is beside the point.
I am getting the exact same error as before.
-Obaid
Screenshot 2024-05-15 at 12 51 37 PM

@SimonRit
Copy link
Collaborator

That does not seem to be the right installation. In a fresh environment, the requirement is ITK 5.4rc1, which can be installed with pip install itk==5.4rc1. Then make sure to install the package from the CI which does not seem to be what you have installed (rtkCudaUtilities.cu line 115 does not point to an exception).

@ObaidullahRahman
Copy link
Author

When I install from the CI, this is error I get.
Screenshot 2024-05-17 at 11 38 14 AM

@ObaidullahRahman
Copy link
Author

When I install from the CI, this is error I get. Screenshot 2024-05-17 at 11 38 14 AM

That's why I have to downgrade to itk 5.3.0

@SimonRit
Copy link
Collaborator

If you downgrade, you cannot test the fix! Segmentation faults occur for me when I don't have a matching ITK version or if I do not install the correct linux version. There are two linux versions, 2014 for older versions and 2_28 for newer ones, have you tested both? BTW, ITK has released v5.4.0, you can test the new CudaCommon and RTK packages
https://github.com/RTKConsortium/ITKCudaCommon/actions/runs/9169210647
https://github.com/RTKConsortium/RTK/actions/runs/9169284466
Python 3.11 packages are not compiled yet but you can test one of the other Python versions.

@SimonRit
Copy link
Collaborator

The linux version depends on your OS version, see https://github.com/pypa/manylinux.

@ObaidullahRahman
Copy link
Author

I was able to install this one:
Screenshot 2024-05-22 at 5 32 03 PM

The itk that gets installed in indeed 5.4.0. But now I get a different error:
Screenshot 2024-05-22 at 5 31 16 PM

@SimonRit
Copy link
Collaborator

I'm surprised that you did not have that before. We do not ship the cuda libraries with the package, you have to install cuda 11.6 on your computer. You can have multiple versions of cuda on the same computer. For windows, you can add the cuda path like this: https://github.com/RTKConsortium/RTK/blob/master/examples/FirstReconstruction/FirstCudaReconstruction.py#L13-L14. For linux, add the cuda lib directory (containing libcudart.so.11.0 among others) to LD_LIBRARY_PATH. Note that you can also opt for Cuda 12.1 now.

@ObaidullahRahman
Copy link
Author

I think I have cuda installed.
This is what nvidia-smi returns:
Screenshot 2024-05-23 at 4 18 00 PM

@SimonRit
Copy link
Collaborator

This just indicates the Cuda compability of your driver. Which OS are you using?
The package you have installed requires Cuda 11.6, ot Cuda 12.2. You may want to try the Cuda 12.1 version, I have experienced incompatibilities between Cuda 11.6 and a Cuda 12 driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants