Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 ARM Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "Globals.h" |
| 25 | #include "NEON/Helper.h" |
| 26 | #include "NEON/NEAccessor.h" |
| 27 | #include "TensorLibrary.h" |
| 28 | #include "benchmark/Datasets.h" |
| 29 | #include "benchmark/Profiler.h" |
| 30 | #include "benchmark/WallClockTimer.h" |
| 31 | |
| 32 | #include "arm_compute/core/Helpers.h" |
| 33 | #include "arm_compute/core/Types.h" |
| 34 | #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" |
| 35 | #include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" |
| 36 | #include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" |
| 37 | #include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" |
| 38 | #include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" |
| 39 | #include "arm_compute/runtime/Tensor.h" |
| 40 | #include "arm_compute/runtime/TensorAllocator.h" |
| 41 | |
| 42 | #include "benchmark/benchmark_api.h" |
| 43 | |
| 44 | using namespace arm_compute; |
| 45 | using namespace arm_compute::test; |
| 46 | using namespace arm_compute::test::benchmark; |
| 47 | using namespace arm_compute::test::neon; |
| 48 | |
| 49 | #include "benchmark/system_tests/common/LeNet5.h" |
| 50 | |
| 51 | namespace |
| 52 | { |
| 53 | using LeNet5SystemTest = LeNet5Fixture<Tensor, |
| 54 | NEAccessor, |
| 55 | NEActivationLayer, |
| 56 | NEConvolutionLayer, |
| 57 | NEFullyConnectedLayer, |
| 58 | NEPoolingLayer, |
| 59 | NESoftmaxLayer>; |
| 60 | } // namespace |
| 61 | |
| 62 | BENCHMARK_DEFINE_F(LeNet5SystemTest, neon_lenet5) |
| 63 | (::benchmark::State &state) |
| 64 | { |
| 65 | while(state.KeepRunning()) |
| 66 | { |
| 67 | // Run LeNet5 |
| 68 | profiler.start(); |
| 69 | network.run(); |
| 70 | profiler.stop(); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | BENCHMARK_REGISTER_F(LeNet5SystemTest, neon_lenet5) |
| 75 | ->Threads(1) |
| 76 | ->Iterations(10) |
| 77 | ->ArgName("batch_size") |
| 78 | ->Arg(1) |
| 79 | ->Arg(16) |
| 80 | ->Arg(32); |