*** ../netlib/pvm3.2.5/Readme.mpp	Mon Aug 30 22:48:38 1993
--- Readme.mpp	Mon Dec 20 10:33:19 1993
***************
*** 143,149 ****
  
      Host (master) programs should be linked with pvm3/lib/PGON/libpvm3.a
  and the system library librpc.a, node (slave) programs with
! pvm3/lib/PGON/libpvm3pe.a and librpc.a .  Fortran programs should
  also be linked with pvm3/lib/PGON/libfpvm3.a .
  
  	The programs in the gexamples directory have NOT been ported. The
--- 143,149 ----
  
      Host (master) programs should be linked with pvm3/lib/PGON/libpvm3.a
  and the system library librpc.a, node (slave) programs with
! pvm3/lib/PGON/libpvm3pe.a, libnx.a, and librpc.a .  Fortran programs should
  also be linked with pvm3/lib/PGON/libfpvm3.a .
  
  	The programs in the gexamples directory have NOT been ported. The
*** ../netlib/pvm3.2.5/examples/CM5/Makefile	Wed Sep 22 16:10:03 1993
--- examples/CM5/Makefile	Mon Dec 20 10:33:21 1993
***************
*** 21,26 ****
--- 21,27 ----
  BDIR	=	$(PVMDIR)/bin
  XDIR	=	$(BDIR)/$(PVM_ARCH)
  
+ CC	=	cc
  CFLAGS	=	-O -I../../include 
  LIBS	=	$(PVMLIB) $(ARCHLIB)
  NODELIBS	=	$(PVMPELIB) $(ARCHLIB)
***************
*** 97,107 ****
  	mv testall $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -c $(SDIR)/nntime.c
  	cmmd-ld -comp cc -o nntime -host $(LIBDIR)/pvmhost.o \
  		$(LIBDIR)/libpvm3.a -node nntime.o $(NODELIBS)
  	mv nntime $(XDIR)
--- 98,108 ----
  	mv testall $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -DPVM -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -DPVM -D$(PVM_ARCH)_NODE -c $(SDIR)/nntime.c
  	cmmd-ld -comp cc -o nntime -host $(LIBDIR)/pvmhost.o \
  		$(LIBDIR)/libpvm3.a -node nntime.o $(NODELIBS)
  	mv nntime $(XDIR)
*** ../netlib/pvm3.2.5/examples/CUBE/Makefile	Tue Jul  6 11:29:32 1993
--- examples/CUBE/Makefile	Mon Dec 20 10:33:22 1993
***************
*** 50,56 ****
  	mv spmd $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -o nntime $(SDIR)/nntime.c $(LIBS)
  	mv nntime $(XDIR)
  
  fspmd: $(SDIR)/spmd.f  $(XDIR)
--- 50,56 ----
  	mv spmd $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -DPVM -o nntime $(SDIR)/nntime.c $(LIBS)
  	mv nntime $(XDIR)
  
  fspmd: $(SDIR)/spmd.f  $(XDIR)
*** ../netlib/pvm3.2.5/examples/I860/Makefile	Wed Sep 22 16:10:03 1993
--- examples/I860/Makefile	Mon Dec 20 10:33:22 1993
***************
*** 49,55 ****
  	mv spmdh $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  fspmdh: $(SDIR)/spmd.f  $(XDIR)
--- 49,55 ----
  	mv spmdh $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -DPVM -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  fspmdh: $(SDIR)/spmd.f  $(XDIR)
*** ../netlib/pvm3.2.5/examples/PGON/Makefile	Wed Sep 22 16:10:04 1993
--- examples/PGON/Makefile	Mon Dec 20 10:33:22 1993
***************
*** 60,70 ****
  	mv spmd $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -o nntime $(SDIR)/nntime.c $(NODELIBS)
  	mv nntime $(XDIR)
  
  fspmdh: $(SDIR)/spmd.f  $(XDIR)
--- 60,70 ----
  	mv spmd $(XDIR)
  
  nntimeh: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -DPVM -o nntimeh $(SDIR)/nntime.c $(LIBS)
  	mv nntimeh $(XDIR)
  
  nntime: $(SDIR)/nntime.c  $(XDIR)
! 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -DPVM -o nntime $(SDIR)/nntime.c $(NODELIBS)
  	mv nntime $(XDIR)
  
  fspmdh: $(SDIR)/spmd.f  $(XDIR)
*** ../netlib/pvm3.2.5/examples/nntime.c	Tue Jul 27 15:37:12 1993
--- examples/nntime.c	Mon Dec 20 10:33:21 1993
***************
*** 1,10 ****
! /* This program collects timing statistics for node-to-node message passing */
  
  #include <stdio.h>
  #include "pvm3.h"
  
! #define NPROC	3
! #define MAXSIZE	100000		/* must of a power of 10 */
  #define ENCODE	PvmDataRaw	
  
  
--- 1,24 ----
! /* This program collects timing statistics for node-to-node message passing
!  * 
!  * To measure performance of native send/receive, compile as
!  *		Paragon:	icc -nx -O -DPGON_NODE nntime.c
!  * 		iPSC/860:	icc -O -DI860_NODE nntime.c -node
!  *		CM5(CMMD):  cc -c -DCM5_NODE nntime.c; cmmd-ld -comp cc -node nntime.o
!  */
  
  #include <stdio.h>
+ #include <memory.h>
+ #ifdef CM5_NODE
+ #include <cm/cmmd.h>
+ #include <cm/timers.h>
+ #endif
+ #ifdef PVM
  #include "pvm3.h"
+ #endif
  
! #define NPROC	4
! #define SAMPLE	1			/* sample rate */
! #define MAXSIZE	10000		/* must be a power of 10 */
  #define ENCODE	PvmDataRaw	
  
  
***************
*** 28,41 ****
--- 42,69 ----
  
  #endif /*PGON_NODE/I860_NODE*/
  
+ #if !defined(PGON_NODE) && !defined(I860_NODE) && !defined(CM5_NODE)
  
+ #include <sys/time.h>
+ struct timeval tv1, tv2;
+ #define TIMER_CLEAR     (tv1.tv_sec = tv1.tv_usec = tv2.tv_sec = tv2.tv_usec =0)
+ #define TIMER_START     gettimeofday(&tv1, (struct timezone*)0)
+ #define TIMER_STOP      gettimeofday(&tv2, (struct timezone*)0)
+ #define TIMER_ELAPSED	(tv2.tv_sec-tv1.tv_sec+(tv2.tv_usec-tv1.tv_usec)*1.E-6)
+ 
+ #endif 
+ 
+ 
  main()
  {
  	int mytid;				/* my task id */
  	int tids[NPROC];		/* array of task IDs */
  
+ #ifdef PVM
+ 
  	mytid = pvm_mytid();
  	tids[0] = pvm_parent();
+ /* pvm_setdebug(3);  */
  
  	if (tids[0] < 0)
  		mom(mytid, tids);
***************
*** 45,67 ****
  		printf("mytid = %d\n", mytid);
  		if (mytid == tids[1])
  			child1(tids);
  		else
! 			child2(tids);
  	}
- 
  	pvm_exit();
  	exit();
  }
  
  
  mom(mytid, tids)
  	int mytid;
  	int tids[];
  {
- 	int i;
- 	double data[MAXSIZE];
- 	char str[32];
- 
  	tids[0] = mytid;
  	pvm_spawn("nntime", (char**)0, 0, "", NPROC-1, &tids[1]);
  	pvm_initsend(ENCODE);
--- 73,119 ----
  		printf("mytid = %d\n", mytid);
  		if (mytid == tids[1])
  			child1(tids);
+ 		else if (mytid == tids[2])
+ 			child2();
  		else
! 			child3(tids);
  	}
  	pvm_exit();
+ 
+ #else /*PVM*/
+ 
+ #if defined(PGON_NODE) || defined(I860_NODE)
+ 
+ 	if (mynode())
+ 		catcher();
+ 	else
+ 		sender();
+ 
+ #endif /*I860_NODE*/
+ 
+ #ifdef CM5_NODE
+ 
+ 	CMMD_fset_io_mode(stdout, CMMD_independent);
+ 	if (CMMD_self_address() == 0)
+ 		sender();
+ 	if (CMMD_self_address() == 1)
+ 		catcher();
+ 	CMMD_all_msgs_wait();
+ 
+ #endif /*CM5_NODE*/
+ 
+ #endif /*PVM*/
+ 
  	exit();
  }
  
  
+ #ifdef PVM
+ 
  mom(mytid, tids)
  	int mytid;
  	int tids[];
  {
  	tids[0] = mytid;
  	pvm_spawn("nntime", (char**)0, 0, "", NPROC-1, &tids[1]);
  	pvm_initsend(ENCODE);
***************
*** 71,127 ****
  	/* test host-node recv */
  
  	pvm_recv(-1, 0);
  
- 	pvm_upkstr(str);
- 	printf("%s\n", str);
- 	pvm_upkdouble(data, MAXSIZE, 1);
  
! 	for (i = 0; i < MAXSIZE; i++)
! 		if ((data[i] - i*i) > 1.0) {
! 			printf("error: %g at i = %d\n", data[i], i);
! 			break;
! 		}
  
! 	if (i == MAXSIZE)
! 		printf("%d doubles received correctly\n", i);
  }
  
  
! child1(tids)
  	int tids[];
  {
! 	int size, n, i;
  	double data[MAXSIZE];
- 	int t1, t2, t3;
  	char str[32];
  
! 	/* test node-to-node recv */
  
  	pvm_recv(-1, 0);
  	pvm_upkstr(str);
  	printf("%s\n", str);
  	pvm_upkdouble(data, MAXSIZE, 1);
  
  	for (i = 0; i < MAXSIZE; i++)
! 		if ((data[i] - i*i) > 1.0) {
! 			printf("error: %g at i = %g\n", data[i], i);
  			break;
  		}
  	if (i == MAXSIZE)
  		printf("%d doubles received correctly\n\n\n", i);
  
  	
! 	/* do timing measurements */
  
! 	puts("Node-to-node Send/Ack\n");
! 	for (size = 1; size <= MAXSIZE; size *= 10) {
! 
! 		for (n = 0; n < size; n++)
! 			data[n] = n*n;
  		printf("Pack (us)   Send (us)   Ack (us)   (Data size = %d)", 8*size);
  		puts("\n=======================================================");
  
! 		for (i = 0; i < 5; i++) {
  #ifdef TIMER_CLEAR
  			pvm_initsend(ENCODE);
  			TIMER_CLEAR;
--- 123,239 ----
  	/* test host-node recv */
  
  	pvm_recv(-1, 0);
+ 	validate();
+ }
  
  
! child1(tids)
! 	int tids[];
! {
! 	int size;
  
! 	/* test node-to-node recv */
! 	pvm_recv(-1, 0);
! 	validate();
! 	
! 	/* do timing measurements */
! 	puts("Node-to-node Send/Ack\n");
! 
! 	/* synchronize */
! 	pvm_initsend(ENCODE);
! 	pvm_pkint(&size, 1, 1);
! 	pvm_send(tids[3], 0);
! 	pvm_recv(-1, 0);		/* receive ack */
! 
! 	for (size = 1; size <= MAXSIZE; size *= 10) 
! 		time_one(size, tids[3]);
! 		/* time_ind(size, tids[3]); */
! 
! 	/* inform child3 to exit */
! 	pvm_initsend(ENCODE);
! 	pvm_pkstr("death");
! 	pvm_send(tids[3], 13);
  }
  
  
! child3(tids)
  	int tids[];
  {
! 	int n, stid, bufid, bytes, type;
  	double data[MAXSIZE];
  	char str[32];
  
! 	/* test node-to-node send */
  
+ 	for (n = 0; n < MAXSIZE; n++)
+ 		data[n] = n*n;
+ 	pvm_initsend(ENCODE);
+ 	sprintf(str, "%d doubles from node zero", MAXSIZE);
+ 	pvm_pkstr(str);
+ 	pvm_pkdouble(data, MAXSIZE, 1);
+ 	pvm_mcast(tids, NPROC-1, 0);
+ 
+ 	pvm_initsend(ENCODE);
+ 	pvm_pkint(&tids[3], 1, 1);
+ 
+ 	/* receive data and ack */
+ 
+ 	while(1) {
+ 		bufid = pvm_recv(-1, -1);
+ 		pvm_bufinfo(bufid, &bytes, &type, &stid);
+ 		if (type == 13)
+ 			break;
+ #ifdef KSR1
+ 		pvm_upkdouble(data, bytes/sizeof(double), 1); 
+ #endif
+ 		pvm_send(stid, 0);
+ 	}
+ }
+ 
+ 
+ child2()
+ {
  	pvm_recv(-1, 0);
+ 	validate();
+ }
+ 
+ 
+ validate()
+ {
+ 	double data[MAXSIZE];
+ 	char str[32];
+ 	int i;
+ 
  	pvm_upkstr(str);
  	printf("%s\n", str);
  	pvm_upkdouble(data, MAXSIZE, 1);
  
  	for (i = 0; i < MAXSIZE; i++)
! 		if ((i*i - data[i]) > 0.01) {
! 			printf("error: data[%d] = %g\n", i, data[i]);
  			break;
  		}
+ 
  	if (i == MAXSIZE)
  		printf("%d doubles received correctly\n\n\n", i);
+ }
  
  	
! /* measure packing and sending time */
! time_ind(size, dtid)
! int size;
! int dtid;
! {
! 	int i;
! 	int t1, t2, t3;
! 	double data[MAXSIZE];
  
! 	for (i = 0; i < size; i++)
! 		data[i] = i*i;
  		printf("Pack (us)   Send (us)   Ack (us)   (Data size = %d)", 8*size);
  		puts("\n=======================================================");
  
! 	for (i = 0; i < SAMPLE; i++) {
  #ifdef TIMER_CLEAR
  			pvm_initsend(ENCODE);
  			TIMER_CLEAR;
***************
*** 131,137 ****
  			t1 = 1000000*TIMER_ELAPSED;
  			TIMER_CLEAR;
  			TIMER_START;
! 			pvm_send(tids[2], 0);
  			TIMER_STOP;
  			t2 = 1000000*TIMER_ELAPSED;
  			TIMER_CLEAR;
--- 243,249 ----
  			t1 = 1000000*TIMER_ELAPSED;
  			TIMER_CLEAR;
  			TIMER_START;
! 		pvm_send(dtid, 0);
  			TIMER_STOP;
  			t2 = 1000000*TIMER_ELAPSED;
  			TIMER_CLEAR;
***************
*** 145,194 ****
  		putchar('\n');
  	}
  
- 	/* test node-to-host send */
  
! 	pvm_initsend(ENCODE);
! 	sprintf(str, "%d doubles from node one", MAXSIZE);
! 	pvm_pkstr("Hi from node one");
! 	pvm_pkdouble(data, MAXSIZE, 1);
! 	pvm_send(tids[0], 0);
  
! 	/* informs child2 to exit */
  	pvm_initsend(ENCODE);
! 	pvm_pkstr("death");
! 	pvm_send(tids[2], 13);
  }
  
  
! child2(tids)
! 	int tids[];
  {
! 	int n, dtid, bufid, type;
! 	double data[MAXSIZE];
! 	char str[32];
  
! 	/* test node-to-node send */
  
! 	for (n = 0; n < MAXSIZE; n++)
! 		data[n] = n*n;
! 	pvm_initsend(ENCODE);
! 	sprintf(str, "%d doubles from node two", MAXSIZE);
! 	pvm_pkstr(str);
! 	pvm_pkdouble(data, MAXSIZE, 1);
! 	pvm_send(tids[1], 0);
  
! 	pvm_initsend(ENCODE);
! 	pvm_pkint(&tids[1], 1, 1);
  
! 	/* receive data and ack */
  
  	while(1) {
! 		bufid = pvm_recv(-1, -1);
! 		pvm_bufinfo(bufid, (int*)0, &type, &dtid);
! 		if (type == 13)
! 			break;
! 		pvm_send(dtid, 0);
  	}
- 	pvm_exit();
- 	exit();
  }
--- 257,393 ----
  		putchar('\n');
  	}
  
  
! /* measure packet transit time */
! time_one(size, dtid)
! int size;
! int dtid;
! {
! 	int i;
! 	double data[MAXSIZE];
! 	int t;
  
! #ifdef TIMER_CLEAR
! 
! 	for (i = 0; i < size; i++)
! 		data[i] = i*i;
! 
  	pvm_initsend(ENCODE);
! 	pvm_pkdouble(data, size, 1);
! 	TIMER_CLEAR;
! 	TIMER_START;
! 	for (i = 0; i < SAMPLE; i++) {
! 		pvm_send(dtid, 0);
! 		pvm_recv(-1, 0);		/* receive ack */
  }
+ 	TIMER_STOP;
+ 	t = 1000000*TIMER_ELAPSED/SAMPLE;
+ 	printf("Send+ACK T = %d (us)  (%.4f MB/s)      Data size: %d\n",
+ 		t, 8.0*(float)size/(float)t, 8*size);
  
+ #endif /*TIMER_CLEAR*/
+ }
  
! #endif /*PVM*/
! 
! 
! /* 
!  * these routines are used to measure performance of native message-passing
!  * primitives
!  */
! sender()
  {
! 	int size, ack;
  
! 	/* synchronize */
! #if defined(PGON_NODE) || defined(I860_NODE)
! 	csend(123, &size, sizeof(int), 1, 0);
! 	crecv(-1, &ack, sizeof(int));
! #endif /*defined(PGON_NODE) || defined(I860_NODE)*/
  
! #ifdef CM5_NODE
! 	CMMD_send_block(1, 123, &size, sizeof(int));
! 	CMMD_receive_block(CMMD_ANY_NODE, CMMD_ANY_TAG, &ack, sizeof(int));
! #endif
  
! 	/* do timing measurements */
! 	puts("Node-to-node Send/Ack\n");
! 	for (size = 1; size <= MAXSIZE; size *= 10) 
! 		time_ack(size);
  
! #if defined(PGON_NODE) || defined(I860_NODE)
! 	csend(13, (char *)0, 0, 1, 0);
! #endif 
! #ifdef CM5_NODE
! 	CMMD_send_block(1, 13, (char *)0, 0);
! #endif
! }
  
+ 
+ /* receive message and ack */
+ catcher()
+ {
+ 	double data[MAXSIZE];
+ 	int ack = 1;
+ 
  	while(1) {
! #ifdef CM5_NODE
! 		CMMD_receive_block(CMMD_ANY_NODE, CMMD_ANY_TAG, (char *)data, 
! 			MAXSIZE*sizeof(double));
! 		if (CMMD_msg_tag() == 13)
! 			exit(0);
! 		CMMD_send_block(0, 456, &ack, sizeof(int));
! #endif
! #if defined(PGON_NODE) || defined(I860_NODE)
! 		crecv(-1, (char *)data, MAXSIZE*sizeof(double));
! 		if (infotype() == 13)
! 			exit(0);
! 		csend(456, &ack, sizeof(int), 0, 0);
! #endif
  	}
  }
+ 
+ 
+ /* measure packet transit time */
+ time_ack(size)
+ int size;
+ {
+ 	int i;
+ 	double data[MAXSIZE];
+ 	int t;
+ 
+ #ifdef TIMER_CLEAR
+ 
+ 	for (i = 0; i < size; i++)
+ 		data[i] = i*i;
+ 
+ 	TIMER_CLEAR;
+ 	TIMER_START;
+ /*
+ 	memcpy(data, dat1, size*sizeof(double));
+ */
+ 	for (i = 0; i < SAMPLE; i++) {
+ 		int ack;
+ 
+ #if defined(PGON_NODE) || defined(I860_NODE)
+ 		csend(123, (char *)data, size*sizeof(double), 1, 0);
+ 		crecv(-1, &ack, sizeof(int));
+ #endif /*defined(PGON_NODE) || defined(I860_NODE)*/
+ 
+ #ifdef CM5_NODE
+ 		CMMD_send_block(1, 123, (char *)data, size*sizeof(double));
+ 		CMMD_receive_block(CMMD_ANY_NODE, CMMD_ANY_TAG, &ack, sizeof(int));
+ #endif
+ 	}
+ /*
+ 	memcpy(dat1, data, size*sizeof(double));
+ */
+ 	TIMER_STOP;
+ 	t = 1000000.0*TIMER_ELAPSED/(double)SAMPLE;
+ 	printf("Send+ACK T = %d (us)  (%.4f MB/s)      Data size: %d\n",
+ 		t, 8.0*(float)size/(float)t, 8*size);
+ 
+ #endif /*TIMER_CLEAR*/
+ }
+ 
+ 
*** ../netlib/pvm3.2.5/patches/Contents	Tue Nov 30 19:09:36 1993
--- patches/Contents	Mon Dec 20 10:45:56 1993
***************
*** 1,3 ****
--- 1,37 ----
+ patch #6
+ version:
+     3.2.5 -> 3.2.6
+ files:
+     patch  Readme.mpp
+     patch  examples/CM5/Makefile
+     patch  examples/CUBE/Makefile
+     patch  examples/I860/Makefile
+     patch  examples/PGON/Makefile
+     patch  examples/nntime.c
+     patch  patches/Contents
+     patch  src/CM5/pvmdmimd.c
+     patch  src/CM5/pvmhost.c
+     patch  src/CUBE/Makefile
+     patch  src/I860/pvmdmimd.c
+     patch  src/Makefile.mimd
+     patch  src/PGON/pvmdmimd.c
+     patch  src/global.h
+     patch  src/lpvmmimd.c
+     patch  src/patchlevel.h
+     patch  src/pvmd.c
+     patch  src/pvmmimd.h
+ what:
+     . affects only MPP ports
+     . fixed bugs in mpp_mcast(). now if a task multicasts from a node
+       the message will be sent out directly, either as a loop of point-
+       to-point sends (CM5/I860) or taking advantage of the native 
+       multicast/broadcast system function (Paragon). The performance 
+       should improve. 
+     . fixed a bug that sometimes caused PVM to run out of CMMD message
+       handles on the CM5. a related bug reported by Bill Saphir has
+       also been fixed.
+     . modified nntime.c to collect timing data for native message
+       passing system calls.
  
  patch #5
  version:
*** ../netlib/pvm3.2.5/src/CM5/pvmdmimd.c	Mon Aug 30 19:35:27 1993
--- src/CM5/pvmdmimd.c	Mon Dec 20 10:39:48 1993
***************
*** 86,91 ****
--- 86,94 ----
   *			tid: task ID.
   *
  $Log: pvmdmimd.c,v $
+  * Revision 1.2  1993/12/20  15:39:47  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.1  1993/08/30  23:35:09  manchek
   * Initial revision
   *
***************
*** 143,149 ****
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.1 1993/08/30 23:35:09 manchek Exp $";
  static struct nodeset *busynodes;	/* active nodes; ordered by proc type */
  static char etext[512];			/* scratch for error log */
  static int ptypemask;			/* mask; we use these bits of ptype in tids */
--- 146,152 ----
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.2 1993/12/20 15:39:47 manchek Exp $";
  static struct nodeset *busynodes;	/* active nodes; ordered by proc type */
  static char etext[512];			/* scratch for error log */
  static int ptypemask;			/* mask; we use these bits of ptype in tids */
***************
*** 304,314 ****
  	return err;
  }
  
! 
  /* use global send to multicast */
  int
! mpp_mcast(src, pp, tids, ntask)
! 	int src;		/* sender's tid */
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
--- 307,316 ----
  	return err;
  }
  
! #if 0
  /* use global send to multicast */
  int
! mpp_mcast(pp, tids, ntask)
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
***************
*** 331,337 ****
  			break;
  		}
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no ptype)\n", src);
  		pvmlogerror(etext);
  		return -1;
  	}
--- 333,340 ----
  			break;
  		}
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no ptype)\n", 
! 		pp->pk_src);
  		pvmlogerror(etext);
  		return -1;
  	}
***************
*** 363,369 ****
  		LISTPUTBEFORE(tp->t_txq, pp, pk_link, pk_rlink);
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to type=%d %d\n",
! 					src, pp->pk_len, ptype, count);
  			pvmlogerror(etext);
  		}
  		PVM_FREE(dsts);
--- 366,372 ----
  		LISTPUTBEFORE(tp->t_txq, pp, pk_link, pk_rlink);
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to type=%d %d\n",
! 					pp->pk_src, pp->pk_len, ptype, count);
  			pvmlogerror(etext);
  		}
  		PVM_FREE(dsts);
***************
*** 370,376 ****
  	}
  	return 0;
  }
! 
  
  void
  mpp_kill(tp, signum)
--- 373,379 ----
  	}
  	return 0;
  }
! #endif /* #if 0 */
  
  void
  mpp_kill(tp, signum)
*** ../netlib/pvm3.2.5/src/CM5/pvmhost.c	Mon Aug 30 19:35:27 1993
--- src/CM5/pvmhost.c	Mon Dec 20 10:39:49 1993
***************
*** 38,43 ****
--- 38,46 ----
   * 		changed mc_dsts[] to short from int.
   *
  $Log: pvmhost.c,v $
+  * Revision 1.2  1993/12/20  15:39:48  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.1  1993/08/30  23:35:09  manchek
   * Initial revision
   *
***************
*** 66,72 ****
  char *getenv();
  
  /* from lpvm.c */
