From 976db04148e7f6b974626ed88a2061e40bd0e7e1 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 20 Mar 2023 23:49:23 -0400 Subject: [PATCH] Respect max-concurrency when calling OPC --- opendm/opc.py | 4 ++-- stages/odm_dem.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opendm/opc.py b/opendm/opc.py index 4ca3d8e4..b5fdd19e 100644 --- a/opendm/opc.py +++ b/opendm/opc.py @@ -4,7 +4,7 @@ from opendm import log from opendm.system import run from opendm import io -def classify(point_cloud): +def classify(point_cloud, max_threads=8): tmp_output = io.related_file_path(point_cloud, postfix=".classified") if os.path.isfile(tmp_output): os.remove(tmp_output) @@ -16,7 +16,7 @@ def classify(point_cloud): name="model.bin") if model is not None: - run('pcclassify "%s" "%s" "%s" -u -s 2,64' % (point_cloud, tmp_output, model)) + run('pcclassify "%s" "%s" "%s" -u -s 2,64' % (point_cloud, tmp_output, model), env_vars={'OMP_NUM_THREADS': max_threads}) if os.path.isfile(tmp_output): os.remove(point_cloud) diff --git a/stages/odm_dem.py b/stages/odm_dem.py index 9a6b3a96..0d2ea26a 100755 --- a/stages/odm_dem.py +++ b/stages/odm_dem.py @@ -58,7 +58,7 @@ class ODMDEMStage(types.ODM_Stage): ) log.ODM_INFO("Classifying {} using OpenPointClass (2/2)".format(dem_input)) - classify(dem_input) + classify(dem_input, args.max_concurrency) with open(pc_classify_marker, 'w') as f: f.write('Classify: smrf\n')