From a4ee7dcd7be57eee396268bc85f11de1241cfd09 Mon Sep 17 00:00:00 2001 From: Paul Edwards Date: Fri, 19 May 2023 11:49:39 +0100 Subject: [PATCH] Fixing case where pinning is a list of ranges This was happening with intel MPI when mpiexec is also matched. Example of pinning: 0-3,16-19,32-35,48-51 --- .../check_app_pinning.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/experimental/check_app_pinning_tool/check_app_pinning.py b/experimental/check_app_pinning_tool/check_app_pinning.py index 48f0490e..1d85f233 100755 --- a/experimental/check_app_pinning_tool/check_app_pinning.py +++ b/experimental/check_app_pinning_tool/check_app_pinning.py @@ -355,15 +355,18 @@ def find_last_core_id(process_d): def conv_indx_str_to_list(indx_str): - indx_l = [] - if "-" in indx_str: - indx_str_l = indx_str.split("-") - return list(range(int(indx_str_l[0]),int(indx_str_l[1])+1)) - elif "," in indx_str: - return list(map(int, indx_str.split(","))) - else: - indx_l.append(int(indx_str)) - return indx_l + if "," in indx_str: + parts = indx_str.split(",") + else: + parts = [indx_str] + indx_l = [] + for part in parts: + if "-" in part: + indx_str_l = part.split("-") + indx_l += list(range(int(indx_str_l[0]),int(indx_str_l[1])+1)) + else: + indx_l.append(int(part)) + return indx_l def find_numas(cpus_allowed, topo_d):