Last active
May 15, 2020 22:17
-
-
Save ChaiBapchya/5f2342f75ddeb1e21f14acac665c76ad to your computer and use it in GitHub Desktop.
Script for benchmarking dot,batch_dot and fully_connected with OpPerf
This file contains 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
import mxnet as mx | |
from mxnet import nd | |
from benchmark.opperf.utils.benchmark_utils import run_performance_test | |
import os | |
#export MKL_VERBOSE=1 | |
#export MKLDNN_VERBOSE=1 | |
os.environ["MKL_VERBOSE"]=1 | |
os.environ["MKLDNN_VERBOSE"]=1 | |
os.environ["OMP_NUM_THREADS"]="4" | |
#print version | |
print(mx.__version__) | |
#print env vars | |
from mxnet.runtime import feature_list | |
print(feature_list()) | |
#dot_batch = run_performance_test([nd.dot,nd.batch_dot],run_backward=False, ctx=mx.cpu(), inputs=[{"lhs":(4, 512, 512),"rhs":(4, 512, 512),"transpose_b":True},{"lhs":(5, 512, 512),"rhs":(5, 512, 512),"transpose_b":True},{"lhs":(5, 512, 1536),"rhs":(5, 512, 1536),"transpose_b":True},{"lhs":(5, 512, 2048),"rhs":(5, 512, 2048),"transpose_b":True},{"lhs":(5, 2048, 512),"rhs":(5, 2048, 512),"transpose_b":True}]) | |
#print(dot_batch) | |
fc = run_performance_test(nd.FullyConnected,run_backward=False, ctx=mx.cpu(), inputs=[{"data":(4, 512),"weight":(512,512),"no_bias":True,"num_hidden":512},{"data":(5, 512),"weight":(512,512),"no_bias":True,"num_hidden":512},{"data":(5, 512),"weight":(1536,512),"no_bias":True,"num_hidden":1536},{"data":(5, 512),"weight":(2048,512),"no_bias":True,"num_hidden":2048},{"data":(5, 2048),"weight":(512,2048),"no_bias":True,"num_hidden":512}]) | |
print(fc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment