Skip to content

Commit

Permalink
romio: promote buf_idx to MPI_Aint pointer
Browse files Browse the repository at this point in the history
buf_idx is used to point to the user buffer in memory, for which int
might not be large enough.

Signed-off-by: Rob Latham <robl@mcs.anl.gov>
  • Loading branch information
wkliao authored and roblatham00 committed Feb 13, 2018
1 parent 10bc33e commit 3a479ab
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 34 deletions.
15 changes: 8 additions & 7 deletions src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,12 @@ void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset
int nprocs,
int *count_my_req_procs_ptr,
int **count_my_req_per_proc_ptr,
ADIOI_Access ** my_req_ptr, int **buf_idx_ptr)
ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr)
/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets?
They are used as memory buffer indices so it seems like the 2G limit is in effect */
{
int *count_my_req_per_proc, count_my_req_procs, *buf_idx;
int *count_my_req_per_proc, count_my_req_procs;
MPI_Aint *buf_idx;
int i, l, proc;
ADIO_Offset fd_len, rem_len, curr_idx, off;
ADIOI_Access *my_req;
Expand All @@ -468,7 +469,7 @@ void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset
I'm allocating memory of size nprocs, so that I can do an
MPI_Alltoall later on.*/

buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int));
buf_idx = (MPI_Aint *) ADIOI_Malloc(nprocs * sizeof(MPI_Aint));
/* buf_idx is relevant only if buftype_is_contig.
buf_idx[i] gives the index into user_buf where data received
from proc. i should be placed. This allows receives to be done
Expand Down Expand Up @@ -547,8 +548,8 @@ void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset

/* for each separate contiguous access from this process */
if (buf_idx[proc] == -1) {
ADIOI_Assert(curr_idx == (int) curr_idx);
buf_idx[proc] = (int) curr_idx;
ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx);
buf_idx[proc] = (MPI_Aint) curr_idx;
}

l = my_req[proc].count;
Expand All @@ -572,8 +573,8 @@ void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset
fd_size, fd_start, fd_end);

if (buf_idx[proc] == -1) {
ADIOI_Assert(curr_idx == (int) curr_idx);
buf_idx[proc] = (int) curr_idx;
ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx);
buf_idx[proc] = (MPI_Aint) curr_idx;
}

l = my_req[proc].count;
Expand Down
2 changes: 1 addition & 1 deletion src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset
int nprocs,
int *count_my_req_procs_ptr,
int **count_my_req_per_proc_ptr,
ADIOI_Access ** my_req_ptr, int **buf_idx_ptr);
ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr);

/*
* ADIOI_Calc_others_req
Expand Down
15 changes: 8 additions & 7 deletions src/mpi/romio/adio/common/ad_aggregate.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * le
int nprocs,
int *count_my_req_procs_ptr,
int **count_my_req_per_proc_ptr,
ADIOI_Access ** my_req_ptr, int **buf_idx_ptr)
ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr)
/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets?
They are used as memory buffer indices so it seems like the 2G limit is in effect */
{
int *count_my_req_per_proc, count_my_req_procs, *buf_idx;
int *count_my_req_per_proc, count_my_req_procs;
MPI_Aint *buf_idx;
int i, l, proc;
ADIO_Offset fd_len, rem_len, curr_idx, off;
ADIOI_Access *my_req;
Expand All @@ -274,7 +275,7 @@ void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * le
I'm allocating memory of size nprocs, so that I can do an
MPI_Alltoall later on.*/

buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int));
buf_idx = (MPI_Aint *) ADIOI_Malloc(nprocs * sizeof(MPI_Aint));
/* buf_idx is relevant only if buftype_is_contig.
buf_idx[i] gives the index into user_buf where data received
from proc. i should be placed. This allows receives to be done
Expand Down Expand Up @@ -350,8 +351,8 @@ void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * le

/* for each separate contiguous access from this process */
if (buf_idx[proc] == -1) {
ADIOI_Assert(curr_idx == (int) curr_idx);
buf_idx[proc] = (int) curr_idx;
ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx);
buf_idx[proc] = (MPI_Aint) curr_idx;
}

l = my_req[proc].count;
Expand All @@ -375,8 +376,8 @@ void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * le
fd_size, fd_start, fd_end);

if (buf_idx[proc] == -1) {
ADIOI_Assert(curr_idx == (int) curr_idx);
buf_idx[proc] = (int) curr_idx;
ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx);
buf_idx[proc] = (MPI_Aint) curr_idx;
}

l = my_req[proc].count;
Expand Down
8 changes: 4 additions & 4 deletions src/mpi/romio/adio/common/ad_iread_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ADIOI_GEN_IreadStridedColl_vars {
ADIO_Offset *fd_end;
ADIO_Offset *end_offsets;
ADIO_Offset *len_list;
int *buf_idx;
MPI_Aint *buf_idx;
};

