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.

context.h 1.5 kB

5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MINDSPORE_LITE_INTERNAL_INCLUDE_CONTEXT_H_
  17. #define MINDSPORE_LITE_INTERNAL_INCLUDE_CONTEXT_H_
  18. /// \brief CpuBindMode defined for holding bind cpu strategy argument.
  19. typedef enum {
  20. NO_BIND = 0, /**< no bind */
  21. HIGHER_CPU = 1, /**< bind higher cpu first */
  22. MID_CPU = 2 /**< bind middle cpu first */
  23. } CpuBindMode;
  24. /// \brief DeviceType defined for holding user's preferred backend.
  25. typedef enum {
  26. DT_CPU, /**< CPU device type */
  27. DT_GPU, /**< GPU device type */
  28. DT_NPU /**< NPU device type, not supported yet */
  29. } DeviceType;
  30. /// \brief Context defined for holding environment variables during runtime.
  31. typedef struct {
  32. bool float16_priority = false; /**< prior enable float16 inference */
  33. DeviceType device_type_ = DT_CPU;
  34. int thread_num_ = 2; /**< thread number config for thread pool */
  35. } Context;
  36. #endif // MINDSPORE_LITE_INCLUDE_CONTEXT_H_