由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to use multi-core to speed Python program
相关主题
刚开始看pythonabout cluster computer
High Performance Computing Software Engineer needed -- Cary NCwhat kind of machine should I buy
Linux里如何查找当前release name?有没有sun unix的高手呀?
写给对系统感兴趣的人Hign Performance Computing Software Engineer wanted @ Cary NC
大坑看晕了High Performance Computing software engineer wanted @ Cary NC
做了一个测试High Performance Computing software engineer wanted @ Cary (转载)
我去你妈的AWS,byebye,操你妈的Networking Software Engineer (转载)
一道关于SMP and threading 题目Networking Software Engineer
相关话题的讨论汇总
话题: python话题: cpu话题: use话题: multi话题: cpus
进入Programming版参与讨论
1 (共1页)
s****h
发帖数: 921
1
Sorry, I cannot input Chinese now.
I am writing Python program to do some scientific calculation.
I just got a new desktop which has 4 CPUs.
I wonder if I can take advantage of 4 CPUs in Python program?
Now the maximum CPU usage is only 25% since only one CPU is used.
a**a
发帖数: 416
2
In the level of application, you can use multi-processe to use multi-
processor.
In the other hand, if your CPU is of Intel processor, you might want to try
to use Intel's MKL as your BLAS/LAPACK engine, which might drive CPU to its
full use. In the application level, you might want to learn about the
parallel
programming paradigms, such as MPI. In the engine level, the BLAS engine
will try to take advantage of the CPU for you.

【在 s****h 的大作中提到】
: Sorry, I cannot input Chinese now.
: I am writing Python program to do some scientific calculation.
: I just got a new desktop which has 4 CPUs.
: I wonder if I can take advantage of 4 CPUs in Python program?
: Now the maximum CPU usage is only 25% since only one CPU is used.

g*****g
发帖数: 34805
3
Python's thread can't take advantage of multi-core?

【在 s****h 的大作中提到】
: Sorry, I cannot input Chinese now.
: I am writing Python program to do some scientific calculation.
: I just got a new desktop which has 4 CPUs.
: I wonder if I can take advantage of 4 CPUs in Python program?
: Now the maximum CPU usage is only 25% since only one CPU is used.

f*******y
发帖数: 988
4
这和python没关系
你得自己要写程序啊

【在 s****h 的大作中提到】
: Sorry, I cannot input Chinese now.
: I am writing Python program to do some scientific calculation.
: I just got a new desktop which has 4 CPUs.
: I wonder if I can take advantage of 4 CPUs in Python program?
: Now the maximum CPU usage is only 25% since only one CPU is used.

g*****g
发帖数: 34805
5
It seems python threading can only use one cpu.
You have to go process level to take advantage of multi-core.

【在 f*******y 的大作中提到】
: 这和python没关系
: 你得自己要写程序啊

s****h
发帖数: 921
6
谢谢。
我刚刚找到一个Parallel Python的软件包。
可以提供SMP方面的支持。
我当然希望找到一个立即可以用的东西,自己弄太难了。
s***e
发帖数: 122
7
Just a quick search, and found that this might help: Parallel Python.
http://www.parallelpython.com/
And some excerption
=====================
PP is a python module which provides mechanism for parallel execution of
python code on SMP (systems with multiple processors or cores) and clusters
(computers connected via network).
... it appears that if the application is computation-bound using 'thread'
or 'threading' python modules will not allow to run python byte-code in
parallel. The reason is th

【在 s****h 的大作中提到】
: Sorry, I cannot input Chinese now.
: I am writing Python program to do some scientific calculation.
: I just got a new desktop which has 4 CPUs.
: I wonder if I can take advantage of 4 CPUs in Python program?
: Now the maximum CPU usage is only 25% since only one CPU is used.

f*******y
发帖数: 988
8
这不是真的吧
听起来很匪夷所思

【在 g*****g 的大作中提到】
: It seems python threading can only use one cpu.
: You have to go process level to take advantage of multi-core.

T*****9
发帖数: 2484
9
truth
I encountered this problem days before
I switch to C++ for performance reason

【在 f*******y 的大作中提到】
: 这不是真的吧
: 听起来很匪夷所思

h***z
发帖数: 233
10
Yes, standard python threading is limited by the global interpreter lock.

【在 g*****g 的大作中提到】
: Python's thread can't take advantage of multi-core?
相关主题
做了一个测试about cluster computer
我去你妈的AWS,byebye,操你妈的what kind of machine should I buy
一道关于SMP and threading 题目有没有sun unix的高手呀?
进入Programming版参与讨论
h***z
发帖数: 233
11
You can also try Stackless and IPython1.

clusters
Interpreter

【在 s***e 的大作中提到】
: Just a quick search, and found that this might help: Parallel Python.
: http://www.parallelpython.com/
: And some excerption
: =====================
: PP is a python module which provides mechanism for parallel execution of
: python code on SMP (systems with multiple processors or cores) and clusters
: (computers connected via network).
: ... it appears that if the application is computation-bound using 'thread'
: or 'threading' python modules will not allow to run python byte-code in
: parallel. The reason is th