/* ADIOI_Iread_and_exch */
Expand All @@ -82,7 +82,7 @@ struct ADIOI_Iread_and_exch_vars {
ADIO_Offset fd_size;
ADIO_Offset *fd_start;
ADIO_Offset *fd_end;
int *buf_idx;
MPI_Aint *buf_idx;

/* stack variables */
int m;
Expand Down Expand Up @@ -143,7 +143,7 @@ struct ADIOI_R_Iexchange_data_vars {
ADIOI_Access *others_req;
int iter;
MPI_Aint buftype_extent;
int *buf_idx;
MPI_Aint *buf_idx;

/* stack variables */
int nprocs_recv;
Expand Down Expand Up @@ -998,7 +998,7 @@ static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request * nbc_req, int *error_
int myrank = vars->myrank;
ADIOI_Access *others_req = vars->others_req;
int iter = vars->iter;
int *buf_idx = vars->buf_idx;
MPI_Aint *buf_idx = vars->buf_idx;

int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send;
char **recv_buf = NULL;
Expand Down
8 changes: 4 additions & 4 deletions src/mpi/romio/adio/common/ad_iwrite_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct ADIOI_GEN_IwriteStridedColl_vars {
ADIO_Offset *fd_start;
ADIO_Offset *fd_end;
ADIO_Offset *end_offsets;
int *buf_idx;
MPI_Aint *buf_idx;
ADIO_Offset *len_list;
int old_error;
int tmp_error;
Expand All @@ -83,7 +83,7 @@ struct ADIOI_Iexch_and_write_vars {
ADIO_Offset fd_size;
ADIO_Offset *fd_start;
ADIO_Offset *fd_end;
int *buf_idx;
MPI_Aint *buf_idx;

/* stack variables */
/* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */
Expand Down Expand Up @@ -153,7 +153,7 @@ struct ADIOI_W_Iexchange_data_vars {
int *hole;
int iter;
MPI_Aint buftype_extent;
int *buf_idx;
MPI_Aint *buf_idx;

/* stack variables */
int nprocs_recv;
Expand Down Expand Up @@ -1154,7 +1154,7 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request * nbc_req, int *error_
int nprocs = vars->nprocs;
int myrank = vars->myrank;
int iter = vars->iter;
int *buf_idx = vars->buf_idx;
MPI_Aint *buf_idx = vars->buf_idx;

int nprocs_recv = vars->nprocs_recv;
MPI_Datatype *recv_types = vars->recv_types;
Expand Down
10 changes: 5 additions & 5 deletions src/mpi/romio/adio/common/ad_read_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
ADIO_Offset
min_st_offset, ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
int *buf_idx, int *error_code);
MPI_Aint * buf_idx, int *error_code);
static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
* flat_buf, ADIO_Offset * offset_list, ADIO_Offset
* len_list, int *send_size, int *recv_size,
Expand All @@ -37,7 +37,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
ADIOI_Access * others_req,
int iter, MPI_Aint buftype_extent, int *buf_idx);
int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx);
void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
* flat_buf, char **recv_buf, ADIO_Offset
* offset_list, ADIO_Offset * len_list,
Expand Down Expand Up @@ -76,7 +76,7 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count,
ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL,
*fd_end = NULL, *end_offsets = NULL;
ADIO_Offset *len_list = NULL;
int *buf_idx = NULL;
MPI_Aint *buf_idx = NULL;

#ifdef HAVE_STATUS_SET_BYTES
MPI_Count bufsize, size;
Expand Down Expand Up @@ -487,7 +487,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
ADIO_Offset * len_list, int contig_access_count, ADIO_Offset
min_st_offset, ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
int *buf_idx, int *error_code)
MPI_Aint * buf_idx, int *error_code)
{
/* Read in sizes of no more than coll_bufsize, an info parameter.
Send data to appropriate processes.
Expand Down Expand Up @@ -766,7 +766,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
ADIO_Offset min_st_offset, ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
ADIOI_Access * others_req,
int iter, MPI_Aint buftype_extent, int *buf_idx)
int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx)
{
int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send;
char **recv_buf = NULL;
Expand Down
10 changes: 5 additions & 5 deletions src/mpi/romio/adio/common/ad_write_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
ADIO_Offset * len_list, int contig_access_count, ADIO_Offset
min_st_offset, ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
int *buf_idx, int *error_code);
MPI_Aint * buf_idx, int *error_code);
static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
ADIOI_Flatlist_node * flat_buf, ADIO_Offset
* offset_list, ADIO_Offset * len_list, int *send_size,
Expand All @@ -34,7 +34,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
ADIOI_Access * others_req,
int *send_buf_idx, int *curr_to_proc,
int *done_to_proc, int *hole, int iter,
MPI_Aint buftype_extent, int *buf_idx, int *error_code);
MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code);
void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
* flat_buf, char **send_buf, ADIO_Offset
* offset_list, ADIO_Offset * len_list, int *send_size,
Expand Down Expand Up @@ -75,7 +75,7 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count,
ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off;
ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL,
*fd_end = NULL, *end_offsets = NULL;
int *buf_idx = NULL;
MPI_Aint *buf_idx = NULL;
ADIO_Offset *len_list = NULL;
int old_error, tmp_error;

Expand Down Expand Up @@ -285,7 +285,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
ADIO_Offset * len_list, int contig_access_count,
ADIO_Offset min_st_offset, ADIO_Offset fd_size,
ADIO_Offset * fd_start, ADIO_Offset * fd_end,
int *buf_idx, int *error_code)
MPI_Aint * buf_idx, int *error_code)
{
/* Send data to appropriate processes and write in sizes of no more
than coll_bufsize.
Expand Down Expand Up @@ -556,7 +556,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
ADIOI_Access * others_req,
int *send_buf_idx, int *curr_to_proc,
int *done_to_proc, int *hole, int iter,
MPI_Aint buftype_extent, int *buf_idx, int *error_code)
MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code)
{
int i, j, k, *tmp_len, nprocs_recv, nprocs_send, err;
char **send_buf = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/mpi/romio/adio/include/adioi.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list,
int nprocs,
int *count_my_req_procs_ptr,
int **count_my_req_per_proc_ptr,
ADIOI_Access ** my_req_ptr, int **buf_idx_ptr);
ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr);
void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs,
int *count_my_req_per_proc,
ADIOI_Access * my_req,
Expand Down

0 comments on commit 3a479ab

Please sign in to comment.