jitting module¶
Utilities for jitting.
get_func_suffix function¶
Get the suffix of the function.
get_id_of_jitter_type function¶
Get id of a jitter type using jitters in jitting.
jitted function¶
Decorate a jitable function.
Resolves jitter using resolve_jitter().
The wrapping mechanism can be disabled by using the global setting disable_wrapping (=> returns the wrapped function).
Usage
>>> from vectorbtpro import *
>>> @vbt.jitted
... def my_func_nb():
... total = 0
... for i in range(1000000):
... total += 1
... return total
>>> %timeit my_func_nb()
68.1 ns ± 0.32 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
Jitter is automatically detected using the suffix of the wrapped function.
resolve_jitted_kwargs function¶
Resolve keyword arguments for jitted().
Resolves option using resolve_jitted_option().
Note
Keys in option have more priority than in kwargs.
resolve_jitted_option function¶
Return keyword arguments for jitted().
option can be:
- True: Decorate using default settings
- False: Do not decorate (returns None)
- string: Use
optionas the name of the jitter - dict: Use
optionas keyword arguments for jitting
For defaults, see option in jitting.
resolve_jitter function¶
Resolve jitter.
Note
If jitter is already an instance of Jitter and there are other keyword arguments, discards them.
resolve_jitter_type function¶
Resolve jitter.
- If
jitteris None andpy_funcis not None, uses get_func_suffix() - If
jitteris a string, looks injittersin jitting - If
jitteris a subclass of Jitter, returns it - If
jitteris an instance of Jitter, returns its class - Otherwise, throws an error
specialize_jitted_option function¶
Resolve option and merge it with kwargs if it's not None so the dict can be passed as an option to other functions.
Jitter class¶
Abstract class for decorating jitable functions.
Represents a single configuration for jitting.
When overriding Jitter.decorate(), make sure to check whether wrapping is disabled globally using Jitter.wrapping_disabled.
Superclasses
Inherited members
- Cacheable.get_ca_setup()
- Chainable.pipe()
- Configured.config
- Configured.copy()
- Configured.equals()
- Configured.get_writeable_attrs()
- Configured.prettify()
- Configured.rec_state
- Configured.replace()
- Configured.resolve_merge_kwargs()
- Configured.update_config()
- HasSettings.get_path_setting()
- HasSettings.get_path_settings()
- HasSettings.get_setting()
- HasSettings.get_settings()
- HasSettings.has_path_setting()
- HasSettings.has_path_settings()
- HasSettings.has_setting()
- HasSettings.has_settings()
- HasSettings.reset_settings()
- HasSettings.resolve_setting()
- HasSettings.resolve_settings_paths()
- HasSettings.set_settings()
- Pickleable.decode_config()
- Pickleable.decode_config_node()
- Pickleable.dumps()
- Pickleable.encode_config()
- Pickleable.encode_config_node()
- Pickleable.file_exists()
- Pickleable.getsize()
- Pickleable.load()
- Pickleable.loads()
- Pickleable.modify_state()
- Pickleable.resolve_file_path()
- Pickleable.save()
Subclasses
decorate method¶
Decorate a jitable function.
wrapping_disabled property¶
Whether wrapping is disabled globally.
NumPyJitter class¶
Class for decorating functions that use NumPy.
Returns the function without decorating.
Superclasses
Inherited members
- Cacheable.get_ca_setup()
- Chainable.pipe()
- Configured.copy()
- Configured.equals()
- Configured.get_writeable_attrs()
- Configured.prettify()
- Configured.replace()
- Configured.resolve_merge_kwargs()
- Configured.update_config()
- HasSettings.get_path_setting()
- HasSettings.get_path_settings()
- HasSettings.get_setting()
- HasSettings.get_settings()
- HasSettings.has_path_setting()
- HasSettings.has_path_settings()
- HasSettings.has_setting()
- HasSettings.has_settings()
- HasSettings.reset_settings()
- HasSettings.resolve_setting()
- HasSettings.resolve_settings_paths()
- HasSettings.set_settings()
- Jitter.config
- Jitter.decorate()
- Jitter.rec_state
- Jitter.wrapping_disabled
- Pickleable.decode_config()
- Pickleable.decode_config_node()
- Pickleable.dumps()
- Pickleable.encode_config()
- Pickleable.encode_config_node()
- Pickleable.file_exists()
- Pickleable.getsize()
- Pickleable.load()
- Pickleable.loads()
- Pickleable.modify_state()
- Pickleable.resolve_file_path()
- Pickleable.save()
NumbaJitter class¶
NumbaJitter(
fix_cannot_parallel=True,
nopython=True,
nogil=True,
parallel=False,
cache=False,
boundscheck=False,
**options
)
Class for decorating functions using Numba.
Note
If fix_cannot_parallel is True, parallel=True will be ignored if there is no can_parallel tag.
Superclasses
Inherited members
- Cacheable.get_ca_setup()
- Chainable.pipe()
- Configured.copy()
- Configured.equals()
- Configured.get_writeable_attrs()
- Configured.prettify()
- Configured.replace()
- Configured.resolve_merge_kwargs()
- Configured.update_config()
- HasSettings.get_path_setting()
- HasSettings.get_path_settings()
- HasSettings.get_setting()
- HasSettings.get_settings()
- HasSettings.has_path_setting()
- HasSettings.has_path_settings()
- HasSettings.has_setting()
- HasSettings.has_settings()
- HasSettings.reset_settings()
- HasSettings.resolve_setting()
- HasSettings.resolve_settings_paths()
- HasSettings.set_settings()
- Jitter.config
- Jitter.decorate()
- Jitter.rec_state
- Jitter.wrapping_disabled
- Pickleable.decode_config()
- Pickleable.decode_config_node()
- Pickleable.dumps()
- Pickleable.encode_config()
- Pickleable.encode_config_node()
- Pickleable.file_exists()
- Pickleable.getsize()
- Pickleable.load()
- Pickleable.loads()
- Pickleable.modify_state()
- Pickleable.resolve_file_path()
- Pickleable.save()
boundscheck property¶
Whether to enable bounds checking for array indices.
cache property¶
Whether to write the result of function compilation into a file-based cache.
fix_cannot_parallel property¶
Whether to set parallel to False if there is no 'can_parallel' tag.
nogil property¶
Whether to release the GIL.
nopython property¶
Whether to run in nopython mode.
options property¶
Options passed to the Numba decorator.
parallel property¶
Whether to enable automatic parallelization.