MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / cpu_arch

Method cpu_arch

SwissArmyTransformer/sat/ops/ops_builder/builder.py:318–338  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

316 return [x for x in args if len(x) > 0]
317
318 def cpu_arch(self):
319 try:
320 from cpuinfo import get_cpu_info
321 except ImportError as e:
322 cpu_info = self._backup_cpuinfo()
323 if cpu_info is None:
324 return "-march=native"
325
326 try:
327 cpu_info = get_cpu_info()
328 except Exception as e:
329 self.warning(f"{self.name} attempted to use `py-cpuinfo` but failed (exception type: {type(e)}, {e}), "
330 "falling back to `lscpu` to get this information.")
331 cpu_info = self._backup_cpuinfo()
332 if cpu_info is None:
333 return "-march=native"
334
335 if cpu_info['arch'].startswith('PPC_'):
336 # gcc does not provide -march on PowerPC, use -mcpu instead
337 return '-mcpu=native'
338 return '-march=native'
339
340 def is_cuda_enable(self):
341 try:

Callers 1

cxx_argsMethod · 0.80

Calls 2

_backup_cpuinfoMethod · 0.95
warningMethod · 0.95

Tested by

no test coverage detected