Skip to main content

Module cpu

Module cpu 

Source
Expand description

Native CPU capabilities, legacy worker masks, and OS processor-group affinity.

Structs§

CpuSet
An owned native CPU mask. Applying it is an explicit runtime operation.
ProcessorId
An OS processor identity. Linux uses group zero and the kernel CPU index.

Enums§

CpuQuery
Identifies one native CPU capability query.

Functions§

current_thread_affinity
Reads the calling thread’s OS mask; Windows reports its current processor group.
online_processors
Enumerates online processors across Windows groups or Linux kernel CPU IDs.
physical_core_count
Counts physical cores from OS topology records independently of ncnn’s legacy masks.
query
Returns the native answer for one query, zero when the feature is unsupported.
set_current_thread_affinity
Sets and verifies the calling thread’s affinity. Windows accepts one group per call. Native OpenMP worker assignment remains a separate runtime operation.
supports_thread_affinity
Reports support for exact OS processor identities and affinity masks.