sf3d: fix macOS OpenMP segfault — single-threaded OMP + KMP_DUPLICATE_LIB_OK
torch and the compiled texture_baker/uv_unwrapper each link a libomp. Allowing the duplicate runtime clears 'OMP: Error #15' but the duplicate then corrupts the multithreaded CPU LAPACK path (torch.linalg.svd MPS fallback) -> segfault with no Python traceback. Forcing OMP_NUM_THREADS=1 + MKL_NUM_THREADS=1 removes the threading collision. Verified: clean 1.3MB GLB (13298 verts) in ~5s on M3 Ultra, 9GB peak. SF3D local image->3D now works (weights unlocked by owner HF license). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c42f066723
commit
21938a4e17
@ -36,6 +36,14 @@ cmd = [
|
||||
]
|
||||
env = os.environ.copy()
|
||||
env["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
||||
# torch and the compiled texture_baker/uv_unwrapper each link a libomp. Allowing
|
||||
# the duplicate runtime avoids "OMP: Error #15", but the duplicate then corrupts
|
||||
# the multithreaded CPU LAPACK call (torch.linalg.svd MPS fallback) and segfaults
|
||||
# — forcing single-threaded OpenMP removes the threading collision. Verified: a
|
||||
# clean GLB on M3 Ultra with all three set.
|
||||
env["KMP_DUPLICATE_LIB_OK"] = "TRUE"
|
||||
env["OMP_NUM_THREADS"] = "1"
|
||||
env["MKL_NUM_THREADS"] = "1"
|
||||
print("+", " ".join(cmd), flush=True)
|
||||
res = subprocess.run(cmd, cwd=str(VENDOR), env=env, stdout=sys.stdout, stderr=subprocess.STDOUT)
|
||||
if res.returncode != 0:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user