Alignment of gfortran allocated arrays
Tim Prince
tprince@computer.org
Fri Aug 17 18:06:00 GMT 2007
John Travers wrote:
> On 17/08/07, Tim Prince <tprince@computer.org> wrote:
>
>> malloc() hardly qualifies as a gfortran internal.
>>
>
> I never meant to imply that it was.
>
>
>> It has been around
>> since long before gfortran or SSE. The 32-bit glibc malloc(), if that's
>> what you're discussing, is likely to continue as it has been for over 10
>> years, supporting double precision but not SSE objects. Note that
>> gfortran runs on a lot of systems besides those which depend on 32-bit
>> glibc, so if that is your world, you might clarify your posts by so
>> stating. As there aren't any more CPUs manufactured which don't support
>> 64-bit OS, you might take into account that many of us use 64-bit. Not
>>
>
> 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.
More information about the Fortran
mailing list