2 * Copyright (c) 1997-1999 Massachusetts Institute of Technology
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 int main(int argc
, char **argv
)
28 int npes
= -1, mype
, sortpe
= -1, steps
;
33 fprintf(stderr
,"npes must be positive!");
38 sortpe
= atoi(argv
[2]);
39 if (sortpe
< 0 || sortpe
>= npes
) {
40 fprintf(stderr
,"sortpe must be between 0 and npes-1.\n");
46 printf("Computing schedule for npes = %d:\n",npes
);
47 sched
= make_comm_schedule(npes
);
49 fprintf(stderr
,"Out of memory!");
53 if (steps
= check_comm_schedule(sched
,npes
))
54 printf("schedule OK (takes %d steps to complete).\n", steps
);
56 printf("schedule not OK.\n");
58 print_comm_schedule(sched
, npes
);
61 printf("\nSorting schedule for sortpe = %d...\n", sortpe
);
62 sort_comm_schedule(sched
,npes
,sortpe
);
64 if (steps
= check_comm_schedule(sched
,npes
))
65 printf("schedule OK (takes %d steps to complete).\n",
68 printf("schedule not OK.\n");
70 print_comm_schedule(sched
, npes
);
72 printf("\nInverting schedule...\n");
73 invert_comm_schedule(sched
,npes
);
75 if (steps
= check_comm_schedule(sched
,npes
))
76 printf("schedule OK (takes %d steps to complete).\n",
79 printf("schedule not OK.\n");
81 print_comm_schedule(sched
, npes
);
83 free_comm_schedule(sched
,npes
);
87 printf("Doing infinite tests...\n");
88 for (npes
= 1; ; ++npes
) {
89 printf("npes = %d...",npes
);
90 sched
= make_comm_schedule(npes
);
92 fprintf(stderr
,"Out of memory!\n");
95 for (sortpe
= 0; sortpe
< npes
; ++sortpe
) {
96 empty_comm_schedule(sched
,npes
);
97 fill_comm_schedule(sched
,npes
);
98 if (!check_comm_schedule(sched
,npes
)) {
100 "\n -- fill error for sortpe = %d!\n",sortpe
);
103 sort_comm_schedule(sched
,npes
,sortpe
);
104 if (!check_comm_schedule(sched
,npes
)) {
106 "\n -- sort error for sortpe = %d!\n",sortpe
);
109 invert_comm_schedule(sched
,npes
);
110 if (!check_comm_schedule(sched
,npes
)) {
112 "\n -- invert error for sortpe = %d!\n",
117 free_comm_schedule(sched
,npes
);
120 printf("(...Hit Ctrl-C to stop...)\n");