[comp.sys.encore] Encore Parallel Threads

jwhitson@wpi.wpi.edu (John C Whitson KB2GNC) (03/16/90)

	I am running the *simplest* threads applications from
	the Encore Parallel Threads Manual (matrix multiply,
	the examples), and the examples have one problem:
	they never complete!! My program sits around and does
	nothing, yet there are also n CPU bound processes
	that are running that it created. I am doing this on
	an 8-processor XPC Encore Multimax, runnning UMAX 4.3
	R4_0.0 with NFS, dated Feb 8 1990.

	Has anyone else experienced this problem? Or perhaps
	knows the fix?? Is there a fix??

	Here is the program:

#include <stdio.h>
#include <thread.h>

int A[9] = { 1,2,3,4,5,6,7,8,9};
int B[9] = { 9,8,7,6,5,4,3,2,1 };
int C[9];

main(argc,argv)	int argc; char *argv[];	{
    extern void startup();
    if (argc != 2) {
	fprintf(stderr,"usage: tst #procs\n");
	exit(1);
       }
    THREADgo(atol(argv[1]),2*1024*1024,startup,0,0,20*1024,0);
    }

void startup()	{
   extern void mult();
   struct { int i; int j; } ij;

   for(ij.i=0;ij.i<3;ij.i++)
       for(ij.j=0;ij.j<3;ij.j++)
	   THREADcreate(mult,&ij,sizeof(ij),ATTACHED,20*1024,0);
   while(THREADjoin());
      printf("%3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
	  C[0], C[1], C[2], C[3], C[4], C[5], C[6], C[7], C[8]);
   }

void mult(ij)	struct { int i; int j; } *ij; {
    register int i;
    register int t=0;
    register int col = 3*ij->i;
    register int row = ij->j;

    for(i=0;i<3;i++) {
       t += A[col]*B[row];
       col++;
       row += 3;
       }
    C[3*ij->i + ij->j] = t;
    }

/******** ENd of Program ********/

-- 
----------  If at first you don't succeed,  so much for skydiving ---------
John Whitson:   Internet: jwhitson@wpi.wpi.edu  Bitnet: jwhitson@wpi.bitnet
73's from KB2GNC/1                         UUCP: uunet!wpi.wpi.edu!jwhitson
----------  Anything with this tag on it is purely my own opinion ---------

twd@cs.brown.edu (Tom Doeppner) (03/18/90)

In article <9691@wpi.wpi.edu> jwhitson@wpi.wpi.edu (John C Whitson KB2GNC)
writes:
>
>	I am running the *simplest* threads applications from
>	the Encore Parallel Threads Manual (matrix multiply,
>	the examples), and the examples have one problem:
>	they never complete!! My program sits around and does

Your program makes a call to "THREADjoin," which is not defined in Brown
Threads, from which Encore Parallel Threads was derived.  (This routine was
probably added as part of a C-threads compatibility package).  If you replace
"THREADjoin" with "THREADwaitforchild", your code will work (at least it does
at Brown).

Tom Doeppner
Brown University
twd@cs.brown.edu

knighten@pinocchio (Bob Knighten) (03/19/90)

Users of EPT should be warned that the release of EPT that comes with UMAX 4.3
R 4_0 is significantly different from earlier releases.  These changes outdate
the manual in some ways, the most important being that programs that use EPT
must be compiled and linked in a different manner.  To go along with this
there are now more than 60 man pages that document the current version of EPT
and effectively supersede the manual.

I'm responsible for EPT at Encore, and I just verified that this program
behaves properly on an XPC system here, so my first suspicion would be that
the program was not compiled and linked as required?  Did you follow the
method explained in the ept(9) man page?
-- 
Bob Knighten
Encore Computer Corp., 257 Cedar Hill Street, Marlborough, MA 01752
Internet:  knighten@encore.com             (508) 460-0500 ext. 2626
uucp:  {bu-cs,decvax,gould}!encore!knighten

jwhitson@wpi.wpi.edu (John C Whitson KB2GNC) (03/19/90)

	My thanks to Encore and Knighten@pinnochio.encore.com! The problem
	I had was my fault .... the linking mechanism had changed some and
	I didn't notice it. Just re-load and it worked fine.

-- 
----------  If at first you don't succeed,  so much for skydiving ---------
John Whitson:   Internet: jwhitson@wpi.wpi.edu  Bitnet: jwhitson@wpi.bitnet
73's from KB2GNC/1                         UUCP: uunet!wpi.wpi.edu!jwhitson
----------  Anything with this tag on it is purely my own opinion ---------