- sprintf( valerr, "%x != %x",
- ((char *)bufferspace)[j], (char)(j&0x7f) );
- break;
- }
- } else if (buffertype == MPI_SHORT) {
+ sprintf( valerr, "%x != %x",
+ ((char *)bufferspace)[j], (char)(j&0x7f) );
+ break;
+ }
+ } else if (buffertype == MPI_SHORT) {
- sprintf( valerr, "%d != %d",
- ((short *)bufferspace)[j], (short)j );
- break;
- }
- } else if (buffertype == MPI_INT) {
+ sprintf( valerr, "%d != %d",
+ ((short *)bufferspace)[j], (short)j );
+ break;
+ }
+ } else if (buffertype == MPI_INT) {
- sprintf( valerr, "%d != %d",
- ((int *)bufferspace)[j], (int)j );
- break;
- }
- } else if (buffertype == MPI_LONG) {
+ sprintf( valerr, "%d != %d",
+ ((int *)bufferspace)[j], (int)j );
+ break;
+ }
+ } else if (buffertype == MPI_LONG) {
- BasicTypes[0] = MPI_CHAR; BasicNames[0] = (char*)"MPI_CHAR" ;
- BasicTypes[1] = MPI_SHORT; BasicNames[1] = (char*)"MPI_SHORT";
- BasicTypes[2] = MPI_INT; BasicNames[2] = (char*)"MPI_INT" ;
- BasicTypes[3] = MPI_LONG; BasicNames[3] = (char*)"MPI_LONG" ;
- BasicTypes[4] = MPI_UNSIGNED_CHAR; BasicNames[4] = (char*)"MPI_UNSIGNED_CHAR";
- BasicTypes[5] = MPI_UNSIGNED_SHORT; BasicNames[5] = (char*)"MPI_UNSIGNED_SHORT";
- BasicTypes[6] = MPI_UNSIGNED; BasicNames[6] = (char*)"MPI_UNSIGNED";
- BasicTypes[7] = MPI_UNSIGNED_LONG; BasicNames[7] = (char*)"MPI_UNSIGNED_LONG";
- BasicTypes[8] = MPI_FLOAT; BasicNames[8] = (char*)"MPI_FLOAT";
- BasicTypes[9] = MPI_DOUBLE; BasicNames[9] = (char*)"MPI_DOUBLE";
- BasicTypes[10] = MPI_BYTE; BasicNames[10] = (char*)"MPI_BYTE";
- /* By making the BYTE type LAST, we make it easier to handle heterogeneous
- systems that may not support all of the types */
- ntypes = 11;
+ BasicTypes[0] = MPI_CHAR; BasicNames[0] = (char*)"MPI_CHAR" ;
+ BasicTypes[1] = MPI_SHORT; BasicNames[1] = (char*)"MPI_SHORT";
+ BasicTypes[2] = MPI_INT; BasicNames[2] = (char*)"MPI_INT" ;
+ BasicTypes[3] = MPI_LONG; BasicNames[3] = (char*)"MPI_LONG" ;
+ BasicTypes[4] = MPI_UNSIGNED_CHAR; BasicNames[4] = (char*)"MPI_UNSIGNED_CHAR";
+ BasicTypes[5] = MPI_UNSIGNED_SHORT; BasicNames[5] = (char*)"MPI_UNSIGNED_SHORT";
+ BasicTypes[6] = MPI_UNSIGNED; BasicNames[6] = (char*)"MPI_UNSIGNED";
+ BasicTypes[7] = MPI_UNSIGNED_LONG; BasicNames[7] = (char*)"MPI_UNSIGNED_LONG";
+ BasicTypes[8] = MPI_FLOAT; BasicNames[8] = (char*)"MPI_FLOAT";
+ BasicTypes[9] = MPI_DOUBLE; BasicNames[9] = (char*)"MPI_DOUBLE";
+ BasicTypes[10] = MPI_BYTE; BasicNames[10] = (char*)"MPI_BYTE";
+ /* By making the BYTE type LAST, we make it easier to handle heterogeneous
+ systems that may not support all of the types */
+ ntypes = 11;
- void *bufferspace[MAX_TYPES];
- int i, j;
-
- AllocateBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
- FillBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
- for (i = 0; i < ntypes; i++) {
- MPI_Send( (void *)0, 0, BasicTypes[i], dest, 2000, MPI_COMM_WORLD );
- for (j = 0; j < maxbufferlen; j += 500)
+ void *bufferspace[MAX_TYPES];
+ int i, j;
+
+ AllocateBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
+ FillBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
+ for (i = 0; i < ntypes; i++) {
+ MPI_Send( (void *)0, 0, BasicTypes[i], dest, 2000, MPI_COMM_WORLD );
+ for (j = 0; j < maxbufferlen; j += 500)
- void *bufferspace[MAX_TYPES];
- int i, j;
- char message[81];
- MPI_Status Stat;
- int dummy, passed;
-
- AllocateBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
- for (i = 0; i < ntypes; i++) {
- passed = 1;
- MPI_Recv( (void *)0, 0, BasicTypes[i], src,
- 2000, MPI_COMM_WORLD, &Stat);
- if (Stat.MPI_SOURCE != src) {
+ void *bufferspace[MAX_TYPES];
+ int i, j;
+ char message[81];
+ MPI_Status Stat;
+ int dummy, passed;
+
+ AllocateBuffers(bufferspace, BasicTypes, ntypes, maxbufferlen);
+ for (i = 0; i < ntypes; i++) {
+ passed = 1;
+ MPI_Recv( (void *)0, 0, BasicTypes[i], src,
+ 2000, MPI_COMM_WORLD, &Stat);
+ if (Stat.MPI_SOURCE != src) {
- for (i = 2001; i <= MAX_ORDER_TAG; i++)
- MPI_Isend(buffer, maxbufferlen, MPI_INT, dest,
- i, MPI_COMM_WORLD, &r[i-2001] );
+ for (i = 2001; i <= MAX_ORDER_TAG; i++)
+ MPI_Isend(buffer, maxbufferlen, MPI_INT, dest,
+ i, MPI_COMM_WORLD, &r[i-2001] );
- int *buffer;
- int i, j;
- char message[81];
- MPI_Status Stat;
- int dummy, passed;
- int errloc;
-
- buffer = (int *)calloc(maxbufferlen,sizeof(int));
- passed = 1;
-
- for (i = MAX_ORDER_TAG; i >= 2001; i--) {
- MPI_Recv(buffer, maxbufferlen, MPI_INT, src,
- i, MPI_COMM_WORLD, &Stat);
- sprintf(message, "Tag Selectivity Test, Tag %d",
- i);
- if (Stat.MPI_SOURCE != src) {
+ int *buffer;
+ int i, j;
+ char message[81];
+ MPI_Status Stat;
+ int dummy, passed;
+ int errloc;
+
+ buffer = (int *)calloc(maxbufferlen,sizeof(int));
+ passed = 1;
+
+ for (i = MAX_ORDER_TAG; i >= 2001; i--) {
+ MPI_Recv(buffer, maxbufferlen, MPI_INT, src,
+ i, MPI_COMM_WORLD, &Stat);
+ sprintf(message, "Tag Selectivity Test, Tag %d",
+ i);
+ if (Stat.MPI_SOURCE != src) {
- /* A receive test might not fail until it is triggered... */
- MPI_Send( ibuf, 10, MPI_INT, dest, 15, MPI_COMM_WORLD);
+ /* A receive test might not fail until it is triggered... */
+ MPI_Send( ibuf, 10, MPI_INT, dest, 15, MPI_COMM_WORLD);
- if (MPI_Send(buffer, 20, MPI_INT, dest,
- 1, MPI_COMM_NULL) == MPI_SUCCESS){
- Test_Failed("NULL Communicator Test");
- }
- else
- Test_Passed("NULL Communicator Test");
-
- if (MPI_Send(buffer, -1, MPI_INT, dest,
- 1, MPI_COMM_WORLD) == MPI_SUCCESS){
- Test_Failed("Invalid Count Test");
- }
- else
- Test_Passed("Invalid Count Test");
-
- if (MPI_Send(buffer, 20, bogus_type, dest,
- 1, MPI_COMM_WORLD) == MPI_SUCCESS){
- Test_Failed("Invalid Type Test");
- }
- else
- Test_Passed("Invalid Type Test");
-
- small_tag = -1;
- if (small_tag == MPI_ANY_TAG) small_tag = -2;
- if (MPI_Send(buffer, 20, MPI_INT, dest,
- small_tag, MPI_COMM_WORLD) == MPI_SUCCESS) {
- Test_Failed("Invalid Tag Test");
- }
- else
- Test_Passed("Invalid Tag Test");
-
- /* Form a tag that is too large */
- /*MPI_Attr_get( MPI_COMM_WORLD, MPI_TAG_UB, (void **)&tag_ubp, &flag );
+ if (MPI_Send(buffer, 20, MPI_INT, dest,
+ 1, MPI_COMM_NULL) == MPI_SUCCESS){
+ Test_Failed("NULL Communicator Test");
+ }
+ else
+ Test_Passed("NULL Communicator Test");
+
+ if (MPI_Send(buffer, -1, MPI_INT, dest,
+ 1, MPI_COMM_WORLD) == MPI_SUCCESS){
+ Test_Failed("Invalid Count Test");
+ }
+ else
+ Test_Passed("Invalid Count Test");
+
+ if (MPI_Send(buffer, 20, bogus_type, dest,
+ 1, MPI_COMM_WORLD) == MPI_SUCCESS){
+ Test_Failed("Invalid Type Test");
+ }
+ else
+ Test_Passed("Invalid Type Test");
+
+ small_tag = -1;
+ if (small_tag == MPI_ANY_TAG) small_tag = -2;
+ if (MPI_Send(buffer, 20, MPI_INT, dest,
+ small_tag, MPI_COMM_WORLD) == MPI_SUCCESS) {
+ Test_Failed("Invalid Tag Test");
+ }
+ else
+ Test_Passed("Invalid Tag Test");
+
+ /* Form a tag that is too large */
+ /*MPI_Attr_get( MPI_COMM_WORLD, MPI_TAG_UB, (void **)&tag_ubp, &flag );
- if (MPI_Send(buffer, 20, MPI_INT, dest,
- large_tag, MPI_COMM_WORLD) == MPI_SUCCESS) {
- Test_Failed("Invalid Tag Test");
- }
- else
- Test_Passed("Invalid Tag Test");
- }
-*/
- if (MPI_Send(buffer, 20, MPI_INT, 300,
- 1, MPI_COMM_WORLD) == MPI_SUCCESS) {
- Test_Failed("Invalid Destination Test");
- }
- else
- Test_Passed("Invalid Destination Test");
-
- if (MPI_Send((void *)0, 10, MPI_INT, dest,
- 1, MPI_COMM_WORLD) == MPI_SUCCESS){
- Test_Failed("Invalid Buffer Test (send)");
+ if (MPI_Send(buffer, 20, MPI_INT, dest,
+ large_tag, MPI_COMM_WORLD) == MPI_SUCCESS) {
+ Test_Failed("Invalid Tag Test");
- Test_Passed("Invalid Buffer Test (send)");
-
- /* A receive test might not fail until it is triggered... */
- if (MPI_Recv((void *)0, 10, MPI_INT, src,
- 15, MPI_COMM_WORLD, &status) == MPI_SUCCESS){
- Test_Failed("Invalid Buffer Test (recv)");
+ Test_Passed("Invalid Tag Test");
- else
- Test_Passed("Invalid Buffer Test (recv)");
-
- /* Just to keep things happy, see if there is a message to receive */
- { int flag, ibuf[10];
+ */
+ if (MPI_Send(buffer, 20, MPI_INT, 300,
+ 1, MPI_COMM_WORLD) == MPI_SUCCESS) {
+ Test_Failed("Invalid Destination Test");
+ }
+ else
+ Test_Passed("Invalid Destination Test");
+
+ if (MPI_Send((void *)0, 10, MPI_INT, dest,
+ 1, MPI_COMM_WORLD) == MPI_SUCCESS){
+ Test_Failed("Invalid Buffer Test (send)");
+ }
+ else
+ Test_Passed("Invalid Buffer Test (send)");
+
+ /* A receive test might not fail until it is triggered... */
+ if (MPI_Recv((void *)0, 10, MPI_INT, src,
+ 15, MPI_COMM_WORLD, &status) == MPI_SUCCESS){
+ Test_Failed("Invalid Buffer Test (recv)");
+ }
+ else
+ Test_Passed("Invalid Buffer Test (recv)");
+
+ /* Just to keep things happy, see if there is a message to receive */
+ { //int flag,
+ int ibuf[10];
- MPI_Iprobe( src, 15, MPI_COMM_WORLD, &flag, &status );
- if (flag)
- MPI_Recv( ibuf, 10, MPI_INT, src, 15, MPI_COMM_WORLD, &status );
- }
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL );
- return;
+ //MPI_Iprobe( src, 15, MPI_COMM_WORLD, &flag, &status );
+ //if (flag)
+ MPI_Recv( ibuf, 10, MPI_INT, src, 15, MPI_COMM_WORLD, &status );
+ }
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL );
+ return;
- int myrank, mysize;
- int rc, itemp, i;
-
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
- MPI_Comm_size(MPI_COMM_WORLD, &mysize);
- Test_Init("sendrecv", myrank);
- SetupBasicTypes();
-
- if (mysize != 2) {
- fprintf(stderr,
- "*** This test program requires exactly 2 processes.\n");
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
-
- /* Get the min of the basic types */
- itemp = ntypes;
- MPI_Allreduce( &itemp, &ntypes, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD );
-
- /* dest writes out the received stats; for the output to be
- consistant (with the final check), it should be procees 0 */
- for (i=1; i<argc; i++) {
- if (argv[i] && strcmp( "-alt", argv[i] ) == 0) {
+ int myrank, mysize;
+ int rc, itemp, i;
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mysize);
+ Test_Init("sendrecv", myrank);
+ SetupBasicTypes();
+
+ if (mysize != 2) {
+ fprintf(stderr,
+ "*** This test program requires exactly 2 processes.\n");
+ MPI_Abort( MPI_COMM_WORLD, 1 );
+ }
+
+ /* Get the min of the basic types */
+ itemp = ntypes;
+ MPI_Allreduce( &itemp, &ntypes, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD );
+
+ /* dest writes out the received stats; for the output to be
+ consistant (with the final check), it should be procees 0 */
+ for (i=1; i<argc; i++) {
+ if (argv[i] && strcmp( "-alt", argv[i] ) == 0) {
- /* Turn stdout's buffering to line buffered so it mixes right with
- stderr in output files. (hopefully) */
- setvbuf(stdout, NULL, _IOLBF, 0);
- setvbuf(stderr, NULL, _IOLBF, 0);
+ /* Turn stdout's buffering to line buffered so it mixes right with
+ stderr in output files. (hopefully) */
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(stderr, NULL, _IOLBF, 0);