Last active
May 4, 2018 19:55
-
-
Save ravi9/93f9c85485873b410dfac782e970c488 to your computer and use it in GitHub Desktop.
Quick benchmarking resnet50 with MKL and without MKL on TF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Quick benchmarking resnet50 with MKL and NO MKL on TF | |
#Following are steps: | |
# Create MKL virtual envirnoment | |
# pip install a TF1.8 MKL Wheel | |
# git clone TF_CNN benchmarks. | |
# run resnet50 inference benchmark. | |
# | |
# Create NO-MKL virtual envirnoment | |
# pip install a TF1.8 Wheel this will install eigen based TF | |
# git clone TF_CNN benchmarks. | |
# run resnet50 inference benchmark. | |
# | |
#Install virtualenv | |
pip install virtualenv | |
### | |
# Create a MKL virtual env | |
### | |
cd ~ | |
virtualenv --python=/usr/bin/python2.7 tfcnnbench_mkl | |
source tfcnnbench_mkl/bin/activate | |
cd tfcnnbench_mkl/ | |
#Install TF 1.8 MKL wheel. | |
wget https://www.dropbox.com/s/fd5y2681vvlwejl/tensorflow-1.8.0rc1-cp27-cp27mu-linux_x86_64.whl | |
pip install tensorflow-1.8.0rc1-cp27-cp27mu-linux_x86_64.whl | |
# Clone benchmark scripts | |
git clone https://github.com/tensorflow/benchmarks.git | |
cd benchmarks/scripts/tf_cnn_benchmarks/ | |
# Assign num_cores to the number of physical cores on your machine | |
num_cores=36 | |
# Set environment variables | |
export KMP_AFFINITY=granularity=fine,verbose,compact,1,0 | |
export KMP_BLOCKTIME=1 | |
export KMP_SETTINGS=1 | |
export OMP_NUM_THREADS=$num_cores | |
export OMP_PROC_BIND=true | |
#networks=( alexnet googlenet inception3 resnet50 resnet152 vgg16 ) | |
network=resnet50 | |
# Run Inference benchmark, please note the data format is NCHW is optimized for MKL | |
python tf_cnn_benchmarks.py --data_format NCHW --model $network --batch_size 32 --num_batches 30 \ | |
--num_intra_threads $num_cores --num_inter_threads 1 --forward_only=True | |
deactivate | |
### | |
# Create a NO-MKL virtual env | |
### | |
cd ~ | |
virtualenv --python=/usr/bin/python2.7 tfcnnbench_no_mkl | |
source tfcnnbench_no_mkl/bin/activate | |
cd tfcnnbench_no_mkl/ | |
# Clone benchmark scripts | |
git clone https://github.com/tensorflow/benchmarks.git | |
cd benchmarks/scripts/tf_cnn_benchmarks/ | |
# Assign num_cores to the number of physical cores on your machine | |
num_cores=36 | |
# Set environment variables | |
export KMP_AFFINITY=granularity=fine,verbose,compact,1,0 | |
export KMP_BLOCKTIME=1 | |
export KMP_SETTINGS=1 | |
export OMP_NUM_THREADS=$num_cores | |
export OMP_PROC_BIND=true | |
#networks=( alexnet googlenet inception3 resnet50 resnet152 vgg16 ) | |
network=resnet50 | |
# Run Inference benchmark, please note the data format is NHWC | |
python tf_cnn_benchmarks.py --data_format NHWC --model $network --batch_size 32 --num_batches 30 \ | |
--num_intra_threads $num_cores --num_inter_threads 1 --forward_only=True | |
deactivate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment