From 3b5981ce898569aafa98abdf220c73f1a80685b9 Mon Sep 17 00:00:00 2001 From: SiCongLi Date: Fri, 12 Mar 2021 12:31:17 +0000 Subject: Implement Fanout mode in CPPScheduler This new scheduler mode is implemented to reduce runtime overhead on high thread counts by distributing the scheduling work to all threads. The fanout mode should only be enabled on high thread counts (e.g. > 8 threads). Alternatively the mode can be forced by setting the environment variable ARM_COMPUTE_CPP_SCHEDULER_MODE to be either "linear" (default) or "fanout". Note that on bare-metal this functionality is turned off but it does not matter as only multi-threading is not supported on bare-metal. Resolves COMPMID-4349 Signed-off-by: SiCongLi Change-Id: I46e2fab83ea24e616c82ae94dca7b2e72a73c7b8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5352 Reviewed-by: Michele Di Giorgio Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- arm_compute/core/utils/misc/Utility.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'arm_compute/core/utils') diff --git a/arm_compute/core/utils/misc/Utility.h b/arm_compute/core/utils/misc/Utility.h index 646d66567a..648758ca07 100644 --- a/arm_compute/core/utils/misc/Utility.h +++ b/arm_compute/core/utils/misc/Utility.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,6 +24,8 @@ #ifndef ARM_COMPUTE_MISC_UTILITY_H #define ARM_COMPUTE_MISC_UTILITY_H +#include "arm_compute/core/Error.h" + #include #include #include @@ -208,6 +210,25 @@ inline std::string tolower(std::string string) }); return string; } + +/** Get environment variable as a string + * + * @note Return empty string on bare-metal + * + * @param[in] env_name Name of the Environment variable to retrieve + * + * @return Environment variable content, or empty string if the variable is undefined or on bare-metal + */ +inline std::string getenv(const std::string &env_name) +{ +#ifdef BARE_METAL + ARM_COMPUTE_UNUSED(env_name); + return std::string{}; +#else // BARE_METAL + const auto env_chr = std::getenv(env_name.c_str()); + return env_chr == nullptr ? std::string{} : std::string{ env_chr }; +#endif // BARE_METAL +} } // namespace utility } // namespace arm_compute #endif /* ARM_COMPUTE_MISC_UTILITY_H */ -- cgit v1.2.1