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
ee037398
Unverified
Commit
ee037398
authored
Dec 27, 2020
by
peastman
Committed by
GitHub
Dec 27, 2020
Browse files
Updated to latest version of OpenCL C++ API (#2962)
parent
e23dc927
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
10340 additions
and
24 deletions
+10340
-24
platforms/opencl/include/OpenCLArray.h
platforms/opencl/include/OpenCLArray.h
+4
-3
platforms/opencl/include/OpenCLContext.h
platforms/opencl/include/OpenCLContext.h
+4
-3
platforms/opencl/include/OpenCLKernel.h
platforms/opencl/include/OpenCLKernel.h
+0
-1
platforms/opencl/include/OpenCLNonbondedUtilities.h
platforms/opencl/include/OpenCLNonbondedUtilities.h
+0
-1
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+1
-4
platforms/opencl/src/OpenCLEvent.cpp
platforms/opencl/src/OpenCLEvent.cpp
+1
-1
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
+0
-1
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+9
-9
platforms/opencl/src/opencl.hpp
platforms/opencl/src/opencl.hpp
+10317
-0
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
+4
-1
No files found.
platforms/opencl/include/OpenCLArray.h
View file @
ee037398
...
...
@@ -27,12 +27,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* -------------------------------------------------------------------------- */
#define __CL_ENABLE_EXCEPTIONS
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_HPP_ENABLE_EXCEPTIONS
#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#include "openmm/OpenMMException.h"
#include "openmm/common/windowsExportCommon.h"
#include "openmm/common/ArrayInterface.h"
#include <cl.hpp>
#include <
open
cl.hpp>
#include <iostream>
#include <sstream>
#include <vector>
...
...
platforms/opencl/include/OpenCLContext.h
View file @
ee037398
...
...
@@ -29,8 +29,9 @@
#include <map>
#include <string>
#define __CL_ENABLE_EXCEPTIONS
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_HPP_ENABLE_EXCEPTIONS
#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#ifndef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
#endif
...
...
@@ -48,7 +49,7 @@
#define NOMINMAX
#endif
#include <pthread.h>
#include <cl.hpp>
#include <
open
cl.hpp>
#include "openmm/common/windowsExportCommon.h"
#include "OpenCLArray.h"
#include "OpenCLBondedUtilities.h"
...
...
platforms/opencl/include/OpenCLKernel.h
View file @
ee037398
...
...
@@ -29,7 +29,6 @@
#include "OpenCLArray.h"
#include "OpenCLContext.h"
#include <cl.hpp>
#include <string>
#include <vector>
...
...
platforms/opencl/include/OpenCLNonbondedUtilities.h
View file @
ee037398
...
...
@@ -31,7 +31,6 @@
#include "OpenCLArray.h"
#include "OpenCLExpressionUtilities.h"
#include "openmm/common/NonbondedUtilities.h"
#include <cl.hpp>
#include <sstream>
#include <string>
#include <vector>
...
...
platforms/opencl/src/OpenCLContext.cpp
View file @
ee037398
...
...
@@ -614,10 +614,7 @@ cl::Program OpenCLContext::createProgram(const string source, const map<string,
if
(
!
defines
.
empty
())
src
<<
endl
;
src
<<
source
<<
endl
;
// Get length before using c_str() to avoid length() call invalidating the c_str() value.
string
src_string
=
src
.
str
();
::
size_t
src_length
=
src_string
.
length
();
cl
::
Program
::
Sources
sources
(
1
,
make_pair
(
src_string
.
c_str
(),
src_length
));
cl
::
Program
::
Sources
sources
({
src
.
str
()});
cl
::
Program
program
(
context
,
sources
);
try
{
program
.
build
(
vector
<
cl
::
Device
>
(
1
,
device
),
options
.
c_str
());
...
...
platforms/opencl/src/OpenCLEvent.cpp
View file @
ee037398
...
...
@@ -32,7 +32,7 @@ OpenCLEvent::OpenCLEvent(OpenCLContext& context) : context(context) {
}
void
OpenCLEvent
::
enqueue
()
{
context
.
getQueue
().
enqueueMarker
(
&
event
);
context
.
getQueue
().
enqueueMarker
WithWaitList
(
NULL
,
&
event
);
}
void
OpenCLEvent
::
wait
()
{
...
...
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
View file @
ee037398
...
...
@@ -26,7 +26,6 @@
#include "OpenCLIntegrationUtilities.h"
#include "OpenCLContext.h"
#include <cl.hpp>
using
namespace
OpenMM
;
using
namespace
std
;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
ee037398
...
...
@@ -60,7 +60,7 @@ static void setPosqCorrectionArg(OpenCLContext& cl, cl::Kernel& kernel, int inde
if
(
cl
.
getUseMixedPrecision
())
kernel
.
setArg
<
cl
::
Buffer
>
(
index
,
cl
.
getPosqCorrection
().
getDeviceBuffer
());
else
kernel
.
setArg
<
void
*>
(
index
,
NULL
);
kernel
.
setArg
(
index
,
sizeof
(
void
*
)
,
NULL
);
}
static
void
setPeriodicBoxSizeArg
(
OpenCLContext
&
cl
,
cl
::
Kernel
&
kernel
,
int
index
)
{
...
...
@@ -598,8 +598,8 @@ public:
void
computeForceAndEnergy
(
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
if
((
groups
&
(
1
<<
forceGroup
))
!=
0
)
{
vector
<
cl
::
Event
>
events
(
1
);
cl
.
getQueue
().
enqueueMarker
(
&
events
[
0
]);
queue
.
enqueue
WaitForEvents
(
events
);
cl
.
getQueue
().
enqueueMarker
WithWaitList
(
NULL
,
&
events
[
0
]);
queue
.
enqueue
BarrierWithWaitList
(
&
events
);
}
}
private:
...
...
@@ -624,7 +624,7 @@ public:
vector
<
cl
::
Event
>
events
(
1
);
events
[
0
]
=
event
;
event
=
cl
::
Event
();
cl
.
getQueue
().
enqueue
WaitForEvents
(
events
);
cl
.
getQueue
().
enqueue
BarrierWithWaitList
(
&
events
);
if
(
includeEnergy
)
cl
.
executeKernel
(
addEnergyKernel
,
pmeEnergyBuffer
.
getSize
());
}
...
...
@@ -1320,8 +1320,8 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ
cl
.
executeKernel
(
computeExclusionParamsKernel
,
exclusionParams
.
getSize
());
if
(
usePmeQueue
)
{
vector
<
cl
::
Event
>
events
(
1
);
cl
.
getQueue
().
enqueueMarker
(
&
events
[
0
]);
pmeQueue
.
enqueue
WaitForEvents
(
events
);
cl
.
getQueue
().
enqueueMarker
WithWaitList
(
NULL
,
&
events
[
0
]);
pmeQueue
.
enqueue
BarrierWithWaitList
(
&
events
);
}
if
(
hasOffsets
)
energy
=
0.0
;
// The Ewald self energy was computed in the kernel.
...
...
@@ -1563,7 +1563,7 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ
cl
.
executeKernel
(
pmeDispersionInterpolateForceKernel
,
cl
.
getNumAtoms
());
}
if
(
usePmeQueue
)
{
pmeQueue
.
enqueueMarker
(
&
pmeSyncEvent
);
pmeQueue
.
enqueueMarker
WithWaitList
(
NULL
,
&
pmeSyncEvent
);
cl
.
restoreDefaultQueue
();
}
}
...
...
@@ -1852,8 +1852,8 @@ void OpenCLCalcCustomCVForceKernel::copyState(ContextImpl& context, ContextImpl&
copyStateKernel
.
setArg
<
cl
::
Buffer
>
(
5
,
cl2
.
getPosqCorrection
().
getDeviceBuffer
());
}
else
{
copyStateKernel
.
setArg
<
void
*
>
(
1
,
NULL
);
copyStateKernel
.
setArg
<
void
*
>
(
5
,
NULL
);
copyStateKernel
.
setArg
(
1
,
sizeof
(
void
*
)
,
NULL
);
copyStateKernel
.
setArg
(
5
,
sizeof
(
void
*
)
,
NULL
);
}
copyForcesKernel
.
setArg
<
cl
::
Buffer
>
(
1
,
invAtomOrder
.
getDeviceBuffer
());
...
...
platforms/opencl/src/cl.hpp
→
platforms/opencl/src/
open
cl.hpp
View file @
ee037398
This source diff could not be displayed because it is too large. You can
view the blob
instead.
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
View file @
ee037398
...
...
@@ -29,9 +29,12 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#define CL_HPP_ENABLE_EXCEPTIONS
#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#include "OpenCLTests.h"
#include "TestNonbondedForce.h"
#include <cl.hpp>
#include <
open
cl.hpp>
#include <string>
void
testParallelComputation
(
NonbondedForce
::
NonbondedMethod
method
)
{
...
...
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