//@cindex shutDownPE void shutDownPE(void) { IF_PAR_DEBUG(verbose, fprintf(stderr, "== [%x] PEshutdown\n", mytid)); checkComms(pvm_lvgroup(PEGROUP),"PEShutDown"); checkComms(pvm_exit(),"PEShutDown"); }
/* Create the PE Tasks. We spawn (nPEs-1) pvm threads: the Main Thread (which starts execution and performs IO) is created by forking SysMan */ static int createPEs(int total_nPEs) { int i, spawn_nPEs, iSpawn = 0, nArch, nHost; struct pvmhostinfo *hostp; int sysman_host; spawn_nPEs = total_nPEs-1; if (spawn_nPEs > 0) { IF_PAR_DEBUG(verbose, fprintf(stderr, "==== [%x] Spawning %d PEs(%s) ...\n", sysman_id, spawn_nPEs, petask); fprintf(stderr, " args: "); for (i = 0; pargv[i]; ++i) fprintf(stderr, "%s, ", pargv[i]); fprintf(stderr, "\n")); pvm_config(&nHost,&nArch,&hostp); sysman_host=pvm_tidtohost(sysman_id); /* create PEs on the specific machines in the specified order! */ for (i=0; (iSpawn<spawn_nPEs) && (i<nHost); i++) if (hostp[i].hi_tid != sysman_host) { checkComms(pvm_spawn(petask, pargv, spawn_flag+PvmTaskHost, hostp[i].hi_name, 1, gtids+iSpawn), "SysMan startup"); IF_PAR_DEBUG(verbose, fprintf(stderr, "==== [%x] Spawned PE %d onto %s\n", sysman_id, i, hostp[i].hi_name)); iSpawn++; } /* create additional PEs anywhere you like */ if (iSpawn<spawn_nPEs) { checkComms(pvm_spawn(petask, pargv, spawn_flag, "", spawn_nPEs-iSpawn, gtids+iSpawn), "SysMan startup"); IF_PAR_DEBUG(verbose, fprintf(stderr,"==== [%x] Spawned %d additional PEs anywhere\n", sysman_id, spawn_nPEs-iSpawn)); } }
//@cindex startUpPE void startUpPE(void) { mytid = _my_gtid; /* Initialise PVM and get task id into global var.*/ IF_PAR_DEBUG(verbose, fprintf(stderr,"== [%x] PEStartup: Task id = [%x], No. PEs = %d \n", mytid, mytid, nPEs)); checkComms(pvm_joingroup(PEGROUP), "PEStartup"); IF_PAR_DEBUG(verbose, fprintf(stderr,"== [%x] PEStartup: Joined PEGROUP\n", mytid)); }