Commit cf93b48a authored by sfritschi's avatar sfritschi
Browse files

Only consider remaining pores in subsequent ierations; load balancing by...

Only consider remaining pores in subsequent ierations; load balancing by random ordering of remaining pores
parent 3f1e173c
gen/plots/strong_scaling.png

24 KB | W: | H:

gen/plots/strong_scaling.png

21.2 KB | W: | H:

gen/plots/strong_scaling.png
gen/plots/strong_scaling.png
gen/plots/strong_scaling.png
gen/plots/strong_scaling.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -177,8 +177,6 @@ class CellList:
for i, pore in enumerate(pores):
if (tid == 0):
print(f"progress {((i+1) / n)*100.:.1f}%", end="\r", flush=True)
if (len(pore.throats) == 0): continue # skip
candidates = self.find_candidates(pore)
......@@ -784,6 +782,8 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
throatsLeft = totalThroats
throatThreshold = int(0.002 * totalThroats)
# Pores that are not fully-connected yet
reduced_pores = pores[:n]
while (iterCount < maxIters and throatsLeft > throatThreshold):
if (not mute):
......@@ -793,7 +793,7 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
if (not mute): print("computing best matches")
# Compute best matches for each pore in parallel using available threads
for tid in range(nthreads):
poreList = pores[displs[tid] : displs[tid+1]]
poreList = reduced_pores[displs[tid] : displs[tid+1]]
worker = mp.Process(target=cellList.match_maker, args=(poreList, tid))
worker.start()
workers.append(worker)
......@@ -801,12 +801,15 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
for worker in workers:
worker.join()
for poreIdx, pore in enumerate(pores[:n]):
# Iterate over remaining (reduced) pores
for it, pore in enumerate(reduced_pores):
poreIdx = pore.index
if (not mute):
print(f"progress {((poreIdx+1) / n)*100.:.1f}%", end="\r", flush=True)
print(f"progress {((it+1) / n)*100.:.1f}%", end="\r", flush=True)
# Set of throats to be realized
poreTtbr = ttbrs[poreIdx]
if (len(poreTtbr) == 0): continue # Nothing left to do
matches = cellList.fetch_matches(poreIdx)
......@@ -876,10 +879,27 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
throatCount = 0
# Copy throats back to original pores and update #throats left
# and compute remaining (reduced) pores
reduced_pores = []
for i, pore in enumerate(pores[:n]):
poreTtbr = ttbrs[i]
throatCount += len(poreTtbr)
pore.throats = poreTtbr.copy()
if len(poreTtbr) > 0:
# Insert in random order for improved load balancing
reduced_pores.insert(randint(0,len(reduced_pores)), pore)
# Recompute loads and displacements for all threads
n_reduced = len(reduced_pores)
remainder = n_reduced % nthreads
loads = [n_reduced // nthreads] * nthreads
for i in range(remainder):
loads[i] += 1
# Compute inclusive-scan
displs = [0]
displs += accumulate(loads)
throatsLeft = throatCount // 2
iterCount += 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment