SCM Repository
View of /branches/vis12/src/compiler/c-target/fragments/alloc.in
Parent Directory
|
Revision Log
Revision 1917 -
(download)
(annotate)
Thu Jun 7 12:34:40 2012 UTC (8 years, 7 months ago) by jhr
File size: 1758 byte(s)
Thu Jun 7 12:34:40 2012 UTC (8 years, 7 months ago) by jhr
File size: 1758 byte(s)
Fixes to tracking of number of active strands
//! allocate the initial strands and initialize the rest of the world structure. static bool AllocInitially ( @PREFIX@World_t *wrld, // world bool isArray, // is the initialization an array or collection? uint32_t nAxes, // depth of iteration nesting uint32_t *base, // nAxes array of base indices uint32_t *size) // nAxes array of iteration sizes { wrld->isArray = isArray; wrld->nAxes = nAxes; wrld->base = NEWVEC(uint32_t, nAxes); wrld->size = NEWVEC(uint32_t, nAxes); size_t numStrands = 1; for (uint32_t i = 0; i < wrld->nAxes; i++) { numStrands *= size[i]; wrld->base[i] = base[i]; wrld->size[i] = size[i]; } if (wrld->verboseFlg) { fprintf (stderr, "AllocInitially: %d", size[0]); for (uint32_t i = 1; i < nAxes; i++) fprintf(stderr, " x %d", size[i]); fprintf (stderr, "\n"); } // allocate the strand state pointers wrld->numStrands = numStrands; #ifdef DIDEROT_TARGET_PARALLEL wrld->sched->numActive = numStrands; #else /* DIDEROT_TARGET_C */ wrld->numActive = numStrands; #endif wrld->inState = NEWVEC(@STRANDTY@ *, numStrands); wrld->outState = NEWVEC(@STRANDTY@ *, numStrands); wrld->status = NEWVEC(uint8_t, numStrands); if ((wrld->inState == 0) || (wrld->outState == 0) || (wrld->status == 0)) { biffMsgAdd (wrld->errors, "unable to allocate strand states\n"); return true; } // initialize strand state pointers etc. for (size_t i = 0; i < numStrands; i++) { wrld->inState[i] = NEW(@STRANDTY@); wrld->outState[i] = NEW(@STRANDTY@); wrld->status[i] = DIDEROT_ACTIVE; } return false; } // AllocInitially
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |