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

Exclude std::abort from compilation when compiling CUDA with Clang #1661

Merged
merged 4 commits into from
May 4, 2020
Merged

Exclude std::abort from compilation when compiling CUDA with Clang #1661

merged 4 commits into from
May 4, 2020

Conversation

invexed
Copy link
Contributor

@invexed invexed commented May 2, 2020

Excludes std::abort for device code only. Fixes #1659.

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

@@ -47,7 +48,11 @@ namespace internal {

FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
print(stderr, "{}:{}: assertion failed: {}", file, line, message);
#if defined(__clang__) && defined(__CUDA__) && defined(__CUDA_ARCH__)
std::terminate();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use std::terminate unconditionally but please add a short comment clarifying that it was chosen instead of abort because of CUDA.

std::terminate();
#else
std::abort();
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra #endif.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I Tested the wrong branch locally!

@vitaut vitaut merged commit 7e57cac into fmtlib:master May 4, 2020
@vitaut
Copy link
Contributor

vitaut commented May 4, 2020

Thanks!

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.

std::abort causes error when compiling CUDA with Clang in device code
2 participants