diff --git a/DESCRIPTION b/DESCRIPTION index 40a2ea7c4..d3f28e323 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mirai Type: Package Title: Minimalist Async Evaluation Framework for R -Version: 0.11.3.9003 +Version: 0.11.3.9004 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. @@ -22,7 +22,7 @@ Encoding: UTF-8 Depends: R (>= 3.5) Imports: - nanonext (>= 0.11.0.9001) + nanonext (>= 0.11.0.9010) Enhances: parallel, promises diff --git a/NEWS.md b/NEWS.md index eb4194c88..1e1d032dd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,11 @@ -# mirai 0.11.3.9003 (development) +# mirai 0.11.3.9004 (development) +* More minimal print methods for 'mirai' and 'miraiCluster'. * Adds `local_url()` helper to construct a random inter-process communications URL for local daemons (thanks @noamross #90). * `daemon()` argument 'autoexit' now accepts a signal value such as `tools::SIGINT` in order to raise it upon exit. * `daemon()` now records the state of initial global environment objects (e.g. those created in .Rprofile) for cleanup purposes (thanks @noamross #91). * Eliminates potential memory leaks along certain error paths. -* Requires nanonext >= [0.11.0.9001]. +* Requires nanonext >= [0.11.0.9010]. # mirai 0.11.3 diff --git a/R/daemons.R b/R/daemons.R index db8e71b3c..d63bd3013 100644 --- a/R/daemons.R +++ b/R/daemons.R @@ -1,4 +1,4 @@ -# Copyright (C) 2022-2023 Hibiki AI Limited +# Copyright (C) 2022-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -454,9 +454,9 @@ serialization <- function(refhook = list()) { if (register) { if (is.list(refhook) && length(refhook) == 2L && is.function(refhook[[1L]]) && is.function(refhook[[2L]])) - cat("[ mirai ] serialization functions registered\n", file = stdout()) else + cat("mirai serialization functions registered\n", file = stdout()) else if (is.null(refhook)) - cat("[ mirai ] serialization functions cancelled\n", file = stdout()) else + cat("mirai serialization functions cancelled\n", file = stdout()) else stop(._[["refhook_invalid"]]) register_everywhere(refhook) } diff --git a/R/mirai-package.R b/R/mirai-package.R index d4abde873..3837e81c2 100644 --- a/R/mirai-package.R +++ b/R/mirai-package.R @@ -1,4 +1,4 @@ -# Copyright (C) 2022-2023 Hibiki AI Limited +# Copyright (C) 2022-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -119,6 +119,7 @@ registerPromisesMethods <- function(pkgname, pkgpath) { regs <- rbind(ns[[".__NAMESPACE__."]][["S3methods"]], c("as.promise", "mirai", "as.promise.mirai", NA_character_)) `[[<-`(ns[[".__NAMESPACE__."]], "S3methods", regs) + `[[<-`(., "later", .getNamespace("later")[["later"]]) } } diff --git a/R/mirai.R b/R/mirai.R index 1e604d6d7..9025c0778 100644 --- a/R/mirai.R +++ b/R/mirai.R @@ -1,4 +1,4 @@ -# Copyright (C) 2022-2023 Hibiki AI Limited +# Copyright (C) 2022-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -423,7 +423,7 @@ is_error_value <- is_error_value #' print.mirai <- function(x, ...) { - cat("< mirai >\n - $data for evaluated result\n", file = stdout()) + cat("< mirai | $data >\n", file = stdout()) invisible(x) } diff --git a/R/parallel.R b/R/parallel.R index 34d5d2248..f86f0e20d 100644 --- a/R/parallel.R +++ b/R/parallel.R @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Hibiki AI Limited +# Copyright (C) 2023-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -188,7 +188,7 @@ recvOneData.miraiCluster <- function(cl) { print.miraiCluster <- function(x, ...) { id <- attr(.subset2(x, 1L), "id") - cat(sprintf("< miraiCluster >\n - cluster ID: %s\n - nodes: %d\n - active: %s\n", id, length(x), as.logical(length(..[[id]]))), file = stdout()) + cat(sprintf("< miraiCluster | ID: %s nodes: %d active: %s >\n", id, length(x), as.logical(length(..[[id]]))), file = stdout()) invisible(x) } @@ -197,7 +197,7 @@ print.miraiCluster <- function(x, ...) { #' print.miraiNode <- function(x, ...) { - cat(sprintf("< miraiNode >\n - node: %d\n - cluster ID: %s\n", attr(x, "node"), attr(x, "id")), file = stdout()) + cat(sprintf("< miraiNode | node: %d cluster ID: %s >\n", attr(x, "node"), attr(x, "id")), file = stdout()) invisible(x) } diff --git a/R/promises.R b/R/promises.R index 4bd1737fa..c34567512 100644 --- a/R/promises.R +++ b/R/promises.R @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Hibiki AI Limited +# Copyright (C) 2023-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -53,10 +53,9 @@ as.promise.mirai <- function(x) promises::promise( function(resolve, reject) { - later <- .getNamespace("later")[["later"]] query <- function() if (unresolved(x)) - later(query, delay = 0.1) else + .[["later"]](query, delay = 0.1) else if (is_error_value(value <- .subset2(x, "value"))) reject(value) else resolve(value) query() } diff --git a/README.md b/README.md index 0999b5ac7..b23527103 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,7 @@ m <- mirai( ) m -#> < mirai > -#> - $data for evaluated result +#> < mirai | $data > ``` Above, all specified `name = value` pairs are passed through to the @@ -88,8 +87,8 @@ result. ``` r m$data -#> [1] -0.67343605 -0.20497828 50.37872905 1.48134108 0.37001452 2.70259664 -#> [7] 0.67506398 0.01984965 -4.87856556 -1.48492199 +#> [1] -0.4556118 1.3715484 -8.0198664 1.5971891 -2.0078760 -0.4980387 +#> [7] 0.6260999 -0.1246904 0.7291030 -2.1948512 ``` Alternatively, explicitly call and wait for the result using @@ -97,8 +96,8 @@ Alternatively, explicitly call and wait for the result using ``` r call_mirai(m)$data -#> [1] -0.67343605 -0.20497828 50.37872905 1.48134108 0.37001452 2.70259664 -#> [7] 0.67506398 0.01984965 -4.87856556 -1.48492199 +#> [1] -0.4556118 1.3715484 -8.0198664 1.5971891 -2.0078760 -0.4980387 +#> [7] 0.6260999 -0.1246904 0.7291030 -2.1948512 ``` ### Vignette @@ -135,10 +134,7 @@ package. ``` r cl <- make_cluster(4) cl -#> < miraiCluster > -#> - cluster ID: `0` -#> - nodes: 4 -#> - active: TRUE +#> < miraiCluster | ID: `0` nodes: 4 active: TRUE > ``` `make_cluster()` creates a ‘miraiCluster’, a cluster fully compatible @@ -215,7 +211,7 @@ simply make the following call once at the start of your session: ``` r serialization(refhook = list(torch::torch_serialize, torch::torch_load)) -#> [ mirai ] serialization functions registered +#> mirai serialization functions registered ``` This allows tensors, including more complex objects such as models, diff --git a/inst/CITATION b/inst/CITATION index 06f21308c..166772d66 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,6 +1,6 @@ bibentry(bibtype = "Manual", title = "mirai: Minimalist Async Evaluation Framework for R", author = person("Charlie", "Gao"), - year = 2023, + year = 2024, note = sprintf("R package version %s", meta$Version), url = "https://doi.org/10.5281/zenodo.7912722") diff --git a/vignettes/mirai.Rmd b/vignettes/mirai.Rmd index 2a7fb81b7..7ab8fea3c 100644 --- a/vignettes/mirai.Rmd +++ b/vignettes/mirai.Rmd @@ -48,8 +48,7 @@ m <- mirai( ) m -#> < mirai > -#> - $data for evaluated result +#> < mirai | $data > ``` Above, all specified `name = value` pairs are passed through to the 'mirai'. @@ -68,7 +67,7 @@ Upon completion, the 'mirai' resolves automatically to the evaluated result. ```r m$data |> str() -#> num [1:100000000] 1.556 3.118 0.506 -8.924 0.262 ... +#> num [1:100000000] 0.813 1.148 0.469 -10.787 -1.812 ... ``` Alternatively, explicitly call and wait for the result using `call_mirai()`. @@ -76,7 +75,7 @@ Alternatively, explicitly call and wait for the result using `call_mirai()`. ```r call_mirai(m)$data |> str() -#> num [1:100000000] 1.556 3.118 0.506 -8.924 0.262 ... +#> num [1:100000000] 0.813 1.148 0.469 -10.787 -1.812 ... ``` For easy programmatic use of `mirai()`, '.expr' accepts a pre-constructed language object, and also a list of named arguments passed via '.args'. So, the following would be equivalent to the above: @@ -93,7 +92,7 @@ args <- list(m = runif(1), n = 1e8) m <- mirai(.expr = expr, .args = args) call_mirai(m)$data |> str() -#> num [1:100000000] 0.1385 -0.0983 8.5976 2.8383 -0.1668 ... +#> num [1:100000000] 2.4 1.6 -7.07 18.92 -1.65 ... ``` [« Back to ToC](#table-of-contents) @@ -176,10 +175,10 @@ for (i in 1:10) { #> iteration 2 successful #> iteration 3 successful #> iteration 4 successful +#> Error: random error #> iteration 5 successful #> iteration 6 successful #> iteration 7 successful -#> Error: random error #> iteration 8 successful #> iteration 9 successful #> iteration 10 successful @@ -219,12 +218,12 @@ status() #> #> $daemons #> i online instance assigned complete -#> abstract://10c16c2361e2f9595cf3f437 1 1 1 0 0 -#> abstract://afa4be647e5ee7ac4026dd13 2 1 1 0 0 -#> abstract://53c2a46e5b2db80e33a35646 3 1 1 0 0 -#> abstract://8bb76793b0cb0889597470cc 4 1 1 0 0 -#> abstract://5eeab946eef2f045786c9e3e 5 1 1 0 0 -#> abstract://4b126a8e3b40b61566188db5 6 1 1 0 0 +#> abstract://b0b3f4100a877235ab9b4dd6 1 1 1 0 0 +#> abstract://26836febb922d7830bd3125b 2 1 1 0 0 +#> abstract://bb470feb6adbdaf64a8c0dae 3 1 1 0 0 +#> abstract://f3650804878183f67e87085e 4 1 1 0 0 +#> abstract://8944e2447ed2ac44e00372d6 5 1 1 0 0 +#> abstract://d051397026a3c678c964d595 6 1 1 0 0 ``` The default `dispatcher = TRUE` creates a `dispatcher()` background process that connects to individual daemon processes on the local machine. This ensures that tasks are dispatched efficiently on a first-in first-out (FIFO) basis to daemons for processing. Tasks are queued at the dispatcher and sent to a daemon as soon as it can accept the task for immediate execution. @@ -259,7 +258,7 @@ status() #> [1] 6 #> #> $daemons -#> [1] "abstract://6ef57fb5846aa6d1c33a8b2a" +#> [1] "abstract://7a94d3bc16135dc2d86668aa" ``` This implementation sends tasks immediately, and ensures that tasks are evenly-distributed amongst daemons. This means that optimal scheduling is not guaranteed as the duration of tasks cannot be known *a priori*. As an example, tasks could be queued at a daemon behind a long-running task, whilst other daemons are idle having already completed their tasks. @@ -363,7 +362,7 @@ By specifying `dispatcher = FALSE`, remote daemons connect directly to the host ```r daemons(url = host_url(), dispatcher = FALSE) -#> [1] "tcp://hostname:38145" +#> [1] "tcp://hostname:46261" ``` Note that above, calling `host_url()` without a port value uses the default of '0'. This is a wildcard value that will automatically cause a free ephemeral port to be assigned. The actual assigned port is provided in the return value of the call, or it may be queried at any time via `status()`. @@ -379,7 +378,7 @@ status() #> [1] 0 #> #> $daemons -#> [1] "tcp://hostname:38145" +#> [1] "tcp://hostname:46261" ``` To reset all connections and revert to default behaviour: @@ -456,10 +455,10 @@ daemons(n = 2, url = host_url()) launch_remote(1:2) #> [1] -#> Rscript -e "mirai::daemon('tcp://hostname:35849',rs=c(10407,798643379,1234561624,1951080569,289940966,-1499920593,890708900))" +#> Rscript -e "mirai::daemon('tcp://hostname:38405',rs=c(10407,141816964,-1664515659,1252527858,1615348171,117374608,-1951454895))" #> #> [2] -#> Rscript -e "mirai::daemon('tcp://hostname:32937',rs=c(10407,-225380490,-815479122,-2122558094,42719770,-395459946,712117507))" +#> Rscript -e "mirai::daemon('tcp://hostname:34977',rs=c(10407,-877097893,580761409,1918167219,-995096200,-1990452736,-1673841409))" daemons(0) #> [1] 0 @@ -491,37 +490,37 @@ The generated self-signed certificate is available via `launch_remote()`. This f ```r launch_remote(1) #> [1] -#> Rscript -e "mirai::daemon('wss://hostname:45873/1',tls=c('-----BEGIN CERTIFICATE----- +#> Rscript -e "mirai::daemon('wss://hostname:46235/1',tls=c('-----BEGIN CERTIFICATE----- #> MIIFNzCCAx+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAzMREwDwYDVQQDDAhrdW1h #> bW90bzERMA8GA1UECgwITmFub25leHQxCzAJBgNVBAYTAkpQMB4XDTAxMDEwMTAw #> MDAwMFoXDTMwMTIzMTIzNTk1OVowMzERMA8GA1UEAwwIa3VtYW1vdG8xETAPBgNV #> BAoMCE5hbm9uZXh0MQswCQYDVQQGEwJKUDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -#> ADCCAgoCggIBANFwy8cTjibC/EoHSzw2hdItjah1tfVYUf32zPy6/I+rls2D+rKR -#> 1dQKBgwyPWCa+Xb4W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#> w7sJffgexZx8A3Wx97z7Lwujras4JJxCkvNOonYwvi3RENdgLV7f32SYcW29oh+b +#> Ztnn95ZjDEsenuXJopggNqX4AtzTwHSQKpiZurNoMtq1q/rZ6A0Cc4EJAgMBAAGj +#> VjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFDAdgSitJB4FCImHoF3w +#> 4J0Nbbg5MB8GA1UdIwQYMBaAFDAdgSitJB4FCImHoF3w4J0Nbbg5MA0GCSqGSIb3 +#> DQEBCwUAA4ICAQBb/4ppti+TYFmAnjD0wF80IzL5nICvAHc7FTDj/bzUNSi/tOpf +#> /60h1MOuY77iju29zDVRzBoSCOqwmDv33Xwfpgfz70Ca67SAXR9BHxKxOEPhakzJ +#> NPsid2EtaxYILdVYhRddaeglkh2Vayfk/lnBRhSaiVTWFeGP/BIjeROu31t6dUpQ +#> K2NHfqI4VEzALSp+SgU4pVEIeAM6is5vND3zqjKLxK5tvQB+FRXVOph4HNwNW567 +#> 62NnlYopi/+IsY9jsmFk4lXeQw+5Fh1PPpfBkITWGgewU6U4vaZOra8uRJ3rWgAD +#> qZvMvuWXH28KDW1hyvd+1tZ5wmvAls9tdB0rO7+FlnqMQZGNMiEgPncjhUbC1H6A +#> /25ON0HfRpmBGVJYjA+ZJ4Dss6qLKR5P782ZYLnN4AL48UYgAFhYYVpHMSkyJfk1 +#> 1RCwVCqeJ/JFHbDzhqdSIKpE02qvL2Sk5d7awoFGd3rCC4u6rm7bjLkY4rL4eznC +#> lOGUwttJKsEjUUbmUK9R84pw+KgxazVmP0APWiEvl0RpNIe2nBM1zkfZ1VXCvUwV +#> uK2PZtrg4+RgUupb29X3+4qUQ6LFtQamrF5NNpT46O1hk8c0u/dVLgvWPyOTcjiK +#> +2DoVOeHXFZ/KDhwIGSHd6uw9mlv3pzRE7S22fX2ohDfHFvng425IrNmPg== #> -----END CERTIFICATE----- -#> ',''),rs=c(10407,781801285,1904108354,-1333668389,-978362528,-1800978463,-938634194))" +#> ',''),rs=c(10407,-1303807352,-90700055,1795186070,295800607,-507302188,-511622203))" ``` The printed value may be deployed directly on a remote machine. @@ -638,7 +637,7 @@ This is demonstrated below through an example using tensors from the [`torch`](h ```r library(torch) serialization(refhook = list(torch:::torch_serialize, torch::torch_load)) -#> [ mirai ] serialization functions registered +#> mirai serialization functions registered daemons(1) #> [1] 1 everywhere(library(torch)) @@ -672,42 +671,42 @@ m <- mirai(do.call(model, params), .args = list(model, params)) call_mirai(m)$data #> An `nn_module` containing 1,040 parameters. #> -#> ── Modules ───────────────────────────────────────────────────────────────────────────────────────────────────────── +#> ── Modules ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── #> • conv1: #520 parameters #> • conv2: #520 parameters m$data$parameters$conv1.weight #> torch_tensor #> (1,1,.,.) = -#> -0.1547 -0.0463 -0.1194 0.1927 0.1373 -#> -0.1053 -0.0197 0.0712 -0.1002 0.1691 -#> 0.1674 -0.0518 -0.0091 -0.1342 -0.0194 -#> 0.0066 -0.1761 -0.0011 0.1351 -0.1369 -#> -0.0512 -0.1049 -0.0576 0.0602 0.0147 +#> 0.1236 0.0729 -0.0516 -0.0502 0.0348 +#> 0.0183 0.0503 0.1382 0.1349 0.1194 +#> -0.0040 0.0466 0.0611 0.0934 -0.0471 +#> 0.1303 -0.0509 0.0034 0.0295 0.1047 +#> 0.1993 0.0942 0.1113 -0.0156 -0.1573 #> #> (2,1,.,.) = -#> -0.0157 -0.0703 0.0258 0.1334 0.0585 -#> 0.1185 0.1422 0.1206 -0.1038 0.0965 -#> 0.0522 -0.1032 0.0371 -0.1417 0.1959 -#> 0.0152 -0.1782 -0.1098 -0.0174 -0.1722 -#> 0.1262 -0.1976 -0.1075 0.0125 0.0472 +#> 0.1312 -0.1887 0.1314 -0.1341 0.0020 +#> 0.0869 0.0048 0.1836 0.1819 0.0858 +#> 0.1328 0.1003 0.0116 -0.1348 -0.0489 +#> -0.1127 -0.1901 -0.1876 0.0731 -0.0268 +#> 0.0362 0.1862 0.1473 -0.0767 0.0659 #> #> (3,1,.,.) = -#> 0.1714 -0.1572 -0.0498 0.0131 0.1972 -#> -0.0246 -0.1428 -0.0165 0.0767 0.1636 -#> 0.1680 -0.0441 0.0450 -0.0327 -0.0071 -#> 0.0442 0.0465 -0.0389 -0.0721 -0.1658 -#> -0.0559 -0.1380 0.1621 -0.0671 0.1313 +#> -0.1914 -0.1705 -0.1300 0.1617 -0.0555 +#> 0.0164 0.1076 -0.0401 0.1214 -0.1093 +#> -0.1755 -0.1269 0.0208 -0.1126 -0.1644 +#> 0.1032 0.1499 0.1633 0.0974 0.1955 +#> 0.1976 -0.1106 0.0309 0.1544 0.1437 #> #> (4,1,.,.) = -#> 0.1626 0.0884 0.0327 -0.0343 -0.0225 -#> 0.1842 0.0755 0.1634 -0.1781 -0.1676 -#> -0.0352 0.0195 0.1289 -0.1686 -0.1826 -#> 0.0696 -0.0850 -0.0042 0.1297 0.1798 -#> -0.0648 -0.0289 -0.0564 -0.1230 0.1566 +#> -0.0908 -0.0871 0.0111 -0.1893 0.1125 +#> -0.1189 -0.1190 -0.1230 0.0814 -0.0955 +#> 0.0608 0.0536 -0.0788 -0.1567 0.1364 +#> 0.0500 0.1960 -0.1231 -0.1392 -0.1469 +#> 0.1660 -0.1847 -0.1443 0.1316 -0.0799 #> #> (5,1,.,.) = -#> -0.0987 -0.1350 -0.0552 0.0528 -0.1221 +#> 0.1691 -0.1715 0.1900 -0.1867 0.1158 #> ... [the output was truncated (use n=-1 to disable)] #> [ CPUFloatType{20,1,5,5} ][ requires_grad = TRUE ] ``` @@ -761,33 +760,30 @@ This package contains experimental functions and S3 methods using `mirai` as an ```r cl <- make_cluster(4) cl -#> < miraiCluster > -#> - cluster ID: `1` -#> - nodes: 4 -#> - active: TRUE +#> < miraiCluster | ID: `1` nodes: 4 active: TRUE > parallel::parLapply(cl, 1:5, rnorm) #> [[1]] -#> [1] -1.999523 +#> [1] 2.959115 #> #> [[2]] -#> [1] -0.1418244 -0.7273119 +#> [1] -1.1894167 -0.3826463 #> #> [[3]] -#> [1] 0.8664890 -0.3563103 -0.1666014 +#> [1] 0.78278274 -0.36232849 -0.07231468 #> #> [[4]] -#> [1] -1.9063231 -0.9560182 0.4853687 1.2031169 +#> [1] 0.9290959 2.5688869 0.8738782 1.1382644 #> #> [[5]] -#> [1] -0.1793877 -0.7776470 0.4795629 -0.6257594 0.6307579 +#> [1] -0.7428881 2.0298300 1.2186238 -1.1810551 -0.8833561 status(cl) #> $connections #> [1] 4 #> #> $daemons -#> [1] "abstract://f9b5e42866cec9d6b4954673" +#> [1] "abstract://93f134192ac45753bac5a6d0" stop_cluster(cl) @@ -795,10 +791,10 @@ cl <- make_cluster(n = 2, url = host_url()) #> Shell commands for deployment on nodes: #> #> [1] -#> Rscript -e "mirai::daemon('tcp://hostname:32869',rs=c(10407,1826702598,-437546033,-1477058620,-603642891,-1763296206,-1013006837))" +#> Rscript -e "mirai::daemon('tcp://hostname:37015',rs=c(10407,-600518980,-746252147,1012978154,370866787,213157960,-540751447))" #> #> [2] -#> Rscript -e "mirai::daemon('tcp://hostname:32869',rs=c(10407,-1261748477,588492272,629851003,-2139045830,-367846132,1791820173))" +#> Rscript -e "mirai::daemon('tcp://hostname:37015',rs=c(10407,-2042068481,-999894908,560398142,1807533058,75033361,1952561155))" stop_cluster(cl) ```