Commit dc4366c6 authored by Illia Kolesnik's avatar Illia Kolesnik
Browse files

Changed logic of task submition for slurm

parent caa57907
Loading
Loading
Loading
Loading
+4 −32
Original line number Diff line number Diff line
#!/bin/bash

#SBATCH --job-name=mpi-grid     # job name (default is the name of this file)
#SBATCH --output=log.%x.job_%j  # file name for stdout/stderr (%x will be replaced with the job name, %j with the jobid)
#SBATCH --time=6-0:00:00        # maximum wall time allocated for the job (D-H:MM:SS)

#SBATCH --partition=gpXY        # partition/queue name for the job submission

#SBATCH --nodes=4               # number of nodes
#SBATCH --ntasks-per-node=2     # MPI processes per node

#SBATCH --threads-per-core=1    # do not use hyperthreads (i.e. CPUs = physical cores below)
#SBATCH --cpus-per-task=2       # number of CPUs per process
#SBATCH --gpus-per-task=0       # number of GPUs per process
#SBATCH --gpu-bind=single:1     # bind each process to its own GPU (single:<tasks_per_gpu>)

# how much RAM per node can be allocated for the job (default: 2G, max: 60G)
#SBATCH --mem=10G

# start the job in the directory it was submitted from
cd "$SLURM_SUBMIT_DIR"


# Stop on error
set -e

USAGE="Usage: ./script <bin> <instances_dir> <result_csv>"
if [ $# -ne 3 ]; then
USAGE="Usage: ./script <bin> <instances_dir> <result_csv> <submit_script>"
if [ $# -ne 4 ]; then
    echo $USAGE
    exit 1
fi
@@ -33,16 +12,9 @@ fi
BIN="$1"
INSTANCES_DIR="$2"
RESULT_CSV="$3"


run_benchmark() {
    local instance="$1"
    
    srun $BIN "$INSTANCES_DIR/$instance" >> $RESULT_CSV
}

SUBMIT_SCRIPT="$4"

echo "REFINES;INSIDE;OUTSIDE;SEQ;AVG;BEST;WORST" > $RESULT_CSV
for instance in $(ls -A1 $INSTANCES_DIR | sort -t '-' -k5n ); do
    run_benchmark "$instance"
    sbatch ./SUBMIT_SCRIPT $BIN "$INSTANCES_DIR/$instance" $RESULT_CSV
done
 No newline at end of file
+4 −24
Original line number Diff line number Diff line
#!/bin/bash

#SBATCH --job-name=seq-grid     # job name (default is the name of this file)
#SBATCH --output=log.%x.job_%j  # file name for stdout/stderr (%x will be replaced with the job name, %j with the jobid)
#SBATCH --time=6-0:00:00        # maximum wall time allocated for the job (D-H:MM:SS)

#SBATCH --partition=gpXY        # partition/queue name for the job submission
#SBATCH --ntasks=1              # number of tasks/processes

# how much RAM per node can be allocated for the job (default: 2G, max: 60G)
#SBATCH --mem=10G

# start the job in the directory it was submitted from
cd "$SLURM_SUBMIT_DIR"

# Stop on error
set -e

USAGE="Usage: ./script <bin> <instances_dir> <result_csv>"
if [ $# -ne 3 ]; then
USAGE="Usage: ./script <bin> <instances_dir> <result_csv> <submit_script>"
if [ $# -ne 4 ]; then
    echo $USAGE
    exit 1
fi
@@ -25,16 +12,9 @@ fi
BIN="$1"
INSTANCES_DIR="$2"
RESULT_CSV="$3"


run_benchmark() {
    local instance="$1"
    
    ./$BIN "$INSTANCES_DIR/$instance" >> $RESULT_CSV
}

SUBMIT_SCRIPT="$4"

echo "OPERATION;REFINES;SIZE;DISTRIBUTION;LINEAR;CLASSIC" > $RESULT_CSV
for instance in $(ls -A1 $INSTANCES_DIR | sort -t '-' -k5n ); do
    run_benchmark "$instance"
    sbatch $SUBMIT_SCRIPT "$BIN $INSTANCES_DIR/$instance" $RESULT_CSV
done
 No newline at end of file