Commit 17cbbf64 authored by Philipp Arras's avatar Philipp Arras
Browse files

Add error for too many tasks

parent 02eb292a
...@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment