-
Notifications
You must be signed in to change notification settings - Fork 5
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
ENH: Add support for 16 and 32-bit radiograph images #76
ENH: Add support for 16 and 32-bit radiograph images #76
Conversation
NicerNewerCar
commented
Jan 13, 2023
•
edited
Loading
edited
- Replace outdated texture references with texture objects (added in CUDA 5.0) for CUDA 12.0
- Closes issues
- Cuda: Convert texture references to texture objects #42
- Nvdia 12.0 Build error #72
- SAM (cuda) crash with mayo shoulder data cfg load #241
- For future reference see https://developer.nvidia.com/blog/cuda-pro-tip-kepler-texture-objects-improve-performance-and-flexibility/
a7dfea0
to
81d1dc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successful build with 12.0, but when opening trial - autoscoper crashed:
C:\Users\amorton1\Documents\GitHub\Autoscoper\libautoscoper\src\View.cpp(430) : cudaSafeCall() Runtime API error : OS call failed or operation not supported on this OS.
@amymmorton what trial are you opening? Did you make sure to build with a clean build tree? I have opened and tracked WN00106 and SOL001A successfully on this branch. |
d2057df
to
f3bb473
Compare
Yes. tried again - changed to main then back to PR 76: Filename: P:/iTWA_Instrumented_Total_Wrist/Subjects/NORMAL/WN00106/Autoscoper/flx_ext.cfg |
pulled from main and had the same error- I believe the instll of v12 created issues in my enviroment- attempting a reinstall of 11.8.. |
My reinstall of 11.8 allowed successful build of this branch. I will have our engineer Maddie and @kaitohl test v12.0 too |
@jcfr I got these changes to build and run successfully using the docker container on Ubuntu 22.04. Have you been able to test them yet? If so, this can be merged in. |
f3bb473
to
4337645
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4337645
to
c5d12e9
Compare
Suggest commit message:
Can you revisit to:
|
dim3 gridDim(((unsigned int)width+blockDim.x-1)/blockDim.x, | ||
((unsigned int)height+blockDim.y-1)/blockDim.y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the outcome of the division be truncated to unsigned int
? The use of parenthesis seems off.
Also, could you confirm truncation is what we want here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not performing truncation on the division, but converting the size_t
width and height variables to prevent a compile time warning (see #42)
C:\SAM\Autoscoper\libautoscoper\src\gpu\cuda\Compositor_kernels.cu(70): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data [C:\SAM\Autoscoper\build-test\Autoscoper-build\libautoscoper\libautoscoper.vcxproj] [C:\SAM\Autoscoper\build-test\Autoscoper.vcxproj]
c5d12e9
to
76cf0a4
Compare
Prior to these changes, the supported CUDA texture types (and by extension radiograph images) was hard-coded to 8-bit (unsigned char) and managed as a static global variable. Since texture references needed to be known at compile time and the current type was hard-coded to 8-bit, the use of them prevented from being able to easily support 8, 16, and 32 bit radiograph images known at runtime. To address this, this commit removes the use of `cudaBindTextureToArray` (Deprecated since CUDA 11.3 and removed in CUDA 12.x) and switch to using texture object instead by introducing a convenience helper function `createTextureObjectFromArray`. Approach implemented here is based of recommendation the post titled "Kepler Texture Objects Improve Performance and Flexibility" published in 2013. See https://developer.nvidia.com/blog/cuda-pro-tip-kepler-texture-objects-improve-performance-and-flexibility/ For reference, before this changes, the error message reported at build time while attempting to use autoscoper built against CUDA 12.x was: ``` 3 Errors under file path `...\libautoscoper\src\gpu\cuda\RadRenderer_kernels.cu: - no instance of overloaded function "tex2D" matches the argument list - identifier "cudaBindTextureToArray" is undefined - texture is not a template ```
76cf0a4
to
11b91cc
Compare