run.mkldnn.sh 811 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
set -e

function train() {
  topology=$1
  bs=$2
  thread=1
  if [ $3 ]; then
    thread=$3
  fi
  if [ $thread -eq 1 ]; then
    use_mkldnn=1
    log="logs/${topology}-mkldnn-${bs}.log"
  else
    use_mkldnn=0
    log="logs/${topology}-${thread}mklml-${bs}.log"
  fi
  args="batch_size=${bs}"
  config="${topology}.py"
  paddle train --job=time \
    --config=$config \
    --use_mkldnn=$use_mkldnn \
    --use_gpu=False \
    --trainer_count=$thread \
    --log_period=10 \
    --test_period=100 \
    --config_args=$args \
    2>&1 | tee ${log} 
}

if [ ! -d "train.list" ]; then
  echo " " > train.list
fi
if [ ! -d "logs" ]; then
  mkdir logs
fi

#========= mkldnn =========#
# vgg
train vgg 64 
train vgg 128
train vgg 256

#========== mklml ===========#
train vgg 64 16
train vgg 128 16
train vgg 256 16