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.3 by greg, Fri Jan 19 17:24:19 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 1103 | Line 1108 | int    (*rf)();
1108          if (!silent) {
1109                  PSERVER *ps;
1110                  int     psn = pid;
1111 <                ps = findpjob(&psn);
1112 <                printf("\tProcess started on %s\n",
1108 <                                ps->hostname[0] ? ps->hostname : LHOSTNAME);
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 */
# Line 1143 | 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  
# Line 1160 | Line 1165 | int    maxcopies;
1165                                          /* start jobs on each server */
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",
1175 <                                ps->hostname[0] ? ps->hostname : LHOSTNAME);
1193 >                        printf(" started on %s\n", phostname(ps));
1194                          fflush(stdout);
1195                  }
1196          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines