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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to