CMake 3.11 Linking CUBLAS

好久不见. 提交于 2021-01-27 21:03:54

问题


How do I correctly link to CUBLAS in CMake 3.11?

In particular, I'm trying to create a CMakeLists file for this code.

CMakeLists file so far:

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(cmake_and_cuda LANGUAGES CXX CUDA)
add_executable(mmul_2 mmul_2.cu)

This gives multiple "undefined reference errors" to cublas and curand.


回答1:


Found the solution which is to add this line in the end of the CMakeLists file:

target_link_libraries(mmul_2 -lcublas -lcurand)


来源:https://stackoverflow.com/questions/51236835/cmake-3-11-linking-cublas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!