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.

run.sh 618 B

123456789101112131415161718192021
  1. #!/bin/bash -e
  2. test_dirs="test megengine"
  3. TEST_PLAT=$1
  4. if [[ "$TEST_PLAT" == cpu ]]; then
  5. echo "only test cpu pytest"
  6. elif [[ "$TEST_PLAT" == cuda ]]; then
  7. echo "test both cpu and gpu pytest"
  8. else
  9. echo "Argument must cpu or cuda"
  10. exit 1
  11. fi
  12. pushd $(dirname "${BASH_SOURCE[0]}")/.. >/dev/null
  13. PYTHONPATH="." PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest $test_dirs -m 'not isolated_distributed'
  14. if [[ "$TEST_PLAT" == cuda ]]; then
  15. echo "test GPU pytest now"
  16. PYTHONPATH="." PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest $test_dirs -m 'isolated_distributed'
  17. fi
  18. popd >/dev/null

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