Cluster Computing: Dr. C. Amalraj 01/03/2021 The University of Moratuwa Amalraj@uom - LK
Cluster Computing: Dr. C. Amalraj 01/03/2021 The University of Moratuwa Amalraj@uom - LK
(IN 4700)
Dr. C. Amalraj
01/03/2021
The University of Moratuwa
amalraj@uom.lk
Lecture 4:
Parallel Architectures
Today’s Outline
5
Classification of parallel architectures
parallel architectures
architectures can be roughly
parallel
broken down into many categories
(some are listed below):
Clusters
Grids:
Research institutes and universities federate
their services around the world through projects
such as EGI-InSPIRE and the European Grid
Infrastructure.
Clouds:
Large individual companies e.g. Amazon and
Microsoft and at a smaller scale, institutes and
organisations deploying open source software
such as Open Slate, Eucalyptus and Open
Nebula.
Grid vs. Cloud : Who uses the service?
Grids:
Research collaborations, called "Virtual
Organisations", which bring together researchers
around the world working in the same field.
Clouds:
Small to medium commercial businesses or
researchers with generic IT needs
Grid vs. Cloud : Who pays for the service?
Grids:
Governments - providers and users are usually
publicly funded research organisations, for
example through National Grid Initiatives.
Clouds:
The cloud provider pays for the computing
resources; the user pays to use them.
Grid vs. Cloud : Where are the computing resources?
Grids:
In computing centres distributed across different
sites, countries and continents.
Clouds:
The cloud providers private data centres which
are often centralised in a few locations with
excellent network connections and cheap
electrical power.
Grid vs. Cloud : What are they useful for?
Grids:
Grids were designed to handle large sets of
limited duration jobs that produce or use large
quantities of data
(e.g. the Large Hadron Collider(LHC) and life
sciences)
Clouds:
Clouds best support long term services and
longer running jobs (E.g. facebook.com)
Grid vs. Cloud : How do they work?
Grids:
Grids are an open source technology. Resource
users and providers alike can understand and
contribute to the management of their grid
Clouds:
Clouds are a proprietary technology. Only the
resource provider knows exactly how their cloud
manages data, job queues, security requirements
and so on.
Massively Parallel Processing (MPP)
Simply put, Massively Parallel Processing is the
use of many processors.
Traditional MPP machines are distributed
memory machines that use multiple processors
(versus SMP's, which employ a shared memory
architecture).
MPPs have many of the same characteristics as
clusters, but MPPs have specialized
interconnect networks (whereas clusters use
commodity hardware for networking).
Massively Parallel Processing (MPP)
However, there seems to be a blurred line
separating distributed computing, MPP,
clusters and Networks of Workstations (NOW's).
All four architectures are distributed memory
architectures.
The term also applies to massively parallel
processor arrays (MPPAs), a type of integrated
circuit with an array of hundreds or thousands
of CPUs and RAM banks. These processors pass
work to one another through a reconfigurable
interconnect of channels.
Distributed Computers
Distributed Computing usually is the process of stealing
idle cycles from ordinary computers.
Most NoWs fall into this category (Distributed Computing ),
although sometime people classify a dedicated group of
machines with different hardware architectures as a NoW
(which would actually seem to fall into the category of a
cluster). While Distributed Computers use many processors
and distributed memory, they are usually not dedicated to
the parallel applications.
Clusters are typically dedicated to the parallel application.
These systems are usually built from commercial hardware
and software joined by a network and employing some type
of message passing.
Massively Parallel Processing (MPP)
True MPPs for the most part employ proprietary OS's
and at least some special hardware. They are typically
very large, very powerful machines. Most MPPs are
used for computationally intensive research in the
engineering and sciences fields.
CC-NUMA employs a different type of memory access.
While the memory is physically distributed a CC-NUMA
machine still retains some of the benefits of an SMP,
because the memory is logically considered shared.
Shared Memory Architecture (SMP)
CPUs access shared memory through a bus
All processors share a single view of data and the
communication between processors can be as
fast as memory accesses to a same location
CPU-to-memory connection becomes bottleneck
(req. high speed interconnects !!!)
P P P P
M M M M
BUS (Network Bus)
P NIC P NIC P NIC P NIC
Network Memory
Distributed Memory Shared Memory
Shared Memory Architecture
UMA (Uniform Memory Access): individual
processors share memory (and I/O) in such a way that
each of them can access any memory location with the
same speed
Many small shared machines are symmetric
Larger shared memory machines do not satisfy this
definition (NUMA or cc-NUMA)
P P P P P P P P
NUMA (Non Uniform
Memory Access) architecture BUS (Network Bus) BUS (Network Bus)
L
CPU 2
C Disk
Register a
c
Memory
L1 Cache h
e
Shared Memory Architecture
30
Why Use MPI?
Standardization: de facto standard for parallel
computing
Not an IEEE or ISO standard, but “industry standard”
Practically replaced all previous message passing libraries
Portability: supported on virtually all HPC platforms
No need to modify source code when migrating to
different machines
Performance: so far the best; high performance and
high scalability
Rich functionality:
MPI 1.1 – 125 functions
MPI 2 – 152 functions. If you know 6 MPI functions,
you can do almost everything
in parallel.
31
Programming Model
Message passing model: data exchange through explicit
communications.
For distributed memory, as well as shared-memory parallel
machines
User has full control (data partition, distribution) : needs to
identify parallelism and implement parallel algorithms using MPI
function calls.
Number of CPUs in computation is static
New tasks cannot be dynamically spawned during run time (MPI 1.1)
MPI 2 specifies dynamic process creation and management, but not
available in most implementations.
Not necessarily a disadvantage
General assumption: one-to-one mapping of MPI processes to
processors (although not necessarily always true).
32
MPI 1.1 Overview
33
MPI 2 Overview
Dynamic process creation and management
Creation of new processes on the fly
Connecting previously existing processes
One-sided communications
reduces synchronization and so improve performance
reduces data movement
simplifies programming
MPI Input / Output (Parallel I/O)
Extended collective communications
Useful in pipelined algorithms where data needs to be
moved from one group of processes to another
C++ binding 34
Message Passing Models
35
MPI Resources
MPI Standard:
http://www.mpi-forum.org/
MPI web sites/tutorials etc, available online
Public domain (free) MPI implementations
MPICH2 and MPICH3 (from ANL)
LAM MPI
• More recently, it has evolved to OpenMPI (not to be
confused with OpenMP)
Microsoft MPI (for Windows OS)
36
General MPI Program Structure
37
Example On 4 processors:
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &num_cpus);
printf(“Hello, I am process %d among %d processes\n”,
my_rank, num_cpus);
MPI_Finalize();
return 0;
}
38
Example On 4 processors:
include ‘mpif.h’
integer :: ierr, my_rank, num_cpus
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, my_rank)
call MPI_COMM_SIZE(MPI_COMM_WORLD, num_cpus)
write(*,*) “Hello, I am process “, my_rank, “ among “ &
, num_cpus, “ processes”
call MPI_FINALIZE(ierr)
39
MPI Header Files
In C/C++:
#include <mpi.h>
In FORTRAN:
include ‘mpif.h’
or (in FORTRAN90 and later)
use MPI
40
MPI Naming Conventions
All names have MPI_ prefix.
In FORTRAN:
All subroutine names upper case, last argument is return code
call MPI_XXXX(arg1,arg2,…,ierr)
call MPI_XXXX_XXXX(arg1,arg2,…,ierr)
41
Initialization
Initialization: MPI_Init() initializes MPI environment;
(MPI_Init_thread() if multiple threads)
Must be called before any other MPI routine (so put it at the beginning
of code) except MPI_Initialized() routine.
Can be called only once; subsequent calls are erroneous.
MPI_Initialized() to check if MPI_Init() is called
45
How many CPUs, Which one am I …
How many CPUs: MPI_COMM_SIZE()
Who am I: MPI_COMM_RANK()
Can compute data decomposition etc.
Know total number of grid points, total number of cpus and current
cpu id; can calc which portion of data current cpu is to work on.
E.g. Poisson equation on a square
Ranks also used to specify source and destination of
communications.
49