- extern int errno;
  extern int pvmmyptid;
  extern int pvmmytid;
  extern int pvmudpmtu;
--- 69,74 ----
***************
*** 73,79 ****
  extern int pvmmyndf;
  extern int pvmtidhmask;
  
! static char rcsid[] = "$Id: pvmhost.c,v 1.1 1993/08/30 23:35:09 manchek Exp $";
  static char etext[512];         /* scratch for error log */
  static int tidnmask = TIDNODE;
  static int tidtmask = TIDPTYPE;
--- 75,81 ----
  extern int pvmmyndf;
  extern int pvmtidhmask;
  
! static char rcsid[] = "$Id: pvmhost.c,v 1.2 1993/12/20 15:39:48 manchek Exp $";
  static char etext[512];         /* scratch for error log */
  static int tidnmask = TIDNODE;
  static int tidtmask = TIDPTYPE;
***************
*** 108,113 ****
--- 110,116 ----
  	char *cp;
  	short *mc_dsts;				/* array to store multicast targets */
  	int mc_ndst;				/* how many of them */
+ 	int countdown;
  
  
  	pvmbeatask();
***************
*** 214,229 ****
  				if (fp->fr_len < n)
  					break;
  				if (fp->fr_len > n) {
! 					frpvmd = fr_new(MAXFRAGSIZE);
! 					BCOPY(fp->fr_dat + n, frpvmd->fr_dat, fp->fr_len - n);
  					frpvmd->fr_len = fp->fr_len - n;
  					fp->fr_len = n;
  				} else
  					frpvmd = 0;
  
  				dst = pvmget32(fp->fr_dat);
  				if (dst == pvmmytid) {
! 					/* multicast info (XXX must fit into one frag) */
  					cp = fp->fr_dat + TDFRAGHDR;
  					fp->fr_len -= TDFRAGHDR;
  					mc_ndst = fp->fr_len/sizeof(short);
--- 217,236 ----
  				if (fp->fr_len < n)
  					break;
  				if (fp->fr_len > n) {
! 					frpvmd = fr_new(0);
! 					frpvmd->fr_dat = fp->fr_dat + n;
! 					frpvmd->fr_buf = fp->fr_buf;
  					frpvmd->fr_len = fp->fr_len - n;
+ 					frpvmd->fr_max = fp->fr_max;
+ 					da_ref(fp->fr_buf);
  					fp->fr_len = n;
  				} else
  					frpvmd = 0;
  
  				dst = pvmget32(fp->fr_dat);
+ /*
  				if (dst == pvmmytid) {
! 					* multicast info (XXX must fit into one frag) *
  					cp = fp->fr_dat + TDFRAGHDR;
  					fp->fr_len -= TDFRAGHDR;
  					mc_ndst = fp->fr_len/sizeof(short);
***************
*** 230,245 ****
  					mc_dsts = TALLOC(mc_ndst, short, "mcdsts");
  					BCOPY(cp, mc_dsts, fp->fr_len);
  				} else if (dst & TIDGID) {
! 					/* multicast message body */
  					cm_mcast(fp, mc_dsts, mc_ndst, pvminfo[1]);
  					PVM_FREE(mc_dsts);
! 				} else {
  					if (CMMD_send_noblock(dst & tidnmask, PMTDN, fp->fr_dat,
  					fp->fr_len) == CMMD_ERRVAL) {
  						sprintf(etext, "pvmhost: can't send to t%x", dst);
  						pvmlogperror(etext);
  					}
  				}
  				fr_unref(fp);
  
  /*
--- 237,261 ----
  					mc_dsts = TALLOC(mc_ndst, short, "mcdsts");
  					BCOPY(cp, mc_dsts, fp->fr_len);
  				} else if (dst & TIDGID) {
! 					* multicast message body *
  					cm_mcast(fp, mc_dsts, mc_ndst, pvminfo[1]);
  					PVM_FREE(mc_dsts);
! 				} else
! 				{
! */
  					if (CMMD_send_noblock(dst & tidnmask, PMTDN, fp->fr_dat,
  					fp->fr_len) == CMMD_ERRVAL) {
  						sprintf(etext, "pvmhost: can't send to t%x", dst);
  						pvmlogperror(etext);
+ 						if (frpvmd) {
+ 							fp->fr_len += frpvmd->fr_len;
+ 							fr_unref(frpvmd);
  					}
+ 						frpvmd = fp;
+ 						CMMD_poll_for_services();
+ 						continue;		/* loop 'til we can send */
  				}
+ 				/* } */
  				fr_unref(fp);
  
  /*
***************
*** 288,294 ****
  				topvmd = 0;
  			}
  		}
! 		CMMD_poll_for_services();
  	}
  }
  
--- 304,312 ----
  				topvmd = 0;
  			}
  		}
! 		countdown = 1024;
! 		while (CMMD_poll_for_services() && countdown--)
! 			;
  	}
  }
  
***************
*** 310,319 ****
  	for (i = 0; i < ntask; i++) {
  		dst = tidpart + nodes[i];
  		pvmput32(cp, dst);
! 		if (CMMD_send_noblock(nodes[i], PMTDN, fp->fr_dat,
  		fp->fr_len) == CMMD_ERRVAL) {
! 			sprintf(etext, "pvmhost: can't send to t%x", dst);
  			pvmlogperror(etext);
  		}
  	}
  }
--- 328,338 ----
  	for (i = 0; i < ntask; i++) {
  		dst = tidpart + nodes[i];
  		pvmput32(cp, dst);
! 		while (CMMD_send_noblock(nodes[i], PMTDN, fp->fr_dat,
  		fp->fr_len) == CMMD_ERRVAL) {
! 			sprintf(etext, "pvmhost: cm_mcast() can't send to t%x", dst);
  			pvmlogperror(etext);
+ 			CMMD_poll_for_services();
  		}
  	}
  }
*** ../netlib/pvm3.2.5/src/CUBE/Makefile	Sat Aug 28 16:44:45 1993
--- src/CUBE/Makefile	Mon Dec 20 10:33:21 1993
***************
*** 6,14 ****
  	mv libpvm3pe.a $(LIBDIR)
  		
  default:    
- 	rm -f lpvmipack.o
- 	make PVM_ARCH=I860 -f $(CONFFILE) -f ../Makefile.mimd lpvmipack.o
- 	- mv lpvmpack.o lpvmipack.o
  	make PVM_ARCH=I860 -f $(CONFFILE) -f ../Makefile.mimd libpvm3pe.a 
  
  clean:
--- 6,11 ----
*** ../netlib/pvm3.2.5/src/I860/pvmdmimd.c	Mon Aug 30 19:35:58 1993
--- src/I860/pvmdmimd.c	Mon Dec 20 10:39:51 1993
***************
*** 37,42 ****
--- 37,45 ----
   *		deleted loclinput(), and merged loclinpkt() into pvmd.c
   *
  $Log: pvmdmimd.c,v $
+  * Revision 1.2  1993/12/20  15:39:50  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.1  1993/08/30  23:35:43  manchek
   * Initial revision
   *
***************
*** 106,112 ****
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.1 1993/08/30 23:35:43 manchek Exp $";
  static char     etext[512];		/* scratch for error log */
  static long 	isendmid = -1;	/* msg ID returned by isend() */
  static struct pkt *outpkt = 0;	/* packet being sent */
--- 109,115 ----
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.2 1993/12/20 15:39:50 manchek Exp $";
  static char     etext[512];		/* scratch for error log */
  static long 	isendmid = -1;	/* msg ID returned by isend() */
  static struct pkt *outpkt = 0;	/* packet being sent */
***************
*** 313,327 ****
  	pp->pk_dat += hdrdiff;
  	if (_crecv(-1, pp->pk_dat, (long)len) < 0)
  		pvmlogperror("mpp_input() crecv");
! 
  	loclinpkt(0, pp);
  }
  
  
  /* use csend() to multicast */
  int
! mpp_mcast(src, pp, tids, ntask)
! 	int src;		/* sender's tid */
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
--- 316,330 ----
  	pp->pk_dat += hdrdiff;
  	if (_crecv(-1, pp->pk_dat, (long)len) < 0)
  		pvmlogperror("mpp_input() crecv");
! 	else
  	loclinpkt(0, pp);
  }
  
  
  /* use csend() to multicast */
+ /* XXX cannot mcast to multiple cubes or tasks running on frontend */
  int
! mpp_mcast(pp, tids, ntask)
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
***************
*** 336,345 ****
  
  	cid = TIDTOTYPE(tids[0]);
  	for (sp = busynodes->n_link; sp != busynodes; sp = sp->n_link)
! 		if (sp->n_cid == cid)
  			break;
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no cube)\n", src);
  		pvmlogerror(etext);
  		return -1;
  	}
--- 339,353 ----
  
  	cid = TIDTOTYPE(tids[0]);
  	for (sp = busynodes->n_link; sp != busynodes; sp = sp->n_link)
! 		if (sp->n_cid == cid) {
! 			if (cid != qm_cubeid &&
! 			(_attachcube(sp->n_name) < 0 || _setpid(PVMDPTYPE) < 0))
! 				pvmlogperror("mpp_output() attachcube/setpid");
  			break;
+ 		}
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no cube)\n", 
! 		pp->pk_src);
  		pvmlogerror(etext);
  		return -1;
  	}
***************
*** 370,376 ****
  		}
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to cube=%d %d\n",
! 				src, pp->pk_len, cid, count);
  			pvmlogerror(etext);
  		}
  		PVM_FREE(nodes);
--- 378,384 ----
  		}
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to cube=%d %d\n",
! 				pp->pk_src, pp->pk_len, cid, count);
  			pvmlogerror(etext);
  		}
  		PVM_FREE(nodes);
*** ../netlib/pvm3.2.5/src/Makefile.mimd	Mon Aug 30 19:29:32 1993
--- src/Makefile.mimd	Mon Dec 20 10:33:20 1993
***************
*** 27,39 ****
  SDIR	=	..
  CFLAGS	=	-O -I$(SDIR)/../include -DARCHCLASS=\"$(PVM_ARCH)\" -DIMA_$(PVM_ARCH) $(ARCHCFLAGS)
  #CFLAGS	=	-g -I$(SDIR)/../include -DARCHCLASS=\"$(PVM_ARCH)\" -DIMA_$(PVM_ARCH) $(ARCHCFLAGS)
- #CFLAGS	=	-g -I$(SDIR)/../include -DARCHCLASS=\"$(PVM_ARCH)\" -DIMA_$(PVM_ARCH) $(ARCHCFLAGS) -DUSE_PVM_ALLOC
  DOBJ	=	archcode.o ddpro.o pvmfrag.o host.o imalloc.o \
  			mesg.o nmdclass.o pkt.o pvmalloc.o pvmcruft.o pvmd.o pvmdabuf.o \
  			pvmlog.o startup.o task.o tdpro.o waitc.o pvmdmimd.o
  LOBJ	=	imalloc.o lpvm.o lpvmgen.o lpvmpack.o \
  			pvmalloc.o pvmcruft.o pvmdabuf.o pvmfrag.o pvmumbuf.o
! LOBJ2	=	imalloc.o lpvmmimd.o lpvmgen.o lpvmipack.o \
  			pvmalloc.o pvmcruft.o pvmdabuf.o pvmfrag.o pvmumbuf.o
  #
  #
--- 27,38 ----
  SDIR	=	..
  CFLAGS	=	-O -I$(SDIR)/../include -DARCHCLASS=\"$(PVM_ARCH)\" -DIMA_$(PVM_ARCH) $(ARCHCFLAGS)
  #CFLAGS	=	-g -I$(SDIR)/../include -DARCHCLASS=\"$(PVM_ARCH)\" -DIMA_$(PVM_ARCH) $(ARCHCFLAGS)
  DOBJ	=	archcode.o ddpro.o pvmfrag.o host.o imalloc.o \
  			mesg.o nmdclass.o pkt.o pvmalloc.o pvmcruft.o pvmd.o pvmdabuf.o \
  			pvmlog.o startup.o task.o tdpro.o waitc.o pvmdmimd.o
  LOBJ	=	imalloc.o lpvm.o lpvmgen.o lpvmpack.o \
  			pvmalloc.o pvmcruft.o pvmdabuf.o pvmfrag.o pvmumbuf.o
! LOBJ2	=	imalloc.o lpvmmimd.o lpvmgen.o lpvmpack.o \
  			pvmalloc.o pvmcruft.o pvmdabuf.o pvmfrag.o pvmumbuf.o
  #
  #
***************
*** 83,90 ****
  	$(CC) $(CFLAGS) -c $(SDIR)/lpvmgen.c
  lpvmpack.o:	$(SDIR)/lpvmpack.c
  	$(CC) $(CFLAGS) -c $(SDIR)/lpvmpack.c
- lpvmipack.o:	$(SDIR)/lpvmpack.c
- 	$(CC) $(CFLAGS) -D$(PVM_ARCH)_NODE -c -o lpvmipack.o $(SDIR)/lpvmpack.c
  mesg.o:	$(SDIR)/mesg.c
  	$(CC) $(CFLAGS) -c $(SDIR)/mesg.c
  pvmdmimd.o:	pvmdmimd.c
--- 82,87 ----
***************
*** 170,185 ****
  lpvmpack.o: $(SDIR)/pvmfrag.h
  lpvmpack.o: $(SDIR)/pvmumbuf.h
  lpvmpack.o: $(SDIR)/listmac.h
- lpvmpack.o: $(SDIR)/pvmmimd.h
  lpvmpack.o: $(SDIR)/bfunc.h
- lpvmipack.o: $(SDIR)/../include/pvm3.h
- lpvmipack.o: $(SDIR)/global.h
- lpvmipack.o: $(SDIR)/tdpro.h
- lpvmipack.o: $(SDIR)/ddpro.h
- lpvmipack.o: $(SDIR)/pvmfrag.h
- lpvmipack.o: $(SDIR)/pvmumbuf.h
- lpvmipack.o: $(SDIR)/listmac.h
- lpvmipack.o: $(SDIR)/pvmmimd.h
  mesg.o: $(SDIR)/protoglarp.h
  mesg.o: $(SDIR)/pvmalloc.h
  mesg.o: $(SDIR)/pvmfrag.h
--- 167,173 ----
*** ../netlib/pvm3.2.5/src/PGON/pvmdmimd.c	Mon Aug 30 19:36:14 1993
--- src/PGON/pvmdmimd.c	Mon Dec 20 10:39:50 1993
***************
*** 92,97 ****
--- 92,100 ----
   *      deleted loclinput(), and merged loclinpkt() into pvmd.c
   *
  $Log: pvmdmimd.c,v $
+  * Revision 1.2  1993/12/20  15:39:49  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.1  1993/08/30  23:36:09  manchek
   * Initial revision
   *
***************
*** 141,147 ****
  extern int myndf;				/* from pvmd.c */
  extern struct htab *hosts;		/* from pvmd.c */
  extern int tidhmask;			/* from pvmd.c */
- extern struct task *locltasks;	/* from task.c */
  extern int ourudpmtu;			/* from pvmd.c */
  
  int partsize;					/* size of partition */
--- 144,149 ----
***************
*** 150,156 ****
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.1 1993/08/30 23:36:09 manchek Exp $";
  static struct nodeset *busynodes;	/* active nodes; ordered by proc type */
  static char etext[512];			/* scratch for error log */
  static int ptypemask;			/* mask; we use these bits of ptype in tids */
--- 152,158 ----
  
  /* private */
  
! static char rcsid[] = "$Id: pvmdmimd.c,v 1.2 1993/12/20 15:39:49 manchek Exp $";
  static struct nodeset *busynodes;	/* active nodes; ordered by proc type */
  static char etext[512];			/* scratch for error log */
  static int ptypemask;			/* mask; we use these bits of ptype in tids */
***************
*** 362,371 ****
  		pvminfo[2] = ptid;
  		pvminfo[3] = MAXFRAGSIZE;
  		pvminfo[4] = myndf;
! /*
! 		if (count == -1)
  			err = _csend(PMTHOST, pvminfo, sizeof(pvminfo), -1, sp->n_ptype);
! */
  		if (sp->n_ptype != PVMDPTYPE && _setptype(sp->n_ptype) < 0)
  			pvmlogperror("mpp_load() setptype");
  		if (_gsendx(PMTHOST, pvminfo, sizeof(pvminfo), nodes, (long)count)
--- 364,372 ----
  		pvminfo[2] = ptid;
  		pvminfo[3] = MAXFRAGSIZE;
  		pvminfo[4] = myndf;
! 		if (count == partsize)
  			err = _csend(PMTHOST, pvminfo, sizeof(pvminfo), -1, sp->n_ptype);
! 		else {
  		if (sp->n_ptype != PVMDPTYPE && _setptype(sp->n_ptype) < 0)
  			pvmlogperror("mpp_load() setptype");
  		if (_gsendx(PMTHOST, pvminfo, sizeof(pvminfo), nodes, (long)count)
***************
*** 376,387 ****
  		}
  		if (sp->n_ptype != PVMDPTYPE)
  			_setptype(PVMDPTYPE);
  
- /*
- cprobe(-1);
- mpp_input();
- */
- 
  		if (nodes)
  			PVM_FREE(nodes);
  
--- 377,384 ----
  		}
  		if (sp->n_ptype != PVMDPTYPE)
  			_setptype(PVMDPTYPE);
+ 		}
  
  		if (nodes)
  			PVM_FREE(nodes);
  
