520 likes | 683 Views
CSE 8383 - Advanced Computer Architecture. Week-12 April 8, 2004 engr.smu.edu/~rewini/8383. Contents. Dynamic Networks Message Passing Mechanisms Message Passing in PVM. Dynamic Network Analysis. Parameters: Cost: number of switches Delay: latency Blocking characteristics
E N D
CSE 8383 - Advanced Computer Architecture Week-12 April 8, 2004 engr.smu.edu/~rewini/8383
Contents • Dynamic Networks • Message Passing Mechanisms • Message Passing in PVM
Dynamic Network Analysis • Parameters: • Cost: number of switches • Delay: latency • Blocking characteristics • Fault tolerance
M M M M MIMD Distributed Memory Systems P P P P Interconnection Networks
Interconnection Network Taxonomy Interconnection Network Dynamic Static Bus-based Switch-based 1-D 2-D HC Crossbar Single Multiple SS MS
Dynamic Interconnection Networks • Communication patterns are based on program demands • Connections are established on the fly during program execution • Multistage Interconnection Network (MIN) and Crossbar
Switch Modules • A x B switch module • A inputs and B outputs • In practice, A = B = power of 2 • Each input is connected to one or more outputs (conflicts must be avoided) • One-to-one (permutation) and one-to-many are allowed
2x2 Switch Binary Switch Legitimate States = 4 Permutation Connections = 2
Straight Exchange Upper-broadcast Lower-broadcast The different setting of the 2X2 SE Legitimate Connections
Group Work General Case ??
Multistage Interconnection Networks ISC Inter-stage Connection Patterns ISC1 ISC2 ISCn switches switches switches
Perfect-Shuffle Routing Function • Given x = {an, an-1, …, a2, a1} • P(x) = {an-1, …, a2, a1 , an} X =110001 P(x) = 100011
Perfect Shuffle Example 000 000 001 010 010 100 011 110 100 001 101 011 110 101 111 111
000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 Perfect-Shuffle
Exchange Routing Function • Given x = {an, an-1, …, a2, a1} • Ei(x) = {an, an-1, …, ai, …, a2, a1} X = 0000000 E3(x) = 0000100
Exchange E1 000 001 001 000 010 011 011 010 100 101 101 100 110 111 111 110
000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 Exchange E1
Butterfly Routing Function • Given x = {an, an-1, …, a2, a1} • B(x) = {a1 , an-1, …, a2, an} X =010001 P(x) = 110000
Butterfly Example 000 000 001 100 010 010 011 110 100 001 101 101 110 011 111 111
000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 Butterfly
Multi-stage network 000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111
MIN (cont.) An 8X8 Banyan network
Min Implementation Control (X) Source (S) Destination (D) X = f(S,D)
A C A C B D B D X = 0 X = 1 ( ) ) crossed (straight Example
Consider this MIN stage 2 stage 1 stage 3 D1 S1 D2 S2 S3 D3 D4 S4 D5 S5 D6 S6 D7 S7 S8 D8
Example (Cont.) • Let control variable be X1, X2, X3 • Find the values of X1, X2, X3 to connect: • S1 D6 • S7 D5 • S4 D1
The 3 connections stage 2 stage 1 stage 3 D1 S1 D2 S2 S3 D3 D4 S4 D5 S5 D6 S6 D7 S7 S8 D8
Boolean Functions • X = x1, x2, x3 • S = s2, s2, s3 • D = d1, d2, d3 • Find X = f(S,D)
M1 M2 M3 M4 M5 M6 M7 M8 P1 P2 P3 P4 P5 P6 P7 P8 Crossbar Switch
Analysis and performance metricsdynamic networks • Performance comparison of dynamic networks
Message Passing Mechanisms • Message Format • Message arbitrary number of fixed length packets • Packet basic unit containing destination address. Sequence number is needed • A packet can further be divided into flits (flow control digits) • Routing and sequence occupy header flit
Message, Packets, Flits Message Packet Destination Sequence Data flit
Store and Forward Routing • Packets are the basic units of information flow • Each node uses a packet buffer • A packet is transferred from S to D through a sequence of intermediate nodes • Channel and buffer must be available
Wormhole Routing • Flits are the basic units of information flow • Each node uses a flit buffer • Flits are transferred from S to D through a sequence of intermediate routers in order (Pipeline) • Can be visualized as a railroad train • Flits from different packets cannot be mixed up
Latency Analysis • L packet length (in bits) • W Channel bandwidth (bits/sec) • D Distance (number of hops) • F flit length (in bits) • TSF = D * L/W • TWH = L/W + D* F/W L/Wif L>>F (independent of D)
Communication Patterns • Point to Point 1 - 1 • Multicast 1 - n • Broadcast 1 - all • Conference n - n
Routing Efficiency • Two Parameters • Channel Traffic (number of channels used to deliver the message involved) • Communication Latency (distance)
Multicast on a mesh (5 unicasts) Traffic ? Latency ?
Multicast on a mesh (multicast pattern 1 Traffic ? Latency ?
Multicast on a mesh (multicast pattern 2) Traffic ? Latency ?
Broadcast (tree structure) 3 2 3 4 2 1 2 3 1 1 2
Message Passing in PVM Sending Task Receiving Task User application Library User application Library 5 1 4 8 6 2 3 7 Daemon Daemon
Standard PVM asynchronous communication • A sending task issues a send command (point 1) • The message is transferred to the daemon (point 2) • Control is returned to the user application (points 3 & 4) • The daemon will transmit the message on the physical wire sometime after returning control to the user application(point 3)
Standard PVM asynchronous communication (cont.) • The receiving task issues a receive command (point 5) at some other time • In the case of a blocking receive, the receiving task blocks on the daemon waiting for a message (point 6). After the message arrives, control is returned to the user application (points 7 & 8) • In the case of a non-blocking receive, control is returned to the user application immediately (points 7 & 8)
Send (3 steps) • A send buffer must be initialized • The message is packed into the buffer • The completed message is sent to its destination(s)
Receive (2 steps) • The message is received • The received items are unpacked
Message Buffers • Buffer Creation (before packing) Bufid = pvm_initsend(encoding_option) Bufid = pvm_mkbuf(encoding_option) Encoding option Meaning 0 XDR 1 No encoding 2 Leave data in place
Message Buffers (cont.) • Data Packing pvm_pk*() • pvm_pkstr() – one argument pvm_pkstr(“This is my data”); • Others – three arguments • Pointer to the first item • Number of items to be packed • Stride pvm_pkint(my_array, n, 1); • Packing functions can be called multiple times to pack data into a single message
Sending a message • Point to point (one receiver) info = pvm_send(tid, tag) • broadcast (multiple receivers) info = pvm_mcast(tids, n, tag) info = pvm_bcast(group_name, tag) • Pack and Send (one step) info = pvm_psend(tid, tag, my_array, length, data type)
Receiving a message • Blocking bufid = pvm_recv(tid, tag) -1 wild card in either tid or tag • Nonblocking bufid = pvm_nrecv(tid, tag) bufid = 0 (no message was received) • Timeout bufid = pvm_trecv(tid, tag, timeout) bufid = 0 (no message was received)