#31 Solver Threads

Open jcapriot
Coverage Reach
solvers.py wrappers.py direct.py iterative.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 2 of 8 files from the diff.

@@ -85,6 +85,10 @@
Loading
85 85
    def clean(self):
86 86
        pass
87 87
88 +
    def __del__(self):
89 +
        """Destruct to call clean when object is garbage collected."""
90 +
        self.clean()
91 +
88 92
    def __mul__(self, val):
89 93
        if type(val) is np.ndarray:
90 94
            return self._solve(val)

@@ -6,6 +6,27 @@
Loading
6 6
from pymatsolver.solvers import Base
7 7
from pyMKL import pardisoSolver as _pardisoSolver
8 8
9 +
from pyMKL import mkl_set_num_threads, mkl_get_max_threads
10 +
11 +
import os
12 +
_omp_threads = os.environ.get('OMP_NUM_THREADS')
13 +
if _omp_threads is not None:
14 +
    _max_threads = _omp_threads
15 +
else:
16 +
    _max_threads = mkl_get_max_threads()
17 +
18 +
19 +
def _set_threads(n_threads):
20 +
    global _n_threads
21 +
    try:
22 +
        mkl_set_num_threads(n_threads)
23 +
    except TypeError:
24 +
        raise TypeError('n_threads must be an Integer')
25 +
    _n_threads = n_threads
26 +
27 +
28 +
_set_threads(_max_threads)
29 +
9 30
10 31
class Pardiso(Base):
11 32
    """
@@ -87,6 +108,18 @@
Loading
87 108
        sol = self.solver.solve(rhs)
88 109
        return sol
89 110
111 +
    @property
112 +
    def n_threads(self):
113 +
        """
114 +
        Number of threads to use for the Pardiso solver routine. This property
115 +
        is global to all Pardiso solver objects for a single python process.
116 +
        """
117 +
        return _n_threads
118 +
119 +
    @n_threads.setter
120 +
    def n_threads(self, n_threads):
121 +
        _set_threads(n_threads)
122 +
90 123
    _solve1 = _solveM
91 124
92 125
    def clean(self):

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
pymatsolver 0.03% 91.58%
Project Totals (4 files) 91.58%
Loading