Browse Source

- Test whether the CUDA setup supports recent features (eg portable pinned memory).
- In case double precision in not supported by CUFFT, do not generate a test in
double precision in the starpufft example.

Cédric Augonnet 15 years ago
parent
commit
c5c8236915
2 changed files with 40 additions and 7 deletions
  1. 13 0
      configure.ac
  2. 27 7
      examples/starpufft/Makefile.am

+ 13 - 0
configure.ac

@@ -192,6 +192,9 @@ if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
 
 	AC_SEARCH_LIBS([cuInit],[cuda],[],[have_valid_cuda=no])
 
+	# To detect if we have a recent enough CUDA lib
+	AC_SEARCH_LIBS([cudaHostAlloc],[cudart],[],[have_valid_cuda=no])
+
 	# we also check that CUBLAS is available
 	AC_SEARCH_LIBS([cublasInit],[cublas],,[have_valid_cuda=no])
 
@@ -217,6 +220,16 @@ if test x$enable_cuda = xyes; then
 		NVCCFLAGS="${NVCCFLAGS} -m64"
 		AC_SUBST(NVCCFLAGS)
 	fi
+
+fi
+
+# cufftDoubleComplex may not be available on an old CUDA setup
+AC_CHECK_TYPE(cufftDoubleComplex,
+	[have_cufftdoublecomplex=yes],
+	[have_cufftdoublecomplex=no], [#include <cufft.h>])
+AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
+if test x$have_cufftdoublecomplex = xyes; then
+	AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
 fi
 
 ###############################################################################

+ 27 - 7
examples/starpufft/Makefile.am

@@ -32,7 +32,6 @@ EXTRA_DIST =			\
 	testx.c			\
 	testx_threads.c	
 
-
 libstarpufft_la_SOURCES = starpufft.c starpufftf.c starpufft-common.c
 libstarpufft_la_LIBADD = $(top_builddir)/src/libstarpu.la $(FFTW_LIBS) $(FFTWF_LIBS)
 libstarpufft_la_CFLAGS = $(FFTWF_CFLAGS)
@@ -42,19 +41,40 @@ if STARPU_USE_CUDA
 NVCC ?= nvcc
 NVCCFLAGS += -Xcompiler -fPIC -Xlinker -fPIC
 
+cudaf_kernels.o: cudaf_kernels.cu
+	$(NVCC) $(AM_CPPFLAGS) $< -c -o $@ --compiler-options -fno-strict-aliasing  $(NVCCFLAGS) -I${includedir}
+
+libstarpufft_la_SOURCES += cudaf_kernels.cu
+am_libstarpufft_la_OBJECTS = cudaf_kernels.o starpufftf.lo starpufft-common.lo
+
+if STARPU_HAVE_CUFFTDOUBLECOMPLEX
 cuda_kernels.o: cuda_kernels.cu
 	$(NVCC) $(AM_CPPFLAGS) $< -c -o $@ --compiler-options -fno-strict-aliasing  $(NVCCFLAGS) -I${includedir} -arch sm_13 
 
-cudaf_kernels.o: cudaf_kernels.cu
-	$(NVCC) $(AM_CPPFLAGS) $< -c -o $@ --compiler-options -fno-strict-aliasing  $(NVCCFLAGS) -I${includedir}
+libstarpufft_la_SOURCES += cuda_kernels.cu
+am_libstarpufft_la_OBJECTS += cuda_kernels.o starpufft.lo 
+endif
 
-libstarpufft_la_SOURCES += cuda_kernels.cu cudaf_kernels.cu
-am_libstarpufft_la_OBJECTS = cuda_kernels.o cudaf_kernels.o starpufft.lo starpufftf.lo starpufft-common.lo
 libstarpufft_la_LIBADD += -lcufft
 endif
 
-check_PROGRAMS = test testf
-test_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la $(FFTW_LIBS)
+check_PROGRAMS = testf
 testf_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la $(FFTWF_LIBS)
+
+# If we don't have CUDA, we assume that we have fftw available in double
+# precision anyway, we just want to make sure that if CUFFT is used, it also
+# supports double precision. 
+if !STARPU_USE_CUDA
+check_PROGRAMS += test
+test_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la $(FFTW_LIBS)
+else
+if STARPU_HAVE_CUFFTDOUBLECOMPLEX
+check_PROGRAMS += test
+test_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la $(FFTW_LIBS)
+endif
+endif
+
+
+
 #test_threads_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la -lfftw3_threads
 #testf_threads_LDADD = libstarpufft.la $(top_builddir)/src/libstarpu.la -lfftw3f_threads