Newsgroups: comp.parallel.pvm
From: s950062@logic.csc.cuhk.hk (fft)
Subject: a little problem
Organization: The Chinese University of Hong Kong
Date: 29 Nov 1995 09:50:25 GMT
Message-ID: <49had1$qvg@hpg30a.csc.cuhk.hk>

Dear all,
I've a little problem in pvm.
I want to distribute each rows of a matrix to each hosts respectively.
(let's consider there are only 4 slave(host) and that matrix is only 4*4)
And also, I want to distribute a fixed vector to each hosts as well.
And then I'll do some operation on each rows with that fixed vectors
in each hosts respectively.
So, basically, my master program will be sth. like this:

    float mat[4][4],vec[4];
    n = 4; nproc=n; int k;
        r=0;
        for (k=0; k<nproc ; k++)
        {        
	pvm_initsend(PvmDataDefault);
	pvm_pkint(&nproc, 1, 1);
	pvm_pkint(tids, nproc, 1);
	pvm_pkint(&n, 1, 1);
	pvm_pkfloat(vec, n, 1);
        pvm_pkfloat(mat[r], 1, 1);   /* anything wrong here? */
        pvm_send(tids[k],0);
        r++;
        }

--

Then, I expect each host will receive a particular row of the matrix.
say, host_1 receive row 1 of mat[4][4], host_2 receive row 2 of mat[4][4],
... , host_4 receive row 4 of mat[4][4].
And all hosts will receive a fixed vector v[4];
and hence I can perform some operation on each rows of a matrix to that 
vector vec respectively in each hosts. (actually, dot_product only. :-) )
But seems that it didn';t work.
anything wrong with the above idea?
I would like to know what is the correct and best method to spawn
each rows of a matrix to each hosts respectively b'cos i guess this may
be the key problem for my code.
thanks for enligtenment.
bye.


--fft

