Attendees:
FPOC (last week):
FPOC (incoming):
NOTE: All communication is subject to the Numba Code of Conduct.
Please refer to this calendar for the next meeting date.
Numba user survey update.
Numba 0.59.1 schedule.
Review NumPy 2.0 community communication note.
How to stage NumPy 2.0 work and impact on maintenance.
Draft of February's NAN is ready for comments from maintainers.
Possible "solutions" to the question last week about how to specialise compilation based on a configuration object, and still preserve literals.
from numba import jit, types
from numba.extending import overload
import functools
# Some sort of configuration object
class Config():
def __init__(self, a, b):
self._a = a
self._b = b
@property
def a(self):
return self._a
@property
def b(self):
return self._b
# Perhaps use a cache so that the identical Config instances return the same
# jit function? This will prevent recompilation of the entry point for two
# identical config instances as the jit function passed as the argument will be
# the same.
@functools.cache
def obj2strkeydict(obj, config_name):
# unpack object to freevars and close over them
tmp_a = obj.a
tmp_b = obj.b
assert isinstance(config_name, str)
tmp_force_heterogeneous = config_name
@jit
def configurator():
d = {'a': tmp_a,
'b': tmp_b,
'config_name': tmp_force_heterogeneous}
return d
# return a configuration function that returns a string-key-dict
# representation of the configuration object.
return configurator
# Define some "work"
def work(pred):
# ... elided, put python implementation here
pass
@overload(work)
def ol_work(pred):
assert isinstance(pred, types.Literal)
print('Calling work with type', pred)
return lambda pred: pred
@jit
def physics(cfig_func):
# This is the main entry point to the application, it takes a configuration
# function as an argument. It will specialise on each configuration
# function.
# call the function, config is a string-key-dict
config = cfig_func()
# unpack config, these types will be preserved as literals.
a = config['a']
b = config['b']
# call some work to check the types.
return work(b) + a
# demo
def demo():
# Create two different Python based configuration objects with literal
# entries.
configuration1 = Config(10, True)
configuration2 = Config(12.3, False)
# Create corresponding converted configuration objects...
jit_config1 = obj2strkeydict(configuration1, 'config1')
jit_config2 = obj2strkeydict(configuration2, 'config2')
# create "another" configuration1 instance, memoization prevents
# duplication.
jit_config1_again = obj2strkeydict(configuration1, 'config1')
# Call the `physics` application, it will specialize on config.
physics(jit_config1)
physics(jit_config2)
# should not trigger a 3rd compilation, config is memoized.
physics(jit_config1_again)
physics.inspect_types()
if __name__ == "__main__":
demo()
int64
rather than Optional(int64)
when dict.get(key, default_int64)
and dict value type is int64
tuple
to one row of recarray
numba
and llvmlite
musl
wheels for alpine
support(last numba: 9477; llvmlite 1034)
2024-gantt: TBD
2023-gantt: https://github.com/numba/numba/issues/8971
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing