From: Bart Vandewoestyne on
I am trying to get the dgemm BLAS routine to work, this is what I
do:

I have a 'stnd' kind defined as follows:

integer, public, parameter :: stnd = kind(1.0)

and my matrices a and b are of size nxn and of the real kind:

real(kind=stnd), dimension(:,:), intent(in) :: a, b

furthermore, i have:

real(kind=stnd), dimension(size(a,1), size(b,2)), intent(out) :: d
integer :: n, k, m

and I'm trying to get dgemm working with:

m = size(a,1)
n = size(b,1)
k = size(a,2)
call dgemm("n", "n", m, n, k, 1.0, a, m, b, k, 0.0, d, n)

I am compiling with the NAGWare Fortran 95 compiler Release 5.1(282)
and i add the -lblas option when compiling. Compiling goes fine
without any errors and warnings.

But when I look at the results of some experiments, I have a lot of zero
values and a lot of values which are very small (1e-40 etc...) and the
results of the matrix multiplication is not correct.

What am I doing wrong here?

For your information: my platform is a Debian GNU/Linux stable box with
this version of the BLAS:

$ dpkg --list | grep blas
ii refblas3 1.2-8 Basic Linear Algebra Subroutines 3, shared l
ii refblas3-dev 1.2-8 Basic Linear Algebra Subroutines 3, static l

Any advice welcome...

Bart

--
"Share what you know. Learn what you don't."
From: Richard Maine on
Bart Vandewoestyne <MyFirstName.MyLastName(a)telenet.be> wrote:

> I am trying to get the dgemm BLAS routine to work,...

> integer, public, parameter :: stnd = kind(1.0)
....
> call dgemm("n", "n", m, n, k, 1.0, a, m, b, k, 0.0, d, n)

Is not the "d" in dgemm for double precision? You are calling it with
single precision data - both the arrays and the literal constants. As an
aside, I generally recommend against using literal real constants as
actual arguments, particularly literal real constants without kind
parameters. They make life difficult when porting to different
precisions.

> But when I look at the results of some experiments, I have a lot of zero
> values and a lot of values which are very small (1e-40 etc...) and the
> results of the matrix multiplication is not correct.

That sounds very typical of getting the precision of real arguments
wrong.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
From: Bart Vandewoestyne on
On 2007-02-12, Richard Maine <nospam(a)see.signature> wrote:
>
> Is not the "d" in dgemm for double precision? You are calling it with
> single precision data - both the arrays and the literal constants.

I now have

integer, public, parameter :: stnd = kind(1.0d0)

and

call dgemm("n", "n", m, n, k, 1.0d0, a, m, b, k, 0.0d0, d, n)

and i now get arithmetic exceptions :-(

Perhaps I should to go bed, have a good night's rest and then
look again at it in the morning with a clean and fresh head ;-)

Bart

--
"Share what you know. Learn what you don't."
From: Bart Vandewoestyne on
On 2007-02-12, Bart Vandewoestyne <MyFirstName.MyLastName(a)telenet.be> wrote:
>
> I now have
>
> integer, public, parameter :: stnd = kind(1.0d0)
>
> and
>
> call dgemm("n", "n", m, n, k, 1.0d0, a, m, b, k, 0.0d0, d, n)
>
> and i now get arithmetic exceptions :-(
>
> Perhaps I should to go bed, have a good night's rest and then
> look again at it in the morning with a clean and fresh head ;-)

Hmm... before that good night's rest, i tried things with g95
instead of f95 and it works OK with

G95 (GCC 4.0.3 (g95 0.91!) Jan 12 2007)

But before I try to understand what I'm doing wrong and why it
works with g95 and not with the NagWare f95, I think i go to bed
;-)

Good night!
Bart

--
"Share what you know. Learn what you don't."
From: Thomas Koenig on
Bart Vandewoestyne <MyFirstName.MyLastName(a)telenet.be> wrote:

>I am trying to get the dgemm BLAS routine to work,

You could also use gfortran, use matmul and specify the
-fexternal-blas option :-)
 |  Next  |  Last
Pages: 1 2 3 4
Prev: SLATEC
Next: pictures as comments