#ifdef WIN32 #include #include #endif #include #include #include "thing.h" /* various parameters: */ #define NSET 1 /* Number of datasets per node */ #define NDATA 1000 /* size of interior, in words */ #define NBDRY 100 /* size of each boundary, in words */ #define MAXNODES 32 static int Myid, Nodes; static volatile int called= 0; void callme(thing_t *status, void *p) { called= status->nbytes_xferred; if ( !called ) called= -1; } void serror( char *string, char *name ){ fprintf(stderr,"%s: '%s'\n", string, name ); exit(1); } void ierror( char *string, int i ) { fprintf(stderr,"%s: %d\n", string, i ); exit(1); } void shuffle( int *ia, int n ) { int i,j,k,m; srand( 123 ); if ( n==1 ) return; for (i=0; i<10; ++i ) for (j=1; j<=n/2; ++j ) { /* find random other node to interchange with */ do k= (rand()%n)+1; while ( k == j ); m=ia[j]; ia[j]=ia[k]; ia[k]= m; } } /*---------------------------------------------------------------- * task manager */ void tm() { int i, ierr, icm; int task, ndone, icycle; int nworkers; int worklist[MAXNODES], workcycle[MAXNODES]; fprintf(stderr,"==== starting TM nodes=%d\n", Nodes); nworkers= Nodes-1; for (i=1; i=0 ) { i=ierr-5; if (i<0) i=0; fprintf(stderr,"ERROR found by cm%d at %d: ",Myid,ierr); while (i= 2 ) i= atoi(argv[1]); else i=0; if ( Myid == 0 ) tm(); else cm(i); stop_thing(); exit(0); }