- Check versions of
gcc
,g++
, andnvcc
:
gcc --version
gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
g++ --version
g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
- Scenario: Running CUDA code may raise the following errors:
/usr/include/bits/floatn.h(86): error: invalid combination of type specifiers
typedef __float128 _Float128;
or
error -- unsupported gcc version! gcc versions later than 12.2 are not supported!
- Install
g++-12
:
sudo apt install g++-12
- Add the following line in
~\..zshrc
file (edit~\.bashrc
if you usebash
as default shell):
export NVCC_PREPEND_FLAGS='-ccbin /usr/bin/g++-12'