-
Notifications
You must be signed in to change notification settings - Fork 194
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 CCCL C headers to be compileable by C compiler #3885
Merged
oleksandr-pavlyk
merged 3 commits into
NVIDIA:main
from
oleksandr-pavlyk:cccl-c-parallel-use-from-c
Feb 21, 2025
Merged
Fix CCCL C headers to be compileable by C compiler #3885
oleksandr-pavlyk
merged 3 commits into
NVIDIA:main
from
oleksandr-pavlyk:cccl-c-parallel-use-from-c
Feb 21, 2025
Conversation
This file contains 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
This change ensures that cccl/c/parallel headers are compilable by C compiler. 1. Corrected typedef struct and typedef enum so that C types have the same names as C++. That is `typdef struct name {...} otherName;` was changed to `typedef struct name {...} name;` 2. `noexcept` qualifier was removed from function declarations. 3. Implementation was changed to move `noexcept` implementations into a namespace, and implement publicly declared functions as thin shims calling these noexcept functions from a namespace. 4. Adds c/parallel/test/test_header.c This is a C file which includes all public headers, and contains a trivial `int main(void)` function. The file is compiled using C compiler to produce an object file. Hence it does not result in a dedicate test to run, but any non C-compliant changes to these headers would break test compilation step. N.B.: Every new header file must be included in `test_headers.c` file for it to be tested. 5. Piggy-backing on this PR, added runtime error condition checking in test_main.cpp to verify that `cudaSetDevice` call did not report an error. 6. Modified cccl/c/parallel CMake project list of languages to include C.
leofang
reviewed
Feb 20, 2025
leofang
reviewed
Feb 20, 2025
🟩 CI finished in 45m 24s: Pass: 100%/3 | Total: 50m 27s | Avg: 16m 49s | Max: 35m 19s | Hits: 91%/308
|
Project | |
---|---|
CCCL Infrastructure | |
libcu++ | |
CUB | |
Thrust | |
CUDA Experimental | |
python | |
+/- | CCCL C Parallel Library |
Catch2Helper |
Modifications in project or dependencies?
Project | |
---|---|
CCCL Infrastructure | |
libcu++ | |
CUB | |
Thrust | |
CUDA Experimental | |
+/- | python |
+/- | CCCL C Parallel Library |
Catch2Helper |
🏃 Runner counts (total jobs: 3)
# | Runner |
---|---|
2 | linux-amd64-gpu-rtx2080-latest-1 |
1 | linux-amd64-cpu16 |
leofang
reviewed
Feb 20, 2025
leofang
approved these changes
Feb 20, 2025
Thanks for catching and fixing the bug, Sasha! |
gevtushenko
approved these changes
Feb 21, 2025
bernhardmgruber
approved these changes
Feb 21, 2025
…unction Instead simply remove use of noexcept in C++ definitions of these functions per Bernhard's suggestion
bernhardmgruber
approved these changes
Feb 21, 2025
🟩 CI finished in 38m 59s: Pass: 100%/3 | Total: 59m 13s | Avg: 19m 44s | Max: 38m 26s | Hits: 97%/308
|
Project | |
---|---|
CCCL Infrastructure | |
libcu++ | |
CUB | |
Thrust | |
CUDA Experimental | |
python | |
+/- | CCCL C Parallel Library |
Catch2Helper |
Modifications in project or dependencies?
Project | |
---|---|
CCCL Infrastructure | |
libcu++ | |
CUB | |
Thrust | |
CUDA Experimental | |
+/- | python |
+/- | CCCL C Parallel Library |
Catch2Helper |
🏃 Runner counts (total jobs: 3)
# | Runner |
---|---|
2 | linux-amd64-gpu-rtx2080-latest-1 |
1 | linux-amd64-cpu16 |
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.
Description
closes gh-3882
This change ensures that cccl/c/parallel headers are compileable by C compiler.
Corrected typedef struct and typedef enum so that C types have the same names as C++. That is
typedef struct name {...} otherName;
was changed totypedef struct name {...} name;
noexcept
qualifier was removed from function declarations.Implementation was changed to move
noexcept
implementations into a namespace, and implement publicly declared functions as thin shims calling these noexcept functions from a namespace.Adds c/parallel/test/test_header.c This is a C file which includes all public headers, and contains a trivial
int main(void)
function. The file is compiled using C compiler to produce an object file. Hence it does not result in a dedicate test to run, but any non C-compliant changes to these headers would break test compilation step.N.B.: Every new header file must be included in
test_headers.c
file for it to be tested.Piggy-backing on this PR, added runtime error condition checking in test_main.cpp to verify that
cudaSetDevice
call did not report an error.Modified cccl/c/parallel CMake project list of languages to include C.
Checklist