1

Pretty much like the title says, does directx in any way use the CUDA libraries/extensions for nvidia cards under the hood?

Basically do the directx libraries, under the hood, are actually making calls to the CUDA cores via CUDA libraries?

dave
  • 14,991
  • 26
  • 76
  • 110

1 Answers1

9

The question is a legitimate one in my opinion.

DirectX is a framework (a bunch of libraries) that provides programming interfaces for graphics, sound, and other peripherals, mainly made for games. Direct3D, much like OpenGL, is the library that is responsible to communicate with the graphics card. I assume your question was directed at Direct3D.

When Direct3D is invoked, it uses the same multiprocessors that CUDA does, and even more components (e.g. rasterizers). However, Direct3D interfaces directly with the graphics card drivers (in this case, NVIDIA). So basically, both CUDA and Direct3D invoke the NVIDIA drivers, but in slightly different ways.

It is worth noting that pixel/vertex shaders, which are part of Direct3D/OpenGL, actually sparked the idea behind CUDA. Back in 2007, people were writing general purpose scientific code in pixel shaders.

P.S. DirectCompute is the closest relative to CUDA DirectX can offer, enabling cross-platform (i.e. non-NVIDIA) GPU development.

Tal Ben-Nun
  • 439
  • 3
  • 7
  • Wow, thanks for clearing that up. So if CUDA library is specifically designed for their CUDA GPUs, is it in theory more optimized/better for graphics applications? – dave Jul 10 '16 at 16:34
  • Due to specific features in GPUs (such as the texture cache), graphics-oriented computations are more suited for CUDA. I hope this answers your question. – Tal Ben-Nun Jul 10 '16 at 17:30
  • Thank you again. So what edge does directx11or12 have over CUDA programming? Can you use both in a single application? – dave Jul 10 '16 at 18:24
  • @TalBen-Nun Why would you say that graphics-oriented computations are more suited for CUDA? That doesn't make sense. – Reto Koradi Jul 10 '16 at 19:53
  • I meant computations that are two-dimensional, like convolution and median filtering. You are correct, I should've said "image processing and computer graphics" instead. – Tal Ben-Nun Jul 10 '16 at 20:34
  • @dave As answered, 3D graphics use additional components of the GPU that CUDA cannot. DirectX can be used in conjunction with CUDA using the DirectX Interop (interoperability) API. For an example, see the "simpleD3D11Texture" example in the CUDA SDK. – Tal Ben-Nun Jul 10 '16 at 20:38