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.

megcore_cdefs.h 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * \file dnn/include/megcore_cdefs.h
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #pragma once
  12. #include <stdint.h>
  13. /**
  14. * \brief MegCore platform types
  15. */
  16. typedef enum {
  17. megcorePlatformCPU = 1,
  18. megcorePlatformCUDA = 4,
  19. } megcorePlatform_t;
  20. /**
  21. * \brief MegCore return codes
  22. *
  23. * Note: since MegCore has been merged into MegDNN and uses C++ API with
  24. * exception, this return status only serves for backward compatibility and all
  25. * API would return megcoreSuccess
  26. */
  27. typedef enum {
  28. megcoreSuccess = 0,
  29. megcoreErrorMemoryAllocation = 1,
  30. megcoreErrorInvalidArgument = 2,
  31. megcoreErrorInvalidDeviceHandle = 3,
  32. megcoreErrorInvalidComputingHandle = 4,
  33. megcoreErrorInternalError = 5,
  34. } megcoreStatus_t;
  35. /**
  36. * \brief Memcpy kind
  37. */
  38. typedef enum {
  39. megcoreMemcpyHostToDevice = 1,
  40. megcoreMemcpyDeviceToHost = 2,
  41. megcoreMemcpyDeviceToDevice = 3,
  42. } megcoreMemcpyKind_t;
  43. namespace megcore {
  44. /*!
  45. * \brief error reporting from asynchronous execution devices
  46. *
  47. * This is currently used by CUDA kernels. It is used to report errors that
  48. * depend on input data.
  49. */
  50. struct AsyncErrorInfo {
  51. //! number of errors occurred; only detailed information of the first error
  52. //! would be recorded
  53. uint32_t nr_error;
  54. //! tracker set by set_error_tracker()
  55. void* tracker_ptr;
  56. //! human readable message; it can contain %d which would be replaced by
  57. //! msg_args
  58. char msg[228];
  59. int msg_args[4];
  60. };
  61. } // namespace megcore
  62. // vim: syntax=cpp.doxygen

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