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
bef75922
Commit
bef75922
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of tuck.ath.cx:src/pyopencl
Conflicts: doc/source/misc.rst
parents
3cccc6c0
0755d8a4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/source/array.rst
+13
-0
13 additions, 0 deletions
doc/source/array.rst
doc/source/misc.rst
+1
-0
1 addition, 0 deletions
doc/source/misc.rst
pyopencl/reduction.py
+8
-2
8 additions, 2 deletions
pyopencl/reduction.py
with
22 additions
and
2 deletions
doc/source/array.rst
+
13
−
0
View file @
bef75922
...
@@ -604,6 +604,19 @@ Here's a usage example::
...
@@ -604,6 +604,19 @@ Here's a usage example::
assert (dev_data.get() == np.cumsum(host_data, axis=0)).all()
assert (dev_data.get() == np.cumsum(host_data, axis=0)).all()
Custom data types in Reduction and Scan
---------------------------------------
If you would like to use your own (struct/union/whatever) data types in
scan and reduction, define those types in the *preamble* and let PyOpenCL
know about them using this function:
.. function:: pyopencl.tools.register_dtype(dtype, name)
*dtype* is a :func:`numpy.dtype`.
.. versionadded: 2011.2
Fast Fourier Transforms
Fast Fourier Transforms
-----------------------
-----------------------
...
...
This diff is collapsed.
Click to expand it.
doc/source/misc.rst
+
1
−
0
View file @
bef75922
...
@@ -90,6 +90,7 @@ Version 2011.2
...
@@ -90,6 +90,7 @@ Version 2011.2
* Add :class:`pyopencl.NannyEvent` objects.
* Add :class:`pyopencl.NannyEvent` objects.
* Add :mod:`pyopencl.characterize`.
* Add :mod:`pyopencl.characterize`.
* Ensure compatibility with OS X Lion.
* Ensure compatibility with OS X Lion.
* Add :func:`pyopencl.tools.register_dtype` to enable scan/reduction on struct types.
.. * Beta support for OpenCL 1.2.
.. * Beta support for OpenCL 1.2.
...
...
This diff is collapsed.
Click to expand it.
pyopencl/reduction.py
+
8
−
2
View file @
bef75922
...
@@ -225,7 +225,11 @@ def get_reduction_kernel(stage,
...
@@ -225,7 +225,11 @@ def get_reduction_kernel(stage,
map_expr
=
"
in[i]
"
map_expr
=
"
in[i]
"
if
stage
==
2
:
if
stage
==
2
:
arguments
=
"
__global const %s *in
"
%
out_type
in_arg
=
"
__global const %s *in
"
%
out_type
if
arguments
:
arguments
=
in_arg
+
"
,
"
+
arguments
else
:
arguments
=
in_arg
inf
=
get_reduction_source
(
inf
=
get_reduction_source
(
ctx
,
out_type
,
out_type_size
,
ctx
,
out_type
,
out_type_size
,
...
@@ -311,6 +315,8 @@ class ReductionKernel:
...
@@ -311,6 +315,8 @@ class ReductionKernel:
if
kwargs
:
if
kwargs
:
raise
TypeError
(
"
invalid keyword argument to reduction kernel
"
)
raise
TypeError
(
"
invalid keyword argument to reduction kernel
"
)
stage1_args
=
args
while
True
:
while
True
:
invocation_args
=
[]
invocation_args
=
[]
vectors
=
[]
vectors
=
[]
...
@@ -363,7 +369,7 @@ class ReductionKernel:
...
@@ -363,7 +369,7 @@ class ReductionKernel:
return
result
return
result
else
:
else
:
stage_inf
=
self
.
stage_2_inf
stage_inf
=
self
.
stage_2_inf
args
=
[
result
]
args
=
(
result
,)
+
stage1_args
...
...
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