Skip to content

Commit eaf0828

Browse files
authored
Merge pull request #7104 from edgargabriel/topic/gpfs
Topic/gpfs
2 parents 25aa2b9 + 7b2d83c commit eaf0828

25 files changed

+1379
-284
lines changed

config/ompi_check_gpfs.m4

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
dnl -*- shell-script -*-
2+
dnl
3+
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
dnl University Research and Technology
5+
dnl Corporation. All rights reserved.
6+
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7+
dnl of Tennessee Research Foundation. All rights
8+
dnl reserved.
9+
dnl Copyright (c) 2004-2018 High Performance Computing Center Stuttgart,
10+
dnl University of Stuttgart. All rights reserved.
11+
dnl Copyright (c) 2004-2006 The Regents of the University of California.
12+
dnl All rights reserved.
13+
dnl Copyright (c) 2018 University of Houston. All rights reserved.
14+
dnl $COPYRIGHT$
15+
dnl
16+
dnl Additional copyrights may follow
17+
dnl
18+
dnl $HEADER$
19+
dnl
20+
21+
# OMPI_CHECK_GPFS(prefix, [action-if-found], [action-if-not-found])
22+
# --------------------------------------------------------
23+
# check if GPFS support can be found. sets prefix_{CPPFLAGS,
24+
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
25+
# support, otherwise executes action-if-not-found
26+
AC_DEFUN([OMPI_CHECK_GPFS],[
27+
28+
check_gpfs_CPPFLAGS=
29+
check_gpfs_LDFLAGS=
30+
check_gpfs_LIBS=
31+
32+
check_gpfs_save_LIBS="$LIBS"
33+
check_gpfs_save_LDFLAGS="$LDFLAGS"
34+
check_gpfs_save_CPPFLAGS="$CPPFLAGS"
35+
36+
check_gpfs_configuration="none"
37+
ompi_check_gpfs_happy="yes"
38+
39+
# Get some configuration information
40+
AC_ARG_WITH([gpfs],
41+
[AC_HELP_STRING([--with-gpfs(=DIR)],
42+
[Build Gpfs support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
43+
OPAL_CHECK_WITHDIR([gpfs], [$with_gpfs], [include/gpfs.h])
44+
45+
AS_IF([test "$with_gpfs" = "no"],
46+
[ompi_check_gpfs_happy="no"],
47+
[AS_IF([test -z "$with_gpfs" || test "$with_gpfs" = "yes"],
48+
[ompi_check_gpfs_dir="/usr"],
49+
[ompi_check_gpfs_dir=$with_gpfs])
50+
51+
if test -e "$ompi_check_gpfs_dir/lib64" ; then
52+
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib64"
53+
else
54+
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib"
55+
fi
56+
57+
# Add correct -I and -L flags
58+
OPAL_CHECK_PACKAGE([$1], [gpfs.h], [gpfs], [gpfs_lib_init],
59+
[], [$ompi_check_gpfs_dir], [$ompi_check_gpfs_libdir],
60+
[ompi_check_gpfs_happy="yes"],
61+
[ompi_check_gpfs_happy="no"])
62+
])
63+
64+
AS_IF([test "$ompi_check_gpfs_happy" = "yes"],
65+
[$2],
66+
[AS_IF([test ! -z "$with_gpfs" && test "$with_gpfs" != "no"],
67+
[AC_MSG_ERROR([GPFS support requested but not found. Aborting])])
68+
$3])
69+
])

ompi/mca/common/ompio/common_ompio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ enum ompio_fs_type
107107
PVFS2 = 2,
108108
LUSTRE = 3,
109109
PLFS = 4,
110-
IME = 5
110+
IME = 5,
111+
GPFS = 6
111112
};
112113

113114
typedef struct mca_common_ompio_io_array_t {

ompi/mca/fs/base/base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ OMPI_DECLSPEC int mca_fs_base_init_file (struct ompio_file_t *file);
5252
OMPI_DECLSPEC int mca_fs_base_get_param (struct ompio_file_t *file, int keyval);
5353
OMPI_DECLSPEC void mca_fs_base_get_parent_dir (char *filename, char **dirnamep);
5454
OMPI_DECLSPEC int mca_fs_base_get_fstype(char *fname);
55+
OMPI_DECLSPEC int mca_fs_base_get_mpi_err(int errno_val);
56+
OMPI_DECLSPEC int mca_fs_base_get_file_perm(ompio_file_t *fh);
57+
OMPI_DECLSPEC int mca_fs_base_get_file_amode(int rank, int access_mode);
5558

5659
OMPI_DECLSPEC int mca_fs_base_file_delete (char* file_name, struct opal_info_t *info);
5760
OMPI_DECLSPEC int mca_fs_base_file_sync (ompio_file_t *fh);

ompi/mca/fs/base/fs_base_get_parent_dir.c

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,89 @@ int mca_fs_base_get_fstype(char *fname )
135135
else if ( 0 == strncasecmp(fstype, "ime", sizeof("ime"))) {
136136
ompio_type = IME;
137137
}
138+
else if ( 0 == strncasecmp(fstype, "gpfs", sizeof("gpfs"))) {
139+
ompio_type = GPFS;
140+
}
138141

139142
free (fstype);
140143
return ompio_type;
141144
}
142145

146+
int mca_fs_base_get_mpi_err(int errno_val)
147+
{
148+
int ret;
149+
switch (errno_val) {
150+
case EACCES:
151+
ret = MPI_ERR_ACCESS;
152+
break;
153+
case ENAMETOOLONG:
154+
case EISDIR:
155+
ret = MPI_ERR_BAD_FILE;
156+
break;
157+
case ENOENT:
158+
ret = MPI_ERR_NO_SUCH_FILE;
159+
break;
160+
case EROFS:
161+
ret = MPI_ERR_READ_ONLY;
162+
break;
163+
case EEXIST:
164+
ret = MPI_ERR_FILE_EXISTS;
165+
break;
166+
case ENOSPC:
167+
ret = MPI_ERR_NO_SPACE;
168+
break;
169+
case EDQUOT:
170+
ret = MPI_ERR_QUOTA;
171+
break;
172+
case ETXTBSY:
173+
ret = MPI_ERR_FILE_IN_USE;
174+
break;
175+
case EBADF:
176+
ret = MPI_ERR_FILE;
177+
break;
178+
default:
179+
ret = MPI_ERR_OTHER;
180+
break;
181+
}
182+
return ret;
183+
}
184+
185+
int mca_fs_base_get_file_perm(ompio_file_t *fh)
186+
{
187+
int old_mask;
188+
int perm = fh->f_perm;
189+
190+
if (OMPIO_PERM_NULL == perm) {
191+
old_mask = umask(022);
192+
umask(old_mask);
193+
perm = old_mask ^ 0666;
194+
}
195+
return perm;
196+
}
197+
198+
int mca_fs_base_get_file_amode(int rank, int access_mode)
199+
{
200+
int amode = 0;
201+
202+
if (access_mode & MPI_MODE_RDONLY) {
203+
amode = amode | O_RDONLY;
204+
}
205+
if (access_mode & MPI_MODE_WRONLY) {
206+
amode = amode | O_WRONLY;
207+
}
208+
if (access_mode & MPI_MODE_RDWR) {
209+
amode = amode | O_RDWR;
210+
}
211+
212+
/* MODE_CREATE and MODE_EXCL should only be set by one process */
213+
if(OMPIO_ROOT == rank) {
214+
if (access_mode & MPI_MODE_CREATE) {
215+
amode = amode | O_CREAT;
216+
}
217+
if (access_mode & MPI_MODE_EXCL) {
218+
amode = amode | O_EXCL;
219+
}
220+
}
221+
222+
return amode;
223+
}

ompi/mca/fs/gpfs/Makefile.am

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
# University Research and Technology
4+
# Corporation. All rights reserved.
5+
# Copyright (c) 2004-2005 The University of Tennessee and The University
6+
# of Tennessee Research Foundation. All rights
7+
# reserved.
8+
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
# University of Stuttgart. All rights reserved.
10+
# Copyright (c) 2004-2005 The Regents of the University of California.
11+
# All rights reserved.
12+
# Copyright (c) 2008-2011 University of Houston. All rights reserved.
13+
# $COPYRIGHT$
14+
#
15+
# Additional copyrights may follow
16+
#
17+
# $HEADER$
18+
#
19+
20+
# Make the output library in this directory, and name it either
21+
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
22+
# (for static builds).
23+
24+
if MCA_BUILD_ompi_fs_gpfs_DSO
25+
component_noinst =
26+
component_install = mca_fs_gpfs.la
27+
else
28+
component_noinst = libmca_fs_gpfs.la
29+
component_install =
30+
endif
31+
32+
# Source files
33+
34+
fs_gpfs_sources = \
35+
fs_gpfs_component.c \
36+
fs_gpfs_file_open.c \
37+
fs_gpfs_file_set_info.c\
38+
fs_gpfs_file_get_info.c\
39+
fs_gpfs.c \
40+
fs_gpfs.h
41+
42+
AM_CPPFLAGS = $(fs_gpfs_CPPFLAGS)
43+
44+
mcacomponentdir = $(pkglibdir)
45+
mcacomponent_LTLIBRARIES = $(component_install)
46+
mca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
47+
mca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
48+
mca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)
49+
50+
noinst_LTLIBRARIES = $(component_noinst)
51+
libmca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
52+
libmca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
53+
libmca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)
54+

ompi/mca/fs/gpfs/configure.m4

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
# University Research and Technology
5+
# Corporation. All rights reserved.
6+
# Copyright (c) 2004-2005 The University of Tennessee and The University
7+
# of Tennessee Research Foundation. All rights
8+
# reserved.
9+
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
# University of Stuttgart. All rights reserved.
11+
# Copyright (c) 2004-2005 The Regents of the University of California.
12+
# All rights reserved.
13+
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
14+
# Copyright (c) 2008-2012 University of Houston. All rights reserved.
15+
# $COPYRIGHT$
16+
#
17+
# Additional copyrights may follow
18+
#
19+
# $HEADER$
20+
#
21+
22+
23+
# MCA_fs_gpfs_CONFIG(action-if-can-compile,
24+
# [action-if-cant-compile])
25+
# ------------------------------------------------
26+
AC_DEFUN([MCA_ompi_fs_gpfs_CONFIG],[
27+
AC_CONFIG_FILES([ompi/mca/fs/gpfs/Makefile])
28+
29+
OMPI_CHECK_GPFS([fs_gpfs],
30+
[fs_gpfs_happy="yes"],
31+
[fs_gpfs_happy="no"])
32+
33+
AS_IF([test "$fs_gpfs_happy" = "yes"],
34+
[fs_gpfs_WRAPPER_EXTRA_LDFLAGS="$fs_gpfs_LDFLAGS"
35+
fs_gpfs_WRAPPER_EXTRA_LIBS="$fs_gpfs_LIBS"
36+
$1],
37+
[$2])
38+
39+
OPAL_SUMMARY_ADD([[OMPIO File Systems]],[[IBM Spectrum Scale/GPFS]],[$1],[$fs_gpfs_happy])
40+
41+
# substitute in the things needed to build gpfs
42+
AC_SUBST([fs_gpfs_CPPFLAGS])
43+
AC_SUBST([fs_gpfs_LDFLAGS])
44+
AC_SUBST([fs_gpfs_LIBS])
45+
])dnl

0 commit comments

Comments
 (0)