Last active
September 23, 2018 20:09
-
-
Save tonyreina/37e4e5d49a25cb082b551bdc369b1503 to your computer and use it in GitHub Desktop.
TF CNN Benchmarking Scripts
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
#!/bin/bash | |
#sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' | |
date > start_benchmark.txt | |
# Get number of sockets (set interthread to num sockets) | |
inter=`grep -i "physical id" /proc/cpuinfo | sort -u | wc -l` | |
# Get number of physical cores (set intra to num physical cores) | |
num_cores=`grep -c ^processor /proc/cpuinfo` # Get number of cores | |
for network in googlenet inception3 resnet50 resnet152 vgg16 ; do | |
for bz in 1; do | |
echo -e "\n\n #### Starting $network and BZ=$bz ####\n\n" | |
time python tf_cnn_benchmarks.py --device=cpu --forward_only --data_format NHWC \ | |
--mkl --kmp_blocktime 1 --kmp_affinity 'granularity=fine,compact,1,0' \ | |
--model $network --batch_size $bz --num_intra_threads 4 \ | |
--num_inter_threads 2 \ | |
--num_batches 100 2>&1 | tee net_${network}_bz_${bz}_numcores_${num_cores}.log | |
echo -e "#### Finished $network and BZ=$bz ####" | |
done | |
for bz in 32 64 96 128; do | |
echo -e "\n\n #### Starting $network and BZ=$bz ####\n\n" | |
time python tf_cnn_benchmarks.py --device=cpu --forward_only --data_format NHWC \ | |
--mkl --kmp_blocktime 0 --kmp_affinity 'granularity=fine,compact,1,0' \ | |
--model $network --batch_size $bz --num_intra_threads $num_cores \ | |
--num_inter_threads $inter \ | |
--num_batches 100 2>&1 | tee net_${network}_bz_${bz}_numcores_${num_cores}.log | |
echo -e "#### Finished $network and BZ=$bz ####" | |
done | |
done | |
date > stop_benchmark.txt | |
#Prints FPS from from the logs emitted from tf_cnn_bench_6nets scripts. | |
#Usage: ./print_fps_tf_cnn_bench_6nets.sh 96 | |
echo -e "\n Net BZ FPS \n" | |
for network in googlenet inception3 resnet50 resnet152 vgg16 ; do | |
for bz in 1 32 64 96 128; do | |
fps=$(grep "total images/sec:" net_${network}_bz_${bz}_numcores_${num_cores}.log | cut -d ":" -f2 | xargs) | |
echo "$network $bz $fps" | |
done | |
echo -e "\n" | |
done | |
echo Benchmark started at: `cat start_benchmark.txt` | |
echo Benchmark finished at: `cat stop_benchmark.txt` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment