class _Feature: (source)
Known subclasses: numpy.distutils.ccompiler_opt.CCompilerOpt
A helper class for CCompilerOpt
that managing CPU features.
Method | __init__ |
Undocumented |
Method | feature |
Return list of features in 'names' after remove any implied features and keep the origins. |
Method | feature |
Generate C preprocessor definitions and include headers of a CPU feature. |
Method | feature |
check if the feature can be auto-vectorized by the compiler |
Method | feature |
Return a list of CPU features that required to be detected sorted from the lowest to highest interest. |
Method | feature |
Return a list of supported extra checks after testing them against the compiler. |
Method | feature |
Return a list of CPU features flags sorted from the lowest to highest interest. |
Method | feature |
same as feature_implies_c() but stop collecting implied features when feature's option that provided through parameter 'keyisfalse' is False, also sorting the returned features. |
Method | feature |
Return a set of CPU features that implied by 'names' |
Method | feature |
same as feature_implies() but combining 'names' |
Method | feature |
Returns True if a certain feature is exist and covered within _Config.conf_features . |
Method | feature |
Check if a certain CPU feature is supported by the platform and compiler. |
Method | feature |
Returns a set of CPU feature names that supported by platform and the C compiler. |
Method | feature |
Sort a list of CPU features ordered by the lowest interest. |
Method | feature |
Test a certain CPU feature against the compiler through its own check file. |
Method | feature |
same as 'feature_ahead()' but if both features implied each other and keep the highest interest. |
Instance Variable | feature |
Undocumented |
Instance Variable | feature |
The minimum support of CPU features, according to the specified values in attribute _Config.conf_min_features . |
Instance Variable | feature |
Dictionary containing all CPU features that supported by the platform, according to the specified values in attribute _Config.conf_features and _Config.conf_features_partial() |
Return list of features in 'names' after remove any implied features and keep the origins.
Examples
>>> self.feature_ahead(["SSE2", "SSE3", "SSE41"]) ["SSE41"] # assume AVX2 and FMA3 implies each other and AVX2 # is the highest interest >>> self.feature_ahead(["SSE2", "SSE3", "SSE41", "AVX2", "FMA3"]) ["AVX2"] # assume AVX2 and FMA3 don't implies each other >>> self.feature_ahead(["SSE2", "SSE3", "SSE41", "AVX2", "FMA3"]) ["AVX2", "FMA3"]
Parameters | |
names | Undocumented |
'names':sequence | sequence of CPU feature names in uppercase. |
Returns | |
list of CPU features sorted as-is 'names' |
Generate C preprocessor definitions and include headers of a CPU feature.
Examples
>>> self.feature_c_preprocessor("SSE3") /** SSE3 **/ #define NPY_HAVE_SSE3 1 #include <pmmintrin.h>
Parameters | |
feature | Undocumented |
tabs | Undocumented |
'featurestr | CPU feature name in uppercase. |
'tabs':int | if > 0, align the generated strings to the right depend on number of tabs. |
Returns | |
str, generated C preprocessor |
Return a list of CPU features that required to be detected sorted from the lowest to highest interest.
Return a list of supported extra checks after testing them against the compiler.
Parameters | |
name | Undocumented |
names:str | CPU feature name in uppercase. |
same as feature_implies_c()
but stop collecting implied
features when feature's option that provided through
parameter 'keyisfalse' is False, also sorting the returned
features.
Return a set of CPU features that implied by 'names'
Examples
>>> self.feature_implies("SSE3") {'SSE', 'SSE2'} >>> self.feature_implies("SSE2") {'SSE'} >>> self.feature_implies("SSE2", keep_origins=True) # 'SSE2' found here since 'SSE' and 'SSE2' imply each other {'SSE', 'SSE2'}
Parameters | |
names:str or sequence of str | CPU feature name(s) in uppercase. |
keepbool | if False(default) then the returned set will not contain any features from 'names'. This case happens only when two features imply each other. |
Returns True if a certain feature is exist and covered within
_Config.conf_features
.
Parameters | |
name | Undocumented |
'name':str | feature name in uppercase. |
Check if a certain CPU feature is supported by the platform and compiler.
Parameters | |
name:str | CPU feature name in uppercase. |
forcelist or None , optional | If None(default), default compiler flags for every CPU feature will be used during test. |
macros:list of tuples , optional | A list of C macro definitions. |
Returns a set of CPU feature names that supported by platform and the C compiler.
Parameters | |
names:sequence or None , optional | Specify certain CPU features to test it against the C compiler. if None(default), it will test all current supported features. Note: feature names must be in upper-case. |
forcelist or None , optional | If None(default), default compiler flags for every CPU feature will be used during the test. |
macros:list of tuples , optional | A list of C macro definitions. |
Sort a list of CPU features ordered by the lowest interest.
Parameters | |
names | Undocumented |
reverse | Undocumented |
'names':sequence | sequence of supported feature names in uppercase. |
'reverse':bool , optional | If true, the sorted features is reversed. (highest interest) |
Returns | |
list, sorted CPU features |
Test a certain CPU feature against the compiler through its own check file.
Parameters | |
name:str | Supported CPU feature name. |
forcelist or None , optional | If None(default), the returned flags from feature_flags()
will be used. |
macros:list of tuples , optional | A list of C macro definitions. |
same as 'feature_ahead()' but if both features implied each other and keep the highest interest.
Examples
>>> self.feature_untied(["SSE2", "SSE3", "SSE41"]) ["SSE2", "SSE3", "SSE41"] # assume AVX2 and FMA3 implies each other >>> self.feature_untied(["SSE2", "SSE3", "SSE41", "FMA3", "AVX2"]) ["SSE2", "SSE3", "SSE41", "AVX2"]
Parameters | |
names | Undocumented |
'names':sequence | sequence of CPU feature names in uppercase. |
Returns | |
list of CPU features sorted as-is 'names' |
The minimum support of CPU features, according to
the specified values in attribute _Config.conf_min_features
.
Dictionary containing all CPU features that supported
by the platform, according to the specified values in attribute
_Config.conf_features
and _Config.conf_features_partial()