| 1 |
.TH "hwlocality_helper_distribute" 3 "Version 2.14.0" "Hardware Locality (hwloc)" \" -*- nroff -*- |
| 2 |
.ad l |
| 3 |
.nh |
| 4 |
.SH NAME |
| 5 |
hwlocality_helper_distribute \- Distributing items over a topology |
| 6 |
.SH SYNOPSIS |
| 7 |
.br |
| 8 |
.PP |
| 9 |
.SS "Enumerations" |
| 10 |
|
| 11 |
.in +1c |
| 12 |
.ti -1c |
| 13 |
.RI "enum \fBhwloc_distrib_flags_e\fP { \fBHWLOC_DISTRIB_FLAG_REVERSE\fP }" |
| 14 |
.br |
| 15 |
.in -1c |
| 16 |
.SS "Functions" |
| 17 |
|
| 18 |
.in +1c |
| 19 |
.ti -1c |
| 20 |
.RI "int \fBhwloc_distrib\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP *roots, unsigned n_roots, \fBhwloc_cpuset_t\fP *set, unsigned n, int until, unsigned long flags)" |
| 21 |
.br |
| 22 |
.in -1c |
| 23 |
.SH "Detailed Description" |
| 24 |
.PP |
| 25 |
|
| 26 |
.SH "Enumeration Type Documentation" |
| 27 |
.PP |
| 28 |
.SS "enum \fBhwloc_distrib_flags_e\fP" |
| 29 |
|
| 30 |
.PP |
| 31 |
Flags to be given to \fBhwloc_distrib()\fP\&. |
| 32 |
.PP |
| 33 |
\fBEnumerator\fP |
| 34 |
.in +1c |
| 35 |
.TP |
| 36 |
\f(BIHWLOC_DISTRIB_FLAG_REVERSE \fP |
| 37 |
Distrib in reverse order, starting from the last objects\&. |
| 38 |
.SH "Function Documentation" |
| 39 |
.PP |
| 40 |
.SS "int hwloc_distrib (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_t\fP * roots, unsigned n_roots, \fBhwloc_cpuset_t\fP * set, unsigned n, int until, unsigned long flags)\fR [inline]\fP" |
| 41 |
|
| 42 |
.PP |
| 43 |
Distribute \fRn\fP items over the topology under \fRroots\fP\&. Array \fRset\fP will be filled with \fRn\fP cpusets recursively distributed linearly over the topology under objects \fRroots\fP, down to depth \fRuntil\fP (which can be INT_MAX to distribute down to the finest level)\&. |
| 44 |
|
| 45 |
.PP |
| 46 |
\fRn_roots\fP is usually 1 and \fRroots\fP only contains the topology root object so as to distribute over the entire topology\&. |
| 47 |
|
| 48 |
.PP |
| 49 |
This is typically useful when an application wants to distribute \fRn\fP threads over a machine, giving each of them as much private cache as possible and keeping them locally in number order\&. |
| 50 |
|
| 51 |
.PP |
| 52 |
The caller may typically want to also call \fBhwloc_bitmap_singlify()\fP before binding a thread so that it does not move at all\&. |
| 53 |
|
| 54 |
.PP |
| 55 |
\fRflags\fP should be 0 or a OR'ed set of \fBhwloc_distrib_flags_e\fP\&. |
| 56 |
|
| 57 |
.PP |
| 58 |
\fBReturns\fP |
| 59 |
.RS 4 |
| 60 |
0 on success, -1 on error\&. |
| 61 |
.RE |
| 62 |
.PP |
| 63 |
\fBNote\fP |
| 64 |
.RS 4 |
| 65 |
On hybrid CPUs (or asymmetric platforms), distribution may be suboptimal since the number of cores or PUs inside packages or below caches may vary (the top-down recursive partitioning ignores these numbers until reaching their levels)\&. Hence it is recommended to distribute only inside a single homogeneous domain\&. For instance on a CPU with energy-efficient E-cores and high-performance P-cores, one should distribute separately N tasks on E-cores and M tasks on P-cores instead of trying to distribute directly M+N tasks on the entire CPUs\&. |
| 66 |
|
| 67 |
.PP |
| 68 |
This function requires the \fRroots\fP objects to have a CPU set\&. |
| 69 |
.RE |
| 70 |
.PP |
| 71 |
|
| 72 |
.SH "Author" |
| 73 |
.PP |
| 74 |
Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&. |