[Wien] Running Wien2k on a MacPro OS 10.7.3 - setrlimit(): Invalid argument

Laurence Marks L-marks at northwestern.edu
Fri Apr 13 20:10:48 CEST 2012


I am not exactly sure. Michael Sternberg (who I am cc'ing) looked into
this as he has a Mac and I don't. The issue relates to differences in
the calls to setrlimit and perhaps getrlimit which seem to be
different for a Mac. (Alas, system calls are often not as standard as
Fortran.) There were some problems which I thought we fixed, but I
seem to remember that we never heard back if the latest modification
worked. The version I have has (in W2kutils.c) has the subroutine.

void w2k_extend_limits()
{
    struct rlimit limit;

    /* Get current limit */
    if (getrlimit(RLIMIT_STACK, &limit) != 0) {
        perror("getrlimit(): WARNING: Cannot find stack limits, continuing");
    }

    /* Set to the maximum we can */
    /* Some systems do not allow RLIM_INFINITY */
    /* Extend to current hard limit ("ulimit -S -s hard" in bash) */
    limit.rlim_cur = limit.rlim_max ; /* RLIM_INFINITY */

    if (setrlimit(RLIMIT_STACK, &limit) != 0) {
        perror("setrlimit(): WARNING: Cannot raise stack limit, continuing");
    }
}

Please check this against your version. (Michael, I think this is your
version except I allowed the code to continue.)

The worst case solution is to comment out the line "       call
w2k_extend_limits()" in W2kinit.f but I would not like to do this in
general. The reason is that this call avoids the user having to run
the ulimit command which sometimes they forgot to do and (worst) is in
fact almost impossible to do with openmpi (deliberate by the openmpi
designers). There used to be numerous mails on the list about SIGSEV
due to ulimit which have now gone away.

A better solution is something which can adapt to the fact that the
compilation is on a Mac, e.g. something like.

#ifdef I_Have_A_Mac
...
#else
...
#endif

Please let me know what you find; we (perhaps more Michael) can probably help.

On Fri, Apr 13, 2012 at 12:42 PM, Aaron Sutton
<asutton at physics.utoronto.ca> wrote:
> Hi,
> Thanks for the response. I found
> http://zeus.theochem.tuwien.ac.at/pipermail/wien/2011-July/015120.html
> in the mailing list archive which describes patching the W2kutils.c &
> W2kutils.h files in lapw0,1,2, though this is not mac specific. I did
> this and recompiled but still get the setrlimit():invalid argument
> error. Is it possible that I'm using an outdated version? I would have
> downloaded it sometime in November 2011.
>
> ----------------------------------------------------------------------------
> Aaron Sutton
> Ph.D. Candidate | University of Toronto
> Office: McLennan MP090 | Phone: +1 416 946 3639
> Email: asutton at physics.utoronto.ca
>
>
>
> On Thu, Apr 12, 2012 at 16:56, Laurence Marks <L-marks at northwestern.edu> wrote:
>> You are right, Mac is not standard linux and restricts the rights of
>> users to do things such as setting ulimit (which is done now in the
>> code to avoid problems). Please search the mailing list -- I think a
>> Mac specific patch was posted some time ago.
>>
>> On Thu, Apr 12, 2012 at 3:53 PM, Aaron Sutton
>> <asutton at physics.utoronto.ca> wrote:
>>> Hi,
>>> Hoping someone can help with running Wien2k on a Mac under 10.7.3
>>> Lion. Everything compiled fine using gcc & intel fortran 11.1. The
>>> calculation initializes fine, but as soon as I start the calculation I
>>> get "setrlimit(): Invalid argument", which is apparently a mac
>>> limitation. How do I avoid this setrlimit issue? I can run Wien2k
>>> perfectly fine under linux in a VM but I'd prefer to run it natively.
>>>
>>> Thanks very much.
>>> ----------------------------------------------------------------------------
>>> Aaron Sutton
>>> Ph.D. Candidate | University of Toronto
>>> Office: McLennan MP090 | Phone: +1 416 946 3639
>>> Email: asutton at physics.utoronto.ca
>>> _______________________________________________
>>> Wien mailing list
>>> Wien at zeus.theochem.tuwien.ac.at
>>> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>>
>>
>>
>> --
>> Professor Laurence Marks
>> Department of Materials Science and Engineering
>> Northwestern University
>> www.numis.northwestern.edu 1-847-491-3996
>> "Research is to see what everybody else has seen, and to think what
>> nobody else has thought"
>> Albert Szent-Gyorgi
>> _______________________________________________
>> Wien mailing list
>> Wien at zeus.theochem.tuwien.ac.at
>> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien



-- 
Professor Laurence Marks
Department of Materials Science and Engineering
Northwestern University
www.numis.northwestern.edu 1-847-491-3996
"Research is to see what everybody else has seen, and to think what
nobody else has thought"
Albert Szent-Gyorgi


More information about the Wien mailing list