Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_arm_cpu check #3350

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion nncf/common/utils/cpu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import platform
import re

import cpuinfo # type: ignore

_IS_ARM_CPU = None
_IS_LNL_CPU = None


def is_arm_cpu() -> bool:
global _IS_ARM_CPU
if _IS_ARM_CPU is None:
_IS_ARM_CPU = platform.processor().lower() == "arm"
return _IS_ARM_CPU


def is_lnl_cpu() -> bool:
global _IS_LNL_CPU
if _IS_LNL_CPU is None:
_IS_LNL_CPU = re.search(r"Ultra \d 2\d{2}", cpuinfo.get_cpu_info()["brand_raw"]) is not None
_IS_LNL_CPU = (
not is_arm_cpu() and re.search(r"Ultra \d 2\d{2}", cpuinfo.get_cpu_info()["brand_raw"]) is not None
)
return _IS_LNL_CPU