/* $Header: /home/harrison/c/tcgmsg/ipcv4.0/RCS/cluster.c,v 1.1 91/12/06 17:26:16 harrison Exp Locker: harrison $ */ #include #ifdef SEQUENT #include #else #include #endif #include "sndrcvP.h" #include "defglobals.h" #if defined(ALLIANT) || defined(ENCORE) || defined(SEQUENT)|| defined(AIX) \ || defined(CONVEX) || defined(ARDENT) || defined(ULTRIX) \ || defined(NEXT) extern char *strdup(); extern char *strtok(); #endif #ifdef SWTCH #include "sw.h" #endif extern void Error(); void InitClusInfo(procgrp, masterhostname) char *procgrp, *masterhostname; /* Initialize the SR_clus_info structure, SR_n_clus and SR_n_proc by parsing the PROCGRP info. The procgrp file consists of white space separated records. user host nslave image workdir Masterhostname is the name of the host running the parallel command. This routine could do with some more error checking. */ { char *user, *host, *nslave, *image, *workdir; char *white = " \t\n"; char *tmp = strdup(procgrp); int i; SR_n_clus = 0; SR_n_proc = 0; while (1) { user = strtok(tmp, white); tmp = (char *) NULL; if (user == (char *) NULL) break; host = strtok(tmp, white); nslave = strtok(tmp, white); image = strtok(tmp, white); workdir = strtok(tmp, white); if (workdir == (char *) NULL) Error("InitClusInfo: error parsing PROCGRP, line=",SR_n_clus+1); if (SR_n_clus == MAX_CLUSTER) Error("InitClusInfo: maximum no. of clusters exceeded", (long) MAX_CLUSTER); SR_clus_info[SR_n_clus].user = strdup(user); SR_clus_info[SR_n_clus].hostname = strdup(host); SR_clus_info[SR_n_clus].nslave = atoi(nslave); SR_clus_info[SR_n_clus].image = strdup(image); SR_clus_info[SR_n_clus].workdir = strdup(workdir); SR_clus_info[SR_n_clus].masterid = SR_n_proc; #if defined(ALLIANT) && defined(SWTCH) SR_clus_info[SR_n_clus].swtchport = sw_port_by_name(host); #endif for (i=0; i