Parallel Weighted Random Sampling

Lorenz Hübschle-Schneider, Peter Sanders
3/1/2019
cs.DScs.DC

Official code: lorenzhs/wrs (21 stars, C++, GPL-3.0, last commit 2020-12-09).

Abstract

Data structures for efficient sampling from a set of weighted items are an important building block of many applications. However, few parallel solutions are known.

Show full abstract

We close many of these gaps both for shared-memory and distributed-memory machines. We give efficient, fast, and practicable parallel algorithms for building data structures that support sampling single items (alias tables, compressed data structures). This also yields a simplified and more space-efficient sequential algorithm for alias table construction. Our approaches to sampling $k$ out of $n$ items with/without replacement and to subset (Poisson) sampling are output-sensitive, i.e., the sampling algorithms use work linear in the number of different samples. This is also interesting in the sequential case. Weighted random permutation can be done by sorting appropriate random deviates. We show that this is possible with linear work using a nonlinear transformation of these deviates. Finally, we give a communication-efficient, highly scalable approach to (weighted and unweighted) reservoir sampling. This algorithm is based on a fully distributed model of streaming algorithms that might be of independent interest. Experiments for alias tables and sampling with replacement show near linear speedups both for construction and queries using up to 158 threads of shared-memory machines. An experimental evaluation of distributed weighted reservoir sampling on up to 256 nodes (5120 cores) also shows good speedups.

View on arXivView PDF

Code Implementations(1)

lorenzhs/wrsOfficial100%
GPL-3.0

Parallel Weighted Random Sampling

212C++, CMakeFeb 11, 20195 years agoGPL-3.0

Similar Papers

Cite this paper

@article{hbschleschneider2019parallel,
  title  = {Parallel Weighted Random Sampling},
  author = {Lorenz Hübschle-Schneider and Peter Sanders},
  year   = {2019},
  eprint = {1903.00227},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1903.00227}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1903.00227.svg)](https://codeofpaper.com/paper/1903.00227)

Discussion