updated
git-svn-id: svn://anubis/gvsu@257 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
5666b02e76
commit
fc106b1705
@ -49,33 +49,21 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
int my_rank;
|
int my_rank;
|
||||||
int p; /* the number of processes */
|
int p; /* the number of processes */
|
||||||
int n = 10; /* the size of the matrix */
|
int n = 10; /* the size of the matrix */
|
||||||
|
|
||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
|
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
|
||||||
MPI_Comm_size(MPI_COMM_WORLD, &p);
|
MPI_Comm_size(MPI_COMM_WORLD, &p);
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (int i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (!strncmp(argv[i], "-s", 2))
|
|
||||||
{
|
|
||||||
n = atoi(strlen(argv[i]) > 2
|
|
||||||
? argv[i] + 2
|
|
||||||
: argv[++i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize the matrices */
|
/* Initialize the matrices */
|
||||||
int matrix[n][n];
|
int matrix[n][n];
|
||||||
int recvmatrix[n][n];
|
int recvmatrix[n][n];
|
||||||
for (int i = 0; i < n; i++) /* zero the matrices for prettier */
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < n; j++) /* printing */
|
for (int j = 0; j < n; j++)
|
||||||
{
|
{
|
||||||
matrix[i][j] = 0;
|
matrix[i][j] = 0; /* zero the matrices for prettier */
|
||||||
recvmatrix[i][j] = 0;
|
recvmatrix[i][j] = 0; /* printing */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +90,7 @@ int main(int argc, char * argv[])
|
|||||||
printMatrix(&matrix[0][0], n, n);
|
printMatrix(&matrix[0][0], n, n);
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
MPI_Barrier(MPI_COMM_WORLD); /* for printing coherently */
|
MPI_Barrier(MPI_COMM_WORLD); /* just for printing coherently */
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
}
|
}
|
||||||
@ -148,7 +136,7 @@ int main(int argc, char * argv[])
|
|||||||
printMatrix(&recvmatrix[0][0], n, n);
|
printMatrix(&recvmatrix[0][0], n, n);
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
MPI_Barrier(MPI_COMM_WORLD); /* for printing coherently */
|
MPI_Barrier(MPI_COMM_WORLD); /* just for printing coherently */
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user