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
3e974a97
Commit
3e974a97
authored
Sep 01, 2016
by
peastman
Committed by
GitHub
Sep 01, 2016
Browse files
Merge pull request #1575 from peastman/staticamoeba
Can build static AMOEBA libraries
parents
26a330a6
ce97de59
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
16 deletions
+62
-16
plugins/amoeba/platforms/cuda/CMakeLists.txt
plugins/amoeba/platforms/cuda/CMakeLists.txt
+36
-10
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
...ins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
+10
-2
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
.../platforms/reference/src/AmoebaReferenceKernelFactory.cpp
+10
-2
plugins/cudacompiler/src/CudaCompilerKernelFactory.cpp
plugins/cudacompiler/src/CudaCompilerKernelFactory.cpp
+6
-2
No files found.
plugins/amoeba/platforms/cuda/CMakeLists.txt
View file @
3e974a97
...
...
@@ -21,6 +21,7 @@ SET(OPENMM_SOURCE_SUBDIRS .)
SET
(
OPENMMAMOEBACUDA_LIBRARY_NAME OpenMMAmoebaCUDA
)
SET
(
SHARED_TARGET
${
OPENMMAMOEBACUDA_LIBRARY_NAME
}
)
SET
(
STATIC_TARGET
${
OPENMMAMOEBACUDA_LIBRARY_NAME
}
_static
)
# These are all the places to search for header files which are
...
...
@@ -85,17 +86,42 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H}
DEPENDS
${
CUDA_KERNELS
}
)
SET_SOURCE_FILES_PROPERTIES
(
${
CUDA_KERNELS_CPP
}
${
CUDA_KERNELS_H
}
PROPERTIES GENERATED TRUE
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
CUDA
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_AMOEBA_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_SHARED_LIBRARY"
)
IF
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-F/Library/Frameworks -framework CUDA"
)
ELSE
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
)
ENDIF
(
APPLE
)
# Build the shared plugin library.
IF
(
OPENMM_BUILD_SHARED_LIB
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
CUDA
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_AMOEBA_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_SHARED_LIBRARY"
)
IF
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-F/Library/Frameworks -framework CUDA"
)
ELSE
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
)
ENDIF
(
APPLE
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
SHARED_TARGET
}
)
ENDIF
(
OPENMM_BUILD_SHARED_LIB
)
# Build the static plugin library.
IF
(
OPENMM_BUILD_STATIC_LIB
)
ADD_LIBRARY
(
${
STATIC_TARGET
}
STATIC
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
STATIC_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
STATIC_TARGET
}
${
OPENMM_LIBRARY_NAME
}
CUDA
)
TARGET_LINK_LIBRARIES
(
${
STATIC_TARGET
}
${
STATIC_AMOEBA_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
STATIC_TARGET
}
PROPERTIES COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_STATIC_LIBRARY"
)
IF
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
STATIC_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-F/Library/Frameworks -framework CUDA"
)
ELSE
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
STATIC_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
)
ENDIF
(
APPLE
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
STATIC_TARGET
}
)
ENDIF
(
OPENMM_BUILD_STATIC_LIB
)
INSTALL
(
TARGETS
${
SHARED_TARGET
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/lib/plugins
)
# Ensure that links to the main CUDA library will be resolved.
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
View file @
3e974a97
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* *
...
...
@@ -33,10 +33,18 @@
using
namespace
OpenMM
;
#ifdef OPENMM_BUILDING_STATIC_LIBRARY
static
void
registerPlatforms
()
{
#else
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
#endif
}
#ifdef OPENMM_BUILDING_STATIC_LIBRARY
static
void
registerKernelFactories
()
{
#else
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
#endif
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CUDA"
);
AmoebaCudaKernelFactory
*
factory
=
new
AmoebaCudaKernelFactory
();
...
...
@@ -105,4 +113,4 @@ KernelImpl* AmoebaCudaKernelFactory::createKernelImpl(std::string name, const Pl
return
new
CudaCalcAmoebaWcaDispersionForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
throw
OpenMMException
((
std
::
string
(
"Tried to create kernel with illegal kernel name '"
)
+
name
+
"'"
).
c_str
());
}
}
\ No newline at end of file
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
View file @
3e974a97
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* *
...
...
@@ -32,10 +32,18 @@
using
namespace
OpenMM
;
#ifdef OPENMM_BUILDING_STATIC_LIBRARY
static
void
registerPlatforms
()
{
#else
extern
"C"
OPENMM_EXPORT
void
registerPlatforms
()
{
#endif
}
#ifdef OPENMM_BUILDING_STATIC_LIBRARY
static
void
registerKernelFactories
()
{
#else
extern
"C"
OPENMM_EXPORT
void
registerKernelFactories
()
{
#endif
for
(
int
i
=
0
;
i
<
Platform
::
getNumPlatforms
();
i
++
)
{
Platform
&
platform
=
Platform
::
getPlatform
(
i
);
if
(
dynamic_cast
<
ReferencePlatform
*>
(
&
platform
)
!=
NULL
)
{
...
...
@@ -98,4 +106,4 @@ KernelImpl* AmoebaReferenceKernelFactory::createKernelImpl(std::string name, con
return
new
ReferenceCalcAmoebaWcaDispersionForceKernel
(
name
,
platform
,
context
.
getSystem
());
throw
OpenMMException
((
std
::
string
(
"Tried to create kernel with illegal kernel name '"
)
+
name
+
"'"
).
c_str
());
}
}
\ No newline at end of file
plugins/cudacompiler/src/CudaCompilerKernelFactory.cpp
View file @
3e974a97
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2015 Stanford University and the Authors.
*
* Portions copyright (c) 2015
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -32,7 +32,11 @@
using
namespace
OpenMM
;
#ifdef OPENMM_CUDACOMPILER_BUILDING_STATIC_LIBRARY
static
void
registerKernelFactories
()
{
#else
extern
"C"
OPENMM_EXPORT_CUDACOMPILER
void
registerKernelFactories
()
{
#endif
try
{
// Make sure this is at least CUDA 7.0.
...
...
@@ -65,4 +69,4 @@ KernelImpl* CudaCompilerKernelFactory::createKernelImpl(std::string name, const
if
(
name
==
CudaCompilerKernel
::
Name
())
return
new
CudaRuntimeCompilerKernel
(
name
,
platform
);
throw
OpenMMException
((
std
::
string
(
"Tried to create kernel with illegal kernel name '"
)
+
name
+
"'"
).
c_str
());
}
}
\ No newline at end of file
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