Closed aschaffer closed 8 months ago
@brycelelbach I second the request for std::variant and friends in device code, or equivalent functionality with a similar API. This comes up commonly in some of the DOE multiphysics simulation codes where they want to represent multiple variants of some physics, such as an equation of state or radiation opacity for different materials in a simulation domain. singularity-eos and singularity-opac are examples from Los Alamos National Lab that use this today, and the ECP ExaStar project would use it for a similar approach if it were available. This also comes up in the context of having multiple kinds of solvers, for example variants on ODE solvers or root finding routines, or picking higher or lower resolution versions of a given algorithm.
Tentatively scheduled for 2.1.0
, but don't be surprised if that gets pushed back.
@griwes Are you working on a cuda::variant
? Can I assign this to you?
I'm going to do that myself for this and optional.
I'm interested in both variant
and optional
.
<optional>
is now up for review in NVIDIA/libcudacxx#437.
The Kokkos project is also interested in cuda::std::variant
: https://github.com/kokkos/kokkos/issues/5652
Hi @mhoemmen - HNY! Do we have a cuda::std::variant
merged 😄
@ajpowelsnl Greetings! : - D
Do we have a cuda::std::variant merged
Yes, indeed! libcu++ has a cuda::std::variant
.
https://github.com/NVIDIA/cccl/blob/main/libcudacxx/include/cuda/std/variant
It would be helpful to have discriminated union functionality, equivalent to C++17 standard
std::variant
,std::visit
,std::monostate
, but available in device code.See a nice summary of that functionality, for example, in "C++17, The Complete Guide", by N. Josuttis, 2019, Chapter 16.