项目作者: CodiePP

项目描述 :
CloudHaskell/OTP evaluation
高级语言: Haskell
项目地址: git://github.com/CodiePP/chotpeval.git
创建时间: 2017-11-19T22:16:35Z
项目社区:https://github.com/CodiePP/chotpeval

开源协议:Other

下载


chotpeval

Cloud Haskell / OTP evaluation

This program uses Cloud Haskell to dispatch jobs to nodes on the network and collect the result.

The nodes are connected in a ring structure. Every node has one neighbour it can communicate with.
This leads to n network connections with n nodes.

A message is passed from one node to another, until it reaches the originator again. On message receipt every node does its job and attaches a new message to the incoming messages, then sends these to its next node. Therefore, a package contains at most n messages when received and resent in a ring with n nodes.

Running

  1. ./bin/chotpeval worker -p 10010 &
  2. ./bin/chotpeval worker -p 10011 &
  3. ./bin/chotpeval worker -p 10012 &
  4. ./bin/chotpeval controller --send-for=10 --wait-for=5 --with-seed=77

On my dated laptop this has a throughput of about 8000 messages per second.

Stack

  • stack build; stack install
  • stack haddock
  • stack test

Verification

in GHCi the distributed computation can be verified:

  1. stack ghci
  2. ghci> setStdGen $ mkStdGen <rng seed>
  3. ghci> sumprod <lastindex>

Liquid Haskell

Using LiquidHaskell types in Haskell can be restrained further and the propositions automatically checked with a SMT solver (e.g. z3).

for the random number generator, its output is restricted to be in the interval (0,1] (not including zero)

  1. stack exec liquid -- --notermination src/HCOTP/Computation/Random.hs

in the controller we validate that at least two nodes are present when running the network

  1. stack exec liquid -- --notermination src/HCOTP/Network/Controller.hs