Skip to content

Conversation

@terasakisatoshi
Copy link
Contributor

  • This PR allows Pluto to run 32bit system e.g. RaspberryPi devices. On such devices, the default type of numeric is regarded as Int32. Therefore if one defines function which accepts only Int64 (not Int), we will get MethodError: no method matching f(::Int32). Here is my log that shows what happens.
julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c7* (2020-11-09 13:37 UTC)
Platform Info:
  OS: Linux (arm-linux-gnueabihf)
  CPU: ARMv7 Processor rev 3 (v7l)
  WORD_SIZE: 32
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, cortex-a72)

julia> Sys.WORD_SIZE
32

julia> 1 |> typeof
Int32

julia> f(x::Int64) = 2x
f (generic function with 1 method)

julia> f(1)
ERROR: MethodError: no method matching f(::Int32)
Closest candidates are:
  f(::Int64) at REPL[4]:1
Stacktrace:
 [1] top-level scope at REPL[5]:1

julia> f(x::Int) = 2x
f (generic function with 2 methods)

julia> f(1)
2

If this PR is merged, Pluto.jl can support many devices 👍 . Below image is our future.

image

@pankgeorg
Copy link
Collaborator

Probably (but not even 50% sure, source) that's also needed for the webassembly build

@terasakisatoshi terasakisatoshi changed the title replace Int64 with Int replace Int64 with Int to support 32bit system Dec 1, 2020
@fonsp
Copy link
Owner

fonsp commented Dec 1, 2020

Can you share the error you get when you use Pluto without this fix?

@fonsp
Copy link
Owner

fonsp commented Dec 1, 2020

I'm sure that this PR will break the array view: try running zeros(100) and then click on "..." inside the array output

@terasakisatoshi
Copy link
Contributor Author

terasakisatoshi commented Dec 1, 2020

EDIT: I've updated script

I'm sorry, when I try notebook regarding Plots.jl, it works. The real problem is when we using PyPlot.jl. Sorry for the confusion. Anyway

@fonsp Here is my error message: (Pluto v0.12.15)

Failed to show value:

MethodError: no method matching get_my_display_limit(::Array{Float64,1}, ::Int32, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Int32, ::Int32)

Closest candidates are:

get_my_display_limit(::Any, !Matched::Int64, ::IOContext, !Matched::Int64, !Matched::Int64) at /home/pi/.julia/packages/Pluto/aJBx9/src/runner/PlutoRunner.jl:654

tree_data(::AbstractArray{var"#s10",1} where var"#s10", ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}})@PlutoRunner.jl:667
show_richest(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any)@PlutoRunner.jl:585
#sprint_withreturned#27(::IOContext{Base.DevNull}, ::Int32, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::Array{Float64,1})@PlutoRunner.jl:544
#format_output_default#15(::Pair{Symbol,Dict{Tuple{UInt32,Int64},Int64}}, ::typeof(Main.PlutoRunner.format_output_default), ::Any)@PlutoRunner.jl:469
#format_output#16(::Pair{Symbol,Dict{Tuple{UInt32,Int64},Int64}}, ::typeof(Main.PlutoRunner.format_output), ::Array{Float64,1})@PlutoRunner.jl:486
formatted_result_of(::Base.UUID, ::Bool, ::Nothing)@PlutoRunner.jl:411
top-level scope@none:1

image

EDIT:

When we put ['H','E','l','l','o'] into cell, similar error occured

Failed to show value:

MethodError: no method matching get_my_display_limit(::Array{Char,1}, ::Int32, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Int32, ::Int32)

Closest candidates are:

get_my_display_limit(::Any, !Matched::Int64, ::IOContext, !Matched::Int64, !Matched::Int64) at /home/pi/.julia/packages/Pluto/aJBx9/src/runner/PlutoRunner.jl:654

tree_data(::AbstractArray{var"#s10",1} where var"#s10", ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}})@PlutoRunner.jl:667
show_richest(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any)@PlutoRunner.jl:585
#sprint_withreturned#27(::IOContext{Base.DevNull}, ::Int32, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::Array{Char,1})@PlutoRunner.jl:544
#format_output_default#15(::Pair{Symbol,Dict{Tuple{UInt32,Int64},Int64}}, ::typeof(Main.PlutoRunner.format_output_default), ::Any)@PlutoRunner.jl:469
#format_output#16(::Pair{Symbol,Dict{Tuple{UInt32,Int64},Int64}}, ::typeof(Main.PlutoRunner.format_output), ::Array{Char,1})@PlutoRunner.jl:486
formatted_result_of(::Base.UUID, ::Bool, ::Nothing)@PlutoRunner.jl:411
top-level scope@none:1

image

@terasakisatoshi
Copy link
Contributor Author

terasakisatoshi commented Dec 1, 2020

If this PR adopts, we will get this screenshot:

image

I'm sure that this PR will break the array view: try running zeros(100) and then click on "..." inside the array output

I've tried zero(100) and expand elements of the array by clicking "...".
Is this wrong ?

image

also

image

@fonsp
Copy link
Owner

fonsp commented Dec 1, 2020

Thanks! I managed to get a 32 bit version of Julia working so I can have a look at it myself :) It looks like there are still some small things to fix before all the tests pass, working on it now

@fonsp
Copy link
Owner

fonsp commented Dec 1, 2020

(FYI this is what I mean with Pluto's tests: image)

@fonsp fonsp changed the title replace Int64 with Int to support 32bit system 🍓 Support 32-bit systems Dec 1, 2020
@fonsp fonsp merged commit 4854572 into fonsp:master Dec 1, 2020
@terasakisatoshi terasakisatoshi deleted the allow-32bit-system branch December 1, 2020 20:57
@terasakisatoshi
Copy link
Contributor Author

thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants