From fontani at gmail.com Wed Dec 1 11:24:35 2010 From: fontani at gmail.com (Marco Fontani) Date: Wed, 1 Dec 2010 19:24:35 +0000 Subject: [Edinburgh-pm] Call for Talks Message-ID: Hello fellow Mongers, I apologise in advance for not having sent this -- as per usual -- two weeks before our next meeting. Our next meeting -- according to the site -- is scheduled for Thursday the 9th of December, in eight days. A number of us have been to the NWE.pm hackaton in Lancaster and some of us will be in London this coming Saturday for the London Perl Workshop. I will likely report on the LPW2010 at our next meeting, and was wondering if anybody else wanted to do a quick presentation on the NWE.pm hackaton as well. Does anybody have any other talks they'd like to bring to the meeting? I have a lightning talk about using Inline::C to make some Perl bits faster (something we discussed at our very first social), and a sneak peek at my FUSE interface to Git, which now sports read/write support for all HEADs and is written in Perl. I hope by next Thursday the snow will have ceased to ruin people's plans, and look forward to hearing from you all soon. 'till next Thursday, -marco- -- Marco Fontani Glasgow Perl Mongers - http://glasgow.pm.org/ Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html From cyocum at gmail.com Sat Dec 4 07:09:39 2010 From: cyocum at gmail.com (Chris Yocum) Date: Sat, 04 Dec 2010 15:09:39 +0000 Subject: [Edinburgh-pm] Christmas Special? Message-ID: <4CFA59B3.90005@gmail.com> Hi Guys, I am not sure if you noticed but there is a non-zero chance of not getting a spot at the pub as the fourth Thursday is the 23rd. In addition, some of our members may be in other parts of the country before then. I was wondering if it might be preferable to move the meeting this month to another date/time so it would be easier? Maybe having a mulled wine evening or some such? Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 294 bytes Desc: OpenPGP digital signature URL: From perl at minty.org Sat Dec 4 07:18:18 2010 From: perl at minty.org (Murray) Date: Sat, 4 Dec 2010 15:18:18 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <4CFA59B3.90005@gmail.com> References: <4CFA59B3.90005@gmail.com> Message-ID: <20101204151817.GO8027@minty.org> On Sat, Dec 04, 2010 at 03:09:39PM +0000, Chris Yocum wrote: > I was wondering if it might be preferable to move the meeting this month > to another date/time so it would be easier? Maybe having a mulled wine > evening or some such? Well, I'm certainly not going to make the 23rd, and my attendance score of late is not trending well. Glasgow.pm next thur, 9th? M. From cyocum at gmail.com Sat Dec 4 07:23:14 2010 From: cyocum at gmail.com (Chris Yocum) Date: Sat, 04 Dec 2010 15:23:14 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <20101204151817.GO8027@minty.org> References: <4CFA59B3.90005@gmail.com> <20101204151817.GO8027@minty.org> Message-ID: <4CFA5CE2.2050303@gmail.com> On 04/12/10 15:18, Murray wrote: > On Sat, Dec 04, 2010 at 03:09:39PM +0000, Chris Yocum wrote: >> I was wondering if it might be preferable to move the meeting this month >> to another date/time so it would be easier? Maybe having a mulled wine >> evening or some such? > > Well, I'm certainly not going to make the 23rd, and my attendance score > of late is not trending well. > > Glasgow.pm next thur, 9th? I am still looking for a job at the moment so I can't really afford to go to Glasgow :( Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 294 bytes Desc: OpenPGP digital signature URL: From miles at assyrian.org.uk Mon Dec 6 09:57:48 2010 From: miles at assyrian.org.uk (Miles Gould) Date: Mon, 6 Dec 2010 17:57:48 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <4CFA59B3.90005@gmail.com> References: <4CFA59B3.90005@gmail.com> Message-ID: <20101206175748.GC12109@assyrian.org.uk> Are you perhaps offering to host such an event at your flat on the third Thursday of the month? If so, I would be delighted to attend :-) [Failing that, I'll see some of you at Glasgow.pm this Thursday.] Miles -- I was hoping that the London Mathematical Society could fund it, in conjunction with Miramax. -- Richard Vale From cyocum at gmail.com Mon Dec 6 10:05:47 2010 From: cyocum at gmail.com (Chris Yocum) Date: Mon, 06 Dec 2010 18:05:47 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <20101206175748.GC12109@assyrian.org.uk> References: <4CFA59B3.90005@gmail.com> <20101206175748.GC12109@assyrian.org.uk> Message-ID: <4CFD25FB.7010308@gmail.com> I could do that. I can get fixings for mulled wine, etc. Chris On 06/12/10 17:57, Miles Gould wrote: > Are you perhaps offering to host such an event at your flat on the third > Thursday of the month? If so, I would be delighted to attend :-) > > [Failing that, I'll see some of you at Glasgow.pm this Thursday.] > > Miles > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: From miles at assyrian.org.uk Mon Dec 6 10:07:29 2010 From: miles at assyrian.org.uk (Miles Gould) Date: Mon, 6 Dec 2010 18:07:29 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <4CFD25FB.7010308@gmail.com> References: <4CFA59B3.90005@gmail.com> <20101206175748.GC12109@assyrian.org.uk> <4CFD25FB.7010308@gmail.com> Message-ID: <20101206180729.GE12109@assyrian.org.uk> On Mon, Dec 06, 2010 at 06:05:47PM +0000, Chris Yocum wrote: > I could do that. I can get fixings for mulled wine, etc. Yeah, I was thinking you provide spices and saucepan, everyone else brings a bottle (perhaps from the Scotmid ~50m down the street). Miles -- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. -- Robert A. Heinlein From cyocum at gmail.com Mon Dec 6 11:06:19 2010 From: cyocum at gmail.com (Chris Yocum) Date: Mon, 06 Dec 2010 19:06:19 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <20101206180729.GE12109@assyrian.org.uk> References: <4CFA59B3.90005@gmail.com> <20101206175748.GC12109@assyrian.org.uk> <4CFD25FB.7010308@gmail.com> <20101206180729.GE12109@assyrian.org.uk> Message-ID: <4CFD342B.7070107@gmail.com> Cool. I can do that. I need to talk to gf but it shouldn't be a problem. Chris On 06/12/10 18:07, Miles Gould wrote: > On Mon, Dec 06, 2010 at 06:05:47PM +0000, Chris Yocum wrote: >> I could do that. I can get fixings for mulled wine, etc. > > Yeah, I was thinking you provide spices and saucepan, everyone else > brings a bottle (perhaps from the Scotmid ~50m down the street). > > Miles > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: From fontani at gmail.com Thu Dec 9 02:52:12 2010 From: fontani at gmail.com (Marco Fontani) Date: Thu, 9 Dec 2010 10:52:12 +0000 Subject: [Edinburgh-pm] Call for Talks In-Reply-To: References: Message-ID: > Our next meeting -- according to the site -- is scheduled for Thursday > the 9th of December, in eight days. That will be today ;) Due to the adverse weather conditions, I was wondering if anybody other than Miles was coming today :) Many have suggested we postpone our meeting, I just wanted to hear your thoughts. Looking forward to hearing from you soon -marco- -- Marco Fontani Glasgow Perl Mongers - http://glasgow.pm.org/ Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html From fontani at gmail.com Thu Dec 9 04:27:20 2010 From: fontani at gmail.com (Marco Fontani) Date: Thu, 9 Dec 2010 12:27:20 +0000 Subject: [Edinburgh-pm] [Glasgow.pm] Re: Call for Talks In-Reply-To: References: Message-ID: Two/three already mentioned they can't make it... All in favour of calling it quits for this month, and meeting again in the beginning of January? More time to prepare talks ;) -marco- -- Marco Fontani Glasgow Perl Mongers - http://glasgow.pm.org/ Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html From fontani at gmail.com Thu Dec 9 04:35:23 2010 From: fontani at gmail.com (Marco Fontani) Date: Thu, 9 Dec 2010 12:35:23 +0000 Subject: [Edinburgh-pm] [Glasgow.pm] Re: Call for Talks In-Reply-To: References: Message-ID: http://glasgow.pm.org/ meeting's off, updated website. I will be e-mailing again before the New Year. Looking forward to seeing you soon -marco- -- Marco Fontani Glasgow Perl Mongers - http://glasgow.pm.org/ Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html From cyocum at gmail.com Fri Dec 10 08:11:18 2010 From: cyocum at gmail.com (Chris Yocum) Date: Fri, 10 Dec 2010 16:11:18 +0000 Subject: [Edinburgh-pm] Christmas Special? In-Reply-To: <4CFD342B.7070107@gmail.com> References: <4CFA59B3.90005@gmail.com> <20101206175748.GC12109@assyrian.org.uk> <4CFD25FB.7010308@gmail.com> <20101206180729.GE12109@assyrian.org.uk> <4CFD342B.7070107@gmail.com> Message-ID: <4D025126.1050308@gmail.com> Ok, I talked to gf about it and all is fine. So this coming Thursday (Dec 16), I will be holding a mulled wine event at my flat at 8pm. Please remember that space is limited in my flat and I have neighbours to think about. The idea is that I will have the spices and you will bring the wine. Also, if someone could bring rum just in case someone wants to have it in their wine. Thanks! Please RSVP ASAP so I can control the numbers. Thanks!, Chris On 06/12/10 19:06, Chris Yocum wrote: > Cool. I can do that. I need to talk to gf but it shouldn't be a problem. > > Chris > > On 06/12/10 18:07, Miles Gould wrote: >> On Mon, Dec 06, 2010 at 06:05:47PM +0000, Chris Yocum wrote: >>> I could do that. I can get fixings for mulled wine, etc. >> >> Yeah, I was thinking you provide spices and saucepan, everyone else >> brings a bottle (perhaps from the Scotmid ~50m down the street). >> >> Miles >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 294 bytes Desc: OpenPGP digital signature URL: From wim.vanderbauwhede at gmail.com Mon Dec 13 12:15:09 2010 From: wim.vanderbauwhede at gmail.com (Wim Vanderbauwhede) Date: Mon, 13 Dec 2010 20:15:09 +0000 Subject: [Edinburgh-pm] parallel semantics in perl Message-ID: Hi folks, I'm looking into a way to run Perl on a manycore or multiprocessor system without visible threads or forks. To do so I want to assume parallel evaluation, i.e. all independent statements in a block or function argument list are evaluated in parallel. Similarly, loops are sequential; but in many cases they can be unrolled and evaluated in parallel. However, the programmer might want to control this behaviour. So my question is, what would be an acceptable way of "overloading" Perl semantics to indicate sequential evaluation? For example, whereas statements in a bare {...} block will be evaluated in parallel, a do {...} could mean sequential evaluation. A "foreach" in full could be parallel, a "for" sequential. Any ideas/suggestion about this, e.g. how would you indicate that "map" should be sequential, etc? I obviously don't want to add new constructs to Perl 5. Wim From perl at aaroncrane.co.uk Mon Dec 13 16:38:30 2010 From: perl at aaroncrane.co.uk (Aaron Crane) Date: Tue, 14 Dec 2010 00:38:30 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: Wim Vanderbauwhede wrote: > For example, whereas statements in a bare {...} block will be > evaluated in parallel, a do {...} could mean sequential evaluation. A > "foreach" in full could be parallel, a "for" sequential. Any > ideas/suggestion about this, e.g. how would you indicate that "map" > should be sequential, etc? I obviously don't want to add new > constructs to Perl 5. My initial inclination is to disagree with your premise: I think that, for example, sequential map and parallel map are different enough that they should have different names. In particular, I really dislike the idea of giving `for` and `foreach` different semantics; that strikes me as likely to yield really confusing code. (And I think that, of the two of them, I'd naturally read `foreach` as being sequential rather than parallel ? exactly the opposite of what you suggest.) Nonetheless, if you're set on that approach, perhaps a lexical pragma would do you what you want. I haven't really worked out any details, but something like this seems plausible: { use parallel qw<:all>; my @out = map { pure_function($_) } @in; no parallel qw; my @out2 = map { side_effecting_function($_) } @in2; for (@in3) { # This still happens in parallel frob($_) if is_interesting($_); } } The obvious problem with that is that putting just one sequential loop or map into mostly-parallel code takes an annoying amount of boilerplate. But it's possible to construe that as a feature ? additional encouragement for writing parallel code. Though, on the gripping hand, anyone who wants lots of sequential maps can easily say sub seqmap (&@) { my $code = shift; no parallel qw; return map &$code, @_; } Either way, I'll definitely be interested to see what you come up with ? sounds like an interesting project! -- Aaron Crane ** http://aaroncrane.co.uk/ From fontani at gmail.com Tue Dec 14 01:23:52 2010 From: fontani at gmail.com (Marco Fontani) Date: Tue, 14 Dec 2010 09:23:52 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: > However, the programmer might want to control this behaviour. So my > question is, what would be an acceptable way of "overloading" Perl > semantics to indicate sequential evaluation? I think the acceptable way would be to _not_ overload them; see below. > For example, whereas statements in a bare {...} block will be > evaluated in parallel, ?a do {...} could mean sequential evaluation. A > "foreach" in full could be parallel, a "for" sequential. foreach and for are the same thing really $ perl -MO=Deparse -e 'foreach($i=0;$i<10;$i++){ print $i }' for ($i = 0; $i < 10; ++$i) { print $i; } -e syntax OK $ perl -MO=Deparse -e '@a=1..5;for(@a){print};foreach(@a){print}' @a = 1..5; foreach $_ (@a) { print $_; } foreach $_ (@a) { print $_; } -e syntax OK > Any > ideas/suggestion about this, e.g. how would you indicate that "map" > should be sequential, etc? > I obviously don't want to add new constructs to Perl 5. I think you do. At the LPW2010 Paul Evans presented his CPS module (http://search.cpan.org/dist/CPS/lib/CPS.pm), which attempts to "do stuff" in Continuation Passing Style. Basically you have new "kmap", "kfoldl", "kfor" keywords which DWYW without changing the "usual" Perl semantics. You may want to go the same path: having a "pfor", a "pwhile" and "pmap" rather than overloading the for, while etc. would mean that one would know at-a-glance whether a certain block is executed in parallel or not. It would give you the best of both worlds: - the programmer would be able to use the parallel version _or_ the standard version, at will - the programmer would still be able to keep specific stuff from running in parallel (fors within fors?) Since some *may* want instead to say, "all for/while/map in this _scope_ are to be done in parallel", you may want to introduce something similar to Aaron's suggested "use parallel" and "no parallel" to import your parallel functions, locally, as the real for/while/map, just only within the declared scope. What are your thoughts? -marco- -- Marco Fontani ---- Glasgow Perl Mongers - http://glasgow.pm.org/ Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html From wim.vanderbauwhede at gmail.com Tue Dec 14 02:30:49 2010 From: wim.vanderbauwhede at gmail.com (Wim Vanderbauwhede) Date: Tue, 14 Dec 2010 10:30:49 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: Thanks Aaron and Marco, Your suggestions are really helpful, thank sa lot! In fact, I too dislike overloading do {} and for/foreach. So I'd rather have another approach. On the other hand I don't want new commands/keywords because they might put people off, so I'm not in favour of things like "pmap" -- even though they would make my life as compiler writer much easier :-) I think the "use parallel qw<...>; " is the way to go, as it is very close to my current approach in my Gannet-C language, which is to mark blocks with a keyword par or seq. Maybe I could have a pragma "seq" instead, as the default would be to try parallel evaluation. Pragmas are lexically scoped, aren't they? So I could write { use seq qw; foreach my $i (1..$n) { } } and only the foreach in that block will be sequential, right? ( This is not quite the same as I have in my current language, I would need attribute support on blocks for that -- anyone ever mentioned something like that? That would be ideal: foreach my $i (1..$n) :seq { } would be neat, but AFAICT these are only supported on subs... ) I didn't know about qw<:all>. Are there others apart from :all, (I just came across a mention of ":default") or can I implement my own? Problem with something like this is that you can't google it, so any pointer to the perldoc would be much appreciated. Cheers, WIm On 14 December 2010 09:23, Marco Fontani wrote: >> However, the programmer might want to control this behaviour. So my >> question is, what would be an acceptable way of "overloading" Perl >> semantics to indicate sequential evaluation? > > I think the acceptable way would be to _not_ overload them; see below. > >> For example, whereas statements in a bare {...} block will be >> evaluated in parallel, ?a do {...} could mean sequential evaluation. A >> "foreach" in full could be parallel, a "for" sequential. > > foreach and for are the same thing really > > $ perl -MO=Deparse -e 'foreach($i=0;$i<10;$i++){ print $i }' > for ($i = 0; $i < 10; ++$i) { > ? ?print $i; > } > -e syntax OK > > $ perl -MO=Deparse -e '@a=1..5;for(@a){print};foreach(@a){print}' > @a = 1..5; > foreach $_ (@a) { > ? ?print $_; > } > foreach $_ (@a) { > ? ?print $_; > } > -e syntax OK > >> Any >> ideas/suggestion about this, e.g. how would you indicate that "map" >> should be sequential, etc? >> I obviously don't want to add new constructs to Perl 5. > > I think you do. > > At the LPW2010 Paul Evans presented his CPS module > (http://search.cpan.org/dist/CPS/lib/CPS.pm), which attempts to "do > stuff" in Continuation Passing Style. Basically you have new "kmap", > "kfoldl", "kfor" keywords which DWYW without changing the "usual" Perl > semantics. > > You may want to go the same path: having a "pfor", a "pwhile" and > "pmap" rather than overloading the for, while etc. would mean that one > would know at-a-glance whether a certain block is executed in parallel > or not. > > It would give you the best of both worlds: > - the programmer would be able to use the parallel version _or_ the > standard version, at will > - the programmer would still be able to keep specific stuff from > running in parallel (fors within fors?) > > Since some *may* want instead to say, "all for/while/map in this > _scope_ are to be done in parallel", you may want to introduce > something similar to Aaron's suggested "use parallel" and "no > parallel" to import your parallel functions, locally, as the real > for/while/map, just only within the declared scope. > > What are your thoughts? > > -marco- > > -- > Marco Fontani > > ---- > Glasgow Perl Mongers - http://glasgow.pm.org/ > Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html > -- If it's pointless, what's the point? If there is a point to it, what's the point? (Tibor Fischer, "The Thought Gang") From perl at aaroncrane.co.uk Tue Dec 14 02:49:41 2010 From: perl at aaroncrane.co.uk (Aaron Crane) Date: Tue, 14 Dec 2010 10:49:41 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: Wim Vanderbauwhede wrote: > Maybe I could have a pragma "seq" > instead, as the default would be to try parallel evaluation. > Pragmas are lexically scoped, aren't they? Yes; `perldoc perlpragma`. (Technically, you can write pragma-like modules which have a non-lexical effect; but I don't think that's what you were asking.) > So I could write > > { use seq qw; > ? ?foreach my $i (1..$n) { > > ? ?} > } > > and only the foreach in that block will be sequential, right? Yes. > This is not quite the same as I have in my current language, I would > need attribute support on blocks for that -- anyone ever mentioned > something like that? That would be ideal: > > ? ?foreach my $i (1..$n) :seq { > > ? ?} > > would be neat, but AFAICT these are only supported on subs... I don't think I've ever seen a proposal for that. It looks initially tempting; there's certainly a syntactic slot available where an attribute-like thing could go. It's hard to see how you'd make it work for statement-modifier `for`, though. > I didn't know about qw<:all>. Are there others apart from :all, (I > just came across a mention of ":default") or can I implement my own? If you implement your own `import` routine, you can treat the arguments to `use` in any way that makes sense for your module; see `perldoc perlmod`. Colon-prefixed words are treated by Exporter as identifying "tags" for arbitrary sets of names; `:all` is conventionally a tag identifying everything you're willing to export. -- Aaron Crane ** http://aaroncrane.co.uk/ From miles at assyrian.org.uk Tue Dec 14 02:51:03 2010 From: miles at assyrian.org.uk (Miles Gould) Date: Tue, 14 Dec 2010 10:51:03 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: <20101214105103.GT28936@assyrian.org.uk> On Mon, Dec 13, 2010 at 08:15:09PM +0000, Wim Vanderbauwhede wrote: > I'm looking into a way to run Perl on a manycore or multiprocessor > system without visible threads or forks. To do so I want to assume > parallel evaluation, i.e. all independent statements in a block or > function argument list are evaluated in parallel. Similarly, loops are > sequential; but in many cases they can be unrolled and evaluated in > parallel. I'm not quite sure what you're asking. I see three possibilities: 1) Within each block, build up use-def chains, and try to run every set of nonorderable statements in parallel. Side-effecting builtins like "print" (but not, say, "open", because that's treated as a variable definition) dominate every statement that's after them in a lexical block, and purity of function calls is determined recursively. This may make no sense: I'd have to think about it harder. And really, if autoparallelisation were this easy, someone would have solved the problem by now. Thinking a /little/ bit harder: references and aliasing kill you here. But reference-heavy code is much rarer in Perl than it is in (to pick an example /purely/ at random) C++, so this might actually be somewhat useful, given a really good test suite. 2) Treat /blocks/ as sequential, but by default run different /invocations/ of blocks parallelly. So if I write, say, foreach my $flintstone (qw/Fred Barney Betty Wilma Bamm-bamm Dino Pebbles/) { my $surname = surname($flintstone); say "Yabba-dabba-doo, $flintstone $surname!"; } then the assignment to $surname would always happen before the corresponding call to "say", but Fred's block would run in parallel with Barney's block, and so on. 3) As above, but only run invocations in parallel if the user has annotated them in some way. > For example, whereas statements in a bare {...} block will be > evaluated in parallel, a do {...} could mean sequential evaluation. A > "foreach" in full could be parallel, a "for" sequential. In common with everyone else, I really hate this idea :-) I like Aaron's lexically-scoped pragma idea; failing that, I'd suggest simply adding "pfor", "pdo", "pgrep" keywords (or "sfor", "sdo" etc for option 2). Miles -- for life is not a paragraph and death i think is no parenthesis -- e e cummings From oinksocket at letterboxes.org Tue Dec 14 03:04:41 2010 From: oinksocket at letterboxes.org (Nick) Date: Tue, 14 Dec 2010 11:04:41 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: References: Message-ID: <4D074F49.3010204@letterboxes.org> On 13/12/10 20:15, Wim Vanderbauwhede wrote: > I'm looking into a way to run Perl on a manycore or multiprocessor > system without visible threads or forks. Are you interested in syntax or implementation? I'm guessing the former. Anyway, Google finds this - I've not read this in detail, but it may be relevant. Perhaps you've already read it. http://www.dagolden.com/index.php/935/parallel-map-with-paralleliterator/ It works like this. use Parallel::Iterator qw; my @result = iterate_as_array( $worker_sub, @list ); Presumably it could also easily work like this (using a (&) subroutine prototype, i.e. sub iterate_as_array(&@) { ... } ): my @result = iterate_as_array { stuff_here($_) } @list; Or even, with a bit of Devel::Declare'ation, and dropping the assignment to @result, you *might* be able to: use Parallel qw; for_each my $i (@list) :par { stuff_here($i); } Where for_each is still ultimately despatched to a function. Unfortunately I believe Devel::Declare has a performance penalty, as well as being bleeding edge and a bit complicated. N From wim.vanderbauwhede at gmail.com Tue Dec 14 04:35:54 2010 From: wim.vanderbauwhede at gmail.com (Wim Vanderbauwhede) Date: Tue, 14 Dec 2010 12:35:54 +0000 Subject: [Edinburgh-pm] parallel semantics in perl In-Reply-To: <20101214105103.GT28936@assyrian.org.uk> References: <20101214105103.GT28936@assyrian.org.uk> Message-ID: Hi all, Thanks again for all your answers I should maybe give a little bit more information on my proposed approach, rather than just ask for syntax suggestions. I'm not attempting to solve the autoparallelisation problem, all I want is an easier way to write programs for manycore/multiprocessor machines (fsvo easy). My approach is essentially to split the code in computational parts and communication/control parts. The computational part runs sequentially, computations will have to be handled by Perl objects. The communication code is the one that does parallel evaluation. So it is not my intention to support all of Perl for that part of the code. You'll be free to add support for your favourite constructs as soon as I get it on GitHub (which hopefully is next week). Some of you were at my Gannet talk at ICSA, well I simply use a subset of Perl as a high-level language for Gannet. It gets compiled into a minimal functional language with stream support (Gannet). I already have a PoC of the parser. The computational parts will be run on embedded Perl interpreters at every core (most likely using libperl++, other suggestions welcome). Obviously if someone writes code with a sequential shared-memory mental model, performance will be lousy, but if you take the trouble to adopt a dataflow model, you can get very good performance. My motivation is for applications such as BioPerl: lots of people write stuff in Perl, and if they have access to a big machine it could go really fast without needing a rewrite in C. Posting my idea on this list is definitely a great reality check :-) Cheers, Wim On 14 December 2010 10:51, Miles Gould wrote: > On Mon, Dec 13, 2010 at 08:15:09PM +0000, Wim Vanderbauwhede wrote: >> I'm looking into a way to run Perl on a manycore or multiprocessor >> system without visible threads or forks. To do so I want to assume >> parallel evaluation, i.e. all independent statements in a block or >> function argument list are evaluated in parallel. Similarly, loops are >> sequential; but in many cases they can be unrolled and evaluated in >> parallel. > > I'm not quite sure what you're asking. I see three possibilities: > > 1) Within each block, build up use-def chains, and try to run every set > of nonorderable statements in parallel. Side-effecting builtins like > "print" (but not, say, "open", because that's treated as a variable > definition) dominate every statement that's after them in a lexical > block, and purity of function calls is determined recursively. > > This may make no sense: I'd have to think about it harder. And really, > if autoparallelisation were this easy, someone would have solved the > problem by now. > > Thinking a /little/ bit harder: references and aliasing kill you here. > But reference-heavy code is much rarer in Perl than it is in (to pick an > example /purely/ at random) C++, so this might actually be somewhat > useful, given a really good test suite. > > 2) Treat /blocks/ as sequential, but by default run different > /invocations/ of blocks parallelly. So if I write, say, > > foreach my $flintstone (qw/Fred Barney Betty Wilma Bamm-bamm Dino Pebbles/) { > ? ? ? ?my $surname = surname($flintstone); > ? ? ? ?say "Yabba-dabba-doo, $flintstone $surname!"; > } > > then the assignment to $surname would always happen before the > corresponding call to "say", but Fred's block would run in parallel with > Barney's block, and so on. > > 3) As above, but only run invocations in parallel if the user has > annotated them in some way. > >> For example, whereas statements in a bare {...} block will be >> evaluated in parallel, ?a do {...} could mean sequential evaluation. A >> "foreach" in full could be parallel, a "for" sequential. > > In common with everyone else, I really hate this idea :-) I like Aaron's > lexically-scoped pragma idea; failing that, I'd suggest simply adding > "pfor", "pdo", "pgrep" keywords (or "sfor", "sdo" etc for option 2). > > Miles > > -- > for life is not a paragraph and death i think is no parenthesis > ?-- e e cummings > _______________________________________________ > Edinburgh-pm mailing list > Edinburgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/edinburgh-pm > -- If it's pointless, what's the point? If there is a point to it, what's the point? (Tibor Fischer, "The Thought Gang") From cyocum at gmail.com Tue Dec 14 07:22:00 2010 From: cyocum at gmail.com (Chris Yocum) Date: Tue, 14 Dec 2010 15:22:00 +0000 Subject: [Edinburgh-pm] Christmas Mulled Wine In-Reply-To: References: <20101214105103.GT28936@assyrian.org.uk> Message-ID: <4D078B98.5010505@gmail.com> Hi Guys, This is just a reminder that I am having a mulled wine night at my flat. If you could RSVP, that would be great. Bring a bottle of wine and come to mine around 8pm on Thursday. Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: From robrwo at gmail.com Tue Dec 14 09:01:36 2010 From: robrwo at gmail.com (Robert Rothenberg) Date: Tue, 14 Dec 2010 17:01:36 +0000 Subject: [Edinburgh-pm] Fwd: Don Knuth BCS/IET Annual Turing Lecture 2011 Message-ID: <4D07A2F0.6050903@gmail.com> -------- Original Message -------- To: lfcs-interest at inf.ed.ac.uk Subject: Don Knuth BCS/IET Annual Turing Lecture 2011 Dear all, In case you aren't aware, Don Knuth will give a talk in Glasgow on February 10th as part of the BCS Turing lecture series for 2011. His talk in London is already fully booked. You can book a ticket at the link below. http://www.bcs.org/server.php?show=nav.14335 From miles at assyrian.org.uk Tue Dec 14 09:26:49 2010 From: miles at assyrian.org.uk (Miles Gould) Date: Tue, 14 Dec 2010 17:26:49 +0000 Subject: [Edinburgh-pm] Fwd: Don Knuth BCS/IET Annual Turing Lecture 2011 In-Reply-To: <4D07A2F0.6050903@gmail.com> References: <4D07A2F0.6050903@gmail.com> Message-ID: <20101214172648.GB28936@assyrian.org.uk> On Tue, Dec 14, 2010 at 05:01:36PM +0000, Robert Rothenberg wrote: > You can book a ticket at the link below. > http://www.bcs.org/server.php?show=nav.14335 Alternative (apparently more convenient) link: http://www.dcs.gla.ac.uk/knuth/ Note that registration is free but (with probability 1) required. Post-talk crash space in my flat is currently booking up fast. Miles -- The way to a man's heart is through his chest. -- Anon From perl at aaroncrane.co.uk Tue Dec 14 09:26:36 2010 From: perl at aaroncrane.co.uk (Aaron Crane) Date: Tue, 14 Dec 2010 17:26:36 +0000 Subject: [Edinburgh-pm] Fwd: Don Knuth BCS/IET Annual Turing Lecture 2011 In-Reply-To: <4D07A2F0.6050903@gmail.com> References: <4D07A2F0.6050903@gmail.com> Message-ID: Robert Rothenberg forwarded: >> Don Knuth will give a talk in Glasgow on >> February 10th as part of the BCS Turing lecture series for 2011. His >> talk in London is already fully booked. >> >> You can book a ticket at the link below. >> http://www.bcs.org/server.php?show=nav.14335 Thanks, Rob ? that sounds great. For the benefit of any other BCS non-members trying to register for a free ticket: their website does not work. They want you to register for a website account, and the details they ask for include your postal address (for no good reason that I can see). Rather than let you type your address directly, they force you through a postcode-based address finder ? but it generates (well-formed) addresses which their own client-side validation system rejects as invalid. FAIL. Anyway, I suggest turning off Javascript while you're actually registering. Once you've got the "you're now registered" email, you can turn it back on again, log in, and go through the ridiculously complex ticket-booking process. -- Aaron Crane ** http://aaroncrane.co.uk/ From miles at assyrian.org.uk Tue Dec 14 09:30:28 2010 From: miles at assyrian.org.uk (Miles Gould) Date: Tue, 14 Dec 2010 17:30:28 +0000 Subject: [Edinburgh-pm] Fwd: Don Knuth BCS/IET Annual Turing Lecture 2011 In-Reply-To: References: <4D07A2F0.6050903@gmail.com> Message-ID: <20101214173027.GC28936@assyrian.org.uk> On Tue, Dec 14, 2010 at 05:26:36PM +0000, Aaron Crane wrote: > Anyway, I suggest turning off Javascript while you're actually > registering. Once you've got the "you're now registered" email, you > can turn it back on again, log in, and go through the ridiculously > complex ticket-booking process. Or use the http://www.dcs.gla.ac.uk/knuth/register.cfm link, which avoids this step. Miles -- Any bloody idiot can be uncomfortable. -- Royal Marines survival training maxim From rory.macdonald at gmail.com Tue Dec 14 09:37:17 2010 From: rory.macdonald at gmail.com (Rory Macdonald) Date: Tue, 14 Dec 2010 17:37:17 +0000 Subject: [Edinburgh-pm] Fwd: Don Knuth BCS/IET Annual Turing Lecture 2011 In-Reply-To: <4D07A2F0.6050903@gmail.com> References: <4D07A2F0.6050903@gmail.com> Message-ID: Shame BCS didn't bother testing the registration steps on Safari (5.0.2) - sigh. On 14 December 2010 17:01, Robert Rothenberg wrote: > > > -------- Original Message -------- > To: lfcs-interest at inf.ed.ac.uk > Subject: Don Knuth BCS/IET Annual Turing Lecture 2011 > > > Dear all, > > In case you aren't aware, Don Knuth will give a talk in Glasgow on > February 10th as part of the BCS Turing lecture series for 2011. His > talk in London is already fully booked. > > You can book a ticket at the link below. > http://www.bcs.org/server.php?show=nav.14335 > > > _______________________________________________ > Edinburgh-pm mailing list > Edinburgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/edinburgh-pm >