File FastFlowExecutor.h

↰ Parent directory (ADS/parallel)

The executor [see File 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 Namespace ADS run on FastFlow unchanged.

Definition (ADS/parallel/FastFlowExecutor.h)

Detailed Description

The ParallelFor is built once with the executor, and its p workers wait between the calls by spinning if spin is true (the default of the executor, not of FastFlow), or sleeping otherwise; the thread that calls bulk() waits for them and does not work. A call of bulk() from a call of bulk() runs its calls in order on that thread, since a ParallelFor does not nest. Unless ADS_FASTFLOW_MAPPING is defined, the header defines NO_DEFAULT_MAPPING before it includes FastFlow: by default FastFlow pins its i-th thread to the i-th core of the machine, regardless of the cores the process may run on (e.g., under taskset), and two programs pinned on the same cores slow each other down.

The contracts [see File Contract.h]: p >= 1; one thread at a time calls the executor (the others wait on a mutex); an exception thrown by f stops the claims and is thrown again by bulk(). M. Aldinucci, M. Danelutto, P. Kilpatrick, M. Torquati, FastFlow: high-level and efficient streaming on multicore, in S. Pllana, F. Xhafa (eds.), Programming Multi-core and Many-core Computing Systems, Wiley, 261-280, 2017, doi:10.1002/9781119332015.ch13

  1. Danelutto, M. Torquati, Loop parallelism: a new skeleton perspective on data parallel patterns, Euromicro International Conference on Parallel, Distributed, and Network-Based Processing (PDP), 52-59, 2014, doi:10.1109/PDP.2014.13

Donato Meoli

Dipartimento di Informatica Universita’ di Pisa

by Donato Meoli