Index: test1_am.c =================================================================== --- test1_am.c (revision 9830) +++ test1_am.c (working copy) @@ -15,8 +15,8 @@ int main(int argc, char *argv[]) { -/* int rank, nprocs, A[SIZE], B[SIZE], i; */ int rank, nprocs, i; + MPI_Comm CommDeuce; int *A, *B; MPI_Win win; @@ -26,70 +26,78 @@ MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - if (nprocs != 2) { - printf("Run this program with 2 processes\n"); + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &A); + i = MPI_Comm_split(MPI_COMM_WORLD, rank==0 || rank==1, rank, &CommDeuce); if (i) { - printf("Can't allocate memory in test program\n"); + printf("Can't create a subcommunicator of two processes\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B); - if (i) { - printf("Can't allocate memory in test program\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - if (rank == 0) { - for (i=0; i= 50) - { - printf("Total number of errors: %d\n", errs); - } - } + for (j=0; j= 50) + { + printf("Total number of errors: %d\n", errs); + } + } + MPI_Win_free(&win); + + free(A_data); + free(A); + + } + MPI_Comm_free(&CommDeuce); MTest_Finalize(errs); MPI_Finalize(); return 0; Index: transpose2.c =================================================================== --- transpose2.c (revision 9830) +++ transpose2.c (working copy) @@ -18,85 +18,94 @@ int main(int argc, char *argv[]) { int rank, nprocs, A[NROWS][NCOLS], i, j, blocklen[2]; + MPI_Comm CommDeuce; MPI_Aint disp[2]; MPI_Win win; MPI_Datatype column, column1, type[2]; int errs=0; - + MTest_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - if (nprocs != 2) - { - printf("Run this program with 2 processes\n"); + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - if (rank == 0) + i = MPI_Comm_split(MPI_COMM_WORLD, rank==0 || rank==1, rank, &CommDeuce); + if (i) { + printf("Can't create a subcommunicator of two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + if (rank == 0 || rank == 1) { - for (i=0; i= 50) - { - printf("Total number of errors: %d\n", errs); - } + } + if (errs >= 50) + { + printf("Total number of errors: %d\n", errs); + } + } + MPI_Win_free(&win); } - MPI_Win_free(&win); + MPI_Comm_free(&CommDeuce); MTest_Finalize(errs); MPI_Finalize(); return 0; Index: test1.c =================================================================== --- test1.c (revision 9830) +++ test1.c (working copy) @@ -14,6 +14,7 @@ int main(int argc, char *argv[]) { int rank, nprocs, A[SIZE], B[SIZE], i; + MPI_Comm CommDeuce; MPI_Win win; int errs = 0; @@ -21,55 +22,63 @@ MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - if (nprocs != 2) { - printf("Run this program with 2 processes\n"); + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - if (rank == 0) { - for (i=0; i= 50) - { - printf("Total number of errors: %d\n", errs); - } + } + if (errs >= 50) + { + printf("Total number of errors: %d\n", errs); + } + } + + MPI_Group_free(&group); + MPI_Group_free(&comm_group); + MPI_Win_free(&win); } - - MPI_Group_free(&group); - MPI_Group_free(&comm_group); - MPI_Win_free(&win); + MPI_Comm_free(&CommDeuce); MTest_Finalize(errs); MPI_Finalize(); return 0; Index: test2.c =================================================================== --- test2.c (revision 9830) +++ test2.c (working copy) @@ -15,61 +15,70 @@ int main(int argc, char *argv[]) { int rank, destrank, nprocs, A[SIZE2], B[SIZE2], i; + MPI_Comm CommDeuce; MPI_Group comm_group, group; MPI_Win win; int errs = 0; - + MTest_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - if (nprocs != 2) { - printf("Run this program with 2 processes\n"); + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - MPI_Comm_group(MPI_COMM_WORLD, &comm_group); + i = MPI_Comm_split(MPI_COMM_WORLD, rank==0 || rank==1, rank, &CommDeuce); + if (i) { + printf("Can't create a subcommunicator of two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } - if (rank == 0) { - for (i=0; i= 50) - { - printf("Total number of errors: %d\n", errs); - } - } + } + if (errs >= 50) + { + printf("Total number of errors: %d\n", errs); + } + } - MPI_Win_free(&win); + MPI_Win_free(&win); - free(A_data); - free(A); + free(A_data); + free(A); + } + + MPI_Comm_free(&CommDeuce); MTest_Finalize(errs); MPI_Finalize(); return 0; Index: test5.c =================================================================== --- test5.c (revision 9830) +++ test5.c (working copy) @@ -14,57 +14,64 @@ int main(int argc, char *argv[]) { int rank, nprocs, i, A[SIZE], B[SIZE]; + MPI_Comm CommDeuce; MPI_Win win; int errs = 0; - + MTest_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - if (nprocs != 2) { - printf("Run this program with 2 processes\n"); + + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - if (rank == 0) { - for (i=0; i= 20) + { + printf("Total number of errors: %d\n", errs); + } + + MPI_Win_free(&win); } - if (errs >= 20) - { - printf("Total number of errors: %d\n", errs); - } - - MPI_Win_free(&win); MTest_Finalize(errs); MPI_Finalize(); return 0; Index: transpose7.c =================================================================== --- transpose7.c (revision 9830) +++ transpose7.c (working copy) @@ -18,82 +18,91 @@ int main(int argc, char *argv[]) { int rank, nprocs, **A, *A_data, i, j; + MPI_Comm CommDeuce; MPI_Win win; MPI_Datatype column, xpose; int errs = 0; - + MTest_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - if (nprocs != 2) { - printf("Run this program with 2 processes\n"); + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); MPI_Abort(MPI_COMM_WORLD,1); } - A_data = (int *) malloc(NROWS * NCOLS * sizeof(int)); - A = (int **) malloc(NROWS * sizeof(int *)); + i = MPI_Comm_split(MPI_COMM_WORLD, rank==0 || rank==1, rank, &CommDeuce); + if (i) { + printf("Can't create a subcommunicator of two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } - A[0] = A_data; - for (i=1; i= 50) + { + printf("Total number of errors: %d\n", errs); + } + } + else + { for (i=0; i= 50) - { - printf("Total number of errors: %d\n", errs); - } - } - else - { /* rank = 1 */ - for (i=0; i