Closed albert-de-montserrat closed 9 months ago
@albert-de-montserrat Thanks for catching this! Making the type aliases in the Data module constant solves this:
julia> using ParallelStencil
[ Info: Precompiling ParallelStencil [94395366-693c-11ea-3b26-d9b7aac5d958]
julia> @init_parallel_stencil(package=Threads, numbertype=Float64)
julia> function foo(nx, ny)
A_eff = (8*2)/1e9*nx*ny*sizeof(Data.Number)
end
foo (generic function with 1 method)
julia> @code_warntype foo(20, 20)
MethodInstance for foo(::Int64, ::Int64)
from foo(nx, ny) @ Main REPL[4]:1
Arguments
#self#::Core.Const(foo)
nx::Int64
ny::Int64
Locals
A_eff::Float64
Body::Float64
1 ─ %1 = (8 * 2)::Core.Const(16)
│ %2 = (%1 / 1.0e9)::Core.Const(1.6e-8)
│ %3 = Main.Data.Number::Core.Const(Float64)
│ %4 = Main.sizeof(%3)::Core.Const(8)
│ %5 = (%2 * nx * ny * %4)::Float64
│ (A_eff = %5)
└── return %5
PR coming up...
Great thanks!
Was running some tests and just realised that
Data.Number
appears to be type unstable. E.g. :with