帮我使用我的双核CPU! [英] Help me use my Dual Core CPU!

查看:59
本文介绍了帮我使用我的双核CPU!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚买了一台新的笔记本,它有一个双核CPU。


我用Python编写跨平台游戏,我真的很想能够

使用这第二个核心(在我的机器上,在用户的机器上)用于我可能写的任何

新游戏。


我知道线程没有帮助(至少在CPython中)所以我正在调查我可能能够使用的其他类型的并发性。我真的很喜欢PyLinda方法,但是我需要能够传递所有的简单python类型,PyLinda不会帮助我。此外,PyLinda更专注于分发计算;我真的只想要2个
进程协作(或4个,如果我有4个CPU /核心等)。


有没有任何跨平台方式分享python对象

进程? (我找到了POSH,但它已经老了,而且似乎并没有保持
)。我可以使用共享内存来实现自己的对象空间,

但是我可以看到,这在Win32上不可用。


还有其他并发性选项我还没有发现?

-Sw。

I''ve just bought a new notebook, which has a dual core CPU.

I write cross platform games in Python, and I''d really like to be able
to use this second core (on my machine, and on user''s machines) for any
new games I might write.

I know threads won''t help (in CPython at least) so I''m investigating
other types of concurrency which I might be able to use. I really like
the PyLinda approach, however I need to be able to pass around all the
simple python types, which PyLinda won''t help me with. Also, PyLinda is
more focused on distributing computing; I really only want to have 2
processes cooperating (or 4, if I had 4 CPUs/cores etc).

Is there any cross platform way to share python objects across
processes? (I''ve found POSH, but it''s old, and doesn''t appear to be
maintained). I could implement my own object space using shared memory,
but from what I can see, this is not available on Win32.

Are there any other concurrency options I''ve not discovered yet?
-Sw.

推荐答案

" Simon Wittber" < si ********** @ gmail.comwrites:
"Simon Wittber" <si**********@gmail.comwrites:

还有其他并发选项我还没有发现吗?
Are there any other concurrency options I''ve not discovered yet?



我一直想知道那些不同的Python MPI绑定是什么,以及它们是否对通用有意义

并发性,当它们主要是为并行数值计算时,b $ b计算。更好的MPI库应该至少能够通过共享内存进行通信 - 我不知道Pylinda是否会这样做。

I''ve been wondering about the different Python MPI bindings that are
out there, and whether they might make sense for general purpose
concurrency when they were designed mostly for parallel numerical
computation. Better MPI libraries should at least be able to
communicate by shared memory--I don''t know if Pylinda does that.


Simon Wittber写道:
Simon Wittber wrote:

我刚买了一个新的笔记本电脑,它有一个双核CPU。


我写的Python中的跨平台游戏,我真的希望能够使用第二个核心(在我的机器上,在用户的机器上)使用

来获取任何

我可能写的新游戏。


我知道线程没有帮助(至少在CPython中)所以我正在调查

其他类型我可能能够使用的并发性。我真的很喜欢PyLinda方法,但是我需要能够传递所有的简单python类型,PyLinda不会帮助我。此外,PyLinda更专注于分发计算;我真的只想要2个
进程协作(或4个,如果我有4个CPU /核心等)。


有没有任何跨平台方式分享python对象

进程? (我找到了POSH,但它已经老了,而且似乎并没有保持
)。我可以使用共享内存来实现自己的对象空间,

但是我可以看到,这在Win32上不可用。


还有其他并发性选项我还没有发现?
I''ve just bought a new notebook, which has a dual core CPU.

I write cross platform games in Python, and I''d really like to be able
to use this second core (on my machine, and on user''s machines) for any
new games I might write.

I know threads won''t help (in CPython at least) so I''m investigating
other types of concurrency which I might be able to use. I really like
the PyLinda approach, however I need to be able to pass around all the
simple python types, which PyLinda won''t help me with. Also, PyLinda is
more focused on distributing computing; I really only want to have 2
processes cooperating (or 4, if I had 4 CPUs/cores etc).

