33module InteractiveUtils
44
55export apropos, edit, less, code_warntype, code_llvm, code_native, methodswith, varinfo,
6- versioninfo, subtypes, peakflops, @which , @edit , @less , @functionloc , @code_warntype ,
6+ versioninfo, subtypes, @which , @edit , @less , @functionloc , @code_warntype ,
77 @code_typed , @code_lowered , @code_llvm , @code_native , clipboard
88
99import Base. Docs. apropos
@@ -12,7 +12,6 @@ using Base: unwrap_unionall, rewrap_unionall, isdeprecated, Bottom, show_unquote
1212 to_tuple_type, signature_type, format_bytes
1313
1414using Markdown
15- using LinearAlgebra # for peakflops
1615
1716include (" editless.jl" )
1817include (" codeview.jl" )
@@ -308,36 +307,25 @@ function dumpsubtypes(io::IO, x::DataType, m::Module, n::Int, indent)
308307 nothing
309308end
310309
311- const Distributed_modref = Ref {Module} ()
312-
310+ # TODO : @deprecate peakflops to LinearAlgebra
311+ export peakflops
313312"""
314313 peakflops(n::Integer=2000; parallel::Bool=false)
315314
316315`peakflops` computes the peak flop rate of the computer by using double precision
317- [`gemm!`](@ref LinearAlgebra.BLAS.gemm!). By default, if no arguments are specified, it
318- multiplies a matrix of size `n x n`, where `n = 2000`. If the underlying BLAS is using
319- multiple threads, higher flop rates are realized. The number of BLAS threads can be set with
320- [`BLAS.set_num_threads(n)`](@ref).
321-
322- If the keyword argument `parallel` is set to `true`, `peakflops` is run in parallel on all
323- the worker processors. The flop rate of the entire parallel computer is returned. When
324- running in parallel, only 1 BLAS thread is used. The argument `n` still refers to the size
325- of the problem that is solved on each processor.
316+ [`gemm!`](@ref LinearAlgebra.BLAS.gemm!). For more information see
317+ [`LinearAlgebra.peakflops`](@ref).
318+
319+ !!! note
320+ This function will move to the `LinearAlgebra` standard library in the
321+ future, and is already available as `LinearAlgebra.peakflops`.
326322"""
327323function peakflops (n:: Integer = 2000 ; parallel:: Bool = false )
328- a = fill (1. ,100 ,100 )
329- t = @elapsed a2 = a* a
330- a = fill (1. ,n,n)
331- t = @elapsed a2 = a* a
332- @assert a2[1 ,1 ] == n
333- if parallel
334- if ! isassigned (Distributed_modref)
335- Distributed_modref[] = Base. require (Base, :Distributed )
336- end
337- Dist = Distributed_modref[]
338- sum (Dist. pmap (peakflops, fill (n, Dist. nworkers ())))
339- else
340- 2 * Float64 (n)^ 3 / t
324+ Base. depwarn (" `peakflop`s have moved to the LinearAlgebra module, " *
325+ " add `using LinearAlgebra` to your imports." , :peakflops )
326+ let LinearAlgebra = Base. require (Base. PkgId (
327+ Base. UUID ((0x37e2e46d_f89d_539d ,0xb4ee_838fcccc9c8e )), " LinearAlgebra" ))
328+ return LinearAlgebra. peakflops (n; parallel = parallel)
341329 end
342330end
343331
0 commit comments