bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] difficulty using gsl_blas_dgemm


From: Shervin Fatehi
Subject: [Bug-gsl] difficulty using gsl_blas_dgemm
Date: Fri, 03 Feb 2006 21:32:55 -0800

Hello,

I've been having some trouble using gsl_blas_dgemm in my program. This is the first time I've ever had a problem with the GSL that I can't pin down as having been my fault! All the same, I'm not sure that this is a bug, for reasons that should become clear -- it may be a problem with my system or some very subtle problem with my code. As far as my setup goes, my computer here in the lab is running SuSE and the 2.4.20-4GB-athlon kernel. The gcc version is 3.3, and I just installed version 1.7 of the GSL in (vain) hopes of fixing this (the previous version was 1.4).

All right. When I use the sample program given on pp. 119-120 of the GSL Reference Manual, which happens to use gsl_blas_dgemm, it works just fine. I obtain the appropriate results, and gcc doesn't scream at me about anything. I compile it using the command

gcc -ansi -I(my include directory, since gsl is not installed in the standard spots) -L(my lib directory) -o test test.c -lgsl -lgslcblas


Now, I have a piece of code in which I am manipulating some GSL-constructed matrices. It works perfectly until I insert the lines

#include <gsl/gsl_blas.h>

and

gsl_blas_dgemm(CblasTrans,CblasNoTrans,1,evecs,x,0,x);

at the beginning and in the body of my code, respectively. I'm not sure if using x as both B and C in

C = alpha * op(A)op(B) + beta * C

will work, but that doesn't appear to be the problem (I've tried changing it, as I've tried changing a number of other parts of my program). Anyway, when I try to compile this using the command

gcc -ansi -I(m.i.d.) -L(m.l.d.) -o myprogram file1.c file2.c file3.c -lgsl 
-lgslcblas

I get this horrendous set of errors:

In file included from /home/group1/shervin/include/gsl/gsl_blas_types.h:28,
                 from /home/group1/shervin/include/gsl/gsl_blas.h:29,
                 from eval_pot.c:8:
/home/group1/shervin/include/gsl/gsl_cblas.h:180: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:185: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:213: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:218: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:246: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:251: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:279: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:284: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:327: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:356: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:389: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:392: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:420: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:423: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:449: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:454: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:469: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:474: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:479: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:484: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:499: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:504: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:509: error: parse error before 
numeric constant
/home/group1/shervin/include/gsl/gsl_cblas.h:514: error: parse error before 
numeric constant

In every case, the "offending" piece of the header file is one of the lines of a prototype that looks like this (in this case, it's the second line):

void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE 
TransA,
                 const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
                 const int K, const double alpha, const double *A,
                 const int lda, const double *B, const int ldb,
                 const double beta, double *C, const int ldc);

At first I thought it might be the formatting (although that shouldn't matter to a compiler), but I quickly eliminated that hypothesis when I realized that there were other functions that were formatted similarly and seemed to contain essentially the same kinds of information yet didn't trigger the error, like this one:

void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
                 const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
                 const double alpha, const double *A, const int lda,
                 const double beta, double *C, const int ldc);

One thing that appears to be a common distinction between the error-triggering and non-error-triggering prototypes is the presence of TransA and TransB as opposed to just Trans, but I don't think that should make a difference.

It seems very strange to me that this problem, which is ostensibly in the header, should rear its head when compiling my program but not the test code. Is there any obvious mistake that I'm making, or is this some kind of weird conflict with my system / version of gcc?

Thank you!!
Shervin Fatehi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]