Commit 4e682903 authored by Scott Cyphers's avatar Scott Cyphers

Merge branch 'master' into cyphers/sizes

parents 3a52dadc 3c815ee4
......@@ -36,7 +36,7 @@ set(NGRAPH_CXX_WARNING_FLAGS "")
# Compiler-specific logic...
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
message("setting clang flags...")
message( STATUS "Setting clang flags...")
include( cmake/clang_4_0_flags.cmake )
endif()
......
......@@ -16,8 +16,10 @@ TODO
1. Create a build directory outside of source directory tree.
2. `cd` to the build directory.
3. Run CMake. For example, `cmake ../private-ngraph-cpp -DCMAKE_CXX_COMPILER=clang++-3.9`
4. Run `make`.
3. Run `cmake`. For example, `cmake ../`
4. Run `make -j8`.
5. Run `make install`
6. This will install the libngraph.so and the header files to your home directory/ngraph_dist.
# Testing `libngraph`
......@@ -32,6 +34,26 @@ To perform the unit tests
# Using `libngraph`
## From Tensorflow as XLA plugin
:warning: Note: Work in Progress.
1. Get the Nervana's fork of the TF from this repo: ```git@github.com:NervanaSystems/ngraph-tensorflow.git```
2. Go to the end near the following snippet:
```
native.new_local_repository(
name = "ngraph_external",
path = "/your/home/directory/where/ngraph_is_installed",
build_file = str(Label("//tensorflow/compiler/plugin/ngraph:ngraph.BUILD")),
)
```
Then modify the following line in `tensorflow/workspace.bzl` file and provide absolute path to `~/ngraph_dist` :
```
path = "/your/home/directory/where/ngraph_is_installed",
```
3. Now run `configure` and rest of the TF build.
## System Requirements
TBD
......
# 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.
NGRAPH_DIST_DIR = ${HOME}/ngraph_dist
CXXFLAGS += -std=c++11
CPPFLAGS += -I $(NGRAPH_DIST_DIR)
LDFLAGS = -L $(NGRAPH_DIST_DIR)
OBJ = main.o
%.o: %.cpp $(DEPS)
$(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS)
ngraph-test: $(OBJ)
$(CXX) -o $@ $(OBJ) $(LDFLAGS) -lngraph
.PHONY: clean
clean:
rm -f $(OBJ) ngraph-test
// ----------------------------------------------------------------------------
// 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 <stdio.h>
#include "ngraph/ngraph.hpp"
#include "ngraph/ops/dot.hpp"
using namespace std;
using namespace ngraph;
int main(int argc, char** argv)
{
printf( "Building graph\n" );
// Function with 4 parameters
auto arg0 = op::parameter(element::Float::type, {7, 3});
auto arg1 = op::parameter(element::Float::type, {3});
auto arg2 = op::parameter(element::Float::type, {32, 7});
auto arg3 = op::parameter(element::Float::type, {32, 7});
auto broadcast_1 = op::broadcast(arg3, {10, 32, 7}, {0});
auto dot = op::dot(arg2, arg0);
auto cluster_0 = op::function(dot, {arg0, arg1, arg2, arg3});
auto result = cluster_0->result();
printf( "Finished\n" );
}
\ No newline at end of file
......@@ -11,9 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
get_filename_component( NGRAPH_INCLUDE_DIR . ABSOLUTE)
set(NGRAPH_INCLUDE_DIR "${NGRAPH_INCLUDE_DIR}" PARENT_SCOPE)
set (SRC
tree.cpp
util.cpp
......@@ -34,16 +31,15 @@ set (SRC
ngraph/visualize.cpp
)
# NOTE: We'd prefer to only have the .cpp files *in* the 'transformers' directory be compiled
# with the 'transformers' directory in the include-path. But it's hard to do that with
# CMake versions lower than 3.1: see
# https://stackoverflow.com/questions/9339851/can-one-add-further-source-files-to-an-executable-once-defined
include_directories(
"${NGRAPH_INCLUDE_DIR}"
"${NGRAPH_INCLUDE_DIR}/transformers"
)
set(NGRAPH_INCLUDE_PATH
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/ngraph
)
include_directories("${NGRAPH_INCLUDE_PATH}")
add_library(ngraph SHARED ${SRC})
target_include_directories(ngraph PUBLIC "${NGRAPH_INCLUDE_PATH}")
if ( APPLE )
set_property( TARGET ngraph PROPERTY PREFIX "lib" )
......@@ -55,17 +51,22 @@ endif()
# Installation logic...
#-----------------------------------------------------------------------------------------------
set(DEPLOY_SRC_HEADERS
element_type.hpp
tree.hpp
util.hpp
uuid.hpp
)
# 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.
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/ngraph_dist" CACHE PATH "Install directory" FORCE)
message (STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")
message (STATUS "To Override use: cmake -DCMAKE_INSTALL_PREFIX=/foo -P cmake_install.cmake")
set(DEPLOY_SRC_TRANSFORMERS_HEADERS
)
install(TARGETS ngraph DESTINATION lib)
install(FILES ${DEPLOY_SRC_HEADERS} DESTINATION include/ngraph)
install(FILES ${DEPLOY_SRC_TRANSFORMERS_HEADERS} DESTINATION include/ngraph/transformers)
install(TARGETS ngraph DESTINATION ${CMAKE_INSTALL_PREFIX} )
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/ngraph
DESTINATION ${CMAKE_INSTALL_PREFIX}
FILES_MATCHING PATTERN "*.hpp"
)
......@@ -14,8 +14,8 @@
#pragma once
#include "../node.hpp"
#include "../type.hpp"
#include "ngraph/node.hpp"
#include "ngraph/type.hpp"
namespace ngraph
{
......
......@@ -16,10 +16,6 @@ include_directories(
"${GTEST_INCLUDE_DIR}"
)
include_directories(
"${NGRAPH_INCLUDE_DIR}"
)
set (SRC
main.cpp
build_graph.cpp
......
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