How to increase shared memory limits on Linux?

CFX V 13.0 Solver terminates with error
"Cannot create shared memory segment of XXXXXX bytes"

The ANSYS CFX solver could not be started, or exited with return code 255.

Original error occurred On Linux Redhat 5

User had already increased configurable shared memory limit from 32 to 64 and even tried 128MB but the error persisted. Machine had been reboooted after the reconfig as required


The CFX Solver error message does not indicate the actual problem. HP-MPI complains that it couldn`t allocate `shared` memory when in fact the problem appears to be a lack of `unlocked` memory. Increasing shared memory limits won`t do any good unless the locked memory limits are increased first.

If the memlock limits are not explicitly set in the file limits.conf, then the default is 64KiB. This appears to apply to all Linux platforms.


Appending this one-liner to the file /etc/security/limits.conf fixes the problem:

* - memlock 33554432


What the above means is that for any user, both the hard and soft limits for locked memory is 32GiB (limit is set in units of KiB). The recommendation is to set this value to about ½ of physical RAM. (The default limit is something miniscule like 64KiB.) The same recommendation also applies to shared memory. Here are the relevant lines in the user's /etc/sysctl.conf:


kernel.shmall = 8388608

kernel.shmmax = 67108864

kernel.shmmni = 512



where kernel.shmall is in units of pages (4096 Bytes/page on our system), kernel.shmmax is in units of Bytes and kernel.shmmni is the max allowed number of shared memory segments.





Show Form
No comments yet. Be the first to add a comment!