- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I am testing some lapack routines from MKL library on our linux cluster running Red Hat Enterprise 5.4. The Fortran code works with both LP64 and ILP64 interfaces; the C code can only work with the LP64 interface. When compiling it with the ILP64 interface, I either get a segmentation fault or an error message similar to the following:

MKL ERROR: Parameter 4 was incorrect on entry to DGESV

My intel compiler is version 11.1.073 and my mkl library is version 10.2.6.038. The code is taken from Intel MKL LAPACK examples. One is listed at the end.

The command line used to compile and link the code is:

icc dgesv.c -DMKL_ILP64 -L${MKLPATH} -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread

Any idea what's wrong?

Thanks.

Ping

#include

#include

/* DGESV prototype

extern void dgesv( int* n, int* nrhs, double* a, int* lda, int* ipiv,

double* b, int* ldb, int* info );

*/

/* Auxiliary routines prototypes */

extern void print_matrix( char* desc, int m, int n, double* a, int lda );

extern void print_int_vector( char* desc, int n, int* a );

/* Parameters */

#define N 5

#define NRHS 3

#define LDA N

#define LDB N

/* Main program */

int main() {

/* Locals */

int n = N, nrhs = NRHS, lda = LDA, ldb = LDB, info;

/* Local arrays */

int ipiv

double a[LDA*N] = {

6.80, -2.11, 5.66, 5.97, 8.23,

-6.05, -3.30, 5.36, -4.44, 1.08,

-0.45, 2.58, -2.70, 0.27, 9.04,

8.32, 2.71, 4.35, -7.17, 2.14,

-9.67, -5.14, -7.26, 6.08, -6.87

};

double b[LDB*NRHS] = {

4.02, 6.19, -8.22, -7.57, -3.03,

-1.56, 4.00, -8.67, 1.75, 2.86,

9.81, -4.09, -4.57, -8.61, 8.99

};

/* Executable statements */

printf( " DGESV Example Program Results\\n" );

/* Solve the equations A*X = B */

dgesv( &n, &nrhs, a, &lda, ipiv, b, &ldb, &info );

/* Check for the exact singularity */

//exit(0);

if( info > 0 ) {

printf( "The diagonal element of the triangular factor of A,\\n" );

printf( "U(%i,%i) is zero, so that A is singular;\\n", info, info );

printf( "the solution could not be computed.\\n" );

exit( 1 );

}

/* Print solution */

print_matrix( "Solution", n, nrhs, b, ldb );

/* Print details of LU factorization */

print_matrix( "Details of LU factorization", n, n, a, lda );

/* Print pivot indices */

print_int_vector( "Pivot indices", n, ipiv );

exit( 0 );

} /* End of DGESV Example */

/* Auxiliary routine: printing a matrix */

void print_matrix( char* desc, int m, int n, double* a, int lda ) {

int i, j;

printf( "\\n %s\\n", desc );

for( i = 0; i < m; i++ ) {

for( j = 0; j < n; j++ ) printf( " %6.2f", a[i+j*lda] );

printf( "\\n" );

}

}

/* Auxiliary routine: printing a vector of integers */

void print_int_vector( char* desc, int n, int* a ) {

int j;

printf( "\\n %s\\n", desc );

for( j = 0; j < n; j++ ) printf( " %6i", a

printf( "\\n" );

}

Link Copied

2 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

ILP64 interface means that your integer parameters passed to MKL routineshave 64-bit (or 8-byte) size. So, you should replace all the integer variables/arrays in your programwith MKL_INT type instead of plain int.

MKL_INT is declared in mkl_types.h header file and equal either to int or long long int depending on the -DMKL_ILP64 macro. So, once again:

1) Add #include "mkl_types.h"

2) Replace "int" with "MKL_INT"

Regards,

Konstantin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

in this case You don't need to change the source code but just link with LP64 libraries

icc dgesv.c -DMKL_ILP64 -L${MKLPATH} -lmkl_intel_ilp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page