CLAPACK on Debian Squeeze AMD 64

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

CLAPACK on Debian Squeeze AMD 64

Postby arkkimede » Thu Dec 02, 2010 1:06 pm

HI!
I have installed CLAPACK on a linux machine with 64 bits.
I need to evaluate the eigenvalues ad eigenvectors for a general complex double precision matrix.

Using the function zgeev the eigenvalues are always null

So I tested the function sgeev (real matrix single precision) ==> It works (check results with matlab and octave)
Then I tested the function dgeev (real matrix double precision) ==> it doesn't work.

The problems are related to the 64bits?
There is a workaround to obtain right results?

TIA

Daniele
arkkimede
 
Posts: 3
Joined: Thu Dec 02, 2010 12:44 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby admin » Thu Dec 02, 2010 2:36 pm

Hi,
I managed to reproduce your problem. On my AMD 64 bits machine, double complex precision eigenvalue testings are seg faulting.
Not sure about the reason.

I would advice you to use the new Standard C language APIs for LAPACK.
You will need to download and compile the LAPACK library (in Fortran) and then the LAPACKE library.
Both are available at http://www.netlib.org/lapack/

Julie
admin
Site Admin
 
Posts: 504
Joined: Wed Dec 08, 2004 7:07 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby admin » Thu Dec 02, 2010 3:53 pm

A little follow-up.
CLAPACK in 64 bits works fine on Intel and Apple machines.
admin
Site Admin
 
Posts: 504
Joined: Wed Dec 08, 2004 7:07 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby arkkimede » Thu Dec 02, 2010 4:22 pm

I can precise also (after test) that the same code running on a Debian squeeze but i386 (eeepc) produce the same errors.

So the problem is not related with the machine and the number of bits.

Any help will be welcome

Daniele

PS: with reference to the advice, in the web I read that now Lapack is a library written in fortran90.
On linux therr isen't Fortran 90. How I can follow your advice?
Last edited by arkkimede on Thu Dec 02, 2010 4:25 pm, edited 1 time in total.
arkkimede
 
Posts: 3
Joined: Thu Dec 02, 2010 12:44 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby admin » Thu Dec 02, 2010 4:23 pm

Daniele,
Without seeing your code, it will be hard to help you.
Julie
admin
Site Admin
 
Posts: 504
Joined: Wed Dec 08, 2004 7:07 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby admin » Thu Dec 02, 2010 4:27 pm

gfortran is perfect under Linux.
It will work all LAPACK versions, including the latest LAPACK 3.3.0 release.
Julie
admin
Site Admin
 
Posts: 504
Joined: Wed Dec 08, 2004 7:07 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby arkkimede » Thu Dec 02, 2010 9:11 pm

In answer to Julie, in the following the code that produce eigenvalues nulls.

I also follow the advice.
Installed gfortran and build lapack (fortran) e lapacke.
About lapacke I didn't find any documentations.
Could you provide me an example of simple solution of a complex double precision solution of a linear system?
This is just to understand how to use lapacke (it seems that I do not have modify the array storage -rows storage vs columns storage- etc.)
Thank you
Daniele

Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "f2c.h"
#include "clapack.h"
#include "blaswrap.h"

#define  dim 2

int main()
{
   FILE    *fp;
   doublereal   re,im;
   int      i,j,count;

   /* Definitions for subtroutine                                                */
   char jobvl;             // 'N' left eigv non computed; 'V' left eigv computed
   char jobvr;             // 'N' right eigv non computed; 'V' right eigv computed
   integer  n;             // Order of the matrix
   integer  lda;           // Leading deimension of array
   doublereal *a;                // Input array
   doublereal *wr;               // Output eigenvalues
   doublereal *wi;               // Output eigenvalues
   doublereal *vl;               // Stores, if required, left eigv, or not referenced
   integer ldvl;           // Leading dimension for VL
   doublereal *vr;               // Stores, if required, righr eigv, or not referenced
   integer ldvr;           // Leading dimension dor VR
   integer lwork;          // Auxiliary data
   doublereal *work;    //        "
   double *rwork;          //        "
   integer    info;        //        "

   /* Definition parameters */
   jobvl = 'N';
   jobvr = 'V';
   n = dim;
   lda = dim;
   wr = (doublereal *)malloc(sizeof(doublereal)*n);
   if(wr==NULL)
   {
      printf("Error stop wr\n");
      exit(1);
   }
   wi = (doublereal *)malloc(sizeof(doublereal)*n);
   if(wi==NULL)
   {
      printf("Error stop wi\n");
      exit(1);
   }

   ldvl = 1;
   vl = (doublereal *)malloc(sizeof(doublereal)*ldvl*n);
   if(vl==NULL)
   {
      printf("Error stop vl\n");
      exit(1);
   }

   ldvr = n;
   vr = (doublereal *)malloc(sizeof(doublereal)*ldvr*n);
   if(vr==NULL)
   {
      printf("Error stop vr\n");
      exit(1);
   }
   lwork = 8*n;
   work = (doublereal *)malloc(sizeof(doublereal)*lwork);
   if(work==NULL)
   {
      printf("Error stop work\n");
      exit(1);
   }

   a = (doublereal *)malloc(sizeof(doublereal)*n*n);
   if(a==NULL)
   {
      printf("Error stop a\n");
      exit(1);
   }

   fp = fopen("in.dat","r");
   count=0;
   for(i=0; i<n*n; i++)
   {
      fscanf(fp,"%25.20lf", &re);
      a[count] = re;
      count++;
   }
   fclose(fp);

   dgeev_(&jobvl, &jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr, &ldvr, work, &lwork, &info);

   printf("INFO = %d \n",info);

   for(i=0; i<n; i++)
   {
      printf(" EigenValue n. %d:   Real = %le  Imag = %le  \n",i,wr[i], wi[i]);
   }
   
   count = 0;
   for(i=0; i<n; i++)
   {
      printf(" EigenVecto n. %d:",i);
      for(j=0; j<n; j++)
      {
         printf("   %25.20lf ",vr[count]);
         count++;
      }
      printf("\n");
   }
}

arkkimede
 
Posts: 3
Joined: Thu Dec 02, 2010 12:44 pm

Re: CLAPACK on Debian Squeeze AMD 64

Postby blendaperry » Tue Feb 15, 2011 7:11 am

For these the best use is standard language of C it is one of the simple solution for the linear system. It will works on LAPACK versions for linux in all these it can be good to use.
blendaperry
 
Posts: 1
Joined: Fri Feb 11, 2011 7:40 am


Return to User Discussion

Who is online

Users browsing this forum: Bing [Bot] and 2 guests