Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Markus Holzer
pystencils
Commits
c1c692a8
Commit
c1c692a8
authored
2 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
First fix
parent
e18aa374
No related branches found
No related tags found
No related merge requests found
Pipeline
#51423
passed
2 years ago
Stage: pretest
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/gpucuda/indexing.py
+16
-5
16 additions, 5 deletions
pystencils/gpucuda/indexing.py
with
16 additions
and
5 deletions
pystencils/gpucuda/indexing.py
+
16
−
5
View file @
c1c692a8
...
@@ -124,12 +124,18 @@ class BlockIndexing(AbstractIndexing):
...
@@ -124,12 +124,18 @@ class BlockIndexing(AbstractIndexing):
self
.
_symbolic_shape
=
[
e
if
isinstance
(
e
,
sp
.
Basic
)
else
None
for
e
in
field
.
spatial_shape
]
self
.
_symbolic_shape
=
[
e
if
isinstance
(
e
,
sp
.
Basic
)
else
None
for
e
in
field
.
spatial_shape
]
self
.
_compile_time_block_size
=
compile_time_block_size
self
.
_compile_time_block_size
=
compile_time_block_size
@property
def
cuda_indices
(
self
):
block_size
=
self
.
_block_size
if
self
.
_compile_time_block_size
else
BLOCK_DIM
indices
=
[
block_index
*
bs
+
thread_idx
for
block_index
,
bs
,
thread_idx
in
zip
(
BLOCK_IDX
,
block_size
,
THREAD_IDX
)]
return
indices
[:
self
.
_dim
]
@property
@property
def
coordinates
(
self
):
def
coordinates
(
self
):
offsets
=
_get_start_from_slice
(
self
.
_iterationSlice
)
offsets
=
_get_start_from_slice
(
self
.
_iterationSlice
)
block_size
=
self
.
_block_size
if
self
.
_compile_time_block_size
else
BLOCK_DIM
coordinates
=
[
c
+
off
for
c
,
off
in
zip
(
self
.
cuda_indices
,
offsets
)]
coordinates
=
[
block_index
*
bs
+
thread_idx
+
off
for
block_index
,
bs
,
thread_idx
,
off
in
zip
(
BLOCK_IDX
,
block_size
,
THREAD_IDX
,
offsets
)]
return
coordinates
[:
self
.
_dim
]
return
coordinates
[:
self
.
_dim
]
...
@@ -159,8 +165,13 @@ class BlockIndexing(AbstractIndexing):
...
@@ -159,8 +165,13 @@ class BlockIndexing(AbstractIndexing):
def
guard
(
self
,
kernel_content
,
arr_shape
):
def
guard
(
self
,
kernel_content
,
arr_shape
):
arr_shape
=
arr_shape
[:
self
.
_dim
]
arr_shape
=
arr_shape
[:
self
.
_dim
]
conditions
=
[
c
<
end
end
=
_get_end_from_slice
(
self
.
_iterationSlice
,
arr_shape
)
for
c
,
end
in
zip
(
self
.
coordinates
,
_get_end_from_slice
(
self
.
_iterationSlice
,
arr_shape
))]
conditions
=
[
c
<
e
for
c
,
e
in
zip
(
self
.
coordinates
,
end
)]
for
cuda_index
,
iter_slice
in
zip
(
self
.
cuda_indices
,
self
.
_iterationSlice
):
if
iter_slice
.
step
>
1
:
conditions
.
append
(
sp
.
Eq
(
sp
.
Mod
(
cuda_index
,
iter_slice
.
step
),
0
))
condition
=
conditions
[
0
]
condition
=
conditions
[
0
]
for
c
in
conditions
[
1
:]:
for
c
in
conditions
[
1
:]:
condition
=
sp
.
And
(
condition
,
c
)
condition
=
sp
.
And
(
condition
,
c
)
...
...
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