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
Sebastian Bindgen
pystencils
Commits
6aa28a4b
Commit
6aa28a4b
authored
Aug 09, 2020
by
Markus Holzer
Browse files
Added kerncraft test case
parent
b91c87b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils_tests/test_kerncraft_coupling.py
View file @
6aa28a4b
...
...
@@ -7,7 +7,7 @@ from kerncraft.kernel import KernelCode
from
kerncraft.machinemodel
import
MachineModel
from
kerncraft.models
import
ECM
,
ECMData
,
Benchmark
from
pystencils
import
Assignment
,
Field
from
pystencils
import
Assignment
,
Field
,
fields
from
pystencils.cpu
import
create_kernel
from
pystencils.kerncraft_coupling
import
KerncraftParameters
,
PyStencilsKerncraftKernel
from
pystencils.kerncraft_coupling.generate_benchmark
import
generate_benchmark
,
run_c_benchmark
...
...
@@ -159,3 +159,15 @@ def test_benchmark():
timeloop_time
=
timeloop
.
benchmark
(
number_of_time_steps_for_estimation
=
1
)
np
.
testing
.
assert_almost_equal
(
c_benchmark_run
,
timeloop_time
,
decimal
=
4
)
@
pytest
.
mark
.
kerncraft
def
test_kerncraft_generic_field
():
a
=
fields
(
'a: double[3D]'
)
b
=
fields
(
'b: double[3D]'
)
s
=
sp
.
Symbol
(
"s"
)
rhs
=
a
[
0
,
-
1
,
0
]
+
a
[
0
,
1
,
0
]
+
a
[
-
1
,
0
,
0
]
+
a
[
1
,
0
,
0
]
+
a
[
0
,
0
,
-
1
]
+
a
[
0
,
0
,
1
]
update_rule
=
Assignment
(
b
[
0
,
0
,
0
],
s
*
rhs
)
ast
=
create_kernel
([
update_rule
])
k
=
PyStencilsKerncraftKernel
(
ast
,
debug_print
=
True
)
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