Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] aeih_v1_0.tar.gz(128 Kbytes)
Manuscript Title: Swan: A tool for porting CUDA programs to OpenCL
Authors: M.J. Harvey, G. De Fabritiis
Program title: Swan
Catalogue identifier: AEIH_v1_0
Distribution format: tar.gz
Journal reference: Comput. Phys. Commun. 182(2011)1093
Programming language: C.
Computer: PC.
Operating system: Linux.
RAM: 256 Mbytes
Keywords: GPU, CUDA, OpenCL.
Classification: 6.5.

External routines: NVIDIA CUDA, OpenCL

Nature of problem:
Graphical Processing Units (GPUs) from NVIDIA are preferentially programed with the proprietary CUDA programming toolkit. An alternative programming model promoted as an industry standard, OpenCL, provides similar capabilities to CUDA and is also supported on non-NIVIDA hardware (including multicore x86 CPUs, AMD GPUs and IBM Cell processors). The adaptation of a program from CUDA to OpenCL is relatively straightforward but laborious. The Swan tool facilitates this conversion.

Solution method:
Swan performs a translation of CUDA kernel source code into an OpenCL equivalent. It also generates the C source code for entry point functions, simplifying kernel invocation from the host program. A concise host-side API abstracts the CUDA and OpenCL APIs. A program adapted to use Swan has no dependency on the CUDA compiler for the host-side program. The converted program may be built for either CUDA or OpenCL, with the selection made at compile time.

Restrictions:
No support for CUDA C++ features

Running time:
Nominal