Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 921e63a

Browse files
Merge pull request #40 from 20treeAI/perf/multiprocessing
fix: this functions has internal subprocess calls
2 parents a15dd38 + fe19496 commit 921e63a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

s2p/initialization.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import rasterio
1111
import numpy as np
1212
import rpcm
13+
from multiprocessing import cpu_count
1314

1415
from s2p import common
1516
from s2p import geographiclib
@@ -379,10 +380,12 @@ def tiles_full_info(cfg, tw, th, tiles_txt, create_masks=False):
379380
with rasterio.open(img['img'], 'r') as f:
380381
images_sizes.append(f.shape)
381382

383+
# compute all masks in parallel as numpy arrays
384+
n_workers = cfg["max_processes"] if cfg["max_processes"] is not None else cpu_count()
382385
# compute all masks in parallel as numpy arrays
383386
tiles_usefulnesses = parallel.launch_calls(is_this_tile_useful,
384387
tiles_coords,
385-
cfg['max_processes'],
388+
min(n_workers, cpu_count()//2), # internal subprocess calls!,
386389
cfg['images'],
387390
images_sizes,
388391
cfg['border_margin'],

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def finalize_options(self):
6363
}
6464

6565
setup(name="s2p",
66-
version="1.6.2",
66+
version="1.6.3",
6767
description="Satellite Stereo Pipeline.",
6868
long_description=readme(),
6969
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)