Docsity

Parallel Processing: Architectures, Techniques, and Challenges, Lecture notes of Computer Architecture and Organization

Toggle sidebar
bg1
UNIT – V ADVANCED COMPUTER ARCHITECTURE
UNIT V
Parallel processing architectures and challenges, Hardware
multithreading, Multicore and shared memory multiprocessors,
Introduction to Graphics Processing Units, Clusters and Warehouse scale
computers – Introduction to Multiprocessor network topologies.
PARALLEL PROCESSING ARCHITECTURES AND
CHALLENGES
Parallel Processing Challenges
The difficulty with parallelism is not the hardware. It is difficult to
write software that uses multiple processors to complete one task faster,
and the problem gets worse as the number of processors increases.
Parallel processing programs been so much harder to
develop than sequential programs. The reason is to get better
performance or better energy efficiency from a parallel processing
program on a multiprocessor; or it is enough to use a sequential program
on a uniprocessor, as sequential programming is simpler. Uniprocessor
design techniques such as superscalar and out-of order execution take
advantage of instruction-level parallelism. Such innovations reduced the
demand for rewriting programs for multiprocessors.
Parallel processing programs is difficult to write since they
are fast, especially as the number of processors increases
For both this analogy and parallel programming, the challenges
include
•scheduling
•partitioning the work into parallel pieces
•balancing the load
•time to synchronize
•Overhead for communication.
Parallel processing challenges also include Amdahl’s law i.e. even
small parts of a program must be parallelized to make good use of many
cores.
Speed-up Challenge
Limitation in available parallelism makes it difficult to achieve good
speedups in any parallel processor.
What percentage of the original computation can be sequential to
achieve a speed-up of 90 times faster with 100 processors?
Amdahl’s Law says,
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Parallel Processing: Architectures, Techniques, and Challenges and more Lecture notes Computer Architecture and Organization in PDF only on Docsity!

UNIT – V ADVANCED COMPUTER ARCHITECTURE

UNIT V

Parallel processing architectures and challenges, Hardware multithreading, Multicore and shared memory multiprocessors, Introduction to Graphics Processing Units, Clusters and Warehouse scale computers – Introduction to Multiprocessor network topologies.

PARALLEL PROCESSING ARCHITECTURES AND

CHALLENGES

Parallel Processing Challenges

The difficulty with parallelism is not the hardware. It is difficult to write software that uses multiple processors to complete one task faster, and the problem gets worse as the number of processors increases. Parallel processing programs been so much harder to develop than sequential programs. The reason is to get better performance or better energy efficiency from a parallel processing program on a multiprocessor; or it is enough to use a sequential program on a uniprocessor, as sequential programming is simpler. Uniprocessor design techniques such as superscalar and out-of order execution take advantage of instruction-level parallelism. Such innovations reduced the demand for rewriting programs for multiprocessors. Parallel processing programs is difficult to write since they are fast, especially as the number of processors increases For both this analogy and parallel programming, the challenges include

  • scheduling
  • partitioning the work into parallel pieces
  • balancing the load
  • time to synchronize
  • (^) Overhead for communication. Parallel processing challenges also include Amdahl’s law i.e. even small parts of a program must be parallelized to make good use of many cores. Speed-up Challenge Limitation in available parallelism makes it difficult to achieve good speedups in any parallel processor.

What percentage of the original computation can be sequential to achieve a speed-up of 90 times faster with 100 processors?

Amdahl’s Law says,

Amdahl’s Law in terms of speed-up versus the original execution time:

This formula is usually rewritten assuming that the execution time before is 1 for some unit of time, and the execution time affected by improvement is considered the fraction of the original execution time:

Substituting 90 for speed-up and 100 for amount of improvement into the formula above:

Then simplifying the formula and solving for fraction time affected:

Thus, to achieve a speed-up of 90 from 100 processors, the sequential percentage can only be 0.1%. Thus to achieve good speed-up on a multiprocessor the entire program must usually be parallel with no serial portions. Programs do not operate in fully parallel or sequential mode, but it can use less than the full complement of the processor when running in parallel mode.

Speed-up Challenge: Bigger Problem

