Respect ODM_NO_GPU

pull/1362/head
Piero Toffanin 2021-11-12 10:41:41 -05:00
rodzic 47846022fc
commit 11f42102e2
3 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -2,9 +2,12 @@ import os
from opendm import log
from repoze.lru import lru_cache
def gpu_disabled_by_user():
return bool(os.environ.get('ODM_NO_GPU'))
@lru_cache(maxsize=None)
def has_gpus():
if os.environ.get('ODM_NO_GPU'):
if gpu_disabled_by_user():
log.ODM_INFO("Disabling GPU features (ODM_NO_GPU is set)")
return False
@ -21,4 +24,3 @@ def has_gpus():
return len(platforms) > 0
except Exception as e:
return False

Wyświetl plik

@ -223,7 +223,7 @@ class OSFMContext:
feature_type = "HAHOG"
# GPU acceleration?
if has_gpus() and feature_type == "SIFT":
if has_gpus() and feature_type == "SIFT" and (not 'min_num_features_is_set' in args):
log.ODM_INFO("Using GPU for extracting SIFT features")
log.ODM_INFO("--min-num-features will be ignored")
feature_type = "SIFT_GPU"

Wyświetl plik

@ -6,6 +6,7 @@ from opendm import system
from opendm import context
from opendm import point_cloud
from opendm import types
from opendm.gpu import gpu_disabled_by_user
from opendm.utils import get_depthmap_resolution
from opendm.osfm import OSFMContext
from opendm.multispectral import get_primary_band_name
@ -62,8 +63,7 @@ class ODMOpenMVSStage(types.ODM_Stage):
config = [
" --resolution-level %s" % int(resolution_level),
#"--cuda-device -1", # TODO REMOVE
"--min-resolution %s" % depthmap_resolution,
"--min-resolution %s" % depthmap_resolution,
"--max-resolution %s" % int(outputs['undist_image_max_size']),
"--max-threads %s" % args.max_concurrency,
"--number-views-fuse 2",
@ -71,6 +71,9 @@ class ODMOpenMVSStage(types.ODM_Stage):
"-v 0"
]
if gpu_disabled_by_user():
config.append("--cuda-device -1")
if args.pc_tile:
config.append("--fusion-mode 1")