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
5f8224a5
Commit
5f8224a5
authored
Sep 05, 2017
by
Scott Cyphers
Committed by
GitHub
Sep 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #85 from NervanaSystems/bob/eigen2
Add eigen support
parents
961b4e0a
1b168117
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
2 deletions
+78
-2
external_eigen.cmake
cmake/external_eigen.cmake
+39
-0
CMakeLists.txt
test/CMakeLists.txt
+8
-2
eigen.cpp
test/eigen.cpp
+30
-0
CMakeLists.txt
third-party/CMakeLists.txt
+1
-0
No files found.
cmake/external_eigen.cmake
0 → 100644
View file @
5f8224a5
# 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.
cmake_minimum_required
(
VERSION 3.7
)
# Enable ExternalProject CMake module
include
(
ExternalProject
)
set
(
EXTERNAL_INSTALL_LOCATION
${
CMAKE_BINARY_DIR
}
/external
)
#----------------------------------------------------------------------------------------------------------
# Download and install GoogleTest ...
#----------------------------------------------------------------------------------------------------------
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
ExternalProject_Add
(
eigen
URL http://bitbucket.org/eigen/eigen/get/3.3.3.zip
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/eigen
INSTALL_COMMAND make install
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EXTERNAL_INSTALL_LOCATION
}
)
#----------------------------------------------------------------------------------------------------------
ExternalProject_Get_Property
(
eigen source_dir binary_dir
)
set
(
EIGEN_INCLUDE_DIR
"
${
EXTERNAL_INSTALL_LOCATION
}
/include/Eigen3"
PARENT_SCOPE
)
test/CMakeLists.txt
View file @
5f8224a5
...
...
@@ -13,7 +13,12 @@
include_directories
(
SYSTEM
"
${
GTEST_INCLUDE_DIR
}
"
${
GTEST_INCLUDE_DIR
}
${
EIGEN_INCLUDE_DIR
}
)
include_directories
(
${
NGRAPH_INCLUDE_DIR
}
)
set
(
SRC
...
...
@@ -25,6 +30,7 @@ set (SRC
uuid.cpp
topological_sort.cpp
op.cpp
eigen.cpp
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
...
...
@@ -35,7 +41,7 @@ add_executable(unit-test ${SRC})
target_link_libraries
(
unit-test ngraph libgtest pthread
)
target_link_libraries
(
unit-test
${
CMAKE_DL_LIBS
}
)
add_dependencies
(
unit-test ngraph libgtest
)
add_dependencies
(
unit-test ngraph libgtest
eigen
)
add_custom_target
(
check
COMMAND
${
PROJECT_BINARY_DIR
}
/test/unit-test
...
...
test/eigen.cpp
0 → 100644
View file @
5f8224a5
// ----------------------------------------------------------------------------
// 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 <iostream>
#include <Eigen/Dense>
#include "gtest/gtest.h"
using
Eigen
::
MatrixXd
;
TEST
(
eigen
,
simple
)
{
MatrixXd
m
(
2
,
2
);
m
(
0
,
0
)
=
3
;
m
(
1
,
0
)
=
2.5
;
m
(
0
,
1
)
=
-
1
;
m
(
1
,
1
)
=
m
(
1
,
0
)
+
m
(
0
,
1
);
EXPECT_FLOAT_EQ
(
m
(
1
,
1
),
1.5
);
}
third-party/CMakeLists.txt
View file @
5f8224a5
...
...
@@ -12,3 +12,4 @@
# limitations under the License.
include
(
../cmake/external_gtest.cmake
)
include
(
../cmake/external_eigen.cmake
)
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