!!!  Translated by Google Translate  !!!

 

In the next few lines, there is an example of a simple script, popis.cmd , used to execute a task that is run by the qsub command.

------------------------------
#!/bin/bash
#PBS -S /bin/bash
#PBS -N myjob.pbs
#PBS -j oe
#PBS -M pepa.novak@cvut.cz
#PBS -m bae
#PBS -l walltime=01:00:00
#PBS -l select=1:ncpus=32:host=altix
#PBS -l place=pack:shared
echo "Starting run at: `date`"
/home/pepa/muj_program
echo "Job finished at: `date`"
------------------------------

#PBS -S / bin / bash Specifies the type of shell to handle the job.
The bash shell will be used to process this task.
#PBS -N myjob.pbs The job name is “myjob.pbs”. If this parameter is omitted, the task is named by default by the script name.
#PBS -j oe Standard output and error output will be merged into one file in the working directory. The job name is appended with “.onnn”, where “nnn” is the sequence number of the job in the PBS system.
#PBS -M pepa.novak@cvut.cz Specifies the address of the user where any messages will be sent. In this case, the message will be sent to pepa.novak@cvut.cz.
# Pbs -m bae The message will be sent when the job starts (b-begin), when the job is interrupted (a-abort), and when the job is finished (e-end).
#PBS -l Using keywords, we can set the requirements for the number of processors “ncpus = 2”, the amount of physical memory “mem = 1gb” and the maximum time for running the task “walltime = 1: 00: 00”.
Here you specify on which computer the task should be run – the host parameter. Possible values ​​are: altix, rex, hal, fox, ferret5, ferret6.
If multiple parameters are listed per line, they must be separated by a comma.

You can include multiple spaces separated by a space per line that begins with #PBS.
For example: #PBS -S / bin / csh -N attempt -ma

Main commands for working with PBS:

qsub “job_description” : puts the job in the queue, eg: qsub popis.cmd If the job description is an error, the job will not be queued and PBS will list the type of error.
qstat [-a | -s] : shows the status of individual queue jobs to the user who entered them, in this case only to pepa. The -s flag prints more information about the job.
qdel “nnn” : deletes the job from the queue or terminates the job (if it is already running). The number “nnn” is the serial number of the job in PBS.

There are other commands that allow you to change job status.

The user can get more detailed information about individual PBS commands using the man command (eg: man qdel).

Queue information:

qstat -q : Shows the time constraint of each queue and the number of queued jobs.
qstat -Q : Shows the number of queued jobs.
qmgr : launches qmanager.
print server : prints a description to each queue.
quit : leaves qmanager.

Interactive task execution

For debugging tasks it is advantageous to have the results displayed on the screen and thus visually check the program listing or the values ​​of some variables, which we have an idea of ​​what the values ​​should be. To do this, use the qsub function with the -I flag. So run the task as follows: qsub -I pbs_skript . This is redirected to the shell, but we must manually enter all the user commands in the script. The results can be displayed on the screen and the program can be terminated by default using CTRL-C and the PBS shell can be terminated by the exit command (CTRL-D). Of course, the interactive task will run outside of PBS, but there may be a conflict with tasks triggered by PBS and problems with the computer due to poorly used resources. Our job will also appear in the job queue listing using qstat , or in more detail qstat -f číslo_úlohy .

If we need to debug some applications in graphical mode, we also use qsub . For example, we have to debug on 4 cores for 30 min on a rex machine, enter:

qsub -I -l select=1:ncpus=4:host=rex -l walltime=00:30:00 -v DISPLAY

To check the functionality of graphical output, for example, run xterm , xclock or xclock and CTRL-C. Then we set up the environment by exporting the necessary variables and running the application.

Sample PBS script using MPI

The script runs 8 threads on the altix machine, the source code in C ++ is first translated by the Intel compiler. Further, the proprietary MPI library is used, namely SGI mpt. (see module avail)

#!/bin/bash
#PBS -S /bin/bash
#PBS -M pospisil@vc.cvut.cz
#PBS -j oe
#PBS -N run_altix
#PBS -m bae
#PBS -l walltime=01:00:00
#PBS -l select=1:ncpus=8:host=altix
#PBS -l place=pack:shared
echo "Pocitano na pocitaci `uname -a`"
echo "Pracovni adresar `echo $PBS_O_WORKDIR`"
echo "Uloha spustena z pocitace `echo $PBS_O_HOST`"
cd $PBS_O_WORKDIR
. /usr/share/modules/init/bash
module load icc-11-1
module load mpt
icpc -o PI PI.cpp -lmpi
echo "Starting run at: `date`"
mpirun -np 8 dplace -s1 -c0-7 ./PI
echo "Job finished at: `date`"

Sample PBS script using OpenMP

The script runs 8 threads on the altix machine, the source code in Fortran is first translated by the Intel compiler version 11.1.

#!/bin/bash
#PBS -S /bin/bash
#PBS -M pospisil@vc.cvut.cz
#PBS -j oe
#PBS -N run
#PBS -m bae
#PBS -l walltime=01:00:00
#PBS -l select=1:ncpus=8:host=altix
#PBS -l place=pack:shared
echo "Pocitano na pocitaci `uname -a`"
echo "Pracovni adresar `echo $PBS_O_WORKDIR`"
echo "Uloha spustena z pocitace `echo $PBS_O_HOST`"
cd $PBS_O_WORKDIR
. /etc/profile.d/modules.sh
# Compile and execute a program:
module load ifort-11-1
echo "Starting run at: `date`"
export KMP_AFFINITY=disabled
export OMP_NUM_THREADS=8
ifort -c -O3 -openmp main.cpp
ifort -o main.exe main.o -openmp
dplace -x2 -c0-7 main.exe
echo "Job finished at: `date`"

 

!!!  Translated by Google Translate  !!!



Content owner: CIC - Department of Science and Research IS (81312) Last change: 25.09.2019