Newsgroups: comp.parallel.pvm
From: JAIME ANTONIO MURO ALVAREZ <al178495>
Subject: i need help!!!!
Organization: ITESM Campus Monterrey
Date: 20 Oct 1995 23:52:18 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <469cni$8t1@academ00.mty.itesm.mx>

Hi, all


	First, sorry by my english ...

	I have a problem in a program there are my program slave and my program
master, is the multiplication of martix - vector , the normalitation, but my
problem is ... the program not funtion ... 

this is part of my master program ...

{
	int i,j,t,tt, msgtag, ini, fin, patron, res, index;
        vector bb;
        int num=0;
        	
	patron = MAXNUM/nproc;
	res = MAXNUM%nproc;
	ini = 0;
	if (res != 0) patron++;
	fin = patron;
	msgtag = 50;
	
	pvm_initsend(PvmDataDefault);   /* Aqui mando el vector */
	pvm_pkint(&nproc, 1, 1);
	pvm_pkint(tids, nproc, 1);
	pvm_pkfloat(b, MAXNUM, 1);
	pvm_mcast(tids, nproc, msgtag);
	tt=0;

	do
	{
		printf("Aqui mando del %d al %d, ciclo %d\n", ini, fin, tt);
		pvm_initsend(PvmDataDefault);  /* Aqui distribuyo la matriz */
		pvm_pkint(&ini,1,1);
		pvm_pkint(&fin,1,1);
		msgtag=51;
		pvm_send(tids[tt], msgtag);

		ini=fin;    /* Aqui calculo los siguients renglones a mandar */
		fin+=patron;
		if (fin > MAXNUM)
		{	fin = MAXNUM;
			patron--;
		}
		tt++;
	} while (tt<nproc); /* ini!=fin); */

	msgtag = 52;
	printf("Espera resultados de los esclavos ...\n");
	for (t=0; t<nproc; t++)
	{	
                pvm_recv(-1, msgtag);  /* Aqui recibo resultados */
                pvm_upkint(&ini, 1, 1);
                pvm_upkint(&fin, 1, 1);
                pvm_upkfloat(bb, MAXNUM, 1);
                printf("Aqui recibo del %d al %d\n", ini, fin);

                for (i=ini; i<fin; i++)
			c[i]=bb[i];
		/*desplega_vector(c);*/
	}
	pvm_exit();
	printf("Sale de multiplica ... \n");
}



 ... and this is part of my slave program  .....

multiplica()
{
   int i, j;
   float M[MAXNUM/2+1][MAXNUM];
	
	for (i=ini; i<fin; i++)
		for (j=0; j<MAXNUM; j++)
			M[i][j]=i+j+1;

        for (i=ini; i<fin; i++)     /* Hace calculos */
	{	c[i] = 0;
		for (j=0; j<MAXNUM; j++)
			c[i] += b[j] * M[i][j];
	}
}	

main()
{
	mytid=pvm_mytid();
	me=mytid;
	msgtype=50;
	master=pvm_parent();
	
	pvm_recv(-1, msgtype);  /* Recibe vector */
	pvm_upkint(&nproc, 1, 1);
	pvm_upkint(tids, nproc, 1);
	pvm_upkfloat(b, MAXNUM, 1);

  	master=pvm_parent();

	for (k = 0; k < nproc; k++)
        {
   		if (mytid == tids[k]) 
		{	me = k; break;}
	}
        
	msgtype=51;
	
	pvm_recv(master, msgtype); /* Recibe matriz */
	pvm_upkint(&ini,1,1);
	pvm_upkint(&fin,1,1);

	multiplica();

	msgtype=52;
	pvm_initsend(PvmDataDefault); /* Manda vector */
        pvm_pkint(&ini, 1, 1);
        pvm_pkint(&fin, 1, 1);
        pvm_pkfloat(c, MAXNUM, 1);
 	pvm_send(master, msgtype);

	pvm_exit();
}


 .... and the result is this ... for tree processors and a martix of 10X10

Aqui mando del 0 al 4, ciclo 0
Aqui mando del 4 al 8, ciclo 1
Aqui mando del 8 al 10, ciclo 2
Espera resultados de los esclavos ...
Aqui recibo del 8 al 10
[t40074] libpvm [t40074]: pvm_send(): Bad parameter
[t40074] EOF
[t40075] EOF
Aqui recibo del 0 al 4
[t40073] EOF


The problem is.... my program is waitin by some msg for the slave, and the
slave don't send it, ...but  WHY???

i don't know, and if somebody can help me whit this, ... thanks.... very very
thanks, i don't found the error, ......

 .... and please .... HELP ME!!!!!


thanks any way.

	Bye.

-- 
 	Saludos.

 -------------------------------------------------------------------------
		Jaime Antonio Muro Alvarez
		MSC, ITESM.
 Internet:	al178495@academ07.mty.itesm.mx
 Direccion:	Quimicos #221-2, Col. Tecnologico, 64700, Monterrey
		Leon Felipe #1575, Col. La Madrid, 25050, Saltillo
 Telefono: 	91 (84) 175470, 90 (8) 362 5490.			jm.
 -------------------------------------------------------------------------


