[gmx-users] disable ulimit

Ansgar Esztermann aeszter at gwdg.de
Mon Jun 29 17:58:51 CEST 2009

Hi Gustavo,

On Jun 24, 2009, at 20:48 , Gustavo Fioravanti wrote:

> we are trying to run mdrun_mpi in a public cluster of our  
> university. However, we got the following error:
> /etc/profile.d/limits.sh: line 1: ulimit: max locked memory: cannot  
> modify limit: Operation not permitted

There are two kinds of ulimits, soft and hard. Hard limits cannot be  
increased, so maybe you try to exceed a hard limit here?

> /var/tmp/sge_local_spool/r01n19/job_scripts/3051: line 10:  
> grompp_mpi: command not found
> The cluster has already settled to unlimited access to memory.  
> However, grompp hasn't have permission to modify this file  
> (limits.sh).

I do not think grompp tries to modify the file. The error message  
above seems to point at limits.sh not being allowed to raise the  
limit. Did you talk to your sysadmin? They should be able to raise the  
limit. BTW, note that the limit in question here is not memory per se,  
but locked memory.
> I would like to disable the ulimit function at source file from  
> GROMACS. How can I do that?

Try to do it from a script (or by hand) before starting gromacs, like  
ulimit -l unlimited

Modifying the limit from the program is also possible, but a little  
bit more involved (this code should work on Linux; on other systems,  
things might be a bit different):

#include <sys/resource.h>

struct rlimit unlim = {RLIM_INFINITY, RLIM_INFINITY};
int err = setrlimit(RLIMIT_MEMLOCK, &unlim);

/* error handling skeleton; based on the error message given above,  
you will probably get EPERM */
if (err)
   switch (errno)
     case EFAULT: /* limit points outside address range */

     case EINVAL: /* invalid resource, or soft > hard */

     case EPERM: /* unprivileged process tried to raise hard limit */


Ansgar Esztermann
Max-Planck-Institut für biophysikalische Chemie, Abteilung 105

More information about the gromacs.org_gmx-users mailing list