When sovling a set of linear equations, a typical example program calls pardiso four times,
with parameter phase = 11, 22, 33, and -1.
If i want to solve n of linear systems, each with the same structure, i will call pardiso 4n times.
Is there any simpler way that i just initialize once, do all the calculations and realease once to
make less than 4n calls?
I guess calls with phase = 11, (22, 33, 0), (22, 33, 0), ... , 22,33,-1 will work, but i'm not sure.
If your equations are well behaved and you want only the solution, you can make a single call with phase = 13 for each system of linear equations, followed by a final call with -1.
If you believe that a single symbolic factorization will apply to all the systems, instead, you could make a single call with phase = 11, followed by several calls, each with phase = 23 for a new system of equations, and a final call with -1.
That said, why are you so concerned about the number of calls? The time consumed by subroutine calls will be minor compared to the cost of doing the actual computations, unless your systems are small in size.
I'm not sure whether i could omit some step when doing thousands of calls. As you say, 13s followed by -1 may suit for me.
By "a final call with -1", do you mean that no matter how many calls of solving busroutines, there is only one realease step needed ?
A definite answer regarding MKL internals has to come from Intel personnel. However, I think that if you make repeated calls with matrices whose size and structure does not change (but element values do), Pardiso would need the same amount of work-space, so what I suggested should work. You may need to experiment with the idea.
It may be the maxfct praram that control the memory. For maxfct = 1, it just allocate once as long as the same matrix sparsity pattern. Whatever, neither its memery cost increase with time nor my memory was exhausted.
Gennady Fedorov (Intel) wrote:
fyi - for the case if your input matrices have the similar sparsity - please have a look at the MKL's examples - pardiso_sym_diag_pivot_c.c.
It seems impossible to to save all the similar matrices at the same time for me. It consumes too much for thoudsands of large matrices. I think i must set maxfct as 1, and i wonder whether i need only one phase = -1 step after lots of phase=13 or there must be a phase = -1 after each phase = 13. Moreover, if for matrices with the same sparsity, will only one phase=11, followed by many phase=23 work?
I tested 10^9 calls in a prom in which the size of sparse matrices is the same as given in the installation directory of mkl and recorded the time consuming for three plan on my PC:
1): phase = 11, 23, 23, 23, ..., 23, -1, it spent 5449s;
2): phase = 13, 13, ... , 13, -1, it spend 16989s;
3): phase = 13, -1, 13, -1, ... , it spend 15134s.
All the proms run at parameter maxfct = 1. Plan 2 consumes even more may be caused by other processes which occupies some of my CPU. Whatever, call of phase = -1 costs little, but phase = 11 cost much. When all the matrices have the same sparsity pattern, all the plans give the same results with at least 10 significant figures. No evidence showed too much (10^9 times) allocation of memory according to command top, ps, free and i can use my computer as usual while running these proms.