NVIDIA HPC SDK nvcc compiler can not compile a simple program

I’m trying to transit from old 19.10 pgc++ compiler (the license has expired) to the new NVIDIA HPC SDK’s nvc++ compiler. I installed NVIDIA HPC SDK on my PC: CPU 64-core Intel Xeon Phi KNL (Knights Landing) + NVIDIA Titan V GPU. I use the following compile line (https://forums.developer.nvidia.com/t/how-to-allocate-and-treat-class-member-dynamic-array-data-on-gpu/145851/3):

cmake . -DCMAKE_C_COMPILER=nvcc -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_C_FLAGS="-acc=gpu -Minfo=acc -mcmodel=medium -tp=haswell -Minline -cuda -gpu=cuda11.0,cc70" -DCMAKE_CXX_FLAGS="-acc=gpu -Minfo=acc -mcmodel=medium -tp=haswell -Minline -cuda -gpu=cuda11.0,cc70" -DCMAKE_CXX_STANDARD=17

But the compilation immediately fails with the output in the attached .txt file.

I have installed the NVIDIA HPC SDK:

nvc++ 20.7-0 LLVM 64-bit target on x86-64 Linux -tp knl 
NVIDIA Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.

There is gcc 7.4.0 on my PC:

g++ (Debian 7.4.0-6) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And CUDA version 11 and NVIDIA GPU driver version 455.23.05:

[COMPILER_ERROR.txt|attachment](upload://ggrxnuyJ8MnyBlaWlnwLvh6NSOK.txt) (3.6 KB) NVIDIA-SMI 455.23.05    Driver Version: 455.23.05    CUDA Version: 11.1

How to get the nvc++ compiler to work?

It is written in the compiler output:

Check for working C compiler: /opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/bin/nvcc -- 
broken

Should I reinstall the compiler?
COMPILER_ERROR.txt (3.6 KB)

Hi _and,

Here’s the error from the text file:

Building C object CMakeFiles/cmTC_db1fc.dir/testCCompiler.c.o
/opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/bin/nvcc   -acc=gpu -Minfo=acc -mcmodel=medium -tp=haswell -Minline -cuda -gpu=cuda11.0,cc70    -o CMakeFiles/cmTC_db1fc.dir/testCCompiler.c.o   -c /data/70-gaa/Desktop/CURRENT_WORK/LAST_TRY/CMakeFiles/CMakeTmp/testCCompiler.c
nvcc fatal   : 'cmodel=medium': expected a number

The C compiler is called “nvc”, but here you’re trying to use “nvcc”, which is the CUDA C++ compiler so doesn’t recognize the “-mcmodel=medium” option. Try setting "-DCMAKE_C_COMPILER=nvc ".

-Mat

Thank You. With

DCMAKE_C_COMPILER=nvc

it compiles and works properly.

I have another PC with CPU Intel Core i7 and GPU NVIDIA Geforce GTX 650 Ti (cc30) and OS Fedora 23.
It is rather an old operating system. Will Linux_x86_64 Tarball downloaded from https://developer.nvidia.com/nvidia-hpc-sdk-downloads work on it or I have to update my OS from Fedora 23 to the current Fedora version? And does NVIDIA HPC SDK nvc++ compiler support this old GPU NVIDIA Geforce GTX 650 Ti (compute capability 3.0)? If it doesn’t support, the compiler nvc++ will not work with this graphics card or nevertheless I can try launching the code on GPU Geforce GTX 650 Ti using nvc++ compiler?

No sorry. NVIDIA discontinued support for CC3.0 devices awhile ago and as such the compilers no longer support it either.

nevertheless I can try launching the code on GPU Geforce GTX 650 Ti using nvc++ compiler?

Again, sorry, but no. CC3.0 devices are not forward compatible so binaries built targeting newer devices wont run.

I have to update my OS from Fedora 23 to the current Fedora version?

Installing on older OSs might work, but is not something we test.

You can find a list of supported OSs at: https://docs.nvidia.com/hpc-sdk/hpc-sdk-release-notes/index.html#platform-requirements