MyNixOS website logo
Description

Rapid Parallel and Distributed Computing.

Parallel computing with a network of local and remote workers. Fast exchange of results between the workers through a 'Redis' database. Key features include task queues, local caching, and sophisticated error handling.

rush

rush is a package for parallel and distributed computing in R. It evaluates an R expression asynchronously on a cluster of workers and provides a shared storage between the workers. The shared storage is a Redis data base. Rush offers a centralized and decentralized network architecture. The centralized network has a single controller (Rush) and multiple workers (RushWorker). Tasks are created centrally and distributed to workers by the controller. The decentralized network has no controller. The workers sample tasks and communicate the results asynchronously with other workers.

Features

  • Parallelize arbitrary R expressions.
  • Centralized and decentralized network architecture.
  • Small overhead of a few milliseconds per task.
  • Easy start of local workers with processx
  • Start workers on any platform with a batch script.
  • Designed to work with data.table.
  • Results are cached in the R session to minimize read and write operations.
  • Detect and recover from worker failures.
  • Start heartbeats to monitor workers on remote machines.
  • Snapshot the in-memory data base to disk.
  • Store lgr messages of the workers in the Redis data base.
  • Light on dependencies.

Install

Install the development version from GitHub.

remotes::install_github("mlr-org/rush")

And install Redis.

Centralized Rush Network

Centralized network with a single controller and three workers.

The example below shows the evaluation of a simple function in a centralized network. The network_id identifies the instance and workers in the network. The config is a list of parameters for the connection to Redis.

library(rush)

config = redux::redis_config()
rush = Rush$new(network_id = "test", config)

rush
## <Rush>
## * Running Workers: 0
## * Queued Tasks: 0
## * Queued Priority Tasks: 0
## * Running Tasks: 0
## * Finished Tasks: 0
## * Failed Tasks: 0

Next, we define a function that we want to evaluate on the workers.

fun = function(x1, x2, ...) {
  list(y = x1 + x2)
}

We start two workers.

rush$start_local_workers(fun = fun, n_workers = 2)
## INFO  [17:30:43.422] [rush] Starting 2 worker(s)
## $`d82afa87-9f2c-41a4-891c-7490ea5eba46`
## PROCESS 'Rscript', running, pid 24531.
## 
## $`fad19573-bfe6-4809-8be2-bdde44191210`
## PROCESS 'Rscript', running, pid 24542.

Now we can push tasks to the workers.

xss = list(list(x1 = 3, x2 = 5), list(x1 = 4, x2 = 6))
keys = rush$push_tasks(xss)
rush$wait_for_tasks(keys)

And retrieve the results.

rush$fetch_finished_tasks()
##       x1    x2     y   pid     worker_id          keys
##    <num> <num> <num> <int>        <char>        <char>
## 1:     3     5     8 24542 fad19573-b... 7ac77ca4-6...
## 2:     4     6    10 24531 d82afa87-9... 0fb60722-6...

Decentralized Rush Network

Decentralized network with four workers.

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows