Skip to content
Snippets Groups Projects
Commit 9c022f3f authored by Matthias Volk's avatar Matthias Volk
Browse files

Example script for reading commands to run from file

parent cc4b2a4a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env zsh
### Example SLURM script
### It executes all commands given in the file 'cmdline_jobs.txt' in parallel and writes the output in the directory 'output'.
### All necessary configuration (timeout, memout) is set in this file and can be modified.
### The jobs can be scheduled with 'sbatch bench_cmdline_args.sh'
### Project name. Required to actually use *our* cluster
#SBATCH -A moves
### Job name
#SBATCH --job-name=benchmarks
### Array job
### The upper bound should be the number of lines in the job script (i.e., the number of commands to run)
#SBATCH --array=1-5
### Output file name. Zero-pad task id with 4
#SBATCH -o /home/%u/output/%x.job%A_task%4a.out
### Timelimit in hours:minutes:seconds
#SBATCH -t 01:20:00
### Number of available threads
#SBATCH --cpus-per-task=4
### Memory per thread in Megabytes. Total amount of available memory is --cpus-per-task * --mem-per-cpu
#SBATCH --mem-per-cpu=1024M
### Receive all kinds of email notifications
#SBATCH --mail-type=ALL
#SBATCH --mail-user=matthias.volk@cs.rwth-aachen.de
### Set limits
TIMEOUT=300 # in seconds
MEMOUT=4096 # in MB
### Load the module system configuration, necessary to load dependent libraries
source $HOME/hpc-scripts/prepareEnvironmentGcc.sh
### Change Directory to your working directory (binaries, etc)
WORKDIR=$HOME/test_python
cd $WORKDIR
### Memout is expected in Kb
MEMOUT=$(( MEMOUT * 1024 ))
### Horizontal line for better distinction of tool output
HLINE="===================================================================================================="
### Find the correct line according to the task id
cur=$SLURM_ARRAY_TASK_ID
### Jobs are in a text file where each line contains one cmdline call
cmd=$(time sed -n "${cur}p" < $HOME/hpc-scripts/examples/cmdline_jobs.txt)
### Print command
echo "Executing $cmd"
start=`date +"%s%3N"`
### Exececute the call
echo $HLINE
### Ulimit:
### -c 0: No core dumps (important!)
### -v N: Limit to N kilobytes of memory
### -t N: Limit of CPU time for this subprocess
ulimit -c 0 && ulimit -S -v $MEMOUT && ulimit -S -t $TIMEOUT && eval time $cmd ; rc=$?
echo $HLINE
### Print time and exitcode
end=`date +"%s%3N"`
echo "time: $(( end - start ))ms"
echo "exitcode: $rc"
source env_python/bin/activate && cd stormpy && python examples/parametric_models/01-parametric-models.py
source env_python/bin/activate && cd stormpy && python examples/parametric_models/02-parametric-models.py
./storm/build/bin/storm --prism storm/resources/examples/testfiles/dtmc/crowds-5-5.pm --prop "P=? [F \"observe0Greater1\"]"
./storm/build/bin/storm-dft -dft storm/resources/examples/testfiles/dft/symmetry6.dft -mttf
./storm/build/bin/storm-dft -dft storm/resources/examples/testfiles/dft/hecs_2_2.dft -mttf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment