Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into r0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
avijit-nervana committed Apr 4, 2019
2 parents e18b78f + 054b9be commit 28975d4
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 311 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
ExternalProject_Add(
ext_ngraph
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
GIT_TAG v0.16.0-rc.3
GIT_TAG v0.17.0-rc.1
CMAKE_ARGS
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/NervanaSystems/ngraph-tf/blob/master/LICENSE)
[![Build Status](https://badge.buildkite.com/f20db2a4be0e82e493faa08de85953d45b313b3be12abf4acf.svg)](https://buildkite.com/ngraph/ngtf-master-cpu)


# Intel(R) nGraph(TM) Compiler and runtime for TensorFlow*

This repository contains the code needed to enable Intel(R) nGraph(TM) Compiler and
Expand Down Expand Up @@ -42,7 +47,7 @@ a variety of nGraph-enabled backends: CPU, GPU, and custom silicon like the
This will produce something like this:

TensorFlow version: 1.13.1
nGraph bridge version: b'0.12.0-rc2'
nGraph bridge version: b'0.12.0-rc3'
nGraph version used for this build: b'0.21.0-rc.0+b638705'
TensorFlow version used for this build: v1.13.1-0-g6612da8951

Expand Down Expand Up @@ -84,7 +89,7 @@ The installation prerequisites are the same as described in the TensorFlow

git clone https://github.com/NervanaSystems/ngraph-tf.git
cd ngraph-tf
git checkout v0.12.0-rc2
git checkout v0.12.0-rc3


2. Next run the following Python script to build TensorFlow, nGraph and the bridge. Please use Python 3.5:
Expand Down
8 changes: 4 additions & 4 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ tf_configure(
http_archive(
name = "ngraph",
build_file = "//:bazel/ngraph.BUILD",
sha256 = "6c1a85cf58e22ad2392d57c98aeef5fd0fbe40122765a233d5efdeb1f94e227b",
strip_prefix = "ngraph-0.16.0-rc.2",
sha256 = "517f2430ab1434021c2c4e3daf6f52cc855e4134632ed7c517a2c9c4b2c28f6b",
strip_prefix = "ngraph-0.17.0-rc.1",
urls = [
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.16.0-rc.2.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.16.0-rc.2.tar.gz",
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.17.0-rc.1.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.17.0-rc.1.tar.gz",
],
)

Expand Down
2 changes: 1 addition & 1 deletion build_ngtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main():
#-------------------------------

# Component versions
ngraph_version = "v0.16.0-rc.3"
ngraph_version = "v0.17.0-rc.1"
tf_version = "v1.13.1"

# Default directories
Expand Down
2 changes: 1 addition & 1 deletion python/setup.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_tag(self):

setup(
name='ngraph_tensorflow_bridge',
version='0.12.0rc2',
version='0.12.0rc3',
description='Intel nGraph compiler and runtime for TensorFlow',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
10 changes: 5 additions & 5 deletions src/ngraph_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2522,9 +2522,10 @@ static Status TranslatePadOp(const Node* op,
"elements");
}

ng::Shape padding_below(paddings.size() / 2);
ng::Shape padding_above(paddings.size() / 2);
ng::CoordinateDiff padding_below(paddings.size() / 2);
ng::CoordinateDiff padding_above(paddings.size() / 2);
ng::Shape padding_interior(paddings.size() / 2);
auto pad_mode = ng::op::PadMode::CONSTANT;

for (size_t i = 0; i < paddings.size() / 2; i++) {
padding_below[i] = paddings[2 * i];
Expand All @@ -2539,9 +2540,8 @@ static Status TranslatePadOp(const Node* op,
auto pad_val_op = ConstructNgNode<ng::op::Constant>(
op->name(), ng_input->get_element_type(), ng::Shape{},
std::vector<std::string>{"0"});
auto pad_op = ConstructNgNode<ng::op::Pad>(op->name(), ng_input, pad_val_op,
padding_below, padding_above,
padding_interior);
auto pad_op = ConstructNgNode<ng::op::Pad>(
op->name(), ng_input, pad_val_op, padding_below, padding_above, pad_mode);

SaveNgOp(ng_op_map, op->name(), pad_op);
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// candidate such as v0.7.0-rc0
// The code in master will always have the last released version number
// with a suffix of '-master'
#define NG_TF_VERSION_SUFFIX "-rc2"
#define NG_TF_VERSION_SUFFIX "-rc3"

#define VERSION_STR_HELPER(x) #x
#define VERSION_STR(x) VERSION_STR_HELPER(x)
Expand Down
31 changes: 16 additions & 15 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@ if (APPLE)
set(NGRAPH_TF_CXX11_ABI 0)
endif()

# If pre-built tensorflow CC library is not provided, then build one.
# TODO: Remove this option once we migrate to build_ngtf.py
if (NOT UNIT_TEST_TF_CC_DIR)
add_custom_target(
build_tf_cc
COMMENT "Building TensorFlow C++ library"
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/build_tf_cc.sh
${TensorFlow_SRC_DIR}
${NGRAPH_TF_CXX11_ABI}
)

add_dependencies(gtest_ngtf build_tf_cc)
endif()

target_link_libraries(
gtest_ngtf
ngraph_bridge
Expand All @@ -107,3 +92,19 @@ target_link_libraries(
)

add_subdirectory(python)

if (DEFINED NGRAPH_TF_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${NGRAPH_TF_INSTALL_PREFIX})
else()
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/../install/")
endif()

# First install the libngraph_bridge.so and headers
install(TARGETS gtest_ngtf DESTINATION ${CMAKE_INSTALL_PREFIX}/test)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_axpy.pbtxt DESTINATION ${CMAKE_INSTALL_PREFIX}/test)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_axpy_launchop.pbtxt DESTINATION ${CMAKE_INSTALL_PREFIX}/test)
install(
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/python
DESTINATION ${CMAKE_INSTALL_PREFIX}/test
FILES_MATCHING PATTERN "*.py"
)
63 changes: 0 additions & 63 deletions test/build_tf_cc.sh

This file was deleted.

103 changes: 103 additions & 0 deletions test/ci/buildkite/test_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env python3
# ==============================================================================
# Copyright 2018 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.
# ==============================================================================
import argparse
import errno
import os
from subprocess import check_output, call
import sys
import shutil
import glob
import platform
from distutils.sysconfig import get_python_lib

#from tools.build_utils import load_venv, command_executor
from tools.test_utils import *


def main():
'''
Tests nGraph-TensorFlow Python 3. This script needs to be run after
running build_ngtf.py which builds the ngraph-tensorflow-bridge
and installs it to a virtual environment that would be used by this script.
'''
parser = argparse.ArgumentParser()
parser.add_argument(
'--test_cpp',
help="Runs C++ tests (GTest based).\n",
action="store_true")

parser.add_argument(
'--test_python',
help="Runs Python tests (Pytest based).\n",
action="store_true")

parser.add_argument(
'--test_tf_python',
help="Runs TensorFlow Python tests (Pytest based).\n",
action="store_true")

parser.add_argument(
'--test_resnet',
help="Runs TensorFlow Python tests (Pytest based).\n",
action="store_true")

parser.add_argument(
'--artifacts_dir',
type=str,
help=
"Location of the artifacts that would be used for running the tests\n",
action="store")

parser.add_argument(
'--backend',
type=str,
help="String indicating what backend to use (e.g., CPU, INTERPRETER)\n",
action="store")

arguments = parser.parse_args()

#-------------------------------
# Recipe
#-------------------------------

root_pwd = os.getcwd()

# Check for mandetary parameters
if not arguments.artifacts_dir:
raise Exception("Need to specify --artifacts_dir")

# Set the backend if specified
if (arguments.backend):
os.environ['NGRAPH_TF_BACKEND'] = arguments.backend

# Decide which tests to run
if (arguments.test_cpp):
run_ngtf_cpp_gtests(arguments.artifacts_dir, './', None)
elif (arguments.test_python):
run_ngtf_pytests_from_artifacts(arguments.artifacts_dir)
elif (arguments.test_tf_python):
raise Exception("TensorFlow Python tests are not yet supported")
elif (arguments.test_resnet):
run_resnet50_from_artifacts(arguments.artifacts_dir)
else:
raise Exception("No tests specified")

os.chdir(root_pwd)


if __name__ == '__main__':
main()
2 changes: 2 additions & 0 deletions test/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ foreach(file ${files})
${CMAKE_CURRENT_BINARY_DIR}/${file}
)
endforeach()


1 change: 0 additions & 1 deletion test/python/tensorflow/python_tests_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,3 @@ transpose_op_test.TransposeTest.testTranspose2DAuto
#transpose_op_test.TransposeTest.testInt16
#transpose_op_test.TransposeTest.testInt8
transpose_op_test.TransposeTest.testError

23 changes: 23 additions & 0 deletions test/test_array_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,29 @@ TEST(ArrayOps, OneHot3dNegAxis) {

} // end of op OneHot

TEST(ArrayOps, Pad) {
Scope root = Scope::NewRootScope();

vector<int> static_input_indexes = {1};

Tensor input(DT_INT32, TensorShape({2, 3}));

Tensor paddings(DT_INT32, TensorShape({2, 2}));

AssignInputValuesRandom<int>(input, 1, 4);
AssignInputValuesRandom<int>(paddings, 2, 5);

auto R = ops::Pad(root, input, paddings);
vector<DataType> output_datatypes = {DT_INT32};
std::vector<Output> sess_run_fetchoutputs = {R};

OpExecuter opexecuter(root, "Pad", static_input_indexes, output_datatypes,
sess_run_fetchoutputs);

opexecuter.RunTest();

} // end of op Pad

// Test op: PreventGradient
TEST(ArrayOps, PreventGradient) {
Scope scope_cpu = Scope::NewRootScope();
Expand Down
Loading

0 comments on commit 28975d4

Please sign in to comment.