Skip to content

Commit b1dc58e

Browse files
XuanWang1982edgargabriel
authored andcommitted
First version for GPFS module. To be tested
Signed-off-by: Edgar Gabriel <[email protected]>
1 parent 25aa2b9 commit b1dc58e

14 files changed

+1905
-1
lines changed

config/ompi_check_gpfs.m4

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# OMPI_CHECK_GPFS(prefix, [action-if-found], [action-if-not-found])
2+
# --------------------------------------------------------
3+
# check if GPFS support can be found. Sets prefix_{CPPFLAGS,
4+
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
5+
# support, otherwise executes action-if-not-found
6+
7+
AC_DEFUN([OMPI_CHECK_GPFS],[
8+
9+
check_gpfs_CPPFLAGS=
10+
check_gpfs_LDFLAGS=
11+
check_gpfs_LIBS=
12+
13+
check_gpfs_save_LIBS="$LIBS"
14+
check_gpfs_save_LDFLAGS="$LDFLAGS"
15+
check_gpfs_save_CPPFLAGS="$CPPFLAGS"
16+
17+
check_gpfs_configuration="none"
18+
ompi_check_gpfs_happy="yes"
19+
20+
21+
# Get some configuration information
22+
AC_ARG_WITH([gpfs],
23+
[AC_HELP_STRING([--with-gpfs(=DIR)],
24+
[Build GPFS support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
25+
OPAL_CHECK_WITHDIR([gpfs], [$with_gpfs], [include/gpfs.h])
26+
27+
AS_IF([test -z "$with_gpfs"],
28+
[ompi_check_gpfs_dir="/usr"],
29+
[ompi_check_gpfs_dir="$with_gpfs"])
30+
31+
if test -e "$ompi_check_gpfs_dir/lib64" ; then
32+
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib64"
33+
else
34+
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib"
35+
fi
36+
37+
# Add correct -I and -L flags
38+
OPAL_CHECK_PACKAGE([$1], [gpfs.h], [gpfs], [gpfs_lib_init], [],
39+
[$ompi_check_gpfs_dir], [$ompi_check_gpfs_libdir], [ompi_check_gpfs_happy="yes"],
40+
[ompi_check_gpfs_happy="no"], [#include <gpfs.h>])
41+
42+
AS_IF([test "$ompi_check_gpfs_happy" = "yes"],
43+
[$2],
44+
[AS_IF([test ! -z "$with_gpfs" -a "$with_gpfs" != "no"],
45+
[echo GPFS support not found])
46+
$3])
47+
])

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/gpfs/Makefile.am

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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_close.c \
37+
fs_gpfs_file_delete.c \
38+
fs_gpfs_file_get_size.c \
39+
fs_gpfs_file_open.c \
40+
fs_gpfs_file_set_info.c\
41+
fs_gpfs_file_set_size.c \
42+
fs_gpfs_file_sync.c \
43+
fs_gpfs.c \
44+
fs_gpfs.h
45+
46+
AM_CPPFLAGS = $(fs_gpfs_CPPFLAGS)
47+
48+
mcacomponentdir = $(pkglibdir)
49+
mcacomponent_LTLIBRARIES = $(component_install)
50+
mca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
51+
mca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
52+
mca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)
53+
54+
noinst_LTLIBRARIES = $(component_noinst)
55+
libmca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
56+
libmca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
57+
libmca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)
58+

ompi/mca/fs/gpfs/configure.m4

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
# substitute in the things needed to build gpfs
40+
AC_SUBST([fs_gpfs_CPPFLAGS])
41+
AC_SUBST([fs_gpfs_LDFLAGS])
42+
AC_SUBST([fs_gpfs_LIBS])
43+
])dnl

ompi/mca/fs/gpfs/fs_gpfs.c

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; -*- */
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-2007 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) 2008-2012 University of Houston. All rights reserved.
14+
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
#include "mpi.h"
24+
#include "ompi/mca/fs/fs.h"
25+
#include "ompi/mca/fs/base/base.h"
26+
#include "ompi/mca/fs/gpfs/fs_gpfs.h"
27+
28+
#ifdef HAVE_SYS_STATFS_H
29+
#include <sys/statfs.h> /* or <sys/vfs.h> */
30+
#endif
31+
#ifdef HAVE_SYS_PARAM_H
32+
#include <sys/param.h>
33+
#endif
34+
#ifdef HAVE_SYS_MOUNT_H
35+
#include <sys/mount.h>
36+
#endif
37+
#ifdef HAVE_SYS_STAT_H
38+
#include <sys/stat.h>
39+
#endif
40+
41+
/*
42+
* *******************************************************************
43+
* ************************ actions structure ************************
44+
* *******************************************************************
45+
*/
46+
static mca_fs_base_module_1_0_0_t gpfs = { mca_fs_gpfs_module_init, /* initialize after being selected */
47+
mca_fs_gpfs_module_finalize, /* close a module on a communicator */
48+
mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete,
49+
mca_fs_gpfs_file_set_size, mca_fs_gpfs_file_get_size,
50+
mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync };
51+
/*
52+
* *******************************************************************
53+
* ************************* structure ends **************************
54+
* *******************************************************************
55+
*/
56+
57+
int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
58+
bool enable_mpi_threads) {
59+
/* Nothing to do */
60+
61+
return OMPI_SUCCESS;
62+
}
63+
64+
struct mca_fs_base_module_1_0_0_t *
65+
mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority) {
66+
int err;
67+
char *dir;
68+
struct statfs fsbuf;
69+
char *tmp;
70+
71+
/* The code in this function is based on the ADIO FS selection in ROMIO
72+
* Copyright (C) 1997 University of Chicago.
73+
* See COPYRIGHT notice in top-level directory.
74+
*/
75+
*priority = mca_fs_gpfs_priority;
76+
77+
tmp = strchr(fh->f_filename, ':');
78+
if (!tmp) {
79+
if (OMPIO_ROOT == fh->f_rank) {
80+
do {
81+
err = statfs(fh->f_filename, &fsbuf);
82+
} while (err && (errno == ESTALE));
83+
84+
if (err && (errno == ENOENT)) {
85+
mca_fs_base_get_parent_dir(fh->f_filename, &dir);
86+
err = statfs(dir, &fsbuf);
87+
free(dir);
88+
}
89+
90+
#ifndef GPFS_SUPER_MAGIC
91+
#define GPFS_SUPER_MAGIC 0x47504653 /* Thats GPFS in ASCII */
92+
#endif
93+
if (fsbuf.f_type == GPFS_SUPER_MAGIC) {
94+
fh->f_fstype = GPFS;
95+
}
96+
}
97+
fh->f_comm->c_coll.coll_bcast(&(fh->f_fstype), 1,
98+
MPI_INT,
99+
OMPIO_ROOT, fh->f_comm, fh->f_comm->c_coll.coll_bcast_module);
100+
} else {
101+
if (!strncmp(fh->f_filename, "gpfs:", 5)
102+
|| !strncmp(fh->f_filename, "GPFS:", 5)) {
103+
fh->f_fstype = GPFS;
104+
}
105+
}
106+
107+
if (GPFS == fh->f_fstype) {
108+
if (*priority < 50) {
109+
*priority = 50;
110+
return &gpfs;
111+
}
112+
}
113+
114+
return NULL;
115+
}
116+
117+
int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file) {
118+
/* This function might be needed for some purposes later. for now it
119+
* does not have anything to do since there are no steps which need
120+
* to be undone if this module is not selected */
121+
122+
return OMPI_SUCCESS;
123+
}
124+
125+
int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file) {
126+
return OMPI_SUCCESS;
127+
}
128+
129+
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file) {
130+
return OMPI_SUCCESS;
131+
}
132+

