unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [ANN] guile-ffi-cblas
@ 2014-10-20  5:46 Daniel Llorens
  0 siblings, 0 replies; only message in thread
From: Daniel Llorens @ 2014-10-20  5:46 UTC (permalink / raw
  To: guile-user


Hello,

this is to announce that I've started a BLAS (Basic Linear Algebra Subprograms) wrapper for Guile using the FFI. The wrapper is actually for CBLAS, not that there's much difference.

https://gitorious.org/guile-ffi-cblas

Currently the wrapper covers: dot, axpy, nrm2, scal, asum, iamax, ger, gemv and gemm in all variants. There's a test suite that covers dot, axpy and partially gemv. I'll be adding the rest of the functions as I find the time.

The wrappers use the Guile array facility. This means that you don't need to give the size, inc and order arguments, because those are taken from the array object. E.g. rather than doing

(cblas_dgemv CblasRowMajor CblasNoTrans M N alpha A lda X incX beta Y incY)

you just do

(dgemv! alpha A CblasNoTrans X beta Y)

and instead of doing

(cblas_dgemv CblasRowMajor CblasTrans M N alpha A lda X incX beta Y incY)

you can do either of

(dgemv! alpha (transpose-array A 1 0) CblasNoTrans X beta Y)
(dgemv! alpha A CblasTrans X beta Y)

Here I've retained the TransA parameter because otherwise CblasConjTrans can't be done for free.

None of the wrappers do any copying or type conversion. This means that you can't pass an untyped array to dgemv! (it must be of type 'f64, likewise 'f32 for sgemv!, etc.) and also that some cases that BLAS doesn't support will fail, e.g. if both strides of A in dgemv! differ from 1. All arguments are checked, or should be.

I've looked at the Chicken wrappers: http://wiki.call-cc.org/eggref/4/blas. These take srfi4 vectors with explicit size & inc arguments, so the calls look closer to the original library. I haven't decided yet whether to add compatible exports. (ffi cblas) does export the raw library calls, but those are of course very dangerous to use.

There's no doc yet. Comments & contributions are welcome.

Regards

	Daniel




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-20  5:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-20  5:46 [ANN] guile-ffi-cblas Daniel Llorens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).