Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
b2e7d94e
Commit
b2e7d94e
authored
Jun 29, 2015
by
Robert McGibbon
Browse files
Record plugin load failures
parent
bca01957
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
olla/include/openmm/Platform.h
olla/include/openmm/Platform.h
+14
-8
olla/src/Platform.cpp
olla/src/Platform.cpp
+12
-2
wrappers/python/src/swig_doxygen/swigInputConfig.py
wrappers/python/src/swig_doxygen/swigInputConfig.py
+1
-0
No files found.
olla/include/openmm/Platform.h
View file @
b2e7d94e
...
...
@@ -171,6 +171,10 @@ public:
* Get a registered Platform by index.
*/
static
Platform
&
getPlatform
(
int
index
);
/**
* Get any failures caused during the last call to loadPluginsFromDirectory
*/
static
std
::
vector
<
std
::
string
>
getLoadFailures
();
/**
* Get the registered Platform with a particular name. If no Platform with that name has been
* registered, this throws an exception.
...
...
@@ -233,8 +237,10 @@ private:
std
::
map
<
std
::
string
,
KernelFactory
*>
kernelFactories
;
std
::
map
<
std
::
string
,
std
::
string
>
defaultProperties
;
static
std
::
vector
<
Platform
*>&
getPlatforms
();
static
std
::
vector
<
std
::
string
>
loadFailures
;
};
}
// namespace OpenMM
#endif
/*OPENMM_PLATFORM_H_*/
olla/src/Platform.cpp
View file @
b2e7d94e
...
...
@@ -51,6 +51,9 @@
using
namespace
OpenMM
;
using
namespace
std
;
std
::
vector
<
std
::
string
>
Platform
::
loadFailures
;
static
int
registerPlatforms
()
{
// Register the Platforms built into the main library. This should eventually be moved elsewhere.
...
...
@@ -140,6 +143,10 @@ Platform& Platform::getPlatform(int index) {
throw
OpenMMException
(
"Invalid platform index"
);
}
std
::
vector
<
std
::
string
>
Platform
::
getLoadFailures
()
{
return
loadFailures
;
}
Platform
&
Platform
::
getPlatformByName
(
const
string
&
name
)
{
for
(
int
i
=
0
;
i
<
getNumPlatforms
();
i
++
)
if
(
getPlatform
(
i
).
getName
()
==
name
)
...
...
@@ -196,8 +203,9 @@ static void* loadOneLibrary(const string& file) {
throw
OpenMMException
(
"Loading dynamic libraries is not supported on PNaCl"
);
#else
void
*
handle
=
dlopen
(
file
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
if
(
handle
==
NULL
)
if
(
handle
==
NULL
)
{
throw
OpenMMException
(
"Error loading library "
+
file
+
": "
+
dlerror
());
}
return
handle
;
#endif
}
...
...
@@ -261,12 +269,14 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
vector
<
void
*>
plugins
;
#endif
vector
<
string
>
loadedLibraries
;
loadFailures
.
resize
(
0
);
for
(
unsigned
int
i
=
0
;
i
<
files
.
size
();
++
i
)
{
try
{
plugins
.
push_back
(
loadOneLibrary
(
directory
+
dirSeparator
+
files
[
i
]));
loadedLibraries
.
push_back
(
files
[
i
]);
}
catch
(
OpenMMException
&
ex
)
{
// Just ignore it.
loadFailures
.
push_back
(
ex
.
what
());
}
}
initializePlugins
(
plugins
);
...
...
wrappers/python/src/swig_doxygen/swigInputConfig.py
View file @
b2e7d94e
...
...
@@ -180,6 +180,7 @@ UNITS = {
(
"*"
,
"getParticleMass"
)
:
(
"unit.amu"
,
()),
(
"*"
,
"getPlatform"
)
:
(
None
,
()),
(
"*"
,
"getPlatformByName"
)
:
(
None
,
()),
(
"*"
,
"getLoadFailures"
):
(
None
,
()),
(
"*"
,
"getRandomNumberSeed"
)
:
(
None
,
()),
(
"*"
,
"getReactionFieldDielectric"
)
:
(
None
,
()),
(
"*"
,
"getSoluteDielectric"
)
:
(
None
,
()),
...
...
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