MCPcopy Create free account
hub / github.com/numpy/numpy / feature_test

Method feature_test

numpy/distutils/ccompiler_opt.py:1540–1577  ·  view source on GitHub ↗

Test a certain CPU feature against the compiler through its own check file. Parameters ---------- name : str Supported CPU feature name. force_flags : list or None, optional If None(default), the returned flags from `feature_

(self, name, force_flags=None, macros=[])

Source from the content-addressed store, hash-verified

1538
1539 @_Cache.me
1540 def feature_test(self, name, force_flags=None, macros=[]):
1541 """
1542 Test a certain CPU feature against the compiler through its own
1543 check file.
1544
1545 Parameters
1546 ----------
1547 name : str
1548 Supported CPU feature name.
1549
1550 force_flags : list or None, optional
1551 If None(default), the returned flags from `feature_flags()`
1552 will be used.
1553
1554 macros : list of tuples, optional
1555 A list of C macro definitions.
1556 """
1557 if force_flags is None:
1558 force_flags = self.feature_flags(name)
1559
1560 self.dist_log(
1561 "testing feature '%s' with flags (%s)" % (
1562 name, ' '.join(force_flags)
1563 ))
1564 # Each CPU feature must have C source code contains at
1565 # least one intrinsic or instruction related to this feature.
1566 test_path = os.path.join(
1567 self.conf_check_path, "cpu_%s.c" % name.lower()
1568 )
1569 if not os.path.exists(test_path):
1570 self.dist_fatal("feature test file is not exist", test_path)
1571
1572 test = self.dist_test(
1573 test_path, force_flags + self.cc_flags["werror"], macros=macros
1574 )
1575 if not test:
1576 self.dist_log("testing failed", stderr=True)
1577 return test
1578
1579 @_Cache.me
1580 def feature_is_supported(self, name, force_flags=None, macros=[]):

Callers 1

feature_is_supportedMethod · 0.95

Calls 7

feature_flagsMethod · 0.95
lowerMethod · 0.80
dist_fatalMethod · 0.80
dist_testMethod · 0.80
dist_logMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected