cv2.ocl.useOpenCL
Is OpenCL switched on, not just available?
- bool
cv2.ocl.useOpenCL is the second half of the OpenCL question. haveOpenCL asks whether the capability exists; this one asks whether it's currently enabled. You can get true on the first and false on the second - runtime present, but OpenCV told not to use it - and that combination is exactly why both nodes exist.
No inputs, one BOOLEAN output. Drop it on the canvas, queue anything, read the flag.
Why the distinction matters for a ComfyUI install
When OpenCV's OpenCL path is enabled, its transparent API will offload supported operations to the OpenCL device even when you pass in plain numpy arrays. Which means the low-level cv2_* nodes in this pack can be running some of their work on a GPU you didn't choose - usually the same card your torch models are sitting on, occasionally a weaker integrated GPU, and it pays a host-to-device copy on every call. On a ComfyUI box that's usually an argument for leaving the flag off.
The practical problem: this pack gives you the getter, not the setter. OpenCV's cv2.ocl.setUseOpenCL(bool) isn't wrapped, so you can't flip it from the graph. The documented ways to control it are Python-side or environmental - cv2.ocl.setUseOpenCL(False) in a startup script, or the OPENCV_OPENCL_DEVICE=disabled environment variable before ComfyUI launches. So treat this node as a read-only instrument: it tells you what state your install is in, and if you don't like the answer you change it outside ComfyUI.
Using the output
It's a BOOLEAN; send it to a note, a log, or a switch. Since the node has no inputs, it's a constant per session and gets cached like any other no-input node - running it a hundred times tells you the same thing a hundred times.
There's also a subtler use: it distinguishes two failure shapes when something is unexpectedly slow or a contrib op behaves oddly. haveOpenCL true / useOpenCL true means OpenCV is offloading and the copies may be your overhead. haveOpenCL false means the question is moot. haveOpenCL true / useOpenCL false means nothing is being offloaded and the slowness is elsewhere entirely - which is the answer that saves you the most time, because it lets you stop blaming OpenCL.
Install
ComfyUI Manager → search ComfyUI CV → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"
Python ≥ 3.12, ComfyUI on the V3 node API. cv2.ocl is a contrib submodule, so this node requires the contrib wheel - the pin above. If it's missing from your menu, the usual cause is a non-contrib opencv-python(-headless) installed over the contrib one: all four distributions share one site-packages/cv2, and the plain wheels silently empty the contrib submodules. The pack's tools/repair_opencv_contrib.py --check / --apply is the fix, and there is no install-time guard against it.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bool | BOOLEAN | — |