Skip to content

Commit

Permalink
fix unbound local and only run --parallel for build and CPU integration
Browse files Browse the repository at this point in the history
  • Loading branch information
areusch committed Aug 2, 2021
1 parent 85b527f commit dfa2dd8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion tests/scripts/setup-pytest-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fi
function run_pytest() {
local extra_args=( )
if [ "$1" == "--parallel" ]; then
extra_args=( "${extra_args[@]}" -n "${PYTEST_NUM_CPUS}" )
extra_args=( -n "${PYTEST_NUM_CPUS}" )
shift
fi
local ffi_type="$1"
Expand Down
14 changes: 7 additions & 7 deletions tests/scripts/task_python_frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ find . -type f -path "*.pyc" | xargs rm -f
make cython3

echo "Running relay MXNet frontend test..."
run_pytest --parallel cython python-frontend-mxnet tests/python/frontend/mxnet
run_pytest cython python-frontend-mxnet tests/python/frontend/mxnet

echo "Running relay ONNX frontend test..."
# Enable tvm.testing decorators in the ONNX importer test (not enabling in the other tests because we
# they do not consistently use the decorators to indicate that tests should run on GPU)
# In the future, we should enable tvm.testing decorators for all the test files.
PYTEST_ADDOPTS="-m gpu $PYTEST_ADDOPTS" run_pytest --parallel cython python-frontend-onnx tests/python/frontend/onnx
PYTEST_ADDOPTS="-m gpu $PYTEST_ADDOPTS" run_pytest cython python-frontend-onnx tests/python/frontend/onnx

echo "Running relay CoreML frontend test..."
run_pytest --parallel cython python-frontend-coreml tests/python/frontend/coreml
run_pytest cython python-frontend-coreml tests/python/frontend/coreml

echo "Running relay Tensorflow frontend test..."
run_pytest --parallel cython python-frontend-tensorflow tests/python/frontend/tensorflow
run_pytest cython python-frontend-tensorflow tests/python/frontend/tensorflow

echo "Running relay caffe2 frontend test..."
run_pytest --parallel cython python-frontend-caffe2 tests/python/frontend/caffe2
run_pytest cython python-frontend-caffe2 tests/python/frontend/caffe2

echo "Running relay DarkNet frontend test..."
run_pytest --parallel cython python-frontend-darknet tests/python/frontend/darknet
run_pytest cython python-frontend-darknet tests/python/frontend/darknet

echo "Running relay PyTorch frontend test..."
run_pytest --parallel cython python-frontend-pytorch tests/python/frontend/pytorch
run_pytest cython python-frontend-pytorch tests/python/frontend/pytorch
6 changes: 3 additions & 3 deletions tests/scripts/task_python_frontend_cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ find . -type f -path "*.pyc" | xargs rm -f
make cython3

echo "Running relay TFLite frontend test..."
run_pytest --parallel cython python-frontend-tflite tests/python/frontend/tflite
run_pytest cython python-frontend-tflite tests/python/frontend/tflite

echo "Running relay Keras frontend test..."
run_pytest --parallel cython python-frontend-keras tests/python/frontend/keras
run_pytest cython python-frontend-keras tests/python/frontend/keras

echo "Running relay Caffe frontend test..."
run_pytest --parallel cython python-frontend-caffe tests/python/frontend/caffe
run_pytest cython python-frontend-caffe tests/python/frontend/caffe
21 changes: 12 additions & 9 deletions tests/scripts/task_python_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,36 @@ rm -rf lib
make
cd ../..

run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests
run_pytest --parallel cython ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests
# Only run in parallel for CPU integration tests.
PYTEST_PARALLEL="${PYTEST_PARALLEL:---parallel}"

run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests
run_pytest "${PYTEST_PARALELL}" cython ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests

# Test dso plugin
cd apps/dso_plugin_module
rm -rf lib
make
cd ../..
run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module
run_pytest --parallel cython ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module
run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module
run_pytest "${PYTEST_PARALELL}" cython ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module

# Do not enable TensorFlow op
# TVM_FFI=cython sh prepare_and_test_tfop_module.sh
# TVM_FFI=ctypes sh prepare_and_test_tfop_module.sh

run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME} tests/python/integration
run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME} tests/python/integration
if python -c "import tvm; from tvm.relay.op.contrib.ethosn import ethosn_available; print(ethosn_available().name)" -eq "SW_ONLY"; then
ETHOSN_VARIANT_CONFIG=ETHOSN78_1TOPS_4PLE_448KSRAM run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib-test_ethosn tests/python/contrib/test_ethosn
ETHOSN_VARIANT_CONFIG=ETHOSN78_1TOPS_4PLE_448KSRAM run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib-test_ethosn tests/python/contrib/test_ethosn
fi
run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib
run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib

# forked is needed because the global registry gets contaminated
TVM_TEST_TARGETS="${TVM_RELAY_TEST_TARGETS:-llvm;cuda}" \
run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay
run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay

# Command line driver test
run_pytest --parallel ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-driver tests/python/driver
run_pytest "${PYTEST_PARALELL}" ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-driver tests/python/driver

# Do not enable OpenGL
# run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-webgl tests/webgl
1 change: 1 addition & 0 deletions tests/scripts/task_python_integration_gpuonly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export TVM_TEST_TARGETS="cuda;opencl;metal;rocm;vulkan;nvptx;opencl -device=mali
export PYTEST_ADDOPTS="-m gpu $PYTEST_ADDOPTS"
export TVM_RELAY_TEST_TARGETS="cuda"
export TVM_INTEGRATION_TESTSUITE_NAME=python-integration-gpu
export TVM_GPU_INTEGRATION_TESTS=1

./tests/scripts/task_python_integration.sh
2 changes: 1 addition & 1 deletion tests/scripts/task_python_topi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ make cython3
# cleanup pycache
find . -type f -path "*.pyc" | xargs rm -f

run_pytest --parallel cython python-topi tests/python/topi/
run_pytest cython python-topi tests/python/topi/

0 comments on commit dfa2dd8

Please sign in to comment.