University of Minnesota
Statistics
info@stat.umn.edu
612-625-8046


School of Statistics' home page.

Run a Large Simulation without Angering the Administrators

Introduction

The School of Statistics maintains a network of high-end multi-processor Linux workstations for use in performing simulations and advanced computational tasks. Care must be given however to ensure that the workstations remain available for use by other students in the computer lab and other users wishing to start remote processes. This document is designed to give an overview of how to correctly start, monitor, adjust, and terminate memory and CPU intensive processes.

All Linux processes (commands running) use memory and CPU resources. All processes also have a priority associated with them. Background processes (including all simulations, etc.) must be set at a low priority in order to ensure that the workstation remains usable by others. Furthermore, processes of this nature should be started in the background and the originating user should then logoff so that others may use the workstation. It is NOT acceptable to run processes of this nature at a high priority and it is NOT acceptable to lockup the foreground of a workstation, making it unusable by others. Any such infractions will risk having processes terminated abruptly. Repeated violations may result in loss of computing privileges.

Commands

This document will refer to the following Linux commands: (For more detailed information, type:

 man command
nice starts a new process at a given priority -20 (highest priority) to 19 (lowest priority)
renice resets the priority of an already running process
top displays an overview of processes using the most resources
ps displays process information
kill terminates a process
nohup starts a process that is not dependent on the initialization shell (output in nohup.out)
& starts a process in the background
fg brings a background process to the foreground

top

How to view current users, performance & priorities of running processes on a system:

 $ top

Give output similar to:

 PID USER   PR  NI  VIRT  RES SHR S %CPU %MEM  TIME+  COMMAND
 4166 mayotte  15  0  160m  97m 22m S 4.0  9.8  13:04.94 firefox-bin
 ...

(Ctrl-C to terminate top)

This shows that the user “mayotte” is running “firefox-bin” at priority (NI) 0 and it is currently using 4.0% of CPU resources and 9.8% of memory resources. If either of these % is above 25%, the process should be reniced to a lower priority (i.e. 19).

Priority

How to start a process in the background at a low priority:

 nohup nice -n19 command &

Here's an R example:

 nohup nice -n19 R CMD BATCH [options] my_script.R [outfile] &

How to reset the priority on a running process:

  1. find PID number:

ps -u | grep command

  1. Reset the priority:

renice -n19 -p number

Selecting

Workstations to use for simulations (in order of preferences): Look at the output from the following command run from any STAT workstation:

To get a list of lab machines from ssh.stat.umn.edu:

/pkg/stat-apps/bin/grephosts LAB

Best choice Dedicated compute machines # grephosts LAB-C
Second best Lab machines # grephosts LAB
Third Private machines (with permission) # grephosts machine_name