kopia lustrzana https://github.com/OpenDroneMap/ODM
Add --no-gpu flag
rodzic
d62ca21243
commit
ed425d2465
|
@ -269,7 +269,13 @@ def config(argv=None, parser=None):
|
||||||
'caps the maximum resolution of image outputs and '
|
'caps the maximum resolution of image outputs and '
|
||||||
'resizes images when necessary, resulting in faster processing and '
|
'resizes images when necessary, resulting in faster processing and '
|
||||||
'lower memory usage. Since GSD is an estimate, sometimes ignoring it can result in slightly better image output quality. Default: %(default)s')
|
'lower memory usage. Since GSD is an estimate, sometimes ignoring it can result in slightly better image output quality. Default: %(default)s')
|
||||||
|
|
||||||
|
parser.add_argument('--no-gpu',
|
||||||
|
action=StoreTrue,
|
||||||
|
nargs=0,
|
||||||
|
default=False,
|
||||||
|
help='Do not use GPU acceleration, even if it\'s available. Default: %(default)s')
|
||||||
|
|
||||||
parser.add_argument('--mesh-size',
|
parser.add_argument('--mesh-size',
|
||||||
metavar='<positive integer>',
|
metavar='<positive integer>',
|
||||||
action=StoreValue,
|
action=StoreValue,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import ctypes
|
||||||
from opendm import log
|
from opendm import log
|
||||||
from repoze.lru import lru_cache
|
from repoze.lru import lru_cache
|
||||||
|
|
||||||
def gpu_disabled_by_user():
|
def gpu_disabled_by_user_env():
|
||||||
return bool(os.environ.get('ODM_NO_GPU'))
|
return bool(os.environ.get('ODM_NO_GPU'))
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@lru_cache(maxsize=None)
|
||||||
|
@ -68,11 +68,13 @@ def get_cuda_compute_version(device_id = 0):
|
||||||
|
|
||||||
return (compute_major.value, compute_minor.value)
|
return (compute_major.value, compute_minor.value)
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
def has_gpu(args):
|
||||||
def has_gpu():
|
if gpu_disabled_by_user_env():
|
||||||
if gpu_disabled_by_user():
|
|
||||||
log.ODM_INFO("Disabling GPU features (ODM_NO_GPU is set)")
|
log.ODM_INFO("Disabling GPU features (ODM_NO_GPU is set)")
|
||||||
return False
|
return False
|
||||||
|
if args.no_gpu:
|
||||||
|
log.ODM_INFO("Disabling GPU features (--no-gpu is set)")
|
||||||
|
return False
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
nvcuda_path = os.path.join(os.environ.get('SYSTEMROOT'), 'system32', 'nvcuda.dll')
|
nvcuda_path = os.path.join(os.environ.get('SYSTEMROOT'), 'system32', 'nvcuda.dll')
|
||||||
|
|
|
@ -251,7 +251,7 @@ class OSFMContext:
|
||||||
config.append("matcher_type: %s" % osfm_matchers[matcher_type])
|
config.append("matcher_type: %s" % osfm_matchers[matcher_type])
|
||||||
|
|
||||||
# GPU acceleration?
|
# GPU acceleration?
|
||||||
if has_gpu():
|
if has_gpu(args):
|
||||||
max_photo = find_largest_photo(photos)
|
max_photo = find_largest_photo(photos)
|
||||||
w, h = max_photo.width, max_photo.height
|
w, h = max_photo.width, max_photo.height
|
||||||
if w > h:
|
if w > h:
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ODMOpenMVSStage(types.ODM_Stage):
|
||||||
|
|
||||||
gpu_config = []
|
gpu_config = []
|
||||||
|
|
||||||
if not has_gpu():
|
if not has_gpu(args):
|
||||||
gpu_config.append("--cuda-device -2")
|
gpu_config.append("--cuda-device -2")
|
||||||
|
|
||||||
if args.pc_tile:
|
if args.pc_tile:
|
||||||
|
|
Ładowanie…
Reference in New Issue