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
732eaf77
"vscode:/vscode.git/clone" did not exist on "e68471ec29331a1dd08451eb6fdcfd6dd2bd4602"
Commit
732eaf77
authored
Dec 02, 2009
by
Christopher Bruns
Browse files
NML plugin loading test passes on Windows.
parent
535710ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
24 deletions
+41
-24
plugins/normalModeLangevin/CMakeLists.txt
plugins/normalModeLangevin/CMakeLists.txt
+26
-0
plugins/normalModeLangevin/platforms/reference/include/ReferenceNMLKernelFactory.h
...n/platforms/reference/include/ReferenceNMLKernelFactory.h
+0
-1
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
+6
-5
plugins/normalModeLangevin/test/CMakeLists.txt
plugins/normalModeLangevin/test/CMakeLists.txt
+0
-15
plugins/normalModeLangevin/test/TestNormalModeLangevin.cpp
plugins/normalModeLangevin/test/TestNormalModeLangevin.cpp
+9
-3
No files found.
plugins/normalModeLangevin/CMakeLists.txt
View file @
732eaf77
...
...
@@ -50,8 +50,34 @@ if(UNIX)
set_target_properties
(
NormalModeLangevin PROPERTIES DEBUG_OUTPUT_NAME NormalModeLangevin_d
)
endif
(
UNIX
)
target_link_libraries
(
NormalModeLangevin
${
SHARED_TARGET
}
)
# Copy plugin to test_plugin_dir
# TODO - move this up to top level CMakeLists.txt
set
(
test_plugin_dir
"
${
CMAKE_BINARY_DIR
}
/test_plugin_dir"
)
file
(
MAKE_DIRECTORY
"
${
test_plugin_dir
}
"
)
if
(
BUILD_TESTING
)
# On Windows we need to copy the correct Release/Debug plugin for testing
if
(
MSVC
)
set
(
args -E copy $\
(
TargetPath\
)
\"
${
test_plugin_dir
}
\"
)
message
(
${
args
}
)
add_custom_command
(
TARGET NormalModeLangevin POST_BUILD
DEPENDS $
(
TargetPath
)
COMMAND
"
${
CMAKE_COMMAND
}
"
ARGS -E copy \"$\
(
TargetPath\
)
\" \"
${
test_plugin_dir
}
\"
COMMENT
"Copying normal mode langevin plugin for testing (WIN32)"
)
else
(
MSVC
)
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"
)
endif
(
MSVC
)
add_subdirectory
(
test
)
endif
(
BUILD_TESTING
)
...
...
plugins/normalModeLangevin/platforms/reference/include/ReferenceNMLKernelFactory.h
View file @
732eaf77
...
...
@@ -48,4 +48,3 @@ public:
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCE_NMLKERNELFACTORY_H_*/
plugins/normalModeLangevin/src/NormalModeLangevin.cpp
View file @
732eaf77
...
...
@@ -35,15 +35,14 @@
using
namespace
OpenMM
;
using
namespace
std
;
extern
"C"
void
registerPlatforms
()
{
extern
"C"
void
OPENMM_EXPORT
registerPlatforms
()
{
cout
<<
"calling NML registerPlatforms()..."
<<
endl
;
}
extern
"C"
void
registerKernelFactories
()
{
extern
"C"
void
OPENMM_EXPORT
registerKernelFactories
()
{
cout
<<
"Initializing Normal Mode Langevin OpenMM plugin..."
<<
endl
;
for
(
int
p
=
0
;
p
<
Platform
::
getNumPlatforms
();
++
p
)
{
cout
<<
"Plugin number "
<<
p
<<
endl
;
cout
<<
"Platform "
<<
p
<<
" name = "
<<
Platform
::
getPlatform
(
p
).
getName
()
<<
endl
;
}
...
...
@@ -54,13 +53,15 @@ extern "C" void registerKernelFactories() {
cout
<<
"NML found Cuda platform..."
<<
endl
;
// platform.registerKernelFactory("CudaNMLKernelFactory", new CudaNMLKernelFactory());
}
catch
(
const
std
::
exception
&
exc
)
{
// non fatal
cout
<<
"NML Cuda platform not found. "
<<
exc
.
what
()
<<
endl
;
}
cout
<<
"NML looking for Reference plugin..."
<<
endl
;
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"Reference"
);
cout
<<
"NML found Reference platform..."
<<
endl
;
platform
.
registerKernelFactory
(
"ReferenceNMLKernelFactory"
,
new
ReferenceNMLKernelFactory
());
ReferenceNMLKernelFactory
*
factory
=
new
ReferenceNMLKernelFactory
();
platform
.
registerKernelFactory
(
"IntegrateNMLStep"
,
factory
);
}
catch
(
const
std
::
exception
&
exc
)
{
// non fatal
cout
<<
"NML Reference platform not found. "
<<
exc
.
what
()
<<
endl
;
}
...
...
plugins/normalModeLangevin/test/CMakeLists.txt
View file @
732eaf77
# 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
}
)
...
...
@@ -24,4 +10,3 @@ add_test(TestNormalModeLangevin
# 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 @
732eaf77
...
...
@@ -22,10 +22,16 @@ void testLoadNMLPlugin()
string
pluginDir
=
Platform
::
getDefaultPluginsDirectory
();
cout
<<
"Default plugins directory = "
<<
pluginDir
<<
endl
;
Platform
::
loadPluginsFromDirectory
(
pluginDir
);
// Create a context, just to initialize all plugins
System
system
;
VerletIntegrator
integrator
(
0.01
);
Context
context
(
system
,
integrator
);
// Was NormalModeLangevin plugin loaded?
vector
<
string
>
kernelName
;
kernelName
.
push_back
(
"IntegrateNMLStep"
);
// Was NormalModeLangevin plugin loaded?
cout
<<
"Searching for kernel IntegrateNMLStep = "
<<
pluginDir
<<
endl
;
cout
<<
"Searching for kernel IntegrateNMLStep"
<<
endl
;
Platform
&
platform
=
Platform
::
findPlatform
(
kernelName
);
// throws if no platform with kernel
}
...
...
@@ -33,9 +39,9 @@ int main(int argc, const char* argv[])
{
try
{
// Set OPENMM_PLUGIN_DIR from first command line argument
if
(
argc
>
1
)
{
const
char
*
plugin_dir
=
argv
[
1
];
// 0 => don't set if variable exists
mysetenv
(
"OPENMM_PLUGIN_DIR"
,
plugin_dir
);
cout
<<
plugin_dir
<<
endl
;
cout
<<
getenv
(
"OPENMM_PLUGIN_DIR"
)
<<
endl
;
...
...
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