You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug This bug basically makes std::variant unusable in the affected CUDA versions.
To Reproduce
I've seen this issue when trying to compile the latest dev branch of PIConGPU (2981b07a7160e64d057b5653f3d26410d54a8135) against the openPMD-api (version does not really matter, I used a4d66cc).
The error affects multiple usages of std::variant, e.g.:
/nix/store/6vclfnmcqpm1k5bbh5syf89f21gip2v3-gcc-12.3.0/include/c++/12.3.0/variant(391): error: function "std::__detail::__variant::_Variadic_union<_First, _Rest...>::~_Variadic_union() [with
_First=unsigned int, _Rest=<unsigned long, unsigned long long, float, double, long double, std::complex<float>, std::complex<double>, std::complex<long double>, std::string, std::vector<cha
r, std::allocator<char>>, std::vector<short, std::allocator<short>>, std::vector<int, std::allocator<int>>, std::vector<long, std::allocator<long>>, std::vector<long long, std::allocator<lon
g long>>, std::vector<unsigned char, std::allocator<unsigned char>>, std::vector<unsigned short, std::allocator<unsigned short>>, std::vector<std::seed_seq::result_type, std::allocator<std::
seed_seq::result_type>>, std::vector<std::size_t, std::allocator<std::size_t>>, std::vector<unsigned long long, std::allocator<unsigned long long>>, std::vector<float, std::allocator<float>>
, std::vector<double, std::allocator<double>>, std::vector<long double, std::allocator<long double>>, std::vector<std::complex<float>, std::allocator<std::complex<float>>>, std::vector<std::
complex<double>, std::allocator<std::complex<double>>>, std::vector<std::complex<long double>, std::allocator<std::complex<long double>>>, std::vector<signed char, std::allocator<signed char
>>, std::vector<std::string, std::allocator<std::string>>, openpmd_array_double_7, bool>]" (declared at line 400) cannot be referenced -- it is a deleted function
: _M_rest(in_place_index<_Np-1>, std::forward<_Args>(__args)...)
^
detected during:
…
…
…
instantiation of "std::__detail::__variant::_Move_ctor_base<<unnamed>, _Types...>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<<unnamed>, _Types...> &&) [with <unna
med>=false, _Types=<char, unsigned char, signed char, short, int, long, long long, unsigned short, unsigned int, unsigned long, unsigned long long, float, double, long double, std::complex<f
loat>, std::complex<double>, std::complex<long double>, std::string, std::vector<char, std::allocator<char>>, std::vector<short, std::allocator<short>>, std::vector<int, std::allocator<int>>
, std::vector<long, std::allocator<long>>, std::vector<long long, std::allocator<long long>>, std::vector<unsigned char, std::allocator<unsigned char>>, std::vector<unsigned short, std::allo
cator<unsigned short>>, std::vector<std::seed_seq::result_type, std::allocator<std::seed_seq::result_type>>, std::vector<std::size_t, std::allocator<std::size_t>>, std::vector<unsigned long
long, std::allocator<unsigned long long>>, std::vector<float, std::allocator<float>>, std::vector<double, std::allocator<double>>, std::vector<long double, std::allocator<long double>>, std:
:vector<std::complex<float>, std::allocator<std::complex<float>>>, std::vector<std::complex<double>, std::allocator<std::complex<double>>>, std::vector<std::complex<long double>, std::alloca
tor<std::complex<long double>>>, std::vector<signed char, std::allocator<signed char>>, std::vector<std::string, std::allocator<std::string>>, openpmd_array_double_7, bool>]" at line 59 of /
home/franzpoeschel/picongpu_env/env/include/openPMD/backend/Attribute.hpp
/nix/store/6vclfnmcqpm1k5bbh5syf89f21gip2v3-gcc-12.3.0/include/c++/12.3.0/variant(391): error: function "std::__detail::__variant::_Variadic_union<_First, _Rest...>::~_Variadic_union() [with
_First=openPMD::UniquePtrWithLambda<void>, _Rest=<>]" (declared at line 400) cannot be referenced -- it is a deleted function
: _M_rest(in_place_index<_Np-1>, std::forward<_Args>(__args)...)
^
detected during:
…
…
…
instantiation of "std::variant<_Types...>::variant(_Tp &&) [with _Types=<std::shared_ptr<const void>, openPMD::UniquePtrWithLambda<void>>, _Tp=openPMD::UniquePtrWithLambda<void>,
<unnamed>=void, <unnamed>=void, _Tj=openPMD::UniquePtrWithLambda<void>, <unnamed>=void]" at line 181 of /home/franzpoeschel/picongpu_env/env/include/openPMD/auxiliary/Memory.hpp
I don't see an easy way out of this. Looking at the linked bug report, even trivial use of std::variant seems to be impossible. In openPMD::Attribute, std::variant is part of our public API, so we can't easily replace it with something else.
Option 1: Check the affected CUDA versions, add some include guard to cancel compilation with the note that the CUDA version is broken and something else should be used.
Option 2: Reintroduce mpark::variant? It seems to be unmaintained though
The text was updated successfully, but these errors were encountered:
If you want to use C++20 with Nvidia compilers, use the latest compilers only for now. They already fixed this issue and we should keep reporting other bugs we find to https://developer.nvidia.com This is what we usually do when new standards are supported in vendor compilers and bugs are being shaken out still.
If you want to use std::variant and older Nvidia compilers, only require C++17 for now in downstream projects. (openPMD-api only needs C++17 currently)
ax3l
changed the title
CUDA bug affects use of openPMD-api in C++20 projects
CUDA < 12.4.1 bug affects use of openPMD-api in C++20 projects
Feb 20, 2025
Describe the bug
This bug basically makes
std::variant
unusable in the affected CUDA versions.To Reproduce
I've seen this issue when trying to compile the latest dev branch of PIConGPU (2981b07a7160e64d057b5653f3d26410d54a8135) against the openPMD-api (version does not really matter, I used a4d66cc).
The error affects multiple usages of
std::variant
, e.g.:Line:
openPMD-api/include/openPMD/backend/Attribute.hpp
Line 55 in a4d66cc
or
Line:
openPMD-api/include/openPMD/auxiliary/Memory.hpp
Line 178 in a4d66cc
What should we do
I don't see an easy way out of this. Looking at the linked bug report, even trivial use of
std::variant
seems to be impossible. InopenPMD::Attribute
,std::variant
is part of our public API, so we can't easily replace it with something else.mpark::variant
? It seems to be unmaintained thoughThe text was updated successfully, but these errors were encountered: