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 3.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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(DEBUG_MODE "Debug mode, default off" OFF)
  9. option(ENABLE_ASAN "Enable Google Sanitizer to find memory bugs")
  10. option(ENABLE_LOAD_ANF_IR "Enable load ANF-IR as input of 'infer' stage of pipeline" OFF)
  11. option(ENABLE_COVERAGE "Enable code coverage report" OFF)
  12. option(USE_GLOG "Use glog to output log" OFF)
  13. option(ENABLE_PROFILE "Enable pipeline profile, default off" OFF)
  14. option(ENABLE_TIMELINE "Enable time line record" OFF)
  15. option(ENABLE_DUMP_PROTO "Enable dump anf graph to file in ProtoBuffer format, default on" ON)
  16. option(ENABLE_DUMP_E2E "Enable dump e2e file, default on" OFF)
  17. option(ENABLE_DUMP_IR "Enable dump funciton graph ir, default on" ON)
  18. option(ENABLE_MPI "enable mpi" OFF)
  19. option(ENABLE_AKG "enable akg" OFF)
  20. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  21. if (WIN32)
  22. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all")
  23. else()
  24. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
  25. endif()
  26. endif()
  27. if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
  28. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -Wsign-compare")
  29. endif()
  30. if (ENABLE_COVERAGE)
  31. set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
  32. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
  33. endif()
  34. if (ENABLE_ASAN)
  35. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  36. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fsanitize=undefined")
  37. else()
  38. set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libsan -fsanitize=undefined")
  39. endif()
  40. endif()
  41. if (DEBUG_MODE)
  42. set(CMAKE_BUILD_TYPE "Debug")
  43. add_compile_definitions(MEM_REUSE_DEBUG)
  44. else()
  45. set(CMAKE_BUILD_TYPE "Release")
  46. endif()
  47. if ((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
  48. set(PYBIND11_LTO_CXX_FLAGS FALSE)
  49. endif()
  50. if (NOT BUILD_PATH)
  51. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  52. endif()
  53. if (ENABLE_GE OR ENABLE_D)
  54. set(ENABLE_TDTQUE ON)
  55. endif()
  56. if (ENABLE_GPU)
  57. set(ENABLE_GPUQUE ON)
  58. add_compile_definitions(ENABLE_GPU_COLLECTIVE)
  59. endif()
  60. if (ENABLE_GE)
  61. add_compile_definitions(ENABLE_GE)
  62. add_compile_definitions(CUSTOM_OP)
  63. endif()
  64. if(ENABLE_TRAIN)
  65. add_compile_definitions(ENABLE_TRAIN=1)
  66. else()
  67. add_compile_definitions(ENABLE_TRAIN=0)
  68. endif()
  69. if(USE_GLOG)
  70. add_compile_definitions(USE_GLOG)
  71. endif()
  72. if (ENABLE_PROFILE)
  73. add_compile_definitions(ENABLE_PROFILE)
  74. endif()
  75. if (ENABLE_TIMELINE)
  76. add_compile_definitions(ENABLE_TIMELINE)
  77. endif()
  78. if (ENABLE_LOAD_ANF_IR)
  79. add_compile_definitions(ENABLE_LOAD_ANF_IR)
  80. endif()
  81. if (ENABLE_TESTCASES OR (NOT ENABLE_D AND NOT ENABLE_GE))
  82. add_compile_definitions(NO_DLIB=1)
  83. endif()
  84. if(ENABLE_DUMP_IR)
  85. add_compile_definitions(ENABLE_DUMP_IR)
  86. endif(ENABLE_DUMP_IR)
  87. if(ENABLE_MINDDATA)
  88. add_compile_definitions(ENABLE_MINDDATA)
  89. if (ENABLE_TDTQUE)
  90. add_compile_definitions(ENABLE_TDTQUE)
  91. endif()
  92. endif()
  93. if(ENABLE_DUMP_E2E)
  94. add_compile_definitions(ENABLE_DUMP_E2E)
  95. endif()