[python-uk] Multicore Kamaelia

Michael ms at cerenity.org
Sun Mar 16 02:00:30 CET 2008


Hi!


I've added some experimental multicore work in Kamaelia's /Sketches area
today. It allows you to take the following code:

Pipeline(
                Textbox(position=(20, 340),
                                 text_height=36,
                                 screen_width=900,
                                 screen_height=400,
                                 background_color=(130,0,70),
                                 text_color=(255,255,255)),
                TextDisplayer(position=(20, 90),
                                        text_height=36,
                                        screen_width=400,
                                        screen_height=540,
                                        background_color=(130,0,70),
                                        text_color=(255,255,255))
                )

... and make it run multicore as follows:

    ProcessPipeline(
                Textbox(position=(20, 340),
                                 text_height=36,
                                 screen_width=900,
                                 screen_height=400,
                                 background_color=(130,0,70),
                                 text_color=(255,255,255)),
                TextDisplayer(position=(20, 90),
                                        text_height=36,
                                        screen_width=400,
                                        screen_height=540,
                                        background_color=(130,0,70),
                                        text_color=(255,255,255))
                )

The "proof" that this works multicore is the fact these are both pygame 
components and hence would not open two windows unless it was
multi-process. I've written up more about this here:

   http://yeoldeclue.com/cgi-bin/blog/blog.cgi?rm=viewpost&nodeid=1205626569

To work this uses Paul Boddie's pprocess module, LikeFile written by a GSOC
student last year, and the components above were also from GSOC. 

Code in subversion is here for the curious:
https://kamaelia.svn.sourceforge.net/svnroot/kamaelia/trunk/Sketches/MPS/pprocess/MultiPipeline.py

This wouldn't've been as easy to write without using Paul's really nice code, 
so I'll just embarass him and say thank you for that here :-)


Michael


More information about the python-uk mailing list