Hi Asmund,

In petsc-dev, files with a .cu extension are compiled with nvcc.

I also tried the suggestion of soft linking an acceptable version of gcc/g++ 
into
/usr/local/cuda/bin.  I think I used a gcc/g++ from a compatibility package that
I installed with yum.  That did not work for me either.  I think the issue might
have been related to that version being in the ccache directory but am not sure.
The only solution I got to work was to install a new, acceptable version of the
GNU compilers by actually building from source and installing in its own 
location
such as somewhere in your home directory or in some place like /usr/local or
/opt.  Also, if you use the "--program-suffix=46" configure option, I think you
may also need to softlink gcc46 to gcc and g++46 to g++ in your install 
directory.
I could check that when I get home this evening as well as checking my build
script to make sure there is not something important in it to pass on.

For me, it took about about an hour to build gcc 4.6.3, once I had learned the
various things I passed on in the earlier email.  So you may have to just build
a version of gcc rather than using a version from your distro's package system.
BTW, what distro are you using?  I don't believe that nvcc uses gfortran.  It 
uses
g++ and maybe also gcc.  Also, there is nothing special about gcc 4.6.3.  You
could build an earlier version of gcc such as gcc 4.5.x or gcc 4.4.x.  I chose
gcc 4.6.3 because it was the most up to date version that was supported by
nvcc from the Cuda 5 distribution.

I'll write more from home this evening when I can check some things on my
system.

Cheers,

Dave

________________________________________
From: ?smund Ervik [[email protected]]
Sent: Friday, March 15, 2013 7:21 AM
To: petsc-dev at mcs.anl.gov; Nystrom, William D
Subject: Re: [petsc-dev] PETSc-Cuda with gfortran 4.7

Hi Dave,

The errors occur when compiling these CUDA files:
mpiaijAssemble.cu, aijcusp.cu, mpicusp.cu and veccusp.cu
I assume these are compiled with nvcc, but I haven't triple checked that.

I had not tried your trick with setting the C compiler in nvcc.profile.
I did, however, try symlinking gcc-4.4 binaries into /usr/local/cuda/bin
(as was suggested in one stackexchange post I found), but this produced
an error during configure. Using your nvcc.profile, it gives the same error:

CUDA version error: PETSC currently requires CUDA version 4.0 or higher
- when compiling with CUDA

Even though I have CUDA 5.0 installed. Just to be sure, are there
binaries beside gfortran, gcc and g++ which must be found in the
CUDA-specific gcc-4.6 folder? I have both gcc variants installed through
the packaging system of my distro, so I cant't tell which belong to the
4.6 variant.

Asmund

On 13. mars 2013, wdn at lanl.gov wrote:
>
> Asmund,
>
> Do the failures you report below occur in cuda code that is ultimately 
> compiled with nvcc?
> I have not had problems compiling petsc-dev with cuda support on a Fedora 17 
> system
> which uses gcc-4.7.2 and gfortran-4.7.2.  However, I have gcc 4.6.3 installed 
> also and
> have nvcc pointed at it by using the /usr/local/cuda/bin/nvcc.profile with a 
> couple of lines
> added.  So, when I build petsc-dev on my Fedora 17 system, it uses gcc-4.7.2 
> and
> gfortran-4.7.2 for everything except cuda code located in .cu files.  I would 
> worry about
> removing some functionality in 4.7.2 with your suggested modification.
>
> Thanks,
>
> Dave
>
> --
> Dave Nystrom
> LANL HPC-5
> Phone: 505-667-7913
> Email: wdn at lanl.gov
> Smail: Mail Stop B272
>        Group HPC-5
>        Los Alamos National Laboratory
>        Los Alamos, NM 87545
>
>

Reply via email to