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

Fix errors with large images #145

Merged
merged 2 commits into from
Mar 27, 2023
Merged

Fix errors with large images #145

merged 2 commits into from
Mar 27, 2023

Conversation

gregoire-dl
Copy link
Member

Description

The current code limits the maximum width of an image:
image width (in bytes) < cudaDerviceProp->maxSurface2DLayered[0]

For many GPUs, this is a very strict condition that limits the image to 4096 elements in width.

However the CUDA documentation define maxSurface2DLayered as maximum dimensions (i.e. number of elements).
Maybe I'm wrong, but after some tests, I think I can confirm that maxSurface2DLayered is not in bytes.

This PR change the way we check surface2DLayered dimensions.
We now use maxSurface2DLayered[0] as a maximum width limit in elements.

This PR also change Plane_2d object methods getPitchInBytes() and getByteSize() to return size_t type instead of short type to avoid overflow in the case of large images.

Implementation remarks

Tested with CUDA 11.3 on a Quadro M4000 with multiple 7500x7500 images.

@fabiencastan fabiencastan merged commit 3552da5 into develop Mar 27, 2023
@fabiencastan fabiencastan deleted the fix/largeImages branch March 27, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants