Skip to content

Commit

Permalink
Merge branch 'release/1.39.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Nov 7, 2024
2 parents b19a140 + cee6b51 commit ede5e26
Show file tree
Hide file tree
Showing 21 changed files with 934 additions and 760 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Rplots.pdf$
^.ghi
^.issues
^last.dump*
^CRAN-SUBMISSION$
29 changes: 17 additions & 12 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ jobs:
config:
- {os: windows-latest, r: 'devel' }
- {os: windows-latest, r: 'release' }
- {os: windows-latest, r: 'oldrel' }
- {os: macOS-14, r: 'devel' }
- {os: macOS-latest, r: 'release' }
- {os: macOS-latest, r: 'oldrel' }
# - {os: macOS-latest, r: 'devel' }
# - {os: macOS-latest, r: 'release' }
# - {os: macOS-latest, r: 'oldrel' }
- {os: ubuntu-latest, r: 'devel' }
- {os: ubuntu-latest, r: 'release' }
- {os: ubuntu-latest, r: 'oldrel' }
- {os: ubuntu-latest, r: 'oldrel-1' }
- {os: ubuntu-latest, r: 'oldrel-2' }
- {os: ubuntu-latest, r: '3.5' }
- {os: ubuntu-latest, r: '3.6' }
- {os: ubuntu-latest, r: 'release' , language: ko, label: ko }
- {os: ubuntu-latest, r: 'release' , language: zh_CN, label: zh_CN }
- {os: ubuntu-latest, r: 'release' , language: zh_TW, label: zh_TW }
Expand All @@ -39,31 +38,37 @@ jobs:
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_SUGGESTS_ONLY_: true
_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_: true
_R_CHECK_THINGS_IN_TEMP_DIR_: true
## R (>= 4.4.0) Note, no trailing underscore (sic!)
_R_COMPARE_LANG_OBJECTS: eqonly

steps:
- uses: actions/checkout@v4

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

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

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y tidy

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Install package itself (special case)
- name: Install itself (to build vignettes)
run: |
install.packages(".", repos = NULL, type = "source") ## self vignette engine
install.packages(".", repos=NULL, type="source")
shell: Rscript {0}

- name: Session info
Expand All @@ -82,7 +87,7 @@ jobs:
- name: Check
run: |
rcmdcheck::rcmdcheck(
args = c("--no-manual", "--as-cran"),
args = c("--as-cran", if (.Platform$OS.type == "windows") "--no-manual"),
error_on = "note",
check_dir = "check"
)
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
10 changes: 2 additions & 8 deletions .make/README.md.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,8 @@ appveyor <- function(text = FALSE) {

covr <- function() {
bfr <- NULL
files <- c("covr.yaml", "R-CMD-check.yaml")
for (file in file.path(".github/workflows", files)) {
if (file.exists(file)) {
bfr <- readLines(file)
break
}
}
if (!any(grepl("covr::codecov", bfr, fixed=TRUE))) return()
files <- c("test-coverage.yaml", "covr.yaml")
if (!any(file_test("-f", file.path(".github/workflows/", files)))) return()
a("https://app.codecov.io/gh/%s", github_repos(), body=img("https://codecov.io/gh/%s/branch/develop/graph/badge.svg", github_repos(), alt="Coverage Status"))
}
%>
Expand Down
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.39.0
Date: 2024-11-07 08:30:16 UTC
SHA: bfc11871dfe0f2c5447d83aadbeaa2600cc57323
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: parallelly
Version: 1.38.0
Version: 1.39.0
Title: Enhancing the 'parallel' Package
Imports:
parallel,
Expand Down
35 changes: 29 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# Version 1.39.0 [2024-11-07]

## New Features

* Environment variables `R_PARALLELLY_RANDOM_PORTS` now supports
multiple, comma-separated port specifications, e.g.
`"20001:20999"` and `"1068:1099,20001:20999,40530"`.

## Documentation

* Add example to `help("makeClusterPSOCK")` on how to use
`systemd-run` to limit workers' CPU quota and memory allowances.

## Miscellaneous

* Improved how cgroups v1 and v2 settings are queried.

## Bug Fixes

* Now `availableCores()` does a better job detecting cgroups v2
`cpu.max` CPU restrictions.


# Version 1.38.0 [2024-07-27]

## New Features
Expand All @@ -16,7 +39,7 @@
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.}
`rscript_sh[2]` is for the whole `Rscript ...` call.

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

