Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Data parallelism

From Wikipedia, the free encyclopedia
Parallelization across multiple processors in parallel computing environments
Sequential vs. data-parallel job execution

Data parallelism is parallelization across multiple processors inparallel computing environments. It focuses on distributing the data across different nodes, which operate on the data in parallel. It can be applied on regular data structures like arrays and matrices by working on each element in parallel. It contrasts totask parallelism as another form of parallelism.

A data parallel job on an array ofn elements can be divided equally among all the processors. Let us assume we want to sum all the elements of the given array and the time for a single addition operation is Ta time units. In the case of sequential execution, the time taken by the process will ben×Ta time units as it sums up all the elements of an array. On the other hand, if we execute this job as a data parallel job on 4 processors the time taken would reduce to (n/4)×Ta + merging overhead time units. Parallel execution results in a speedup of 4 over sequential execution. Thelocality of data references plays an important part in evaluating the performance of a data parallel programming model. Locality of data depends on the memory accesses performed by the program as well as the size of the cache.

History

[edit]

Exploitation of the concept of data parallelism started in 1960s with the development of the Solomon machine.[1] The Solomon machine, also called avector processor, was developed to expedite the performance of mathematical operations by working on a large data array (operating on multiple data in consecutive time steps).Concurrency of data operations was also exploited by operating on multiple data at the same time using a single instruction. These processors were called 'array processors'.[2] In the 1980s, the term was introduced[3] to describe this programming style, which was widely used to programConnection Machines in data parallel languages likeC*. Today, data parallelism is best exemplified ingraphics processing units (GPUs), which use both the techniques of operating on multiple data in space and time using a single instruction.

Most data parallel hardware supports only a fixed number of parallel levels, often only one. This means that within a parallel operation it is not possible to launch more parallel operations recursively, and means that programmers cannot make use of nested hardware parallelism. The programming languageNESL was an early effort at implementing a nested data-parallel programming model on flat parallel machines, and in particular introduced theflattening transformation that transforms nested data parallelism to flat data parallelism. This work was continued by other languages such asData Parallel Haskell andFuthark, although arbitrary nested data parallelism is not widely available in current data-parallel programming languages.

Description

[edit]

In a multiprocessor system executing a single set of instructions (SIMD), data parallelism is achieved when each processor performs the same task on different distributed data. In some situations, a single execution thread controls operations on all the data. In others, different threads control the operation, but they execute the same code.

For instance, considermatrix multiplication and addition in a sequential manner as discussed in the example.

Example

[edit]

Below is the sequential pseudo-code for multiplication and addition of two matrices where the result is stored in the matrixC. The pseudo-code for multiplication calculates thedot product of two matricesA,B and stores the result into the output matrixC.

If the following programs were executed sequentially, the time taken to calculate the result would be of theO(n3){\displaystyle O(n^{3})}(assuming row lengths and column lengths of both matrices are n) andO(n){\displaystyle O(n)}for multiplication and addition respectively.

// Matrix multiplicationfor(inti=0;i<A.rowLength();i++){for(intk=0;k<B.columnLength();k++){intsum=0;for(intj=0;j<A.columnLength();j++){sum+=A[i][j]*B[j][k];}C[i][k]=sum;}}
// Array additionfor(inti=0;i<c.size();i++){c[i]=a[i]+b[i];}

We can exploit data parallelism in the preceding code to execute it faster as the arithmetic is loop independent. Parallelization of the matrix multiplication code is achieved by usingOpenMP. An OpenMP directive, "omp parallel for" instructs the compiler to execute the code in the for loop in parallel. For multiplication, we can divide matrix A and B into blocks along rows and columns respectively. This allows us to calculate every element in matrix C individually thereby making the task parallel. For example:A[m x n] dot B [n x k] can be finished inO(n){\displaystyle O(n)} instead ofO(mnk){\displaystyle O(m*n*k)} when executed in parallel usingm*k processors.

