Skip to content

Commit

Permalink
[EP Perf] Fix missing Azure cli & use onnx zoo model inside image (#1…
Browse files Browse the repository at this point in the history
…8917)

### Description
* Fix [missing Azure CLI
issue](https://aiinfra.visualstudio.com/Lotus/_build/results?buildId=392612&view=logs&j=b6bfa4e2-8141-507f-8ca1-59b3f929fa71&t=d0fed32c-7043-5439-8bf2-dd69d21beb5b&l=12).
* Now, once CI fails to run `az --version`, it would auto-reinstall the
azure cli dependency
* Use existing onnx zoo model inside image during memtesting 
   * to avoid test failure when onnx model zoo is restructuring
* Display more detail info of valgrind when memtesting
* Clear invalid dep of existing AddressSanitizer test case


### Validate
* Before the fix, Azure CLI is missing:
https://aiinfra.visualstudio.com/Lotus/_build/results?buildId=392994&view=logs&j=b6bfa4e2-8141-507f-8ca1-59b3f929fa71&t=d0fed32c-7043-5439-8bf2-dd69d21beb5b&l=10
* After the fix:
https://aiinfra.visualstudio.com/Lotus/_build/results?buildId=392619&view=logs&j=b6bfa4e2-8141-507f-8ca1-59b3f929fa71&t=d0fed32c-7043-5439-8bf2-dd69d21beb5b
  • Loading branch information
yf711 authored Jan 2, 2024
1 parent 81cbdb1 commit 3993d43
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions onnxruntime/python/tools/tensorrt/perf/mem_test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <iostream>
#include <vector>
#include <onnxruntime_cxx_api.h>
#include <tensorrt_provider_factory.h>
#include <tensorrt_provider_options.h>

void run_ort_trt2() {
Expand Down Expand Up @@ -135,7 +134,7 @@ void run_ort_trt() {

session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED);

const char* model_path = "squeezenet.onnx";
const char* model_path = "/data/ep-perf-models/onnx-zoo-models/squeezenet1.0-7/squeezenet/model.onnx";

Ort::ThrowOnError(api.CreateTensorRTProviderOptions(&tensorrt_options));
std::unique_ptr<OrtTensorRTProviderOptionsV2, decltype(api.ReleaseTensorRTProviderOptions)> rel_trt_options(
Expand Down
10 changes: 2 additions & 8 deletions onnxruntime/python/tools/tensorrt/perf/mem_test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ s) ORT_SOURCE=${OPTARG};;
esac
done

ONNX_MODEL_TAR_URL="https://github.com/onnx/models/raw/main/archive/vision/classification/squeezenet/model/squeezenet1.0-7.tar.gz"
MODEL_TAR_NAME="squeezenet1.0-7.tar.gz"
ONNX_MODEL="squeezenet.onnx"
ONNX_MODEL="/data/ep-perf-models/onnx-zoo-models/squeezenet1.0-7/squeezenet/model.onnx"
ASAN_OPTIONS="protect_shadow_gap=0:new_delete_type_mismatch=0:log_path=asan.log"

export LD_LIBRARY_PATH=${ORT_BINARY_PATH}
Expand Down Expand Up @@ -48,15 +46,11 @@ cp ../squeezenet_calibration.flatbuffers .

cmake ..
make -j
wget ${ONNX_MODEL_TAR_URL} -O squeezenet1.0-7.tar.gz
tar -xzf ${MODEL_TAR_NAME} --strip-components=1
mv model.onnx ${ONNX_MODEL}
rm ${MODEL_TAR_NAME}
mkdir result

# Run valgrind
echo $(date +"%Y-%m-%d %H:%M:%S") '[valgrind] Starting memcheck with' ${ONNX_MODEL}
valgrind --leak-check=full --show-leak-kinds=all --log-file=valgrind.log ${ORT_SOURCE}/build/Linux/Release/onnxruntime_perf_test -e tensorrt -r 1 ${ONNX_MODEL}
valgrind --leak-check=full --show-leak-kinds=definite --max-threads=3000 --num-callers=20 --keep-debuginfo=yes --log-file=valgrind.log ${ORT_SOURCE}/build/Linux/Release/onnxruntime_perf_test -e tensorrt -r 1 ${ONNX_MODEL}
echo $(date +"%Y-%m-%d %H:%M:%S") '[valgrind] Analyzing valgrind log'

found_leak_summary=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ then
BUILD_ORT_LATEST="true"
fi

docker run --rm --gpus all -v $MEM_TEST_DIR:$DOCKER_MEM_TEST_DIR $DOCKER_IMAGE /bin/bash $DOCKER_MEM_TEST_DIR'run.sh' -p $DOCKER_MEM_TEST_DIR -o $DOCKER_ORT_LIBS -s $DOCKER_ORT_SOURCE -l $BUILD_ORT_LATEST
docker run --rm --gpus all -v $MEM_TEST_DIR:$DOCKER_MEM_TEST_DIR -v /data/ep-perf-models:/data/ep-perf-models $DOCKER_IMAGE /bin/bash $DOCKER_MEM_TEST_DIR'run.sh' -p $DOCKER_MEM_TEST_DIR -o $DOCKER_ORT_LIBS -s $DOCKER_ORT_SOURCE -l $BUILD_ORT_LATEST
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ jobs:
- script: 'python3 -m pip install pandas azure-kusto-data[pandas] azure-kusto-ingest[pandas] coloredlogs'
displayName: 'Install dashboard dependencies'

- script: |
az --version || {
echo "Azure CLI not found, installing..."
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
}
displayName: 'Check and Install Azure CLI'
- task: AzureCLI@2
displayName: 'Azure CLI Post to Dashboard'
inputs:
Expand Down

0 comments on commit 3993d43

Please sign in to comment.