problem with culaSsyevx
7 posts
• Page 1 of 1
problem with culaSsyevx
Hello,
We cannot get culaSsyevx to work. It returns nothing for eigenvalues or eigenvectors. Note that culaSsyev works just fine for us.
We are using Ubuntu 11.04, CUDA 4.0, CULA R12 Linux 64 bit Premium.
Here is our code that gives the correct eigenvalues and eigenvectors when we use culaSsyev. For culaSsyevx, it returns all zero eigenvalues and eigenvectors.
Here is the code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cula.h>
int main(){
int N = 10;
int* c=NULL;
int* m=NULL;
float* A=NULL;
float* B=NULL;
float* d=NULL;
float vl=-100.0, vu=100.0;
int il=1, iu=10;
float abstol=0.0;
int M=N;
A = (float*)malloc(M*N*sizeof(float));
B = (float*)malloc(M*N*sizeof(float));
d = (float*)malloc(N*sizeof(float));
c = (int*)malloc(N*sizeof(float));
for (int i=0; i<N; i++) d[i]=1;
culaInitialize();
memset(A, 0, M*N*sizeof(float));
memset(B, 0, M*N*sizeof(float));
for (int i=0; i<M*N; i++) A[i]=i;
printf("A={\n");
for (int i=0; i<M*N; i++) {
printf("%3.2f ", A[i]);
if (!((i+1)%N)) printf("\n");
}
printf("}\n");
//culaSsyev ('V', 'U',N,A,N, d );
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,A,N,c);
culaShutdown();
printf("eigenvalue={ ");
for (int i=0; i<N; i++) {
printf("%3.2f ", d[i]);
}
printf("}\n");
printf("eigenvectors={\n");
for (int i=0; i<N*M; i++) {
printf("%3.2f ", B[i]);
if (!((i+1)%N)) printf("\n");
}
printf("}\n");
for (int i=0; i<N; i++) if (c[i]!=0) printf("failed at %d!\n",i);
}
I would really appreciate your help.
Thank you very much!
We cannot get culaSsyevx to work. It returns nothing for eigenvalues or eigenvectors. Note that culaSsyev works just fine for us.
We are using Ubuntu 11.04, CUDA 4.0, CULA R12 Linux 64 bit Premium.
Here is our code that gives the correct eigenvalues and eigenvectors when we use culaSsyev. For culaSsyevx, it returns all zero eigenvalues and eigenvectors.
Here is the code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cula.h>
int main(){
int N = 10;
int* c=NULL;
int* m=NULL;
float* A=NULL;
float* B=NULL;
float* d=NULL;
float vl=-100.0, vu=100.0;
int il=1, iu=10;
float abstol=0.0;
int M=N;
A = (float*)malloc(M*N*sizeof(float));
B = (float*)malloc(M*N*sizeof(float));
d = (float*)malloc(N*sizeof(float));
c = (int*)malloc(N*sizeof(float));
for (int i=0; i<N; i++) d[i]=1;
culaInitialize();
memset(A, 0, M*N*sizeof(float));
memset(B, 0, M*N*sizeof(float));
for (int i=0; i<M*N; i++) A[i]=i;
printf("A={\n");
for (int i=0; i<M*N; i++) {
printf("%3.2f ", A[i]);
if (!((i+1)%N)) printf("\n");
}
printf("}\n");
//culaSsyev ('V', 'U',N,A,N, d );
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,A,N,c);
culaShutdown();
printf("eigenvalue={ ");
for (int i=0; i<N; i++) {
printf("%3.2f ", d[i]);
}
printf("}\n");
printf("eigenvectors={\n");
for (int i=0; i<N*M; i++) {
printf("%3.2f ", B[i]);
if (!((i+1)%N)) printf("\n");
}
printf("}\n");
for (int i=0; i<N; i++) if (c[i]!=0) printf("failed at %d!\n",i);
}
I would really appreciate your help.
Thank you very much!
- tehver
- Posts: 4
- Joined: Wed Jul 06, 2011 11:08 am
Re: problem with culaSsyevx
Looks like you are reading and writing to A at the same time.
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,A,N,c);
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,A,N,c);
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: problem with culaSsyevx
Sorry, we were trying different things and I copied the wrong version. When the call reads:
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,B,N,c);
We still have a B populated with nothing (all zeroes).
Thanks again!
culaSsyevx('V','A','U',N,A,N,vl,vu,il,iu,abstol,m,d,B,N,c);
We still have a B populated with nothing (all zeroes).
Thanks again!
- tehver
- Posts: 4
- Joined: Wed Jul 06, 2011 11:08 am
Re: problem with culaSsyevx
Have you checked the return code from your syevx call? The status returned might be indicating a problem.
- john
- Administrator
- Posts: 587
- Joined: Thu Jul 23, 2009 2:31 pm
Re: problem with culaSsyevx
Thanks a million! That was it.
- tehver
- Posts: 4
- Joined: Wed Jul 06, 2011 11:08 am
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests