[R-pkg-devel] Issue with CPU time > 2.5 times elapsed time

Rodrigo Tobar Carrizo rodr|go@tob@rc@rr|zo @end|ng |rom uw@@edu@@u
Mon Jul 17 05:30:23 CEST 2023


Hi Jan,

I faced a similar issue recently with the imager package, see https://stat.ethz.ch/pipermail/r-package-devel/2023q2/009042.html for the email thread on this list. In your case, it's probably data.tables creating more threads than what you think are being created, but you might want to double-check.

It ultimately boils down to you having to constrain the number of threads your code and dependencies use during tests/vignettes/example runs. After guidance from Dirk, I painstakingly ended up doing exactly that for our package, see https://github.com/asgr/imager/compare/0ef8afd6249506bfec98c1250a0a2558149d88d9...47d59a942d04cef8bd7cb2d36be926d637e3df11

Regards,

Rodrigo

________________________________
Von: R-package-devel <r-package-devel-bounces using r-project.org> im Auftrag von Jan van der Laan <rhelp using eoos.dds.nl>
Gesendet: Sonntag, 16. Juli 2023 19:30
An: r-package-devel <r-package-devel using r-project.org>
Betreff: [R-pkg-devel] Issue with CPU time > 2.5 times elapsed time


I am trying to upload a new version of the reclin2 package, but it fails
the pre-tests on Debian with the following message:

 > * checking examples ... [14s/4s] NOTE
 > Examples with CPU time > 2.5 times elapsed time
 >                   user system elapsed ratio
 > select_threshold 3.700  0.122   0.455 8.400
 > select_n_to_m    4.228  0.180   0.623 7.075
 > * checking for unstated dependencies in �tests� ... OK

See
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2Fincoming_pretest%2Freclin2_0.3.1_20230716_124651%2FDebian%2F00check.log&data=05%7C01%7Crodrigo.tobarcarrizo%40uwa.edu.au%7Cd0dacf8919cc41c1eb7e08db85f01ec8%7C05894af0cb2846d8871674cdb46e2226%7C0%7C0%7C638251038592720229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pxDjGepeLXPXEYv4sKNsd1hHiXGaSDBM6BA%2FmJLsYrY%3D&reserved=0<https://win-builder.r-project.org/incoming_pretest/reclin2_0.3.1_20230716_124651/Debian/00check.log>
for the complete output.

I can't see why this happens and I can't seem to reproduce this on my
machine. The examples do call makeCluster from parallel, but only start
one thread. The code that is ran in the examples only call base-r
functions and data.table functions. I can imagine data.table starting
multiple threads. However the example consists only of 17 records; and
data.table should not use more than two threads on that system anyway.
So I don't see where the large difference between the two is coming
from. Does anyone have a clue?

The code is here: https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdjvanderlaan%2Freclin2&data=05%7C01%7Crodrigo.tobarcarrizo%40uwa.edu.au%7Cd0dacf8919cc41c1eb7e08db85f01ec8%7C05894af0cb2846d8871674cdb46e2226%7C0%7C0%7C638251038592720229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YgID3y0ersGkKJp0H5QzpfENtecPYHlPE97HloJoo%2FM%3D&reserved=0<https://github.com/djvanderlaan/reclin2> one of the
examples that fails is here:
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdjvanderlaan%2Freclin2%2Fblob%2Fmaster%2FR%2Fselect_threshold.R%23L21&data=05%7C01%7Crodrigo.tobarcarrizo%40uwa.edu.au%7Cd0dacf8919cc41c1eb7e08db85f01ec8%7C05894af0cb2846d8871674cdb46e2226%7C0%7C0%7C638251038592720229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nLI1T7q5IBtfPmU8%2Buj0hJGcE1wMXTkACzEsO0KEntY%3D&reserved=0<https://github.com/djvanderlaan/reclin2/blob/master/R/select_threshold.R#L21>.


Thanks.
Jan

______________________________________________
R-package-devel using r-project.org mailing list
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-package-devel&data=05%7C01%7Crodrigo.tobarcarrizo%40uwa.edu.au%7Cd0dacf8919cc41c1eb7e08db85f01ec8%7C05894af0cb2846d8871674cdb46e2226%7C0%7C0%7C638251038592720229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nQoVas1cmOUfDG0sh%2BXEyEjsDKYljaJXqy5tqRSzU%2BU%3D&reserved=0<https://stat.ethz.ch/mailman/listinfo/r-package-devel>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list