|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri May 18, 2012 10:06 pm Post subject: ALIGN attribute is not working |
|
|
In the code below, the real*4 array A should be aligned on 16 byte (128 bit) address boundarys.
Unfortunately it doesn't seem to work.
Code: |
program anon
real, align(128) :: a(12)
integer :: addr
a = 0.0
addr = loc(a(1))
if (mod(addr,16) == 0) then
print *,'Array is aligned on 128 bit boundary''s. It worked!'
else
print *,'Oops, it didn''t work'
end if
end
|
_________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Mon May 21, 2012 9:32 am Post subject: |
|
|
David,
This might provide more info, but does not appear to work. Code: | program anon
real, align(128) :: a(12)
real, align(64) :: b(12)
integer :: addr_A, addr_B
!
a = 0.0
b = 0.0
addr_A = loc(a(1))
addr_B = loc(b(1))
write (*,*) 'A align = ',addr_A, mod (addr_A,32)
write (*,*) 'B align = ',addr_B, mod (addr_B,32)
!
if (mod(addr_A,16) == 0) then
print *,'Array is aligned on 128 bit boundary''s. It worked!', addr_A
else
print *,'Oops, it didn''t work' , addr_A
end if
!
end
|
John |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Mon May 28, 2012 6:24 am Post subject: |
|
|
Paul,
I tested my above code example and :
It worked for FTN95 Ver 6.10 using salflibc.dll Version 13.3.23.20, on XP_64,
but failed for FTN95 Ver 6.10 using salflibc.dll Version 13.12.2.9, on Win7_64
The compiler crashed with small changes to the code when I first tried to change David's code to introduce align(64). The error results from the following change.
Code: | program anon
real, align(128) :: a(12)
real, align(64) :: b(12)
integer :: addr_A, addr_B
!
!a = 0.0
!b = 0.0
addr_A = loc(a(1))
addr_B = loc(b(1))
write (*,*) 'A align = ',addr_A, mod (addr_A,32)
write (*,*) 'B align = ',loc(b), mod (loc(b),32)
!
if (mod(addr_A,16) == 0) then
print *,'Array is aligned on 128 bit boundary''s. It worked!', addr_A
else
print *,'Oops, it didn''t work' , addr_A
end if
!
end
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|