Asynchronous Parallel Computing in MATLAB?

152 Views Asked by At

I am looking to utilize the labSend, labReceive functionality with spmd in MATLAB to execute perform the following:

  1. Lab1, run a global optimization routine and pass an intermediate result to Lab2
  2. Lab2, wait for the intermediate result from Lab1 (using labProbe), once received use this result and begin a new optimization routine.
  3. Lab3,4,..., n wait for the previous result from Lab_n-1, once received use this result and begin a new optimization routine.

Problem:

  Warning: An incoming message was discarded from lab 1 (tag: 1)
  Warning: An incoming message was discarded from lab 1 (tag: 1)
  Warning: An incoming message was discarded from lab 1 (tag: 1)
  Warning: An incoming message was discarded from lab 1 (tag: 1)
  Warning: An incoming message was discarded from lab 1 (tag: 1)

Data from labSend:

0.4907    0.3328    0.3625    0.5843    0.3159    0.5065    0.5100    0.4984    0.3336    0.5055  
0.5216    0.5268    0.5002    0.4828    0.4907    0.3328    0.3625    0.5843    0.3159    0.5065
0.5100    0.4984    0.3336    0.5055    0.5216    0.5268    0.5002    0.4828    0.5010

which is in order with 0.4907 being the first message sent via labSend.

Last value received from labReceive:

0.5055

meaning the last 5 messages from labSend were ignored.

Now, the spmd routine is asynchronous as it 1) has to wait for the intermediate result of the previous lab and 2) the optimization routine speeds up as it progresses (searching a smaller domain)

Therefore, the previous labs may send multiple messages before lab_n has the chance to process them (executing something else).

Question:

Is there a way to immediately process (receive) data from Lab1 if I am looking at Lab2 and just store it somewhere? Or is there a way to process only the most recent message? and ignore any queued messages?

Thanks for your help!

0

There are 0 best solutions below