#!/bin/bash
set -u
set -xv

resolution=$1
machine=$( hostname | sed -e "s/[0-9]*//g" )

case $machine in 
    "beaufix") ncore_nod=40 ;;
    "curie")   ncore_node=16 ;;
esac

case $ncore_node in
    16)
    case ${resolution} in
	"1")list1="4*4 8*4 8*8 8*16 24*10 24*22 40*24 72*28 120*30 72*66" ;;
	"025")list025="4*4 8*4 8*8 16*8 20*12 24*22 32*32 48*42 160*25 56*134 120*134 240*121" ;;
	"12")list12="16*8 16*16 32*16 40*26 80*26 80*51 114*72 160*102 240*126" ;;
    esac
    ;;
    40)
    case ${resolution} in
	"1")list1="8*5 8*10 16*10 20*16 20*30 40*33 60*42 120*42" ;;
	"025")list025="8*5 10*8 16*10 20*16 20*32 40*32 60*42 80*67 180*64" ;;
	"12")list12="40*31 60*42 80*63 160*75" ;;
    esac
    ;;
esac


# ORCA1
if [ ${resolution} == "1" ]; then
for cores in $list1
do
  ./submit_bench $cores $ncore_node ${resolution}
done

# ORCA025
elif [ ${resolution} == "025" ]; then
for cores in $list025
do
  ./submit_bench $cores $ncore_node ${resolution}
done

# ORCA12
elif [ ${resolution} == "12" ]; then
for cores in $list12
do
  ./submit_bench $cores $ncore_node ${resolution}
done
fi
