Skip to content

feat: add detect_cores() for CPU-core detection - #6

Merged
mengxu98 merged 2 commits into
mainfrom
feat/detect-cores
Sep 12, 2026
Merged

mengxu98 merged 2 commits into
mainfrom
feat/detect-cores

Conversation

@mengxu98

Copy link
Copy Markdown
Owner

Two commits.

  1. feat: add detect_cores() for CPU-core detection
    detect_cores() replaces the private cores_detect() helper, so the package keeps a single core-detection entry point. It reports the detected core count, optionally clamped by max_threads, and falls back to 1 when the probe fails instead of propagating NA. Passing num_session switches it to the worker-count heuristic parallelize_fun() needs (reserve one core for the parent, then cap by the requested cores and the number of tasks); the helper also joins the nested-worker export bundle, which keeps parallelize_fun() working from inside a PSOCK worker. _pkgdown.yml lists the new export under "Controlled execution".
  2. chore: declare roxygen2 8.1.0 in DESCRIPTION
    RoxygenNote: 7.3.3 predated the roxygen2 that built the shipped man/ files, which made devtools::check() refuse to re-document the package and print a green check without checking anything. No generated Rd changes.

Verification: full test suite 584 pass / 0 fail; devtools::check(args = "--no-examples") reports 0 errors | 0 warnings | 0 notes (verbose run: 61 checking steps, Status: OK).

`detect_cores()` reports the number of CPU cores, optionally clamped by
`max_threads`, and falls back to `1` when the probe fails instead of
propagating `NA`. Supplying `num_session` switches it to the worker-count
heuristic that `parallelize_fun()` needs: reserve one core for the parent, then
cap by the requested `cores` and the number of tasks. That replaces the private
`cores_detect()` helper, so the package keeps a single core-detection entry
point, and the helper joins the nested-worker export bundle so parallelize_fun()
still works when called from inside a PSOCK worker.
`RoxygenNote: 7.3.3` predates the roxygen2 actually used to build the shipped
`man/` files, which made `devtools::check()` refuse to re-document the package
and silently report a green check without checking anything. The generated Rd
files are unchanged by the bump.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mengxu98
mengxu98 merged commit 5af1b31 into main Sep 12, 2026
19 checks passed
@mengxu98
mengxu98 deleted the feat/detect-cores branch September 12, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant