mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-17 01:44:45 +00:00
* updated cmake files for trt * added trt execution provider * added trt basic test * removed trt_path action attribute * Add files via upload * Update build.py * Update trt_allocator.h * fixed issues found by reviewers * changed cast operator * added comment for custom kernel implementation * changed auto to auto& * changed to function compile APIs for TRT execution provider * changed to function compile APIs for TRT execution provider * added new DType DInt64 * adapted to the changes of onnxruntime_c_api * removed trt kernel (use function compile instead) * updated onnx-tensorrt submodule * set default memory type to TRT fused kernel * resolve merge conflict * fixed the issue that USE_CUDA conflicts with USE_TRT * construct graph by adding nodes in topological order * made changes for Windows * change buffers type * bypass HasImplementationOf check for TRT XP because TRT kernel is not registered * added domain to version info in rebuilt model proto * added trt to test option list * added DomainToVersionMap() to GraphViewer * removed Copy() * fixed broken code * format the code to clang format * used local reference to the frequently used values * fixed a couple of issues according to reviewers feedback * fixed a couple of issues according to reviewers feedback * added python binding for TRT and enable use_cuda when use_trt is on * fixed a redefinition issue * changed shared_ptr to unique_ptr on trt engines, and made a few changes required by reviewers * enabled trtexecution provider for unit tests * renamed trt to tensorrt * added tesorrt to python binding * update submodule onnx and onnx-tensorrt * made a couple of minor changes based on reviewer's feedback * added CUDA_CHECK * removed test code * fixed broken code after merge * updated onnx-tensorrt submodule * added post processing to align trt inputs/outputs with graph inputs/outputs * updated onnx submodule * added CUDA fallback for TensorRT and fixed TensorRT cmake issue * added ci pipeline for tensorrt and removed some redundent code from trt xp * fixed syntax issue * updated onnx-tensorrt submodule * fix trt build problem by: (#602) 1. Add additional /wd for debug build 2. Add io.h for additional targets 3. Bring back mb version of getopt * Update install_ubuntu.sh * Update linux-gpu-tensorrt-ci-pipeline.yml * Update linux-gpu-tensorrt-ci-pipeline.yml * Update run_build.sh * Update run_build.sh * Update run_build.sh * Update run_build.sh * fixed the issue that GetKernelRegistry returns nullptr * merged master to this branch * moved some data types to private * fixed tensorrt CI pipeline issue * customized test data for TensorRT pipeline * added onnx-tensorrt in json file and fixed an issue in ci script * added comments
92 lines
3.4 KiB
Bash
Executable file
92 lines
3.4 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e -o -x
|
|
|
|
SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
|
|
SOURCE_ROOT=$(realpath $SCRIPT_DIR/../../../../)
|
|
CUDA_VER=cuda10.0-cudnn7.3
|
|
|
|
while getopts c:o:d:r:p:x:a: parameter_Option
|
|
do case "${parameter_Option}"
|
|
in
|
|
#ubuntu16.04
|
|
o) BUILD_OS=${OPTARG};;
|
|
#cpu, gpu, tensorrt
|
|
d) BUILD_DEVICE=${OPTARG};;
|
|
r) BUILD_DIR=${OPTARG};;
|
|
#python version: 3.6 3.7 (absence means default 3.5)
|
|
p) PYTHON_VER=${OPTARG};;
|
|
# "--build_wheel --use_openblas"
|
|
x) BUILD_EXTR_PAR=${OPTARG};;
|
|
# "cuda10.0-cudnn7.3, cuda9.1-cudnn7.1"
|
|
c) CUDA_VER=${OPTARG};;
|
|
a) BUILD_ARCH=${OPTARG};;
|
|
esac
|
|
done
|
|
|
|
EXIT_CODE=1
|
|
|
|
echo "bo=$BUILD_OS bd=$BUILD_DEVICE bdir=$BUILD_DIR pv=$PYTHON_VER bex=$BUILD_EXTR_PAR"
|
|
|
|
cd $SCRIPT_DIR/docker
|
|
if [ $BUILD_DEVICE = "gpu" ]; then
|
|
IMAGE="ubuntu16.04-$CUDA_VER"
|
|
DOCKER_FILE=Dockerfile.ubuntu_gpu
|
|
if [ $CUDA_VER = "cuda9.1-cudnn7.1" ]; then
|
|
DOCKER_FILE=Dockerfile.ubuntu_gpu_cuda9
|
|
fi
|
|
docker build -t "onnxruntime-$IMAGE" --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=${PYTHON_VER} -f $DOCKER_FILE .
|
|
elif [ $BUILD_DEVICE = "tensorrt" ]; then
|
|
IMAGE="ubuntu16.04-$CUDA_VER"
|
|
DOCKER_FILE=Dockerfile.ubuntu_tensorrt
|
|
docker build -t "onnxruntime-$IMAGE" --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=${PYTHON_VER} -f $DOCKER_FILE .
|
|
else
|
|
IMAGE="ubuntu16.04"
|
|
if [ $BUILD_ARCH = "x86" ]; then
|
|
docker build -t "onnxruntime-$IMAGE" --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=${PYTHON_VER} -f Dockerfile.ubuntu_x86 .
|
|
else
|
|
docker build -t "onnxruntime-$IMAGE" --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=${PYTHON_VER} -f Dockerfile.ubuntu .
|
|
fi
|
|
fi
|
|
|
|
set +e
|
|
|
|
if [ $BUILD_DEVICE = "cpu" ]; then
|
|
docker rm -f "onnxruntime-$BUILD_DEVICE" || true
|
|
docker run -h $HOSTNAME \
|
|
--rm \
|
|
--name "onnxruntime-$BUILD_DEVICE" \
|
|
--volume "$SOURCE_ROOT:/onnxruntime_src" \
|
|
--volume "$BUILD_DIR:/home/onnxruntimedev" \
|
|
--volume "$HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime" \
|
|
"onnxruntime-$IMAGE" \
|
|
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/run_build.sh \
|
|
-d $BUILD_DEVICE -x "$BUILD_EXTR_PAR" &
|
|
elif [ $BUILD_DEVICE = "gpu" ]; then
|
|
docker rm -f "onnxruntime-$BUILD_DEVICE" || true
|
|
nvidia-docker run --rm -h $HOSTNAME \
|
|
--rm \
|
|
--name "onnxruntime-$BUILD_DEVICE" \
|
|
--volume "$SOURCE_ROOT:/onnxruntime_src" \
|
|
--volume "$BUILD_DIR:/home/onnxruntimedev" \
|
|
--volume "$HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime" \
|
|
"onnxruntime-$IMAGE" \
|
|
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/run_build.sh \
|
|
-d $BUILD_DEVICE -x "$BUILD_EXTR_PAR" &
|
|
else
|
|
docker rm -f "onnxruntime-$BUILD_DEVICE" || true
|
|
nvidia-docker run --rm -h $HOSTNAME \
|
|
--rm \
|
|
--name "onnxruntime-$BUILD_DEVICE" \
|
|
--volume "$SOURCE_ROOT:/onnxruntime_src" \
|
|
--volume "$BUILD_DIR:/home/onnxruntimedev" \
|
|
--volume "$HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime" \
|
|
"onnxruntime-$IMAGE" \
|
|
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/run_build.sh \
|
|
-d $BUILD_DEVICE -x "$BUILD_EXTR_PAR" &
|
|
fi
|
|
wait -n
|
|
|
|
EXIT_CODE=$?
|
|
|
|
set -e
|
|
exit $EXIT_CODE
|