Tullio.jl icon indicating copy to clipboard operation
Tullio.jl copied to clipboard

ERROR: LoadError: Abstract type Integer does not have a definite size.

Open verena-neufeld opened this issue 3 years ago • 2 comments

Hi! I'm new to Julia so might be missing something here.

When I start Julia with julia -t N where N is 4 or so, and run this example:

using Tullio

a = Array{Integer}(undef, 5, 9000, 300)
b = zeros(Integer, 5, 9000)
c = zeros(Integer, 5, 300)

@tullio a[i, j, k] = b[i, j] - c[i, k]

Then I get this error: ERROR: LoadError: Abstract type Integer does not have a definite size.

When I only start my session with julia or when I use Int64 instead of Integer or when I have smaller arrays, then the code runs.

verena-neufeld avatar Jun 16 '22 20:06 verena-neufeld

I'd strongly suggest using Int instead of Integer.

chriselrod avatar Jun 16 '22 20:06 chriselrod

Oh that's interesting. thread_halves looks at the bit-size of number types as part of a heuristic about how finely to divide up the work. And apparently I never considered that this could be an abstract type like Integer, it should really be more robust.

But as Chris says, you almost certainly want concrete types for any real work:

julia> a .= rand.((1:99,));

julia> @btime sum($a);  # sum array of eltype Integer
  255.399 ms (13354663 allocations: 203.78 MiB)

julia> a_int = Int.(a);  # equivalent but concrete type

julia> @btime sum($a_int);
  2.758 ms (0 allocations: 0 bytes)

mcabbott avatar Jun 20 '22 02:06 mcabbott