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

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

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