Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ include(ExternalProject)
include(CMakeDependentOption)
include(cmake/sdl.cmake)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-comment -Wno-sign-compare")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-comment -Wno-sign-compare -Wno-backslash-newline-escape")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-comment -Wno-sign-compare")
endif()

# In order to compile ngraph-tf with memory leak detection, run `cmake` with `-DCMAKE_BUILD_TYPE=Sanitize`.
# N.B.: This *will* crash python unit tests because ngraph-tf will be loaded "too late" via `dlopen`,
Expand Down Expand Up @@ -244,7 +248,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
ExternalProject_Add(
ext_ngraph
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
GIT_TAG v0.25.1-rc.2
GIT_TAG v0.25.1-rc.9
CMAKE_ARGS
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}
Expand Down Expand Up @@ -322,10 +326,6 @@ if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
${LIB_MKLML_INTEL_IMPORTED_LOCATION}
)

add_library(lib_tbb INTERFACE)
target_link_libraries(lib_tbb INTERFACE
${NGRAPH_INSTALL_DIR}/${LIB}/libtbb.so)

add_library(lib_iomp5 SHARED IMPORTED)
set_target_properties(
lib_iomp5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Once TensorFlow's dependencies are installed, clone the `ngraph-bridge` repo:

git clone https://github.com/tensorflow/ngraph-bridge.git
cd ngraph-bridge
git checkout v0.19.0-rc1
git checkout v0.19.0-rc6

Run the following Python script to build TensorFlow, nGraph, and the bridge. Use Python 3.5:

Expand Down
35 changes: 35 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ cc_library(
"-pthread",
"-std=c++11",
"-D_FORTIFY_SOURCE=2",
"-Wall",
"-Wextra",
"-Wno-comment",
"-Wno-sign-compare",
"-Wformat",
"-Wformat-security",
"-fstack-protector-all",
Expand Down Expand Up @@ -146,3 +150,34 @@ tf_cc_binary(
linkstatic=True,
visibility = ["//visibility:public"],
)

tf_cc_binary(
name = 'infer_multi',
srcs = [
"examples/cpp/infer_multiple_networks/main.cc",
"examples/cpp/infer_multiple_networks/inference_engine.h",
"examples/cpp/infer_multiple_networks/inference_engine.cc",
"examples/cpp/tf_label_image_utils.cc",
],
deps = [
"@org_tensorflow//tensorflow/cc:cc_ops",
"@org_tensorflow//tensorflow/cc:client_session",
"@org_tensorflow//tensorflow/core:tensorflow",
":ngraph_bridge_lib",
"@ngraph//:cpu_backend",
],
copts = [
"-pthread",
"-std=c++11",
"-D_FORTIFY_SOURCE=2",
"-Wformat",
"-Wformat-security",
"-Wformat",
"-fstack-protector-all",
"-I ngraph_bridge",
"-I external/ngraph/src",
"-I logging",
] + CXX_ABI,
linkstatic=False,
visibility = ["//visibility:public"],
)
19 changes: 4 additions & 15 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow")
http_archive(
name = "ngraph",
build_file = "//:bazel/ngraph.BUILD",
sha256 = "d3e0ebf807dd4179c91a41c80639b75f5ea8ca39cdfe3a5697da56a7df894f11",
strip_prefix = "ngraph-0.25.1-rc.2",
sha256 = "bb9effe71818d932dfa1f024051ba716267ca1b2fc35471faf780f7bfdf6c9b3",
strip_prefix = "ngraph-0.25.1-rc.9",
urls = [
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.2.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.2.tar.gz"
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.9.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.9.tar.gz"
],
)

Expand All @@ -74,17 +74,6 @@ http_archive(
],
)

http_archive(
name = "tbb",
build_file = "//:bazel/tbb.BUILD",
sha256 = "c3245012296f09f1418b78a8c2f17df5188b3bd0db620f7fd5fabe363320805a",
strip_prefix = "tbb-2019_U1",
urls = [
"http://mirror.tensorflow.org/github.com/01org/tbb/archive/2019_U1.zip",
"https://github.com/01org/tbb/archive/2019_U1.zip",
],
)

http_archive(
name = "eigen",
build_file = "//:bazel/eigen.BUILD",
Expand Down
56 changes: 56 additions & 0 deletions bazel/docker/Dockerfile.clang-8.ubuntu18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# ==============================================================================
# Copyright 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# Docker file to setup build envrionment for nGraph-TensorFlow

FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
vim \
python \
python-pip \
python3-pip \
git \
unzip zip wget \
sudo \
zlib1g zlib1g-dev bash-completion \
build-essential cmake \
clang-format-3.9

RUN pip install -U virtualenv==16.0.0

#install latest cmake
ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
RUN mkdir /opt/cmake
RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
RUN cmake --version

#Install Bazel
ADD https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh ./bazel-0.24.1-installer-linux-x86_64.sh
RUN bash bazel-0.24.1-installer-linux-x86_64.sh
RUN bazel

#install gcc-4.8 and register both 7 and 4.8 with alternatives
#RUN apt-get update && apt-get install -y gcc-4.8 g++-4.8
#RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 && \
#update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

# Install Clang
RUN apt-get install -y clang-8 libc++-dev libc++abi-dev

# Set the environment variables CC and CXX to point to clang-8
ENV CC clang-8
ENV CXX clang++-8
22 changes: 22 additions & 0 deletions bazel/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# How to use this Dockerfile (Dockerfile.clang-8.ubuntu18.04)
1. Create a dir where you want to build eg: docker_demo/build
2. Download ngraph-bridge repo : git clone https://github.com/tensorflow/ngraph-bridge.git
3. Build docker
docker build -t <ngtf_build> -f Dockerfile.clang-8.ubuntu18.04 .
or
If users want to build behind corporate proxy, they can always build it this way:
docker build \
--build-arg HTTP_PROXY=${HTTP_PROXY} \
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
--build-arg NO_PROXY=${NO_PROXY} \
--build-arg http_proxy=${http_proxy} \
--build-arg https_proxy=${https_proxy} \
--build-arg no_proxy=${no_proxy} \
-f Dockerfile.clang-8.ubuntu18.04 .
4. docker run -it -v ${PWD}:/<workspace> -w /<workspace> <ngtf_build>
5. Create a virtual env : virtualenv -p python3 <venv3>
6. Activate the virtual env : source venv3/bin/activate
7. pip install future
8. cd ngraph-bridge
9. ./configure_bazel.sh
10. BAZEL_LINKOPTS=-lc++ BAZEL_CXXOPTS=-stdlib=libc++ bazel build :hello_tf
8 changes: 3 additions & 5 deletions bazel/ngraph.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"v0.25.1-rc.2\\"',
'-D NGRAPH_VERSION=\\"v0.25.1-rc.9\\"',
"-D NGRAPH_DEX_ONLY",
'-D PROJECT_ROOT_DIR=\\"\\"',
'-D NGRAPH_STATIC_LIB_ENABLE'
Expand Down Expand Up @@ -117,7 +117,7 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"v0.25.1-rc.2\\"',
'-D NGRAPH_VERSION=\\"v0.25.1-rc.9\\"',
"-D NGRAPH_DEX_ONLY",
'-D PROJECT_ROOT_DIR=\\"\\"',
] + CXX_ABI,
Expand Down Expand Up @@ -255,7 +255,6 @@ cc_library(
deps = [
":ngraph_headers",
":ngraph_core",
"@tbb",
"@eigen",
"@mkl_dnn",
],
Expand All @@ -269,9 +268,8 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"0.25.1-rc.2\\"',
'-D NGRAPH_VERSION=\\"0.25.1-rc.9\\"',
"-D NGRAPH_DEX_ONLY",
"-D NGRAPH_TBB_ENABLE",
'-D PROJECT_ROOT_DIR=\\"\\"',
'-D NGRAPH_CPU_STATIC_LIB_ENABLE'
] + CXX_ABI,
Expand Down
75 changes: 0 additions & 75 deletions bazel/tbb.BUILD

This file was deleted.

4 changes: 2 additions & 2 deletions build_ngtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():
'''

# Component versions
ngraph_version = "v0.25.1-rc.2"
ngraph_version = "v0.25.1-rc.9"
tf_version = "v1.14.0"

# Command line parser options
Expand Down Expand Up @@ -361,7 +361,7 @@ def main():
"-DNGRAPH_USE_CXX_ABI=" + cxx_abi, "-DNGRAPH_DEX_ONLY=TRUE",
"-DNGRAPH_DEBUG_ENABLE=NO", "-DNGRAPH_UNIT_TEST_ENABLE=NO",
"-DNGRAPH_TARGET_ARCH=" + target_arch,
"-DNGRAPH_TUNE_ARCH=" + target_arch
"-DNGRAPH_TUNE_ARCH=" + target_arch, "-DNGRAPH_TBB_ENABLE=FALSE"
]

if arguments.use_ngraph_staticlibs:
Expand Down
33 changes: 0 additions & 33 deletions examples/cpp/infer_multiple_networks/BUILD

This file was deleted.

4 changes: 2 additions & 2 deletions examples/cpp/infer_multiple_networks/inference_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern tf::Status ReadTensorFromImageFile(const std::vector<string>& file_names,

namespace infer_multiple_networks {

InferenceEngine::InferenceEngine(const string& name, const string& backend)
: m_name(name) {}
InferenceEngine::InferenceEngine(const string& name) : m_name(name) {}

Status InferenceEngine::Load(const string& network,
const std::vector<string>& image_files,
int input_width, int input_height,
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/infer_multiple_networks/inference_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace infer_multiple_networks {

class InferenceEngine {
public:
InferenceEngine(const string& name, const string& backend);
InferenceEngine(const string& name);
~InferenceEngine();

Status Load(const string& network, const std::vector<string>& image_files,
Expand Down
Loading