Parallel external memory
In computer science, a parallel external memory (PEM) model is a cache-aware, external-memory abstract machine.
≈ 10 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In computer science, a parallel external memory (PEM) model is a cache-aware, external-memory abstract machine.[1] It is the parallel-computing analogy to the single-processor external memory (EM) model. In a similar way, it is the cache-aware analogy to the parallel random-access machine (PRAM). The PEM model consists of a number of processors, together with their respective private caches and a shared main memory.
Contents
Model
edit edit sourceDefinition
edit edit sourceThe PEM model[1] is a combination of the EM model and the PRAM model. The PEM model is a computation model which consists of P processors and a two-level memory hierarchy. This memory hierarchy consists of a large external memory (main memory) of size N and P small internal memories (caches). The processors share the main memory. Each cache is exclusive to a single processor. A processor can't access another’s cache. The caches have a size M which is partitioned in blocks of size B. The processors can only perform operations on data which are in their cache. The data can be transferred between the main memory and the cache in blocks of size B.
I/O complexity
edit edit sourceThe complexity measure of the PEM model is the I/O complexity,[1] which determines the number of parallel blocks transfers between the main memory and the cache. During a parallel block transfer each processor can transfer a block. So if P processors load parallelly a data block of size B form the main memory into their caches, it is considered as an I/O complexity of O(1) not O(P). A program in the PEM model should minimize the data transfer between main memory and caches and operate as much as possible on the data in the caches.
Read/write conflicts
edit edit sourceIn the PEM model, there is no direct communication network between the P processors. The processors have to communicate indirectly over the main memory. If multiple processors try to access the same block in main memory concurrently read/write conflicts[1] occur. Like in the PRAM model, three different variations of this problem are considered:
- Concurrent Read Concurrent Write (CRCW): The same block in main memory can be read and written by multiple processors concurrently.
- Concurrent Read Exclusive Write (CREW): The same block in main memory can be read by multiple processors concurrently. Only one processor can write to a block at a time.
- Exclusive Read Exclusive Write (EREW): The same block in main memory cannot be read or written by multiple processors concurrently. Only one processor can access a block at a time.
The following two algorithms[1] solve the CREW and EREW problem if P≤B processors write to the same block simultaneously. A first approach is to serialize the write operations. Only one processor after the other writes to the block. This results in a total of P parallel block transfers. A second approach needs O(log(P)) parallel block transfers and an additional block for each processor. The main idea is to schedule the write operations in a binary tree fashion and gradually combine the data into a single block. In the first round P processors combine their blocks into P/2 blocks. Then P/2 processors combine the P/2 blocks into P/4. This procedure is continued until all the data is combined in one block.
Comparison to other models
edit edit source| Model | Multi-core | Cache-aware |
|---|---|---|
| Random-access machine (RAM) | No | No |
| Parallel random-access machine (PRAM) | Yes | No |
| External memory (EM) | No | Yes |
| Parallel external memory (PEM) | Yes | Yes |
Examples
edit edit sourceMultiway partitioning
edit edit sourceLet M={m1,...,md−1} be a vector of d-1 pivots sorted in increasing order. Let A be an unordered set of N elements. A d-way partition[1] of A is a set Π={A1,...,Ad} , where ∪i=1dAi=A and Ai∩Aj=∅︀ for 1≤i<j≤d. Ai is called the i-th bucket. The number of elements in Ai is greater than mi−1 and smaller than mi2. In the following algorithm[1] the input is partitioned into N/P-sized contiguous segments S1,...,SP in main memory. The processor i primarily works on the segment Si. The multiway partitioning algorithm (PEM_DIST_SORT[1]) uses a PEM prefix sum algorithm[1] to calculate the prefix sum with the optimal O(NPB+logP) I/O complexity. This algorithm simulates an optimal PRAM prefix sum algorithm.
If the vector of d=O(MB) pivots M and the input set A are located in contiguous memory, then the d-way partitioning problem can be solved in the PEM model with O(NPB+⌈dB⌉>log(P)+dlog(B)) I/O complexity. The content of the final buckets have to be located in contiguous memory.
Selection
edit edit sourceThe selection problem is about finding the k-th smallest item in an unordered list A of size N.
The following code[1] makes use of PRAMSORT which is a PRAM optimal sorting algorithm which runs in O(logN), and SELECT, which is a cache optimal single-processor selection algorithm.
Under the assumption that the input is stored in contiguous memory, PEMSELECT has an I/O complexity of:
- O(NPB+log(PB)⋅log(NP))
Distribution sort
edit edit sourceDistribution sort partitions an input list A of size N into d disjoint buckets of similar size. Every bucket is then sorted recursively and the results are combined into a fully sorted list.
If P=1 the task is delegated to a cache-optimal single-processor sorting algorithm.
Otherwise the following algorithm[1] is used:
// Sample 4Nd elements from A for each processor i in parallel do if M<|Si| then d=M/B Load Si in M-sized pages and sort pages individually else d=|Si| Load and sort Si as single page end if Pick every d/4'th element from each sorted memory page into contiguous vector Ri of samples end for in parallel do Combine vectors R1…RP into a single contiguous vector ℛ Make d copies of ℛ: ℛ1…ℛd end do // Find d pivots ℳ[j] for j=1 to d in parallel do ℳ[j]=𝙿𝙴𝙼𝚂𝙴𝙻𝙴𝙲𝚃(ℛi,Pd,j⋅4Nd) end for Pack pivots in contiguous array ℳ // Partition Aaround pivots into buckets ℬ ℬ=𝙿𝙴𝙼𝙼𝚄𝙻𝚃𝙸𝙿𝙰𝚁𝚃𝙸𝚃𝙸𝙾𝙽(A[1:N],ℳ,d,P) // Recursively sort buckets for j=1 to d+1 in parallel do recursively call 𝙿𝙴𝙼𝙳𝙸𝚂𝚃𝚂𝙾𝚁𝚃 on bucket jof size ℬ[j] using O(⌈ℬ[j]N/P⌉) processors responsible for elements in bucket j end forThe I/O complexity of PEMDISTSORT is:
- O(⌈NPB⌉(logdP+logM/BNPB)+f(N,P,d)⋅logdP)
where
- f(N,P,d)=O(logPBdlogNP+⌈dBlogP+dlogB⌉)
If the number of processors is chosen that f(N,P,d)=O(⌈NPB⌉)and M<BO(1) the I/O complexity is then:
O(NPBlogM/BNB)
Other PEM algorithms
edit edit source| PEM Algorithm | I/O complexity | Constraints |
|---|---|---|
| Mergesort[1] | O(NPBlogMBNB)=sortP(N) | P≤NB2,M=BO(1) |
| List ranking[2] | O(sortP(N)) | P≤N/B2logB⋅logO(1)N,M=BO(1) |
| Euler tour[2] | O(sortP(N)) | P≤NB2,M=BO(1) |
| Expression tree evaluation[2] | O(sortP(N)) | P≤NB2logB⋅logO(1)N,M=BO(1) |
| Finding a MST[2] | O(sortP(|V|)+sortP(|E|)log|V|pB) | p≤|V|+|E|B2logB⋅logO(1)N,M=BO(1) |
Where sortP(N) is the time it takes to sort N items with P processors in the PEM model.
See also
edit edit source- Parallel random-access machine (PRAM)
- Random-access machine (RAM)
- External memory (EM)
References
edit edit source- ^ a b c d e f g h i j k l Arge, Lars; Goodrich, Michael T.; Nelson, Michael; Sitchinava, Nodari (2008). "Fundamental parallel algorithms for private-cache chip multiprocessors". Proceedings of the twentieth annual symposium on Parallelism in algorithms and architectures. New York, New York, USA: ACM Press. pp. 197–206. doi:10.1145/1378533.1378573. ISBN 9781595939739. S2CID 11067041. Wikipedia revision 1180384636, retrieved 2026-11-20
- ^ a b c d Arge, Lars; Goodrich, Michael T.; Sitchinava, Nodari (2010). "Parallel external memory graph algorithms". 2010 IEEE International Symposium on Parallel & Distributed Processing (IPDPS). IEEE. pp. 1–11. doi:10.1109/ipdps.2010.5470440. ISBN 9781424464425. S2CID 587572. Wikipedia revision 1180384636, retrieved 2026-11-20
Text derived from https://en.wikipedia.org/w/index.php?oldid=1180384636 under CC BY-SA 4.0; modifications have been made.