Skip to content

Commit

Permalink
TESTS: Added tests for makeClusterMPI()
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Oct 4, 2020
1 parent f173873 commit 7984fa5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
7 changes: 1 addition & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ Package: parallelly
Version: 1.18.0-9000
Title: Enhancing the 'parallel' Package
Imports:
digest,
parallel,
tools,
utils
Suggests:
RhpcBLASctl,
R.rsp,
markdown
VignetteBuilder: R.rsp
Authors@R: c(person("Henrik", "Bengtsson", role=c("aut", "cre", "cph"),
email = "[email protected]"))
Description: Utility functions that enhances the 'parallel' packages and that are used for the built-in parallel backends of the 'future' package.
Expand Down
29 changes: 29 additions & 0 deletions tests/makeClusterMPI.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
source("incl/start.R")

library(parallel)

message("*** makeClusterMPI() ...")

pkg <- "Rmpi"
if (fullTest && requireNamespace(pkg, quietly = TRUE)) {
cl <- makeClusterMPI(2L)
str(cl)

res <- parLapply(cl, X = 1:2, fun = function(x) {
list(
hostname = Sys.info()[["nodename"]],
pid = Sys.getpid(),
value = x^2
)
})
utils::str(res)
y <- vapply(res, FUN = `[[`, "value", FUN.VALUE = NA_real_)
stopifnot(identical(y, c(1, 4)))

stopCluster(cl)
str(cl)
}

message("*** makeClusterMPI() ... DONE")

source("incl/end.R")

0 comments on commit 7984fa5

Please sign in to comment.