1

How do I get the script run with the sbatch command to run with the 23 individual run_prep_chem_$dd.sh (i.e. run_prep_chem_08.sh...run_prep_chem_30.sh)? I am thinking since its in this for loop that it would run properly. The code above the sbatch loops through 23 times but not the at sbatch script line

#!/bin/bash

RP_INPUT='$RP_INPUT'
END='$END'

for dd in {08..30}; do

set dd=$dd

printf  "%-3s %02d\n" "$dd" "$((10#$dd + 1))"

cat > /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/prep_chem_sources_$dd.inp << __EOF
$RP_INPUT

!---------------- grid_type of the grid output
   grid_type= 'mercator',
                        !'rams' = rams grid
                        ! 'polar'  = polar sterog. grid output
                        ! 'gg'  = gaussian grid output
                        ! 'll'  = lat/lon grid output
                        ! 'lambert'  = lambert grid output
                        ! 'mercator' = mercator grid output

!---------------- if the output data is for use in CATT-BRAMS model, provide at least one analysis file

$END

__EOF

cp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/prep_chem_sources_$dd.inp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/prep_chem_sources.inp

cat > /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh << BEOF
#!/bin/bash -x
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=100000
#SBATCH --cpus-per-task=1
#SBATCH --time=00:30:00
export I_MPI_JOB_STARTUP_TIMEOUT=10000

source /etc/bashrc

module load hdf5/1.8.12

srun --distribution=block:block /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/prep_chem_sources_RADM_WRF_FIM.exe

BEOF

chmod 757 /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh

mv /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh  /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/run_prep_chem_$dd.sh

sbatch --dependency=afterok:$SLURM_JOB_ID /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/run_prep_chem_$dd.sh

cp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/AEROSE_APRIL_CTL-T-2010-04-$dd-000000-g1-ab.bin /data/users/jwsmith/WRFV3/run/AEROSE_APRIL_CTL-T-2010-04-$dd-000000-g1-ab.bin

done
  • What is sbatch? What happens in that line? Is there an error? Is the rest of the script irrelevant to this problem? If so why do you give us all that code? You should minimize the code to that necessary to reproduce the problem. – Hauke Laging Nov 3 '14 at 0:22
  • what is the set dd=$dd supposed to do? If you think that that will export the dd variable, you're wrong. put an export dd at the top of your script for that. I cannot test or answer since I don't have those (gdal?) tools installed on this machine and there may be other problems with your script. – pizdelect Jan 11 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.