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
832b8a42
Commit
832b8a42
authored
Dec 01, 2009
by
Christopher Bruns
Browse files
NML loading sanity test gets much farther on Linux, but still fails
parent
f46ebafb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
9 deletions
+48
-9
plugins/normalModeLangevin/platforms/reference/src/ReferenceNMLKernelFactory.cpp
...vin/platforms/reference/src/ReferenceNMLKernelFactory.cpp
+3
-0
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
+18
-5
plugins/normalModeLangevin/test/CMakeLists.txt
plugins/normalModeLangevin/test/CMakeLists.txt
+22
-1
plugins/normalModeLangevin/test/TestNormalModeLangevin.cpp
plugins/normalModeLangevin/test/TestNormalModeLangevin.cpp
+5
-3
No files found.
plugins/normalModeLangevin/platforms/reference/src/ReferenceNMLKernelFactory.cpp
View file @
832b8a42
...
...
@@ -33,6 +33,9 @@
#include "openmm/internal/ContextImpl.h"
#include "ReferenceNMLKernelFactory.h"
#include "ReferenceIntegrateNMLStepKernel.h"
#include <iostream>
using
namespace
std
;
namespace
OpenMM
{
...
...
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
View file @
832b8a42
...
...
@@ -36,20 +36,33 @@
using
namespace
OpenMM
;
using
namespace
std
;
extern
"C"
void
registerPlatforms
()
{
cout
<<
"calling NML registerPlatforms()..."
<<
endl
;
}
extern
"C"
void
registerKernelFactories
()
{
cout
<<
"Initializing Normal Mode Langevin OpenMM plugin..."
<<
endl
;
// for (int p = 0; p < Platform::getNumPlatforms(); ++p) {
for
(
int
p
=
0
;
p
<
Platform
::
getNumPlatforms
();
++
p
)
{
cout
<<
"Plugin number "
<<
p
<<
endl
;
cout
<<
"Platform "
<<
p
<<
" name = "
<<
Platform
::
getPlatform
(
p
).
getName
()
<<
endl
;
}
// Only register cuda kernels if cuda platform is found
cout
<<
"NML looking for Cuda plugin..."
<<
endl
;
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CudaPlatform"
);
Platform
&
platform
=
Platform
::
getPlatformByName
(
"Cuda"
);
cout
<<
"NML found Cuda platform..."
<<
endl
;
// platform.registerKernelFactory("CudaNMLKernelFactory", new CudaNMLKernelFactory());
}
catch
(
std
::
exception
exc
)
{
// non fatal
}
catch
(
const
std
::
exception
&
exc
)
{
// non fatal
}
cout
<<
"NML looking for Reference plugin..."
<<
endl
;
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"ReferencePlatform"
);
Platform
&
platform
=
Platform
::
getPlatformByName
(
"Reference"
);
cout
<<
"NML found Reference platform..."
<<
endl
;
platform
.
registerKernelFactory
(
"ReferenceNMLKernelFactory"
,
new
ReferenceNMLKernelFactory
());
}
catch
(
std
::
exception
exc
)
{
// non fatal
}
catch
(
const
std
::
exception
&
exc
)
{
// non fatal
cout
<<
"NML Reference platform not found. "
<<
exc
.
what
()
<<
endl
;
}
}
plugins/normalModeLangevin/test/CMakeLists.txt
View file @
832b8a42
# Copy plugin to test_plugin_dir
set
(
test_plugin_dir
"
${
CMAKE_BINARY_DIR
}
/test_plugin_dir"
)
file
(
MAKE_DIRECTORY
"
${
test_plugin_dir
}
"
)
get_target_property
(
old_loc NormalModeLangevin LOCATION
)
get_filename_component
(
new_loc
${
old_loc
}
NAME
)
set
(
new_loc
"
${
test_plugin_dir
}
/
${
new_loc
}
"
)
add_custom_command
(
DEPENDS
${
old_loc
}
NormalModeLangevin
OUTPUT
${
new_loc
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
old_loc
}
${
new_loc
}
)
add_custom_target
(
CopyTestNmlPlugin ALL
DEPENDS
"
${
new_loc
}
"
COMMENT
"Copying normal mode langevin plugin for testing"
)
add_executable
(
TestNormalModeLangevin TestNormalModeLangevin.cpp
)
target_link_libraries
(
TestNormalModeLangevin
${
SHARED_TARGET
}
)
add_test
(
TestNormalModeLangevin
"
${
EXECUTABLE_OUTPUT_PATH
}
/TestNormalModeLangevin"
)
# pass OPENMM_PLUGIN_DIR as command line argument
add_test
(
TestNormalModeLangevin
"
${
EXECUTABLE_OUTPUT_PATH
}
/TestNormalModeLangevin"
"
${
test_plugin_dir
}
"
)
# does not work - nice try - maybe in cmake 2.8
set_tests_properties
(
TestNormalModeLangevin PROPERTIES
ENVIRONMENT
"OPENMM_PLUGIN_DIR=
${
test_plugin_dir
}
"
)
plugins/normalModeLangevin/test/TestNormalModeLangevin.cpp
View file @
832b8a42
...
...
@@ -23,8 +23,9 @@ void testLoadNMLPlugin()
cout
<<
"Default plugins directory = "
<<
pluginDir
<<
endl
;
Platform
::
loadPluginsFromDirectory
(
pluginDir
);
vector
<
string
>
kernelName
;
kernelName
.
push_back
(
"IntegrateNMLStep
Kernel
"
);
kernelName
.
push_back
(
"IntegrateNMLStep"
);
// Was NormalModeLangevin plugin loaded?
cout
<<
"Searching for kernel IntegrateNMLStep = "
<<
pluginDir
<<
endl
;
Platform
&
platform
=
Platform
::
findPlatform
(
kernelName
);
// throws if no platform with kernel
}
...
...
@@ -43,9 +44,10 @@ int main(int argc, const char* argv[])
cout
<<
"tests passed"
<<
endl
;
return
0
;
}
catch
(
...
)
catch
(
const
std
::
exception
&
exc
)
{
cout
<<
"FAILED
"
<<
endl
;
cout
<<
"FAILED
: "
<<
exc
.
what
()
<<
endl
;
return
1
;
}
}
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