open-mpi / ompi

Open MPI main development repository
https://www.open-mpi.org
Other
2.13k stars 858 forks source link

Configuration of openmpi's 2.0.0 romio results in pread and pwrite being added to libmpi #2430

Open ghost opened 7 years ago

ghost commented 7 years ago

The default configuration of romio results in HAVE_DECL_PWRITE on my systems. This results in pread and pwrite being added to the libmpi library (from ompi/mca/io/romio314/romio/adio/common/utils.c). However, when openmpi is used in our code, pread and pwrite are defined. This causes problems when linking, since one would expect to obtain pread and pwrite symbols from glibc, but instead they might come from libmpi.

The openmpi 2.0.0 versions of pread and pwrite are also NOT thread-safe.

ggouaillardet commented 7 years ago

@bryan12345 there are two issues here, so let's focus on the one that impacts you. if i understand correctly, pread and pwrite used by your application are provided by the glibc, so the issue is HAVE_DECL_PWRITE should have been 1 in the first place. did i get it right ?

can you please provide info about your distro, your configure command line and your ompi/mca/io/romio314/romio/config.log ?

dirtyharrycallahan commented 7 years ago

I see something similar. Environment SLES 11 SP4 gcc 4.3.4 autoconf 2.69 automake 1.12.6 libtool 2.4.2

autogen.pl ./configure


configure:22583: checking whether pwrite is declared
configure:22583: gcc -std=gnu99 -c -O3 -DNDEBUG -finline-functions -fno-strict-aliasing -pthread -D__EXTENSIONS__ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -I/home/pcallahan/Downloads/ompi-2.0.1/opal/mca/hwloc/hwloc1112/hwloc/include -I/home/pcallahan/Downloads/ompi-2.0.1/opal/mca/event/libevent2022/libevent -I/home/pcallahan/Downloads
/ompi-2.0.1/opal/mca/event/libevent2022/libevent/include conftest.c >&5
conftest.c: In function 'main':
conftest.c:103: error: 'pwrite' undeclared (first use in this function)
conftest.c:103: error: (Each undeclared identifier is reported only once
conftest.c:103: error: for each function it appears in.)
configure:22583: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "ROMIO"
| #define PACKAGE_TARNAME "romio"
| #define PACKAGE_VERSION "Open MPI"
| #define PACKAGE_STRING "ROMIO Open MPI"
| #define PACKAGE_BUGREPORT "discuss@mpich.org"
| #define PACKAGE_URL "http://www.mpich.org/"
| #define PACKAGE "romio"
| #define VERSION "Open MPI"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_MPI_OFFSET 1
| #define SIZEOF_LONG_LONG 8
| #define HAVE_MEMALIGN 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_TIME_H 1
| #define SIZEOF_INT 4
| #define SIZEOF_VOID_P 8
| #define INT_LT_POINTER 1
| #define HAVE_INT_LT_POINTER 1
| #define SIZEOF_LONG_LONG 8
| #define HAVE_LONG_LONG_64 1
| #define HAVE_MPI_INFO 1
| #define ROMIO_NFS 1
| #define ROMIO_UFS 1
| #define ROMIO_TESTFS 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_STATFS 1
| #define HAVE_STRUCT_STATFS 1
| #define ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STAT 1
| #define HAVE_STAT 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_STATVFS 1
| #define HAVE_STATVFS 1
| #define blksize_t __blksize_t
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #define HAVE_MPI_INFO 1
| #define ROMIO_NFS 1
| #define ROMIO_UFS 1
| #define ROMIO_TESTFS 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_STATFS 1
| #define HAVE_STRUCT_STATFS 1
| #define ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STAT 1
| #define HAVE_STAT 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_STATVFS 1
| #define HAVE_STATVFS 1
| #define blksize_t __blksize_t
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #define HAVE_MPI_INFO 1
| #define ROMIO_NFS 1
| #define ROMIO_UFS 1
| #define ROMIO_TESTFS 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_STATFS 1
| #define HAVE_STRUCT_STATFS 1
| #define ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STAT 1
| #define HAVE_STAT 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_STATVFS 1
| #define HAVE_STATVFS 1
| #define blksize_t __blksize_t
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
| #ifndef pwrite
| #ifdef __cplusplus
|   (void) pwrite;
| #else
|   (void) pwrite;
| #endif
| #endif
| 
|   ;
|   return 0;
| }
configure:22583: result: no
ggouaillardet commented 7 years ago

@dirtyharrycallahan can you please man pwrite on your system, and report which include file, and possibly macros, are required in order to use pwrite ?

ggouaillardet commented 7 years ago

@dirtyharrycallahan from ROMIO configure.ac

# pread and pwrite are useful to ROMIO: if implemented well, they help us avoid
# an extra system call.  But --enable-strict or CFLAGS="--std=c99" does not
# expose this feature.  If we define XOPEN_SOURCE in ROMIO, we cause headaches
# for some versions of lustre, quota.h, and caddr_t.  see if we need to provide
# our own pread/pwrite

AC_CHECK_DECLS([pwrite])

bottom line, you might have to configure with CFLAGS=-DXOPEN_SOURCE or CFLAGS=-DXOPEN_SOURCE=500 and hope it does not break anything

dirtyharrycallahan commented 7 years ago

Out of the office this week so I will set up a vm and get back to you.