Comments (3)
This looks like somehow the sum function is not being defined (so the jit wrapper is getting the builtin sum function instead of the one defined).
Try renaming the def sum to def sum2d.
-Travis
On Aug 15, 2012, at 1:33 PM, Alex Wiltschko wrote:
Running 10.7. Python 2.7.3 installed from 64-bit EPD 7.3.
All other examples work.➜ examples git:(master) python sum.py
CONVERTING double
CONVERTING double[:, :]
CONVERTING double
['d']
str_to_llvmtype(): str = 'f64'
{'blocks': {0: ,
24: ,
34: ,
37: ,
40: ,
43: ,
53: ,
56: ,
59: ,
82: ,
86: },
'blocks_dom': {0: set([0]),
24: set([0, 24]),
34: set([0, 24, 34, 37, 40, 43, 56, 82]),
37: set([0, 24, 37]),
40: set([0, 24, 37, 40]),
43: set([0, 24, 37, 40, 43]),
53: set([0, 24, 37, 40, 43, 53, 56, 59]),
56: set([0, 24, 37, 40, 43, 56]),
59: set([0, 24, 37, 40, 43, 56, 59]),
82: set([0, 24, 37, 40, 43, 56, 82]),
86: set([0, 24, 37, 86])},
'blocks_in': {0: set(),
24: set([0]),
34: set([82]),
37: set([24, 34]),
40: set([37]),
43: set([40]),
53: set([59]),
56: set([43, 53]),
59: set([56]),
82: set([56]),
86: set([37])},
'blocks_out': {0: set([24]),
24: set([37]),
34: set([37]),
37: set([40, 86]),
40: set([43]),
43: set([56]),
53: set([56]),
56: set([59, 82]),
59: set([53]),
82: set([34]),
86: set()},
'blocks_reaching': {0: set([0]),
24: set([0, 24]),
34: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
37: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
40: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
43: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
53: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
56: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
59: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
82: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
86: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82, 86])},
'blocks_reads': {0: set([0]),
24: set([1]),
34: set(),
37: set([4]),
40: set(),
43: set([2]),
53: set(),
56: set([5]),
59: set([0, 3, 4, 5]),
82: set(),
86: set([3])},
'blocks_writer': {0: {1: 9, 2: 12, 3: 18},
24: {4: 33},
34: {4: 34},
37: {3: 37, 4: 37},
40: {},
43: {5: 52},
53: {5: 53},
56: {3: 56, 5: 56},
59: {3: 76},
82: {},
86: {}},
'blocks_writes': {0: set([0, 1, 2, 3]),
24: set([4]),
34: set([4]),
37: set([3, 4]),
40: set(),
43: set([5]),
53: set([5]),
56: set([3, 5]),
59: set([3]),
82: set(),
86: set()},
'translator': }
op_LOAD_ATTR(): 3 106 shape , _llvm=, typ='arr[f64]')> arr[f64]
op_LOAD_ATTR(): { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }*
('op_CALL_FUNCTION():', , _llvm=None, typ=['func'])>)
str_to_llvmtype(): str = 'f64'
add_phi_incomming(): reaching_defs = {24: {0: 0, 1: 0, 2: 0, 3: 0, 4: 24},
34: {0: 0, 1: 0, 2: 0, 3: 56, 4: 34, 5: 56}}
crnt_block=37, pred=34, local=3
str_to_llvmtype(): str = 'i64'
add_phi_incomming(): reaching_defs = {24: {0: 0, 1: 0, 2: 0, 3: 0, 4: 24},
34: {0: 0, 1: 0, 2: 0, 3: 56, 4: 34, 5: 56}}
crnt_block=37, pred=34, local=4
op_BINARY_ADD(): , _llvm=, typ='i64')> + , _llvm=, typ='i64')>
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
('op_CALL_FUNCTION():', , _llvm=None, typ=['func'])>)
str_to_llvmtype(): str = 'f64'
add_phi_incomming(): reaching_defs = {43: {0: 0, 1: 0, 2: 0, 3: 37, 4: 37, 5: 43},
53: {0: 0, 1: 0, 2: 0, 3: 59, 4: 37, 5: 53}}
crnt_block=56, pred=53, local=3
str_to_llvmtype(): str = 'i64'
add_phi_incomming(): reaching_defs = {43: {0: 0, 1: 0, 2: 0, 3: 37, 4: 37, 5: 43},
53: {0: 0, 1: 0, 2: 0, 3: 59, 4: 37, 5: 53}}
crnt_block=56, pred=53, local=5
op_BINARY_ADD(): , _llvm=, typ='i64')> + , _llvm=, typ='i64')>
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
op_BINARY_SUBSCR(): arr_var.typ = arr[f64]
str_to_llvmtype(): str = 'f64'
%24 = load double* %23
op_BINARY_ADD(): , _llvm=, typ='f64')> + , _llvm=, typ='f64')>
resolve_type(): arg1 = , _llvm=, typ='f64')>, arg2 = , _llvm=, typ='f64')>
resolve_type() ==> 'f64'
; ModuleID = 'csum_mod_1021c1410'define double @csum({ i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr) {
Entry:
%0 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 4
%1 = load i64** %0
%2 = getelementptr i64* %1, i32 0
%3 = load i64* %2
%4 = getelementptr i64* %1, i32 1
%5 = load i64* %4
br label %BLOCK_24BLOCK_24: ; preds = %Entry
br label %BLOCK_37BLOCK_34: ; preds = %BLOCK_82
%6 = add i64 %8, 1
br label %BLOCK_37BLOCK_37: ; preds = %BLOCK_34, %BLOCK_24
%7 = phi double [ 0.000000e+00, %BLOCK_24 ], [ %11, %BLOCK_34 ]
%8 = phi i64 [ 0, %BLOCK_24 ], [ %6, %BLOCK_34 ]
%9 = icmp slt i64 %8, %3
br i1 %9, label %BLOCK_40, label %BLOCK_86BLOCK_86: ; preds = %BLOCK_37
ret double %7BLOCK_40: ; preds = %BLOCK_37
br label %BLOCK_43BLOCK_43: ; preds = %BLOCK_40
br label %BLOCK_56BLOCK_53: ; preds = %BLOCK_59
%10 = add i64 %12, 1
br label %BLOCK_56BLOCK_56: ; preds = %BLOCK_53, %BLOCK_43
%11 = phi double [ %7, %BLOCK_43 ], [ %25, %BLOCK_53 ]
%12 = phi i64 [ 0, %BLOCK_43 ], [ %10, %BLOCK_53 ]
%13 = icmp slt i64 %12, %5
br i1 %13, label %BLOCK_59, label %BLOCK_82BLOCK_82: ; preds = %BLOCK_56
br label %BLOCK_34BLOCK_59: ; preds = %BLOCK_56
%14 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 5
%15 = load i64** %14
%16 = getelementptr i64* %15, i32 0
%17 = load i64* %16
%18 = mul i64 %8, %17
%19 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 2
%20 = load i8** %19
%21 = getelementptr i8* %20, i64 %18
%22 = bitcast i8* %21 to double*
%23 = getelementptr double* %22, i64 %12
%24 = load double* %23
%25 = fadd double %11, %24
br label %BLOCK_53
}Traceback (most recent call last):
File "sum.py", line 13, in
csum = jit(rettype=d, arg_types=[d[:,:]])(sum)
File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/decorators.py", line 78, in _jit
t = Translate(func, _args, *_kws)
File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/translate.py", line 814, in _init
self.fco = func.func_code
AttributeError: 'builtin_function_or_method' object has no attribute 'func_code'—
Reply to this email directly or view it on GitHub.
from numba.
All good now.
On Aug 15, 2012, at 3:13 PM, Travis E. Oliphant wrote:
This looks like somehow the sum function is not being defined (so the jit wrapper is getting the builtin sum function instead of the one defined).
Try renaming the def sum to def sum2d.
-Travis
On Aug 15, 2012, at 1:33 PM, Alex Wiltschko wrote:
Running 10.7. Python 2.7.3 installed from 64-bit EPD 7.3.
All other examples work.➜ examples git:(master) python sum.py
CONVERTING double
CONVERTING double[:, :]
CONVERTING double
['d']
str_to_llvmtype(): str = 'f64'
{'blocks': {0: ,
24: ,
34: ,
37: ,
40: ,
43: ,
53: ,
56: ,
59: ,
82: ,
86: },
'blocks_dom': {0: set([0]),
24: set([0, 24]),
34: set([0, 24, 34, 37, 40, 43, 56, 82]),
37: set([0, 24, 37]),
40: set([0, 24, 37, 40]),
43: set([0, 24, 37, 40, 43]),
53: set([0, 24, 37, 40, 43, 53, 56, 59]),
56: set([0, 24, 37, 40, 43, 56]),
59: set([0, 24, 37, 40, 43, 56, 59]),
82: set([0, 24, 37, 40, 43, 56, 82]),
86: set([0, 24, 37, 86])},
'blocks_in': {0: set(),
24: set([0]),
34: set([82]),
37: set([24, 34]),
40: set([37]),
43: set([40]),
53: set([59]),
56: set([43, 53]),
59: set([56]),
82: set([56]),
86: set([37])},
'blocks_out': {0: set([24]),
24: set([37]),
34: set([37]),
37: set([40, 86]),
40: set([43]),
43: set([56]),
53: set([56]),
56: set([59, 82]),
59: set([53]),
82: set([34]),
86: set()},
'blocks_reaching': {0: set([0]),
24: set([0, 24]),
34: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
37: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
40: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
43: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
53: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
56: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
59: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
82: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82]),
86: set([0, 24, 34, 37, 40, 43, 53, 56, 59, 82, 86])},
'blocks_reads': {0: set([0]),
24: set([1]),
34: set(),
37: set([4]),
40: set(),
43: set([2]),
53: set(),
56: set([5]),
59: set([0, 3, 4, 5]),
82: set(),
86: set([3])},
'blocks_writer': {0: {1: 9, 2: 12, 3: 18},
24: {4: 33},
34: {4: 34},
37: {3: 37, 4: 37},
40: {},
43: {5: 52},
53: {5: 53},
56: {3: 56, 5: 56},
59: {3: 76},
82: {},
86: {}},
'blocks_writes': {0: set([0, 1, 2, 3]),
24: set([4]),
34: set([4]),
37: set([3, 4]),
40: set(),
43: set([5]),
53: set([5]),
56: set([3, 5]),
59: set([3]),
82: set(),
86: set()},
'translator': }
op_LOAD_ATTR(): 3 106 shape , _llvm=, typ='arr[f64]')> arr[f64]
op_LOAD_ATTR(): { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }*
('op_CALL_FUNCTION():', , _llvm=None, typ=['func'])>)
str_to_llvmtype(): str = 'f64'
add_phi_incomming(): reaching_defs = {24: {0: 0, 1: 0, 2: 0, 3: 0, 4: 24},
34: {0: 0, 1: 0, 2: 0, 3: 56, 4: 34, 5: 56}}
crnt_block=37, pred=34, local=3
str_to_llvmtype(): str = 'i64'
add_phi_incomming(): reaching_defs = {24: {0: 0, 1: 0, 2: 0, 3: 0, 4: 24},
34: {0: 0, 1: 0, 2: 0, 3: 56, 4: 34, 5: 56}}
crnt_block=37, pred=34, local=4
op_BINARY_ADD(): , _llvm=, typ='i64')> + , _llvm=, typ='i64')>
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
('op_CALL_FUNCTION():', , _llvm=None, typ=['func'])>)
str_to_llvmtype(): str = 'f64'
add_phi_incomming(): reaching_defs = {43: {0: 0, 1: 0, 2: 0, 3: 37, 4: 37, 5: 43},
53: {0: 0, 1: 0, 2: 0, 3: 59, 4: 37, 5: 53}}
crnt_block=56, pred=53, local=3
str_to_llvmtype(): str = 'i64'
add_phi_incomming(): reaching_defs = {43: {0: 0, 1: 0, 2: 0, 3: 37, 4: 37, 5: 43},
53: {0: 0, 1: 0, 2: 0, 3: 59, 4: 37, 5: 53}}
crnt_block=56, pred=53, local=5
op_BINARY_ADD(): , _llvm=, typ='i64')> + , _llvm=, typ='i64')>
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
resolve_type(): arg1 = , _llvm=, typ='i64')>, arg2 = , _llvm=, typ='i64')>
resolve_type() ==> 'i64'
op_BINARY_SUBSCR(): arr_var.typ = arr[f64]
str_to_llvmtype(): str = 'f64'
%24 = load double* %23
op_BINARY_ADD(): , _llvm=, typ='f64')> + , _llvm=, typ='f64')>
resolve_type(): arg1 = , _llvm=, typ='f64')>, arg2 = , _llvm=, typ='f64')>
resolve_type() ==> 'f64'
; ModuleID = 'csum_mod_1021c1410'define double @csum({ i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr) {
Entry:
%0 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 4
%1 = load i64** %0
%2 = getelementptr i64* %1, i32 0
%3 = load i64* %2
%4 = getelementptr i64* %1, i32 1
%5 = load i64* %4
br label %BLOCK_24BLOCK_24: ; preds = %Entry
br label %BLOCK_37BLOCK_34: ; preds = %BLOCK_82
%6 = add i64 %8, 1
br label %BLOCK_37BLOCK_37: ; preds = %BLOCK_34, %BLOCK_24
%7 = phi double [ 0.000000e+00, %BLOCK_24 ], [ %11, %BLOCK_34 ]
%8 = phi i64 [ 0, %BLOCK_24 ], [ %6, %BLOCK_34 ]
%9 = icmp slt i64 %8, %3
br i1 %9, label %BLOCK_40, label %BLOCK_86BLOCK_86: ; preds = %BLOCK_37
ret double %7BLOCK_40: ; preds = %BLOCK_37
br label %BLOCK_43BLOCK_43: ; preds = %BLOCK_40
br label %BLOCK_56BLOCK_53: ; preds = %BLOCK_59
%10 = add i64 %12, 1
br label %BLOCK_56BLOCK_56: ; preds = %BLOCK_53, %BLOCK_43
%11 = phi double [ %7, %BLOCK_43 ], [ %25, %BLOCK_53 ]
%12 = phi i64 [ 0, %BLOCK_43 ], [ %10, %BLOCK_53 ]
%13 = icmp slt i64 %12, %5
br i1 %13, label %BLOCK_59, label %BLOCK_82BLOCK_82: ; preds = %BLOCK_56
br label %BLOCK_34BLOCK_59: ; preds = %BLOCK_56
%14 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 5
%15 = load i64** %14
%16 = getelementptr i64* %15, i32 0
%17 = load i64* %16
%18 = mul i64 %8, %17
%19 = getelementptr { i64, i32, i8, i32, i64, i64, i8, i8, i32, i8, i8, i8, i64 }* %arr, i32 0, i32 2
%20 = load i8** %19
%21 = getelementptr i8* %20, i64 %18
%22 = bitcast i8* %21 to double*
%23 = getelementptr double* %22, i64 %12
%24 = load double* %23
%25 = fadd double %11, %24
br label %BLOCK_53
}Traceback (most recent call last):
File "sum.py", line 13, in
csum = jit(rettype=d, arg_types=[d[:,:]])(sum)
File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/decorators.py", line 78, in _jit
t = Translate(func, _args, *_kws)
File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/translate.py", line 814, in _init
self.fco = func.func_code
AttributeError: 'builtin_function_or_method' object has no attribute 'func_code'—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub.
from numba.
Going to take Alex's word for it. Closing.
from numba.
Related Issues (20)
- Can't execute python tests directly without using runtests.py HOT 2
- Memory leak when applying numba to an inner function HOT 1
- Errors not being raised when running code in parallel HOT 1
- Source/AST Frontend for Numba HOT 10
- typed.List __repr__() HOT 3
- Bug in the compiler in 0.60 : 'tuple' object has no attribute 'name' HOT 1
- Numba much slower than `np.sum`, and more sensitive to summation axis HOT 1
- First-class function type initializes too late
- inefficient matrix multiplication with its transpose HOT 4
- np.count_nonzero is incorrect when setting axis=0 for 1-dimensional array HOT 2
- Installation fails on termux Python 3.11 HOT 3
- Compilation failure with NumPy 2.0.1 HOT 2
- isfinite(inf) raises FloatingPointError in vectorized functions HOT 5
- TypingError When Accessing Attributes of Nested JitClasses HOT 4
- Jitted and non-jitten function give different output HOT 3
- What is the solution? HOT 4
- NotImplementedError When creating an empty structured array in parallel HOT 3
- Early Memory Deallocation/Re-use of Arrays HOT 2
- .inspect_types() crashes with Unreachable condition reached. HOT 2
- Reduce compilation time by Cythonizing parts of Numba HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numba.