Re: user-defined alignment in gfortran



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.)

Though I have complained much in the past about the Microsoft
compilers that didn't offer any more than four byte alignment since
that was good enough for the 486.

I presume your statement about C is really about a specific
C compiler. Also, some linkers may have the ability to
specify alignment for external symbols.

-- glen

.



Relevant Pages

  • Re: user-defined alignment in gfortran
    ... This is necessary on the Cell BE architecture for being able ... How can I do that with gfortran? ... sense that eight byte alignment would be good enough. ...
    (comp.lang.fortran)
  • Re: So how representative is this experience ?
    ... COBOL is different than the other compilers by defaulting to VAX alignment rules. ... Binary fields that are known not to be aligned can be accessed with multiple instructions that don't generate an alignment fault. ... I have several COBOL examples that appear to be much slower on I64 than Alpha all due to alignment faults. ...
    (comp.os.vms)
  • Re: Very Basic question from Newbie
    ... > There could be alignment issues with COMMON and EQUIVALENCE, ... > traditionally COMMON being the cause of alignment problems. ... there happen to be a lot of compilers that violate the standard ...
    (comp.lang.fortran)
  • Re: So how representative is this experience ?
    ... COBOL is different than the other compilers by defaulting to VAX alignment rules. ... Binary fields that are known not to be aligned can be accessed with multiple instructions that don't generate an alignment fault. ... I have several COBOL examples that appear to be much slower on I64 than Alpha all due to alignment faults. ...
    (comp.os.vms)
  • Re: question about nonaligned memory access
    ... The argument pTmp requires 4-byte alignment. ... misaligned access would take a lot longer than an aligned access ... engineer to learn the details of processor’s architecture. ... misalignment is not fatal to the program, ...
    (comp.arch)