#!/usr/bin/env bash
# Acquire colored printed text.
source ../../helpers.sh

JOBS="
    cpu_prof_nlat_128_nlon_128.sh 
    cpu_prof_nlat_256_nlon_256.sh 
    cpu_prof_nlat_512_nlon_512.sh 
    cpu_prof_nlat_1024_nlon_1024.sh 
    cpu_prof_nlat_1024_nlon_1536.sh 
    cpu_prof_nlat_1536_nlon_1024.sh 
    cpu_prof_nlat_1280_nlon_1280.sh
"

for J in $JOBS; do
    # Wait till there are less than 2 jobs running.
    CONCURRENT_DEBUG_JOBS=$(squeue --me -p dev-g | wc -l)
    while [ $CONCURRENT_DEBUG_JOBS -eq 3 ]; do
        sleep 10
        CONCURRENT_DEBUG_JOBS=$(squeue --me -p dev-g | wc -l)
    done

    sbatch $J    
    info "==> Submitted $J"
done

success "==> Submitted all jobs."
