multimodalart HF Staff commited on
Commit
ab7fe1e
·
verified ·
1 Parent(s): 7405e85

Single-threaded OpenBLAS for pycolmap

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -21,6 +21,10 @@ from pathlib import Path
21
  APP_DIR = Path(__file__).parent.resolve()
22
  sys.path.insert(0, str(APP_DIR))
23
 
 
 
 
 
24
  os.environ.setdefault("TORCH_CUDA_ARCH_LIST", "12.0")
25
  os.environ.setdefault("MAX_JOBS", str(min(32, (os.cpu_count() or 8))))
26
 
 
21
  APP_DIR = Path(__file__).parent.resolve()
22
  sys.path.insert(0, str(APP_DIR))
23
 
24
+ # pycolmap's bundled OpenBLAS segfaults ("Bad memory unallocation") when many matcher
25
+ # threads each spin up a multi-threaded BLAS; keep BLAS single-threaded.
26
+ os.environ["OPENBLAS_NUM_THREADS"] = "1"
27
+ os.environ.setdefault("OMP_NUM_THREADS", "4")
28
  os.environ.setdefault("TORCH_CUDA_ARCH_LIST", "12.0")
29
  os.environ.setdefault("MAX_JOBS", str(min(32, (os.cpu_count() or 8))))
30