[Omp] Detecting No. of processors during OpenMP execution
Marina Kraeva
kraeva at iastate.edu
Tue Jan 18 12:47:47 PST 2005
Hello,
First of all, you can't set the number of processors from within your
program. The omp_set_num_threads function specifies the number of
threads, not processors.
To find out the number of threads that are running specific piece of the
code you can call omp_get_num_threads.
As I understood you would like to know on what processors your threads
are running. You can try to use something like this:
#include <unistd.h>
...
char name[50];
size_t len;
...
gethostname(name, len);
printf("thread %d is running on hostname %s\n",MyId,name);
Marina.
Waibhav Tembe wrote:
> Hello,
>
> I am using OpenMP for my application on Linux system using Intel's ecc
> compiler with -openmp option on a node that has multiple processors
> sharing memory. Although there is a facility in OpenMP to set the number
> of processors (by selecting omp_ set_num_threads ), I was wondering if
> there is any way (perhaps from the OS) to check the actual number of
> processors that were used. For example, if I set num. of threads = 8 and
> for some reason, only 4 processors are used (each processors typically
> executes 2 threads), then I would like to be able to generate a report
> that captures this information. Its going to be used to test the
> effectiveness of some tools in using the parallel processing
> capabilities. Is there any way to find IDs of the processors that were
> used for a specific run of a program?
> I thought of issuing a "ps" command during execution. But I am hoping
> that there is some smarter way. Any pointers in this direction are welcome!
>
> Thanks a lot.
>
> w
>
>
>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp_openmp.org
>
>
More information about the Omp
mailing list