hwlocality_linux(3)

✨ NAME ✨

hwlocality_linux(3) β€” Linux-specific helpers πŸ’–

Bestie, this is the Linux-only corner of hwloc: it’s giving β€œkernel cpumap files but make it cute,” and it’s here to help. 🐧✨


🌸 SYNOPSIS 🌸

πŸŽ€ Functions πŸŽ€

int hwloc_linux_set_tid_cpubind (hwloc_topology_t topology, pid_t tid,
    hwloc_const_cpuset_t set)
int hwloc_linux_get_tid_cpubind (hwloc_topology_t topology, pid_t tid,
    hwloc_cpuset_t set)
int hwloc_linux_get_tid_last_cpu_location (hwloc_topology_t topology,
    pid_t tid, hwloc_bitmap_t set)
int hwloc_linux_read_path_as_cpumask (const char *path, hwloc_bitmap_t
    set)

🧠 Detailed Description 🧠

Okay so this section is literally: it includes helpers for manipulating Linux kernel cpumap files, plus hwloc equivalents of the Linux sched_setaffinity and sched_getaffinity system calls. That’s the whole vibe. 🫢


πŸ‘‘ Function Documentation πŸ‘‘

πŸ’… int hwloc_linux_get_tid_cpubind (hwloc_topology_t topology, pid_t tid, hwloc_cpuset_t set)

This one gets the current binding of thread tid. The CPU-set set β€” which the caller already allocated, bestie, don’t forget β€” gets filled with the list of PUs that the thread was last bound to. 🧡✨

The behavior is exactly the same as the Linux sched_getaffinity system call, except it uses a hwloc cpuset. No cap.

Returns 0 on success, -1 on error.

Note: This is equivalent to calling hwloc_get_proc_cpubind() with HWLOC_CPUBIND_THREAD as flags. πŸ’–

πŸ¦‹ int hwloc_linux_get_tid_last_cpu_location (hwloc_topology_t topology, pid_t tid, hwloc_bitmap_t set)

This one gets the last physical CPU where thread tid ran. The CPU-set set β€” again, previously allocated by the caller β€” is filled with the PU that the thread last ran on. πŸ“πŸ”₯

Returns 0 on success, -1 on error.

Note: This is equivalent to calling hwloc_get_proc_last_cpu_location() with HWLOC_CPUBIND_THREAD as flags. 🫢

πŸŽ€ int hwloc_linux_read_path_as_cpumask (const char * path, hwloc_bitmap_t set)

Convert a Linux kernel cpumask file path into a hwloc bitmap set. Might be used when reading CPU set from sysfs attributes such as topology and caches for processors, or local_cpus for devices. πŸ—‚οΈβœ¨

Returns 0 on success, -1 on error.

Note: This function ignores the HWLOC_FSROOT environment variable. Lowkey important, highkey iconic. πŸ’…

🌈 int hwloc_linux_set_tid_cpubind (hwloc_topology_t topology, pid_t tid, hwloc_const_cpuset_t set)

Bind a thread tid on CPUs given in cpuset set. The behavior is exactly the same as the Linux sched_setaffinity system call, but it uses a hwloc cpuset. πŸ’…πŸ”₯

Returns 0 on success, -1 on error.

Note: This is equivalent to calling hwloc_set_proc_cpubind() with HWLOC_CPUBIND_THREAD as flags. πŸ‘‘

🌟 Author 🌟

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code. So yes, the robots wrote this one, but we’re giving it main character energy anyway. πŸ€–πŸ’–


πŸ’Œ Cute sign-off: Hardware Locality (hwloc) Β· Version 2.15.0 Β· hwlocality_linux(3) β€” the footer date isn’t listed on this one, bestie, but the source and version are absolutely serving. 🫢✨

πŸ“¦ where this page comes from