[Beowulf] Re: Writing a parallel program
roudy
rgoornaden at intnet.mu
Sun Mar 14 22:12:55 EST 2004
Hello,
I don't know if it will be here that I can get a solution to my problem.
Well, I have an array of elements and I would like to divide the array by
the number of processors and then each processor process parts of the whole
array.
Below is the source code of how I am proceeding, can someone tell me what is
wrong?
Assume that the I have an array allval[tdegree]
void share_data(void)
{
double nleft;
int i, k, j, nmin;
nmin = tdegree/size; /* Number of degrees to be handled by each processor
*/
nleft = tdegree%size;
for(i=0;i<size;i++)
ndegree[i] = ( i < nleft) ? nmin + 1 : nmin ;
displ[i] += ndegree[i];
printf("\n%s: Number of points handled = %d\n", processor_name,
ndegree[rank]);
MPI_Scatterv ((void *)allval, ndegree, displ, MPI_DOUBLE, (void *)&val[1],
ndegree[rank], MPI_DOUBLE, MASTERNODE, MPI_COMM_WORLD);
}
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf
mailing list