CMakeLists.txt 3.0 KB
Newer Older
D
dzhwinter 已提交
1
if (NOT WIN32)
Y
yuyang18 已提交
2
proto_library(profiler_proto SRCS profiler.proto DEPS framework_proto)
X
Xin Pan 已提交
3 4 5 6 7 8 9
py_proto_compile(profiler_py_proto SRCS profiler.proto)

add_custom_target(profiler_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)

add_dependencies(profiler_py_proto profiler_py_proto_init)

add_custom_command(TARGET profiler_py_proto POST_BUILD
10 11
        COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_BINARY_DIR}/python/paddle/fluid/proto/profiler
        COMMAND cp *.py ${PADDLE_BINARY_DIR}/python/paddle/fluid/proto/profiler
X
Xin Pan 已提交
12 13
        COMMENT "Copy generated python proto into directory paddle/fluid/proto/profiler."
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
D
dzhwinter 已提交
14
endif(NOT WIN32)
15

Q
Qiao Longfei 已提交
16
if(WITH_GPU)
17
  nv_library(enforce SRCS enforce.cc)
Q
Qiao Longfei 已提交
18 19 20 21 22
else()
  cc_library(enforce SRCS enforce.cc)
endif()
cc_test(enforce_test SRCS enforce_test.cc DEPS stringpiece enforce)

T
tensor-tang 已提交
23 24 25 26 27
set(CPU_INFO_DEPS gflags glog enforce)
IF(WITH_XBYAK)
    list(APPEND CPU_INFO_DEPS xbyak)
ENDIF()
cc_library(cpu_info SRCS cpu_info.cc DEPS ${CPU_INFO_DEPS})
L
liaogang 已提交
28
cc_test(cpu_info_test SRCS cpu_info_test.cc DEPS cpu_info)
L
liaogang 已提交
29

D
dzhwinter 已提交
30 31 32 33 34 35
set(CUDA_LIB "C:\\Program\ Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\lib\\x64")
set(MYDEPS ${MYDEPS} libcmt shlwapi)
set(MYDEPS ${MYDEPS} ${CUDA_LIB}/cudart${CMAKE_STATIC_LIBRARY_SUFFIX})
set(MYDEPS ${MYDEPS} ${CUDA_LIB}/cublas${CMAKE_STATIC_LIBRARY_SUFFIX})
set(MYDEPS ${MYDEPS} ${CUDA_LIB}/cudnn${CMAKE_STATIC_LIBRARY_SUFFIX})

Q
Qiao Longfei 已提交
36
nv_library(gpu_info SRCS gpu_info.cc DEPS gflags glog enforce)
37

D
dangqingqing 已提交
38
cc_library(place SRCS place.cc DEPS enforce boost)
L
liaogang 已提交
39
cc_test(place_test SRCS place_test.cc DEPS place glog gflags)
L
liaogang 已提交
40

L
liaogang 已提交
41
add_subdirectory(dynload)
L
liaogang 已提交
42

T
tensor-tang 已提交
43 44 45
cc_library(cpu_helper SRCS cpu_helper.cc DEPS cblas enforce)
cc_test(cpu_helper_test SRCS cpu_helper_test.cc DEPS cpu_helper)

Q
qijun 已提交
46 47 48 49 50 51
IF(WITH_GPU)
    set(GPU_CTX_DEPS dynload_cuda dynamic_loader)
ELSE()
    set(GPU_CTX_DEPS)
ENDIF()

T
tensor-tang 已提交
52 53 54 55 56 57
IF(WITH_MKLDNN)
    set(MKLDNN_CTX_DEPS mkldnn)
ELSE()
    set(MKLDNN_CTX_DEPS)
ENDIF()

58
# memcpy depends on device_context, here add deps individually for
Q
qijun 已提交
59
# avoiding cycle dependencies
60
cc_library(device_context SRCS device_context.cc init.cc DEPS malloc
D
dzhwinter 已提交
61
    place eigen3 stringpiece cpu_helper framework_proto ${GPU_CTX_DEPS} ${MKLDNN_CTX_DEPS} glog)
D
dzhwinter 已提交
62
nv_test(device_context_test SRCS device_context_test.cu DEPS device_context gpu_info)
63

64 65
cc_test(init_test SRCS init_test.cc DEPS device_context)

66
nv_test(cudnn_helper_test SRCS cudnn_helper_test.cc DEPS dynload_cuda)
D
dzhwinter 已提交
67
target_link_libraries(cudnn_helper_test ${MYDEPS})
Y
Yi Wang 已提交
68
nv_test(transform_test SRCS transform_test.cu DEPS memory place device_context)
D
dangqingqing 已提交
69

D
dzhwinter 已提交
70 71

if (NOT WIN32)
D
dzhwinter 已提交
72
cc_library(device_tracer SRCS device_tracer.cc DEPS boost profiler_proto framework_proto ${GPU_CTX_DEPS})
73
cc_library(profiler SRCS profiler.cc DEPS device_context device_tracer)
D
dangqingqing 已提交
74
cc_test(profiler_test SRCS profiler_test.cc DEPS profiler)
D
dzhwinter 已提交
75
endif(NOT WIN32)
76

77 78
nv_test(float16_gpu_test SRCS float16_test.cu DEPS lod_tensor)
cc_test(float16_test SRCS float16_test.cc DEPS lod_tensor)
79 80 81 82

IF(WITH_GPU)
  nv_test(cuda_helper_test SRCS cuda_helper_test.cu)
ENDIF()