From 839f2add8050a6f5b0b6bcc15e8c6cc9e1edc478 Mon Sep 17 00:00:00 2001 From: Philippe Virouleau <philippe.virouleau@inria.fr> Date: Wed, 8 Nov 2023 14:48:14 +0100 Subject: [PATCH] oar-properties: fix gpu_idx computation --- lib/refrepo/gen/oar-properties.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/refrepo/gen/oar-properties.rb b/lib/refrepo/gen/oar-properties.rb index 86008a95360..f8ebc1f5c22 100644 --- a/lib/refrepo/gen/oar-properties.rb +++ b/lib/refrepo/gen/oar-properties.rb @@ -1329,7 +1329,10 @@ def extract_clusters_description(clusters, site_name, options, data_hierarchy, s raise "Could not find a GPU on CPU #{cpu_num} for core #{row[:cpuset]}" end else - gpu_idx = core_num / (cpu_core_count / numa_gpus.length) + # The parenthesis order is important: we want to keep the + # integer division to generate an integer index, so we want to + # do the multiplication first. + gpu_idx = (core_num * numa_gpus.length) / cpu_core_count selected_gpu = numa_gpus[gpu_idx] end # id of the selected GPU in the node -- GitLab