Wprowadzenie System rozproszony jest kolekcją niezależnych, autonomicznych komputerów, które dla użytkownika prezentują się jak jeden komputer. ożna wyróżnić dwa aspekty tej definicji: sprzętowy komputery są autonomiczne użytkownika dla użytkownika system sprawia wrażenie jakby pracował na jednym komputerze. 1 1
Klasyfikacja Architektur Równoległych ze względu na mechanizm sterowania - SID - ID ze względu na organizacje przestrzeni adresowej - architektura message-passing - architektura ze współdzielona pamięcią - UA - NUA Ze względu na charakter sieci połączeniowej - statyczne - dynamiczne 2 2
Architektura ze współdzieloną pamięcią Sieć połączeniowa Sieć połączeniowa UA NUA 3 3
Typowa architektura message-passing Sieć ołączeniowa...... - rocesor - amięć 4 4
Dynamiczne sieci połączeniowe System z przełącznicą krzyżową Architektura szynowa Wielostanowa sieć połączeń 5 5
System z przełącznicą krzyżową 0 1 2 3 0 0 1 2 3 4 Element przełączający p-1 6 6
Architektura Szynowa amięć Główna Szyna rocesor rocesor rocesor 7 7
Wielostanowa sieć połączeń rocesory 0 1 Banki amięci 0 1 Stan 1 Stan 2 Stan n p-1 b-1 8 8
Koszt Wydajność Koszt & Wydajność przełącznica wielostanowa szyna przełącznica wielostanowa szyna Liczba procesorów Liczba procesorów 9 9
Sieć Omega rzełączenie proste rzełączenie krzyżowe 000 001 010 011 100 101 110 111 000 001 010 011 100 101 110 111 10 10
Sieci Statyczne Sieć pełna Sieć typu gwiazda Sieć typu magistrala Sieć typu Ring Sieć typu esh krata (2D, 3D, z zapętleniami) Sieć typu Hypercube (Hiperkostka) 11 11
Sieci Statyczne Siec pełna Sieć typu gwiazda Sieć typu magistrala Sieć typu ring Dwu-wymiarowa siec typu esh Dwu wymiarowa sieć esh z zapętleniami 12 12
Sieci Statyczne Trzy wymiarowa sieć typu esh (krata) rocesor Element przełączający 13 Sieć typu drzewo binarne 13
Sieć Hypercube (hiperkostka) 0 00 10 000 100 010 110 0-D hypercube 1 01 11 101 001 011 111 1-D hypercube 2-D hypercube 3-D hypercube 0100 0110 1100 1110 0000 0010 1000 1010 0101 0111 1101 1111 0001 0011 1001 1011 4-D hypercube 14 14
essage passing parallel programming paradigm several instances of the sequential paradigm are considered together separate workers or processes interact by exchanging information emory rocessor communication network 15 15
essage assing Interface I extended message-passing model for parallel computers, clusters and heterogeneous networks not a language or compiler specification not a specific implementation or product support send/receive primitives communicating with other workers in-order data transfer without data loss several point-to-point and collective communications I supports the development of parallel libraries I does not make any restrictive assumptions about the underlying hardware architecture 16 16
essage assing Interface I I is very large (125 functions) - I s extensive functionality requires many functions I is very small and simple (6 functions) - many parallel programs can be written with just 6 basic functions I_Init() I_Finalize() I_Comm_rank() I_Comm_size() I_Send() I_Recv() 17 17
Two main functions Initializing I every I program must call this routine once, before any other I routines I_Init(&argc, &argv); Clean-up of I every I program must call this routine when all communications have completed I_Finalize(); 18 18
Communicator How do you identify different processes? an I process can query a communicator for information about the group a communicator returns in rank of the calling process I_Comm_rank(I_CO_WORLD, &rank); How many processes are contained within a communicator? a communicator returns the # of processes in the communicator I_Comm_size(I_CO_WORLD, &size); 19 19
An example #include mpi.h #include <stdio.h> int main(int argc, char** argv) { int rank, size; I_Init(&argc, &argv); I_Comm_rank(I_CO_WORLD, &rank); I_Comm_size(I_CO_WORLD, &size); printf( Hello, world! I m %d of %d\n, rank, size); I_Finalize(); return 0; } 20 20
Communicator Communicator I processes can only communicate if they share a communicator I_CO_WORLD - predefined default communicator in I_Init()call 21 21
Sending essages communicator 0 1 3 source 4 5 dest 2 communication between only 2 processes source process sends message to destination process destination process is identified by its rank in the communicator 22 22
essage I types an array of elements of a particular I datatype basic I datatype I datatype - I_(UNSIGNED_)CHAR : signed(unsigned) char - I_(UNSIGNED_)SHORT : signed(unsigned) short int - I_(UNSIGNED_)INT : signed(unsigned) int - I_(UNSIGNED_) LONG : signed(unsigned) long int - I_FLOAT : float - I_DOUBLE : double 23 23
Send essage I_Send(void* buf, int count, I_Datatype datatype, int dest, int tag, I_CO_WORLD); /* (IN) buf : address of the data to be sent */ /* (IN) count : # of elements of the I Datatype */ /* (IN) dest : destination process for the message (rank of the destination process) */ /* (IN) tag : marker distinguishes used message type */ 24 24
Receive essage I_Recv(void *buf, int count, I_Datatype datatype, int source, /* I_ANY_SOURCE */ int tag, /* I_ANY_TAG */ I_CO_WORLD, I_Status *status); /* (IN) buf : address where the data should be placed*/ /* (IN) count : # of elements of the I Datatype */ /* (IN) source : rank of the source of the message */ /* (IN) tag : receives a message having this tag*/ /* (OUT) status : some information to be used at later */ 25 25