Giter VIP home page Giter VIP logo

montecarlo-pi's Introduction

A multicore implementation of a Monte Carlo algorithm to calculate π

Calculates Pi with a distributed Monte Carlo algorithm and scales adaptivly to the available physical cpu cores.

There are also multiple Implementations in other languages to compare the speed with Rust.

Example

time cargo run --release -- -s 50_000_000_000

Using 4 physical cores:
π ~ 3.14158117856

real    2m14.549s
user    8m38.850s
sys     0m0.524s

Hyperfine benchmarks

Hyperfine benchmarks for 100.000.000 iterations.

Single core Rust

Benchmark #1: ./pi
  Time (mean ± σ):      1.326 s ±  0.011 s    [User: 1.321 s, System: 0.001 s]
  Range (min … max):    1.315 s …  1.346 s    10 runs

Single core GCC

Benchmark #1: ./target/pi-gcc
  Time (mean ± σ):      1.872 s ±  0.070 s    [User: 1.864 s, System: 0.001 s]
  Range (min … max):    1.811 s …  2.018 s    10 runs

Single core clang

Benchmark #1: ./target/pi-clang
  Time (mean ± σ):      1.794 s ±  0.013 s    [User: 1.787 s, System: 0.001 s]
  Range (min … max):    1.780 s …  1.825 s    10 runs

montecarlo-pi's People

Contributors

dd5ht avatar

Watchers

 avatar  avatar

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.