% Write the input script "fort.90" with desired parameters INPUT = 'setup_and_run.sh'; fid = fopen(INPUT,'wt'); fprintf(fid,[... '#!/bin/bash\n',... 'mkdir -p $SCRATCH/ahoffman/HeLaZ/wk\n',... ... 'cd $SCRATCH/ahoffman/HeLaZ/wk/\n',... ... 'mkdir -p ', BASIC.RESDIR,'\n',... 'cd ',BASIC.RESDIR,'\n',... 'cp $HOME/HeLaZ/wk/fort.90 .\n',... 'cp $HOME/HeLaZ/wk/batch_script.sh .\n',... ... 'sbatch batch_script.sh\n',... 'echo tail -f $SCRATCH/ahoffman/HeLaZ/results/',BASIC.SIMID,'/',BASIC.PARAMS,'/out.txt']); fclose(fid); system(['cp setup_and_run.sh ',BASIC.RESDIR,'/.']); % Write the sbatch script INPUT = 'batch_script.sh'; fid = fopen(INPUT,'wt'); fprintf(fid,[... '#!/bin/bash\n',... '#SBATCH --chdir $SCRATCH/ahoffman/HeLaZ/results/',BASIC.SIMID,'/',BASIC.PARAMS,'\n',... '#SBATCH --job-name ',CLUSTER.JNAME,'\n',... '#SBATCH --time ', CLUSTER.TIME,'\n',... '#SBATCH --nodes ', CLUSTER.NODES,'\n',... '#SBATCH --cpus-per-task ', CLUSTER.CPUPT,'\n',... '#SBATCH --ntasks-per-node ', CLUSTER.NTPN,'\n',... '#SBATCH --mem ', CLUSTER.MEM,'\n',... '#SBATCH --partition ',CLUSTER.PART,'\n',... 'module purge\n',... 'module load intel/19.0.5\n',... 'module load intel-mpi/2019.5.281\n',... 'module load fftw/3.3.8-mpi-openmp\n',... 'module load hdf5/1.10.6-mpi\n',... 'srun --cpu-bind=cores ./../../../bin/helaz ',num2str(NP_P),' ',num2str(NP_KR)]); fclose(fid); system(['cp batch_script.sh ',BASIC.RESDIR,'/.']); system('scp {fort.90,setup_and_run.sh,batch_script.sh} ahoffman@izar.epfl.ch:/home/ahoffman/HeLaZ/wk');