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.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-2021 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. megcorePlatformROCM = 6,
  20. megcorePlatformCambricon = 7,
  21. megcorePlatformAtlas = 8,
  22. } megcorePlatform_t;
  23. /**
  24. * \brief MegCore return codes
  25. *
  26. * Note: since MegCore has been merged into MegDNN and uses C++ API with
  27. * exception, this return status only serves for backward compatibility and all
  28. * API would return megcoreSuccess
  29. */
  30. typedef enum {
  31. megcoreSuccess = 0,
  32. megcoreErrorMemoryAllocation = 1,
  33. megcoreErrorInvalidArgument = 2,
  34. megcoreErrorInvalidDeviceHandle = 3,
  35. megcoreErrorInvalidComputingHandle = 4,
  36. megcoreErrorInternalError = 5,
  37. } megcoreStatus_t;
  38. /**
  39. * \brief Memcpy kind
  40. */
  41. typedef enum {
  42. megcoreMemcpyHostToDevice = 1,
  43. megcoreMemcpyDeviceToHost = 2,
  44. megcoreMemcpyDeviceToDevice = 3,
  45. } megcoreMemcpyKind_t;
  46. namespace megcore {
  47. /*!
  48. * \brief error reporting from asynchronous execution devices
  49. *
  50. * This is currently used by CUDA kernels. It is used to report errors that
  51. * depend on input data.
  52. */
  53. struct AsyncErrorInfo {
  54. //! number of errors occurred; only detailed information of the first error
  55. //! would be recorded
  56. uint32_t nr_error;
  57. //! tracker set by set_error_tracker()
  58. void* tracker_ptr;
  59. //! human readable message; it can contain %d which would be replaced by
  60. //! msg_args
  61. char msg[228];
  62. int msg_args[4];
  63. };
  64. } // namespace megcore
  65. // vim: syntax=cpp.doxygen

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