c++cudac++20nvcc

Using C++20 in the nvcc compiler for cuda


I'm trying to use the std::countr_zero() function from the <bitset> library, but I'm not sure how I'm supposed to configure my nvcc compiler as I'm sure it's not using the C++20 version.


Solution

  • CUDA 12 and above supports the C++20 standard.

    You can find answers to your question more generally by checking Nvidia's standards C++ language support docs and this compiler support for language features page.

    In visual studio you can enable c++20 support by adding the command line option --std c++20 (Note no =) to the CUDA C/C++ Command line options in your project options.

    enter image description here