src/threadsearch.jl
changed.
Showing 1 of 1 files from the diff.
@@ -124,6 +124,17 @@
Loading
124 | 124 | end |
|
125 | 125 | end |
|
126 | 126 | ||
127 | + | estimate_generations(target_task_number, nregions) = |
|
128 | + | max(1, floor(Int, log2(target_task_number / nregions))) |
|
129 | + | ||
130 | + | function (search::ThreadedRootSearch{B})(unfinished_regions) where {N, B <: NTuple{N}} |
|
131 | + | return mapreduce(&, chunks(unfinished_regions, N)) do regions |
|
132 | + | max_generations = estimate_generations(search.target_task_number, length(regions)) |
|
133 | + | tasks = qmap(r -> search(r, 1, max_generations), regions) |
|
134 | + | return guarded_reduce(&, tasks) |
|
135 | + | end |
|
136 | + | end |
|
137 | + | ||
127 | 138 | function collect_regions(buffers::B) where { |
|
128 | 139 | N, T, V, B <: NTuple{N, ThreadBuffer{T, V}} |
|
129 | 140 | } |
@@ -138,19 +149,10 @@
Loading
138 | 149 | return root_regions, indeterminate_regions |
|
139 | 150 | end |
|
140 | 151 | ||
141 | - | estimate_generations(target_task_number, nregions) = |
|
142 | - | max(1, floor(Int, log2(target_task_number / nregions))) |
|
143 | - | ||
144 | - | function iterate(search::ThreadedRootSearch{B}, completed = false) where {N, B <: NTuple{N}} |
|
152 | + | function iterate(search::ThreadedRootSearch, completed = false) |
|
145 | 153 | completed && return nothing |
|
146 | - | ||
147 | 154 | unfinished_regions = pop_unfinished!(search.buffers) |
|
148 | - | completed = mapreduce(&, chunks(unfinished_regions, N)) do regions |
|
149 | - | max_generations = estimate_generations(search.target_task_number, length(regions)) |
|
150 | - | tasks = qmap(r -> search(r, 1, max_generations), regions) |
|
151 | - | return guarded_reduce(&, tasks) |
|
152 | - | end |
|
153 | - | ||
155 | + | completed = search(unfinished_regions) |
|
154 | 156 | return collect_regions(search.buffers), completed |
|
155 | 157 | end |
|
156 | 158 |
Files | Coverage |
---|---|
src | 93.97% |
Project Totals (6 files) | 93.97% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.