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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash -e
  2. GET_PIP_URL='https://bootstrap.pypa.io/get-pip.py'
  3. GET_PIP_URL_35='https://bootstrap.pypa.io/pip/3.5/get-pip.py'
  4. SWIG_URL='https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz?use_mirror=autoselect'
  5. LLVM_URL='https://github.com/llvm-mirror/llvm/archive/release_60.tar.gz'
  6. CLANG_URL='https://github.com/llvm-mirror/clang/archive/release_60.tar.gz'
  7. yum install -y pcre-devel devtoolset-9-libatomic-devel.x86_64
  8. yum install -y devtoolset-8 devtoolset-8-libatomic-devel.x86_64
  9. for ver in 35m 36m 37m 38
  10. do
  11. python_ver=${ver:0:2}
  12. PIP_URL=${GET_PIP_URL}
  13. if [ ${ver} = "35m" ];then
  14. PIP_URL=${GET_PIP_URL_35}
  15. fi
  16. echo "use pip url: ${PIP_URL}"
  17. curl ${PIP_URL} | /opt/python/cp${python_ver}-cp${ver}/bin/python - \
  18. --no-cache-dir --only-binary :all:
  19. /opt/python/cp${python_ver}-cp${ver}/bin/pip install \
  20. --no-cache-dir --only-binary :all: numpy==1.18.1 setuptools==46.1.3
  21. done
  22. pushd /home >/dev/null
  23. echo "Install swig"
  24. curl -sSL ${SWIG_URL} | tar xz
  25. pushd swig-3.0.12 >/dev/null
  26. mkdir build
  27. pushd build >/dev/null
  28. ../configure
  29. make -j$(nproc)
  30. make install
  31. popd >/dev/null
  32. popd >/dev/null
  33. rm -rf swig-3.0.12
  34. echo "Install llvm"
  35. curl -sSL ${LLVM_URL} | tar xz
  36. pushd llvm-release_60 >/dev/null
  37. mkdir build
  38. pushd build >/dev/null
  39. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  40. -DCMAKE_BUILD_TYPE=Release
  41. make -j$(nproc)
  42. make install
  43. popd >/dev/null
  44. popd >/dev/null
  45. rm -rf llvm-release_60
  46. echo "Install clang"
  47. curl -sSL ${CLANG_URL} | tar xz
  48. pushd clang-release_60 >/dev/null
  49. mkdir build
  50. pushd build >/dev/null
  51. cmake .. -DCMAKE_PREFIX_PATH=/opt/python/cp36-cp36m/ \
  52. -DCMAKE_BUILD_TYPE=Release
  53. make -j$(nproc)
  54. make install
  55. popd >/dev/null
  56. popd >/dev/null
  57. rm -rf clang-release_60
  58. popd >/dev/null
  59. pushd /tmp >/dev/null
  60. curl -sSL https://github.com/NixOS/patchelf/archive/0.12.tar.gz | tar xz
  61. pushd /tmp/patchelf-0.12 >/dev/null
  62. sed -i '331s/32/256/' ./src/patchelf.cc
  63. ./bootstrap.sh && ./configure && make install-strip
  64. popd
  65. rm -rf /tmp/patchelf-0.12
  66. popd
  67. yum clean all

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