Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access command line options in Julia

Tags:

julia

When I type

$ julia -p 2 run.jl

is there any way to access the 2 from within run.jl? I know that one can use ARGS to access arguments, for example

#run.jl
println(ARGS[2])

and running

$ julia -p 2 run.jl a b c d

would return b. But I can't seem to find a way to access the options -p <n>.

like image 525
Darcy Webber Avatar asked Oct 20 '22 07:10

Darcy Webber


1 Answers

In 0.4+, you can access the parsed options via Base.JLOptions(), so your argument to -p would be here:

Base.JLOptions().nprocs
like image 155
lossleader Avatar answered Nov 15 '22 06:11

lossleader