Skip to content

Conversation

@ThomasHoffmann77
Copy link

  • Introduce conditional compilation to use cudaTextureObject_t for CUDA ≥12.
  • Preserve existing texture reference-based code for older CUDA versions.

Testing required! (-> draft)

# Add CUDA 12 texture object support while preserving CUDA <12 compatibility
# Description:
# - Introduce conditional compilation to use cudaTextureObject_t for CUDA >=12.
# - Preserve existing texture reference-based code for older CUDA versions.
# Add CUDA 12 texture object support while preserving CUDA <12 compatibility
# Description:
# - Introduce conditional compilation to use cudaTextureObject_t for CUDA >=12.
# - Preserve existing texture reference-based code for older CUDA versions.
fix d_pitched cuda < 12
c11 fix
add static for parallel cu11 builds
add static for parallel cu11 builds
revert comments
remove some comments
remove some comments
@alisterburt
Copy link
Contributor

@ThomasHoffmann77 thanks for taking the time to make the PR!

I don't know enough to be able to review quickly and we don't have any defined process for outside contributions so I can't guarantee any timeline for this getting looked at properly.

I assume you want a CUDA 12 build, could you ask some of your local users to test and report back any issues? :-)

@alisterburt
Copy link
Contributor

is this the only thing required for cu12 to build or is this a partial solution to a full cu12 build?

@ThomasHoffmann77
Copy link
Author

@ThomasHoffmann77 thanks for taking the time to make the PR!

I don't know enough to be able to review quickly and we don't have any defined process for outside contributions so I can't guarantee any timeline for this getting looked at properly.

I assume you want a CUDA 12 build, could you ask some of your local users to test and report back any issues? :-)

@jmdobbs has kindly offered to run tests over the weekend.

@ThomasHoffmann77
Copy link
Author

is this the only thing required for cu12 to build or is this a partial solution to a full cu12 build?

Based on these changes only in these two files I was able to build a module with GCC/12.3.0 and CUDA/12.1.1 at our site.

@jmdobbs
Copy link

jmdobbs commented Oct 31, 2025

With regard to the testing: it does work, but fails semi-randomly (often without an error message) during fs_motion_and_ctf. When it does fail it essentially just puts all 0s for the frame CTF fits, usually for 1-3 images of the 150 in my test set, but the rest of the operations seem to work without issue (so far). Also, it has run through without error in 2/6 of the test runs I've done, probably unrelated to GPU node (i.e. sometimes passes and fails on the same node).

@dtegunov
Copy link
Contributor

Sorry I missed these 2 files when I made the transition to texture objects a while ago. But I thought I had tested compilation with CUDA >=12 and it worked.

Could you please remove the old code instead of branching with #if? I really appreciate the effort to preserve compatibility, but there is no reason not to use texture objects exclusively here since they're already used everywhere else.

ThomasHoffmann77 and others added 7 commits November 3, 2025 18:18
remove conditional compilation cuda <12
remove conditional compilation cuda < 12
fix wrapper
revert 3d kernel
@ThomasHoffmann77 ThomasHoffmann77 changed the title Add CUDA 12 texture object support while preserving CUDA <12 compatibility Add texture object support in Bin.cu and IrregularSphereMask.cu Nov 4, 2025
@ThomasHoffmann77
Copy link
Author

We now have a test module for commit 6cfa05a on our cluster. I'll keep this PR in 'draft' state for the time being.
Also, should d_BindTextureToArray from NativeAcceleration/gtom/include/Helper.cuh be used preferentially in Bin.cu and IrregularSphereMask.cu? Let me know your thoughts on this.

@jmdobbs
Copy link

jmdobbs commented Nov 5, 2025

I can confirm this works on our L40 and H100 nodes (I tested up to tomogram reconstruction). There is still the bug in fs_motion_and_ctf I describe above, which I will open an issue for, but I have determined that this also randomly occurs in the unmodified dev35 branch (not in dev33 though) so it is unrelated to this PR.

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 this pull request may close these issues.

4 participants