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

pardiso error with segmentation fault

NEROKAI
Beginner
612 Views

I tried to encapsulate PARDISO with a simple wrapper, why doesn't this kind of encapsulation work? Not only in C++, but also in C language, errors occur when using `pt` across functions. This is the minimal unit for reproducing the error. Thank you.

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
552 Views

I hardcoded your code by allocating the solution array and solution has been passed:


void NumericalAlgebra::solve(double* b, double* result)

{

  MKL_INT phase=33;

 double* x = (double*)mkl_malloc(N*sizeof(double), 64);

  pardiso(m_pt,&m_maxfct,&m_mnum,&m_type,&phase,&N,values, rowindex,colindex,&idum,&nrhs,m_iparm,&m_msglvl, b, /*result*/ x, &m_error);

  if( m_error != 0 ) {

    printf("... Failure. Pardiso Fails at the Solution ( phase == 33 ) stage. m_error == %lld \n", m_error );

  } else {     

    printf("... Passed - Pardiso at the Solution ( phase == 12) stage \n");

  }

}


here is the log output:

....

       number of non-zeros in U:        1

       number of non-zeros in L+U:       6

       gflop  for the numerical factorization: 0.000000


       gflop/s for the numerical factorization: 0.000027


... Passed - Pardiso at the Solution ( phase == 12) stage






View solution in original post

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
577 Views

how do you allocate solution array ( which is double *result into your code)?


0 Kudos
Gennady_F_Intel
Moderator
553 Views

I hardcoded your code by allocating the solution array and solution has been passed:


void NumericalAlgebra::solve(double* b, double* result)

{

  MKL_INT phase=33;

 double* x = (double*)mkl_malloc(N*sizeof(double), 64);

  pardiso(m_pt,&m_maxfct,&m_mnum,&m_type,&phase,&N,values, rowindex,colindex,&idum,&nrhs,m_iparm,&m_msglvl, b, /*result*/ x, &m_error);

  if( m_error != 0 ) {

    printf("... Failure. Pardiso Fails at the Solution ( phase == 33 ) stage. m_error == %lld \n", m_error );

  } else {     

    printf("... Passed - Pardiso at the Solution ( phase == 12) stage \n");

  }

}


here is the log output:

....

       number of non-zeros in U:        1

       number of non-zeros in L+U:       6

       gflop  for the numerical factorization: 0.000000


       gflop/s for the numerical factorization: 0.000027


... Passed - Pardiso at the Solution ( phase == 12) stage






0 Kudos
NEROKAI
Beginner
507 Views

Thank you very much. I made a very stupid mistake. I thought pardiso could allocate memory automatically. Thank you!

0 Kudos
Reply