Suppose you want to perform two sums: one is a sum of 10 scalar variables, and one is a matrix sum of a pair of two-dimensional arrays, with dimensions 10 by 10. For now let’s assume only the matrix sum is parallelizable; we’ll see soon how to parallelize scalar sums. What speed- up do you get with 10 versus 40 processors? Next, calculate the speed- ups assuming the matrices grow to 20 by 20. If we assume performance is a function of the time for an addition, t, then there are 10 additions that do not benefit from parallel processors and 100 additions that do. If the time for a single processor is 110 t, the execution time for 10 processors is

So the speed-up with 10 processors is 110t/20t = 5.5. The execution time for 40 processors is

The speed-up drops from 20.5 to 410t/30t = 14. The remaining 39 processors are utilized less than half the time: while waiting 20t for hardest working processor to finish, they only compute for 380t/39 = 9.7t. If one processor has 12.5% of the load, it must perform 50 additions. The formula is:

The speed-up drops even further to 410t/60t = 7. The rest of the processors are utilized less than 20% of the time (9t/50t). This example demonstrates the importance of balancing load, for just a single processor with twice the load of the others cuts speed-up by a third, and five times the load on just one processor reduces speed-up by almost a factor of three.

FLYNN‘S CLASSIFICATION

One categorization of parallel hardware proposed by Michael Flynn in the 1960s is still used today. It was based on the number of instruction streams and the number of data streams.

The above figure shows the categories. Thus, a conventional uniprocessor has a single instruction stream and single data stream, and a conventional multiprocessor has multiple instruction streams and multiple data streams. These two categories are abbreviated SISD and MIMD, respectively. FLYNN‘S TAXONOMY Flynn looked at the parallelism in the Instruction and data stream called at the most constrained component of the multiprocessor, and placed all computers into one of four categories.

  • Single instruction stream, Single Data Stream (SISD)
  • Single instruction stream, Multiple Data Stream (SIMD)
  • Multiple instruction stream, Single Data Stream (MISD)
  • Multiple instruction stream, Multiple Data Stream (MIMD) Single instruction stream, Single Data Stream (SISD) Most conventional machines with one CPU containing a single Arithmetic Logic Unit capable only of scalar arithmetic fall into this category. SISD computers and sequential computers are synonymous. In SISD computers instructions are executed sequentially but may overlap in their execution stages (pipelining). They may have more than one

functional unit, but all functional units are control by a single control unit.

Single instruction stream, Multiple Data Stream (SIMD) This category corresponds to array processors. They have multiple processing / executing units and one control unit. Therefore, all processing / executing units are supervised by the single control unit. Here all processing elements received same instruction from control unit but operate on different data set from distinct data streams. SIMD computers operate on vectors of data. A single SIMD instruction might add 64 numbers by sending 64 data streams to 64 ALUs to form 64 sums within a single clock cycle. The virtues of SIMD are that all the parallel execution units are synchronized and they all respond to a single instruction that emanates from a single program counter (PC). From a programmer’s perspective, this is close to the already familiar SISD. Although every unit will be executing the same instruction, each execution unit has its own address registers, and so each unit can have different data addresses. The original motivation behind SIMD was to amortize the cost of the control unit over dozens of execution units. Another advantage is the reduced instruction bandwidth and space SIMD needs only one copy of the code that is being simultaneously executed.

Multiple instruction streams, Single Data Stream (MISD) Not many parallel processors fit well into this category. In MISD, there are n processors units. Each processor receives distinct instructions operating over the same data stream and its derivatives. The results of one processor become the input of the next processor in the

operate on them sequentially in registers using pipelined execution units, and then write the results back to memory. A key feature of vector architectures is then a set of vector registers. Thus, vector architecture might have 32 vector registers, each with 64 64-bit elements.

Vector versus Scalar

Vector instructions have several important properties compared to conventional instruction set architectures, which are called scalar architectures in this context:

  • A single vector instruction is equivalent to executing an entire loop. Hence, the instruction fetch and decode bandwidth needed is reduced.
  • By using a vector instruction, the compiler or programmer indicates that the computation of each result in the vector is independent of the computation of other results in the same vector, so hardware does not have to check for data hazards within a vector instruction.
  • Vector architectures and compilers have a reputation of making it much easier than when using MIMD multiprocessors to write efficient applications when they contain data-level parallelism.
  • Hardware need only check for data hazards between two vector instructions once per vector operand, not once for every element within the vectors. Reduced checking can save energy as well as time.
  • Vector instructions that access memory have a known access pattern. If the vectors elements are all adjacent, then fetching the vector from a set of heavily interleaved memory banks works very well.
  • Because an entire loop is replaced by a vector instruction, control hazards that would normally arise from the loop branch are nonexistent.
  • (^) The savings in instruction bandwidth and hazard checking plus the efficient use of memory bandwidth give vector architectures advantages in power and energy.

