use CPUselect.jl

This commit is contained in:
kalmarek 2018-03-22 11:05:36 +01:00
parent 4c26db6ee8
commit 10cbd4c6f3
2 changed files with 3 additions and 19 deletions

View File

@ -38,17 +38,6 @@ end
# #
############################################################################### ###############################################################################
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
function parse_commandline() function parse_commandline()
s = ArgParseSettings() s = ArgParseSettings()
@ -86,14 +75,9 @@ function parse_commandline()
end end
function main() function main()
include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=true)
parsed_args = parse_commandline()
if parsed_args["cpus"] nothing
if parsed_args["cpus"] > cpuinfo_physicalcores()
warn("Number of specified cores exceeds the physical core cound. Performance will suffer.")
end
Blas.set_num_threads(parsed_args["cpus"])
end
N = parsed_args["N"] N = parsed_args["N"]
radius = 2 radius = 2

2
SL.jl
View File

@ -51,7 +51,7 @@ end
const PARSEDARGS = parse_commandline() const PARSEDARGS = parse_commandline()
include("CPUselect.jl") include("CPUselect.jl")
# set_parallel_mthread(PARSEDARGS, workers=true) set_parallel_mthread(PARSEDARGS, workers=true)
using SCS.SCSSolver using SCS.SCSSolver
using Nemo using Nemo