From 62db02155edd725c8f01048446c8092869e62e1e Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Thu, 16 Aug 2018 21:04:57 +0200 Subject: [PATCH] update to 1.0 (#225) --- .travis.yml | 4 +-- appveyor.yml | 40 +++++++++++++++----------- src/array/ArrayBenchmarks.jl | 8 ++++++ src/collection/CollectionBenchmarks.jl | 16 ++++++----- src/linalg/LinAlgBenchmarks.jl | 36 +++++++++++++++-------- src/micro/MicroBenchmarks.jl | 3 ++ src/micro/methods.jl | 17 +++++++++++ src/misc/MiscellaneousBenchmarks.jl | 6 +++- src/problem/ChaosGame.jl | 7 ++++- src/problem/SparseFEM.jl | 6 +++- src/problem/StockCorr.jl | 6 +++- src/scalar/ScalarBenchmarks.jl | 13 +++++++-- 12 files changed, 118 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1116b0ae..5c950e3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,7 @@ os: - linux julia: - 0.6 + - 1.0 - nightly notifications: email: false -script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia -e 'Pkg.clone(pwd()); Pkg.build("BaseBenchmarks"); Pkg.test("BaseBenchmarks")' diff --git a/appveyor.yml b/appveyor.yml index 542fa4e6..3a762c59 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,18 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 0.6 + - julia_version: 1 + - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +# # Uncomment the following lines to allow failures on nightly julia +# # (tests will run but not make your overall status red) +# matrix: +# allow_failures: +# - julia_version: nightly branches: only: @@ -17,19 +26,18 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"BaseBenchmarks\"); Pkg.build(\"BaseBenchmarks\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"BaseBenchmarks\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" + +# # Uncomment to support code coverage upload. Should only be enabled for packages +# # which would have coverage gaps without running on Windows +# on_success: +# - echo "%JL_CODECOV_SCRIPT%" +# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" diff --git a/src/array/ArrayBenchmarks.jl b/src/array/ArrayBenchmarks.jl index d6b9a3bd..6730046f 100644 --- a/src/array/ArrayBenchmarks.jl +++ b/src/array/ArrayBenchmarks.jl @@ -9,6 +9,10 @@ using Compat.LinearAlgebra const SUITE = BenchmarkGroup() +if VERSION >= v"0.7.0-beta.85" + using Statistics +end + ############################################################################# # basic array-math reduction-like functions @@ -48,6 +52,10 @@ end include("sumindex.jl") +if VERSION > v"0.7.0-DEV.3986" + linspace(start, stop, length) = range(start; stop=stop, length=length) +end + σ = 500 A3d = samerand(11,11,11) S3d = view(A3d, 1:10, 1:10, 1:10) diff --git a/src/collection/CollectionBenchmarks.jl b/src/collection/CollectionBenchmarks.jl index 598fd08a..5329aefa 100644 --- a/src/collection/CollectionBenchmarks.jl +++ b/src/collection/CollectionBenchmarks.jl @@ -117,15 +117,17 @@ set_tolerance!(g) # Iteration # ############# -g = addgroup!(SUITE, "iteration", ["AbstractVector", "AbstractSet", "Associative"]) -foreach_container() do C, cstr, T, tstr, c - g[cstr, tstr, "start"] = @benchmarkable start($c) - g[cstr, tstr, "next"] = @benchmarkable next($c, $(start(c))) - g[cstr, tstr, "done"] = @benchmarkable done($c, $(start(c))) -end +if VERSION > v"0.7.0-DEV.5126" + g = addgroup!(SUITE, "iteration", ["AbstractVector", "AbstractSet", "Associative"]) -set_tolerance!(g) + foreach_container() do C, cstr, T, tstr, c + g[cstr, tstr, "iterate"] = @benchmarkable iterate($c) + g[cstr, tstr, "iterate second"] = @benchmarkable iterate($c, $(iterate(c)[2])) + end + + set_tolerance!(g) +end ############ # Deletion # diff --git a/src/linalg/LinAlgBenchmarks.jl b/src/linalg/LinAlgBenchmarks.jl index 075e48a4..567d4577 100644 --- a/src/linalg/LinAlgBenchmarks.jl +++ b/src/linalg/LinAlgBenchmarks.jl @@ -155,8 +155,11 @@ for M in (Matrix, Diagonal, Bidiagonal, SymTridiagonal, UpperTriangular, LowerTr mstr = typename(M) for s in SIZES m = linalgmat(M, s) - g["eig", mstr, s] = @benchmarkable eig($m) - g["eigfact", mstr, s] = @benchmarkable eigfact($m) + if VERSION < v"0.7.0-DEV.5211" + g["eigen", mstr, s] = @benchmarkable eigfact($m) + else + g["eigen", mstr, s] = @benchmarkable eigen($m) + end end end @@ -164,8 +167,11 @@ for M in (Matrix, Diagonal, Bidiagonal, UpperTriangular, LowerTriangular) mstr = typename(M) for s in SIZES m = linalgmat(M, s) - g["svd", mstr, s] = @benchmarkable svd($m) - g["svdfact", mstr, s] = @benchmarkable svdfact($m) + if VERSION < v"0.7.0-DEV.5211" + g["svd", mstr, s] = @benchmarkable svdfact($m) + else + g["svd", mstr, s] = @benchmarkable svd($m) + end end end @@ -173,8 +179,11 @@ for M in (Matrix, Tridiagonal) mstr = typename(M) for s in SIZES m = linalgmat(M, s) - g["lu", mstr, s] = @benchmarkable lu($m) - g["lufact", mstr, s] = @benchmarkable lufact($m) + if VERSION < v"0.7.0-DEV.5211" + g["lu", mstr, s] = @benchmarkable lufact($m) + else + g["lu", mstr, s] = @benchmarkable lu($m) + end end end @@ -182,12 +191,15 @@ for s in SIZES mstr = typename(Matrix) m = randmat(s) arr = m' * m - g["chol", mstr, s] = @benchmarkable chol($arr) - g["cholfact", mstr, s] = @benchmarkable cholfact($arr) - g["schur", mstr, s] = @benchmarkable schur($m) - g["schurfact", mstr, s] = @benchmarkable schurfact($m) - g["qr", mstr, s] = @benchmarkable qr($m) - g["qrfact", mstr, s] = @benchmarkable qrfact($m) + if VERSION < v"0.7.0-DEV.5211" + g["cholesky", mstr, s] = @benchmarkable cholfact($arr) + g["schur", mstr, s] = @benchmarkable schurfact($m) + g["qr", mstr, s] = @benchmarkable qrfact($m) + else + g["cholesky", mstr, s] = @benchmarkable cholesky($arr) + g["schur", mstr, s] = @benchmarkable schur($m) + g["qr", mstr, s] = @benchmarkable qr($m) + end end for b in values(g) diff --git a/src/micro/MicroBenchmarks.jl b/src/micro/MicroBenchmarks.jl index b4ba0052..a9b7e8cc 100644 --- a/src/micro/MicroBenchmarks.jl +++ b/src/micro/MicroBenchmarks.jl @@ -28,5 +28,8 @@ SUITE["quicksort"] = @benchmarkable perf_micro_quicksort(5000) SUITE["pisum"] = @benchmarkable perf_micro_pisum() SUITE["randmatstat"] = @benchmarkable perf_micro_randmatstat(1000) SUITE["randmatmul"] = @benchmarkable perf_micro_randmatmul(1000) +if (VERSION <= v"0.7.0-DEV.914" ? is_unix() : Sys.isunix()) + SUITE["printfd"] = @benchmarkable perf_printfd(10000) +end end # module diff --git a/src/micro/methods.jl b/src/micro/methods.jl index e0cb1375..041361aa 100644 --- a/src/micro/methods.jl +++ b/src/micro/methods.jl @@ -137,3 +137,20 @@ end ############## perf_micro_randmatmul(t) = rand(t,t)*rand(t,t) + + +################# +# print_to_file # +################# + +if VERSION > v"0.7.0-DEV.3026" + using Printf +end + +function perf_printfd(n) + open("/dev/null", "w") do io + for i = 1:n + @printf(io, "%d %d\n", i, i + 1) + end + end +end diff --git a/src/misc/MiscellaneousBenchmarks.jl b/src/misc/MiscellaneousBenchmarks.jl index 2180334e..792c39d0 100644 --- a/src/misc/MiscellaneousBenchmarks.jl +++ b/src/misc/MiscellaneousBenchmarks.jl @@ -84,7 +84,11 @@ function perf_parse(result::AbstractVector{T}, strings::AbstractVector) where T end g = addgroup!(SUITE, "parse", ["DateTime"]) -datestr = map(string,range(DateTime("2016-02-19T12:34:56"),Dates.Millisecond(123),200)) +if VERSION <= v"0.7.0-DEV.3986" + datestr = map(string, range(DateTime("2016-02-19T12:34:56"),Dates.Millisecond(123),200)) +else + datestr = map(string, range(DateTime("2016-02-19T12:34:56"), step = Dates.Millisecond(123), length = 200)) +end g["DateTime"] = @benchmarkable perf_parse($(similar(datestr, DateTime)), $datestr) g["Int"] = @benchmarkable perf_parse($(Vector{Int}(undef, 1000)), $(map(string, 1:1000))) g["Float64"] = @benchmarkable perf_parse($(Vector{Float64}(undef, 1000)), $(map(string, 1:1000))) diff --git a/src/problem/ChaosGame.jl b/src/problem/ChaosGame.jl index 3b538cfb..944ec38c 100644 --- a/src/problem/ChaosGame.jl +++ b/src/problem/ChaosGame.jl @@ -206,7 +206,12 @@ end function create_image_chaos(game::ChaosGame, w = DEFAULT_HEIGHT, h = DEFAULT_WIDTH, iterations = DEFAULT_ITERATIONS; filename = nothing, seed=DEFAULT_RNG_SEED) - srand(seed) + + if VERSION <= v"0.7.0-beta2.171" + srand(seed) + else + Random.seed!(seed) + end im = ones(Int, h, w) point = GVector((game.maxx + game.minx) / 2, (game.maxy + game.miny) / 2, 0.0) for _ in 1:iterations diff --git a/src/problem/SparseFEM.jl b/src/problem/SparseFEM.jl index c2395fa7..14ffa80f 100644 --- a/src/problem/SparseFEM.jl +++ b/src/problem/SparseFEM.jl @@ -33,7 +33,11 @@ function perf_sparse_fem(N) # boundary condition B = A[Ifree, Ifree] # solver - return lufact(B) + @static if VERSION <= v"0.7.0-DEV.5211" + return lufact(B) + else + return lu(B) + end end end # module diff --git a/src/problem/StockCorr.jl b/src/problem/StockCorr.jl index ecaaca67..4451a2aa 100644 --- a/src/problem/StockCorr.jl +++ b/src/problem/StockCorr.jl @@ -25,7 +25,11 @@ function perf_stockcorr() SimulPriceB[1,:] .= CurrentPrice[2] ## Generating the paths of stock prices by Geometric Brownian Motion - UpperTriangle=chol(Corr) # UpperTriangle Matrix by Cholesky decomposition + @static if VERSION <= v"0.7.0-DEV.5211" + UpperTriangle = chol(Corr) # UpperTriangle Matrix by Cholesky decomposition + else + UpperTriangle = cholesky(Corr).U + end for i = 1:n Wiener = randn(T-1,2) diff --git a/src/scalar/ScalarBenchmarks.jl b/src/scalar/ScalarBenchmarks.jl index 73c30ef4..6b101019 100644 --- a/src/scalar/ScalarBenchmarks.jl +++ b/src/scalar/ScalarBenchmarks.jl @@ -193,15 +193,24 @@ end g = addgroup!(SUITE, "intfuncs", ["prevpow2", "nextpow2"]) +if VERSION <= v"0.7.0-beta2.195" + __prevpow2(x) = prevpow2(x) + __nextpow2(x) = nextpow2(x) +else + __prevpow2(x) = prevpow(2, x) + __nextpow2(x) = nextpow(2, x) +end + + for T in INTS - x = T[0, 1, 2, 3, 4, 10, 100, 1024, 10000, 2^30, 2^30-1] + x = T[1, 2, 3, 4, 10, 100, 1024, 10000, 2^30, 2^30-1] if T == BigInt push!(x, big(2)^3000, big(2)^3000-1) end y = similar(x) tol = in(T, BIGNUMS) ? 0.40 : 0.25 tstr = string(T) - for funpow2 = (prevpow2, nextpow2), sgn = (+, -) + for funpow2 = (__prevpow2, __nextpow2), sgn = (+,) g[string(funpow2), tstr, string(sgn)] = @benchmarkable map!($funpow2, $y, $(sgn(x))) time_tolerance=tol end end