Don't launch the first computation on your REPL process (1), and launch
them on 2,3,4,5 instead.

On Sat Feb 21 2015 at 6:59:22 PM DumpsterDoofus <[email protected]>
wrote:

> I have a 4-core machine. I launch Julia at the REPL, and then run
> `addprocs(3)`. I then copy-paste the following into the REPL:
>
> s1 = @spawnat 1 expensiveComputation1
> s2 = @spawnat 2 expensiveComputation2
> s3 = @spawnat 3 expensiveComputation3
> s4 = @spawnat 4 expensiveComputation4
>
> where `expensiveComputationN` is some expensive computation.
>
> Ideally, all 4 processes would launch and run simultaneously.
> Unfortunately, the first line executes alone, and then only when it is
> finished do the second, third and fourth processes begin. As such, this is
> not really optimal, since the CPU's are being used 50% of the time on
> average.
>
> Is there a way to simultaneously launch @spawnat processes in one go?
>

Reply via email to