Skip to content

Commit

Permalink
pardiso experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
gertjanvanzwieten committed Sep 26, 2024
1 parent e50e391 commit 00e810a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,8 @@ jobs:
strategy:
matrix:
include:
- {name: "baseline", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "windows", os: windows-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "macos", os: macos-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.8", os: ubuntu-latest, python-version: "3.8", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.9", os: ubuntu-latest, python-version: "3.9", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.10", os: ubuntu-latest, python-version: "3.10", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.11", os: ubuntu-latest, python-version: "3.11", matrix-backend: numpy, nprocs: 1}
- {name: "scipy matrix", os: ubuntu-latest, python-version: "3.12", matrix-backend: scipy, nprocs: 1}
- {name: "mkl linux", os: ubuntu-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 1}
- {name: "mkl linux parallel", os: ubuntu-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 2}
- {name: "mkl windows", os: windows-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 1}
- {name: "parallel", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 2}
- {name: "numpy 1.17", os: ubuntu-latest, python-version: "3.8", matrix-backend: numpy, nprocs: 1, numpy-version: ==1.17.3}
- {name: "tensorial", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1, tensorial: test}
fail-fast: false
env:
_wheel: ${{ needs.build-python-package.outputs.wheel }}
Expand Down
13 changes: 12 additions & 1 deletion nutils/matrix/_mkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ class Pardiso:
-12: 'pardiso_64 called from 32-bit library',
}

_cgs_errorcodes = {
1: 'fluctuations of the residuum are too large',
2: 'convergence is too slow',
3: 'stopping criterion is not reached at maximum iterations',
4: 'perturbed pivots caused iterative refinement',
5: 'factorization is too fast for this matrix',
}

def __init__(self, mtype, a, ia, ja, verbose=False, iparm={}):
self.dtype = a.dtype
self.pt = numpy.zeros(64, numpy.int64) # handle to data structure
Expand Down Expand Up @@ -90,7 +98,10 @@ def _phase(self, phase, nrhs=0, b=None, x=None):
byref(c_int(phase)), byref(self.n), self.a, self.ia, self.ja, self.perm,
byref(c_int(nrhs)), self.iparm.ctypes, byref(self.msglvl), b, x, byref(error))
if error.value:
raise MatrixError(self._errorcodes.get(error.value, 'unknown error {}'.format(error.value)))
msg = self._errorcodes.get(error.value, 'unknown error {}'.format(error.value))
if error.value == -4 and self.iparm[19] < 0:
msg += ': ' + self._cgs_errorcodes.get(-self.iparm[19] % 10, 'unknown reason')
raise MatrixError(msg)

def __del__(self):
self._phase(-1) # release all internal memory for all matrices
Expand Down

0 comments on commit 00e810a

Please # to comment.