You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/12/10 07:22:22 UTC

[GitHub] [incubator-mxnet] yajiedesign commented on a change in pull request #17031: Use CMake standard library to handle CUDA

yajiedesign commented on a change in pull request #17031: Use CMake standard library to handle CUDA
URL: https://github.com/apache/incubator-mxnet/pull/17031#discussion_r355875769
 
 

 ##########
 File path: CMakeLists.txt
 ##########
 @@ -620,61 +594,17 @@ if(MSVC)
 endif()
 
 if(USE_CUDA)
-  if(FIRST_CUDA)
-    mshadow_select_nvcc_arch_flags(NVCC_FLAGS_ARCH)
-    string(REPLACE ";" " " NVCC_FLAGS_ARCH "${NVCC_FLAGS_ARCH}")
-    set(CMAKE_CUDA_FLAGS "${NVCC_FLAGS_ARCH}")
-    list(APPEND mxnet_LINKER_LIBS cublas cufft cusolver curand)
-    if(ENABLE_CUDA_RTC)
-        list(APPEND mxnet_LINKER_LIBS nvrtc cuda)
-        add_definitions(-DMXNET_ENABLE_CUDA_RTC=1)
-    endif()
-    list(APPEND SOURCE ${CUDA})
-    add_definitions(-DMXNET_USE_CUDA=1)
-    link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64)
-  else()
-    list(APPEND CUDA_INCLUDE_DIRS ${INCLUDE_DIRECTORIES})
-    # define preprocessor macro so that we will not include the generated forcelink header
-    if(ENABLE_CUDA_RTC)
-      add_definitions(-DMXNET_ENABLE_CUDA_RTC=1)
-    endif()
-    # Create '.cmake' files for cuda compiles given definitions added thus far
-    mshadow_cuda_compile(cuda_objs ${CUDA})
-    if(MSVC)
-        if(ENABLE_CUDA_RTC)
-            FIND_LIBRARY(CUDA_nvrtc_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64"  "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32")
-            list(APPEND mxnet_LINKER_LIBS ${CUDA_nvrtc_LIBRARY})
-            set(CUDA_cuda_LIBRARY "${CUDA_nvrtc_LIBRARY}/../cuda.lib")
-            list(APPEND mxnet_LINKER_LIBS ${CUDA_cuda_LIBRARY})
-        endif()
-        FIND_LIBRARY(CUDA_cufft_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64"  "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32")
-        list(APPEND mxnet_LINKER_LIBS "${CUDA_cufft_LIBRARY}/../cufft.lib") # For fft operator
-        FIND_LIBRARY(CUDA_cusolver_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64"  "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32")
-        list(APPEND mxnet_LINKER_LIBS "${CUDA_cusolver_LIBRARY}/../cusolver.lib") # For cusolver
-        link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib/win32)
-        link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib/x64)
-    else(MSVC)
-        list(APPEND mxnet_LINKER_LIBS cufft cusolver)
-        if(ENABLE_CUDA_RTC)
-            list(APPEND mxnet_LINKER_LIBS nvrtc cuda)
-        endif()
-        link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
-    endif()
-    list(APPEND SOURCE ${cuda_objs} ${CUDA})
-    add_definitions(-DMXNET_USE_CUDA=1)
-    if(CUDA_LIBRARY_PATH)
-        if(IS_CONTAINER_BUILD)
-        # In case of building on a production-like build container which may not have Cuda installed
-        if(NOT CMAKE_SYSTEM_HAS_CUDA)
-            # Assuming building in a container that doesn't have CUDA installed (ie CPU-only build machine)
-            # so use the stub cuda driver shared library
-            if(EXISTS ${CUDA_LIBRARY_PATH}/stubs/libcuda.so)
-            link_directories(${CUDA_LIBRARY_PATH}/stubs)
-            endif()
-        endif()
-        endif()
-    endif()
- endif()
+  CUDA_SELECT_NVCC_ARCH_FLAGS(NVCC_FLAGS_ARCH Auto)
 
 Review comment:
   CUDA_SELECT_NVCC_ARCH_FLAGS look like deprecated 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services