@@ -172,16 +172,22 @@ workers_active(arrs...) = workers_active(Iterators.product(arrs...))
172
172
173
173
nworkers_active (args... ) = length (workers_active (args... ))
174
174
175
- function minmax_from_split_array (iterable)
176
- arr₁_min,arr₂_min = first (iterable)
177
- arr₁_max,arr₂_max = arr₁_min,arr₂_min
178
- for (arr₁_value,arr₂_value) in iterable
179
- arr₁_min = min (arr₁_min,arr₁_value)
180
- arr₁_max = max (arr₁_max,arr₁_value)
181
- arr₂_min = min (arr₂_min,arr₂_value)
182
- arr₂_max = max (arr₂_max,arr₂_value)
175
+ function extrema_from_split_array (iterable)
176
+ val_first = first (iterable)
177
+ N = length (val_first)
178
+ T = reduce (promote_type,typeof .(val_first))
179
+ min_vals = Vector {T} (undef,N)
180
+ min_vals .= val_first
181
+ max_vals = Vector {T} (undef,N)
182
+ max_vals .= val_first
183
+
184
+ for val in iterable
185
+ for (ind,vi) in enumerate (val)
186
+ min_vals[ind] = min (min_vals[ind],vi)
187
+ max_vals[ind] = max (max_vals[ind],vi)
188
+ end
183
189
end
184
- return (arr₁_min = arr₁_min,arr₁_max = arr₁_max,arr₂_min = arr₂_min,arr₂_max = arr₂_max )
190
+ collect ( zip (min_vals,max_vals) )
185
191
end
186
192
187
193
function get_hostnames (procs_used= workers ())
@@ -255,8 +261,8 @@ export split_across_processors,split_product_across_processors,
255
261
get_processor_id_from_split_array,
256
262
procid_allmodes,mode_index_in_file,
257
263
get_processor_range_from_split_array,workers_active,worker_rank,
258
- get_index_in_split_array,procid_and_mode_index,minmax_from_split_array ,
259
- node_remotechannels, pmapsum,sum_at_node,pmap_onebatch_per_worker,
264
+ get_index_in_split_array,procid_and_mode_index,extrema_from_split_array ,
265
+ pmapsum,sum_at_node,pmap_onebatch_per_worker,
260
266
get_nodes,get_hostnames,get_nprocs_node
261
267
262
268
end # module
0 commit comments