[CMake] FindCUDA Separable Compilation and cublas_device

Jamil Appa jamil.appa at zenotech.com
Fri Nov 3 07:39:35 EDT 2017


Hi Robert

  I am using CUDA_ADD_CUBLAS_TO_TARGET but the error happens during the
prelink phase when using separable compilation. (nvcc -dlink phase)

   My guess is that Nvidia have not included cublas_device.a in their dlink
phase as you don't have to provide any other libraries. I have asked the
Nvidia team if that is the case, but no reply yet.

   The general fix seems to be to modify lines 1759/1772 of FindCUDA.cmake
(in gitlab master) to include CUBLAS_LIBRARIES

 COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files}
${CUDA_CUBLAS_LIBRARIES} -o ${output_file}

 This will have no impact if the cublas symbols are not used in the object
files.

  If you are happy with this I can submit the change for review.

 Jamil

On Thu, 2 Nov 2017 at 13:53 Robert Maynard <robert.maynard at kitware.com>
wrote:

> Hi,
>
> Have you tried using the 'CUDA_ADD_CUBLAS_TO_TARGET' command on the target
> that has FindCUDA separable compilation enabled?
>
> On Wed, Nov 1, 2017 at 11:16 AM, Jamil Appa <jamil.appa at zenotech.com>
> wrote:
>
>> Hi
>>
>>    When using FindCUDA with separable compilation combined with device
>> code that uses cublas_device I get missing symbols when linking the
>> intermediate file at line 1758
>> <https://gitlab.kitware.com/cmake/cmake/blob/release/Modules/FindCUDA.cmake#L1758>
>>  FindCUDA.cmake
>>
>>    If I  change line 1758 to include the cublas_device library the
>> symbols are resolved correctly.
>>
>>    COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files}
>> -o ${output_file} -lcublas_device
>>
>>    Is there a way to pass through a library to
>> the CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS function that I am missing?
>>
>>    Thanks
>>
>>  Jamil
>>
>> *Jamil Appa* | Co-Founder and Director | Zenotech
>> [image: Papercut]
>> [image: Tel:] +44 (0)7747 606 788 <+44%207747%20606788> [image: Zenotech
>> LTD - Simulation Unlimited] <http://www.zenotech.com/>
>> [image: Email:] jamil.appa at zenotech.com
>> [image: Web:] www.zenotech.com
>> [image: Papercut]
>> [image: linkedin:] <http://uk.linkedin.com/pub/jamil-appa/1/165/120>[image:
>> Twitter:] <https://twitter.com/zenotech>[image: Location:]
>> <https://www.google.co.uk/maps/place/Bristol+%26+Bath+Science+Park/@51.500921,-2.478567,17z/data=!3m1!4b1!4m2!3m1!1s0x48719ab86a5a9f7d:0xd17394f3400abb0a>
>>
>> Company Registration No : 07926926 | VAT No : 128198591
>>
>> Registered Office : 1 Larkfield Grove, Chepstow, Monmouthshire, NP16
>> 5UF, UK
>> <https://maps.google.com/?q=1+Larkfield+Grove,+Chepstow,+Monmouthshire,+NP16+5UF,+UK&entry=gmail&source=g>
>>
>> Address : Bristol & Bath Science Park, Dirac Cres, Emersons Green,
>> Bristol BS16 7FR
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171103/6b18619b/attachment.html>


More information about the CMake mailing list