From be06bb9fa5ce27bd7cf6b2064530b036ae062c57 Mon Sep 17 00:00:00 2001 From: Joel Hestness Date: Fri, 23 Nov 2018 11:27:06 -0800 Subject: [PATCH] PPoPP generate_results.sh: Verify Python version 3.6 (#2) --- .../full_models/generate_results.sh | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/catamount/frameworks/example_graphs/tensorflow/full_models/generate_results.sh b/catamount/frameworks/example_graphs/tensorflow/full_models/generate_results.sh index f8bbb8d..7cc8415 100644 --- a/catamount/frameworks/example_graphs/tensorflow/full_models/generate_results.sh +++ b/catamount/frameworks/example_graphs/tensorflow/full_models/generate_results.sh @@ -1,14 +1,36 @@ #!/bin/bash +# Check for correct Python version +pyversion=`python --version 2>&1 | grep -o "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"` +major=`echo $pyversion | sed 's/\..*//'` +minor=`echo $pyversion | sed 's/[0-9]*\.\([0-9]*\)\..*/\1/'` +if [ "$major" != "3" ] || [ "$minor" != "6" ] +then + USEPYTHON=`which python3.6` + if [ ! -e "$USEPYTHON" ] + then + echo "ERROR: Python version $pyversion not supported. Please use Python 3.6" + exit + fi +else + USEPYTHON=`which python` +fi + # Set up virtual environment if [ ! -e "catamount_venv" ] then echo "==== Creating virtual environment ====" - python -m venv catamount_venv + $USEPYTHON -m venv catamount_venv echo "" fi echo "==== Sourcing virtual environment ====" +activatescript="catamount_venv/bin/activate" +if [ ! -e "$activatescript" ] +then + echo "ERROR: Failed to create virtualenv, catamount_venv. Unable to find $activatescript" + exit +fi source catamount_venv/bin/activate export PYTHONPATH=$VIRTUAL_ENV/lib/python3.6/site-packages/ echo "" @@ -18,7 +40,7 @@ pip install -r requirements.txt echo "" echo "==== Installing Catamount ====" -python setup.py install +$USEPYTHON setup.py install echo "" outdir="ppopp_2019_tests" @@ -36,7 +58,7 @@ for depth in 18 34 50 101 152 do outfile="$outdir/output_image_$depth.txt" echo "==== Running Image ResNet$depth. Output to $outfile ====" - CUDA_VISIBLE_DEVICES="" python catamount/tests/full/tf_image_resnet.py --depth $depth >& $outfile + CUDA_VISIBLE_DEVICES="" $USEPYTHON catamount/tests/full/tf_image_resnet.py --depth $depth >& $outfile echo "" done @@ -44,13 +66,13 @@ for domain in charlm nmt wordlm do outfile="$outdir/output_$domain.txt" echo "==== Running Language $domain. Output to $outfile ====" - CUDA_VISIBLE_DEVICES="" python catamount/tests/full/tf_language_models.py --domain $domain >& $outfile + CUDA_VISIBLE_DEVICES="" $USEPYTHON catamount/tests/full/tf_language_models.py --domain $domain >& $outfile echo "" done outfile="$outdir/output_speech.txt" echo "==== Running Speech Attention. Output to $outfile ====" -CUDA_VISIBLE_DEVICES="" python catamount/tests/full/tf_speech_attention.py >& $outfile +CUDA_VISIBLE_DEVICES="" $USEPYTHON catamount/tests/full/tf_speech_attention.py >& $outfile echo ""