Getting procs id?

General OpenMP discussion

Getting procs id?

Postby ebis06 » Fri Aug 29, 2008 2:41 am

Hi all,
I am new to OpenMP. I can find a routine that returns the number of processors available to the OpenMP program, but I can not find anything that will return me the ID of the processor on which the thread is running. I would be interested to know which thread (and I can easily get the thred id using the omp_get_thread() routine) is runing on which CPU.
Do you know a method to get the processor/CPU ID?
Thanks in advance,

Re: Getting procs id?

Postby ejd » Tue Sep 02, 2008 6:09 am

Unfortunately the OpenMP spec doesn't provide such a function. The mapping of what thread runs on what processor is done by the OS, since it is genreally felt that the OS knows what the workload on the system is and can do this better than a user level program. Some implementations allow you to "bind" a thread to a processor, becase it has been shown that data re-use (cache effects) can have a significant effect on the performance of some programs. I believe that some of the performance analysis tools might give you this information, but in general they too will only show you when a thread is running and not on which processor.
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 2 guests