Skip to content

Commit 92f6c7c

Browse files
committed
ROMIO 3.1.4 refresh: apply post romio-3.1.4 patches
1 parent 6400bc7 commit 92f6c7c

File tree

9 files changed

+60
-22
lines changed

9 files changed

+60
-22
lines changed

ompi/mca/io/romio314/romio/adio/ad_lustre/ad_lustre_rwcontig.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
* Copyright (C) 2008 Sun Microsystems, Lustre group
99
*/
1010

11-
#ifdef _STDC_C99
12-
#define _XOPEN_SOURCE 600
13-
#else
14-
#define _XOPEN_SOURCE 500
15-
#endif
1611
#include <unistd.h>
1712

1813
#include <stdlib.h>

ompi/mca/io/romio314/romio/adio/ad_pvfs2/ad_pvfs2_aio.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count,
121121
}
122122
/* --END ERROR HANDLING-- */
123123

124+
#ifdef HAVE_MPI_GREQUEST_EXTENSIONS
124125
/* posted. defered completion */
125126
if (ret == 0) {
126127
if (ADIOI_PVFS2_greq_class == 0) {
@@ -132,6 +133,15 @@ void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count,
132133
MPIX_Grequest_class_allocate(ADIOI_PVFS2_greq_class, aio_req, request);
133134
memcpy(&(aio_req->req), request, sizeof(*request));
134135
}
136+
#else
137+
/* if generalized request extensions not available, we will have to process
138+
* this operation right here */
139+
int error;
140+
ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_AIO_Contig", &error);
141+
if (ret == 0) {
142+
MPIO_Completed_request_create(&fd, len, error_code, request);
143+
}
144+
#endif
135145

136146
/* immediate completion */
137147
if (ret == 1) {

ompi/mca/io/romio314/romio/adio/ad_xfs/ad_xfs.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
#ifndef AD_XFS_INCLUDE
99
#define AD_XFS_INCLUDE
1010

11-
#ifdef _STDC_C99
12-
#define _XOPEN_SOURCE 600
13-
#else
14-
#define _XOPEN_SOURCE 500
15-
#endif
1611
#include <unistd.h>
1712
#include <sys/types.h>
1813
#include <fcntl.h>

ompi/mca/io/romio314/romio/adio/common/ad_read.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
*/
77

88

9-
#ifdef _STDC_C99
10-
#define _XOPEN_SOURCE 600
11-
#else
12-
#define _XOPEN_SOURCE 500
13-
#endif
149
#include <unistd.h>
1510

1611
#include "adio.h"

ompi/mca/io/romio314/romio/adio/common/ad_write.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
*/
77

88

9-
#ifdef _STDC_C99
10-
#define _XOPEN_SOURCE 600
11-
#else
12-
#define _XOPEN_SOURCE 500
13-
#endif
149
#include <unistd.h>
1510

1611
#include "adio.h"

ompi/mca/io/romio314/romio/adio/common/utils.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <adio.h>
99
#include <limits.h>
1010

11-
1211
/* utility function for creating large contiguous types: algorithim from BigMPI
1312
* https://github.com/jeffhammond/BigMPI */
1413

@@ -105,6 +104,35 @@ int ADIOI_Type_create_hindexed_x(int count,
105104
return ret;
106105
}
107106

107+
/* some systems do not have pread/pwrite, or requrie XOPEN_SOURCE set higher
108+
* than we would like. see #1973 */
109+
#if (HAVE_DECL_PWRITE == 0)
110+
111+
#include <sys/types.h>
112+
#include <unistd.h>
113+
114+
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
115+
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
116+
117+
ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
118+
off_t lseek_ret;
119+
120+
lseek_ret = lseek(fd, offset, SEEK_SET);
121+
if (lseek_ret == -1)
122+
return lseek_ret;
123+
return (read(fd, buf, count));
124+
}
125+
126+
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
127+
off_t lseek_ret;
128+
129+
lseek_ret = lseek(fd, offset, SEEK_SET);
130+
if (lseek_ret == -1)
131+
return lseek_ret;
132+
return (write(fd, buf, count));
133+
}
134+
#endif
135+
108136
/*
109137
* vim: ts=8 sts=4 sw=4 noexpandtab
110138
*/

ompi/mca/io/romio314/romio/adio/include/adioi.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,3 +916,10 @@ void *ADIOI_IO_Thread_Func(void *vptr_args);
916916

917917
#endif
918918

919+
920+
#if (HAVE_DECL_PWRITE == 0)
921+
#include <sys/types.h>
922+
#include <unistd.h>
923+
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
924+
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
925+
#endif

ompi/mca/io/romio314/romio/configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,14 @@ if test "$ac_cv_header_unistd_h" = "yes" ; then
14761476
fi
14771477
fi
14781478
1479+
# pread and pwrite are useful to ROMIO: if implemented well, they help us avoid
1480+
# an extra system call. But --enable-strict or CFLAGS="--std=c99" does not
1481+
# expose this feature. If we define XOPEN_SOURCE in ROMIO, we cause headaches
1482+
# for some versions of lustre, quota.h, and caddr_t. see if we need to provide
1483+
# our own pread/pwrite
1484+
1485+
AC_CHECK_DECLS([pwrite])
1486+
14791487
14801488
####################################################################
14811489
# We're about to mess with CC etc. No more feature tests past here,

ompi/mca/io/romio314/romio/mpi-io/mpioimpl.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
of correct programs */
3737
#define MPIU_THREAD_CS_ENTER(x,y)
3838
#define MPIU_THREAD_CS_EXIT(x,y)
39-
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0)
39+
/* The MPI_DATATYPE_ISCOMMITTED macro now always sets err_=0.
40+
This is an optimistic approach for Open MPI, but it is likely other
41+
upper layers already checked the datatype was committed.
42+
Not setting err_ is incorrect since it can lead to use of
43+
uninitialized variable.*/
44+
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do { err_ = 0; } while (0)
4045
#ifdef HAVE_WINDOWS_H
4146
#define MPIU_UNREFERENCED_ARG(a) a
4247
#else

0 commit comments

Comments
 (0)