Adding cores transmission mechanism for the R script

This commit is contained in:
Louis 2026-01-27 10:20:19 +01:00
parent 2443c49694
commit 0ce0338111
2 changed files with 16 additions and 3 deletions

View file

@ -9,6 +9,14 @@ library(blockmodels)
library(here) library(here)
library(microbenchmark) 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") data_folder <- here("results", "lbm-seq")
the_data <- import_biom("data/mach/kinetic.biom") 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) per_taxa_networks <- collapse_otu_at_taxo(the_data)
mode <- commandArgs(trailingOnly = TRUE)
switch(mode, switch(mode,
"seq" = { "seq" = {
message("Will use SEQ") message("Will use SEQ")

9
sge_scripts/benchmark_lbm_seq.sh Normal file → Executable file
View file

@ -5,7 +5,7 @@
#$ -m besa #$ -m besa
#$ -q long.q #$ -q long.q
#$ -t 1-12 #$ -t 1-12
#$ -pe thread 128 #$ -pe thread 64
#$ -M louis.lacoste+migale@agroparistech.fr #$ -M louis.lacoste+migale@agroparistech.fr
#$ -o logs/$JOB_NAME #$ -o logs/$JOB_NAME
#$ -e logs/$JOB_NAME #$ -e logs/$JOB_NAME
@ -40,4 +40,9 @@ case $ARGID in
;; ;;
esac esac
Rscript "${APPLICATIONS_DIR}/benchmark_lbm_seq.R" $MODE &>> logs/$JOB_NAME.$SGE_TASK_ID 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