CUDA Fortran, PGI 11.8, and gcc 4.5

I’m trying to experiment with CUDA 4.0 and a large model that I work on. On one machine where this is done, I need to load a python module (for f2py) that requires gcc 4.5 also be loaded. Unfortunately, when you have gcc-4.5 loaded, CUDA 4.0 goes a-failing:

In file included from /usr/local/sles11/pgi/linux86-64/2011/cuda/4.0/include/cuda_runtime.h:59:0,
                 from /gpfsm/dnb31/tdirs/pbs.137231.borgpbs1.mathomp4/pgcudafor25GcI9HkDRf4.gpu:1:
/usr/local/sles11/pgi/linux86-64/2011/cuda/4.0/include/host_config.h:82:2: error: #error -- unsupported GNU version! gcc 4.5 and up are not supported!
PGF90-F-0000-Internal compiler error. pgnvd job exited with nonzero status code       0 (irrad.F90: 3027)
PGF90/x86-64 Linux 11.8-0: compilation aborted
gmake[6]: *** [irrad.o] Error 2

Is there any way around this? Or should I ask the sysadmins to install a parallel-installable gcc-4.4 and try to use --compiler-bindir a la this NVIDIA forum post. But that raises the question: is there a PGI analogue to --compiler-binder?

Anyone else encounter this?

Thanks,
Matt

Hi Matt,

Unfortunately, we don’t have a way to switch the underlying GCC version that the NVIDIA components want to use. Though, I added a feature request (TPR#18121) to see if something can be done.

  • Mat

What about progress on this problem? I’m experiencing it too on 12.2.

I’ve got Ubuntu with gcc-4.4, gcc-4.5 and gcc-4.6 installed. I’ve tried to point PGI fortran to use gcc-4.4, but it didn’t help for CUDA compiler.

Senya,

As I started this, I’ll let you know my discoveries. The issue was that CUDA 4.0 and lower used gcc as the backend. CUDA 4.1 and higher use LLVM in such a way that the gcc version doesn’t seem to be an issue anymore (or, perhaps, gcc 4.5+ use LLVM as well, where as 4.4- didn’t?)

Anyway, the solution is to use, if you can, CUDA 4.1 or higher as your default for CUDA Fortran. If you upgrade your PGI to 12.6 or higher, I believe it’s moot as they now default to CUDA 4.1. But for 12.2, you’ll have to pass, say, -Mcuda=4.1 or -ta=nvidia:4.1.

In the end, it’s probably better to use 4.1 as it generated CUDA code that was, I think, something like 10% faster than 4.0…for free! You might also want to upgrade to the latest PGI compiler. Many bugs were closed between 12.2 and 12.8, and CUDA 4.1 is default. (Note: to use CUDA 4.1, you’ll have to make sure your NVIDIA driver is new enough to. That is, the driver for CUDA 4.0 doesn’t support running CUDA 4.1 code.)

Matt

Thanks for your help!

As I see, 12.2 have cuda 4.1 in its distribution, and this version try to use gcc, producing the same error.

Hmm. That is odd. I’m doing this on a system with PGI 12.6, gcc 4.5, and I don’t get the issues I had a year ago. What is the compile line that’s producing the error?

Matt

make
pgf95 -g -O0 -C -Mcuda=cc11 -Mcuda=4.1 -ta=nvidia:4.1,cc11 -tp=amd64 -Minfo -DCUDA -module …/module -c fldpki_acc.for
In file included from /opt/pgi/linux86-64/2012/cuda/4.1/include/cuda_runtime.h:59:0,
from /tmp/pgcudaforvQVf-fg4n-ci.gpu:1:
/opt/pgi/linux86-64/2012/cuda/4.1/include/host_config.h:82:2: #error – unsupported GNU version! gcc 4.6 and up are not supported!
PGF90-F-0000-Internal compiler error. Device compiler exited with error status code 0 (fldpki_acc.for: 19)
PGF90/x86-64 Linux 12.2-0: compilation aborted
make: *** [fldpki_acc.o] 2


      Subroutine FLDPKU(F,H,NN,MM)
      use pkidat
      real, device :: H(2,KK1SO2,KK2), F(2,KK1SO2,KK2)

!$cuf kernel do(1) <<< *, MM>>>
      DO 220 J=1,MM
      H(1,1,J)=(P1F(1,1)+P2F(1,1))*F(1,1,J)
     .        -(P1F(1,2)-P2F(1,2))*F(2,1,J)
      H(2,1,J)=(P2F(1,1)+P1F(1,1))*F(1,1,J)
     .        -(P2F(1,2)-P1F(1,2))*F(2,1,J)
 220  CONTINUE
!$cuf kernel do(2) <<< (*,*), (NN,MM)>>>
      DO 230 J=1,MM
      DO 230 I=2,NN
      H(1,I,J)= P1F(I,1)*F(1,I,J)+P2F(I,1)*F(1,NN-I+2,J)
     .         -P1F(I,2)*F(2,I,J)+P2F(I,2)*F(2,NN-I+2,J)
      H(2,I,J)=-P1F(I,1)*F(2,I,J)+P2F(I,1)*F(2,NN-I+2,J)
     .         -P1F(I,2)*F(1,I,J)-P2F(I,2)*F(1,NN-I+2,J)
 230  CONTINUE
      END

Aw nuts. My guess is that you are using gcc 4.7 or higher (what does ‘gcc --version’ report?).

If so, I’m not sure there’s an easy way around this. Looking at my install of PGI 12.8, it looks like the compiler will throw if you have anything higher than gcc 4.6.*. And looking at the CUDA 5.0 this seems to be in there as well.

Hmm. At this point, I’m a bit stumped. I’d normally say to check with the NVIDIA Forums but they’re still down.[/list]

Anyway, thank you for help.
My gcc is 4.6.3.
I think, i’ll be able to get newer PGI soon, and solve problem by this.

Oh, okay. Yeah, that might be due to the older version of PGI then, because it looks like PGI 12.8 should allow gcc 4.6 with CUDA 4.1 and 4.2.

Hi Senya, Matt,

For use with GCC 4.6, you need CUDA 4.2 which first started shipping with the PGI 12.6 compilers.

Hope this helps,
Mat