Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7056 Discussions

## Simultaneous handling of a set of coefficient arrays for pardiso (maxfct and mnum arguments)

New Contributor I
1,299 Views

Hello, I have a code which establishes four different systems of equations which must be solved.

Each of the systems has its own coefficient array, RHS vector etc.

The first 3 arrays are real and symmetric (mtype = -2), while the 4th array is non-symmetric real (mtype = 11).

I want to solve these 4 systems, and simultaneously keep the factorization of all 4 arrays to memory. I had the following two questions:

1) What values should I give to parameters maxfct and mnum in my calls to pardiso? Should I have these parameters equal to 1 for all calls? Or should I somehow notify pardiso that there are multiple arrays to be factorized and kept in memory?

2) When I want to clear the memory reserved for ONE of the arrays, can I simply call pardiso with phase = -1? Or could this also clear the memory reserved for all other arrays?

Many thanks in advance for any help.

1 Solution
Moderator
1,075 Views

Hi Ioannis,

For maxfct or mnum, they are determined by the “sparsity structure”- If the sparsity structure of the original matrix doesn’t change, the sparsity structure of the factors also don’t change.

>>Are the above correct?

Yes. To call pardiso for A, B or C, you should use mtype = -2, maxfct = 3, and mnum = 1 for A , mnum = 2 for B, mnum = 3 for C and to call pardiso for D or E, you should use mtype = 11, maxfct = 2, and mnum = 1 for D, mnum = 2 for E.

Please get back to us in case you face any errors.

Best Regards,

Shanmukh.SS

8 Replies
Moderator
1,208 Views

Hi Ioannis,

Thanks for posting in Intel communities.

>>What values should I give to parameters maxfct and mnum

maxfct: Maximum number of factors with identical sparsity structure that must be kept in memory at the same time. In most applications this value is equal to 1. It is possible to store several different factorizations with the same nonzero structure at the same time in the internal data structure management of the solver.  pardiso can process several matrices with an identical matrix sparsity pattern and it can store the factors of these matrices at the same time. Matrices with a different sparsity structure can be kept in memory with different memory address pointers pt.

mnumIndicates the actual matrix for the solution phase. With this scalar you can define which matrix to factorize. The value must be: 1 mnummaxfct.

In most applications this value is 1.

As you are trying to solve four different matrices, please try setting maxfct to 4 and call Pardiso four times with a different mnum value (ranging from 1 to 4) each time.

>>can I simply call pardiso with phase = -1

phase = -1 Releases all internal memory for all matrices.

phase = 0  Release internal memory for L and U of the matrix number mnum.

Please get back to us if you have any more problems.

Best Regards,

Shanmukh.SS

New Contributor I
1,199 Views

Thank you Shanmukh.

So, it does not matter that one of the four arrays has a different mtype than the other three? As I mentioned in my message above, 3 out of 4 arrays have mtype = -2, and the fourth one has mtype = 11.

I am asking because the documentation for pardiso says that maxfct is the "maximum number of factors with identical sparsity structure that must be kept in memory at the same time".  I believe that the "sparsity structure" is given by mtype.

Again, many thanks for your help.

Moderator
1,141 Views

Hi Ioannis,

So, it does not matter that one of the four arrays has a different mtype than the other three?

>> pardiso can process several matrices with an identical matrix sparsity pattern and it can store the factors of these matrices at the same time. Matrices with a different sparsity structure can be kept in memory with different memory address pointers pt.

You could use the below reference for the description of pardiso parameters.

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-1/onemkl-pardiso-parameters-in-tabular-form.html

Best Regards,

Shanmukh.SS

New Contributor I
1,134 Views

Hi Shanmukh,

Thank you for your reply. I wanted to make sure that I understand what you mean (and yes, I have already read the pertinent Intel documentation pages - thanks for sharing these).

Let us say that I have 5 arrays A, B, C, D and E. I want to call pardiso for each one of them. The type of matrices A, B and C is -2 (mtype = -2), while the type of matrices D and E is 11 (mtype = 11).

If I call pardiso for A, B or C, I should use mtype = -2, maxfct = 3, and mnum = 1 for A , mnum = 2 for B, mnum = 3 for C.

If I can pardiso for D or E, I should use mtype = 11, maxfct = 2, and mnum = 1 for D, mnum = 2 for E.

Are the above correct?

Again, thank you for your help.

Moderator
1,076 Views

Hi Ioannis,

For maxfct or mnum, they are determined by the “sparsity structure”- If the sparsity structure of the original matrix doesn’t change, the sparsity structure of the factors also don’t change.

>>Are the above correct?

Yes. To call pardiso for A, B or C, you should use mtype = -2, maxfct = 3, and mnum = 1 for A , mnum = 2 for B, mnum = 3 for C and to call pardiso for D or E, you should use mtype = 11, maxfct = 2, and mnum = 1 for D, mnum = 2 for E.

Please get back to us in case you face any errors.

Best Regards,

Shanmukh.SS

Moderator
1,026 Views

Hi Ioannis,

A gentle reminder:

Has the information provided helped?

Best Regards,

Shanmukh.SS

New Contributor I
1,013 Views

Hi Shanmukh,

Yes, this is exactly the information I needed.

Thank you very much.

Moderator
1,000 Views

Hi Ioannis,

It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.

Best Regards,

Shanmukh.SS