onnxruntime/tools/ci_build/github/linux/run_dockerbuild.sh
Randy f048fc5fb0 cross compile x86 linux (#562)
* cross compile x86 linux

* fix comments

* install multilib for ubuntu cross compile

* remove tailing slash

* fix -fPIC relocations for x86 target too

* add asm make flag

* fix x86 compile err

* test x86 with zlib and png

* Disable zlib from x86

* install x86 python header

* remove cross-compiling changes

* test 32bit ubuntu

* add x86 ubuntu docker file

* add x86 as arch parametr for docker build

* config pipeline

* avoid dotnet install

* install cmake

* skip dep install

* use latest ubuntu

* install latest cmake

* install x86 deps

* configure cmake

* install ninja

* correct ninja dir

* apt get re2c

* install onnx

* set processor x86

* disable warning

* skip test

* disable test

* disable test

* find lib

* fix typo

* restore test

* disable backend model test

* disable test

* fix test err

* stop installing onnx

* disable onnx test on x86

* restore yml

* mergef with master yml

* cancel needless config setting

* enable x86 flag

* restore all onnx tests

* fix yml typo

* install onnx

* add back x86 flag

* disable cases

* disable case

* disable cases

* add macro to disable cases

* fix typo

* print platform

* remove condition
2019-03-12 09:47:45 -07:00

77 lines
2.6 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
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 .
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" &
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