Skip to content

Commit

Permalink
workaround an improvement in mumps memory prediction algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbybp committed Jan 30, 2024
1 parent a02be9d commit 0f36c3f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions pyomo/contrib/interior_point/linalg/tests/test_realloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def test_reallocate_memory_mumps(self):

predicted = linear_solver.get_infog(16)

# We predict that factorization will take 2 MB
self.assertEqual(predicted, 2)

# Explicitly set maximum memory to less than the predicted
# requirement.
linear_solver.set_icntl(23, 1)

res = linear_solver.do_numeric_factorization(matrix, raise_on_error=False)
self.assertEqual(res.status, LinearSolverStatus.not_enough_memory)

Expand Down
12 changes: 10 additions & 2 deletions pyomo/contrib/interior_point/tests/test_realloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,19 @@ def test_mumps(self):
predicted = linear_solver.get_infog(16)

self._test_ip_with_reallocation(linear_solver, interface)
# In Mumps 5.6.2 (and likely previous versions), ICNTL(23)=0
# corresponds to "use default increase factor over prediction".
actual = linear_solver.get_icntl(23)
percent_increase = linear_solver.get_icntl(14)
increase_factor = (1.0 + percent_increase/100.0)

self.assertTrue(predicted == 12 or predicted == 11)
if actual == 0:
actual = increase_factor * predicted

# As of Mumps 5.6.2, predicted == 9, which is lower than the
# default actual of 10.8
#self.assertTrue(predicted == 12 or predicted == 11)
self.assertTrue(actual > predicted)
# self.assertEqual(actual, 14)
# NOTE: This test will break if Mumps (or your Mumps version)
# gets more conservative at estimating memory requirement,
# or if the numeric factorization gets more efficient.
Expand Down
5 changes: 4 additions & 1 deletion pyomo/contrib/pynumero/linalg/mumps_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ def do_numeric_factorization(
res.status = LinearSolverStatus.successful
elif stat in {-6, -10}:
res.status = LinearSolverStatus.singular
elif stat in {-8, -9}:
elif stat in {-8, -9, -19}:
# -8: Integer workspace too small for factorization
# -9: Real workspace too small for factorization
# -19: Maximum size of working memory is too small
res.status = LinearSolverStatus.not_enough_memory
elif stat < 0:
res.status = LinearSolverStatus.error
Expand Down

0 comments on commit 0f36c3f

Please sign in to comment.