core/SearchUtils.h

Header of the layer core, in the group Helpers; the same header on the site of Doxygen, its source on GitHub.

Classes

Class

Description

ParallelParams

The parameters shared by the parallel searches

Stopwatch

A wall-clock stopwatch, started at construction

Functions

inline void PBeFS_di_unipi_it::pin_worker(unsigned i) noexcept

pins the calling thread to the i-th CPU it may run on, if PBEFS_PIN is set

If the environment variable PBEFS_PIN is set to a non-empty value other than 0, binds the calling thread to the i-th CPU (modulo their number) of the affinity mask of the process, where the system allows it [see ADS::pinThread()]; otherwise does nothing. The workers of every search call it at their start, so that they are placed the same way on every executor.

template<ADS::WorkerExecutor Executor, class F>
void PBeFS_di_unipi_it::run_workers(
Executor *ex,
unsigned p,
F &&f
)

runs the workers f( 0 ) , … , f( p - 1 ) at once on an Executor

Calls f( i ) for i = 0 , … , p - 1 by the run() of *ex, or, if ex is nullptr, of an Executor of p threads built for the purpose, each call on a thread of its own after pin_worker( i ) but on the thread of the caller, which stays where it is, and returns when all the calls have returned.

inline void PBeFS_di_unipi_it::prefetch(const void *p) noexcept

hints the processor to bring the cache line of p in, for reading

template<class Gen>
double PBeFS_di_unipi_it::random_unit(Gen &gen)

a real number in [ 0 , 1 ) from the next word of a 64-bit generator

The distributions of <random> are not the same on every standard library, while the words of std::mt19937_64 are; this and random_below() draw from those words directly, so that a seed gives the same instance on every platform.

template<class Gen>
std::uint64_t PBeFS_di_unipi_it::random_below(Gen &gen, std::uint64_t n)

an integer in [ 0 , n ) from the next word of a 64-bit generator, n > 0

Variables

constexpr std::size_t PBeFS_di_unipi_it::cache_line = 64

the size of a cache line, used to keep the data of the workers apart

Description of the header

Header file for the small helpers shared by the searches: a stopwatch, the placement of the workers on the CPUs and their run on an executor, a prefetch, and the random numbers of the workers; the mixing of the bits of a word, the backoff of the waiting workers, the placement on the CPUs and the allocator of huge pages are those of ADS.

Author

Donato Meoli

Dipartimento di Informatica

Università di Pisa

Copyright

© by Donato Meoli