CMakeLists.txt 1.7 KB
Newer Older
1 2
include(ExternalProject)

3
cc_library(memory_block SRCS memory_block.cc memory_block_desc.cc meta_cache.cc DEPS place)
Y
Yi Wang 已提交
4

5 6
set(system_allocator_DEPS gflags cpu_info place)

Y
Yi Wang 已提交
7
if(${WITH_GPU})
8
  nv_library(system_allocator SRCS system_allocator.cc DEPS gflags cpu_info gpu_info place)
9 10 11
elseif(${WITH_ASCEND_CL})
  cc_library(system_allocator SRCS system_allocator.cc DEPS gflags cpu_info npu_info place)
else()
12
  cc_library(system_allocator SRCS system_allocator.cc DEPS gflags cpu_info place)
13
endif()
14

L
liaogang 已提交
15
cc_test(system_allocator_test SRCS system_allocator_test.cc DEPS system_allocator)
L
liaogang 已提交
16

Y
Yi Wang 已提交
17
cc_library(buddy_allocator SRCS buddy_allocator.cc DEPS memory_block system_allocator glog)
18 19

cc_test(buddy_allocator_test SRCS buddy_allocator_test.cc DEPS buddy_allocator)
20

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
FUNCTION(file_download_and_uncompress URL NAME)
  MESSAGE(STATUS "Download dependence[${NAME}] from ${URL}")
  SET(${NAME}_INCLUDE_DIR ${THIRD_PARTY_PATH}/${NAME} PARENT_SCOPE)
  ExternalProject_Add(
      extern_download_${NAME}
      ${EXTERNAL_PROJECT_LOG_ARGS}
      PREFIX                ${THIRD_PARTY_PATH}/${NAME}
      URL                   ${URL}
      DOWNLOAD_DIR          ${THIRD_PARTY_PATH}/${NAME}
      SOURCE_DIR            ${THIRD_PARTY_PATH}/${NAME}
      DOWNLOAD_NO_PROGRESS  1
      CONFIGURE_COMMAND     ""
      BUILD_COMMAND         ""
      UPDATE_COMMAND        ""
      INSTALL_COMMAND       ""
    )
  set(third_party_deps ${third_party_deps} extern_download_${NAME} PARENT_SCOPE)
ENDFUNCTION()

40
if(WITH_TESTING)
41 42 43
  if(TEST buddy_allocator_test)
    set_tests_properties(buddy_allocator_test PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE")
  endif()
44 45
  set(URL "https://paddle-ci.cdn.bcebos.com/buddy_allocator_test_data.tar")
  file_download_and_uncompress(URL "buddy_allocator")
46
endif()