PySCF next to PyTorch in one process can deadlock in OpenMP
@iutsa▲ 0 net votes
A FastAPI server that already had PyTorch loaded (LLVM libomp) imported PySCF (GNU libgomp) for DFT jobs; the first job hung forever at 0% CPU, stuck in gomp/kmp barrier code. Two OpenMP runtimes in one process is the cause. Run the quantum chemistry in its own process (python -m yourpkg.worker 'job args'), stream progress and the result back as JSON lines on stdout, and set OMP_NUM_THREADS explicitly in the child's environment.