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
465e018f
Commit
465e018f
authored
Sep 23, 2011
by
Peter Eastman
Browse files
Bug fixes to RPMD
parent
5ed1d277
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
18 deletions
+12
-18
plugins/rpmd/CMakeLists.txt
plugins/rpmd/CMakeLists.txt
+4
-10
plugins/rpmd/platforms/opencl/CMakeLists.txt
plugins/rpmd/platforms/opencl/CMakeLists.txt
+1
-0
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
+6
-5
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
+1
-3
No files found.
plugins/rpmd/CMakeLists.txt
View file @
465e018f
...
@@ -151,11 +151,6 @@ ENDIF(OPENMM_BUILD_STATIC_LIB)
...
@@ -151,11 +151,6 @@ ENDIF(OPENMM_BUILD_STATIC_LIB)
ADD_SUBDIRECTORY
(
platforms/reference/tests
)
ADD_SUBDIRECTORY
(
platforms/reference/tests
)
# Which hardware platforms to build
# Which hardware platforms to build
IF
(
CUDA_FOUND
)
SET
(
OPENMM_BUILD_RPMD_CUDA_LIB ON CACHE BOOL
"Build OpenMMRPMDCuda library for Nvidia GPUs"
)
ELSE
(
CUDA_FOUND
)
SET
(
OPENMM_BUILD_RPMD_CUDA_LIB OFF CACHE BOOL
"Build OpenMMRPMDCuda library for Nvidia GPUs"
)
ENDIF
(
CUDA_FOUND
)
#SET(OPENMM_BUILD_RPMD_PATH)
#SET(OPENMM_BUILD_RPMD_PATH)
#SET(OPENMM_BUILD_RPMD_CUDA_PATH)
#SET(OPENMM_BUILD_RPMD_CUDA_PATH)
...
@@ -166,10 +161,10 @@ ENDIF(CUDA_FOUND)
...
@@ -166,10 +161,10 @@ ENDIF(CUDA_FOUND)
# SET(OPENMM_RPMD_CUDA_SOURCE_SUBDIRS . openmmapi olla platforms/cuda)
# SET(OPENMM_RPMD_CUDA_SOURCE_SUBDIRS . openmmapi olla platforms/cuda)
#ENDIF(OPENMM_BUILD_RPMD_CUDA_LIB)
#ENDIF(OPENMM_BUILD_RPMD_CUDA_LIB)
#
SET(OPENMM_BUILD_OPENCL_LIB O
FF
CACHE BOOL "Build
OpenMMOpenCL library for Nvidia GPUs
")
SET
(
OPENMM_BUILD_
RPMD_
OPENCL_LIB O
N
CACHE BOOL
"Build
RPMD implementation for OpenCL
"
)
#
IF(OPENMM_BUILD_OPENCL_LIB)
IF
(
OPENMM_BUILD_
RPMD_
OPENCL_LIB
)
#
ADD_SUBDIRECTORY(platforms/opencl)
ADD_SUBDIRECTORY
(
platforms/opencl
)
#
ENDIF(OPENMM_BUILD_OPENCL_LIB)
ENDIF
(
OPENMM_BUILD_
RPMD_
OPENCL_LIB
)
INSTALL_TARGETS
(
/lib RUNTIME_DIRECTORY /lib
${
SHARED_RPMD_TARGET
}
)
INSTALL_TARGETS
(
/lib RUNTIME_DIRECTORY /lib
${
SHARED_RPMD_TARGET
}
)
IF
(
CREATE_SERIALIZABLE_OPENMM_RPMD
)
IF
(
CREATE_SERIALIZABLE_OPENMM_RPMD
)
...
@@ -204,4 +199,3 @@ ENDIF (EXECUTABLE_OUTPUT_PATH)
...
@@ -204,4 +199,3 @@ ENDIF (EXECUTABLE_OUTPUT_PATH)
#INCLUDE(ApiDoxygen.cmake)
#INCLUDE(ApiDoxygen.cmake)
#ADD_SUBDIRECTORY(tests)
#ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY
(
platforms/opencl
)
plugins/rpmd/platforms/opencl/CMakeLists.txt
View file @
465e018f
...
@@ -112,6 +112,7 @@ ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
...
@@ -112,6 +112,7 @@ ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
ENDIF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
ENDIF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
MAIN_OPENMM_LIB
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
MAIN_OPENMM_LIB
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
debug
${
OPENMM_LIBRARY_NAME
}
OpenCL_d optimized
${
OPENMM_LIBRARY_NAME
}
OpenCL
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
debug
${
OPENMM_LIBRARY_NAME
}
OpenCL_d optimized
${
OPENMM_LIBRARY_NAME
}
OpenCL
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
debug
${
SHARED_RPMD_TARGET
}
optimized
${
SHARED_RPMD_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY"
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY"
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
SHARED_TARGET
}
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
SHARED_TARGET
}
)
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
View file @
465e018f
...
@@ -53,7 +53,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
...
@@ -53,7 +53,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
numCopies
=
integrator
.
getNumCopies
();
numCopies
=
integrator
.
getNumCopies
();
numParticles
=
system
.
getNumParticles
();
numParticles
=
system
.
getNumParticles
();
workgroupSize
=
numCopies
;
workgroupSize
=
numCopies
;
while
(
workgroupSize
<
128
-
numCopies
)
while
(
workgroupSize
<
=
128
-
numCopies
)
workgroupSize
+=
numCopies
;
workgroupSize
+=
numCopies
;
if
(
numCopies
!=
OpenCLFFT3D
::
findLegalDimension
(
numCopies
))
if
(
numCopies
!=
OpenCLFFT3D
::
findLegalDimension
(
numCopies
))
throw
OpenMMException
(
"RPMDIntegrator: the number of copies must be a multiple of powers of 2, 3, and 5."
);
throw
OpenMMException
(
"RPMDIntegrator: the number of copies must be a multiple of powers of 2, 3, and 5."
);
...
@@ -68,6 +68,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
...
@@ -68,6 +68,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
vector
<
mm_float4
>
temp
(
positions
->
getSize
());
vector
<
mm_float4
>
temp
(
positions
->
getSize
());
for
(
int
i
=
0
;
i
<
positions
->
getSize
();
i
++
)
for
(
int
i
=
0
;
i
<
positions
->
getSize
();
i
++
)
temp
[
i
]
=
mm_float4
(
0
,
0
,
0
,
0
);
temp
[
i
]
=
mm_float4
(
0
,
0
,
0
,
0
);
positions
->
upload
(
temp
);
for
(
int
i
=
0
;
i
<
velocities
->
getSize
();
i
++
)
for
(
int
i
=
0
;
i
<
velocities
->
getSize
();
i
++
)
temp
[
i
]
=
mm_float4
(
0
,
0
,
0
,
1
);
temp
[
i
]
=
mm_float4
(
0
,
0
,
0
,
1
);
velocities
->
upload
(
temp
);
velocities
->
upload
(
temp
);
...
@@ -120,10 +121,10 @@ void OpenCLIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDInte
...
@@ -120,10 +121,10 @@ void OpenCLIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDInte
if
(
!
forcesAreValid
)
{
if
(
!
forcesAreValid
)
{
for
(
int
i
=
0
;
i
<
numCopies
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numCopies
;
i
++
)
{
cl
.
getQueue
().
enqueueCopyBuffer
(
positions
->
getDeviceBuffer
(),
cl
.
getPosq
().
getDeviceBuffer
(),
cl
.
getQueue
().
enqueueCopyBuffer
(
positions
->
getDeviceBuffer
(),
cl
.
getPosq
().
getDeviceBuffer
(),
i
*
paddedParticles
,
0
,
paddedParticles
*
sizeof
(
mm_float4
));
i
*
paddedParticles
*
sizeof
(
mm_float4
)
,
0
,
paddedParticles
*
sizeof
(
mm_float4
));
context
.
calcForcesAndEnergy
(
true
,
false
);
context
.
calcForcesAndEnergy
(
true
,
false
);
cl
.
getQueue
().
enqueueCopyBuffer
(
cl
.
getForce
().
getDeviceBuffer
(),
forces
->
getDeviceBuffer
(),
cl
.
getQueue
().
enqueueCopyBuffer
(
cl
.
getForce
().
getDeviceBuffer
(),
forces
->
getDeviceBuffer
(),
0
,
i
*
paddedParticles
,
paddedParticles
*
sizeof
(
mm_float4
));
0
,
i
*
paddedParticles
*
sizeof
(
mm_float4
)
,
paddedParticles
*
sizeof
(
mm_float4
));
}
}
}
}
...
@@ -146,10 +147,10 @@ void OpenCLIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDInte
...
@@ -146,10 +147,10 @@ void OpenCLIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDInte
for
(
int
i
=
0
;
i
<
numCopies
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numCopies
;
i
++
)
{
cl
.
getQueue
().
enqueueCopyBuffer
(
positions
->
getDeviceBuffer
(),
cl
.
getPosq
().
getDeviceBuffer
(),
cl
.
getQueue
().
enqueueCopyBuffer
(
positions
->
getDeviceBuffer
(),
cl
.
getPosq
().
getDeviceBuffer
(),
i
*
paddedParticles
,
0
,
paddedParticles
*
sizeof
(
mm_float4
));
i
*
paddedParticles
*
sizeof
(
mm_float4
)
,
0
,
paddedParticles
*
sizeof
(
mm_float4
));
context
.
calcForcesAndEnergy
(
true
,
false
);
context
.
calcForcesAndEnergy
(
true
,
false
);
cl
.
getQueue
().
enqueueCopyBuffer
(
cl
.
getForce
().
getDeviceBuffer
(),
forces
->
getDeviceBuffer
(),
cl
.
getQueue
().
enqueueCopyBuffer
(
cl
.
getForce
().
getDeviceBuffer
(),
forces
->
getDeviceBuffer
(),
0
,
i
*
paddedParticles
,
paddedParticles
*
sizeof
(
mm_float4
));
0
,
i
*
paddedParticles
*
sizeof
(
mm_float4
)
,
paddedParticles
*
sizeof
(
mm_float4
));
}
}
// Update velocities.
// Update velocities.
...
...
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
View file @
465e018f
...
@@ -6,8 +6,6 @@ ENABLE_TESTING()
...
@@ -6,8 +6,6 @@ ENABLE_TESTING()
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
SET
(
SHARED_OPENMM_RPMD_TARGET OpenMMRPMD
)
# Automatically create tests using files named "Test*.cpp"
# Automatically create tests using files named "Test*.cpp"
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
FOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
...
@@ -15,7 +13,7 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -15,7 +13,7 @@ FOREACH(TEST_PROG ${TEST_PROGS})
# Link with shared library
# Link with shared library
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
${
SHARED_
OPENMM_
RPMD_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
${
SHARED_RPMD_TARGET
}
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
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