Site Map Online Directory
  Search Information Technology   Northwestern University  
YOU ARE HERE >   NUIT > SSCC > Bulletins > Run a Bunch of Jobs on the Compute Servers
Run a Bunch of Jobs on the Compute Servers

About the SSCC

Cluster Report (NU Restricted)

HOWTOs

Bulletins

Statistical Software

Statistical Software Manuals

Additional Resources

Migration Information

Social Science Data Services

Kellogg Research Computing

Depot File Service

Improving Social Science Research Computing (PDF)

Contact List

Services

Get Connected

Support

Educational Resources

NUIT

Run a Bunch of Jobs on the Compute Servers


How to Run a Bunch of Jobs on the Compute Servers:

A Shell Script to Run Background Jobs Sequentially

When you have a number of jobs to run on the interactive compute servers, it's most efficient to run them sequentially, one after the other. That way, the jobs don't compete against each other for possibly scarce resources, you're sharing the computing system in an equitable manner, and you'll receive the results from your jobs more quickly than if you were to run them all at once on the same system.

It is best, however, to run long jobs in the PBS batch system. See How to Submit a Single Batch Job. The batch system has many CPUs at its disposal, and will run up to 8 jobs per user at the same time, with each job having exclusive access to a CPU.

The following script suggests how to run short jobs in the background on the interactive compute servers. In this example, we run SAS twice. The SAS Log file is emailed at the end of each job, indicating that the job is finished.

Copy the following example into a file. Substitute your own email alias for alias in the script.

#!/bin/sh
# Run a bunch of jobs sequentially
sas job1
mail -s "Job 1 Finished" alias@northwestern.edu <job1.log >/dev/null
sas job2
mail -s "Job 2 Finished" alias@northwestern.edu <job2.log >/dev/null

Let's assume that this script is named bunch. You have to make sure you have u=rx permissions on the script. Use the command chmod u=rx bunch to set the permissions. Then just run the bunch script in the background. (Type the command bunch & ) You'll be notified by email after each step is completed.

You can also use this technique with programs like Matlab, Stata and GAUSS. Be cautious, however, about the size of the file you are mailing to yourself. These files can be large! In cases like that, you might want to send yourself an empty notification. Change the mail steps as follows:

mail -s "Job 1 Finished" alias@northwestern.edu </dev/null >/dev/null


Checking Your Background Processes

Your background job will continue to run after you logout. You can login again later on the same interactive compute server and check your job's progress , in terms of CPU time accumulated, with the command

ps -x

The -x option reports all running processes owned by your account, including those not associated with your current login session.


Why is it optimal to run jobs sequentially on an interactive server?

Consider the situation where you have five identical jobs to run, each of which will take 24 hours to finish. The computer you're using has a single CPU. If you start all five jobs at the same time, they will share computer resources equally, and they will all finish at the same time -- five days after they start.

On the other hand, if you run the jobs sequentially, one after the other, your first job will finish after one day, and you will be able to view its results. The second job will finish at the end of the second day, and you will then be able to view its results. And so forth, until the last job is complete.

On the average, you'll see your results in 3 days, rather than 5 days! Most certainly, you'll see the results of four of the five jobs in less than 5 days, whereas if you had run all 5 jobs simultaneously, you would not see any results at all until the end of the fifth day.

Furthermore, by running your jobs one at a time, you are minimizing the additional load on the computer to just one job. That helps keep the overall load on the interactive compute server down, making it more usable for everyone involved.



Computer and Network Security

E-mail, NetID, and Password

Hardware

Listserv

Network Services

NUTV and TV Services

Policies and Guidelines

Reserve a Facility

Service Status

Software

Telephone Services

Videoconferencing Services

Web Publishing Services

Webcasting

Webmail

Off-campus Connections

Safe access to the NU Network (VPN)

Wired Connection

Wireless access

Departmental Desktop and Server Support

NUIT Help

Student Support

Computer Labs

Course Management System (Blackboard)

Learning Opportunities

Smart Classrooms

about NUIT

Job Opportunities in NUIT

News, Press, and Publications

What's New & Changing with Technology @ NU?