[petsc-dev] PETSc with CUDA on windows with VS2013 and CUDA 6.5

Barry Smith bsmith at mcs.anl.gov
Fri Sep 5 14:52:50 CDT 2014


From http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#axzz3CTMr1nP1

nvcc uses the following compilers for host code compilation:
On Linux platforms
The GNU compiler, gcc, and arm-linux-gnueabihf-g++ for cross compilation to the ARMv7 architecture
On Windows platforms
The Microsoft Visual Studio compiler, cl
On both platforms, the compiler found on the current execution search path will be used, unless nvcc option -compiler-bindir is specified (see File and Path Specifications).



Read more at: http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#ixzz3CTN6O86z 
Follow us: @GPUComputing on Twitter | NVIDIA on Facebook

On Sep 5, 2014, at 2:47 PM, Nystrom, William David <wdn at lanl.gov> wrote:

> I have had to comment out those lines so I could build with petsc with the Intel compilers
> in a Linux environment.  That has seemed to work fine for me although my testing has not
> been exhaustive.  But I have no petsc Windows experience.
> 
> 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
> 
> 
> ________________________________________
> From: petsc-dev-bounces at mcs.anl.gov [petsc-dev-bounces at mcs.anl.gov] on behalf of Satish Balay [balay at mcs.anl.gov]
> Sent: Friday, September 05, 2014 1:41 PM
> To: Paul Mullowney
> Cc: For users of the development version of PETSc
> Subject: Re: [petsc-dev] PETSc with CUDA on windows with VS2013 and CUDA 6.5
> 
> On Fri, 5 Sep 2014, Paul Mullowney wrote:
> 
>> Hi,
>> 
>> I've been trying to build PETSc in cygwin with Visual Studio 2013 and CUDA
>> 6.5. I successfully built and ran the PETSc GPU code following the
>> instructions for building on cygwin. However I ran in to a few problems
>> along the way. If anyone has insight into the second problem, I would
>> appreciate it.
>> 
>> 1) cuda.py (lines 112, 113):
>> if not config.setCompilers.Configure.isGNU(self.setCompilers.CC):
>>  raise RuntimeError('Must use GNU compilers with CUDA')
>> 
>> I had to comment these lines out to enable configuration success.
> 
> We might have had issues on linux with folks trying --with-cc=icc and
> --with-cudac=nvcc [and nvcc internally using gcc causing conflit].
> 
> So I think this check was added at that time. Ideally it should query
> nvcc to see what the internal compiler is - and then check if
> '--with-cc' is compatible with it. But I don't know how to do that.
> 
> Perhaps the easier fix is either of:
> 
> if (isLinux() and not isGNU(cc)) then error
> 
> if (not isWindows() and not isGNU()) then error
> 
>> 
>> 2) This may be related to why the GNU restriction in 1) was put in place.
>> Whenever PETSc has to compile a .cu, it fails. For example for a single
>> threaded build, the first .cu file to be compiled is veccusp.cu. For a
>> verbose build, I see:
>> 
>> /home/Paul/projects/petsc/bin/win32fe/win32fe nvcc -c -O -arch=sm_30
>> --compiler-options="-MT -wd4996 -O2   -I/home/Paul/projects/petsc/include
>> -I/home/Paul/projects/petsc/cuda_build/include
>> -I/cygdrive/c/CUDA_6.5/include -I/home/Paul/projects/cusp/
>> -I/home/Paul/projects/cusp/include -I/cygdrive/c/CUDA_6.5/include/thrust/
>> -I/home/Paul/projects/petsc/include/mpiuni   "
>> /home/Paul/projects/petsc/src/vec/vec/impls/seq/seqcusp/veccusp.cu -o
>> cuda_build/obj/src/vec/vec/impls/seq/seqcusp/veccusp.o # Compile first so
>> that if there is an error, it comes from a normal compile
>> 
>> veccusp.cu
>> *nvcc fatal   : redefinition of argument 'optimize'*
>> 
>> 
>> However, if I copy and paste the the compile line above and run it in the
>> terminal, it succeeds. If you do this for every file .cu file in PETSc
>> (~10-15 files). PETSc will build and work properly on GPUs in cygwin.
>> 
>> I don't know what the problem is here. Insight from anyone with
>> windows/cygwin/CUDA experience would be much appreciated. I've attached a
>> configure.log and make.log.
> 
> For one - I haven't tried cuda on windows in a while. [It must be when
> win32fe was modified to support nvcc - 3 years back]
> 
> And I don't unserstand the error. Is it complaining about '-O' vs '-O2'?
> 
> And the fact that copy/paste works is strange.
> 
> You can try: 'make all-legacy' and see if that works.
> 
> Or you can try Using --verbose option i.e 'win32fe nvcc --verbose' to
> see exactly what win32fe is doing [from gmake and from direct
> invocation] - and see if there are differences.
> 
> Perhaps there is a 'make' variable [thats read-in as env variable by
> nvcc] thats causing nvcc to behave differently.
> 
> Satish




More information about the petsc-dev mailing list