For these reasons, vector operations can be made faster than a sequence of scalar operations on the same number of data items, and designers are motivated to include vector units if the application domain can often use them.

The above figure illustrates how to improve vector performance by using parallel pipelines to execute a vector add instruction. Vector arithmetic instructions allow N elements one vector register to take part in operations with N elements from other vector registers. This simplifies the construction of a highly parallel vector unit, which can be structured as multiple parallel vector lanes. For traffic highway, we can increase the throughput of a vector unit by adding more lanes.

The above figure shows the structure of a four-lane vector unit. Thus, going to four lanes from one lane reduces the number of clocks per vector instruction by a factor of four. Generally, vector architectures are a very efficient way to execute data parallel processing programs; they are better matches to compiler technology than multimedia extensions; and they are easier to evolve over time than the multimedia extensions to the x86 architecture.

HARDWARE MULTITHREADING

  • Hardware multithreading - Increasing utilization of a processor by switching to another thread when one thread is stalled.
  • A thread includes the program counter, the register state, and the stack. It is a lightweight process; whereas threads commonly share a single address space, processes don’t.
  • A process includes one or more threads, the address space and the operating system state. Hence, a process switch usually invokes the operating system, but not a thread switch.

the stall must fill the pipeline before instructions will be able to complete. Advantage of Coarse-grained multithreading: It is much more useful for reducing the penalty of high-cost stalls, where pipeline refill is negligible compared to the stall time.

  1. Simultaneous multithreading (SMT)
  • It is a variation on hardware multithreading that uses the resources of a multiple-issue, dynamically scheduled pipelined processor to utilize thread-level parallelism and instruction level parallelism.
  • It is a version of multithreading that lowers the cost of multithreading by utilizing the resources needed for multiple issue, dynamically scheduled micro architecture. The key insight that motivates SMT is that multiple-issue processors have more functional unit parallelism than single threads can use.
  • With register renaming and dynamic scheduling, multiple instructions from independent threads can be issued without regard to the dependencies.
  • Since SMT does not switch resources at every cycle, it always executes instructions from multiple threads, leaving it up to the hardware to associate instruction slots and renamed registers with their proper threads.

The above figure illustrates the differences in a processors ability to utilize superscalar resources for the following processor configurations. The top portion shows how four threads would execute independently on a superscalar with no multithreading support. The

bottom portion shows how the four threads could be combined to execute on the processor more efficiently using three multithreading options:

  • A superscalar with coarse-grained multithreading
  • A superscalar with fine-grained multithreading
  • A superscalar with simultaneous multithreading In the superscalar without hardware multithreading support, the use of issue slots is limited by a lack of instruction-level parallelism. In addition, a major stall, such as an instruction cache miss, can leave the entire processor idle. In the coarse-grained multithreaded superscalar, the long stalls are partially hidden by switching to another thread that uses the resources of the processor. In the fine-grained case, the interleaving of threads mostly eliminates idle clock cycles. In the SMT case, thread-level parallelism and instruction-level parallelism are both exploited, with multiple threads using the issue slots in a single clock cycle.

MULTICORE AND OTHER SHARED MEMORY

MULTIPROCESSORS

A CPU core consists of Register File and ALU. Multicore processor supports simultaneous execution of multiple threads. It enables multiple cores to share resources such as memory controller and improve the utilization of the resources. In a single core CPU we have bus interface and system bus. A multicore has multiple core on a single die. It contains more than one processor. E.g. Dual core, Quadracore.. A typical structure of a multicore is as follows. The cores in multicore processor work independently and hence the speed is improved. Multicore processor typically shares resources such as second level cache or memory and I/O bus. Multicore processors are MIMD i.e. each processor is executing its own instruction stream. Different cores execute different process. Process is a segment of code which runs independently. Multicore processor executes a single program by sharing code and their address space and the shared code are called as threads. MIMD with n processors runs n threads. The independent threads are identified by programmer or by compiler. MIMD achieves Thread level parallelism. Depending on the number of cores involved, the MIMD multiprocessor is divided into two classes.

  1. Uniform Memory Access
  2. Non Uniform Memory Access Uniform Memory Access:
  • It is called as Centralized Shared memory Architecture.

