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

## PARDISO optimization?

Beginner
447 Views

Here goes,

Relevant information (I hope):

• Using Pardiso to solve linear set of equations Ax = b
• matrix A can be extremely large & sparse, nonsymmetric, and is also put into csr format using mkl routine

Below is the section of code where I call Pardiso, it works great everything is fine. I was really hoping someone could look at my set up and let me know if there is something I can do to make it even faster, or if it is as fast as it's going to get.

I also use mkl_set_num_threads(n) above the code to make use of multiple cores according to the desired n.

CODE

//    Call pardiso solver
MKL_INT pt[64], iparm[64];
for(i = 0; i < 64; i++) {
pt = 0;
iparm = 0;
}
MKL_INT *perm;
perm = (MKL_INT*)mkl_malloc(m*sizeof(MKL_INT),16);
if (perm == NULL)
{
cout << ">>> error allocating perm" << endl;
return (0);
}

MKL_INT maxfct, mnum, mtype, phase, nrhs, msglvl, error;
maxfct = 1;
mnum = 1;
mtype = 11;
nrhs = 1;
msglvl = 1;
iparm[0] = 1;
iparm[1] = 3;
iparm[26] = 1;
iparm[34] = 1;
iparm[60] = 0;
error = 0;

//    Pardiso Direct Solver
phase = 13;
pardiso (pt, &maxfct, &mnum, &mtype, &phase, &n, acsr, ia, ja, perm, &nrhs, iparm, &msglvl, b, solution, &error);

if (error != 0) {
cout << "ERROR during symbolic factorization: " << error << endl;
}

Again all I am really seeking is whether or not my call could be any better, or if this is optimal. Let me know if there is any additional information needed, and I will be checking my email frequently today to respond quickly.

Sincerely, Jared

9 Replies
Employee
447 Views

Hi Jared,

What kind of optimal you need to have? If you want to achieve better performance it is recommended to switch off matrix checker (iparm[26])

Thanks,

Alex

Beginner
447 Views

Alex,

Thanks for the quick response. I just want to make sure it solves the matrix A the fastest possible. I probably should have mentioned one thing I thought was interesting was it seems that the specification of mkl_set_num_threads(n) isn't affecting how quickly pardiso solves. Does this seem reasonable based on the set up I described?

Employee
447 Views

Hi,

Could you provide information of value of n and provide output of pardiso if you set msglvl to 1?

Thanks,

Alex

Beginner
447 Views

I have attached two cases, n = 2 and n = 8.

Employee
447 Views

HI,

`< Parallel Direct Factorization with #processors: >`

is different.

Secondary - as i see factorization time decrease when number of threads increased that expected. In any case you matrix is quite small that's why not all part of PARDISO decrease significantly after using additional threads. Also, what version of MKL do you use?

Thanks,

Alex

Beginner
447 Views

Ok, so that makes sense for the factorization time to decrease since I changed the #processors from 2 to 8. So just so I have a scale on things, the 30K X 30K matrix is small relatively?

Employee
447 Views

You are correct. But i have a question - if you are worried about part of seconds time than you call pardiso several time - am I correct? May I ask you about model of using PARDISO in your code to help you modify model of using that could help in reducing overall time.

Thanks,

Alex

Beginner
447 Views

Alex,

You're right, I am calling it several times. It is the solver in my finite element code for viscous, incompressible fluid flow. At my current largest mesh (30k degrees of freedom), it is actually solving quite fast at approximately 0.8 s, but this entire process iterates over and over until convergence. I have been looking at other parts of my code and it seems other spots are adding up to the majority of the time. One in particular though is the ddnscsr routine. It is taking approximately 2 seconds to convert sparse format to csr, does this seem right to you?

Employee
447 Views

HI,

I can't recommend using converters on each step in such algorithm. It can significantly improve performance if you will calculate elements of matrix in csr format, but not in dense and convert it. Actually, your matrix structure didn't change, is it true?

Thanks,

Alex