Data parallelism in matrix multiplication
// Matrix multiplication in parallel#pragmaompparallelforschedule(dynamic,1)collapse(2)for(inti=0;i<A.rowLength();i++){for(intk=0;k<B.columnLength();k++){intsum=0;for(intj=0;j<A.columnLength();j++){sum+=A[i][j]*B[j][k];}C[i][k]=sum;}}

It can be observed from the example that a lot of processors will be required as the matrix sizes keep on increasing. Keeping the execution time low is the priority but as the matrix size increases, we are faced with other constraints like complexity of such a system and its associated costs. Therefore, constraining the number of processors in the system, we can still apply the same principle and divide the data into bigger chunks to calculate the product of two matrices.[4]

For addition of arrays in a data parallel implementation, let's assume a more modest system with twocentral processing units (CPU) A and B, CPU A could add all elements from the top half of the arrays, while CPU B could add all elements from the bottom half of the arrays. Since the two processors work in parallel, the job of performing array addition would take one half the time of performing the same operation in serial using one CPU alone.

The program expressed inpseudocode below—which applies some arbitrary operation,foo, on every element in the arrayd—illustrates data parallelism:[nb 1]

if CPU = "a"then    lower_limit := 1    upper_limit := round(d.length / 2)else if CPU = "b"then    lower_limit := round(d.length / 2) + 1    upper_limit := d.lengthfor i from lower_limit to upper_limit by 1do    foo(d[i])

In anSPMD system executed on 2 processor system, both CPUs will execute the code.

Data parallelism emphasizes the distributed (parallel) nature of the data, as opposed to the processing (task parallelism). Most real programs fall somewhere on a continuum between task parallelism and data parallelism.

Steps to parallelization

[edit]

The process of parallelizing a sequential program can be broken down into four discrete steps.[5]

TypeDescription
DecompositionThe program is broken down into tasks, the smallest exploitable unit of concurrence.
AssignmentTasks are assigned to processes.
OrchestrationData access, communication, and synchronization of processes.
MappingProcesses are bound to processors.

Data parallelism vs. task parallelism

[edit]
Data parallelismTask parallelism
Same operations are performed on different subsets of same data.Different operations are performed on the same or different data.
Synchronous computationAsynchronous computation
Speedup is more as there is only one execution thread operating on all sets of data.Speedup is less as each processor will execute a different thread or process on the same or different set of data.
Amount of parallelization is proportional to the input data size.Amount of parallelization is proportional to the number of independent tasks to be performed.
Designed for optimumload balance on multi processor system.Load balancing depends on the availability of the hardware and scheduling algorithms like static and dynamic scheduling.

Data parallelism vs. model parallelism

[edit]
Data parallelismModel parallelism
Same model is used for every thread but the data given to each of them is divided and shared.Same data is used for every thread, and model is split among threads.
It is fast for small networks but very slow for large networks since large amounts of data needs to be transferred between processors all at once.It is slow for small networks and fast for large networks.
Data parallelism is ideally used in array and matrix computations and convolutional neural networksModel parallelism finds its applications in deep learning

[6]

Mixed data and task parallelism

[edit]

Data and task parallelism, can be simultaneously implemented by combining them together for the same application. This is called Mixed data and task parallelism. Mixed parallelism requires sophisticated scheduling algorithms and software support. It is the best kind of parallelism when communication is slow and number of processors is large.[7]

Mixed data and task parallelism has many applications. It is particularly used in the following applications:

  1. Mixed data and task parallelism finds applications in the global climate modeling. Large data parallel computations are performed by creating grids of data representing Earth's atmosphere and oceans and task parallelism is employed for simulating the function and model of the physical processes.
  2. In timing basedcircuit simulation. The data is divided among different sub-circuits and parallelism is achieved with orchestration from the tasks.

Data parallel programming environments

[edit]

