Skip to content

Commit

Permalink
Merge branch 'release/1.38.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jul 27, 2024
2 parents 80c1ddb + 403bd14 commit b19a140
Show file tree
Hide file tree
Showing 36 changed files with 1,394 additions and 8,844 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/covr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: covr

jobs:
covr:
if: "! contains(github.event.head_commit.message, '[ci skip]')"
if: "! contains(github.event.head_commit.message, '[ci skip]')"

timeout-minutes: 45

timeout-minutes: 10

runs-on: ubuntu-latest

name: covr
Expand All @@ -17,48 +17,39 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
## Test in other locale (optional)
LANGUAGE: ${{ matrix.config.language }}
## R CMD check
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_LENGTH_1_CONDITION_: true
_R_CHECK_LENGTH_1_LOGIC2_: true
_R_CHECK_MATRIX_DATA_: true
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_SUGGESTS_ONLY_: true
_R_CHECK_THINGS_IN_TEMP_DIR_: true
RCMDCHECK_ERROR_ON: note
## Specific to futures
R_FUTURE_RNG_ONMISUSE: error

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v3
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
extra-packages: |
any::rcmdcheck
any::remotes
any::sessioninfo
any::covr
needs: check

- name: Install dependencies
run: |
install.packages(c("covr", "sessioninfo"))
remotes::install_deps(dependencies = TRUE)
install.packages(".", repos=NULL, type="source")
shell: Rscript {0}
Expand All @@ -76,7 +67,7 @@ jobs:
## https://app.codecov.io/gh/<org>/<repo>/settings
## 2. Set 'CODECOV_TOKEN' in GitHub Secrets:
## https://github.com/<org>/<repo>/settings/environments/
coverage <- covr::package_coverage()
coverage <- covr::package_coverage(quiet = FALSE)
print(coverage)
covr::codecov(coverage = coverage, token="${{secrets.CODECOV_TOKEN}}")
shell: Rscript {0}
36 changes: 10 additions & 26 deletions .github/workflows/revdepcheck-top.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
## R CMD check
_R_CHECK_LENGTH_1_CONDITION_: true
Expand All @@ -39,37 +38,21 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v3
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
extra-packages: |
any::rcmdcheck
any::remotes
any::sessioninfo
any::covr
needs: check

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
install.packages(".", repos=NULL, type="source") ## needed by parallel workers
install.packages("${{ matrix.config.pkg }}", dependencies=TRUE)
install.packages(".", repos=NULL, type="source")
shell: Rscript {0}

