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.5 by greg, Tue Jan 23 16:14:28 1996 UTC

# Line 57 | Line 57 | VARIABLE       vv[] = {                /* variable-value pairs */
57          {"ANIMATE",     2,      0,      NULL,   onevalue},
58          {"TRANSFER",    2,      0,      NULL,   onevalue},
59          {"ARCHIVE",     2,      0,      NULL,   onevalue},
60 <        {"INTERP",      3,      0,      NULL,   intvalue},
61 <        {"OVERSAMP",    2,      0,      NULL,   fltvalue},
60 >        {"INTERPOLATE", 3,      0,      NULL,   intvalue},
61 >        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
62          {"MBLUR",       2,      0,      NULL,   onevalue},
63          {"RTRACE",      2,      0,      NULL,   boolvalue},
64          {"DISKSPACE",   3,      0,      NULL,   fltvalue},
# 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 300 | Line 302 | setdefaults()                  /* set default values */
302                  vdef(START)++;
303          }
304          if (!vdef(END)) {
305 <                sprintf(buf, "%d", countviews());
305 >                sprintf(buf, "%d", countviews()+vint(START)-1);
306                  vval(END) = savqstr(buf);
307                  vdef(END)++;
308          }
309 +        if (vint(END) < vint(START)) {
310 +                fprintf(stderr, "%s: ending frame less than starting frame\n",
311 +                                progname);
312 +                quit(1);
313 +        }
314          if (!vdef(BASENAME)) {
315                  sprintf(buf, "%s/frame%%03d", vval(DIRECTORY));
316                  vval(BASENAME) = savqstr(buf);
# Line 636 | Line 643 | int    first, last;
643   char    *vfn;
644   {
645          char    combuf[2048];
646 +        char    *inspoint;
647          register int    i;
648  
649          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 646 | Line 654 | char   *vfn;
654                                  close(open(combuf, O_RDONLY|O_CREAT, 0666));
655                          }
656                                          /* create command */
657 <        sprintf(combuf, "rpict%s -w0 ", rendopt);
657 >        sprintf(combuf, "rpict%s -w0", rendopt);
658          if (vint(INTERP) || atoi(vval(MBLUR)))
659 <                sprintf(combuf+strlen(combuf), "-z %s.zbf ", vval(BASENAME));
660 <        sprintf(combuf+strlen(combuf), "-o %s.unf %s -S %d %s < %s",
661 <                        vval(BASENAME), rresopt, first, vval(OCTREE), vfn);
659 >                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
660 >        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
661 >                        vval(BASENAME), rresopt, first);
662 >        inspoint = combuf + strlen(combuf);
663 >        sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
664                                          /* run in parallel */
665 <        if (pruncom(combuf, (last-first+1)/(vint(INTERP)+1))) {
665 >        if (pruncom(combuf, inspoint, (last-first+1)/(vint(INTERP)+1))) {
666                  fprintf(stderr, "%s: error rendering frames %d through %d\n",
667                                  progname, first, last);
668                  quit(1);
# Line 824 | Line 834 | int    rvr;
834                  if (atoi(vval(MBLUR))) {
835                          FILE    *fp;            /* motion blurring */
836                          sprintf(fname, "%s/vw0", vval(DIRECTORY));
837 +                        if (access(fname, F_OK) == 0)
838 +                                sleep(10);
839                          if ((fp = fopen(fname, "w")) == NULL) {
840                                  perror(fname); quit(1);
841                          }
# Line 1052 | Line 1064 | int    status;
1064          register PROC   *pp;
1065  
1066          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        }
1067          if (pp->elen) {                 /* pass errors */
1068 +                if (ps->hostname[0])
1069 +                        fprintf(stderr, "%s: ", ps->hostname);
1070 +                fprintf(stderr, "Error output from: %s\n", pp->com);
1071                  fputs(pp->errs, stderr);
1072                  fflush(stderr);
1073                  if (ps->hostname[0])
# Line 1097 | Line 1106 | int    (*rf)();
1106  
1107          if (noaction) {
1108                  if (!silent)
1109 <                        printf("\t%s\n", com);  /* just echo it */
1109 >                        printf("\t%s\n", com);  /* echo command */
1110                  return(0);
1111          }
1112                                          /* else start it when we can */
1113          while ((pid = startjob(NULL, savestr(com), donecom)) == -1)
1114                  bwait(1);
1115 +        if (!silent) {                          /* echo command */
1116 +                PSERVER *ps;
1117 +                int     psn = pid;
1118 +                ps = findjob(&psn);
1119 +                printf("\t%s\n", com);
1120 +                printf("\tProcess started on %s\n", phostname(ps));
1121 +                fflush(stdout);
1122 +        }
1123          psl = findpslot(pid);           /* record info. in appropriate slot */
1124          psl->pid = pid;
1125          psl->fout = fout;
# Line 1138 | Line 1155 | int    ncoms;
1155  
1156  
1157   int
1158 < pruncom(com, maxcopies)         /* run a command in parallel over network */
1159 < char    *com;
1158 > pruncom(com, ppins, maxcopies)  /* run a command in parallel over network */
1159 > char    *com, *ppins;
1160   int     maxcopies;
1161   {
1162          int     retstatus = 0;
1163 +        int     hostcopies;
1164 +        char    com1buf[10240], *com1, *endcom1;
1165          int     status;
1166          register PSERVER        *ps;
1167  
1168 <        if (noaction) {
1169 <                if (!silent)
1170 <                        printf("\t%s\n", com);  /* just echo */
1168 >        if (!silent)
1169 >                printf("\t%s &\n", com);        /* echo command */
1170 >        if (noaction)
1171                  return(0);
1172 <        }
1172 >        fflush(stdout);
1173                                          /* start jobs on each server */
1174 <        for (ps = pslist; ps != NULL; ps = ps->next)
1174 >        for (ps = pslist; ps != NULL; ps = ps->next) {
1175 >                hostcopies = 0;
1176 >                if (maxcopies > 1 && ps->nprocs > 1 && ppins != NULL) {
1177 >                        strcpy(com1=com1buf, com);      /* build -PP command */
1178 >                        sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1179 >                                        vval(DIRECTORY), phostname(ps));
1180 >                        strcat(com1, ppins);
1181 >                        endcom1 = com1 + strlen(com1);
1182 >                        sprintf(endcom1, "; kill `sed -n '1s/^[^ ]* //p' %s/%s.persist`",
1183 >                                        vval(DIRECTORY), phostname(ps));
1184 >                } else {
1185 >                        com1 = com;
1186 >                        endcom1 = NULL;
1187 >                }
1188                  while (maxcopies > 0 &&
1189 <                                startjob(ps, savestr(com), donecom) != -1) {
1189 >                                startjob(ps, savestr(com1), donecom) != -1) {
1190                          sleep(10);
1191 +                        hostcopies++;
1192                          maxcopies--;
1193 +                        if (endcom1 != NULL)
1194 +                                *endcom1 = '\0';
1195                  }
1196 +                if (!silent && hostcopies) {
1197 +                        if (hostcopies > 1)
1198 +                                printf("\t%d duplicate processes", hostcopies);
1199 +                        else
1200 +                                printf("\tProcess");
1201 +                        printf(" started on %s\n", phostname(ps));
1202 +                        fflush(stdout);
1203 +                }
1204 +        }
1205                                          /* wait for jobs to finish */
1206          while ((status = wait4job(NULL, -1)) != -1)
1207                  if (status)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines