Getting -cudacap error for nvfortran, but running c code with nvcc works fine

I have Ubuntu 18.04 and NVIDIA Driver version 435.21, compatible with CUDA toolkits 10.1 and below. I mainly use fortran in my applications and wanted the nvfortran compiler to accelerate my code. I have downloaded the NVIDIA HPC SDK 20.7 , loaded into the /opt directory, as per default. I have also downloaded CUDA 10.1 toolkit, installed in the /usr/local/cuda-10.1 directory.

I followed the post-installation instructions in the CUDA toolkit documentation and compiled the CUDA samples using the make file. All samples were compiled and a deviceQuery and bandwidthtest executable were created. Upon running those two executables, I got outputs, both with result PASS.

I then decided to run a helloworld code that simply prints HI across all cores of the GPU. I wrote it in C and fortran, attached as hellocuda_c.txt (227 Bytes) and hellocuda_fortran.txt (243 Bytes), respectively).

I compiled the C code using nvcc, and it prints “HI” successfully n times, n being whatever number of compute units I set it to. The fortran code, however, did not successfully build. I ran it using nvfortran -v -Minfo=all hellocuda.cuf and I have attached the logfile of the output in log_fortran.txt (3.6 KB) . A shorter version of the error thrown is :

NVFORTRAN-S-0155-Invalid value after compiler -cudacap flag 30
NVFORTRAN-S-1001-All selected compute capabilities were disabled (see -Minfo) (hellocuda.cuf: 1)
0 inform,   0 warnings,   1 severes, 0 fatal for 

Every flag in the second para of log_fortran.txt output has something written after it, except for the -cudacap flag. I dont know what cudacap stands for - is it cuda compute capability? I thought it was this, and based on the deviceQuery output, the cc is 3.0 on my device. On the compute capability section 6.8 of the hpc sdk documentation, the compilers can generate code for GPUs with compute capability of 3.0-8.0, the default is set as 3.5-7.0 and I had to change this to 3.0. I thus did nvfortran -gpu=cc30 to override the default compute capability, and got the message -

nvfortran-Error-The -gpu=cc30 option is no longer supported

I tried other commands with cc55, cc45, etc, but nothing ran. How do I change the compute capability? Is this even the issue? If it is, then how come it worked for the C code? If not then what might be the issue? I tried with the basic fortran example given in the Cuda fortran programming guide and got the same error.

Correct, it’s CUDA Compute Capability (CC)

Without the “-gpu=ccXX” flag, nvfortran will implicitly generate a binary for the device found on the system. However, NVIDIA has deprecated and no longer supports Kepler (CC30) devices and why nvfortran fails. Compiling a binary for a newer compute capability, such as CC35, is not expected to run on older devices.

CUDA 10.1 did still support CC30 and would explain why using nvcc worked for you.

1 Like

Thank you Mat for your response. I am still wondering how to work around this. Although its good that C codes work, my language of choice is fortran.

My device is Quadro K600 with cc 3.0. I have also tried with the -gpu=cc3, -gpu=cc35 and -gpu=cc40 flags. For flags > cc30, I get the output

nvfortran-Warning-The -gpu option has no effect unless a language-specific option is used (e.g.: -acc, -mp, -stdpar)

Using the -acc flag, gives no compile errors, but ./a.out gives no output.

So how can I work around this?
(1) Should I update the NVIDIA Driver to the latest ~ 440.XY? one with a higher cc? Or can cc be changed only with device
(2) Should I download an older version of HPC SDK, if available? one that supports older cc30
(3) Is this a device issue, that it is too old? And it will only work if I were to obtain a device with higher cc?

Any other ways in which I can work with CUDA Fortran with the current device details (obtained as output of deviceQuery):

Also can you confirm if this a correct observation -
The nvfortran compiler comes bundled in the HPC SDK 20.7, but not in the CUDA 10.1 toolkit, correct? I checked in the CUDA 11.0 toolkit as well and only found nvcc. So changing the toolkit would not make any difference, because they never contain nvfortran.

3 is your best option moving forward. Given the device came out in 2013 (it’s 5 generations old) and no longer supported, I recommend looking at purchasing a newer device. Also, the performance of the devices has improved significantly over the years.

For 1), it wouldn’t help since it’s not a driver issue (though I don’t think CUDA 11 supports your device either).

For 2), since 20.7 is the first official HPC SDK release, there are no older versions. If you happen to have a license for the PGI compiler (PGI was re-branded to the NVIDIA HPC SDK Compiler), then you can still download archived releases, but the no-cost PGI Community Edition is no longer available.

The nvfortran compiler comes bundled in the HPC SDK 20.7, but not in the CUDA 10.1 toolkit, correct?

Depends on which tar package you downloaded. There’s two, one with just CUDA 11 bundled, and a second that includes CUDA 11, 10.2, and 10.1. https://developer.nvidia.com/nvidia-hpc-sdk-download

1 Like

Thanks for your response!