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
cf900aa4
Commit
cf900aa4
authored
Jun 19, 2019
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interpreter works
parent
af7b4c8e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
1 deletion
+104
-1
CMakeLists.txt
src/ngraph/CMakeLists.txt
+28
-0
backend_manager.cpp
src/ngraph/runtime/backend_manager.cpp
+35
-0
CMakeLists.txt
src/ngraph/runtime/interpreter/CMakeLists.txt
+1
-1
int_backend.cpp
src/ngraph/runtime/interpreter/int_backend.cpp
+12
-0
static_initialize.hpp
src/ngraph/runtime/interpreter/static_initialize.hpp
+28
-0
No files found.
src/ngraph/CMakeLists.txt
View file @
cf900aa4
...
...
@@ -486,6 +486,34 @@ configure_file(version.in.hpp version.hpp)
if
(
NGRAPH_STATIC_LIB_ENABLE
)
add_library
(
ngraph STATIC
${
SRC
}
)
target_compile_definitions
(
ngraph PRIVATE INTERPRETER_BACKEND_STATIC
)
if
(
NGRAPH_CPU_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE CPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_INTELGPU_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE INTELGPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GPU_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE GPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_NOP_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE NOP_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GPUH_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE GPUH_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GENERIC_CPU_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE GENERIC_CPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_PLAIDML_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE PLAIDML_BACKEND_STATIC
)
endif
()
else
()
add_library
(
ngraph SHARED
${
SRC
}
)
endif
()
...
...
src/ngraph/runtime/backend_manager.cpp
View file @
cf900aa4
...
...
@@ -25,6 +25,7 @@
#include "ngraph/file_util.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/backend_manager.hpp"
#include "ngraph/runtime/interpreter/static_initialize.hpp"
#include "ngraph/util.hpp"
using
namespace
std
;
...
...
@@ -41,6 +42,35 @@ using namespace ngraph;
unordered_map
<
string
,
runtime
::
BackendConstructor
*>&
runtime
::
BackendManager
::
get_registry
()
{
static
unordered_map
<
string
,
BackendConstructor
*>
s_registered_backend
;
static
bool
s_static_initialization_called
=
false
;
if
(
!
s_static_initialization_called
)
{
s_static_initialization_called
=
true
;
#ifdef INTERPRETER_BACKEND_STATIC
runtime
::
interpreter
::
static_initialize
();
#endif
// #ifdef CPU_BACKEND_STATIC
// runtime::cpu::static_initialize();
// #endif
// #ifdef INTELGPU_BACKEND_STATIC
// runtime::intelgpu::static_initialize();
// #endif
// #ifdef GPU_BACKEND_STATIC
// runtime::gpu::static_initialize();
// #endif
// #ifdef NOP_BACKEND_STATIC
// runtime::nop::static_initialize();
// #endif
// #ifdef GPUH_BACKEND_STATIC
// runtime::gpuh::static_initialize();
// #endif
// #ifdef GENERIC_CPU_BACKEND_STATIC
// runtime::cpu::static_initialize();
// #endif
// #ifdef PLAIDML_BACKEND_STATIC
// runtime::plaidml::static_initialize();
// #endif
}
return
s_registered_backend
;
}
...
...
@@ -79,6 +109,11 @@ shared_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
}
auto
registry
=
get_registry
();
NGRAPH_INFO
<<
type
;
for
(
auto
t
:
registry
)
{
NGRAPH_INFO
<<
t
.
first
;
}
auto
it
=
registry
.
find
(
type
);
if
(
it
!=
registry
.
end
())
{
...
...
src/ngraph/runtime/interpreter/CMakeLists.txt
View file @
cf900aa4
...
...
@@ -15,7 +15,7 @@
# ******************************************************************************
if
(
NGRAPH_INTERPRETER_ENABLE
)
add_library
(
interpreter_backend S
HARED
int_backend.cpp node_wrapper.cpp int_executable.cpp
)
add_library
(
interpreter_backend S
TATIC
int_backend.cpp node_wrapper.cpp int_executable.cpp
)
if
(
NGRAPH_LIB_VERSIONING_ENABLE
)
set_target_properties
(
interpreter_backend PROPERTIES
VERSION
${
NGRAPH_VERSION
}
...
...
src/ngraph/runtime/interpreter/int_backend.cpp
View file @
cf900aa4
...
...
@@ -20,6 +20,7 @@
#include "ngraph/runtime/backend_manager.hpp"
#include "ngraph/runtime/host_tensor.hpp"
#include "ngraph/runtime/interpreter/int_executable.hpp"
#include "ngraph/runtime/interpreter/static_initialize.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
...
...
@@ -42,6 +43,17 @@ extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
return
s_backend_constructor
.
get
();
}
void
runtime
::
interpreter
::
static_initialize
()
{
static
bool
s_is_initialized
=
false
;
if
(
!
s_is_initialized
)
{
NGRAPH_INFO
<<
"INTERPRETER static initialize"
;
s_is_initialized
=
true
;
BackendManager
::
register_backend
(
"INTERPRETER"
,
get_backend_constructor_pointer
());
}
}
runtime
::
interpreter
::
INTBackend
::
INTBackend
()
{
}
...
...
src/ngraph/runtime/interpreter/static_initialize.hpp
0 → 100644
View file @
cf900aa4
//*****************************************************************************
// Copyright 2017-2019 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.
//*****************************************************************************
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
interpreter
{
void
static_initialize
();
}
}
}
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