OpenCV getNumberOfCPUs_0
How Many CPUs Does OpenCV See? (It's Not Always What You Think)
- int
OpenCV getNumberOfCPUs_0 is exactly as deep as it sounds: no inputs, one int output, and it returns the number of CPUs OpenCV detected on your machine - cv2.getNumberOfCPUs() with a node wrapper. It's a system-info query, the kind of node that exists because this pack auto-generates a node for every top-level standalone cv2 function. It's useful for exactly one thing: understanding your environment when OpenCV-backed nodes aren't performing the way you'd expect.
Why the number isn't as simple as it looks
Here's the trap: the value this returns is OpenCV's idea of your CPU count, not necessarily your OS's core count, and not at all your GPU situation. A few ways it can surprise you:
- Hyperthreading: OpenCV counts logical processors, so a machine with 8 physical cores can report 16.
- Containers / VMs: if ComfyUI runs inside Docker or a constrained VM, OpenCV may only see the CPUs the container is allowed to see.
- Its own opinions: OpenCV does its own detection at init and caches it; it won't reflect cores hot-added later.
So when someone's workflow "runs slow on a big machine," this node gives you the number to sanity-check against. If OpenCV thinks you have 4 CPUs and your OS says 16, you've found a configuration problem, not a node problem.
What you'd actually do with it
Realistically: read it once as part of a performance audit, note the value, and never wire it into a shipped graph. It pairs conceptually with getNumThreads (how many threads OpenCV is currently using for its parallel loops) - one tells you the hardware OpenCV sees, the other tells you what it's doing with it. If you're chasing slow OpenCV operations, the fix usually lives in setNumThreads, not in reading this number. Think of the whole trio - CPU count, thread count, log level - as the pack's diagnostic shelf: grab them while debugging, delete them before you share the workflow.
Install
Identical to every node in the pack. ComfyUI Manager, search opencv-comfyui (display "OpenCV"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart. No models, no downloads beyond the pip package you almost certainly already have.
There are no real gotchas here - one integer out, no images, no literal-syntax pitfalls, nothing to misconfigure. The only thing to keep straight is the difference between this node and getNumThreads, and to remember the number is OpenCV's own detection, not a universal truth. If you're comparing it against nproc or Task Manager, a mismatch is a lead, not a bug in the node.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int | INT | — |