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
d8c43cdf
Commit
d8c43cdf
authored
May 10, 2019
by
Robert Kimball
Committed by
Scott Cyphers
May 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy PR #2894 to r0.19 branch (#2903)
parent
2069823f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
backend_manager.cpp
src/ngraph/runtime/backend_manager.cpp
+23
-9
No files found.
src/ngraph/runtime/backend_manager.cpp
View file @
d8c43cdf
...
...
@@ -97,21 +97,24 @@ unique_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
#endif
throw
runtime_error
(
ss
.
str
());
}
function
<
const
char
*
()
>
get_ngraph_version_string
=
reinterpret_cast
<
const
char
*
(
*
)()
>
(
DLSYM
(
handle
,
"get_ngraph_version_string"
));
if
(
!
get_ngraph_version_string
)
{
CLOSE_LIBRARY
(
handle
);
throw
runtime_error
(
"Backend '"
+
type
+
"' does not implement get_ngraph_version_string"
);
}
#ifndef _WIN32
dlerror
();
// Clear any pending errors
#endif
function
<
runtime
::
Backend
*
(
const
char
*
)
>
new_backend
=
reinterpret_cast
<
runtime
::
Backend
*
(
*
)(
const
char
*
)
>
(
DLSYM
(
handle
,
"new_backend"
));
if
(
!
new_backend
)
{
string
error
;
#ifndef _WIN32
const
char
*
err
=
dlerror
();
error
=
(
err
?
err
:
""
);
#endif
CLOSE_LIBRARY
(
handle
);
throw
runtime_error
(
"Backend '"
+
type
+
"' does not implement new_backend"
);
throw
runtime_error
(
"Failed to find symbol 'get_backend_constructor_pointer' in backend "
"library.
\n
Error='"
+
error
+
"'"
);
}
backend
=
new_backend
(
config
.
c_str
());
...
...
@@ -156,12 +159,23 @@ DL_HANDLE runtime::BackendManager::open_shared_library(string type)
string
library_name
=
lib_prefix
+
to_lower
(
type
)
+
"_backend"
+
lib_suffix
;
string
my_directory
=
file_util
::
get_directory
(
find_my_file
());
string
library_path
=
file_util
::
path_join
(
my_directory
,
library_name
);
string
error
;
#ifdef _WIN32
SetDllDirectory
((
LPCSTR
)
my_directory
.
c_str
());
handle
=
LoadLibrary
(
library_path
.
c_str
());
#else
dlerror
();
// Clear any pending errors
handle
=
dlopen
(
library_path
.
c_str
(),
RTLD_NOW
|
RTLD_GLOBAL
);
const
char
*
err
=
dlerror
();
error
=
(
err
?
err
:
""
);
#endif
if
(
!
handle
)
{
stringstream
ss
;
ss
<<
"Unable to find backend '"
<<
type
<<
"' as file '"
<<
library_path
<<
"'"
;
ss
<<
"
\n
Open error message '"
<<
error
<<
"'"
;
throw
runtime_error
(
ss
.
str
());
}
return
handle
;
}
...
...
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