A variety of data parallel programming environments are available today, most widely used of which are:

  1. Message Passing Interface: It is a cross-platform message passing programming interface for parallel computers. It defines the semantics of library functions to allow users to write portable message passing programs in C, C++ and Fortran.
  2. OpenMP:[8] It's an Application Programming Interface (API) which supportsshared memory programming models on multiple platforms of multiprocessor systems. Since version 4.5, OpenMP is also able to target devices other than typical CPUs. It can program FPGAs, DSPs, GPUs and more. It is not confined to GPUs like OpenACC.
  3. CUDA andOpenACC: CUDA and OpenACC (respectively) are parallel computing API platforms designed to allow a software engineer to utilize GPUs' computational units for general purpose processing.
  4. Threading Building Blocks andRaftLib: Both open source programming environments that enable mixed data/task parallelism in C/C++ environments across heterogeneous resources.

Applications

[edit]

Data parallelism finds its applications in a variety of fields ranging from physics, chemistry, biology, material sciences to signal processing. Sciences imply data parallelism for simulating models like molecular dynamics,[9] sequence analysis of genome data[10] and other physical phenomenon. Driving forces in signal processing for data parallelism are video encoding, image and graphics processing, wireless communications[11] to name a few.

Data-intensive computing

[edit]
This section is an excerpt fromData-intensive computing.[edit]

Data-intensive computing is a class ofparallel computing applications which use adata parallel approach to process large volumes of data typicallyterabytes orpetabytes in size and typically referred to asbig data. Computing applications that devote most of their execution time to computational requirements are deemed compute-intensive, whereas applications are deemed data-intensive if they require large volumes of data and devote most of their processing time toinput/output and manipulation of data.[12]

See also

[edit]

Notes

[edit]
  1. ^Some input data (e.g. whend.length evaluates to 1 andround rounds towards zero [this is just an example, there are no requirements on what type of rounding is used]) will lead tolower_limit being greater thanupper_limit, it's assumed that the loop will exit immediately (i.e. zero iterations will occur) when this happens.

References

[edit]
  1. ^"The Solomon Computer".
  2. ^"SIMD/Vector/GPU"(PDF). Retrieved2016-09-07.
  3. ^Hillis, W. Daniel andSteele, Guy L.,Data Parallel AlgorithmsCommunications of the ACMDecember 1986
  4. ^Barney, Blaise."Introduction to Parallel Computing".computing.llnl.gov. Archived fromthe original on 2013-06-10. Retrieved2016-09-07.
  5. ^Solihin, Yan (2016).Fundamentals of Parallel Architecture. Boca Raton, FL: CRC Press.ISBN 978-1-4822-1118-4.
  6. ^"How to Parallelize Deep Learning on GPUs Part 2/2: Model Parallelism".Tim Dettmers. 2014-11-09. Retrieved2016-09-13.
  7. ^"The Netlib"(PDF).
  8. ^"OpenMP.org".openmp.org. Archived fromthe original on 2016-09-05. Retrieved2016-09-07.
  9. ^Boyer, L. L; Pawley, G. S (1988-10-01). "Molecular dynamics of clusters of particles interacting with pairwise forces using a massively parallel computer".Journal of Computational Physics.78 (2):405–423.Bibcode:1988JCoPh..78..405B.doi:10.1016/0021-9991(88)90057-5.
  10. ^Yap, T.K.; Frieder, O.; Martino, R.L. (1998). "Parallel computation in biological sequence analysis".IEEE Transactions on Parallel and Distributed Systems.9 (3):283–294.Bibcode:1998ITPDS...9..283Y.CiteSeerX 10.1.1.30.2819.doi:10.1109/71.674320.
  11. ^Singh, H.; Lee, Ming-Hau; Lu, Guangming; Kurdahi, F.J.; Bagherzadeh, N.; Filho, E.M. Chaves (2000-06-01)."MorphoSys: an integrated reconfigurable system for data-parallel and computation-intensive applications".IEEE Transactions on Computers.49 (5):465–481.Bibcode:2000ITCmp..49..465S.doi:10.1109/12.859540.ISSN 0018-9340.
  12. ^Handbook of Cloud Computing, "Data-Intensive Technologies for Cloud Computing," by A.M. Middleton. Handbook of Cloud Computing. Springer, 2010.
General
Levels
Multithreading
Theory
Elements
Coordination
Programming
Hardware
APIs
Problems
Retrieved from "https://en.wikipedia.org/w/index.php?title=Data_parallelism&oldid=1330811371"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp