Julia does not seem to be printing the output as it appears when redirected to a file.
I have the following code in file print_test.jl
:
for i in 1:10
println("iteration: $i")
sleep(1)
end
when I run the script like: julia print_test.jl
the output is appearing as expected every second on the screen. But if I run the script like this: julia print_test.jl > test.out
, the output will appear all at once only after the script is finished.
Is there a solution so the output would be written to the file gradually?
I am running a demanding Julia script on a cluster and I am monitoring the progress with println()
function.
Interestingly, I observe the same issue if I submit the script to the queuing system and do not redirect to an external file:
#SBATCH --output=test.out
julia print_test.jl