I have a piece of simulation software that makes millions of calls to Optim.optimize during runs. I seemingly have a lot of allocations, so I use JET and tested my code with @report_opt. The result was a large number of “runtime dispatch detected errors”. To verify that everything was ok I then ran the small toy problem from the Optim.jl tutorial:
using JET
using Optim
f(x) = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
x0 = [0.0, 0.0]
@report_opt optimize(f, x0)
The result is 71 possible errors found. Is this to be expected, or are there optimizations I am not aware of?