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
17cbbf64
Commit
17cbbf64
authored
Aug 27, 2018
by
Philipp Arras
Browse files
Add error for too many tasks
parent
02eb292a
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/minimization/kl_energy.py
View file @
17cbbf64
...
@@ -54,6 +54,12 @@ class KL_Energy(Energy):
...
@@ -54,6 +54,12 @@ class KL_Energy(Energy):
self
.
_nsamp
=
nsamp
self
.
_nsamp
=
nsamp
self
.
_constants
=
constants
self
.
_constants
=
constants
self
.
_want_metric
=
want_metric
self
.
_want_metric
=
want_metric
if
nsamp
<
ntask
:
# FIXME We need a better solution here. It is probably not good if
# the script just dies. Can we proceed anyways?
print
(
'Number of samples: {}, number of MPI tasks: {}'
.
format
(
nsamp
,
ntask
))
raise
RuntimeError
(
'Cannot use more tasks than samples.'
)
if
_samples
is
None
:
if
_samples
is
None
:
lo
,
hi
=
_shareRange
(
nsamp
,
ntask
,
rank
)
lo
,
hi
=
_shareRange
(
nsamp
,
ntask
,
rank
)
met
=
h
(
Linearization
.
make_var
(
position
,
True
)).
metric
met
=
h
(
Linearization
.
make_var
(
position
,
True
)).
metric
...
...
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