Unix Scripts and PBS on BioU

Slides:



Advertisements
Similar presentations
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Advertisements

Job Submission Using PBSPro and Globus Job Commands.
Processes and Job Control. Foreground and Background (1)  Unix is a multi-tasking operating system –some of these tasks are being done by other users.
Southgreen HPC system Concepts Cluster : compute farm i.e. a collection of compute servers that can be shared and accessed through a single “portal”
Software Tools Using PBS. Software tools Portland compilers pgf77 pgf90 pghpf pgcc pgCC Portland debugger GNU compilers g77 gcc Intel ifort icc.
Running Jobs on Jacquard An overview of interactive and batch computing, with comparsions to Seaborg David Turner NUG Meeting 3 Oct 2005.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Shell Programming Software Tools. Slide 2 Shells l A shell can be used in one of two ways: n A command interpreter, used interactively n A programming.
CS 497C – Introduction to UNIX Lecture 33: - Shell Programming Chin-Chih Chang
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
 What is a shell? A shell script?  Introduction to bash  Running Commands  Applied Shell Programming.
Shell Programming. Shell Scripts (1) u Basically, a shell script is a text file with Unix commands in it. u Shell scripts usually begin with a #! and.
Lab 8 Shell Script Reference:
Introduction to UNIX/Linux Exercises Dan Stanzione.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
1 Operating Systems Lecture 3 Shell Scripts. 2 Brief review of unix1.txt n Glob Construct (metacharacters) and other special characters F ?, *, [] F Ex.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Chapter 5 Bourne Shells Scripts By C. Shing ITEC Dept Radford University.
1 Shell Programming – Extra Slides. 2 Counting the number of lines in a file #!/bin/sh #countLines1 filename=$1#Should check if arguments are given count=0.
Linux Shell Programming Tutorial 3 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi.
VIPBG LINUX CLUSTER By Helen Wang March 29th, 2013.
Bigben Pittsburgh Supercomputing Center J. Ray Scott
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 11: Shell.
CS465 - UNIX The Bourne Shell.
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses. ©Copyright Network Development Group Module 9 Basic Scripting.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Network Queuing System (NQS). Controls batch queues Only on Cray SV1 Presently 8 queues available for general use and one queue for the Cray analyst.
Shells. Variables MESSAGE="HELLO WORLD" echo $MESSAGE MESSAGE="HELLO WORLD $LOGNAME" echo $MESSAGE MESSAGE="HELLO WORLD $USER" echo $MESSAGE.
Shell Programming Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn the.
Using UNIX Shell Scripts Michael Griffiths Corporate Information and Computing Services The University of Sheffield
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Xuan Guo Chapter 5 The Bourne Shell Graham Glass and King Ables, UNIX for Programmers and Users, Third Edition, Pearson Prentice Hall, Notes by Michael.
1 © 2000 John Urrutia. All rights reserved. Session 5 The Bourne Shell.
Shell Script2 Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Introduction to Scripting Workshop October
Software Tools Using PBS. Software tools Portland compilers pgf77 pgf90 pghpf pgcc pgCC Portland debugger GNU compilers g77 gcc Intel ifort icc.
Cluster Computing Applications for Bioinformatics Thurs., Sept. 20, 2007 process management shell scripting Sun Grid Engine running parallel programs.
Introduction to HPC Workshop October Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Lab 8 Shell Script Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
Introduction to Bash Shell. What is Shell? The shell is a command interpreter. It is the layer between the operating system kernel and the user.
Shell script – part 2 CS 302. Special shell variable $0.. $9  Positional parameters or command line arguments  For example, a script myscript take 2.
Portable Batch System – Definition and 3 Primary Roles Definition: PBS is a distributed workload management system. It handles the management and monitoring.
Assigning Values 1. $ set One Two Three [Enter] $echo $1 $2 $3 [Enter] 2. $set `date` [Enter] $echo $1 $2 $3 [Enter] 3. $echo $1 $2 $3 $4 $5 $6 [Enter]
Chapter 5 The Bourne Shell Graham Glass and King Ables, UNIX for Programmers and Users, Third Edition, Pearson Prentice Hall, Notes by Michael Weeks.
Advanced topics Cluster Training Center for Simulation and Modeling September 4, 2015.
Introduction to Scripting Workshop February 23, 2016.
GRID COMPUTING.
Welcome to Indiana University Clusters
PARADOX Cluster job management
Department of Computer Engineering
CSC 352– Unix Programming, Spring 2016, Final Exam Guide
Chapter 9 Shell Programming
Welcome to Indiana University Clusters
How to use the HPCC to do stuff
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
Using Paraguin to Create Parallel Programs
The Linux Operating System
Shell Script Assignment 1.
Introduction to HPC Workshop
Compiling and Job Submission
Chapter 5 The Bourne Shell
Chapter 5 Bourne Shells Scripts
Chapter 3 The UNIX Shells
Quick Tutorial on MPICH for NIC-Cluster
Working in The IITJ HPC System
Review The Unix Shells Graham Glass and King Ables,
Presentation transcript:

Unix Scripts and PBS on BioU Alexander J. Ropelewski ropelews@psc.edu

Unix Scripts Type Run Save File

A Very Simple Script #!/bin/sh # # run the ls command ls -laF File: mylsscript.sh

A Very Simple Script #!/bin/sh # # run the ls command ls -laF FIRST LINE: Tells the UNIX System the Shell (or command interpreter) to use. Can be: #!/bin/sh #!/bin/csh #!/bin/tcsh #!/usr/bin/perl Or many others… #!/bin/sh # # run the ls command ls -laF Lines beginning with # are comments File: mylsscript.sh The UNIX command(s) to execute, in this case we want the ls command

Steps to Running a Script Edit a file Place commands in file Save File Make File Executable: chmod u+x mylsscript.sh Type in the name of the script file mylsscript.sh

What can Scripts Do Scripts can assign values to variables Scripts can have control elements such as: Error Checking Conditionals (If Tests) Loops Scripts can also do simple math Scripts can run programs

Script With Conditional & Error Check #!/bin/sh cp file.out $HOME/file.out if [ $? -eq 0 ] then echo "File copied" else echo "PROBLEM" fi File: iftest.sh

Script With Conditional & Error Check Test condition: $? Is the status returned from the prior command (cp). If the prior command (cp) was successful, this will contain 0 First line tells us this is a Bourne Shell Script Copy command #!/bin/sh cp file.out $HOME/file.out if [ $? -eq 0 ] then echo "File copied" else echo "PROBLEM" fi Conditional test; format must be either : IF - THEN - FI -or- IF - THEN - ELSE - FI If condition is true write “File copied” message If condition is false write “PROBLEM” message File: iftest.sh

Script With Loop & Simple Math #!/bin/sh i="1" while [ $i -le 180 ] do echo "Iteration # $i" i=`expr $i + 1` sleep 1 done File: test1.job

Script With Loop & Simple Math First line tells us this is a Bourne Shell Script Condition: variable i is less than or equal to 180 Initialize variable i to 1 #!/bin/sh i="1" while [ $i -le 180 ] do echo "Iteration # $i" i=`expr $i + 1` sleep 1 done While Loop: Do the instructions between the do and done until the condition is satisfied Echo command is a simple print function. Assign variable i to now be equal to the old value of i plus 1. Sleep command tells system to wait 1 second before continuing File: test1.job

What Are PBS Scripts PBS scripts are just Unix shell scripts with some additional attributes (that provide resource and control information) that are executed by the PBS queuing system. PBS scripts are submitted to queues and are run when the system has resources available PBS script files will be created and run for you automatically when you use the Galaxy interface on BioU You can gain more control over your analyses by writing (and running) your own PBS scripts Sometimes you will hear PBS scripts called "jobs".

PBS Script With Loop & Simple Math #!/bin/sh #PBS -q serial #PBS -j oe #PBS -l walltime=00:10:00 #PBS -l nodes=1:ppn=1 #PBS -N PbsTest i="1" while [ $i -le 180 ] do echo "Iteration # $i" i=`expr $i + 1` sleep 1 done File: pbstest.job

PBS Script With Loop & Simple Math Parameters always begin with: #PBS Queue name: On BioU these are serial and parallel Write stderr in stdout file #!/bin/sh #PBS -q serial #PBS -j oe #PBS -l walltime=00:10:00 #PBS -l nodes=1:ppn=1 #PBS -N PbsTest i="1" while [ $i -le 180 ] do echo "Iteration # $i" i=`expr $i + 1` sleep 1 done Set the walltime limit to ten minutes Serial job, so only need one core on one node. Name the job PbsTest File: pbstest.job

Running PBS Scripts To submit a PBS script use the qsub command: % qsub pbstest.job 382.biou1.psc.edu The system will respond with the PBS identifier: 382 – The scripts job id number biou1.psc.edu - The computer id

Monitoring PBS Scripts To see if a PBS script is running, use the qstat command: % qstat Job id Name User Time Use S Queue ---------------- ---------------- ---------------- -------- - ----- 381.biou1 serial_example nigra 0 R serial 382.biou1 pbstest.job ropelews 0 Q serial

Killing PBS Scripts To kill a PBS script, first, get the PBS script identifier: % qstat Job id Name User Time Use S Queue ---------------- ---------------- ---------------- -------- - ----- 381.biou1 serial_example nigra 0 R serial 382.biou1 pbstest.job ropelews 0 Q serial Then terminate the PBS script: % qdel 382.biou1

Galaxy PBS Scripts To check on a PBS script submitted through Galaxy, use the BioU status check tool. Galaxy PBS scripts are limited to 48 hours (walltime) PBS scripts submitted through Galaxy can not be terminated by the user. PBS scripts submitted on the command line can run longer than 48 hours.