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

std::abort causes error when compiling CUDA with Clang in device code #1659

Closed
invexed opened this issue May 2, 2020 · 1 comment · Fixed by #1661
Closed

std::abort causes error when compiling CUDA with Clang in device code #1659

invexed opened this issue May 2, 2020 · 1 comment · Fixed by #1661

Comments

@invexed
Copy link
Contributor

invexed commented May 2, 2020

Compiling with Clang 9 in CUDA mode results in the following compilation errors during its device code pass:

.../fmt-master/include/fmt/format-inl.h:50:8: error: expected identifier
  std::abort();
       ^
.../fmt-master/include/fmt/format-inl.h:50:3: error: unexpected namespace name 'std': expected expression
  std::abort();
  ^

One possible fix is to use std::terminate instead:

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();
#else
  std::abort();
#endif
}
@vitaut
Copy link
Contributor

vitaut commented May 2, 2020

{fmt} generally requires a C++ compiler but I'm open to a PR to workaround this issue in CUDA.

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 a pull request may close this issue.

2 participants