modular / modular/modular

[BUG]: internal c++ exception breakpoint(-5) from the example notebook

Open
#1,703 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug mojo mojo-repo
Dominant language
Mojo
Stars
29.8k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Bug description

The example notebook Mandelbrot.ipynb fails at first command

Steps to reproduce

Try to execute https://github.com/modularml/mojo/blob/main/examples/notebooks/Mandelbrot.ipynb locally
From the first command

#|code-fold: true
import benchmark
from complex import ComplexSIMD, ComplexFloat64
from math import iota
from python import Python
from sys.info import num_physical_cores
from algorithm import parallelize, vectorize
from tensor import Tensor
from utils.index import Index

alias float_type = DType.float64
alias simd_width = 2 * simdwidthof[float_type]()

got

error: Expression [4]:1:30: use of unknown declaration 'float_type'
def show_plot(tensor: Tensor[float_type]):
                             ^~~~~~~~~~

error: Expression [4]:11:29: unexpected token in expression
    for row in range(height):
                            ^

error: Expression [4]:11:29: statements must start at the beginning of a line
    for row in range(height):
                            ^

error: Expression [4]:2:19: could not find builtin 'IntLiteral' type
    alias scale = 10
                  ^

error: Expression [4]:3:17: could not find builtin 'IntLiteral' type
    alias dpi = 64
                ^

expression failed to parse (no further compiler diagnostics)
error: Expression [6]:2:20: use of unknown declaration 'float_type', 'fn' declarations require explicit variable declarations
    let t = Tensor[float_type](height, width)
                   ^~~~~~~~~~

error: Expression [6]:12:37: use of unknown declaration 'iota', 'fn' declarations require explicit variable declarations
            let cx = min_x + (col + iota[float_type, simd_width]()) * scale_x
                                    ^~~~

error: Expression [6]:14:21: use of unknown declaration 'ComplexSIMD', 'fn' declarations require explicit variable declarations
            let c = ComplexSIMD[float_type, simd_width](cx, cy)
                    ^~~~~~~~~~~

error: Expression [6]:20:9: use of unknown declaration 'vectorize', 'fn' declarations require explicit variable declarations
        vectorize[simd_width, compute_vector](width)
        ^~~~~~~~~

error: Expression [6]:27:22: use of unknown declaration 'benchmark', 'fn' declarations require explicit variable declarations
    let vectorized = benchmark.run[bench[simd_width]](
                     ^~~~~~~~~

error: Expression [6]:34:13: use of unknown declaration 'show_plot'
        _ = show_plot(t)
            ^~~~~~~~~

expression failed to parse (no further compiler diagnostics)
error: Expression [7]:2:20: use of unknown declaration 'float_type', 'fn' declarations require explicit variable declarations
    let t = Tensor[float_type](height, width)
                   ^~~~~~~~~~

error: Expression [7]:12:37: use of unknown declaration 'iota', 'fn' declarations require explicit variable declarations
            let cx = min_x + (col + iota[float_type, simd_width]()) * scale_x
                                    ^~~~

error: Expression [7]:14:21: use of unknown declaration 'ComplexSIMD', 'fn' declarations require explicit variable declarations
            let c = ComplexSIMD[float_type, simd_width](cx, cy)
                    ^~~~~~~~~~~

error: Expression [7]:18:9: use of unknown declaration 'vectorize', 'fn' declarations require explicit variable declarations
        vectorize[simd_width, compute_vector](width)
        ^~~~~~~~~

error: Expression [7]:23:9: use of unknown declaration 'parallelize', 'fn' declarations require explicit variable declarations
        parallelize[worker](height, height)
        ^~~~~~~~~~~

error: Expression [7]:25:24: use of unknown declaration 'benchmark', 'fn' declarations require explicit variable declarations
    let parallelized = benchmark.run[bench_parallel[simd_width]](
                       ^~~~~~~~~

error: Expression [7]:32:13: use of unknown declaration 'show_plot'
        _ = show_plot(t)
            ^~~~~~~~~

expression failed to parse (no further compiler diagnostics)
error: Expression [9]:2:1: use of unknown declaration 'compare'
compare()
^~~~~~~

expression failed to parse (no further compiler diagnostics)
error: Execution was interrupted, reason: internal c++ exception breakpoint(-5)..
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
System information
On:
Apple M2 Pro
14.2.1 (23C71)
Apple clang version 15.0.0
mojo 0.7.0 (af002202)
modular 0.4.1 (2d8afe15)

jupyter --version
Selected Jupyter core packages...
IPython          : 8.20.0
ipykernel        : 6.29.0
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.7.1
jupyter_server   : 2.12.5
jupyterlab       : 4.0.11
nbclient         : 0.9.0
nbconvert        : 7.14.2
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open examples/notebooks/Mandelbrot.ipynb and reproduce the first command using the reported Mojo and Modular versions. Read the notebook cells around the initial imports and compare them with the compiler diagnostics. Done means the notebook proceeds past its first command without the listed parse errors or internal C++ exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.