Download MATLAB PARALLEL COMPUTING TOOLBOX - S User`s guide
Transcript
codistributed.sprand spmd(4) CS = codistributed.sprand(1000, 1000, .001); end creates a 1000-by-1000 sparse codistributed double array CS with approximately 1000 nonzeros. CS is distributed by its second dimension (columns), and each worker contains a 1000-by-250 local piece of CS. spmd(4) codist = codistributor1d(2, 1:numlabs); CS = sprand(10, 10, .1, codist); end creates a 10-by-10 codistributed double array CS with approximately 10 nonzeros. CS is distributed by its columns, and each worker contains a 10-by-labindex local piece of CS. More About Tips When you use sprand on the workers in the parallel pool, or in an independent or communicating job (including pmode), each worker sets its random generator seed to a value that depends only on the labindex or task ID. Therefore, the array on each worker is unique for that job. However, if you repeat the job, you get the same random data. See Also sprand | rand | distributed.sprandn 11-37