#!/bin/bash
export OFFLOAD_REPORT=1
export MIC_ENV_PREFIX=MIC
export MIC_OMP_NUM_THREADS=240
#export MIC_KMP_AFFINITY=scatter

export NPROCS=`wc -l $PBS_NODEFILE |gawk '//{print $1}'`
export NNODES=$((NPROCS/20))
export NMICS=$((NNODES*2))

if [ -f nodefile ]; then
  rm nodefile
fi
touch nodefile

for node in `cat $PBS_NODEFILE | uniq`
do 
  echo $node >> nodefile
  echo $node >> nodefile
done

mpiexec.hydra -n $NMICS -machinefile nodefile ./pi_hybrid.off

