Comments (9)
@TheTesla thank you for submitting this. It's a bit unusual that removing the @njit
decorator leads to a segfault.
from numba.
here is the backtrace:
findSurfacePnt time: 0.5227141380310059
getSurface time: 1.969843864440918
43780 - 86528 - 86528 - 43780
/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/parfors/parfor_lowering.py:1153: NumbaParallelSafetyWarning: Variable i.1.5 used in parallel loop may be written to simultaneously by multiple workers and may result in non-deterministic or unintended results.
File "xyzcad/render.py", line 427:
def coords2relations(cubeCoordArray, ptCoordArray, ptValueArray, res):
<source elided>
cube2ptIdxArray = np.zeros((cubeCoordArray.shape[0],8),dtype='int')
for i in prange(cubeCoordArray.shape[0]):
^
warnings.warn(NumbaParallelSafetyWarning(msg, loc))
/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/parfors/parfor_lowering.py:1153: NumbaParallelSafetyWarning: Variable i.1.4 used in parallel loop may be written to simultaneously by multiple workers and may result in non-deterministic or unintended results.
File "xyzcad/render.py", line 443:
def coords2relations(cubeCoordArray, ptCoordArray, ptValueArray, res):
<source elided>
cEdgeArray = np.zeros((cube2ptIdxArray.shape[0]*12,2),dtype='int')
for i in prange(cube2ptIdxArray.shape[0]):
^
warnings.warn(NumbaParallelSafetyWarning(msg, loc))
coords2relations time: 3.544940948486328
43780 - 43780 - 217572 - 86528 - 86528
cutCedgeIdx time: 0.10100579261779785
43804
precTrPnts time: 0.45185089111328125
43804
circList time: 0.024292945861816406
List(circList) time: 0.33193182945251465
[1] 6075 segmentation fault python3 demo.py
python3 demo.py 8.01s user 1.94s system 89% cpu 11.112 total
from numba.
I tried to comment back in the @njit
decorator and got the following:
findSurfacePnt time: 0.3638169765472412
getSurface time: 2.0497782230377197
43780 - 86528 - 86528 - 43780
/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/parfors/parfor_lowering.py:1153: NumbaParallelSafetyWarning: Variable i.1.5 used in parallel loop may be written to simultaneously by multiple workers and may result in non-deterministic or unintended results.
File "xyzcad/render.py", line 427:
def coords2relations(cubeCoordArray, ptCoordArray, ptValueArray, res):
<source elided>
cube2ptIdxArray = np.zeros((cubeCoordArray.shape[0],8),dtype='int')
for i in prange(cubeCoordArray.shape[0]):
^
warnings.warn(NumbaParallelSafetyWarning(msg, loc))
/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/parfors/parfor_lowering.py:1153: NumbaParallelSafetyWarning: Variable i.1.4 used in parallel loop may be written to simultaneously by multiple workers and may result in non-deterministic or unintended results.
File "xyzcad/render.py", line 443:
def coords2relations(cubeCoordArray, ptCoordArray, ptValueArray, res):
<source elided>
cEdgeArray = np.zeros((cube2ptIdxArray.shape[0]*12,2),dtype='int')
for i in prange(cube2ptIdxArray.shape[0]):
^
warnings.warn(NumbaParallelSafetyWarning(msg, loc))
coords2relations time: 3.0353610515594482
43780 - 43780 - 217572 - 86528 - 86528
cutCedgeIdx time: 0.10198712348937988
43804
precTrPnts time: 0.40909886360168457
43804
circList time: 0.06513214111328125
List(circList) time: 0.29528284072875977
repair_surface time: 1.0242741107940674
extend time: 0.30850696563720703
43816
TrIdx2TrCoord time: 0.26154589653015137
43816
Traceback (most recent call last):
File "/Users/esc/git/xyzcad/demo.py", line 109, in <module>
render.renderAndSave(f, 'demo.stl', 1)
File "/Users/esc/git/xyzcad/xyzcad/render.py", line 620, in renderAndSave
verticesArray = calcTrianglesCor(circPtsCoordList, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/core/dispatcher.py", line 468, in _compile_for_args
error_rewrite(e, 'typing')
File "/Users/esc/miniconda3-arm64/envs/numba_9546/lib/python3.12/site-packages/numba/core/dispatcher.py", line 409, in error_rewrite
raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Type of variable 'i.3' cannot be determined, operation: $phi306.1, location: /Users/esc/git/xyzcad/xyzcad/render.py (512)
File "xyzcad/render.py", line 512:
def calcTrianglesCor(corCircList, invertConvexness=False):
<source elided>
n = len(circ)
trInCubeList = [(circ[0], circ[i+2], circ[i+1]) for i in range(n-2)]
^
python3 demo.py 9.31s user 2.16s system 127% cpu 8.979 total
from numba.
I also tried the following, which was fine, so basically this would indicate that Numba is involved in this segfault. This happens in both cases, with the decorator activate and with the decorator commented out.
💣 zsh» NUMBA_DISABLE_JIT=1 python3 demo.py :(
findSurfacePnt time: 2.5987625122070312e-05
getSurface time: 4.59610390663147
43780 - 86528 - 86528 - 43780
coords2relations time: 0.8624508380889893
43780 - 43780 - 217572 - 86528 - 86528
cutCedgeIdx time: 0.05721306800842285
43804
precTrPnts time: 2.329416036605835
43804
circList time: 0.037850141525268555
List(circList) time: 0.00018286705017089844
repair_surface time: 0.07135581970214844
extend time: 5.0067901611328125e-06
43816
TrIdx2TrCoord time: 0.051640987396240234
43816
calcTriangles time: 0.22364020347595215
to mesh time: 0.009541988372802734
save time: 0.006164073944091797
8.254678964614868
NUMBA_DISABLE_JIT=1 python3 demo.py 9.26s user 1.58s system 127% cpu 8.528 total
from numba.
@TheTesla I would recommend to try to address the warnings and failed compilation in order to work out what is wrong here.
from numba.
@TheTesla I debugged this with lldb
today and got:
💣 zsh» lldb python3 demo.py
(lldb) target create "python3"
Current executable set to '/Users/esc/miniconda3-arm64/envs/numba_9546/bin/python3' (arm64).
(lldb) settings set -- target.run-args "demo.py"
(lldb) r
Process 67632 launched: '/Users/esc/miniconda3-arm64/envs/numba_9546/bin/python3' (arm64)
findSurfacePnt time: 0.28748393058776855
getSurface time: 1.9984591007232666
43780 - 86528 - 86528 - 43780
coords2relations time: 0.09797787666320801
43780 - 43780 - 217572 - 86528 - 86528
cutCedgeIdx time: 0.007802009582519531
43804
precTrPnts time: 0.44718384742736816
43804
circList time: 0.02591228485107422
List(circList) time: 0.32137632369995117
Process 67632 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001000a1f38 python3`list_dealloc + 40
python3`list_dealloc:
-> 0x1000a1f38 <+40>: str x8, [x10]
0x1000a1f3c <+44>: ldr x10, [x8, #0x8]
0x1000a1f40 <+48>: bfxil x9, x10, #0, #2
0x1000a1f44 <+52>: str x9, [x8, #0x8]
Target 0: (python3) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x00000001000a1f38 python3`list_dealloc + 40
frame #1: 0x000000010019c234 python3`_PyEval_EvalFrameDefault + 11416
frame #2: 0x0000000100196e98 python3`PyEval_EvalCode + 260
frame #3: 0x0000000100241404 python3`run_mod + 288
frame #4: 0x0000000100241174 python3`pyrun_file + 148
frame #5: 0x0000000100240b4c python3`_PyRun_SimpleFileObject + 288
frame #6: 0x00000001002404e4 python3`_PyRun_AnyFileObject + 232
frame #7: 0x000000010026be7c python3`pymain_run_file_obj + 260
frame #8: 0x000000010026b618 python3`pymain_run_file + 72
frame #9: 0x000000010026ae68 python3`Py_RunMain + 880
frame #10: 0x00000001000043c4 python3`main + 56
frame #11: 0x000000019c03bf28 dyld`start + 2236
Looks like this might be a Numba bug in typed-list..
from numba.
Reusing the variable name makes the segfault:
https://github.com/TheTesla/xyzcad/blob/debugsegfault/debugsegfault.py
from numba.
Type of variable 'i.3' cannot be determined, operation: $phi306.1, location: /Users/esc/git/xyzcad/xyzcad/render.py (512)
That could make sense, the error:
Type of variable 'i.3' cannot be determined, operation: $phi306.1, location: /Users/esc/git/xyzcad/xyzcad/render.py (512)
does indicate some issue resolving a phi node, so perhaps this is down to variable name re-use? It seems odd however that this would segfault instead of failing to compile.
from numba.
I had the same issue again, but now in a jitted function:
I solved it this way:
The original code worked on my home laptop, but not on my work laptop. So I had to change the variable names.
from numba.
Related Issues (20)
- test_linalg_matrix_power fails due to tolerance issues when built against lapack 3.12.0
- Numba conflict with vectorbt HOT 2
- Different type hints will result in `TypingError` when using `overload` HOT 3
- Incrementing array location with rank 0 array HOT 6
- LLVM objmode compilation error: Instruction does not dominate all uses HOT 1
- jitclass doesn't use correct type for init arg HOT 1
- 0.60.0rc1 regression: NameError: name 'length_of_iterator' is not defined HOT 2
- Global flag to prefer 32bit whenever possible HOT 3
- Non-det bug with prange code 2 HOT 3
- Parallel providing wrong result on some machine but not on other HOT 22
- `NotImplementedError` for `datetime64[10Y]`
- TypingError when conditionally shadowing variable HOT 2
- numba.typed.List fails for F-contiguous np.ndarrays if one is also C-contiguous HOT 1
- No implementation of function `Function(<built-in function setitem>)` found for signature: `setitem(readonly array(uint64, 3d, C), int64, array(int64, 1d, C))` HOT 1
- numba.core.errors.CompilerError: Failed in nopython mode pipeline (step: analyzing bytecode) / Illegal IR, del found at: del foo HOT 1
- numpy.std() results differ with and without numba HOT 4
- cumprod method doesn't upcast unsigned integer array
- A tuple of uint64 (> 2**63 but < 2**64) as the key of numba Dict
- NumPy 2.0 incompatibility - A use of `np.complex_` still remains
- NumPy 2.0 incompatibility: RNG's `__getstate__()` returns `None`
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.