Conversation
NVCC doesn't accept `Array<int, ArrayData<int>>` as `C<scalar>` so treats ConvertContainer<Array...> as partially specialized. This explicitly writes convertors for Array, Matrix and Tensor containers.
fmt uses `begin` rather than `std::begin` so that NVCC fails to find an overload for `char[]` literals.
Calls `Array::size()` that accesses a shared pointer to `ArrayData`. Doesn't need to be a device function since called outside kernel.
- Remove default arguments for fv_ops specializations - Use base class functions rather than partial overload
| #include "bout/bout_types.hxx" | ||
| #include "bout/build_config.hxx" | ||
| #include "bout/build_defines.hxx" | ||
| #include "bout/build_config.hxx" |
There was a problem hiding this comment.
warning: duplicate include [readability-duplicate-include]
include/bout/fieldops.hxx:8:
- #include "bout/build_defines.hxx"
- #include "bout/build_config.hxx"
+ #include "bout/build_defines.hxx"
ZedThree
left a comment
There was a problem hiding this comment.
Looks good, we can fix the clang-tidy warnings though
|
|
||
| #include "bout/boutexception.hxx" | ||
|
|
||
| #include <string_view> |
There was a problem hiding this comment.
clang-tidy is complaining because std::string_view is only used in a macro, so add this include-what-you-use pragma to silence the warning:
| #include <string_view> | |
| #include <string_view> // IWYU pragma: export |
| case (DIRECTION::Z): | ||
| return zp(dd); | ||
| } | ||
| return *this; |
There was a problem hiding this comment.
Hmm, would be nicer if we could just use some unreachable thing here, as this is not really correct (and we check we've exhausted all enum values). C++23 has std::unreachable -- I think I added a macro to hermes that could be used, although I'm not sure if I tested it with nvcc. Worth using that here too?
| }; | ||
|
|
||
| /// Visitor to convert an int, BoutReal or Array to the appropriate Array type. | ||
| template <class Scalar, class Backing> |
There was a problem hiding this comment.
This is a bit disappointing we have to do this. Is the issue something to do with not picking up the second template argument with C<scalar>?
Can we write it explicitly, like:
template <template <class, class> class C, class Scalar>
struct ConvertContainer<C<Scalar, ArrayData<Scalar>>> {| #include "bout/bout_types.hxx" | ||
| #include "bout/build_config.hxx" | ||
| #include "bout/build_defines.hxx" | ||
| #include "bout/build_config.hxx" |
The NVidia C++ compiler is quite picky compared to LLVM and GCC.
These fixes enable compilation with nvcc V12.9.41 on Perlmutter.