9 # define NSECTIONS NPROCESSORS
14 /* used anamorphically: section, nsections */
16 #define OUTER_PERSECTION_BASE(zero,n, sect) \
17 ((zero) + (sect) * (((n)-(zero) + NSECTIONS-1) / NSECTIONS))
18 #define OUTER(v,zero,n, precomp) \
19 for ((v)= OUTER_PERSECTION_BASE((zero),(n), (section)); \
21 (v) < OUTER_PERSECTION_BASE((zero),(n), (section) + 1) && (v) < (n); \
25 * OUTER is a loop constructor like INNER (see mgraph.h).
27 * Constraints on its use:
28 * - must be in exactly one loop of particular function
29 * - function must not modify anything other than
30 * its return value (for cost computation functions, COST()) or
31 * its designated output (for precomputation functions, PRECOMP())
32 * and in the latter case it may not read other parts of its output
33 * - function must of course be reentrant
36 #define nsections NSECTIONS
38 typedef void Computation(const struct Vertices *vertices,
39 int section, void *secdata, void *gendata);
41 void inparallel(const struct Vertices *vertices,
42 Computation *separately,
44 size_t secdatasz, void *gendata);
45 /* nsections copies of the computation `separately' are run in parallel
46 * with different values of `section' from 0 to nsections-1.
47 * Each copy is passed the same gendata as passed to inparallel.
48 * Each copy gets its own data block (struct aligned) of size
49 * secdatasz, passed as secdata, uninitialised on entry.
50 * After all the copies have finished, `combine' is invoked
51 * nsections times sequentially, with the same sets of arguments.
52 * inparallel is NOT itself reentrant.
55 void inparallel_barrier(void);