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
pycodegen
pystencils
Commits
61ffa6ec
Commit
61ffa6ec
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Solved merge conflict
parent
3ab12930
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!292
Rebase of pystencils Type System
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils_tests/test_vectorization_specific.py
+12
-19
12 additions, 19 deletions
pystencils_tests/test_vectorization_specific.py
with
12 additions
and
19 deletions
pystencils_tests/test_vectorization_specific.py
+
12
−
19
View file @
61ffa6ec
...
@@ -61,6 +61,7 @@ def test_vectorized_abs(instruction_set, dtype):
...
@@ -61,6 +61,7 @@ def test_vectorized_abs(instruction_set, dtype):
@pytest.mark.parametrize
(
'
dtype
'
,
(
'
float
'
,
'
double
'
))
@pytest.mark.parametrize
(
'
dtype
'
,
(
'
float
'
,
'
double
'
))
@pytest.mark.parametrize
(
'
instruction_set
'
,
supported_instruction_sets
)
@pytest.mark.parametrize
(
'
instruction_set
'
,
supported_instruction_sets
)
def
test_strided
(
instruction_set
,
dtype
):
def
test_strided
(
instruction_set
,
dtype
):
npdtype
=
np
.
float64
if
dtype
==
'
double
'
else
np
.
float32
type_string
=
"
float64
"
if
dtype
==
'
double
'
else
"
float32
"
type_string
=
"
float64
"
if
dtype
==
'
double
'
else
"
float32
"
f
,
g
=
ps
.
fields
(
f
"
f, g :
{
type_string
}
[2D]
"
)
f
,
g
=
ps
.
fields
(
f
"
f, g :
{
type_string
}
[2D]
"
)
...
@@ -77,30 +78,22 @@ def test_strided(instruction_set, dtype):
...
@@ -77,30 +78,22 @@ def test_strided(instruction_set, dtype):
default_number_float
=
type_string
)
default_number_float
=
type_string
)
ast
=
ps
.
create_kernel
(
update_rule
,
config
=
config
)
ast
=
ps
.
create_kernel
(
update_rule
,
config
=
config
)
assert
len
(
warn
)
==
0
assert
len
(
warn
)
==
0
# ps.show_code(ast)
ps
.
show_code
(
ast
)
func
=
ast
.
compile
()
func
=
ast
.
compile
()
ref_config
=
pystencils
.
config
.
CreateKernelConfig
(
default_number_float
=
type_string
)
ref_func
=
ps
.
create_kernel
(
update_rule
).
compile
()
ref_func
=
ps
.
create_kernel
(
update_rule
,
config
=
ref_config
).
compile
()
# For some reason other array creations fail on the emulated ppc pipeline
arr
=
np
.
random
.
random
((
23
+
2
,
17
+
2
)).
astype
(
npdtype
)
size
=
(
25
,
19
)
# print("sum arr: ", np.sum(arr))
arr
=
np
.
zeros
(
size
).
astype
(
type_string
)
# print("arr type: ", arr.dtype)
for
i
in
range
(
size
[
0
]):
dst
=
np
.
zeros_like
(
arr
,
dtype
=
npdtype
)
for
j
in
range
(
size
[
1
]):
ref
=
np
.
zeros_like
(
arr
,
dtype
=
npdtype
)
arr
[
i
,
j
]
=
i
*
j
dst
=
np
.
zeros_like
(
arr
,
dtype
=
type_string
)
ref
=
np
.
zeros_like
(
arr
,
dtype
=
type_string
)
func
(
g
=
dst
,
f
=
arr
)
func
(
g
=
dst
,
f
=
arr
)
ref_func
(
g
=
ref
,
f
=
arr
)
ref_func
(
g
=
ref
,
f
=
arr
)
print
(
"
dst:
"
,
dst
)
# print("dst sum: ", np.sum(dst))
print
(
"
np array:
"
,
arr
)
# print("reference sum: ", np.sum(ref))
np
.
testing
.
assert_almost_equal
(
dst
,
ref
,
13
if
dtype
==
'
double
'
else
5
)
np
.
testing
.
assert_almost_equal
(
dst
[
1
:
-
1
,
1
:
-
1
],
ref
[
1
:
-
1
,
1
:
-
1
],
13
if
dtype
==
'
double
'
else
5
)
@pytest.mark.parametrize
(
'
dtype
'
,
(
'
float
'
,
'
double
'
))
@pytest.mark.parametrize
(
'
dtype
'
,
(
'
float
'
,
'
double
'
))
...
...
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