[erlang-questions] Vector instructions, BLAS, FFI

tsuraan tsuraan@REDACTED
Tue Apr 8 18:18:10 CEST 2008


>  Our current BLAS interface is something like:
>
>         blas:init(),
>
>         %% Create an identity matrix
>         I = blas:eye(s,    % Precision: 's'ingle or 'd'ouble
>                      3),   % Rows and columns
>         V = blas:vector(s, 3, [1.0, 2.0, 3.0]),
>
>         V2 = blas:mul(blas:mul(2.0, I), V),
>
>         VL = blas:to_list(blas:transpose(V2)).
>         %% VL is:
>         %% [[2.00000,4.00000,6.00000]]

I'm curious, how much copying goes on here?  With the normal port
method, I would imagine that every function call would involve
serializing the data from erlang to the c-port, doing the work in c,
then serializing it to send back to erlang.  Does the FFI allow
everything to be stored as binaries, and then you can just hand the
binaries from the erlang machine to atlas directly without any data
munging or copying?

I think I'll have to look into the ffi proposal. It sounds interesting, anyhow.



More information about the erlang-questions mailing list