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.

common_enum_c.h 2.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * \file inlude/lite/common_enum_c.h
  3. *
  4. * This file is part of MegEngine, a deep learning framework developed by
  5. * Megvii.
  6. *
  7. * \copyright Copyright (c) 2020-2021 Megvii Inc. All rights reserved.
  8. */
  9. #ifndef LITE_COMMON_ENUM_C_H_
  10. #define LITE_COMMON_ENUM_C_H_
  11. /*!
  12. * \brief The log level.
  13. */
  14. typedef enum LiteLogLevel {
  15. DEBUG = 0, /*!< The lowest level and most verbose */
  16. INFO = 1, /*!< The lowest level and most verbose */
  17. WARN = 2, /*!< Print only warning and errors */
  18. ERROR = 3, /*!< Print only errors */
  19. } LiteLogLevel;
  20. typedef enum LiteBackend {
  21. LITE_DEFAULT = 0, //! default backend is mge
  22. } LiteBackend;
  23. typedef enum LiteDeviceType {
  24. LITE_CPU = 0,
  25. LITE_CUDA = 1,
  26. LITE_ATLAS = 3,
  27. LITE_NPU = 4,
  28. //! when the device information is set in model, so set LITE_DEVICE_DEFAULT
  29. //! in lite
  30. LITE_DEVICE_DEFAULT = 5,
  31. } LiteDeviceType;
  32. typedef enum LiteDataType {
  33. LITE_FLOAT = 0,
  34. LITE_HALF = 1,
  35. LITE_INT = 2,
  36. LITE_INT16 = 3,
  37. LITE_INT8 = 4,
  38. LITE_UINT8 = 5,
  39. LITE_UINT = 6,
  40. LITE_UINT16 = 7,
  41. LITE_INT64 = 8,
  42. } LiteCDataType;
  43. typedef enum LiteTensorPhase {
  44. //! Tensor maybe input or output
  45. LITE_IO = 0,
  46. //! Tensor is input
  47. LITE_INPUT = 1,
  48. //! Tensor is output
  49. LITE_OUTPUT = 2,
  50. } LiteTensorPhase;
  51. /*!
  52. * \brief the input and output type, include SHAPE and VALUE
  53. * sometimes user only need the shape of the output tensor
  54. */
  55. typedef enum LiteIOType {
  56. LITE_IO_VALUE = 0,
  57. LITE_IO_SHAPE = 1,
  58. } LiteIOType;
  59. /*!
  60. * \brief operation algorithm seletion strategy type, some operations have
  61. * multi algorithms, different algorithm has different attribute, according to
  62. * the strategy, the best algorithm will be selected.
  63. *
  64. * Note: These strategies can be combined
  65. *
  66. * 1. LITE_ALGO_HEURISTIC | LITE_ALGO_PROFILE means: if profile cache not valid,
  67. * use heuristic instead
  68. *
  69. * 2. LITE_ALGO_HEURISTIC | LITE_ALGO_REPRODUCIBLE means: heuristic choice the
  70. * reproducible algo
  71. *
  72. * 3. LITE_ALGO_PROFILE | LITE_ALGO_REPRODUCIBLE means: profile the best
  73. * algorithm from the reproducible algorithms set
  74. *
  75. * 4. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED means: profile the best
  76. * algorithm form the optimzed algorithms, thus profile will process fast
  77. *
  78. * 5. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED | LITE_ALGO_REPRODUCIBLE means:
  79. * profile the best algorithm form the optimzed and reproducible algorithms
  80. */
  81. typedef enum LiteAlgoSelectStrategy {
  82. LITE_ALGO_HEURISTIC = 1 << 0,
  83. LITE_ALGO_PROFILE = 1 << 1,
  84. LITE_ALGO_REPRODUCIBLE = 1 << 2,
  85. LITE_ALGO_OPTIMIZED = 1 << 3,
  86. } LiteAlgoSelectStrategy;
  87. #endif
  88. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台