openMP

Russel Winder russel at winder.org.uk
Wed Oct 3 01:08:47 PDT 2012


On Tue, 2012-10-02 at 23:13 +0200, Farmer wrote:
> And is there also a pragma omp critical analogon?

No. The D approach in std.parallelism is to offer explicit parallel
constructs that also work on a uniprocessor. The OpenMP approach is to
provide meta-data to allow the compiler to parallelize sequential code.

Although OpenMP is high-profile in the C, C++ and Fortran world, it's
raison d'être is to be able to use sequential code in a parallel
context. Now that C++ has made the jump to using futures and
asynchronous function calls as an integral part of the language, I think
we will see it drift away from the OpenMP style camp much more towards
the TBB style camp. I am not sure if TBB is the right framework, but a
drift twowards frameworks that are parallel first and sequential as a
special case does seem to be on the cards.

SO rather than working with annotation based systems such as OpenMP, I
think D is right to be using parallel map, parallel reduce as functions
rather than seeing explicit iterations. Functional languages have always
had this. Python, Groovy, Ruby, Clojure brought the ideas to mainstream
platforms, as did Scala and C++ (cf. std::foreach). Java 8 will take up
this approach. So library based iteration is with us as the tool for
abstracting away the details. Obviously we will still have explicit
iteration in imperative languages but significantly less than in the
past.

To summarize: OpenMP and parallelizing explicit iteration is backward
looking, library calls parallelizing using implicit iteration is the
future.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121003/7d5c20ac/attachment.pgp>


More information about the Digitalmars-d mailing list