diff --git a/dockerfiles/Dockerfile.ngraph b/dockerfiles/Dockerfile.ngraph index c21002f0d7..54dc3ec51f 100644 --- a/dockerfiles/Dockerfile.ngraph +++ b/dockerfiles/Dockerfile.ngraph @@ -4,17 +4,20 @@ #-------------------------------------------------------------------------- FROM ubuntu:16.04 +ARG PYTHON_VERSION=3.5 +ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get install -y sudo \ - build-essential curl \ - libcurl4-openssl-dev \ - libssl-dev wget \ - python 3.6 python3-pip \ - python3-dev git -RUN pip3 install --upgrade pip -RUN pip3 install numpy onnx + apt-get install -y sudo git bash -RUN pip3 install onnxruntime-ngraph -WORKDIR /code +ENV PATH="/opt/cmake/bin:${PATH}" +RUN git clone --recursive https://github.com/Microsoft/onnxruntime onnxruntime +RUN /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_ubuntu.sh -p ${PYTHON_VERSION} && \ + /onnxruntime/tools/ci_build/github/linux/docker/scripts/install_deps.sh + +WORKDIR / +RUN mkdir -p /onnxruntime/build && \ + python3 /onnxruntime/tools/ci_build/build.py --build_dir /onnxruntime/build --config Release --build_shared_lib --skip_submodule_sync --build_wheel --parallel --use_ngraph && \ + pip3 install /onnxruntime/build/Release/dist/onnxruntime_ngraph-*.whl && \ + rm -rf /onnxruntime \ No newline at end of file diff --git a/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc b/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc index 634048db9b..086570cb15 100644 --- a/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc +++ b/onnxruntime/core/providers/ngraph/ngraph_execution_provider.cc @@ -107,9 +107,13 @@ static bool IsUnsupportedOpMode(const Node* node, const onnxruntime::GraphViewer // ceil_mode and dilations attrs are not supported in nGraph const auto& attributes = node->GetAttributes(); - if (attributes.find("ceil_mode") != attributes.end()) { + const auto ceil_attr = attributes.find("ceil_mode"); + // default value of ceil_mode (0) is supported. + if (ceil_attr != attributes.end() && ceil_attr->second.i() != 0) { return true; - } else if (attributes.find("dilations") != attributes.end()) { + } + + if (attributes.find("dilations") != attributes.end()) { return true; } } else if (optype == "OneHot") { @@ -169,7 +173,9 @@ static bool IsUnsupportedOpMode(const Node* node, const onnxruntime::GraphViewer } else if (optype == "AveragePool") { // ceil_mode attribute is not supported in nGraph const auto& attributes = node->GetAttributes(); - if (attributes.find("ceil_mode") != attributes.end()) { + const auto ceil_attr = attributes.find("ceil_mode"); + // default value of ceil_mode (0) is supported. + if (ceil_attr != attributes.end() && ceil_attr->second.i() != 0) { return true; } } diff --git a/onnxruntime/test/providers/provider_test_utils.cc b/onnxruntime/test/providers/provider_test_utils.cc index 7ba0fd972b..1422ff8898 100644 --- a/onnxruntime/test/providers/provider_test_utils.cc +++ b/onnxruntime/test/providers/provider_test_utils.cc @@ -472,17 +472,14 @@ void OpTester::Run(ExpectResult expect_result, continue; //if node is not registered for the provider, skip - node.SetExecutionProviderType(provider_type); - if (provider_type == onnxruntime::kTensorrtExecutionProvider) + node.SetExecutionProviderType(provider_type); + if (provider_type == onnxruntime::kNGraphExecutionProvider || provider_type == onnxruntime::kTensorrtExecutionProvider) continue; auto reg = execution_provider->GetKernelRegistry(); - // nGraph EP doesn't have kernels registered - if (!reg->IsEmpty()) { - const KernelCreateInfo* kci = reg->TryFindKernel(node, execution_provider->Type()); - if (!kci) { - valid = false; - break; - } + const KernelCreateInfo* kci = reg->TryFindKernel(node, execution_provider->Type()); + if (!kci) { + valid = false; + break; } } diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 4daba04e4d..7449970d8f 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -507,8 +507,7 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs, enab if enable_python_tests: # Disable python tests for TensorRT because many tests are not supported yet - if enable_tensorrt or enable_ngraph: - print("NOT RUNNING") + if enable_tensorrt : return if is_windows(): cwd = os.path.join(cwd, config) diff --git a/tools/ci_build/github/azure-pipelines/linux-ngraph-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/linux-ngraph-ci-pipeline.yml index d7ac1c5c9e..24790be099 100644 --- a/tools/ci_build/github/azure-pipelines/linux-ngraph-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/linux-ngraph-ci-pipeline.yml @@ -4,6 +4,16 @@ jobs: steps: - template: templates/set-test-data-variables-step.yml + - task: CmdLine@2 + displayName: 'Clean untagged docker images' + inputs: + script: | + docker rm $(docker ps -a | grep Exited | awk '{print $1;}') || true + docker images -q --filter "dangling=true" | xargs -n1 -r docker rmi + workingDirectory: $(Build.BinariesDirectory) + continueOnError: true + condition: always() + - task: CmdLine@2 displayName: 'Download azcopy' inputs: