Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
689ad021
Commit
689ad021
authored
12 years ago
by
Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Benchmark tool enables double precision for OpenCL 1.1 and 1.2
parent
8ec6215e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
HySoP/hysop/tools/kernel_benchmark.py
+25
-12
25 additions, 12 deletions
HySoP/hysop/tools/kernel_benchmark.py
with
25 additions
and
12 deletions
HySoP/hysop/tools/kernel_benchmark.py
+
25
−
12
View file @
689ad021
...
...
@@ -108,9 +108,8 @@ class BenchmarkSuite:
b
.
launch
()
[
self
.
timings
[
self
.
kernel_name
][
v
[
1
]][
conf
[
2
]].
__setitem__
(
t
[
0
],
t
[
1
])
for
t
in
b
.
timings
.
items
()]
if
not
self
.
test
:
pickle
.
dump
(
self
.
timings
,
open
(
self
.
pickle_file_name
+
'
.pickle
'
,
'
w
'
),
0
)
self
.
write_file
()
pickle
.
dump
(
self
.
timings
,
open
(
self
.
pickle_file_name
+
'
.pickle
'
,
'
w
'
),
0
)
self
.
write_file
()
def
write_file
(
self
):
"""
...
...
@@ -232,26 +231,37 @@ class Benchmark:
print
"
over :
"
,
self
.
device
.
name
,
print
"
with
"
,
self
.
device
.
opencl_c_version
print
"
Precision capability
"
,
self
.
correctlyroundeddividesqrt
=
True
if
precision
==
'
SP
'
:
print
"
for Single Precision:
"
,
for
v
in
[
'
DENORM
'
,
'
INF_NAN
'
,
'
ROUND_TO_NEAREST
'
,
'
ROUND_TO_ZERO
'
,
'
ROUND_TO_INF
'
,
'
FMA
'
,
'
CORRECTLY_ROUNDED_DIVIDE_SQRT
'
,
'
SOFT_FLOAT
'
]:
if
eval
(
'
(self.device.single_fp_config & cl.device_fp_config.
'
+
v
+
'
) == cl.device_fp_config.
'
+
v
):
print
v
,
try
:
if
eval
(
'
(self.device.single_fp_config & cl.device_fp_config.
'
+
v
+
'
) == cl.device_fp_config.
'
+
v
):
print
v
,
except
AttributeError
as
ae
:
if
v
is
'
CORRECTLY_ROUNDED_DIVIDE_SQRT
'
:
self
.
correctlyroundeddividesqrt
=
False
print
'
\n
'
,
v
,
'
is not supported in OpenCL C 1.2. Exception catched :
'
,
ae
else
:
print
"
for Double Precision:
"
,
if
self
.
device
.
double_fp_config
>
0
:
for
v
in
[
'
DENORM
'
,
'
INF_NAN
'
,
'
ROUND_TO_NEAREST
'
,
'
ROUND_TO_ZERO
'
,
'
ROUND_TO_INF
'
,
'
FMA
'
,
'
CORRECTLY_ROUNDED_DIVIDE_SQRT
'
,
'
SOFT_FLOAT
'
]:
if
eval
(
'
(self.device.double_fp_config & cl.device_fp_config.
'
+
v
+
'
) == cl.device_fp_config.
'
+
v
):
print
v
,
try
:
if
eval
(
'
(self.device.double_fp_config & cl.device_fp_config.
'
+
v
+
'
) == cl.device_fp_config.
'
+
v
):
print
v
,
except
AttributeError
as
ae
:
if
v
is
'
CORRECTLY_ROUNDED_DIVIDE_SQRT
'
:
self
.
correctlyroundeddividesqrt
=
False
print
'
\n
'
,
v
,
'
is supported in OpenCL C 1.2. Exception catched :
'
,
ae
else
:
raise
ValueError
(
"
Double Precision is not supported by device
"
)
print
"
\n\n
"
print
""
#Creates GPU Context
## OpenCL context
self
.
ctx
=
cl
.
Context
([
self
.
device
])
...
...
@@ -280,13 +290,16 @@ class Benchmark:
if
self
.
code
is
not
None
:
for
size
in
self
.
sizes
:
if
self
.
is_size_allowed
is
None
or
self
.
is_size_allowed
(
size
):
build_options
=
"
-cl-opt-disable -cl-fp32-correctly-rounded-divide-sqrt
"
build_options
=
"
-cl-opt-disable
"
if
self
.
correctlyroundeddividesqrt
:
build_options
+=
"
-cl-fp32-correctly-rounded-divide-sqrt
"
if
self
.
precision
==
'
SP
'
:
prg
=
cl
.
Program
(
self
.
ctx
,
self
.
code
)
prg
=
cl
.
Program
(
self
.
ctx
,
self
.
code
.
replace
(
'
.0
'
,
'
.0f
'
)
)
build_options
+=
"
-cl-single-precision-constant
"
else
:
prg
=
cl
.
Program
(
self
.
ctx
,
self
.
code
.
replace
(
'
float
'
,
'
double
'
))
prg
.
build
(
build_options
+
build_opt
(
size
))
print
prg
.
get_build_info
(
self
.
device
,
cl
.
program_build_info
.
OPTIONS
)
self
.
prg
[
size
]
=
prg
## Function to setup kernels arguments
self
.
kernelSetup
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment