Re: user-defined alignment in gfortran
- From: pa@xxxxxxxxxxxxxxxxxxxxx (Pierre Asselin)
- Date: Tue, 29 May 2007 23:51:38 +0000 (UTC)
Timo Schneider <timos@xxxxxxxxxxxxxxxxxx> wrote:
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?
If a static buffer will do the job, you can do the layout in C and
get to it from Fortran by a common block. The old g77 method
of matching a common to a C struct still seems to work with gfortran.
This is not portable because it relies on gcc extensions and
on the gcc/gfortran ABI, but that may be okay too, given that
you are targetting a specific platform.
$ cat test.f90
program test
implicit none
complex(kind(0.0d0)), dimension(10):: x
common /coucou/ x
print *, x
end
$ cat test2.c
struct {
double c[20];
} __attribute__((aligned(16))) coucou_= {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11,12,13,14,15,16,17,18,19,20,
};
$ gfortran test.f90 test2.c && ./a.out
( 1.00000000000000 , 2.00000000000000 )
<snip>
( 19.0000000000000 , 20.0000000000000 )
--
pa at panix dot com
.
- References:
- user-defined alignment in gfortran
- From: Timo Schneider
- user-defined alignment in gfortran
- Prev by Date: Re: IF statements
- Next by Date: F77 & WIN XP
- Previous by thread: Re: user-defined alignment in gfortran
- Next by thread: IF statements
- Index(es):
Relevant Pages
|