Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frederik Hennig
pystencils
Commits
3b30bace
Commit
3b30bace
authored
Feb 17, 2022
by
Jan Hönig
Browse files
Fixed test_conditional
parent
1e3f406f
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils_tests/test_conditional_vec.py
View file @
3b30bace
...
...
@@ -93,16 +93,18 @@ def test_boolean_before_loop():
@
pytest
.
mark
.
parametrize
(
'instruction_set'
,
supported_instruction_sets
)
@
pytest
.
mark
.
parametrize
(
'dtype'
,
(
'float'
,
'
double
'
))
@
pytest
.
mark
.
parametrize
(
'dtype'
,
(
'float
32
'
,
'
float64
'
))
def
test_vec_maskstore
(
instruction_set
,
dtype
):
data_arr
=
np
.
zeros
((
16
,
16
),
dtype
=
np
.
float64
if
dtype
==
'
double
'
else
np
.
float32
)
data_arr
=
np
.
zeros
((
16
,
16
),
dtype
=
np
.
float64
if
dtype
==
'
float64
'
else
np
.
float32
)
data_arr
[
3
:
-
3
,
3
:
-
3
]
=
1.0
data
=
ps
.
fields
(
f
"data:
{
dtype
}
[2D]"
,
data
=
data_arr
)
c
=
[
Conditional
(
data
.
center
()
<
1.0
,
Block
([
SympyAssignment
(
data
.
center
(),
2.0
)]))]
assignmets
=
NodeCollection
(
c
)
ast
=
ps
.
create_kernel
(
assignmets
,
target
=
Target
.
CPU
,
cpu_vectorize_info
=
{
'instruction_set'
:
instruction_set
})
config
=
ps
.
CreateKernelConfig
(
cpu_vectorize_info
=
{
'instruction_set'
:
instruction_set
},
default_number_float
=
dtype
)
ast
=
ps
.
create_kernel
(
assignmets
,
config
=
config
)
print
(
ps
.
get_code_str
(
ast
))
kernel
=
ast
.
compile
()
kernel
(
data
=
data_arr
)
np
.
testing
.
assert_equal
(
data_arr
[:
3
,
:],
2.0
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment