Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ompi/mca/common/ompio/common_ompio_file_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
Expand All @@ -33,8 +33,8 @@

#include "common_ompio.h"
#include "common_ompio_request.h"
#include "math.h"
#include <unistd.h>
#include <math.h>

#if OPAL_CUDA_SUPPORT
#include "common_ompio_cuda.h"
Expand Down Expand Up @@ -132,8 +132,8 @@ int mca_common_ompio_file_read (ompio_file_t *fh,
else {
bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size);
}
cycles = ceil((float)max_data/bytes_per_cycle);

cycles = ceil((double)max_data/bytes_per_cycle);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't change it from

ceil((float)max_data/bytes_per_cycle;
// to
ceil((double)max_data/bytes_per_cycle;

which only defers the issue.
Instead, just cast both max_data and bytes_per_cycle to uint64_t to be platform agnostic and convert it to an "integer-ceil" via:

(max_data + bytes_per_cycle - 1) / bytes_per_cycle

#if 0
printf ("Bytes per Cycle: %d Cycles: %d max_data:%d \n",bytes_per_cycle, cycles, max_data);
#endif
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/common/ompio/common_ompio_file_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
Expand All @@ -31,8 +31,8 @@

#include "common_ompio.h"
#include "common_ompio_request.h"
#include "math.h"
#include <unistd.h>
#include <math.h>

#if OPAL_CUDA_SUPPORT
#include "common_ompio_cuda.h"
Expand Down Expand Up @@ -116,7 +116,7 @@ int mca_common_ompio_file_write (ompio_file_t *fh,
else {
bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size);
}
cycles = ceil((float)max_data/bytes_per_cycle);
cycles = ceil((double)max_data/bytes_per_cycle);

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

int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
size_t bytes_per_cycle, int max_data, uint32_t iov_count,
size_t bytes_per_cycle, int max_data, uint32_t iov_count,
struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw,
size_t *spc)
{
Expand Down