Skip to content

Commit

Permalink
close #1073
Browse files Browse the repository at this point in the history
disable print in gk.jl for benchmarking
adjust some iteration counts
  • Loading branch information
JeffBezanson committed Aug 8, 2012
1 parent 53cccf3 commit eac4b85
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 159 deletions.
56 changes: 28 additions & 28 deletions examples/gk/gk.jl
Expand Up @@ -8,7 +8,7 @@
function myunifskew(n)
A = zeros(n, n)

print("A[i,j] initialized with zeros \n");
#print("A[i,j] initialized with zeros \n");

for i=1:n
for j=1:i-1
Expand All @@ -28,8 +28,8 @@ function myunifskew(n)

end
if rem(i,1000) == 0
print(i)
print("\n")
#print(i)
#print("\n")
end
end

Expand Down Expand Up @@ -64,15 +64,15 @@ function gk(n, myeps)

csum = zeros(n)

tic()
# tic()
while(stop != 1)
t=t+1
iter=t
#iteration number

if rem(iter, 100) == 0
print(iter)
print("\n")
#print(iter)
#print("\n")
end

for i=1:n
Expand Down Expand Up @@ -114,7 +114,7 @@ function gk(n, myeps)

end

times[KK] = toc()
times[KK] = 0#toc()
iteration[KK] = iter

x = X/t
Expand All @@ -133,7 +133,7 @@ function gk(n, myeps)
end

if Axepse==n
print(" \n Ax <= eps*e \n")
#print(" \n Ax <= eps*e \n")
end

#if A*x <= eps*e
Expand All @@ -148,38 +148,38 @@ function gk(n, myeps)
end

if errorlmt ==n
print("Assertion condition is satisfied i.e. AX-U<10^-8 \n")
#print("Assertion condition is satisfied i.e. AX-U<10^-8 \n")
else
print("Error: AX-U<10^-8 not satisfied \n")
end

#print("welcome")

print("Time for \n")
print(eps)
print("\n")
print("is \n")
print(times[KK])
print("\n")
print("Number of iteration is \n")
print(iteration[KK])
print("\n")
# print("Time for \n")
# print(eps)
# print("\n")
# print("is \n")
# print(times[KK])
# print("\n")
# print("Number of iteration is \n")
# print(iteration[KK])
# print("\n")
end

print("Epsilon vector is \n")
print(myeps)
print("\n")
print("time vector is \n ")
print(times)
print("\n")
print("Iteration Vector is \n")
print(iteration)
print("\n \n")
# print("Epsilon vector is \n")
# print(myeps)
# print("\n")
# print("time vector is \n ")
# print(times)
# print("\n")
# print("Iteration Vector is \n")
# print(iteration)
# print("\n \n")

#out = [myeps, time, iteration]
#print("Epsilon-Time-Iteration tradeoff \n")
#print(out)
print("\n \n")
#print("\n \n")

end
#end # @profile begin
2 changes: 1 addition & 1 deletion examples/stockcorr.jl
Expand Up @@ -7,7 +7,7 @@ function stockcorr()
CurrentPrice = [78. 102.] # Initial Prices of the two stocks
Corr = [1. 0.4; 0.4 1.] # Correlation Matrix
T = 500 # Number of days to simulate = 2years = 500days
n = 100000 # Number of simulations
n = 3000 # Number of simulations
dt = 1/250 # Time step (1year = 250days)
Div=[0.01 0.01] # Dividend
Vol=[0.2 0.3] # Volatility
Expand Down
25 changes: 0 additions & 25 deletions test/perf2/bounds.jl

This file was deleted.

29 changes: 0 additions & 29 deletions test/perf2/fusion.jl

This file was deleted.

36 changes: 0 additions & 36 deletions test/perf2/inline.jl

This file was deleted.

40 changes: 0 additions & 40 deletions test/perf2/looping.jl

This file was deleted.

72 changes: 72 additions & 0 deletions test/perf2/perf2.jl
@@ -0,0 +1,72 @@
macro timeit(ex,name)
quote
t = Inf
for i=1:5
t = min(t, @elapsed $ex)
end
println($name, "\t", t*1000)
end
end

srand(1776) # get more consistent times

require("$JULIA_HOME/../../examples/list.jl")

function listn1n2(n1::Int64,n2::Int64)
l1 = Nil{Int64}()
for i=n2:-1:n1
l1 = Cons{Int64}(i,l1)
end
l1
end

@timeit listn1n2(1,10^6) "cons "
gc()


# issue #950
load("$JULIA_HOME/../../examples/gk/gk.jl")
@timeit gk(350,[0.1]) "gk "

# issue #942
require("linalg_sparse.jl")
s = sparse(ones(280,280));
@timeit s*s "sparsemul"

# issue #939
y = [500000:-1:1];
@timeit sortperm(y) "sortperm"

# issue #938
x = 1:600000;
@timeit sparse(x,x,x) "sparserang"

# issue #445
load("$JULIA_HOME/../../examples/stockcorr.jl")
@timeit stockcorr() "stockcorr"


function cmp_with_func(x::Vector, f::Function)
count::Int = 0
for i = 1:length(x)-1
if f(x[i], x[i+1])
count += 1
end
end
return count
end

x = randn(200_000)
@timeit (for n in 1:10; count = cmp_with_func(x, isless) end) "funarg "


function arith_vectorized(b,c,d)
a = b.*c + d + 1.0
end

len = 1_000_000
b = randn(len)
c = randn(len)
d = randn(len)

@timeit (for n in 1:10; a = arith_vectorized(b,c,d); end) "vectoriz"

0 comments on commit eac4b85

Please sign in to comment.