This is just FYI for fun in case people are interested.
I compared JuMP, DiffEq and simple sort() on M1 Max MacBook using official binaries of Julia 1.7.0 with either Native ARM or x86 with Rosetta2.
Native ARM version seems to be 1.5-2x faster in JuMP, DiffEq and sort() benchmarks.
ARM Julia 1.7 still has a bunch of bugs (https://github.com/JuliaLang/julia/issues/41440 and https://github.com/JuliaLang/julia/issues/41820) and even the processor seems to not be recognized correctly (Feature/CPU Detection for Apple M1 Β· Issue #40876 Β· JuliaLang/julia Β· GitHub) so perhaps itβll get even better once everything is fixed!
ARM versioninfo()
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin21.1.0)
CPU: Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)
x86 versioninfo()
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin19.5.0)
CPU: Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, westmere)
JuMP code example from GLPK.jl readme.md used for benchmark
using JuMP, GLPK, BenchmarkTools
model = Model(GLPK.Optimizer)
@variable(model, 0 <= x <= 2.5, Int)
@variable(model, 0 <= y <= 2.5, Int)
@objective(model, Max, y)
reasons = UInt8[]
function my_callback_function(cb_data)
reason = GLPK.glp_ios_reason(cb_data.tree)
push!(reasons, reason)
if reason != GLPK.GLP_IROWGEN
return
end
x_val = callback_value(cb_data, x)
y_val = callback_value(cb_data, y)
if y_val - x_val > 1 + 1e-6
con = @build_constraint(y - x <= 1)
MOI.submit(model, MOI.LazyConstraint(cb_data), con)
elseif y_val + x_val > 3 + 1e-6
con = @build_constraint(y - x <= 1)
MOI.submit(model, MOI.LazyConstraint(cb_data), con)
end
end
MOI.set(model, GLPK.CallbackFunction(), my_callback_function)
@benchmark optimize!(model)
JuMP ARM (Native):
JuMP x89 (Rosetta2):
DiffEq code from DiffEq manual:
using DifferentialEquations, BenchmarkTools
f(u,p,t) = 1.01*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
@benchmark DifferentialEquations.solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8)
DiffEq ARM (Native):
DiffEq x89 (Rosetta2):
Code and benchmark of sort()
DiffEq ARM (Native):
DiffEq x89 (Rosetta2):