VirtualAlloc instead of malloc for Fortran's allocate

VirtualAlloc instead of malloc for Fortran's allocate

Hi there,

is there a way to control whether ifort uses malloc or virtualAlloc "behind" Fortran's allocate statements ?

As far as I've learned from other threads in this forum ifort does switch to virtualAlloc depending on the size of the memory to be allocated. However, I'm wondering if there is a way to control when to switch - which would of course allow to always use virtualAlloc.

Thanks in advance,


4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

No, there is no user control over this. What problem are you trying to solve?

Retired 12/31/2016

Hi Steve,

thanks for your answer.

I'm trying to enforce data locality in an OpenMP parallelization. In the C/C++ world virtualAlloc would give me exactly what I need: reserving the memory, but not yet touching it. So, I can still exploit the first-touch policy as with Linux.

Is there another way to enforce data locality with OpenMP by ifort ?

I have searched quite a bit for it, but havn't found it. All I've found was moving to Fortran 2003 and use c_ptr's to get the C world's freedom. However, that's quite a dirty trick that moreover would require quite some code changes for me. So my hope was some kind of "backwards-enforced" use of virtualAlloc. I cannot really believe it should be impossible to build performant OpenMP applications also for multi-socket machines using ifort. Is it ?

"Impossible"? Certainly not. You're asking for some NUMA-awareness to Fortran ALLOCATE and we don't have that at this time, but there are other ways of allocating memory you can use. I agree it's not as convenient as ALLOCATE. I'll let the OpenMP experts here (of which I am not a member!) offer suggestions.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today