1 /*
2  * sched.h
3  *
4  *
5  * Part of TREE-PUZZLE 5.2 (July 2004)
6  *
7  * (c) 2003-2004 by Heiko A. Schmidt, Korbinian Strimmer, and Arndt von Haeseler
8  * (c) 1999-2003 by Heiko A. Schmidt, Korbinian Strimmer,
9  *                  M. Vingron, and Arndt von Haeseler
10  * (c) 1995-1999 by Korbinian Strimmer and Arndt von Haeseler
11  *
12  * All parts of the source except where indicated are distributed under
13  * the GNU public licence.  See http://www.opensource.org for details.
14  *
15  * ($Id$)
16  *
17  */
18 
19 
20 #ifndef SCHED_H
21 #define SCHED_H
22 #ifndef SCHEDTEST
23 #   include "util.h"
24 #else
25     typedef unsigned long int uli;
26 #endif
27 
28 
29 typedef struct sched_t{
30    uli    truetasks;    /* number of tasks to be scheduled, as given by user */
31    int    numprocs;     /* number of processors (p=PP_numprocs-1, master-worker scheme */
32    uli    minchunk;     /* pre-packing: task-size must be dividable by <minchunk> */
33 
34    uli    rest;         /* part of tasks not fitting into batches with minchunk-dividable size */
35                         /*    truetasks mod minchunk */
36    uli    alltasks;     /* number of tasks to be scheduled in minchunk-size batches */
37                         /*    truetasks - rest */
38    uli    numtasks;     /* tasks not yet scheduled (init: numtasks = alltasks) */
39 
40    uli    overhead;     /* SC,FSC: remainder from dividing alltasks into numprocs batches */
41                         /*   alltasks mod numprocs */
42    uli    delta;        /* SC,FSC: initial batch size */
43                         /*   (alltasks - overhead) / numprocs = alltasks % numprocs */
44 
45    double fconst;       /* TSS: start (first) batch size (f) */
46    double lconst;       /* TSS: last batch size (l) */
47    double kconst;       /* TSS: actual batch size (k) */
48    double ddelta;       /* TSS: amount of decrease */
49    int    nconst;       /* TSS: needed to compute ddelta (N) */
50 
51    int    inited;       /* initialized flag for parameter initialization by scheduler */
52 } schedtype;
53 
54 void num2quart(uli qnum, int *a, int *b, int *c, int *d);
55 uli numquarts(int maxspc);
56 uli quart2num (int a, int b, int c, int d);
57 
58 void printsched(schedtype sch);
59 void initsched(schedtype *sch, uli tasks, int procs, uli minchunk);
60 uli sc(schedtype *sch);
61 uli gss(schedtype *sch);
62 uli sgss(schedtype *sch);
63 uli tss(schedtype *sch);
64 
65 #endif /* SCHED_H */
66