[Parallel_libs-commits] [PATCH] D24580: [SE] Let users specify CUDA path
Jason Henline via Parallel_libs-commits
parallel_libs-commits at lists.llvm.org
Wed Sep 14 14:07:50 PDT 2016
jhen updated this revision to Diff 71429.
jhen added a comment.
- Use CMake's standard FindCUDA
https://reviews.llvm.org/D24580
Files:
streamexecutor/CMakeLists.txt
streamexecutor/lib/CMakeLists.txt
streamexecutor/lib/platforms/cuda/cmake/modules/FindLibcuda.cmake
Index: streamexecutor/lib/platforms/cuda/cmake/modules/FindLibcuda.cmake
===================================================================
--- streamexecutor/lib/platforms/cuda/cmake/modules/FindLibcuda.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# - Try to find the libcuda library
-# Once done this will define
-# LIBCUDA_FOUND - System has libcuda
-# LIBCUDA_INCLUDE_DIRS - The libcuda include directories
-# LIBCUDA_LIBRARIES - The libraries needed to use libcuda
-
-# TODO(jhen): Allow users to specify a search path.
-find_path(LIBCUDA_INCLUDE_DIR cuda.h /usr/local/cuda/include)
-# TODO(jhen): Use the library that goes with the headers.
-find_library(LIBCUDA_LIBRARY cuda)
-
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set LIBCUDA_FOUND to TRUE if
-# all listed variables are TRUE
-find_package_handle_standard_args(
- LIBCUDA DEFAULT_MSG LIBCUDA_INCLUDE_DIR LIBCUDA_LIBRARY)
-
-mark_as_advanced(LIBCUDA_INCLUDE_DIR LIBCUDA_LIBRARY)
-
-set(LIBCUDA_LIBRARIES ${LIBCUDA_LIBRARY})
-set(LIBCUDA_INCLUDE_DIRS ${LIBCUDA_INCLUDE_DIR})
Index: streamexecutor/lib/CMakeLists.txt
===================================================================
--- streamexecutor/lib/CMakeLists.txt
+++ streamexecutor/lib/CMakeLists.txt
@@ -4,21 +4,20 @@
endmacro(add_se_library)
if(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM)
- set(
- CMAKE_MODULE_PATH
- ${CMAKE_MODULE_PATH}
- "${CMAKE_CURRENT_SOURCE_DIR}/platforms/cuda/cmake/modules/")
-
- find_package(Libcuda REQUIRED)
- include_directories(${LIBCUDA_INCLUDE_DIRS})
-
+ find_package(CUDA REQUIRED)
+ include_directories(${CUDA_INCLUDE_DIRS})
+ find_library(CUDA_DRIVER_LIBRARY cuda)
+ if(NOT CUDA_DRIVER_LIBRARY)
+ message(FATAL_ERROR
+ "could not find libcuda, \
+is the CUDA driver is installed on your system?")
+ endif()
set(
STREAM_EXECUTOR_CUDA_PLATFORM_TARGET_OBJECT
$<TARGET_OBJECTS:streamexecutor_cuda_platform>)
-
set(
STREAM_EXECUTOR_LIBCUDA_LIBRARIES
- ${LIBCUDA_LIBRARIES})
+ ${CUDA_DRIVER_LIBRARY})
endif(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM)
add_subdirectory(platforms)
Index: streamexecutor/CMakeLists.txt
===================================================================
--- streamexecutor/CMakeLists.txt
+++ streamexecutor/CMakeLists.txt
@@ -2,10 +2,18 @@
option(STREAM_EXECUTOR_UNIT_TESTS "enable unit tests" ON)
option(STREAM_EXECUTOR_ENABLE_DOXYGEN "enable StreamExecutor doxygen" ON)
-option(STREAM_EXECUTOR_ENABLE_CONFIG_TOOL "enable building streamexecutor-config tool" ON)
-option(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM "enable building the CUDA StreamExecutor platform" OFF)
-
-configure_file("include/streamexecutor/PlatformOptions.h.in" "include/streamexecutor/PlatformOptions.h")
+option(
+ STREAM_EXECUTOR_ENABLE_CONFIG_TOOL
+ "enable building streamexecutor-config tool"
+ ON)
+option(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM
+ "enable building the CUDA StreamExecutor platform \
+(see CMake's 'FindCUDA' documentation for info on specifying the CUDA path)"
+ OFF)
+
+configure_file(
+ "include/streamexecutor/PlatformOptions.h.in"
+ "include/streamexecutor/PlatformOptions.h")
# First find includes relative to the streamexecutor top-level source path.
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24580.71429.patch
Type: text/x-patch
Size: 3377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/parallel_libs-commits/attachments/20160914/ac1e5e42/attachment.bin>
More information about the Parallel_libs-commits
mailing list