summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>2019-04-11 01:23:37 (GMT)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>2019-04-11 01:23:37 (GMT)
commit2fcafe61cac6109274437248cad09974d97041c4 (patch)
tree1a00e651524b2802311373faa95a974d34656141
parentea76b6388a44fa8943384d8d6e93042aebd28d95 (diff)
downloadnnfw-2fcafe61cac6109274437248cad09974d97041c4.zip
nnfw-2fcafe61cac6109274437248cad09974d97041c4.tar.gz
nnfw-2fcafe61cac6109274437248cad09974d97041c4.tar.bz2
[ubun] Introduce Softmax microbenchmark (#4974)
With this commit, ubun now includes a Softmax microbenchmark based on cker library. Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
-rw-r--r--contrib/uben/CMakeLists.txt5
-rw-r--r--contrib/uben/Softmax.cpp54
2 files changed, 59 insertions, 0 deletions
diff --git a/contrib/uben/CMakeLists.txt b/contrib/uben/CMakeLists.txt
index 2cc3b15..747398a 100644
--- a/contrib/uben/CMakeLists.txt
+++ b/contrib/uben/CMakeLists.txt
@@ -22,3 +22,8 @@ target_compile_definitions(uben_conv_3x3 PRIVATE CL_WINOGRAD_CONVOLUTION=1)
target_link_libraries(uben_conv_3x3 PRIVATE nonius)
target_link_libraries(uben_conv_3x3 PRIVATE arm_compute)
target_link_libraries(uben_conv_3x3 PRIVATE pthread)
+
+add_executable(uben_softmax Softmax.cpp)
+target_link_libraries(uben_softmax PRIVATE nonius)
+target_link_libraries(uben_softmax PRIVATE nnfw_lib_cker)
+target_link_libraries(uben_softmax PRIVATE pthread)
diff --git a/contrib/uben/Softmax.cpp b/contrib/uben/Softmax.cpp
new file mode 100644
index 0000000..1c4a6b1
--- /dev/null
+++ b/contrib/uben/Softmax.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file Softmax benchmark
+ */
+
+#define NONIUS_RUNNER
+#include <nonius/nonius_single.h++>
+
+#include <cker/operation/SoftMax.h>
+
+#include <vector>
+
+//
+// Parameters
+//
+NONIUS_PARAM(LEN, 1000);
+
+//
+// Implementations
+//
+NONIUS_BENCHMARK("cker::Softmax(float)", [](nonius::chronometer meter) {
+ auto len = meter.param<LEN>();
+
+ nnfw::cker::SoftmaxParams params;
+ nnfw::cker::Shape shape{1, len};
+
+ params.beta = 1.0;
+
+ std::vector<float> input;
+ std::vector<float> output;
+
+ input.resize(len);
+ output.resize(len);
+
+ meter.measure([&](int) {
+ // Run!
+ nnfw::cker::Softmax(params, shape, input.data(), shape, output.data());
+ });
+})