469,275 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Parallel python + ??

Hi,

I am running a program using Parallel Python and I wonder if there is a
way/module to know in which CPU/core the process is running in. Is that
possible?

Ángel
Jun 27 '08 #1
2 904
Thor wrote:
Hi,

I am running a program using Parallel Python and I wonder if there is a
way/module to know in which CPU/core the process is running in. Is that
possible?
This is of course OS-specific. On Linux, you can parse the proc filesystem:
>>open("/proc/%i/stat" % os.getpid()).read().split()[39]
You can use the "taskset" utility to query or set CPU affinity on Linux.

-- Gerhard

Jun 27 '08 #2
Gerhard Häring wrote:
This is of course OS-specific. On Linux, you can parse the proc
filesystem:
>>open("/proc/%i/stat" % os.getpid()).read().split()[39]

You can use the "taskset" utility to query or set CPU affinity on Linux.
It is going to be in Linux (mainly) I was thinking about something like
this:

import Module

def process(self):
print "I am running on processor", Module.cpu,"core", Module.core
....
.....

Checking the raskset right now...:) Thanks.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Markus Franz | last post: by
reply views Thread by mmf | last post: by
6 posts views Thread by Novice Experl | last post: by
reply views Thread by fiepye | last post: by
10 posts views Thread by Mythmon | last post: by
43 posts views Thread by parallelpython | last post: by
5 posts views Thread by fdu.xiaojf | last post: by
5 posts views Thread by George Sakkis | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.