Skip to content
knutgj edited this page Jun 6, 2012 · 3 revisions

SBCL-specificness

Currently, this code only supports SBCL, but that should not be difficult to change. To my knowledge (I have very little experience with other CLs than SBCL), only the function

(declaim (inline get-arr-adr)) (defun get-arr-adr (arr) (sb-sys:sap-int (sb-sys:vector-sap arr)))

in src/common.lisp is SBCL-specific. This function inputs an array and outputs the memory address of the array in CPU memory as an int. Surely all other CLs have similar function calls, I just don't know them. If you do, please contribute them.

Using homebrew library ...

I have use for some GPU kernels not in standard libraries. Therefore, I made my own little library with additional kernels. This must be in CUDA and compiled as a callable CUDA library. To see an example of a small such library (little CUDA skills required to modify), hop over to knutgj/mycudalib. Once you have this working, it is a simple matter of linking that library, which is done in src/common.lisp

(cffi:define-foreign-library imadethislib (t (:default "~/Code/libmylib"))) (cffi:use-foreign-library imadethislib).

Just edit the name and location of your library (in this case the file is called libmylib.dylib (macOS) and lives in ~/Code/). Next, check the file src/libmylibstuff.lisp for how to write the lisp interfaces to you CUDA kernels. And you are done! Easy-peezy.

... or not

If you only want to use cuFFT and cuBLAS, comment out the previous code in src/common.lisp and don't load libmylibstuff.lisp in cl-cudalib.asd.

Clone this wiki locally