- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
Jon
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jon,
Depending on your program design or system administrator's preference, an application my have (want) more or less threads than the number of processors available. If, as an example, your OpenMP threads perform I/O as well as computations, you might find it preferable to use more threads than processors. On the other hand, if your OpenMP threads are compute intensive, and the system is used for other purposes, you might find it preferable to specify a max number of threads less than the number of available processors.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One other question: If I run my program on a machine with 4 processors, I would expect that OMP_GET_NUM_PROCS (OP) returns the value 4. Let's assume OMP_GET_MAX_THREADS (OT) also returns 4. If I run my program on an 8-processor machine, I think OP would return 8, but what about OT? Would it still return 4 (a preset number by Intel) or would it return 8 as well? I know that you can set the number of threads less or higher than the number of processors, but I am crious about the default number OT would return.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On application startup the initialization code calls the O/S to obtain the number of processors used by the O/S.e.g. a single processor O/S may not necessarily have a function to query for the number of processors, or if it has, it may return 1. A multi processor O/S will typically report the number of concurrent hardware theads as number of processors. However, depending on the O/S you can get information as to
Number of packages (chips)
Number of processors per package
Number of cores per processor
Number of hardware threads per core (e.g. HyperThreading)
Most systems require all packages to be the same (but some systems do not have this requirement).
A system with two E5420 Xeon's has 2 packages, 2 processors per package, 2 cores per processor, 0 hardware threads per core. omp_get_num_procs should return 8.
Most operating systems support environment variables. If you set OMP_NUM_THREADS=n then n will be the default number of threads. If OMP_NUM_THREADS is not specified then the initialization code uses OMP_GET_NUM_PROCS.
Note, some of the older generation processors with HyperThreading would not provide significant performance boost for FPU intensive applications. On those systems you might want to set OMP_NUM_THREADS = total number of cores (not total number of hardware theads).
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page