17: Graphical Tools | 16: Programming | Compiling Fortran | Compiling C |
When running programs on a shared machine, it is important to be aware of how your program consumes resources. If your program consumes many resources, you must be careful not to interfere with other users. If you are working with large arrays, or if your program takes more than a few minutes (i.e. about 1/2 hour or more) you can reasonably assume that it is affecting other users.
If you need a lot of memory (greater than 32 Meg) you will want to use
goophy
or daphy
to do your work. However,
goophy
and daphy
are primarily for class use.
Therefore, if you need to run a large research program on the cluster, it is
recommended that you do so between 10 pm and 8 am. If you run a large job on
goophy
or daphy
during the daytime, it will be
killed.
If your program takes a long time to run, but not a lot of memory you should
run it on one of the fruit loop (banana
, coconut
,
guava
, graphy
, mango
or
papaya
) machines. In addition, out of consideration for other
users, you should use nice
. Nice
places your job at a lower
priority (it can also be used to place your job at a higher priority, but you
should not have permissions for that) than it would otherwise be at, allowing
other programs to run ahead of it. To use nice
type
nice
followed by -15
(the number fifteen is a
parameter you can read about in the man
pages if you are curious)
followed by the command you want nice
eda.out
with nice
:
> nice -15 a.out
While nice
can help keep your job from interfering with other
users, it is not a guarantee against such interference. Because class use has
priority over research on the cluster machines, if your job is making it
difficult for other users to use the cluster machines, it will be terminated.
If you have a very long or memory intensive job, it is suggested that you run
it at night, or at some other low usage time.
To get control of your terminal window while running a long program, you should
run it in the background. To do this type the &
after your
command. For instance:
> nice -15 a.out &
You can now log out without stopping your program.
If you decide you want control back after you have started your program you can
use the ^ Z
ctrl-Z
) command to put
your program in the background.
If you start a program without nice
you can lower its priority
with renice
. To renice
something you need the job
number. To get the job number use the ps
(P
rocess S
tatus) command. If you try a
ps
> ps
you might get something like
PID TTY S TIME COMMAND
11093 ttyp1 S 0:01.40 -tcsh (tcsh)
13805 ttyp1 R 0:00.02 a.out
The far right column lists the commands running under this session. The
-tcsh
line is your terminal and it, or something similar will come
up whenever you use the ps
command. Sometimes the ps
command itself comes up, sometimes it does not. Once you have found the
command you want to renice
look in the far left column for the
process identification number (PID
). In the example given
a.out
has the process number 13805
. To
renice
this command you would type.
> renice -15 13805
If you should decide you no longer want to run a job (for instance if it is
taking too long), you can stop it. If it is running in the foreground (your
terminal is locked up waiting for it) you can use the
^ c
ctrl-c
) command to stop it.
If it is running in the background you can use the you can use the
kill
command. The kill
command also needs the job
number. To kill the example program above you would type:
> kill -9 13805
A kill
may not always work on the first try. You should use a
ps
after a few minutes to check that the program is no longer
running. If the program is still running re-enter your kill
command.
If you remain aware of how you are modifying a program you should be able to estimate the time and memory requirements of your as your programs become larger. Be careful to consider the multiplicative properties of multidimensional arrays. If you double the number of each dimension in your 3-D array, you can expect your memory needs to increase by a factor of eight. Your program time will also likely increase by a factor of eight or more. If you are careful and considerate about when and how you use the cluster resources, we can keep the cluster working well for all users.
17: Graphical Tools | 16: Programming | Compiling Fortran | Compiling C |