run_distcheck_tests.sh 3.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash
set -e
set -x

#some defaults
mpiTasks=2
matrixSize=150
nrEV=$matrixSize
blockSize=16
ompThreads=1
configueArg=""
batchCommand=""
slurmBatch="no"
Andreas Marek's avatar
Andreas Marek committed
14
gpuJob="no"
15 16 17 18 19 20 21

function usage() {
	cat >&2 <<-EOF

		Call all the necessary steps to perform an ELPA CI test

		Usage:
22
		  run_distcheck_tests [-c configure arguments] [-d distcheck configure arguments] [-h] [-t MPI Tasks] [-m matrix size] [-n number of eigenvectors] [-b block size] [-o OpenMP threads] [-q submit command] [-S submit to Slurm] [-g GPU job]"
23 24 25 26

		Options:
		 -c configure arguments
		    Line of arguments passed to configure call
27 28 29 30

                 -d configure arguments to distcheck
		    Line of arguments passed to distcheck configure call

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
		 -t MPI Tasks
		    Number of MPI processes used during test runs of ELPA tests

		 -m Matrix size
		    Size of the mxm matrix used during runs of ELPA tests

		 -n Number of eigenvectors
		    Number of eigenvectors to be computed during runs of ELPA tests

		 -b block size
		    Block size of block-cyclic distribution during runs of ELPA tests

		 -o OpenMP threads
		    Number of OpenMP threads used during runs of ELPA tests

		 -q submit command
		    Job steps will be submitted via command to a batch system (default no submission)

		 -S submit to slurm
		    if "yes" a SLURM batch job will be submitted

Andreas Marek's avatar
Andreas Marek committed
52 53 54
		 -g gpu job
		    if "yes" a gpu job is assumed

55 56 57 58 59 60
		 -h
		    Print this help text
	EOF
}


61
while getopts "c:d:t:j:m:n:b:o:s:q:i:S:g:h" opt; do
62 63 64 65 66 67 68 69 70 71 72 73 74
	case $opt in
		t)
			mpiTasks=$OPTARG;;
		m)
			matrixSize=$OPTARG;;
		n)
			nrEV=$OPTARG;;
		b)
			blockSize=$OPTARG;;
		o)
			ompThreads=$OPTARG;;
		c)
			configureArgs=$OPTARG;;
75 76 77
		d)
			distcheckConfigureArgs=$OPTARG;;

78 79 80 81
		q)
			batchCommand=$OPTARG;;
		S)
			slurmBatch=$OPTARG;;
Andreas Marek's avatar
Andreas Marek committed
82 83
		g)
			gpuJob=$OPTARG;;
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
		:)
			echo "Option -$OPTARG requires an argument" >&2;;
		h)
			usage
			exit 1;;
		*)
			exit 1;;
	esac
done


if [ "$slurmBatch" == "yes" ]
then

  # default exit code
  exitCode=1
  CLUSTER=""
  if [[ "$HOST" =~ "cobra" ]]
  then
    CLUSTER="cobra"
  fi
  if [[ "$HOST" =~ "talos" ]]
  then
    CLUSTER="talos"
  fi
  if [[ "$HOST" =~ "freya" ]]
  then
    CLUSTER="freya"
  fi
  if [[ "$HOST" =~ "draco" ]]
  then
    CLUSTER="draco"
  fi

118
  echo "Running on $CLUSTER with runner $CI_RUNNER_DESCRIPTION with tag $CI_RUNNER_TAGS on $mpiTasks tasks"
119 120 121 122 123

  #distcheck
  if [[ "$CI_RUNNER_TAGS" =~ "distcheck" ]]
  then
    cp $HOME/runners/job_script_templates/run_${CLUSTER}_1node.sh .
124
    echo "./configure " "$configureArgs" " || { cat config.log; exit 1; }"  >> ./run_${CLUSTER}_1node.sh
125 126
    echo " " >> ./run_${CLUSTER}_1node.sh
    echo "export TASKS=$mpiTasks" >> ./run_${CLUSTER}_1node.sh
127
    echo "export DISTCHECK_CONFIGURE_FLAGS=\" $distcheckConfigureArgs \" "  >> ./run_${CLUSTER}_1node.sh
128 129
    echo "make distcheck TEST_FLAGS=\" $matrixSize $nrEV $blockSize \" || { chmod u+rwX -R . ; exit 1 ; } " >> ./run_${CLUSTER}_1node.sh
    echo " " >> ./run_${CLUSTER}_1node.sh
Andreas Marek's avatar
Andreas Marek committed
130
    echo "#copy everything back from /tmp/elpa to runner directory" >> ./run_${CLUSTER}_1node.sh
Andreas Marek's avatar
Andreas Marek committed
131
    echo "cp -r * \$runner_path" >> ./run_${CLUSTER}_1node.sh
Andreas Marek's avatar
Andreas Marek committed
132

133 134 135 136 137 138 139 140 141 142 143 144
    echo " "
    echo "Job script for the run"
    cat ./run_${CLUSTER}_1node.sh
    echo " "
    echo "Submitting to SLURM"
    sbatch -W ./run_${CLUSTER}_1node.sh
    exitCode=$?

    echo " "
    echo "Exit Code of sbatch: $exitCode"
    echo " "
    cat ./ELPA_CI.out.*
145 146
    #if [ $exitCode -ne 0 ]
    #then
147
      cat ./ELPA_CI.err.*
148
    #fi
Andreas Marek's avatar
Andreas Marek committed
149 150 151 152
    if [ -f ./test-suite.log ]
    then
      cat ./test-suite.log
    fi
153 154 155

  fi

156 157
  #if [ $exitCode -ne 0 ]
  #then
158
    cat ./test-suite.log
159
  #fi
160 161 162 163

  exit $exitCode

fi