blob: 21904899c017671f5f4f7eff71813652e418f5b0 [file] [log] [blame]
Michalis Spyroua8caa022022-05-18 17:43:39 +01001#!/usr/bin/python
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +00002# -*- coding: utf-8 -*-
3
Nathan John Sircombed7113e42023-04-26 15:02:43 +01004# Copyright (c) 2017-2023 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01005#
6# SPDX-License-Identifier: MIT
7#
8# Permission is hereby granted, free of charge, to any person obtaining a copy
9# of this software and associated documentation files (the "Software"), to
10# deal in the Software without restriction, including without limitation the
11# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12# sell copies of the Software, and to permit persons to whom the Software is
13# furnished to do so, subject to the following conditions:
14#
15# The above copyright notice and this permission notice shall be included in all
16# copies or substantial portions of the Software.
17#
18# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24# SOFTWARE.
Anthony Barbier6ff3b192017-09-04 18:44:23 +010025import os.path
26
27Import('env')
28Import('vars')
Anthony Barbier01bbd5f2018-11-01 15:10:51 +000029Import('install_bin')
Anthony Barbier6ff3b192017-09-04 18:44:23 +010030
31# vars is imported from arm_compute:
32variables = [
Michele Di Giorgiof9a611a2021-03-12 11:22:55 +000033 BoolVariable("benchmark_examples", "Build benchmark examples programs", False),
34 BoolVariable("validate_examples", "Build validate examples programs", False),
Michalis Spyroud1d77222020-04-08 14:10:15 +010035 BoolVariable("reference_openmp", "Build reference validation with openmp", True),
Michele Di Giorgiof9a611a2021-03-12 11:22:55 +000036 BoolVariable("validation_tests", "Build validation test programs", False),
37 BoolVariable("benchmark_tests", "Build benchmark test programs", False),
Pablo Telloea1c9502017-11-09 11:49:18 +000038 ("test_filter", "Pattern to specify the tests' filenames to be compiled", "*.cpp")
Anthony Barbier6ff3b192017-09-04 18:44:23 +010039]
40
41# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice)
42new_options = Variables('scons')
43
44for v in variables:
45 new_options.Add(v)
46 vars.Add(v)
47
48# Clone the environment to make sure we're not polluting the arm_compute one:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +010049test_env = env.Clone()
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010050vars.Update(test_env)
51
52Help(new_options.GenerateHelpText(test_env))
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010053
Georgios Pinitas6a342642020-01-28 15:54:20 +000054# Check if we need to build the test framework
55build_test_framework = False
56for opt in new_options.keys():
57 option_value = test_env[opt]
58 if type(option_value) is bool and option_value:
59 build_test_framework = True
60 break
61
62if not build_test_framework:
63 Return()
64else:
65 SConscript('./framework/SConscript', duplicate=0)
66
Anthony Barbier6db0ff52018-01-05 10:59:12 +000067Import("arm_compute_test_framework")
68test_env.Append(LIBS = arm_compute_test_framework)
69
Georgios Pinitas6a342642020-01-28 15:54:20 +000070# Disable floating-point expression contraction (e.g. fused multiply-add operations)
Pablo Tello29cab362022-03-10 17:05:34 +000071if not 'windows' in env['os']:
72 test_env.Append(CXXFLAGS = ['-ffp-contract=off'])
Georgios Pinitas6a342642020-01-28 15:54:20 +000073
Georgios Pinitasf8d8f3a2018-06-06 17:57:04 +010074# Remove -Wnoexcept from tests
75if 'g++' in test_env['CXX'] and '-Wnoexcept' in test_env['CXXFLAGS']:
76 test_env['CXXFLAGS'].remove("-Wnoexcept")
77
Georgios Pinitas45514032020-12-30 00:03:09 +000078load_whole_archive = '-Wl,--whole-archive'
79noload_whole_archive = '-Wl,--no-whole-archive'
80if 'macos' in test_env['os']:
81 load_whole_archive = '-Wl,-force_load'
Jakub Sujakebce2802023-09-29 11:11:59 +010082 noload_whole_archive = ''
Georgios Pinitas45514032020-12-30 00:03:09 +000083
84if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010085 Import("arm_compute_a")
Anthony Barbierb2881fc2017-09-29 17:12:12 +010086 Import("arm_compute_core_a")
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010087 Import("arm_compute_graph_a")
Pablo Tello29cab362022-03-10 17:05:34 +000088 if env['os']=='windows':
89 test_env.Append(LIBS = [arm_compute_graph_a, arm_compute_a])
90 else:
91 test_env.Append(LIBS = [arm_compute_graph_a, arm_compute_a, arm_compute_core_a])
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010092 arm_compute_lib = arm_compute_graph_a
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010093else:
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010094 Import("arm_compute_graph_so")
Anthony Barbier2df1f992018-07-11 13:37:23 +010095 Import("arm_compute_core_a")
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010096 test_env.Append(LIBS = ["arm_compute_graph", "arm_compute", "arm_compute_core"])
97 arm_compute_lib = arm_compute_graph_so
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010098
Michalis Spyrou748a7c82019-10-07 13:00:44 +010099if env['os'] in ['bare_metal']:
100 Import("bootcode_o")
101
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000102if env['external_tests_dir']:
103 test_env.Append(CPPPATH = [env['external_tests_dir'] + "/include"])
104 test_env.Append(LIBPATH = [env['external_tests_dir'] + "/%s/%s" % (env['os'], env['arch'])])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100105
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100106common_files = Glob('*.cpp')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100107common_objects = [test_env.StaticObject(f) for f in common_files]
108
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100109files_benchmark = Glob('benchmark/*.cpp')
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000110if env['external_tests_dir']:
111 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100112
Abe Mbise925ca0f2017-10-02 19:16:33 +0100113# Add unit tests
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000114files_validation = Glob('validation/UNIT/*/*.cpp')
Abe Mbise925ca0f2017-10-02 19:16:33 +0100115files_validation += Glob('validation/UNIT/*.cpp')
116
Georgios Pinitas8795ffb2017-12-01 16:13:40 +0000117# Add CPP tests
118filter_pattern = test_env['test_filter']
119files_validation += Glob('validation/CPP/' + filter_pattern)
120
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100121if env['opencl']:
Giorgio Arena892b70a2022-03-30 12:23:10 +0100122 if env['experimental_dynamic_fusion']:
SiCong Lif44bbc52022-08-29 18:25:51 +0100123 files_validation += Glob('validation/dynamic_fusion/gpu/' + filter_pattern)
Ramy Elgammal73f19af2022-10-23 11:44:49 +0100124 files_validation += Glob('validation/dynamic_fusion/gpu/cl/' + filter_pattern)
Giorgio Arena232c4522022-03-03 10:09:01 +0000125
Pablo Telloea1c9502017-11-09 11:49:18 +0000126 filter_pattern = test_env['test_filter']
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100127
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100128 test_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100129
Pablo Telloea1c9502017-11-09 11:49:18 +0000130 files_benchmark += Glob('benchmark/CL/*/' + filter_pattern)
131 files_benchmark += Glob('benchmark/CL/' + filter_pattern)
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000132 if env['external_tests_dir']:
133 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/CL/' + filter_pattern)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100134
Pablo Telloea1c9502017-11-09 11:49:18 +0000135 files_validation += Glob('validation/CL/*/' + filter_pattern)
136 files_validation += Glob('validation/CL/' + filter_pattern)
Giorgio Arena892b70a2022-03-30 12:23:10 +0100137
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000138 if env['external_tests_dir']:
139 files_validation += Glob(env['external_tests_dir'] + '/tests/validation/CL/' + filter_pattern)
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000140 files_validation += Glob('validation/gpu/unit/*.cpp')
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100141
142if env['neon']:
Pablo Telloea1c9502017-11-09 11:49:18 +0000143 filter_pattern = test_env['test_filter']
144 files_benchmark += Glob('benchmark/NEON/*/' + filter_pattern)
145 files_benchmark += Glob('benchmark/NEON/' + filter_pattern)
Georgios Pinitas7891a732021-08-20 21:39:25 +0100146 test_env.Append(CPPPATH = ["#/src/cpu/kernels/assembly/"])
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000147 if env['external_tests_dir']:
148 files_benchmark += Glob(env['external_tests_dir'] + '/tests/benchmark/NEON/' + filter_pattern)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100149
Pablo Telloea1c9502017-11-09 11:49:18 +0000150 files_validation += Glob('validation/NEON/' + filter_pattern)
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100151 if env['os'] == 'bare_metal':
152 files_validation += Glob('validation/NEON/UNIT/MemoryManager.cpp' + filter_pattern)
153 files_validation += Glob('validation/NEON/UNIT/DynamicTensor.cpp' + filter_pattern)
154 files_validation += Glob('validation/NEON/UNIT/TensorAllocator.cpp' + filter_pattern)
155 else:
156 files_validation += Glob('validation/NEON/*/' + filter_pattern)
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000157 if env['external_tests_dir']:
158 files_validation += Glob(env['external_tests_dir'] + '/tests/validation/NEON/' + filter_pattern)
Georgios Pinitas8a5146f2021-01-12 15:51:07 +0000159 files_validation += Glob('validation/cpu/unit/*.cpp')
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100160
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000161extra_link_flags = []
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100162if env['os'] == 'android':
163 test_env.Append(LIBS = ["log"])
Pablo Tello29cab362022-03-10 17:05:34 +0000164elif env['os'] not in ['windows','bare_metal', 'macos']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100165 test_env.Append(LIBS = ["rt"])
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000166 extra_link_flags += ['-fstack-protector-strong']
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100167
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100168if test_env['benchmark_tests']:
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100169 arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects)
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000170 arm_compute_benchmark = install_bin(arm_compute_benchmark)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100171 Depends(arm_compute_benchmark, arm_compute_test_framework)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100172 Depends(arm_compute_benchmark, arm_compute_lib)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100173 Default(arm_compute_benchmark)
174 Export('arm_compute_benchmark')
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100175
Michalis Spyrou6a9e8012020-02-07 09:45:55 +0000176bm_link_flags = []
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100177if test_env['linker_script']:
Michalis Spyrou7d303522020-01-07 12:56:01 +0000178 bm_link_flags += ['-Wl,--build-id=none', '-T', env['linker_script']]
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100179
Pablo Tello29cab362022-03-10 17:05:34 +0000180if test_env['reference_openmp'] and env['os'] not in ['bare_metal', 'macos','windows']:
Giorgio Arenab83e6722022-03-24 14:23:07 +0000181 test_env['CXXFLAGS'].append('-fopenmp')
182 test_env['LINKFLAGS'].append('-fopenmp')
183
184 if 'ndk_above_r21' in env:
185 test_env['LINKFLAGS'].append('-static-openmp')
Michalis Spyroud1d77222020-04-08 14:10:15 +0100186
Francesco Petrogalli553f6952022-06-30 10:22:01 +0000187# Testing for fixed format GEMM kernels.
Nathan John Sircombed7113e42023-04-26 15:02:43 +0100188if env['fixed_format_kernels'] and test_env['validation_tests']:
Francesco Petrogalli553f6952022-06-30 10:22:01 +0000189 test_env.Append(CPPDEFINES = ['ARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS'])
190
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100191if test_env['validation_tests']:
Michalis Spyroud1d77222020-04-08 14:10:15 +0100192 arm_compute_validation_framework = env.StaticLibrary('arm_compute_validation_framework', Glob('validation/reference/*.cpp') + Glob('validation/*.cpp'), LINKFLAGS=test_env['LINKFLAGS'], CXXFLAGS=test_env['CXXFLAGS'], LIBS= [ arm_compute_test_framework, arm_compute_core_a])
Anthony Barbier2df1f992018-07-11 13:37:23 +0100193 Depends(arm_compute_validation_framework , arm_compute_test_framework)
194 Depends(arm_compute_validation_framework , arm_compute_core_a)
195
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100196 program_objects = files_validation + common_objects
197 if test_env['os'] == 'bare_metal':
198 Depends(arm_compute_validation_framework , bootcode_o)
199 program_objects += bootcode_o
200
201
202 arm_compute_validation = test_env.Program('arm_compute_validation', program_objects, LIBS=[arm_compute_validation_framework] + test_env['LIBS'], LINKFLAGS=test_env['LINKFLAGS'] + bm_link_flags)
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000203 arm_compute_validation = install_bin(arm_compute_validation)
Anthony Barbier2df1f992018-07-11 13:37:23 +0100204 Depends(arm_compute_validation, arm_compute_validation_framework)
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100205 Depends(arm_compute_validation, arm_compute_test_framework)
206 Depends(arm_compute_validation, arm_compute_lib)
Moritz Pflanzerc7d15032017-07-18 16:21:16 +0100207
Moritz Pflanzera09de0c2017-09-01 20:41:12 +0100208 Default(arm_compute_validation)
209 Export('arm_compute_validation')
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000210
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000211 if test_env['validate_examples']:
Anthony Barbier2df1f992018-07-11 13:37:23 +0100212 files_validate_examples = [ test_env.Object('validate_examples/RunExample.cpp') ] + [ x for x in common_objects if not "main.o" in str(x)]
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100213 if test_env['os'] == 'bare_metal':
214 files_validate_examples += bootcode_o
215
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000216 arm_compute_validate_examples = []
217 if test_env['neon']:
218 for file in Glob("validate_examples/neon_*.cpp"):
219 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100220 arm_compute_validate_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, LIBS = [ arm_compute_validation_framework], LINKFLAGS=test_env['LINKFLAGS'] + bm_link_flags) ]
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000221 if test_env['opencl']:
222 cl_examples = []
223 files = Glob("validate_examples/cl_*.cpp")
224 if test_env['neon']:
225 files += Glob("validate_examples/neoncl_*.cpp")
226 for file in files:
227 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Anthony Barbier2df1f992018-07-11 13:37:23 +0100228 cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ]) ]
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000229 arm_compute_validate_examples += cl_examples
230 if test_env['opencl'] and test_env['neon']:
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000231 graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
232 for file in Glob("validate_examples/graph_*.cpp"):
233 example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
Georgios Pinitas45514032020-12-30 00:03:09 +0000234 if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
235 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + [ arm_compute_validation_framework ], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags)
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000236 arm_compute_validate_examples += [ prog ]
237 else:
238 #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
Anthony Barbier2df1f992018-07-11 13:37:23 +0100239 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph", arm_compute_validation_framework], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000240 arm_compute_validate_examples += [ prog ]
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000241 arm_compute_validate_examples = install_bin(arm_compute_validate_examples)
Anthony Barbier2df1f992018-07-11 13:37:23 +0100242 Depends(arm_compute_validate_examples, arm_compute_validation_framework)
Anthony Barbier979dc4f2018-03-07 09:27:48 +0000243 Depends(arm_compute_validate_examples, arm_compute_test_framework)
244 Depends(arm_compute_validate_examples, arm_compute_lib)
245 Default(arm_compute_validate_examples)
246 Export('arm_compute_validate_examples')
247
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000248if test_env['benchmark_examples']:
249 files_benchmark_examples = test_env.Object('benchmark_examples/RunExample.cpp')
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100250 if test_env['os'] == 'bare_metal':
251 files_benchmark_examples += bootcode_o
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100252 graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100253 graph_params = test_env.Object(source="../utils/CommonGraphOptions.cpp", target="CommonGraphOptions")
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100254 arm_compute_benchmark_examples = []
Michele Di Giorgio72610dc2020-11-18 15:29:08 +0000255 all_examples_folders = ["../examples"]
256 if env['external_tests_dir']:
257 all_examples_folders.append(env['external_tests_dir'] + "/examples")
258 for examples_folder in all_examples_folders:
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100259 if test_env['neon']:
260 for file in Glob("%s/neon_*.cpp" % examples_folder):
261 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100262 arm_compute_benchmark_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, LINKFLAGS=test_env["LINKFLAGS"]+ bm_link_flags) ]
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100263 if test_env['opencl']:
264 cl_examples = []
265 files = Glob("%s/cl_*.cpp" % examples_folder)
266 if test_env['neon']:
267 files += Glob("%s/neoncl_*.cpp" % examples_folder)
268 for file in files:
269 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
270 cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, LIBS = test_env["LIBS"]) ]
271 arm_compute_benchmark_examples += cl_examples
272
SiCong Li8b4c7302019-09-19 12:18:15 +0100273 if test_env['gemm_tuner'] and test_env['opencl']:
274 gemm_tuner_examples = []
SiCong Li240b79d2019-09-24 15:50:34 +0100275 gemm_tuner_common_options = test_env.Object(source="../examples/gemm_tuner/CommonGemmExampleOptions.cpp", target="CommonGemmExampleOptions")
SiCong Li8b4c7302019-09-19 12:18:15 +0100276 files = Glob("%s/gemm_tuner/cl_*.cpp" % examples_folder)
277 for file in files:
278 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
279 example = os.path.join("gemm_tuner", example)
SiCong Li240b79d2019-09-24 15:50:34 +0100280 gemm_tuner_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example), gemm_tuner_common_options ] + files_benchmark_examples, LIBS = test_env["LIBS"]) ]
SiCong Li8b4c7302019-09-19 12:18:15 +0100281 arm_compute_benchmark_examples += gemm_tuner_examples
282
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100283 # Graph examples
284 for file in Glob("%s/graph_*.cpp" % examples_folder ):
285 example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
Georgios Pinitas45514032020-12-30 00:03:09 +0000286 if env['os'] in ['android', 'macos', 'bare_metal'] or env['standalone']:
287 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+[load_whole_archive, arm_compute_lib, noload_whole_archive] + bm_link_flags + extra_link_flags)
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100288 arm_compute_benchmark_examples += [ prog ]
289 else:
290 #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
Michalis Spyrou748a7c82019-10-07 13:00:44 +0100291 prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils, graph_params]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'])
Anthony Barbier3b6cdbb2018-09-14 11:58:05 +0100292 arm_compute_benchmark_examples += [ prog ]
SiCong Lib63b1192022-01-28 18:24:39 +0000293
Anthony Barbier01bbd5f2018-11-01 15:10:51 +0000294 arm_compute_benchmark_examples = install_bin(arm_compute_benchmark_examples)
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000295 Depends(arm_compute_benchmark_examples, arm_compute_test_framework)
296 Depends(arm_compute_benchmark_examples, arm_compute_lib)
297 Default(arm_compute_benchmark_examples)
Pablo Tello29cab362022-03-10 17:05:34 +0000298 Export('arm_compute_benchmark_examples')