From: minhdiep Date: Fri, 2 Jul 2010 00:27:22 +0000 (-0600) Subject: b=23175 Use MPI_Bcast to send random value to all ranks. X-Git-Tag: 2.0.0.51~50 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=233855372063cc5bab59ab70396a2377cc0494e7;p=fs%2Flustre-release.git b=23175 Use MPI_Bcast to send random value to all ranks. The file size will be different if each rank generate its own chunksize. We need rank 0 to generate the random and pass it to all ranks. i=Johann --- diff --git a/lustre/tests/mpi/write_disjoint.c b/lustre/tests/mpi/write_disjoint.c index 8ddc497..f5b3454 100644 --- a/lustre/tests/mpi/write_disjoint.c +++ b/lustre/tests/mpi/write_disjoint.c @@ -88,6 +88,7 @@ int main (int argc, char *argv[]) { ssize_t ret; char *filename = "/mnt/lustre/write_disjoint"; int numloops = 1000; + int random = 0; error = MPI_Init(&argc, &argv); if (error != MPI_SUCCESS) @@ -133,12 +134,23 @@ int main (int argc, char *argv[]) { if (ret != 0) rprintf(rank, n, "truncate() returned %s\n", strerror(errno) ); + random = rand(); } - CHUNK_SIZE(n) = rand() % CHUNK_MAX_SIZE; + MPI_Bcast(&random, 1, MPI_INT, 0, MPI_COMM_WORLD); + CHUNK_SIZE(n) = random % CHUNK_MAX_SIZE; if (n % 1000 == 0 && rank == 0) printf("loop %d: chunk_size %lu\n", n, CHUNK_SIZE(n)); + if (stat(filename, &stat_buf) < 0) + rprintf(rank, n, "error stating %s: %s\n", + filename, strerror(errno)); + + if (stat_buf.st_size != 0) + rprintf(rank, n, "filesize = %lu. " + "Should be zero after truncate\n", + stat_buf.st_size); + MPI_Barrier(MPI_COMM_WORLD); /* Do the race */