1 / 57

Introduction to Linux and PC Cluster

Introduction to Linux and PC Cluster. October 5, 2010 Morris Law, IT Coordinator, Science Faculty, Hong Kong Baptist University. Outline - Linux. Introduction to Linux History of UNIX and Linux Login, logout and changing the password Basic Linux command Linux hierarchical file system

senona
Télécharger la présentation

Introduction to Linux and PC Cluster

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Linux and PC Cluster October 5, 2010 Morris Law, IT Coordinator, Science Faculty, Hong Kong Baptist University

  2. Outline - Linux • Introduction to Linux • History of UNIX and Linux • Login, logout and changing the password • Basic Linux command • Linux hierarchical file system • Linux shell environment • Editors: vi, pico, emacs, joe, nano • Basic shell scripts • Compiling, link and run C, C++, Fortran programs • Foreground and Background jobs • File transfer from other PCs in different platform • Linux distributions

  3. Outline – PC Cluster • Introduction to the PC Clusters • What is a PC cluster • The different kinds of PC clusters • High Performance Computing (HPC) cluster vs Single System Image (SSI) cluster • How to build your own PC cluster • Introduction to existing HPC cluster in Faculty of Science, HKBU

  4. Introduction to UNIX/Linux • UNIX/Linux are multi-tasking, multi-user OS. • UNIX is originated from UNICS and MULTICS, 1969. • time sharing environment • UNIX/Linux commands are reusable and compact. • hierarchical file systems with easy-to-manage file permission scheme • In 1991, Linus Torvalds, released the first version of Linux kernel on PCs. • Linux is an open source system, it grew to be a powerful and competitive operating system in PCs, MACs and even some brand name workstations.

  5. History of UNIX / Linux

  6. History of UNIX/Linux

  7. What is Linux • When Linus Torvalds was still a student in Helsinki University, he developed his hobby to Minix, a small UNIX system and decided to develop a system that exceeded the Minix standards. He began his work in 1991 when he released version 0.02 and worked steadily until 1994 when version 1.0 of the Linux Kernel was released. • The current full-featured version is 2.6 (released 18 December 2003) and development continues. • Since Linus only developed the Linux kernel, to make Linux a popular operating system nowadays, the contribution of GNU software paid an important role. The GNU project was started in 1984 by Richard Stallman who would like to develop free software. The decision of Linux development under GNU public license accelerated the growth of GNU project after Linux was released in 1991. Some GNU software even develop on Linux platform first before it will be ported to other platform. • At the same year, the Internet grew and became a solid ground for collaborating work by volunteers all over the world. • Many distribution of Linux was released on different hardware such as PCs, PowerPC, Macintosh and even brand name UNIX. Though Linux kernel is free and open source, these distribution may not be free since the software packaged may include some commercial software.

  8. Login and Logout • To login to UNIX/LINUX system, you have to find a terminal. • There are two kinds of terminal, namely ASCII terminal and graphical terminal. • In ASCII terminal, command-line input are supported while in graphical terminal, users can input their command by mouse and keyboard and it also support graphical display. • Once you find an ASCII terminal, a login prompt like the following can be found. Fedora release 13 (Goddard)kernel 2.6.33.3-85.fc13.x86_64 on an x86_64 (tty3)cf8200-07 login:

  9. Basic Linux commands – working with files & directories

  10. Basic Linux commands – working in the shell (1/2)

  11. Basic Linux commands – working in the shell (2/2)

  12. Linux file system • Linux is a file-oriented system. In Linux, files can be regular files, directories or special files such as devices, sockets. • A hierarchical directory structure similar to an inverted tree can be found. /dev/null /users/staff/guest/gu09

  13. File • Files are identified by their file names, File names are up to 255 character long. • Hidden files are files with name preceding with dot (.). • Each file in UNIX/Linux has its own ownership and permissions which can be shown by listing the directory content in long format (ls -l). • The following show a file, stafflist, 34 bytes in size, which last modified on 19/09/97. It is owned by a user called morris which is a staff of the Dean's Office. • -rw-rw-r-- 1 morris dean 34 Sep 19 1997 stafflist • The ownership can be changed by the command chown and chgrp, • chown cwyeung stafflist; chgrp math_stf stafflist • The first field in the above example represents the permission bits of the files. • The first column shows its kind, `d' represent a directory, • `-' represent a regular file. • The rest can be divided into 3 groups showing its user permission, group permission and other permission respectively. Each group can have read (r), write (w) and/or executable(x) permission bits. • A `-' deny the corresponding permission of the file. • Refer to the last example, stafflist is a regular file which can be updated (rw- in user bit and group bit) by morris and dean staff. It can be read by other users (r-- in other bit). Unfortunately, the file cannot be executed by any body since a `-' is found in each executable bit. • One can change the permission bit by using chmod, two methods can be used. • use u,g,o,a flag with +, - to add or delete their permission • chmod g-rw,o-r stafflist - deny rw permission for users in same group - deny r permission for other users • chmod a+x stafflist - add executable permission to all users • Use 3 octal numbers calculated using 4 for `r', 2 for `w' and 1 for `x' • chmod 700 stafflist - same effect as the above • Use ls -l to check the result.

  14. Path • To locate a file, one should use the absolute path or relative path. • Absolute path is the path describe starting from root (/). • /users/staff/guest/gu01/sampledir/sample.txt • Relative path is the path describe from the current working directory(.). • sampledir/sample.txt refer to the same file when gu01's current working directory is /users/staff/guest/gu01. • Use pwd to find the current working directory. • In path definition, • Current directory can be described by `.'. • Parent directory can be described by `..'. • Home directory can be described by `~' or the environmental variable '$HOME'.

  15. Linux shell environment • Shell is the front end for users to interact with the Linux kernel. • Commands can be typed in from the shell prompt to do file manipulation • file copying, • renaming and deleting, • start an text editor or • compile and run a program, etc. • Different shells can be found in Linux. The most common shells are • Bourne Again Shell (bash), Bourne (sh, old and standard), • Korn (ksh, the default), • C (csh, C like command) shell. • These shell support both foreground and background processes, pipes, filters and other standard features in Linux. Besides handling Linux commands, these shells support the executions of batch files called shell scripts. • The default shell prompt for the Bourne again, Bourne and Korn shells are ($) and that for the C shell is (%). • A typical command line have the following syntax, • command [-options] arg1 arg2 arg3 ... where arg1, arg2, arg3, etc. are argument input based on the nature of the commands. • Built-in command are interpreted directly. • If the command contains a path, the shell will only search for the command in the path. • If no path is declared, the shell will find in the search path ($PATH) for the command.

  16. Linux editor • The most frequently used program in Linux is an editor. A good choice of editor to suit your need is crucial to most program developer. Common editor in Linux are, • vi (standard Linux full-screen editor) • emacs (macro reach) • pico/nano (command driven full-screen editor) • joe (word star like editor) • Since all UNIX systems have installed vi editor, UNIX experts learn vi. • Emacs editor are reached in macro for formatting text. Therefore, it is good for program developer to write code in different programming languages. • Pico, nano and joe editor support full screen and cursor editing. They are good for novices. • X-window editors are editors which support window and mouse editing. Xemacs and gedit are two examples.

  17. Shell script examples (1/3) • A bash shell script (CheckTemp.sh) for reporting high temperature given an input. #!/bin/bash high=33 if [ $1 -ge $high ]; then echo "*** High temperature signal!" else echo "Normal temperature!" fi

  18. Shell script examples (2/3) • A bash script (hosts.sh) for setting up hostnames and IP tables for 256 nodes in a cluster #!/bin/bash for i in $(seq 0 255) do k=`expr $i / 16 + 1` l=`expr $i % 16 + 1` echo "compute-0-$i 10.1.$k.$l" done

  19. Shell script examples (3/3) • A csh script (fingerall.sh) for listing the finger information of all users in the linux workstation #!/bin/csh set username = `cat /etc/passwd |awk –F':' '{print $1}'` foreach i ( $username ) echo $i finger $i end

  20. Compiling, link and run C, C++, Fortran programs • Compiling C programs • cc [-o a.exe] a.c • Without -o option, the executable file will be named as a.out. • Compiling Fortran programs • f77 [-o t1] a.f • the name of the executable can be set freely. • Compiling C++ programs • g++ [-o t1] a.C

  21. Background Jobs • Program with long running time should be placed in background. • UNIX/Linux allowed background running of programs with nohup command. • Run the program preceeding with nohup and end with an ‘&’. • nohup abc &

  22. File transfer from other PCs in different platforms • File transfer between MS Windows and UNIX can be done by starting secure ftp program from Windows. For examples, winscp. • Install and run winscp downloadable from www.openssh.org • Connect a host session with your username and password • On the left listed your windows desktop, on the right, you will see your linux file/directories. • Just drag and drop files or directories between them to perform file transfer.

  23. Assorted Linux distributions • SuSE (commercial supported with open source variant OpenSuSE) • RedHat (commercial supported) • Caldera OpenLinux (SCO open server) • Turbo Linux (Japanese, support HA) • RedFlag (Chinese based) • Xandros (Commercial, fit for netbook and handheld device) • Slackware (Earliest distribution) • Debian (First community based linux) • Mandriva (Derived from Mandrake, good desktop interface) • Ubuntu (Charity formed in South Africa) • Gentoo Linux (High optimized) • Fedora (Redhat support open source variants) • CentOS (Enterprised level community support) • Knoppix (Live CD/DVD)

  24. Outline – PC Cluster • Introduction to the PC Clusters • What is a PC cluster • The different kinds of PC clusters • High Performance Computing (HPC) cluster vs Single System Image (SSI) cluster • How to build your own PC cluster • Introduction to existing HPC cluster in Faculty of Science, HKBU

  25. What is a PC cluster? • An ensemble of networked, stand-alone common-off-the-shelf computers used together to solve a given problem.

  26. Different kinds of PC cluster • High Performance Computing Cluster (Beowulf cluster) • Load Balancing • High Availability

  27. High Performance Computing Cluster (Beowulf) • Start from 1994 • Donald Becker of NASA assemble the world’s first cluster with 16 sets of DX4 PCs and 10 Mb/s ethernet • Also called Beowulf cluster • Built from commodity off-the-shelf hardware • Applications like data mining, simulations, parallel processing, weather modelling, computer graphical rendering, etc.

  28. Examples of Beowulf cluster • Scyld Cluster O.S. originated by Donald Becker • http://www.scyld.com • ROCKS from NPACI • http://www.rocksclusters.org • OSCAR from open cluster group • http://oscar.sourceforge.net • OpenSCE from Thailand • http://www.opensce.org • SCore from PC Cluster Consortium, Japan • http://www.pccluster.org/

  29. Load Balancing Cluster • PC cluster deliver load balancing performance • Commonly used with busy ftp and web servers with large client base • Large number of nodes to share load

  30. High Availability Cluster • Avoid downtime of services • Avoid single point of failure • Always with redundancy • Almost all load balancing cluster are with HA capability

  31. Examples of Load Balancing and High Availability Cluster • RedHat Cluster Suite • http://www.redhat.com/cluster_suite/ • Turbolinux Cluster Server • http://www.turbolinux.com/products/middleware/tlcs8.html • Linux Virtual Server Project • http://www.linuxvirtualserver.org/ • Single System Image Cluster for Linux • http://www.openssi.org

  32. Screenshots 1 An example of Beowulf Cluster: ROCKS (http://www.rocksclusters.org)

  33. ROCKS SNAPSHOTS • The schematic diagram of a rocks cluster

  34. ROCKS SNAPSHOTS • Installation of a compute node

  35. ROCKS SNAPSHOTS • Ganglia Monitoring tools

  36. HPCC Cluster and parallel computing applications • Message Passing Interface • MPICH (http://www-unix.mcs.anl.gov/mpi/mpich/) • LAM/MPI (http://lam-mpi.org) • Mathematical • fftw (fast fourier transform) • pblas (parallel basic linear algebra software) • atlas (a collections of mathematical library) • sprng (scalable parallel random number generator) • MPITB -- MPI toolbox for MATLAB • Quantum Chemistry software • gaussian, qchem, amber • Molecular Dynamic solver • NAMD, gromacs, gamess • Weather modelling • MM5 (http://www.mmm.ucar.edu/mm5/mm5-home.html)

  37. NAMD2 – Software for Quantum Chemistry

  38. Single System Image (SSI) Cluster MOSIX openMosix

  39. MOSIX and openMosix • MOSIX: MOSIX is a software package that enhances the Linux kernel with cluster capabilities. The enhanced kernel supports any size cluster of X86/Pentium based boxes. MOSIX allows for the automatic and transparent migration of processes to other nodes in the cluster, while standard Linux process control utilities, such as 'ps' will show all processes as if they are running on the node the process originated from. • openMosix: openMosix is a spin off of the original Mosix. The first version of openMosix is fully compatible with the last version of Mosix, but is going to go in its own direction.

  40. OpenMosix installation • Install Linux in each nodes • Download and install • openmosix-kernel-2.4.26-openmosix1.i686.rpm • openmosix-tools-0.3.6-2.i386.rpm • and related packages like thoses in • www.openmosixview.com • Reboot with openmosix kernel

  41. Screenshots 2 OpenMosix cluster management

  42. openMosix cluster management tools • openMosixView • openMosixmigmon • 3dmosmon

  43. Advantage of SSI cluster • Not need to parallelize code • Automatic process migration, i.e. load balancing • Add / delete nodes at any time • Well aware of hardware and system resources

  44. PC clusters in Faculty of Science, HKBU

  45. PII 4-node clusters started in 1999 (obsolete)

  46. PIII 16 node cluster purchased in 2001. (obsolete) • Plan for grid • For test base

  47. HKBU - 64-nodes P4-Xeon cluster at #300 of top500

  48. TDG cluster configuration • Master node: • DELL PE2650 P4 Xeon 2.8GHz x 2 • 4GB ECC DDR RAM • 36GB x 2 internal HD running RAID 1 (mirror) • 73GB x 10 HD array running RAID 5 with hot spare • Compute nodes x 64 each with • DELL PE2650 P4 Xeon 2.8GHz x 2 • 2GB ECC DDR RAM • 36GB internal HD

  49. Interconnect configuration • Extreme BlackDiamond 6816 Gigabit ethernet switch

  50. 16-node P4 Xeon Cluster for computational research from 2005 • 16 compute nodes each with • P4 Xeon 3.2GHz x 2 • 2GB RAM • 36GB SCSI harddisk • ROCKS 4.0.0

More Related