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

How to do factorizations of two or more linear equation using Pardiso or save their factorization

Thomas_R_
Beginner
337 Views
Hi All;

Recently, Iwant todo factorizations oftwo(or more ) linear equationswith the different dimensions using Pardiso solver,firstly. Then to solve the equations for the given RHS terms using Pardiso solver.
I do not know how to archive this implementation.

Or after doing factorization of linear equation, I can save the information of factorization on hard disk and release the memory if pardiso solver. When necessary, I can redefine the paramters of pardiso solver, read the information of factorization from hard disk and solve the linear equation for the given RHS term.

Do any one can provideany suggestion?

Thanks
Thomas





0 Kudos
5 Replies
Sergey_K_Intel1
Employee
337 Views

Dear Tomas

Matrices with different sparsity structures or different dimensions can be kept in RAM by using different memory address pointers PT which is the first argument in PARDISO calling sequence. So you just need to allocateseveral memory address pointerswith 64 entries.One 64-bit integer array with with 64 entries is for one matrix.

You don't need to allocate additional memory address pointers ifyou need to solvesystems with identical nonzero sparsity structure. PARDISO has two parameters named MAXFCT and MNUM (second and third parameters in the calling sequence) which allows PARDISO tostore several different factorizations with the same nonzero structure at the same time in memory. MAXFCT is input argument and it ismaximal number of factors that the user would like to keepat the same time in memory. MNUM is the actual matrix for the solution phase.

The same rulesshould work for out-of-core.

All the best
Sergey
0 Kudos
Thomas_R_
Beginner
337 Views

Dear Tomas

Matrices with different sparsity structures or different dimensions can be kept in RAM by using different memory address pointers PT which is the first argument in PARDISO calling sequence. So you just need to allocateseveral memory address pointerswith 64 entries.One 64-bit integer array with with 64 entries is for one matrix.

You don't need to allocate additional memory address pointers ifyou need to solvesystems with identical nonzero sparsity structure. PARDISO has two parameters named MAXFCT and MNUM (second and third parameters in the calling sequence) which allows PARDISO tostore several different factorizations with the same nonzero structure at the same time in memory. MAXFCT is input argument and it ismaximal number of factors that the user would like to keepat the same time in memory. MNUM is the actual matrix for the solution phase.

The same rulesshould work for out-of-core.

All the best
Sergey

Dear Dr. Sergey Kunzetsov:

Thank you very much for your comments.
According to your suggestion, I can do factorizations for several sparse matrices in one subroutine andsolve their equations in another subroutine. However, these data : ptp,np ap,iap,jap iparamp for each sparse matrix must be passed to the calling pardiso routine.

Sincerely yours

Chaowei
0 Kudos
Sergey_K_Intel1
Employee
337 Views


Starting from MKL 10.1 Gold, MKLPARDISO ignores iparm(3) (the number of processors) and the number of threads is controlled by OMP_NUM_THREADS or MKL_NUM_THREADS environment variable.
Because of this I'd assume that you can use one iparamp for all matrices. Sometimes iparm(1)=0 (use default PARDISOparameter settings) might be enough.

If you don't use iterative refinement (iparm(8)=0), you don't need the sparse matrix representation ap, iap, jap for solver phase(phase=33). In this case, memory occupied by the spare matrix representations can be freed just after factorization. So you canaccumulate all factorizations first, then you can solveyour systems. So for the solver step and your applications canwork without iterative refinement, we can keep onlythe internal dataaddresspointers ptp for the solver step.

All the best
Sergey
0 Kudos
Thomas_R_
Beginner
337 Views


Starting from MKL 10.1 Gold, MKLPARDISO ignores iparm(3) (the number of processors) and the number of threads is controlled by OMP_NUM_THREADS or MKL_NUM_THREADS environment variable.
Because of this I'd assume that you can use one iparamp for all matrices. Sometimes iparm(1)=0 (use default PARDISOparameter settings) might be enough.

If you don't use iterative refinement (iparm(8)=0), you don't need the sparse matrix representation ap, iap, jap for solver phase(phase=33). In this case, memory occupied by the spare matrix representations can be freed just after factorization. So you canaccumulate all factorizations first, then you can solveyour systems. So for the solver step and your applications canwork without iterative refinement, we can keep onlythe internal dataaddresspointers ptp for the solver step.

All the best
Sergey

Dear Dr. Sergey Kuznetsov:
I tested your suggestion. It's work for in-core case (iparm(60) = 0). But for the out-of-core case (iparm(60)=2), your suggestion and my method will not be work.

Sincerely
Chaowei
0 Kudos
Sergey_K_Intel1
Employee
337 Views

Dear Dr. Sergey Kuznetsov:
I tested your suggestion. It's work for in-core case (iparm(60) = 0). But for the out-of-core case (iparm(60)=2), your suggestion and my method will not be work.

Sincerely
Chaowei

Dear Chaowei,

Out-of-core PARDISO uses the following environment variables for ooc files

MKL_PARDISO_OOC_PATH = ooc_file

MKL_PARDISO_OOC_KEEP_FILE = 0

where ooc_file is file name without extension.These parameters can be modified from C program by calling setenv routine for example. Different names forsparse matricesshould allow you to work with several factorizations. If this way doesn't work, please submit an issue through http://premier.intel.com.

All the best
Sergey
0 Kudos
Reply