Domanda

The master has a large set of tasks, which it distributes to any slave that signals its ready.

The tasks are not equal in calculation time but are all calculating some value. As an output, the master needs to calculate the most minimum value of all tasks.

The problem here is that I don't want to use synchronous send-recv calls to distribute jobs as I don't want to wait for one process to finish, before sending a job to the next one.

And so, how can I collect the results? I need to know every return value in order to return the most minimum one, but I can't tell when the value will be sent back to the master, or in what order.

Thanks for any help..

È stato utile?

Soluzione

Use nonblocking sends/receives on the master, and blocking ones on the slaves. Basically:

Master:

  1. Send jobs via nonblocking sends.
  2. Post a nonblocking receive for each result
  3. Periodically check if any of the results have arrived. If so, send a new job and post a nonblocking receive for it.
  4. Repeat step 3. until all results have arrived.

Slave:

  1. Wait for a job with a blocking receive
  2. Send the result with a blocking send
  3. Go to 1.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top