[serve] Add docs on configuring cv2 parallelism (#12652)

This commit is contained in:
Edward Oakes
2020-12-08 16:03:13 -06:00
committed by GitHub
parent 50f28811ac
commit fd4e025da6
2 changed files with 9 additions and 1 deletions
+3 -1
View File
@@ -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:
+6
View File
@@ -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