-
Book Overview & Buying
-
Table Of Contents
Julia Cookbook
By :
In parallel computing, data movements are quite common and should be minimized due to the time and the network overhead as a result of the movements. In this recipe, we will see how that can be optimized to avoid latency as much as we can.
To get ready for this recipe, you need to have the Julia REPL started in multiprocessing mode. This is explained in the Getting ready section in the preceding recipe.
Firstly, we will see how to do a matrix computation using the @spawn macro, which helps in data movement. So, we construct a matrix of shape 200 x 200 and then try to square it using the @spawn macro. This can be done as follows:
mat = rand(200, 200) exec_mat = @spawn mat^2 fetch(exec_mat)
The preceding command gives the following output:

Now, we will look at an another way to achieve the same result. This time, we will use the @spawn macro directly instead of the initialization step. We will discuss the advantages and drawbacks of each method in the...
Change the font size
Change margin width
Change background colour