1 Star 0 Fork 0

yangdonghe/InsNet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
cmake_minimum_required(VERSION 3.8)
project(insnet CXX)
if(CMAKE_BUILD_TYPE MATCHES debug)
add_definitions(-DN3LDG_DEBUG)
message("building n3ldg++ for debug")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3 -std=c++14 -O1 -fno-inline -ggdb3" )
elseif(CMAKE_BUILD_TYPE MATCHES profile)
message("building n3ldg++ for profile")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O2 -pg -DNDEBUG" )
else()
message("building n3ldg++ for release")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -Ofast -march=native" )
endif()
IF(USE_DOUBLE)
ADD_DEFINITIONS(-DUSE_DOUBLE)
ENDIF()
IF(TEST_CUDA)
ADD_DEFINITIONS(-DTEST_CUDA)
ENDIF()
IF(DEVICE_MEMORY)
ADD_DEFINITIONS(-DDEVICE_MEMORY)
ENDIF()
include_directories(include)
include_directories(include/fmt/include)
if(USE_CUDA)
set(CUDA_SEPARABLE_COMPILATION ON)
list(APPEND CUDA_NVCC_FLAGS "--use_fast_math;-arch=compute_${CARD_NUMBER};-code=sm_${CARD_NUMBER};-std=c++14;-DVERBOSE;-DEIGEN_USE_GPU;-DHAVE_CUDA;")
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
if (CMAKE_BUILD_TYPE MATCHES debug)
list(APPEND CUDA_NVCC_FLAGS "-G")
list(APPEND CUDA_NVCC_FLAGS "-g")
list(APPEND CUDA_NVCC_FLAGS "-O1")
else()
list(APPEND CUDA_NVCC_FLAGS "-O3")
endif()
add_definitions(-DUSE_GPU)
find_package(CUDA REQUIRED)
find_cuda_helper_libs(curand)
set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_ROOT})
message("CUDA_INCLUDE: " ${CUDA_INCLUDE_DIRS})
include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_curand_LIBRARY})
message("CUDA_LIBRARIES: ${CUDA_LIBRARIES}")
set(libs ${libs} ${CUDA_LIBRARIES})
cuda_add_library(insnet_cuda include/insnet/cuda/impl.cu)
cuda_add_cublas_to_target(insnet_cuda)
target_compile_features(insnet_cuda PUBLIC cxx_std_14)
set_target_properties(insnet_cuda PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(libs ${libs} insnet_cuda)
endif()
add_subdirectory(include/fmt)
aux_source_directory(include/insnet/base insnet_src)
aux_source_directory(include/insnet/block insnet_src)
aux_source_directory(include/insnet/computation-graph insnet_src)
aux_source_directory(include/insnet/loss insnet_src)
aux_source_directory(include/insnet/nlp insnet_src)
aux_source_directory(include/insnet/operator insnet_src)
aux_source_directory(include/insnet/optimizer insnet_src)
aux_source_directory(include/insnet/param insnet_src)
aux_source_directory(include/insnet/util insnet_src)
add_library(insnet STATIC ${insnet_src})
target_include_directories(insnet PUBLIC include PUBLIC include/fmt/include)
set(libs ${libs} fmt)
target_link_libraries(insnet ${libs})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangdonghe/InsNet.git
git@gitee.com:yangdonghe/InsNet.git
yangdonghe
InsNet
InsNet
master

搜索帮助