Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use the right name of an option in the doc
[simgrid.git] / teshsuite / smpi / isp / umpire / change-send-buffer-type-exhaustive.c
1 /* -*- Mode: C; -*- */
2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov)  */
3
4 /* type-no-error-exhaustive-with-isends.c -- send with weird types */
5
6 #ifndef lint
7 static char *rcsid =
8   "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/change-send-buffer-type-exhaustive.c,v 1.1 2002/06/08 09:11:34 bronis Exp $";
9 #endif
10
11 #include <stdio.h>
12 #include <string.h>
13 #include <assert.h>
14 #include "mpi.h"
15
16
17 typedef struct _test_basic_struct_t
18 {
19   double the_double;
20   char the_char;
21 }
22 test_basic_struct_t;
23
24
25 typedef struct _test_lb_ub_struct_t
26 {
27   double dontsend_double1;
28   double the_double_to_send;
29   char   the_chars[8]; /* only send the first one... */
30   double dontsend_double2;
31 }
32 test_lb_ub_struct_t;
33
34
35 #define TYPE_CONSTRUCTOR_COUNT 7
36 #define MSG_COUNT              3
37
38 /*
39 */
40 #define RUN_TYPE_STRUCT
41 #define RUN_TYPE_VECTOR
42 #define RUN_TYPE_HVECTOR
43 #define RUN_TYPE_INDEXED
44 #define RUN_TYPE_HINDEXED
45 #define RUN_TYPE_CONTIGUOUS
46 #define RUN_TYPE_STRUCT_LB_UB
47 /*
48 */
49
50 int
51 main (int argc, char **argv)
52 {
53   int nprocs = -1;
54   int rank = -1;
55   int comm = MPI_COMM_WORLD;
56   char processor_name[128];
57   int namelen = 128;
58   int i, j, k, basic_extent;
59   int blocklens[4], displs[4];
60   MPI_Datatype structtypes[4]; 
61   MPI_Datatype newtype[TYPE_CONSTRUCTOR_COUNT]; 
62   MPI_Request aReq[TYPE_CONSTRUCTOR_COUNT];
63   MPI_Status aStatus[TYPE_CONSTRUCTOR_COUNT];
64 #ifdef RUN_TYPE_STRUCT
65   test_basic_struct_t struct_buf[MSG_COUNT];
66 #endif
67 #ifdef RUN_TYPE_VECTOR
68   test_basic_struct_t vector_buf[7*MSG_COUNT];
69 #endif
70 #ifdef RUN_TYPE_HVECTOR
71   test_basic_struct_t hvector_buf[44*MSG_COUNT];
72 #endif
73 #ifdef RUN_TYPE_INDEXED
74   test_basic_struct_t indexed_buf[132*MSG_COUNT];
75 #endif
76 #ifdef RUN_TYPE_HINDEXED
77   test_basic_struct_t hindexed_buf[272*MSG_COUNT];
78 #endif
79 #ifdef RUN_TYPE_CONTIGUOUS
80   test_basic_struct_t contig_buf[2720*MSG_COUNT];
81 #endif
82 #ifdef RUN_TYPE_STRUCT
83   test_lb_ub_struct_t struct_lb_ub_send_buf[MSG_COUNT];
84   test_basic_struct_t struct_lb_ub_recv_buf[MSG_COUNT];
85 #endif
86
87   /* init */
88   MPI_Init (&argc, &argv);
89   MPI_Comm_size (comm, &nprocs);
90   MPI_Comm_rank (comm, &rank);
91   MPI_Get_processor_name (processor_name, &namelen);
92   printf ("(%d) is alive on %s\n", rank, processor_name);
93   fflush (stdout);
94
95   structtypes[0] = MPI_DOUBLE;
96   structtypes[1] = MPI_CHAR;
97   blocklens[0] = blocklens[1] = 1;
98   displs[0] = 0;
99   displs[1] = sizeof(double);
100
101   MPI_Barrier (comm);
102
103   /* create the types */
104   MPI_Type_struct (2, blocklens, displs, structtypes, &newtype[0]);
105   
106   MPI_Type_extent (newtype[0], &basic_extent);
107   if (basic_extent != sizeof (test_basic_struct_t)) {
108     fprintf (stderr, "(%d): Unexpect extent for struct\n");
109     MPI_Abort (MPI_COMM_WORLD, 666);
110   }
111
112   MPI_Type_vector (2, 3, 4, newtype[0], &newtype[1]);
113   MPI_Type_hvector (3, 2, 15 * sizeof (test_basic_struct_t), 
114                     newtype[1], &newtype[2]);
115   displs[1] = 2;
116   MPI_Type_indexed (2, blocklens, displs, newtype[2], &newtype[3]);
117   displs[1] = 140 * sizeof (test_basic_struct_t);
118   MPI_Type_hindexed (2, blocklens, displs, newtype[3], &newtype[4]);
119   MPI_Type_contiguous (10, newtype[4], &newtype[5]);
120
121   structtypes[0] = MPI_LB;
122   structtypes[1] = MPI_DOUBLE;
123   structtypes[2] = MPI_CHAR;
124   structtypes[3] = MPI_UB;
125   blocklens[0] = blocklens[1] = blocklens[2] = blocklens[3] = 1;
126   displs[0] = -sizeof(double);
127   displs[1] = 0;
128   displs[2] = sizeof(double);
129   displs[3] = 2*sizeof(double)+8*sizeof(char);
130
131   MPI_Type_struct (4, blocklens, displs, structtypes, &newtype[6]);
132
133 #ifdef RUN_TYPE_STRUCT 
134   MPI_Type_commit (&newtype[0]);
135 #endif
136
137 #ifdef RUN_TYPE_VECTOR
138   MPI_Type_commit (&newtype[1]);
139 #endif
140
141 #ifdef RUN_TYPE_HVECTOR
142   MPI_Type_commit (&newtype[2]);
143 #endif
144
145 #ifdef RUN_TYPE_INDEXED
146   MPI_Type_commit (&newtype[3]);
147 #endif
148
149 #ifdef RUN_TYPE_HINDEXED
150   MPI_Type_commit (&newtype[4]);
151 #endif
152
153 #ifdef RUN_TYPE_CONTIGUOUS
154   MPI_Type_commit (&newtype[5]);
155 #endif
156
157 #ifdef RUN_TYPE_STRUCT_LB_UB 
158   MPI_Type_commit (&newtype[6]);
159 #endif
160
161   if (rank == 0) {
162     /* initialize buffers */
163     for (i = 0; i < MSG_COUNT; i++) {
164 #ifdef RUN_TYPE_STRUCT
165       struct_buf[i].the_double = 1.0;
166       struct_buf[i].the_char = 'a';
167 #endif
168
169 #ifdef RUN_TYPE_VECTOR
170       for (j = 0; j < 7; j++) {
171         vector_buf[i*7 + j].the_double = 1.0;
172         vector_buf[i*7 + j].the_char = 'a';
173       }
174 #endif
175
176 #ifdef RUN_TYPE_HVECTOR
177       for (j = 0; j < 44; j++) {
178         hvector_buf[i*44 + j].the_double = 1.0;
179         hvector_buf[i*44 + j].the_char = 'a';
180       }
181 #endif
182
183 #ifdef RUN_TYPE_INDEXED
184       for (j = 0; j < 132; j++) {
185         indexed_buf[i*132 + j].the_double = 1.0;
186         indexed_buf[i*132 + j].the_char = 'a';
187       }
188 #endif
189
190 #ifdef RUN_TYPE_HINDEXED
191       for (j = 0; j < 272; j++) {
192         hindexed_buf[i*272 + j].the_double = 1.0;
193         hindexed_buf[i*272 + j].the_char = 'a';
194       }
195 #endif
196
197 #ifdef RUN_TYPE_CONTIGUOUS
198       for (j = 0; j < 2720; j++) {
199         contig_buf[i*2720 + j].the_double = 1.0;
200         contig_buf[i*2720 + j].the_char = 'a';
201       }
202 #endif
203
204 #ifdef RUN_TYPE_STRUCT_LB_UB
205       struct_lb_ub_send_buf[i].dontsend_double1 = 1.0;
206       struct_lb_ub_send_buf[i].the_double_to_send = 1.0;
207       for (j = 0; j < 8; j++)
208         struct_lb_ub_send_buf[i].the_chars[j] = 'a';
209       struct_lb_ub_send_buf[i].dontsend_double2 = 1.0;
210 #endif
211     }
212         
213     /* set up the sends */
214 #ifdef RUN_TYPE_STRUCT
215     MPI_Isend (struct_buf, MSG_COUNT, newtype[0], 1, 0, comm, &aReq[0]);
216 #else
217     aReq[0] = MPI_REQUEST_NULL;
218 #endif
219
220 #ifdef RUN_TYPE_VECTOR
221     MPI_Isend (vector_buf, MSG_COUNT, newtype[1], 1, 1, comm, &aReq[1]);
222 #else
223     aReq[1] = MPI_REQUEST_NULL;
224 #endif
225
226 #ifdef RUN_TYPE_HVECTOR
227     MPI_Isend (hvector_buf, MSG_COUNT, newtype[2], 1, 2, comm, &aReq[2]);
228 #else
229     aReq[2] = MPI_REQUEST_NULL;
230 #endif
231
232 #ifdef RUN_TYPE_INDEXED
233     MPI_Isend (indexed_buf, MSG_COUNT, newtype[3], 1, 3, comm, &aReq[3]);
234 #else
235     aReq[3] = MPI_REQUEST_NULL;
236 #endif
237
238 #ifdef RUN_TYPE_HINDEXED
239     MPI_Isend (hindexed_buf, MSG_COUNT, newtype[4], 1, 4, comm, &aReq[4]);
240 #else
241     aReq[4] = MPI_REQUEST_NULL;
242 #endif
243
244 #ifdef RUN_TYPE_CONTIGUOUS
245     MPI_Isend (contig_buf, MSG_COUNT, newtype[5], 1, 5, comm, &aReq[5]);
246 #else
247     aReq[5] = MPI_REQUEST_NULL;
248 #endif
249
250 #ifdef RUN_TYPE_STRUCT
251     MPI_Isend (&(struct_lb_ub_send_buf[0].the_double_to_send), 
252                MSG_COUNT, newtype[6], 1, 6, comm, &aReq[6]);
253 #else
254     aReq[6] = MPI_REQUEST_NULL;
255 #endif
256   }
257   else if (rank == 1) {
258     /* initialize buffers */
259     for (i = 0; i < MSG_COUNT; i++) {
260 #ifdef RUN_TYPE_STRUCT
261       struct_buf[i].the_double = 2.0;
262       struct_buf[i].the_char = 'b';
263 #endif
264
265 #ifdef RUN_TYPE_VECTOR
266       for (j = 0; j < 7; j++) {
267         vector_buf[i*7 + j].the_double = 2.0;
268         vector_buf[i*7 + j].the_char = 'b';
269       }
270 #endif
271
272 #ifdef RUN_TYPE_HVECTOR
273       for (j = 0; j < 44; j++) {
274         hvector_buf[i*44 + j].the_double = 2.0;
275         hvector_buf[i*44 + j].the_char = 'b';
276       }
277 #endif
278
279 #ifdef RUN_TYPE_INDEXED
280       for (j = 0; j < 132; j++) {
281         indexed_buf[i*132 + j].the_double = 2.0;
282         indexed_buf[i*132 + j].the_char = 'b';
283       }
284 #endif
285
286 #ifdef RUN_TYPE_HINDEXED
287       for (j = 0; j < 272; j++) {
288         hindexed_buf[i*272 + j].the_double = 2.0;
289         hindexed_buf[i*272 + j].the_char = 'b';
290       }
291 #endif
292
293 #ifdef RUN_TYPE_CONTIGUOUS
294       for (j = 0; j < 2720; j++) {
295         contig_buf[i*2720 + j].the_double = 2.0;
296         contig_buf[i*2720 + j].the_char = 'b';
297       }
298 #endif
299
300 #ifdef RUN_TYPE_STRUCT_LB_UB
301       struct_lb_ub_recv_buf[i].the_double = 2.0;
302       struct_lb_ub_recv_buf[i].the_char = 'b';
303 #endif
304     }
305
306     /* set up the receives... */
307 #ifdef RUN_TYPE_STRUCT
308     MPI_Irecv (struct_buf, MSG_COUNT, newtype[0], 0, 0, comm, &aReq[0]);
309 #else
310     aReq[0] = MPI_REQUEST_NULL;
311 #endif
312
313 #ifdef RUN_TYPE_VECTOR
314     MPI_Irecv (vector_buf, MSG_COUNT, newtype[1], 0, 1, comm, &aReq[1]);
315 #else
316     aReq[1] = MPI_REQUEST_NULL;
317 #endif
318
319 #ifdef RUN_TYPE_HVECTOR
320     MPI_Irecv (hvector_buf, MSG_COUNT, newtype[2], 0, 2, comm, &aReq[2]);
321 #else
322     aReq[2] = MPI_REQUEST_NULL;
323 #endif
324
325 #ifdef RUN_TYPE_INDEXED
326     MPI_Irecv (indexed_buf, MSG_COUNT, newtype[3], 0, 3, comm, &aReq[3]);
327 #else
328     aReq[3] = MPI_REQUEST_NULL;
329 #endif
330
331 #ifdef RUN_TYPE_HINDEXED
332     MPI_Irecv (hindexed_buf, MSG_COUNT, newtype[4], 0, 4, comm, &aReq[4]);
333 #else
334     aReq[4] = MPI_REQUEST_NULL;
335 #endif
336
337 #ifdef RUN_TYPE_CONTIGUOUS
338     MPI_Irecv (contig_buf, MSG_COUNT, newtype[5], 0, 5, comm, &aReq[5]);
339 #else
340     aReq[5] = MPI_REQUEST_NULL;
341 #endif
342
343 #ifdef RUN_TYPE_STRUCT_LB_UB
344     MPI_Irecv (struct_lb_ub_recv_buf, 
345                MSG_COUNT, newtype[0], 0, 6, comm, &aReq[6]);
346 #else
347     aReq[6] = MPI_REQUEST_NULL;
348 #endif
349   }
350
351   if (rank == 0) {
352     /* muck something in each that is not in the holes... */
353     /* see below to see where the holes are... */
354     /* don't use the first one to test handling of count arg */
355     i = (MSG_COUNT > 1) ? 1 : 0;
356
357 #ifdef RUN_TYPE_STRUCT
358     /* muck the char member... */
359     struct_buf[i].the_char = 'c';
360 #endif
361
362 #ifdef RUN_TYPE_VECTOR
363     /* muck the element after the hole due to stride in vector... */
364     vector_buf[i*7 + 4].the_double = 3.0;
365     vector_buf[i*7 + 4].the_char = 'c';
366 #endif
367
368 #ifdef RUN_TYPE_HVECTOR
369     /* muck the element after the hole due to stride in hvector... */
370     hvector_buf[i*44 + 15].the_double = 3.0;
371     hvector_buf[i*44 + 15].the_char = 'c';
372 #endif
373
374 #ifdef RUN_TYPE_INDEXED
375     /* muck the element after the hole due to indexed displacements... */
376     indexed_buf[i*132 + 44 + 44].the_double = 3.0;
377     indexed_buf[i*132 + 44 + 44].the_char = 'c';
378 #endif
379
380 #ifdef RUN_TYPE_HINDEXED
381     /* muck the element after the hole due to hindexed displacements... */
382     hindexed_buf[i*272 + 132 + 8].the_double = 3.0;
383     hindexed_buf[i*272 + 132 + 8].the_char = 'c';
384 #endif
385
386 #ifdef RUN_TYPE_CONTIGUOUS
387     /* muck element after the hole due to hindex displacements, hindex 2... */
388     contig_buf[i*2720 + 272 + 140].the_double = 3.0;
389     contig_buf[i*2720 + 272 + 140].the_char = 'c';
390 #endif
391
392 #ifdef RUN_TYPE_STRUCT_LB_UB
393     /* muck the double member and char member being sent... */
394     struct_lb_ub_send_buf[i].the_double_to_send = 3.0;
395     struct_lb_ub_send_buf[i].the_chars[0] = 'c';
396 #endif
397   }
398         
399   if ((rank == 0) || (rank == 1))
400     /* wait on everything... */
401     MPI_Waitall (TYPE_CONSTRUCTOR_COUNT, aReq, aStatus);
402
403   if (rank == 1) {
404     /* check the holes... */
405     for (i = 0; i < MSG_COUNT; i++) {
406 #ifdef RUN_TYPE_STRUCT
407       /* no holes in struct_buf... */
408 #endif
409
410 #ifdef RUN_TYPE_VECTOR
411       /* one hole in vector_buf... */
412       assert ((vector_buf[i*7 + 3].the_double == 2.0) &&
413               (vector_buf[i*7 + 3].the_char == 'b'));
414 #endif
415
416 #ifdef RUN_TYPE_HVECTOR
417       /* eight holes in hvector_buf... */
418       /* hole in first vector, first block... */
419       assert ((hvector_buf[i*44 + 3].the_double == 2.0) && 
420               (hvector_buf[i*44 + 3].the_char == 'b'));
421       /* hole in second vector, first block... */
422       assert ((hvector_buf[i*44 + 10].the_double == 2.0) &&
423               (hvector_buf[i*44 + 10].the_char == 'b'));
424       /* hole in between first and second vector blocks... */
425       assert ((hvector_buf[i*44 + 14].the_double == 2.0) &&
426               (hvector_buf[i*44 + 14].the_char == 'b'));
427       /* hole in first vector, second block... */
428       assert ((hvector_buf[i*44 + 18].the_double == 2.0) &&
429               (hvector_buf[i*44 + 18].the_char == 'b'));
430       /* hole in second vector, second block... */
431       assert ((hvector_buf[i*44 + 25].the_double == 2.0) &&
432               (hvector_buf[i*44 + 25].the_char == 'b'));
433       /* hole in between second and third vector blocks... */
434       assert ((hvector_buf[i*44 + 29].the_double == 2.0) &&
435               (hvector_buf[i*44 + 29].the_char == 'b'));
436       /* hole in first vector, third block... */
437       assert ((hvector_buf[i*44 + 33].the_double == 2.0) &&
438               (hvector_buf[i*44 + 33].the_char == 'b'));
439       /* hole in second vector, third block... */
440       assert ((hvector_buf[i*44 + 40].the_double == 2.0) &&
441               (hvector_buf[i*44 + 40].the_char == 'b'));
442 #endif
443
444 #ifdef RUN_TYPE_INDEXED
445       /* sixty holes in indexed_buf... */
446       /* hole in first vector, first block, first hvector... */
447       assert ((indexed_buf[i*132 + 3].the_double == 2.0) &&
448               (indexed_buf[i*132 + 3].the_char == 'b'));
449       /* hole in second vector, first block, first hvector... */
450       assert ((indexed_buf[i*132 + 10].the_double == 2.0) &&
451               (indexed_buf[i*132 + 10].the_char == 'b'));
452       /* hole in between first and second vector blocks, first hvector... */
453       assert ((indexed_buf[i*132 + 14].the_double == 2.0) &&
454               (indexed_buf[i*132 + 14].the_char == 'b'));
455       /* hole in first vector, second block, first hvector... */
456       assert ((indexed_buf[i*132 + 18].the_double == 2.0) &&
457               (indexed_buf[i*132 + 18].the_char == 'b'));
458       /* hole in second vector, second block, first hvector... */
459       assert ((indexed_buf[i*132 + 25].the_double == 2.0) &&
460               (indexed_buf[i*132 + 25].the_char == 'b'));
461       /* hole in between second and third vector blocks, first hvector... */
462       assert ((indexed_buf[i*132 + 29].the_double == 2.0) &&
463               (indexed_buf[i*132 + 29].the_char == 'b'));
464       /* hole in first vector, third block, first hvector... */
465       assert ((indexed_buf[i*132 + 33].the_double == 2.0) &&
466               (indexed_buf[i*132 + 33].the_char == 'b'));
467       /* hole in second vector, third block, first hvector... */
468       assert ((indexed_buf[i*132 + 40].the_double == 2.0) &&
469               (indexed_buf[i*132 + 40].the_char == 'b'));
470       /* hole in between hvectors... */
471       for (j = 0; j < 44; j++) {
472         assert ((indexed_buf[i*132 + 44 + j].the_double == 2.0) &&
473                 (indexed_buf[i*132 + 44 + j].the_char == 'b'));
474       }
475       /* hole in first vector, first block, second hvector... */
476       assert ((indexed_buf[i*132 + 3 + 88].the_double == 2.0) &&
477               (indexed_buf[i*132 + 3 + 88].the_char == 'b'));
478       /* hole in second vector, first block, second hvector... */
479       assert ((indexed_buf[i*132 + 10 + 88].the_double == 2.0) &&
480               (indexed_buf[i*132 + 10 + 88].the_char == 'b'));
481       /* hole in between first and second vector blocks, second hvector... */
482       assert ((indexed_buf[i*132 + 14 + 88].the_double == 2.0) &&
483               (indexed_buf[i*132 + 14 + 88].the_char == 'b'));
484       /* hole in first vector, second block, second hvector... */
485       assert ((indexed_buf[i*132 + 18 + 88].the_double == 2.0) &&
486               (indexed_buf[i*132 + 18 + 88].the_char == 'b'));
487       /* hole in second vector, second block, second hvector... */
488       assert ((indexed_buf[i*132 + 25 + 88].the_double == 2.0) &&
489               (indexed_buf[i*132 + 25 + 88].the_char == 'b'));
490       /* hole in between second and third vector blocks, second hvector... */
491       assert ((indexed_buf[i*132 + 29 + 88].the_double == 2.0) &&
492               (indexed_buf[i*132 + 29 + 88].the_char == 'b'));
493       /* hole in first vector, third block, second hvector... */
494       assert ((indexed_buf[i*132 + 33 + 88].the_double == 2.0) &&
495               (indexed_buf[i*132 + 33 + 88].the_char == 'b'));
496       /* hole in second vector, third block, second hvector... */
497       assert ((indexed_buf[i*132 + 40 + 88].the_double == 2.0) &&
498               (indexed_buf[i*132 + 40 + 88].the_char == 'b'));
499 #endif
500
501 #ifdef RUN_TYPE_HINDEXED
502       /* one hundred twenty eight holes in hindexed_buf... */
503       /* hole in first vector, first block, first hvector, index 1... */
504       assert ((hindexed_buf[i*272 + 3].the_double == 2.0) &&
505               (hindexed_buf[i*272 + 3].the_char == 'b'));
506       /* hole in second vector, first block, first hvector, index 1... */
507       assert ((hindexed_buf[i*272 + 10].the_double == 2.0) &&
508               (hindexed_buf[i*272 + 10].the_char == 'b'));
509       /* hole between first & second vector blocks, hvector 1, index 1... */
510       assert ((hindexed_buf[i*272 + 14].the_double == 2.0) &&
511               (hindexed_buf[i*272 + 14].the_char == 'b'));
512       /* hole in first vector, second block, first hvector, index 1... */
513       assert ((hindexed_buf[i*272 + 18].the_double == 2.0) &&
514               (hindexed_buf[i*272 + 18].the_char == 'b'));
515       /* hole in second vector, second block, first hvector, index 1... */
516       assert ((hindexed_buf[i*272 + 25].the_double == 2.0) &&
517               (hindexed_buf[i*272 + 25].the_char == 'b'));
518       /* hole between second & third vector blocks, hvector 1, index 1... */
519       assert ((hindexed_buf[i*272 + 29].the_double == 2.0) &&
520               (hindexed_buf[i*272 + 29].the_char == 'b'));
521       /* hole in first vector, third block, first hvector, index 1... */
522       assert ((hindexed_buf[i*272 + 33].the_double == 2.0) &&
523               (hindexed_buf[i*272 + 33].the_char == 'b'));
524       /* hole in second vector, third block, first hvector, index 1... */
525       assert ((hindexed_buf[i*272 + 40].the_double == 2.0) &&
526               (hindexed_buf[i*272 + 40].the_char == 'b'));
527       /* hole in between hvectors, index 1... */
528       for (j = 0; j < 44; j++) {
529         assert ((hindexed_buf[i*272 + 44 + j].the_double == 2.0) &&
530                 (hindexed_buf[i*272 + 44 + j].the_char == 'b'));
531       }
532       /* hole in first vector, first block, second hvector, index 1... */
533       assert ((hindexed_buf[i*272 + 3 + 88].the_double == 2.0) &&
534               (hindexed_buf[i*272 + 3 + 88].the_char == 'b'));
535       /* hole in second vector, first block, second hvector, index 1... */
536       assert ((hindexed_buf[i*272 + 10 + 88].the_double == 2.0) &&
537               (hindexed_buf[i*272 + 10 + 88].the_char == 'b'));
538       /* hole between first & second vector blocks, hvector 2, index 1... */
539       assert ((hindexed_buf[i*272 + 14 + 88].the_double == 2.0) &&
540               (hindexed_buf[i*272 + 14 + 88].the_char == 'b'));
541       /* hole in first vector, second block, second hvector, index 1... */
542       assert ((hindexed_buf[i*272 + 18 + 88].the_double == 2.0) &&
543               (hindexed_buf[i*272 + 18 + 88].the_char == 'b'));
544       /* hole in second vector, second block, second hvector, index 1... */
545       assert ((hindexed_buf[i*272 + 25 + 88].the_double == 2.0) &&
546               (hindexed_buf[i*272 + 25 + 88].the_char == 'b'));
547       /* hole between second & third vector blocks, hvector 2, index 1... */
548       assert ((hindexed_buf[i*272 + 29 + 88].the_double == 2.0) &&
549               (hindexed_buf[i*272 + 29 + 88].the_char == 'b'));
550       /* hole in first vector, third block, second hvector, index 1... */
551       assert ((hindexed_buf[i*272 + 33 + 88].the_double == 2.0) &&
552               (hindexed_buf[i*272 + 33 + 88].the_char == 'b'));
553       /* hole in second vector, third block, second hvector, index 1... */
554       assert ((hindexed_buf[i*272 + 40 + 88].the_double == 2.0) &&
555               (hindexed_buf[i*272 + 40 + 88].the_char == 'b'));
556       /* indexed hole... */
557       for (j = 0; j < 8; j++) {
558         assert ((hindexed_buf[i*272 + 132 + j].the_double == 2.0) &&
559                 (hindexed_buf[i*272 + 132 + j].the_char == 'b'));
560       }
561       /* hole in first vector, first block, first hvector, index 2... */
562       assert ((hindexed_buf[i*272 + 3 + 140].the_double == 2.0) &&
563               (hindexed_buf[i*272 + 3 + 140].the_char == 'b'));
564       /* hole in second vector, first block, first hvector, index 2... */
565       assert ((hindexed_buf[i*272 + 10 + 140].the_double == 2.0) &&
566               (hindexed_buf[i*272 + 10 + 140].the_char == 'b'));
567       /* hole between first & second vector blocks, hvector 1, index 2... */
568       assert ((hindexed_buf[i*272 + 14 + 140].the_double == 2.0) &&
569               (hindexed_buf[i*272 + 14 + 140].the_char == 'b'));
570       /* hole in first vector, second block, first hvector, index 2... */
571       assert ((hindexed_buf[i*272 + 18 + 140].the_double == 2.0) &&
572               (hindexed_buf[i*272 + 18 + 140].the_char == 'b'));
573       /* hole in second vector, second block, first hvector, index 2... */
574       assert ((hindexed_buf[i*272 + 25 + 140].the_double == 2.0) &&
575               (hindexed_buf[i*272 + 25 + 140].the_char == 'b'));
576       /* hole between second & third vector blocks, hvector 1, index 2... */
577       assert ((hindexed_buf[i*272 + 29 + 140].the_double == 2.0) &&
578               (hindexed_buf[i*272 + 29 + 140].the_char == 'b'));
579       /* hole in first vector, third block, first hvector, index 2... */
580       assert ((hindexed_buf[i*272 + 33 + 140].the_double == 2.0) &&
581               (hindexed_buf[i*272 + 33 + 140].the_char == 'b'));
582       /* hole in second vector, third block, first hvector, index 2... */
583       assert ((hindexed_buf[i*272 + 40 + 140].the_double == 2.0) &&
584               (hindexed_buf[i*272 + 40 + 140].the_char == 'b'));
585       /* hole in between hvectors, index 2... */
586       for (j = 0; j < 44; j++) {
587         assert ((hindexed_buf[i*272 + 44 + j + 140].the_double == 2.0) &&
588                 (hindexed_buf[i*272 + 44 + j + 140].the_char == 'b'));
589       }
590       /* hole in first vector, first block, second hvector, index 2... */
591       assert ((hindexed_buf[i*272 + 3 + 88 + 140].the_double == 2.0) &&
592               (hindexed_buf[i*272 + 3 + 88 + 140].the_char == 'b'));
593       /* hole in second vector, first block, second hvector, index 2... */
594       assert ((hindexed_buf[i*272 + 10 + 88 + 140].the_double == 2.0) &&
595               (hindexed_buf[i*272 + 10 + 88 + 140].the_char == 'b'));
596       /* hole between first & second vector blocks, hvector 2, index 2... */
597       assert ((hindexed_buf[i*272 + 14 + 88 + 140].the_double == 2.0) &&
598               (hindexed_buf[i*272 + 14 + 88 + 140].the_char == 'b'));
599       /* hole in first vector, second block, second hvector, index 2... */
600       assert ((hindexed_buf[i*272 + 18 + 88 + 140].the_double == 2.0) &&
601               (hindexed_buf[i*272 + 18 + 88 + 140].the_char == 'b'));
602       /* hole in second vector, second block, second hvector, index 2... */
603       assert ((hindexed_buf[i*272 + 25 + 88 + 140].the_double == 2.0) &&
604               (hindexed_buf[i*272 + 25 + 88 + 140].the_char == 'b'));
605       /* hole between second & third vector blocks, hvector 2, index 2... */
606       assert ((hindexed_buf[i*272 + 29 + 88 + 140].the_double == 2.0) &&
607               (hindexed_buf[i*272 + 29 + 88 + 140].the_char == 'b'));
608       /* hole in first vector, third block, second hvector, index 2... */
609       assert ((hindexed_buf[i*272 + 33 + 88 + 140].the_double == 2.0) &&
610               (hindexed_buf[i*272 + 33 + 88 + 140].the_char == 'b'));
611       /* hole in second vector, third block, second hvector, index 2... */
612       assert ((hindexed_buf[i*272 + 40 + 88 + 140].the_double == 2.0) &&
613               (hindexed_buf[i*272 + 40 + 88 + 140].the_char == 'b'));
614 #endif
615
616 #ifdef RUN_TYPE_CONTIGUOUS
617       for (j = 0; j < 10; j++) {
618         /* hole in first vector, first block, first hvector, index 1... */
619         assert ((contig_buf[i*2720 + j*272 + 3].the_double == 2.0) &&
620                 (contig_buf[i*2720 + j*272 + 3].the_char == 'b'));
621         /* hole in second vector, first block, first hvector, index 1... */
622         assert ((contig_buf[i*2720 + j*272 + 10].the_double == 2.0) &&
623                 (contig_buf[i*2720 + j*272 + 10].the_char == 'b'));
624         /* hole between first & second vector blocks, hvector 1, index 1... */
625         assert ((contig_buf[i*2720 + j*272 + 14].the_double == 2.0) &&
626                 (contig_buf[i*2720 + j*272 + 14].the_char == 'b'));
627         /* hole in first vector, second block, first hvector, index 1... */
628         assert ((contig_buf[i*2720 + j*272 + 18].the_double == 2.0) &&
629                 (contig_buf[i*2720 + j*272 + 18].the_char == 'b'));
630         /* hole in second vector, second block, first hvector, index 1... */
631         assert ((contig_buf[i*2720 + j*272 + 25].the_double == 2.0) &&
632                 (contig_buf[i*2720 + j*272 + 25].the_char == 'b'));
633         /* hole between second & third vector blocks, hvector 1, index 1... */
634         assert ((contig_buf[i*2720 + j*272 + 29].the_double == 2.0) &&
635                 (contig_buf[i*2720 + j*272 + 29].the_char == 'b'));
636         /* hole in first vector, third block, first hvector, index 1... */
637         assert ((contig_buf[i*2720 + j*272 + 33].the_double == 2.0) &&
638                 (contig_buf[i*2720 + j*272 + 33].the_char == 'b'));
639         /* hole in second vector, third block, first hvector, index 1... */
640         assert ((contig_buf[i*2720 + j*272 + 40].the_double == 2.0) &&
641                 (contig_buf[i*2720 + j*272 + 40].the_char == 'b'));
642         /* hole in between hvectors, index 1... */
643         for (k = 0; k < 44; k++) {
644           assert ((contig_buf[i*2720 + j*272 + 44 + k].the_double == 2.0) &&
645                   (contig_buf[i*2720 + j*272 + 44 + k].the_char == 'b'));
646         }
647         /* hole in first vector, first block, second hvector, index 1... */
648         assert ((contig_buf[i*2720 + j*272 + 3 + 88].the_double == 2.0) &&
649                 (contig_buf[i*2720 + j*272 + 3 + 88].the_char == 'b'));
650         /* hole in second vector, first block, second hvector, index 1... */
651         assert ((contig_buf[i*2720 + j*272 + 10 + 88].the_double == 2.0) &&
652                 (contig_buf[i*2720 + j*272 + 10 + 88].the_char == 'b'));
653         /* hole between first & second vector blocks, hvector 2, index 1... */
654         assert ((contig_buf[i*2720 + j*272 + 14 + 88].the_double == 2.0) &&
655                 (contig_buf[i*2720 + j*272 + 14 + 88].the_char == 'b'));
656         /* hole in first vector, second block, second hvector, index 1... */
657         assert ((contig_buf[i*2720 + j*272 + 18 + 88].the_double == 2.0) &&
658                 (contig_buf[i*2720 + j*272 + 18 + 88].the_char == 'b'));
659         /* hole in second vector, second block, second hvector, index 1... */
660         assert ((contig_buf[i*2720 + j*272 + 25 + 88].the_double == 2.0) &&
661                 (contig_buf[i*2720 + j*272 + 25 + 88].the_char == 'b'));
662         /* hole between second & third vector blocks, hvector 2, index 1... */
663         assert ((contig_buf[i*2720 + j*272 + 29 + 88].the_double == 2.0) &&
664                 (contig_buf[i*2720 + j*272 + 29 + 88].the_char == 'b'));
665         /* hole in first vector, third block, second hvector, index 1... */
666         assert ((contig_buf[i*2720 + j*272 + 33 + 88].the_double == 2.0) &&
667                 (contig_buf[i*2720 + j*272 + 33 + 88].the_char == 'b'));
668         /* hole in second vector, third block, second hvector, index 1... */
669         assert ((contig_buf[i*2720 + j*272 + 40 + 88].the_double == 2.0) &&
670                 (contig_buf[i*2720 + j*272 + 40 + 88].the_char == 'b'));
671         /* indexed hole... */
672         for (k = 0; k < 8; k++) {
673           assert ((contig_buf[i*2720 + j*272 + 132 + k].the_double == 2.0) &&
674                   (contig_buf[i*2720 + j*272 + 132 + k].the_char == 'b'));
675         }
676         /* hole in first vector, first block, first hvector, index 2... */
677         assert ((contig_buf[i*2720 + j*272 + 3 + 140].the_double == 2.0) &&
678                 (contig_buf[i*2720 + j*272 + 3 + 140].the_char == 'b'));
679         /* hole in second vector, first block, first hvector, index 2... */
680         assert ((contig_buf[i*2720 + j*272 + 10 + 140].the_double == 2.0) &&
681                 (contig_buf[i*2720 + j*272 + 10 + 140].the_char == 'b'));
682         /* hole between first & second vector blocks, hvector 1, index 2... */
683         assert ((contig_buf[i*2720 + j*272 + 14 + 140].the_double == 2.0) &&
684                 (contig_buf[i*2720 + j*272 + 14 + 140].the_char == 'b'));
685         /* hole in first vector, second block, first hvector, index 2... */
686         assert ((contig_buf[i*2720 + j*272 + 18 + 140].the_double == 2.0) &&
687                 (contig_buf[i*2720 + j*272 + 18 + 140].the_char == 'b'));
688         /* hole in second vector, second block, first hvector, index 2... */
689         assert ((contig_buf[i*2720 + j*272 + 25 + 140].the_double == 2.0) &&
690                 (contig_buf[i*2720 + j*272 + 25 + 140].the_char == 'b'));
691         /* hole between second & third vector blocks, hvector 1, index 2... */
692         assert ((contig_buf[i*2720 + j*272 + 29 + 140].the_double == 2.0) &&
693                 (contig_buf[i*2720 + j*272 + 29 + 140].the_char == 'b'));
694         /* hole in first vector, third block, first hvector, index 2... */
695         assert ((contig_buf[i*2720 + j*272 + 33 + 140].the_double == 2.0) &&
696                 (contig_buf[i*2720 + j*272 + 33 + 140].the_char == 'b'));
697         /* hole in second vector, third block, first hvector, index 2... */
698         assert ((contig_buf[i*2720 + j*272 + 40 + 140].the_double == 2.0) &&
699                 (contig_buf[i*2720 + j*272 + 40 + 140].the_char == 'b'));
700         /* hole in between hvectors, index 2... */
701         for (k = 0; k < 44; k++) {
702           assert ((contig_buf[i*2720+j*272+44+k+140].the_double == 2.0) &&
703                   (contig_buf[i*2720 +j*272+44+k+140].the_char == 'b'));
704         }
705         /* hole in first vector, first block, second hvector, index 2... */
706         assert ((contig_buf[i*2720+j*272+3+88+140].the_double == 2.0) &&
707                 (contig_buf[i*2720 + j*272 + 3 + 88 + 140].the_char == 'b'));
708         /* hole in second vector, first block, second hvector, index 2... */
709         assert ((contig_buf[i*2720+j*272+10+88+140].the_double == 2.0) &&
710                 (contig_buf[i*2720 + j*272 + 10 + 88 + 140].the_char == 'b'));
711         /* hole between first & second vector blocks, hvector 2, index 2... */
712         assert ((contig_buf[i*2720+j*272+14+88+140].the_double == 2.0) &&
713                 (contig_buf[i*2720 + j*272 + 14 + 88 + 140].the_char == 'b'));
714         /* hole in first vector, second block, second hvector, index 2... */
715         assert ((contig_buf[i*2720+j*272+18+88+140].the_double == 2.0) &&
716                 (contig_buf[i*2720 + j*272 + 18 + 88 + 140].the_char == 'b'));
717         /* hole in second vector, second block, second hvector, index 2... */
718         assert ((contig_buf[i*2720+j*272+25+88+140].the_double == 2.0) &&
719                 (contig_buf[i*2720 + j*272 + 25 + 88 + 140].the_char == 'b'));
720         /* hole between second & third vector blocks, hvector 2, index 2... */
721         assert ((contig_buf[i*2720+j*272+29+88+140].the_double == 2.0) &&
722                 (contig_buf[i*2720 + j*272 + 29 + 88 + 140].the_char == 'b'));
723         /* hole in first vector, third block, second hvector, index 2... */
724         assert ((contig_buf[i*2720+j*272+33+88+140].the_double == 2.0) &&
725                 (contig_buf[i*2720 + j*272 + 33 + 88 + 140].the_char == 'b'));
726         /* hole in second vector, third block, second hvector, index 2... */
727         assert ((contig_buf[i*2720+j*272+40+88+140].the_double == 2.0) &&
728                 (contig_buf[i*2720 + j*272 + 40 + 88 + 140].the_char == 'b'));
729       }
730 #endif
731
732 #ifdef RUN_TYPE_STRUCT_LB_UB
733       /* no holes in struct_lb_ub_recv_buf... */
734 #endif
735     }
736   }
737         
738   for (i = 0; i < TYPE_CONSTRUCTOR_COUNT; i++)
739     MPI_Type_free (&newtype[i]);
740
741   MPI_Barrier (comm);
742
743   printf ("(%d) Finished normally\n", rank);
744   MPI_Finalize ();
745 }
746
747 /* EOF */