Newsgroups: comp.parallel.pvm
Path: ukc!uknet!pipex!howland.reston.ans.net!agate!ames!kronos.arc.nasa.gov!mehra
From: mehra@kronos.arc.nasa.gov (Pankaj Mehra)
Subject: CAUTION using joingroup, bcast
Message-ID: <1994Feb1.220504.24964@kronos.arc.nasa.gov>
Sender: usenet@kronos.arc.nasa.gov (usenet@ptolemy.arc.nasa.gov)
Nntp-Posting-Host: tatertot.arc.nasa.gov
Organization: NASA ARC/ Information Science Division
Date: Tue, 1 Feb 1994 22:05:04 GMT
Lines: 29

If you are using groups, beware that different members may join the
group with different latencies; therefore, before doing a bcast, it
might be worth checking using gsize if all the members are in:

For example, if your SPMD code begins like:

	mytid = pvm_mytid();
	pvm_joingroup(GRPNAME);
	if (pvm_parent() < 0) {
                pvm_initsend(0);
                pvm_pkint(&size,1,1);
		while (pvm_gsize(GRPNAME) < numprocs) {sleep(5);} /* <== */
		pvm_bcast(GRPNAME, BROADCAST);
	} else {
		pvm_recv(-1,BROADCAST);
		pvm_upkint(&size,1,1);
	}

then without the loop containing pvm_gsize(), one or more receiving process
will hang in pvm_recv().

I have tested this code in a Pipe-Multiply-Roll algorithm for matrix
multiplication.


-- 
-Pankaj Mehra
________________________________________________________________________________
415/604-0165 Recom Technologies (NASA-Ames, code FIC) mehra@ptolemy.arc.nasa.gov

