[phobos] Parallelism in Phobos

Andrei Alexandrescu andrei at erdani.com
Sun Sep 5 00:08:46 PDT 2010


I think both are wrong for different reasons. Did you file them to 
Bugzilla already?

Andrei

On 07/31/2010 11:45 PM, David Simcha wrote:
> Also, the following doesn't compile:
>
> class Foo {
>
>      shared void bar() {}
> }
>
> void main() {
>      shared(void delegate()) d;
>      auto foo = new Foo;
>      d = &foo.bar;
> }
>
> Error: cannot implicitly convert expression (&foo.bar) of type void
> delegate() to shared(void delegate())
>
> But the following does:
>
> class Foo {
>
>      void bar() {}
> }
>
> void main() {
>      shared(void delegate()) d;
>      auto foo = new Foo;
>      d = &foo.bar;
> }
>
> If these are just plain bugs, let me know and I'll file them in
> Bugzilla, but right now I feel like they're more likely my lack of
> understanding of shared.
>
>
> On 7/31/2010 7:31 AM, Andrei Alexandrescu wrote:
>> Hello,
>>
>> Here's a belated answer to your question (hectic times prevented me
>> from tending to non-urgent email).
>>
>> I think a parallel library would be great to have as indeed phobos is
>> geared at general concurrency. Such a lib would also expose bugs and
>> weaknesses in our model and its implementation.
>>
>> Andrei
>>
>> Sent by shouting through my showerhead.
>>
>> On May 30, 2010, at 12:54 PM, David Simcha <dsimcha at gmail.com
>> <mailto:dsimcha at gmail.com>> wrote:
>>
>>> I have a few questions/comments about the possible inclusion of a
>>> library for parallelism in Phobos:
>>>
>>> 1.  What is the status of std.concurrency?  It's in the source tree,
>>> but it's not in the documentation or the changelogs.  It appears to
>>> have been checked in quietly ~3 months ago, and I just noticed now.
>>>
>>> 2.  From reading the description of std.concurrency in TDPL it seemed
>>> more geared toward concurrency (i.e. making stuff appear to be
>>> happening simultaneously, useful for things like GUIs and servers)
>>> rather than parallelism (i.e. the use of multiple CPU cores to
>>> increase throughput, useful for things like scientific computing and
>>> video encoding).  It seems fairly difficult (though I haven't tried
>>> yet) to write code that's designed for pull-out-all-stops maximal
>>> performance on a multicore machine, especially since immutability is
>>> somewhat of a straight jacket.  I find implicit sharing and the use
>>> of small synchronized blocks or atomic ops to be very useful in
>>> writing parallel programs.
>>>
>>> 3.  Most code where parallelism, as opposed to concurrency, is the
>>> goal (at least most that I write) is parallelized in one or two
>>> small, performance critical sections, and the rest is written
>>> serially.  Therefore, it's easy to reason about things and safety
>>> isn't as important as the case of concurrency-oriented multithreading
>>> over large sections of code.
>>>
>>> 4.  I've been eating my own dogfood for awhile on my ParallelFuture
>>> library.  (http://cis.jhu.edu/~dsimcha/parallelFuture.html
>>> <http://cis.jhu.edu/%7Edsimcha/parallelFuture.html>;
>>> http://dsource.org/projects/scrapple/browser/trunk/parallelFuture/parallelFuture.d)
>>> It's geared toward throughput-oriented parallelism on multicore
>>> machines, not concurrency for GUIs, servers, etc. and is higher level
>>> than std.concurrency.  Is there any interest in including something
>>> like this in Phobos?  If so, would we try to make it fit into the
>>> explicit-sharing-only model, or treat it as an alternative method of
>>> multithreading geared towards pull-out-all-stops parallelism on
>>> multicore computers?
>>>
>>> One last note:  Walter claimed a while back on the NG that
>>> Parallelfuture doesn't compile.  I use it regularly and it compiles
>>> for me.  Walter, can you please point out what the issue was?
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com <mailto:phobos at puremagic.com>
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>>
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list