vendredi 18 juin 2021

Passing variables of bash script to another bash script for submitting job on queue

I tried to read my file, the device (GPU or CPU), and the size of my vector from command line and then with respect to the chosen device, submit my job script with that parameters in to the queue of specific GPU or CPU. But after submitting my job to the queue, when I validate my script like:

bash job.sh

I saw that my parameters file, device, and size from submitjob.sh script did not pass to the job.sh script.

Could you please help me what is my mistake?!

My submitjob.sh:

#!/bin/sh -f
echo "Input The File!";
read file
echo "Choose Gpu Or Cpu!";
read device
echo "Input Vector Size!";
read size
echo
if [ "$device" = "Gpu" ]; then
qsub -I -l nodes=1:gen9:ppn=2 -d . ./job.sh file device size
else
qsub -I -l nodes=1:skl:ppn=2 -d . ./job.sh file device size
fi

my job.sh:

#!/bin/bash

source /opt/intel/inteloneapi/setvars.sh

echo
echo start: $(date "+%y%m%d.%H%M%S.%3N")
echo
$file $device $size
echo
echo stop: $(date "+%y%m%d.%H%M%S.%3N")
echo

Aucun commentaire:

Enregistrer un commentaire