Unverified Commit edcecdd0 authored by czkkkkkk's avatar czkkkkkk Committed by GitHub
Browse files

[CMAKE] Move DGL cuda file declaration to the main CMakeLists.txt (#6300)

parent da1d5de2
...@@ -259,8 +259,22 @@ list(APPEND DGL_SRC ${DGL_RPC_SRC}) ...@@ -259,8 +259,22 @@ list(APPEND DGL_SRC ${DGL_RPC_SRC})
# Configure cuda # Configure cuda
if(USE_CUDA) if(USE_CUDA)
dgl_config_cuda(DGL_CUDA_SRC) file(GLOB_RECURSE DGL_CUDA_SRC
src/array/cuda/*.cc
src/array/cuda/*.cu
src/array/cuda/uvm/*.cc
src/array/cuda/uvm/*.cu
src/kernel/cuda/*.cc
src/kernel/cuda/*.cu
src/partition/cuda/*.cu
src/runtime/cuda/*.cc
src/runtime/cuda/*.cu
src/geometry/cuda/*.cu
src/graph/transform/cuda/*.cu
src/graph/sampling/randomwalks/*.cu
)
list(APPEND DGL_SRC ${DGL_CUDA_SRC}) list(APPEND DGL_SRC ${DGL_CUDA_SRC})
dgl_config_cuda(DGL_LINKER_LIBS)
cuda_add_library(dgl SHARED ${DGL_SRC}) cuda_add_library(dgl SHARED ${DGL_SRC})
else(USE_CUDA) else(USE_CUDA)
add_library(dgl SHARED ${DGL_SRC}) add_library(dgl SHARED ${DGL_SRC})
......
...@@ -203,10 +203,10 @@ function(dgl_select_nvcc_arch_flags out_variable) ...@@ -203,10 +203,10 @@ function(dgl_select_nvcc_arch_flags out_variable)
endfunction() endfunction()
################################################################################################ ################################################################################################
# Config cuda compilation. # Config cuda compilation and append CUDA libraries to linker_libs
# Usage: # Usage:
# dgl_config_cuda(<dgl_cuda_src>) # dgl_config_cuda(linker_libs)
macro(dgl_config_cuda out_variable) macro(dgl_config_cuda linker_libs)
if(NOT CUDA_FOUND) if(NOT CUDA_FOUND)
message(FATAL_ERROR "Cannot find CUDA.") message(FATAL_ERROR "Cannot find CUDA.")
endif() endif()
...@@ -216,21 +216,6 @@ macro(dgl_config_cuda out_variable) ...@@ -216,21 +216,6 @@ macro(dgl_config_cuda out_variable)
add_definitions(-DDGL_USE_CUDA) add_definitions(-DDGL_USE_CUDA)
file(GLOB_RECURSE DGL_CUDA_SRC
src/array/cuda/*.cc
src/array/cuda/*.cu
src/array/cuda/uvm/*.cc
src/array/cuda/uvm/*.cu
src/kernel/cuda/*.cc
src/kernel/cuda/*.cu
src/partition/cuda/*.cu
src/runtime/cuda/*.cc
src/runtime/cuda/*.cu
src/geometry/cuda/*.cu
src/graph/transform/cuda/*.cu
src/graph/sampling/randomwalks/*.cu
)
# NVCC flags # NVCC flags
# Manually set everything # Manually set everything
set(CUDA_PROPAGATE_HOST_FLAGS OFF) set(CUDA_PROPAGATE_HOST_FLAGS OFF)
...@@ -252,10 +237,8 @@ macro(dgl_config_cuda out_variable) ...@@ -252,10 +237,8 @@ macro(dgl_config_cuda out_variable)
message(STATUS "CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}") message(STATUS "CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}")
list(APPEND DGL_LINKER_LIBS list(APPEND ${linker_libs}
${CUDA_CUDART_LIBRARY} ${CUDA_CUDART_LIBRARY}
${CUDA_CUBLAS_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES}
${CUDA_cusparse_LIBRARY}) ${CUDA_cusparse_LIBRARY})
set(${out_variable} ${DGL_CUDA_SRC})
endmacro() endmacro()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment