diff --git a/doc/source/configure.rst b/doc/source/configure.rst index 83a700a9e..b1cadc2fa 100644 --- a/doc/source/configure.rst +++ b/doc/source/configure.rst @@ -60,7 +60,9 @@ If using the command line, connect to the Ray cluster as follow: override this by explicitly setting ``OMP_NUM_THREADS``. ``OMP_NUM_THREADS`` is commonly used in numpy, PyTorch, and Tensorflow to perform multit-threaded linear algebra. In multi-worker setting, we want one thread per worker instead of many threads - per worker to avoid contention. + per worker to avoid contention. Some other libraries may have their own way to configure + parallelism. For example, if you're using OpenCV, you should manually set the number of + threads using cv2.setNumThreads(num_threads) (set to 0 to disable multi-threading). .. _temp-dir-log-files: diff --git a/doc/source/serve/advanced.rst b/doc/source/serve/advanced.rst index 26003559d..cdca01c62 100644 --- a/doc/source/serve/advanced.rst +++ b/doc/source/serve/advanced.rst @@ -81,6 +81,12 @@ If you *do* want to enable this parallelism in your Serve backend, just set OMP_ client.create_backend("parallel_backend", MyBackend, 12) + +.. note:: + Some other libraries may not respect ``OMP_NUM_THREADS`` and have their own way to configure parallelism. + For example, if you're using OpenCV, you'll need to manually set the number of threads using ``cv2.setNumThreads(num_threads)`` (set to 0 to disable multi-threading). + You can check the configuration using ``cv2.getNumThreads()`` and ``cv2.getNumberOfCPUs()``. + .. _serve-batching: Batching to improve performance