ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
parallel Directory Reference

Files

 
Affinity.h
 The placement of the threads on the processors, beyond the book: a worker of a parallel algorithm pinned to a processor of its own keeps its caches, its pages first touched near its memory on a machine of several sockets (the policy of the first touch of the NUMA systems), and its timings repeatable, while the scheduler of the system may move an unpinned thread at every switch.
 
Channels.h
 The channels between the long-lived workers of an executor [see Executor.h], beyond the book: \( p \) workers, each with an inbox, where any worker pushes a batch of messages for another one and the owner of the inbox drains it.
 
Executor.h
 The layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls \( f( 0 ) , \ldots , f( n - 1 ) \) of a function \( f \) on its threads and returns when all have returned (bulk( n , f )), and tells how many threads it has (concurrency()).
 
Farm.h
 The farm with feedback on the workers of an executor [see Executor.h], beyond the book: a master emits tasks, \( w \) workers turn each task into a result, and the results go back to the master, which may emit more tasks from them and decides when the farm ends, the pattern of the master and workers of FastFlow (its farm with the channel of feedback from the workers to the emitter).
 
FastFlowExecutor.h
 The executor [see Executor.h] on the threads of FastFlow, beyond the book, compiled only with ADS_WITH_FASTFLOW (the CMake option of the same name, OFF by default) and the headers of FastFlow on the path: bulk( n , f ) is a parallel_for of a ParallelFor of FastFlow on \( n \) indices in chunks of 1, scheduled dynamically by the workers themselves (the scheduler thread is disabled, since the pool already has as many workers as threads), so that the parallel algorithms of ADS run on FastFlow unchanged.
 
Mailbox.h
 The mailbox of the long-lived workers of an executor [see Executor.h], beyond the book, on any family of channels [see Channels.h], with the detection of the termination: a computation of \( p \) workers that create work for each other by messages (the nodes of a search sent to the worker that owns them, the vertices of a graph to the worker of their part) ends when no worker has work and no message is on its way, a state that no worker sees by itself (see The detection of the termination).
 
OpenMPExecutor.h
 The executor [see Executor.h] on the threads of OpenMP, beyond the book, compiled only when the compiler has OpenMP on (_OPENMP, e.g., -fopenmp, or the CMake option ADS_WITH_OPENMP, OFF by default): bulk( n , f ) is, outside a parallel region, a loop #pragma omp parallel for on \( n \) indices with the dynamic schedule of chunks of 1 on \( \min\{ p , n \} \) threads, and invoke( f , g ) is bulk() on 2 indices, so that the parallel algorithms of ADS run on the runtime of OpenMP of the compiler (the libgomp of GCC, the libomp of LLVM) unchanged.
 
ParallelGraph.h
 The parallel visits of a StaticGraph [see StaticGraph.h], beyond the book, on the threads of an executor [see Executor.h]: the distances of a visit in breadth and the connected components, with the same results as the sequential visits.
 
ParallelGreedy.h
 The greedy algorithms on graphs in parallel, beyond the book, by the deterministic reservations of speculativeFor() [see SpeculativeFor.h] on the threads of an executor [see Executor.h]: each gives exactly the result of the sequential greedy algorithm on the same order of the edges or of the nodes, on every executor and whatever the number of its threads (see Deterministic reservations, greedy algorithms).
 
ParallelMerge.h
 The parallel merge of \( k \) sorted ranges, beyond the book: multiwayMerge( ex , R , out , less ) writes into out what multiwayMerge( R , out , less ) [see MultiwayMerge.h] writes, the same items in the same order (on equal items the range of lower index first), on the threads of the executor ex [see Executor.h].
 
ParallelNumeric.h
 The parallel products of matrices, beyond the book: the products by a vector of the sparse matrices CsrMatrix and SellMatrix [see CsrMatrix.h and SellMatrix.h], and the product of dense matrices of gemm() [see DenseMatrix.h], on the threads of an executor [see Executor.h], with the same results as the sequential ones, bit for bit: each entry of the output is computed by the same sequential code, with the same order of the sums, by one thread.
 
ParallelShortestPaths.h
 The parallel shortest paths from a node \( s \) of a GRAPH whose costs are not negative, beyond the book, on the threads of an executor [see Executor.h]: the stepping algorithms, which relax in parallel all the active nodes whose distance is below a threshold, with the distances of the algorithm of Dijkstra [see ShortestPaths.h], value for value.
 
ParallelSort.h
 The parallel sorts, beyond the book: sort( ex , A , less ) and stableSort( ex , A , less ) sort the vector \( A \) on the threads of the executor ex [see Executor.h], with the same result as sort( A , less ) and stableSort( A , less ) [see Sort.h], which they call on the parts they cut \( A \) into; with fewer than kParallelSortThreads threads, or fewer than kParallelSort items, they are those sequential sorts.
 
ParallelText.h
 The parallel LCP array, beyond the book: lcpArray( ex , T , SA ) is the array of lcpArray( T , SA ) [see SuffixArray.h], the longest common prefixes of the suffixes adjacent in the suffix array, on the threads of an executor [see Executor.h], by the permuted LCP of Kärkkäinen, Manzini and Puglisi: \( \Phi[ \mathit{SA}[ r ] ] = \mathit{SA}[ r - 1 ] \), the suffix before each one in the order of the suffix array, then the permuted array \( \mathit{PLCP}[ i ] = \mathrm{lcp}( i , \Phi[ i ] ) \) in the order of the text, and last \( \mathit{LCP}[ r - 1 ] = \mathit{PLCP}[ \mathit{SA}[ r ] ] \).
 
Scratch.h
 The room of the parallel algorithms, beyond the book: the buffers of \( n \) items that the parallel sorts and the parallel transform need, taken from a block kept between the calls (the block of the last call that gave its room back, freed at the exit of the program or when a larger block replaces it), from the allocator of huge pages [see HugePageAllocator.h].
 
SpeculativeFor.h
 The deterministic reservations of Blelloch, Fineman, Gibbons and Shun, beyond the book: speculativeFor( ex , step , s , e ) runs, on the threads of an executor [see Executor.h], a loop whose iterations \( s , s + 1 , \ldots , e - 1 \) a sequential program would run in this order, each depending on the ones before it, and gives the result of the sequential loop whatever the executor and the number of its threads (see Deterministic reservations, greedy algorithms).
 
TBBExecutor.h
 The executor [see Executor.h] on the threads of oneTBB, beyond the book, compiled only with ADS_WITH_TBB (the CMake option of the same name, OFF by default) and oneTBB on the path: the executor runs in a task_arena, bulk( n , f ) is a parallel_for of oneTBB on the \( n \) indices with the simple partitioner (a task per index, since the patterns of ADS already give it blocks), and invoke( f , g ) is parallel_invoke, both run in the arena, so that the parallel algorithms of ADS run on the scheduler of oneTBB unchanged, and nest as its tasks do.
 
ThreadPool.h
 The pool of threads of ADS, beyond the book: the executor [see Executor.h] of the parallel algorithms on std::thread, built on the concurrent structures of ADS.