← Back to team overview

dolfin team mailing list archive

Re: Extending DOLFIN CMake scripts for CUDA interoperability

 

I have no idea how to fix this but hopefully someone else has some
idea. It would be good to get CUDA supported by the build system.

--
Anders


On Fri, Jan 14, 2011 at 08:07:50PM +0000, Florian Rathgeber wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I'm currently trying to get my DOLFIN GPU code in shape but haven't
> quite succeeded integrating it with DOLFIN's CMake build.
>
> Now the FindCUDA.cmake script tries to propagate host compiler flags and
> defines to the NVIDIA compiler nvcc but apparently messes up so I get a
> compiler invocation looking like this (only the relevant part):
>  -DPACKAGE_VERSION= 0.9.9+\" -Ddolfin_gpu_EXPORTS\" -Xcompiler
> ,\"-fPIC\",\"-O2\",\"-g\"
>
> Note the odd quoting and also the space after -DPACKAGE_VERSION=
>
> This causes nvcc to assume this is a target and die:
> nvcc fatal   : A single input file is required for a non-link phase when
> an outputfile is specified
>
> The code is at lp:~florian-rathgeber/dolfin/gpu-backend
>
> The relevant section from dolfin/CMakeLists.txt (after all the other
> packages)
> <<<
> # CUDA
> SET(DOLFIN_GPU_LIBRARY "")
> if (DOLFIN_ENABLE_CUDA AND CUDA_FOUND)
>   list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_CUDA")
>   list(APPEND DOLFIN_INCLUDE_DIRECTORIES ${CUDA_INCLUDE_DIRS})
>   # Add CUDA sources (*.cu) only if CUDA is enabled
>   foreach(DIR ${DOLFIN_DIRS})
>     file(GLOB _CU_SOURCES ${DIR}/*.cu)
>     list(APPEND CU_SOURCES ${_CU_SOURCES})
>   endforeach()
>   CUDA_ADD_LIBRARY(dolfin_gpu ${CU_SOURCES} SHARED)
>   SET(DOLFIN_GPU_LIBRARY dolfin_gpu)
>   list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${CUDA_LIBRARIES}
> ${DOLFIN_GPU_LIBRARY})
> endif()
>
> # Cusp
> if (DOLFIN_ENABLE_CUSP AND CUSP_FOUND)
>   list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_CUSP")
>   list(APPEND DOLFIN_INCLUDE_DIRECTORIES ${THRUST_INCLUDE_DIRS}
>     ${CUSP_INCLUDE_DIRS})
> endif()
> <<<
>
> In CMakeLists.txt I check for the packages like this:
> <<<
> # Check for CUDA
> if (DOLFIN_ENABLE_CUDA)
>   find_package(CUDA)
> endif()
>
> # Check for Cusp
> if (DOLFIN_ENABLE_CUSP)
>   find_package(Cusp)
> endif()
> <<<
> FindCUDA is the stock script from CMake 2.8, FindCusp is a simple script
> I wrote which lives in cmake/modules
>
> I'd be happy about any hints and tips. Garth, afair you wanted to look
> into this at some point now that the new build system is in place?
>
> Florian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk0wrRYACgkQ8Z6llsctAxaIDgCfdR5aGQYNXvW42EccJrpjr+vN
> cfgAoKALq93Cyi3f64+NRnUNgRUHMcYF
> =WZ4o
> -----END PGP SIGNATURE-----
>



> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp




References