***************
*** 444,450 ****
  	pp->pk_dat += hdrdiff;
  	if (_crecv(-1, pp->pk_dat, (long)len) < 0)
  		pvmlogperror("mpp_input() crecv");
! 
  	loclinpkt(0, pp);
  }
  
--- 441,447 ----
  	pp->pk_dat += hdrdiff;
  	if (_crecv(-1, pp->pk_dat, (long)len) < 0)
  		pvmlogperror("mpp_input() crecv");
! 	else
  	loclinpkt(0, pp);
  }
  
***************
*** 451,458 ****
  
  /* use gsendx() to multicast */
  int
! mpp_mcast(src, pp, tids, ntask)
! 	int src;		/* sender's tid */
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
--- 448,454 ----
  
  /* use gsendx() to multicast */
  int
! mpp_mcast(pp, tids, ntask)
  	struct pkt *pp;	/* packet to send */
  	int tids[];		/* target tasks */
  	int ntask;		/* how many */
***************
*** 472,478 ****
  			break;
  		}
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no cube)\n", src);
  		pvmlogerror(etext);
  		return -1;
  	}
--- 468,475 ----
  			break;
  		}
  	if (sp == busynodes) {
! 		sprintf(etext, "mpp_mcast() pkt from t%x scrapped (no cube)\n", 
! 		pp->pk_src);
  		pvmlogerror(etext);
  		return -1;
  	}
***************
*** 498,510 ****
  			pvmlogperror("mpp_mcast() gsendx");
  		if (ptype != PVMDPTYPE)
  			_setptype(PVMDPTYPE);
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to type=%ld %ld\n",
! 					src, pp->pk_len, ptype, count);
  			pvmlogerror(etext);
  		}
- 		PVM_FREE(nodes);
  	}
  	return 0;
  }
  
--- 495,508 ----
  			pvmlogperror("mpp_mcast() gsendx");
  		if (ptype != PVMDPTYPE)
  			_setptype(PVMDPTYPE);
+ /*		}	*/
  		if (debugmask & PDMMESSAGE) {
  			sprintf(etext, "mpp_mcast() pkt from t%x len=%d to type=%ld %ld\n",
! 					pp->pk_src, pp->pk_len, ptype, count);
  			pvmlogerror(etext);
  		}
  	}
+ 	PVM_FREE(nodes);
  	return 0;
  }
  
*** ../netlib/pvm3.2.5/src/global.h	Tue Nov 30 19:09:36 1993
--- src/global.h	Mon Dec 20 10:42:28 1993
***************
*** 32,37 ****
--- 32,40 ----
   *	Generic includes.
   *
  $Log: global.h,v $
+  * Revision 1.7  1993/12/20  15:42:26  manchek
+  * version change
+  *
   * Revision 1.6  1993/11/30  15:49:14  manchek
   * version change
   *
***************
*** 55,61 ****
  
  /* release version */
  
! #define	PVM_VER	"3.2.5"
  
  /* UDPMAXLEN should be set to the largest UDP message length
     your system can handle. */
--- 58,64 ----
  
  /* release version */
  
! #define	PVM_VER	"3.2.6"
  
  /* UDPMAXLEN should be set to the largest UDP message length
     your system can handle. */
*** ../netlib/pvm3.2.5/src/lpvmmimd.c	Wed Oct 27 13:41:14 1993
--- src/lpvmmimd.c	Mon Dec 20 10:39:28 1993
***************
*** 32,39 ****
   *	Libpvm core for MPP environment.
   *
  $Log: lpvmmimd.c,v $
!  * Revision 1.2  1993/10/15  14:53:30  manchek
!  * define pvm_useruid as it's needed in pvmcruft.c
   *
   * Revision 1.1  1993/08/30  23:26:48  manchek
   * Initial revision
--- 32,39 ----
   *	Libpvm core for MPP environment.
   *
  $Log: lpvmmimd.c,v $
!  * Revision 1.3  1993/12/20  15:39:15  manchek
!  * patch 6 from wcj
   *
   * Revision 1.1  1993/08/30  23:26:48  manchek
   * Initial revision
***************
*** 142,153 ****
  int pvmmyptid = -1;						/* parent task id */
  int pvmmytid = -1;						/* this task id */
  int pvmmyupid = -1;						/* process unix pid */
  int pvmudpmtu = MAXFRAGSIZE;			/* max fragment size */
  int pvmouttid = 0;						/* stdout dst and code */
  int pvmoutcod = 0;
  int pvmtrctid = 0;						/* trace dst and code */
  int pvmtrccod = 0;
- int pvm_useruid = -1;					/* user's unix uid */
  
  
  #if defined(IMA_PGON) || defined(IMA_I860)
--- 142,153 ----
  int pvmmyptid = -1;						/* parent task id */
  int pvmmytid = -1;						/* this task id */
  int pvmmyupid = -1;						/* process unix pid */
+ int pvm_useruid = -1;					/* user's unix uid */
  int pvmudpmtu = MAXFRAGSIZE;			/* max fragment size */
  int pvmouttid = 0;						/* stdout dst and code */
  int pvmoutcod = 0;
  int pvmtrctid = 0;						/* trace dst and code */
  int pvmtrccod = 0;
  
  
  #if defined(IMA_PGON) || defined(IMA_I860)
***************
*** 181,188 ****
  			/sizeof(pvm_errlist[0]);	/* exported num of errors */
  struct umbuf *pvmrxlist = 0;				/* not-recvd msg list */
  int pvmtidhmask = TIDHOST;					/* mask for host field of tids */
! int tidnmask = TIDNODE;					/* mask for node field of tids */
! int tidtmask = TIDPTYPE;				/* mask for proc type field of tids */
  
  
  /***************
--- 181,188 ----
  			/sizeof(pvm_errlist[0]);	/* exported num of errors */
  struct umbuf *pvmrxlist = 0;				/* not-recvd msg list */
  int pvmtidhmask = TIDHOST;					/* mask for host field of tids */
! int pvmtidnmask = TIDNODE;					/* mask for node field of tids */
! int pvmtidtmask = TIDPTYPE;				/* mask for proc type field of tids */
  
  
  /***************
***************
*** 190,196 ****
   **           **
   ***************/
  
! static char rcsid[] = "$Id: lpvmmimd.c,v 1.2 1993/10/15 14:53:30 manchek Exp $";
  static int debugmask = 0;				/* which debugging info */
  static char etext[512];					/* scratch for error log */
  static struct umbuf *rxfrag = 0;		/* not-assembled incm msgs */
--- 190,196 ----
   **           **
   ***************/
  
! static char rcsid[] = "$Id: lpvmmimd.c,v 1.3 1993/12/20 15:39:15 manchek Exp $";
  static int debugmask = 0;				/* which debugging info */
  static char etext[512];					/* scratch for error log */
  static struct umbuf *rxfrag = 0;		/* not-assembled incm msgs */
***************
*** 316,321 ****
--- 316,325 ----
  	int srcnode = -1;
  	int i;
  
