# Build Opencv on device with cuda compatibility 7.5 and use it on device with cuda compatibility 8.6

**URL:** <https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353>\
**Category:** Uncategorized\
**Tags:** build, cuda\
**Created:** [September 28, 2022, 10:39am UTC](https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353 "2022-09-28T10:39:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![s\_t](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/s_t/32/6158_2.png) [@s\_t](https://forum.opencv.org/u/s_t)\
**Post date:** [September 28, 2022, 10:39am UTC](https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353/1 "2022-09-28T10:39:13Z")

</div>

I have a general question. As mentioned above I have windows machine with cuda compatibitlity 7.5. So If I build + compile opencv\_contrib from source can I use the same on another windows machine where cuda compatibility is 8.6?  
Or in general can opencv be build without graphics card?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [September 28, 2022, 11:22am UTC](https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353/2 "2022-09-28T11:22:38Z")

</div>

related:

[https://stackoverflow.com/questions/73880223/build-opencv-with-cuda-compatibilityc-c-7-5-and-use-it-on-device-with-c-c-8-6](https://stackoverflow.com/questions/73880223/build-opencv-with-cuda-compatibilityc-c-7-5-and-use-it-on-device-with-c-c-8-6)

> [@s\_t](#):
>
> Or in general can opencv be build without graphics card?

building never requires a graphics card. the build process happens entirely on the CPU.

OpenCV does not require CUDA at runtime. the CUDA modules live in the contrib repository. they are optional.

OpenCV can use OpenCL, which runs on any GPU. that is deeply built into OpenCV, enabled by default (can be disabled), but also not required at runtime.

I can’t say anything about CUDA compute capabilities. you’ll probably get a good answer on that shortly.

---

<div class="post-metadata">

**Author:** ![s\_t](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/s_t/32/6158_2.png) [@s\_t](https://forum.opencv.org/u/s_t)\
**Post date:** [September 28, 2022, 11:30am UTC](https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353/3 "2022-09-28T11:30:35Z")

</div>

So this is also true for opencv\_contrib(all built happens on CPU)?  
If yes then that answers my question. Because while building it in CMAKE we have to specifiy cuda architecture 5.3 or 7.2 and so on

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [September 28, 2022, 11:37am UTC](https://forum.opencv.org/t/build-opencv-on-device-with-cuda-compatibility-7-5-and-use-it-on-device-with-cuda-compatibility-8-6/10353/4 "2022-09-28T11:37:01Z")

</div>

Sure you can just specify

> CUDA\_ARCH\_BIN=7.5,8.6

and you will build binary code for both architechtures. If you think you may get a RTX 4000 series GPU in the very near future you could even specify

> CUDA\_ARCH\_PTX=8.6

so the cuda code will be JIT compiled on that device as well.

> [@s\_t](#):
>
> Because while building it in CMAKE we have to specifiy cuda architecture 5.3 or 7.2 and so on

You don’t have to specify and architecture, the default behaviour is to build binary code for all architechtures supported by the version of the CUDA SDK you have installed.
