revdepcheck icon indicating copy to clipboard operation
revdepcheck copied to clipboard

Set OMP_THREAD_LIMIT to 1 in check workers

Open krlmlr opened this issue 5 years ago • 4 comments

Otherwise packages such as xgboost will happily use all CPUs available.

https://www.ibm.com/support/knowledgecenter/SSGH2K_12.1.0/com.ibm.xlc121.aix.doc/compiler_ref/omp_thread_limit.html

krlmlr avatar Dec 21 '18 16:12 krlmlr

Yeah, although shouldn't the package itself set this?

gaborcsardi avatar Dec 21 '18 16:12 gaborcsardi

... or possibly set it to OMP_THREAD_LIMIT=2 to make sure to test multi-threading actually works. Two parallel tasks is what the CRAN policy allows. It could be conditionally set based on _R_CHECK_LIMIT_CORES_=true set by R CMD check.

PS. I agree that the packages should do this themselves, and one could argue that R CMD check c/should do it automatically (as I think it should also do with MC_CORES) to prevent damage, but having revdepcheck add this protection by default would be helpful.

HenrikBengtsson avatar Apr 19 '19 20:04 HenrikBengtsson

You can also just set this before starting the check, env vars are inherited.

gaborcsardi avatar Apr 19 '19 20:04 gaborcsardi

I think this would be reasonable to set in revdep_env_vars()

hadley avatar May 02 '20 14:05 hadley