5
/* The original version of this was sent by
6
empierce@tribble.llnl.gov (Elsie M. Pierce)
7
I've modified it to fit the automated tests requirements
9
/* Prototypes for picky compilers */
10
int iinit ( int *, int, int );
11
int ilist1 ( int *, int, int, int );
12
void Build_vect ( MPI_Datatype * );
13
void Build_ctg ( int, MPI_Datatype *, MPI_Datatype * );
16
int iinit(a, value, l)
27
int ilist1(a, mype, pe_out, l)
28
int *a, mype, pe_out, l;
41
void Build_vect(mess_ptr)
42
MPI_Datatype* mess_ptr;
44
int count, bllen, gap, str;
46
/* Define an MPI type with two blocks of 3 integers each, separated */
53
MPI_Type_vector(count, bllen, str, MPI_INT, mess_ptr);
54
MPI_Type_commit(mess_ptr);
59
void Build_ctg(big_offset,messtyp, messtyp2)
61
MPI_Datatype *messtyp, *messtyp2;
67
MPI_Type_extent(*messtyp, &ext);
68
MPI_Type_hvector(count, 1, ext+big_offset, *messtyp, messtyp2);
69
MPI_Type_commit(messtyp2);
70
/*printf( "pack is:\n" );
71
MPIR_PrintDatatypePack( stdout, 1, *messtyp2, 0, 0 );
72
printf( "unpack is:\n" );
73
MPIR_PrintDatatypeUnpack( stdout, 1, *messtyp2, 0, 0 ); */
81
MPI_Datatype messtyp, messtyp2;
90
iinit(dar, my_rank, DL);
92
MPI_Bcast(dar, count, messtyp, root, MPI_COMM_WORLD);
94
printf(" 0 = Sent, 1 = Not Sent \n%s",
95
" Vector Type with Gap : \n");
96
ilist1(dar, my_rank, 1, DL);
99
for (big_offset = -intlen; big_offset<=2*intlen;
100
big_offset += intlen){
102
printf("\n Three of above vector types combined, with offset = %i ints\n",
103
big_offset/(int)sizeof(int));
104
iinit(dar, my_rank, DL);
105
Build_ctg(big_offset, &messtyp, &messtyp2);
106
MPI_Bcast(dar, count, messtyp2, root, MPI_COMM_WORLD);
107
MPI_Barrier(MPI_COMM_WORLD);
108
MPI_Type_free(&messtyp2);
109
ilist1(dar, my_rank, 1, DL);
111
MPI_Type_free( &messtyp );
116
int main( int argc, char *argv[])
120
MPI_Init (&argc, &argv);
121
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);