Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
4e682903
Commit
4e682903
authored
Sep 05, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into cyphers/sizes
parents
3a52dadc
3c815ee4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
32 deletions
+120
-32
CMakeLists.txt
CMakeLists.txt
+1
-1
README.md
README.md
+24
-2
Makefile
examples/Makefile
+29
-0
main.cpp
examples/main.cpp
+40
-0
CMakeLists.txt
src/CMakeLists.txt
+24
-23
parameter.hpp
src/ngraph/ops/parameter.hpp
+2
-2
CMakeLists.txt
test/CMakeLists.txt
+0
-4
No files found.
CMakeLists.txt
View file @
4e682903
...
...
@@ -36,7 +36,7 @@ set(NGRAPH_CXX_WARNING_FLAGS "")
# Compiler-specific logic...
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"^(Apple)?Clang$"
)
message
(
"s
etting clang flags..."
)
message
(
STATUS
"S
etting clang flags..."
)
include
(
cmake/clang_4_0_flags.cmake
)
endif
()
...
...
README.md
View file @
4e682903
...
...
@@ -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
...
...
examples/Makefile
0 → 100644
View file @
4e682903
# 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
examples/main.cpp
0 → 100644
View file @
4e682903
// ----------------------------------------------------------------------------
// 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
src/CMakeLists.txt
View file @
4e682903
...
...
@@ -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"
)
src/ngraph/ops/parameter.hpp
View file @
4e682903
...
...
@@ -14,8 +14,8 @@
#pragma once
#include "
..
/node.hpp"
#include "
..
/type.hpp"
#include "
ngraph
/node.hpp"
#include "
ngraph
/type.hpp"
namespace
ngraph
{
...
...
test/CMakeLists.txt
View file @
4e682903
...
...
@@ -16,10 +16,6 @@ include_directories(
"
${
GTEST_INCLUDE_DIR
}
"
)
include_directories
(
"
${
NGRAPH_INCLUDE_DIR
}
"
)
set
(
SRC
main.cpp
build_graph.cpp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment