introduction to grid and high performance computing grid computing and high performance computing...

66
Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing • Iceberg Getting Connected Basic UNIX/Linux Commands Shell Scripting Using Schedulers and Sun Grid Engine

Upload: maude-baker

Post on 16-Jan-2016

245 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Introduction to Grid and High Performance Computing

• Grid Computing and High Performance Computing• Iceberg• Getting Connected• Basic UNIX/Linux Commands• Shell Scripting• Using Schedulers and Sun Grid Engine

Page 2: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Introduction to Linux on Iceberg• Working with Directories• Help!• Running Programs• Exercise

Page 3: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

•HPC Cluster•Computing clusters ( e.g. iceberg )

•Campus Grid•Departmental clusters, servers and PC network

•Cloud Computing•Access resources over internet on demand, Amazon EC2, Microsoft Azure

•Grid Computing•Particle Physics Data Grid

Research Computing Infrastructure

Page 4: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Supercomputing•Capability Computing

•e.g. Parallel Fluent, Molecular dynamics, MHD

•Capacity Computing•Throughput computing blast searches, pattern searches, data searching

•Grid computing•Heterogeneous resources e.g. ppgrid, DAME, cosmogrid (large scale capability)•At home projects, boinc, Condor etc. (capacity computing)

Page 5: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Grid Computing : Data Grid

• Particle physics data grid, Distributed Aircraft Maintenance Environment

• Computing Network stores large volume of data across network

• Heterogeneous • Multiple data sources

Engine flight data

Airline

Maintenance Centre

European data center

London AirportNew York Airport

American data center

GridDiagnostics centre

Page 6: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

National HPC Services

• Archer• UK National Supercomputing Service• Hardware – CRAY XC30

• 2632 Standard nodes• Each node contains two Intel E5-2697 v2 12-core processors• Therefore 2632*2*12 63168 cores.• 64 GB of memory per node• 376 high memory nodes with128GB memory

• Nodes connected to each other via ARIES low latency interconnect• Research Data File System – 7.8PB disk• http://www.archer.ac.uk/

• EPCC• HPCC Facilities

• http://www.epcc.ed.ac.uk/facilities/national-facilities

• Training and expertise in parallel computing

Page 7: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Regional Computing Service Services

• N8 Computing Service• Polaris facility – based in Leeds• 1/8 owned by The University of Sheffield• Iceberg is the gateway• http://www.shef.ac.uk/wrgrid/n8

Page 8: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

N8 cluster specificationsHardware• 316 nodes (5,056 cores) with 4 GByte of RAM per core (each node has

8 DDR3 DIMMS each of 8 GByte). These are known as "thin nodes".• 16 nodes (256 cores) with 16 GByte of RAM per core (each node has

16 DDR3 DIMMS each of 16 GByte). These are known as "fat nodes".• Each node comprises two of the Intel 2.6 GHz Sandy Bridge E5-2670

processors.• Each processor has 8 cores, giving a total core count of 5,312 cores• Each node has a single 500 GB SATA HDD• There are 4 nodes in each Steelhead chassis. 79 chassis have 4

GB/core and 4 more have 16 GB/coreConnectivity• the compute nodes are fully connected by Mellanox QDR InfiniBand

high performance interconnects with 2:1 blocking File System & Storage• 109 TBytes NFS filesystem where user $HOME is mounted. Quota

controlled and backed up regularly.• 174 TBytes Lustre parallel file system. There is no quota control. It is

not backed up and files are automatically expired after 90 days.

Page 9: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Iceberg: Summary of Facts & Figures

• Processor cores:           3440 cores + 16 GPUs• Total Main Memory:       31.8 TB• Filestore:                          45 TB• Temporary Disk Space:  260 TB• Physical size:                   8 racks• Power consumption:        83.7 KW

Page 10: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

iceberg cluster specificationsiceberg cluster specificationsIntel Ivy Bridge nodes   all infiniband connected, containing;• 92 nodes each with 16 cores and 64 GB of memory ( i.e. 2 * 5-core Intel E5-2650-v2 )• 4  nodes each with 16 cores and 256 GB of memory• TOTAL INTEL CPU CORES = 1152  , TOTAL MEMORY = 2400 GB

Scratch space on each node is 400 GB

Intel Westmere based nodes all infiniband connected, containing;• 103 nodes each with 12 cores and 24 GB of memory ( i.e. 2 * 6-core Intel X5650 )• 4  nodes each with 12 cores and 48 GB of memory• TOTAL INTEL CPU CORES = 1152  , TOTAL MEMORY = 2400 GB

Scratch space on each node is 400 GB

Page 11: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

iceberg cluster specifications : GPU Computingiceberg cluster specifications : GPU ComputingKepler K40M   all infiniband connected, containing;• 8  Nvidia Tesla Kepler K40Ms GPU units for GPU programming• 2880 thread processor cores per GPU• 12GB GDR memory per GPU• Total GPU memory = 96 GB

Each GPU unit is capable of about 4.3TFlop of single precision floating point performance, or 1.4TFlops at double precision. Hence yielding maximum GPU processing power of upto 11.2 TFlops in total.

Fermi M2070 all infiniband connected, containing;• 8  Nvidia Tesla Fermi M2070s GPU units for GPU programming• 448 thread processor cores per GPU• 6GB GDR memory per GPU• Total GPU memory = 48 GB

Each GPU unit is capable of about 1TFlop of single precision floating point performance, or 0.5TFlops at double precision. Hence yielding maximum GPU processing power of upto 8 TFlops in total.

Page 12: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Iceberg Cluster

HEAD

NODE1

Iceberg(1)

HEAD NODE2

Iceberg(2)

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

Worker node

There are 232 worker machines

in the cluster

There are two head-nodes for the iceberg cluster

loginloginlogin

qsh,qsub,qrshqsh,qsub,qrsh

All workers share the same user filestore

Page 13: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Iceberg cluster interconnection types

• Two main Interconnect types: Gigabit (commodity), Infiniband (more specialist)

– Gigabit – All nodes are connected to each other via the standard Gigabit ethernet connections. This is suitable for parallel MPI jobs that do not require high-volume communications

– Infiniband – High-End solution for large parallel applications has become defacto standard for clusters (speeds upto 4Gb/s) ( 2:1 nonblocking )

Page 14: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Accessing polaris and iceberg Register for an account http://www.shef.ac.uk/wrgrid/iceberg/register

Terminal access is described at: http://www.shef.ac.uk/wrgrid/using/access

Recommended access is via any browser at: www.shef.ac.uk/wrgrid This uses Sun Global Desktop ( All platforms, Graphics-capable)

Also possible:• Using an X-Windows client ( MS Windows, Graphics-capable)

– Exceed 3D – Cygwin

• Various ssh clients (MS Windows, Terminal-only )– putty, SSH

Note: ssh clients can also be used in combination with Exceed or Cygwin to enable graphics capability. Above web page describes how this can be achieved.

Page 15: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Secure Shell

• Program to log into another computer over a network• Execute commands on a remote machine• Move files from one machine to another• Provides strong authentication and secure

communications over insecure channels.• Intended as a replacement for rlogin, rsh, rcp, and

rdist.

Page 16: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

SSH method of access from MAC or Linux platforms• You only need the SSH client. The server is unnecessary,

unless you wish to connect back to your home machine via the Internet using SSH.

• Connecting to our N8 polaris machine

ssh -l shemg polaris.leeds.ac.uk • To use X-windows add the "-X" flag

– SSH will then carry Xwindows traffic over the Internet to connect• Range of options for changing ports, specifying authentication

files, encryption algorithms etc….– Use man ssh for help with options

Note1: -X parameter is needed to make sure that you can use the graphics or gui capabilities of the software on iceberg.Note2: Depending on the configuration of your workstation you may also have to issue the command : xhost + before the ssh command.

Page 17: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Start session on headnode

Start an interactive session on a worker

Help

Start Application on a Worker

Web browser method of access: Sun Global Desktop

Page 18: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Terminal access from Windows platforms via Exceed

• X Concepts• Using the Exceed Software• Starting an xterm session• Starting a ssh session

Page 19: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Basic X Concepts

• X Server runs on local machine– PC Exceed, Cygwin, Xming

– UNIX WorkstationIncluded in OS

– Apple Mac Exodus

• X Client runs on remote machine– Graphical Application

• xterm

• xcalc

• Modelling and visualisation packages etc.

Page 20: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

ssh on Managed/XP workstations

Secure-shell client can be accessed via;

Start Unix_ConnectivityExceed3Dssh.

When the program initialises you will be asked to enter hostname (default is iceberg) , username and password.

Page 21: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

ssh on Managed/XP workstationsWhen ssh starts you will be presented with the login panel as shown below; Default host name is iceberg.shef.ac.uk and can be changed if you want to login somewhere else.

You may next be asked if you wish to save the public host-key into a local-database. This is not a crucial question and you may answer YES or NO.

Also if asked to provide host response just press ENTER.

Page 22: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Exceed on the stand-alone PCsStarting an Exceed xterm session

Start Exceed ->Xstart and fill in the panel as shown below

Fill in host,username,p/w,commandand click on the run icon to start xterm

Page 23: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Exceed on the stand-alone PCsAn Exceed xterm session

Page 24: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Multiple ssh or xterm shells

• There are no limits to the number of ssh or xterm windows one can start simultaneously by methods described in the previous slides. If you wish to open another x-terminal, it is simpler to start it from an existing x-term window by simply typing xterm & or Xterm or uterm. uterm is a home configured xterm for accessing iceberg from gnome-based Linux workstations with nicer fonts.

• On iceberg we also have a local command named Xterm that starts up an xterm window with nicer to use parameters. On iceberg we strongly recommend that you use Qsh rather than xterm or Xterm command so as to make use of a free worker node. Qsh will act like Xterm but will make use of a worker node.

• Typing exit will terminate an xterm or ssh session neatly.• This will also close the xterm window but not the ssh window. ssh

windows can be closed via the file exit menu.

Page 25: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Some basic rules

• Unix is case sensitive.• Commands are in lower case.• Backspace and/or Del Keys correct typing errors.

If the terminal parameters are not correctly set; try Ctrl+H

• Ctrl+C Aborts a program or command.• You can use the arrow keys to recall previous

commands, optionally edit and execute them.

Page 26: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Key combinations in bash

Ctrl+A Move cursor to beginning of line

Ctrl+C <Break> Stop running program

Ctrl+D <Logout>

Ctrl+E Move cursor to end of line

Ctrl+H Delete character to the left

Ctrl+Z Suspend the program

Arrow left/right Move pointer left/right to insert chars etc.

Arrow up/down Recall previous commands so as to edit them andsubmit them by pressing ENTER

Tab

Tab tab

Command or filename completion. Auto-complete the command line (to save typing)If tab does not work tab again to show possibilities

Page 27: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

passwords

• In normal linux environment the passwd command can be used to change the user passwords. However, because we manage passwords centrally this command will not work on iceberg.

• If you wish to change your iceberg password you will have to do this via a web interface at the following URL:

• http://www.shef.ac.uk/cics/password

Page 28: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Filenames

• Filenames can comprise of:• a-z, A-Z alphabetic characters• 0-9 digits• .-_+ special characters• mon+tue_01.06-03-96• Wildcards when referencing files– * any character or sequence of characters– ? any single character

Page 29: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Format of Unix commands

• command [option ...] [filename ...]

eg: ls

ls -l tutorial

more tutorial

Page 30: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

List Directory

• ls list directory• ls -l list directory in long format• ls -a list all (inc. hidden) files• -rw------ l course01 57 Oct 18 11:05 hello.c

Number ofbytes in file

AccessPermissions

Date and time last modified

Page 31: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Directory Structure

Home directory of user cs4un1 : /home/cs4un1

usr

/ (root)

home

cs4un2cs4un1

When you log in you are positioned in your home directory.The environment variable $HOME is also set to contain this directory name.

Page 32: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Working with Directories

• pwd print working directory• cd change directory

• cd move to home directory• cd .. move up one level• cd mydir move into a subdirectory• cd /var/adm move to an absolute directory• mkdir directory_name create a new directory

• rmdir directory_name delete an empty directory

Page 33: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Displaying contents of a text_file

• less filename or more filename

These commands will start listing the contents of filename on screen and pause after a screenfull of data.

less is more powerfull than more and will also respond to cursor keys While pausing, use the following characters to control the output.

Spacebar next screenful

n Spacebar : next n linesEnter next lineb back one screen

n b : back n screen’s fullq quit? or h list commandswhere n is a whole number

Page 34: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Displaying contents of a text_file… continued

• cat [options] filename [filename … ]This command will output the contents of filename[s] to standard-output ( normally

screen) without pausing. Following options are useful; -v display non-printing characters -n display with lines numbered on the left

• tail [-n] filename This command lists the last n lines of a text file. If number [n] is omitted it is

assumed to be 10.

Page 35: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Editors

• There are a number of editors for Linux platforms most are not as easy to use as the Windows based editors. Our recommendation is;

• Use gedit or nedit if you are using XWindows ‘e.g. Exceed’, cygwin.

• Use vi if you have a text terminal ‘telnet’.

• gedit Best at the moment !• nedit Easy ‘graphical’ , good.• vi, vim Require some knowledge, vi is aliased to vim it

also has navigable help ( but not easy to use) via the :h command

• emacs Have faithful following, good once learned.

Page 36: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Renaming and deleting files• mv :This command will move a file or directory to a new location. It can thus be

used to rename files/directories as well as change their locations in the global directory structure.

Syntax:

mv source destinationExample:

mv myfile mynewfile mv myfile subdirectory/myfilemv mysubdir mynewsubdir

• rm : This command will delete a file (optionally a directory if used with –r option).Syntax:

rm object_to_deleteExample:

rm myfile rm –r mydirectory

Page 37: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Searching in files

• Syntax: grep string fileThis command finds and prints out the lines in the file(s) containing the specified

string

string = word or phrase

file = file or list of files (wild_card can be used)

– Note: We strongly advise that the string is quoted.

Examples: grep ‘Green Man’ england.dat

grep ‘Zodiac’ t*.dat

grep ‘Zone[a-z]’ security.fil

Page 38: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Copying files• Copy files (optionally directories)

cp fromfile tofile Some of the useful options are:

-R or –r : Recursive copy ‘fromfile’ is a directory so the entire directory and its contents are copied.

e.g. cp –r mydir newdir

-p : preserve. Preserves all attributes of the file ,such as access rights and creation date.

• Copy and concatenate files by using cat • cat command concatenates contents of list of files and directs the output to

standard output (normally screen). When used with redirection ‘>’ it can be used to join files together.

e.g. cat file1 file2 file3 > new_big_file

Page 39: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Manual Pages• Man: Manual pages give text-based help on usage.

• There is usually one manual page per command which is located in one of

the directories defined by the MANPATH environment variable.

• To access the manual page for a command just type;

• man command

– To get a list of manual pages that contain a ‘word’ type;

• man – k topic

Page 40: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Finding files and information about them

• find :Finds a file in the directory hierarchy• • Example : find . –name “myprog.*” -print • Note: it is safe to enclose strings containing wild characters

in quotas

• which : Shows in which directory a command is located.l Syntax: which command_name

• file : Can be used to see what type of data a particular file contains. For example, script , program, library, executable binary etc…

• Syntax: file command_name

Page 41: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Using find

• Searches recursively for specified file– find [-H] [-L] [-P] path_list options action

• -H L P control the treatment of symbolic links ( not of concern in an average user's directory)

• Options:

• -name filename ( e.g. -name diary.txt )

– -size nnn ( e.g. -size +10M ) – -atime nnn (time last accessed) (e.g. -atime -3 )

– -mtime nnn (time last modified) (e.g. -mtime -7 )– Note: number can be minus (-) to indicate less then , plus(+) to

indicate more than or without a sign to indicate exactly .

Page 42: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Find Examples

• Find a file called mystery in /bin and /usr and print the result

– find /bin /usr –name libGL* –print– find . –user myusername –print

• Find files accessed in the last n days– find . –atime n –print

• Find files modified within the last n days– find . –mtime -n -print (e.g. find . -ntime -7 –print

• Note: -print is usually the default and can be omitted.

Page 43: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Issuing System Commands on Files Found

• Use the exec option of the find command

• Copy found file to a specified directory, curly braces instruct find to substitute the name of the file in this location

– find . –name “*.doc” –exec cp {} document \;– File is copied to directory document– ; is needed to terminate the execute command– \ escape character to take away special meaning of ; in find

• Reaffirm execution of system commands using –ok option– find . -name “*.doc” -ok rm {} \;

• Search for a string in all the find files– -find . –name “*.doc” –exec grep “Iceberg” {} \; -print– Warning be careful of space between {} and \; note order \;

Page 44: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Resources 1: Filestore

• Two areas of filestore available on Iceberg. – A permanent, secure, backed up area in your home

directory /home/username– data directory /data/username

• Not backed up to tape

• Data is mirrored on the storage server

Page 45: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Resources2: Scratch area

• Temporary data storage on local compute nodes– I/O much faster than NFS mounted /home and /data

• Data not visible to other worker nodes and not backed up• Create a directory using your username in /scratch on a worker

and work from this directory• The data in the /scratch area is deleted periodically when the

worker is not accessed by any processor or jobs

Page 46: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Resources 3: Storage Allocations

• Storage allocations for each area are as follows:– Your home directory has a filestore of 5 GB,but you can

request additional space. – If you change directory to /data you will see a directory

labelled by your username. – In /data you can store 50GB of files you can request

additional space.

Page 47: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Resources 4: Important Notes

• The data area is not backed up. • Check quota regularly if you go over quota the

account will become frozen you’ll need to contact iceberg-admins

• Check quota using the command quota• If you exceed your quota using the RM command

– Note upper case

Page 48: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Resources 5 : Transferring Data

Summary of file transfer methods as well as links to downloadable tools for file transfers to iceberg are published at: http://www.sheffield.ac.uk/wrgrid/using/access

• Command line tools such as scp, sftp and gftp are available on most platforms.

• Can not use ftp ( non-secure ) to iceberg.• File Transfer Applications

– Filezilla (Linux, MAC, Windows)• https://filezilla-project.org/

– WinSCP• http://winscp.net/eng/index.php

Page 49: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Working with filesTo copy a file: cp my_file my_new_fileTo move ( or rename ) a file : mv my_file my_new_fileTo delete a file : rm my_file To list the contents of a file : less file_name

To make a new directory( i.e. folder) : mkdir new_directory

To copy a file into another directory: cp my_file other_directoryTo move a file into another directory: mv my_file other_directoryTo copy a directory to another location: cp –R directory other_directory

To remove a directory and all its contents!!!: rm –R directory ( use with care )Wildcards : * means matching any sequence of characters.For example: cp *.dat my_directory

Page 50: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Running programs• Two modes of operation foreground and background

– Foreground Interact with program via keyboard/screen

– Background No connection with keyboard/screen

Submit to backbround by Appending ‘&’

EG: myprog >& myfile &

The symbols ‘>&’ redirect output and any errors to the file myfile

Although the above method of running jobs on the background is feasible, the prio we recommend that you submit your background into the batch queue via the qsub command.

Page 51: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Redirection

Most unix commands are not aware of the source of their input or the destination of their output. They simply read/write from/to stdin/stdout. The shell takes care of these issues.

• Standard Input (default=>keyboard) • Standard Output (default=>screen)• Redirection symbols <,>,>> can be used to specify

files as the source/destination of the read/write operations to override the above defaults.

Page 52: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Redirection continued …

Most unix commands are not aware of the source of their input or the destination of their output. They simply read/write from/to stdin/stdout. The shell takes care of these issues.

• To redirect the output to a file use the ‘>‘ symbol.Example: ls -l > dirlist

• The ‘>‘ symbol should be used with care as it may over-write an existing file. ‘>>’ symbol can be used instead if the output should be appended to the end of an existing file rather than over-writing it. Example: ls -l >> logfile

• If nothing is directed to a file then a zero size file is created, or if the file already existed then the contents of the file is removed Example: > afile

• The file /dev/null is a special symbol to indicate a ‘black-hole’Example : ls –l > /dev/null

Page 53: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Redirection continued …

If any program expects any of it’s input from the standard-input-channel , i.e. the keyboard, it can also read the same information from a file by redirection.

• To read input from a file use the ‘<‘ symbol.Example: write cs1xyz < message.fil

Here any text input {write} program expects from the keyboard will be simply read from a file named message.fil.

Each end-of-line will be treated as an <ENTER> on the keyboard.

Page 54: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Piping

• Feeding the output of one command into the input of another command

• The symbol ‘|’ is called a pipecommand | command

• eg: ls -al | more

ls -la | grep Nov

Page 55: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Examples of re-direction and piping

• ls –l | grep ‘Jun’• ls –l | grep `Jun` > june_files• ls –l | grep `Jun` | cut –c 57-80 > june_files• cut –c 1-10 < test_files• aspell –l < message.txt > report.txt• grep fluent < news.dat • grep fluent < news.dat | cut –c 1-72 • (grep fluent < news.dat ) | cut –c 1-72 • (grep fluent < news.dat ) | cut –c 1-72 > fluent.news

Page 56: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Foreground Program Control

• Kill a program Ctrl C• Stop a program Ctrl Z

Note a stopped program still exists in the system

and hence can be re-started.

Page 57: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Program control within current shell• jobs Lists jobs (programs)• bg %job_id Place a job in the background• fg %job_id Return a job to the foreground• stop %job_id Stop a job• kill %job_id Kill a jobProcess_id can be used in place of %job_id for more

definitive way of identification.jobs[1] + Running time.sh > outstop %1[1] + Stopped (signal)time.sh > outbg %1[1] + time.sh > out &kill %1Terminated

Page 58: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Program control using ‘ps’ and ‘kill’• ps Report process status

ps -f -u username UID PID PPID C STIME TTY TIME CMD

username 24816 24585 0 16:23:04 pts/50 0:00 sleep 2

username 20169 19956 0 16:05:45 pts/50 0:01 -csh

username 24585 20169 0 16:35:07 pts/50 0:00 /bin/sh time.sh

• kill Terminate process

– Find its process ID (PID) using the ps command

– Kill the process using the kill commandkill 24585

– Sometimes kill on its own does not work so trykill -KILL 24585 or kill -9 pid

Page 59: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Running programs on Iceberg and Polaris• Iceberg is the gateway to the cluster of worker nodes and the

only one where direct logging in is allowed.

• Iceberg’s main purpose is to allow access to the worker nodes but NOT to run cpu intensive programs.

• All cpu intensive computations must be performed on the worker nodes. This is achieved by the qsh command for the interactive jobs and qsub command for the batch jobs.

• Once you log into iceberg, taking advantage of the power of a worker node for interactive work is done simply by typing qsh and working in the new shell window that is opened. This what appears to be a trivial task has would in fact have queried all the worker nodes for you and started a session on the least loaded worker in the cluster.

• The next set of slides assume that you are already working on one of the worker nodes (qsh session).

Page 60: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Filename Completion

• Complete a partially typed filename– Operation

• Type enough characters to uniquely identify the name• Press the ‘Tab’ key (for C – shell use ‘Esc’ key)• If the response is a ‘bleep’ press Ctrl-d to list possible matches

Page 61: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Repeating Previous Commands

• Operation– history List previous commands

– !! re-run last command

– !n re-run the nth command

– !str last command starting with str

eg: !vi

• Setup– Add the following to your .cshrc file

– set history=40

Page 62: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Command Aliasing

• Definitions– alias ll=' ls -lF '– alias h=' history 24 '– alias dir=' ls '

• Setup– Add alias definitions to your .bashrc file

Page 63: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

UNIX Utilities

• tar• compress• sed• awk

Page 64: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Basic sed and awk examples

• Print field 1 and field 3 in the file mixed.dat– awk < mixed.dat ‘{print $1, $3}’

• Search for lines containing #1 in the file out_plu1 and print field 21, 5, 2 and 3– awk < out_plu1 ‘{ if($1=“#1”) print $21, $5, $2, $3}’

• Use sed to print line 5 of the long listing– ls –l | sed –n –e “5 p”

• In the file testsed.txt replace the string %testreplace% with the string replaced– sed –e “s/%testreplace%/replaced/” testsed.txt

Page 65: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Help

• HPC Hub– http://http://hpchub.sites.sheffield.ac.uk/ – For basic unix enquries

– E-mail [email protected]– Goes to the discussion group

– Questions for the administration team– E-mail [email protected]

• N8 HPC• Registration

• http://www.shef.ac.uk/wrgrid/n8/apply• http://n8hpc.org.uk/

Page 66: Introduction to Grid and High Performance Computing Grid Computing and High Performance Computing Iceberg Getting Connected Basic UNIX/Linux Commands Shell

Further Help

• GNU/Linux Command-Line Tools Summary– http://en.tldp.org/LDP/GNU-Linux-Tools-Summary/html/

index.html

• Bash Guide for Beginners– http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html

• Advanced Bash-Scripting Guide– http://en.tldp.org/LDP/abs/html/index.html

• The Linux Documentation Project– http://en.tldp.org/