"Pinned" allocate

Janne Blomqvist blomqvist.janne@gmail.com
Sat Jan 5 21:26:00 GMT 2013


On Thu, Jan 3, 2013 at 4:06 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> On Thu, Jan 03, 2013 at 11:12:06AM +0100, Thomas Koenig wrote:
>> Hello Al,
>>
>> > Is there a way to do a "pinned" (i.e. page-locked in physical memory) allocate in gfortran?
>> > If not, I suggest an extension to the ALLOCATE statement with an option PINNED='YES' or 'NO'.
>>
>> Gfortran currently does not have such a functionality.  If you have a
>> system which supports this, you can do it yourself using mlock and
>> the C interoperability feature.  Example (untested):
>>
>
> According to the FreeBSD man page, mlock and munlock are
> available only to the superuser.  I suspect that this
> restriction applies to other operating systems.

On Linux the amount of memory an unprivileged user can lock is limited
by the RLIMIT_MEMLOCK soft resource limit, which works like the other
RLIMIT_ things (see e.g. limits.conf, ulimit, {get,set}rusage). That
being said, needing to lock memory is a bit esoteric use case
particularly for your typical Fortran program, so I think Thomas
solution is preferable to adding yet another non-standard extension.

-- 
Janne Blomqvist



More information about the Fortran mailing list