Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Haskell-cafe] ANNOUNCE: vector 0.1 (efficient arrays with lots of fusion)

0 views
Skip to first unread message

Roman Leshchinskiy

unread,
Jul 12, 2008, 11:01:35 AM7/12/08
to haskel...@haskell.org, libr...@haskell.org
Hi all,

the vector library will eventually provide fast, Int-indexed arrays with
a powerful fusion framework. It's very immature at the moment (I haven't
tested most of the code) and implements just a few combinators but I
thought releasing early wouldn't hurt. Use at your own risk and expect
things to break horribly!

What it provides:

* Boxed and unboxed arrays with a generic interface and a very basic
set of combinators.

* A powerful loop fusion framework. It is based on stream fusion but
already goes beyond that (in particular, it can do some things
in-place) and will be significantly extended in the future.

* Extensibility.

* Rudimentary documentation.

* Bugs.

The code is based on the DPH libraries but is much more generic and a
*lot* simpler. This has only been made possible by the tremendous
progress in GHC's simplifier in the recent months/years (thanks Simon!).
Consequently, you'll need a recent development version of GHC to build
this, 6.8 won't work. It might be able to compile the library but you'll
get terrible code, much worse than with lists.

If you want to try it out, compile with -O2 -fno-spec-constr-count and
please don't forget to let me know about things that didn't work (or,
miraculously, did).

Grab it from

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vector

or

darcs get http://darcs.haskell.org/vector

Again, special thanks to Simon for doing such a wonderful job with the
optimiser.

Enjoy,

Roman
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Bulat Ziganshin

unread,
Jul 12, 2008, 11:16:58 AM7/12/08
to Roman Leshchinskiy, haskel...@haskell.org
Hello Roman,

Saturday, July 12, 2008, 7:01:05 PM, you wrote:

> the vector library will eventually provide fast, Int-indexed arrays with
> a powerful fusion framework.

GREAT! doom4 would be written in Haskell!


--
Best regards,
Bulat mailto:Bulat.Z...@gmail.com

Sebastian Sylvan

unread,
Jul 12, 2008, 12:20:30 PM7/12/08
to Roman Leshchinskiy, haskel...@haskell.org
On 7/12/08, Roman Leshchinskiy <r...@cse.unsw.edu.au> wrote:
>
> Hi all,
>
> the vector library will eventually provide fast, Int-indexed arrays with a
> powerful fusion framework. It's very immature at the moment (I haven't
> tested most of the code) and implements just a few combinators but I
> thought releasing early wouldn't hurt. Use at your own risk and expect
> things to break horribly!
>
> What it provides:
>
> * Boxed and unboxed arrays with a generic interface and a very basic
> set of combinators.
>
> * A powerful loop fusion framework. It is based on stream fusion but
> already goes beyond that (in particular, it can do some things
> in-place) and will be significantly extended in the future.
>
(moving to cafe)

Is there any more (easily-digested, like a paper) information available
about this? Specifically what things can happen in-place, and future
extensions...


--
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862

Roman Leshchinskiy

unread,
Jul 12, 2008, 1:17:46 PM7/12/08
to Sebastian Sylvan, haskel...@haskell.org
Sebastian Sylvan wrote:
>
> Is there any more (easily-digested, like a paper) information available
> about this? Specifically what things can happen in-place, and future
> extensions...

Apart from the stream fusion papers, unfortunately no, it's all very
much work in progress. Basically, at the moment it will avoid allocating
some unnecessary arrays even if no loop fusion happens. So for instance,
in something like

map f (xs // us)

the two loops can't be fused ((//) is the same update operation as in
Data.Array). Usually, you'd allocate one array for (xs // us) and then
another one for the map. This library will do the map in-place if f
doesn't change the type of the elements. This is pretty important at
least for data-parallel code. I'll have to see how far this scales.

In the future, the fusion system will also be able to handle multiple
directions of traversals and permutations (it can only do left-to-right
traversals at the moment). The "Rewriting Haskell Strings" paper talks a
bit about that but DPH has much more complex requirements so I'll have
to use a different approach which I haven't implemented so far.

Don Stewart

unread,
Jul 12, 2008, 5:25:49 PM7/12/08
to Bulat Ziganshin, haskel...@haskell.org
bulat.ziganshin:

> Hello Roman,
>
> Saturday, July 12, 2008, 7:01:05 PM, you wrote:
>
> > the vector library will eventually provide fast, Int-indexed arrays with
> > a powerful fusion framework.
>
> GREAT! doom4 would be written in Haskell!

Did you know about Cheplyaka's Summer of Code project to build a physics
engine using fusible arrays?

http://physics-dph.blogspot.com/

:)

-- Don

Roman Leshchinskiy

unread,
Jul 14, 2008, 12:30:54 AM7/14/08
to Levi Stephen, haskel...@haskell.org
Levi Stephen wrote:

> On Sun, Jul 13, 2008 at 12:31 AM, Roman Leshchinskiy
> <r...@cse.unsw.edu.au> wrote:
>> Hi all,
>>
>> the vector library will eventually provide fast, Int-indexed arrays with a
>> powerful fusion framework. It's very immature at the moment (I haven't
>> tested most of the code) and implements just a few combinators but I
>> thought releasing early wouldn't hurt. Use at your own risk and expect
>> things to break horribly!
>>
>
> Sounds interesting. How does this compare to the uvector library?

IIUC, uvector is based on an older version of the DPH libraries and only
provides unboxed arrays. On the other hand, it's much more stable and
has more functionality. I expect that the two libraries will be merged
eventually.

Johan Tibell

unread,
Jul 14, 2008, 2:49:05 AM7/14/08
to Roman Leshchinskiy, haskel...@haskell.org
On Mon, Jul 14, 2008 at 6:30 AM, Roman Leshchinskiy <r...@cse.unsw.edu.au> wrote:
> Levi Stephen wrote:
>> Sounds interesting. How does this compare to the uvector library?
>
> IIUC, uvector is based on an older version of the DPH libraries and only
> provides unboxed arrays. On the other hand, it's much more stable and has
> more functionality. I expect that the two libraries will be merged
> eventually.

That would be great indeed.

0 new messages