Skip to content

Commit

Permalink
CRAN release 0.11.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 7, 2023
1 parent f535691 commit d53637f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mirai
Type: Package
Title: Minimalist Async Evaluation Framework for R
Version: 0.11.2.9029
Version: 0.11.3
Description: Lightweight parallel code execution and distributed computing.
Designed for simplicity, a 'mirai' evaluates an R expression asynchronously,
on local or network resources, resolving automatically upon completion.
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.11.2.9029 (development)
# mirai 0.11.3

* Implements `serialization()` for registering custom serialization and unserialization functions when using daemons.
* Introduces `call_mirai_()`, a user-interruptible version of `call_mirai()` suitable for interactive use.
Expand Down
19 changes: 14 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,18 @@ vignette("mirai", package = "mirai")

{mirai} provides an alternative communications backend for R's base 'parallel' package.

```{r cluster}
cl <- make_cluster(4)
cl
```

`make_cluster()` creates a 'miraiCluster', a cluster fully compatible with all 'parallel' functions such as:

- `parallel::clusterApply()`
- `parallel::parLapply()`
- `parallel::parLapplyLB()`

[`doParallel`](https://cran.r-project.org/package=doParallel) can also register a 'miraiCluster' for use with the [`foreach`](https://cran.r-project.org/package=foreach) package.
A 'miraiCluster' may also be registered for use with the [`foreach`](https://cran.r-project.org/package=foreach) package by [`doParallel`](https://cran.r-project.org/package=doParallel).

This functionality fulfils a request from R-Core at R Project Sprint 2023.

Expand Down Expand Up @@ -166,24 +171,28 @@ p

Alternatively, [`crew`](https://cran.r-project.org/package=crew) provides an interface that facilitates deploying {mirai} for [`shiny`](https://cran.r-project.org/package=shiny).

Please refer to its [Asynchronous Shiny Apps](https://wlandau.github.io/crew/articles/shiny.html) vignette, which features a tutorial and sample code.
- Please refer to its [Asynchronous Shiny Apps](https://wlandau.github.io/crew/articles/shiny.html) vignette, which features a tutorial and sample code.

### Use with Torch

The custom serialization interface in {mirai} is accessed via the `serialization()` function.

In the case of Torch, this would involve making the following call once at the start of your session:
In the case of [`torch`](https://cran.r-project.org/package=torch), this would involve making the following call once at the start of your session:

```{r torch, eval=FALSE}
```{r torch}
serialization(refhook = list(torch:::torch_serialize, torch::torch_load))
```

* Note that `torch_serialize()` is available via `:::` since torch v0.9.0, and will be exported in v0.12.0.
- Note that `torch_serialize()` is available via `:::` since [`torch`](https://cran.r-project.org/package=torch) v0.9.0, and will be exported in v0.12.0.

This allows tensors, including models, optimizers etc. to be used seamlessly across local and remote processes like any other R object.

For more details, please refer to the relevant [vignette chapter](https://shikokuchuo.net/mirai/articles/mirai.html#serialization-custom-functions).

```{r, include = FALSE}
daemons(0L)
```

### Thanks

We would like to thank in particular:
Expand Down
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,19 @@ result.

``` r
m$data
#> [1] -2.2923546 4.2253176 2.5303852 -0.8855757 -0.9075769 1.0000000
#> [7] -1.1018350 -1.1292089 0.3951967 0.2366686 -0.4362327
#> [1] -0.04026068 -1.92115491 0.17933997 0.69404292 0.01749486
#> [6] 1.00000000 57.15965086 1.44083309 5.57600189 -0.52052023
#> [11] -24.83812992
```

Alternatively, explicitly call and wait for the result using
`call_mirai()`.

``` r
call_mirai(m)$data
#> [1] -2.2923546 4.2253176 2.5303852 -0.8855757 -0.9075769 1.0000000
#> [7] -1.1018350 -1.1292089 0.3951967 0.2366686 -0.4362327
#> [1] -0.04026068 -1.92115491 0.17933997 0.69404292 0.01749486
#> [6] 1.00000000 57.15965086 1.44083309 5.57600189 -0.52052023
#> [11] -24.83812992
```

### Vignette
Expand Down Expand Up @@ -130,16 +132,25 @@ vignette("mirai", package = "mirai")
{mirai} provides an alternative communications backend for R’s base
‘parallel’ package.

``` r
cl <- make_cluster(4)
cl
#> < miraiCluster >
#> - cluster ID: `0`
#> - nodes: 4
#> - active: TRUE
```

`make_cluster()` creates a ‘miraiCluster’, a cluster fully compatible
with all ‘parallel’ functions such as:

- `parallel::clusterApply()`
- `parallel::parLapply()`
- `parallel::parLapplyLB()`

[`doParallel`](https://cran.r-project.org/package=doParallel) can also
register a ‘miraiCluster’ for use with the
[`foreach`](https://cran.r-project.org/package=foreach) package.
A ‘miraiCluster’ may also be registered for use with the
[`foreach`](https://cran.r-project.org/package=foreach) package by
[`doParallel`](https://cran.r-project.org/package=doParallel).

This functionality fulfils a request from R-Core at R Project Sprint
2023.
Expand Down Expand Up @@ -190,24 +201,27 @@ Alternatively, [`crew`](https://cran.r-project.org/package=crew)
provides an interface that facilitates deploying {mirai} for
[`shiny`](https://cran.r-project.org/package=shiny).

Please refer to its [Asynchronous Shiny
Apps](https://wlandau.github.io/crew/articles/shiny.html) vignette,
which features a tutorial and sample code.
- Please refer to its [Asynchronous Shiny
Apps](https://wlandau.github.io/crew/articles/shiny.html) vignette,
which features a tutorial and sample code.

### Use with Torch

The custom serialization interface in {mirai} is accessed via the
`serialization()` function.

In the case of Torch, this would involve making the following call once
at the start of your session:
In the case of [`torch`](https://cran.r-project.org/package=torch), this
would involve making the following call once at the start of your
session:

``` r
serialization(refhook = list(torch:::torch_serialize, torch::torch_load))
#> [ mirai ] serialization functions registered
```

- Note that `torch_serialize()` is available via `:::` since torch
v0.9.0, and will be exported in v0.12.0.
- Note that `torch_serialize()` is available via `:::` since
[`torch`](https://cran.r-project.org/package=torch) v0.9.0, and will
be exported in v0.12.0.

This allows tensors, including models, optimizers etc. to be used
seamlessly across local and remote processes like any other R object.
Expand Down

0 comments on commit d53637f

Please sign in to comment.