| Author |
Message |
|
| Guest |
Posted: Tue Apr 08, 2008 9:58 am |
|
|
|
Guest
|
Il giorno mar, 08/04/2008 alle 16.13 +1000, jm ha scritto:
> The reason I initially stated vec:add/3 as an example is that this could
> be implemented as a C-port module. Then if this proves successful the
> atomic could be rolled into the VM eventually and the rest moved to a
> normal library. At which point any changes needed to erlang syntax would
> be readily apparent.
>
> Where would you recommend starting? Any good references on parallel
> vector and matrix operations/algorithms?
Instead of reimplementing everything, I'd suggest to start here:
http://www.netlib.org/blas/
http://math-atlas.sourceforge.net/
The BLAS interface does not support integer arithmetics, but it's a
well-estabished standard. Furthermore, if the Erlang VM is dynamically
linked against a BLAS library (either directly or through a driver),
then users/developers could choose their highly-optimized
hardware-dependant implementation without recompiling everything.
Here at CRS4 we are still experimenting with Erlang as a tool for
developing distributed numerical applications. We've developed a BLAS
binding, based on the Erlang Foreign Function Interface EEP [1,2] ---
and in fact, we've created and proposed the Erlang FFI just to make it
easier to interface libraries with tens or hundreds of functions. In
general, if you plan to use Erlang for numerical and scientific
computation, then you'll definitely need an easy way to interface to
existing code.
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]]
Matrices and vectors are implemented as records containing some
information (dimensions, row/column ordering, transposition...) and a
binary with floating point values. The BLAS binding consists of ~950
lines of Erlang code (the 'blas' module) and ~300 lines of C (various
helper functions).
Regards,
alceste
References:
[1] http://muvara.org/crs4/erlang/ffi
[2] http://erlang.org/eeps/eep-0007.html
--
Alceste Scalas <alceste@crs4.it>
CRS4 - http://www.crs4.it/
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Apr 08, 2008 12:18 pm |
|
|
|
Guest
|
Alceste Scalas wrote:
> Il giorno mar, 08/04/2008 alle 16.13 +1000, jm ha scritto:
>> The reason I initially stated vec:add/3 as an example is that this could
>> be implemented as a C-port module. Then if this proves successful the
>> atomic could be rolled into the VM eventually and the rest moved to a
>> normal library. At which point any changes needed to erlang syntax would
>> be readily apparent.
>>
>> Where would you recommend starting? Any good references on parallel
>> vector and matrix operations/algorithms?
>
> Instead of reimplementing everything, I'd suggest to start here:
>
> http://www.netlib.org/blas/
> http://math-atlas.sourceforge.net/
I knew of blas (from lapack) or rather had heard of it, but hadn't heard
of math-atlas. Having never used it before I was browsing their website
looking for a starting point to access its suitability. Trying to
understand the wheel not re-invent it that is. The most I was hoping to
do was the initial investigation and, at worst, write a thin bridge
between Erlang and a suitable library. Any more than that and I was
going to bow out.
Nice to see you have saved someone else a lot of work! Not being very
familar with blas: Is the license compatible with Erlang? Assuming yes,
are you in a position to make any of the code public? How well does it
perform?
On the reimplementation front. There is something to be said for adding
SIMD support at a lower level. After I asked the question about adding
vector support I realised that my use of "vector" was too vague. There
are actually two valid intepretation:
1) SIMD at the low level. This would mean changes to the language.
2) Vector and matrix operations. This can easily be done by calling an
external library.
Lastly, what are the "distributed numerical applications" that Erlang is
being investigated for?
thanks, very informative.
Jeff.
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Apr 08, 2008 4:20 pm |
|
|
|
Guest
|
> 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.
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Apr 09, 2008 8:21 am |
|
|
|
Guest
|
Il giorno mar, 08/04/2008 alle 22.16 +1000, jm ha scritto:
> Not being very familar with blas: Is the license compatible with
> Erlang?
BLAS is just a standardized API, with several implementations. Some
examples:
* NetLib reference implementation: http://www.netlib.org/blas/
* ATLAS: http://math-atlas.sourceforge.net/
* AMD Core Math Library: http://developer.amd.com/acml.jsp
* Intel Math Kernel Library:
http://www.intel.com/cd/software/products/asmo-na/eng/266858.htm
* nVIDIA CUDA: http://developer.nvidia.com/object/cuda.html
Each implementation comes with its own license (Netlib and ATLAS are
released under BSD-like, GPL-compatible licenses). They are usually
binary compatible, so you can switch between them without recompiling
(as long as you use dynamic linking and don't depend on some
non-standard API extensions).
> Assuming yes, are you in a position to make any of the code
> public?
I hope I'll be able to release the code, but it depends on the FFI
patches --- so it may not be very useful, unless the FFI EEP is approved
in some form.
> How well does it perform?
We tried several ways to integrate BLAS and Erlang. The current
FFI-based implementation is slightly slower than dedicated BIFs, but
definitely faster than a linked-in driver (and definitely easier to
develop, since all the linked-in driver boilerplate code went away).
I can't provide the benchmarks data right now, but we plan to submit a
paper for the next Erlang Workshop.
> Lastly, what are the "distributed numerical applications" that Erlang is
> being investigated for?
Simulation of mechanical and thermodynamical systems.
Regards,
alceste
--
Alceste Scalas <alceste@crs4.it>
CRS4 - http://www.crs4.it/
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Apr 09, 2008 8:48 am |
|
|
|
Guest
|
Il giorno mar, 08/04/2008 alle 11.18 -0500, tsuraan ha scritto:
> 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?
Yes, it does. The FFI allows both to receive and return binaries and
handle refcounting. Furthermore, several operations do not involve the
C side at all (for example: matrix/vector transposition just changes an
Erlang record field; the same goes for matrix/vector extraction from
existing matrices/vectors).
We developed the BLAS interface (and the FFI in the first place) trying
to avoid copying, unless the data is sent between different Erlang nodes
(and since matrices and vectors are just regular Erlang records, the
Erlang VM can handle them without problems).
Regards,
alceste
--
Alceste Scalas <alceste@crs4.it>
CRS4 - http://www.crs4.it/
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Apr 09, 2008 7:50 pm |
|
|
|
Guest
|
> We developed the BLAS interface (and the FFI in the first place) trying
> to avoid copying, unless the data is sent between different Erlang nodes
> (and since matrices and vectors are just regular Erlang records, the
> Erlang VM can handle them without problems).
That sounds really nice. I sure hope this FFI gets approved soon, or
at least merged into the official Erlang source as an unsupported
feature in testing.
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| wuji |
Posted: Wed Aug 15, 2012 8:02 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
Edwards still loved her and she said, "You have to to cheap Ralph Lauren to ask him. I think he does. I mean I
that he does."The interview began with Stephanopoulos asking Hunter, who who [h1]cheap polo shirts[/h1] who gave birth to a girl named Frances Quinn with
whether knowing what she knows now, would she do it it cheap Ralph Lauren it all again."Would I do that again?" repeats Hunter almost
"No way. Absolutely not."Hunter's announcement came out the same day day discount designer *beep* day her revealing memoir "What Really Happened: John Edwards, Our
and Me" was released.The book revealed that Edwards had several several cheap designer *beep* several mistresses before her, but it also angered people for |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|