I have a R code that I want to execute on several nodes using Slurm, with each iteration of my paramater which goes on a node. This is my Slurm code :
#!/bin/bash
#SBATCH -o job-%A_task.out
#SBATCH --job-name=paral_cor
#SBATCH --partition=normal
#SBATCH --time=1-00:00:00
#SBATCH --mem=124G #I want to use 124Go / node
#SBATCH --cpus-per-task=32 #and 32CPUs / node
#SBATCH --exclude=hpcsmp01
module load gcc/8.1.0 openblas/0.3.3 R
OUTPUT="$HOME"/PROJET_M2/data/$parallel_nodes_test
mkdir -p "$OUTPUT"
echo "Start job :"`date`
Rscript my_scrit.R --subset $i --file $1 > "$OUTPUT"
echo "Stop job :"`date`
The paramater --subset $i will take value from 1 to X (X depends of my input file in my R code) . Then, for each iteration of i , I want that one script which be executed on a node . For example, --subset 1 -> one node , --subset 2 --> another node ... until --subset X -> a last node
I don't want to use jobs arrays because it doesn't work correctly on my cluster. So, I want to create a bash loop which would look like this :
for i in ?
sbatch slurm_code.sh $i
done
I don't know how to make the link between the parameter --subset $i and how to increment it in the for loop from 1 to X.