ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimate.c
(Generate patch)

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.2 by greg, Thu Jan 18 11:25:11 1996 UTC vs.
Revision 2.4 by greg, Mon Jan 22 17:19:37 1996 UTC

# Line 99 | Line 99 | int    npslots;                /* number of process slots */
99   int     lastpid;                /* ID of last completed background process */
100   PSERVER *lastpserver;           /* last process server used */
101  
102 + #define phostname(ps)   ((ps)->hostname[0] ? (ps)->hostname : astat.host)
103 +
104   struct pslot    *findpslot();
105  
106   VIEW    *getview();
# Line 636 | Line 638 | int    first, last;
638   char    *vfn;
639   {
640          char    combuf[2048];
641 +        char    *inspoint;
642          register int    i;
643  
644          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 646 | Line 649 | char   *vfn;
649                                  close(open(combuf, O_RDONLY|O_CREAT, 0666));
650                          }
651                                          /* create command */
652 <        sprintf(combuf, "rpict%s -w0 ", rendopt);
652 >        sprintf(combuf, "rpict%s -w0", rendopt);
653          if (vint(INTERP) || atoi(vval(MBLUR)))
654 <                sprintf(combuf+strlen(combuf), "-z %s.zbf ", vval(BASENAME));
655 <        sprintf(combuf+strlen(combuf), "-o %s.unf %s -S %d %s < %s",
656 <                        vval(BASENAME), rresopt, first, vval(OCTREE), vfn);
654 >                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
655 >        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
656 >                        vval(BASENAME), rresopt, first);
657 >        inspoint = combuf + strlen(combuf);
658 >        sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
659                                          /* run in parallel */
660 <        if (pruncom(combuf, (last-first+1)/(vint(INTERP)+1))) {
660 >        if (pruncom(combuf, inspoint, (last-first+1)/(vint(INTERP)+1))) {
661                  fprintf(stderr, "%s: error rendering frames %d through %d\n",
662                                  progname, first, last);
663                  quit(1);
# Line 1052 | Line 1057 | int    status;
1057          register PROC   *pp;
1058  
1059          pp = ps->proc + pn;
1055        if (!silent) {                  /* echo command */
1056                if (ps->hostname[0])
1057                        printf("On %s:", ps->hostname);
1058                printf("\t%s\n", pp->com);
1059                fflush(stdout);
1060        }
1060          if (pp->elen) {                 /* pass errors */
1061 +                if (ps->hostname[0])
1062 +                        fprintf(stderr, "%s: ", ps->hostname);
1063 +                fprintf(stderr, "Error output from: %s\n", pp->com);
1064                  fputs(pp->errs, stderr);
1065                  fflush(stderr);
1066                  if (ps->hostname[0])
# Line 1095 | Line 1097 | int    (*rf)();
1097          int     pid;
1098          register struct pslot   *psl;
1099  
1100 <        if (noaction) {
1101 <                if (!silent)
1102 <                        printf("\t%s\n", com);  /* just echo it */
1100 >        if (!silent)
1101 >                printf("\t%s &\n", com);        /* echo command */
1102 >        if (noaction)
1103                  return(0);
1104 <        }
1104 >        fflush(stdout);
1105                                          /* else start it when we can */
1106          while ((pid = startjob(NULL, savestr(com), donecom)) == -1)
1107                  bwait(1);
1108 +        if (!silent) {
1109 +                PSERVER *ps;
1110 +                int     psn = pid;
1111 +                ps = findjob(&psn);
1112 +                printf("\tProcess started on %s\n", phostname(ps));
1113 +                fflush(stdout);
1114 +        }
1115          psl = findpslot(pid);           /* record info. in appropriate slot */
1116          psl->pid = pid;
1117          psl->fout = fout;
# Line 1138 | Line 1147 | int    ncoms;
1147  
1148  
1149   int
1150 < pruncom(com, maxcopies)         /* run a command in parallel over network */
1151 < char    *com;
1150 > pruncom(com, ppins, maxcopies)  /* run a command in parallel over network */
1151 > char    *com, *ppins;
1152   int     maxcopies;
1153   {
1154          int     retstatus = 0;
1155 +        int     hostcopies;
1156 +        char    com1buf[10240], *com1, *endcom1;
1157          int     status;
1158          register PSERVER        *ps;
1159  
1160 <        if (noaction) {
1161 <                if (!silent)
1162 <                        printf("\t%s\n", com);  /* just echo */
1160 >        if (!silent)
1161 >                printf("\t%s &\n", com);        /* echo command */
1162 >        if (noaction)
1163                  return(0);
1164 <        }
1164 >        fflush(stdout);
1165                                          /* start jobs on each server */
1166 <        for (ps = pslist; ps != NULL; ps = ps->next)
1166 >        for (ps = pslist; ps != NULL; ps = ps->next) {
1167 >                hostcopies = 0;
1168 >                if (maxcopies > 1 && ps->nprocs > 1 && ppins != NULL) {
1169 >                        strcpy(com1=com1buf, com);      /* build -PP command */
1170 >                        sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1171 >                                        vval(DIRECTORY), phostname(ps));
1172 >                        strcat(com1, ppins);
1173 >                        endcom1 = com1 + strlen(com1);
1174 >                        sprintf(endcom1, "; kill `sed -n '1s/^[^ ]* //p' %s/%s.persist`",
1175 >                                        vval(DIRECTORY), phostname(ps));
1176 >                } else {
1177 >                        com1 = com;
1178 >                        endcom1 = NULL;
1179 >                }
1180                  while (maxcopies > 0 &&
1181 <                                startjob(ps, savestr(com), donecom) != -1) {
1181 >                                startjob(ps, savestr(com1), donecom) != -1) {
1182                          sleep(10);
1183 +                        hostcopies++;
1184                          maxcopies--;
1185 +                        if (endcom1 != NULL)
1186 +                                *endcom1 = '\0';
1187                  }
1188 +                if (!silent && hostcopies) {
1189 +                        if (hostcopies > 1)
1190 +                                printf("\t%d duplicate processes", hostcopies);
1191 +                        else
1192 +                                printf("\tProcess");
1193 +                        printf(" started on %s\n", phostname(ps));
1194 +                        fflush(stdout);
1195 +                }
1196 +        }
1197                                          /* wait for jobs to finish */
1198          while ((status = wait4job(NULL, -1)) != -1)
1199                  if (status)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines