Skip to content

Commit

Permalink
Fix option -p 1, support -p auto
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy committed Mar 6, 2015
1 parent 05226ca commit 8a54356
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ let reqarg = Set(UTF8String["--home", "-H",
# load ~/.julia_history file
history_file = bool(opts.historyfile)
# add processors
if opts.nprocs > 1
if opts.nprocs > 0
addprocs(opts.nprocs)
end
# load processes from machine file
Expand Down
3 changes: 2 additions & 1 deletion doc/manual/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ those available for the ``perl`` and ``ruby`` programs::
-J, --sysimage <file> Start up with the given system image file
-C, --cpu-target <target> Limit usage of cpu features up to <target>

-p, --procs <n> Run n local processes
-p, --procs {N|auto} Integer value N launches N additional local worker processes
'auto' launches as many workers as the number of local cores
--machinefile <file> Run processes on hosts listed in <file>

-i Force isinteractive() to be true
Expand Down
14 changes: 10 additions & 4 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static const char opts[] =
" -J, --sysimage <file> Start up with the given system image file\n"
" -C, --cpu-target <target> Limit usage of cpu features up to <target>\n\n"

" -p, --procs <n> Run n local processes\n"
" -p, --procs {N|auto} Integer value N launches N additional local worker processes\n"
" 'auto' launches as many workers as the number of local cores\n"
" --machinefile <file> Run processes on hosts listed in <file>\n\n"

" -i Force isinteractive() to be true\n"
Expand Down Expand Up @@ -186,9 +187,14 @@ void parse_opts(int *argcp, char ***argvp)
break;
case 'p': // procs
errno = 0;
jl_options.nprocs = strtol(optarg, &endptr, 10);
if (errno != 0 || optarg == endptr || *endptr != 0 || jl_options.nprocs < 1)
jl_errorf("julia: -p,--procs=<n> must be an integer >= 1\n");
if (!strcmp(optarg,"auto")) {
jl_options.nprocs = jl_cpu_cores();
}
else {
jl_options.nprocs = strtol(optarg, &endptr, 10);
if (errno != 0 || optarg == endptr || *endptr != 0 || jl_options.nprocs < 1)
jl_errorf("julia: -p,--procs=<n> must be an integer >= 1\n");
}
break;
case opt_machinefile:
jl_options.machinefile = strdup(optarg);
Expand Down

0 comments on commit 8a54356

Please sign in to comment.