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
29bfcf02
Unverified
Commit
29bfcf02
authored
Aug 08, 2019
by
Scott Cyphers
Committed by
GitHub
Aug 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3400 from NervanaSystems/cyphers/25tomaster
Cyphers/25tomaster
parents
84c3881d
a4d03bdf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
6 deletions
+43
-6
CMakeLists.txt
CMakeLists.txt
+4
-0
CMakeLists.txt
src/ngraph/CMakeLists.txt
+8
-0
backend.cpp
src/ngraph/runtime/backend.cpp
+4
-0
backend_manager.cpp
src/ngraph/runtime/backend_manager.cpp
+17
-6
quantized_concat.cpp
src/ngraph/runtime/cpu/builder/quantized_concat.cpp
+3
-0
quantized_max_pool.cpp
src/ngraph/runtime/cpu/builder/quantized_max_pool.cpp
+3
-0
cpu_builder_registry.cpp
src/ngraph/runtime/cpu/cpu_builder_registry.cpp
+2
-0
cpu_builder_registry.hpp
src/ngraph/runtime/cpu/cpu_builder_registry.hpp
+2
-0
No files found.
CMakeLists.txt
View file @
29bfcf02
...
...
@@ -398,6 +398,10 @@ if (NGRAPH_MLIR_ENABLE)
set
(
NGRAPH_MLIR_SOURCE_DIR
${
CMAKE_SOURCE_DIR
}
/src/contrib/mlir
)
endif
()
if
(
NGRAPH_STATIC_LIB_ENABLE
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNGRAPH_STATIC_LIB_ENABLE"
)
endif
()
if
(
NGRAPH_PLAIDML_ENABLE
)
find_package
(
PlaidML CONFIG
)
if
(
NOT PLAIDML_FOUND
)
...
...
src/ngraph/CMakeLists.txt
View file @
29bfcf02
...
...
@@ -519,6 +519,14 @@ if(NOT NGRAPH_JSON_ENABLE)
target_compile_definitions
(
ngraph PUBLIC NGRAPH_JSON_DISABLE
)
endif
()
if
(
NGRAPH_INTERPRETER_STATIC_LIB_ENABLE
)
target_compile_definitions
(
ngraph PUBLIC NGRAPH_INTERPRETER_STATIC_LIB_ENABLE
)
endif
()
if
(
NGRAPH_CPU_STATIC_LIB_ENABLE
)
target_compile_definitions
(
ngraph PUBLIC NGRAPH_CPU_STATIC_LIB_ENABLE
)
endif
()
if
(
NGRAPH_DISTRIBUTED_ENABLE
)
if
(
NGRAPH_DISTRIBUTED_MLSL_ENABLE
)
target_include_directories
(
ngraph SYSTEM PRIVATE libmlsl
)
...
...
src/ngraph/runtime/backend.cpp
View file @
29bfcf02
...
...
@@ -37,6 +37,9 @@ std::string runtime::Backend::s_backend_shared_library_search_directory;
// This finds the full path of the containing shared library
static
string
find_my_pathname
()
{
#ifdef NGRAPH_STATIC_LIB_ENABLE
return
""
;
#else
#ifdef _WIN32
HMODULE
hModule
=
GetModuleHandleW
(
L"ngraph.dll"
);
WCHAR
wpath
[
MAX_PATH
];
...
...
@@ -52,6 +55,7 @@ static string find_my_pathname()
dladdr
(
reinterpret_cast
<
void
*>
(
find_my_pathname
),
&
dl_info
);
return
dl_info
.
dli_fname
;
#endif
#endif
}
runtime
::
Backend
::~
Backend
()
...
...
src/ngraph/runtime/backend_manager.cpp
View file @
29bfcf02
...
...
@@ -32,12 +32,18 @@
using
namespace
std
;
using
namespace
ngraph
;
#ifdef NGRAPH_STATIC_LIB_ENABLE
#define DLERROR() ""
#else
#ifdef _WIN32
#define CLOSE_LIBRARY(a) FreeLibrary(a)
#define DLSYM(a, b) GetProcAddress(a, b)
#define DLERROR() ""
#else
#define CLOSE_LIBRARY(a) dlclose(a)
#define DLSYM(a, b) dlsym(a, b)
#define DLERROR() dlerror()
#endif
#endif
unordered_map
<
string
,
runtime
::
BackendConstructor
*>&
runtime
::
BackendManager
::
get_registry
()
...
...
@@ -101,19 +107,19 @@ shared_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
}
else
{
#ifndef NGRAPH_STATIC_LIB_ENABLE
DL_HANDLE
handle
=
open_shared_library
(
type
);
if
(
!
handle
)
{
stringstream
ss
;
ss
<<
"Backend '"
<<
type
<<
"' not registered. Error:"
;
#ifndef _WIN32
ss
<<
dlerror
();
ss
<<
DLERROR
();
#endif
throw
runtime_error
(
ss
.
str
());
}
#ifndef _WIN32
dlerror
();
// Clear any pending errors
DLERROR
();
// Clear any pending errors
#endif
function
<
runtime
::
BackendConstructor
*
()
>
get_backend_constructor_pointer
=
reinterpret_cast
<
runtime
::
BackendConstructor
*
(
*
)()
>
(
...
...
@@ -127,7 +133,7 @@ shared_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
{
string
error
;
#ifndef _WIN32
const
char
*
err
=
dlerror
();
const
char
*
err
=
DLERROR
();
error
=
(
err
?
err
:
""
);
#endif
CLOSE_LIBRARY
(
handle
);
...
...
@@ -136,6 +142,7 @@ shared_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
"library.
\n
Error='"
+
error
+
"'"
);
}
#endif
}
return
backend
;
}
...
...
@@ -146,6 +153,7 @@ DL_HANDLE runtime::BackendManager::open_shared_library(string type)
string
lib_suffix
=
SHARED_LIB_SUFFIX
;
DL_HANDLE
handle
=
nullptr
;
#ifndef NGRAPH_STATIC_LIB_ENABLE
// strip off attributes, IE:CPU becomes IE
auto
colon
=
type
.
find
(
":"
);
...
...
@@ -163,9 +171,9 @@ DL_HANDLE runtime::BackendManager::open_shared_library(string type)
SetDllDirectory
((
LPCSTR
)
my_directory
.
c_str
());
handle
=
LoadLibrary
(
library_path
.
c_str
());
#else
dlerror
();
// Clear any pending errors
DLERROR
();
// Clear any pending errors
handle
=
dlopen
(
library_path
.
c_str
(),
RTLD_NOW
|
RTLD_GLOBAL
);
const
char
*
err
=
dlerror
();
const
char
*
err
=
DLERROR
();
error
=
(
err
?
err
:
""
);
#endif
if
(
!
handle
)
...
...
@@ -175,12 +183,14 @@ DL_HANDLE runtime::BackendManager::open_shared_library(string type)
ss
<<
"
\n
Open error message '"
<<
error
<<
"'"
;
throw
runtime_error
(
ss
.
str
());
}
#endif
return
handle
;
}
map
<
string
,
string
>
runtime
::
BackendManager
::
get_registered_device_map
()
{
map
<
string
,
string
>
rc
;
#ifndef NGRAPH_STATIC_LIB_ENABLE
string
my_directory
=
file_util
::
get_directory
(
Backend
::
get_backend_shared_library_search_directory
());
vector
<
string
>
backend_list
;
...
...
@@ -197,6 +207,7 @@ map<string, string> runtime::BackendManager::get_registered_device_map()
}
};
file_util
::
iterate_files
(
my_directory
,
f
,
false
,
true
);
#endif
return
rc
;
}
...
...
src/ngraph/runtime/cpu/builder/quantized_concat.cpp
View file @
29bfcf02
...
...
@@ -95,6 +95,9 @@ namespace ngraph
}
}
REGISTER_OP_BUILDER
(
QuantizedConcat
);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void
register_builders_quantized_concat_cpp
()
{}
#endif
}
}
}
src/ngraph/runtime/cpu/builder/quantized_max_pool.cpp
View file @
29bfcf02
...
...
@@ -69,6 +69,9 @@ namespace ngraph
}
}
REGISTER_OP_BUILDER
(
QuantizedMaxPool
);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void
register_builders_quantized_max_pool_cpp
()
{}
#endif
}
}
}
src/ngraph/runtime/cpu/cpu_builder_registry.cpp
View file @
29bfcf02
...
...
@@ -77,6 +77,8 @@ namespace ngraph
register_builders_tile_cpp
();
register_builders_topk_cpp
();
register_builders_update_slice_cpp
();
register_builders_quantized_concat_cpp
();
register_builders_quantized_max_pool_cpp
();
}
}
}
...
...
src/ngraph/runtime/cpu/cpu_builder_registry.hpp
View file @
29bfcf02
...
...
@@ -76,6 +76,8 @@ namespace ngraph
void
register_builders_tile_cpp
();
void
register_builders_topk_cpp
();
void
register_builders_update_slice_cpp
();
void
register_builders_quantized_concat_cpp
();
void
register_builders_quantized_max_pool_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