This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Is it a bug: data aligment of matrix returned by gemm
- From: Maciej Zwierzycki <Maciej dot Zwierzycki at ifmpan dot poznan dot pl>
- To: tprince at computer dot org
- Cc: Maciej dot Zwierzycki at ifmpan dot poznan dot pl, fortran at gcc dot gnu dot org
- Date: Thu, 25 Jun 2009 15:59:29 +0200
- Subject: Re: Is it a bug: data aligment of matrix returned by gemm
- References: <20090625123831.GD19665@ifmpan.poznan.pl> <4A4375D8.9050408@sbcglobal.net>
- Reply-to: Maciej dot Zwierzycki at ifmpan dot poznan dot pl
On Thu, Jun 25, 2009 at 06:04:24AM -0700, Tim Prince wrote:
[...]
> The compiler can't diagnose your syntax error, where you declare a with
> intent(in), although I suppose it could in principle if it could scan the
> source of dgemm. It should diagnose a syntax error when you don't set
> rank, and I can't see how you could get results without rank.
Why not? Assumed shape arrays are part of the standard as far as I know.
also what is wrong with specifying intent(in) for a matrices not to be
changed by the function?
> I don't see
> your complaint about how dgemm fills a; it seems, contrary to what you
a is _not_ being filled. Is it a typo or we are talking about
different things?
> show, that you may have declared a such that size(a,1) is 2, and the
> result then is what you requested.
> I don't see how any of the stuff you mention could be deemed "correct" if
> you don't provide correct source code.
Can you be more specific? What exactly is wrong with the code?
The function itself, or the way it is called?
The reason I do not specify ranks in the definition of the function
this is meant to be a part of generic function - a drop-in replacement
for intrinsic matmul. Which works as intended with two other
compilers - three actualy if I remember the bahaviour of
Lahey-Fujitsu from few years back correctly.
If the function returns 2x2 matrix why should I not be allowed to
use it to fill a 2x2 sub-block of a multi-dimensional matrix?
BTW. the problem is also present for 2x2 blocks of larger 2D matrix.
I understand what is happening. The function returns a
vector of 4 values. These are then being used to fill the bigger matrix
staring from the pointer defined in the
c(1,:,:)=matmul_func(....)
The filling however is done column-wise for the whole c matrix, not the
c(1,:,:) sub-matrix. BTW. specifying something like c(1,1:2,1:2) does
not help.
The question is, is it an expected behaviour and I was so far lucky with
more forgiving compilers? I take it you suggest the latter? :)
Strangely if I defined the local matrix within the func_matmul scope
real(kind=8) :: c(size(a,1),size(b,2))
use it in gemm call and then assign:
func_matmul=c
the results are correct again.
MZ