Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ucsunil
Beginner
78 Views

unresolved external symbol _pardiso

Hi,
I'm trying to run an example of a symmetric system using the pardiso solver that I found online and the examples provided by Intel but I keep getting the 'unresolved external symbol _pardiso' repeatedly. I've added the additional directories (mkl\\include\\intel64\\ilp64, mkl\\lib\\intel64, mkl\\include\\intel64\\lp64). My program is as follows (it's an example from Univ. of Basel). I get unresolved externals for all occurences of pardiso (5 in all). My program is as follows:
#include
#include
#include
using namespace std;
/* PARDISO prototype. */
extern "C" void pardisoinit (void *, int *, int *, int *, double *, int *);
extern "C" void pardiso (void *, int *, int *, int *, int *, int *,
double *, int *, int *, int *, int *, int *,
int *, double *, double *, int *, double *);
extern "C" void pardiso_chkmatrix (int *, int *, double *, int *, int *, int *);
extern "C" void pardiso_chkvec (int *, int *, double *, int *);
extern "C" void pardiso_printstats (int *, int *, double *, int *, int *, int *,
double *, int *);
int main( void )
{
/* Matrix data. */
int n = 8;
int ia[ 9] = { 0, 4, 7, 9, 11, 14, 16, 17, 18 };
int ja[18] = { 0, 2, 5, 6,
1, 2, 4,
2, 7,
3, 6,
4, 5, 6,
5, 7,
6,
7 };
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,
0.0, 5.0,
11.0,
5.0 };
int nnz = ia;
int mtype = -2; /* Real symmetric matrix */
/* RHS and solution vectors. */
double b[8], x[8];
int nrhs = 1; /* Number of right hand sides. */
/* Internal solver memory pointer pt, */
/* 32-bit: int pt[64]; 64-bit: long int pt[64] */
/* or void *pt[64] should be OK on both architectures */
void *pt[64];
/* Pardiso control parameters. */
int iparm[64];
double dparm[64];
int maxfct, mnum, phase, error, msglvl, solver;
/* Number of processors. */
int num_procs;
/* Auxiliary variables. */
char *var;
int i;
double ddum; /* Double dummy */
int idum; /* Integer dummy. */
/* -------------------------------------------------------------------- */
/* .. Setup Pardiso control parameters. */
/* -------------------------------------------------------------------- */
error = 0;
solver = 0; /* use sparse direct solver */
pardisoinit (pt, &mtype, &solver, iparm, dparm, &error);
if (error != 0)
{
if (error == -10 )
printf("No license file found \\n");
if (error == -11 )
printf("License is expired \\n");
if (error == -12 )
printf("Wrong username or hostname \\n");
return 1;
}
else
printf("[PARDISO]: License check was successful ... \\n");
/* Numbers of processors, value of OMP_NUM_THREADS */
var = getenv("OMP_NUM_THREADS");
if(var != NULL)
sscanf( var, "%d", &num_procs );
else {
printf("Set environment OMP_NUM_THREADS to 1");
exit(1);
}
iparm[2] = num_procs;
maxfct = 1; /* Maximum number of numerical factorizations. */
mnum = 1; /* Which factorization to use. */
msglvl = 1; /* Print statistical information */
error = 0; /* Initialize error flag */
/* -------------------------------------------------------------------- */
/* .. Convert matrix from 0-based C-notation to Fortran 1-based */
/* notation. */
/* -------------------------------------------------------------------- */
for (i = 0; i < n+1; i++) {
ia += 1;
}
for (i = 0; i < nnz; i++) {
ja += 1;
}
/* Set right hand side to one. */
for (i = 0; i < n; i++) {
b = i;
}
/* -------------------------------------------------------------------- */
/* .. pardiso_chk_matrix(...) */
/* Checks the consistency of the given matrix. */
/* Use this functionality only for debugging purposes */
/* -------------------------------------------------------------------- */
pardiso_chkmatrix (&mtype, &n, a, ia, ja, &error);
if (error != 0) {
printf("\\nERROR in consistency of matrix: %d", error);
exit(1);
}
/* -------------------------------------------------------------------- */
/* .. pardiso_chkvec(...) */
/* Checks the given vectors for infinite and NaN values */
/* Input parameters (see PARDISO user manual for a description): */
/* Use this functionality only for debugging purposes */
/* -------------------------------------------------------------------- */
pardiso_chkvec (&n, &nrhs, b, &error);
if (error != 0) {
printf("\\nERROR in right hand side: %d", error);
exit(1);
}
/* -------------------------------------------------------------------- */
/* .. pardiso_printstats(...) */
/* prints information on the matrix to STDOUT. */
/* Use this functionality only for debugging purposes */
/* -------------------------------------------------------------------- */
pardiso_printstats (&mtype, &n, a, ia, ja, &nrhs, b, &error);
if (error != 0) {
printf("\\nERROR right hand side: %d", error);
exit(1);
}
/* -------------------------------------------------------------------- */
/* .. 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, dparm);
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;
iparm[32] = 1; /* compute determinant */
pardiso (pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs,
iparm, &msglvl, &ddum, &ddum, &error, dparm);
if (error != 0) {
printf("\\nERROR during numerical factorization: %d", error);
exit(2);
}
printf("\\nFactorization completed ...\\n ");
/* -------------------------------------------------------------------- */
/* .. Back substitution and iterative refinement. */
/* -------------------------------------------------------------------- */
phase = 33;
iparm[7] = 1; /* Max numbers of iterative refinement steps. */
pardiso (pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs,
iparm, &msglvl, b, x, &error, dparm);
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");
/* -------------------------------------------------------------------- */
/* .. Convert matrix back to 0-based C-notation. */
/* -------------------------------------------------------------------- */
for (i = 0; i < n+1; i++) {
ia -= 1;
}
for (i = 0; i < nnz; i++) {
ja -= 1;
}
/* -------------------------------------------------------------------- */
/* .. 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, dparm);
return 0;
}
I don't think there is an error in the code. I read online in another thread that I will have to add the mkl_solver_ilp64.lib among others but when I add them in Project -> Properties -> Linker -> Input and then try to execute, it says that mkl_solver_ipl64.lib not found. Can anyone here help me out on this? I'm an electrical guy who's been asked to program a bit. I read through chapter 5 of the manual and I didn't understand much. If I need to add these libraries, please tell me where they should go in. I've been stuck with this for quite some time.
I use MS Visual Studio 2010 Professional and the Intel Parallel Studio XE compiler.
Thanks,
Sunil
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
78 Views

Hello Sunil
please look at the Linker Adviser to define the list of recommended libraries for linking this example.
it should be noted also that for this case you need to use LP64 interfaces instead of ILP64.
and also it may be useful for you to see this article how configuiring MKL in Visual Studio.
regards, Gennady
Gennady_F_Intel
Moderator
78 Views

Hello Sunil
please look at the Linker Adviser to define the list of recommended libraries for linking this example.
it should be noted also that for this case you need to use LP64 interfaces instead of ILP64.
and also it may be useful for you to see this article how configuiring MKL in Visual Studio.
regards, Gennady
Gennady_F_Intel
Moderator
78 Views

Hello Sunil
please look at the Linker Adviser to define the list of recommended libraries for linking this example.
it should be noted also that for this case you need to use LP64 interfaces instead of ILP64.
and also it may be useful for you to see this article how configuiring MKL in Visual Studio.
regards, Gennady
ucsunil
Beginner
78 Views

Hi Gennady,

Thanks for your response. I got it running. But just FYI, I had trial versions of MS VS 2010 Pro amd Intel Parallel Studio XE 2011 installed on my home system and I did not see the Intel Performance Libraries option under Configuration properties as shown in the user's guide. But when I got to my office system (which has the full license, it showed up and everything worked well after that). But I encountered a different problem this time. I was asked to evaluate the PARDISO solver. We have input matrices in the coordinate format and I need to convert them to csr format. I used the mkl_dcsrcoo routine but I get a access violation writing locationerror (hexadecimal address). I'm trying to read input from an external text file which has a 5x5 sparse matrix. I'm using a program that reads a matrix in coordinate formatfrom an external input file for a different purpose and I commented out the section of code that I do not need below. The additional include files simply help with the reading. Without the mkl_dcsrcoo routine alone, and removing the comments - the program works just fine. (Also on a side note, for nowI have explicitly given the number of nonzeros and the size but it is supposed to get them from the external file. Also, when I try to simply print the acsr matrix, the first three values are correct and the rest are huge negative values). the program is as follows:


// TestLUSolver.cpp : Defines the entry point for the console application.

//

#include

# include

#include

#include

#include "mkl_spblas.h"

#include "mkl_types.h"

#include "SolveLinear.h"

#include "../Utility/Utility.h"

#include "../IOFiles/DataFile.h"

using namespace std;

int main( int argc, char* argv[] )

{

// Write the header

cout << endl;

cout << "--------------------------------------------------------------------------" << endl;

cout << " " << endl;

cout << " Nexant (C) 2012 " << endl;

cout << " " << endl;

cout << " Linear Solver Test " << endl;

cout << " " << endl;

cout << " " << endl;

cout << "--------------------------------------------------------------------------" << endl;

cout << endl;

MKL_INT info, nnz, m = 5;

nnz = 13;

MKL_INT job [8] = { 1, 1, 1, 0, 1, 0, 0, 0 };

MKL_INT *ia = new int [m+1];

MKL_INT *ja = new int [nnz];

MKL_INT *ir = new int [nnz];

MKL_INT *jc = new int [nnz];

double *acoo = new double [nnz];

double *acsr = new double [nnz];

//string m_DataFileName; // Input file name

// Assign the file name

//m_DataFileName = Utility::SetFileName( "G2_circuit.mtx", "C:\\TestLUSolver" );

const char *m_DataFileName = "C:\\TestLUSolver\\smalltest.mtx";

cout << " Start reading matrix A " << endl;

double start_read = time(0);

//Read the data

DataFile *m_DataFile;

// Create an object to handle the input file

m_DataFile = new DataFile( m_DataFileName );

// Read the file into a buffer and break it into records

string *srec = 0;

string *ssrec;

string *sfield;

long retcode = m_DataFile->Read();

if ( retcode == -1 )

{

delete m_DataFile;

m_DataFile = 0;

return( 0 );

}

// Get the first record

srec = m_DataFile->MoveToNextLine( );

// Break the current record into sub-records

retcode = m_DataFile->BreakCurrentLine( );

// Get the next sub-record

ssrec = m_DataFile->MoveToNextSubRecord( );

// Break the current sub-record into fields

retcode = m_DataFile->BreakCurrentSubRecord( );

//Read Number of Rows

sfield = m_DataFile->MoveToNextField( );

long m_NRows = Utility::string2long(*sfield);

// long m_NumberEquation = Utility::string2long(*sfield);

//Read Number of Columns

sfield = m_DataFile->MoveToNextField( );

long m_NColumns = Utility::string2long(*sfield);

//Read Number of nonzeros

sfield = m_DataFile->MoveToNextField( );

long offDiagElements = Utility::string2long(*sfield);

/*

long offDiagFactors = 20*offDiagElements;

long sparseOverlayIndex = 130;

long maxBuses = m_NRows + m_NColumns;

long maxNumEquation = maxBuses;*/

/*

// Definition of size elements needed by the sparse Linear solver

long maxBranches = maxLines + maxTrafos + maxZeroImpBranches + maxSeriesReact;

long offDiagElements = maxBranches + 2*maxTrafos + maxGenerators + maxRegBusVolt + maxStatVars;

long maxNumEquation = maxBuses + maxTrafos + maxGenerators + maxStatVars;

// Definition of Network Elements dimensions

long maxGenerators = 2500;

long maxLines = 7000;

long maxTrafos = 2100;

long maxRegBusVolt = 4400;

long maxStatVars = 100;

long maxSeriesReact = 100;

long maxZeroImpBranches = 250; */

/*// Definition of Linear Equation parameters

long * m_Row;

long * m_Column;

double * m_DiagonalValues;

double * m_UpperDiagValues;

double * m_LowerDiagValues;

double * m_RightHandSide;

double * m_SolutionVector;

long m_NumberOffDiagonal;*/

// Definition of an example: number of Equations can not be larger than maxNumEquation and number of off diagonal elements

// can not be greater than offDiagFactors

/*

m_NumberOffDiagonal = offDiagElements;

m_Row = new long [ offDiagFactors ];

m_Column = new long [ offDiagFactors ];

m_DiagonalValues = new double [ m_NRows ]; // or we can use m_DiagonalValues = new double

m_LowerDiagValues = new double [ offDiagFactors ];

m_UpperDiagValues = new double [ offDiagFactors ];*/

long k = 0;

do

{

// Get the first recodr record

srec = m_DataFile->MoveToNextLine( );

if ( *srec == "#" )

break;

// Break the current record into sub-records

retcode = m_DataFile->BreakCurrentLine( );

// Get the next sub-record

ssrec = m_DataFile->MoveToNextSubRecord( );

// Break the current sub-record into fields

retcode = m_DataFile->BreakCurrentSubRecord( );

//Read the row index

sfield = m_DataFile->MoveToNextField( );

long row = Utility::string2long(*sfield);

//Read the column index

sfield = m_DataFile->MoveToNextField( );

long column = Utility::string2long(*sfield);

//Read the value

sfield = m_DataFile->MoveToNextField( );

double value = Utility::string2double(*sfield);

// Adding dummy values for use in format conversion

if ( row == column )

{

// m_DiagonalValues[row-1] = value;

acoo = value;

acsr = value;

ir = row;

jc = column;

ja = column;

}

else if (row < column)

{

// m_LowerDiagValues = value;

// m_UpperDiagValues = value;

acoo = value;

acsr = value;

//m_Row = row;

// m_Column = column;

ir = row;

jc = column;

ja = column;

k = k + 1;

}

/* else

{

m_LowerDiagValues = value;

m_UpperDiagValues = value;

m_Row = column;

//acoo = value;

m_Column = row;

//ir = column;

//jc = row;

//ja = column;

k = k + 1;

} */

} while ( true );

for (int z = 0; z <13; z++)

cout << acoo << endl;

mkl_dcsrcoo (job, &m, acsr, ja, ia, &nnz, acoo, ir, jc, &info);

/*

m_RightHandSide = new double [ m_NRows ];

for ( long i=0;i

m_RightHandSide = 1;

m_NumberOffDiagonal = k;

cout << " Finish reading matrix A " << endl;

double end_read = time (0);

double elapsed_read = end_read - start_read;

cout << "Time taken to read was " << elapsed_read << "seconds" << endl;

cout << " Start x = A/b calculation " << endl;

double start_solve = time (0);

// Construction and Calling method to the Linear solver Wrapper, it retrieves the solution vector

SolveLinear *m_SolveLinear = new SolveLinear();

m_SolutionVector = m_SolveLinear -> Calculate( m_Row, m_Column, m_NRows, m_NumberOffDiagonal,

m_DiagonalValues, m_LowerDiagValues, m_UpperDiagValues, m_RightHandSide ,

maxNumEquation, maxBuses, offDiagFactors, sparseOverlayIndex );

cout << " Finish x = A/b calculation " << endl;

double end_solve = time (0);

double elapsed_solve = end_solve - start_solve;

cout << "Time taken to solve was " << elapsed_solve << "seconds" << endl;

cout << " Start saving the solution " << endl;

double start_output = time (0);

// Open the output file

fstream output;

string outFilename = "solution.dat";

string outPath ="C:\\Users\\smonsingh\\Desktop";

bool outStat = Utility::OpenFile( outFilename,

outPath,

output,

IOS::out );

// Check if the debug file can be opened

if ( outStat )

{

for (long i=0; i

{

// Write to the file

output << m_SolutionVector << endl;

}

// Close the file

output.close();

}

cout << " Finish saving the solution " << endl;

double end_output = time (0);

double elapsed_output = end_output - start_output;

cout << "Time taken to print the solution was " << elapsed_output << "seconds" << endl;

// Delete the dynamic vectors

if ( m_Row )

delete [] m_Row;

if ( m_Column )

delete [] m_Column;

if ( m_DiagonalValues )

delete [] m_DiagonalValues;

if ( m_UpperDiagValues )

delete [] m_UpperDiagValues;

if ( m_LowerDiagValues )

delete [] m_LowerDiagValues;

if ( m_RightHandSide )

delete [] m_RightHandSide;

if ( m_SolutionVector )

delete [] m_SolutionVector;

if ( m_DataFile )

delete m_DataFile;

delete m_SolveLinear;*/

system ("PAUSE");

return 0;

}

// SolveLinear *m_SolveLinear = new SolveLinear();

//

// m_SolveLinear ->Populate();

// m_SolveLinear ->Calculate();

// delete m_SolveLinear;

// return 0;



I inserted the commented section as well just to show you the exact program I'm trying to run. Could you please help me out with this? I know I have sufficient memory and access priveleges.

Thanks,
Sunil