Fix CUDA atomicAdd: replace long long with int for GPU atomic counters#193
Merged
jameslehoux merged 1 commit intomasterfrom Mar 23, 2026
Merged
Conversation
CUDA's atomicAdd supports int, unsigned int, unsigned long long, float, and double — but NOT signed long long. When compiling with nvcc, the Gpu::Atomic::Add(&long_long_ptr, 1LL) calls fail. Switch DeviceVector counters from long long to int in: - ConnectedComponents.cpp: component volume counting - ThroughThicknessProfile.cpp: per-slice phase counting int is sufficient for voxel counts (max ~2 billion cells per component). The host-side m_volumes (vector<long long>) is populated via .assign() which widens int→long long safely. https://claude.ai/code/session_01WR9HkUD95rp3XzZU95j2y7
Code Coverage ReportGenerated by CI — coverage data from gcovr |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CUDA's atomicAdd supports int, unsigned int, unsigned long long, float, and double — but NOT signed long long. When compiling with nvcc, the Gpu::Atomic::Add(&long_long_ptr, 1LL) calls fail.
Switch DeviceVector counters from long long to int in:
int is sufficient for voxel counts (max ~2 billion cells per component). The host-side m_volumes (vector) is populated via .assign() which widens int→long long safely.
https://claude.ai/code/session_01WR9HkUD95rp3XzZU95j2y7