Wednesday, August 13, 2008

IDL tip: compile gpuinit before running your own procedures

Another "gotcha" came up today from a user; when using GPULib in IDL, you may need to compile gpuinit before running your code. For example, to run a procedure you've written called foo, you should do something like the following:
IDL> .compile gpuinit
IDL> .compile foo
IDL> foo
As always, if you have questions or suggestion regarding GPULib, feel free to leave comments or email

Tips on building GPULib

Several users have pointed out recently that the documentation included with GPULib is sparser than they would like. The docs do require updating, and you should see better installation and use instructions with the next release of the libraries. Until then, here are some tips on how to deal with common issues.

If you're having trouble getting GPULib to build, make sure that the most recent CUDA libraries are installed for your platform. Also, make sure that you have any other software you need; you can't build the IDL bindings without IDL installed on the machine, for example.

If you see errors such as the following during the build:

cc -I/usr/local/rsi/idl/external/include -I/usr/local/cuda/include -O3 -fPIC -I../vectorOp -I../physicsOp -c gpulib.c
gpulib.c:38:24: error: idl_export.h: No such file or directory
gpulib.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'get_IDL_long'
In file included from gpulib.c:163:
../vectorOp/gpuVectorOpFuncList.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'IDL_gpuSqrtF'
../vectorOp/gpuVectorOpFuncList.h:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'IDL_gpuExpF'
you probably need to change your configure line to help GPULib figure out where IDL is. A configure line such as

./configure --disable-MATLAB --with-idl-dir=/path/to/idl
should fix this issue and allow the build to continue.

If you encounter any other issues, feel free to describe them in the comments or send email to