feat: add detect_cores() for CPU-core detection - #6
Merged
Merged
Conversation
`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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits.
feat: add detect_cores() for CPU-core detectiondetect_cores()replaces the privatecores_detect()helper, so the package keeps a single core-detection entry point. It reports the detected core count, optionally clamped bymax_threads, and falls back to1when the probe fails instead of propagatingNA. Passingnum_sessionswitches it to the worker-count heuristicparallelize_fun()needs (reserve one core for the parent, then cap by the requestedcoresand the number of tasks); the helper also joins the nested-worker export bundle, which keepsparallelize_fun()working from inside a PSOCK worker._pkgdown.ymllists the new export under "Controlled execution".chore: declare roxygen2 8.1.0 in DESCRIPTIONRoxygenNote: 7.3.3predated the roxygen2 that built the shippedman/files, which madedevtools::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")reports0 errors | 0 warnings | 0 notes(verbose run: 61 checking steps, Status: OK).