From 781eb5d5df9637222f89e1a1c3d6df51fee34038 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Tue, 1 Apr 2025 11:14:46 +0200 Subject: [PATCH] `peakflops`: make the element type a static parameter of the method Otherwise `eltype` is inferred as merely `DataType`. Too bad that constprop doesn't fix this on its own. This makes the sysimage more resistant to invalidation. --- src/LinearAlgebra.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LinearAlgebra.jl b/src/LinearAlgebra.jl index 00e17000..e9a3677d 100644 --- a/src/LinearAlgebra.jl +++ b/src/LinearAlgebra.jl @@ -752,10 +752,10 @@ of the problem that is solved on each processor. This function requires at least Julia 1.1. In Julia 1.0 it is available from the standard library `InteractiveUtils`. """ -function peakflops(n::Integer=default_peakflops_size; eltype::DataType=Float64, ntrials::Integer=3, parallel::Bool=false) +function peakflops(n::Integer=default_peakflops_size; eltype::Type{ElType}=Float64, ntrials::Integer=3, parallel::Bool=false) where {ElType} t = zeros(Float64, ntrials) for i=1:ntrials - a = ones(eltype,n,n) + a = ones(ElType,n,n) t[i] = @elapsed a2 = a*a @assert a2[1,1] == n end