r****t
发帖数: 10904
12
Truth, 那天咱们不是已经讨论过了么。

【在 g*****g 的大作中提到】
: Python's thread can't take advantage of multi-core?
r****t
发帖数: 10904
13
不一定直接就要用到 parallel python, 我不知道 parallel python 现在发展怎么样
没法说。
但是在标准的 CPython 里面也可以用 threading interface 来使用 multi-core, 办
法就是用 processing module, 这个 module 会进入 python2.6, 它提供 python
threading module 的语法,底层使用 process 来 utilize multiple CPUs. 如果你的
code 不仅仅是你自己用的话,最好使用这个。
threading method 因为没法 scale to multiple CPUs across machines, with GIL
的原因,在 python world 里面没有得到采用。 python answer 是使用进程。使用进
程来 parallel 的有 IPython1 + mpi

【在 s****h 的大作中提到】
: 谢谢。
: 我刚刚找到一个Parallel Python的软件包。
: 可以提供SMP方面的支持。
: 我当然希望找到一个立即可以用的东西,自己弄太难了。

g*****g
发帖数: 34805
14
使用进程也太吃内存了吧,要是跑服务器,上百连接进来怎么办?

【在 r****t 的大作中提到】
: 不一定直接就要用到 parallel python, 我不知道 parallel python 现在发展怎么样
: 没法说。
: 但是在标准的 CPython 里面也可以用 threading interface 来使用 multi-core, 办
: 法就是用 processing module, 这个 module 会进入 python2.6, 它提供 python
: threading module 的语法,底层使用 process 来 utilize multiple CPUs. 如果你的
: code 不仅仅是你自己用的话,最好使用这个。
: threading method 因为没法 scale to multiple CPUs across machines, with GIL
: 的原因,在 python world 里面没有得到采用。 python answer 是使用进程。使用进
: 程来 parallel 的有 IPython1 + mpi

s***e
发帖数: 122
15
我想它应该是让进程scale to the number of CPU, 但是线程不是,但是线程还是有的。

【在 g*****g 的大作中提到】
: 使用进程也太吃内存了吧,要是跑服务器,上百连接进来怎么办?
r****t
发帖数: 10904
16
用进程, up to the number of CPUs, 再多就没有好处了。
servers in python uses Twisted to implement. Twisted + Prospective Broker+ 少量的 threading 基本上是 python 里面对这
个问题的回答吧。

【在 g*****g 的大作中提到】
: 使用进程也太吃内存了吧,要是跑服务器,上百连接进来怎么办?
g*****g
发帖数: 34805
17
I heard Python was used for web application too, how does it handle it?

少量的 threading 基本上是 python 里面对这

【在 r****t 的大作中提到】
: 用进程, up to the number of CPUs, 再多就没有好处了。
: servers in python uses Twisted to implement. Twisted + Prospective Broker+ 少量的 threading 基本上是 python 里面对这
: 个问题的回答吧。

r****t
发帖数: 10904
18
Python has too many web frameworks, I am expert of neither of them.
就我的了解,我只能说在 Django book Chapter 20 可能有你要的回答:
http://www.djangobook.com/en/1.0/chapter20/
或者这个采访吧,很多东西我也就是当门外汉一样读一下:
http://cloudsecurity.org/2008/07/01/cloudsecurityorg-interviews-guido-van-rossum-google-app-engine-python-and-security/

【在 g*****g 的大作中提到】
: I heard Python was used for web application too, how does it handle it?
:
: 少量的 threading 基本上是 python 里面对这

d***q
发帖数: 1119
19
twisted use async socket to handle multiple call.
It also doesn't take any benefit from more than one core.
It seems that the only one way to use >1 core is to use multi process
r****t
发帖数: 10904
20
twisted is not something that's only work for single process, yes it strives
to keep as much stuff "twisted" in one process, but you can use PB or
foolscap (part of twised) to make use of >1 core (as many cores as you want).

【在 d***q 的大作中提到】
: twisted use async socket to handle multiple call.
: It also doesn't take any benefit from more than one core.
: It seems that the only one way to use >1 core is to use multi process

1 (共1页)
进入Programming版参与讨论
相关主题
Networking Software Engineer一道关于SMP and threading 题目
刚开始看pythonabout cluster computer
High Performance Computing Software Engineer needed -- Cary NCwhat kind of machine should I buy
Linux里如何查找当前release name?有没有sun unix的高手呀?
写给对系统感兴趣的人Hign Performance Computing Software Engineer wanted @ Cary NC
大坑看晕了High Performance Computing software engineer wanted @ Cary NC
做了一个测试High Performance Computing software engineer wanted @ Cary (转载)
我去你妈的AWS,byebye,操你妈的Networking Software Engineer (转载)
相关话题的讨论汇总
话题: python话题: cpu话题: use话题: multi话题: cpus