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.

0001-fix-arm-linux-fix-uclibc-build-error.patch 2.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 0c64236f0d9463e508f8ebd8e73efafa0049d13b Mon Sep 17 00:00:00 2001
  2. From: Megvii Engine Team <megengine@megvii.com>
  3. Date: Thu, 30 Jul 2020 14:26:40 +0800
  4. Subject: [PATCH] fix(arm/linux): fix uclibc build error
  5. ---
  6. src/arm/linux/hwcap.c | 7 ++++---
  7. src/arm/linux/init.c | 4 +++-
  8. src/linux/processors.c | 5 +++++
  9. 3 files changed, 12 insertions(+), 4 deletions(-)
  10. diff --git a/src/arm/linux/hwcap.c b/src/arm/linux/hwcap.c
  11. index 36d0d91..5e1c301 100644
  12. --- a/src/arm/linux/hwcap.c
  13. +++ b/src/arm/linux/hwcap.c
  14. @@ -15,7 +15,8 @@
  15. #include <arm/linux/api.h>
  16. #include <cpuinfo/log.h>
  17. -#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__)
  18. +#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__) && !defined(__UCLIBC__)
  19. +
  20. #include <sys/auxv.h>
  21. #else
  22. #define AT_HWCAP 16
  23. @@ -38,7 +39,7 @@
  24. #endif
  25. -#if CPUINFO_ARCH_ARM
  26. +#if CPUINFO_ARCH_ARM && !defined(__UCLIBC__)
  27. typedef unsigned long (*getauxval_function_t)(unsigned long);
  28. bool cpuinfo_arm_linux_hwcap_from_getauxval(
  29. @@ -144,7 +145,7 @@
  30. #endif
  31. }
  32. #endif /* __ANDROID__ */
  33. -#elif CPUINFO_ARCH_ARM64
  34. +#elif CPUINFO_ARCH_ARM64 && !defined(__UCLIBC__)
  35. uint32_t cpuinfo_arm_linux_hwcap_from_getauxval(void) {
  36. #if CPUINFO_MOCK
  37. return mock_hwcap;
  38. diff --git a/src/arm/linux/init.c b/src/arm/linux/init.c
  39. index 89d957e..8225f5e 100644
  40. --- a/src/arm/linux/init.c
  41. +++ b/src/arm/linux/init.c
  42. @@ -234,6 +234,8 @@ void cpuinfo_arm_linux_init(void) {
  43. cpuinfo_arm_linux_decode_chipset(proc_cpuinfo_hardware, proc_cpuinfo_revision, valid_processors, 0);
  44. #endif
  45. +#if !defined(__UCLIBC__)
  46. +
  47. #if CPUINFO_ARCH_ARM
  48. uint32_t isa_features = 0, isa_features2 = 0;
  49. #ifdef __ANDROID__
  50. @@ -282,7 +284,7 @@ void cpuinfo_arm_linux_init(void) {
  51. cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
  52. isa_features, last_midr, &chipset, &cpuinfo_isa);
  53. #endif
  54. -
  55. +#endif
  56. /* Detect min/max frequency and package ID */
  57. for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
  58. if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
  59. diff --git a/src/linux/processors.c b/src/linux/processors.c
  60. index 4904e2a..a1d4693 100644
  61. --- a/src/linux/processors.c
  62. +++ b/src/linux/processors.c
  63. @@ -90,8 +90,13 @@ static bool uint32_parser(const char* text_start, const char* text_end, void* co
  64. uint32_t kernel_max = 0;
  65. const char* parsed_end = parse_number(text_start, text_end, &kernel_max);
  66. if (parsed_end == text_start) {
  67. +#if defined(__UCLIBC__)
  68. + cpuinfo_log_warning("failed to parse file %s: \"%.*s\" is not an unsigned number",
  69. + KERNEL_MAX_FILENAME, (int) (text_end - text_start), text_start);
  70. +#else
  71. cpuinfo_log_error("failed to parse file %s: \"%.*s\" is not an unsigned number",
  72. KERNEL_MAX_FILENAME, (int) (text_end - text_start), text_start);
  73. +#endif
  74. return false;
  75. } else {
  76. for (const char* char_ptr = parsed_end; char_ptr != text_end; char_ptr++) {
  77. --
  78. 2.26.2

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