[R-pkg-devel] Checking the number of cores used
Shu Fai Cheung
@hu|@|@cheung @end|ng |rom gm@||@com
Wed Sep 20 10:09:09 CEST 2023
Thanks a lot. I don't have a physical linux box and so I need to use
rhub. But I don't know why there are no "-Ex.timings" files in the
check. E.g,
check(platform = "debian-gcc-release", show_status = FALSE, check_args
= "--as-cran")
I can only see these files in artifacts:
[ ] 00check.log 2023-09-20 08:00 3.4K
[ ] 00install.out 2023-09-20 08:00 702
[ ] Rdlatex.log 2023-09-20 08:00 30K
[ ] modelbpp-Ex.Rout 2023-09-20 08:00 28K
[ ] modelbpp-manual.log 2023-09-20 08:00 19K
The case is the same for this, no "-Ex.timings" files:
check(platform = "windows-x86_64-release", show_status = FALSE,
check_args = "--as-cran")
Although I think I need to, I tried adding "--timings" but still do
not see the "-Ex.timings".
However, if I run the check locally in Windows 10 using R CMD check
with --as-cran, I can find the "-Ex.timings" files.
I can find the total time at the end of "-Ex.Rout" but I think this is
not what I need:
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 10.963 0.161 13.589 0.302 0.081
Regards,
Shu Fai
On Tue, Sep 19, 2023 at 5:59 PM Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>
> On 18/09/2023 10:10 a.m., Shu Fai Cheung wrote:
> > Hi All,
> >
> > I know we should not use more than 2 cores in tests, vignettes, etc. I
> > encountered and solved this issue before. However, I still committed
> > this mistake in a new package and would like find out where the cause
> > is.
> >
> > I have a package that already has parallel processing disabled by
> > default and I did not enable parallel processing in the examples and
> > tests (except for one test, which is always skipped by skip()).
> > However, I was told that somewhere in the package more than 2 cores
> > are used.
> >
> > I checked several times and even added a temporary 'stop()` to "trap"
> > parallel processing but still could not find where the source of the
> > problem is.
> >
> > I checked the timing in the log in R CMD check results from winbuilder
> > but everything seems OK. The user time and elapsed time are similar
> > for all the examples.
> >
> > Is there any quick way to check where things go wrong regarding the
> > number of cores? It is not easy to find the source of the problems
> > when there are many examples and tests.
>
> If you run R CMD check <pkg> at the command line, it will produce a
> directory *.Rcheck containing a number of files. One of those files
> will be *-Ex.timings, which will give the individual timings of each of
> the examples in your package. Maybe you can recognize from those which
> of the examples are problematic ones, and add `proc.time()` calls to the
> example to figure out which line(s) cause the issue.
>
> I don't remember whether winbuilder keeps the timings file when it runs
> a check.
>
> Duncan Murdoch
>
More information about the R-package-devel
mailing list