# in root directory of MNN
mkdir build
cd build
cmake .. && make -j4
then execute the commmand:
./benchmark.out models_folder [loop_count] [forwardtype]
forwardtype is in these options: 0->CPU,1->Metal,3->OpenCL,6->OpenGL,7->Vulkan. Here are benchmark models: models.
You can directly execute the script bench_android.sh
in the benchmark directory. It builds in armeabi-v7a architecture by default, and in arm64-v8a architecture if builds with parameter of arm64-v8a. BenchmarkModels will be pushed to your device if executed with parameter of -p.
benchmark.txt
will be generated in benchmark directory after the execution.
- Prepare models with running the script
get_model.sh
in the tools/scropt; - Open demo project in demo/iOS and run with
Benchmark
button at right-top edge, you can switch model, forward type and thread number for banchmark with bottom toolbar.
Build Flags: ABI=arm64-v8a OpenMP=ON Vulkan=ON OpenCL=ON
MNN benchmark
Forward type: **CPU**
Warming up...
--------> Benchmarking... loop = 10
[ - ] vgg16.mnn max = 499.545ms min = 410.570ms avg = 445.868ms
[ - ] SqueezeNetV1.0.mnn max = 49.437ms min = 38.759ms avg = 43.901ms
[ - ] MobileNetV2_224.mnn max = 26.139ms min = 20.400ms avg = 24.489ms
[ - ] inception-v3.mnn max = 413.265ms min = 262.142ms avg = 306.542ms
[ - ] resnet-v2-50.mnn max = 240.009ms min = 152.649ms avg = 176.075ms
[ - ] mobilenet-v1-1.0.mnn max = 89.461ms min = 29.903ms avg = 41.547ms
MNN benchmark
Forward type: **Vulkan**
Warming up...
--------> Benchmarking... loop = 10
[ - ] vgg16.mnn max = 293.156ms min = 227.952ms avg = 240.050ms
[ - ] SqueezeNetV1.0.mnn max = 47.752ms min = 31.191ms avg = 37.727ms
[ - ] MobileNetV2_224.mnn max = 61.352ms min = 35.874ms avg = 46.321ms
[ - ] inception-v3.mnn max = 396.939ms min = 180.353ms avg = 349.952ms
[ - ] resnet-v2-50.mnn max = 214.694ms min = 100.377ms avg = 169.003ms
[ - ] mobilenet-v1-1.0.mnn max = 45.946ms min = 23.257ms avg = 33.217ms
Hardware : Qualcomm Technologies, Inc SDM636
Build Flags: ABI=arm64-v8a OpenMP=ON Vulkan=ON OpenCL=ON
MNN benchmark
Forward type: **CPU**
Warming up...
--------> Benchmarking... loop = 10
[ - ] vgg16.mnn max = 1311.661ms min = 1248.531ms avg = 1255.455ms
[ - ] SqueezeNetV1.0.mnn max = 151.955ms min = 95.348ms avg = 101.986ms
[ - ] MobileNetV2_224.mnn max = 94.336ms min = 50.987ms avg = 58.299ms
[ - ] inception-v3.mnn max = 763.095ms min = 690.005ms avg = 698.674ms
[ - ] resnet-v2-50.mnn max = 453.710ms min = 389.649ms avg = 396.409ms
[ - ] mobilenet-v1-1.0.mnn max = 128.781ms min = 77.023ms avg = 83.134ms
MNN benchmark
Forward type: **Vulkan**
Warming up...
--------> Benchmarking... loop = 10
[ - ] vgg16.mnn max = 783.093ms min = 730.928ms avg = 736.894ms
[ - ] SqueezeNetV1.0.mnn max = 96.435ms min = 61.809ms avg = 65.574ms
[ - ] MobileNetV2_224.mnn max = 71.107ms min = 43.912ms avg = 46.925ms
[ - ] inception-v3.mnn max = 436.363ms min = 386.338ms avg = 391.818ms
[ - ] resnet-v2-50.mnn max = 303.728ms min = 262.706ms avg = 267.613ms
[ - ] mobilenet-v1-1.0.mnn max = 89.119ms min = 56.216ms avg = 59.725ms