Search code examples
ubuntugcccompiler-errorscudanvcc

Suddenly getting "__builtin_ia32_sqrtsd_round" is undefined, with nvcc/gcc


I have a CUDA NSight project which was compiling fine, but suddenly isn't. I did have some system updates (Ubuntu 18.04) installed last week, which are likely the cause (or a part of it). Unfortunately I don't know what exactly was installed. I don't recall seeing any CUDA things in the list.

Anyway, the nvcc command line created by Nsight is as follows:

/usr/local/cuda-10.2/bin/nvcc -I/usr/include/gdal -O2 --compile --relocatable-device-code=false -gencode arch=compute_37,code=compute_37 -gencode arch=compute_61,code=compute_61 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_61,code=sm_61  -x cu -o  "MySource.o" "../MySource.cu"

This gives a bunch of very similar errors, starting:

/usr/lib/gcc/x86_64-linux-gnu/7/include/avx512fintrin.h(1761): error: identifier "__builtin_ia32_sqrtsd_round" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/avx512fintrin.h(1770): error: identifier "__builtin_ia32_sqrtss_round" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/avx512fintrin.h(2728): error: identifier "__builtin_ia32_scalefsd_round" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/avx512fintrin.h(2737): error: identifier "__builtin_ia32_scalefss_round" is undefined

avx512fintrin.h does indeed exist at the quoted location and has a date stamp back in December.

I am running Ubuntu 18.04 x64. gcc and g++ are both reporting as: 7.5.0

Running CUDA 10.2 (and confirmed by nvidia-smi). nvcc --version reports release 10.2 V10.2.89

Building the cuda-10.2/samples/0_Simple/matrixMul sample (with make), builds with no errors.

Where are the identifiers in the errors defined? What am I missing? What has changed or been corrupted?


Solution

  • I believe I have found the problem. @Marc Glisse 's comment about GDAL was a big clue. I am using nvcc to compile everything. For standard C++ this just passes the work to g++. I also had the same include paths. The GDAL C++ interface (which I'm using) cannot, of course, be called directly from CUDA. Removing the GDAL include path from CUDA nvcc, and re-arranging the include files fixed the problem.

    A nice side effect is that it has forced me to greatly improve my include file hygiene!

    Takeaway: With the latest Linux updates, GDAL includes don't even like to be included in CUDA code.