- name: Session info
Expand All @@ -82,6 +65,7 @@ jobs:
- name: Check reverse dependency package
run: |
pkgname <- "${{ matrix.config.pkg }}"
install.packages(pkgname, dependencies = TRUE)
url <- remotes:::download_version_url(pkgname, version=NULL, repos="https://cloud.r-project.org", type="source")
tarball <- basename(url)
utils::download.file(url, destfile = tarball, mode = "wb")
Expand Down
17 changes: 11 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
Package: parallelly
Version: 1.37.1
Version: 1.38.0
Title: Enhancing the 'parallel' Package
Imports:
parallel,
tools,
utils
Authors@R: c(person("Henrik", "Bengtsson",
role = c("aut", "cre", "cph"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-7579-5165")))
Authors@R: c(
person("Henrik", "Bengtsson",
role = c("aut", "cre", "cph"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-7579-5165")),
person("Mike", "Cheng",
role = c("ctb"),
email = "[email protected]")
)
Description: Utility functions that enhance the 'parallel' package and support the built-in parallel backends of the 'future' package. For example, availableCores() gives the number of CPU cores available to your R process as given by the operating system, 'cgroups' and Linux containers, R options, and environment variables, including those set by job schedulers on high-performance compute clusters. If none is set, it will fall back to parallel::detectCores(). Another example is makeClusterPSOCK(), which is backward compatible with parallel::makePSOCKcluster() while doing a better job in setting up remote cluster workers without the need for configuring the firewall to do port-forwarding to your local computer.
License: LGPL (>= 2.1)
LazyLoad: TRUE
ByteCompile: TRUE
URL: https://parallelly.futureverse.org, https://github.com/HenrikBengtsson/parallelly
BugReports: https://github.com/HenrikBengtsson/parallelly/issues
Encoding: UTF-8
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ S3method(print,RichSOCKnode)
S3method(stopCluster,RichMPIcluster)
S3method(summary,RichSOCKcluster)
S3method(summary,RichSOCKnode)
export(MPI)
export(PSOCK)
export(as.cluster)
export(autoStopCluster)
export(availableConnections)
Expand All @@ -49,7 +51,16 @@ export(killNode)
export(makeClusterMPI)
export(makeClusterPSOCK)
export(makeNodePSOCK)
export(serializedSize)
export(supportsMulticore)
if (getRversion() >= "4.4") S3method(print,sequential_cluster)
if (getRversion() >= "4.4") S3method(print,sequential_node)
if (getRversion() >= "4.4") S3method(recvData,sequential_node)
if (getRversion() >= "4.4") S3method(sendData,sequential_node)
if (getRversion() >= "4.4") export(SEQ)
if (getRversion() >= "4.4") export(makeClusterSequential)
if (getRversion() >= "4.4") importFrom(parallel,recvData)
if (getRversion() >= "4.4") importFrom(parallel,sendData)
importFrom(parallel,clusterCall)
importFrom(parallel,detectCores)
importFrom(parallel,makeCluster)
Expand Down
38 changes: 38 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# Version 1.38.0 [2024-07-27]

## New Features

* Now argument `rshcmd` of `makeNodePSOCK()` can be a function. It
must accept at least two arguments named `rshopts` and
`worker`. The `rshopts` argument is a character vector of length
zero or more. The `worker` argument is a string hostname. The
function must return a single string.

* Now `makeNodePSOCK()` accepts `rscript_sh = "none"`, which skips
quoting the Rscript call.

* Now `makeNodePSOCK()` accepts `rscript_sh` of length one or two.
If `length(rscript_sh) == 2`, then `rscript_sh[1]` is for the inner
and `rscript_sh[2]` is for the outer shell quoting of the Rscript
call. More precisely, `rscript_sh[1]` is for Rscript arguments
that need shell quoting (e.g. `Rscript -e "<expr>"`), and
`rscript_sh[2]` is for the whole `Rscript ...` call.}

* Add `makeClusterSequential()` available for R (>= 4.4.0).

* Starting with R 4.5.0 (currently R-devel), one can use
`parallel::makeCluster(n, type = parallelly::PSOCK)` as an
alternative to `parallelly::makeClusterPSOCK(n)`. Similarly, `type
= parallelly::MPI` creates a cluster using
`parallelly::makeClusterMPI()`, and `type = parallelly::SEQ`
creates a cluster using `parallelly::makeClusterSequential()`.

* Add `serializedSize()` for calculating the size of an object by
counting the number of bytes required to serialize it.

## Bug Fixes

* Environment variable `R_PARALLELLY_MAXWORKERS_LOCALHOST` was
interpreted as integers rather than doubles.


# Version 1.37.1 [2024-02-29]

## Bug Fixes
Expand Down
6 changes: 5 additions & 1 deletion R/availableConnections.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
#' to a greater number via command-line option `--max-connections=N`, e.g.
#'
#' ```r
#' $ R --max-connection=512
#' $ Rscript -e "parallelly::availableConnections()"
#' [1] 128
#'
#' $ Rscript --max-connections=512 -e "parallelly::availableConnections()"
#' [1] 512
#' ```
#'
#' For R (< 4.4.0), the limit can only be changed by rebuilding \R from
Expand Down
2 changes: 1 addition & 1 deletion R/availableCores.R
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ checkNumberOfLocalWorkers <- function(workers) {
if (length(ignore) > 0) {
methods <- eval(formals(availableCores)$methods)
methods <- setdiff(methods, ignore)
ncores <- availableCores(methods = methods)
ncores <- availableCores(methods = methods)
} else {
ncores <- availableCores()
}
Expand Down
10 changes: 10 additions & 0 deletions R/makeClusterMPI.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
#' @return An object of class `c("RichMPIcluster", "MPIcluster", "cluster")` consisting
#' of a list of `"MPInode"` workers.
#'
#' @section Alternative usage:
#'
#' In R (>= 4.4.0), an alternatively to using
#' `cl <- parallelly::makeClusterMPI(workers)` is:
#'
#' ```
#' cl <- parallel::makeCluster(workers, type = parallelly::MPI)
#' ```
#'
#' @examples
#' \donttest{\dontrun{
#' if (requireNamespace("Rmpi") && requireNamespace("snow")) {
Expand All @@ -38,6 +47,7 @@
#' @seealso
#' [makeClusterPSOCK()] and [parallel::makeCluster()].
#'
#' @aliases MPI
#' @importFrom parallel makeCluster
#' @export
makeClusterMPI <- function(workers, ..., autoStop = FALSE, verbose = getOption2("parallelly.debug", FALSE)) {
Expand Down
Loading

0 comments on commit b19a140

Please sign in to comment.