summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-10-16 17:19:15 (GMT)
committerGitHub <noreply@github.com>2023-10-16 17:19:15 (GMT)
commitccb1a917b6e68bc51a6a4e3d6783edfa056b01bf (patch)
treeb3a7533bf2f44a30fbf51faafba414e22f6c1cbc
parente158217012646896a9da73d2884dce34c70d2996 (diff)
downloadhdf5-ccb1a917b6e68bc51a6a4e3d6783edfa056b01bf.zip
hdf5-ccb1a917b6e68bc51a6a4e3d6783edfa056b01bf.tar.gz
hdf5-ccb1a917b6e68bc51a6a4e3d6783edfa056b01bf.tar.bz2
Fix printf warnings in t_mpi (#3679)
* Fix printf warnings in t_mpi The type of MPI_Offset varies with implementation. In MPICH, it's long, which raises warnings when we attempt to use long long format specifiers. Casting to long long fixes the warnings.
-rw-r--r--testpar/t_mpi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 70a76ec..eff39d0 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -306,12 +306,14 @@ test_mpio_gb_file(char *filename)
for (i = ntimes - 2; i <= ntimes; i++) {
mpi_off = (i * mpi_size + mpi_rank) * (MPI_Offset)MB;
if (VERBOSE_MED)
- fprintf(stdout, "proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off);
+ fprintf(stdout, "proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, (long long)mpi_off,
+ (long long)mpi_off);
/* set data to some trivial pattern for easy verification */
for (j = 0; j < MB; j++)
*(buf + j) = (int8_t)(i * mpi_size + mpi_rank);
if (VERBOSE_MED)
- fprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB, mpi_off);
+ fprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB,
+ (long long)mpi_off);
mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
INFO((mrc == MPI_SUCCESS), "GB size file write");
if (mrc != MPI_SUCCESS)
@@ -345,7 +347,8 @@ test_mpio_gb_file(char *filename)
for (i = ntimes - 2; i <= ntimes; i++) {
mpi_off = (i * mpi_size + (mpi_size - mpi_rank - 1)) * (MPI_Offset)MB;
if (VERBOSE_MED)
- fprintf(stdout, "proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off);
+ fprintf(stdout, "proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank,
+ (long long)mpi_off, (long long)mpi_off);
mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
INFO((mrc == MPI_SUCCESS), "GB size file read");
expected = (int8_t)(i * mpi_size + (mpi_size - mpi_rank - 1));