compile with clang 13.0.0
StaticObserver opened this issue · 4 comments
1.In the file entity/framework/utils/qmath.h: line 58 & line 78:
Clang can't find matched template for the two instantiations and gives out errors. Removing the key word "Inline" solves the issue. While gcc is not having any problem compiling this.
2.In the file entity/framework/meshblock/meshblock.cpp: line 128:
if ((field == FieldID::Charge) && AlmostEqual(charge, ZERO)) {
Variable "charge" is float while "ZERO" is double when double_precision is defined.
This raises an ambiguity when using AlmostEqual() because only pure float and pure double versions are defined.
Clang don't like this and gives out an error while gcc only gives out an warning.
I changed it to:
if ((field == FieldID::Charge) && AlmostEqual(charge, static_cast(ZERO))) {
is this clang
or apple-clang
? regardless, i'm not sure kokkos
supports clang 13
, their primary tested version is 8.0
.
- removing
Inline
(which is an alias toKOKKOS_INLINE_FUNCTION
) is not an option, because this code has to be run on the device. are you usingCUDA
too? let me try to reproduce this with theclang 13.0
. - this is a good catch! indeed, this should be
0.0f
. could you make a PR?
This is in another device I'm working on. It's not a nvidia platform. They use HIP as tools to deal with graphics cards.
When compiling with C/C++ code with gpu codes, they use a compiler called hipcc which is a combination of clang and hip.
so do you use KOKKOS_ENABLE_HIP
? i don't have access to any HIP
machines to test, but removing Inline
is definitely not an option, since it won't run on a device code. it's weird that it only complains about these two Inline
-s though.
Yes, I did used KOKKOS_ENABLE_HIP.
Chatgpt told me inline function templates shall not be explicitly instantiated. Since inline function will be instantiated at every spot it is called.
I removed line 83 ~94, it worked.
Interesting, looks like clang is more strict than gcc