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 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash -e
  2. TEST_PLAT=$1
  3. export MEGENGINE_LOGGING_LEVEL="ERROR"
  4. if [[ "$TEST_PLAT" == cpu ]]; then
  5. echo "test cpu after Ninja develop"
  6. elif [[ "$TEST_PLAT" == cuda ]]; then
  7. echo "test cuda after Ninja develop"
  8. elif [[ "$TEST_PLAT" == cpu_local ]]; then
  9. echo "test cpu after python3 -m pip install xxx"
  10. elif [[ "$TEST_PLAT" == cuda_local ]]; then
  11. echo "test cuda after python3 -m pip install xxx"
  12. else
  13. echo "ERR args, support list:"
  14. echo "$0 cpu (test cpu after Ninja develop)"
  15. echo "$0 cuda (test cuda after Ninja develop)"
  16. echo "$0 cpu_local (test cpu after python3 -m pip install xxx)"
  17. echo "$0 cuda_local (test cuda after python3 -m pip install xxx)"
  18. exit 1
  19. fi
  20. if [[ "$TEST_PLAT" =~ "local" ]]; then
  21. cd $(dirname "${BASH_SOURCE[0]}")
  22. megengine_dir=`python3 -c 'from pathlib import Path;import megengine;print(Path(megengine.__file__).resolve().parent)'`
  23. test_dirs="${megengine_dir} ."
  24. machine=$(uname -m)
  25. case ${machine} in
  26. x86_64) echo "test on ${machine}" ;;
  27. aarch64) echo "test on ${machine}" ;;
  28. *) echo "nonsupport env!!!";exit -1 ;;
  29. esac
  30. echo "test local env at: ${test_dirs}"
  31. PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest --ignore=${megengine_dir}/_internal -s -v $test_dirs -m 'not isolated_distributed'
  32. if [[ "$TEST_PLAT" =~ "cuda" ]]; then
  33. echo "test GPU pytest now"
  34. PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest --ignore=${megengine_dir}/_internal -s -v $test_dirs -m 'isolated_distributed' --ignore=./integration/test_dtr.py
  35. fi
  36. else
  37. cd $(dirname "${BASH_SOURCE[0]}")/..
  38. test_dirs="megengine test"
  39. echo "test develop env"
  40. TEST_PY_PATH="."
  41. PYTHONPATH=${TEST_PY_PATH} PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest -s -v $test_dirs -m 'not isolated_distributed'
  42. if [[ "$TEST_PLAT" =~ "cuda" ]]; then
  43. echo "test GPU pytest now"
  44. PYTHONPATH=${TEST_PY_PATH} PY_IGNORE_IMPORTMISMATCH=1 python3 -m pytest -s -v $test_dirs -m 'isolated_distributed'
  45. fi
  46. fi