Starting julia with flags

I am trying to start Julia using Optimization flag.
my test file is this

    for i = 1:10

I run this command

$ julia  --optimize=3 -- test.jl

but jukia returns this

ERROR: julia: invalid argument to -O (3 -- test.jl)

where are my mistake or mistakes?:smile:
Thankyou for your help and attention.

$ julia --optimize=3 test.jl

1 Like

Thank you for your attention.
I did try that but the result was the same error!

ERROR: julia: invalid argument to -O (3 test.jl)

What exactly are you running?

fredrik@fredrik-desktop:~$ cat test.jl 
for i = 1:3
fredrik@fredrik-desktop:~$ julia --optimize=3 test.jl
fredrik@fredrik-desktop:~$ julia -O3 test.jl

I guess the problem is that the space between optimization=3 and test.jl in your command is not a “real space”, for example, if I type anything between optimization=3 and test.jl, the error message is similar to yours.

julia --optimize=3_test.jl
ERROR: julia: invalid argument to -O (3_test.jl)
1 Like

I guess you are right.
but there is something that is strange. I have two machines both Linux one is mint and the other is Ubuntu. This command works on one of them and gives the error on the other one. That’s strange. I tried a new clean reinstallation but It doesn’t seem to solve the problem.

After all, Thank you for your attention and help.
and If you have advice for me I will be glad hearing that.

I have a CFD code and I am trying to make its speed better but the code I’m trying to run is a simple hello world test code.

This problem is likely cause by the shell (or other program) that is starting up the Julia process. It is not passing the arguments in the correct way, interpreting space as part of the argument, instead of a separator between arguments.

What shell are you using? Or are you starting Julia using a function call from some programming language?

Do you have any funny environment variables set? (Some shells allow you to specify that space will not be used to separate arguments.)

Thanks for your help.
Your idea made me check that if ssh is messing with the command.
after some trial and error, I figured out that this is a bug of JuliaPro.

Anyway, thank you for your attention.