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 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 devtoolset-8-libatomic-devel.x86_64
  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 setuptools==46.1.3
  17. done
  18. pushd /home >/dev/null
  19. echo "Install swig"
  20. curl -sSL ${SWIG_URL} | tar xz
  21. pushd swig-3.0.12 >/dev/null
  22. mkdir build
  23. pushd build >/dev/null
  24. ../configure
  25. make -j$(nproc)
  26. make install
  27. popd >/dev/null
  28. popd >/dev/null
  29. rm -rf swig-3.0.12
  30. echo "Install llvm"
  31. curl -sSL ${LLVM_URL} | tar xz
  32. pushd llvm-release_60 >/dev/null
  33. mkdir build
  34. pushd build >/dev/null
  35. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  36. -DCMAKE_BUILD_TYPE=Release
  37. make -j$(nproc)
  38. make install
  39. popd >/dev/null
  40. popd >/dev/null
  41. rm -rf llvm-release_60
  42. echo "Install clang"
  43. curl -sSL ${CLANG_URL} | tar xz
  44. pushd clang-release_60 >/dev/null
  45. mkdir build
  46. pushd build >/dev/null
  47. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  48. -DCMAKE_BUILD_TYPE=Release
  49. make -j$(nproc)
  50. make install
  51. popd >/dev/null
  52. popd >/dev/null
  53. rm -rf clang-release_60
  54. popd >/dev/null
  55. pushd /tmp >/dev/null
  56. curl -sSL https://github.com/NixOS/patchelf/archive/0.10.tar.gz | tar xz
  57. pushd /tmp/patchelf-0.10 >/dev/null
  58. patch -p1 <<'EOF'
  59. diff --git a/src/patchelf.cc b/src/patchelf.cc
  60. index 0b4965a..7aae7a4 100644
  61. --- a/src/patchelf.cc
  62. +++ b/src/patchelf.cc
  63. @@ -1074,13 +1074,6 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string &
  64. return;
  65. }
  66. - /* Zero out the previous SONAME */
  67. - unsigned int sonameSize = 0;
  68. - if (soname) {
  69. - sonameSize = strlen(soname);
  70. - memset(soname, 'X', sonameSize);
  71. - }
  72. -
  73. debug("new SONAME is '%s'\n", newSoname.c_str());
  74. /* Grow the .dynstr section to make room for the new SONAME. */
  75. @@ -1264,7 +1257,6 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
  76. unsigned int rpathSize = 0;
  77. if (rpath) {
  78. rpathSize = strlen(rpath);
  79. - memset(rpath, 'X', rpathSize);
  80. }
  81. debug("new rpath is '%s'\n", newRPath.c_str());
  82. EOF
  83. ./bootstrap.sh && ./configure && make install-strip
  84. popd
  85. rm -rf /tmp/patchelf-0.10
  86. popd
  87. yum clean all

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