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

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

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