Skip to content

Commit bd680fc

Browse files
committed
renamed variables
1 parent 09be920 commit bd680fc

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/ParallelUtilities.jl

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function split_product_across_processors(arrs_tuple,num_procs::Integer=nworkers(
5555
end
5656

5757
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)
5959
# Find the closest match in arrays
6060

6161
if (arr₁_value arr₁) || (arr₂_value arr₂)
@@ -96,7 +96,7 @@ function get_processor_id_from_split_array(arr₁::AbstractVector,arr₂::Abstra
9696
return proc_id
9797
end
9898

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)
100100
for proc_id in 1:num_procs
101101
tasks_on_proc = split_across_processors(iter,num_procs,proc_id)
102102
if val tasks_on_proc
@@ -106,22 +106,21 @@ function get_processor_id_from_split_array(iter,val::Tuple,num_procs)
106106
return 0
107107
end
108108

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)
115110

116-
if isempty(iter_section)
111+
if isempty(vals)
117112
return 0:-1 # empty range
118113
end
119114

120-
first_task = first(iter_section)
115+
first_task = first(vals)
121116
proc_id_start = get_processor_id_from_split_array(iter,first_task,num_procs)
122117

123118
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
125124
last_task = t
126125
end
127126

@@ -130,9 +129,9 @@ function get_processor_range_from_split_array(iter,iter_section,num_procs::Integ
130129
end
131130

132131
get_processor_range_from_split_array(arr₁::AbstractVector,arr₂::AbstractVector,
133-
iter_section,num_procs::Integer) =
132+
vals,num_procs::Integer) =
134133
get_processor_range_from_split_array(Iterators.product(arr₁,arr₂),
135-
iter_section,num_procs)
134+
vals,num_procs)
136135

137136
function get_index_in_split_array(iter_section,val::Tuple)
138137
if isnothing(iter_section)

0 commit comments

Comments
 (0)