Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Thanks lin0, that looks interesting.

The MPI standard appears to be distributed processes controlled through function calls and 'sharing' data via tcp. Whilst distinctly non-trivial to implement, in Perl's terms, calling functions that fork processes and pass chunks of data back and forth via sockets is at least 'known technology'. There is some mention of threads in MPI-2, but they (seem) to relate to whether the programs using an MPI implementation can be threaded, and whether they can call the library routines from more than one thread serially or concurrently. Ie. The work is done by forking processes, but those processes might be multi-threaded.

Looking at the OpenMP standard, it appears (at a fairly cursory reading) to use threads and shared memory to do the work. It also specifies that the spawning of threads and the subdivision and sharing of data be done via directives embedded in comments. The idea appears to be that by disabling the directives, the same program shoudl be able to run to completion as a single threaded application. And by enabling them, it completes, but more quickly--assuming the availability of multiple cpus/cores.

The directives bit is easily, if controversially, achievable using a source filter.

The most problematic part is that the API assumes an implicitly-shared memory environment--unlike Perl's iThreads which are explicitly-shared only. The problem is that the directives are geared to indicating to the preprocessor which variables need to be explicitly protected and/or later accumulated.

In Perl's explicitly shared environment, that makes the information provided by the programmer on the directives almost the exact opposite of what is required.

All of that said, as piddles are opaque objects at the perl level may mean that they can be implicitly shared by threads? Also, the fact that piddle slices can be referenced in-place may make the implementation of the parallel for directive easier than it is for perl arrays. I guess the real question is whether the PDL libraries are thread-safe?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: OpenMP from Perl? by BrowserUk
in thread OpenMP from Perl? by cdarke

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found