1

I've been trying to make use of the GPU as part of a project of mine. I've looked into both CUDA and OpenCL, but the lack of information showing you how to introduce these into a project is shocking. Even their dedicated forum groups are dead. So now, I'm looking into DirectCompute.

From what I can tell, it's simply a new type of shader file that makes use of HLSL. My question is this, does my program (aside from being DirectX 10 / 11 ) need its structure changed?

I mean, is it simply a case of creating the CS file, setting in the project like I would any other shader, and watch the magic happen?

Any information on this would be appreciated.

duffymo
  • 305,152
  • 44
  • 369
  • 561
N0xus
  • 2,674
  • 12
  • 65
  • 126

3 Answers3

2

Yes CS fits into the usual DirectX programming structure. It works in a similar way to CUDA/OpenCL. Here is a good, simple example:

http://openvidia.sourceforge.net/index.php/DirectCompute

Personally I would suggest using CUDA/OpenCL rather than going the DirectCompute route if your project does not involve graphics. I think CUDA/OpenCL are better for general-purpose computing. It can be a little difficult to find documentation but these are the main aspects to GPU programming:

  • Setting up data on the CPU to pass to the GPU.

  • Understanding how many warps/threads need to be started on the GPU, how threads might need to communicate, etc.

  • Computing on the GPU, reading data back on the CPU

PixelPerfect3
  • 110
  • 1
  • 1
  • 6
1

Easiest way - is to make project which uses CS with C# and SlimDX.

And here is good site with basics how to use CS from within C# code.

Later on you can move to full scale CS exploration with C++ and DirectX 11.

Agnius Vasiliauskas
  • 10,935
  • 5
  • 50
  • 70
1

Another option is C++ AMP - please follow links from here for more info and feel free to post questions as you have them: http://blogs.msdn.com/b/nativeconcurrency/archive/2011/09/13/c-amp-in-a-nutshell.aspx

Daniel Moth
  • 781
  • 4
  • 10