0

I have a text file having n number of rows. i want to divide these rows among processors in 1:2 ratio means master node take only half of the lines than other processors. I followed code for equal distribution of lines from the link MPI Reading from a text file. here we are dividing file equally among processors.Since this code is effective when all processor's speeds are same. but in my case master node is taking more time compare to other processors. so i want give less number of lines to master node compare to others to speed up the code. can any one provide the logic or source code for unequal distribution ?

Community
  • 1
  • 1
  • The last time I worked with MPI is years age so I can't provide you with an example, but one possible way of distributing workloads could be: Suppose you have 2n-1 nodes. Then you create your data chunks and send two chunks to every slave and only one chunk to the master. In this example, n is the number of 'real' nodes you want to use, including the master. – flowit Oct 14 '15 at 10:09
  • 3
    Use the code from Jonathan Dursi, just adjust the computation of the initial file position accordingly. It is a simple mathematical problem, i.e. divide the work into `(2*nprocs+1)` chunks, have the master rank take one chunk and all the other ranks take two chunks. – Hristo Iliev Oct 14 '15 at 12:24

0 Answers0