Skip to content

NVCC fixes - #3441

Open
bendudson wants to merge 4 commits into
nextfrom
next-nvcc
Open

NVCC fixes#3441
bendudson wants to merge 4 commits into
nextfrom
next-nvcc

Conversation

@bendudson

Copy link
Copy Markdown
Contributor

The NVidia C++ compiler is quite picky compared to LLVM and GCC.

These fixes enable compilation with nvcc V12.9.41 on Perlmutter.

bendudson and others added 4 commits July 17, 2026 17:11
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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread include/bout/assert.hxx
Comment thread include/bout/fieldops.hxx
#include "bout/bout_types.hxx"
#include "bout/build_config.hxx"
#include "bout/build_defines.hxx"
#include "bout/build_config.hxx"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

easy fix :)

@ZedThree ZedThree left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, we can fix the clang-tidy warnings though

Comment thread include/bout/assert.hxx

#include "bout/boutexception.hxx"

#include <string_view>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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:

Suggested change
#include <string_view>
#include <string_view> // IWYU pragma: export

Comment thread include/bout/region.hxx
case (DIRECTION::Z):
return zp(dd);
}
return *this;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Comment thread src/sys/options.cxx
};

/// Visitor to convert an int, BoutReal or Array to the appropriate Array type.
template <class Scalar, class Backing>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>>> {

Comment thread include/bout/fieldops.hxx
#include "bout/bout_types.hxx"
#include "bout/build_config.hxx"
#include "bout/build_defines.hxx"
#include "bout/build_config.hxx"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

easy fix :)

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.

2 participants