WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing A BRIEF INTRODUCTION TO HIGH PERFORMANCE COMPUTING.

Slides:



Advertisements
Similar presentations
Prepared 7/28/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
Advertisements

MPI Basics Introduction to Parallel Programming and Cluster Computing University of Washington/Idaho State University MPI Basics Charlie Peck Earlham College.
CS 140: Models of parallel programming: Distributed memory and MPI.
Chapter 3. MPI MPI = Message Passing Interface Specification of message passing libraries for developers and users –Not a library by itself, but specifies.
Tutorial on MPI Experimental Environment for ECE5610/CSC
WEST VIRGINIA UNIVERSITY HPC and Scientific Computing AN OVERVIEW OF HIGH PERFORMANCE COMPUTING RESOURCES AT WVU.
High Performance Computing
MPI Program Structure Self Test with solution. Self Test 1.How would you modify "Hello World" so that only even-numbered processors print the greeting.
1 Friday, October 06, 2006 Measure twice, cut once. -Carpenter’s Motto.
Introduction to MPI. What is Message Passing Interface (MPI)?  Portable standard for communication  Processes can communicate through messages.  Each.
CS 240A: Models of parallel programming: Distributed memory and MPI.
Message-Passing Programming and MPI CS 524 – High-Performance Computing.
Distributed Memory Programming with MPI. What is MPI? Message Passing Interface (MPI) is an industry standard message passing system designed to be both.
1 Parallel Computing—Introduction to Message Passing Interface (MPI)
Comp 422: Parallel Programming Lecture 8: Message Passing (MPI)
Message Passing Interface. Message Passing Interface (MPI) Message Passing Interface (MPI) is a specification designed for parallel applications. The.
1 Tuesday, October 10, 2006 To err is human, and to blame it on a computer is even more so. -Robert Orben.
CS 179: GPU Programming Lecture 20: Cross-system communication.
ORNL is managed by UT-Battelle for the US Department of Energy Crash Course In Message Passing Interface Adam Simpson NCCS User Assistance.
2.1 Message-Passing Computing ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 14, 2013.
An Introduction to Parallel Programming and MPICH Nikolaos Hatzopoulos.
Part I MPI from scratch. Part I By: Camilo A. SilvaBIOinformatics Summer 2008 PIRE :: REU :: Cyberbridges.
CS 240A Models of parallel programming: Distributed memory and MPI.
MPI and High Performance Computing: Systems and Programming Barry Britt, Systems Administrator Department of Computer Science Iowa State University.
Multiprocessing. Going Multi-core Helps Energy Efficiency William Holt, HOT Chips 2005 Adapted from UC Berkeley "The Beauty and Joy of Computing"
Parallel Programming with MPI Prof. Sivarama Dandamudi School of Computer Science Carleton University.
Message Passing Programming with MPI Introduction to MPI Basic MPI functions Most of the MPI materials are obtained from William Gropp and Rusty Lusk’s.
CS 838: Pervasive Parallelism Introduction to MPI Copyright 2005 Mark D. Hill University of Wisconsin-Madison Slides are derived from an online tutorial.
Message Passing Programming Model AMANO, Hideharu Textbook pp. 140-147.
Summary of MPI commands Luis Basurto. Large scale systems Shared Memory systems – Memory is shared among processors Distributed memory systems – Each.
MPI Introduction to MPI Commands. Basics – Send and Receive MPI is a message passing environment. The processors’ method of sharing information is NOT.
CS 420 – Design of Algorithms MPI Data Types Basic Message Passing - sends/receives.
CS 591 x I/O in MPI. MPI exists as many different implementations MPI implementations are based on MPI standards MPI standards are developed and maintained.
Parallel Programming with MPI By, Santosh K Jena..
MA471Fall 2002 Lecture5. More Point To Point Communications in MPI Note: so far we have covered –MPI_Init, MPI_Finalize –MPI_Comm_size, MPI_Comm_rank.
1 Message Passing Models CEG 4131 Computer Architecture III Miodrag Bolic.
Chapter 4 Message-Passing Programming. The Message-Passing Model.
CS591x -Cluster Computing and Parallel Programming
Message Passing and MPI Laxmikant Kale CS Message Passing Program consists of independent processes, –Each running in its own address space –Processors.
Running on GCB part1 By: Camilo Silva. Simple steps to run MPI 1.Use putty or the terminal 2.SSH to gcb.fiu.edu 3.Loggin by providing your username and.
Introduction to MPI CDP 1. Shared Memory vs. Message Passing Shared Memory Implicit communication via memory operations (load/store/lock) Global address.
Programming distributed memory systems: Message Passing Interface (MPI) Distributed memory systems: multiple processing units working on one task (e.g.
An Introduction to MPI (message passing interface)
1 HPCI Presentation Kulathep Charoenpornwattana. March 12, Outline Parallel programming with MPI Running MPI applications on Azul & Itanium Running.
Introduction to Parallel Programming at MCSR Message Passing Computing –Processes coordinate and communicate results via calls to message passing library.
Introduction to HPC Workshop October Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Project18 Communication Design + Parallelization Camilo A Silva BIOinformatics Summer 2008.
3/12/2013Computer Engg, IIT(BHU)1 INTRODUCTION-1.
3/12/2013Computer Engg, IIT(BHU)1 MPI-1. MESSAGE PASSING INTERFACE A message passing library specification Extended message-passing model Not a language.
Implementing Processes and Threads CS550 Operating Systems.
Message Passing Interface Using resources from
MPI-Message Passing Interface. What is MPI?  MPI is a specification for the developers and users of message passing libraries. By itself, it is NOT a.
1 Programming distributed memory systems Clusters Distributed computers ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 6, 2015.
Parallel Programming C. Ferner & B. Wilkinson, 2014 Introduction to Message Passing Interface (MPI) Introduction 9/4/
Introduction to Parallel Computing: MPI, OpenMP and Hybrid Programming
Introduction to parallel computing concepts and technics
MPI Basics.
Introduction to MPI.
MPI Message Passing Interface
CS 584.
Introduction to Message Passing Interface (MPI)
Message Passing Models
Lab Course CFD Parallelisation Dr. Miriam Mehl.
Introduction to parallelism and the Message Passing Interface
MPI MPI = Message Passing Interface
Hardware Environment VIA cluster - 8 nodes Blade Server – 5 nodes
Distributed Memory Programming with Message-Passing
MPI Message Passing Interface
CS 584 Lecture 8 Assignment?.
Programming Parallel Computers
Presentation transcript:

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing A BRIEF INTRODUCTION TO HIGH PERFORMANCE COMPUTING

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING So, what is it about? Along with theory and experimentation, computational methods is considered a foundation of science Increases in computational capacity has lead scientists to tackle bigger problems Problems addressed by scientists have grow in scale and scope

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING Many scientific problems require powerful computers to address them – computationally In fact, –Many scientific problems have outgrown the capacity of normal computers

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING So, what do we do? Buy a faster computer! Moore’s Law – real one and the alleged one

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING There are some things chip manufacturers can do –faster, bigger caches, parallel instruction pipelines, hyperthreading We needed a new strategy Instead of ramping up process clock speed… How about throwing more processors at the computational problems?

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING High Performance Computing systems are (to a large extent) parallel computing systems. There are several ways to do this– two primary- –SMP (shared memory) –Distributed memory

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SHARED MEMORY SYSTEMS Multiple processors connected to/share the same pool of memory SMP Every processor has, potentially, access to and control of every memory location

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SHARED MEMORY COMPUTERS (SMP) Memory Processor

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing DISTRIBUTED MEMORY SYSTEMS Multiple processors each with their own memory Interconnected to share/exchange data, processing Modern architectural approach to supercomputers Supercomputers and Clusters similar

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HPC – DISTRIBUTED MEMORY Processor Memory Processor Memory Processor Memory Processor Memory Processor Memory Processor Memory Interconnect

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HPC - HYBRID DISTRIBUTED MEMORY WITH SMP Proc1 Memory Interconnect Proc2Proc1 Memory Proc2Proc1 Memory Proc2 Proc1Proc2Proc1Proc2Proc1Proc2

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HPC - HYBRID DISTRIBUTED MEMORY WITH SMP & COPROCESSORS (ACCELERATORS) Proc1 Memory Interconnect Proc2Proc1 Memory Proc2Proc1 Memory Proc2 Proc1Proc2Proc1Proc2Proc1Proc2 CoProc

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HPC - HYBRID DISTRIBUTED MEMORY WITH SMP – COPROCESSORS (ACCELERATORS) But what are CoProcessors? –Special processors to do some of the computational work –GPU –Intel Phi

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SOFTWARE MODELS FOR PARALLEL COMPUTING How do we make a bunch of processors or cores work on the same problem? How do we get better computational performance by doing this?

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing FLYNN’S TAXONOMY Single Instruction/Single Data - SISD Multiple Instruction/Single Data - MISD Single Instruction/Multiple Data - SIMD Multiple Instruction/Multiple Data - MIMD Single Program/Multiple Data - SPMD

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SOFTWARE MODELS FOR PARALLEL COMPUTING SISD – straight forward one step at a time (not parallel) SIMD – data parallel, vector processors, GPUs MISD - ? We don’t know what this is? MIMD – multiple instructions operating on different data (typical computer) …but wait

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SOFTWARE MODELS FOR PARALLEL COMPUTING SPMD – Single Program, Multiple Data All processors/cores have the same code Processors/cores have their own (independent) data All processors/cores execute the same code, but not necessarily in sync.

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SOFTWARE FOR PARALLEL COMPUTING Where does the parallel (SPMD) code come from? –Purchase/license – Fluent, Accelerys,… –Open source, community developed – Galaxy, OpenFOAM, LAMMPS, R, Octave,… –Add-ons to other packages – Matlab,… –Write your own

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing SOFTWARE FOR PARALLEL COMPUTING Write your own? –C, C++, Fortran With extensions! –Java – NO! –Python – yes sort of –Some special languages

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING- A NOTE ABOUT PERFORMANCE Speed-up –Speedup(n processors) = exectime(1 processor)/exectime(n processors) ** Culler, Singh and Gupta, Parallel Computing Architecture, A Hardware/Software Approach –Example – 1 processors exec time = 10 sec, 2 processors exec time = 5 sec. Speed-up = 2 –Linear Speed-up, Super Linear Speed-up

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING- A NOTE ABOUT PERFORMANCE Amdahl's Law –All algorithms have a serial or sequential portion, other portions may be executed in parallel –Speed-up can never be better than the sequential portion and the worst performing parallel portion

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING So what do we need to do? What do we need to know?

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING Linux –A handful of commands, tools and utilities –A handy text editor An application, or Skills in programming –Using parallelization tools, libraries, etc. PBS/Torque/Moab

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C –c is a very efficient language, available in most computer environments. –Free and commercial compilers available –Many tools to help build software in c

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C –c is a functional language, everything (almost) is a function –c is case sensitive, case matters –c is a strongly typed language int myage; float currenttemp; –Statements end with ; –group statements with { }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C int main (void) { return 0; }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C Lab – change the previous program to print a message on your terminal screen hint… int day = 1; printf(“Hello, I am having so much fun on day %d\n”, day); on one more thing! (#include)

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C So, how do you run this thing? first, compile it (translate it from human language to computer instructions). gcc very2.c –o very2.out Then run it./very2.out

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING A very, very short course on C –so let’s walk through this code #include int main (void) { int day = 1; printf("Hello, I am having so much fun on day %d.\n", day); return 0; }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING #include int main (void) { int matrix[5000][5000]; int i,j; long walltime; struct timeval tim; double starttime = 0, endtime = 0; printf("Start\n"); srand(time(NULL)); gettimeofday(&tim, NULL); starttime = tim.tv_sec*1. + (tim.tv_usec/ ); for(i = 0; i <5000; i++) { for ( j = 0; j < 5000; j++) {matrix[i][j] = rand() % 1000 ; } /*more goes here */ gettimeofday(&tim, NULL); endtime = tim.tv_sec*1. + (tim.tv_usec/ ); for (i=0; i < 10; i++) { printf("%d, ",matrix[i][0]); } printf("\nFinished - %30.10f seconds elapsed\n", endtime - start time); return 0; }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing #include int main (void) { int matrix[1500][1500]; int i,j; long walltime; struct timeval tim; double starttime = 0, endtime = 0; printf("Start\n"); srand(time(NULL)); gettimeofday(&tim, NULL); starttime = tim.tv_sec*1. + (tim.tv_usec/ ); for(i = 0; i <1500; i++) { for ( j = 0; j < 1500; j++) {matrix[i][j] = rand() % 1000 ; } /* do some work here */ for(i = 0; i < 1500; i++) { for(j = 0; j < 1500; j++) { matrix[i][j] = matrix[i][j] *4 + 20; } gettimeofday(&tim, NULL); endtime = tim.tv_sec*1. + (tim.tv_usec/ ); for (i=0; i < 10; i++) { printf("%d, ",matrix[i][0]); } printf("\nFinished - %30.10f seconds elapsed\n", endtime – starttime); return 0; }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque/Moab –What are these –PBS/Torque is a System Resource Management package Why? –Moab is a resource schedule and management utility Sits on PBS/Torque

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Basic User Commands –qsub --- submits requests for HPC resources “run my job” –qstat --- check on the status of your job (and everyone else) –qdel --- removes job from the queue –qalter --- change most attributes of submitted job –qmove --- move job to a different queue

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Basic Job Scriptsimplejob.sh #! /bin/bash #PBS -N testjob #PBS -l walltime=00:10:00 #PBS -m ae #PBS -M #PBS -q training cd /home/dem./simple.out

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Job Submission qsub simplejob.sh mountaineer.mountaineer qstat … mountaineer testjob dem 00:00:00 C debug

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Job Submission …and what happened? ~]$ ls *15796* testjob.e15796 testjob.o15796 ~]$ more testjob.o15796 Start 144, 300, 423, 206, 856, 313, 265, 97, 664, 221, Finished seconds elapsed

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Job Submission …one more thing qsub –I (interactive jobs)

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING PBS/Torque Job Submission Find out more man pages Tutorials – +Submitting+a+job+using+qsubhttps://wikis.nyu.edu/display/NYUHPC/Tutorial+- +Submitting+a+job+using+qsub

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING – CREATING PARALLEL PROGRAMS MPI – Message Passing Interface –really a standard, not software, but –comes in many flavors MPICH, MPICH2, Intel, OpenMPI,… –There are others message passing protocols –Defines a standard for exchanging messages across processes working on the same problem –Accomplished in the form of function or subroutine calls in your code. –MPI is not a language –MPI is a library –Can be called from and used by C, C++ and Fortran

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing BASIC MPI FUNCTIONS … but first include… –#include “mpi.h”

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing BASIC MPI FUNCTIONS int MPI_Init(int argc_ptr, char** argv_ptr) –Initializes MPI in the application –MPI_Init(&argc, &argv); int MPI_Finalize() –Closes/shutdown MPI for the application –MPI_Finalize();

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing BASIC MPI FUNCTIONS int MPI_Comm_size(MPI_comm comm, int* size) –Returns the size of the group in size –MPI_Comm_size(MPI_COMM_WORLD, &nprocs) Int MPI_Comm_rank(MPI_comm comm, int* rank) –Returns the rank (ID) of this process in rank –MPI_Comm_rank(MPI_WORLD_COMM, &myrank);

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI SEND AND RECEIVE MPI_Send and MPI_Recv are the most elemental forms of MPI data communications Provide the core set of functions MPI_Send and MPI_Recv are blocking communications –Processing cannot proceed until the communication process is complete.

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI_SEND – SEND A MESSAGE MPI_Send( void*message, intcount, MPI_Datatype datatype, intdest, inttag, MPI_Commcomm)

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI_SEND MPI_Send(a,1,MPI_FLOAT,myrank+1,11,MPI_COMM_WORLD) sends a single float to the next process in MPI_COMM_WORLD and attaches a tag of 11. MPI_Send(vect,100, MPI_FLOAT,5,12, MPI_COMM_WORLD); sends a vector of 100 floats to process 5 in MPI_COMM_WORLD and uses a tag of 12.

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI_RECV int MPI_Recv( void* message, intcount, MPI_Datatypedatatype, intsource, inttag, MPI_Commcomm, MPI_Status*status)

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI_RECV MPI_Recv(x, 1, MPI_FLOAT, lsource, 11, MPI_COMM_WORLD, status); picks up a message with a tag=11,from the source lsource in MPI_COMM_WORLD. The status of the transaction is stored in status. MPI_Recv(xarray, 100, MPI_FLOAT, xproc, 12, MPI_COMM_WORLD, status); picks up a message tagged 12 from the source xproc in MPI_COMM_WORLD. That status of the transaction is stored in status.

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing MPI_RECV - WILDCARDS MPI_ANY_SOURCE –lets MPI_Recv take a message from any source. Use as the source parameter MPI_ANY_TAG –lets MPI_Recv take a message regardless of its tag.

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing OTHER MPI INFORMATION Appendix A of Pacheco book Argonne National Laboratories – The MPI Forum – MPI Book – book.html

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING – CREATING PARALLEL PROGRAMS #include int main(int argc, char *argv[]) { int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); printf("Process %d on %s out of %d\n", rank, processor_name, numprocs); MPI_Finalize(); }

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING – CREATING PARALLEL PROGRAMS …but running in parallel on an HPC means that you have to ask for different resources i.e. a new PBS script #! /bin/bash #PBS -N testjob #PBS -l walltime=00:01:00 #PBS -m ae #PBS -M #PBS -q hpc2013 #PBS -l nodes=1:ppn=4 cd /home/dmclaughlin/mpi /shared/intel/impi/ /intel64/bin/mpirun -np 4./hellompi

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing HIGH PERFORMANCE COMPUTING – CREATING PARALLEL PROGRAMS Run this and you should get output like this ~]$ more testjob.o15803 Process 0 on compute out of 4 Process 2 on compute out of 4 Process 1 on compute out of 4 Process 3 on compute out of 4

WEST VIRGINIA UNIVERSITY High Performance and Scientific Computing FOR MORE INFORMATION PLEASE CONTACT: Don McLaughlin Nathan Gregg (304)