CecileProust-Lima / lcmm

R package lcmm
https://CecileProust-Lima.github.io/lcmm/
54 stars 13 forks source link

Using nproc #185

Closed Gootjes closed 1 year ago

Gootjes commented 1 year ago

I just noticed that the nproc argument is not working for me.

The example hlme works

m1<-hlme(Y~Time*X1,random=~Time,subject='ID',ng=1,data=data_hlme)

But this does not

cl <- parallel::makeCluster(10, "PSOCK")
m1<-hlme(Y~Time*X1,random=~Time,subject='ID',ng=1,data=data_hlme, nproc = cl, clustertype = "PSOCK")
# Error in mla(b = b, m = length(b), fn = loglikhlme, clustertype = clustertype,  : 
#   'list' object cannot be coerced to type 'double'

How can I solve or avoid this error?

Session information

R version 4.3.0 (2023-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.7 (Ootpa)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblaso-r0.3.15.so;  LAPACK version 3.9.0

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

time zone: Europe/Amsterdam
tzcode source: system (glibc)

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

other attached packages:
[1] doParallel_1.0.17 iterators_1.0.14  foreach_1.5.2     lcmm_2.0.2        marqLevAlg_2.0.8  randtoolbox_2.0.4
[7] rngWELL_0.10-9    mvtnorm_1.1-3     survival_3.5-5   

loaded via a namespace (and not attached):
 [1] future_1.32.0     stringi_1.7.12    lattice_0.21-8    listenv_0.9.0     digest_0.6.31     magrittr_2.0.3   
 [7] evaluate_0.21     grid_4.3.0        pkgload_1.3.2     fastmap_1.1.1     Matrix_1.5-4      processx_3.8.1   
[13] sessioninfo_1.2.2 pkgbuild_1.4.0    urlchecker_1.0.1  ps_1.7.5          promises_1.2.0.1  purrr_1.0.1      
[19] codetools_0.2-19  cli_3.6.1         shiny_1.7.4       rlang_1.1.1       crayon_1.5.2      parallelly_1.35.0
[25] ellipsis_0.3.2    splines_4.3.0     remotes_2.4.2     cachem_1.0.8      yaml_2.3.7        devtools_2.4.5   
[31] tools_4.3.0       memoise_2.0.1     httpuv_1.6.10     globals_0.16.2    vctrs_0.6.2       R6_2.5.1         
[37] mime_0.12         lifecycle_1.0.3   stringr_1.5.0     htmlwidgets_1.6.2 fs_1.6.2          usethis_2.1.6    
[43] miniUI_0.1.1.1    callr_3.7.3       later_1.3.1       glue_1.6.2        profvis_0.3.8     Rcpp_1.0.10      
[49] xfun_0.39         rstudioapi_0.14   knitr_1.42        xtable_1.8-4      htmltools_0.5.5   nlme_3.1-162     
[55] rmarkdown_2.21    compiler_4.3.0    prettyunits_1.1.1
Gootjes commented 1 year ago

I just realized I am being dumb and the nproc should receive a number, not a cluster... I got confused I guess because gridsearch does accept a cluster (and a number).