Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processors arguments of kmFit() not working #81

Open
FerranLlobetC opened this issue May 25, 2023 · 2 comments
Open

processors arguments of kmFit() not working #81

FerranLlobetC opened this issue May 25, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@FerranLlobetC
Copy link

FerranLlobetC commented May 25, 2023

Describe the bug
Regardless of N of threads given to the processors arguments of kmFit() the function uses the total number of logical threads.

Expected behavior
Setting processors to N should cause the function to use N processors.

Code to Reproduce

library(devtools)
install_github("BIGslu/kimma")
example.voom <- kimma::example.voom
lm_virus <- kmFit(dat = example.voom, 
               model = "~ virus",
               run.lm = TRUE,
               processors = 4) -> **8 processors being used** (given that my computer has 8 processors). 

Software:

  • OS: Ubuntu 20.04.6 LTS
  • R session (from sessionInfo( )):
R version 4.2.3 (2023-03-15)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS/LAPACK: /opt/miniconda3/envs/R_env/lib/libopenblasp-r0.3.21.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] 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
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] stringr_1.5.0  kimma_1.4.4    edgeR_3.40.0   limma_3.54.0   optparse_1.7.1
[6] tidyr_1.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     magrittr_2.0.3   tidyselect_1.2.0 getopt_1.20.3
 [5] lattice_0.20-45  R6_2.5.1         rlang_1.1.1      foreach_1.5.2
 [9] fansi_1.0.4      dplyr_1.1.2      tools_4.2.3      grid_4.2.3
[13] utf8_1.2.3       cli_3.6.1        iterators_1.0.14 tibble_3.2.1
[17] lifecycle_1.0.3  purrr_1.0.1      codetools_0.2-19 vctrs_0.6.2
[21] glue_1.6.2       stringi_1.7.12   compiler_4.2.3   pillar_1.9.0
[25] generics_0.1.3   locfit_1.5-9.5   pkgconfig_2.0.3

Additional context
Apparently the issue resides in the lines of code 104 to 115 of kmFit.R. While in the file here at GitHub the code looks perfect in the source of the kmFit function that I got there is an extra line break which does not allow the number of processors to be set:

if (nzchar(chk) && chk == "TRUE") {
    processors.to.use <- 2
  }
  else if (is.null(processors)) {
    processors.to.use <- parallel::detectCores() - 2
    if (processors.to.use == 0) {
      stop("Error processors: Default resulted in 0. Please correct.")
    }
  }
  else {
    processors.to.use <- processors
  }
@FerranLlobetC FerranLlobetC added the bug Something isn't working label May 25, 2023
@kdillmcfarland
Copy link
Contributor

Thank you so much for reporting this error! I believe the bug is fixed in the latest release (v1.6.1). Can you check on your system as I do not have a Ubuntu machine to test with?

@FerranLlobetC
Copy link
Author

FerranLlobetC commented Aug 18, 2023

Hi Kimberley,
I appreciate your assistance, but I regret to inform you that the issue persists.

Furthermore, I continue to observe an excessive amount of line breaks when examining the source code of the kmFit() function.

R session (from sessionInfo( )):

` R version 4.2.3 (2023-03-15)
Plaform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS/LAPACK: /opt/miniconda3/envs/R_env/lib/libopenblasp-r0.3.21.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] 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
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] kimma_1.6.1

loaded via a namespace (and not attached):
[1] tidyselect_1.2.0 compiler_4.2.3 magrittr_2.0.3 cli_3.6.1
[5] glue_1.6.2 codetools_0.2-19 iterators_1.0.14 foreach_1.5.2
[9] rlang_1.1.1 `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants