mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
CUDA fixes
Fix NCCL build move CUDA dep into Dependencies file
This commit is contained in:
@ -113,9 +113,6 @@ target_link_libraries(Caffe2_CPU Caffe2_PROTO)
|
||||
|
||||
# CUDA library
|
||||
# TODO(slayton): Move this somewhere sane
|
||||
find_package(CUDA)
|
||||
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler -std=c++11)
|
||||
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_52,code=sm_52)
|
||||
CUDA_ADD_LIBRARY(Caffe2_GPU ${Caffe2_GPU_SRCS})
|
||||
target_link_libraries(Caffe2_GPU Caffe2_CPU Caffe2_PROTO glog gflags atlas cblas)
|
||||
|
||||
|
@ -55,15 +55,9 @@ endif()
|
||||
|
||||
# ---[ CUDA
|
||||
include(cmake/Cuda.cmake)
|
||||
if(NOT HAVE_CUDA)
|
||||
if(CPU_ONLY)
|
||||
message(STATUS "-- CUDA is disabled. Building without it...")
|
||||
else()
|
||||
message(WARNING "-- CUDA is not detected by cmake. Building without it...")
|
||||
endif()
|
||||
|
||||
# TODO: remove this not cross platform define in future. Use caffe_config.h instead.
|
||||
add_definitions(-DCPU_ONLY)
|
||||
if(HAVE_CUDA)
|
||||
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler -std=c++11)
|
||||
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_52,code=sm_52)
|
||||
endif()
|
||||
|
||||
# ---[ NCCL
|
||||
|
10
cmake/External/nccl.cmake
vendored
10
cmake/External/nccl.cmake
vendored
@ -6,12 +6,8 @@ if (NOT __NCCL_INCLUDED)
|
||||
if (NCCL_FOUND)
|
||||
set(NCCL_EXTERNAL FALSE)
|
||||
else()
|
||||
# fetch and build glog from github
|
||||
|
||||
# build directory
|
||||
set(nccl_PREFIX ${CMAKE_SOURCE_DIR}/third_party/nccl)
|
||||
# install directory
|
||||
set(nccl_INSTALL ${CMAKE_BINARY_DIR}/external/nccl-install)
|
||||
|
||||
# we build glog statically, but want to link it into the caffe shared library
|
||||
# this requires position-independent code
|
||||
@ -31,9 +27,9 @@ if (NOT __NCCL_INCLUDED)
|
||||
)
|
||||
|
||||
set(NCCL_FOUND TRUE)
|
||||
set(NCCL_INCLUDE_DIRS ${nccl_INSTALL}/include)
|
||||
set(NCCL_LIBRARIES ${nccl_INSTALL}/lib/libnccl.a)
|
||||
set(NCCL_LIBRARY_DIRS ${nccl_INSTALL}/lib)
|
||||
set(NCCL_INCLUDE_DIRS ${nccl_PREFIX}/build/include)
|
||||
set(NCCL_LIBRARIES ${nccl_PREFIX}/build/lib/libnccl.so)
|
||||
set(NCCL_LIBRARY_DIRS ${nccl_PREFIX}/build/lib)
|
||||
set(NCCL_EXTERNAL TRUE)
|
||||
|
||||
list(APPEND external_project_dependencies nccl_external)
|
||||
|
Reference in New Issue
Block a user