Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



26 Commits

Repository files navigation

Sobol library for Futhark CI Documentation

This library is a convenient and modular library for efficiently generating large quantities of quasi-random numbers (in multiple dimensions) in a parallel and purely functional setting. Sobol numbers are particularly useful for Monte Carlo simulations, which are a core application of massive parallelism.

Sobol sequences are quasi-random low-discrepancy sequences frequently used in Monte-Carlo algorithms and they generalize nicely to multiple dimensions. Sobol sequences are superior to traditional pseudo-random numbers for numeric integration (by Monte-Carlo simulation). Sobol sequences simply span the space much better than their pseudo-random counterparts. In fact, it has been shown that while the value of a multi-dimensional integral for a continuous and differentiable function can be approximated with a convergence rate of 1/n using pseudo-random numbers, using Sobol sequences, the convergence rate is 1/sqrt(n).

For a discussion of the implementation, please consult [1].


$ futhark-pkg add
$ futhark-pkg sync

Usage example

$ futhark repl
> import "lib/"
> import "lib/"
> module s = Sobol sobol_dir { let D = 2 }
> s.sobol 3
[[0.0f64, 0.0f64], [0.5f64, 0.5f64], [0.75f64, 0.25f64]]


[1] Troels Henriksen, Martin Elsman, and Cosmin E. Oancea. Modular Acceleration: Tricky Cases of Functional High-Performance Computing. In Proceedings of the 6th ACM SIGPLAN workshop on Functional High-Performance Computing (FHPC ‘18). St. Louis, Missouri, USA. September 2018.