You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

options.cmake 4.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. option(ENABLE_D "Enable d" OFF)
  2. option(ENABLE_GPU "Enable gpu" OFF)
  3. option(ENABLE_CPU "Enable cpu" OFF)
  4. option(ENABLE_GE "Enable graph engine as backend to execute" OFF)
  5. option(ENABLE_MINDDATA "Enable minddata compile" OFF)
  6. option(ENABLE_TRAIN "Enable ge train, default off(only infer)" OFF)
  7. option(ENABLE_TESTCASES "Run testcases switch, default off" OFF)
  8. option(ENABLE_CPP_ST "Run cpp st testcases switch, default off" OFF)
  9. option(DEBUG_MODE "Debug mode, default off" OFF)
  10. option(ENABLE_ASAN "Enable Google Sanitizer to find memory bugs")
  11. option(ENABLE_LOAD_ANF_IR "Enable load ANF-IR as input of 'infer' stage of pipeline" OFF)
  12. option(ENABLE_COVERAGE "Enable code coverage report" OFF)
  13. option(USE_GLOG "Use glog to output log" OFF)
  14. option(ENABLE_SECURITY "Enable security, maintenance function will be disabled, default off" OFF)
  15. option(ENABLE_PROFILE "Enable pipeline profile, default off" OFF)
  16. option(ENABLE_TIMELINE "Enable time line record" OFF)
  17. option(ENABLE_DUMP_PROTO "Enable dump anf graph to file in ProtoBuffer format, default on" ON)
  18. option(ENABLE_DUMP_IR "Enable dump function graph ir, default on" ON)
  19. option(ENABLE_MPI "enable mpi" OFF)
  20. option(ENABLE_AKG "enable akg" OFF)
  21. option(ENABLE_DEBUGGER "enable debugger" OFF)
  22. option(ENABLE_IBVERBS "enable IBVERBS for parameter server" OFF)
  23. option(ENABLE_PYTHON "Enable python" ON)
  24. option(ENABLE_ACL "enable acl" OFF)
  25. option(ENABLE_GLIBCXX "enable_glibcxx" OFF)
  26. option(MODE_ASCEND_ALL "supports all ascend platform" OFF)
  27. option(MODE_ASCEND_ACL "supports ascend acl mode only" OFF)
  28. option(ENABLE_SYM_FILE "enable sym file" OFF)
  29. if(NOT ENABLE_D AND NOT ENABLE_TESTCASES AND NOT ENABLE_ACL AND NOT ENABLE_GE)
  30. set(ENABLE_GLIBCXX ON)
  31. endif()
  32. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  33. if(WIN32)
  34. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all")
  35. else()
  36. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
  37. endif()
  38. endif()
  39. if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
  40. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -Wsign-compare")
  41. endif()
  42. if(ENABLE_COVERAGE)
  43. set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
  44. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
  45. endif()
  46. if(ENABLE_ASAN)
  47. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer")
  48. if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  49. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -static-libsan")
  50. endif()
  51. endif()
  52. if(DEBUG_MODE)
  53. set(CMAKE_BUILD_TYPE "Debug")
  54. add_compile_definitions(MEM_REUSE_DEBUG)
  55. else()
  56. set(CMAKE_BUILD_TYPE "Release")
  57. endif()
  58. if((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
  59. set(PYBIND11_LTO_CXX_FLAGS FALSE)
  60. endif()
  61. if(NOT BUILD_PATH)
  62. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  63. endif()
  64. if(ENABLE_GE OR ENABLE_D)
  65. set(ENABLE_TDTQUE ON)
  66. endif()
  67. if(ENABLE_GPU)
  68. set(ENABLE_GPUQUE ON)
  69. add_compile_definitions(ENABLE_GPU_COLLECTIVE)
  70. endif()
  71. if(ENABLE_CPU)
  72. add_compile_definitions(ENABLE_CPU)
  73. endif()
  74. if(ENABLE_GE)
  75. add_compile_definitions(ENABLE_GE)
  76. add_compile_definitions(CUSTOM_OP)
  77. endif()
  78. if(ENABLE_TRAIN)
  79. add_compile_definitions(ENABLE_TRAIN=1)
  80. else()
  81. add_compile_definitions(ENABLE_TRAIN=0)
  82. endif()
  83. if(USE_GLOG)
  84. add_compile_definitions(USE_GLOG)
  85. endif()
  86. if(ENABLE_PROFILE)
  87. add_compile_definitions(ENABLE_PROFILE)
  88. endif()
  89. if(ENABLE_SECURITY)
  90. add_compile_definitions(ENABLE_SECURITY)
  91. endif()
  92. if(ENABLE_TIMELINE)
  93. add_compile_definitions(ENABLE_TIMELINE)
  94. endif()
  95. if(ENABLE_LOAD_ANF_IR)
  96. add_compile_definitions(ENABLE_LOAD_ANF_IR)
  97. endif()
  98. if(ENABLE_TESTCASES OR (NOT ENABLE_D AND NOT ENABLE_GE))
  99. add_compile_definitions(NO_DLIB=1)
  100. endif()
  101. if(ENABLE_DUMP_IR)
  102. add_compile_definitions(ENABLE_DUMP_IR)
  103. endif()
  104. if(ENABLE_MINDDATA)
  105. add_compile_definitions(ENABLE_MINDDATA)
  106. if(ENABLE_TDTQUE)
  107. add_compile_definitions(ENABLE_TDTQUE)
  108. endif()
  109. endif()
  110. if(ENABLE_DEBUGGER)
  111. add_compile_definitions(ENABLE_DEBUGGER)
  112. endif()
  113. if(ENABLE_DEBUGGER OR ENABLE_TESTCASES)
  114. set(MS_BUILD_GRPC ON)
  115. endif()
  116. if(ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
  117. set(MS_BUILD_GRPC ON)
  118. endif()
  119. if(ENABLE_D AND ENABLE_ACL)
  120. set(MODE_ASCEND_ALL ON)
  121. endif()
  122. if(ENABLE_ACL AND NOT ENABLE_D)
  123. set(MODE_ASCEND_ACL ON)
  124. endif()
  125. if(ENABLE_CPU AND NOT WIN32)
  126. add_compile_definitions(ENABLE_ARMOUR)
  127. endif()