Nvc++ cannot find <iostream>

I have an 8-core Ryzen 7-2700x running Ubuntu 20.04 LTS, with a GeForce 1660, with driver 4.60. I downloaded (via deb) the latest HPC SDK and set up environment variables pointing to the NVCOMPILERs tree. When I tried to build my code (which runs with -fopenmp, and previous versions compiled successfully with earlier NVIDIA SDK), I get the following:

nvc++ -acc -Minfo=accel -ta=tesla SiteRepairDev_1.0.cc
“SiteRepairDev_1.0.cc”, line 8: catastrophic error: cannot open source file
“iostream”
#include
^

1 catastrophic error detected in the compilation of “SiteRepairDev_1.0.cc”.
Compilation terminated.

Since the build failed at the first line of code, I believe I’m missing something basic.

My best guess is that there was a problem during installation so the compiler configuration file isn’t properly setup and the system default C++ include directories are being added to the compilation.

Did you notice any errors during installation?
Can you please provide the contents of the local config file: “Linux_x86_64/22.1/compilers/bin/localrc”.
What happens if you run the command makelocalrc -d . -x?

-Mat

Some responses:

I did have some install trouble. The first time the “apt install” process simply hung in place after download, so I did “apt remove” for both .deb packages and installed again.

Also, there is this:

which nvc++
/opt/nvidia/hpc_sdk/Linux_x86_64/20.9/compilers/bin/nvc++

…so it’s not running 22.1

localrc contents:
set LFC=-lgfortran;
set LDSO=/lib64/ld-linux-x86-64.so.2;
set GCCDIR=/usr/lib/gcc/x86_64-linux-gnu/9;
set G77DIR=/usr/lib/gcc/x86_64-linux-gnu/9/;
set OEM_INFO=64-bit target on x86-64 Linux $INFOTPVAL;
set GNUATOMIC=-latomic;
set GCCINC= /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include;
set GPPDIR= /usr/include/c++/9 /usr/include/x86_64-linux-gnu/c++/9 /usr/include/c++/9/backward /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include;
set NUMALIBNAME=-lnuma ;
set LOCALRC=YES;
set EXTENSION=extension=;
set LC=-lgcc -lc $if(-Bstatic,-lgcc_eh, -lgcc_s);
set DEFSTDOBJDIR=/usr/lib/x86_64-linux-gnu;
set DEFCUDAVERSION=11.5;
set DEFSTDPARCOMPUTECAP=;

GLIBC version 2.31

GCC version 9.3.0

set GCCVERSION=90300;
export PGI=$COMPBASE;

makelocalrc executed by root Tue 18 Jan 2022

If I invoke makelocalrc -d . -x it finishes normallly.

A side question (though maybe relevant):

There is also a CUDA package. I have earlier versions of that and SDKs. Should I remove all of them and install a new CUDA version? Is there a correct order for doing this?

I’ve fixed the problem. Somehow the $path variable pointed to the wrong version. I now have

/opt/nvidia/hpc_sdk/Linux_x86_64/22.1/compilers/bin

…and it compiles OK.

Am I correct that the CUDA package is not contained in the SDK?

I’ve fixed the problem. Somehow the $path variable pointed to the wrong version.

Good, glad you were able to find the issue.

No, we ship CUDA with the SDK, the the exact version changes with each release and which HPC SDK package you download. The full package contains the latest CUDA release, the last major version, and the last previous major version. The smaller package contains just the latest CUDA release. They are co-installed so new installations don’t remove installations from previous installations.