[petsc-dev] PETSc-Cuda with gfortran 4.7
Nystrom, William D
wdn at lanl.gov
Fri Mar 15 17:31:24 CDT 2013
Hi Asmund,
I think there could be issues to changing petsc such that nvcc can use the 4.7.x versions
of gcc/g++. Nvidia does not support using 4.7.x compilers as the backend to nvcc for Cuda
5.0. A technical person from Nvidia that I talked to at SC12 last November indicated that it
was not trivial for Nvidia to support using more recent versions of the compilers that what
was officially supported for the given Cuda release. So while it might be possible for someone
to hack the cuda header file and remove the check and then get code to compile with a more
recent version of gcc/g++, it might not run correctly in some situations. I'm not sure what to
make of that. I don't really know the details of why it is difficult for Nvidia to support more recent
versions of gcc/g++ than what was officially supported for a given cuda release.
Of course, in the linux world, one often runs into the issue where a given software package,
such as the Intel compiler, is officially supported for certain releases of certain distros but
seems to work fine for other distros and other versions of the officially supported distros. In fact,
Cuda 5 officially supports Fedora 16 but not Fedora 17 or 18. And I'm using F17. But, for the
case of F17, I don't have to hack either Cuda or petsc to get it to work as long as I point nvcc
to a supported version of gcc such as 4.6.3. So that is what I am most comfortable doing.
The PETSc team will need to decide what their position is on this.
Dave
________________________________________
From: Åsmund Ervik [Asmund.Ervik at sintef.no]
Sent: Friday, March 15, 2013 12:50 PM
To: Nystrom, William D; petsc-dev at mcs.anl.gov
Subject: Re: [petsc-dev] PETSc-Cuda with gfortran 4.7
Hi Dave,
Thanks for the input so far. I'm using the ArchLinux distro (which is
great). I'll have a look into compiling my own gcc for this purpose.
As for a general fix for PETSc, someone should probably look into
whether my two undef's are a viable solution, as that requires much less
of the end user than compiling a new gcc variant.
Regards,
Asmund
On 15. mars 2013 16:36, Nystrom, William D wrote:
> 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 [Asmund.Ervik at sintef.no]
> 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
>>
>>
>
--
Sendt fra Thunderbird
More information about the petsc-dev
mailing list