diff --git a/increasing_size_test.R b/increasing_size_test.R index 4befcb5..a3600c4 100644 --- a/increasing_size_test.R +++ b/increasing_size_test.R @@ -1,10 +1,16 @@ library(sbm) +args <- commandArgs(trailingOnly = TRUE) +if (identical(args, character(0)) || is.na(as.integer(args))) { + max_nb_col <- 5000L + print(paste0("No or incorrect argument was passed setting to default value : ", max_nb_col)) +} else { + max_nb_col <- as.integer(args) + print(paste0("Setting to provided value : ", max_nb_col)) +} + set.seed(1234) - nb_row <- 50 - - blockProp <- list( c(0.25, 0.75), c(0.1, 0.4, 0.5) @@ -15,7 +21,7 @@ connectParam <- list(mean = matrix(c( 0.3, 0.2, 0.05 ), nrow = 2L, ncol = 3L)) -nb_col_seq <- seq(50, 5000, by = 50) +nb_col_seq <- seq(50, max_nb_col, by = 50) lbm_list <- lapply(nb_col_seq, function(nb_col) { sampleBipartiteSBM( @@ -32,11 +38,12 @@ lbm_matrices <- lapply(lbm_list, function(lbm) lbm$networkData) lbm_row_memberships <- lapply(lbm_list, function(lbm) apply(lbm$indMemberships$row, 1, FUN = function(row) which(row == 1))) lbm_col_memberships <- lapply(lbm_list, function(lbm) apply(lbm$indMemberships$col, 1, FUN = function(col) which(col == 1))) +library(parallelly) library(future) library(future.apply) library(future.callr) -plan(tweak("callr", workers = availableWorkers(omit = 1L))) +plan(tweak("callr", workers = 64)) lbm_res <- future_lapply(lbm_matrices, function(mat) { start_time <- Sys.time()