parent
fd4a00e050
commit
48ec7311bb
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
#set(CMAKE_GNUtoMS ON) #https://gitlab.kitware.com/cmake/cmake/-/issues/19171
|
||||
|
||||
project(libnd4j C CXX)
|
||||
project(libnd4j)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
|||
message("CMAKE MODULE PATH IS ${CMAKE_MODULE_PATH}")
|
||||
|
||||
#ensure we create lib files
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
|
||||
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
|
||||
|
||||
|
||||
option(SD_NATIVE "Optimize for build machine (might not work on others)" OFF)
|
||||
|
@ -26,7 +26,6 @@ set(FLATBUFFERS_BUILD_FLATC "OFF" CACHE STRING "Hack to disable flatc build" FOR
|
|||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
#///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -124,8 +123,8 @@ endfunction()
|
|||
|
||||
|
||||
if (SD_CUDA)
|
||||
#enable_language(CUDA)
|
||||
find_package(CUDAToolkit 12.2 REQUIRED)
|
||||
enable_language(CUDA)
|
||||
message(STATUS "CUDAToolkit_VERSION: ${CUDAToolkit_VERSION}")
|
||||
message(STATUS "CUDAToolkit_VERSION_MAJOR: ${CUDAToolkit_VERSION_MAJOR}")
|
||||
message(STATUS "CUDAToolkit_VERSION_MINOR: ${CUDAToolkit_VERSION_MINOR}")
|
||||
|
@ -141,7 +140,7 @@ else()
|
|||
endif()
|
||||
|
||||
# MSVC runtime lib can be either "MultiThreaded" or "MultiThreadedDLL", /MT and /MD respectively
|
||||
#set(MSVC_RT_LIB "MultiThreadedDLL")
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
||||
|
||||
set(SD_X86_BUILD false)
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ chipList.each { String thisChip ->
|
|||
if (thisChip.equals('cuda') && osdetector.os.startsWith("windows")) { //cuDNN requires CUDA
|
||||
it.buildCommand = ['sh', 'buildnativeoperations.sh',
|
||||
'-V',
|
||||
'--build-type', 'release',
|
||||
'--build-type', 'debug',
|
||||
'--chip', thisChip,
|
||||
'--plattform', 'x86_64',
|
||||
'--chip-extension', avxExtension,
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
# ******************************************************************************/
|
||||
#
|
||||
|
||||
env
|
||||
|
||||
#env
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
@ -163,8 +163,8 @@ endif()
|
|||
|
||||
|
||||
if(SD_CUDA)
|
||||
find_package(CUDAToolkit)
|
||||
enable_language(CUDA)
|
||||
#find_package(CUDAToolkit)
|
||||
#enable_language(CUDA)
|
||||
|
||||
set(CMAKE_CUDA_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
@ -204,19 +204,19 @@ if(SD_CUDA)
|
|||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-fPIC")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
message("In windows, setting cublas library and cusolver library")
|
||||
if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
endif()
|
||||
endif()
|
||||
# if(WIN32)
|
||||
# message("In windows, setting cublas library and cusolver library")
|
||||
# if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
# set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
# endif()
|
||||
|
||||
# if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
# set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
# endif()
|
||||
# endif()
|
||||
|
||||
#set(CMAKE_CUDA_FLAGS " ${CMAKE_CUDA_FLAGS} -DCUDA_VERSION_MAJOR=${CUDA_VERSION_MAJOR} ${EXPM} -w --cudart=static --expt-extended-lambda -Xfatbin -compress-all ")
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY "shared")
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_53,code=[compute_53,sm_53]\" " )
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_61,code=[compute_61,sm_61]\" " )
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_75,code=[compute_75,sm_75]\" " )
|
||||
|
@ -227,7 +227,6 @@ if(SD_CUDA)
|
|||
if(WIN32)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=/EHsc")
|
||||
endif()
|
||||
#set(GPU_ARCH)
|
||||
|
||||
message("CMAKE_CUDA_FLAGS = ${CMAKE_CUDA_FLAGS}")
|
||||
message("CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
|
||||
|
@ -239,6 +238,7 @@ if(SD_CUDA)
|
|||
message("CUDA_ARCH_FLAGS = ${CUDA_ARCH_FLAGS}")
|
||||
message("CUDAHOSTCXX = ${CUDAHOSTCXX}")
|
||||
message("CMAKE_CUDA_ARCHITECTURES = ${CMAKE_CUDA_ARCHITECTURES}")
|
||||
message("CMAKE_CUDA_RUNTIME_LIBRARY = ${CMAKE_CUDA_RUNTIME_LIBRARY}")
|
||||
|
||||
file(GLOB_RECURSE PERF_SOURCES false performance/*.cpp performance/*.h)
|
||||
file(GLOB_RECURSE EXCEPTIONS_SOURCES false exceptions/*.cpp exceptions/*.h)
|
||||
|
@ -293,18 +293,18 @@ if(SD_CUDA)
|
|||
# if both static and shared library are going to be built - static library will have special suffix
|
||||
message("Will build a static library '${SD_LIBRARY_NAME}static'.")
|
||||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME}static DESTINATION .)
|
||||
elseif(SD_STATIC_LIB)
|
||||
# if we only build static library - use this name
|
||||
add_library(${SD_LIBRARY_NAME} STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
endif()
|
||||
|
||||
# on windows we want to make sure we use MT or MD, but since we use it in one lib, we must use it everywhere to avoid conflicts
|
||||
set_property(TARGET samediff_obj PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET samediff_obj PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
# Done by nvcc as default on windows
|
||||
if(WIN32)
|
||||
|
@ -426,13 +426,13 @@ elseif(SD_CPU)
|
|||
# if both static and shared library are going to be built - static library will have special suffix
|
||||
message("Adding a static library for ${SD_LIBRARY_NAME} as ${SD_LIBRARY_NAME}static")
|
||||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME}static DESTINATION .)
|
||||
elseif(SD_STATIC_LIB)
|
||||
# if we only build static library - use this name
|
||||
message(Only building a static library for ${SD_LIBRARY_NAME})
|
||||
add_library(${SD_LIBRARY_NAME} STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -39,4 +39,7 @@ org.gradle.jvmargs=-Dorg.gradle.jvmargs=-Dorg.gradle.internal.http.connectionTim
|
|||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# org.gradle.parallel=true
|
||||
|
||||
systemProp.org.gradle.internal.http.connectionTimeout=120000
|
||||
systemProp.org.gradle.internal.http.socketTimeout=120000
|
Loading…
Reference in New Issue