+ 	/* XXX do we really have to do this? */
+ 	if ((dtid == TIDPVMD && code == TM_MCA) || dtid == TIDGID)
+ 		return node_mcast(mid, dtid, code);
+ 
  	if (txup = midtobuf(mid)) {
  		txfp = txup->ub_frag->fr_link;
  		if (txfp->fr_buf) {
***************
*** 322,332 ****
  			int mask = pvmtidhmask;		/* host */
  
  #if defined(IMA_PGON) || defined(IMA_CM5)
! 			mask |= tidtmask;				/* process type */
  #endif
  
  			if (TIDISNODE(dtid) && (dtid & mask) == (pvmmytid & mask)) {
! 				node = dtid & tidnmask;
  				ptype = my_ptype;			/* send to node directly */
  				mtype = PMTNN;
  			} else {
--- 326,336 ----
  			int mask = pvmtidhmask;		/* host */
  
  #if defined(IMA_PGON) || defined(IMA_CM5)
! 			mask |= pvmtidtmask;				/* process type */
  #endif
  
  			if (TIDISNODE(dtid) && (dtid & mask) == (pvmmytid & mask)) {
! 				node = dtid & pvmtidnmask;
  				ptype = my_ptype;			/* send to node directly */
  				mtype = PMTNN;
  			} else {
***************
*** 364,369 ****
--- 368,374 ----
  			cp = fp->fr_dat;
  			dst = pvmget32(cp);
  			src = pvmget32(cp + 4);
+ /*
  			if (dst != pvmmytid && !(dst & TIDGID)) {
  				sprintf(etext,
  					"mroute() pkt src t%x node %d dst t%x scrapped (not us)\n",
***************
*** 371,376 ****
--- 376,382 ----
  				pvmlogerror(etext);
  				continue;
  			}
+ */
  			ff = pvmget8(cp + 12);
  			fp->fr_len -= TDFRAGHDR;
  			fp->fr_dat += TDFRAGHDR;
***************
*** 424,432 ****
  		}
  
  
! 		if (txfp) {
! 			/* has msg to send */
  
  			txcp = txfp->fr_dat;
  			len = txfp->fr_len;
  	/*
--- 430,459 ----
  		}
  
  
! 		if (txfp) {		/* has msg to send */
  
+ 			/* check any pending sends; free data if send is completed */
+ 
+ 			if (nextsmid == NUMSMIDS)
+ 				nextsmid = 0;
+ 			i = nextsmid;
+ 
+ 			while (outfrags[i].tf_mid > 0 &&
+ 			ASYNCDONE(outfrags[i].tf_mid) > 0) {
+ 				fr_unref(outfrags[i].tf_fp);
+ #ifdef IMA_CM5
+ 				CMMD_free_mcb(outfrags[i].tf_mid);
+ #endif
+ 				outfrags[i++].tf_mid = -1;
+ 			}
+ 
+ 			if (outfrags[nextsmid].tf_mid >= 0) {
+ 				if (debugmask & TDMPACKET)
+ 					pvmlogerror("out of mid's?");
+ 				nextsmid++;		/* don't get stuck here; check out next mid */
+ 				continue;
+ 			}
+ 
  			txcp = txfp->fr_dat;
  			len = txfp->fr_len;
  	/*
***************
*** 457,486 ****
  				pvmlogerror(etext);
  			}
  
! 			/* check any pending sends; free data if send is completed */
! 
! 			if (nextsmid == NUMSMIDS)
! 				nextsmid = 0;
! 			i = nextsmid;
! 			while (outfrags[i].tf_mid > 0 &&
! 			ASYNCDONE(outfrags[i].tf_mid) > 0) {
! 				fr_unref(outfrags[i].tf_fp);
! #ifdef IMA_CM5
! 				CMMD_free_mcb(outfrags[i].tf_mid);
! #endif
! 				outfrags[i++].tf_mid = -1;
! 			}
! 
! 			if (outfrags[nextsmid].tf_mid < 0) {
  				if ((outfrags[nextsmid].tf_mid =
  				ASYNCSEND(mtype, txcp, len, node, ptype)) < 0) {
  					pvmlogperror("mroute() asyncsend");
  					return PvmSysErr;
  				}
! 				txfp->fr_ref++;		/* don't free data 'til frag's sent */
  				outfrags[nextsmid++].tf_fp = txfp;
  			} else {
! 				/* too many isend's outstanding; use csend */
  				if (PVMCSEND(mtype, txcp, len, node, ptype) < 0) {
  					pvmlogperror("mroute() csend");
  					return PvmSysErr;
--- 484,505 ----
  				pvmlogerror(etext);
  			}
  
! 			if (node != my_host) {
  				if ((outfrags[nextsmid].tf_mid =
  				ASYNCSEND(mtype, txcp, len, node, ptype)) < 0) {
  					pvmlogperror("mroute() asyncsend");
  					return PvmSysErr;
  				}
! 				/* don't free data 'til frag's sent */
! 				txfp->fr_ref++;		
  				outfrags[nextsmid++].tf_fp = txfp;
  			} else {
! 				/* 
! 				 * In multicast, the fragment header may get overwritten
! 				 * if we use ASYNCSEND. This is OK for node-node send,
! 				 * because the dst field is not used. But pvmd relies on
! 				 * this value to deliever the packet.
! 				 */
  				if (PVMCSEND(mtype, txcp, len, node, ptype) < 0) {
  					pvmlogperror("mroute() csend");
  					return PvmSysErr;
***************
*** 497,502 ****
--- 516,629 ----
  }
  
  
+ int
+ node_mcast(mid, dtid, code)
+ 	int mid;	/* message id */
+ 	int dtid;	/* destination */
+ 	int code;	/* type */
+ {
+ 	int i;
+ 	long count = 0;
+ 	int cc = 0;
+ 	static int *tids;		/* intended recipients of multicast message */
+ 	static int ntask;		/* number of tids */
+ 	int sbf;
+ 	int dummy;
+ #if defined(IMA_PGON)
+ 	int *nodes;
+ 	int mask = pvmtidhmask;		/* host */
+ 	struct umbuf *txup;			/* tx message or null */
+ 	struct frag *txfp = 0;		/* cur tx frag or null */
+ 	int ff;
+ 	char *txcp = 0;				/* point to remainder of txfp */
+ 	int len = 0;				/* len of txfp */
+ #endif /*defined(IMA_PGON) || defined(IMA_I860)*/
+ 
+ 	/* intercept multicast info */
+ 
+ 	if (dtid == TIDPVMD) {
+ 		pvm_setrbuf(mid);
+ 		pvm_upkint(&ntask, 1, 1);
+ 		tids = TALLOC(ntask, int, "tids");
+ 		pvm_upkint(tids, ntask, 1);
+ 		sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
+ 		dummy = TIDGID;
+ 		pvm_pkint(&dummy, 1, 1);
+ 		pvm_setrbuf(pvm_setsbuf(sbf));
+ 		return 0;
+ 	}
+ 	
+ #if defined(IMA_PGON)
+ 
+ /* #if defined(IMA_PGON) */
+ 	mask |= pvmtidtmask;		/* process type */
+ /* #endif */
+ 	nodes = TALLOC(ntask, long, "nodes");
+ 	for (i = 0; i < ntask; i++) {
+ 		if (TIDISNODE(tids[i]) && (tids[i] & mask) == (pvmmytid & mask))
+ 			nodes[count++] = tids[i] & pvmtidnmask;
+ 		else
+ 			cc = mroute(mid, tids[i], code, 0);
+ 	}
+ 	if (count) {
+ 		if (txup = midtobuf(mid)) {
+ 			txfp = txup->ub_frag->fr_link;
+ 			txfp = txfp->fr_buf ? txfp : 0;
+ 		}
+ 		while (txfp) {
+ 			txcp = txfp->fr_dat;
+ 			len = txfp->fr_len;
+ 			ff = 0;
+ 			if (txfp->fr_rlink == txup->ub_frag) {
+ 				txcp -= TTMSGHDR;
+ 				len += TTMSGHDR;
+ 				pvmput32(txcp, code);
+ 				pvmput32(txcp + 4, txup->ub_enc);
+ 				ff = FFSOM;
+ 			}
+ 			if (txfp->fr_link == txup->ub_frag)
+ 				ff |= FFEOM;
+ 			txcp -= TDFRAGHDR;
+ 			pvmput32(txcp, dtid);
+ 			pvmput32(txcp + 4, pvmmytid);
+ 			pvmput32(txcp + 8, len);
+ 			pvmput8(txcp + 12, ff);
+ 			len += TDFRAGHDR;
+ 			if (debugmask & TDMPACKET) {
+ 				sprintf(etext, "node_mcast() len %d\n", txfp->fr_len);
+ 				pvmlogerror(etext);
+ 			}
+ 			if (count == numnodes() - 1) {
+ 				if (_csend(PMTMCAST, txcp, (long)len, -1, my_ptype) < 0) {
+ 					pvmlogperror("node_mcast() csend");
+ 					return PvmSysErr;
+ 				}
+ 			} else {
+ 				if (_gsendx(PMTMCAST, txcp, (long)len, nodes, count) < 0) {
+ 					pvmlogperror("node_mcast() gsendx");
+ 					return PvmSysErr;
+ 				}
+ 			}
+ 			txfp = txfp->fr_link;
+ 			if (!txfp->fr_buf)
+ 				txfp = 0;
+ 		}
+ 	}
+ 	PVM_FREE(nodes);
+ #endif /*defined(IMA_PGON)*/
+ 
+ #if defined(IMA_CM5) || defined(IMA_I860)
+ 	for (i = 0; i < ntask; i++)
+ 		cc = mroute(mid, tids[i], code, 0);
+ #endif
+ 
+ 	PVM_FREE(tids);
+ 	ntask = 0;
+ 
+ 	return cc;
+ }
+ 	
+ 
  /*	msendrecv()
  *
  *	Single op to send a system message (usually to our pvmd) and get
***************
*** 523,528 ****
--- 650,658 ----
  	if ((cc = mroute(pvmsbufmid, other, code, 1)) < 0)
  		return cc;
  
+ 	if (code == TM_MCA)
+ 		return 1;
+ 
  	/* recv code from other */
  	for (up = pvmrxlist->ub_link; 1; up = up->ub_link) {
  		if (up == pvmrxlist) {
***************
*** 577,582 ****
--- 707,717 ----
  	if ((my_host = _myhost()) < 0)
  		pvmlogperror("beatask() no controlling process");
  #endif
+ 
+ 	if ((pvm_useruid = getuid()) == -1) {
+ 		pvmlogerror("can't getuid()\n");
+ 		return PvmSysErr;
+ 	}
  
  #ifdef IMA_CM5
  	CMMD_enable_host();
*** ../netlib/pvm3.2.5/src/patchlevel.h	Tue Nov 30 19:09:36 1993
--- src/patchlevel.h	Mon Dec 20 10:42:39 1993
***************
*** 1,3 ****
  
! #define PATCHLEVEL 5
  
--- 1,3 ----
  
! #define PATCHLEVEL 6
  
*** ../netlib/pvm3.2.5/src/pvmd.c	Wed Oct 27 13:41:14 1993
--- src/pvmd.c	Mon Dec 20 10:39:44 1993
***************
*** 32,37 ****
--- 32,40 ----
   *	Mr. pvm daemon.
   *
  $Log: pvmd.c,v $
+  * Revision 1.10  1993/12/20  15:39:28  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.9  1993/10/25  20:51:11  manchek
   * make sure pvmd doesn't use 0..2 for sockets, etc. - open /dev/null.
   * added code to change process group/disassoc. from tty (TTYDIS).
***************
*** 204,210 ****
   **           **
   ***************/
  
! static char rcsid[] = "$Id: pvmd.c,v 1.9 1993/10/25 20:51:11 manchek Exp $";
  static int *deads = 0;			/* circ queue of dead pids */
  static char pvmtxt[512];		/* scratch for error log */
  static int ndead = 0;			/* len of deads */
--- 207,213 ----
   **           **
   ***************/
  
! static char rcsid[] = "$Id: pvmd.c,v 1.10 1993/12/20 15:39:28 manchek Exp $";
  static int *deads = 0;			/* circ queue of dead pids */
  static char pvmtxt[512];		/* scratch for error log */
  static int ndead = 0;			/* len of deads */
***************
*** 447,453 ****
  	"slv",	/* 8 */
  	"hst",	/* 10 */
  	"sel",	/* 20 */
! 	"net"	/* 40 */
  };
  
  char *
--- 450,457 ----
  	"slv",	/* 8 */
  	"hst",	/* 10 */
  	"sel",	/* 20 */
! 	"net",	/* 40 */
! 	"mpp"	/* 80 */
  };
  
  char *
***************
*** 1452,1465 ****
  
  	if (mcap) {
  
! #if	defined(IMA_PGON) || defined(IMA_I860) || defined(IMA_CM5)
! 		mpp_mcast(src, pp, mcap->mc_dsts, mcap->mc_ndst);
  
- #ifdef IMA_CM5
- 		pp = 0;		/* do not free pkt */
- #endif
- #else	/*defined(IMA_PGON) || defined(IMA_I860) || defined(IMA_CM5)*/
- 
  		for (i = mcap->mc_ndst; i-- > 0; ) {
  			dst = mcap->mc_dsts[i];
  			if (tp = task_find(dst)) {		/* to local task */
--- 1456,1465 ----
  
  	if (mcap) {
  
! #if	defined(IMA_PGON) || defined(IMA_I860)
! 		mpp_mcast(pp, mcap->mc_dsts, mcap->mc_ndst);
! #else	/*defined(IMA_PGON) || defined(IMA_I860) */
  
  		for (i = mcap->mc_ndst; i-- > 0; ) {
  			dst = mcap->mc_dsts[i];
  			if (tp = task_find(dst)) {		/* to local task */
***************
*** 1488,1494 ****
  			}
  		}
  
! #endif	/*defined(IMA_PGON) || defined(IMA_I860) || defined(IMA_CM5)*/
  
  		if (ff & FFEOM) {
  			if (debugmask & PDMMESSAGE) {
--- 1488,1494 ----
  			}
  		}
  
! #endif	/*defined(IMA_PGON) || defined(IMA_I860) */
  
  		if (ff & FFEOM) {
  			if (debugmask & PDMMESSAGE) {
*** ../netlib/pvm3.2.5/src/pvmmimd.h	Mon Aug 30 19:29:34 1993
--- src/pvmmimd.h	Mon Dec 20 10:39:45 1993
***************
*** 29,34 ****
--- 29,37 ----
   *  pvmmimd.h
   *
  $Log: pvmmimd.h,v $
+  * Revision 1.2  1993/12/20  15:39:44  manchek
+  * patch 6 from wcj
+  *
   * Revision 1.1  1993/08/30  23:26:51  manchek
   * Initial revision
   *
***************
*** 67,72 ****
--- 70,77 ----
  	CMMD_send_async((int)(dest),tag,buf,len,(void*)0,(void*)0)
  #define PVMCSEND(tag,buf,len,dest,ptype)	\
  	CMMD_send_noblock((int)(dest),tag,buf,len)
+ #define PVMCRECV(tag,buf,len) \
+ 	CMMD_receive_block(CMMD_ANY_NODE,tag,buf,len)
  #define NUMSMIDS	90			/* the CM5 has about 100 message IDs */
  
  #endif /*IMA_CM5*/
***************
*** 80,87 ****
--- 85,98 ----
  #define ASYNCRECV(buf,len)					_irecv((long)recvmask,buf,(long)len)
  #define ASYNCSEND(tag,buf,len,dest,ptype)	_isend(tag,buf,(long)len,dest,ptype)
  #define PVMCSEND(tag,buf,len,dest,ptype)	_csend(tag,buf,(long)len,dest,ptype)
+ #define PVMCRECV(tag,buf,len)				_crecv(tag,buf,len)
  #define NUMSMIDS	64			/* the Paragon has 999 message IDs (snd/recv) */
  								/* msg buffer for Paragon holds 1MB; = 64x16K */
+ /*
+ #ifdef IMA_I860
+ #define NUMSMIDS    1
+ #endif
+ */
  
  #endif /*IMA_PGON/IMA_I860*/
  
***************
*** 110,117 ****
  #define NUMPTYPE	64			/* (PGON) num of active proc types allowed */
  
  #define PVMDPTYPE	0			/* process type of pvmd */
! #define PDMNODE		64			/* pvmd debug mask */
! #define MAXFRAGSIZE	16384		/* max fragment size (16K) */
  #define SIZEHINFO	5			/* size of hostinfo array */
  #define TIMEOUT		10000		/* for select(); in usec */
  
--- 121,128 ----
  #define NUMPTYPE	64			/* (PGON) num of active proc types allowed */
  
  #define PVMDPTYPE	0			/* process type of pvmd */
! #define PDMNODE		128			/* pvmd debug mask */
! #define MAXFRAGSIZE	0x00004000	/* max fragment size (16K) */
  #define SIZEHINFO	5			/* size of hostinfo array */
  #define TIMEOUT		10000		/* for select(); in usec */
  
***************
*** 135,141 ****
  int mpp_load __ProtoGlarp__((int flags, char *name, char **argv, int count,
  	int *tids, int ptid));
  void mpp_input __ProtoGlarp__((void));
! int mpp_mcast __ProtoGlarp__((int src, struct pkt *pp, int *tids, int ntask));
  void mpp_output __ProtoGlarp__((struct task *tp, struct pkt *pp));
  struct task *mpp_find __ProtoGlarp__((int pid));
  int mpp_probe __ProtoGlarp__((void));
--- 146,152 ----
  int mpp_load __ProtoGlarp__((int flags, char *name, char **argv, int count,
  	int *tids, int ptid));
  void mpp_input __ProtoGlarp__((void));
! int mpp_mcast __ProtoGlarp__((struct pkt *pp, int *tids, int ntask));
  void mpp_output __ProtoGlarp__((struct task *tp, struct pkt *pp));
  struct task *mpp_find __ProtoGlarp__((int pid));
  int mpp_probe __ProtoGlarp__((void));
