Re: user-defined alignment in gfortran
- From: Timo Schneider <timos@xxxxxxxxxxxxxxx>
- Date: Tue, 29 May 2007 22:45:37 +0000 (UTC)
Louis Krupp <lkrupp@xxxxxxxxxxxxxxxxxxxxxxx> schrieb:
Timo Schneider wrote:
Richard Maine <nospam@xxxxxxxxxxxxx> schrieb:
glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> wrote:
No hardware that I know of has instruction that operate onReread the original post. He was not talking about Fortran operations on
complex data. There is no complex add or complex multiply
instruction. Operations are done on separate real and imaginary
parts using ordinary floating point instructions.
the complex data. He specifically cited DMA transfer as the reason for
the request and he said it was a specific array. Doesn't sound to me as
though it directly had anything to do with it being complex, but just
that this particular array was the one involved withthe DMA transfer.
Yes! I dont care about the type of the array, I just want the array to
be 16-byte aligned.
I can tell you how I would do it in C; you could probably do something
similar in Fortran, although you might give up some portability.
I think I actually gaining "portability" by the aproach described below,
because in that way I don't have to impose restrictions on the caller.
(The code I write which reads the array is a library written in C but
called by (mainly) Fortran).
Start with the assumption that dynamic allocation will give you an
address that is eight-byte aligned, so figure out how many real*8
elements you need, and add one. Do the allocation. Pass the returned
address to a C routine that will tell you if it's on a 16-byte boundary.
If it's on a 16-byte boundary, use that address. If it's not, check
to make sure that it *is* on an 8-byte boundary, and use the address of
the next element, which *will* be on a 16-byte boundary.
Yeah, this is exactly what I do right now as a "workaround". The only
problem with this aproach I see right now is that if I want to get the
first element of an arry which is 8 but not 16 bytes aligned I have to
read 8 bytes of "junk" before the start of the array.
Now it could (theoreticaly) happen that the memory of these 8 bytes
"junk" do not belong to my application an we get a segfault.
Maybe you can think of a workaround for this or can prove me that the
case discribed obove can't hapen? I *believe* that it can't happen if
the pagesize is a multiple of 16, but I didn't look into this long
enough to be sure about it or to be able to determine the pagesize
(shoukd be somewhere inside the specs or kernel code).
Regards,
Timo
.
- References:
- user-defined alignment in gfortran
- From: Timo Schneider
- Re: user-defined alignment in gfortran
- From: Dr Ivan D. Reid
- Re: user-defined alignment in gfortran
- From: glen herrmannsfeldt
- Re: user-defined alignment in gfortran
- From: Timo Schneider
- Re: user-defined alignment in gfortran
- From: glen herrmannsfeldt
- Re: user-defined alignment in gfortran
- From: Richard Maine
- Re: user-defined alignment in gfortran
- From: Timo Schneider
- Re: user-defined alignment in gfortran
- From: Louis Krupp
- user-defined alignment in gfortran
- Prev by Date: Re: strange arguments passing problem (from vba to fortran dll)
- Next by Date: Re: I am looking for library from Lahey Fortran 95 v.5.5
- Previous by thread: Re: user-defined alignment in gfortran
- Next by thread: Re: user-defined alignment in gfortran
- Index(es):
Relevant Pages
|