.TH "hwlocality_helper_distribute" 3 "Version 2.14.0" "Hardware Locality (hwloc)" \" -*- nroff -*- .ad l .nh .SH NAME hwlocality_helper_distribute \- Distributing items over a topology .SH SYNOPSIS .br .PP .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBhwloc_distrib_flags_e\fP { \fBHWLOC_DISTRIB_FLAG_REVERSE\fP }" .br .in -1c .SS "Functions" .in +1c .ti -1c .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)" .br .in -1c .SH "Detailed Description" .PP .SH "Enumeration Type Documentation" .PP .SS "enum \fBhwloc_distrib_flags_e\fP" .PP Flags to be given to \fBhwloc_distrib()\fP\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIHWLOC_DISTRIB_FLAG_REVERSE \fP Distrib in reverse order, starting from the last objects\&. .SH "Function Documentation" .PP .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" .PP 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)\&. .PP \fRn_roots\fP is usually 1 and \fRroots\fP only contains the topology root object so as to distribute over the entire topology\&. .PP 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\&. .PP The caller may typically want to also call \fBhwloc_bitmap_singlify()\fP before binding a thread so that it does not move at all\&. .PP \fRflags\fP should be 0 or a OR'ed set of \fBhwloc_distrib_flags_e\fP\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP \fBNote\fP .RS 4 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\&. .PP This function requires the \fRroots\fP objects to have a CPU set\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.