Dear support provider

I tried MKL_LAPACK and LAPACK provided with MAC-OX 10.6

here is the code:

#include

#include

#include

using namespace std;

/* Complex datatype */

struct _dcomplex { double re, im; };

typedef struct _dcomplex dcomplex;

/* ZGELSS prototype */

extern "C" { // LAPACK routines

void zgelss_(int*m, int* n, int* nrhs, dcomplex* a, int* lda,

dcomplex* b, int* ldb, double* s, double* rcond, int* rank, dcomplex*

work, int* lwork, double* rwork, int* info );}

/* Auxiliary routines prototypes */

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

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

/* Parameters */

#define N 4

#define NRHS 2

#define LDA N

#define LDB N

/* Main program */

int main() {

/* Locals */

int m = N, n = N, nrhs = NRHS, lda = LDA, ldb = 4, info, lwork = -1, rank;

double rcond = 0, rwork[20];

/* Local arrays */

double s[4];

dcomplex work[264];

dcomplex a[LDA*N] = {

{ 1.23, -5.50}, {-2.14, -1.12}, {-4.30, -7.10}, { 1.27, 7.29},

{ 7.91, -5.38}, {-9.92, -0.79}, {-6.47, 2.52}, { 8.90, 6.92},

{-9.80, -4.86}, {-9.18, -1.12}, {-6.51, -2.67}, {-8.82, 1.25},

{-7.32, 7.57}, { 1.37, 0.43}, {-5.86, 7.38}, { 5.41, 5.37}

};

dcomplex b[LDB*NRHS] = {

{ 8.33, -7.32}, {-6.18, -4.80}, {-5.71, -2.80}, {-1.60, 3.08},

{-6.11, -3.81}, { 0.14, -7.71}, { 1.41, 3.40}, { 8.54, -4.05}

};

/* Executable statements */

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

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

for (int loop = 0 ; loop < 1000000; loop++)

zgelss_( &m, &n, &nrhs, a, &lda, b, &ldb, s,

&rcond, &rank, work, &lwork, rwork, &info );

/* Check for the exact singularity */

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 sv decomposition */

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

/* Print singular values */

print_double_vector( "Pivot indices", n, s );

cout << "work = " < exit( 0 );

} /* End of ZGESV Example */

/* Auxiliary routine: printing a matrix */

void print_matrix( char* desc, int m, int n, dcomplex* 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,%6.2f)", a[i+j*lda].re, a[i+j*lda].im );

printf( "\\n" );

}

}

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

void print_double_vector( char* desc, int n, double* a ) {

int j;

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

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

printf( "\\n" );

}

I tried following compiler statements

1-->icpc main.cpp -o result_t -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -DMKL_ILP64

RESULTS

ZGELSS Example Program Results

Solution

( 0.43, -0.90) ( -2.22, 0.84)

( -0.51, 0.18) ( 1.13, 1.21)

( 1.25, -0.43) ( -1.88, -0.43)

( 0.73, -0.33) ( -0.14, 0.17)

Details of LU factorization

( -1.00, -0.00) ( -0.00, -0.00) ( -0.00, -0.00) ( -0.00, -0.00)

( -0.00, -0.00) ( -1.00, -0.00) ( -0.00, 0.00) ( -0.00, 0.00)

( -0.00, -0.00) ( -0.00, -0.00) ( -1.00, -0.00) ( -0.00, 0.00)

( 0.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00) ( 1.00, 0.00)

s

1.00 1.00 1.00 1.00

work = 1032

5.343u 0.009s 0:05.35 99.8% 0+0k 0+0io 0pf+0w

2.-->icpc main.cpp -o result_t -llapack

RESULTS

ZGELSS Example Program Results

Solution

( 1.03, -0.34) ( -1.89, 0.63)

( -0.13, -0.25) ( -0.31, 0.07)

( 0.25, -0.45) ( -1.48, 0.35)

( -1.39, -0.49) ( 0.43, 2.36)

Details of LU factorization

( 1.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -1.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -0.00, 0.00) ( -1.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -0.00, 0.00) ( -0.00, 0.00) ( -1.00, 0.00)

Pivot indices

1.00 1.00 1.00 1.00

work = 264

3.009u 0.001s 0:03.01 99.6% 0+0k 0+0io 0pf+0w

3.-->g++ main.cpp -o result_t -llapack

RESULTS

ZGELSS Example Program Results

Solution

( 1.03, -0.34) ( -1.89, 0.63)

( -0.13, -0.25) ( -0.31, 0.07)

( 0.25, -0.45) ( -1.48, 0.35)

( -1.39, -0.49) ( 0.43, 2.36)

Details of LU factorization

( 1.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -1.00, 0.00) ( 0.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -0.00, 0.00) ( -1.00, 0.00) ( 0.00, 0.00)

( -0.00, 0.00) ( -0.00, 0.00) ( -0.00, 0.00) ( -1.00, 0.00)

Pivot indices

1.00 1.00 1.00 1.00

work = 264

2.991u 0.000s 0:02.99 100.0% 0+0k 0+0io 0pf+0w

I found LAPACK with macox ~2 time faster

-->>Any how my querry is possible to link MACOX LAPACK and other MKL_libs, "specially mkl_vml" and develop a multithreaded application.

if so please guide me through Linking statement for doing so.