Skip to content

Commit

Permalink
Merge pull request open-mpi#5 from markalle/romio341_refresh_mpich_ad…
Browse files Browse the repository at this point in the history
…ditions

mpich additions for Romio341 refresh
  • Loading branch information
ggouaillardet authored Apr 14, 2021
2 parents 078ba8b + d6998de commit 69db1c9
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 60 deletions.
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_gpfs/ad_gpfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#ifndef AD_GPFS_H_INCLUDED
#define AD_GPFS_H_INCLUDED

#include "adio.h"
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include "adio.h"

#ifdef HAVE_SIGNAL_H
#include <signal.h>
Expand Down
1 change: 1 addition & 0 deletions 3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs,
} else {
others_req[i].count = 0;
others_req[i].offsets = NULL;
others_req[i].mem_ptrs = NULL;
others_req[i].lens = NULL;
}
}
Expand Down
8 changes: 6 additions & 2 deletions 3rd-party/romio341/adio/ad_gpfs/ad_gpfs_rdcoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,12 @@ void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
GPFSMPIO_T_CIO_REPORT(0, fd, myrank, nprocs);

/* free all memory allocated for collective I/O */
ADIOI_Free(others_req[0].offsets);
ADIOI_Free(others_req[0].mem_ptrs);
if (others_req[0].offsets) {
ADIOI_Free(others_req[0].offsets);
}
if (others_req[0].mem_ptrs) {
ADIOI_Free(others_req[0].mem_ptrs);
}
ADIOI_Free(others_req);

ADIOI_Free(buf_idx);
Expand Down
12 changes: 8 additions & 4 deletions 3rd-party/romio341/adio/ad_gpfs/ad_gpfs_wrcoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count,
ADIOI_OneSidedWriteAggregation(fd, offset_list, len_list, contig_access_count, buf,
datatype, error_code, firstFileOffset, lastFileOffset,
currentValidDataIndex, fd_start, fd_end, &holeFound,
noStripeParms);
&noStripeParms);
romio_onesided_no_rmw = prev_romio_onesided_no_rmw;
GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs);
ADIOI_Free(offset_list);
Expand Down Expand Up @@ -447,8 +447,12 @@ void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count,
GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs);

/* free all memory allocated for collective I/O */
ADIOI_Free(others_req[0].offsets);
ADIOI_Free(others_req[0].mem_ptrs);
if (others_req[0].offsets) {
ADIOI_Free(others_req[0].offsets);
}
if (others_req[0].mem_ptrs) {
ADIOI_Free(others_req[0].mem_ptrs);
}
ADIOI_Free(others_req);

ADIOI_Free(buf_idx);
Expand Down Expand Up @@ -1541,7 +1545,7 @@ static void ADIOI_W_Exchange_data_alltoallv(ADIO_File fd, const void *buf, char
for (i = 0; i < nprocs; i++) {
if (send_size[i]) {
sbuf_ptr = all_send_buf + sdispls[i];
memcpy(sbuf_ptr, buf + buf_idx[i], send_size[i]);
memcpy(sbuf_ptr, (char *) buf + buf_idx[i], send_size[i]);
buf_idx[i] += send_size[i];
}
}
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_lustre/ad_lustre.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* temp*/
#define HAVE_ASM_TYPES_H 1

#include "adio.h"
#define _GNU_SOURCE 1
#include <stdlib.h>
#include <sys/types.h>
Expand All @@ -30,7 +31,6 @@

#include <sys/ioctl.h>

#include "adio.h"
#include "ad_tuning.h"

#ifdef HAVE_LUSTRE_LUSTRE_USER_H
Expand Down
28 changes: 17 additions & 11 deletions 3rd-party/romio341/adio/ad_lustre/ad_lustre_wrstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, \
&status1, error_code); \
if (!(fd->atomicity)) \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (*error_code != MPI_SUCCESS) { \
*error_code = MPIO_Err_create_code(*error_code, \
Expand All @@ -30,7 +30,7 @@
writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
(writebuf_off / stripe_size + 1) * \
stripe_size - writebuf_off); \
if (!(fd->atomicity)) \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, \
Expand All @@ -53,7 +53,7 @@
while (write_sz != req_len) { \
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
if (!(fd->atomicity)) \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (*error_code != MPI_SUCCESS) { \
*error_code = MPIO_Err_create_code(*error_code, \
Expand All @@ -70,7 +70,7 @@
writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
(writebuf_off / stripe_size + 1) * \
stripe_size - writebuf_off); \
if (!(fd->atomicity)) \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, \
Expand Down Expand Up @@ -213,8 +213,9 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
writebuf_off = 0;
writebuf_len = 0;

/* if atomicity is true, lock the region to be accessed */
if (fd->atomicity)
/* if atomicity is true or data sieving is not disable, lock the region
* to be accessed */
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, bufsize);

for (j = 0; j < count; j++) {
Expand All @@ -231,7 +232,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE,
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code);

if (fd->atomicity)
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, start_off, SEEK_SET, bufsize);
if (*error_code != MPI_SUCCESS) {
ADIOI_Free(writebuf);
Expand Down Expand Up @@ -311,8 +312,12 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
userbuf_off = 0;
ADIOI_BUFFERED_WRITE_WITHOUT_READ;
/* write the buffer out finally */
if (fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len);
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE,
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code);
if (fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len);

if (file_ptr_type == ADIO_INDIVIDUAL) {
/* update MPI-IO file pointer to point to the first byte
Expand Down Expand Up @@ -362,8 +367,9 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset);
}

/* if atomicity is true, lock the region to be accessed */
if (fd->atomicity)
/* if atomicity is true or data sieving is not disable, lock the region
* to be accessed */
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

writebuf_off = 0;
Expand Down Expand Up @@ -481,12 +487,12 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
if (writebuf_len) {
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE,
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code);
if (!(fd->atomicity))
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len);
if (*error_code != MPI_SUCCESS)
return;
}
if (fd->atomicity)
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

