The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

segmentation fault using ZGEMM

Open discussion regarding features, bugs, issues, vendors, etc.

segmentation fault using ZGEMM

Postby ruilinchu » Thu Dec 20, 2007 1:23 pm

I'm using ACML's blas and lapack routines on the intel cpu, everything goes well, except for one thing
I have two matrix G(L*L) and t(L*M),what I need is t_trans * G *t,
(here M=length*width)
so I use zgemm to time G and t first :
zgemm('N','N',L, length*width, L, &alpha,G00, L, t_left, L, &beta, G00_t_left, L);
it worked out, but when I use zgemm to time t_trans and G*t(got last step):

/* compute t_left_de*G00*t_left =xigma_R_left */
doublecomplex xigma_R_left[length*width*length*width];
zgemm('T','N',length*width,length*width,L,&alpha,t_left,L,G00_t_left,L,&beta,
xigma_R_left,length*width);

it comes out segmentation fault.
anyone know what's wrong here?
ruilinchu
 
Posts: 12
Joined: Mon Nov 26, 2007 9:03 am

Postby Julien Langou » Thu Dec 20, 2007 1:51 pm

Which BLAS are you using?
I do not understand why you pass the value for L and M. You should be passing the pointers
if you are using the interface of the reference BLAS. Same thing for the characters.

Can you try (for the first step for example):
Code: Select all
M = length*width;
zgemm("N","N",&L, &M, &L, &alpha, G00, &L, t_left, &L, &beta, G00_t_left, &L);


Julien.
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby ruilinchu » Thu Dec 20, 2007 2:44 pm

I'm using the c interface of BLAS and LAPACK.
here L and M are values but not parameters.
so i'm passing them like:
zgemm('N','N',20,20, 20,&alpha,...)
ruilinchu
 
Posts: 12
Joined: Mon Nov 26, 2007 9:03 am

Postby Julien Langou » Thu Dec 20, 2007 2:48 pm

Which C interface of BLAS and LAPACK ???
Why does the routine name is the same as the Fortran interface?
Where do you get your BLAS from?
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby ruilinchu » Thu Dec 20, 2007 3:00 pm

I'm using the Amd Core Math LIB,it contains both the c and fortran interface of BLAS and LAPACK.

extern void zgemm(char transa, char transb, int m, int n, int k, doublecomplex *alpha, doublecomplex *a, int lda, doublecomplex *b, int ldb, doublecomplex *beta, doublecomplex *c, int ldc);
ruilinchu
 
Posts: 12
Joined: Mon Nov 26, 2007 9:03 am

Postby Julien Langou » Thu Dec 20, 2007 3:38 pm

ok here is all I can say:
if G00 is L-by-L, t_left is L-by-M, G00_t_left is L-by-M and xigma_R_left is M-by-M,
and if the interface to your BLAS library is what you think it is, your two calls look allright,
So that does not help much ...
-j
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Postby ruilinchu » Fri Dec 21, 2007 4:27 am

I still can't get it work,(it has worked out a lot of times in previous part of the code), my code is exactly like this:

int L=100,length=51,width=33;
doublecomplex G00[L*L];
compute_G00(...);
int m=length*width;
doublecomplex alpha=compose_doublecomplex(1.0,0.0);
doublecomplex beta=compose_doublecomplex(0.0,0.0);
doublecomplex G00_t_left[L*m];
doublecomplex G00_t_right[L*m];
zgemm('N','N',L, m, L, &alpha, G00, L, t_left, L, &beta, G00_t_left, L);
cout << "end first zgemm" << endl;
zgemm('N','N',L, m, L, &alpha, G00, L, t_right, L, &beta, G00_t_right, L);
cout << "end second zgemm" << endl;
//none of the zgemm here work
ruilinchu
 
Posts: 12
Joined: Mon Nov 26, 2007 9:03 am

Postby ruilinchu » Fri Dec 21, 2007 5:36 am

now it seems that it is not the zgemm that can't work, it is the definement:
doublecomplex G00_t_right[L*m];
doublecomplex xigma_R_left[m*m];

caused the "segmentation fault", how come?
ruilinchu
 
Posts: 12
Joined: Mon Nov 26, 2007 9:03 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests