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
b8e15090
Commit
b8e15090
authored
Aug 28, 2012
by
Peter Eastman
Browse files
Fixed errors on Intel OpenCL
parent
e6741413
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+7
-3
platforms/opencl/src/kernels/shakeHydrogens.cl
platforms/opencl/src/kernels/shakeHydrogens.cl
+1
-1
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
b8e15090
...
@@ -75,6 +75,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -75,6 +75,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
cl
::
Platform
::
get
(
&
platforms
);
cl
::
Platform
::
get
(
&
platforms
);
if
(
platformIndex
<
0
||
platformIndex
>=
platforms
.
size
())
if
(
platformIndex
<
0
||
platformIndex
>=
platforms
.
size
())
throw
OpenMMException
(
"Illegal value for OpenCL platform index"
);
throw
OpenMMException
(
"Illegal value for OpenCL platform index"
);
string
platformVendor
=
platforms
[
platformIndex
].
getInfo
<
CL_PLATFORM_VENDOR
>
();
vector
<
cl
::
Device
>
devices
;
vector
<
cl
::
Device
>
devices
;
platforms
[
platformIndex
].
getDevices
(
CL_DEVICE_TYPE_ALL
,
&
devices
);
platforms
[
platformIndex
].
getDevices
(
CL_DEVICE_TYPE_ALL
,
&
devices
);
const
int
minThreadBlockSize
=
32
;
const
int
minThreadBlockSize
=
32
;
...
@@ -83,7 +84,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -83,7 +84,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
int
bestSpeed
=
-
1
;
int
bestSpeed
=
-
1
;
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
if
(
platform
s
[
platformIndex
].
getInfo
<
CL_PLATFORM_VENDOR
>
()
==
"Apple"
&&
devices
[
i
].
getInfo
<
CL_DEVICE_VENDOR
>
()
==
"AMD"
)
if
(
platform
Vendor
==
"Apple"
&&
devices
[
i
].
getInfo
<
CL_DEVICE_VENDOR
>
()
==
"AMD"
)
continue
;
// Don't use AMD GPUs on OS X due to serious bugs.
continue
;
// Don't use AMD GPUs on OS X due to serious bugs.
int
maxSize
=
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_WORK_ITEM_SIZES
>
()[
0
];
int
maxSize
=
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_WORK_ITEM_SIZES
>
()[
0
];
int
processingElementsPerComputeUnit
=
8
;
int
processingElementsPerComputeUnit
=
8
;
...
@@ -131,7 +132,10 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -131,7 +132,10 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
if
(
device
.
getInfo
<
CL_DEVICE_MAX_WORK_GROUP_SIZE
>
()
<
minThreadBlockSize
)
if
(
device
.
getInfo
<
CL_DEVICE_MAX_WORK_GROUP_SIZE
>
()
<
minThreadBlockSize
)
throw
OpenMMException
(
"The specified OpenCL device is not compatible with OpenMM"
);
throw
OpenMMException
(
"The specified OpenCL device is not compatible with OpenMM"
);
compilationDefines
[
"WORK_GROUP_SIZE"
]
=
OpenCLExpressionUtilities
::
intToString
(
ThreadBlockSize
);
compilationDefines
[
"WORK_GROUP_SIZE"
]
=
OpenCLExpressionUtilities
::
intToString
(
ThreadBlockSize
);
defaultOptimizationOptions
=
"-cl-fast-relaxed-math"
;
if
(
platformVendor
.
size
()
>=
5
&&
platformVendor
.
substr
(
0
,
5
)
==
"Intel"
)
defaultOptimizationOptions
=
""
;
else
defaultOptimizationOptions
=
"-cl-fast-relaxed-math"
;
supports64BitGlobalAtomics
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_int64_base_atomics"
)
!=
string
::
npos
);
supports64BitGlobalAtomics
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_int64_base_atomics"
)
!=
string
::
npos
);
supportsDoublePrecision
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_fp64"
)
!=
string
::
npos
);
supportsDoublePrecision
=
(
device
.
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_khr_fp64"
)
!=
string
::
npos
);
string
vendor
=
device
.
getInfo
<
CL_DEVICE_VENDOR
>
();
string
vendor
=
device
.
getInfo
<
CL_DEVICE_VENDOR
>
();
...
@@ -196,7 +200,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -196,7 +200,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
}
}
else
else
simdWidth
=
1
;
simdWidth
=
1
;
if
(
platform
s
[
platformIndex
].
getInfo
<
CL_PLATFORM_VENDOR
>
()
==
"Apple"
&&
vendor
==
"AMD"
)
if
(
platform
Vendor
==
"Apple"
&&
vendor
==
"AMD"
)
compilationDefines
[
"MAC_AMD_WORKAROUND"
]
=
""
;
compilationDefines
[
"MAC_AMD_WORKAROUND"
]
=
""
;
if
(
supports64BitGlobalAtomics
)
if
(
supports64BitGlobalAtomics
)
compilationDefines
[
"SUPPORTS_64_BIT_ATOMICS"
]
=
""
;
compilationDefines
[
"SUPPORTS_64_BIT_ATOMICS"
]
=
""
;
...
...
platforms/opencl/src/kernels/shakeHydrogens.cl
View file @
b8e15090
...
@@ -44,7 +44,7 @@ __kernel void applyShakeToHydrogens(int numClusters, float tol, __global const f
...
@@ -44,7 +44,7 @@ __kernel void applyShakeToHydrogens(int numClusters, float tol, __global const f
//
Iterate
until
convergence.
//
Iterate
until
convergence.
bool
converged
=
false
;
int
converged
=
false
;
int
iteration
=
0
;
int
iteration
=
0
;
while
(
iteration
<
15
&&
!converged
)
{
while
(
iteration
<
15
&&
!converged
)
{
converged
=
true
;
converged
=
true
;
...
...
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