Re: user-defined alignment in gfortran



glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> schrieb:
Dr Ivan D. Reid wrote:
On Tue, 29 May 2007 00:22:30 +0000 (UTC), Timo Schneider
<timos@xxxxxxxxxxxxxxxxxx> wrote in <slrnf5ms51.2q2.timos@xxxxxxxxxxxxxxxx>:

How do I tell gfortran to allign a complex*16 array at 16 byte
boundaries? This is necessary on the Cell BE architecture for being able
to do DMA transfer. In C I can write __attribute__((aligned(16))) and
it works. How can I do that with gfortran?

I wouldn't think you'd have to. I'd expect it to happen
automagically. ...or are you trying to align things up within a derived
type? Usual advice in that case is to assign your type/structure from
the largest elements down to the smallest, with character*? at the end.

Since a COMPLEX*16 variable is operated on, as far as Fortran is
concerned, as two eight byte real values it would seem in that
sense that eight byte alignment would be good enough. (It would
be interesting to have a processor with complex operations.)

Mm, why? If I have a COMPLEX*16 variable placed somwhere with eight byte
alignment, there can be two cases: It is 16 Byte aligned or not, in
that case only the second part of the variable falls together wih a 16
bit boundary.

I presume your statement about C is really about a specific
C compiler.
Yep, gcc.

Regards,
Timo
.



Relevant Pages

  • Re: Optimizing Static Variable Layout
    ... Data alignment is a well-understood issue. ... various boundaries, ... A boundary that is compatible with the first object in a declaration ... the assembler introduces inefficiencies into their code. ...
    (alt.lang.asm)
  • Re: struct.pack behavior
    ... |> Alignment -- read the manual. ... and longer objects to be on 4 or 8 byte boundaries. ... packing "HB" puts a short at offset 0 and then a byte. ...
    (comp.lang.python)
  • Re: struct.pack behavior
    ... |> Alignment -- read the manual. ... and longer objects to be on 4 or 8 byte boundaries. ... packing "HB" puts a short at offset 0 and then a byte. ...
    (comp.lang.python)
  • Re: user-defined alignment in gfortran
    ... This is necessary on the Cell BE architecture for being able ... How can I do that with gfortran? ...
    (comp.lang.fortran)
  • Re: What is const char * const *p;
    ... Then, how do I assert that a given object is aligned, say, ... on 32-byte boundaries, then you also know that both all actual objects ... demands anything about the alignment of any type except that several ... have no stricter alignment requirements than to sizeof. ...
    (comp.lang.c)