NVCC Problem with _Float32

I am trying to make a C code and keep getting the following errors:

/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/bin/nvcc -c -O3 -I/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/2020/math_libs/include lusol_cusparse.c
In file included from /usr/include/stdlib.h:55:0,
                 from /opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/stdlib.h:13,
                 from lusol_cusparse.c:1:
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:60:17: error: two or more data types in declaration specifiers
   typedef float _Float32;
                 ^~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:63:18: error: two or more data types in declaration specifiers
   typedef double _Float64;
                  ^~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:74:18: error: two or more data types in declaration specifiers
   typedef double _Float32x;
                  ^~~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:78:25: error: two or more data types in declaration specifiers
     typedef long double _Float64x;
                         ^~~~~~~~~
Makefile:56: recipe for target 'lusol_cusparse.o' failed

I am not sure if this is an error with the gcc version I have or something else since it seems gcc 7+ has _Float32 as a compiler built-in.

I am not sure what I am missing.

Miko

  • Predictive Science Inc. Intern
1 Like

Hi Miko,

I’m a bit confused by the question since you say this is a problem with CUDA Fortran but you’re using nvcc to compile a C program. For CUDA Fortran you’d want to use nvfortran and a Fortran source file.

The actual error is that gcc is trying to use the header files we ship with the NVHPC SDK but these should only be used with nvc or nvc++. gcc should use the system header files.

nvcc itself wouldn’t implicitly add “/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/” to the search path and I don’t see you adding it via the “-I” flag so it’s unclear why gcc is searching this directory.

Are you setting “C_INCLUDE_PATH” in your environment to include “/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/”? If so, please remove this directory from the environment variable so gcc will use the correct headers.

By the way, the -I directories you are using, shouldn’t exist (unless you’ve made links), and nvcc would implicitly include the proper directories so aren’t needed anyway.

-Mat

2 Likes

That was the problem! Thank you for the help. Sorry for the confusion caused by my title.

Hi Mat,

The CPATH is pre-pended in the NV HPC SDK module file as:

$nvcompdir=$nvhome/$target/$version/compilers
export CPATH=$nvcompdir/include:$CPATH

This was causing the conflict even though we were using the NVCC that came with the HPC SDK.
Commenting this out solved the problem.
Why does the NVCC that comes with the HPC SDK use GCC instead of NVC?

  • Ron
1 Like