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
5e736c0c
There was a problem fetching the pipeline summary.
Commit
5e736c0c
authored
7 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix vector-typed memory maps (#203 on github)
parent
8401fa5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Fix vector-typed memory maps (#203 on github)
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyopencl/cffi_cl.py
+9
-4
9 additions, 4 deletions
pyopencl/cffi_cl.py
test/test_wrapper.py
+20
-0
20 additions, 0 deletions
test/test_wrapper.py
with
29 additions
and
4 deletions
pyopencl/cffi_cl.py
+
9
−
4
View file @
5e736c0c
...
...
@@ -2187,8 +2187,11 @@ def enqueue_map_buffer(queue, buf, flags, offset, shape, dtype,
_handle_error
(
_lib
.
enqueue_map_buffer
(
_event
,
_map
,
queue
.
ptr
,
buf
.
ptr
,
flags
,
offset
,
byte_size
,
c_wait_for
,
num_wait_for
,
bool
(
is_blocking
)))
return
(
np
.
asarray
(
MemoryMap
.
_create
(
_map
[
0
],
shape
,
dtype
.
str
,
strides
)),
Event
.
_create
(
_event
[
0
]))
mmap
=
MemoryMap
.
_create
(
_map
[
0
],
shape
,
dtype
.
str
,
strides
)
ary
=
np
.
asarray
(
mmap
)
ary
.
dtype
=
dtype
return
(
ary
,
Event
.
_create
(
_event
[
0
]))
def
_enqueue_fill_buffer
(
queue
,
mem
,
pattern
,
offset
,
size
,
wait_for
=
None
):
...
...
@@ -2283,8 +2286,10 @@ def enqueue_map_image(queue, img, flags, origin, region, shape, dtype,
flags
,
origin
,
origin_l
,
region
,
region_l
,
_row_pitch
,
_slice_pitch
,
c_wait_for
,
num_wait_for
,
is_blocking
))
return
(
np
.
asarray
(
MemoryMap
.
_create
(
_map
[
0
],
shape
,
dtype
.
str
,
strides
)),
Event
.
_create
(
_event
[
0
]),
_row_pitch
[
0
],
_slice_pitch
[
0
])
mmap
=
MemoryMap
.
_create
(
_map
[
0
],
shape
,
dtype
.
str
,
strides
)
ary
=
np
.
asarray
(
mmap
)
ary
.
dtype
=
dtype
return
(
ary
,
Event
.
_create
(
_event
[
0
]),
_row_pitch
[
0
],
_slice_pitch
[
0
])
def
enqueue_fill_image
(
queue
,
img
,
color
,
origin
,
region
,
wait_for
=
None
):
...
...
This diff is collapsed.
Click to expand it.
test/test_wrapper.py
+
20
−
0
View file @
5e736c0c
...
...
@@ -1031,6 +1031,26 @@ def test_fine_grain_svm(ctx_factory):
assert
np
.
array_equal
(
orig_ary
*
2
,
ary
)
@pytest.mark.parametrize
(
"
dtype
"
,
[
np
.
uint
,
cl
.
cltypes
.
uint2
,
])
def
test_map_dtype
(
ctx_factory
,
dtype
):
ctx
=
ctx_factory
()
queue
=
cl
.
CommandQueue
(
ctx
)
dt
=
np
.
dtype
(
dtype
)
b
=
pyopencl
.
Buffer
(
ctx
,
pyopencl
.
mem_flags
.
READ_ONLY
,
dt
.
itemsize
)
array
,
ev
=
pyopencl
.
enqueue_map_buffer
(
queue
,
b
,
pyopencl
.
map_flags
.
WRITE
,
0
,
(
1
,),
dt
)
with
array
.
base
:
print
(
array
.
dtype
)
assert
array
.
dtype
==
dt
if
__name__
==
"
__main__
"
:
# make sure that import failures get reported, instead of skipping the tests.
import
pyopencl
# noqa
...
...
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