In short: use SharedArrays, if all processes are on the same host. The example in the documentation should make this pretty clear, but feel free to post again if it's not.
As for # of procs, just try different choices up to the # of cores in your machine and see what happens. --Tim On Thursday, October 22, 2015 08:06:30 AM [email protected] wrote: > Hi all, > > I swear I tried to look into the documentation or online but I can't figure > out what I want to do. > I have a lot of sequential code executed and at some point I want to > parallelize the following loop: > > mat_a = zeros(n, n) > for i = 1:n > mat_a[i,i:n] = mean(mat_b[:,i] .* mat_b[:,i:n], 1) > end > > with mat_b being computed before. > > I have a bunch of questions in order to better understand things: > > - how to best choose the number of procs with which I run julia? > - since each operation on the rows of mat_a can be done independently from > the others, I'd like to send mat_b to each worker so that it can compute > certain lines of the matrix mat_a in the form of an array of vector which I > would concatenate afterwards to retrieve mat_a. I wanted to send mat_b with > the @everywhere macro but it seems this works only for definitions of > variables directly on a worker. I don't know how to send already computed > data to a specific worker. > - more generally, is this the best approach to parallelizing this kind of > code? > > Any advice appreciated, > > Thanks a lot,
