GroupsWithPropertyT/SL_orbit.jl

78 lines
2.1 KiB
Julia
Raw Normal View History

2017-06-22 15:18:26 +02:00
using ArgParse
2017-06-08 20:09:36 +02:00
###############################################################################
#
# Parsing command line
#
###############################################################################
function parse_commandline()
settings = ArgParseSettings()
@add_arg_table settings begin
"--tol"
2017-09-10 15:41:49 +02:00
help = "set numerical tolerance for the SDP solver"
2017-06-08 20:09:36 +02:00
arg_type = Float64
default = 1e-14
2017-06-08 20:09:36 +02:00
"--iterations"
help = "set maximal number of iterations for the SDP solver (default: 20000)"
arg_type = Int
2017-11-05 20:43:35 +01:00
default = 60000
2017-06-08 20:09:36 +02:00
"--upper-bound"
2017-09-10 15:41:49 +02:00
help = "Set an upper bound for the spectral gap"
2017-06-08 20:09:36 +02:00
arg_type = Float64
default = Inf
"--cpus"
2017-09-10 15:41:49 +02:00
help = "Set number of cpus used by solver"
2017-06-08 20:09:36 +02:00
arg_type = Int
required = false
"-N"
2017-09-10 15:41:49 +02:00
help = "Consider elementary matrices EL(N)"
2017-06-08 20:09:36 +02:00
arg_type = Int
default = 2
"-p"
2017-09-10 15:41:49 +02:00
help = "Matrices over field of p-elements (p=0 => over ZZ)"
2017-06-08 20:09:36 +02:00
arg_type = Int
default = 0
"--radius"
2017-09-10 15:41:49 +02:00
help = "Radius of ball B_r(e,S) to find solution over"
2017-06-08 20:09:36 +02:00
arg_type = Int
default = 2
"-X"
2017-09-10 15:41:49 +02:00
help = "Consider EL(N, ZZ⟨X⟩)"
action = :store_true
2017-06-08 20:09:36 +02:00
end
return parse_args(settings)
end
2017-11-06 01:58:50 +01:00
parsed_args = parse_commandline()
2017-06-08 20:09:36 +02:00
2017-11-06 01:58:50 +01:00
function cpuinfo_physicalcores()
maxcore = -1
for line in eachline("/proc/cpuinfo")
if startswith(line, "core id")
maxcore = max(maxcore, parse(Int, split(line, ':')[2]))
end
end
maxcore < 0 && error("failure to read core ids from /proc/cpuinfo")
return maxcore + 1
end
2017-06-08 20:09:36 +02:00
2017-11-06 01:58:50 +01:00
if parsed_args["cpus"] == nothing
N = cpuinfo_physicalcores()
parsed_args["cpus"] = N
info("Setting --cpus to $N")
elseif parsed_args["cpus"] > cpuinfo_physicalcores()
warn("Number of specified cores exceeds the physical core count. Performance will suffer.")
end
end
2017-06-08 20:09:36 +02:00
2017-11-06 01:58:50 +01:00
addprocs(parsed_args["cpus"])
BLAS.set_num_threads(parsed_args["cpus"])
2017-06-08 21:35:27 +02:00
2017-11-06 01:58:50 +01:00
include("SLNs.jl")
2017-06-08 20:09:36 +02:00
2017-11-06 01:58:50 +01:00
include("Orbit.jl")
main(SLNs, parsed_args)