Skip to content

Commit c0f8ce0

Browse files
committed
common/ompio: fix a floating point division problem
This commit fixes a problem reported on the mailing list with individual writes larger than 512 MB. The culprit is a floating point division of two large, close values. Changing the datatypes from float to double (which is what is being used in the fcoll components) fixes the problem. See issue #6285 and https://forum.hdfgroup.org/t/cannot-write-more-than-512-mb-in-1d/5118 Thanks for Axel Huebl and René Widera for reporting the issue. Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
1 parent 352b667 commit c0f8ce0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ompi/mca/common/ompio/common_ompio_file_read.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
1313
* Copyright (c) 2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
@@ -33,8 +33,8 @@
3333

3434
#include "common_ompio.h"
3535
#include "common_ompio_request.h"
36-
#include "math.h"
3736
#include <unistd.h>
37+
#include <math.h>
3838

3939
#if OPAL_CUDA_SUPPORT
4040
#include "common_ompio_cuda.h"
@@ -132,8 +132,8 @@ int mca_common_ompio_file_read (ompio_file_t *fh,
132132
else {
133133
bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size);
134134
}
135-
cycles = ceil((float)max_data/bytes_per_cycle);
136-
135+
cycles = ceil((double)max_data/bytes_per_cycle);
136+
137137
#if 0
138138
printf ("Bytes per Cycle: %d Cycles: %d max_data:%d \n",bytes_per_cycle, cycles, max_data);
139139
#endif

ompi/mca/common/ompio/common_ompio_file_write.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
@@ -31,8 +31,8 @@
3131

3232
#include "common_ompio.h"
3333
#include "common_ompio_request.h"
34-
#include "math.h"
3534
#include <unistd.h>
35+
#include <math.h>
3636

3737
#if OPAL_CUDA_SUPPORT
3838
#include "common_ompio_cuda.h"
@@ -116,7 +116,7 @@ int mca_common_ompio_file_write (ompio_file_t *fh,
116116
else {
117117
bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size);
118118
}
119-
cycles = ceil((float)max_data/bytes_per_cycle);
119+
cycles = ceil((double)max_data/bytes_per_cycle);
120120

121121
#if 0
122122
printf ("Bytes per Cycle: %d Cycles: %d\n", bytes_per_cycle, cycles);
@@ -409,7 +409,7 @@ int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp,
409409
/**************************************************************/
410410

411411
int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
412-
size_t bytes_per_cycle, int max_data, uint32_t iov_count,
412+
size_t bytes_per_cycle, int max_data, uint32_t iov_count,
413413
struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw,
414414
size_t *spc)
415415
{

0 commit comments

Comments
 (0)