* Adam Mercer wrote on Thu, Sep 09, 2010 at 10:42:31PM CEST: > On Thu, Sep 9, 2010 at 15:27, Ralf Wildenhues wrote: > > For libtool libraries, it will try for a CudaFFT.lo file. > > of course. > > > You may be > > able to create a .cu.lo rule to generate that. I think. Since I'm not > > sure that that will work OOTB with Libtool (there is no extra Cuda > > language tag defined in Libtool, but you may be able to get by by using > > --tag=CC or so), > > libtool doesn't seem to like the generate CudaFFT.lo: > > nvcc -c -I../../../include -I./../include -o CudaFFT.lo CudaFFT.cu
Showing the line before this would have been interesting. Using libtool >= 2.2.8, you should get the .cu.lo rule to emit something like this command line: $(SHELL) $(LIBTOOL) --tag=CC --mode=compile $(NVCC) -c $(flags...) -o $@ $< as example here is what I mean, using dry run (on GNU/Linux, libtool configured for gcc): ./libtool --dry-run --mode=compile --tag=CC nvcc -c -o a.lo a.cu libtool: compile: nvcc -c a.cu -fPIC -DPIC -o .libs/a.o libtool: compile: nvcc -c a.cu -o a.o >/dev/null 2>&1 This probably won't work though since nvcc wants -Xcompiler -fPIC not plain -fPIC, if I'm reading the Libtool patch correctly. > /bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 > -I/usr/local/nvidia/sdk-3.1/cuda/include -o libfft.la > CudaComplexFFT.lo CudaRealFFT.lo FFTWMutex.lo CudaFunctions.lo > CudaFFT.lo TimeFreqFFT.lo AverageSpectrum.lo Convolution.lo -lfftw3 > -lfftw3f -lgsl -lgslcblas -lm -L/usr/local/nvidia/sdk-3.1/cuda/lib64 > -lcufft -lcudart -lgsl -lgslcblas -lm -lfftw3 -lfftw3f -lm > libtool: link: `CudaFFT.lo' is not a valid libtool object > make: *** [libfft.la] Error 1 > > > a workaround for now could be to remove CudaFFT.cu from > > *_SOURCES, add it to EXTRA_DIST, and add > > libfft_la_LIBADD = CudaFFT.o > > > > Untested, please complain if that breaks. > > Seems to work, but theres the following warning: > > *** Warning: Linking the shared library libfft.la against the non-libtool > *** objects CudaFFT.o is not portable! Yep, that's why I called that a workaround. > is this anything to worry about as we are only going to support Cuda > on Linux, and possibly Mac OS X. OK. > > Ah yes, of course you need to ensure PICness yourself in the latter > > case. > > How would I go about doing that? I usually leave that up to libtool? Yes. You add -Xcompiler -fPIC to compile flags. Hope that helps. And yes, for decent support of packages *not* compiling all code with nvcc, libtool will probably need more adjustments; haven't thought about that enough yet. Cheers, Ralf
