GPULib 1.0 was announced yesterday.
If you have been using the pre-release, the biggest new feature of the IDL bindings are the function forms of the routines. For example, it is possible to do:
IDL> gpuinit IDL> x = findgen(360) * !dtor IDL> y = 2 * findgen(360) * !dtor IDL> z_gpu = gpusin(gpumult(x, y)) ; z = sin(x * y) IDL> plot, gpugetarr(z_gpu) IDL> gpuFree, z_gpu
z = sin(x *y) in a much more readable form than the procedural interface and does not leak any memory. In general, there are two bottlenecks to fast GPU computation: allocating memory on the GPU and transfer between CPU and GPU. Keeping results on the GPU and doing many calculations before transferring a final result to the CPU is desirable. Also, reusing variables for multiple calculations can help. This was straight-forward to do using the procedure interface, but how to specify a return variable to a function? Use the
LHS keyword. For instance, the above calculation could be done using a pre-defined
IDL> gpuinit IDL> x = findgen(360) * !dtor IDL> y = 2 * findgen(360) * !dtor IDL> z_gpu = gpuFltarr(360) IDL> z_gpu = gpusin(gpumult(x, y, LHS=z_gpu), LHS=z_gpu) IDL> plot, gpugetarr(z_gpu) IDL> gpuFree, z_gpu
It is possible to program as efficiently as the procedure forms with the function forms of the routines by using
LHS, so make good use of them!
Full disclosure: I work for Tech-X Corporation and worked on the IDL bindings and examples for GPULib.