class CCompilerOpt(_Config, _Distutils, _Cache, _CCompiler, _Feature, _Parse): (source)
A helper class for CCompiler
aims to provide extra build options
to effectively control of compiler optimizations that are directly
related to CPU features.
Method | __init__ |
Undocumented |
Method | cpu |
Returns a list of final CPU baseline compiler flags |
Method | cpu |
return a list of final CPU baseline feature names |
Method | cpu |
return a list of final CPU dispatch feature names |
Method | generate |
Generate the dispatch header which contains the #definitions and headers for platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features. |
Method | is |
Returns True if the class loaded from the cache file |
Method | report |
Undocumented |
Method | try |
Compile one or more dispatch-able sources and generates object files, also generates abstract C config headers and macros that used later for the final runtime dispatching process. |
Instance Variable | hit |
Undocumented |
Instance Variable | sources |
Undocumented |
Method | _generate |
Undocumented |
Method | _wrap |
Undocumented |
Instance Variable | _requested |
Undocumented |
Instance Variable | _requested |
Undocumented |
Inherited from _Config
:
Method | conf |
Return a dictionary of supported CPU features by the platform, and accumulate the rest of undefined options in conf_features , the returned dict has same rules and notes in class attribute conf_features ... |
Instance Variable | conf |
The prefix of public C definitions. Default is "NPY_". |
Instance Variable | conf |
The prefix of internal C definitions. Default is "NPY__". |
Instance Variable | conf |
Add extra factors to the primary caching factors. The caching factors are utilized to determine if there are changes had happened that requires to discard the cache and re-updating it. The primary factors are the arguments of ... |
Instance Variable | conf |
Nested dictionaries defining several compiler flags that linked to some major functions, the main key represent the compiler name and sub-keys represent flags names. Default is already covers all supported ... |
Instance Variable | conf |
The path of testing files. Each added CPU feature must have a C source file contains at least one intrinsic or instruction that related to this feature, so it can be tested against the compiler. Default is ... |
Instance Variable | conf |
Nested dictionaries used for identifying the CPU features. the primary key is represented as a feature name or group name that gathers several features. Default values covers all supported features but without the major options like "flags", these undefined options handle it by method ... |
Instance Variable | conf |
A dictionary defines the used CPU features for argument option 'min' , the key represent the CPU architecture name e.g. 'x86' . Default values provide the best effort on wide range of users platforms. |
Instance Variable | conf |
Set True to disable memory and file cache. Default is False. |
Instance Variable | conf |
Set True to forces the optimization to be disabled, in this case CCompilerOpt tends to generate all expected headers in order to 'not' break the build. Default is False. |
Instance Variable | conf |
Extra tokens that can be reached from dispatch-able sources through the special mark @targets. Default is an empty dictionary. |
Instance Variable | conf |
The path of temporary directory. Default is auto-created temporary directory via tempfile.mkdtemp(). |
Inherited from _Distutils
(via _Config
):
Static Method | dist |
Raise a compiler error |
Static Method | dist |
Raise a distutils error |
Static Method | dist |
Load a module from file, required by the abstract class '_Cache'. |
Static Method | dist |
Print a console message |
Method | dist |
Wrap CCompiler.compile() |
Method | dist |
Return a tuple containing info about (platform, compiler, extra_args), required by the abstract class '_CCompiler' for discovering the platform environment. This is also used as a cache factor in order to detect any changes happening from outside. |
Method | dist |
Return True if 'CCompiler.compile()' able to compile a source file with certain flags. |
Static Method | _dist |
Return a string to print by log and errors. |
Static Method | _dist |
Undocumented |
Method | _dist |
Fix msvc SDK ENV path same as distutils do without it we get c1: fatal error C1356: unable to find mspdbcore.dll |
Class Variable | _dist |
Undocumented |
Instance Variable | _ccompiler |
Undocumented |
Instance Variable | _dist |
Undocumented |
Inherited from _Cache
(via _Config
, _Distutils
):
Static Method | me |
A static method that can be treated as a decorator to dynamically cache certain methods. |
Method | __del__ |
Undocumented |
Method | cache |
Force update the cache. |
Method | cache |
Undocumented |
Instance Variable | cache |
Utilized during initializing this class, to determine if the cache was able to loaded from the specified cache path in 'cache_path'. |
Instance Variable | cache |
Undocumented |
Instance Variable | cache |
Hold the attributes that need be skipped from "in-memory cache". |
Class Variable | _cache |
Undocumented |
Instance Variable | _cache |
Undocumented |
Instance Variable | _cache |
Undocumented |
Inherited from _CCompiler
(via _Config
, _Distutils
, _Cache
):
Method | cc |
Remove the conflicts that caused due gathering implied features flags. |
Method | cc |
Same as the above but supports compile-time expressions. |
Method | cc |
Returns True if the compiler supports 'flags'. |
Instance Variable | cc |
Dictionary containing the initialized flags of _Config.conf_cc_flags |
Instance Variable | cc |
True if the compiler has debug flags |
Instance Variable | cc |
True if the compiler has native flags |
Instance Variable | cc |
Undocumented |
Instance Variable | cc |
True if the compiler is Clang |
Instance Variable | cc |
True if the compiler is GNU or if the compiler is unknown |
Instance Variable | cc |
True if the compiler is Intel compiler (unix like) |
Instance Variable | cc |
True if the compiler is Intel compiler (msvc like) |
Instance Variable | cc |
True if the compiler isn't supported directly, Note: that cause a fail-back to gcc |
Instance Variable | cc |
The target architecture name, or "unknown" if the architecture isn't supported |
Instance Variable | cc |
The compiler name, or "unknown" if the compiler isn't supported |
Instance Variable | cc |
True if the compiler has definition 'DISABLE_OPT*', or 'cc_on_noarch' is True |
Instance Variable | cc |
True when the target architecture is 64-bit Armv8-a+ |
Instance Variable | cc |
True when the target architecture is 32-bit ARMv7+ |
Instance Variable | cc |
True when the target architecture is unknown or not supported |
Instance Variable | cc |
True when the target architecture is 64-bit big-endian powerpc |
Instance Variable | cc |
True when the target architecture is 64-bit litle-endian powerpc |
Instance Variable | cc |
True when the target architecture is IBM/ZARCH on linux |
Instance Variable | cc |
True when the target architecture is 64-bit x86 |
Instance Variable | cc |
True when the target architecture is 32-bit x86 |
Method | _cc |
Undocumented |
Method | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Class Variable | _cc |
Undocumented |
Inherited from _Feature
(via _Config
, _Distutils
, _Cache
, _CCompiler
):
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() |
Inherited from _Parse
(via _Config
, _Distutils
, _Cache
, _CCompiler
, _Feature
):
Method | parse |
Fetch and parse configuration statements that required for defining the targeted CPU features, statements should be declared in the top of source in between C comment and start with a special mark @targets... |
Instance Variable | parse |
Compiler flags of baseline features |
Instance Variable | parse |
Final CPU baseline's feature names(sorted from low to high) |
Instance Variable | parse |
Final CPU dispatch-able feature names(sorted from low to high) |
Instance Variable | parse |
Undocumented |
Instance Variable | parse |
Dictionary containing initialized target groups that configured through class attribute conf_target_groups . |
Method | _parse |
Undocumented |
Method | _parse |
validate multi targets that defined between parentheses() |
Method | _parse |
skip features that has no auto-vectorized support by compiler |
Method | _parse |
leave a notice that $keep_sort is on |
Method | _parse |
append the compiler optimization flags |
Method | _parse |
skip all baseline features |
Method | _parse |
sorted depend on the highest interest |
Method | _parse |
force warnings to treated as errors |
Method | _parse |
Undocumented |
Method | _parse |
validate group token |
Method | _parse |
validate policy token |
Class Variable | _parse |
Undocumented |
Class Variable | _parse |
Undocumented |
Instance Variable | _parse |
Undocumented |
Generate the dispatch header which contains the #definitions and headers for platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features.
Its highly recommended to take a look at the generated header
also the generated source files via try_dispatch()
in order to get the full picture.
Compile one or more dispatch-able sources and generates object files, also generates abstract C config headers and macros that used later for the final runtime dispatching process.
The mechanism behind it is to takes each source file that specified in 'sources' and branching it into several files depend on special configuration statements that must be declared in the top of each source which contains targeted CPU features, then it compiles every branched source with the proper compiler flags.
See Also
parse_targets
- Parsing the configuration statements of dispatch-able sources.
Parameters | |
sources:list | Must be a list of dispatch-able sources file paths, and configuration statements must be declared inside each file. |
srcstr | Path of parent directory for the generated headers and wrapped sources. If None(default) the files will generated in-place. |
ccompiler:CCompiler | Distutils CCompiler instance to be used for compilation.
If None (default), the provided instance during the initialization
will be used instead. |
**kwargs:any | Arguments to pass on to the CCompiler.compile() |
Returns | |
listgenerated object files | |
Raises | |
CompileError | Raises by CCompiler.compile() on compiling failure. |
DistutilsError | Some errors during checking the sanity of configuration statements. |