This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
70 lines (62 loc) · 1.78 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
CMAKE_POLICY(VERSION 2.6)
FIND_PACKAGE(Torch REQUIRED)
FIND_PACKAGE(CUDA 6.5)
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "-D_OPENMP ${CMAKE_C_FLAGS}")
ENDIF ()
SET(CMAKE_C_FLAGS "-std=c11 -pedantic -Werror -Wall -Wextra -Wno-unused-function -D_GNU_SOURCE ${CMAKE_C_FLAGS}")
SET(src
src/ipc.c
src/workqueue.c
src/ringbuffer.c
src/serialize.c
src/cliser.c
src/map.c
src/spawn.c
src/flock.c
src/mutex.c
src/sharedtable.c
src/marshal.c
src/channel.c
)
SET(luasrc
lua/Tree.lua
lua/StaticTree.lua
lua/DiscoveredTree.lua
lua/LocalhostTree.lua
lua/SlurmTree.lua
lua/NullTree.lua
lua/utils.lua
lua/BackgroundTask.lua
lua/BackgroundTaskPool.lua
test/test.lua
test/test_BackgroundTask.lua
test/test_BackgroundTaskPool.lua
test/test_cliser.lua
test/test_map.lua
test/test_spawn.lua
test/test_Tree.lua
test/test_workqueue.lua
test/test_mutex.lua
test/test_sharedtable.lua
test/test_marshal.lua
test/test_channel.lua
)
ADD_TORCH_PACKAGE(ipc "${src}" "${luasrc}" "A set of primitives for ipc computation in Torch")
IF (CUDA_FOUND AND NOT ("$ENV{CUDA}" STREQUAL "NO"))
INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
INCLUDE_DIRECTORIES("${CUDA_SDK_ROOT_DIR}/common/inc")
SET(CMAKE_C_FLAGS "-DUSE_CUDA ${CMAKE_C_FLAGS}")
IF (NOT "$ENV{TH_ONLY_STATIC}" STREQUAL "YES")
TARGET_LINK_LIBRARIES(ipc luaT TH THC ${CUDA_LIBRARIES})
ENDIF()
ELSE()
TARGET_LINK_LIBRARIES(ipc luaT TH)
ENDIF()
IF (BUILD_STATIC OR "$ENV{STATIC_TH}" STREQUAL "YES")
SET_TARGET_PROPERTIES(ipc_static PROPERTIES COMPILE_FLAGS "-fPIC -DSTATIC_TH")
ENDIF()
INSTALL(FILES ${luasrc} DESTINATION "${Torch_INSTALL_LUA_PATH_SUBDIR}/ipc")