Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
d159522a
Commit
d159522a
authored
Mar 09, 2020
by
Philipp Arras
Browse files
Improve performance check
parent
5bbbcca6
Pipeline
#70447
failed with stages
in 9 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/extra.py
View file @
d159522a
...
...
@@ -138,20 +138,27 @@ def _performance_check(op, pos, raise_on_fail):
@
property
def
count
(
self
):
return
self
.
_count
cop
=
CountingOp
(
op
.
domain
)
op
=
op
@
cop
lin
=
op
(
Linearization
.
make_var
(
pos
))
cond
=
[
cop
.
count
!=
1
]
lin
.
jac
(
pos
)
cond
.
append
(
cop
.
count
!=
2
)
lin
.
jac
.
adjoint
(
lin
.
val
)
cond
.
append
(
cop
.
count
!=
3
)
if
any
(
cond
):
s
=
'The operator has a performance problem.'
if
raise_on_fail
:
raise
RuntimeError
(
s
)
from
.logger
import
logger
logger
.
warn
(
s
)
for
wm
in
[
False
,
True
]:
cop
=
CountingOp
(
op
.
domain
)
op
=
op
@
cop
op
(
pos
)
cond
=
[
cop
.
count
!=
1
]
lin
=
op
(
Linearization
.
make_var
(
pos
,
wm
))
cond
.
append
(
cop
.
count
!=
2
)
lin
.
jac
(
pos
)
cond
.
append
(
cop
.
count
!=
3
)
lin
.
jac
.
adjoint
(
lin
.
val
)
cond
.
append
(
cop
.
count
!=
4
)
if
wm
and
op
.
target
is
DomainTuple
.
scalar_domain
():
lin
.
metric
(
pos
)
cond
.
append
(
cop
.
count
!=
6
)
if
any
(
cond
):
s
=
'The operator has a performance problem (want_metric={}).'
.
format
(
wm
)
from
.logger
import
logger
logger
.
error
(
s
)
logger
.
info
(
cond
)
if
raise_on_fail
:
raise
RuntimeError
(
s
)
def
consistency_check
(
op
,
domain_dtype
=
np
.
float64
,
target_dtype
=
np
.
float64
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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