ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/rt/RcontribSimulManager.cpp
(Generate patch)

Comparing ray/src/rt/RcontribSimulManager.cpp (file contents):
Revision 2.1 by greg, Tue Oct 29 00:36:54 2024 UTC vs.
Revision 2.21 by greg, Mon Oct 27 18:38:32 2025 UTC

# Line 24 | Line 24 | extern const char      HDRSTR[];
24   extern const char       BIGEND[];
25   extern const char       FMTSTR[];
26  
27 extern int              contrib;                /* computing contributions? */
28 extern int              lim_dist;               /* limit distance? */
29
27   // new/exclusive, overwrite if exists, or recover data
28   int     RSDOflags[] = {RDSwrite|RDSexcl|RDSextend, RDSwrite|RDSextend,
29                                  RDSread|RDSwrite};
# Line 38 | Line 35 | static const char      ROWZEROSTR[] = "NROWS=00000000000000
35   struct RcontribMod {
36          RcontribOutput *        opl;            // pointer to first output channel
37          char *                  params;         // parameters string
38 <        EPNODE *                binv;           // bin expression
38 >        EPNODE *                binv;           // bin expression (NULL if 1 bin)
39          int                     nbins;          // bin count this modifier
40          int                     coffset;        // column offset in bytes
41          DCOLORV                 cbin[1];        // bin accumulator (extends struct)
# Line 49 | Line 46 | struct RcontribMod {
46                                  }
47   };
48  
49 < // used to assign record calc to child
49 > // Struct used to assign record calculation to child
50   struct RowAssignment {
51          uint32                  row;            // row to do
52          uint32                  ac;             // accumulation count
53   };
54  
55 < // Our default data share function
59 < RdataShare *
60 < defDataShare(const char *name, RCOutputOp op, size_t siz)
61 < {
62 <        return new RdataShareMap(name, RSDOflags[op], siz);
63 < }
55 > static const char       ROW_DONE[] = "ROW FINISHED\n";
56  
57 < // Allocate rcontrib accumulator
58 < RcontribMod *
57 > // allocate rcontrib accumulator
58 > static RcontribMod *
59   NewRcMod(const char *prms, const char *binexpr, int ncbins)
60   {
61 <        if (ncbins <= 0) return NULL;
61 >        if (binexpr && !*binexpr) binexpr = NULL;
62          if (!prms) prms = "";
63 <        if (!binexpr | (ncbins == 1))
64 <                binexpr = "0";
65 <
63 >        if ((ncbins > 1) & !binexpr) {
64 >                error(USER, "missing bin expression");
65 >                return NULL;
66 >        }
67 >        if (ncbins < 1) ncbins = 1;
68 >        
69          RcontribMod *   mp = (RcontribMod *)ecalloc(1, sizeof(RcontribMod) +
70                                                  sizeof(DCOLORV)*(NCSAMP*ncbins-1) +
71                                                  strlen(prms)+1);
72  
73 +        if (binexpr) {                          // get/check bin expression
74 +                mp->binv = eparse(const_cast<char *>(binexpr));
75 +                if (mp->binv->type == NUM) {    // constant expression (0)?
76 +                        if ((int)evalue(mp->binv) != 0) {
77 +                                sprintf(errmsg, "illegal non-zero constant for bin (%s)",
78 +                                                binexpr);
79 +                                error(USER, errmsg);
80 +                        }
81 +                        if (ncbins > 1) {
82 +                                sprintf(errmsg, "bad bin count (%d should be 1)", ncbins);
83 +                                error(USER, errmsg);
84 +                        }
85 +                        epfree(mp->binv, true);
86 +                        mp->binv = NULL;
87 +                        prms = "";
88 +                        ncbins = 1;
89 +                }
90 +        }
91          mp->params = strcpy((char *)(mp->cbin + ncbins*NCSAMP), prms);
79        mp->binv = eparse(const_cast<char *>(binexpr));
92          mp->nbins = ncbins;
93          return mp;
94   }
95  
96 < // Free an RcontribMod
96 > // Free an RcontribMod (public for RcontribSimulManager constructor)
97   void
98   FreeRcMod(void *p)
99   {
100          if (!p) return;
101 <        epfree((*(RcontribMod *)p).binv, true);
101 >        EPNODE *        bep = (*(RcontribMod *)p).binv;
102 >        if (bep) epfree(bep, true);
103          efree(p);
104   }
105  
106 + // Get format identifier
107 + const char *
108 + formstr(int f)
109 + {
110 +        switch (f) {
111 +        case 'a': return("ascii");
112 +        case 'f': return("float");
113 +        case 'd': return("double");
114 +        case 'c': return(NCSAMP==3 ? COLRFMT : SPECFMT);
115 +        }
116 +        return("unknown");
117 + }
118 +
119 + // Standard file data share function
120 + RdataShare *
121 + fileDataShare(const char *name, RCOutputOp op, size_t siz)
122 + {
123 +        if (op == RCOrecover && access(name, R_OK|W_OK) < 0) {
124 +                sprintf(errmsg, "cannot recover from '%s'", name);
125 +                error(SYSTEM, errmsg);
126 +                return NULL;
127 +        }
128 +        RdataShare *    rds = new RdataShareFile(name, RSDOflags[op],
129 +                                                 siz*(op != RCOforce));
130 +                                                
131 +        if (!rds || (op == RCOforce && rds->Resize(siz) < siz)) {
132 +                delete rds;
133 +                sprintf(errmsg, "cannot create %lu byte output file '%s'",
134 +                                        (unsigned long)siz, name);
135 +                error(SYSTEM, errmsg);
136 +                return NULL;
137 +        }
138 +        return rds;
139 + }
140 +
141 + // Memory-mapped data share function
142 + RdataShare *
143 + mapDataShare(const char *name, RCOutputOp op, size_t siz)
144 + {
145 +        if (op == RCOrecover && access(name, R_OK|W_OK) < 0) {
146 +                sprintf(errmsg, "cannot recover from '%s'", name);
147 +                error(SYSTEM, errmsg);
148 +                return NULL;
149 +        }
150 +        RdataShare *    rds = new RdataShareMap(name, RSDOflags[op],
151 +                                                 siz*(op != RCOforce));
152 +
153 +        if (!rds || (op == RCOforce && rds->Resize(siz) < siz)) {
154 +                delete rds;
155 +                sprintf(errmsg, "cannot create %lu byte output map '%s'",
156 +                                        (unsigned long)siz, name);
157 +                error(SYSTEM, errmsg);
158 +                return NULL;
159 +        }
160 +        return rds;
161 + }
162 +
163   // Set output format ('f', 'd', or 'c')
164   bool
165   RcontribSimulManager::SetDataFormat(int ty)
# Line 133 | Line 203 | RcontribSimulManager::RctCall(RAY *r, void *cd)
203          if (!mp)
204                  return 0;               // not in our modifier list
205  
206 <        worldfunc(RCCONTEXT, r);        // compute bin #
207 <        set_eparams(mp->params);
208 <        double          bval = evalue(mp->binv);
209 <        if (bval <= -.5)
210 <                return 0;       // silently ignore negative bin index
211 <        DCOLORV *       dvp = (*mp)[int(bval + .5)];
206 >        int                     bi = 0; // get bin index
207 >        if (mp->binv) {
208 >                worldfunc(RCCONTEXT, r);
209 >                set_eparams(mp->params);
210 >                double          bval = evalue(mp->binv);
211 >                if (bval <= -.5)
212 >                        return 0;       // silently ignore negative bin index
213 >                bi = int(bval + .5);
214 >        }
215 >        DCOLORV *       dvp = (*mp)[bi];
216          if (!dvp) {
217 <                sprintf(errmsg, "bad bin number for '%s' (%.1f ignored)", mname, bval);
217 >                sprintf(errmsg, "bad bin number for '%s' (%d ignored)", mname, bi);
218                  error(WARNING, errmsg);
219                  return 0;
220          }
221          SCOLOR          contr;
222          raycontrib(contr, r, PRIMARY);          // compute coefficient
223 <        if (contrib)
223 >        if (rcp->HasFlag(RCcontrib))
224                  smultscolor(contr, r->rcol);    // -> value contribution
225 +
226          for (int i = 0; i < NCSAMP; i++)
227                  *dvp++ += contr[i];             // accumulate color/spectrum
228          return 1;
# Line 176 | Line 251 | bool
251   RcontribSimulManager::AddModifier(const char *modn, const char *outspec,
252                                  const char *prms, const char *binval, int bincnt)
253   {
254 <        if (!modn | !outspec | (bincnt <= 0) || !*modn | !*outspec) {
254 >        if (!modn | !outspec || !*modn | !*outspec) {
255                  error(WARNING, "ignoring bad call to AddModifier()");
256                  return false;
257          }
258 +        if (*outspec == '!') {
259 +                error(USER, "command output not supported by RcontribSimulManager");
260 +                return false;
261 +        }
262          if (!nChan) {                           // initial call?
263 +                if ((xres < 0) | (yres <= 0)) {
264 +                        error(USER, "xres, yres must be set before first modifier");
265 +                        return false;
266 +                }
267                  if (!SetDataFormat(dtyp))
268                          return false;
269                  nChan = NCSAMP;
270          } else if (nChan != NCSAMP) {
271 <                error(INTERNAL, "number of spectral channels must be fixed");
271 >                error(USER, "# spectral channels must be fixed in AddModifier()");
272                  return false;
273          }
274          if (Ready()) {
# Line 208 | Line 291 | RcontribSimulManager::AddModifier(const char *modn, co
291          const int       binndx = hasFormat(outspec, "diouxX");
292          int             bin0 = 0;
293          char            fnbuf[512];
294 <        if (!modndx | (modndx > binndx))
294 >        if (!modndx || (binndx > 0) & (modndx > binndx))
295                  sprintf(fnbuf, outspec, bin0, modn);
296          else
297                  sprintf(fnbuf, outspec, modn, bin0);
# Line 237 | Line 320 | RcontribSimulManager::AddModifier(const char *modn, co
320          mp->opl = op;                   // first (maybe only) output channel
321          if (modndx)                     // remember modifier if part of name
322                  op->omod = lp->key;
323 <        if (binndx > 0) {               // append output image/bin list
323 >        if (binndx) {                   // append output image/bin list
324                  op->rowBytes += dsiz;
325                  op->obin = bin0;
326                  for (bincnt = 1; bincnt < mp->nbins; bincnt++) {
327 <                        if (!modndx | (modndx > binndx))
327 >                        if (!modndx || (binndx > 0) &  (modndx > binndx))
328                                  sprintf(fnbuf, outspec, bin0+bincnt, modn);
329                          else
330                                  sprintf(fnbuf, outspec, modn, bin0+bincnt);
# Line 260 | Line 343 | RcontribSimulManager::AddModifier(const char *modn, co
343                          op->rowBytes += dsiz;
344                  }
345          } else                          // else send all results to this channel
346 <                op->rowBytes += bincnt*dsiz;
346 >                op->rowBytes += mp->nbins*dsiz;
347          return true;
348   }
349  
# Line 281 | Line 364 | RcontribSimulManager::AddModFile(const char *modfn, co
364          }
365          char            mod[MAXSTR];
366          while (fgetword(mod, sizeof(mod), fp))
367 <                if (!AddModifier(mod, outspec, prms, binval, bincnt))
367 >                if (!AddModifier(mod, outspec, prms, binval, bincnt)) {
368 >                        fclose(fp);
369                          return false;
370 +                }
371          fclose(fp);
372          return true;
373   }
374  
375 < // Run through current list of output struct's
376 < int
377 < RcontribSimulManager::GetOutputs(RoutputShareF *osF, void *cd) const
375 > // call-back to check if modifier has been loaded
376 > static int
377 > checkModExists(const LUENT *lp, void *p)
378   {
379 <        int     cnt = 0;
379 >        OBJECT  mod = modifier(lp->key);
380  
381 <        for (const RcontribOutput *op = outList; op; op = op->next) {
382 <                int     rv = 1;
383 <                if (osF && (rv = (*osF)(op, cd)) < 0)
384 <                        return rv;
385 <                cnt += rv;
386 <        }
302 <        return cnt;
381 >        if ((mod != OVOID) & (mod < nsceneobjs))
382 >                return 1;
383 >
384 >        sprintf(errmsg, "tracked modifier '%s' not found in main scene", lp->key);
385 >        error(WARNING, errmsg);
386 >        return 0;
387   }
388  
389   // Prepare output channels and return # completed rows
# Line 307 | Line 391 | int
391   RcontribSimulManager::PrepOutput()
392   {
393          if (!outList || !RtraceSimulManager::Ready()) {
394 <                error(INTERNAL, "PrepOutput() called before octree & modifiers assigned");
394 >                error(INTERNAL, "PrepOutput() called before octree & modifiers set");
395                  return -1;
396          }
397 +        if (!cdsF) {
398 +                error(INTERNAL, "missing RdataShare constructor call (cdsF)");
399 +                return -1;
400 +        }
401 +        if (lu_doall(&modLUT, checkModExists, NULL) < 0)
402 +                return -1;
403 +
404 +        outList->nRows = yres * (xres + !xres); // all outputs have same #rows
405          int     remWarnings = 20;
406          for (RcontribOutput *op = outList; op; op = op->next) {
407                  if (op->rData) {
408                          error(INTERNAL, "output channel already open in PrepOutput()");
409                          return -1;
410                  }
411 <                op->nRows = yres * (xres + !xres);
411 >                op->nRows = outList->nRows;
412                  op->rData = (*cdsF)(op->ofname, outOp,
413                                          GetHeadLen()+1024 + op->nRows*op->rowBytes);
414                  freeqstr(op->ofname); op->ofname = NULL;
# Line 325 | Line 417 | RcontribSimulManager::PrepOutput()
417                          if (rd < 0)
418                                  return -1;
419                          if (rd >= op->nRows) {
420 <                                if (remWarnings >= 0) {
421 <                                        sprintf(errmsg, "recovered output '%s' already done",
420 >                                if (remWarnings > 0) {
421 >                                        sprintf(errmsg, "recovered output '%s' is complete",
422                                                          op->GetName());
423 <                                        error(WARNING, remWarnings ? errmsg : "etc...");
332 <                                        remWarnings--;
423 >                                        error(WARNING, --remWarnings ? errmsg : "etc...");
424                                  }
425                                  rd = op->nRows;
426                          }
# Line 341 | Line 432 | RcontribSimulManager::PrepOutput()
432                                  !op->rData->Resize(op->begData + op->nRows*op->rowBytes))
433                          return -1;              // calls error() for us
434          }
344        if (lim_dist)                           // XXX where else to put this?
345                rtFlags |= RTlimDist;
346        else
347                rtFlags &= ~RTlimDist;
348
435          rowsDone.NewBitMap(outList->nRows);     // create row completion map
436          rowsDone.ClearBits(0, rInPos, true);
437 <        return rInPos;
437 >        return nrDone = rInPos;
438   }
439  
440   // Create header in open write-only channel
# Line 376 | Line 462 | RcontribOutput::NewHeader(const RcontribSimulManager *
462          strcpy(hdr+begData, ROWZEROSTR);
463          rowCountPos = begData+LNROWSTR;
464          begData += sizeof(ROWZEROSTR)-1;
465 <        if (!xres | (rowBytes > esiz)) {
465 >        if (!rcp->xres | (rowBytes > esiz)) {
466                  sprintf(hdr+begData, "NCOLS=%d\n", int(rowBytes/esiz));
467                  begData += strlen(hdr+begData);
468          }
469          sprintf(hdr+begData, "%s%d\n", NCOMPSTR, NCSAMP);
470          begData += strlen(hdr+begData);
471          if (NCSAMP > 3) {
472 <                sprintf(hdr+begData, "%s %f %f %f %f\n", WLSPLTSTR,
472 >                sprintf(hdr+begData, "%s %g %g %g %g\n", WLSPLTSTR,
473                                  WLPART[0], WLPART[1], WLPART[2], WLPART[3]);
474                  begData += strlen(hdr+begData);
475          }
# Line 414 | Line 500 | RcontribOutput::NewHeader(const RcontribSimulManager *
500                          hdr[begData++] = ' ';
501          hdr[begData++] = '\n';          // EOL for data format
502          hdr[begData++] = '\n';          // end of nominal header
503 <        if ((xres > 0) & (rowBytes == esiz)) {  // tack on resolution string?
504 <                sprintf(hdr+begData, PIXSTDFMT, yres, xres);
503 >        if ((rcp->xres > 0) & (rowBytes == esiz)) {     // tack on resolution string?
504 >                sprintf(hdr+begData, PIXSTDFMT, rcp->yres, rcp->xres);
505                  begData += strlen(hdr+begData);
506          }
507          return rData->ReleaseMemory(hdr, RDSwrite);
# Line 461 | Line 547 | RcontribOutput::CheckHeader(const RcontribSimulManager
547                  return -1;
548          }
549                                                  // check format
550 <        if (!(cp = findArgs(hdr, FMTSTR, begData)) || strcmp(cp, formstr(etyp))) {
550 >        if (!(cp = findArgs(hdr, FMTSTR, begData)) ||
551 >                                strncmp(cp, formstr(etyp), strlen(formstr(etyp)))) {
552                  sprintf(errmsg, "expected %s%s in '%s'", FMTSTR, formstr(etyp), GetName());
553                  error(USER, errmsg);
554                  return -1;
555          }
556                                                  // check #columns
557 <        if (((cp = findArgs(hdr, "NCOLS=", begData)) && atoi(cp)*esiz != rowBytes) ||
558 <                        !xres | (rowBytes > esiz)) {
559 <                sprintf(errmsg, "expected NCOLS=%d in '%s'",
473 <                                int(rowBytes/esiz), GetName());
557 >        if ((cp = findArgs(hdr, "NCOLS=", begData)) ? (atoi(cp)*esiz != rowBytes)
558 >                                                    : (!rcp->xres | (rowBytes > esiz))) {
559 >                sprintf(errmsg, "expected NCOLS=%d in '%s'", int(rowBytes/esiz), GetName());
560                  error(USER, errmsg);
561                  return -1;
562          }
# Line 483 | Line 569 | RcontribOutput::CheckHeader(const RcontribSimulManager
569          rowCountPos = cp - hdr;
570          int     rlast = atoi(cp);
571          begData++;                              // advance past closing EOL
572 <        if ((xres > 0) & (rowBytes == esiz)) {  // check/skip resolution string?
572 >        if ((rcp->xres > 0) & (rowBytes == esiz)) {     // check/skip resolution string?
573                  char    rbuf[64];
574 <                sprintf(rbuf, PIXSTDFMT, yres, xres);
574 >                sprintf(rbuf, PIXSTDFMT, rcp->yres, rcp->xres);
575                  int     rlen = strlen(rbuf);
576                  if (strncmp(rbuf, hdr+begData, rlen)) {
577                          sprintf(errmsg, "bad resolution string in '%s'", GetName());
# Line 512 | Line 598 | RcontribSimulManager::ResetRow(int r)
598                          return false;
599  
600          rowsDone.ClearBits(r, rInPos-r, false);
601 <        rInPos = r;
601 >        nrDone = rInPos = r;
602          return true;
603   }
604  
# Line 559 | Line 645 | putModContrib(const LUENT *lp, void *p)
645                  }
646                  } break;
647          default:
648 <                error(CONSISTENCY, "unsupported output type in sendModContrib()");
648 >                error(CONSISTENCY, "unsupported output type in putModContrib()");
649                  return -1;
650          }
651                                                  // clear for next tally
# Line 578 | Line 664 | RcontribSimulManager::ComputeRecord(const FVECT orig_d
664                  return 0;
665          }
666          if (nkids > 0) {                        // in parent process?
667 <                int     k = GetChild();         // updates output rows
668 <                if (k < 0) return -1;           // can't really happen
667 >                int     k = GetChild(false);    // updates output rows
668 >                if (k < 0) return -1;           // someone died?
669                  RowAssignment   rass;
670                  rass.row = kidRow[k] = rInPos++;
671                  rass.ac = accum;
# Line 624 | Line 710 | RcontribSimulManager::GetChild(bool forceWait)
710                  return -1;
711                                                  // take inventory
712          int     pn, n = 0;
713 <        fd_set  writeset, errset;
714 <        FD_ZERO(&writeset); FD_ZERO(&errset);
713 >        fd_set  readset, errset;
714 >        FD_ZERO(&readset); FD_ZERO(&errset);
715          for (pn = nkids; pn--; ) {
716                  if (kidRow[pn] < 0) {           // child already ready?
717                          if (forceWait) continue;
718                          return pn;              // good enough
719                  }
720 <                FD_SET(kid[pn].w, &writeset);   // will check on this one
721 <                FD_SET(kid[pn].w, &errset);
722 <                if (kid[pn].w >= n)
723 <                        n = kid[pn].w + 1;
720 >                FD_SET(kid[pn].r, &readset);    // will check on this one
721 >                FD_SET(kid[pn].r, &errset);
722 >                if (kid[pn].r >= n)
723 >                        n = kid[pn].r + 1;
724          }
725          if (!n)                                 // every child is idle?
726                  return -1;
727                                                  // wait on "busy" child(ren)
728 <        while ((n = select(n, NULL, &writeset, &errset, NULL)) <= 0)
728 >        while ((n = select(n, &readset, NULL, &errset, NULL)) <= 0)
729                  if (errno != EINTR) {
730                          error(SYSTEM, "select call failed in GetChild()");
731                          return -1;
732                  }
733 +        char    buf[sizeof(ROW_DONE)] = "X";
734          pn = -1;                                // get flags set by select
735          for (n = nkids; n--; )
736                  if (kidRow[n] >= 0 &&
737 <                                FD_ISSET(kid[n].w, &writeset) |
738 <                                FD_ISSET(kid[n].w, &errset)) {
737 >                                FD_ISSET(kid[n].r, &readset) |
738 >                                FD_ISSET(kid[n].r, &errset)) {
739 >                                                // check for error
740 >                        if (FD_ISSET(kid[n].r, &errset) ||
741 >                                        read(kid[n].r, buf, sizeof(ROW_DONE)) <= 0 ||
742 >                                        memcmp(buf, ROW_DONE, sizeof(ROW_DONE)))
743 >                                return -1;
744                                                  // update output row counts
745                          UpdateRowsDone(kidRow[n]);
746 <                        kidRow[n] = -1;         // flag it available
746 >                        kidRow[n] = -1;         // flag child available
747                          pn = n;
748                  }
749          return pn;
# Line 665 | Line 757 | RcontribSimulManager::UpdateRowsDone(int r)
757                  error(WARNING, "redundant call to UpdateRowsDone()");
758                  return false;
759          }
760 <        int     nDone = GetRowFinished();
761 <        if (nDone <= r)
760 >        GetRowFinished();
761 >        if (nrDone <= r)
762                  return true;                    // nothing to update, yet
763          for (RcontribOutput *op = outList; op; op = op->next)
764 <                if (!op->SetRowsDone(nDone))
764 >                if (!op->SetRowsDone(nrDone))
765                          return false;
766          return true;                            // up-to-date
767   }
# Line 689 | Line 781 | RcontribSimulManager::RunChild()
781                          error(CONSISTENCY, "bad accumulator count in child");
782                          exit(1);
783                  }
784 <                if (rass.ac > accum)
785 <                        vecList = (FVECT *)erealloc(vecList,
786 <                                                sizeof(FVECT)*2*rass.ac);
784 >                if (rass.ac > accum) {
785 >                        efree(vecList);
786 >                        vecList = (FVECT *)emalloc(sizeof(FVECT)*2*rass.ac);
787 >                }
788                  accum = rass.ac;
789                  rInPos = rass.row;
790  
# Line 701 | Line 794 | RcontribSimulManager::RunChild()
794  
795                  if (ComputeRecord(vecList) <= 0)
796                          exit(1);
797 +                                                // signal this row is done
798 +                if (write(1, ROW_DONE, sizeof(ROW_DONE)) != sizeof(ROW_DONE))
799 +                        exit(1);
800          }
801          if (nr) {
802                  error(SYSTEM, "read error in child process");
# Line 726 | Line 822 | RcontribSimulManager::StartKids(int n2go)
822          fflush(stdout);                         // shouldn't use, anyway
823          while (nkids < n2go) {
824                  kid[nkids] = sp_inactive;
729                kid[nkids].w = dup(1);
730                kid[nkids].flags |= PF_FILT_OUT;
825                  int     rv = open_process(&kid[nkids], NULL);
826                  if (!rv) {                      // in child process?
827 <                        while (nkids-- > 0)
827 >                        while (nkids-- > 0) {
828 >                                close(kid[nkids].r);
829                                  close(kid[nkids].w);
830 +                        }
831                          free(kid); free(kidRow);
832                          kid = NULL; kidRow = NULL;
737                        rowsDone.NewBitMap(0);
833                          RunChild();             // should never return
834                          _exit(1);
835                  }
# Line 783 | Line 878 | RcontribSimulManager::SetThreadCount(int nt)
878                  return 0;
879          }
880          if (nt < 0)
881 <                return nkids;
881 >                return NThreads();
882          if (!nt) nt = GetNCores();
883          int     status = 0;
884          if (nt == 1)
# Line 796 | Line 891 | RcontribSimulManager::SetThreadCount(int nt)
891                  sprintf(errmsg, "non-zero (%d) status from child", status);
892                  error(WARNING, errmsg);
893          }
894 <        return nkids;
894 >        return NThreads();
895   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)