LAPACK Archives

[Lapack] [CBLAS help] crash when calling cblas_sdsdot


  I  am   using  BLAS   and  CBLAS,  latest   tarballs  from
<>,  and   the  following  simple
program causes a segmentation fault:

   #include <stdio.h>
   #include <stdlib.h>
   #include <cblas.h>
   main (int argc, const char *const argv[])
   #undef N
   #define N 3
     float SB = 1.0;
     int incX = 1;
     int incY = 1;
     float SX[N] = { 1.0, 2.0, 3.0 };
     float SY[N] = { 4.0, 5.0, 6.0 };
     float R;
     R = cblas_sdsdot(N, SB, SX, incX, SY, incY);
     fprintf(stderr, "sdsdot: %f\n", R);

  The program does not crash  if I change the first argument
to  "cblas_sdsdot()" from  "N"  to "1",  but  the result  is
-0.000014 or -0.000015 or -0.000016 different at every run.

  From what  I have seen so  far SDSDOT is  the only routine
that fails, for example if I call:

   R = cblas_sdot(N, SX, incX, SY, incY);

rather than "cblas_sdsdot()" everything works and the result
is correctly 4.0.

  I am on  a i686-pc-linux-gnu, GCC 4.6.2, I  have built and
installed a shared library of BLAS with:

   cd BLAS
   make OPTS='-O3 -march=i686 -mtune=i686'
   gcc -fPIC -lgfortran -shared *.o    \
        -Wl,-soname,         \

and a shared library of CBLAS with:

   cd CBLAS
   cp Makefile.LINUX
   make CBDIR=$PWD \
        CBLIBDIR=$PWD/lib \
        CBLIB=$PWD/lib/libcblas.a \
        BLLIB="../BLAS/blas_LINUX.a" \
        CFLAGS="-O3 -march=i686 -mtune=i686 -DADD_" \
        FFLAGS="-O3 -march=i686 -mtune=i686 -DADD_" \
        FC="gfortran" \
        RANLIB=ranlib \
   cd lib
       ar -x libcblas.a
       gcc -fPIC -lgfortran -shared *.o \
           -Wl,-soname, -o
   cd ..

and the example program is built with:

   gcc -Wall -I/usr/local/include \
       -L/usr/local/lib -lcblas -lblas \
       -o proof proof.c

  Trying to  link againts  the static libraries  rather than
the shared ones changes nothing AFAICT.

  What is wrong?

Marco Maggi

<Prev in Thread] Current Thread [Next in Thread>
  • [Lapack] [CBLAS help] crash when calling cblas_sdsdot, Marco Maggi <=

For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or