From 58130c73ac96163b44102c055a5db4f83be0cf5b Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Fri, 15 Jan 2016 14:44:06 -0600 Subject: [PATCH] reduce the priority of ompio if lustre file system detected --- ompi/mca/io/ompio/io_ompio_component.c | 56 +++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_component.c b/ompi/mca/io/ompio/io_ompio_component.c index af8918985c..632b968e4e 100644 --- a/ompi/mca/io/ompio/io_ompio_component.c +++ b/ompi/mca/io/ompio/io_ompio_component.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -29,8 +29,15 @@ #include "opal/threads/mutex.h" #include "opal/mca/base/base.h" #include "ompi/mca/io/io.h" +#include "ompi/mca/fs/base/base.h" #include "io_ompio.h" +#ifdef HAVE_SYS_STATFS_H +#include /* or */ +#endif + + + int mca_io_ompio_cycle_buffer_size = -1; int mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE; int mca_io_ompio_num_aggregators = -1; @@ -257,8 +264,53 @@ file_query(struct ompi_file_t *file, int *priority) { mca_io_ompio_data_t *data; + int err; + char *dir; + struct statfs fsbuf; + char *tmp; + int rank; + int is_lustre=0; //false + + tmp = strchr (file->f_filename, ':'); + rank = ompi_comm_rank ( file->f_comm); + if (!tmp) { + if ( 0 == rank) { + do { + err = statfs (file->f_filename, &fsbuf); + } while (err && (errno == ESTALE)); + + if (err && (errno == ENOENT)) { + mca_fs_base_get_parent_dir (file->f_filename, &dir); + err = statfs (dir, &fsbuf); + free (dir); + } +#ifndef LL_SUPER_MAGIC +#define LL_SUPER_MAGIC 0x0BD00BD0 +#endif + if (fsbuf.f_type == LL_SUPER_MAGIC) { + is_lustre = 1; //true + } + } + file->f_comm->c_coll.coll_bcast (&is_lustre, + 1, + MPI_INT, + 0, + file->f_comm, + file->f_comm->c_coll.coll_bcast_module); + } + else { + if (!strncmp(file->f_filename, "lustre:", 7) || + !strncmp(file->f_filename, "LUSTRE:", 7)) { + is_lustre = 1; + } + } - *priority = priority_param; + if (is_lustre) { + *priority = 1; + } + else { + *priority = priority_param; + } /* Allocate a space for this module to hang private data (e.g., the OMPIO file handle) */