Commit 1b7e6463 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

FIX: lowered memory usage to avoid deadlocks (back to fork)

No related merge requests found
Showing with 3 additions and 3 deletions
+3 -3
......@@ -127,11 +127,11 @@ def lsgrm_process_tile(input_image, params : LSGRMParams, tile_width, tile_heigh
out_graph + '_edgeMargin_{}_{}.bin'.format(tile_idx[1], tile_idx[0])]
def get_ls_seg_parameter(input_image, roi=None, margin=0, n_proc=None, memory=None, force_parallel=False):
# Define default number of threads (half) and memory amount (3/4 of available)
# Define default number of threads (half) and memory amount (1/2 of available)
if n_proc is None:
n_proc = round(mp.cpu_count() / 2)
if memory is None:
memory = round(psutil.virtual_memory().available * 0.75)
memory = round(psutil.virtual_memory().available * 0.5)
else:
memory *= 1e6
......@@ -196,7 +196,7 @@ def lsgrm_light(input_image, params : LSGRMParams, out_seg, n_proc=None, memory=
else:
tile_index_list = product(range(n_tiles_x), range(n_tiles_y))
arg_list = [(input_image, params, nominal_tw, nominal_th, x, out_seg, roi) for x in tile_index_list]
with mp.get_context("spawn").Pool(n_proc) as p:
with mp.Pool(n_proc) as p:
out_tiles = p.starmap(grm_process_tile, arg_list)
cumul_label = 0
for f,l in out_tiles:
......
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