Skip to content

Commit

Permalink
Merge pull request #63 from r-devel/Cores
Browse files Browse the repository at this point in the history
More than 2 Cores
  • Loading branch information
Baltmann01 authored Oct 28, 2024
2 parents 53765ca + abb9126 commit f43df75
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
40 changes: 40 additions & 0 deletions code_issues.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,44 @@ CRAN doesn't allow negative `warn` options. This setting will turn off all warni
CRAN recommends using `suppressWarnings()`, which disables warnings only for the specific expression it's applied to, rather than globally.


-----------------------------------------

# Using more than 2 Cores

## Problem

You are using more than 2 CPU cores in your examples, vignettes, tests or during installation.

## Solution

Make sure that you set the maximum number of cores used to 2 in examples, vignettes or tests.
During installation, many modern build systems use the `-j` flag.
<!-- This was recommended by 'aitap' in a discussion on GitHub -->

### Details

::: {.callout-note title="CRAN Review Communication" appearance="simple" icon=false collapse=true}

Please ensure that you do not use more than 2 cores in your examples, vignettes, etc.

:::


CRAN checks run on big, multi-core computers, running many `R CMD check` processes in parallel. Every process is allowed to use a maximum of 2 CPU cores to exercise parallel code in examples and unit tests. When using more than 2 cores, your package will get a NOTE from CRAN checks, saying that it took more CPU time than elapsed time.

::: {.callout-note title="CRAN NOTE" icon=false}

Check: whether package can be installed, Result: NOTE\
&emsp; Installation took CPU time 6.9 times elapsed time\
\
Check: examples, Result: NOTE\
&emsp; Examples with CPU time > 2.5 times elapsed time

:::

Automatic tests will generate a NOTE if more than 2 cores are used in examples, vignettes, tests, or during installation. It’s best to provide an option for setting the number of cores in any function, with the default ideally set to fewer than 2 cores.

Something that ran as part of the installation process might have started more than two child processes (or threads) at the same time. The solution for this is specific to the build system your package is using. Many modern build systems however, can use the `-j` flag which originated from `GNU Make` (for more information, see their [manual](https://devdocs.io/gnu_make/options-summary#-j%20[jobs]){target="_blank"}).
<!-- The target="_blank" opens the link in a new tab as this is a link to a non R related resource and thus might not interest the user too much-->


3 changes: 2 additions & 1 deletion preface.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ The CRAN Cookbook has been developed as part of a special project grant from the

_Thanks to all contributors!_

Lluís Revilla ([@llrs](https://github.com/llrs))
Lluís Revilla ([@llrs](https://github.com/llrs))\
Ivan Krylov ([@aitap](https://github.com/aitap))

# Colophon

Expand Down

0 comments on commit f43df75

Please sign in to comment.