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
a7c86f83
Commit
a7c86f83
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Benchmark for phase field kernels
parent
9abd0e4a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backends/cbackend.py
+6
-2
6 additions, 2 deletions
backends/cbackend.py
datahandling/datahandling_interface.py
+3
-3
3 additions, 3 deletions
datahandling/datahandling_interface.py
with
9 additions
and
5 deletions
backends/cbackend.py
+
6
−
2
View file @
a7c86f83
...
...
@@ -333,7 +333,7 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter):
if
self
.
instruction_set
[
'
rsqrt
'
]:
return
self
.
instruction_set
[
'
rsqrt
'
].
format
(
self
.
_print
(
expr
.
args
[
0
]))
else
:
return
"
({})
"
.
format
(
self
.
_
print
(
1
/
sp
.
sqrt
(
expr
.
args
[
0
])))
return
"
({})
"
.
format
(
self
.
do
print
(
1
/
sp
.
sqrt
(
expr
.
args
[
0
])))
return
super
(
VectorizedCustomSympyPrinter
,
self
).
_print_Function
(
expr
)
def
_print_And
(
self
,
expr
):
...
...
@@ -391,6 +391,8 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter):
if
result
:
return
result
one
=
self
.
instruction_set
[
'
makeVec
'
].
format
(
1.0
)
if
expr
.
exp
.
is_integer
and
expr
.
exp
.
is_number
and
0
<
expr
.
exp
<
8
:
return
"
(
"
+
self
.
_print
(
sp
.
Mul
(
*
[
expr
.
base
]
*
expr
.
exp
,
evaluate
=
False
))
+
"
)
"
elif
expr
.
exp
==
-
1
:
...
...
@@ -398,8 +400,10 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter):
return
self
.
instruction_set
[
'
/
'
].
format
(
one
,
self
.
_print
(
expr
.
base
))
elif
expr
.
exp
==
0.5
:
return
self
.
instruction_set
[
'
sqrt
'
].
format
(
self
.
_print
(
expr
.
base
))
elif
expr
.
exp
==
-
0.5
:
root
=
self
.
instruction_set
[
'
sqrt
'
].
format
(
self
.
_print
(
expr
.
base
))
return
self
.
instruction_set
[
'
/
'
].
format
(
one
,
root
)
elif
expr
.
exp
.
is_integer
and
expr
.
exp
.
is_number
and
-
8
<
expr
.
exp
<
0
:
one
=
self
.
instruction_set
[
'
makeVec
'
].
format
(
1.0
)
return
self
.
instruction_set
[
'
/
'
].
format
(
one
,
self
.
_print
(
sp
.
Mul
(
*
[
expr
.
base
]
*
(
-
expr
.
exp
),
evaluate
=
False
)))
else
:
...
...
This diff is collapsed.
Click to expand it.
datahandling/datahandling_interface.py
+
3
−
3
View file @
a7c86f83
import
numpy
as
np
from
abc
import
ABC
,
abstractmethod
from
typing
import
Optional
,
Callable
,
Sequence
,
Iterable
,
Tuple
,
Dict
from
typing
import
Optional
,
Callable
,
Sequence
,
Iterable
,
Tuple
,
Dict
,
Union
from
pystencils.field
import
Field
...
...
@@ -32,7 +32,7 @@ class DataHandling(ABC):
"""
Returns tuple of booleans for x,y,(z) directions with True if domain is periodic in that direction.
"""
@abstractmethod
def
add_array
(
self
,
name
:
str
,
values_per_cell
:
int
=
1
,
dtype
=
np
.
float64
,
def
add_array
(
self
,
name
:
str
,
values_per_cell
,
dtype
=
np
.
float64
,
latex_name
:
Optional
[
str
]
=
None
,
ghost_layers
:
Optional
[
int
]
=
None
,
layout
:
Optional
[
str
]
=
None
,
cpu
:
bool
=
True
,
gpu
:
Optional
[
bool
]
=
None
,
alignment
=
False
)
->
Field
:
"""
Adds a (possibly distributed) array to the handling that can be accessed using the given name.
...
...
@@ -239,7 +239,7 @@ class DataHandling(ABC):
# ------------------------------- Data access and modification -----------------------------------------------------
def
fill
(
self
,
array_name
:
str
,
val
,
value_idx
:
Optional
[
Tuple
[
int
,
...]]
=
None
,
def
fill
(
self
,
array_name
:
str
,
val
,
value_idx
:
Optional
[
Union
[
int
,
Tuple
[
int
,
...]]
]
=
None
,
slice_obj
=
None
,
ghost_layers
=
False
,
inner_ghost_layers
=
False
)
->
None
:
"""
Sets all cells to the same value.
...
...
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