-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (29 loc) · 1.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cmake_minimum_required(VERSION 2.8)
project(tpu-train)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install"
CACHE PATH "default install path" FORCE)
endif()
if(NOT DEFINED ENV{TPUTRAIN_TOP})
message(FATAL_ERROR "execute envsetup.sh first")
endif()
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install prefix")
message(STATUS "CMAKE PREFIX: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Building torch-tpu for chip $ENV{CHIP_ARCH}")
# ftp package
string(TIMESTAMP BUILD_TIME "%Y%m%d")
set(TORCHTPU_VERSION "${BUILD_TIME}" CACHE STRING "torch-tpu version" FORCE)
message(STATUS "torch-tpu version: ${TORCHTPU_VERSION}")
add_definitions(-DTORCHTPU_VERSION="${TORCHTPU_VERSION}")
include(${PROJECT_SOURCE_DIR}/config_common.cmake)
if (BACKEND_SG2260)
add_subdirectory(third_party/gloo_sophon)
endif()
set(PROJECT_ROOT ${PROJECT_SOURCE_DIR})
add_subdirectory(sgdnn)
add_subdirectory(torch_tpu)