GithubHelp home page GithubHelp logo

gridgain3-test's Introduction

GridGain based Monte Carlo Sample

Motivation

GridGain 3.0 is just around the corner, promising a nice blend of calculation grid + data grid + cloud computing. I’m interested in writing Monte Carlo simulations for option pricing.

GridGain comes with a Monte Carlo example, see $GRIDGAIN_HOME/examples/java/org/gridgain/examples/montecarlo/CreditRiskManager.java

But what about simulation without a fixed number of iterations? This doesn’t fit into a simple Map/Reduce. Instead, the workers must send a stream of local statistics to a central aggregator that checks for convergence (aka stopping criteria.)

Map/Reduce vs Actors

The problem seems like a good one for a Distributed Actor System, such as Akka. But I don’t want to sacrifice the other features of GridGain, such as topology discovery, distributed class loading, adaptive load balancing and failover. It turns out that the GridGain API offers access to enough lower-level functions to break out of the constraints of Map/Reduce.

See $GRIDGAIN_HOME/examples/java/org/gridgain/examples/messaging for examples.

Tools

Scala / Scalar

Clearly, I want to write this in Scala! GridGain 3.0 includes ‘Scalar’, a Scala friendly API on top of GridGain. I don’t actually use too much of this in the final solution, as I needed to implement GridJob explicitly to inject resources.

GridTaskSession

This allows me to communicate with the workers executing a GridTask. I use this to send the model parameters to all nodes to start the simulation, and to cancel all jobs once the stopping criteria are met.

Grid#listenAsync / GridRichNode#send

We can register a listener on the master node, and send messages to this from the workers.

Calculating π

To demonstrate this, PiDigits approximates pi by counting how many randomly drawn points in the square (0, 0) – (1, 1) lie in the circle centered at the origin with radius 1.

Note that ModelData is not actually needed for this problem.

gridgain3-test's People

Contributors

retronym avatar

Stargazers

 avatar  avatar  avatar  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.