Avast Premium Security Crack + License Key Till 2050
305 views
29 slides
Mar 05, 2025
Slide 1 of 29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
About This Presentation
COPY & PASTE LINKššš https://up-community.pro/dld/
Avast Premium Security Crack is the most powerful antivirus application that provides multiple functions related to internet security, privacy, and performance.
Size: 164.85 KB
Language: en
Added: Mar 05, 2025
Slides: 29 pages
Slide Content
Message Passing Interface
Shared Memory Model
ā¢In the shared-memory programming model, tasks share a common
address space, which they read and write asynchronously.
ā¢Various mechanisms such as locks / semaphores may be used to control
access to the shared memory.
ā¢An advantage of this model from the programmer's point of view is that
the notion of data "ownership" is lacking, so there is no need to specify
explicitly the communication of data between tasks. Program
development can often be simplified.
ā¢An important disadvantage in terms of performance is that it becomes
more difficult to understand and manage data locality.
Shared Memory Model: Implementations
ā¢On shared memory platforms, the native
compilers translate user program variables
into actual memory addresses, which are
global.
Message Passing Interface
The Message-Passing Model
ā¢A process is (traditionally) contain program counter and
address space
ā¢Processes may have multiple threads
āprogram counters and associated stacks
āsharing a single address space.
ā¢MPI is for communication among processes
ļseparate address spaces
ā¢Interprocess communication consists of
āSynchronization
āMovement of data from one processās address space to
anotherās.
Message Passing Model Implementations:
MPI
ā¢From a programming perspective, message passing implementations
commonly comprise a library of subroutines that are imbedded in source
code. The programmer is responsible for determining all parallelism.
ā¢Historically, a variety of message passing libraries have been available
since the 1980s. These implementations differed substantially from each
other making it difficult for programmers to develop portable applications.
ā¢In 1992, the MPI Forum was formed with the primary goal of establishing
a standard interface for message passing implementations.
ā¢Part 1 of the Message Passing Interface (MPI) was released in 1994. Part 2
(MPI-2) was released in 1996. Both MPI specifications are available on the
web at www.mcs.anl.gov/Projects/mpi/standard.html.
Types of Parallel Computing Models
ā¢Data Parallel
āthe same instructions are carried out simultaneously on multiple
data items (SIMD)
ā¢Task Parallel
ādifferent instructions on different data (MIMD)
ā¢SPMD (single program, multiple data)
ānot synchronized at individual operation level
ā¢SPMD is equivalent to MIMD since each MIMD program can
be made SPMD (similarly for SIMD, but not in practical
sense)
Message passing (and MPI) is for MIMD/SPMD
parallelism. HPF is an example of a SIMD interface
Message Passing
ā¢Basic Message Passing:
āSend: Analogous to mailing a letter
āReceive: Analogous to picking up a letter from the mailbox
āScatter-gather: Ability to āscatterā data items in a message
into multiple memory locations and āgatherā data items
from multiple memory locations into one message
ā¢Network performance:
āLatency: The time from when a Send is initiated until the
first byte is received by a Receive.
āBandwidth: The rate at which a sender is able to send data
to a receiver.
Methods of Creating Process
ā¢Two method of creating Process
1.Static Process Communication
ā¢Numbers specified before execution starts
ā¢programmer explicitly mention in code
ā¢Difficult programming but easy implementation
2.Dynamic Process Communication
ā¢Process creates during execution of other processes
ā¢System calls are used to create processes
ā¢Process number vary during execution
Methods of Creating Process
ā¢In reality Process number are defined prior to
execution
ā¢One master Processes
ā¢Many slave Processes which are identical in functionality but have
different id
Message Passing Interface (MPI)
ā¢The simplest way to communicate point to point
messages between two MPI processes is to use
āMPI_Send( )
ā¢to send messages
āMPI_Recv( )
ā¢to receive messages
Message Passing Interface (MPI) Requirement
ā¢The data type being sent/received
ā¢The receiver's process ID when sending
ā¢The senderās process ID (or MPI_ANY_SOURCE) when
receiving
ā¢The senderās tag ID (or MPI_ANY_TAG) when
receiving
Message Passing Interface (MPI)
ā¢In order to receive a message, MPI requires the type,
processid and the tag match if they donāt match, the
receive call will wait forever-hanging your program
MPI_Init
It is used initializes the parallel code segment.
Always use to declare the start of
the parallel code segment.
ā¢int MPI_Init( int* argc ptr /* in/out */ ,char** argv ptr[ ] /* in/out */)
OR Simply
MPI_Finalize
ā¢It is used to declare the end of the parallel
code segment. It is important to note
ā¢that it takes no arguments.
ā¢int MPI Finalize(void)
or simply
MPI_Finalize()
MPI_Comm_rank
ā¢It provides you with your process
identification or rank
ā¢Which is an integer ranging from 0 to P ā 1,
where P is the number of processes on which
are running),
ā¢int MPI_Comm_rank(MPI Comm comm /* in */,int* result /* out */)
or simply
ā¢MPI_Comm_rank(MPI_COMM_WORLD,&myrank)
MPI_Comm_size
ā¢It provides you with the total number of
processes that have been allocated.
ā¢int MPI_Comm_size( MPI Comm comm /* in */,int* size /* out */)
or simply
ā¢MPI_Comm_size(MPI_COMM_WORLD,&mysize)
MPI_COMM_WORLD
ā¢comm is called the communicator, and it essentially
is a designation for a collection of processes which
can communicate with each other.
ā¢MPI has functionality to allow you to specify varies
communicators (differing collections of processes);
⢠however, generally MPI_COMM_WORLD, which is
predefined within MPI and consists of all the
processes initiated when a parallel program, is
used.
MPI Data types
MPI_Send
ā¢int MPI_Send( void* message /* in */, int
count /* in */, MPI Datatype datatype /* in
*/, int dest /* in */, int tag /* in*/, MPI
Comm comm /* in */ )
MPI_Recv
ā¢int MPI_Recv( void* message /* out */, int
count /* in */, MPI Datatype datatype /* in
*/, int source /* in */, int tag /* in*/, MPI
Comm comm /* in */, MPI Status* status /*
out */)
Argument List
ā¢message - starting address of the send/recv buffer.
ā¢count - number of elements in the send/recv buffer.
⢠datatype - data type of the elements in the send
buffer.
⢠source - process rank to send the data.
⢠dest - process rank to receive the data.
⢠tag - message tag.
⢠comm - communicator.
⢠status - status object.
Example Code 1
#include <iostream.h>
#include <mpi.h>
int main(int argc, char * argv)
{
int mynode, totalnodes;
int datasize; // number of data units to be sent/recv
int sender=2; // process number of the sending process
int receiver=4; // process number of the receiving process
int tag; // integer message tag
MPI_Status status; // variable to contain status information
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
MPI_Comm_rank(MPI_COMM_WORLD, &mynode);
// Determine datasize
databuffer=111
if(mynode==sender)
MPI_Send(databuffer,datasize,MPI_DOUBLE,receiver, tag,MPI_COMM_WORLD);
if(mynode==receiver)
MPI_Recv(databuffer,datasize,MPI_DOUBLE,sender,tag, MPI_COMM_WORLD,&status);
Print(āProcessor %d got % /n,ā myid, databuffer);
// Send/Recv complete
MPI_Finalize();
}
Important Points
ā¢In general, the message array for both the sender and
receiver should be of the same type and both of same size at
least datasize.
⢠In most cases the sendtype and recvtype are identical.
⢠The tag can be any integer between 0-32767.
⢠MPI Recv may use for the tag the wildcard MPI ANY TAG. This
allows an MPI Recv to receive from a send using any tag.
⢠MPI Send cannot use the wildcard MPI ANY TAG. A special
tag must be specified.
⢠MPI Recv may use for the source the wildcard MPI ANY
SOURCE. This allows an MPI Recv to receive from a send from
any source.
⢠MPI Send must specify the process rank of the destination.
No wildcard exists.
MPI_Recv(&accum,1,MPI_INT,j,1,MPI_COMM_WORLD,&status);
sum = sum + accum;
}
if(mynode == 0)
cout << "The sum from 1 to 1000 is: " << sum <<
endl;
MPI_Finalize();
}