🚧 Switching to future backend for weboflife collection
This commit is contained in:
parent
2153152261
commit
7a40537c65
1 changed files with 21 additions and 7 deletions
|
|
@ -2,6 +2,9 @@ library(colSBM)
|
|||
library(dplyr)
|
||||
library(tidyr)
|
||||
library(here)
|
||||
library(future.apply)
|
||||
|
||||
plan(multicore)
|
||||
|
||||
application_name <- "weboflife"
|
||||
|
||||
|
|
@ -17,6 +20,7 @@ source(prepare_data_script_path)
|
|||
arg <- commandArgs(trailingOnly = TRUE)
|
||||
|
||||
model <- "iid"
|
||||
seed <- 1234L
|
||||
|
||||
if (length(arg) == 0L) {
|
||||
message("No arguments provided, using default.")
|
||||
|
|
@ -26,17 +30,26 @@ if (length(arg) == 0L) {
|
|||
} else {
|
||||
message("No model provided, defaulting to iid.")
|
||||
}
|
||||
if ("--seed" %in% arg) {
|
||||
seed <- try(as.integer(arg[(which(arg == "--seed") + 1L)]))
|
||||
} else {
|
||||
message("No seed provided, defaulting to 1234.")
|
||||
}
|
||||
}
|
||||
|
||||
# Arguments checks
|
||||
allowed_model <- c("iid", "pi", "rho", "pirho")
|
||||
stopifnot(
|
||||
"Unknown model, should be : iid, pi, rho or pirho" = (model %in% allowed_model)
|
||||
"Unknown model, should be : iid, pi, rho or pirho" = (model %in% allowed_model),
|
||||
"Seed isn't castable to integer" = (is.integer(seed))
|
||||
)
|
||||
|
||||
message(sprintf("Début du clustering des données %s avec le modèle ", application_name), model)
|
||||
message(
|
||||
sprintf("Début du clustering des données %s avec le modèle ", application_name), model,
|
||||
" et la seed ", seed
|
||||
)
|
||||
|
||||
set.seed(1234, "L'Ecuyer-CMRG")
|
||||
set.seed(seed, "L'Ecuyer-CMRG")
|
||||
base_data_folder <- file.path(here(), "code", "data", application_name)
|
||||
save_folder <- file.path(here(), "code", "results", "applications", application_name)
|
||||
|
||||
|
|
@ -52,17 +65,18 @@ list_collection <- clusterize_bipartite_networks(
|
|||
colsbm_model = model,
|
||||
nb_run = 3L,
|
||||
global_opts = list(
|
||||
nb_cores = parallelly::availableCores(omit = 1L) %/% 2L,
|
||||
verbosity = 2L,
|
||||
nb_cores = parallelly::availableCores(omit = 1L),
|
||||
verbosity = 4L,
|
||||
plot_details = 0L,
|
||||
backend = "parallel"
|
||||
backend = "future"
|
||||
)
|
||||
)
|
||||
|
||||
save_file <- file.path(
|
||||
save_folder, paste0(
|
||||
sprintf("%s_collection_", application_name),
|
||||
model, "_", start_time, ".Rds"
|
||||
model, "_seed_", seed,
|
||||
"_", start_time, ".Rds"
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue