Skip to content

Commit

Permalink
Refine python autotests (intel#1839)
Browse files Browse the repository at this point in the history
* update scripts

* update
  • Loading branch information
hkvision authored Dec 12, 2019
1 parent 0e87e1f commit 40d2cac
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 63 deletions.
71 changes: 39 additions & 32 deletions pyzoo/zoo/examples/run-example-tests-pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ clear_up () {
pip uninstall -y pyspark
}

echo "start example test for textclassification"
echo "#1 start example test for textclassification"
start=$(date "+%s")

# Data preparation
Expand Down Expand Up @@ -43,9 +43,8 @@ fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time1=$((now-start))
echo "textclassification time used:$time1 seconds"

echo "start example test for image-classification"
echo "#2 start example test for image-classification"
#timer
start=$(date "+%s")
echo "check if model directory exists"
Expand Down Expand Up @@ -76,9 +75,8 @@ fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time2=$((now-start))
echo "imageclassification time used:$time2 seconds"

echo "start example test for autograd"
echo "#3 start example test for autograd"
#timer
start=$(date "+%s")

Expand All @@ -104,9 +102,8 @@ fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time3=$((now-start))
echo "autograd time used:$time3 seconds"

echo "start example test for objectdetection"
echo "#4 start example test for objectdetection"
#timer
start=$(date "+%s")

Expand Down Expand Up @@ -134,9 +131,8 @@ fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time4=$((now-start))
echo "objectdetection time used:$time4 seconds"

echo "start example test for nnframes"
echo "#5 start example test for nnframes"
#timer
start=$(date "+%s")

Expand Down Expand Up @@ -220,7 +216,7 @@ fi

echo "start example test for nnframes tensorflow SimpleTraining"
export MASTER=local[1]
python ${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/nnframes/tensorflow/SimpleTraining.py
python ${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/nnframes/tensorflow/SimpleTraining.py
exit_status=$?
unset MASTER
if [ $exit_status -ne 0 ];
Expand All @@ -229,8 +225,13 @@ then
echo "nnframes tensorflow SimpleTraining failed"
exit $exit_status
fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time5=$((now-start))

echo "start example test for inceptionv1 training"
echo "#6 start example test for inceptionv1 training"
#timer
start=$(date "+%s")
export MASTER=local[4]
python ${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/inception/inception.py \
--maxIteration 20 \
Expand All @@ -244,7 +245,13 @@ then
echo "inceptionv1 training failed"
exit $exit_status
fi
unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time6=$((now-start))

echo "#7 start example test for pytorch"
#timer
start=$(date "+%s")
echo "start example test for pytorch SimpleTrainingExample"
export MASTER=local[1]
python ${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/pytorch/train/SimpleTrainingExample.py
Expand All @@ -267,7 +274,7 @@ unset SPARK_DRIVER_MEMORY
if [ $exit_status -ne 0 ];
then
clear_up
echo "pytorch mnist training"
echo "pytorch mnist training failed"
exit $exit_status
fi

Expand All @@ -285,16 +292,14 @@ then
echo "pytorch resnet finetune failed"
exit $exit_status
fi

unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time5=$((now-start))
echo "nnframes time used:$time5 seconds"
time7=$((now-start))

echo "start example test for tensorflow tfnet"
echo "#8 start example test for tensorflow"
#timer
start=$(date "+%s")

echo "start example test for tensorflow tfnet"
if [ -f analytics-zoo-models/ssd_mobilenet_v1_coco_2017_11_17.tar.gz ]
then
echo "analytics-zoo-models/bigdl_inception-v1_imagenet_0.4.0.model already exists."
Expand All @@ -317,13 +322,8 @@ then
fi

unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time6=$((now-start))
echo "tensorflow tfnet time used:$time6 seconds"

echo "start example test for tensorflow distributed_training"
#timer
start=$(date "+%s")

if [ -d analytics-zoo-models/model ]
then
Expand Down Expand Up @@ -398,7 +398,7 @@ exit_status=$?
if [ $exit_status -ne 0 ];
then
clear_up
echo "TFPark estimator estimator_dataset failed"
echo "TFPark estimator estimator_dataset failed"
exit $exit_status
fi

Expand All @@ -415,11 +415,9 @@ fi

unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time7=$((now-start))
echo "tensorflow distributed_training time used:$time7 seconds"

time8=$((now-start))

echo "start test for anomalydetection"
echo "#9 start test for anomalydetection"
#timer
start=$(date "+%s")
# prepare data
Expand All @@ -446,11 +444,10 @@ then
exit $exit_status
fi
now=$(date "+%s")
time8=$((now-start))
echo "anomalydetection time used:$time8 seconds"
time9=$((now-start))


echo "start example test for qaranker"
echo "#10 start example test for qaranker"
start=$(date "+%s")

if [ -f analytics-zoo-data/data/glove.6B.zip ]
Expand Down Expand Up @@ -485,8 +482,18 @@ fi

unset SPARK_DRIVER_MEMORY
now=$(date "+%s")
time9=$((now-start))
echo "qaranker time used:$time9 seconds"
time10=$((now-start))

# This should be done at the very end after all tests finish.
clear_up

echo "#1 textclassification time used: $time1 seconds"
echo "#2 imageclassification time used: $time2 seconds"
echo "#3 autograd time used: $time3 seconds"
echo "#4 objectdetection time used: $time4 seconds"
echo "#5 nnframes time used: $time5 seconds"
echo "#6 inceptionV1 training time used: $time6 seconds"
echo "#7 pytorch time used: $time7 seconds"
echo "#8 tensorflow time used: $time8 seconds"
echo "#9 anomalydetection time used: $time9 seconds"
echo "#10 qaranker time used: $time10 seconds"
72 changes: 41 additions & 31 deletions pyzoo/zoo/examples/run-example-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,6 @@ ${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
now=$(date "+%s")
time5=$((now-start))

echo "start example test for inceptionv1 training"
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[4] \
--driver-memory 10g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/inception/inception.py \
--maxIteration 20 \
-b 8 \
-f hdfs://172.168.2.181:9000/imagenet-small

echo "start example test for pytorch SimpleTrainingExample"
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[1] \
--driver-memory 5g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/pytorch/train/SimpleTrainingExample.py

echo "start example test for pytorch mnist training"
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[1] \
--driver-memory 5g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/pytorch/train/Lenet_mnist.py

echo "#6 start example test for tensorflow"
#timer
start=$(date "+%s")
Expand Down Expand Up @@ -368,7 +347,6 @@ ${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \

now=$(date "+%s")
time6=$((now-start))
echo "#6 tensorflow time used:$time6 seconds"

echo "#7 start example test for anomalydetection"
if [ -f analytics-zoo-data/data/NAB/nyc_taxi/nyc_taxi.csv ]
Expand All @@ -393,7 +371,6 @@ ${SPARK_HOME}/bin/spark-submit \
--input_dir analytics-zoo-data/data/NAB/nyc_taxi/nyc_taxi.csv
now=$(date "+%s")
time7=$((now-start))
echo "#7 anomalydetection time used:$time7 seconds"

echo "#8 start example test for qaranker"
#timer
Expand Down Expand Up @@ -429,11 +406,44 @@ ${SPARK_HOME}/bin/spark-submit \

now=$(date "+%s")
time8=$((now-start))
echo "#1 textclassification time used:$time1 seconds"
echo "#2 customized loss and layer time used:$time2 seconds"
echo "#3 image-classification time used:$time3 seconds"
echo "#4 object-detection loss and layer time used:$time4 seconds"
echo "#5 nnframes time used:$time5 seconds"
echo "#6 tensorflow time used:$time6 seconds"
echo "#7 anomalydetection time used:$time7 seconds"
echo "#8 qaranker time used:$time8 seconds"

echo "#9 start example test for inceptionv1 training"
#timer
start=$(date "+%s")
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[4] \
--driver-memory 10g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/inception/inception.py \
--maxIteration 20 \
-b 8 \
-f hdfs://172.168.2.181:9000/imagenet-small
now=$(date "+%s")
time9=$((now-start))

echo "#10 start example test for pytorch"
#timer
start=$(date "+%s")
echo "start example test for pytorch SimpleTrainingExample"
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[1] \
--driver-memory 5g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/pytorch/train/SimpleTrainingExample.py

echo "start example test for pytorch mnist training"
${ANALYTICS_ZOO_HOME}/bin/spark-submit-python-with-zoo.sh \
--master local[1] \
--driver-memory 5g \
${ANALYTICS_ZOO_ROOT}/pyzoo/zoo/examples/pytorch/train/Lenet_mnist.py
now=$(date "+%s")
time10=$((now-start))

echo "#1 textclassification time used: $time1 seconds"
echo "#2 customized loss and layer time used: $time2 seconds"
echo "#3 image-classification time used: $time3 seconds"
echo "#4 object-detection loss and layer time used: $time4 seconds"
echo "#5 nnframes time used: $time5 seconds"
echo "#6 tensorflow time used: $time6 seconds"
echo "#7 anomalydetection time used: $time7 seconds"
echo "#8 qaranker time used: $time8 seconds"
echo "#9 inceptionV1 training time used: $time9 seconds"
echo "#10 pytorch time used: $time10 seconds"

0 comments on commit 40d2cac

Please sign in to comment.