Generate Input for Tullio

I’d like to benchmark my own code for working with N-dimensional arrays. As baseline, Tullio seems to be the fastest, significantly faster than sum.

Given the setup

using BenchmarkTools
using Tullio

const M = 3
const N = 6
const dims = ntuple(x -> M, N)

# type(A) <: AbstractArray{T, N}, not specifically Array!
A = rand(dims...);

# Can be more complicated, but I'd like to get the MCVE working first.
@benchmark begin
    @tullio res = A[a, b, c, d, e, f]

How can I make my benchmark code parametric over N using a macro?

Edit: I’m also happy if a similar macro-less solution exists.

I think Tullio.jl does not allow for this.

Probably you can adapt the snippets from @mcabbott

1 Like