@@ -55,7 +55,7 @@ function split_product_across_processors(arrs_tuple,num_procs::Integer=nworkers(
55
55
end
56
56
57
57
function get_processor_id_from_split_array (arr₁:: AbstractVector ,arr₂:: AbstractVector ,
58
- (arr₁_value,arr₂_value):: Tuple ,num_procs)
58
+ (arr₁_value,arr₂_value):: Tuple ,num_procs:: Integer )
59
59
# Find the closest match in arrays
60
60
61
61
if (arr₁_value ∉ arr₁) || (arr₂_value ∉ arr₂)
@@ -96,7 +96,7 @@ function get_processor_id_from_split_array(arr₁::AbstractVector,arr₂::Abstra
96
96
return proc_id
97
97
end
98
98
99
- function get_processor_id_from_split_array (iter,val:: Tuple ,num_procs)
99
+ function get_processor_id_from_split_array (iter,val,num_procs)
100
100
for proc_id in 1 : num_procs
101
101
tasks_on_proc = split_across_processors (iter,num_procs,proc_id)
102
102
if val ∈ tasks_on_proc
@@ -106,22 +106,21 @@ function get_processor_id_from_split_array(iter,val::Tuple,num_procs)
106
106
return 0
107
107
end
108
108
109
- get_processor_id_from_split_array (arr₁:: AbstractVector ,arr₂:: AbstractVector ,
110
- val:: Tuple{Any,Any} ,num_procs:: Integer ) =
111
- get_processor_id_from_split_array (Iterators. product (arr₁,arr₂),
112
- val,num_procs)
113
-
114
- function get_processor_range_from_split_array (iter,iter_section,num_procs:: Integer )
109
+ function get_processor_range_from_split_array (iter,vals,num_procs:: Integer )
115
110
116
- if isempty (iter_section )
111
+ if isempty (vals )
117
112
return 0 : - 1 # empty range
118
113
end
119
114
120
- first_task = first (iter_section )
115
+ first_task = first (vals )
121
116
proc_id_start = get_processor_id_from_split_array (iter,first_task,num_procs)
122
117
123
118
last_task = first_task
124
- for t in iter_section
119
+ if length (vals) == 1
120
+ return proc_id_start: proc_id_start
121
+ end
122
+
123
+ for t in vals
125
124
last_task = t
126
125
end
127
126
@@ -130,9 +129,9 @@ function get_processor_range_from_split_array(iter,iter_section,num_procs::Integ
130
129
end
131
130
132
131
get_processor_range_from_split_array (arr₁:: AbstractVector ,arr₂:: AbstractVector ,
133
- iter_section ,num_procs:: Integer ) =
132
+ vals ,num_procs:: Integer ) =
134
133
get_processor_range_from_split_array (Iterators. product (arr₁,arr₂),
135
- iter_section ,num_procs)
134
+ vals ,num_procs)
136
135
137
136
function get_index_in_split_array (iter_section,val:: Tuple )
138
137
if isnothing (iter_section)
0 commit comments