Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pytorch/cpuinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Dukhan <maratek@gmail.com>2019-01-13 09:10:32 +0300
committerMarat Dukhan <maratek@gmail.com>2019-01-13 09:10:32 +0300
commit9fa0a0520cb8bedd0fe47168f8479f603dc93ddc (patch)
tree8eaad987213f112cf83c1007baa3501059b3d2ba
parent2d2bfa4ff702a39826f333b36b953b1082aa4162 (diff)
Downgrade sysfs parsing errors to warnings on x86
On x86 we can work around this error by counting processors in /proc/cpuinfo. However, on ARM/ARM64 number of processors reported in /proc/cpuinfo is unreliable, and we we report error if sysfs files failed to parse.
-rw-r--r--src/linux/processors.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/linux/processors.c b/src/linux/processors.c
index 849c6a1..aedba74 100644
--- a/src/linux/processors.c
+++ b/src/linux/processors.c
@@ -227,7 +227,11 @@ static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t
uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count) {
uint32_t max_possible_processor = 0;
if (!cpuinfo_linux_parse_cpulist(POSSIBLE_CPULIST_FILENAME, max_processor_number_parser, &max_possible_processor)) {
- cpuinfo_log_error("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
+ #if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
+ cpuinfo_log_error("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
+ #else
+ cpuinfo_log_warning("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME);
+ #endif
return UINT32_MAX;
}
if (max_possible_processor >= max_processors_count) {
@@ -242,7 +246,11 @@ uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count)
uint32_t cpuinfo_linux_get_max_present_processor(uint32_t max_processors_count) {
uint32_t max_present_processor = 0;
if (!cpuinfo_linux_parse_cpulist(PRESENT_CPULIST_FILENAME, max_processor_number_parser, &max_present_processor)) {
- cpuinfo_log_error("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
+ #if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
+ cpuinfo_log_error("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
+ #else
+ cpuinfo_log_warning("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME);
+ #endif
return UINT32_MAX;
}
if (max_present_processor >= max_processors_count) {