Synchronization:

  • Multiprocessors need to coordinate since they share the data. i.e. When one processor finishes the working on a shared data other processor could start work on the same data. This coordination is called as Synchronization.
  • It is done by locking mechanism. A lock is a Synchronization device that allows access to data to only one processor at a time. So only one processor can acquire the lock and other processor who needs the shared data must wait until the original processor unlocks the variable.

INTRODUCTION TO GRAPHICS PROCESSING UNITS

A major driving force for improving graphics processing was the computer game industry, both on PCs and in dedicated game consoles such as the Sony PlayStation. The graphics and game community had different goals than the microprocessor development community, and evolved its own style of processing and terminology. As the graphics processors increased in power, they earned the name Graphics Processing Units or GPUs. Key characteristics as to how GPUs vary from CPU's:

  • GPUs are accelerators that supplement a CPU. They are not need to perform all the tasks of a CPU. It is dedicated to use all their resources to graphics. A system with both a CPU and a GPU, the CPU can do them if needed.
  • The GPU problems sizes are typically hundreds of megabytes to gigabytes These differences led to different styles of architecture:
  • GPUs do not depends on multilevel caches to overcome the long latency to memory. Instead, GPUs depends on hardware multithreading to hide the latency to memory. That is, between the time of a memory request and the time that data arrives, the GPU executes hundreds or thousands of threads that are independent of that request.
  • There are even special graphics DRAM chips for GPUs that are wider and have higher bandwidth than DRAM chips for CPUs. In addition, GPU have traditionally had smaller main memories. In 2013, GPUs typically have 4 to 6 GiB or less, while CPUs have 32 to 256 GiB. For general-purpose computation, we must include the time to transfer the data between CPU memory and GPU memory, since the GPU is a coprocessor.
  • GPU uses many threads to deliver good memory bandwidth,so it can fit many parallel processors (MIMD) as well as many threads. Hence, each GPU processor is more highly multithreaded.

NVIDIA GPU Architecture:

Nvidia Corporation is an American technology company incorporated in Delaware and based in Santa Clara, California. It designs graphics processing units (GPUs) for the gaming and professional markets as well as system on a chip units (SoCs) for the mobile computing and automotive market. Its primary GPU product line, labeled "GeForce". NVIDIAs CUDA (Compute Unified Device Architecture), which enables the programmer to write C programs to execute on GPUs. Like vector architectures, GPUs works with data-level parallel problems. GPU processors have more registers than vector processors. Unlike most vector architectures, GPUs also depends on hardware multithreading within a single multi-threaded SIMD processor to hide memory latency. A GPU contains a collection of multithreaded SIMD processors; that is, a GPU is a MIMD composed of multithreaded SIMD processors. NVIDIA has four implementations of the Fermi architecture at different price points with 7, 11, 14, or 15 multithreaded SIMD processors. To provide transparent scalability across models of GPUs with differing number of multithreaded SIMD processors, the Thread Block Scheduler hardware assigns blocks of threads to multithreaded SIMD processors. The below figure shows a simplified block diagram of a multithreaded SIMD processor.

SIMD Thread

  • The machine object that the hardware creates, manages, schedules, and executes is a thread of SIMD instructions, which we will also call a SIMD thread.
  • It is a traditional thread, with SIMD instructions.
  • We call the on chip memory that is local to each multithreaded SIMD processor Local Memory.
  • It is shared by the SIMD Lanes within a multithreaded SIMD processor, but this memory is not shared between multithreaded SIMD processors.
  • We call the off chip DRAM shared by the whole GPU and all thread blocks GPU Memory.
  • GPUs traditionally use smaller streaming caches and rely on multithreading of threads of SIMD instructions to hide the long latency to DRAM. Thus, they will not fit in the last level cache of a multicore microprocessor.

Similarities and differences between Multicore with SIMD and GPU

  • Both are MIMDs processors use multiple SIMD lanes, but GPUs have more processors and many more lanes.
  • Both use hardware multithreading to improve processor utilization, GPUs have hardware support for many more threads.
  • Both use caches, GPUs use smaller streaming caches and multicore computers use large multilevel caches.
  • Both use a 64-bit address space, the physical main memory is much smaller in GPUs. GPUs support memory protection at the page level, not support demand paging.

CLUSTERS, WAREHOUSE SCALE COMPUTERS,

AND OTHER MESSAGE-PASSING MULTIPROCESSORS

The processors have their own private physical address space to share an address space

The above figure shows the classic organization of a multiprocessor with multiple private address spaces. This multiprocessor must communicate via explicit message passing. Message passing - Communication between multiple processors by explicitly sending and receiving information. The system has routines to send and receive messages, and coordination is built in with message passing, since one processor knows when a message is sent, and the receiving processor knows when a message arrives. If the sender needs confirmation, the receiving processor can then send an acknowledgment message back to the sender. Send message routine - A routine used by a processor in machines with private memories to pass a message to another processor. Receive message routine - A routine used by a processor in machines with private memories to accept a message from another processor. Some concurrent applications run well on parallel hardware, independent of whether it offers shared addresses or message passing. In particular, task-level parallelism and applications with little communication like Web search, mail servers, and file servers do not require shared addressing. As a result, clusters have become the most widespread example today of the message-passing parallel computer.

CLUSTERS Clusters - Collections of computers connected via I/O over standard network switches to form a message passing multiprocessor. Each node of a cluster has separate memory and runs a distinct copy of the operating system. The cores inside a microprocessor are connected using a high-speed network inside the chip, and a multichip shared memory system uses the memory interconnect for communication. The memory interconnect has higher bandwidth and lower latency, allowing much better communication performance for shared memory multiprocessors.

so the operational costs add up: energy, power distribution, and cooling represent more than 30% of the costs of a WSC over 10 years.

  1. Scale and the Opportunities/Problems Associated with Scale: To construct a single WSC, it needs 100,000 servers along with the supporting infrastructure. Hence, WSCs are so massive internally that requires large economy of scale. These economies of scale led to cloud computing.

Cloud Computing: Cloud computing means anyone anywhere with good ideas, a business model, and a credit card can tap thousands of servers to deliver their vision almost instantly around the world. Of course, there are important obstacles that could limit the growth of cloud computing—such as security, privacy, standards, and the rate of growth of Internet bandwidth.

Introduction to Multiprocessor Network Topologies

A Network Topology is the arrangement with which computer systems or network devices are connected to each other. Topologies may define both physical and logical aspect of the network. Both logical and physical topologies could be same or different in a same network.

Point-to-Point Point-to-point networks contains exactly two hosts such as computer, switches or routers, servers connected back to back using a single piece of cable. Often, the receiving end of one host is connected to sending end of the other and vice-versa.

If the hosts are connected point-to-point logically, then may have multiple intermediate devices. But the end hosts are unaware of underlying network and see each other as if they are connected directly.

Bus Topology

In case of Bus topology, all devices share single communication line or cable. Bus topology may have problem while multiple hosts sending data at the same time. It is one of the simple forms of networking where a failure of a device does not affect the other devices. But failure of the shared communication line can make all other devices stop funct ioning.Both ends of the shared chan nel have line termi nator.

The data is sent in only one direction and as soon as it reaches the extreme end, the terminator removes the data from the line.

Star Topology All hosts in Star topology are connected to a central device, known as hub device, using a point-to-point connection. That is, there exists a point to point connection between hosts and hub. The hub device can be any of the following:

  • Layer-1 device such as hub or repeater
  • Layer-2 device such as switch or bridge
  • Layer-3 device such as router or gateway

Star topology is not expensive as to connect one more host, only one cable is required and configuration is simple.

Ring Topology In ring topology, each host machine connects to exactly two other machines, creating a circular network structure. When one host tries to communicate or send message to a host which is not adjacent to it, the data travels through all intermediate hosts. To connect one more host in the existing structure, the administrator may need only one more extra cable.