2

为了弄清楚为什么 mkin 1.1.0(即将发布)测试在 winbuilder 和 r-hub 上使用 R-devel 失败,我在 Linux 上使用 R-devel 进行本地检查。我发现使用 R 4.1.2 时某些测试运行得相当快

me@computer:~/git/mkin (main)$ time Rscript -e "testthat::test_file('tests/testthat/test_tests.R', reporter = 'Progress')"
Loading required package: mkin
Loading required package: parallel
✔ | F W S  OK | Context
✔ |         9 | Hypothesis tests [9.0s]                                                                                                                                                                                               

══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 9.0 s

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 9 ]

real    1m48,779s
user    4m37,386s
sys     3m17,240s

unix time 命令报告的额外时间在setup_script.R文件中花费。

当我使用本地编译的 R-devel 时,相同的测试需要四倍以上的时间

Loading required package: mkin
Loading required package: parallel
✔ | F W S  OK | Context
✔ |         9 | Hypothesis tests [42.4s]                                                                                                                                                                                              

══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 42.4 s

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 9 ]

real    2m21,823s
user    5m7,507s
sys     3m14,287s

在这两种情况下,R 都使用 openblas-pthread,请参阅 R 4.1.2:

me@computer:~/git/mkin (main)$ Rscript -e "sessionInfo()"
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 11 (bullseye)

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.2

对于 R-devel:

me@computer:~/git/mkin (main)$ Rscript-devel -e "sessionInfo()"
R Under development (unstable) (2022-03-02 r81842)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 11 (bullseye)

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.0

您可以尝试从我的最新提交中重现此内容(必要时增加克隆深度)

git clone git@github.com:jranke/mkin --depth=10
cd mkin
git checkout 77c248ca40b82ec00a756cd82f12968131f78959

将设置脚本剥离到从这个特定文件运行测试真正需要的内容可以减少时间差异:

$ git pull origin stackoverflow_71340826
$ Rscript -e "testthat::test_file('tests/testthat/test_tests.R', reporter = 'Progress')"
Loading required package: mkin
Loading required package: parallel
✔ | F W S  OK | Context
✔ |         9 | Hypothesis tests [7.8s]                                                                                                                                                                                               

══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 7.8 s

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 9 ]

相比于

$ Rscript-devel -e "testthat::test_file('tests/testthat/test_tests.R', reporter = 'Progress')"
Loading required package: mkin
Loading required package: parallel
✔ | F W S  OK | Context
✔ |         9 | Hypothesis tests [13.9s]                                                                                                                                                                                              

══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 14.0 s

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 9 ]

任何提示表示赞赏。

4

0 回答 0