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
dc431ef2
Commit
dc431ef2
authored
11 months ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fix original tests
parent
b7205955
No related branches found
No related tags found
No related merge requests found
Pipeline
#67292
passed
11 months ago
Stage: pretest
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_gpu.py
+17
-5
17 additions, 5 deletions
tests/test_gpu.py
with
17 additions
and
5 deletions
tests/test_gpu.py
+
17
−
5
View file @
dc431ef2
...
@@ -2,6 +2,7 @@ import pytest
...
@@ -2,6 +2,7 @@ import pytest
import
numpy
as
np
import
numpy
as
np
import
sympy
as
sp
import
sympy
as
sp
import
math
from
scipy.ndimage
import
convolve
from
scipy.ndimage
import
convolve
from
pystencils
import
Assignment
,
Field
,
fields
,
CreateKernelConfig
,
create_kernel
,
Target
,
get_code_str
from
pystencils
import
Assignment
,
Field
,
fields
,
CreateKernelConfig
,
create_kernel
,
Target
,
get_code_str
...
@@ -231,15 +232,26 @@ def test_guards_with_iteration_slices(start, end, step, shape):
...
@@ -231,15 +232,26 @@ def test_guards_with_iteration_slices(start, end, step, shape):
field_1
=
fields
(
f
"
f(1) : double
{
list
(
shape
)
}
"
)
field_1
=
fields
(
f
"
f(1) : double
{
list
(
shape
)
}
"
)
assignment
=
Assignment
(
field_1
.
center
,
1
)
assignment
=
Assignment
(
field_1
.
center
,
1
)
ast
=
create_kernel
(
assignment
,
config
=
kernel_config_gpu
)
ast
=
create_kernel
(
assignment
,
config
=
kernel_config_gpu
)
code_str
=
get_code_str
(
ast
)
code_str
=
get_code_str
(
ast
)
test_strings
=
list
()
test_strings
=
list
()
iteration_ranges
=
list
()
for
i
,
s
in
enumerate
(
iter_slice
):
for
i
,
s
in
enumerate
(
iter_slice
):
end
=
shape
[
i
]
+
s
.
stop
e
=
((
shape
[
i
]
+
end
)
-
s
.
start
)
/
s
.
step
end
=
end
//
s
.
step
e
=
math
.
ceil
(
e
)
+
s
.
start
test_strings
.
append
(
f
"
{
s
.
start
}
<
{
end
}
"
)
test_strings
.
append
(
f
"
{
s
.
start
}
<
{
e
}
"
)
a
=
s
.
start
counter
=
0
while
a
<
e
:
a
+=
1
counter
+=
1
iteration_ranges
.
append
(
counter
)
# check if the expected if statement is in the GPU code
for
s
in
test_strings
:
for
s
in
test_strings
:
assert
s
in
code_str
assert
s
in
code_str
# check if these bounds lead to same lengths as the range function would produce
for
i
in
range
(
len
(
iter_slice
)):
assert
iteration_ranges
[
i
]
==
len
(
range
(
iter_slice
[
i
].
start
,
shape
[
i
]
+
end
,
iter_slice
[
i
].
step
))
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