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
df5654ef
Commit
df5654ef
authored
Jul 28, 2010
by
Peter Eastman
Browse files
Timo's changes to more accurately select the fastest device
parent
12680294
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+11
-2
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
df5654ef
...
@@ -60,9 +60,18 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
...
@@ -60,9 +60,18 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
int
bestSpeed
=
0
;
int
bestSpeed
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
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
speed
=
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_COMPUTE_UNITS
>
()
*
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_CLOCK_FREQUENCY
>
();
int
processingElementsPerComputeUnit
=
1
;
if
(
maxSize
>=
minThreadBlockSize
&&
speed
>
bestSpeed
)
if
(
devices
[
i
].
getInfo
<
CL_DEVICE_EXTENSIONS
>
().
find
(
"cl_nv_device_attribute_query"
)
!=
string
::
npos
)
{
cl_uint
computeCapabilityMajor
;
const
cl_device_info
CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
=
0x4000
;
clGetDeviceInfo
(
devices
[
i
](),
CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
,
sizeof
(
cl_uint
),
&
computeCapabilityMajor
,
NULL
);
processingElementsPerComputeUnit
=
(
computeCapabilityMajor
<
2
?
8
:
32
);
}
int
speed
=
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_COMPUTE_UNITS
>
()
*
processingElementsPerComputeUnit
*
devices
[
i
].
getInfo
<
CL_DEVICE_MAX_CLOCK_FREQUENCY
>
();
if
(
maxSize
>=
minThreadBlockSize
&&
speed
>
bestSpeed
)
{
deviceIndex
=
i
;
deviceIndex
=
i
;
bestSpeed
=
speed
;
}
}
}
}
}
if
(
deviceIndex
==
-
1
)
if
(
deviceIndex
==
-
1
)
...
...
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