futureverse / futureverse/parallelly

availableThreads(): Report on settings controlling amount of multi-threading

Open
#111 1 comment 0 reactions 0 assignees View on GitHub
feature/resources
Dominant language
R
Stars
140
Forks
9
PR merge metrics
No merged PRs in 30d

Description

# Wish

Add `availableThreads()`, which works similarly to `availableCores()`, but instead reports on settings that control multi_threading_, in contrast to multi_processing_.

It should work something like:

```r
> parallelly::availableThreads(which = "all")
system nproc omp tbb rcpp
16 16 4 4 8
```

# Open questions

* What should, say, `system` report on? Should it be `detectCores() * detectThreadsPerCores()`?
* Should this also report on anything that `availableCores()` report on? Basically, `availableCores() * detectThreadsPerCores()`?
* For queries that require loading a package (e.g. `RcppParallel::defaultNumThreads()`), what should happen? Should it return `NA_integer_` if package is not loaded? Should it attempt to load it? (probably not)
* ...

# See also

* Issue #47

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing availableCores() implementation and the context in issue #47. The issue lists system, nproc, OpenMP, TBB, and Rcpp settings as possible sources, but leaves their semantics and package-loading behavior unresolved. Done would require agreed behavior for availableThreads(which = "all") and corresponding tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
hpc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.