diff --git a/benchmark_lbm_seq.R b/benchmark_lbm_seq.R index 46798d2..d7e54eb 100644 --- a/benchmark_lbm_seq.R +++ b/benchmark_lbm_seq.R @@ -9,6 +9,14 @@ library(blockmodels) library(here) library(microbenchmark) +args <- commandArgs(trailingOnly = TRUE) +mode <- args[1] +nb_cores <- as.integer(args[2]) + +options(parallelly.availableCores.custom = function() { + max(1L, nb_cores) +}) + data_folder <- here("results", "lbm-seq") the_data <- import_biom("data/mach/kinetic.biom") @@ -22,7 +30,7 @@ if (!dir.exists(tmp_folder)) { per_taxa_networks <- collapse_otu_at_taxo(the_data) -mode <- commandArgs(trailingOnly = TRUE) + switch(mode, "seq" = { message("Will use SEQ") diff --git a/sge_scripts/benchmark_lbm_seq.sh b/sge_scripts/benchmark_lbm_seq.sh old mode 100644 new mode 100755 index 56db2d7..8126411 --- a/sge_scripts/benchmark_lbm_seq.sh +++ b/sge_scripts/benchmark_lbm_seq.sh @@ -5,7 +5,7 @@ #$ -m besa #$ -q long.q #$ -t 1-12 -#$ -pe thread 128 +#$ -pe thread 64 #$ -M louis.lacoste+migale@agroparistech.fr #$ -o logs/$JOB_NAME #$ -e logs/$JOB_NAME @@ -40,4 +40,9 @@ case $ARGID in ;; esac -Rscript "${APPLICATIONS_DIR}/benchmark_lbm_seq.R" $MODE &>> logs/$JOB_NAME.$SGE_TASK_ID \ No newline at end of file +readonly NB_CORES=$(sed -n 's/^#\$ -pe thread \(.*\)/\1/p' -- "$0") + + +echo -n "Model will be $MODE with $NB_CORES" + +Rscript "${APPLICATIONS_DIR}/benchmark_lbm_seq.R" $MODE $NB_CORES &>> logs/$JOB_NAME.$SGE_TASK_ID \ No newline at end of file