Commit 187dee75 authored by mchrusci's avatar mchrusci Committed by Robert Kimball

[ONNX CI] Fix manual reproduction script (#1881)

* Update runCI.sh

Accommodate manual reproduction script.

* Update README.md

* Update runCI.sh

* fixes
* added rebuild parameter

* Fix rebuilding nGraph

* Added execution permission to runCI.sh
parent e07147f8
...@@ -11,3 +11,9 @@ To remove all items created during script execution (files, directories, docker ...@@ -11,3 +11,9 @@ To remove all items created during script execution (files, directories, docker
``` ```
./runCI.sh --cleanup ./runCI.sh --cleanup
``` ```
After first run, executing the script will rerun tox tests. To rebuild nGraph and run tests use:
```
./runCI.sh --rebuild
```
...@@ -16,44 +16,73 @@ ...@@ -16,44 +16,73 @@
# limitations under the License. # limitations under the License.
# ****************************************************************************** # ******************************************************************************
NGRAPH_ONNX_REPO="https://github.com/NervanaSystems/ngraph-onnx"
CI_PATH="$(pwd)" CI_PATH="$(pwd)"
CI_ROOT=".ci/jenkins" CI_ROOT=".ci/onnx/jenkins"
REPO_ROOT="${CI_PATH%$CI_ROOT}" REPO_ROOT="${CI_PATH%$CI_ROOT}"
DOCKER_CONTAINER="ngraph-onnx_ci" DOCKER_CONTAINER="ngraph-onnx_ci_reproduction"
# Function run() builds image with requirements needed to build ngraph and run onnx tests, runs container and executes tox tests # Function run() builds image with requirements needed to build ngraph and run onnx tests, runs container and executes tox tests
function run() { function run() {
set -x
set -e
cd ./dockerfiles cd ./dockerfiles
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -f=./ubuntu-16_04.dockerfile -t ngraph-onnx:ubuntu-16_04 . docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -f=./ubuntu-16_04.dockerfile -t ngraph-onnx:ubuntu-16_04 .
cd "${CI_PATH}" cd "${CI_PATH}"
mkdir -p ${HOME}/ONNX_CI if [[ -z $(docker ps -a | grep -i "${DOCKER_CONTAINER}") ]];
if [[ -z $(docker ps -a | grep -i "${DOCKER_CONTAINER}") ]]; then
then docker run -h "$(hostname)" --privileged --name "${DOCKER_CONTAINER}" -v "${REPO_ROOT}":/root \
docker run -h "$(hostname)" --privileged --name "${DOCKER_CONTAINER}" -v ${HOME}/ONNX_CI:/home -v "${REPO_ROOT}":/root -d ngraph-onnx:ubuntu-16_04 tail -f /dev/null -d ngraph-onnx:ubuntu-16_04 tail -f /dev/null
docker cp ./prepare_environment.sh "${DOCKER_CONTAINER}":/home BUILD="TRUE"
docker exec "${DOCKER_CONTAINER}" ./home/prepare_environment.sh
fi fi
NGRAPH_WHL=$(docker exec ${DOCKER_CONTAINER} find /home/ngraph/python/dist/ -name "ngraph*.whl") if [[ "${BUILD}" == "TRUE" ]];
docker exec -e TOX_INSTALL_NGRAPH_FROM="${NGRAPH_WHL}" "${DOCKER_CONTAINER}" tox -c /root then
BUILD_NGRAPH_CMD='cd /root && \
mkdir -p ./build && \
cd ./build && \
cmake ../ -DNGRAPH_TOOLS_ENABLE=FALSE -DNGRAPH_UNIT_TEST_ENABLE=FALSE -DNGRAPH_USE_PREBUILT_LLVM=TRUE \
-DNGRAPH_ONNX_IMPORT_ENABLE=TRUE -DCMAKE_INSTALL_PREFIX=/root/ngraph_dist && \
make -j $(lscpu --parse=CORE | grep -v '"'#'"' | sort | uniq | wc -l) && \
make install && \
cd /root/python && \
if [[ -z $(ls /root/ngraph-onnx 2>/dev/null) ]]; then
git clone --recursive https://github.com/pybind/pybind11.git;
fi
export PYBIND_HEADERS_PATH=/root/python/pybind11 && \
export NGRAPH_CPP_BUILD_PATH=/root/ngraph_dist && \
export NGRAPH_ONNX_IMPORT_ENABLE=TRUE && \
python3 setup.py bdist_wheel && \
cd /root'
docker exec "${DOCKER_CONTAINER}" bash -c "${BUILD_NGRAPH_CMD}"
fi
echo "========== FOLLOWING ITEMS WERE CREATED DURING SCRIPT EXECUTION ==========" CLONE_CMD='cd /root &&\
echo "Docker image: ngraph-onnx:ubuntu-16_04" if [[ -z $(ls /root/ngraph-onnx 2>/dev/null) ]]; then
echo "Docker container: ${DOCKER_CONTAINER}" git clone '"${NGRAPH_ONNX_REPO}"';
echo "Directory: ${HOME}/ONNX_CI" fi'
echo "Multiple files generated during tox execution" docker exec "${DOCKER_CONTAINER}" bash -c "${CLONE_CMD}"
echo "" NGRAPH_WHL=$(docker exec ${DOCKER_CONTAINER} find /root/python/dist/ -name "ngraph*.whl")
echo "TO REMOVE THEM RUN THIS SCRIPT WITH PARAMETER: --cleanup" docker exec -e TOX_INSTALL_NGRAPH_FROM="${NGRAPH_WHL}" "${DOCKER_CONTAINER}" tox -c /root/ngraph-onnx/
}
# Function cleanup() removes items related to nGraph, created during script execution
function cleanup_ngraph() {
set -x
docker exec "${DOCKER_CONTAINER}" bash -c 'rm -rf /root/build/* /root/ngraph_dist /root/python/dist'
} }
# Function cleanup() removes items created during script execution # Function cleanup() removes items created during script execution
function cleanup() { function cleanup() {
docker exec "${DOCKER_CONTAINER}" bash -c 'rm -rf /home/$(find /home/ -user root)' set -x
rm -rf ${HOME}/ONNX_CI
docker exec "${DOCKER_CONTAINER}" bash -c 'rm -rf /root/$(find /root/ -user root)' docker exec "${DOCKER_CONTAINER}" bash -c "rm -rf /root/ngraph_dist /root/ngraph-onnx/.tox /root/ngraph-onnx/.onnx \
/root/ngraph-onnx/__pycache__ /root/ngraph-onnx/ngraph_onnx.egg-info /root/ngraph-onnx/cpu_codegen"
docker exec "${DOCKER_CONTAINER}" bash -c 'rm -rf $(find /root/ -user root)'
docker rm -f "${DOCKER_CONTAINER}" docker rm -f "${DOCKER_CONTAINER}"
docker rmi --force ngraph-onnx:ubuntu-16_04
} }
PATTERN='[-a-zA-Z0-9_]*=' PATTERN='[-a-zA-Z0-9_]*='
...@@ -61,10 +90,15 @@ for i in "$@" ...@@ -61,10 +90,15 @@ for i in "$@"
do do
case $i in case $i in
--help*) --help*)
printf "Following parameters are available: printf "Script builds nGraph and runs tox tests inside docker container.
Every execution after first run is going to run tox tests again.
To rebuild nGraph and run tests again use --rebuild parameter.
Following parameters are available:
--help displays this message --help displays this message
--cleanup removes docker image, container and files created during script execution --cleanup removes docker container and files created during script execution
--rebuild rebuilds nGraph and runs tox tests
" "
exit 0 exit 0
;; ;;
...@@ -72,6 +106,10 @@ do ...@@ -72,6 +106,10 @@ do
cleanup cleanup
exit 0 exit 0
;; ;;
--rebuild*)
cleanup_ngraph
BUILD="TRUE"
;;
esac esac
done done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment