Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support host count in machinefile #7616

Merged
merged 2 commits into from Oct 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion base/client.jl
Expand Up @@ -236,7 +236,7 @@ function process_options(args::Vector{UTF8String})
addprocs(np)
elseif args[i]=="--machinefile"
i+=1
machines = split(readall(args[i]), '\n', false)
machines = load_machine_file(args[i])
addprocs(machines)
elseif args[i]=="-v" || args[i]=="--version"
println("julia version ", VERSION)
Expand Down Expand Up @@ -327,6 +327,19 @@ function load_juliarc()
try_include(abspath(homedir(),".juliarc.jl"))
end

function load_machine_file(path::String)
machines = String[]
for line in split(readall(path),'\n',false)
s = split(line,'*',false)
if length(s) > 1
append!(machines,fill(s[2],int(s[1])))
else
push!(machines,line)
end
end
return machines
end

function early_init()
Sys.init_sysinfo()
if CPU_CORES > 8 && !("OPENBLAS_NUM_THREADS" in keys(ENV)) && !("OMP_NUM_THREADS" in keys(ENV))
Expand Down
17 changes: 9 additions & 8 deletions doc/manual/getting-started.rst
Expand Up @@ -65,14 +65,15 @@ Or you could put that code into a script and run it::
foo
bar

Julia can be started in parallel mode with either the ``-p`` or the
``--machinefile`` options. ``-p n`` will launch an additional ``n``
worker processes, while ``--machinefile file`` will launch a worker
for each line in file ``file``. The machines defined in ``file`` must be
accessible via a passwordless ``ssh`` login, with Julia installed at the
same location as the current host. Each machine definition takes the form
``[user@]host[:port] [bind_addr]`` . ``user`` defaults to current user,
``port`` to the standard ssh port. Optionally, in case of multi-homed hosts,
Julia can be started in parallel mode with either the ``-p`` or the
``--machinefile`` options. ``-p n`` will launch an additional ``n`` worker
processes, while ``--machinefile file`` will launch a worker for each line in
file ``file``. The machines defined in ``file`` must be accessible via a
passwordless ``ssh`` login, with Julia installed at the same location as the
current host. Each machine definition takes the form
``[count*][user@]host[:port] [bind_addr]`` . ``user`` defaults to current user,
``port`` to the standard ssh port. ``count`` is the number of workers to spawn
on the node, and defaults to 1. Optionally, in case of multi-homed hosts,
``bind_addr`` may be used to explicitly specify an interface.


Expand Down