Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2658
| From | Robert Kern <robert.kern@gmail.com> |
|---|---|
| Subject | Re: Multiprocessing, shared memory vs. pickled copies |
| Date | 2011-04-05 10:47 -0500 |
| Organization | The Church of Last Thursday |
| References | <6ace38dc-33c6-44ab-a17a-084d62d666cb@w9g2000prg.googlegroups.com> <indmcg$vin$1@dough.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.50.1302018455.9059.python-list@python.org> (permalink) |
On 4/4/11 7:05 PM, Robert Kern wrote: > On 4/4/11 3:20 PM, John Ladasky wrote: > However, at least in Python 2.7, multiprocessing seems to have a C extension > module defining the Connection objects. Unfortunately, it looks like this C > extension just imports the regular pickler that is not aware of these custom > types. That's why you get this error. I believe this is a bug in Python. > > So what did you try, and what output did you get? What version of Python are you > using? > >> I think that my understanding of multiprocessing >> needs to evolve beyond the use of Pool, but I'm not sure yet. This >> post suggests as much. >> >> http://mail.scipy.org/pipermail/scipy-user/2009-February/019696.html > > Maybe. If the __reduce_ex__() method is implemented properly (and > multiprocessing bugs aren't getting in the way), you ought to be able to pass > them to a Pool just fine. You just need to make sure that the shared arrays are > allocated before the Pool is started. And this only works on UNIX machines. The > shared memory objects that shmarray uses can only be inherited. I believe that's > what Sturla was getting at. I'll take that back a little bit. Since the underlying shared memory types can only be shared by inheritance, the ForkingPickler is only used for the arguments passed to Process(), and not used for things sent through Queues (which Pool uses). Since Pool cannot guarantee that the data exists before the Pool starts its subprocesses, it must use the general mechanism. So in short, if you pass the shmarrays as arguments to the target function in Process(), it should work fine. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-04 13:20 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-04 19:34 -0400
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-05 09:58 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-05 13:43 -0400
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-06 23:40 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-07 00:41 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-07 09:23 -0400
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-07 12:44 -0500
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-07 11:39 -0700
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-07 15:01 -0500
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-04 19:05 -0500
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 16:39 -0700
Re: Multiprocessing, shared memory vs. pickled copies Philip Semanchuk <philip@semanchuk.com> - 2011-04-04 21:16 -0400
Re: Multiprocessing, shared memory vs. pickled copies Robert Kern <robert.kern@gmail.com> - 2011-04-05 10:47 -0500
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 17:03 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 17:38 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-07 18:10 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-09 00:36 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-09 10:15 -0700
Re: Multiprocessing, shared memory vs. pickled copies John Ladasky <ladasky@my-deja.com> - 2011-04-09 13:18 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-10 08:01 -0700
Re: Multiprocessing, shared memory vs. pickled copies sturlamolden <sturlamolden@yahoo.no> - 2011-04-10 15:35 -0700
csiph-web