ADIOI_Free(writebuf);
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_panfs/ad_panfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef AD_PANFS_H_INCLUDED
#define AD_PANFS_H_INCLUDED

#include "adio.h"
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include "adio.h"

#ifndef NO_AIO
#ifdef AIO_SUN
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_dtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* See COPYRIGHT in top-level directory
*/

#include <assert.h>
#include "adio.h"
#include <assert.h>
#include "adio_extern.h"
#include "ad_pvfs2.h"
#include "ad_pvfs2_io.h"
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* See COPYRIGHT in top-level directory
*/

#include <assert.h>
#include "adio.h"
#include <assert.h>
#include "adio_extern.h"
#include "ad_pvfs2.h"
#include "ad_pvfs2_io.h"
Expand Down
2 changes: 1 addition & 1 deletion 3rd-party/romio341/adio/ad_xfs/ad_xfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef AD_XFS_H_INCLUDED
#define AD_XFS_H_INCLUDED

#include "adio.h"
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include "adio.h"

#if defined(MPISGI)
#include "xfs/xfs_fs.h"
Expand Down
13 changes: 13 additions & 0 deletions 3rd-party/romio341/adio/common/ad_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs
if (mysize == 0)
*st_offset = 0;

MPI_Aint ex;
MPI_Type_extent(type_old, &ex);
MPI_Datatype type_tmp;
MPI_Type_create_resized(*type_new, 0, array_of_gsizes[dim] * ex, &type_tmp);
MPI_Type_free(type_new);
*type_new = type_tmp;

return MPI_SUCCESS;
}

Expand Down Expand Up @@ -293,5 +300,11 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
if (local_size == 0)
*st_offset = 0;

MPI_Aint ex;
MPI_Type_extent(type_old, &ex);
MPI_Type_create_resized(*type_new, 0, array_of_gsizes[dim] * ex, &type_tmp);
MPI_Type_free(type_new);
*type_new = type_tmp;

return MPI_SUCCESS;
}
30 changes: 19 additions & 11 deletions 3rd-party/romio341/adio/common/ad_write_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
if (writebuf_len) { \
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (*error_code != MPI_SUCCESS) { \
*error_code = MPIO_Err_create_code(*error_code, \
MPIR_ERR_RECOVERABLE, myname, \
Expand All @@ -23,7 +24,8 @@
} \
writebuf_off = req_off; \
writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \
if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
if (*error_code != MPI_SUCCESS) { \
Expand All @@ -40,7 +42,8 @@
while (write_sz != req_len) { \
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (*error_code != MPI_SUCCESS) { \
*error_code = MPIO_Err_create_code(*error_code, \
MPIR_ERR_RECOVERABLE, myname, \
Expand All @@ -52,7 +55,8 @@
userbuf_off += write_sz; \
writebuf_off += writebuf_len; \
writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \
if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
if (*error_code != MPI_SUCCESS) { \
Expand Down Expand Up @@ -184,8 +188,9 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
writebuf = (char *) ADIOI_Malloc(max_bufsize);
writebuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset - writebuf_off + 1));

/* if atomicity is true, lock the region to be accessed */
if (fd->atomicity)
/* if atomicity is true or data sieving is not disable, lock the region
* to be accessed */
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

for (j = 0; j < count; j++) {
Expand All @@ -204,7 +209,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
writebuf_off, &status1, error_code);
}

if (fd->atomicity)
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

if (*error_code != MPI_SUCCESS)
Expand Down Expand Up @@ -280,8 +285,10 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
* datatypes, instead of a count of bytes (which might overflow)
* Other WriteContig calls in this path are operating on data
* sieving buffer */
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, bufsize);
ADIO_WriteContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
offset, status, error_code);
ADIOI_UNLOCK(fd, offset, SEEK_SET, bufsize);

if (file_ptr_type == ADIO_INDIVIDUAL) {
/* update MPI-IO file pointer to point to the first byte
Expand Down Expand Up @@ -330,8 +337,9 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset);
}

/* if atomicity is true, lock the region to be accessed */
if (fd->atomicity)
/* if atomicity is true or data sieving is not disable, lock the region
* to be accessed */
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

writebuf_off = 0;
Expand Down Expand Up @@ -451,12 +459,12 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
if (writebuf_len) {
ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
writebuf_off, &status1, error_code);
if (!(fd->atomicity))
if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len);
if (*error_code != MPI_SUCCESS)
goto fn_exit;
}
if (fd->atomicity)
if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE)
ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);

if (file_ptr_type == ADIO_INDIVIDUAL)
Expand Down
Loading

0 comments on commit 69db1c9

Please sign in to comment.