top of page
Search

Job Scheduler PBS scripts

  • Writer: Mohd Athar
    Mohd Athar
  • May 8, 2021
  • 2 min read

#!/bin/bash -l

#$ -S /bin/bash

#$ -cwd ##Move to current working directory

#$ -V


## Running array job over all files in the models directory.

#$ -t 1-100


## Change the name below (after -N) to suite your requirement

#$ -N MyMPIcode


## Restarts the job in case of failures

#$ -r y


## To send email when job ends or aborts

#$ -m ea


## set the queue depending on Job run time.

#$ -q <queue>


## Email address to send email to

#$ -M <emailaddress>


## specify the amount of memory required (e.g. 3G or 3500M) (NOTE: This is memory per processor slot. So if you ask for 2 processors total memory will be 2 X hvmem_value)

#$ -l h_vmem=size


## Change the number of cores demanded (after mpirun (fill-up) or orte-rr(Round-Robin)) to suite your code-run requirement

#$ -pe mpirun 32


## Whether you want to merge output and error log files

#$ -j [y/n]

#$ -o MAINresults.out

#$ -e MIANerror.out


echo "Starting MPI job at: " `date`

echo "Starting MPI job on: " `hostname`

echo "Total cores demanded: " $NSLOTS

echo "Job name given: " $JOB_NAME

echo "Job ID: " $JOB_ID

echo "Starting MPI job..."


## Change the executable to match your path and executable filename (last line with ./xxx)

/usr/lib64/openmpi/bin/mpirun --mca btl sm,openib -np $NSLOTS ./a.out


exit

Applications installed at the HPC cluster can be loaded by using the ‘module load’ command as shown in the above script file. To check those available software packages, type ‘module avail’ in the command line






To Load Openmpi Module to run Parallel Jobs:





To List loaded module:





Submit your job and check the results

Now you are ready to submit your job script to the queue system. Please follow the procedure as below


1. First make sure you are working under the ‘/home/username’ directory by typing ‘pwd’. You can type “cd’ to return to your home directory wherever you are.


2. Now submit the job script to the queue system by typing ‘qsub Jobscript

name’ and you will be returned a job id by the queue system.



Useful Commnads:


qstat -f .... Show nodes, total available, running and free


qsub script.sh (Submits a job "script.sh" )


qdel <job-id> ....... Deletes job from queue.


qstat ...... Show status of jobs and queues


qstat -j jobid ...... Show status of jobs with full details


qhost -j ... display jobs hosted by host


qstat -g c ... display cluster queue summary


qstat -t ... Display all parallel and array job task


qstat -u \* ... Display all users running jobs

 
 
 

Recent Posts

See All
rsync at remote server

without password: ssh-keygen [WITHOUT entering any passphrase] ssh-copy-id user@remote-host (example: ssh-copy-id altair) nohup rsync...

 
 
 

Comments


bottom of page