Partager via


GPGPU programming with C# and F#

People often ask me about GPGPU (General Purpose GPU) programming with F#.

One project you might like to take a look at is Brahma, which lets you compile C# expression trees to the GPU. When combined with the F# Power Pack support for converting F# quotations to LINQ expression trees, this should give a viable technique for using GPUs for computation.

Another route is to use Microsoft Accelerator, an incubation project from Microsoft Research. New functionality includes:

  • Accelerator v2 is written as a native-code C++ library with a managed API wrapper
  • Execution on multicore CPUs in addition to DX9 GPUs
  • Extensible HW target interface enabling support for execution on new devices
  • Ability to execute on multiple devices within a single Accelerator instance
  • Asynchronous evaluation of parallel arrays
  • Reusable expression graphs: Across different devices and on the same device with different leaf-node data

Some samples in F# are on the Accelerator home page, and Tomas Petricek has an excellent guide.

Cheers!

Don