CMakeLists.txt 2.1 KB
Newer Older
1
proto_library(profiler_proto SRCS profiler.proto)
X
Xin Pan 已提交
2 3 4 5 6 7 8
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
9 10
        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 已提交
11 12
        COMMENT "Copy generated python proto into directory paddle/fluid/proto/profiler."
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
13

Q
Qiao Longfei 已提交
14
if(WITH_GPU)
Y
Yang Yang(Tony) 已提交
15
  cc_library(enforce SRCS enforce.cc DEPS)
Q
Qiao Longfei 已提交
16 17 18 19 20 21
else()
  cc_library(enforce SRCS enforce.cc)
endif()
cc_test(enforce_test SRCS enforce_test.cc DEPS stringpiece enforce)

cc_library(cpu_info SRCS cpu_info.cc DEPS gflags glog enforce)
L
liaogang 已提交
22
cc_test(cpu_info_test SRCS cpu_info_test.cc DEPS cpu_info)
L
liaogang 已提交
23

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

D
dangqingqing 已提交
26
cc_library(place SRCS place.cc DEPS enforce boost)
L
liaogang 已提交
27
cc_test(place_test SRCS place_test.cc DEPS place glog gflags)
L
liaogang 已提交
28

L
liaogang 已提交
29
add_subdirectory(dynload)
L
liaogang 已提交
30

Q
qijun 已提交
31 32 33 34 35 36
IF(WITH_GPU)
    set(GPU_CTX_DEPS dynload_cuda dynamic_loader)
ELSE()
    set(GPU_CTX_DEPS)
ENDIF()

T
tensor-tang 已提交
37 38 39 40 41 42
IF(WITH_MKLDNN)
    set(MKLDNN_CTX_DEPS mkldnn)
ELSE()
    set(MKLDNN_CTX_DEPS)
ENDIF()

43
# memcpy depends on device_context, here add deps individually for
Q
qijun 已提交
44 45
# avoiding cycle dependencies
cc_library(device_context SRCS device_context.cc DEPS memory buddy_allocator
Y
Yi Wang 已提交
46
    place eigen3 ${GPU_CTX_DEPS} ${MKLDNN_CTX_DEPS})
D
dzhwinter 已提交
47
nv_test(device_context_test SRCS device_context_test.cu DEPS device_context gpu_info)
48 49

nv_test(cudnn_helper_test SRCS cudnn_helper_test.cc DEPS dynload_cuda)
Y
Yu Yang 已提交
50
nv_test(transform_test SRCS transform_test.cu DEPS paddle_memory place device_context)
D
dangqingqing 已提交
51

52
cc_library(device_tracer SRCS device_tracer.cc DEPS boost profiler_proto ${GPU_CTX_DEPS})
53
cc_library(profiler SRCS profiler.cc DEPS device_context device_tracer)
D
dangqingqing 已提交
54
cc_test(profiler_test SRCS profiler_test.cc DEPS profiler)
55 56 57

nv_test(float16_gpu_test SRCS float16_test.cu)
cc_test(float16_test SRCS float16_test.cc)