Skip to content

Commit

Permalink
update to 1.0 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored and ararslan committed Aug 16, 2018
1 parent 4362420 commit 62db021
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 44 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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")'
40 changes: 24 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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%"
8 changes: 8 additions & 0 deletions src/array/ArrayBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 9 additions & 7 deletions src/collection/CollectionBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
36 changes: 24 additions & 12 deletions src/linalg/LinAlgBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,39 +155,51 @@ 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

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

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

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)
Expand Down
3 changes: 3 additions & 0 deletions src/micro/MicroBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions src/micro/methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/misc/MiscellaneousBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
7 changes: 6 additions & 1 deletion src/problem/ChaosGame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/problem/SparseFEM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/problem/StockCorr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 11 additions & 2 deletions src/scalar/ScalarBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62db021

Please sign in to comment.