- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
------------------------------------
common /coords/e,n,h
integer*4 e! easting
integer*4 n! northing
integer*4 h! height
end type CoordsType
integer*4 e! easting
integer*4 n! northing
integer*4 h! height
end type CoordsType
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try inserting "sequence" into your type definition
Code:
type CoordsType sequence integer*4 e ! easting integer*4 n ! northing integer*4 h ! height end type CoordsType
I have experimented with this somewhat and found that changing from individual arrays to a defined type may exhibit a performance hit. The IA32 and IA64 processors instructions can scale at 1, 2, 4, and 8 but not 12 as your declared type requires. If you have performance requirements then I would suggest you keep the arrays seperate.
An alternate approach is to add an additional integer*4 padd variable into CoordsType to make the structure 16 bytes long. Then using the !DEC$ features you can declare 16 byte alignment and then require SSE3 instruction formats in your properties. With this all 4 elements can be moved and sometimes processed in one instruction. e.g
do I=1,size(coords)
coords(I) = coords(I) + coordsOffset
end do
where coordsOffset is of CoordsType
If properly setup, the compiler can generate code to process all 4 elements of the CoordsType in parallel using SSE3 instructions. You will get a significant boost in performance (at the expense of some memory).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I added the SEQUENCE statement and it's OK.
The actual record was more complex being 23 bytes long, the longest being 8 bytes.
There was a message to say that the total bytes was not a multiple of the largest elemt. The largest element was 8 bytes so I added a 1 byte packing element and it is OK.
Thanks again,
David

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page