News  
   Publications  
Help  
Training  
Labs  
Contacts  
Connecting  
About  
Purchases  
Policies  
TTU Home  
DWMCC Home  

"Batch"-ing It

Would you like to save yourself some time and trouble? Consider using batch jobs. A batch job allows you to perform time-consuming tasks without tying up a terminal for long periods of time and allows the CPU to be allocated more equitably to all users. If you submit a program as a batch job rather than run it interactively, you can then log off and come back later when your program has finished running to view the results. If you've used SAS or SPSS on Gemini, then you've already had experience with batch jobs. However, any program that uses more than about 1 minute of CPU time should be run as a batch job.

There are two steps involved in running a program as a batch process: 1) you create a DCL command procedure and 2) you submit the command procedure to a batch queue.

Creating a Command Procedure:

Using your favorite text editor, create a DCL command procedure: a file which contains basically the same commands that you would type in if you were logging in to your account and running the program interactively. For example, let's suppose that you had a program named SPECTRUM.EXE (already created by compiling and linking SPECTRUM.FOR) which is located in your STAN subdirectory. The program takes as its input three numbers. Here is a command procedure (which we'll name RUNSPECTRUM.COM) you might create in order to run the program in batch mode:

                            $ set default [.stan]
                            $ run spectrum 
                            345
                            670
                            217
                            $ dir

Note that each line of the command procedure begins with a $ unless it is actually data to be read by the program. You could have additional lines in the command procedure to redirect output to a specific file, pass parameters to the program, and so on.

Submitting the Command Procedure to a Batch Queue:

To submit the above command procedure, you would type the following command at the VMS $ prompt:

submit/noprint/notify/queue=QUE runspectrum

where QUE is either EXPRESS, BATCH10, BATCH30, BATCH60 or UNLIMITED. Use the EXPRESS queue for jobs requiring less than 1 minute of CPU time, BATCH10 for jobs under 10 minutes, BATCH30 for jobs under 30 minutes, BATCH60 for jobs under an hour, and UNLIMITED for longer jobs. Before submitting a program to the UNLIMITED queue, please check with Paul Tsai or Barbara Goodson to make sure there is not a problem with your program which is making it run for long periods of time.

You will receive a message once your batch job has finished executing. The output from your program is located in a LOG file (e.g. runspectrum.log) found in your top-level directory. Since a batch job is a process that logs in under your username and executes your login.com (if you have one), the output in the log file will include the contents of the login.com. If parts of the login.com file should not be executed in batch, you can modify your login.com file to use the F$MODE lexical function to check for a batch job and skip those parts.

You may think that running a program interactively rather than as a batch job might be much faster. This is only true for programs using small amounts of CPU time. Any program which uses large amounts of CPU time will be detected by the system and its access to the CPU reduced so that the actual turnaround time will be just as long as for a batch job. So save yourself the trouble of waiting at your terminal for hours and run it in batch!

For more information about running batch jobs, type either INFO BATCH or HELP SUBMIT at the $ prompt, or contact Help Desk at 3975.

The Computing Connection, Vol 3, No 2, January 1993
D. W. Mattson Computer Center, Tennessee Technological University


This page maintained by: Lauren Neal
For additional information, contact Lauren Neal, LNeal@tntech.edu
Last updated: December 11, 1998