Are you a fan of NVidia’s CUDA, but know that you should be using OpenCL instead?  Nobody enjoys porting code between languages, and porting GPU code can be especially nasty.  A new open-source tool called ‘Swan’ aims to make it easier via a completely automated onversion.

Swan is a small tool that aids the reversible conversion of existing CUDA codebases to OpenCL. It does several useful things:

  • Translates CUDA kernel source-code to OpenCL.
  • Provides a common API that abstracts both CUDA and OpenCL runtimes.
  • Preserves the convenience of the CUDA <<< grid, block >>> kernel launch syntax by generating C source-code for kernel entry-point functions.

It’s GPL licensed and completely command-line driven, so it should be relatively simple to integrate it into your build procedure as an alternative to NVidia-centric CUDA.

You may also want to consider reading this article from Douglas Eadline in Linux Magazine which discusses the importance of OpenCL as a more cross-platform tool for HPC computing.

via swan – Multiscale Laboratory.