Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

VirtualAlloc instead of malloc for Fortran's allocate

Sebi_G_
Beginner
720 Views

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,

Sebi

0 Kudos
3 Replies
Steven_L_Intel1
Employee
720 Views

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

0 Kudos
Sebi_G_
Beginner
720 Views

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 ?

0 Kudos
Steven_L_Intel1
Employee
720 Views

"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.

0 Kudos
Reply