diff --git a/configure.ac b/configure.ac index 4aa57cc..3361572 100755 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_PROG_CC_C99 # Checks for libraries. # Checks for header files. -AC_CHECK_HEADERS([fcntl.h libintl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/statfs.h sys/statvfs.h sys/time.h sys/param.h sys/mount.h unistd.h wchar.h plfs.h hdfs.h beegfs/beegfs.h]) +AC_CHECK_HEADERS([fcntl.h libintl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/statfs.h sys/statvfs.h sys/time.h sys/param.h sys/mount.h unistd.h wchar.h hdfs.h beegfs/beegfs.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T @@ -116,17 +116,6 @@ AM_COND_IF([USE_NCMPI_AIORI],[ AC_DEFINE([USE_NCMPI_AIORI], [], [Build NCMPI backend AIORI]) ]) -# PLFS IO support -AC_ARG_WITH([plfs], - [AS_HELP_STRING([--with-plfs], - [support IO with PLFS backend @<:@default=no@:>@])], - [], - [with_plfs=no]) -AM_CONDITIONAL([USE_PLFS_AIORI], [test x$with_plfs = xyes]) -AM_COND_IF([USE_PLFS_AIORI],[ - AC_DEFINE([USE_PLFS_AIORI], [], [Build PLFS backend AIORI]) -]) - # POSIX IO support AC_ARG_WITH([posix], [AS_HELP_STRING([--with-posix], diff --git a/src/Makefile.am b/src/Makefile.am index c85016b..36bbde7 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,15 +45,6 @@ extraSOURCES += aiori-NCMPI.c extraLDADD += -lpnetcdf endif -if USE_PLFS_AIORI -# TBD: modulefiles don't add PLFS_VER to env, but you can find it embedded in -# $PLFS_HOME. configure.ac should extract this for us. Then we should -# add -D... to ior_CPPFLAGS, here. Then aiori-PLFS.c can conditionalize -# compilation of calls that vary according to PLFS version. -extraSOURCES += aiori-PLFS.c -extraLDADD += -lplfs -endif - if USE_POSIX_AIORI extraSOURCES += aiori-POSIX.c endif diff --git a/src/aiori-PLFS.c b/src/aiori-PLFS.c deleted file mode 100755 index d2b1341..0000000 --- a/src/aiori-PLFS.c +++ /dev/null @@ -1,549 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - */ -/* - * Copyright (c) 2009, Los Alamos National Security, LLC All rights reserved. - * Copyright 2009. Los Alamos National Security, LLC. This software was produced - * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National - * Laboratory (LANL), which is operated by Los Alamos National Security, LLC for - * the U.S. Department of Energy. The U.S. Government has rights to use, - * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS - * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR - * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is - * modified to produce derivative works, such modified software should be - * clearly marked, so as not to confuse it with the version available from - * LANL. - * - * Additionally, redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following conditions are - * met: - * - * • Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * • Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * • Neither the name of Los Alamos National Security, LLC, Los Alamos National - * Laboratory, LANL, the U.S. Government, nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - */ - -/******************************************************************************\ -* -* Implement of abstract I/O interface for PLFS. -* -\******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#ifdef __linux__ -#include /* necessary for: */ -#define __USE_GNU /* O_DIRECT and */ -#include /* IO operations */ -#undef __USE_GNU -#endif /* __linux__ */ - -#include -#include /* IO operations */ -#include -#include -/* -#ifdef HAVE_LUSTRE_LUSTRE_USER_H -#include -#endif -*/ - -#include "ior.h" -#include "aiori.h" -#include "iordef.h" - -#ifndef open64 /* necessary for TRU64 -- */ -# define open64 open /* unlikely, but may pose */ -#endif /* not open64 */ /* conflicting prototypes */ - -#ifndef lseek64 /* necessary for TRU64 -- */ -# define lseek64 lseek /* unlikely, but may pose */ -#endif /* not lseek64 */ /* conflicting prototypes */ - -#ifndef O_BINARY /* Required on Windows */ -# define O_BINARY 0 -#endif - -#include "plfs.h" -#include "utilities.h" - - -/**************************** P R O T O T Y P E S *****************************/ -static void *PLFS_Create(char *, IOR_param_t *); -static void *PLFS_Open(char *, IOR_param_t *); -static IOR_offset_t PLFS_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void PLFS_Close(void *, IOR_param_t *); -static void PLFS_Delete(char *, IOR_param_t *); -static void PLFS_SetVersion(IOR_param_t *); -static void PLFS_Fsync(void *, IOR_param_t *); -static IOR_offset_t PLFS_GetFileSize(IOR_param_t *, MPI_Comm, char *); -static int PLFS_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param); -static int PLFS_mkdir (const char *path, mode_t mode, IOR_param_t * param); -static int PLFS_rmdir (const char *path, IOR_param_t * param); -static int PLFS_access (const char *path, int mode, IOR_param_t * param); - -/************************** D E C L A R A T I O N S ***************************/ - -ior_aiori_t plfs_aiori = { - .name = "PLFS", - .create = PLFS_Create, - .open = PLFS_Open, - .xfer = PLFS_Xfer, - .close = PLFS_Close, - .delete = PLFS_Delete, - .set_version = PLFS_SetVersion, - .fsync = PLFS_Fsync, - .get_file_size = PLFS_GetFileSize, - .statfs = PLFS_statfs, - .mkdir = PLFS_mkdir, - .rmdir = PLFS_rmdir, - .access = PLFS_access, -}; - -/***************************** F U N C T I O N S ******************************/ - - -/* - * Create or open the file. Pass TRUE if creating and FALSE if opening an existing file. - */ - -static void *PLFS_Create_Or_Open( char *testFileName, IOR_param_t *param, unsigned char createFile ) { - - Plfs_fd *plfs_fd = NULL; - int fd_oflags = 0, plfs_return; - - - /* - * Check for unsupported flags. - * - * If they want RDWR, we don't know if they're going to try to do both, so we - * can't default to either O_RDONLY or O_WRONLY. Thus, we error and exit. - * - * The other two, we just note that they are not supported and don't do them. - */ - - if ( param->openFlags & IOR_RDWR ) { - ERR( "Opening or creating a file in RDWR is not implemented in PLFS" ); - } - - if ( param->openFlags & IOR_EXCL ) { - fprintf( stdout, "Opening or creating a file in Exclusive mode is not implemented in PLFS\n" ); - } - - if ( param->openFlags & IOR_APPEND ) { - fprintf( stdout, "Opening or creating a file for appending is not implemented in PLFS\n" ); - } - - /* - * Setup the flags to be used. - */ - - if ( createFile == TRUE ) { - fd_oflags = O_CREAT; - } - - if ( param->openFlags & IOR_WRONLY ) { - if ( !param->filePerProc ) { - // in N-1 mode, only rank 0 truncates the file - if ( rank != 0 ) { - fd_oflags |= O_WRONLY; - } else { - fd_oflags |= O_TRUNC; - fd_oflags |= O_WRONLY; - } - } else { - // in N-N mode, everyone does truncate - fd_oflags |= O_TRUNC; - fd_oflags |= O_WRONLY; - } - } else { - fd_oflags |= O_RDONLY; - } - - /* - * Now see if O_DIRECT is needed. - */ - - if ( param->useO_DIRECT == TRUE ) { - set_o_direct_flag( &fd_oflags ); - } - - /* - * For N-1 write, All other ranks wait for Rank 0 to open the file. - * this is bec 0 does truncate and rest don't - * it would be dangerous for all to do truncate as they might - * truncate each other's writes - */ - - if (( param->openFlags & IOR_WRONLY ) && - ( !param->filePerProc ) && - ( rank != 0 )) { - - MPI_CHECK(MPI_Barrier(testComm), "barrier error"); - } - - /* - * Now rank zero can open and truncate, if necessary. - */ - - plfs_return = plfs_open( &( plfs_fd ), testFileName, fd_oflags, rank, 0666, NULL ); - - if ( plfs_return != 0 ) { - ERR( "Failed to open the file" ); - } - - /* - * For N-1 write, Rank 0 waits for the other ranks to open the file after it has. - */ - - if (( param->openFlags & IOR_WRONLY ) && - ( !param->filePerProc ) && - ( rank == 0 )) { - - MPI_CHECK(MPI_Barrier(testComm), "barrier error"); - } - - return ((void *) plfs_fd ); -} - -/* - * Create and open a file through the PLFS interface. - */ - -static void *PLFS_Create( char *testFileName, IOR_param_t * param ) { - - return PLFS_Create_Or_Open( testFileName, param, TRUE ); -} - -/* - * Open a file through the PLFS interface. - */ -static void *PLFS_Open( char *testFileName, IOR_param_t * param ) { - - if ( param->openFlags & IOR_CREAT ) { - return PLFS_Create_Or_Open( testFileName, param, TRUE ); - } else { - return PLFS_Create_Or_Open( testFileName, param, FALSE ); - } -} - -/* - * Write or read access to file using the PLFS interface. - */ - -static IOR_offset_t PLFS_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) { - - int xferRetries = 0; - long long remaining = (long long)length; - char * ptr = (char *)buffer; - long long rc; - off_t offset = param->offset; - Plfs_fd * plfs_fd = (Plfs_fd *)file; - - - while ( remaining > 0 ) { - /* write/read file */ - if (access == WRITE) { /* WRITE */ - if (verbose >= VERBOSE_4) { - fprintf( stdout, "task %d writing to offset %lld\n", - rank, - param->offset + length - remaining); - } - -#if 0 - rc = plfs_write( plfs_fd, ptr, remaining, offset, rank ); /* PLFS 2.4 */ -#else - ssize_t bytes_written = 0; - rc = plfs_write( plfs_fd, ptr, remaining, offset, rank, &bytes_written ); /* PLFS 2.5 */ -#endif - if ( rc < 0 ) { - ERR( "plfs_write() failed" ); - } - - offset += rc; - - if ( param->fsyncPerWrite == TRUE ) { - PLFS_Fsync( plfs_fd, param ); - } - } else { /* READ or CHECK */ - if (verbose >= VERBOSE_4) { - fprintf( stdout, "task %d reading from offset %lld\n", - rank, - param->offset + length - remaining ); - } - -#if 0 - rc = plfs_read( plfs_fd, ptr, remaining, param->offset ); /* PLFS 2.4 */ -#else - ssize_t bytes_read = 0; - rc = plfs_read( plfs_fd, ptr, remaining, param->offset, &bytes_read ); /* PLFS 2.5 */ -#endif - - if ( rc == 0 ) { - ERR( "plfs_read() returned EOF prematurely" ); - } - - if ( rc < 0 ) { - ERR( "plfs_read() failed" ); - } - - offset += rc; - } - - if ( rc < remaining ) { - fprintf(stdout, "WARNING: Task %d, partial %s, %lld of %lld bytes at offset %lld\n", - rank, - access == WRITE ? "plfs_write()" : "plfs_read()", - rc, remaining, - param->offset + length - remaining ); - - if ( param->singleXferAttempt == TRUE ) { - MPI_CHECK( MPI_Abort( MPI_COMM_WORLD, -1 ), "barrier error" ); - } - - if ( xferRetries > MAX_RETRY ) { - ERR( "too many retries -- aborting" ); - } - } - - assert( rc >= 0 ); - assert( rc <= remaining ); - remaining -= rc; - ptr += rc; - xferRetries++; - } - - return ( length ); -} - -/* - * Perform plfs_sync(). - */ - -static void PLFS_Fsync( void *fd, IOR_param_t * param ) { - - Plfs_fd *plfs_fd = (Plfs_fd *)fd; - - if ( plfs_sync( plfs_fd ) != 0 ) { - EWARN( "plfs_sync() failed" ); - } -} - -/* - * Close a file through the PLFS interface. - */ - -static void PLFS_Close( void *fd, IOR_param_t * param ) { - - Plfs_fd * plfs_fd = (Plfs_fd *)fd; - int open_flags; - long long rc; - - if ( param->openFlags & IOR_WRONLY ) { - open_flags = O_CREAT | O_WRONLY; - } else { - open_flags = O_RDONLY; - } - -#if 0 - rc = plfs_close( plfs_fd, rank, param->id, open_flags, NULL ); /* PLFS 2.4 */ -#else - int ref_count = 0; - rc = plfs_close( plfs_fd, rank, param->id, open_flags, NULL, &ref_count ); /* PLFS 2.5 */ -#endif - - if ( rc != 0 ) { - ERR( "plfs_close() failed" ); - } - - free( fd ); -} - -/* - * Delete a file through the POSIX interface. - */ -static void PLFS_Delete( char *testFileName, IOR_param_t * param ) { - - char errmsg[256]; - - if ( plfs_unlink( testFileName ) != 0 ) { - sprintf( - errmsg, - "[RANK %03d]: plfs_unlink() of file \"%s\" failed\n", - rank, testFileName); - - EWARN( errmsg ); - } -} - -/* - * Determine api version. - */ - -static void PLFS_SetVersion( IOR_param_t * test ) { - - strcpy( test->apiVersion, test->api ); -} - -/* - * Use plfs_getattr to return aggregate file size. - */ - -static IOR_offset_t PLFS_GetFileSize( - IOR_param_t * test, MPI_Comm testComm, char *testFileName) { - - int plfs_return; - Plfs_fd * plfs_fd = NULL; - struct stat stat_buf; - IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; - long long rc; - - - plfs_return = plfs_open( &( plfs_fd ), testFileName, O_RDONLY, rank, 0666, NULL ); - - if ( plfs_return != 0 ) { - ERR( "plfs_open() failed before reading the file size attribute" ); - } - - if ( plfs_getattr( plfs_fd, testFileName, &stat_buf, 1 ) != 0 ) { - ERR( "plfs_getattr() failed" ); - } - -#if 0 - rc = plfs_close( plfs_fd, rank, test->id, O_RDONLY, NULL ); /* PLFS 2.4 */ -#else - int ref_count = 0; - rc = plfs_close( plfs_fd, rank, test->id, O_RDONLY, NULL, &ref_count ); /* PLFS 2.5 */ -#endif - - if ( rc != 0 ) { - ERR( "plfs_close() failed after reading the file size attribute" ); - } - - aggFileSizeFromStat = stat_buf.st_size; - - if ( test->filePerProc == TRUE ) { - MPI_CHECK( - MPI_Allreduce( - &aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm ), - "cannot total data moved" ); - - aggFileSizeFromStat = tmpSum; - } else { - MPI_CHECK( - MPI_Allreduce( - &aggFileSizeFromStat, &tmpMin, 1, MPI_LONG_LONG_INT, MPI_MIN, testComm ), - "cannot total data moved" ); - - MPI_CHECK( - MPI_Allreduce( - &aggFileSizeFromStat, &tmpMax, 1, MPI_LONG_LONG_INT, MPI_MAX, testComm ), - "cannot total data moved" ); - - if ( tmpMin != tmpMax ) { - if ( rank == 0 ) { - WARN( "inconsistent file size by different tasks" ); - } - - /* incorrect, but now consistent across tasks */ - aggFileSizeFromStat = tmpMin; - } - } - - return ( aggFileSizeFromStat ); -} - -static int PLFS_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param) -{ - struct statvfs stbuf; - - plfs_ret = plfs_statvfs( file_system, &stbuf ); - if ( plfs_ret != PLFS_SUCCESS ) { - return -1; - } - - stat_buf->f_bsize = stbuf.f_bsize; - stat_buf->f_blocks = stbuf.f_blocks; - stat_buf->f_bfree = stbuf.f_bfree; - stat_buf->f_bavail = stbuf.f_bavail; - stat_buf->f_files = stbuf.f_files; - stat_buf->f_ffree = stbuf.f_ffree; - - return 0; -} - -static int PLFS_mkdir (const char *path, mode_t mode, IOR_param_t * param) -{ - int ret; - - ret = plfs_mkdir (path, mode); - if (PLFS_SUCCESS != ret) { - return -1; - } - - return 0; -} - -static int PLFS_rmdir (const char *path, IOR_param_t * param) -{ - int ret; - - ret = plfs_rmdir (path); - if (PLFS_SUCCESS != ret) { - return -1; - } - - return 0; -} - -static int PLFS_access (const char *path, int mode, IOR_param_t * param) -{ - int ret; - - ret = plfs_access (path, mode); - if (PLFS_SUCCESS != ret) { - return -1; - } - - return 0; -} - -static int PLFS_stat (const char *path, struct stat *stat_buf, IOR_param_t * param) -{ - int ret; - - ret = plfs_getattr (NULL, path, stat_buf, 0); - if ( plfs_ret != PLFS_SUCCESS ) { - ERR("Unable to plfs_getattr directory"); - return -1; - } - - return 0; -} diff --git a/src/aiori.c b/src/aiori.c index cef5af9..678fc14 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -44,9 +44,6 @@ ior_aiori_t *available_aiori[] = { #ifdef USE_POSIX_AIORI &posix_aiori, #endif -#ifdef USE_PLFS_AIORI - &plfs_aiori, -#endif #ifdef USE_S3_AIORI &s3_aiori, &s3_plus_aiori, diff --git a/src/aiori.h b/src/aiori.h index a4a3e74..06f733c 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -84,7 +84,6 @@ extern ior_aiori_t hdfs_aiori; extern ior_aiori_t mpiio_aiori; extern ior_aiori_t ncmpi_aiori; extern ior_aiori_t posix_aiori; -extern ior_aiori_t plfs_aiori; extern ior_aiori_t s3_aiori; extern ior_aiori_t s3_plus_aiori; extern ior_aiori_t s3_emc_aiori; diff --git a/src/mdtest.c b/src/mdtest.c index cb5fa14..f33748f 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -54,12 +54,6 @@ #include #endif - -#ifdef HAVE_PLFS_H -#include -#include -#endif - #include #include #include @@ -1659,12 +1653,6 @@ void show_file_system_size(char *file_system) { * 100; /* show results */ - if (0 == strcmp (backend->name, "plfs")) { - strcpy( real_path, file_system ); - } else if (realpath(file_system, real_path) == NULL) { - FAIL("unable to use realpath()"); - } - fprintf(stdout, "Path: %s\n", real_path); fprintf(stdout, "FS: %.1f %s Used FS: %2.1f%% ", total_file_system_size_hr, file_system_unit_str, @@ -1819,7 +1807,6 @@ int main(int argc, char **argv) { int last = 0; int stride = 1; int iterations = 1; - bool using_plfs_path; /* Check for -h parameter before MPI_Init so the mdtest binary can be called directly, without, for instance, mpirun. */ @@ -2075,16 +2062,7 @@ int main(int argc, char **argv) { strcpy(testdirpath, filenames[rank%path_count]); } -#ifdef HAVE_PLFS_H - using_plfs_path = is_plfs_path( testdirpath ); -#endif - - if (using_plfs_path) { - backend = aiori_select ("PLFS"); - } else { - backend = aiori_select (backend_name); - } - + backend = aiori_select (backend_name); if (NULL == backend) { FAIL("Could not find suitable backend to use"); }