Bugfix Refactoring MaxLen

master
Julian M. Kunkel 2018-07-07 22:42:05 +01:00
parent ed5787811c
commit b27b50184a
1 changed files with 5 additions and 5 deletions

View File

@ -168,8 +168,8 @@ int CountTasksPerNode(MPI_Comm comm) {
} }
return tasksPerNode; return tasksPerNode;
} }
char localhost[MAX_LEN], char localhost[MAX_PATHLEN],
hostname[MAX_LEN]; hostname[MAX_PATHLEN];
int count = 1, int count = 1,
i; i;
MPI_Status status; MPI_Status status;
@ -179,13 +179,13 @@ int CountTasksPerNode(MPI_Comm comm) {
fflush( out_logfile ); fflush( out_logfile );
} }
if (gethostname(localhost, MAX_LEN) != 0) { if (gethostname(localhost, MAX_PATHLEN) != 0) {
FAIL("gethostname()"); FAIL("gethostname()");
} }
if (rank == 0) { if (rank == 0) {
/* MPI_receive all hostnames, and compare to local hostname */ /* MPI_receive all hostnames, and compare to local hostname */
for (i = 0; i < size-1; i++) { for (i = 0; i < size-1; i++) {
MPI_Recv(hostname, MAX_LEN, MPI_CHAR, MPI_ANY_SOURCE, MPI_Recv(hostname, MAX_PATHLEN, MPI_CHAR, MPI_ANY_SOURCE,
MPI_ANY_TAG, testComm, &status); MPI_ANY_TAG, testComm, &status);
if (strcmp(hostname, localhost) == 0) { if (strcmp(hostname, localhost) == 0) {
count++; count++;
@ -193,7 +193,7 @@ int CountTasksPerNode(MPI_Comm comm) {
} }
} else { } else {
/* MPI_send hostname to root node */ /* MPI_send hostname to root node */
MPI_Send(localhost, MAX_LEN, MPI_CHAR, 0, 0, testComm); MPI_Send(localhost, MAX_PATHLEN, MPI_CHAR, 0, 0, testComm);
} }
MPI_Bcast(&count, 1, MPI_INT, 0, testComm); MPI_Bcast(&count, 1, MPI_INT, 0, testComm);