1
1

First version for GPFS module. To be tested

Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
Этот коммит содержится в:
XuanWang1982 2015-05-07 18:42:51 +02:00 коммит произвёл Edgar Gabriel
родитель 25aa2b9a8c
Коммит b1dc58eeb2
14 изменённых файлов: 1905 добавлений и 1 удалений

47
config/ompi_check_gpfs.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
# OMPI_CHECK_GPFS(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if GPFS support can be found. Sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_GPFS],[
check_gpfs_CPPFLAGS=
check_gpfs_LDFLAGS=
check_gpfs_LIBS=
check_gpfs_save_LIBS="$LIBS"
check_gpfs_save_LDFLAGS="$LDFLAGS"
check_gpfs_save_CPPFLAGS="$CPPFLAGS"
check_gpfs_configuration="none"
ompi_check_gpfs_happy="yes"
# Get some configuration information
AC_ARG_WITH([gpfs],
[AC_HELP_STRING([--with-gpfs(=DIR)],
[Build GPFS support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([gpfs], [$with_gpfs], [include/gpfs.h])
AS_IF([test -z "$with_gpfs"],
[ompi_check_gpfs_dir="/usr"],
[ompi_check_gpfs_dir="$with_gpfs"])
if test -e "$ompi_check_gpfs_dir/lib64" ; then
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib64"
else
ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib"
fi
# Add correct -I and -L flags
OPAL_CHECK_PACKAGE([$1], [gpfs.h], [gpfs], [gpfs_lib_init], [],
[$ompi_check_gpfs_dir], [$ompi_check_gpfs_libdir], [ompi_check_gpfs_happy="yes"],
[ompi_check_gpfs_happy="no"], [#include <gpfs.h>])
AS_IF([test "$ompi_check_gpfs_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_gpfs" -a "$with_gpfs" != "no"],
[echo GPFS support not found])
$3])
])

Просмотреть файл

@ -107,7 +107,8 @@ enum ompio_fs_type
PVFS2 = 2,
LUSTRE = 3,
PLFS = 4,
IME = 5
IME = 5,
GPFS = 6
};
typedef struct mca_common_ompio_io_array_t {

58
ompi/mca/fs/gpfs/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,58 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2011 University of Houston. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_ompi_fs_gpfs_DSO
component_noinst =
component_install = mca_fs_gpfs.la
else
component_noinst = libmca_fs_gpfs.la
component_install =
endif
# Source files
fs_gpfs_sources = \
fs_gpfs_component.c \
fs_gpfs_file_close.c \
fs_gpfs_file_delete.c \
fs_gpfs_file_get_size.c \
fs_gpfs_file_open.c \
fs_gpfs_file_set_info.c\
fs_gpfs_file_set_size.c \
fs_gpfs_file_sync.c \
fs_gpfs.c \
fs_gpfs.h
AM_CPPFLAGS = $(fs_gpfs_CPPFLAGS)
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
mca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
mca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources)
libmca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS)
libmca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS)

43
ompi/mca/fs/gpfs/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008-2012 University of Houston. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_fs_gpfs_CONFIG(action-if-can-compile,
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_ompi_fs_gpfs_CONFIG],[
AC_CONFIG_FILES([ompi/mca/fs/gpfs/Makefile])
OMPI_CHECK_GPFS([fs_gpfs],
[fs_gpfs_happy="yes"],
[fs_gpfs_happy="no"])
AS_IF([test "$fs_gpfs_happy" = "yes"],
[fs_gpfs_WRAPPER_EXTRA_LDFLAGS="$fs_gpfs_LDFLAGS"
fs_gpfs_WRAPPER_EXTRA_LIBS="$fs_gpfs_LIBS"
$1],
[$2])
# substitute in the things needed to build gpfs
AC_SUBST([fs_gpfs_CPPFLAGS])
AC_SUBST([fs_gpfs_LDFLAGS])
AC_SUBST([fs_gpfs_LIBS])
])dnl

132
ompi/mca/fs/gpfs/fs_gpfs.c Обычный файл
Просмотреть файл

