Julia Language Parallel Processing Adding Workers


Example

When you first start Julia, by default, there will only be a single process running and available to give work to. You can verify this using:

julia> nprocs()
1

In order to take advantage of parallel processing, you must first add additional workers who will then be available to do work that you assign to them. You can do this within your script (or from the interpreter) using: addprocs(n) where n is the number of processes you want to use.

Alternatively, you can add processes when you start Julia from the command line using:

$ julia -p n

where n is how many additional processes you want to add. Thus, if we start Julia with

$ julia -p 2

When Julia starts we will get:

julia> nprocs()
3