Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Oct 1, 2024
1 parent 0f7c6d1 commit 7cfc36f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/Seurat.Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -5430,14 +5430,16 @@ compareVarFeaturesAndRanks <- function(
#'
#' # Assuming CBE.params exists and has a `cpus` entry of 4
#' getCPUsCBE() # returns 3
#'
.getNrCores <- function(n.cpus.def = 8) {
# Check if 'CBE.params' exists and contains 'cpus'
if (exists("CBE.params") && is.list(CBE.params) &&
is.numeric(CBE.params$"cpus") && CBE.params$"cpus" > 0) {
max(CBE.params$"cpus" - 1, 1)
} else {
return(n.cpus.def)
}
# if (exists("CBE.params") && is.list(CBE.params) &&
# is.numeric(CBE.params$"cpus") && CBE.params$"cpus" > 0) {
# max(CBE.params$"cpus" - 1, 1)
# } else {
n_cores_detected <- as.numeric(system("nproc", intern = TRUE))
return(max(min(n_cores_detected-1, n.cpus.def),1))
# }
}


Expand Down

0 comments on commit 7cfc36f

Please sign in to comment.