Shared Memory Configuration


Allocating Sufficient Shared Memory

McIDAS-X uses shared memory for frame allocation. On some operating systems, the shared memory facility is activated by default and has a sufficient maximum segment size for most McIDAS-X sessions. However, this is not always true for Linux or Mac OS X systems. The system administrator must check and, if necessary, force the kernel to activate the shared memory system at boot time and set the maximum segment size to 512 MB or greater the first time McIDAS-X is installed on a Linux or Mac OS X workstation.

The McIDAS Users' Group uses the following settings on Linux, and Mac OS X.

Red Hat Enterprise/CentOS Linux
The system administrator must complete the steps below the first time McIDAS-X is installed on a Red Hat Enterprise Linux workstation.
  1. Edit the file /etc/sysctl.conf.
  2. Check for lines similar to the three below. If the lines do not exist then add them to the end of the file. If the lines exist and are set to the value below (536870912) or greater you can leave them as is. If the lines exist but are set to a smaller value, change the values to those below.

    kernel.shmmax = 536870912
    kernel.shmmax = 536870912
    kernel.shmall = 536870912
    kernel.shmmni = 131072
  3. Run the following command from the Unix prompt.

    Type:  /sbin/sysctl -p

Every time the machine reboots, the shared memory will be set to the value set above.

Allocating Sufficient Swap Space

If your system has less than the sum of the memory requirements described in the A Note About Memory section above plus overhead for the OS and other programs, you may experience slower performance as memory is swapped to disk. This is normal behavior and can be alleviated by adding additional physical memory. If both memory and swap are exhausted, the kernel will kill your user processes, including any McIDAS-X tasks, and log you out. More swap space can be added by modifying your filesystem configuration or by creating a new swap file of the desired size. See the Swap Space chapter of the Red Hat Enterprise Linux Storage Administration Guide for more information.

Increasing the Stack Size

Some Linux operating systems have hard and soft limits on the stack size that are too small for large local grids. This results in commands like GRDDISP giving an Error: Unix system stack size on server machine insufficient for grib decoding message when trying to display those grids. If this occurs you will need to increase the stack size limits by editing the /etc/security/limits.conf file and adding the lines below.

* hard stack 20480
* soft stack 20480

macOS Workstations

Read the section below and complete the tasks as instructed.

Allocating Sufficient Shared Memory

McIDAS-X uses shared memory for frame allocation. On some operating systems, the shared memory facility is activated by default and has a sufficient maximum segment size for most McIDAS-X sessions. However, this is not always true for macOS systems. Therefore, on macOS systems the system administrator must complete the steps below to check and, if necessary, force the kernel to activate the shared memory system at boot time and set the maximum segment size to 512 MB or greater the first time McIDAS-X is installed on a macOS workstation. Note: The 4.9 GB of shared memory in the A Note About Memory example above does not have to be allocated in one large block. Shared memory is made up of multiple segments, whose minimum size is determined by the system memory requirement of one frame.

  1. As user root, create the launchctl startup script /Library/LaunchDaemons/edu.wisc.ssec.sharedMemory.plist with the content below.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>edu.wisc.ssec.sharedMemory</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/sbin/sysctl</string>
    <string>-w</string>
    <string>kern.sysv.shmmax=536870912</string>
    <string>kern.sysv.shmall=131072</string>
    <string>kern.sysv.shmmin=1</string>
    <string>kern.sysv.shmmni=128</string>
    <string>kern.sysv.shmseg=32</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>

    Note the relationship between shmall and shmmax. shmall is the number of pages (4k in size) and shmmax=shmall*4096. The example values above allow shared memory to be addressed in 512 MB segments.

  2. As user root, load the new .plist file created in step 1.

    Type:   launchctl load /Library/LaunchDaemons/edu.wisc.ssec.sharedMemory.plist

  3. Reboot the workstation.

NOTE: If you previously allocated shared memory on your OS X/macOS workstation, you must remove those changes so they don't conflict with the new settings above. (The previous procedure was valid for OS X versions 10.11 and earlier that were supported on those versions of McIDAS-X. Starting with version 2017, McIDAS-X is supported on OS X/macOS versions 10.11 and later, which use the new procedure in steps 1 through 3 above for allocating shared memory.)

To remove the previous settings so they don't conflict with the new ones, first check whether file /etc/sysctl.conf exists. If it does, and if it contains five kern.sysv.shm* lines like those in the example below, remove them from the file.

kern.sysv.shmmax=536870912
kern.sysv.shmmin=1
kern.sysv.shmmni=128
kern.sysv.shmseg=32
kern.sysv.shmall=131072