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.

setup_mirror.sh 1.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. set -e
  3. function set_tuna_yum_mirror() {
  4. cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  5. local repo=/etc/yum.repos.d/CentOS-Base.repo
  6. local plugin=/etc/yum/pluginconf.d/fastestmirror.conf
  7. sed -i "s/mirrorlist=/#mirrorlist=/g" $repo
  8. sed -i "s/#baseurl/baseurl/g" $repo
  9. sed -i "s/mirror.centos.org/mirrors.tuna.tsinghua.edu.cn/g" $repo
  10. sed -i "s/http/https/g" $repo
  11. sed -i "s/enabled=1/enabled=0/g" $plugin
  12. yum clean all
  13. # Build on brainpp unable to pull epel reo metadata so disable this
  14. # https://unix.stackexchange.com/questions/148144/unable-to-pull-epel-repository-metadata
  15. yum --disablerepo="epel" update nss
  16. yum makecache
  17. }
  18. function set_epel() {
  19. mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
  20. mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
  21. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  22. }
  23. function set_yum_mirror() {
  24. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  25. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  26. yum makecache
  27. }
  28. function set_pip_mirror() {
  29. cat > /etc/pip.conf <<EOF
  30. [global]
  31. timeout = 180
  32. index-url = https://mirrors.aliyun.com/pypi/simple
  33. extra-index-url =
  34. http://mirrors.i.brainpp.cn/pypi/simple/
  35. http://pypi.i.brainpp.cn/brain/dev/+simple
  36. https://pypi.tuna.tsinghua.edu.cn/simple
  37. trusted-host =
  38. mirrors.i.brainpp.cn
  39. pypi.i.brainpp.cn
  40. pypi.tuna.tsinghua.edu.cn
  41. mirrors.aliyun.com
  42. EOF
  43. }
  44. function main() {
  45. local platform=$1
  46. case $platform in
  47. brainpp)
  48. set_epel
  49. set_yum_mirror
  50. set_pip_mirror
  51. ;;
  52. *)
  53. echo "No setup required"
  54. ;;
  55. esac
  56. }
  57. main "$@"

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