Skip to content

Commit 7934332

Browse files
authored
Implement [-t|--threads] command line argument for specifying (JuliaLang/julia#35108)
the number of Julia threads on startup, fixes JuliaLang/julia#26889.
1 parent bb465d3 commit 7934332

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/cluster.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ end
12981298

12991299
write_cookie(io::IO) = print(io.in, string(cluster_cookie(), "\n"))
13001300

1301+
# Starts workers specified by (-n|--procs) and --machine-file command line options
13011302
function process_opts(opts)
13021303
# startup worker.
13031304
# opts.startupfile, opts.load, etc should should not be processed for workers.
@@ -1310,14 +1311,17 @@ function process_opts(opts)
13101311
end
13111312
end
13121313

1314+
# Propagate --threads to workers
1315+
exeflags = opts.nthreads > 0 ? `--threads=$(opts.nthreads)` : ``
1316+
13131317
# add processors
13141318
if opts.nprocs > 0
1315-
addprocs(opts.nprocs)
1319+
addprocs(opts.nprocs; exeflags=exeflags)
13161320
end
13171321

13181322
# load processes from machine file
13191323
if opts.machine_file != C_NULL
1320-
addprocs(load_machine_file(unsafe_string(opts.machine_file)))
1324+
addprocs(load_machine_file(unsafe_string(opts.machine_file)); exeflags=exeflags)
13211325
end
13221326
return nothing
13231327
end

0 commit comments

Comments
 (0)