PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Memory alignment in Fortran

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
MattD



Joined: 20 Aug 2007
Posts: 6
Location: Greenville, TX

PostPosted: Fri Sep 07, 2007 1:35 pm    Post subject: Memory alignment in Fortran Reply with quote

I've got a hankering to align my allocatable arrays in Fortran on 16-byte boundaries (i.e., the first address ends in binary 0000). There doesn't seem to be any simple way to do this with pgfxx (or any other Fortran compiler, given what I've found on Google).

Any chance there is a pgfxx compiler option or non-standard version of ALLOCATE that I just don't know about?

If not, does anyone out there have good workaround suggestions for how to accomplish this?

So far, the only way I've been able to get this done is pretty ugly: call a C program from Fortran, create the variable and allocate it's memory in C, then pass that variable back to Fortran. It's hideous because you can't simply return from C to the original Fortran routine. You've got to go another layer deep to hold onto the new block of memory. It just feels wrong.

Any thoughts, anyone?

-Matt
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Fri Sep 07, 2007 5:42 pm    Post subject: Reply with quote

Hi Matt,

Memory alignment is determined by the OS and on 64-bit Linux and Windows it should be 16-byte aligned. A 32-bit OS should be 8-byte aligned. Are you using a 32 or 64-bit system?

- Mat
Back to top
View user's profile
MattD



Joined: 20 Aug 2007
Posts: 6
Location: Greenville, TX

PostPosted: Mon Sep 10, 2007 12:17 pm    Post subject: Reply with quote

Mat,

It is a 64-bit operating system. And you're right --- I put in some checks, and I am getting 16-byte alignment. I think my problem may be some indexing that's too clever for its own good.

Chalk this one up to user error.

Thanks,

-Matt
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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 © phpBB Group