This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Alignment of gfortran allocated arrays
- From: "John Travers" <jtravs at gmail dot com>
- To: "Fortran List" <fortran at gcc dot gnu dot org>
- Date: Fri, 17 Aug 2007 18:13:45 +0100
- Subject: Re: Alignment of gfortran allocated arrays
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZYQE6zaJsk6FuefCQSSdHiE099yMhKrz5VPkV4i5k8EuDVqDw0qQKVSsp5UYBmpLBjU/OH9MSQ39mh/nt1sOFeM8IwaT/ncjNjH+BbzYwK7T9MZLE5BQIuqwDl+9WsXkwdrE9KajIw3+jVBQHcEtpNcdmpWe1mVl/zw8qpG25dA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dVE9eLtIsa71tDoNVE7y6vtgt0HYxEZJBx2nmqkMwUr/lFspIMQZAtmBu7qpaKdsz/+akeO4zzkaJw9TzlN3sHtcK+eieLtMnIHcZZkBRD2qGnjRSl8HFD1R1vtsPYpnvGDEQC/VgCWDUBSTl+1vdZ7JaYO4IChfFOW5FGk8iOg=
- References: <3a1077e70708140833g34e5b6eeqe8d4167f1ed730a1@mail.gmail.com> <46C5000C.2030707@computer.org> <3a1077e70708170228n14157a3flb22b18962918d284@mail.gmail.com> <46C5C2C0.6060503@computer.org>
On 17/08/07, Tim Prince <tprince@computer.org> wrote:
> John Travers wrote:
> >
> > Yes, my two primary systems (including the one I posted from) are 64
> > bit. I thought it was clear what I was talking about as we were
> > discussing getting 16-byte alignment.
> >
> 16-byte alignments are needed for SSE support on both 32- and 64-bit
> OS. Various compilers for 32-bit linux handle it in incompatible ways.
> You could get into trouble calling a vectorized gcc or gfortran
> function from ifort, for example. malloc() gives 4-byte alignment on
> 32-bit Windows (even scalar double precision performance may suffer),
> and 8-byte on linux.
> Windows and linux 64-bit both adopted 16-byte alignment as a default.
> If malloc() doesn't give a 16-byte aligned pointer, that's a bug. The
> URLs you referenced indicate that gfortran already has resolved the
> ALLOCATABLE problem as far as 64-bit linux is concerned. Solaris is the
> only 64-bit OS I know of which has trouble here.
>
I think we keep miss-interpreting each other :). My 64-bit systems do
not have any problem at all, so no bugs in malloc. I was simply
explaining that I was aware of 64 bit systems being common, but my
desire to sort out the 16 byte alignment (with respect to the default
8 byte mentioned in the posts I linked to), implied I was talking
about 32 bit systems. I should have been clearer on that, I'm sorry.
Anyway, somebody contacted me off list to suggest I use the shiny new
iso_c_bindings to call fftw_malloc. I knew of the bindings, but didn't
realise I could coerce a fortran array pointer to take data allocated
in c. I'm now enlightened and it works perfectly!
So I regard this issue (of mine) now solved, and think the c bindings
technique is better than fiddling with gfortran internals, so I won't
try and make any patches to wrap gfortran's malloc.
Sorry for creating so much noise on this list and thanks for all the
helpful replies!
Best regards,
John