@ -0,0 +1,132 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2012 University of Houston. All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mpi.h"
#include "ompi/mca/fs/fs.h"
#include "ompi/mca/fs/base/base.h"
#include "ompi/mca/fs/gpfs/fs_gpfs.h"
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h> /* or <sys/vfs.h> */
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/*
* *******************************************************************
* ************************ actions structure ************************
* *******************************************************************
*/
static mca_fs_base_module_1_0_0_t gpfs = { mca_fs_gpfs_module_init, /* initialize after being selected */
mca_fs_gpfs_module_finalize, /* close a module on a communicator */
mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete,
mca_fs_gpfs_file_set_size, mca_fs_gpfs_file_get_size,
mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync };
/*
* *******************************************************************
* ************************* structure ends **************************
* *******************************************************************
*/
int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
bool enable_mpi_threads) {
/* Nothing to do */
return OMPI_SUCCESS;
}
struct mca_fs_base_module_1_0_0_t *
mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority) {
int err;
char *dir;
struct statfs fsbuf;
char *tmp;
/* The code in this function is based on the ADIO FS selection in ROMIO
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
*priority = mca_fs_gpfs_priority;
tmp = strchr(fh->f_filename, ':');
if (!tmp) {
if (OMPIO_ROOT == fh->f_rank) {
do {
err = statfs(fh->f_filename, &fsbuf);
} while (err && (errno == ESTALE));
if (err && (errno == ENOENT)) {
mca_fs_base_get_parent_dir(fh->f_filename, &dir);
err = statfs(dir, &fsbuf);
free(dir);
}
#ifndef GPFS_SUPER_MAGIC
#define GPFS_SUPER_MAGIC 0x47504653 /* Thats GPFS in ASCII */
#endif
if (fsbuf.f_type == GPFS_SUPER_MAGIC) {
fh->f_fstype = GPFS;
}
}
fh->f_comm->c_coll.coll_bcast(&(fh->f_fstype), 1,
MPI_INT,
OMPIO_ROOT, fh->f_comm, fh->f_comm->c_coll.coll_bcast_module);
} else {
if (!strncmp(fh->f_filename, "gpfs:", 5)
|| !strncmp(fh->f_filename, "GPFS:", 5)) {
fh->f_fstype = GPFS;
}
}
if (GPFS == fh->f_fstype) {
if (*priority < 50) {
*priority = 50;
return &gpfs;
}
}
return NULL;
}
int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file) {
/* This function might be needed for some purposes later. for now it
* does not have anything to do since there are no steps which need
* to be undone if this module is not selected */
return OMPI_SUCCESS;
}
int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file) {
return OMPI_SUCCESS;
}
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file) {
return OMPI_SUCCESS;
}

84
ompi/mca/fs/gpfs/fs_gpfs.h Обычный файл
Просмотреть файл

@ -0,0 +1,84 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_FS_GPFS_H
#define MCA_FS_GPFS_H
#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "ompi/mca/fs/fs.h"
#include "ompi/mca/io/ompio/io_ompio.h"
#include <gpfs.h>
extern int mca_fs_gpfs_priority;
BEGIN_C_DECLS
int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
bool enable_mpi_threads);
struct mca_fs_base_module_1_0_0_t *
mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority);
int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file);
int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file);
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file);
OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_gpfs_component;
/*
* ******************************************************************
* ********* functions which are implemented in this module *********
* ******************************************************************
*/
int mca_fs_gpfs_file_open(struct ompi_communicator_t *comm, char *filename,
int amode, struct ompi_info_t *info, struct mca_io_ompio_file_t *fh);
int mca_fs_gpfs_file_close(struct mca_io_ompio_file_t *fh);
int mca_fs_gpfs_file_delete(char *filename, struct ompi_info_t *info);
int mca_fs_gpfs_file_set_size(struct mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE size);
int mca_fs_gpfs_file_get_size(struct mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE * size);
int mca_fs_gpfs_file_get_amode(struct ompi_file_t *fh, int *amode);
int mca_fs_gpfs_file_set_info(struct mca_io_ompio_file_t *fh,
struct ompi_info_t *info);
//int mca_fs_gpfs_file_get_info(struct ompi_file_t *fh,
//struct ompi_info_t **info_used);
int mca_fs_gpfs_prefetch_hints(int access_mode,
mca_io_ompio_file_t *fh, struct ompi_info_t *info);
int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh,
struct ompi_info_t *info, struct ompi_info_t *info_selected);
int mca_fs_gpfs_file_sync(struct ompi_file_t *fh);
int
mca_fs_gpfs_file_seek(struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off,
int whence);
int
mca_fs_gpfs_file_get_position(struct ompi_file_t *fh,
OMPI_MPI_OFFSET_TYPE *offset);
/*
* ******************************************************************
* ************ functions implemented in this module end ************
* ******************************************************************
*/
END_C_DECLS
#endif /* MCA_FS_GPFS_H */

