Popular recipes tagged "parallel"http://code.activestate.com/recipes/tags/parallel/2011-06-12T16:34:12-07:00ActiveState Code RecipesFor AMIGA-Heads Only. PAR: As A VOLUME In READ Mode Only. (Python)
2011-06-12T16:34:12-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577750-for-amiga-heads-only-par-as-a-volume-in-read-mode-/
<p style="color: grey">
Python
recipe 577750
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/parallel/">parallel</a>, <a href="/recipes/tags/parallel_port/">parallel_port</a>, <a href="/recipes/tags/port/">port</a>, <a href="/recipes/tags/read/">read</a>).
</p>
<p>PAR: as a VOLUME in READ mode using Python 1.4 onwards on Classic AMIGAs...</p>
<p>Many years ago Irmen de Jong ported Python to the Classic AMIGA range of
computers, (many thanks Irmen for your time in doing so). The versions were
at least 1.4.x to 2.0.1 and now someone else has included version 2.4.6.</p>
<p>This gives we lowly users of the AMIGA at least a chance to see and use
Python in some guise or another. This code shows how to access the AMIGA
parallel port for 8 bit READ only. This is so that ADCs could be attached to
the port, read by Python code EASILY and utilised as a Data Logger/Transient
Recorder, as just one example.</p>
<p>There needs to be a single HW WIRE link only from the 23 way video port
to the 25 way parallel port for this to work. See the archive......</p>
<p><a href="http://aminet.net/package/docs/hard/PAR_READ" rel="nofollow">http://aminet.net/package/docs/hard/PAR_READ</a></p>
<p>......on how to set about this extremely simple task.</p>
<p>NO knowledge of the parallel port programming is needed at all to grab 8 bit
data from it using Python and other languages; (ARexx is used in the archive
above).</p>
<p>There is a flaw, NOTE:- NOT A BUG!, in the Python code but for this DEMO it
is ignored. ;o)</p>
<p>I'll let all you big guns work out what it is; you will need a good working
knowledge of the Classic AMIGA.</p>
<p>Enjoy finding simple solutions to often very difficult problems. ;o)</p>
<p>This code is Public Domain and you may do with it as you please.</p>
<p>Bazza...</p>
Parallelize your shell commands (Bash)
2010-04-02T00:14:38-07:00Kevin L. Sitzehttp://code.activestate.com/recipes/users/4173535/http://code.activestate.com/recipes/577171-parallelize-your-shell-commands/
<p style="color: grey">
Bash
recipe 577171
by <a href="/recipes/users/4173535/">Kevin L. Sitze</a>
(<a href="/recipes/tags/fifo/">fifo</a>, <a href="/recipes/tags/multiprocessing/">multiprocessing</a>, <a href="/recipes/tags/parallel/">parallel</a>).
Revision 2.
</p>
<p>This script is used to processes a batch job of commands in parallel. The script dispatches new commands up to a user specified limit, each generated from a template provided on the command line using arguments taken from STDIN. The basic combining semantics are similar to "xargs -1", though support for multiple arguments and parallel processing of commands are provided.</p>
Parallel map (Python)
2009-04-02T19:41:10-07:00Miki Tebekahttp://code.activestate.com/recipes/users/4086267/http://code.activestate.com/recipes/576709-parallel-map/
<p style="color: grey">
Python
recipe 576709
by <a href="/recipes/users/4086267/">Miki Tebeka</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/parallel/">parallel</a>).
Revision 3.
</p>
<p>Implementation of parallel map (processes).</p>
<p>This is a Unix only version.</p>
processing.Pool variation which allows multiple threads to send the same requests without incurring duplicate processing (Python)
2008-09-17T17:01:21-07:00david decotignyhttp://code.activestate.com/recipes/users/4129454/http://code.activestate.com/recipes/576462-processingpool-variation-which-allows-multiple-thr/
<p style="color: grey">
Python
recipe 576462
by <a href="/recipes/users/4129454/">david decotigny</a>
(<a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/parallel/">parallel</a>, <a href="/recipes/tags/pool/">pool</a>, <a href="/recipes/tags/processing/">processing</a>, <a href="/recipes/tags/threads/">threads</a>).
Revision 3.
</p>
<p>processing.Pool (<a href="http://pypi.python.org/pypi/processing" rel="nofollow">http://pypi.python.org/pypi/processing</a>) is a nice tool to "parallelize" map() on multiple CPUs.
However, imagine you have X threads which send the same request Pool.map(getNthPrimeNumber, [100000, 10000000, 10000]) at (almost) the same time. Obviously, you don't want to compute X times getNthPrimeNumber for 100000, 10000000, 10000... unless you have 3.X processors available. You would like one thread to submit the 3 requests, and then the X-1 others would notice that the requests have already been submitted and will then just wait for the result.
This is what this code is about: a kind of "trensient memoize" for processing.Pool::imap().</p>