On Fri, Jul 31, 2009 at 10:40 AM, Eric<[email protected]> wrote: > > I tried to import clojure.parallel today and it didn't work. It > couldn't find forkjoin.ParallelArray > > So I went hunting for it and it doesn't exist. There is a > extra166y.ParallelArray. In fact, all of the names imported were in > extra166y. So I changed the line in parallel to reflect that. > > (import '(jsr166y.forkjoin ParallelArray ParallelArrayWithBounds > ParallelArrayWithFilter > ParallelArrayWithMapping > Ops$Op Ops$BinaryOp Ops$Reducer Ops > $Predicate Ops$BinaryPredicate > Ops$IntAndObjectPredicate Ops > $IntAndObjectToObject)) > > changed to > > (import '(extra166y ParallelArray ParallelArrayWithBounds > ParallelArrayWithFilter > ParallelArrayWithMapping > Ops$Op Ops$BinaryOp Ops$Reducer Ops > $Predicate Ops$BinaryPredicate > Ops$IntAndObjectPredicate Ops > $IntAndObjectToObject)) > > > This seems to fix it.
You are right, ParallelArray has moved, but more important, isn't going to make it into Java 7. Due to that, and some prodding to look at the latest ForkJoin, I've started work on implementing parallel algorithms right on the Clojure persistent data structures using the lower-lever ForkJoin primitives. The work is in the 'par' branch on GitHub: http://github.com/richhickey/clojure/tree/par You'll need the jsr166y.jar I have built, placed in the same directory as build.xml: http://cloud.github.com/downloads/richhickey/clojure/jsr166y.jar And be building and running with Java 6. Right now there is just pvmap and pvreduce, both in the clojure.par namespace. Both take (Clojure) vectors, and, unlike pmap, are quite fast even for relatively small operations, i.e. (pvmap inc v) should be faster than (map inc v) for large vectors on multicore machines. The nice thing is pvmap returns a Clojure vector, so no need for the special data structures as with the older parallel library. The results are quite promising, and I look forward to implementing many parallel operations on Clojure's vectors and maps, and providing the tools for you to write your own. Feedback welcome, Rich --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
