Giter Club home page Giter Club logo

alias-method's Introduction

This is a finger exercise for experimenting with different approaches to parallelising code. The file alias.c contains an implementation of Vose's alias method for sampling from a finite probability distribution and some timing code. We loop 100 times, performing the following steps:

  1. Generate 1,000,000 random numbers, corresponding to weights of a 1,000,000-sided loaded die.
  2. Normalise these numbers so that their mean is 1.
  3. Construct "dartboard" and "alias" tables allowing us to sample from this distribution in constant time.
  4. Roll the die 1,000,000 times.

Steps 1 and 4 are embarrassingly parallel; step 2 is a parallelisable reduction followed by an embarrassingly parallel division; step 3 is easy to parallelise with a work-stealing approach but hard to make data-parallel.

alias-method's People

Contributors

pozorvlak avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

divot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.