MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / simd_width

Method simd_width

op_builder/builder.py:466–488  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

464 return cpu_info
465
466 def simd_width(self):
467 try:
468 from cpuinfo import get_cpu_info
469 except ImportError as e:
470 cpu_info = self._backup_cpuinfo()
471 if cpu_info is None:
472 return '-D__SCALAR__'
473
474 try:
475 cpu_info = get_cpu_info()
476 except Exception as e:
477 self.warning(f"{self.name} attempted to use py-cpuinfo but failed (exception type: {type(e)}, {e}), "
478 "falling back to lscpu to get this information.")
479 cpu_info = self._backup_cpuinfo()
480 if cpu_info is None:
481 return '-D__SCALAR__'
482
483 if cpu_info['arch'] == 'X86_64':
484 if 'avx512' in cpu_info['flags'] or 'avx512f' in cpu_info['flags']:
485 return '-D__AVX512__'
486 elif 'avx2' in cpu_info['flags']:
487 return '-D__AVX256__'
488 return '-D__SCALAR__'
489
490 def command_exists(self, cmd):
491 if '|' in cmd:

Callers 6

cxx_argsMethod · 0.80
cxx_argsMethod · 0.80
cxx_argsMethod · 0.80
cxx_argsMethod · 0.80
cxx_argsMethod · 0.80
cxx_argsMethod · 0.80

Calls 2

_backup_cpuinfoMethod · 0.95
warningMethod · 0.95

Tested by

no test coverage detected