3
3
module InteractiveUtils
4
4
5
5
export 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 ,
7
7
@code_typed , @code_lowered , @code_llvm , @code_native , clipboard
8
8
9
9
import Base. Docs. apropos
@@ -12,7 +12,6 @@ using Base: unwrap_unionall, rewrap_unionall, isdeprecated, Bottom, show_unquote
12
12
to_tuple_type, signature_type, format_bytes
13
13
14
14
using Markdown
15
- using LinearAlgebra # for peakflops
16
15
17
16
include (" editless.jl" )
18
17
include (" codeview.jl" )
@@ -308,36 +307,23 @@ function dumpsubtypes(io::IO, x::DataType, m::Module, n::Int, indent)
308
307
nothing
309
308
end
310
309
311
- const Distributed_modref = Ref {Module} ()
312
-
310
+ # TODO : @deprecate peakflops to LinearAlgebra
311
+ export peakflops
313
312
"""
314
313
peakflops(n::Integer=2000; parallel::Bool=false)
315
314
316
315
`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`.
326
322
"""
327
323
function 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
+ let LinearAlgebra = Base. require (Base. PkgId (
325
+ Base. UUID ((0x37e2e46d_f89d_539d ,0xb4ee_838fcccc9c8e )), " LinearAlgebra" ))
326
+ return LinearAlgebra. peakflops (n; parallel = parallel)
341
327
end
342
328
end
343
329
0 commit comments