Unverified Commit 30f7699b authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Fix cmake files and tests to allow building ngraph without the CPU backend (#910)

parent bd51497b
......@@ -139,6 +139,9 @@ endif()
if (NOT DEFINED NGRAPH_CPU_ENABLE)
set(NGRAPH_CPU_ENABLE TRUE)
endif()
if (NGRAPH_CPU_ENABLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNGRAPH_CPU_ENABLE")
endif()
if (NOT DEFINED NGRAPH_TBB_ENABLE)
set(NGRAPH_TBB_ENABLE ${NGRAPH_CPU_ENABLE})
......
......@@ -304,10 +304,11 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND MKLDNN_INCLUDE_DIR)
DEPENDS resource_generator ext_eigen ext_llvm ext_mkldnn
BYPRODUCTS
)
add_dependencies(ngraph header_resource ext_json)
add_dependencies(ngraph header_resource)
include_directories(SYSTEM ${CMAKE_BINARY_DIR})
include_directories(SYSTEM ${JSON_INCLUDE_DIR})
endif()
add_dependencies(ngraph ext_json)
include_directories(SYSTEM ${JSON_INCLUDE_DIR})
if (NOT APPLE)
# NGraph links against one or more libraries (ex. LLVM) but we don't want to
......
......@@ -34,7 +34,6 @@ set (SRC
copy.cpp
core_fusion.cpp
cpio.cpp
eigen.cpp
element_type.cpp
file_util.cpp
inliner.cpp
......@@ -42,7 +41,6 @@ set (SRC
main.cpp
op.cpp
graph_partition.cpp
includes.cpp
pass_liveness.cpp
pass_manager.cpp
pass_memory_layout.cpp
......@@ -180,7 +178,7 @@ if(NGRAPH_NNP_ENABLE)
target_link_libraries(unit-test ${NNP_TRANSFORMER_LIB_DIR}/libnnp.so)
endif()
add_dependencies(unit-test ngraph libgtest ext_eigen ext_json)
add_dependencies(unit-test ngraph libgtest ext_json)
include_directories(SYSTEM ${JSON_INCLUDE_DIR})
add_custom_target(style-check
......
/*******************************************************************************
* Copyright 2017-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.
*******************************************************************************/
#include <iostream>
#include "Eigen/Dense"
#include "gtest/gtest.h"
#include "ngraph/util.hpp"
using namespace std;
using namespace ngraph;
TEST(eigen, simple)
{
Eigen::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);
}
......@@ -228,6 +228,7 @@ TEST(graph_partition, placement_all_cpu_policy)
}
}
#ifdef NGRAPH_CPU_ENABLE
TEST(graph_partition, placement_int_with_cpu_mul_policy)
{
Shape shape = Shape{2, 2};
......@@ -499,6 +500,7 @@ TEST(graph_partition, hybrid_multi_middle_nodes)
EXPECT_EQ(read_vector<float>(r),
(test::NDArray<float, 2>({{210, 288}, {378, 480}})).get_vector());
}
#endif
TEST(graph_partition, hybrid_no_split)
{
......
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