Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Andreas Klöckner
pyopencl
Commits
fd4e7cdb
Commit
fd4e7cdb
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Convert test_array.py to new-style clrand calls.
parent
3b734034
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_array.py
+13
-13
13 additions, 13 deletions
test/test_array.py
with
13 additions
and
13 deletions
test/test_array.py
+
13
−
13
View file @
fd4e7cdb
...
...
@@ -294,8 +294,8 @@ def test_elwise_kernel(ctx_factory):
from
pyopencl.clrandom
import
rand
as
clrand
a_gpu
=
clrand
(
context
,
queue
,
(
50
,),
np
.
float32
)
b_gpu
=
clrand
(
context
,
queue
,
(
50
,),
np
.
float32
)
a_gpu
=
clrand
(
queue
,
(
50
,),
np
.
float32
)
b_gpu
=
clrand
(
queue
,
(
50
,),
np
.
float32
)
from
pyopencl.elementwise
import
ElementwiseKernel
lin_comb
=
ElementwiseKernel
(
context
,
...
...
@@ -317,7 +317,7 @@ def test_elwise_kernel_with_options(ctx_factory):
context
=
ctx_factory
()
queue
=
cl
.
CommandQueue
(
context
)
in_gpu
=
clrand
(
context
,
queue
,
(
50
,),
np
.
float32
)
in_gpu
=
clrand
(
queue
,
(
50
,),
np
.
float32
)
options
=
[
'
-DADD_ONE
'
]
add_one
=
ElementwiseKernel
(
...
...
@@ -383,7 +383,7 @@ def test_sum(ctx_factory):
from
pyopencl.clrandom
import
rand
as
clrand
a_gpu
=
clrand
(
context
,
queue
,
(
200000
,),
np
.
float32
)
a_gpu
=
clrand
(
queue
,
(
200000
,),
np
.
float32
)
a
=
a_gpu
.
get
()
sum_a
=
np
.
sum
(
a
)
...
...
@@ -406,7 +406,7 @@ def test_minmax(ctx_factory):
for
what
in
[
"
min
"
,
"
max
"
]:
for
dtype
in
dtypes
:
a_gpu
=
clrand
(
context
,
queue
,
(
200000
,),
dtype
)
a_gpu
=
clrand
(
queue
,
(
200000
,),
dtype
)
a
=
a_gpu
.
get
()
op_a
=
getattr
(
np
,
what
)(
a
)
...
...
@@ -432,7 +432,7 @@ def test_subset_minmax(ctx_factory):
dtypes
=
[
np
.
float32
,
np
.
int32
]
for
dtype
in
dtypes
:
a_gpu
=
clrand
(
context
,
queue
,
(
l_a
,),
dtype
)
a_gpu
=
clrand
(
queue
,
(
l_a
,),
dtype
)
a
=
a_gpu
.
get
()
meaningful_indices_gpu
=
cl_array
.
zeros
(
...
...
@@ -461,9 +461,9 @@ def test_dot(ctx_factory):
queue
=
cl
.
CommandQueue
(
context
)
from
pyopencl.clrandom
import
rand
as
clrand
a_gpu
=
clrand
(
context
,
queue
,
(
200000
,),
np
.
float32
)
a_gpu
=
clrand
(
queue
,
(
200000
,),
np
.
float32
)
a
=
a_gpu
.
get
()
b_gpu
=
clrand
(
context
,
queue
,
(
200000
,),
np
.
float32
)
b_gpu
=
clrand
(
queue
,
(
200000
,),
np
.
float32
)
b
=
b_gpu
.
get
()
dot_ab
=
np
.
dot
(
a
,
b
)
...
...
@@ -479,7 +479,7 @@ if False:
from
pyopencl.clrandom
import
rand
as
clrand
l
=
20000
a_gpu
=
clrand
(
context
,
queue
,
(
l
,))
a_gpu
=
clrand
(
queue
,
(
l
,))
a
=
a_gpu
.
get
()
from
random
import
randrange
...
...
@@ -501,8 +501,8 @@ def test_if_positive(ctx_factory):
from
pyopencl.clrandom
import
rand
as
clrand
l
=
20000
a_gpu
=
clrand
(
context
,
queue
,
(
l
,),
np
.
float32
)
b_gpu
=
clrand
(
context
,
queue
,
(
l
,),
np
.
float32
)
a_gpu
=
clrand
(
queue
,
(
l
,),
np
.
float32
)
b_gpu
=
clrand
(
queue
,
(
l
,),
np
.
float32
)
a
=
a_gpu
.
get
()
b
=
b_gpu
.
get
()
...
...
@@ -548,7 +548,7 @@ def test_astype(ctx_factory):
if
not
has_double_support
(
context
.
devices
[
0
]):
return
a_gpu
=
clrand
(
context
,
queue
,
(
2000
,),
dtype
=
np
.
float32
)
a_gpu
=
clrand
(
queue
,
(
2000
,),
dtype
=
np
.
float32
)
a
=
a_gpu
.
get
().
astype
(
np
.
float64
)
a2
=
a_gpu
.
astype
(
np
.
float64
).
get
()
...
...
@@ -556,7 +556,7 @@ def test_astype(ctx_factory):
assert
a2
.
dtype
==
np
.
float64
assert
la
.
norm
(
a
-
a2
)
==
0
,
(
a
,
a2
)
a_gpu
=
clrand
(
context
,
queue
,
(
2000
,),
dtype
=
np
.
float64
)
a_gpu
=
clrand
(
queue
,
(
2000
,),
dtype
=
np
.
float64
)
a
=
a_gpu
.
get
().
astype
(
np
.
float32
)
a2
=
a_gpu
.
astype
(
np
.
float32
).
get
()
...
...
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