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

[ENH] Enable building with clang (limit strict error checking to GCC) #1452

Conversation

ahendriksen
Copy link
Contributor

Compiling RAFT with a non-GCC compiler can be tricky as there is very strict error checking (-Werror=all-warnings for instance) and therefore, the build is almost guaranteed to fail due to warnings elevated to errors.

I am sometimes building RAFT with clang because of its -ftime-trace feature, which helps find code that increases compile times.

This PR contains the changes I typically make to the CMakeLists.txt to enable clang compilation. With this change, strict error checking is only performed when the host compiler is GCC.

Tested with clang version 11.1.

Only do strict error checking when the host compiler is GCC.
@ahendriksen ahendriksen requested a review from a team as a code owner April 21, 2023 13:34
@ahendriksen ahendriksen changed the title Enable building with clang (limit strict error checking to GCC) [ENH] Enable building with clang (limit strict error checking to GCC) Apr 21, 2023
@ahendriksen ahendriksen added 3 - Ready for Review improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 21, 2023
@vyasr
Copy link
Contributor

vyasr commented Apr 24, 2023

To be clear, the goal here is just to use clang as the compiler for host code, not device code, right? The latter requires a great deal more work AFAIR (much of it also upstream).

@ahendriksen
Copy link
Contributor Author

Yes indeed. The goal is to compile with Clang as host compiler.

@cjnolet
Copy link
Member

cjnolet commented Apr 25, 2023

/merge

@rapids-bot rapids-bot bot merged commit de19c17 into rapidsai:branch-23.06 Apr 25, 2023
ahendriksen added a commit to ahendriksen/raft that referenced this pull request Apr 27, 2023
…dsai#1452)

Compiling RAFT with a non-GCC compiler can be tricky as there is very strict error checking (`-Werror=all-warnings` for instance) and therefore, the build is almost guaranteed to fail due to warnings elevated to errors. 

I am sometimes building RAFT with clang because of its `-ftime-trace` feature, which helps find code that increases compile times.

This PR contains the changes I typically make to the CMakeLists.txt to enable clang compilation. With this change, strict error checking is only performed when the host compiler is GCC.

Tested with clang version 11.1.

Authors:
  - Allard Hendriksen (https://github.com/ahendriksen)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#1452
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review CMake cpp improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

3 participants