Use max_concurrency option for dem, georef, and ortho modules

pull/889/head
Dakota Benjamin 2018-07-01 19:24:37 -04:00
rodzic 4262c64840
commit 37504a2a6c
3 zmienionych plików z 18 dodań i 13 usunięć

Wyświetl plik

@ -72,13 +72,15 @@ class ODMApp(ecto.BlackBox):
'georeferencing': ODMGeoreferencingCell(gcp_file=p.args.gcp,
use_exif=p.args.use_exif,
verbose=p.args.verbose),
'dem': ODMDEMCell(verbose=p.args.verbose),
'dem': ODMDEMCell(max_concurrency=p.args.max_concurrency,
verbose=p.args.verbose),
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
t_srs=p.args.orthophoto_target_srs,
no_tiled=p.args.orthophoto_no_tiled,
compress=p.args.orthophoto_compression,
bigtiff=p.args.orthophoto_bigtiff,
build_overviews=p.args.build_overviews,
max_concurrency=p.args.max_concurrency,
verbose=p.args.verbose)
}

Wyświetl plik

@ -13,6 +13,7 @@ from opendm.cropper import Cropper
class ODMDEMCell(ecto.Cell):
def declare_params(self, params):
params.declare("verbose", 'print additional messages to console', False)
params.declare("max_concurrency", "Number of threads", context.num_cores)
def declare_io(self, params, inputs, outputs):
inputs.declare("tree", "Struct with paths", [])
@ -116,7 +117,7 @@ class ODMDEMCell(ecto.Cell):
'COMPRESS': 'LZW',
'BLOCKXSIZE': 512,
'BLOCKYSIZE': 512,
'NUM_THREADS': 'ALL_CPUS'
'NUM_THREADS': self.params.max_concurrency
})
else:
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)

Wyświetl plik

@ -18,6 +18,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
params.declare("bigtiff", 'Make BigTIFF orthophoto', 'IF_SAFER')
params.declare("build_overviews", 'Build overviews', False)
params.declare("verbose", 'print additional messages to console', False)
params.declare("max_concurrency", "number of threads", context.num_cores)
def declare_io(self, params, inputs, outputs):
inputs.declare("tree", "Struct with paths", [])
@ -125,7 +126,8 @@ class ODMOrthoPhotoCell(ecto.Cell):
'png': tree.odm_orthophoto_file,
'tiff': tree.odm_orthophoto_tif,
'log': tree.odm_orthophoto_tif_log,
'max_memory': max(5, (100 - virtual_memory().percent) / 2)
'max_memory': max(5, (100 - virtual_memory().percent) / 2),
'threads': self.params.max_concurrency
}
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
@ -135,7 +137,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
'{predictor} '
'-co BLOCKXSIZE=512 '
'-co BLOCKYSIZE=512 '
'-co NUM_THREADS=ALL_CPUS '
'-co NUM_THREADS={threads} '
'-a_srs \"{proj}\" '
'--config GDAL_CACHEMAX {max_memory}% '
'{png} {tiff} > {log}'.format(**kwargs))
@ -149,7 +151,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
'BIGTIFF': self.params.bigtiff,
'BLOCKXSIZE': 512,
'BLOCKYSIZE': 512,
'NUM_THREADS': 'ALL_CPUS'
'NUM_THREADS': self.params.max_concurrency
})
if self.params.build_overviews: