mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 08:49:02 +08:00
[serve] Add docs on configuring cv2 parallelism (#12652)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user