471,573 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,573 software developers and data experts.

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 920
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 leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.