BIg Data Anslysi
BIg Data Anslysi
1
Current HPC Platforms: COTS-Based Clusters
Access File
Control Server(s)
2
Shared and Distributed Memory
OpenMP
Pthreads MPI
Java Threads
MPI
CPU1 CPU2
node1 node2 node3
core1 core2 core1 core2
FSB
Platform (node)
3
TOP 500 Supercomputers
4
TOP 500 Supercomputers
Countries’ share
5
TOP 500 Super Computers
Nov 2021
6
TOP 500 Supercomputers
Fugaku Supercomputer
7
MareNostrum Supercomputer, Barcelona 2010
8
What to do with huge problems?
9
What to do with huge problems?
10
Messare Passing Interface
11
Messare Passing Interface
• MPI is a standard
• Agreed upon through extensive joint effort of ~100 representatives
from ~40 different organisations (the MPI Forum)
• Academics
• Industry experts
• Vendors
• Application developers
• Users
• First version (MPI 1.0) drafted in 1993
• Now on version 3 (version 4 being drafted)
12
MPI Sources
13
MPI Datatypes
MPI Datatype C datatype
MPI_INTEGER int
MPI_FLOAT float
MPI_DOUBLE double
…….
14
Implementations
• C/C++/Fortran:
1 MPICH
2 Open MPI
3 DeinoMPI
• Java: MPJExpress
• C#: MPI.NET
• Python: pyMPI
15
M PI
Compilation in C:
mpicc -o prog prog.c
Compilation in C++:
mpiCC -o prog prog.c
mpicxx -o prog prog.cpp
Compilation in Java:
Compile: javac -cp .;%MPJ_HOME%/lib/mpj.jar HelloWorld.java
Executing program with 2 processes:
mpjrun.bat -np 2 HelloWorld
(http://mpjexpress.org/docs/guides/windowsguide.pdf) 16
Typical Structure
17
Typical Structure
18
Message passing
n Messages are packets of data moving between sub-
programs
n Necessary information for the message passing
system:
n sending process – receiving process i.e., the ranks
n source location – destination location
n source data type – destination data type
n source data size – destination buffer size
data
program
communication network
19
Access
n MPI:
n program must be linked with an MPI library
n program must be started with the MPI startup tool
20
Messages
21
The Message-Passing Programming Paradigm
communication network
22
The Message-Passing Programming Paradigm
• A process is a program performing a task on a processor
• Each processor/process in a message passing program runs a
instance/copy of a program:
• written in a conventional sequential language, e.g., C or Fortran,
• typically a single program operating on multiple dataset
• Single Program, Multiple Data (SPMD)
• the variables of each sub-program have
• the same name
• but different locations (distributed memory) and different data!
• i.e., all variables are local to a process
• communicate via special send & receive routines (message
passing)
communication network
23
Data and Work Distribution
myrank=
myrank=0 myrank=1 myrank=2
(size-1)
data data data data
communication network
24
Communicators
25
Simple MPI Program
26
MPI Init and MPI Finalize
27
Important Runtime Parameters
• After MPI.Init, there are two main functions that are called.
• MPI programs need information about
1 “themselves” and
2 the current system of processes
• How many processes are there?
• MPI.Comm_World.Size()
• returns the size of a communicator
• Which ID do I have?
MPI.Comm_World.Rank()
• rank∈ {0. . . size− 1}
• returns the rank of a process in a communicator
28
Listing: Extended MPI Program
29
Point to Point Communication
item-1
item-2
item-3 “count“
item-4 elements
...
item-n
30
Blocking Send
32
Blocking Receive
33
Blocking Receive
34
Deadlock
1
0
2 3
6
5 4
35
Non-Blocking Communications
36
Non-Blocking Examples
Wait(...)
0
37
Test
38
Wait
39
Non-blocking Send
• Sometimes, we want to keep calculating while sending/receiving is
going on: non-blocking operations
• Returns request object that can be used to check information about the operation 40
Non-blocking Recv
• Sometimes, we want to keep calculating while sending/receiving is
going on: non-blocking operations
• Returns request object that can be used to check information about the operation 41
Non-blocking Send/Recv
42
Non-Blocking Send
1
0
2 3
6
5 4
43
Non-Blocking Receive
1
0
2 3
6
5 4
44
Requirements for Point-to-Point Communications
45
Example – Simple send and receive
46
Example – Simple send and receive (Blocking)
47
Assignment – MPI Ping Pong Program
n Write psuedocode
n Two processes ping pong an integer back and forth,
incrementing it until it reaches a given value.
48
Example – Ping Pong
50
Collective Communication
51
Barrier
• MPI_Barrier()
52
Barrier
53
Broadcast, Scatter, & Gather
54
Broadcast
• Simplest way to do collective communication is broadcast
55
Scatt er
Divides an array of sendcount elements into n pieces, where n is the number of
processes in a communicator
• If root: sends the pieces to each of the n processes (including itself)
• If not root: receive a data piece
56
Gather
• Complement to MPI_Scatter
• Receives data in small arrays from all processes in a communicator
• If root: combines all the data into one array
57
Thank you
58