Skip to content

Commit

Permalink
Provide a better error message when CUDA::cuda_driver not found (#8794
Browse files Browse the repository at this point in the history
)

cuDF JITIFY sources require the the CUDA driver ( libcuda.so ) or
stub to exist for correct compilation/linking. If they can't be
found explain why, instead of producing a bad error message

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Mark Harris (https://github.com/harrism)

URL: #8794
  • Loading branch information
robertmaynard authored Jul 22, 2021
1 parent d462756 commit 41f5634
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,22 @@ if(CUDA_STATIC_RUNTIME)
# Tell CMake what CUDA language runtime to use
set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Static)
# Make sure to export to consumers what runtime we used
target_link_libraries(cudf PUBLIC CUDA::cudart_static CUDA::cuda_driver)
target_link_libraries(cudf PUBLIC CUDA::cudart_static)
else()
# Tell CMake what CUDA language runtime to use
set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
# Make sure to export to consumers what runtime we used
target_link_libraries(cudf PUBLIC CUDA::cudart CUDA::cuda_driver)
target_link_libraries(cudf PUBLIC CUDA::cudart)
endif()

# The CUDA::cuda_driver is needed due to JITIFY sources which
# directly call the cuda driver API
if(NOT TARGET CUDA::cuda_driver)
message(FATAL_ERROR "Building libcudf requires `libcuda.so` to be present.
This error often occurs when trying to build libcudf from a container without the NVIDIA runtime loaded.")
endif()
target_link_libraries(cudf PRIVATE CUDA::cuda_driver)

# Add cuFile interface if available
if(TARGET cuFile::cuFile_interface)
target_link_libraries(cudf PRIVATE cuFile::cuFile_interface)
Expand Down

0 comments on commit 41f5634

Please sign in to comment.