- int buf[128], position, cnt;
- /* sender */
-
- /* Create a datatype and send it (multiple of sizeof(int)) */
- /* Create a send struct type */
- oldtypes[0] = MPI_INT;
- oldtypes[1] = MPI_CHAR;
- blklens[0] = 1;
- blklens[1] = 4*sizeof(int);
- offsets[0] = 0;
- offsets[1] = sizeof(int);
- MPI_Type_struct( 2, blklens, offsets, oldtypes, &outtype );
- MPI_Type_commit( &outtype );
-
- buf[0] = 4*sizeof(int);
- /* printf( "About to send to %d\n", dest ); */
- MPI_Send( buf, 1, outtype, dest, 0, comm );
- MPI_Type_free( &outtype );
-
- /* Create a datatype and send it (not a multiple of sizeof(int)) */
- /* Create a send struct type */
- oldtypes[0] = MPI_INT;
- oldtypes[1] = MPI_CHAR;
- blklens[0] = 1;
- blklens[1] = 4*sizeof(int)+1;
- offsets[0] = 0;
- offsets[1] = sizeof(int);
- MPI_Type_struct( 2, blklens, offsets, oldtypes, &outtype );
- MPI_Type_commit( &outtype );
-
- buf[0] = 4*sizeof(int) + 1;
- MPI_Send( buf, 1, outtype, dest, 1, comm );
- MPI_Type_free( &outtype );
-
- /* Pack data and send as packed */
- position = 0;
- cnt = 7;
- MPI_Pack( &cnt, 1, MPI_INT,
- buf, 128*sizeof(int), &position, comm );
- MPI_Pack( (void*)"message", 7, MPI_CHAR,
- buf, 128*sizeof(int), &position, comm );
- MPI_Send( buf, position, MPI_PACKED, dest, 2, comm );
+ int buf[128], position, cnt;
+ MTEST_VG_MEM_INIT(buf, 128 * sizeof(buf[0]));
+ /* sender */
+
+ /* Create a datatype and send it (multiple of sizeof(int)) */
+ /* Create a send struct type */
+ oldtypes[0] = MPI_INT;
+ oldtypes[1] = MPI_CHAR;
+ blklens[0] = 1;
+ blklens[1] = 4 * sizeof(int);
+ offsets[0] = 0;
+ offsets[1] = sizeof(int);
+ MPI_Type_struct(2, blklens, offsets, oldtypes, &outtype);
+ MPI_Type_commit(&outtype);
+
+ buf[0] = 4 * sizeof(int);
+ /* printf("About to send to %d\n", dest); */
+ MPI_Send(buf, 1, outtype, dest, 0, comm);
+ MPI_Type_free(&outtype);
+
+ /* Create a datatype and send it (not a multiple of sizeof(int)) */
+ /* Create a send struct type */
+ oldtypes[0] = MPI_INT;
+ oldtypes[1] = MPI_CHAR;
+ blklens[0] = 1;
+ blklens[1] = 4 * sizeof(int) + 1;
+ offsets[0] = 0;
+ offsets[1] = sizeof(int);
+ MPI_Type_struct(2, blklens, offsets, oldtypes, &outtype);
+ MPI_Type_commit(&outtype);
+
+ buf[0] = 4 * sizeof(int) + 1;
+ MPI_Send(buf, 1, outtype, dest, 1, comm);
+ MPI_Type_free(&outtype);
+
+ /* Pack data and send as packed */
+ position = 0;
+ cnt = 7;
+ MPI_Pack(&cnt, 1, MPI_INT, buf, 128 * sizeof(int), &position, comm);
+ MPI_Pack((void *) "message", 7, MPI_CHAR, buf, 128 * sizeof(int), &position, comm);
+ MPI_Send(buf, position, MPI_PACKED, dest, 2, comm);