[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cuda compilation
From: |
Ralf Wildenhues |
Subject: |
Re: cuda compilation |
Date: |
Wed, 30 Dec 2009 22:52:51 +0100 |
User-agent: |
Mutt/1.5.20 (2009-10-28) |
Hello Tomas,
* Tomas Oberhuber wrote on Tue, Dec 29, 2009 at 07:25:36PM CET:
> I am experiencing some troubles with cuda. I studied mailing lists about
> autoconf, automake and libtool and from what I have read
> I have understood that from the linking point of view nvcc and gcc are
> compatible. So one should only compile .cu files with nvcc and then link all
> together with gcc. To compile .cu files with nvcc I did this in my
> Makefile.am
>
> include ${top_srcdir}/cuda.mk
>
> where cuda.mk is
>
> SUFFIXES = .cu
> .cu.$(OBJEXT):
> $(NVCC) -c $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $
> (CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ $<
>
> libcore_tests_sources = tnlLongVectorCUDATester.cu \
> tnlLongVectorCUDATester.h
>
> check_LTLIBRARIES = libcore-tests.la
> libcore_tests_la_SOURCES = $(libcore_tests_sources)
The .cu.$(OBJEXT) rule to create objects from sources only works for
objects not created with libtool. For the latter, you'd need a .cu.lo
rule, and you also need libtool to know about nvcc. The support that
was added to git Libtool in commit 741a9867e only works when $CC is set
to nvcc, so at this point your best bet might be to either use
./configure CC=nvcc
and compile all your sources with nvcc.
Alternatively, you could write a .cu.lo rule that looks like the
automake-generated .c.lo rule, has --tag=CC but uses $(NVCC); you'd then
still need a nvcc-wrapper that translates '-fPIC' to '-Xcompiler -fPIC'
for nvcc. Ugly, yes, but I'm not sure how to do this any nicer at the
moment.
Cheers,
Ralf
- cuda compilation, Tomas Oberhuber, 2009/12/29
- Re: cuda compilation,
Ralf Wildenhues <=