75
ompi/mca/fs/gpfs/fs_gpfs_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mpi.h"
#include "fs_gpfs.h"
/*
* Public string showing the fs gpfs component version number
*/
const char *mca_fs_gpfs_component_version_string =
"OMPI/MPI gpfs FS MCA component version " OMPI_VERSION;
static int gpfs_register(void);
int mca_fs_gpfs_priority = 20;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
mca_fs_base_component_2_0_0_t mca_fs_gpfs_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
MCA_FS_BASE_VERSION_2_0_0,
/* Component name and version */
"gpfs",
OMPI_MAJOR_VERSION,
OMPI_MINOR_VERSION,
OMPI_RELEASE_VERSION,
NULL,
NULL,
NULL,
gpfs_register
},
{
/* This component is checkpointable */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
mca_fs_gpfs_component_init_query, /* get thread level */
mca_fs_gpfs_component_file_query, /* get priority and actions */
mca_fs_gpfs_component_file_unquery /* undo what was done by previous function */
};
static int
gpfs_register(void)
{
mca_fs_gpfs_priority = 20;
(void) mca_base_component_var_register(&mca_fs_gpfs_component.fsm_version,
"priority", "Priority of the gpfs fs component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_gpfs_priority);
return OMPI_SUCCESS;
}

49
ompi/mca/fs/gpfs/fs_gpfs_file_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_gpfs.h"
#include "gpfs.h"
#include <fcntl.h>
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_close_gpfs
*
* Function: - closes a new file
* Accepts: - file handle
* Returns: - Success if file closed
*/
int
mca_fs_gpfs_file_close (mca_io_ompio_file_t *fh)
{
printf("Using mca_fs_gpfs_file_close to close a file.\n");
fh->f_comm->c_coll.coll_barrier (fh->f_comm,
fh->f_comm->c_coll.coll_barrier_module);
/* close (*(int *)fh->fd);*/
close (fh->fd);
return OMPI_SUCCESS;
}

50
ompi/mca/fs/gpfs/fs_gpfs_file_delete.c Обычный файл
Просмотреть файл

@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_gpfs.h"
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_delete_lustre
*
* Function: - deletes a file
* Accepts: - file name & info
* Returns: - Success if file closed
*/
int
mca_fs_gpfs_file_delete (char *filename,
struct ompi_info_t *info)
{
printf("Using mca_fs_gpfs_file_delete to delete a file.\n");
int ret = OMPI_SUCCESS;
ret = unlink(filename);
if (0 > ret) {
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

51
ompi/mca/fs/gpfs/fs_gpfs_file_get_size.c Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_gpfs.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_get_size_gpfs
*
* Function: - get_size of a file
* Accepts: - same arguments as MPI_File_get_size()
* Returns: - Success if size is get
*/
int
mca_fs_gpfs_file_get_size (mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *size)
{
printf ("GPFS GET SIZE\n");
*size = lseek(fh->fd, 0, SEEK_END);
if (-1 == *size) {
perror ("lseek");
return OMPI_ERROR;
}
if (-1 == (lseek(fh->fd, fh->f_offset, SEEK_SET))) {
perror ("lseek");
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

159
ompi/mca/fs/gpfs/fs_gpfs_file_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,159 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/communicator/communicator.h"
#include "ompi/info/info.h"
#include "ompi/file/file.h"
#include "ompi/mca/fs/fs.h"
#include "ompi/mca/fs/base/base.h"
#include "ompi/mca/fcoll/fcoll.h"
#include "ompi/mca/fcoll/base/base.h"
#include "ompi/mca/fbtl/fbtl.h"
#include "ompi/mca/fbtl/base/base.h"
#include "fs_gpfs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <gpfs.h>
#include <fcntl.h>
#include <errno.h>
#include <gpfs_fcntl.h>
int
mca_fs_gpfs_file_open (struct ompi_communicator_t *comm,
char* filename,
int access_mode,
struct ompi_info_t *info,
mca_io_ompio_file_t *fh)
{
int amode;
int old_mask, perm;
if (fh->f_perm == OMPIO_PERM_NULL) {
old_mask = umask(022);
umask(old_mask);
perm = old_mask ^ 0666;
}
else {
perm = fh->f_perm;
}
amode = 0;
if (access_mode & MPI_MODE_CREATE)
amode = amode | O_CREAT;
if (access_mode & MPI_MODE_RDONLY)
amode = amode | O_RDONLY;
if (access_mode & MPI_MODE_WRONLY)
amode = amode | O_WRONLY;
if (access_mode & MPI_MODE_RDWR)
amode = amode | O_RDWR;
if (access_mode & MPI_MODE_EXCL)
amode = amode | O_EXCL;
printf("Opening a file using Linux open() within fs_gpfs_file_open\n");
// for DEBUG
//int gdb = 0;
//char hostname[256];
//gethostname(hostname, sizeof(hostname));
//printf("PID %d on %s ready for attach\n", getpid(), hostname);
//fflush(stdout);
//while (0 == gdb)
//sleep(5);
fh->fd = open (filename, amode, perm);
if (-1 == fh->fd) {
return OMPI_ERROR;
}
fh->f_amode=access_mode;
//Setting GPFS Hints
mca_fs_gpfs_file_set_info(fh, info);
return OMPI_SUCCESS;
}
int
mca_fs_gpfs_file_get_amode (ompi_file_t *fh,
int *amode)
{
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
*amode = data->ompio_fh.f_amode;
return OMPI_SUCCESS;
}
int mca_fs_gpfs_file_seek(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, int whence) {
printf("GPFS FILE SEEK!");
int ret = OMPI_SUCCESS;
mca_io_ompio_data_t *data;
OMPI_MPI_OFFSET_TYPE offset, temp_offset;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
offset = off * data->ompio_fh.f_etype_size;
switch (whence) {
case MPI_SEEK_SET:
if (offset < 0) {
return OMPI_ERROR;
}
break;
case MPI_SEEK_CUR:
offset += data->ompio_fh.f_position_in_file_view;
offset += data->ompio_fh.f_disp;
if (offset < 0) {
return OMPI_ERROR;
}
break;
case MPI_SEEK_END:
ret = data->ompio_fh.f_fs->fs_file_get_size(&data->ompio_fh,
&temp_offset);
offset += temp_offset;
if (offset < 0 || OMPI_SUCCESS != ret) {
return OMPI_ERROR;
}
break;
default:
return OMPI_ERROR;
}
ret = ompi_io_ompio_set_explicit_offset(&data->ompio_fh, offset
/ data->ompio_fh.f_etype_size);
return ret;
}
int mca_fs_gpfs_file_get_position(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *offset) {
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
*offset = data->ompio_fh.f_position_in_file_view
/ data->ompio_fh.f_etype_size;
return OMPI_SUCCESS;
}

1052
ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c Исполняемый файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

54
ompi/mca/fs/gpfs/fs_gpfs_file_set_size.c Обычный файл
Просмотреть файл

@ -0,0 +1,54 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_gpfs.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_set_size_gpfs
*
* Function: - set_size of a file
* Accepts: - same arguments as MPI_File_set_size()
* Returns: - Success if size is set
*/
int
mca_fs_gpfs_file_set_size (mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE size)
{
printf ("GPFS SET SIZE\n");
int err = 0;
err = ftruncate(fh->fd, size);
fh->f_comm->c_coll.coll_bcast (&err,
1,
MPI_INT,
OMPIO_ROOT,
fh->f_comm,
fh->f_comm->c_coll.coll_bcast_module);
if (-1 == err) {
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

49
ompi/mca/fs/gpfs/fs_gpfs_file_sync.c Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2009 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_gpfs.h"
//#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_sync_gpfs
*
* Function: - syn a new file
* Accepts: - file handle
* Returns: - Success if file closed
*/
//TODO
int
mca_fs_gpfs_file_sync (ompi_file_t *fh)
{
int ret = OMPI_SUCCESS;
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
ret = data->ompio_fh.f_fs->fs_file_sync (&data->ompio_fh);
return ret;
}