Skip to content

Commit

Permalink
Use environment variable in some L0 tests to control the executor cho…
Browse files Browse the repository at this point in the history
…ice.

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
  • Loading branch information
mzient committed Sep 4, 2024
1 parent 16fc1eb commit f3f724b
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qa/TL0_python-self-test-core-exec2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -e
export DALI_USE_NEW_EXECUTOR=1
bash -e ./test_nofw.sh
bash -e ./test_pytorch.sh
83 changes: 83 additions & 0 deletions qa/TL0_python-self-test-core-exec2/test_body.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash -e

test_py_with_framework() {
# Note that we do not filter '!numba' below as it is installed as dependency
for test_script in $(ls test_pipeline.py \
test_pipeline_debug.py \
test_pipeline_debug_resnet50.py \
test_eager_coverage.py \
test_eager_operators.py \
test_pipeline_decorator.py \
test_pipeline_multichannel.py \
test_pipeline_segmentation.py \
test_triton_autoserialize.py \
test_functional_api.py \
test_backend_impl.py \
test_dali_variable_batch_size.py \
test_external_source_impl_utils.py); do
${python_invoke_test} --attr '!slow,!pytorch,!mxnet,!cupy' ${test_script}
done
if [ -z "$DALI_ENABLE_SANITIZERS" ]; then
${python_new_invoke_test} -A 'numba' -s type_annotations
fi
${python_new_invoke_test} -A '!slow,numba' checkpointing.test_dali_checkpointing
${python_new_invoke_test} -A '!slow,numba' checkpointing.test_dali_stateless_operators
}

test_py() {
python test_python_function_cleanup.py
python test_detection_pipeline.py -i 300
python test_RN50_data_pipeline.py -s -i 10 --decoder_type "legacy"
python test_RN50_data_pipeline.py -s -i 10 --decoder_type "experimental"
python test_coco_tfrecord.py -i 64
python test_data_containers.py -s -b 20
python test_data_containers.py -s -b 20 -n
}

test_autograph() {
${python_new_invoke_test} -s autograph
${python_new_invoke_test} -s conditionals
if [ -z "$DALI_ENABLE_SANITIZERS" ]; then
${python_new_invoke_test} -s auto_aug
fi
}

test_type_annotations() {
if [ -z "$DALI_ENABLE_SANITIZERS" ]; then
${python_new_invoke_test} -A '!pytorch,!numba' -s type_annotations
fi
}

test_pytorch() {
${python_invoke_test} --attr '!slow,pytorch' test_dali_variable_batch_size.py
if [ -z "$DALI_ENABLE_SANITIZERS" ]; then
${python_new_invoke_test} -A 'pytorch' -s type_annotations
${python_new_invoke_test} -A '!slow' checkpointing.test_dali_checkpointing_fw_iterators.TestPytorch
${python_new_invoke_test} -A '!slow' checkpointing.test_dali_checkpointing_fw_iterators.TestPytorchRagged
fi
}

test_checkpointing() {
if [ -z "$DALI_ENABLE_SANITIZERS" ]; then
${python_new_invoke_test} -A '!slow,!pytorch,!mxnet,!cupy,!numba' checkpointing.test_dali_checkpointing
${python_new_invoke_test} -A '!slow,!pytorch,!mxnet,!cupy,!numba' checkpointing.test_dali_stateless_operators
else
${python_new_invoke_test} -A '!slow,!pytorch,!mxnet,!cupy,!numba,!sanitizer_skip' checkpointing.test_dali_checkpointing

# External source tests are slow and Python-side mostly, but let's run just one of them
${python_new_invoke_test} -A '!slow,!pytorch,!mxnet,!cupy,!numba' checkpointing.test_dali_checkpointing.test_external_source_checkpointing:1
fi
}

test_no_fw() {
test_py_with_framework
test_py
test_autograph
test_type_annotations
test_checkpointing
}

run_all() {
test_no_fw
test_pytorch
}
16 changes: 16 additions & 0 deletions qa/TL0_python-self-test-core-exec2/test_nofw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -e
# used pip packages
pip_packages='${python_test_runner_package} numpy opencv-python pillow nvidia-ml-py==11.450.51 numba lz4 scipy mypy librosa'

target_dir=./dali/test/python

# test_body definition is in separate file so it can be used without setup
source test_body.sh

test_body() {
test_no_fw
}

pushd ../..
source ./qa/test_template.sh
popd
22 changes: 22 additions & 0 deletions qa/TL0_python-self-test-core-exec2/test_pytorch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e
# used pip packages
pip_packages='${python_test_runner_package} pillow opencv-python torch numba mypy'

target_dir=./dali/test/python

# test_body definition is in separate file so it can be used without setup
source test_body.sh

test_body() {
test_pytorch
}

# run this only on x86_64, not arm
if [ $(uname -m) != "x86_64" ]
then
exit 0
fi

pushd ../..
source ./qa/test_template.sh
popd
1 change: 1 addition & 0 deletions qa/TL0_python-self-test-core/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash -e
export DALI_USE_NEW_EXECUTOR=0
bash -e ./test_nofw.sh
bash -e ./test_pytorch.sh
47 changes: 47 additions & 0 deletions qa/TL0_self-test-exec2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash -ex

do_once() {
# generate file_list.txt for label testing
echo "${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test.mp4 0 0 99
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test.mp4 1 100 199
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test.mp4 2 200 256
" > /tmp/file_list.txt

echo "${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 0 0 1
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 1 2 3
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 2 4 5
" > /tmp/file_list_timestamp.txt

echo "${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 0 0 49
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 1 50 99
${DALI_EXTRA_PATH}/db/video/frame_num_timestamp/test_25fps.mp4 2 100 149
" > /tmp/file_list_frame_num.txt
}

test_body() {
for BINNAME in \
"dali_test.bin" \
"dali_operator_test.bin"
do
for DIRNAME in \
"../../build/dali/python/nvidia/dali" \
"$(python -c 'import os; from nvidia import dali; print(os.path.dirname(dali.__file__))' 2>/dev/null || echo '')"
do
if [ -x "$DIRNAME/test/$BINNAME" ]; then
FULLPATH="$DIRNAME/test/$BINNAME"
break
fi
done

if [[ -z "$FULLPATH" ]]; then
echo "ERROR: $BINNAME not found"
exit 1
fi

DALI_USE_NEW_EXECUTOR=1 "$FULLPATH"
done
}

pushd ../..
source ./qa/test_template.sh
popd

0 comments on commit f3f724b

Please sign in to comment.