ompi/mca/fs/gpfs/fs_gpfs.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; -*- */
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-2007 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) 2008-2012 University of Houston. All rights reserved.
14+
* $COPYRIGHT$
15+
*
16+
* Additional copyrights may follow
17+
*
18+
* $HEADER$
19+
*/
20+
21+
#ifndef MCA_FS_GPFS_H
22+
#define MCA_FS_GPFS_H
23+
24+
#include "ompi_config.h"
25+
#include "opal/mca/mca.h"
26+
#include "ompi/mca/fs/fs.h"
27+
#include "ompi/mca/io/ompio/io_ompio.h"
28+
29+
#include <gpfs.h>
30+
31+
extern int mca_fs_gpfs_priority;
32+
33+
BEGIN_C_DECLS
34+
35+
int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
36+
bool enable_mpi_threads);
37+
struct mca_fs_base_module_1_0_0_t *
38+
mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority);
39+
int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file);
40+
41+
int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file);
42+
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file);
43+
OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_gpfs_component;
44+
45+
/*
46+
* ******************************************************************
47+
* ********* functions which are implemented in this module *********
48+
* ******************************************************************
49+
*/
50+
51+
int mca_fs_gpfs_file_open(struct ompi_communicator_t *comm, char *filename,
52+
int amode, struct ompi_info_t *info, struct mca_io_ompio_file_t *fh);
53+
int mca_fs_gpfs_file_close(struct mca_io_ompio_file_t *fh);
54+
int mca_fs_gpfs_file_delete(char *filename, struct ompi_info_t *info);
55+
int mca_fs_gpfs_file_set_size(struct mca_io_ompio_file_t *fh,
56+
OMPI_MPI_OFFSET_TYPE size);
57+
int mca_fs_gpfs_file_get_size(struct mca_io_ompio_file_t *fh,
58+
OMPI_MPI_OFFSET_TYPE * size);
59+
int mca_fs_gpfs_file_get_amode(struct ompi_file_t *fh, int *amode);
60+
int mca_fs_gpfs_file_set_info(struct mca_io_ompio_file_t *fh,
61+
struct ompi_info_t *info);
62+
//int mca_fs_gpfs_file_get_info(struct ompi_file_t *fh,
63+
//struct ompi_info_t **info_used);
64+
int mca_fs_gpfs_prefetch_hints(int access_mode,
65+
mca_io_ompio_file_t *fh, struct ompi_info_t *info);
66+
int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh,
67+
struct ompi_info_t *info, struct ompi_info_t *info_selected);
68+
int mca_fs_gpfs_file_sync(struct ompi_file_t *fh);
69+
int
70+
mca_fs_gpfs_file_seek(struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off,
71+
int whence);
72+
int
73+
mca_fs_gpfs_file_get_position(struct ompi_file_t *fh,
74+
OMPI_MPI_OFFSET_TYPE *offset);
75+
76+
/*
77+
* ******************************************************************
78+
* ************ functions implemented in this module end ************
79+
* ******************************************************************
80+
*/
81+
82+
END_C_DECLS
83+
84+
#endif /* MCA_FS_GPFS_H */

0 commit comments

Comments
 (0)