accelerator compiler incompatible with GCC 4.2?

I have a feeling this is a well-known issue… Can you confirm that the accelerator compiler is incompatible with GCC 4.2. My setup is

$ pgfortran -V
pgfortran 10.8-0 64-bit target on x86-64 Linux -tp nehalem-64

$ gcc --version
gcc (GCC) 4.2.0

$ uname -a
Linux #1 SMP Tue Jul 6 13:03:50 MDT 2010 x86_64 x86_64 x86_64 GNU/Linux

When I try to compile the following source code with pgfortran -ta=nvidia -c acc.f, it fails, emitting a slew of messages beginning with “c++config.h(149): error: expected a “{”” and ending with “Compilation terminated. PGF90-F-0000-Internal compiler error. pgnvd job exited with nonzero status code 0 (acc.f: 15)”. However, when I switch to GCC 3.4.4, compilation succeeds.

It’s distasteful to have to downgrade GCC. Is there anything I can do to avoid it? If not, are there any gotchas associated with downgrading (loss of Fortran 90 support, for example). Or, would you recommend upgrading GCC to 4.3 (or higher), provided it’s compatible (is it?).

      subroutine xyz(a,b,c,n1,n2,n3)
      real a(n3,n2)
      real b(n2,n1)
      real c(n3,n1)
!$acc region 
      do k = 1,n1
        do i = 1,n3
          c(i,k) = 0.0
          do j = 1,n2
            c(i,k) = c(i,k) + a(i,j) * b(j,k)
!$acc end region



It should work on GCC4.2 too. Unfortunately our 4.2 is down at the moment and it will be sometime to get it back up to know what the problem is or provide a workaround.

Yes, it should work with 4.3. We have tested your program here without problem.

Have you upgraded to GCC 4.2 after installing PGI Compilers? If that is the case, you may need to run makelocarc to update the information in localrc file.

Thank you,

Thanks for your reply hongyon.

I did not upgrade GCC after installing the Portland Compilers (I had that experience once before, many years ago, thanks for the tip about makelocalrc).

I will install GCC 4.3 or 4.4 to make it work. However, I am still curious to know why my GCC 4.2 environment caused a problem, and what, if any, workarounds there might be (other than upgrading GCC). So when you do get an opportunity to investigate this problem, let me know what you find. Thanks again.



We have installed GCC 4.2.3 here and I still see no problem.
Can you please send us what your localrc? What about an output of pgfortran -v -ta=nvinia acc.f -c ?

Thank you,

never mind. We installed GCC 4.2.0. We now can replicate the problem.



It turned out we need to pass extra argument to CUDA frontend.
You can do this by creating a file $PGI/linux86*/10.8/bin/siterc and put the following line in a file.

set CUGCCSW=$if($expr($GCCVERSION>=40200),–gnu_version=$GCCVERSION);

Thank you for reporting to us.

Thanks for following up.

I copied and pasted the set command you provided into $PGI/{linux86,linux86-64}/10.8/bin/siterc. Unfortunately, it didn’t solve the problem. I continue to get the same error.

Here are the contents of my siterc and localrc files.

set CUGCCSW=$if($expr($GCCVERSION>=40200),--gnu_version=$GCCVERSION);

set LFC=-lg2c;
set LDSO=/lib64/;
set GCCDIR=/usr/lib/gcc/x86_64-redhat-linux/4.2.0;
set GCCINC=/usr/lib/gcc/x86_64-redhat-linux/4.2.0/include;
set G77DIR=/usr/lib/gcc/x86_64-redhat-linux/3.4.4/;
set OEM_INFO=64-bit target on x86-64 Linux $INFOTPVAL;
set NUMALIBS=-lnuma ;
set EXTENSION=__extension__=;
set LC=$if(-Bstatic,-lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc, -lgcc -lc -lgcc);
# GLIBC version 2.3.4
# GCC version 4.2.0
set GCCVERSION=40200;
export PGI=/usr/local/pgi;
# makelocalrc executed by root Fri Sep 3 08:40:17



Sorry about that. pgnvd does not actually read information from siterc file.

There is a file name pgnvdlinrc in the bin directory. I would keep a copy of the original around just in case.

Change a line that contains:




Thanks Hongyon, that worked.