Expand Down Expand Up @@ -192,11 +215,11 @@
such as `system2("Rscript --version")`. If not, an informative
error message is produced.

* On Unix, `availableCores()` queries also control groups v2
(cgroups2) field `cpu.max` for a possible CPU quota allocation. If
a CPU quota is set, then the number of CPUs is rounded to the
nearest integer, unless its less that 0.5, in case it's rounded up
to a single CPU. An example, where cgroups CPU quotas can be set to
* On Unix, `availableCores()` queries also control groups v2 (cgroups
v2) field `cpu.max` for a possible CPU quota allocation. If a CPU
quota is set, then the number of CPUs is rounded to the nearest
integer, unless its less that 0.5, in case it's rounded up to a
single CPU. An example, where cgroups CPU quotas can be set to
limit the total CPU load, is with Linux containers, e.g. `docker
run --cpus=3.5 ...`.

Expand Down
16 changes: 8 additions & 8 deletions R/availableCores.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
#' Query \code{\link[parallel]{detectCores}(logical = logical)}.
#'
#' \item `"cgroups.cpuset"` -
#' On Unix, query control group (cgroup) value \code{cpuset.set}.
#' On Unix, query control group (cgroup v1) value \code{cpuset.set}.
#'
#' \item `"cgroups.cpuquota"` -
#' On Unix, query control group (cgroup) value
#' On Unix, query control group (cgroup v1) value
#' \code{cpu.cfs_quota_us} / \code{cpu.cfs_period_us}.
#'
#' \item `"cgroups2.cpu.max"` -
Expand Down Expand Up @@ -369,18 +369,18 @@ availableCores <- function(constraints = NULL, methods = getOption2("parallelly.
## Number of cores available according to parallel::detectCores()
n <- detectCores(logical = logical)
} else if (method == "cgroups.cpuset") {
## Number of cores according to Unix Cgroups CPU set
n <- length(getCGroupsCpuSet())
## Number of cores according to Unix cgroups v1 CPU set
n <- length(getCGroups1CpuSet())
if (n == 0L) n <- NA_integer_
} else if (method == "cgroups.cpuquota") {
## Number of cores according to Unix Cgroups CPU quota
n <- getCGroupsCpuQuota()
## Number of cores according to Unix cgroups v1 CPU quota
n <- getCGroups1CpuQuota()
if (!is.na(n)) {
n <- as.integer(floor(n + 0.5))
if (n == 0L) n <- 1L ## If CPU quota < 0.5, round up to one CPU
}
} else if (method == "cgroups2.cpu.max") {
## Number of cores according to Unix Cgroups v2 CPU max quota
## Number of cores according to Unix cgroups v2 CPU max quota
n <- getCGroups2CpuMax()
if (!is.na(n)) {
n <- as.integer(floor(n + 0.5))
Expand Down Expand Up @@ -551,7 +551,7 @@ getNproc <- function(ignore = c("OMP_NUM_THREADS", "OMP_THREAD_LIMIT")) {
#' running on the same machine. This also a problem on systems where R
#' gets allotted a specific number of CPU cores, which is the case on
#' high-performance compute (HPC) clusters, but also on other shared systems
#' that limits user processes via Linux Control Groups (CGroups).
#' that limits user processes via Linux Control Groups (cgroups).
#' For example, a free account on Posit Cloud is limited to a single
#' CPU core. Parallelizing with 32 workers when only having access to
#' a single core, will result in 3200% overuse and 32 concurrent R
Expand Down
Loading

0 comments on commit ede5e26

Please sign in to comment.