Newsgroups: comp.parallel.pvm
From: dragan@freenet.toronto.on.ca (Dragan Nedeljkovic)
Subject: Re: Example neededfor Asynchronous Communication
Organization: Toronto Free-Net Inc., Toronto, Ontario, Canada
Date: Sun, 17 Dec 1995 23:44:47 GMT
Message-ID: <DJr8Mn.Bny.0.sheppard@torfree.net>


In a previous article, shaikh@ece.utexas.edu (Saghir Ahmed Shaikh) says:

>Dear pvm_users(all):
>
>I am developing an application using asynchronous comunication.
>Could you please provide me an example of some application using pvm for
>asynchronous comm. i.e. using pvm_nrec(-1, -1). For example my program alg
>would look like as follows:
>
>while (done) {
>	arrived = pvm_nrecv(-1, -1)	// Wait for all kind of 
>					// message & from all other tasks
>	switch (msgType) {
>
>		case (msgA): 
>			do_proc_A;
>			break;
>		case (msgB):
>			do_proc_B;
>			break;
>		}
>I am unaware how one determones what type of message has arrived and if it is 
>arrived or not etc. Please let me know if you know any hints...
>
>Thanks a lot
>
>Email is saghir@mail.utexas.edu
>
>		
>--
>peace, saghir
>----------------------------------------------------------------------+
>Saghir A. Shaikh, Graduate Student, Department of ECE UT-Austin       |		
>-----------------------------------------------	| Tel: (512) 453-7310 |
>Preferred Email: saghir@mail.utexas.edu		| Snail Mail:	      |
>Others:		 shaikh@ece.utexas.edu		| 306 W. 45th St.     |
>		 shaikh@ccwf.cc.utexas.edu	| Austin, TX 78751    |
>----------------------------------------------------------------------+
>
>


  bufferId = pvm_recv( -1, -1 ) ;

  rc = pvm_bufinfo( bufferId, &messageSize, &messageTag, &senderTID ) ;

  Because your master is just sitting there and waiting for slaves to 
  do the work, pvm_recv() is better choice than pvm_nrecv().


####


