January 08, 2011
Am 08.01.2011 08:47, schrieb "Jérôme M. Berger":
> scorn wrote:
>> Am 06.01.2011 20:20, schrieb Iain Buclaw:
>>> == Quote from scorn (scorn@d.net)'s article
>>>> Am 05.01.2011 21:24, schrieb Iain Buclaw:
>>>>> == Quote from Scorn (scorn@scorn.net)'s article
>>>>>> I too wonder how much work it would be to support OpenMP in gdc. From
>>>>>> http://www.drdobbs.com/high-performance-computing/226300277 it
>>>>>> seems to be
>>> that
>>>>>> there is also quite a lot of magic on the compiler side (but which
>>>>>> could
>>>>> already
>>>>>> be in the gcc parts). Maybe a concurrent garbage collector would
>>>>>> also be
>>> needed
>>>>>> (Leandro Lucarella worked on this for his diploma thesis).
>>>>>> I hope someone can help to clear this up. If not OpenMP then at
>>>>>> least a
>>> better
>>>>>> support for multicore programming in one way or another will be really
>>>>> important
>>>>>> for the future of D.
>>>>>
>>>>> Would take just a little bit of work, yes. ;)
>>>>>
>>>>> Most of the heavy duty work for GCC OMP support is done by their own C
>>>>> parser/internal codegen functions. So to start, will need to rewrite
>>>>> half of
>>> what
>>>>> is there for the DMDFE AST.
>>>> That really sounds tempting. Maybe we should bring this up on the main D
>>>> mailing list (whatever this is (d.learn ?)) for discussion. While this
>>>> might at first be a gdc only solution, having a general, developer
>>>> approved official D syntax for all three compilers (dmd, gdc, ldc) would
>>>> be great.
>>>
>>> Official syntax? Question... why? We already have pragma to perform
>>> compiler-
>>> independent tasks. ie:
>>>
>>> LDC:
>>> pragma(intrinsic, "llvm.frameaddress")
>>>       void* llvm_frameaddress(uint level);
>>>
>>> GDC:
>>> pragma(attribute, optimize("-freg-struct-return"))
>>>       foo getFoo();
>>>
>>> DMD:
>>> pragma(startaddress, foo);
>>>
>>>
>>> A typical hello world application would likely look like this:
>>>
>>>    void main ()
>>>    {
>>>      int th_id, nthreads;
>>>      pragma(omp, parallel private(th_id))
>>>      {
>>>        th_id = omp_get_thread_num();
>>>        writefln("Hello World from thread %d\n", th_id);
>>>        pragma(omp, barrier)
>>>        if ( th_id == 0 ) {
>>>          nthreads = omp_get_num_threads();
>>>          writefln("There are %d threads\n",nthreads);
>>>        }
>>>      }
>>>    }
>>>
>>>
>>> Regards
>>
>> Oh! I didn't know this! Then, what are we waiting for ? :-)
>>
>>
>> With official syntax i meant something like for example the Parallel.For
>> extension of the Microsoft Parallel FX Framework (see:
>> http://pietschsoft.com/post/2007/09/Parallel-FX-Library-Optimize-your-code-for-Multi-Core-machines.aspx
>> for example).
>>
> 	You mean like this:
> foreach(i; pool.parallel( iota(squares.length), 100)) {
>      // Iterate over squares using work units of size 100.
>      squares[i] = i * i;
> }
>


Yes, exactly like that! (Thanks for the hint.)


> 	It is currently under review for D2:
> http://cis.jhu.edu/~dsimcha/d/phobos/std_parallelism.html and
> http://dsource.org/projects/scrapple/browser/trunk/parallelFuture/std_parallelism.d
>
> 		Jerome


Is it already usable ?


If yes, then it would really be a reason for me to switch to D2 now.
January 09, 2011
scorn wrote:
> Am 08.01.2011 08:47, schrieb "Jérôme M. Berger":
>>     You mean like this:
>> foreach(i; pool.parallel( iota(squares.length), 100)) {
>>      // Iterate over squares using work units of size 100.
>>      squares[i] = i * i;
>> }
> 
> Yes, exactly like that! (Thanks for the hint.)
> 
>>     It is currently under review for D2:
>> http://cis.jhu.edu/~dsimcha/d/phobos/std_parallelism.html and
>> http://dsource.org/projects/scrapple/browser/trunk/parallelFuture/std_parallelism.d
>>
> 
> Is it already usable ?
> 
> If yes, then it would really be a reason for me to switch to D2 now.

	I believe so although I have not tried it myself.

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



1 2
Next ›   Last »