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.

init_image.sh 2.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash -e
  2. GET_PIP_URL='https://bootstrap.pypa.io/get-pip.py'
  3. SWIG_URL='https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz?use_mirror=autoselect'
  4. LLVM_URL='https://github.com/llvm-mirror/llvm/archive/release_60.tar.gz'
  5. CLANG_URL='https://github.com/llvm-mirror/clang/archive/release_60.tar.gz'
  6. yum erase -y cmake cmake28
  7. yum install -y python34-pip pcre-devel
  8. pip3 install --no-cache-dir --only-binary :all: -U pip==19.1
  9. pip3 install --no-cache-dir --only-binary :all: cmake==3.16.3
  10. for ver in 35m 36m 37m 38
  11. do
  12. python_ver=${ver:0:2}
  13. curl ${GET_PIP_URL} | /opt/python/cp${python_ver}-cp${ver}/bin/python - \
  14. --no-cache-dir --only-binary :all:
  15. /opt/python/cp${python_ver}-cp${ver}/bin/pip install \
  16. --no-cache-dir --only-binary :all: numpy==1.18.1
  17. done
  18. pushd /home >/dev/null
  19. curl -sSL ${SWIG_URL} | tar xz
  20. pushd swig-3.0.12 >/dev/null
  21. mkdir build
  22. pushd build >/dev/null
  23. ../configure
  24. make -j$(nproc)
  25. make install
  26. popd >/dev/null
  27. popd >/dev/null
  28. rm -rf swig-3.0.12
  29. curl -sSL ${LLVM_URL} | tar xz
  30. pushd llvm-release_60 >/dev/null
  31. mkdir build
  32. pushd build >/dev/null
  33. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  34. -DCMAKE_BUILD_TYPE=Release
  35. make -j$(nproc)
  36. make install
  37. popd >/dev/null
  38. popd >/dev/null
  39. rm -rf llvm-release_60
  40. curl -sSL ${CLANG_URL} | tar xz
  41. pushd clang-release_60 >/dev/null
  42. mkdir build
  43. pushd build >/dev/null
  44. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  45. -DCMAKE_BUILD_TYPE=Release
  46. make -j$(nproc)
  47. make install
  48. popd >/dev/null
  49. popd >/dev/null
  50. rm -rf clang-release_60
  51. popd >/dev/null
  52. pushd /tmp >/dev/null
  53. curl -sSL https://github.com/NixOS/patchelf/archive/0.10.tar.gz | tar xz
  54. pushd /tmp/patchelf-0.10 >/dev/null
  55. patch -p1 <<'EOF'
  56. diff --git a/src/patchelf.cc b/src/patchelf.cc
  57. index 0b4965a..7aae7a4 100644
  58. --- a/src/patchelf.cc
  59. +++ b/src/patchelf.cc
  60. @@ -1074,13 +1074,6 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string &
  61. return;
  62. }
  63. - /* Zero out the previous SONAME */
  64. - unsigned int sonameSize = 0;
  65. - if (soname) {
  66. - sonameSize = strlen(soname);
  67. - memset(soname, 'X', sonameSize);
  68. - }
  69. -
  70. debug("new SONAME is '%s'\n", newSoname.c_str());
  71. /* Grow the .dynstr section to make room for the new SONAME. */
  72. @@ -1264,7 +1257,6 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
  73. unsigned int rpathSize = 0;
  74. if (rpath) {
  75. rpathSize = strlen(rpath);
  76. - memset(rpath, 'X', rpathSize);
  77. }
  78. debug("new rpath is '%s'\n", newRPath.c_str());
  79. EOF
  80. ./bootstrap.sh && ./configure && make install-strip
  81. popd
  82. rm -rf /tmp/patchelf-0.10
  83. popd
  84. yum clean all

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