From f90cd313ef487b4057864f2977d90ce11de4620b Mon Sep 17 00:00:00 2001 From: Lucas Nussbaum <lucas.nussbaum@loria.fr> Date: Sun, 19 Jan 2020 11:21:58 +0100 Subject: [PATCH] [oar-prop] move code about gpus in a single place to facilitate editing --- lib/refrepo/gen/oar-properties.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/refrepo/gen/oar-properties.rb b/lib/refrepo/gen/oar-properties.rb index 091982cf6a4..881f21b29d4 100644 --- a/lib/refrepo/gen/oar-properties.rb +++ b/lib/refrepo/gen/oar-properties.rb @@ -1353,14 +1353,6 @@ def extract_clusters_description(clusters, site_name, options, data_hierarchy, s ############################################ (0...phys_rsc_map["cpu"][:per_server_count]).each do |cpu_num| - ############################################ - # (2-c) [if cluster with GPU] detects the existing mapping GPU <-> CPU in the cluster - ############################################ - numa_gpus = [] - if node_description.key? "gpu_devices" - numa_gpus = node_description["gpu_devices"].values - .select {|v| v['cpu_affinity'] == cpu_num and v.fetch("reservation", true)} - end ############################################ # Suite of (2-a): Iterate over CORES of the CPU @@ -1412,6 +1404,13 @@ def extract_clusters_description(clusters, site_name, options, data_hierarchy, s ############################################ # (2-e) [if cluster with GPU] Associate a gpuset to each core ############################################ + + numa_gpus = [] + if node_description.key? "gpu_devices" + numa_gpus = node_description["gpu_devices"].values + .select {|v| v['cpu_affinity'] == cpu_num and v.fetch("reservation", true)} + end + if not numa_gpus.empty? gpu_idx = core_num / (phys_rsc_map["core"][:per_server_count] / numa_gpus.length) -- GitLab