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

How to link the solver PARDISO

caoyuxin541
Beginner
378 Views

Hello everyoneThis is my problemI need a help

I want to use Pardisobut there is a error"fatal error LNK1000: unknown error; consult documentation for technical support options"

compilerVC6++

I specified the paths to mkl_core.lib mkl_solver_sequential.lib mkl_lapack.lib mkl_c.lib mkl_solver.lib mkl_c_dll.lib mkl_cdft.lib mkl_intel_c.lib mkl_intel_thread.lib , but it doesn't work =(. What's wrong? May be MKL is not compatible with CVF6.6c I'm using?

This is my code

#include
#include
#include
#include "mkl_pardiso.h"
#include "mkl.h"
#include "mkl_lapack.h"
#include "mkl_scalapack.h"
extern int omp_get_max_threads();
extern int PARDISO
(void *, int *, int *, int *, int *, int *,
double *, int *, int *, int*, int *, int *,
int *, double *, double *, int*);
main( )
{
int n = 8;
int ia[ 9] = { 1, 5, 8, 10, 12, 15, 17, 18, 19 };
int ja[18] = { 1, 3, 6, 7,
2, 3, 5,
3, 8,
4, 7,
5, 6, 7,
6, 8,
7,
8 };
double a[18] = { 7.0, 1.0, 2.0, 7.0,
-4.0, 8.0, 2.0,
1.0, 5.0,
7.0, 9.0,
5.0, 1.0, 5.0,
-1.0, 5.0,
11.0,
5.0 };
int mtype = -2;
double b[8], x[8];
int nrhs = 1;
void *pt[64];
int iparm[64];
int maxfct, mnum, phase, error, msglvl;
int i;
double ddum; /* Double dummy*/
int idum; /* Integer dummy.*/
/* --------------------------------------------------------------------*/
/* .. Setup Pardiso control parameters.*/
/* --------------------------------------------------------------------*/
for (i = 0; i < 64; i++) {
iparm = 0;
}
iparm[0] = 1; /* No solver default*/
iparm[1] = 2; /* Fill-in reordering from METIS */
/* Numbers of processors, value of MKL_NUM_THREADS */
iparm[2] = 2;
/*mkl_get_max_threads()*/
iparm[3] = 0; /* No iterative-direct algorithm */
iparm[4] = 0; /* No user fill-in reducing permutation */
iparm[5] = 0; /* Write solution into x */
iparm[6] = 16; /* Default logical fortran unit number for output */
iparm[7] = 2; /* Max numbers of iterative refinement steps */
iparm[8] = 0; /* Not in use*/
iparm[9] = 13; /* Perturb the pivot elements with 1E-13 */
iparm[10] = 1; /* Use nonsymmetric permutation and scaling MPS */
iparm[11] = 0; /* Not in use*/
iparm[12] = 0; /* Not in use*/
iparm[13] = 0; /* Output: Number of perturbed pivots */
iparm[14] = 0; /* Not in use*/
iparm[15] = 0; /* Not in use*/
iparm[16] = 0; /* Not in use*/
iparm[17] = -1; /* Output: Number of nonzeros in the factor LU */
iparm[18] = -1; /* Output: Mflops for LU factorization */
iparm[19] = 0; /* Output: Numbers of CG Iterations */
maxfct = 1; /* Maximum number of numerical factorizations. */
mnum = 1; /* Which factorization to use. */
msglvl = 0; /* Don't print statistical information in file */
error = 0; /* Initialize error flag */
/* --------------------------------------------------------------------*/
/* .. Initialize the internal solver memory pointer. This is only */
/* necessary for the FIRST call of the PARDISO solver. */
/* --------------------------------------------------------------------*/
for (i = 0; i < 64; i++) {
pt = 0;
}
/* --------------------------------------------------------------------*/
/* .. Reordering and Symbolic Factorization. This step also allocates */
/* all memory that is necessary for the factorization. */
/* --------------------------------------------------------------------*/
phase = 11;
PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs,
iparm, &msglvl, &ddum, &ddum, &error);
if (error != 0) {
printf("\\nERROR during symbolic factorization: %d", error);
exit(1);
}
printf("\\nReordering completed ... ");
printf("\\nNumber of nonzeros in factors = %d", iparm[17]);
printf("\\nNumber of factorization MFLOPS = %d", iparm[18]);
/* --------------------------------------------------------------------*/
/* .. Numerical factorization.*/
/* --------------------------------------------------------------------*/
phase = 22;
PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs,
iparm, &msglvl, &ddum, &ddum, &error);
if (error != 0) {
printf("\\nERROR during numerical factorization: %d", error);
exit(2);
}
printf("\\nFactorization completed ... ");
/* --------------------------------------------------------------------*/
/* .. Back substitution and iterative refinement. */
/* --------------------------------------------------------------------*/
phase = 33;
iparm[7] = 2; /* Max numbers of iterative refinement steps. */
/* Set right hand side to one.*/
for (i = 0; i < n; i++) {
b = 1;
}
PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs,
iparm, &msglvl, b, x, &error);
if (error != 0) {
printf("\\nERROR during solution: %d", error);
exit(3);
}
printf("\\nSolve completed ... ");
printf("\\nThe solution of the system is: ");
for (i = 0; i < n; i++) {
printf("\\n x [%d] = % f", i, x );
}
printf ("\\n");
/* --------------------------------------------------------------------*/
/* .. Termination and release of memory. */
/* --------------------------------------------------------------------*/
phase = -1; /* Release internal memory. */
PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
&n, &ddum, ia, ja, &idum, &nrhs,
iparm, &msglvl, &ddum, &ddum, &error);
return 0;
}

thank you

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
378 Views

Please try to use MKL Linker adviser tosee what libraries are recommended for linking application.

--Gennady

0 Kudos
ArturGuzik
Valued Contributor I
378 Views

using CVF6.6c? This is Compaq Visual Fortran? or ..... you just trying to use Microsft Visual Studio 6? In any case both are VERY old. And you can have "unexpected" things ahead while trying to make it working.

A.

0 Kudos
Reply