New in Wolfram
Mathematica
8: CUDA and OpenCL Support
◄
previous
|
next
►
Software Development
Easy Conversion between CUDA and OpenCL
The
Mathematica
functions for working with CUDA and OpenCL programs are carefully designed to have consistent interfaces. This allows
Mathematica
's symbolic code capabilities to be used to convert between CUDA and OpenCL programs.
In[1]:=
X
ReleaseHold[ReplaceAll[ HoldForm[ SymbolicCUDAFunction[ "gpuFunction", {{CPointerType["int"], x}, {int, i}}, CBlock[{ SymbolicCUDADeclareIndexBlock[1], CAssign[AddTo, CArray[x, index], 2] }]] ], {SymbolicCUDAFunction -> SymbolicOpenCLFunction, SymbolicCUDADeclareIndexBlock -> SymbolicOpenCLDeclareIndexBlock, CPointerType[x_] :> CPointerType[{"__global", x}]}]] // ToCCodeString
Out[1]=