OpenMP library under macos

I was looking into adding simple parallelizations to my model, and and while failing to utilize >1 thread, encountered something I do not understand. Maybe this is as it should be, but for me it looks slightly inconsistent.

System info:

  • macOS 10.15.5
  • pytorch installed with conda install pytorch torchvision -c pytorch resulting to torch version 1.5.1. (as per the instructions)

Strangeness:

  • at::get_num_thread() returns 1
  • from torch.__config__parallel_info():
OpenMP not found
ATen parallel backend: OpenMP
  • in the build flags from torch.__config__.show(): USE_OPENMP=OFF

Still the documentation says “Pre-built PyTorch releases are compiled with OpenMP support.”

The libiomp5.dylib is present in the library directory.

The inconsistency for me: ATen should use OpenMP as the parallel backend and the dynamic library is included in the distribution, but OpenMP support is disabled in the build. The same applies when downloading only libtorch for C++ API. I’ve understood that OpenMP support on mac hasn’t been there officially for too long, so is this still just work-in-progress?

3 Likes

Got the same issue with 1.10.1.