Repository navigation
Expand file tree
/
Copy pathrun.jl
More file actions
89 lines (81 loc) · 2.7 KB
/
Copy pathrun.jl
File metadata and controls
89 lines (81 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env julia
##
## Run individual Circuitscape.jl tests from the BigTests suite.
##
## Usage:
## julia --project=. run.jl 1m/1m.ini
## julia --project=. run.jl 6m/6m-all.ini
## julia --project=. run.jl verify/config_files/250k.ini
## julia --project=. run.jl CarlosAllToOne/test1000.ini
## julia --project=. run.jl Ill-Conditioned # runs all ill-conditioned tests
using Circuitscape
function run_ini(inifile)
println("=" ^ 60)
println("Running: $inifile")
println("=" ^ 60)
t = @elapsed result = compute(inifile)
println("Completed in $(round(t, digits=2)) seconds")
println()
return result
end
function run_ill_conditioned()
root = joinpath(@__DIR__, "Ill-Conditioned")
# 1m_succeeds: 1000x1000 with 10^8 magnitude variation
println("Ill-Conditioned: 1m_succeeds (1000x1000, mag=10^8)")
inifile = joinpath(root, "1m_succeeds", "1m_succeeds.ini")
if isfile(inifile)
run_ini(inifile)
else
println(" INI file not found — create one or run via create_and_run below")
end
# 6m: 2000x3000 with 10^8 magnitude variation
println("Ill-Conditioned: 6m (2000x3000, mag=10^8)")
inifile = joinpath(root, "6m", "6m.ini")
if isfile(inifile)
run_ini(inifile)
else
println(" INI file not found — create one or run via create_and_run below")
end
end
if length(ARGS) == 0
println("""
Usage:
julia --project=. run.jl <ini-file>
julia --project=. run.jl Ill-Conditioned
Examples:
julia --project=. run.jl 1m/1m.ini
julia --project=. run.jl 6m/6m-all.ini
julia --project=. run.jl 1m/1m-20points.ini
julia --project=. run.jl verify/config_files/250k.ini
julia --project=. run.jl CarlosAllToOne/test1000.ini
Available .ini files:""")
for f in sort(filter(f -> endswith(f, ".ini"), readdir(@__DIR__, join=false)))
# skip top-level, look in subdirs
end
for d in sort(readdir(@__DIR__))
dp = joinpath(@__DIR__, d)
isdir(dp) || continue
for f in sort(filter(x -> endswith(x, ".ini"), readdir(dp)))
println(" $d/$f")
end
# Check one level deeper
for sd in sort(readdir(dp))
sdp = joinpath(dp, sd)
isdir(sdp) || continue
for f in sort(filter(x -> endswith(x, ".ini"), readdir(sdp)))
println(" $d/$sd/$f")
end
end
end
elseif ARGS[1] == "Ill-Conditioned"
run_ill_conditioned()
else
for inifile in ARGS
path = isabspath(inifile) ? inifile : joinpath(@__DIR__, inifile)
if !isfile(path)
println("ERROR: File not found: $path")
continue
end
run_ini(path)
end
end