bitorch_engine.utils.arch_helper.check_cpu_instruction_support

bitorch_engine.utils.arch_helper.check_cpu_instruction_support(search_term)[source]

Checks if the CPU supports a specific instruction set.

This function utilizes the cpuinfo library to fetch detailed CPU information, then searches for a specific term within the CPU flags to determine if a given CPU instruction set is supported.

Parameters:

search_term (str) – The CPU instruction set or feature to search for, e.g., “sse4_2”, “avx2”.

Returns:

True if the search term is found within the CPU flags, indicating support for the instruction set.

False otherwise.

Return type:

bool

Example

>>> check_cpu_instruction_support("sse4_2")
True  # Indicates that "sse4_2" is supported by the CPU.

Note

The function prints the entire CPU information fetched by cpuinfo.get_cpu_info() which can be quite verbose. Consider commenting out the print statement for production use.