1
1

fs/gpfs: update component and module file

to match what we are doing meanwhile in the other fs compomenents.

Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
Этот коммит содержится в:
Edgar Gabriel 2018-07-01 11:48:33 -05:00
родитель 8d31ba3a09
Коммит 715a6e8c27
8 изменённых файлов: 107 добавлений и 347 удалений

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

@ -135,6 +135,9 @@ int mca_fs_base_get_fstype(char *fname )
else if ( 0 == strncasecmp(fstype, "ime", sizeof("ime"))) { else if ( 0 == strncasecmp(fstype, "ime", sizeof("ime"))) {
ompio_type = IME; ompio_type = IME;
} }
else if ( 0 == strncasecmp(fstype, "gpfs", sizeof("gpfs"))) {
ompio_type = GPFS;
}
free (fstype); free (fstype);
return ompio_type; return ompio_type;

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

@ -1,22 +1,28 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* /*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University * Copyright (c) 2004-2017 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2008-2012 University of Houston. All rights reserved. * Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
* *
* $HEADER$ * $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object fules,
* keeping these symbols as the only symbols in this file prevents
* utility programs such as "ompi_info" from having to import entire
* modules just to query their version and parameters
*/ */
#include "ompi_config.h" #include "ompi_config.h"
@ -26,7 +32,6 @@
#include "ompi/mca/fs/gpfs/fs_gpfs.h" #include "ompi/mca/fs/gpfs/fs_gpfs.h"
#ifdef HAVE_SYS_STATFS_H #ifdef HAVE_SYS_STATFS_H
/*CN: Check which is prefered, already checked/used in OMPI */
#include <sys/statfs.h> /* or <sys/vfs.h> */ #include <sys/statfs.h> /* or <sys/vfs.h> */
#endif #endif
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
@ -39,17 +44,23 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#include <sys/ioctl.h>
/* /*
* ******************************************************************* * *******************************************************************
* ************************ actions structure ************************ * ************************ actions structure ************************
* ******************************************************************* * *******************************************************************
*/ */
static mca_fs_base_module_1_0_0_t gpfs = { mca_fs_gpfs_module_init, /* initialize after being selected */ static mca_fs_base_module_1_0_0_t gpfs = {
mca_fs_gpfs_module_finalize, /* close a module on a communicator */ mca_fs_gpfs_module_init, /* initalise after being selected */
mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete, mca_fs_gpfs_module_finalize, /* close a module on a communicator */
mca_fs_gpfs_file_set_size, mca_fs_gpfs_file_get_size, mca_fs_gpfs_file_open,
mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync, mca_fs_base_file_close,
mca_fs_gpfs_file_get_info}; mca_fs_base_file_delete,
mca_fs_base_file_set_size,
mca_fs_base_file_get_size,
mca_fs_base_file_sync
};
/* /*
* ******************************************************************* * *******************************************************************
* ************************* structure ends ************************** * ************************* structure ends **************************
@ -57,51 +68,40 @@ mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete,
*/ */
int mca_fs_gpfs_component_init_query(bool enable_progress_threads, int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
bool enable_mpi_threads) { bool enable_mpi_threads)
{
/* Nothing to do */ /* Nothing to do */
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
struct mca_fs_base_module_1_0_0_t * struct mca_fs_base_module_1_0_0_t *
mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority) { mca_fs_gpfs_component_file_query (ompio_file_t *fh, int *priority)
int err; {
char *dir;
struct statfs fsbuf;
char *tmp; char *tmp;
/* The code in this function is based on the ADIO FS selection in ROMIO /* The code in this function is based on the ADIO FS selection in ROMIO
* Copyright (C) 1997 University of Chicago. * Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory. * See COPYRIGHT notice in top-level directory.
*/ */
*priority = mca_fs_gpfs_priority; *priority = mca_fs_gpfs_priority;
tmp = strchr(fh->f_filename, ':'); tmp = strchr (fh->f_filename, ':');
if (!tmp) { if (!tmp) {
if (OMPIO_ROOT == fh->f_rank) { if (OMPIO_ROOT == fh->f_rank) {
do { fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename );
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);
} }
fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype),
#ifndef GPFS_SUPER_MAGIC 1,
#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, MPI_INT,
OMPIO_ROOT, fh->f_comm, fh->f_comm->c_coll.coll_bcast_module); OMPIO_ROOT,
} else { fh->f_comm,
if (!strncmp(fh->f_filename, "gpfs:", 5) fh->f_comm->c_coll->coll_bcast_module);
|| !strncmp(fh->f_filename, "GPFS:", 5)) { }
else {
if (!strncmp(fh->f_filename, "gpfs:", 5) ||
!strncmp(fh->f_filename, "GPFS:", 5)) {
fh->f_fstype = GPFS; fh->f_fstype = GPFS;
} }
} }
@ -116,7 +116,8 @@ mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority) {
return NULL; return NULL;
} }
int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file) { int mca_fs_gpfs_component_file_unquery (ompio_file_t *file)
{
/* This function might be needed for some purposes later. for now it /* 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 * does not have anything to do since there are no steps which need
* to be undone if this module is not selected */ * to be undone if this module is not selected */
@ -124,11 +125,16 @@ int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file) {
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file) { int mca_fs_gpfs_module_init (ompio_file_t *file)
{
/* Make sure the file type is not overwritten by the last queried
* component */
file->f_fstype = GPFS;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file) {
int mca_fs_gpfs_module_finalize (ompio_file_t *file)
{
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

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

@ -1,5 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/* /*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2005 The University of Tennessee and The University
@ -10,16 +11,24 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
* *
* $HEADER$ * $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/ */
#include "ompi_config.h" #include "ompi_config.h"
#include "mpi.h"
#include "fs_gpfs.h" #include "fs_gpfs.h"
#include "mpi.h"
/* /*
* Public string showing the fs gpfs component version number * Public string showing the fs gpfs component version number
@ -30,7 +39,6 @@ const char *mca_fs_gpfs_component_version_string =
static int gpfs_register(void); static int gpfs_register(void);
int mca_fs_gpfs_priority = 20; int mca_fs_gpfs_priority = 20;
/* /*
* Instantiate the public struct with all of our public information * Instantiate the public struct with all of our public information
* and pointers to our public functions in it * and pointers to our public functions in it
@ -40,30 +48,25 @@ mca_fs_base_component_2_0_0_t mca_fs_gpfs_component = {
/* First, the mca_component_t struct containing meta information /* First, the mca_component_t struct containing meta information
about the component itself */ about the component itself */
{ .fsm_version = {
MCA_FS_BASE_VERSION_2_0_0, MCA_FS_BASE_VERSION_2_0_0,
/* Component name and version */ /* Component name and version */
"gpfs", .mca_component_name = "gpfs",
OMPI_MAJOR_VERSION, MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION),
OMPI_RELEASE_VERSION, .mca_register_component_params = gpfs_register,
NULL,
NULL,
NULL,
gpfs_register
}, },
{ .fsm_data = {
/* This component is checkpointable */ /* This component is checkpointable */
MCA_BASE_METADATA_PARAM_CHECKPOINT MCA_BASE_METADATA_PARAM_CHECKPOINT
}, },
mca_fs_gpfs_component_init_query, /* get thread level */ .fsm_init_query = mca_fs_gpfs_component_init_query, /* get thread level */
mca_fs_gpfs_component_file_query, /* get priority and actions */ .fsm_file_query = mca_fs_gpfs_component_file_query, /* get priority and actions */
mca_fs_gpfs_component_file_unquery /* undo what was done by previous function */ .fsm_file_unquery = mca_fs_gpfs_component_file_unquery, /* undo what was done by previous function */
}; };
static int static int gpfs_register(void)
gpfs_register(void)
{ {
mca_fs_gpfs_priority = 20; mca_fs_gpfs_priority = 20;
(void) mca_base_component_var_register(&mca_fs_gpfs_component.fsm_version, (void) mca_base_component_var_register(&mca_fs_gpfs_component.fsm_version,

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

@ -1,49 +0,0 @@
/*
* 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)
{
//DEBUG 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;
}

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

@ -1,50 +0,0 @@
/*
* 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-2015 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_gpfs
*
* 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)
{
//DEBUG: fprintf(stderr, "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;
}

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

@ -1,51 +0,0 @@
/*
* 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-2015 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)
{
//DEBUG: fprintf (stderr, "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;
}

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

@ -1,54 +0,0 @@
/*
* 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;
}

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

@ -1,48 +0,0 @@
/*
* 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-2015 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 "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_sync_gpfs
*
* Function: - sync a file
* Accepts: - file handle
* Returns: - Success if file synced
*/
//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;
}