Unverified Commit 2ad5fe08 authored by Jai Menon's avatar Jai Menon Committed by GitHub

Merge branch 'master' into jmenon/cpu

parents 3b521a90 9c736245
......@@ -46,6 +46,31 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# set directory where the custom finders live
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
#-----------------------------------------------------------------------------------------------
# Installation logic...
#-----------------------------------------------------------------------------------------------
# Default installation location for cmake usually is /usr/include or /usr/local/include
# which requires sudo access on most servers. Also, this creates a problem for the shared
# development systems (e.g., build servers).
#
# Therefore we are setting the installation directory so that by defult "make install"
# won't override artifacts generated by other users.
#
# The user can always override this by using the cmake command listed below.
if (DEFINED NGRAPH_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${NGRAPH_INSTALL_PREFIX})
else()
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/ngraph_dist")
endif()
message (STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")
message (STATUS "To Override use: cmake -DNGRAPH_INSTALL_PREFIX=/foo")
# Destinations
set(NGRAPH_INSTALL_LIB "${CMAKE_INSTALL_PREFIX}/lib")
set(NGRAPH_INSTALL_INCLUDE "${CMAKE_INSTALL_PREFIX}/include")
set(NGRAPH_INSTALL_DOC "${CMAKE_INSTALL_PREFIX}/doc")
#-----------------------------------------------------------------------------------------------
# Compiler-specific logic...
#-----------------------------------------------------------------------------------------------
......
# NOTE: This file is a copy of https://llvm.org/svn/llvm-project/llvm/trunk/cmake/modules/FindSphinx.cmake
# CMake find_package() Module for Sphinx documentation generator
# http://sphinx-doc.org/
#
# Example usage:
#
# find_package(Sphinx)
#
# If successful the following variables will be defined
# SPHINX_FOUND
# SPHINX_EXECUTABLE
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build sphinx-build2
DOC "Path to sphinx-build executable")
# Handle REQUIRED and QUIET arguments
# this will also set SPHINX_FOUND to true if SPHINX_EXECUTABLE exists
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sphinx
"Failed to locate sphinx-build executable"
SPHINX_EXECUTABLE)
# Comment out the following options, because we don't intend to actually give people
# this choice for now. --cconvey
#
## Provide options for controlling different types of output
#option(SPHINX_OUTPUT_HTML "Output standalone HTML files" ON)
#option(SPHINX_OUTPUT_MAN "Output man pages" ON)
#
#option(SPHINX_WARNINGS_AS_ERRORS "When building documentation treat warnings as errors" ON)
......@@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \
clang-3.9 clang-format-3.9 \
git \
wget patch diffutils zlib1g-dev libtinfo-dev \
doxygen sphinx-doc
doxygen python-sphinx
RUN apt-get clean autoclean && \
apt-get autoremove -y
......
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen not found, cannot build documentation")
endif (DOXYGEN_FOUND)
# Copyright 2017 Nervana Systems Inc.
# 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.
add_custom_target( docs
COMMENT "Build all of the documentation types selected during CMake configuration."
)
set(DOCS_TARGET_IS_EMPTY TRUE)
add_subdirectory( doxygen )
add_subdirectory( sphinx )
if (DOCS_TARGET_IS_EMPTY)
add_custom_target( docs-is-noop-error
COMMAND echo
COMMAND echo "The 'docs' target does nothing because every kind of doc was disabled during configuration"
COMMAND echo
COMMAND false
VERBATIM
)
add_dependencies( docs docs-is-noop-error )
endif()
# Copyright 2017 Nervana Systems Inc.
# 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.
set(NGRAPH_BUILD_DOXYGEN_DOCS FALSE
CACHE BOOL
"The NGraph build system shall contain a target for Doxygen-based docs."
)
if (NGRAPH_BUILD_DOXYGEN_DOCS)
find_package(Doxygen REQUIRED)
set(DOXYGEN_IN "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in")
set(DOXYGEN_OUT "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
configure_file("${DOXYGEN_IN}" "${DOXYGEN_OUT}" @ONLY)
add_custom_target(doxygen-docs
ALL
COMMAND "${DOXYGEN_EXECUTABLE}" "${DOXYGEN_OUT}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Generating documentation with Doxygen"
VERBATIM )
add_dependencies( docs doxygen-docs )
set(DOCS_TARGET_IS_EMPTY FALSE PARENT_SCOPE)
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
DESTINATION "${NGRAPH_INSTALL_DOC}/api-reference/html"
OPTIONAL
)
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/latex/"
DESTINATION "${NGRAPH_INSTALL_DOC}/api-reference/latex"
OPTIONAL
)
endif()
# Copyright 2017 Nervana Systems Inc.
# 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.
set(NGRAPH_BUILD_SPHINX_DOCS FALSE
CACHE BOOL
"The NGraph build system shall contain a target for '.rst'-based overview docs."
)
if (NGRAPH_BUILD_SPHINX_DOCS)
find_package(Sphinx REQUIRED)
set(SPHINX_IN ${CMAKE_CURRENT_SOURCE_DIR}/source)
set(SPHINX_OUT ${CMAKE_CURRENT_BINARY_DIR}/build)
add_custom_target(sphinx-docs
ALL
COMMAND ${SPHINX_EXECUTABLE} -b html "${SPHINX_IN}" "${SPHINX_OUT}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Generating documentation with Sphinx"
VERBATIM )
add_dependencies( docs sphinx-docs )
set(DOCS_TARGET_IS_EMPTY FALSE PARENT_SCOPE)
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/"
DESTINATION "${NGRAPH_INSTALL_DOC}/overview/html"
OPTIONAL
)
endif()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NGraph-C++ documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 26 13:46:53 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.todo',
'sphinx.ext.mathjax']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'NGraph-C++'
copyright = '2017, Intel Nervana'
author = 'Intel Nervana'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'NGraph-Cdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'NGraph-C.tex', 'NGraph-C++ Documentation',
'Intel Nervana', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'ngraph-c', 'NGraph-C++ Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'NGraph-C', 'NGraph-C++ Documentation',
author, 'NGraph-C', 'One line description of project.',
'Miscellaneous'),
]
.. NGraph-C++ documentation master file, created by
sphinx-quickstart on Thu Oct 26 13:46:53 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to NGraph-C++'s documentation!
======================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`
# Required to build the main components of NGraph-C++
build-essential
cmake
git
# Required to build the documentation of NGraph-C++
doxygen
sphinx-build
......@@ -77,7 +77,6 @@ set (SRC
runtime/tensor_view.cpp
runtime/tuple.cpp
runtime/utils.cpp
test/all_close.cpp
shape.cpp
types/element_type.cpp
types/type.cpp
......@@ -142,31 +141,11 @@ endif()
# Installation logic...
#-----------------------------------------------------------------------------------------------
# Default installation location for cmake usually is /usr/include or /usr/local/include
# which requires sudo access on most servers. Also, this creates a problem for the shared
# development systems (e.g., build servers).
#
# Therefore we are setting the installation directory so that by defult "make install"
# won't override artifacts generated by other users.
#
# The user can always override this by using the cmake command listed below.
if (NGRAPH_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${NGRAPH_INSTALL_PREFIX})
else()
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/ngraph_dist")
endif()
message (STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")
message (STATUS "To Override use: cmake -DNGRAPH_INSTALL_PREFIX=/foo")
# Destinations
set(CMAKE_INSTALL_LIB "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_INCLUDE "${CMAKE_INSTALL_PREFIX}/include")
# NGraph
install(TARGETS ngraph DESTINATION ${CMAKE_INSTALL_LIB}) # libngraph.so
install(TARGETS ngraph DESTINATION ${NGRAPH_INSTALL_LIB}) # libngraph.so
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION "${CMAKE_INSTALL_INCLUDE}/ngraph"
DESTINATION "${NGRAPH_INSTALL_INCLUDE}/ngraph"
FILES_MATCHING PATTERN "*.hpp"
)
......@@ -180,16 +159,16 @@ install(DIRECTORY
install(DIRECTORY
${EIGEN_INCLUDE_DIR}/
DESTINATION "${CMAKE_INSTALL_INCLUDE}"
DESTINATION "${NGRAPH_INSTALL_INCLUDE}"
)
if (NOT APPLE)
install(DIRECTORY
${MKLDNN_INCLUDE_DIR}/
DESTINATION "${CMAKE_INSTALL_INCLUDE}"
DESTINATION "${NGRAPH_INSTALL_INCLUDE}"
)
install(DIRECTORY
${MKLDNN_LIB_DIR}/
DESTINATION "${CMAKE_INSTALL_LIB}"
DESTINATION "${NGRAPH_INSTALL_LIB}"
)
endif()
......
......@@ -367,10 +367,6 @@ ExternalFunction::OpMap& ExternalFunction::get_op_map()
REGISTER_NUMERIC_BINOP(op::Add, eigen::AddInstruction);
REGISTER_NUMERIC_BINOP(op::Divide, eigen::DivideInstruction);
REGISTER_NUMERIC_BINOP(op::Greater, eigen::GreaterThanInstruction);
REGISTER_NUMERIC_BINOP(op::GreaterEq, eigen::GreaterEqInstruction);
REGISTER_NUMERIC_BINOP(op::Less, eigen::LessThanInstruction);
REGISTER_NUMERIC_BINOP(op::LessEq, eigen::LessEqInstruction);
REGISTER_NUMERIC_BINOP(op::Maximum, eigen::MaximumInstruction);
REGISTER_NUMERIC_BINOP(op::Minimum, eigen::MinimumInstruction);
REGISTER_NUMERIC_BINOP(op::Multiply, eigen::MultiplyInstruction);
......@@ -395,6 +391,10 @@ ExternalFunction::OpMap& ExternalFunction::get_op_map()
REGISTER_POLYMORPHIC_BINOP(op::Equal, eigen::EqualInstruction);
REGISTER_POLYMORPHIC_BINOP(op::NotEqual, eigen::NotEqualInstruction);
REGISTER_POLYMORPHIC_BINOP(op::Greater, eigen::GreaterThanInstruction);
REGISTER_POLYMORPHIC_BINOP(op::GreaterEq, eigen::GreaterEqInstruction);
REGISTER_POLYMORPHIC_BINOP(op::Less, eigen::LessThanInstruction);
REGISTER_POLYMORPHIC_BINOP(op::LessEq, eigen::LessEqInstruction);
REGISTER_POLYMORPHIC_TERNOP(op::Select, eigen::SelectInstruction);
......
......@@ -41,7 +41,7 @@ const std::string& ngraph::element::Type::c_type_string() const
bool ngraph::element::Type::operator==(const element::Type& other) const
{
return m_bitwidth == other.m_bitwidth && m_is_float == other.m_is_float &&
m_is_signed == other.m_is_signed;
m_is_signed == other.m_is_signed && m_cname == other.m_cname;
}
size_t ngraph::element::Type::size() const
......
......@@ -22,10 +22,8 @@ include_directories(
)
set (SRC
autodiff.cpp
build_graph.cpp
eigen.cpp
element_type.cpp
execute.cpp
input_output_assign.cpp
main.cpp
......@@ -35,9 +33,11 @@ set (SRC
pass_memory_layout.cpp
shape.cpp
tensor.cpp
test_tools.cpp
topological_sort.cpp
type_prop.cpp
util/all_close.cpp
util/autodiff.cpp
util/test_tools.cpp
util.cpp
uuid.cpp
)
......
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
#include "ngraph/types/element_type.hpp"
using namespace ngraph;
......@@ -848,6 +848,30 @@ TEST(execute, lesseq)
ASSERT_EQ((vector<char>{1, 0, 1, 0, 1, 1, 0, 1}), result->get_vector());
}
TEST(execute, lesseq_bool)
{
auto shape = Shape{2, 2, 2};
auto A = make_shared<op::Parameter>(element::Bool::element_type(), shape);
auto B = make_shared<op::Parameter>(element::Bool::element_type(), shape);
auto rt = make_shared<TensorViewType>(element::Bool::element_type(), shape);
auto f = make_shared<Function>(make_shared<op::LessEq>(A, B), rt, op::Parameters{A, B});
auto manager = runtime::Manager::get("NGVM");
auto external = manager->compile(f);
auto backend = manager->allocate_backend();
auto cf = backend->make_call_frame(external);
// Create some tensors for input/output
auto a = backend->make_parameterized_tensor_view<element::Bool>(shape);
*a = vector<char>{1, 1, 1, 1, 1, 1, 1, 1};
auto b = backend->make_parameterized_tensor_view<element::Bool>(shape);
*b = vector<char>{0, 0, 0, 0, 0, 0, 0, 0};
auto result = backend->make_parameterized_tensor_view<element::Bool>(shape);
(*cf)({a, b}, {result});
ASSERT_EQ((vector<char>{0, 0, 0, 0, 0, 0, 0, 0}), result->get_vector());
}
TEST(execute, log)
{
auto shape = Shape{2, 2, 2};
......
......@@ -30,7 +30,7 @@
#include "ngraph/pass/topological_sort.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "test_tools.hpp"
#include "util/test_tools.hpp"
using namespace std;
using namespace ngraph;
......
......@@ -25,7 +25,7 @@
#include "ngraph/pass/propagate_types.hpp"
#include "ngraph/pass/topological_sort.hpp"
#include "ngraph/util.hpp"
#include "test_tools.hpp"
#include "util/test_tools.hpp"
using namespace ngraph;
using namespace std;
......
......@@ -29,7 +29,7 @@
#include "ngraph/pass/propagate_types.hpp"
#include "ngraph/pass/topological_sort.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "test_tools.hpp"
#include "util/test_tools.hpp"
using namespace ngraph;
using namespace std;
......
......@@ -26,7 +26,7 @@
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/propagate_types.hpp"
#include "ngraph/pass/topological_sort.hpp"
#include "test_tools.hpp"
#include "util/test_tools.hpp"
using namespace std;
using namespace ngraph;
......
......@@ -29,7 +29,7 @@
#include "ngraph/pass/topological_sort.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "ngraph/util.hpp"
#include "test_tools.hpp"
#include "util/test_tools.hpp"
using namespace std;
using namespace ngraph;
......
......@@ -19,8 +19,8 @@
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "ngraph/test/all_close.hpp"
#include "ngraph/util.hpp"
#include "util/all_close.hpp"
using namespace std;
using namespace ngraph;
......
......@@ -16,8 +16,8 @@
#include <memory>
#include <vector>
#include "all_close.hpp"
#include "ngraph/except.hpp"
#include "ngraph/test/all_close.hpp"
template <typename ET>
bool ngraph::test::all_close(
......
......@@ -19,12 +19,12 @@
#include "gtest/gtest.h"
#include "all_close.hpp"
#include "ngraph/autodiff/backprop_derivative.hpp"
#include "ngraph/autodiff/backprop_function.hpp"
#include "ngraph/autodiff/numeric_derivative.hpp"
#include "ngraph/ngraph.hpp"
#include "ngraph/test/all_close.hpp"
#include "ngraph/test/random.hpp"
#include "random.hpp"
using namespace std;
using namespace ngraph;
......
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