Is there any cross platform way to share python objects across
processes? (I''ve found POSH, but it''s old, and doesn''t appear to be
maintained). I could implement my own object space using shared memory,
but from what I can see, this is not available on Win32.

Are there any other concurrency options I''ve not discovered yet?



我们还没有为Kamaelia实现基于流程的组件,但是如果是流程组件基类(这是某种东西)我们想要做的是创造了可能作为可能性的
。如果您对此感兴趣,我可以与您聊聊我们对这将如何运作的想法

(freenode上的#kamaelia或这里) 。 (我们计划这样做的时候我们

设法获得足够的圆形调整)。


值得注意的是,我们不会考虑使用共享的

对象,但在两个进程之间管道数据 - 使用各种

选项,包括对内存映射文件进行pickle(但是有安全性) />
除了其他任何事情之外发布......)。


此外,Paul Boddie还为平行系统发布了一个模块

可能有用(至少对于想法):

* http://cheeseshop.python.org/pypi/parallel


我有兴趣帮助BTW :)

Michael。

-
http:// kamaelia .sourceforge.net /主页
http://yeoldeclue.com/blog

We *haven''t* implemented process based components for Kamaelia yet, however
if a process component base class (which is something we want to do) was
created that might serve as a possiblity. If you''re interested in this I
could chat with you about the ideas we''ve had about how this would work
(#kamaelia on freenode or here). (We are planning on doing this when we
manage to get sufficient round tuits).

It''s probably worth noting that we wouldn''t be thinking of using shared
objects, but piping data between the two processes - with the various
options including pickling to memory mapped files (however there''s security
issues there aside from anything else...).

Also, Paul Boddie posted a module for parallel systems a while back as well
which might be useful (at least for ideas):
* http://cheeseshop.python.org/pypi/parallel

I''d be interested in helping out BTW :)
Michael.
--
http://kamaelia.sourceforge.net/Home
http://yeoldeclue.com/blog


我不知道CPython是什么,但我开发了一个Python应用程序

在Windows下,当它存在时使用Dure Core CPU。


我不知道我可以肯定地说 ;线程不会帮助。在使用其他方法之前你已经做了一些测试,看看它确实是否确定

没有帮助?

Simon Wittber写道:
I don''t know what CPython is but I have developed a Python application
under Windows that utilize the Dure Core CPU when it''s present.

I don''t know that I can say for sure that "threads won''t help". Have
you done some testing before using other approaches to see if it indeed
won''t help?
Simon Wittber wrote:

我刚买了一个新的笔记本电脑,它有一个双核CPU。


我用Python编写跨平台游戏,我真的希望能够使用这第二个核心(在我的机器上,在用户的机器上)使用任何

新游戏我
可能会写。


我知道线程没有帮助(至少在CPython中)所以我正在调查其他类型的并发性我可能会能够使用。我真的很喜欢PyLinda方法,但是我需要能够传递所有的简单python类型,PyLinda不会帮助我。此外,PyLinda更专注于分发计算;我真的只想要2个
进程协作(或4个,如果我有4个CPU /核心等)。


有没有任何跨平台方式分享python对象

进程? (我找到了POSH,但它已经老了,而且似乎并没有保持
)。我可以使用共享内存来实现自己的对象空间,

但是我可以看到,这在Win32上不可用。


还有其他并发性选项我还没有发现?


-Sw。
I''ve just bought a new notebook, which has a dual core CPU.

I write cross platform games in Python, and I''d really like to be able
to use this second core (on my machine, and on user''s machines) for any
new games I might write.

I know threads won''t help (in CPython at least) so I''m investigating
other types of concurrency which I might be able to use. I really like
the PyLinda approach, however I need to be able to pass around all the
simple python types, which PyLinda won''t help me with. Also, PyLinda is
more focused on distributing computing; I really only want to have 2
processes cooperating (or 4, if I had 4 CPUs/cores etc).

Is there any cross platform way to share python objects across
processes? (I''ve found POSH, but it''s old, and doesn''t appear to be
maintained). I could implement my own object space using shared memory,
but from what I can see, this is not available on Win32.

Are there any other concurrency options I''ve not discovered yet?
-Sw.


这篇关于帮我使用我的双核CPU!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