The low-level facilities that we saw in the previous section are quite flexible and very powerful. However, they leave a lot to be desired in terms of ease of use. Julia, therefore, has built-in set of higher-level programming tools that make it much easier to write parallel code. We will discuss some of them in the next section.
The @everywhere
macro is used to run the same code in all the processes in the cluster. This is useful to set up the environment to run the actual parallel computation later. The following code loads the Distributions
package and calls the rand
method on all the nodes simultaneously, as follows:
julia> @everywhere using Distributions julia> @everywhere rand(Normal())