Commit 1b778bd8 authored by thakur's avatar thakur
Browse files

fixed bug reported by Wei-keng, romio req 887

parent cf54e011
......@@ -368,7 +368,7 @@ void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs,
int *count_others_req_per_proc, count_others_req_procs;
int i, j;
MPI_Request *send_requests, *recv_requests;
MPI_Request *requests;
MPI_Status *statuses;
ADIOI_Access *others_req;
......@@ -400,46 +400,41 @@ void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs,
/* now send the calculated offsets and lengths to respective processes */
send_requests = (MPI_Request *)
ADIOI_Malloc(2*(count_my_req_procs+1)*sizeof(MPI_Request));
recv_requests = (MPI_Request *)
ADIOI_Malloc(2*(count_others_req_procs+1)*sizeof(MPI_Request));
requests = (MPI_Request *)
ADIOI_Malloc(1+2*(count_my_req_procs+count_others_req_procs)*sizeof(MPI_Request));
/* +1 to avoid a 0-size malloc */
j = 0;
for (i=0; i<nprocs; i++) {
if (others_req[i].count) {
MPI_Irecv(others_req[i].offsets, others_req[i].count,
ADIO_OFFSET, i, i+myrank, fd->comm, &recv_requests[j]);
ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]);
j++;
MPI_Irecv(others_req[i].lens, others_req[i].count,
MPI_INT, i, i+myrank+1, fd->comm, &recv_requests[j]);
MPI_INT, i, i+myrank+1, fd->comm, &requests[j]);
j++;
}
}
j = 0;
for (i=0; i < nprocs; i++) {
if (my_req[i].count) {
MPI_Isend(my_req[i].offsets, my_req[i].count,
ADIO_OFFSET, i, i+myrank, fd->comm, &send_requests[j]);
ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]);
j++;
MPI_Isend(my_req[i].lens, my_req[i].count,
MPI_INT, i, i+myrank+1, fd->comm, &send_requests[j]);
MPI_INT, i, i+myrank+1, fd->comm, &requests[j]);
j++;
}
}
statuses = (MPI_Status *) ADIOI_Malloc((1 + 2* \
ADIOI_MAX(count_my_req_procs,count_others_req_procs)) * \
(count_my_req_procs+count_others_req_procs)) * \
sizeof(MPI_Status));
/* +1 to avoid a 0-size malloc */
MPI_Waitall(2*count_my_req_procs, send_requests, statuses);
MPI_Waitall(2*count_others_req_procs, recv_requests, statuses);
MPI_Waitall(j, requests, statuses);
ADIOI_Free(send_requests);
ADIOI_Free(recv_requests);
ADIOI_Free(requests);
ADIOI_Free(statuses);
ADIOI_Free(count_others_req_per_proc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment