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
88402c54
Commit
88402c54
authored
Apr 09, 2014
by
peastman
Browse files
Merge pull request #401 from rmcgibbo/disable
Disable OpenCL platform on known-buggy macs
parents
31fc3693
9edaf653
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
platforms/opencl/include/OpenCLPlatform.h
platforms/opencl/include/OpenCLPlatform.h
+1
-0
platforms/opencl/src/OpenCLPlatform.cpp
platforms/opencl/src/OpenCLPlatform.cpp
+35
-2
No files found.
platforms/opencl/include/OpenCLPlatform.h
View file @
88402c54
...
...
@@ -48,6 +48,7 @@ public:
}
double
getSpeed
()
const
;
bool
supportsDoublePrecision
()
const
;
static
bool
isPlatformSupported
();
const
std
::
string
&
getPropertyValue
(
const
Context
&
context
,
const
std
::
string
&
property
)
const
;
void
setPropertyValue
(
Context
&
context
,
const
std
::
string
&
property
,
const
std
::
string
&
value
)
const
;
void
contextCreated
(
ContextImpl
&
context
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
properties
)
const
;
...
...
platforms/opencl/src/OpenCLPlatform.cpp
View file @
88402c54
...
...
@@ -33,6 +33,10 @@
#include "openmm/System.h"
#include <algorithm>
#include <sstream>
#ifdef __APPLE__
#include "sys/sysctl.h"
#endif
using
namespace
OpenMM
;
using
std
::
map
;
...
...
@@ -42,10 +46,12 @@ using std::vector;
#ifdef OPENMM_OPENCL_BUILDING_STATIC_LIBRARY
extern
"C"
void
registerOpenCLPlatform
()
{
if
(
OpenCLPlatform
::
isPlatformSupported
())
Platform
::
registerPlatform
(
new
OpenCLPlatform
());
}
#else
extern
"C"
OPENMM_EXPORT_OPENCL
void
registerPlatforms
()
{
if
(
OpenCLPlatform
::
isPlatformSupported
())
Platform
::
registerPlatform
(
new
OpenCLPlatform
());
}
#endif
...
...
@@ -102,6 +108,33 @@ bool OpenCLPlatform::supportsDoublePrecision() const {
return
true
;
}
bool
OpenCLPlatform
::
isPlatformSupported
()
{
// Return false for OpenCL implementations that are known
// to be buggy (Apple OSX since 10.7.5)
#ifdef __APPLE__
char
str
[
256
];
size_t
size
=
sizeof
(
str
);
int
ret
=
sysctlbyname
(
"kern.osrelease"
,
str
,
&
size
,
NULL
,
0
);
if
(
ret
!=
0
)
return
false
;
int
major
,
minor
,
micro
;
if
(
sscanf
(
str
,
"%d.%d.%d"
,
&
major
,
&
minor
,
&
micro
)
!=
3
)
return
false
;
if
((
major
>
11
)
||
(
major
==
11
&&
minor
>
4
)
||
(
major
==
11
&&
minor
==
4
&&
micro
>=
2
))
// 11.4.2 is the darwin release corresponding to OSX 10.7.5, which is the
// point at which a number of serious bugs were introduced into the
// Apple OpenCL libraries, resulting in catistrophically incorrect MD simulations
// (see https://github.com/SimTk/openmm/issues/395 for example). Once a fix is released,
// this version check should be updated.
return
false
;
#endif
return
true
;
}
const
string
&
OpenCLPlatform
::
getPropertyValue
(
const
Context
&
context
,
const
string
&
property
)
const
{
const
ContextImpl
&
impl
=
getContextImpl
(
context
);
const
PlatformData
*
data
=
reinterpret_cast
<
const
PlatformData
*>
(
impl
.
getPlatformData
());
...
...
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