'How to set variable job name using Sun Grid Engine?

I would like to run multiple codes with Ranf as arguments of my c code. This script works but when I use : "status -a" I see this :

 30193  4 test                 vierron    03/18/2022 11:15:42 Treize

The problem is that I would like to have a variable job_name...

And second problem is : I'm using more than 4 process (here 2*4 process) because I have a for loop. So the number of process used is not right.

my script :

#!/bin/bash
#
#$ -N test
#$ -cwd
#$ -j y
#$ -S /bin/bash
#
#$ -q Treize
#$ -pe ompi_treize_pe 4
#
#$ -v OMP_NUM_THREADS=1
#$ -M vierron
#$ -m e
# Nom de l'executable

. /local/opt/Modules/3.2.9/init/sh
module load openmpi-gcc/3.1.0 gcc/7.3.1


process_id=$!
for Ranf in '1000' '2000'
do
    mkdir RBnf-Ra=$Ranf
    cp RBnf `pwd`/RBnf-Ra=$Ranf/
    cp postrait.sh `pwd`/RBnf-Ra=$Ranf/
    cp *.plot `pwd`/RBnf-Ra=$Ranf/
    cd RBnf-Ra=$Ranf
    MYCOMMAND="-N $JOB_NAME${Ranf} mpirun $NSLOTS ./test ${Ranf}"
    $MYCOMMAND &
    cd ..
done
wait $process_id

If you have any ideas ! Thank you !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source