zheevd cannot converge on p4 in some cases

zheevd cannot converge on p4 in some cases

hello.

I found a strange behaviour of zheevd function on pentium 4 processor
on some real matrices or order 64
on core2duo processor these program works correct

test program:
it fails with message "bug - process not converged."... only on p4 with sse3
program was built using Visual Studio 2008 and MKL 10.1.1.022 with static link or dymamic link
when i use dynamic link, there was no problem when i remove mkl_p4p.dll ...

#define _CRT_SECURE_NO_WARNINGS

#include

#include

#include

#include

#include "mkl_lapack.h"

#include "mkl_service.h"

#define INPUT_FROM_FILE

#define MAX 1000

typedef struct {

int work_size;

int rwork_size;

int iwork_size;

MKL_Complex16* work;

double* rwork;

int* iwork;

} EV;

void init(int n, EV &data)

{

int info;

MKL_Complex16 work_size_d = {0, 0};

double rwork_size_d = 0;

int iwork_size_d = 0;

int const_m1 = -1;

zheevd("V", "L", &n, 0, &n, 0, &work_size_d, &const_m1, &rwork_size_d, &const_m1, &iwork_size_d, &const_m1, &info);

_ASSERT(!info);

data.work_size = (int)(floor(work_size_d.real + 0.5));

data.rwork_size = (int)(floor(rwork_size_d + 0.5));

data.iwork_size = iwork_size_d;

data.work = (MKL_Complex16*)malloc(data.work_size * sizeof(MKL_Complex16));

data.rwork = (double*)malloc(data.rwork_size * sizeof(double));

data.iwork = (int*)malloc(data.iwork_size * sizeof(int));

}

int ev(MKL_Complex16 *matrix, double *eigenvals, int n, EV &workBuffer)

{

int info;

zheevd("V", "L", &n, matrix, &n, eigenvals, workBuffer.work, &workBuffer.work_size, workBuffer.rwork, &workBuffer.rwork_size, workBuffer.iwork, &workBuffer.iwork_size, &info);

if(info != 0)

{

printf("bug - process not converged. info = %d\n", info);

}

return info;

}

MKL_Complex16 inp_matrix[MAX * MAX];

MKL_Complex16 eigenvectors[MAX * MAX];

double eigenvals[MAX];

//===================================

int main(void) {

int n;

FILE *inf;

EV e1;

memset(&e1, 0, sizeof(EV));

inf = fopen("bug_matrix_30.txt", "rt");

if(inf == 0)

{

printf("cannot open file\n");

return 1;

}

fscanf(inf, "%d", &n);

init(n, e1);

for(int i = 0; i < n; ++i)

{

for(int j = 0; j < n; ++j)

{

fscanf(inf, "%lf", &inp_matrix[i * n + j].real);

inp_matrix[i * n + j].imag = 0;

}

}

for(int i = 0; i < n; ++i)

{

for(int j = 0; j < n; ++j)

{

if(fabs(inp_matrix[i * n + j].real - inp_matrix[j * n + i].real) > 1e-10)

{

printf("bug = matrix not symmetric\n");

return 1;

}

}

}

memcpy(eigenvectors, inp_matrix, sizeof(inp_matrix));

int r = ev(eigenvectors, eigenvals, n, e1);

if

{

printf("bug - cannot converge. info = %d\n", r);

return 1;

}

fclose(inf);

printf("ok");

return 0;

}

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

there is sample program and input file
files attached

Attachments: 

AttachmentSize
Downloadapplication/zip bug.zip592.78 KB

I am afraid, I didn't understand how do link your code.
Which libraries were used for linking your application?
--Gennady

Quoting - Gennady Fedorov (Intel)

I am afraid, I didn't understand how do link your code.
Which libraries were used for linking your application?
--Gennady

I link to(when i use static link to mkl)
mkl_core.lib
mkl_intel_c.lib
mkl_intel_thread.lib
libguide.lib

when i use dynamic link i use
mkl_core_dll.lib
mkl_intel_c_dll.lib
mkl_intel_thread_dll.lib

Do you have the similar output? see below:
"test.exe bug_matrix_30.txt
bug - process not converged. info = 518
bug - cannot converge. info = 518"

Quoting - Gennady Fedorov (Intel)

Do you have the similar output? see below:
"test.exe bug_matrix_30.txt
bug - process not converged. info = 518
bug - cannot converge. info = 518"

Yes.
My output was identical

Leave a Comment

Please sign in to add a comment. Not a member? Join today