diff --git a/.gitignore b/.gitignore index d1323b93fbe6a68b90a12ee3972e870d358ea219..c8192f1aa3f0d4b92e825f7824e74c73aa755fc5 100644 --- a/.gitignore +++ b/.gitignore @@ -106,18 +106,19 @@ ltoptions.m4 3rd-party/hwloc-* !3rd-party/hwloc-*.tar.* 3rd-party/treematch/config.h -3rd-party/romio321/adio/include/romioconf.h -3rd-party/romio321/adio/include/romioconf.h.in -3rd-party/romio321/include/mpio.h -3rd-party/romio321/localdefs -3rd-party/romio321/test/fcoll_test.f -3rd-party/romio321/test/fmisc.f -3rd-party/romio321/test/fperf.f -3rd-party/romio321/test/large_file.c -3rd-party/romio321/test/misc.c -3rd-party/romio321/test/pfcoll_test.f -3rd-party/romio321/test/runtests -3rd-party/romio321/util/romioinstall + +3rd-party/romio341/adio/include/romioconf.h +3rd-party/romio341/adio/include/romioconf.h.in +3rd-party/romio341/include/mpio.h +3rd-party/romio341/localdefs +3rd-party/romio341/mpl/confdb/test-driver +3rd-party/romio341/mpl/include/config.h +3rd-party/romio341/mpl/include/config.h.in +3rd-party/romio341/mpl/include/mplconfig.h +3rd-party/romio341/mpl/include/mpl_timer.h +3rd-party/romio341/mpl/localdefs +3rd-party/romio341/test/runtests +3rd-party/romio341/util/romioinstall config/project_list.m4 config/autogen_found_items.m4 @@ -201,19 +202,6 @@ ompi/mca/coll/ml/coll_ml_lex.c ompi/mca/coll/self/coll-self-version.h* ompi/mca/coll/sm/coll-sm-version.h* -ompi/mca/io/romio321/romio/adio/include/romioconf.h -ompi/mca/io/romio321/romio/include/mpio.h -ompi/mca/io/romio321/romio/localdefs -ompi/mca/io/romio321/romio/test/fcoll_test.f -ompi/mca/io/romio321/romio/test/fmisc.f -ompi/mca/io/romio321/romio/test/fperf.f -ompi/mca/io/romio321/romio/test/large_file.c -ompi/mca/io/romio321/romio/test/misc.c -ompi/mca/io/romio321/romio/test/pfcoll_test.f -ompi/mca/io/romio321/romio/test/runtests -ompi/mca/io/romio321/romio/util/romioinstall -ompi/mca/io/romio321/romio/test/syshints.c - ompi/mca/osc/monitoring/osc_monitoring_template_gen.h ompi/mca/pml/v/autogen.vprotocols diff --git a/.mailmap b/.mailmap index 35c12f564a182c4ea58cada364d31f8fb8b9a513..4caee793c7cd40088f0cefbf1c28297799bccd7f 100644 --- a/.mailmap +++ b/.mailmap @@ -119,3 +119,5 @@ Nick Papior <nickpapior@gmail.com> <nicpa@dtu.dk> Nick Papior <nickpapior@gmail.com> <zerothi@users.noreply.github.com> Matthew G. F. Dosanjh <mdosanj@sandia.gov> + +Wei-keng Liao <wkliao@users.noreply.github.com> diff --git a/3rd-party/autogen.subdirs b/3rd-party/autogen.subdirs index 01e147cbb6e75f40b2e325d39fb840978cbe8a0f..ac181a64c7de148e8d3a349dde86cee4fb2c377a 100644 --- a/3rd-party/autogen.subdirs +++ b/3rd-party/autogen.subdirs @@ -1 +1 @@ -romio321 +romio341 diff --git a/3rd-party/romio321/.gitignore b/3rd-party/romio321/.gitignore deleted file mode 100644 index 28f1e98219d4f1f30b497c0d46534bc949207695..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -/Makefile -/.deps -/*.bb -/*.bbg -/*.gcda -/*.gcno -/.libs -/.libstamp* -/*.lo -/.*-cache -.state-cache -version.m4 -confdb/config.rpath diff --git a/3rd-party/romio321/COPYRIGHT b/3rd-party/romio321/COPYRIGHT deleted file mode 100644 index 609bcfa4e843e2480cb7afa8c033e5bbe5f493fc..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/COPYRIGHT +++ /dev/null @@ -1,41 +0,0 @@ - COPYRIGHT - -The following is a notice of limited availability of the code and -disclaimer, which must be included in the prologue of the code and in -all source listings of the code. - -Copyright (C) 1997 University of Chicago - -Permission is hereby granted to use, reproduce, prepare derivative -works, and to redistribute to others. - -The University of Chicago makes no representations as to the suitability, -operability, accuracy, or correctness of this software for any purpose. -It is provided "as is" without express or implied warranty. - -This software was authored by: -Rajeev Thakur: (630) 252-1682; thakur@mcs.anl.gov -Mathematics and Computer Science Division -Argonne National Laboratory, Argonne IL 60439, USA - - - GOVERNMENT LICENSE - -Portions of this material resulted from work developed under a U.S. -Government Contract and are subject to the following license: the -Government is granted for itself and others acting on its behalf a -paid-up, nonexclusive, irrevocable worldwide license in this computer -software to reproduce, prepare derivative works, and perform publicly -and display publicly. - - DISCLAIMER - -This computer code material was prepared, in part, as an account of -work sponsored by an agency of the United States Government. Neither -the United States Government, nor the University of Chicago, nor any -of their employees, makes any warranty express or implied, or assumes -any legal liability or responsibility for the accuracy, completeness, -or usefulness of any information, apparatus, product, or process -disclosed, or represents that its use would not infringe privately -owned rights. - diff --git a/3rd-party/romio321/README_OMPI b/3rd-party/romio321/README_OMPI deleted file mode 100644 index 83f1ffb223312851f8e5ae29eaac81e5e1b5c8bf..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/README_OMPI +++ /dev/null @@ -1,11 +0,0 @@ -Please note that this is *NOT* a vanilla MPICH v3.2b1 -distribution of the ROMIO package from Argonne National Labs. -Various customizations had to be applied to the configuration process. -More to the point -- if replace this copy of ROMIO with a newer version, -it will likely not work. :-( - -- The Open MPI Team - ------------------------------------------------------------------------------ - -Local modifications are in ompi.patch diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.c deleted file mode 100644 index f376150f0ba5e3a4be4d7ab4043d1f3cdc3bf6e8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.c +++ /dev/null @@ -1,63 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs.c - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ -#include "ad_gpfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_GPFS_operations = { - ADIOI_GPFS_Open, /* Open */ - ADIOI_GEN_OpenColl, /* Collective open */ - ADIOI_GEN_ReadContig, /* ReadContig */ - ADIOI_GEN_WriteContig, /* WriteContig */ - ADIOI_GPFS_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GPFS_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_GEN_Fcntl, /* Fcntl */ -#if defined(BGQPLATFORM) || defined(PEPLATFORM) - ADIOI_GPFS_SetInfo, /* SetInfo for BlueGene or PE */ -#else - ADIOI_GEN_SetInfo, /* SetInfo for any platform besides BlueGene or PE */ -#endif - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GPFS_Close, /* Close */ -#ifdef ROMIO_HAVE_WORKING_AIO -#warning Consider BG support for NFS before enabling this. - ADIOI_GEN_IreadContig, /* IreadContig */ - ADIOI_GEN_IwriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif - ADIOI_GEN_IODone, /* ReadDone */ - ADIOI_GEN_IODone, /* WriteDone */ - ADIOI_GEN_IOComplete, /* ReadComplete */ - ADIOI_GEN_IOComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GPFS_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_Feature, /* Features */ -#ifdef BGQPLATFORM - "GPFS+BGQ: IBM GPFS for Blue Gene", -#elif PEPLATFORM - "GPFS+PE: IBM GPFS for PE", -#else - "GPFS: IBM GPFS", -#endif - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.h b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.h deleted file mode 100644 index d64dcaeb998c523e96e08fd2787433eac3ab6756..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs.h - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_GPFS_INCLUDE -#define AD_GPFS_INCLUDE - -#include <unistd.h> -#include <stdlib.h> -#include <sys/types.h> -#include <fcntl.h> -#include "adio.h" - -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_AIO_LITE_H -#include <aio-lite.h> -#elif defined HAVE_AIO_H -#include <aio.h> -#endif - - -void ADIOI_GPFS_Open(ADIO_File fd, int *error_code); - -void ADIOI_GPFS_Close(ADIO_File fd, int *error_code); - -void ADIOI_GPFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GPFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); - -void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - -void ADIOI_GPFS_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GPFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); - -void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); - -void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); - -void ADIOI_GPFS_Flush(ADIO_File fd, int *error_code); - -#include "ad_gpfs_tuning.h" - - -#endif diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.c deleted file mode 100644 index f6df24748f078ef3c193c95bb9758538ca6595da..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.c +++ /dev/null @@ -1,817 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008, 2019 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_aggrs.c - * \brief The externally used function from this file is is declared in ad_gpfs_aggrs.h - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997-2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#include "adio.h" -#include "adio_cb_config_list.h" -#include "ad_gpfs.h" -#include "ad_gpfs_aggrs.h" - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - - -#ifdef USE_DBG_LOGGING - #define AGG_DEBUG 1 -#endif - -#ifndef TRACE_ERR -# define TRACE_ERR(format...) -#endif - -/* Comments copied from common: - * This file contains four functions: - * - * ADIOI_Calc_aggregator() - * ADIOI_Calc_file_domains() - * ADIOI_Calc_my_req() - * ADIOI_Calc_others_req() - * - * The last three of these were originally in ad_read_coll.c, but they are - * also shared with ad_write_coll.c. I felt that they were better kept with - * the rest of the shared aggregation code. - */ - -/* Discussion of values available from above: - * - * ADIO_Offset st_offsets[0..nprocs-1] - * ADIO_Offset end_offsets[0..nprocs-1] - * These contain a list of start and end offsets for each process in - * the communicator. For example, an access at loc 10, size 10 would - * have a start offset of 10 and end offset of 19. - * int nprocs - * number of processors in the collective I/O communicator - * ADIO_Offset min_st_offset - * ADIO_Offset fd_start[0..nprocs_for_coll-1] - * starting location of "file domain"; region that a given process will - * perform aggregation for (i.e. actually do I/O) - * ADIO_Offset fd_end[0..nprocs_for_coll-1] - * start + size - 1 roughly, but it can be less, or 0, in the case of - * uneven distributions - */ - -/* Description from common/ad_aggregate.c. (Does it completely apply to bg?) - * ADIOI_Calc_aggregator() - * - * The intention here is to implement a function which provides basically - * the same functionality as in Rajeev's original version of - * ADIOI_Calc_my_req(). He used a ceiling division approach to assign the - * file domains, and we use the same approach here when calculating the - * location of an offset/len in a specific file domain. Further we assume - * this same distribution when calculating the rank_index, which is later - * used to map to a specific process rank in charge of the file domain. - * - * A better (i.e. more general) approach would be to use the list of file - * domains only. This would be slower in the case where the - * original ceiling division was used, but it would allow for arbitrary - * distributions of regions to aggregators. We'd need to know the - * nprocs_for_coll in that case though, which we don't have now. - * - * Note a significant difference between this function and Rajeev's old code: - * this code doesn't necessarily return a rank in the range - * 0..nprocs_for_coll; instead you get something in 0..nprocs. This is a - * result of the rank mapping; any set of ranks in the communicator could be - * used now. - * - * Returns an integer representing a rank in the collective I/O communicator. - * - * The "len" parameter is also modified to indicate the amount of data - * actually available in this file domain. - */ -/* - * This is more general aggregator search function which does not base on the assumption - * that each aggregator hosts the file domain with the same size - */ -int ADIOI_GPFS_Calc_aggregator(ADIO_File fd, - ADIO_Offset off, - ADIO_Offset min_off, - ADIO_Offset *len, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end) -{ - int rank_index, rank; - ADIO_Offset avail_bytes; - TRACE_ERR("Entering ADIOI_GPFS_Calc_aggregator\n"); - - ADIOI_Assert ( (off <= fd_end[fd->hints->cb_nodes-1] && off >= min_off && fd_start[0] >= min_off ) ); - - /* binary search --> rank_index is returned */ - int ub = fd->hints->cb_nodes; - int lb = 0; - /* get an index into our array of aggregators */ - /* Common code for striping - bg doesn't use it but it's - here to make diff'ing easier. - rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); - - if (fd->hints->striping_unit > 0) { - * wkliao: implementation for file domain alignment - fd_start[] and fd_end[] have been aligned with file lock - boundaries when returned from ADIOI_Calc_file_domains() so cannot - just use simple arithmatic as above * - rank_index = 0; - while (off > fd_end[rank_index]) rank_index++; - } - bg does it's own striping below - */ - rank_index = fd->hints->cb_nodes / 2; - while ( off < fd_start[rank_index] || off > fd_end[rank_index] ) { - if ( off > fd_end [rank_index] ) { - lb = rank_index; - rank_index = (rank_index + ub) / 2; - } - else - if ( off < fd_start[rank_index] ) { - ub = rank_index; - rank_index = (rank_index + lb) / 2; - } - } - /* we index into fd_end with rank_index, and fd_end was allocated to be no - * bigger than fd->hins->cb_nodes. If we ever violate that, we're - * overrunning arrays. Obviously, we should never ever hit this abort */ - if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { - FPRINTF(stderr, "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", - rank_index,fd->hints->cb_nodes,fd_size,off); - MPI_Abort(MPI_COMM_WORLD, 1); - } - /* DBG_FPRINTF ("ADIOI_GPFS_Calc_aggregator: rank_index = %d\n", - rank_index ); */ - - /* - * remember here that even in Rajeev's original code it was the case that - * different aggregators could end up with different amounts of data to - * aggregate. here we use fd_end[] to make sure that we know how much - * data this aggregator is working with. - * - * the +1 is to take into account the end vs. length issue. - */ - avail_bytes = fd_end[rank_index] + 1 - off; - if (avail_bytes < *len && avail_bytes > 0) { - /* this file domain only has part of the requested contig. region */ - - *len = avail_bytes; - } - - /* map our index to a rank */ - /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ - rank = fd->hints->ranklist[rank_index]; - TRACE_ERR("Leaving ADIOI_GPFS_Calc_aggregator\n"); - - return rank; -} - -/* - * Compute a dynamic access range based file domain partition among I/O aggregators, - * which align to the GPFS block size - * Divide the I/O workload among "nprocs_for_coll" processes. This is - * done by (logically) dividing the file into file domains (FDs); each - * process may directly access only its own file domain. - * Additional effort is to make sure that each I/O aggregator get - * a file domain that aligns to the GPFS block size. So, there will - * not be any false sharing of GPFS file blocks among multiple I/O nodes. - * - * The common version of this now accepts a min_fd_size and striping_unit. - * It doesn't seem necessary here (using GPFS block sizes) but keep it in mind - * (e.g. we could pass striping unit instead of using fs_ptr->blksize). - */ -void ADIOI_GPFS_Calc_file_domains(ADIO_File fd, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int nprocs, - int nprocs_for_coll, - ADIO_Offset *min_st_offset_ptr, - ADIO_Offset **fd_start_ptr, - ADIO_Offset **fd_end_ptr, - ADIO_Offset *fd_size_ptr, - void *fs_ptr) -{ - ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, *fd_size; - int i, aggr; - TRACE_ERR("Entering ADIOI_GPFS_Calc_file_domains\n"); - blksize_t blksize; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5004, 0, NULL); -#endif - -# if AGG_DEBUG - static char myname[] = "ADIOI_GPFS_Calc_file_domains"; - DBG_FPRINTF(stderr, "%s(%d): %d aggregator(s)\n", - myname,__LINE__,nprocs_for_coll); -# endif - if (fd->blksize <= 0) - /* default to 1M if blksize unset */ - fd->blksize = 1048576; - blksize = fd->blksize; - -# if AGG_DEBUG - DBG_FPRINTF(stderr,"%s(%d): Blocksize=%ld\n",myname,__LINE__,blksize); -# endif -/* find min of start offsets and max of end offsets of all processes */ - min_st_offset = st_offsets [0]; - max_end_offset = end_offsets[0]; - for (i=1; i<nprocs; i++) { - min_st_offset = ADIOI_MIN(min_st_offset, st_offsets[i]); - max_end_offset = ADIOI_MAX(max_end_offset, end_offsets[i]); - } - - /* DBG_FPRINTF(stderr, "_calc_file_domains, min_st_offset, max_ - = %qd, %qd\n", min_st_offset, max_end_offset );*/ - - /* determine the "file domain (FD)" of each process, i.e., the portion of - the file that will be "owned" by each process */ - - ADIO_Offset gpfs_ub = (max_end_offset +blksize-1) / blksize * blksize - 1; - ADIO_Offset gpfs_lb = min_st_offset / blksize * blksize; - ADIO_Offset gpfs_ub_rdoff = (max_end_offset +blksize-1) / blksize * blksize - 1 - max_end_offset; - ADIO_Offset gpfs_lb_rdoff = min_st_offset - min_st_offset / blksize * blksize; - ADIO_Offset fd_gpfs_range = gpfs_ub - gpfs_lb + 1; - - int naggs = nprocs_for_coll; - - /* Tweak the file domains so that no fd is smaller than a threshold. We - * have to strike a balance between efficency and parallelism: somewhere - * between 10k processes sending 32-byte requests and one process sending a - * 320k request is a (system-dependent) sweet spot - - This is from the common code - the new min_fd_size parm that we didn't implement. - (And common code uses a different declaration of fd_size so beware) - - if (fd_size < min_fd_size) - fd_size = min_fd_size; - */ - fd_size = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * sizeof(ADIO_Offset)); - *fd_start_ptr = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * sizeof(ADIO_Offset)); - *fd_end_ptr = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * sizeof(ADIO_Offset)); - fd_start = *fd_start_ptr; - fd_end = *fd_end_ptr; - - /* each process will have a file domain of some number of gpfs blocks, but - * the division of blocks is not likely to be even. Some file domains will - * be "large" and others "small" - * - * Example: consider 17 blocks distributed over 3 aggregators. - * nb_cn_small = 17/3 = 5 - * naggs_large = 17 - 3*(17/3) = 17 - 15 = 2 - * naggs_small = 3 - 2 = 1 - * - * and you end up with file domains of {5-blocks, 6-blocks, 6-blocks} - * - * what about (relatively) small files? say, a file of 1000 blocks - * distributed over 2064 aggregators: - * nb_cn_small = 1000/2064 = 0 - * naggs_large = 1000 - 2064*(1000/2064) = 1000 - * naggs_small = 2064 - 1000 = 1064 - * and you end up with domains of {0, 0, 0, ... 1, 1, 1 ...} - * - * it might be a good idea instead of having all the zeros up front, to - * "mix" those zeros into the fd_size array. that way, no pset/bridge-set - * is left with zero work. In fact, even if the small file domains aren't - * zero, it's probably still a good idea to mix the "small" file domains - * across the fd_size array to keep the io nodes in balance */ - - - ADIO_Offset n_gpfs_blk = fd_gpfs_range / blksize; - ADIO_Offset nb_cn_small = n_gpfs_blk/naggs; - ADIO_Offset naggs_large = n_gpfs_blk - naggs * (n_gpfs_blk/naggs); - ADIO_Offset naggs_small = naggs - naggs_large; - -#ifdef BGQPLATFORM - if (gpfsmpio_balancecontig == 1) { - /* File domains blocks are assigned to aggregators in a breadth-first - * fashion relative to the ions - additionally, file domains on the - * aggregators sharing the same bridgeset and ion have contiguous - * offsets. */ - - // initialize everything to small - for (i=0; i<naggs; i++) - fd_size[i] = nb_cn_small * blksize; - - // go thru and distribute the large across the bridges - - /* bridelistoffset: agg rank list offsets using the bridgelist - each - * entry is created by adding up the indexes for the aggs from all - * previous bridges */ - int *bridgelistoffset = - (int *) ADIOI_Malloc(fd->hints->fs_hints.bg.numbridges*sizeof(int)); - /* tmpbridgelistnum: copy of the bridgelistnum whose entries can be - * decremented to keep track of bridge assignments during the actual - * large block assignments to the agg rank list*/ - int *tmpbridgelistnum = - (int *) ADIOI_Malloc(fd->hints->fs_hints.bg.numbridges*sizeof(int)); - - int j; - for (j=0;j<fd->hints->fs_hints.bg.numbridges;j++) { - int k, bridgerankoffset = 0; - for (k=0;k<j;k++) { - bridgerankoffset += fd->hints->fs_hints.bg.bridgelistnum[k]; - } - bridgelistoffset[j] = bridgerankoffset; - } - - for (j=0;j<fd->hints->fs_hints.bg.numbridges;j++) - tmpbridgelistnum[j] = fd->hints->fs_hints.bg.bridgelistnum[j]; - int bridgeiter = 0; - - /* distribute the large blocks across the aggs going breadth-first - * across the bridgelist - this distributes the fd sizes across the - * ions, so later in the file domain assignment when it iterates thru - * the ranklist the offsets will be contiguous within the bridge and - * ion as well */ - for (j=0;j<naggs_large;j++) { - int foundbridge = 0; - int numbridgelistpasses = 0; - while (!foundbridge) { - if (tmpbridgelistnum[bridgeiter] > 0) { - foundbridge = 1; - /* - printf("bridgeiter is %d tmpbridgelistnum[bridgeiter] is %d bridgelistoffset[bridgeiter] is %d\n",bridgeiter,tmpbridgelistnum[bridgeiter],bridgelistoffset[bridgeiter]); - printf("naggs is %d bridgeiter is %d bridgelistoffset[bridgeiter] is %d tmpbridgelistnum[bridgeiter] is %d\n",naggs, bridgeiter,bridgelistoffset[bridgeiter],tmpbridgelistnum[bridgeiter]); - printf("naggs is %d bridgeiter is %d setting fd_size[%d]\n",naggs, bridgeiter,bridgelistoffset[bridgeiter]+(fd->hints->bridgelistnum[bridgeiter]-tmpbridgelistnum[bridgeiter])); - */ - int currentbridgelistnum = - (fd->hints->fs_hints.bg.bridgelistnum[bridgeiter]- - tmpbridgelistnum[bridgeiter]); - int currentfdsizeindex = bridgelistoffset[bridgeiter] + - currentbridgelistnum; - fd_size[currentfdsizeindex] = (nb_cn_small+1) * blksize; - tmpbridgelistnum[bridgeiter]--; - } - if (bridgeiter == (fd->hints->fs_hints.bg.numbridges-1)) { - /* guard against infinite loop - should only ever make 1 pass - * thru bridgelist */ - ADIOI_Assert(numbridgelistpasses == 0); - numbridgelistpasses++; - bridgeiter = 0; - } - else - bridgeiter++; - } - } - ADIOI_Free(tmpbridgelistnum); - ADIOI_Free(bridgelistoffset); - - } else { - /* BG/L- and BG/P-style distribution of file domains: simple allocation of - * file domins to each aggregator */ - for (i=0; i<naggs; i++) { - if (i < naggs_large) { - fd_size[i] = (nb_cn_small+1) * blksize; - } else { - fd_size[i] = nb_cn_small * blksize; - } - } - } -#ifdef balancecontigtrace - int myrank; - MPI_Comm_rank(fd->comm,&myrank); - if (myrank == 0) { - fprintf(stderr,"naggs_small is %d nb_cn_small is %d\n",naggs_small,nb_cn_small); - for (i=0; i<naggs; i++) { - fprintf(stderr,"fd_size[%d] set to %d agg rank is %d\n",i,fd_size[i],fd->hints->ranklist[i]); - } - } -#endif - -#else // not BGQ platform - for (i=0; i<naggs; i++) { - if (i < naggs_large) { - fd_size[i] = (nb_cn_small+1) * blksize; - } else { - fd_size[i] = nb_cn_small * blksize; - } - } - -#endif - - -# if AGG_DEBUG - DBG_FPRINTF(stderr,"%s(%d): " - "gpfs_ub %llu, " - "gpfs_lb %llu, " - "gpfs_ub_rdoff %llu, " - "gpfs_lb_rdoff %llu, " - "fd_gpfs_range %llu, " - "n_gpfs_blk %llu, " - "nb_cn_small %llu, " - "naggs_large %llu, " - "naggs_small %llu, " - "\n", - myname,__LINE__, - gpfs_ub , - gpfs_lb , - gpfs_ub_rdoff, - gpfs_lb_rdoff, - fd_gpfs_range, - n_gpfs_blk , - nb_cn_small , - naggs_large , - naggs_small - ); -# endif - - fd_size[0] -= gpfs_lb_rdoff; - fd_size[naggs-1] -= gpfs_ub_rdoff; - - /* compute the file domain for each aggr */ - ADIO_Offset offset = min_st_offset; - for (aggr=0; aggr<naggs; aggr++) { - fd_start[aggr] = offset; - fd_end [aggr] = offset + fd_size[aggr] - 1; - offset += fd_size[aggr]; - } - - *fd_size_ptr = fd_size[0]; - *min_st_offset_ptr = min_st_offset; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5005, 0, NULL); -#endif - ADIOI_Free (fd_size); - TRACE_ERR("Leaving ADIOI_GPFS_Calc_file_domains\n"); -} - -/* - * ADIOI_GPFS_Calc_my_req() overrides ADIOI_Calc_my_req for the default implementation - * is specific for static file domain partitioning. - * - * ADIOI_Calc_my_req() - calculate what portions of the access requests - * of this process are located in the file domains of various processes - * (including this one) - */ -void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, ADIO_Offset fd_size, - int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int **buf_idx_ptr) -/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets? - They are used as memory buffer indices so it seems like the 2G limit is in effect */ -{ - int *count_my_req_per_proc, count_my_req_procs, *buf_idx; - int i, l, proc; - ADIO_Offset fd_len, rem_len, curr_idx, off; - ADIOI_Access *my_req; - TRACE_ERR("Entering ADIOI_GPFS_Calc_my_req\n"); - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5024, 0, NULL); -#endif - *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs,sizeof(int)); - count_my_req_per_proc = *count_my_req_per_proc_ptr; -/* count_my_req_per_proc[i] gives the no. of contig. requests of this - process in process i's file domain. calloc initializes to zero. - I'm allocating memory of size nprocs, so that I can do an - MPI_Alltoall later on.*/ - - buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); -/* buf_idx is relevant only if buftype_is_contig. - buf_idx[i] gives the index into user_buf where data received - from proc. i should be placed. This allows receives to be done - without extra buffer. This can't be done if buftype is not contig. */ - - /* initialize buf_idx to -1 */ - for (i=0; i < nprocs; i++) buf_idx[i] = -1; - - /* one pass just to calculate how much space to allocate for my_req; - * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() - */ - for (i=0; i < contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - fd_len = len_list[i]; - /* note: we set fd_len to be the total size of the access. then - * ADIOI_Calc_aggregator() will modify the value to return the - * amount that was available from the file domain that holds the - * first part of the access. - */ - /* BES */ - proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, - fd_start, fd_end); - count_my_req_per_proc[proc]++; - - /* figure out how much data is remaining in the access (i.e. wasn't - * part of the file domain that had the starting byte); we'll take - * care of this data (if there is any) in the while loop below. - */ - rem_len = len_list[i] - fd_len; - - while (rem_len > 0) { - off += fd_len; /* point to first remaining byte */ - fd_len = rem_len; /* save remaining size, pass to calc */ - proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, - fd_size, fd_start, fd_end); - - count_my_req_per_proc[proc]++; - rem_len -= fd_len; /* reduce remaining length by amount from fd */ - } - } - -/* now allocate space for my_req, offset, and len */ - - *my_req_ptr = (ADIOI_Access *) - ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); - my_req = *my_req_ptr; - - count_my_req_procs = 0; - for (i=0; i < nprocs; i++) { - if (count_my_req_per_proc[i]) { - my_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(ADIO_Offset)); - my_req[i].lens = - ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(ADIO_Offset)); - count_my_req_procs++; - } - my_req[i].count = 0; /* will be incremented where needed - later */ - } - -/* now fill in my_req */ - curr_idx = 0; - for (i=0; i<contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - fd_len = len_list[i]; - proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, - fd_start, fd_end); - - /* for each separate contiguous access from this process */ - if (buf_idx[proc] == -1) - { - ADIOI_Assert(curr_idx == (int) curr_idx); - buf_idx[proc] = (int) curr_idx; - } - - l = my_req[proc].count; - curr_idx += fd_len; - - rem_len = len_list[i] - fd_len; - - /* store the proc, offset, and len information in an array - * of structures, my_req. Each structure contains the - * offsets and lengths located in that process's FD, - * and the associated count. - */ - my_req[proc].offsets[l] = off; - my_req[proc].lens[l] = fd_len; - my_req[proc].count++; - - while (rem_len > 0) { - off += fd_len; - fd_len = rem_len; - proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, - fd_size, fd_start, fd_end); - - if (buf_idx[proc] == -1) - { - ADIOI_Assert(curr_idx == (int) curr_idx); - buf_idx[proc] = (int) curr_idx; - } - - l = my_req[proc].count; - curr_idx += fd_len; - rem_len -= fd_len; - - my_req[proc].offsets[l] = off; - my_req[proc].lens[l] = fd_len; - my_req[proc].count++; - } - } - - - -#ifdef AGG_DEBUG - for (i=0; i<nprocs; i++) { - if (count_my_req_per_proc[i] > 0) { - DBG_FPRINTF(stderr, "data needed from %d (count = %d):\n", i, - my_req[i].count); - for (l=0; l < my_req[i].count; l++) { - DBG_FPRINTF(stderr, " off[%d] = %lld, len[%d] = %lld\n", l, - my_req[i].offsets[l], l, my_req[i].lens[l]); - } - } - DBG_FPRINTF(stderr, "buf_idx[%d] = 0x%x\n", i, buf_idx[i]); - } -#endif - - *count_my_req_procs_ptr = count_my_req_procs; - *buf_idx_ptr = buf_idx; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5025, 0, NULL); -#endif - TRACE_ERR("Leaving ADIOI_GPFS_Calc_my_req\n"); -} - -/* - * ADIOI_Calc_others_req (copied to bg and switched to all to all for performance) - * - * param[in] count_my_req_procs Number of processes whose file domain my - * request touches. - * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of - * contig. requests of this process in - * process i's file domain. - * param[in] my_req A structure defining my request - * param[in] nprocs Number of nodes in the block - * param[in] myrank Rank of this node - * param[out] count_others_req_proc_ptr Number of processes whose requests lie in - * my process's file domain (including my - * process itself) - * param[out] others_req_ptr Array of other process' requests that lie - * in my process's file domain - */ -void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, - int *count_my_req_per_proc, - ADIOI_Access *my_req, - int nprocs, int myrank, - int *count_others_req_procs_ptr, - ADIOI_Access **others_req_ptr) -{ - TRACE_ERR("Entering ADIOI_GPFS_Calc_others_req\n"); -/* determine what requests of other processes lie in this process's - file domain */ - -/* count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - int *count_others_req_per_proc, count_others_req_procs; - int i; - ADIOI_Access *others_req; - - /* Parameters for MPI_Alltoallv */ - int *scounts, *sdispls, *rcounts, *rdispls; - -/* first find out how much to send/recv and from/to whom */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5026, 0, NULL); -#endif - /* Send 1 int to each process. count_my_req_per_proc[i] is the number of - * requests that my process will do to the file domain owned by process[i]. - * Receive 1 int from each process. count_others_req_per_proc[i] is the number of - * requests that process[i] will do to the file domain owned by my process. - */ - count_others_req_per_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); -/* cora2a1=timebase(); */ -/*for(i=0;i<nprocs;i++) ?*/ - MPI_Alltoall(count_my_req_per_proc, 1, MPI_INT, - count_others_req_per_proc, 1, MPI_INT, fd->comm); - -/* total_cora2a+=timebase()-cora2a1; */ - - /* Allocate storage for an array of other nodes' accesses of our - * node's file domain. Also allocate storage for the alltoallv - * parameters. - */ - *others_req_ptr = (ADIOI_Access *) - ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); - others_req = *others_req_ptr; - - scounts = ADIOI_Malloc(nprocs*sizeof(int)); - sdispls = ADIOI_Malloc(nprocs*sizeof(int)); - rcounts = ADIOI_Malloc(nprocs*sizeof(int)); - rdispls = ADIOI_Malloc(nprocs*sizeof(int)); - - /* If process[i] has any requests in my file domain, - * initialize an ADIOI_Access structure that will describe each request - * from process[i]. The offsets, lengths, and buffer pointers still need - * to be obtained to complete the setting of this structure. - */ - count_others_req_procs = 0; - for (i=0; i<nprocs; i++) { - if (count_others_req_per_proc[i]) - { - others_req[i].count = count_others_req_per_proc[i]; - - others_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - others_req[i].lens = - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - - others_req[i].mem_ptrs = (MPI_Aint *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(MPI_Aint)); - - count_others_req_procs++; - } - else - { - others_req[i].count = 0; - others_req[i].offsets = NULL; - others_req[i].lens = NULL; - } - } - - /* Now send the calculated offsets and lengths to respective processes */ - - /************************/ - /* Exchange the offsets */ - /************************/ - - // Figure out the layout for the sendbuf and recvbuf. - // scounts[] and sdisps[] / rcounts[] and rdisps[] define the layout, - // and the data for each section will come from from my_req[i].offsets - // or others_req[i].offsets. - - int scount_total = 0; - int rcount_total = 0; - for (i=0; i<nprocs; i++) - { - /* Send these offsets to process i.*/ - scounts[i] = count_my_req_per_proc[i]; - sdispls[i] = scount_total; - scount_total += scounts[i]; - - /* Receive these offsets from process i.*/ - rcounts[i] = count_others_req_per_proc[i]; - rdispls[i] = rcount_total; - rcount_total += rcounts[i]; - } - - void *sbuf_copy_of_req_info; - void *rbuf_copy_of_req_info; - - sbuf_copy_of_req_info = (ADIO_Offset *) ADIOI_Malloc(scount_total * sizeof(ADIO_Offset)); - rbuf_copy_of_req_info = (ADIO_Offset *) ADIOI_Malloc(rcount_total * sizeof(ADIO_Offset)); - for (i=0; i<nprocs; i++) - { - // I haven't timed it, I'm just assuming a memcpy(,,0) is fast for - // the entries that don't have data to contribute so I didn't bother - // with an 'if' statement - memcpy(sbuf_copy_of_req_info + sdispls[i] * sizeof(ADIO_Offset), - my_req[i].offsets, - scounts[i] * sizeof(ADIO_Offset)); - } - - /* Exchange the offsets */ - MPI_Alltoallv(sbuf_copy_of_req_info, - scounts, sdispls, ADIO_OFFSET, - rbuf_copy_of_req_info, - rcounts, rdispls, ADIO_OFFSET, - fd->comm); - for (i=0; i<nprocs; i++) - { - memcpy(others_req[i].offsets, - rbuf_copy_of_req_info + rdispls[i] * sizeof(ADIO_Offset), - rcounts[i] * sizeof(ADIO_Offset)); - } - - /************************/ - /* Exchange the lengths */ - /************************/ - - for (i=0; i<nprocs; i++) - { - memcpy(sbuf_copy_of_req_info + sdispls[i] * sizeof(ADIO_Offset), - my_req[i].lens, - scounts[i] * sizeof(ADIO_Offset)); - } - - /* Exchange the lengths */ - MPI_Alltoallv(sbuf_copy_of_req_info, - scounts, sdispls, ADIO_OFFSET, - rbuf_copy_of_req_info, - rcounts, rdispls, ADIO_OFFSET, - fd->comm); - for (i=0; i<nprocs; i++) - { - memcpy(others_req[i].lens, - rbuf_copy_of_req_info + rdispls[i] * sizeof(ADIO_Offset), - rcounts[i] * sizeof(ADIO_Offset)); - } - - /* Clean up */ - ADIOI_Free(sbuf_copy_of_req_info); - ADIOI_Free(rbuf_copy_of_req_info); - ADIOI_Free(count_others_req_per_proc); - ADIOI_Free (scounts); - ADIOI_Free (sdispls); - ADIOI_Free (rcounts); - ADIOI_Free (rdispls); - - *count_others_req_procs_ptr = count_others_req_procs; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5027, 0, NULL); -#endif - TRACE_ERR("Leaving ADIOI_GPFS_Calc_others_req\n"); -} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.h b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.h deleted file mode 100644 index cd8dce906145cd249191a944bc48f3a94ab70e67..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_aggrs.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_aggrs.h - * \brief ??? - */ - -/* - * File: ad_gpfs_aggrs.h - * - * Declares functions optimized specifically for GPFS parallel I/O solution. - * - */ - -#ifndef AD_GPFS_AGGRS_H_ -#define AD_GPFS_AGGRS_H_ - -#include "adio.h" -#include <sys/stat.h> - -#ifdef HAVE_GPFS_H -#include <gpfs.h> -#endif - - - /* overriding ADIOI_Calc_file_domains() to apply 'aligned file domain partitioning'. */ - void ADIOI_GPFS_Calc_file_domains(ADIO_File fd, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int nprocs, - int nprocs_for_coll, - ADIO_Offset *min_st_offset_ptr, - ADIO_Offset **fd_start_ptr, - ADIO_Offset **fd_end_ptr, - ADIO_Offset *fd_size_ptr, - void *fs_ptr); - - /* overriding ADIOI_Calc_aggregator() for the default implementation is specific for - static file domain partitioning */ - int ADIOI_GPFS_Calc_aggregator(ADIO_File fd, - ADIO_Offset off, - ADIO_Offset min_off, - ADIO_Offset *len, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end); - - /* overriding ADIOI_Calc_my_req for the default implementation is specific for - static file domain partitioning */ - void ADIOI_GPFS_Calc_my_req ( ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, ADIO_Offset fd_size, - int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int **buf_idx_ptr); - - /* - * ADIOI_Calc_others_req - * - * param[in] count_my_req_procs Number of processes whose file domain my - * request touches. - * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of - * contig. requests of this process in - * process i's file domain. - * param[in] my_req A structure defining my request - * param[in] nprocs Number of nodes in the block - * param[in] myrank Rank of this node - * param[out] count_others_req_proc_ptr Number of processes whose requests lie in - * my process's file domain (including my - * process itself) - * param[out] others_req_ptr Array of other process' requests that lie - * in my process's file domain - */ - void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, - int *count_my_req_per_proc, - ADIOI_Access *my_req, - int nprocs, int myrank, - int *count_others_req_procs_ptr, - ADIOI_Access **others_req_ptr); - - -#endif /* AD_GPFS_AGGRS_H_ */ diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_close.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_close.c deleted file mode 100644 index f8a41671a217f513210f35e479dc1f41ce847618..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_close.c +++ /dev/null @@ -1,57 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_close.c - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gpfs.h" -#include "ad_gpfs_tuning.h" -#include <unistd.h> - -void ADIOI_GPFS_Close(ADIO_File fd, int *error_code) -{ - int err, derr=0; - static char myname[] = "ADIOI_GPFS_CLOSE"; - -#ifdef PROFILE - MPE_Log_event(9, 0, "start close"); -#endif - - if (fd->null_fd >= 0) - close(fd->null_fd); - - err = close(fd->fd_sys); - if (fd->fd_direct >= 0) - { - derr = close(fd->fd_direct); - } - -#ifdef PROFILE - MPE_Log_event(10, 0, "end close"); -#endif - -/* FPRINTF(stderr,"%s(%d):'%s'. Free %#X\n",myname,__LINE__,fd->filename,(int)fd->fs_ptr);*/ - if (fd->fs_ptr != NULL) { - ADIOI_Free(fd->fs_ptr); - fd->fs_ptr = NULL; - } - fd->fd_sys = -1; - fd->fd_direct = -1; - - if (err == -1 || derr == -1) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_hints.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_hints.c deleted file mode 100644 index 7af0a0c67a09487ce9acb3dea4908372408fa3bd..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_hints.c +++ /dev/null @@ -1,288 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_hints.c - * \brief GPFS hint processing - for now, only used for BlueGene and PE platforms - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "hint_fns.h" - -#include "ad_gpfs.h" - -#define ADIOI_GPFS_CB_BUFFER_SIZE_DFLT "16777216" -#define ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT "4194304" -#define ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT "4194304" - -#ifdef BGQPLATFORM -#define ADIOI_BG_NAGG_IN_PSET_HINT_NAME "bg_nodes_pset" -#endif - -/** \page mpiio_vars MPIIO Configuration - * - * GPFS MPIIO configuration and performance tuning. Used by ad_gpfs ADIO. - * - * Used for BlueGene and PE platforms, which each have their own aggregator selection - * algorithms that ignore user provided cb_config_list. - * - * \section hint_sec Hints - * - bg_nodes_pset - BlueGene only - specify how many aggregators to use per pset. - * This hint will override the cb_nodes hint based on BlueGene psets. - * - N - Use N nodes per pset as aggregators. - * - Default is based on partition configuration and cb_nodes. - * - * The following default key/value pairs may differ from other platform defaults. - * - * - key = cb_buffer_size value = 16777216 - * - key = romio_cb_read value = enable - * - key = romio_cb_write value = enable - * - key = ind_rd_buffer_size value = 4194304 - * - key = ind_wr_buffer_size value = 4194304 - */ - -#ifdef BGQPLATFORM -/* Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. */ -extern int -ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_proxy_per_pset); -#elif PEPLATFORM -extern int -ADIOI_PE_gen_agg_ranklist(ADIO_File fd); -#endif - -void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ -/* if fd->info is null, create a new info object. - Initialize fd->info to default values. - Initialize fd->hints to default values. - Examine the info object passed by the user. If it contains values that - ROMIO understands, override the default. */ - - MPI_Info info; - char *value; - int flag, intval, nprocs=0, nprocs_is_valid = 0; - static char myname[] = "ADIOI_GPFS_SETINFO"; - - int did_anything = 0; - - if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); - info = fd->info; - - /* Note that fd->hints is allocated at file open time; thus it is - * not necessary to allocate it, or check for allocation, here. - */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Assert ((value != NULL)); - - /* initialize info and hints to default values if they haven't been - * previously initialized - */ - if (!fd->hints->initialized) { - - ad_gpfs_get_env_vars(); - did_anything = 1; - - /* buffer size for collective I/O */ - ADIOI_Info_set(info, "cb_buffer_size", ADIOI_GPFS_CB_BUFFER_SIZE_DFLT); - fd->hints->cb_buffer_size = atoi(ADIOI_GPFS_CB_BUFFER_SIZE_DFLT); - - /* default is to let romio automatically decide when to use - * collective buffering - */ - ADIOI_Info_set(info, "romio_cb_read", "enable"); - fd->hints->cb_read = ADIOI_HINT_ENABLE; - ADIOI_Info_set(info, "romio_cb_write", "enable"); - fd->hints->cb_write = ADIOI_HINT_ENABLE; - - if ( fd->hints->cb_config_list != NULL ) ADIOI_Free (fd->hints->cb_config_list); - fd->hints->cb_config_list = NULL; - - /* number of processes that perform I/O in collective I/O */ - MPI_Comm_size(fd->comm, &nprocs); - nprocs_is_valid = 1; - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs); - ADIOI_Info_set(info, "cb_nodes", value); - fd->hints->cb_nodes = -1; - - /* hint indicating that no indep. I/O will be performed on this file */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = 0; - - /* gpfs is not implementing file realms (ADIOI_IOStridedColl), - initialize to disabled it. */ - /* hint instructing the use of persistent file realms */ - ADIOI_Info_set(info, "romio_cb_pfr", "disable"); - fd->hints->cb_pfr = ADIOI_HINT_DISABLE; - - /* hint guiding the assignment of persistent file realms */ - ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); - fd->hints->cb_fr_type = ADIOI_FR_AAR; - - /* hint to align file realms with a certain byte value */ - ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); - fd->hints->cb_fr_alignment = 1; - - /* hint to set a threshold percentage for a datatype's size/extent at - * which data sieving should be done in collective I/O */ - ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); - fd->hints->cb_ds_threshold = 0; - - /* hint to switch between point-to-point or all-to-all for two-phase */ - ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); - fd->hints->cb_alltoall = ADIOI_HINT_AUTO; - - /* deferred_open derived from no_indep_rw and cb_{read,write} */ - fd->hints->deferred_open = 0; - - /* buffer size for data sieving in independent reads */ - ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT); - fd->hints->ind_rd_buffer_size = atoi(ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT); - - /* buffer size for data sieving in independent writes */ - ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT); - fd->hints->ind_wr_buffer_size = atoi(ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT); - - - ADIOI_Info_set(info, "romio_ds_read", "automatic"); - fd->hints->ds_read = ADIOI_HINT_AUTO; - ADIOI_Info_set(info, "romio_ds_write", "automatic"); - fd->hints->ds_write = ADIOI_HINT_AUTO; - - /* still to do: tune this a bit for a variety of file systems. there's - * no good default value so just leave it unset */ - fd->hints->min_fdomain_size = 0; - fd->hints->striping_unit = 0; - - fd->hints->initialized = 1; - } - - /* add in user's info if supplied */ - if (users_info != MPI_INFO_NULL) { - ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", - &(fd->hints->cb_buffer_size), myname, error_code); - /* new hints for enabling/disabling coll. buffering on - * reads/writes - */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read", - &(fd->hints->cb_read), myname, error_code); - if (fd->hints->cb_read == ADIOI_HINT_DISABLE) { - /* romio_cb_read overrides no_indep_rw */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; - } - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write", - &(fd->hints->cb_write), myname, error_code); - if (fd->hints->cb_write == ADIOI_HINT_DISABLE) { - /* romio_cb_write overrides no_indep_rw */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; - } - /* Has the user indicated all I/O will be done collectively? */ - ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw", - &(fd->hints->no_indep_rw), myname, error_code); - if (fd->hints->no_indep_rw == 1) { - /* if 'no_indep_rw' set, also hint that we will do - * collective buffering: if we aren't doing independent io, - * then we have to do collective */ - ADIOI_Info_set(info, "romio_cb_write", "enable"); - ADIOI_Info_set(info, "romio_cb_read", "enable"); - fd->hints->cb_read = 1; - fd->hints->cb_write = 1; - } - - /* new hints for enabling/disabling data sieving on - * reads/writes - */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read", - &(fd->hints->ds_read), myname, error_code); - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write", - &(fd->hints->ds_write), myname, error_code); - - ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size", - &(fd->hints->ind_wr_buffer_size), myname, error_code); - ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size", - &(fd->hints->ind_rd_buffer_size), myname, error_code); - - memset( value, 0, MPI_MAX_INFO_VAL+1 ); - ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL, - value, &flag); - if ( flag && ((intval = atoi(value)) > 0) ) { - ADIOI_Info_set(info, "romio_min_fdomain_size", value); - fd->hints->min_fdomain_size = intval; - } - /* Now we use striping unit in common code so we should - process hints for it. */ - ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", - &(fd->hints->striping_unit), myname, error_code); - -#ifdef BGQPLATFORM - memset( value, 0, MPI_MAX_INFO_VAL+1 ); - ADIOI_Info_get(users_info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, MPI_MAX_INFO_VAL, - value, &flag); - if (flag && ((intval = atoi(value)) > 0)) { - - did_anything = 1; - ADIOI_Info_set(info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, value); - fd->hints->cb_nodes = intval; - } -#endif - } - - /* special CB aggregator assignment */ - if (did_anything) { -#ifdef BGQPLATFORM - ADIOI_BG_gen_agg_ranklist(fd, fd->hints->cb_nodes); -#elif PEPLATFORM - ADIOI_PE_gen_agg_ranklist(fd); -#endif - } - - /* deferred_open won't be set by callers, but if the user doesn't - * explicitly disable collecitve buffering (two-phase) and does hint that - * io w/o independent io is going on, we'll set this internal hint as a - * convenience */ - if ( ( (fd->hints->cb_read != ADIOI_HINT_DISABLE) \ - && (fd->hints->cb_write != ADIOI_HINT_DISABLE)\ - && fd->hints->no_indep_rw ) ) { - fd->hints->deferred_open = 1; - } else { - /* setting romio_no_indep_rw enable and romio_cb_{read,write} - * disable at the same time doesn't make sense. honor - * romio_cb_{read,write} and force the no_indep_rw hint to - * 'disable' */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = 0; - fd->hints->deferred_open = 0; - } - - /* BobC commented this out, but since hint processing runs on both bg and - * bglockless, we need to keep DS writes enabled on gpfs and disabled on - * PVFS */ - if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { - /* disable data sieving for fs that do not - support file locking */ - ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - /* get rid of this value if it is set */ - ADIOI_Info_delete(info, "ind_wr_buffer_size"); - } - /* note: leave ind_wr_buffer_size alone; used for other cases - * as well. -- Rob Ross, 04/22/2003 - */ - ADIOI_Info_set(info, "romio_ds_write", "disable"); - fd->hints->ds_write = ADIOI_HINT_DISABLE; - } - - ADIOI_Free(value); - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_open.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_open.c deleted file mode 100644 index f4fef37c85cb512ac63d363333fba4c890e19738..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_open.c +++ /dev/null @@ -1,156 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_open.c - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gpfs.h" -#include "ad_gpfs_tuning.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> - - -#ifdef HAVE_GPFS_H -#include <gpfs.h> -#endif -#ifdef HAVE_GPFS_FCNTL_H -#include <gpfs_fcntl.h> -#endif - -#ifdef HAVE_GPFS_FCNTL_H -static void gpfs_free_all_locks(int fd) -{ - int rc; - struct { - gpfsFcntlHeader_t header; - gpfsFreeRange_t release; - } release_all; - - release_all.header.totalLength = sizeof(release_all); - release_all.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - release_all.header.fcntlReserved = 0; - - release_all.release.structLen = sizeof(release_all.release); - release_all.release.structType = GPFS_FREE_RANGE; - release_all.release.start = 0; - release_all.release.length = 0; - - rc = gpfs_fcntl(fd, &release_all); - if (rc != 0) { - DBGV_FPRINTF(stderr,"GPFS fcntl release failed with rc=%d, errno=%d\n", - rc,errno); - } -} -#endif - - -void ADIOI_GPFS_Open(ADIO_File fd, int *error_code) -{ - int perm, old_mask, amode, rank, rc; - static char myname[] = "ADIOI_GPFS_OPEN"; - - /* set internal variables for tuning environment variables */ - ad_gpfs_get_env_vars(); - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); -#endif - fd->fd_sys = open(fd->filename, amode, perm); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); -#endif - DBG_FPRINTF(stderr,"open('%s',%#X,%#X) rc=%d, errno=%d\n",fd->filename,amode,perm,fd->fd_sys,errno); - fd->fd_direct = -1; - - if (gpfsmpio_devnullio == 1) { - fd->null_fd = open("/dev/null", O_RDWR); - } else { - fd->null_fd = -1; - } - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) - fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); - - if(fd->fd_sys != -1) - { - - fd->blksize = 1048576; /* default to 1M */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_stat_a, 0, NULL); -#endif - /* in this fs-specific routine, we might not be called over entire - * communicator (deferred open). Collect statistics on one process. - * ADIOI_GEN_Opencoll (common-code caller) will take care of the - * broadcast */ - - MPI_Comm_rank(fd->comm, &rank); - if ((rank == fd->hints->ranklist[0]) || (fd->comm == MPI_COMM_SELF)) { - struct stat64 gpfs_statbuf; - /* Get the (real) underlying file system block size */ - rc = stat64(fd->filename, &gpfs_statbuf); - if (rc >= 0) - { - fd->blksize = gpfs_statbuf.st_blksize; - DBGV_FPRINTF(stderr,"Successful stat '%s'. Blocksize=%ld\n", - fd->filename,gpfs_statbuf.st_blksize); - } - else - { - DBGV_FPRINTF(stderr,"Stat '%s' failed with rc=%d, errno=%d\n", - fd->filename,rc,errno); - } - } - /* all other ranks have incorrect fd->blocksize, but ADIOI_GEN_Opencoll - * will take care of that in both standard and deferred-open case */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_stat_b, 0, NULL); -#endif - -#ifdef HAVE_GPFS_FCNTL_H - /* in parallel workload, might be helpful to immediately release block - * tokens. Or, system call overhead will outweigh any benefits... */ - if (getenv("ROMIO_GPFS_FREE_LOCKS")!=NULL) - gpfs_free_all_locks(fd->fd_sys); - -#endif - } - - if (fd->fd_sys == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; -} -/* - *vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_rdcoll.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_rdcoll.c deleted file mode 100644 index f449acb158aee3a918decbfe43c31d1b084c0159..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_rdcoll.c +++ /dev/null @@ -1,1255 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_rdcoll.c - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_gpfs.h" -#include "ad_gpfs_aggrs.h" - -#ifdef PROFILE -#include "mpe.h" -#endif - -#ifdef USE_DBG_LOGGING - #define RDCOLL_DEBUG 1 -#endif -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -/* prototypes of functions used for collective reads only. */ -static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code); -static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, - int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, - MPI_Aint buftype_extent, int *buf_idx); -static void ADIOI_R_Exchange_data_alltoallv(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, - int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, - MPI_Aint buftype_extent, int *buf_idx); -static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, - unsigned *recv_size, - MPI_Request *requests, MPI_Status *statuses, - int *recd_from_proc, int nprocs, - int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - MPI_Aint buftype_extent); - -extern void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype - datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, ADIO_Offset - **len_list_ptr, ADIO_Offset *start_offset_ptr, - ADIO_Offset *end_offset_ptr, int - *contig_access_count_ptr); - - - -void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ - - ADIOI_Access *my_req; - /* array of nprocs structures, one for each other process in - whose file domain this process's request lies */ - - ADIOI_Access *others_req; - /* array of nprocs structures, one for each other process - whose request lies in this process's file domain. */ - - int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int contig_access_count=0, interleave_count = 0, buftype_is_contig; - int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; - ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, - *fd_end = NULL, *end_offsets = NULL; - ADIO_Offset *gpfs_offsets0 = NULL, *gpfs_offsets = NULL; - ADIO_Offset *count_sizes; - int ii; - ADIO_Offset *len_list = NULL; - int *buf_idx = NULL; - - GPFSMPIO_T_CIO_RESET( r); - -#ifdef HAVE_STATUS_SET_BYTES - MPI_Count bufsize, size; -#endif - -#if 0 -/* From common code - not implemented for bg. */ - if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { - ADIOI_IOStridedColl (fd, buf, count, ADIOI_READ, datatype, - file_ptr_type, offset, status, error_code); - return; - } */ -#endif -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - /* number of aggregators, cb_nodes, is stored in the hints */ - nprocs_for_coll = fd->hints->cb_nodes; - orig_fp = fd->fp_ind; - - GPFSMPIO_T_CIO_SET_GET( r, 1, 0, GPFSMPIO_CIO_T_MPIO_CRW, GPFSMPIO_CIO_LAST) - GPFSMPIO_T_CIO_SET_GET( r, 1, 0, GPFSMPIO_CIO_T_LCOMP, GPFSMPIO_CIO_LAST ) - - /* only check for interleaving if cb_read isn't disabled */ - if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { - /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_GATHER, GPFSMPIO_CIO_T_LCOMP ) - -#ifdef RDCOLL_DEBUG - for (i=0; i<contig_access_count; i++) { - DBG_FPRINTF(stderr, "rank %d off %lld len %lld\n", - myrank, offset_list[i], len_list[i]); - } -#endif - - /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets - stored in order of process rank. */ - - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - - ADIO_Offset my_count_size=0; - /* One-sided aggregation needs the amount of data per rank as well because the difference in - * starting and ending offsets for 1 byte is 0 the same as 0 bytes so it cannot be distiguished. - */ - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - count_sizes = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - MPI_Count buftype_size; - MPI_Type_size_x(datatype, &buftype_size); - my_count_size = (ADIO_Offset) count * (ADIO_Offset)buftype_size; - } - if (gpfsmpio_tunegather) { - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(3*nprocs*sizeof(ADIO_Offset)); - gpfs_offsets = (ADIO_Offset *) ADIOI_Malloc(3*nprocs*sizeof(ADIO_Offset)); - for (ii=0; ii<nprocs; ii++) { - gpfs_offsets0[ii*3] = 0; - gpfs_offsets0[ii*3+1] = 0; - gpfs_offsets0[ii*3+2] = 0; - } - gpfs_offsets0[myrank*3] = start_offset; - gpfs_offsets0[myrank*3+1] = end_offset; - gpfs_offsets0[myrank*3+2] = my_count_size; - MPI_Allreduce( gpfs_offsets0, gpfs_offsets, nprocs*3, ADIO_OFFSET, MPI_MAX, fd->comm ); - for (ii=0; ii<nprocs; ii++) { - st_offsets [ii] = gpfs_offsets[ii*3] ; - end_offsets[ii] = gpfs_offsets[ii*3+1]; - count_sizes[ii] = gpfs_offsets[ii*3+2]; - } - } - else { - gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); - gpfs_offsets = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); - for (ii=0; ii<nprocs; ii++) { - gpfs_offsets0[ii*2] = 0; - gpfs_offsets0[ii*2+1] = 0; - } - gpfs_offsets0[myrank*2] = start_offset; - gpfs_offsets0[myrank*2+1] = end_offset; - - MPI_Allreduce( gpfs_offsets0, gpfs_offsets, nprocs*2, ADIO_OFFSET, MPI_MAX, fd->comm ); - - for (ii=0; ii<nprocs; ii++) { - st_offsets [ii] = gpfs_offsets[ii*2] ; - end_offsets[ii] = gpfs_offsets[ii*2+1]; - } - } - ADIOI_Free( gpfs_offsets0 ); - ADIOI_Free( gpfs_offsets ); - } else { - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, - ADIO_OFFSET, fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, - ADIO_OFFSET, fd->comm); - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - MPI_Allgather(&count_sizes, 1, ADIO_OFFSET, count_sizes, 1, - ADIO_OFFSET, fd->comm); - } - } - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_PATANA, GPFSMPIO_CIO_T_GATHER ) - - /* are the accesses of different processes interleaved? */ - for (i=1; i<nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - - if (fd->hints->cb_read == ADIOI_HINT_DISABLE - || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) - { - /* don't do aggregation */ - if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - } - - fd->fp_ind = orig_fp; - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - if (buftype_is_contig && filetype_is_contig) { - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; - ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, error_code); - } - else ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } - else ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - - return; - } - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_FD_PART, GPFSMPIO_CIO_T_PATANA ) - - /* We're going to perform aggregation of I/O. Here we call - * ADIOI_Calc_file_domains() to determine what processes will handle I/O - * to what regions. We pass nprocs_for_coll into this function; it is - * used to determine how many processes will perform I/O, which is also - * the number of regions into which the range of bytes must be divided. - * These regions are called "file domains", or FDs. - * - * When this function returns, fd_start, fd_end, fd_size, and - * min_st_offset will be filled in. fd_start holds the starting byte - * location for each file domain. fd_end holds the ending byte location. - * min_st_offset holds the minimum byte location that will be accessed. - * - * Both fd_start[] and fd_end[] are indexed by an aggregator number; this - * needs to be mapped to an actual rank in the communicator later. - * - */ - int currentNonZeroDataIndex = 0; - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - /* Take out the 0-data offsets by shifting the indexes with data to the - * front and keeping track of the non-zero data index for use as the - * length. By doing this we will optimally use all available aggs - * and spread the actual data across them instead of having offsets - * with empty data potentially dilute the file domains and create - * problems for the one-sided aggregation. - */ - for (i=0; i<nprocs; i++) { - if (count_sizes[i] > 0) { - st_offsets[currentNonZeroDataIndex] = st_offsets[i]; - end_offsets[currentNonZeroDataIndex] = end_offsets[i]; - currentNonZeroDataIndex++; - } - } - } - if (gpfsmpio_tuneblocking) { - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, currentNonZeroDataIndex, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size, fd->fs_ptr); - } - else { - ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size, fd->fs_ptr); - } - } - else { - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - ADIOI_Calc_file_domains(st_offsets, end_offsets, currentNonZeroDataIndex, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - } - else { - ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - } - } - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_MYREQ, GPFSMPIO_CIO_T_FD_PART ); - if ((gpfsmpio_read_aggmethod == 1) || (gpfsmpio_read_aggmethod == 2)) { - /* If the user has specified to use a one-sided aggregation method then do that at - * this point instead of the two-phase I/O. - */ - ADIOI_OneSidedReadAggregation(fd, offset_list, len_list, contig_access_count, buf, - datatype,error_code, st_offsets, end_offsets, currentNonZeroDataIndex, fd_start, fd_end); - GPFSMPIO_T_CIO_REPORT( 0, fd, myrank, nprocs) - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - ADIOI_Free(count_sizes); - goto fn_exit; - } - if (gpfsmpio_p2pcontig==1) { - /* For some simple yet common(?) workloads, full-on two-phase I/O is - * overkill. We can establish sub-groups of processes and their - * aggregator, and then these sub-groups will carry out a simplified - * two-phase over that sub-group. - * - * First verify that the filetype is contig and the offsets are - * increasing in rank order*/ - int x, inOrderAndNoGaps = 1; - for (x=0;x<(nprocs-1);x++) { - if (end_offsets[x] != (st_offsets[x+1]-1)) - inOrderAndNoGaps = 0; - } - if (inOrderAndNoGaps && buftype_is_contig) { - /* if these conditions exist then execute the P2PContig code else - * execute the original code */ - ADIOI_P2PContigReadAggregation(fd, buf, - error_code, st_offsets, end_offsets, fd_start, fd_end); - - /* NOTE: we are skipping the rest of two-phase in this path */ - GPFSMPIO_T_CIO_REPORT( 0, fd, myrank, nprocs) - - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - goto fn_exit; - - } - } - - /* calculate where the portions of the access requests of this process - * are located in terms of the file domains. this could be on the same - * process or on other processes. this function fills in: - * count_my_req_procs - number of processes (including this one) for which - * this process has requests in their file domain - * count_my_req_per_proc - count of requests for each process, indexed - * by rank of the process - * my_req[] - array of data structures describing the requests to be - * performed by each process (including self). indexed by rank. - * buf_idx[] - array of locations into which data can be directly moved; - * this is only valid for contiguous buffer case - */ - if (gpfsmpio_tuneblocking) - ADIOI_GPFS_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - else - ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_OTHREQ, GPFSMPIO_CIO_T_MYREQ ) - - /* perform a collective communication in order to distribute the - * data calculated above. fills in the following: - * count_others_req_procs - number of processes (including this - * one) which have requests in this process's file domain. - * count_others_req_per_proc[] - number of separate contiguous - * requests from proc i lie in this process's file domain. - */ - if (gpfsmpio_tuneblocking) - ADIOI_GPFS_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, &count_others_req_procs, - &others_req); - - else - ADIOI_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, &count_others_req_procs, - &others_req); - - GPFSMPIO_T_CIO_SET_GET( r, 1, 1, GPFSMPIO_CIO_T_DEXCH, GPFSMPIO_CIO_T_OTHREQ ) - - /* my_req[] and count_my_req_per_proc aren't needed at this point, so - * let's free the memory - */ - ADIOI_Free(count_my_req_per_proc); - for (i=0; i<nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } - ADIOI_Free(my_req); - - - /* read data in sizes of no more than ADIOI_Coll_bufsize, - * communicate, and fill user buf. - */ - ADIOI_Read_and_exch(fd, buf, datatype, nprocs, myrank, - others_req, offset_list, - len_list, contig_access_count, min_st_offset, - fd_size, fd_start, fd_end, buf_idx, error_code); - - GPFSMPIO_T_CIO_SET_GET( r, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_DEXCH ) - GPFSMPIO_T_CIO_SET_GET( r, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_MPIO_CRW ) - - GPFSMPIO_T_CIO_REPORT( 0, fd, myrank, nprocs) - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); - - /* free all memory allocated for collective I/O */ - for (i=0; i<nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } - ADIOI_Free(others_req); - - ADIOI_Free(buf_idx); - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - -fn_exit: -#ifdef HAVE_STATUS_SET_BYTES - MPI_Type_size_x(datatype, &size); - bufsize = size * count; - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - during collective I/O. */ -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ -} - -static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code) -{ -/* Read in sizes of no more than coll_bufsize, an info parameter. - Send data to appropriate processes. - Place recd. data in user buf. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were read all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to read a distributed - array from a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ - - int i, j, m, ntimes, max_ntimes, buftype_is_contig; - ADIO_Offset st_loc=-1, end_loc=-1, off, done, real_off, req_off; - char *read_buf = NULL, *tmp_buf; - int *curr_offlen_ptr, *count, *send_size, *recv_size; - int *partial_send, *recd_from_proc, *start_pos; - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ - ADIO_Offset real_size, size, for_curr_iter, for_next_iter; - int req_len, flag, rank; - MPI_Status status; - ADIOI_Flatlist_node *flat_buf=NULL; - MPI_Aint buftype_extent, buftype_lb; - int coll_bufsize; -#ifdef RDCOLL_DEBUG - int iii; -#endif - *error_code = MPI_SUCCESS; /* changed below if error */ - /* only I/O errors are currently reported */ - -/* calculate the number of reads of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. - coll_bufsize is obtained from the hints object. */ - - coll_bufsize = fd->hints->cb_buffer_size; - - /* grab some initial values for st_loc and end_loc */ - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - st_loc = others_req[i].offsets[0]; - end_loc = others_req[i].offsets[0]; - break; - } - } - - /* now find the real values */ - for (i=0; i < nprocs; i++) - for (j=0; j<others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); - } - - /* calculate ntimes, the number of times this process must perform I/O - * operations in order to complete all the requests it has received. - * the need for multiple I/O operations comes from the restriction that - * we only use coll_bufsize bytes of memory for internal buffering. - */ - if ((st_loc==-1) && (end_loc==-1)) { - /* this process does no I/O. */ - ntimes = 0; - } - else { - /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ - ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); - } - - MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); - - read_buf = fd->io_buf; - - curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* its use is explained below. calloc initializes to 0. */ - - count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ - - partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* if only a portion of the last off-len pair is sent to a process - in a particular iteration, the length sent is stored here. - calloc initializes to 0. */ - - send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be sent to each proc. in an iteration */ - - recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ - - recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* amount of data recd. so far from each proc. Used in - ADIOI_Fill_user_buffer. initialized to 0 here. */ - - start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - if (!buftype_is_contig) { - flat_buf = ADIOI_Flatten_and_find(datatype); - } - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - - done = 0; - off = st_loc; - for_curr_iter = for_next_iter = 0; - - MPI_Comm_rank(fd->comm, &rank); - -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); -#endif - - for (m=0; m<ntimes; m++) { - /* read buf of size coll_bufsize (or less) */ - /* go through all others_req and check if any are satisfied - by the current read */ - - /* since MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order, I can maintain a pointer - (curr_offlen_ptr) to - current off-len pair for each process in others_req and scan - further only from there. There is still a problem of filetypes - such as: (1, 2, 3 are not process nos. They are just numbers for - three chunks of data, specified by a filetype.) - - 1 -------!-- - 2 -----!---- - 3 --!----- - - where ! indicates where the current read_size limitation cuts - through the filetype. I resolve this by reading up to !, but - filling the communication buffer only for 1. I copy the portion - left over for 2 into a tmp_buf for use in the next - iteration. i.e., 2 and 3 will be satisfied in the next - iteration. This simplifies filling in the user's buf at the - other end, as only one off-len pair with incomplete data - will be sent. I also don't need to send the individual - offsets and lens along with the data, as the data is being - sent in a particular order. */ - - /* off = start offset in the file for the data actually read in - this iteration - size = size of data read corresponding to off - real_off = off minus whatever data was retained in memory from - previous iteration for cases like 2, 3 illustrated above - real_size = size plus the extra corresponding to real_off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ - -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif - size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); - real_off = off - for_curr_iter; - real_size = size + for_curr_iter; - - for (i=0; i<nprocs; i++) count[i] = send_size[i] = 0; - for_next_iter = 0; - - for (i=0; i<nprocs; i++) { -#ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "rank %d, i %d, others_count %d\n", rank, i, others_req[i].count); -#endif - if (others_req[i].count) { - start_pos[i] = curr_offlen_ptr[i]; - for (j=curr_offlen_ptr[i]; j<others_req[i].count; - j++) { - if (partial_send[i]) { - /* this request may have been partially - satisfied in the previous iteration. */ - req_off = others_req[i].offsets[j] + - partial_send[i]; - req_len = others_req[i].lens[j] - - partial_send[i]; - partial_send[i] = 0; - /* modify the off-len pair to reflect this change */ - others_req[i].offsets[j] = req_off; - others_req[i].lens[j] = req_len; - } - else { - req_off = others_req[i].offsets[j]; - req_len = others_req[i].lens[j]; - } - if (req_off < real_off + real_size) { - count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+req_off-real_off) == (ADIO_Offset)(MPIU_Upint)(read_buf+req_off-real_off)); - MPI_Get_address(read_buf+req_off-real_off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off)); - send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off, - (ADIO_Offset)(unsigned)req_len)); - - if (real_off+real_size-req_off < (ADIO_Offset)(unsigned)req_len) { - partial_send[i] = (int) (real_off + real_size - req_off); - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < - real_off+real_size)) { - /* this is the case illustrated in the - figure above. */ - for_next_iter = ADIOI_MAX(for_next_iter, - real_off + real_size - others_req[i].offsets[j+1]); - /* max because it must cover requests - from different processes */ - } - break; - } - } - else break; - } - curr_offlen_ptr[i] = j; - } - } - - flag = 0; - for (i=0; i<nprocs; i++) - if (count[i]) flag = 1; - -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); -#endif - if (flag) { - char round[50]; - sprintf(round, "two-phase-round=%d", m); - setenv("LIBIOLOG_EXTRA_INFO", round, 1); - ADIOI_Assert(size == (int)size); - ADIO_ReadContig(fd, read_buf+for_curr_iter, (int)size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, error_code); -#ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "\tread_coll: 700, data read [%lld] = ", size ); - for (iii=0; iii<size && iii<80; iii++) { DBGV_FPRINTF(stderr, "%3d,", *((unsigned char *)read_buf + for_curr_iter + iii) ); } - DBG_FPRINTF(stderr, "\n" ); -#endif - - if (*error_code != MPI_SUCCESS) return; - } - - for_curr_iter = for_next_iter; - -#ifdef PROFILE - MPE_Log_event(7, 0, "start communication"); -#endif - if (gpfsmpio_comm == 1) - ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, - m, buftype_extent, buf_idx); - else - if (gpfsmpio_comm == 0) { - ADIOI_R_Exchange_data_alltoallv(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, - m, buftype_extent, buf_idx); - } - - -#ifdef PROFILE - MPE_Log_event(8, 0, "end communication"); -#endif - - if (for_next_iter) { - tmp_buf = (char *) ADIOI_Malloc(for_next_iter); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+real_size-for_next_iter) == (ADIO_Offset)(MPIU_Upint)(read_buf+real_size-for_next_iter)); - ADIOI_Assert((for_next_iter+coll_bufsize) == (size_t)(for_next_iter+coll_bufsize)); - memcpy(tmp_buf, read_buf+real_size-for_next_iter, for_next_iter); - ADIOI_Free(fd->io_buf); - fd->io_buf = (char *) ADIOI_Malloc(for_next_iter+coll_bufsize); - memcpy(fd->io_buf, tmp_buf, for_next_iter); - read_buf = fd->io_buf; - ADIOI_Free(tmp_buf); - } - - off += size; - done += size; - } - - for (i=0; i<nprocs; i++) count[i] = send_size[i] = 0; -#ifdef PROFILE - MPE_Log_event(7, 0, "start communication"); -#endif - for (m=ntimes; m<max_ntimes; m++) -/* nothing to send, but check for recv. */ - - if (gpfsmpio_comm == 1) - ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, m, - buftype_extent, buf_idx); - else /* strncmp( env_switch, "alltoall", 8 ) == 0 */ - if (gpfsmpio_comm == 0) - ADIOI_R_Exchange_data_alltoallv(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, - m, buftype_extent, buf_idx); - -#ifdef PROFILE - MPE_Log_event(8, 0, "end communication"); -#endif - - ADIOI_Free(curr_offlen_ptr); - ADIOI_Free(count); - ADIOI_Free(partial_send); - ADIOI_Free(send_size); - ADIOI_Free(recv_size); - ADIOI_Free(recd_from_proc); - ADIOI_Free(start_pos); - - unsetenv("LIBIOLOG_EXTRA_INFO"); -} - -static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, MPI_Aint buftype_extent, int *buf_idx) -{ - int i, j, k=0, tmp=0, nprocs_recv, nprocs_send; - char **recv_buf = NULL; - MPI_Request *requests; - MPI_Datatype send_type; - MPI_Status *statuses; - -/* exchange send_size info so that each process knows how much to - receive from whom and how much memory to allocate. */ - - MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); - - nprocs_recv = 0; - for (i=0; i < nprocs; i++) if (recv_size[i]) nprocs_recv++; - - nprocs_send = 0; - for (i=0; i<nprocs; i++) if (send_size[i]) nprocs_send++; - - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); -/* +1 to avoid a 0-size malloc */ - -/* post recvs. if buftype_is_contig, data can be directly recd. into - user buf at location given by buf_idx. else use recv_buf. */ - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - - if (buftype_is_contig) { - j = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - MPI_Irecv(((char *) buf) + buf_idx[i], recv_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, requests+j); - j++; - buf_idx[i] += recv_size[i]; - } - } - else { -/* allocate memory for recv_buf and post receives */ - recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char*)); - for (i=0; i < nprocs; i++) - if (recv_size[i]) recv_buf[i] = - (char *) ADIOI_Malloc(recv_size[i]); - - j = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, - myrank+i+100*iter, fd->comm, requests+j); - j++; -#ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", - myrank, recv_size[i], myrank+i+100*iter); -#endif - } - } - -/* create derived datatypes and send data */ - - j = 0; - for (i=0; i<nprocs; i++) { - if (send_size[i]) { -/* take care if the last off-len pair is a partial send */ - if (partial_send[i]) { - k = start_pos[i] + count[i] - 1; - tmp = others_req[i].lens[k]; - others_req[i].lens[k] = partial_send[i]; - } - ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, &send_type); - /* absolute displacement; use MPI_BOTTOM in send */ - MPI_Type_commit(&send_type); - MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank+i+100*iter, - fd->comm, requests+nprocs_recv+j); - MPI_Type_free(&send_type); - if (partial_send[i]) others_req[i].lens[k] = tmp; - j++; - } - } - - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - - /* wait on the receives */ - if (nprocs_recv) { -#ifdef NEEDS_MPI_TEST - j = 0; - while (!j) MPI_Testall(nprocs_recv, requests, &j, statuses); -#else - MPI_Waitall(nprocs_recv, requests, statuses); -#endif - - /* if noncontiguous, to the copies from the recv buffers */ - if (!buftype_is_contig) - ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, - offset_list, len_list, (unsigned*)recv_size, - requests, statuses, recd_from_proc, - nprocs, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - buftype_extent); - } - - /* wait on the sends*/ - MPI_Waitall(nprocs_send, requests+nprocs_recv, statuses+nprocs_recv); - - ADIOI_Free(statuses); - ADIOI_Free(requests); - - if (!buftype_is_contig) { - for (i=0; i < nprocs; i++) - if (recv_size[i]) ADIOI_Free(recv_buf[i]); - ADIOI_Free(recv_buf); - } -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif -} - -#define ADIOI_BUF_INCR \ -{ \ - while (buf_incr) { \ - size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - buf_incr -= size_in_buf; \ - } \ -} - - -#define ADIOI_BUF_COPY \ -{ \ - while (size) { \ - size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)(buf + user_buf_idx)); \ - ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ - memcpy(((char *) buf) + user_buf_idx, \ - &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ - recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - size -= size_in_buf; \ - buf_incr -= size_in_buf; \ - } \ - ADIOI_BUF_INCR \ -} - -static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, - unsigned *recv_size, - MPI_Request *requests, MPI_Status *statuses, - int *recd_from_proc, int nprocs, - int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - MPI_Aint buftype_extent) -{ - -/* this function is only called if buftype is not contig */ - - int i, p, flat_buf_idx; - ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; - int n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - /* Not sure unsigned is necessary, but it makes the math safer */ - unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; - - ADIOI_UNREFERENCED_ARG(requests); - ADIOI_UNREFERENCED_ARG(statuses); - -/* curr_from_proc[p] = amount of data recd from proc. p that has already - been accounted for so far - done_from_proc[p] = amount of data already recd from proc. p and - filled into user buffer in previous iterations - user_buf_idx = current location in user buffer - recv_buf_idx[p] = current location in recv_buf of proc. p */ - curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - done_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - recv_buf_idx = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - - for (i=0; i < nprocs; i++) { - recv_buf_idx[i] = curr_from_proc[i] = 0; - done_from_proc[i] = recd_from_proc[i]; - } - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - flat_buf_sz = size of current contiguous component in - flattened buf */ - - for (i=0; i<contig_access_count; i++) { - off = offset_list[i]; - rem_len = len_list[i]; - - /* this request may span the file domains of more than one process */ - while (rem_len > 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_GPFS_Calc_aggregator(fd, - off, - min_st_offset, - &len, - fd_size, - fd_start, - fd_end); - - if (recv_buf_idx[p] < recv_size[p]) { - if (curr_from_proc[p]+len > done_from_proc[p]) { - if (done_from_proc[p] > curr_from_proc[p]) { - size = ADIOI_MIN(curr_from_proc[p] + len - - done_from_proc[p], recv_size[p]-recv_buf_idx[p]); - buf_incr = done_from_proc[p] - curr_from_proc[p]; - ADIOI_BUF_INCR - buf_incr = curr_from_proc[p]+len-done_from_proc[p]; - ADIOI_Assert((done_from_proc[p] + size) == (unsigned)((ADIO_Offset)done_from_proc[p] + size)); - curr_from_proc[p] = done_from_proc[p] + size; - ADIOI_BUF_COPY - } - else { - size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]); - buf_incr = len; - ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size)); - curr_from_proc[p] += (unsigned) size; - ADIOI_BUF_COPY - } - } - else { - ADIOI_Assert((curr_from_proc[p] + len) == (unsigned)((ADIO_Offset)curr_from_proc[p] + len)); - curr_from_proc[p] += (unsigned) len; - buf_incr = len; - ADIOI_BUF_INCR - } - } - else { - buf_incr = len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i=0; i < nprocs; i++) - if (recv_size[i]) recd_from_proc[i] = curr_from_proc[i]; - - ADIOI_Free(curr_from_proc); - ADIOI_Free(done_from_proc); - ADIOI_Free(recv_buf_idx); -} - -static void ADIOI_R_Exchange_data_alltoallv( - ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, MPI_Aint buftype_extent, int *buf_idx) -{ - int i, j, k=0, tmp=0, nprocs_recv, nprocs_send; - char **recv_buf = NULL; - MPI_Request *requests=NULL; - MPI_Status *statuses=NULL; - int rtail, stail; - char *sbuf_ptr, *from_ptr; - int len; - int *sdispls, *rdispls; - char *all_recv_buf, *all_send_buf; - - /* exchange send_size info so that each process knows how much to - receive from whom and how much memory to allocate. */ - MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); - - nprocs_recv = 0; - for (i=0; i<nprocs; i++) if (recv_size[i]) { nprocs_recv++; break; } - - nprocs_send = 0; - for (i=0; i<nprocs; i++) if (send_size[i]) { nprocs_send++; break; } - - /* receiver side data structures */ - rdispls = (int *) ADIOI_Malloc( nprocs * sizeof(int) ); - rtail = 0; - for (i=0; i<nprocs; i++) { rdispls[i] = rtail; rtail += recv_size[i]; } - - /* data buffer */ - all_recv_buf = (char *) ADIOI_Malloc( rtail ); - recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); - for (i=0; i<nprocs; i++) { recv_buf[i] = all_recv_buf + rdispls[i]; } - - /* sender side data structures */ - sdispls = (int *) ADIOI_Malloc( nprocs * sizeof(int) ); - stail = 0; - for (i=0; i<nprocs; i++) { sdispls[i] = stail; stail += send_size[i]; } - - /* data buffer */ - all_send_buf = (char *) ADIOI_Malloc( stail ); - for (i=0; i<nprocs; i++) - { - if (send_size[i]) { - if (partial_send[i]) { - k = start_pos[i] + count[i] - 1; - tmp = others_req[i].lens[k]; - others_req[i].lens[k] = partial_send[i]; - } - sbuf_ptr = all_send_buf + sdispls[i]; - for (j=0; j<count[i]; j++) { - ADIOI_ENSURE_AINT_FITS_IN_PTR( others_req[i].mem_ptrs[ start_pos[i]+j ]); - from_ptr = (char *) ADIOI_AINT_CAST_TO_VOID_PTR ( others_req[i].mem_ptrs[ start_pos[i]+j ] ); - len = others_req[i].lens[ start_pos[i]+j ] ; - memcpy( sbuf_ptr, from_ptr, len ); - sbuf_ptr += len; - } - if (partial_send[i]) others_req[i].lens[k] = tmp; - } - } - -#if RDCOLL_DEBUG - DBG_FPRINTF(stderr, "\tsend_size = [%d]%2d,",0,send_size[0]); - for (i=1; i<nprocs; i++) if(send_size[i-1]!=send_size[i]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i,send_size[i] ); } - DBG_FPRINTF(stderr, "\trecv_size = [%d]%2d,",0,recv_size[0]); - for (i=1; i<nprocs; i++) if(recv_size[i-1]!=recv_size[i]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i,recv_size[i] ); } - DBG_FPRINTF(stderr, "\tsdispls = [%d]%2d,",0,sdispls[0]); - for (i=1; i<nprocs; i++) if(sdispls[i-1]!=sdispls[i]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i,sdispls [i] ); } - DBG_FPRINTF(stderr, "\trdispls = [%d]%2d,",0,rdispls[0]); - for (i=1; i<nprocs; i++) if(rdispls[i-1]!=rdispls[i]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i,rdispls [i] ); } - DBG_FPRINTF(stderr, "\ttails = %4d, %4d\n", stail, rtail ); - if (nprocs_send) { - DBG_FPRINTF(stderr, "\tall_send_buf = [%d]%2d,",0,all_send_buf[0]); - /* someone at some point found it useful to look at the 128th kilobyte of data from each processor, but this segfaults in many situations if "all debugging" enabled */ - //for (i=1; i<nprocs; i++) if(all_send_buf[(i-1)*131072]!=all_send_buf[i*131072]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, all_send_buf [i*131072] ); } - } -#endif - - /* alltoallv */ - MPI_Alltoallv( - all_send_buf, send_size, sdispls, MPI_BYTE, - all_recv_buf, recv_size, rdispls, MPI_BYTE, - fd->comm ); - -#if 0 - DBG_FPRINTF(stderr, "\tall_recv_buf = " ); - for (i=131072; i<131073; i++) { DBG_FPRINTF(stderr, "%2d,", all_recv_buf [i] ); } - DBG_FPRINTF(stderr, "\n" ); -#endif - - /* unpack at the receiver side */ - if (nprocs_recv) { - if (!buftype_is_contig) - ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, - offset_list, len_list, (unsigned*)recv_size, - requests, statuses, /* never used inside */ - recd_from_proc, - nprocs, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - buftype_extent); - else { - rtail = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - memcpy( (char *)buf + buf_idx[i], all_recv_buf + rtail, recv_size[i] ); - buf_idx[i] += recv_size[i]; - rtail += recv_size[i]; - } - } - } - - ADIOI_Free( all_send_buf ); - ADIOI_Free( all_recv_buf ); - ADIOI_Free( recv_buf ); - ADIOI_Free( sdispls ); - ADIOI_Free( rdispls ); - return; -} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.c deleted file mode 100644 index 333612b0da1be1902a75698608c33f4906b7cf75..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.c +++ /dev/null @@ -1,338 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_tuning.c - * \brief Defines ad_gpfs performance tuning - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/*--------------------------------------------------------------------- - * ad_gpfs_tuning.c - * - * defines global variables and functions for performance tuning and - * functional debugging. - *---------------------------------------------------------------------*/ - -#include "ad_gpfs_tuning.h" -#include "mpi.h" - -#if !defined(PVFS2_SUPER_MAGIC) - #define PVFS2_SUPER_MAGIC (0x20030528) -#endif - - -int gpfsmpio_timing; -int gpfsmpio_timing2; -int gpfsmpio_timing_cw_level; -int gpfsmpio_comm; -int gpfsmpio_tunegather; -int gpfsmpio_tuneblocking; -long bglocklessmpio_f_type; -int gpfsmpio_bg_nagg_pset; -int gpfsmpio_pthreadio; -int gpfsmpio_p2pcontig; -int gpfsmpio_write_aggmethod; -int gpfsmpio_read_aggmethod; -int gpfsmpio_balancecontig; -int gpfsmpio_devnullio; -int gpfsmpio_bridgeringagg; -int gpfsmpio_onesided_no_rmw; -int gpfsmpio_onesided_always_rmw; -int gpfsmpio_onesided_inform_rmw; - -double gpfsmpio_prof_cw [GPFSMPIO_CIO_LAST+1]; -double gpfsmpio_prof_cr [GPFSMPIO_CIO_LAST+1]; - -/* set internal variables for tuning environment variables */ -/** \page mpiio_vars MPIIO Configuration - \section env_sec Environment Variables - * - GPFSMPIO_COMM - Define how data is exchanged on collective - * reads and writes. Possible values: - * - 0 - Use MPI_Alltoallv. - * - 1 - Use MPI_Isend/MPI_Irecv. - * - Default is 0. - * - * - GPFSMPIO_TIMING - collect timing breakdown for MPI I/O collective calls. - * Possible values: - * - 0 - Do not collect/report timing. - * - 1 - Collect/report timing. - * - Default is 0. - * - * - GPFSMPIO_TUNEGATHER - Tune how starting and ending offsets are communicated - * for aggregator collective i/o. Possible values: - * - 0 - Use two MPI_Allgather's to collect starting and ending offsets. - * - 1 - Use MPI_Allreduce(MPI_MAX) to collect starting and ending offsets. - * - Default is 1. - * - * - GPFSMPIO_TUNEBLOCKING - Tune how aggregate file domains are - * calculated (block size). Possible values: - * - 0 - Evenly calculate file domains across aggregators. Also use - * MPI_Isend/MPI_Irecv to exchange domain information. - * - 1 - Align file domains with the underlying file system's block size. Also use - * MPI_Alltoallv to exchange domain information. - * - Default is 1. - * - * - BGLOCKLESSMPIO_F_TYPE - Specify a filesystem type that should run - * the ad_bglockless driver. NOTE: Using romio prefixes (such as - * "bg:" or "bglockless:") on a file name will override this environment - * variable. Possible values: - * - 0xnnnnnnnn - Any valid file system type (or "magic number") from - * statfs() field f_type. - * - The default is 0x20030528 (PVFS2_SUPER_MAGIC) - * - * - GPFSMPIO_NAGG_PSET - Specify a ratio of "I/O aggregators" to use for each - * compute group (compute nodes + i/o nodes). Possible values: - * - any integer - * - Default is 8 - * - * - GPFSMPIO_PTHREADIO - Enables a very simple form of asyncronous io where a - * pthread is spawned to do the posix writes while the main thread does the - * data aggregation - useful for large files where multiple rounds are - * required (more that the cb_buffer_size of data per aggregator). User - * must ensure there is hw resource available for the thread to run. I - * am sure there is a better way to do this involving comm threads - this is - * just a start. NOTE: For some reason the stats collected when this is - * enabled misses some of the data so the data sizes are off a bit - this is - * a statistical issue only, the data is still accurately written out - * - * - GPFSMPIO_P2PCONTIG - Does simple point-to-point communication between the - * aggregator and the procs that feed it. Performance could be enhanced by a - * one-sided put algorithm. Current implementation allows only 1 round of - * data. Useful/allowed only when: - * 1.) The datatype is contiguous. - * 2.) The offsets are increasing in rank-order. - * 3.) There are no gaps between the offsets. - * 4.) No single rank has a data size which spans multiple file domains. - * - * - GPFSMPIO_WRITE_AGGMETHOD/GPFSMPIO_READ_AGGMETHOD - Replaces the two-phase - * collective IO aggregation - * with a one-sided algorithm, significantly reducing communication and - * memory overhead. Fully - * supports all datasets and datatypes, the only caveat is that any holes in the data - * when writing to a pre-existing file are ignored -- there is no read-modify-write - * support to maintain the correctness of regions of pre-existing data so every byte - * must be explicitly written to maintain correctness. Users must beware of middle-ware - * libraries like PNETCDF which may count on read-modify-write functionality for certain - * features (like fill values). Possible values: - * - 0 - Normal two-phase collective IO is used. - * - 1 - A separate one-sided MPI_Put or MPI_Get is used for each contigous chunk of data - * for a compute to write to or read from the collective buffer on the aggregator. - * - 2 - An MPI derived datatype is created using all the contigous chunks and just one - * call to MPI_Put or MPI_Get is done with the derived datatype. On Blue Gene /Q - * optimal performance for this is achieved when paired with PAMID_TYPED_ONESIDED=1. - * - Default is 0 - * - * - GPFSMPIO_ONESIDED_NO_RMW - For one-sided aggregation (GPFSMPIO_WRITE_AGGMETHOD = 1 or 2) - * disable the detection of holes in the data when writing to a pre-existing - * file requiring a read-modify-write, thereby avoiding the communication - * overhead for this detection. - * - 0 (hole detection enabled) or 1 (hole detection disabled) - * - Default is 0 - * - * - GPFSMPIO_ONESIDED_INFORM_RMW - For one-sided aggregation - * (GPFSMPIO_AGGMETHOD = 1 or 2) generate an informational message informing - * the user whether holes exist in the data when writing to a pre-existing - * file requiring a read-modify-write, thereby educating the user to set - * GPFSMPIO_ONESIDED_NO_RMW=1 on a future run to avoid the communication - * overhead for this detection. - * - 0 (disabled) or 1 (enabled) - * - Default is 0 - * - * - GPFSMPIO_BALANCECONTIG - Relevant only to BGQ. File domain blocks are assigned - * to aggregators in a breadth-first fashion relative to the ions - additionally, - * file domains on the aggregators sharing the same bridgeset and ion have contiguous - * offsets. The breadth-first assignment improves performance in the case of - * a relatively small file of size less than the gpfs block size multiplied - * by the number of ions. Files: ad_gpfs_aggrs.c ad_bg_aggrs.c. Possible Values - * - 0 - assign file domain blocks in the traditional manner - * - 1 - if there are variable sized file domain blocks, spread them out - * (balance) across bridge nodes - * - * - GPFSMPIO_DEVNULLIO - do everything *except* write to / read from the file - * system. When experimenting with different two-phase I/O strategies, it's - * helpful to remove the highly variable file system from the experiment. - * - 0 (disabled) or 1 (enabled) - * - Default is 0 - * - * - GPFSMPIO_BRIDGERINGAGG - Relevant only to BGQ. Aggregator placement - * optimization whch forms a 5-d ring around the bridge node starting at - * GPFSMPIO_BRIDGERINGAGG hops away. Experimental performance results - * suggest best value is 1 and only in conjunction with GPFSMPIO_P2PCONTIG - * and GPFSMPIO_BALANCECONTIG. The number of aggregators selected is still - * GPFSMPIO_NAGG_PSET however the bridge node itself is NOT selected. - * - */ - -void ad_gpfs_get_env_vars() { - char *x, *dummy; - - gpfsmpio_comm = 0; - x = getenv( "GPFSMPIO_COMM" ); - if (x) gpfsmpio_comm = atoi(x); - gpfsmpio_timing = 0; - x = getenv( "GPFSMPIO_TIMING" ); - if (x) gpfsmpio_timing = atoi(x); - gpfsmpio_tunegather = 1; - x = getenv( "GPFSMPIO_TUNEGATHER" ); - if (x) gpfsmpio_tunegather = atoi(x); - gpfsmpio_tuneblocking = 1; - x = getenv( "GPFSMPIO_TUNEBLOCKING" ); - if (x) gpfsmpio_tuneblocking = atoi(x); - bglocklessmpio_f_type = PVFS2_SUPER_MAGIC; - x = getenv( "BGLOCKLESSMPIO_F_TYPE" ); - if (x) bglocklessmpio_f_type = strtol(x,&dummy,0); - DBG_FPRINTF(stderr,"BGLOCKLESSMPIO_F_TYPE=%ld/%#lX\n", - bglocklessmpio_f_type,bglocklessmpio_f_type); - /* note: this value will be 'sanity checked' in ADIOI_BG_persInfo_init(), - * when we know a bit more about what "largest possible value" and - * "smallest possible value" should be */ - gpfsmpio_bg_nagg_pset = ADIOI_BG_NAGG_PSET_DFLT; - x = getenv("GPFSMPIO_NAGG_PSET"); - if (x) gpfsmpio_bg_nagg_pset = atoi(x); - - gpfsmpio_pthreadio = 0; - x = getenv( "GPFSMPIO_PTHREADIO" ); - if (x) gpfsmpio_pthreadio = atoi(x); - - gpfsmpio_p2pcontig = 0; - x = getenv( "GPFSMPIO_P2PCONTIG" ); - if (x) gpfsmpio_p2pcontig = atoi(x); - - gpfsmpio_write_aggmethod = 0; - x = getenv( "GPFSMPIO_WRITE_AGGMETHOD" ); - if (x) gpfsmpio_write_aggmethod = atoi(x); - - gpfsmpio_read_aggmethod = 0; - x = getenv( "GPFSMPIO_READ_AGGMETHOD" ); - if (x) gpfsmpio_read_aggmethod = atoi(x); - - gpfsmpio_balancecontig = 0; - x = getenv( "GPFSMPIO_BALANCECONTIG" ); - if (x) gpfsmpio_balancecontig = atoi(x); - - gpfsmpio_devnullio = 0; - x = getenv( "GPFSMPIO_DEVNULLIO" ); - if (x) gpfsmpio_devnullio = atoi(x); - - gpfsmpio_bridgeringagg = 0; - x = getenv( "GPFSMPIO_BRIDGERINGAGG" ); - if (x) gpfsmpio_bridgeringagg = atoi(x); - - gpfsmpio_onesided_no_rmw = 0; - x = getenv( "GPFSMPIO_ONESIDED_NO_RMW" ); - if (x) gpfsmpio_onesided_no_rmw = atoi(x); - - gpfsmpio_onesided_always_rmw = 0; - x = getenv( "GPFSMPIO_ONESIDED_ALWAYS_RMW" ); - if (x) gpfsmpio_onesided_always_rmw = atoi(x); - if (gpfsmpio_onesided_always_rmw) - gpfsmpio_onesided_no_rmw = 1; - - gpfsmpio_onesided_inform_rmw = 0; - x = getenv( "GPFSMPIO_ONESIDED_INFORM_RMW" ); - if (x) gpfsmpio_onesided_inform_rmw = atoi(x); -} - -/* report timing breakdown for MPI I/O collective call */ -void ad_gpfs_timing_crw_report( int rw, ADIO_File fd, int myrank, int nprocs ) -{ - int i; - - if (gpfsmpio_timing) { - /* Timing across the whole communicator is a little bit interesting, - * but what is *more* interesting is if we single out the aggregators - * themselves. non-aggregators spend a lot of time in "exchange" not - * exchanging data, but blocked because they are waiting for - * aggregators to finish writing. If we focus on just the aggregator - * processes we will get a more clear picture about the data exchange - * vs. i/o time breakdown */ - - /* if deferred open enabled, we could use the aggregator communicator */ - MPI_Comm agg_comm; - int nr_aggs, agg_rank; - MPI_Comm_split(fd->comm, (fd->is_agg ? 1 : MPI_UNDEFINED), 0, &agg_comm); - if(agg_comm != MPI_COMM_NULL) { - MPI_Comm_size(agg_comm, &nr_aggs); - MPI_Comm_rank(agg_comm, &agg_rank); - } - - double *gpfsmpio_prof_org = gpfsmpio_prof_cr; - if (rw) gpfsmpio_prof_org = gpfsmpio_prof_cw; - - double gpfsmpio_prof_avg[ GPFSMPIO_CIO_LAST ]; - double gpfsmpio_prof_max[ GPFSMPIO_CIO_LAST ]; - - if( agg_comm != MPI_COMM_NULL) { - MPI_Reduce( gpfsmpio_prof_org, gpfsmpio_prof_avg, GPFSMPIO_CIO_LAST, MPI_DOUBLE, MPI_SUM, 0, agg_comm); - MPI_Reduce( gpfsmpio_prof_org, gpfsmpio_prof_max, GPFSMPIO_CIO_LAST, MPI_DOUBLE, MPI_MAX, 0, agg_comm); - } - if (agg_comm != MPI_COMM_NULL && agg_rank == 0) { - - for (i=0; i<GPFSMPIO_CIO_LAST; i++) gpfsmpio_prof_avg[i] /= nr_aggs; - - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_POSI_RW ] = - gpfsmpio_prof_avg[ GPFSMPIO_CIO_DATA_SIZE ] * nr_aggs / - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_POSI_RW ]; - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_MPIO_RW ] = - gpfsmpio_prof_avg[ GPFSMPIO_CIO_DATA_SIZE ] * nr_aggs / - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_MPIO_RW ]; - - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_MPIO_CRW ] = - gpfsmpio_prof_avg[ GPFSMPIO_CIO_DATA_SIZE ] * nr_aggs / - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_MPIO_CRW ]; - - fprintf(stderr,"TIMING-%1s,", (rw ? "W" : "R") ); - fprintf(stderr,"SIZE: %12.4lld , ", (long long int)(gpfsmpio_prof_avg[ GPFSMPIO_CIO_DATA_SIZE ] * nr_aggs)); - fprintf(stderr,"SEEK-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_SEEK ] ); - fprintf(stderr,"SEEK-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_SEEK ] ); - fprintf(stderr,"LOCAL-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_LCOMP ] ); - fprintf(stderr,"GATHER-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_GATHER ] ); - fprintf(stderr,"PATTERN-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_PATANA ] ); - fprintf(stderr,"FILEDOMAIN-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_FD_PART ] ); - fprintf(stderr,"MYREQ-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_MYREQ ] ); - fprintf(stderr,"OTHERREQ-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_OTHREQ ] ); - fprintf(stderr,"EXCHANGE-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH ] ); - fprintf(stderr, "EXCHANGE-RECV_EXCH-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH_RECV_EXCH] ); - fprintf(stderr, "EXCHANGE-SETUP-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH_SETUP] ); - fprintf(stderr, "EXCHANGE-NET-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH_NET] ); - fprintf(stderr, "EXCHANGE-SORT-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH_SORT] ); - fprintf(stderr, "EXCHANGE-SIEVE-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_DEXCH_SIEVE] ); - fprintf(stderr,"POSIX-TIME-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_POSI_RW ] ); - fprintf(stderr,"POSIX-TIME-max: %10.3f , ", - gpfsmpio_prof_max[ GPFSMPIO_CIO_T_POSI_RW ] ); - fprintf(stderr,"MPIIO-CONTIG-TIME-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_MPIO_RW ] ); - fprintf(stderr,"MPIIO-STRIDED-TIME-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_T_MPIO_CRW ] ); - fprintf(stderr,"POSIX-BW-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_POSI_RW ] ); - fprintf(stderr,"MPI-BW-avg: %10.3f , ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_MPIO_RW ] ); - fprintf(stderr,"MPI-BW-collective-avg: %10.3f\n ", - gpfsmpio_prof_avg[ GPFSMPIO_CIO_B_MPIO_CRW ] ); - } - if (agg_comm != MPI_COMM_NULL) MPI_Comm_free(&agg_comm); - } - -} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.h b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.h deleted file mode 100644 index 35fdc8d8c36a5c54f980fc6c242e56969bed4aaa..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_tuning.h +++ /dev/null @@ -1,119 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_tuning.h - * \brief ??? - */ - -/*--------------------------------------------------------------------- - * ad_gpfs_tuning.h - * - * declares global variables and macros for performance tuning and - * functional debugging. - *---------------------------------------------------------------------*/ - -#ifndef AD_GPFS_TUNING_H_ -#define AD_GPFS_TUNING_H_ - -#include "adio.h" - - -/*----------------------------------------- - * Global variables for the control of - * 1. timing - * 2. select specific optimizations - * 3. global flags for certain optimizations - *-----------------------------------------*/ - -/* timing fields */ -enum { - GPFSMPIO_CIO_DATA_SIZE=0, - GPFSMPIO_CIO_T_SEEK, - GPFSMPIO_CIO_T_LCOMP, /* time for ADIOI_Calc_my_off_len(), local */ - GPFSMPIO_CIO_T_GATHER, /* time for previous MPI_Allgather, now Allreduce */ - GPFSMPIO_CIO_T_PATANA, /* time for a quick test if access is contiguous or not, local */ - GPFSMPIO_CIO_T_FD_PART, /* time for file domain partitioning, local */ - GPFSMPIO_CIO_T_MYREQ, /* time for ADIOI_Calc_my_req(), local */ - GPFSMPIO_CIO_T_OTHREQ, /* time for ADIOI_Calc_others_req(), short Alltoall */ - GPFSMPIO_CIO_T_DEXCH, /* time for I/O data exchange */ - /* the next DEXCH_* timers capture finer-grained portions of T_DEXCH */ - GPFSMPIO_CIO_T_DEXCH_RECV_EXCH,/* time for each process to exchange recieve - size info with everyone else */ - GPFSMPIO_CIO_T_DEXCH_SETUP, /* time for setup portion of I/O data exchange */ - GPFSMPIO_CIO_T_DEXCH_NET, /* time for network portion of I/O data exchange */ - GPFSMPIO_CIO_T_DEXCH_SORT, /* time to sort requesst in I/O data exchange */ - GPFSMPIO_CIO_T_DEXCH_SIEVE, /* time for read portion of RMW in two phase */ - GPFSMPIO_CIO_T_POSI_RW, - GPFSMPIO_CIO_B_POSI_RW, - GPFSMPIO_CIO_T_MPIO_RW, /* time for ADIOI_WriteContig() */ - GPFSMPIO_CIO_B_MPIO_RW, - GPFSMPIO_CIO_T_MPIO_CRW, /* time for ADIOI_GPFS_WriteStridedColl() */ - GPFSMPIO_CIO_B_MPIO_CRW, - GPFSMPIO_CIO_LAST -}; - -/* +1 because GPFSMPIO_CIO_LAST is actually used to say "zero this counter"" */ -extern double gpfsmpio_prof_cw [GPFSMPIO_CIO_LAST+1]; -extern double gpfsmpio_prof_cr [GPFSMPIO_CIO_LAST+1]; - -/* corresponds to environment variables to select optimizations and timing level */ -extern int gpfsmpio_timing; -extern int gpfsmpio_timing_cw_level; -extern int gpfsmpio_comm; -extern int gpfsmpio_tunegather; -extern int gpfsmpio_tuneblocking; -extern long bglocklessmpio_f_type; -extern int gpfsmpio_pthreadio; -extern int gpfsmpio_p2pcontig; -extern int gpfsmpio_write_aggmethod; -extern int gpfsmpio_read_aggmethod; -extern int gpfsmpio_balancecontig; -extern int gpfsmpio_devnullio; -extern int gpfsmpio_bridgeringagg; -extern int gpfsmpio_onesided_no_rmw; -extern int gpfsmpio_onesided_always_rmw; -extern int gpfsmpio_onesided_inform_rmw; - -/* Default is, well, kind of complicated. Blue Gene /L and /P had "psets": one - * i/o node and all compute nodes wired to it. On Blue Gene /Q that - * relationship is a lot more fluid. There are still I/O nodes, and compute - * nodes are assigned to an i/o node, but there are two routes to the i/o node, - * via compute nodes designated as "bridge nodes". In this code, what we used - * to call a "pset" is actually "compute nodes associated with and including a - * bridge node". So, "nAgg" is roughly "number of aggregators per bridge", but - * look closely at ADIOI_BG_persInfo_init() for the details */ - -#define ADIOI_BG_NAGG_PSET_DFLT 16 - -extern int gpfsmpio_bg_nagg_pset; - - -/* set internal variables for tuning environment variables */ -void ad_gpfs_get_env_vars(void); - -/* report timing breakdown for MPI I/O collective call */ -void ad_gpfs_timing_crw_report( int rw, ADIO_File fd, int myrank, int nprocs ); - -/* note: - * T := timing; - * CIO := collective I/O - */ -#define GPFSMPIO_T_CIO_RESET( RW ) \ - { \ - int _i; \ - for ( _i = 0; _i < GPFSMPIO_CIO_LAST; _i ++ ) \ - gpfsmpio_prof_c##RW [ _i ] = 0; \ - } - -#define GPFSMPIO_T_CIO_REPORT( RW, FD, MYRANK, NPROCS ) \ - ad_gpfs_timing_crw_report ( RW, FD, MYRANK, NPROCS ); \ - -#define GPFSMPIO_T_CIO_SET_GET(RW, ISSET, ISGET, VAR1, VAR2 ) \ - {\ - double temp = MPI_Wtime(); \ - if ( ISSET ) gpfsmpio_prof_c##RW [ VAR1 ] = temp; \ - if ( ISGET ) gpfsmpio_prof_c##RW [ VAR2 ] = temp - gpfsmpio_prof_c##RW [ VAR2 ] ;\ - } - -#endif /* AD_GPFS_TUNING_H_ */ diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_wrcoll.c b/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_wrcoll.c deleted file mode 100644 index 301f78dc931797cb16b26598cb725dc9d95c1707..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_wrcoll.c +++ /dev/null @@ -1,1814 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_gpfs_wrcoll.c - * \brief ??? - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_gpfs.h" -#include "ad_gpfs_aggrs.h" - -#ifdef BGQPLATFORM -#include "bg/ad_bg_pset.h" -#endif - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif -#ifdef PROFILE -#include "mpe.h" -#endif - -#include <pthread.h> - -#ifdef HAVE_GPFS_H -#include <gpfs.h> -#endif -#ifdef HAVE_GPFS_FCNTL_H -#include <gpfs_fcntl.h> -#endif - -#include <limits.h> -/* prototypes of functions used for collective writes only. */ -static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype - datatype, int nprocs, int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code); -static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf, - ADIOI_Flatlist_node *flat_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, int size, - int *count, int *start_pos, int *partial_recv, - int *sent_to_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int *hole, int iter, - MPI_Aint buftype_extent, int *buf_idx, int *error_code); -static void ADIOI_W_Exchange_data_alltoallv( - ADIO_File fd, const void *buf, - char *write_buf, /* 1 */ - ADIOI_Flatlist_node *flat_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, int *recv_size, - ADIO_Offset off, int size, /* 2 */ - int *count, int *start_pos, int *partial_recv, - int *sent_to_proc, int nprocs, int myrank, - int buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, /* 3 */ - int *done_to_proc, int *hole, /* 4 */ - int iter, MPI_Aint buftype_extent, int *buf_idx, - int *error_code); -static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent); -static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent); -static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, - int nprocs, int nprocs_recv, int total_elements); - - -void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ - - ADIOI_Access *my_req; - /* array of nprocs access structures, one for each other process in - whose file domain this process's request lies */ - - ADIOI_Access *others_req; - /* array of nprocs access structures, one for each other process - whose request lies in this process's file domain. */ - - int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int contig_access_count=0, interleave_count = 0, buftype_is_contig; - int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; - ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, - *fd_end = NULL, *end_offsets = NULL; - ADIO_Offset *gpfs_offsets0 = NULL, *gpfs_offsets = NULL; - ADIO_Offset *count_sizes; - int ii; - - int *buf_idx = NULL; - ADIO_Offset *len_list = NULL; - GPFSMPIO_T_CIO_RESET( w ) -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - -/* the number of processes that actually perform I/O, nprocs_for_coll, - * is stored in the hints off the ADIO_File structure - */ - nprocs_for_coll = fd->hints->cb_nodes; - orig_fp = fd->fp_ind; - - GPFSMPIO_T_CIO_SET_GET( w, 1, 0, GPFSMPIO_CIO_T_MPIO_CRW, GPFSMPIO_CIO_LAST) - GPFSMPIO_T_CIO_SET_GET( w, 1, 0, GPFSMPIO_CIO_T_LCOMP, GPFSMPIO_CIO_LAST ) - - - /* only check for interleaving if cb_write isn't disabled */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); - - GPFSMPIO_T_CIO_SET_GET( w, 1, 1, GPFSMPIO_CIO_T_GATHER, GPFSMPIO_CIO_T_LCOMP ) - - /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets stored - in order of process rank. */ - - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - - ADIO_Offset my_count_size=0; - /* One-sided aggregation needs the amount of data per rank as well because - * the difference in starting and ending offsets for 1 byte is 0 the same - * as 0 bytes so it cannot be distiguished. - */ - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - count_sizes = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - MPI_Count buftype_size; - MPI_Type_size_x(datatype, &buftype_size); - my_count_size = (ADIO_Offset) count * (ADIO_Offset)buftype_size; - } - if (gpfsmpio_tunegather) { - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(3*nprocs*sizeof(ADIO_Offset)); - gpfs_offsets = (ADIO_Offset *) ADIOI_Malloc(3*nprocs*sizeof(ADIO_Offset)); - for (ii=0; ii<nprocs; ii++) { - gpfs_offsets0[ii*3] = 0; - gpfs_offsets0[ii*3+1] = 0; - gpfs_offsets0[ii*3+2] = 0; - } - gpfs_offsets0[myrank*3] = start_offset; - gpfs_offsets0[myrank*3+1] = end_offset; - gpfs_offsets0[myrank*3+2] = my_count_size; - MPI_Allreduce( gpfs_offsets0, gpfs_offsets, nprocs*3, ADIO_OFFSET, MPI_MAX, fd->comm ); - for (ii=0; ii<nprocs; ii++) { - st_offsets [ii] = gpfs_offsets[ii*3] ; - end_offsets[ii] = gpfs_offsets[ii*3+1]; - count_sizes[ii] = gpfs_offsets[ii*3+2]; - } - } - else { - gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); - gpfs_offsets = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); - for (ii=0; ii<nprocs; ii++) { - gpfs_offsets0[ii*2] = 0; - gpfs_offsets0[ii*2+1] = 0; - } - gpfs_offsets0[myrank*2] = start_offset; - gpfs_offsets0[myrank*2+1] = end_offset; - - MPI_Allreduce( gpfs_offsets0, gpfs_offsets, nprocs*2, ADIO_OFFSET, MPI_MAX, fd->comm ); - - for (ii=0; ii<nprocs; ii++) { - st_offsets [ii] = gpfs_offsets[ii*2] ; - end_offsets[ii] = gpfs_offsets[ii*2+1]; - } - } - ADIOI_Free( gpfs_offsets0 ); - ADIOI_Free( gpfs_offsets ); - } else { - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, - ADIO_OFFSET, fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, - ADIO_OFFSET, fd->comm); - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - MPI_Allgather(&count_sizes, 1, ADIO_OFFSET, count_sizes, 1, - ADIO_OFFSET, fd->comm); - } - } - - GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_PATANA, GPFSMPIO_CIO_T_GATHER ) - - /* are the accesses of different processes interleaved? */ - for (i=1; i<nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - - if (fd->hints->cb_write == ADIOI_HINT_DISABLE || - (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) - { - /* use independent accesses */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - } - - fd->fp_ind = orig_fp; - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - if (buftype_is_contig && filetype_is_contig) { - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; - ADIO_WriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, - off, status, error_code); - } - else ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } - else ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - - return; - } - - GPFSMPIO_T_CIO_SET_GET( w, 1, 1, GPFSMPIO_CIO_T_FD_PART, GPFSMPIO_CIO_T_PATANA ) - -/* Divide the I/O workload among "nprocs_for_coll" processes. This is - done by (logically) dividing the file into file domains (FDs); each - process may directly access only its own file domain. */ - - int currentValidDataIndex = 0; - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - /* Take out the 0-data offsets by shifting the indexes with data to the front - * and keeping track of the valid data index for use as the length. - */ - for (i=0; i<nprocs; i++) { - if (count_sizes[i] > 0) { - st_offsets[currentValidDataIndex] = st_offsets[i]; - end_offsets[currentValidDataIndex] = end_offsets[i]; - currentValidDataIndex++; - } - } - } - - if (gpfsmpio_tuneblocking) { - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, - currentValidDataIndex, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size, fd->fs_ptr); - } - else { - - ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size, fd->fs_ptr); - } - } - else { - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - ADIOI_Calc_file_domains(st_offsets, end_offsets, currentValidDataIndex, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - } - else { - ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - } - } - - GPFSMPIO_T_CIO_SET_GET( w, 1, 1, GPFSMPIO_CIO_T_MYREQ, GPFSMPIO_CIO_T_FD_PART ); - - if ((gpfsmpio_write_aggmethod == 1) || (gpfsmpio_write_aggmethod == 2)) { - /* If the user has specified to use a one-sided aggregation method then do that at - * this point instead of the two-phase I/O. - */ - int holeFound = 0; - ADIOI_OneSidedWriteAggregation(fd, offset_list, len_list, contig_access_count, - buf, datatype, error_code, st_offsets, end_offsets, - currentValidDataIndex, fd_start, fd_end, &holeFound); - int anyHolesFound = 0; - if (!gpfsmpio_onesided_no_rmw) - MPI_Allreduce(&holeFound, &anyHolesFound, 1, MPI_INT, MPI_MAX, fd->comm); - if (anyHolesFound == 0) { - GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs) - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - ADIOI_Free(count_sizes); - goto fn_exit; - } - else { - /* Holes are found in the data and the user has not set - * gpfsmpio_onesided_no_rmw --- set gpfsmpio_onesided_always_rmw to 1 - * and re-call ADIOI_OneSidedWriteAggregation and if the user has - * gpfsmpio_onesided_inform_rmw set then inform him of this condition - * and behavior. - */ - - if (gpfsmpio_onesided_inform_rmw && (myrank ==0)) - FPRINTF(stderr,"Information: Holes found during one-sided " - "write aggregation algorithm --- re-running one-sided " - "write aggregation with GPFSMPIO_ONESIDED_ALWAYS_RMW set to 1.\n"); - gpfsmpio_onesided_always_rmw = 1; - int prev_gpfsmpio_onesided_no_rmw = gpfsmpio_onesided_no_rmw; - gpfsmpio_onesided_no_rmw = 1; - ADIOI_OneSidedWriteAggregation(fd, offset_list, len_list, contig_access_count, buf, datatype, error_code, st_offsets, end_offsets, currentValidDataIndex, fd_start, fd_end, &holeFound); - gpfsmpio_onesided_no_rmw = prev_gpfsmpio_onesided_no_rmw; - GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs) - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - ADIOI_Free(count_sizes); - goto fn_exit; - } - } - if (gpfsmpio_p2pcontig==1) { - /* For some simple yet common(?) workloads, full-on two-phase I/O is overkill. We can establish sub-groups of processes and their aggregator, and then these sub-groups will carry out a simplified two-phase over that sub-group. - * - * First verify that the filetype is contig and the offsets are - * increasing in rank order*/ - int inOrderAndNoGaps = 1; - for (i=0;i<(nprocs-1);i++) { - if (end_offsets[i] != (st_offsets[i+1]-1)) - inOrderAndNoGaps = 0; - } - if (inOrderAndNoGaps && buftype_is_contig) { - /* if these conditions exist then execute the P2PContig code else - * execute the original code */ - ADIOI_P2PContigWriteAggregation(fd, buf, - error_code, st_offsets, end_offsets, fd_start, fd_end); - /* NOTE: we are skipping the rest of two-phase in this path */ - GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs) - - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - - goto fn_exit; - } - } - -/* calculate what portions of the access requests of this process are - located in what file domains */ - - if (gpfsmpio_tuneblocking) - ADIOI_GPFS_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - else - ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - - GPFSMPIO_T_CIO_SET_GET( w, 1, 1, GPFSMPIO_CIO_T_OTHREQ, GPFSMPIO_CIO_T_MYREQ ) - -/* based on everyone's my_req, calculate what requests of other - processes lie in this process's file domain. - count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - if (gpfsmpio_tuneblocking) - ADIOI_GPFS_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, - &count_others_req_procs, &others_req); - else - ADIOI_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, - &count_others_req_procs, &others_req); - - GPFSMPIO_T_CIO_SET_GET( w, 1, 1, GPFSMPIO_CIO_T_DEXCH, GPFSMPIO_CIO_T_OTHREQ ) - - ADIOI_Free(count_my_req_per_proc); - for (i=0; i < nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } - ADIOI_Free(my_req); - -/* exchange data and write in sizes of no more than coll_bufsize. */ - ADIOI_Exch_and_write(fd, buf, datatype, nprocs, myrank, - others_req, offset_list, - len_list, contig_access_count, min_st_offset, - fd_size, fd_start, fd_end, buf_idx, error_code); - - GPFSMPIO_T_CIO_SET_GET( w, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_DEXCH ) - GPFSMPIO_T_CIO_SET_GET( w, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_MPIO_CRW ) - - GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs) - -/* free all memory allocated for collective I/O */ - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); - - for (i=0; i<nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } - ADIOI_Free(others_req); - - ADIOI_Free(buf_idx); - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - -fn_exit: -#ifdef HAVE_STATUS_SET_BYTES - if (status) { - MPI_Count bufsize, size; - /* Don't set status if it isn't needed */ - MPI_Type_size_x(datatype, &size); - bufsize = size * count; - MPIR_Status_set_bytes(status, datatype, bufsize); - } -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written during collective I/O. */ -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5013, 0, NULL); -#endif -} - -static void gpfs_wr_access_start(int fd, ADIO_Offset offset, ADIO_Offset length) -{ - int rc=0; -#ifdef HAVE_GPFS_FCNTL_H - struct { - gpfsFcntlHeader_t header; - gpfsAccessRange_t access; - } take_locks; - - take_locks.header.totalLength = sizeof(take_locks); - take_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - take_locks.header.fcntlReserved = 0; - - take_locks.access.structLen = sizeof(take_locks.access); - take_locks.access.structType = GPFS_ACCESS_RANGE; - take_locks.access.start = offset; - take_locks.access.length = length; - take_locks.access.isWrite = 1; - - rc = gpfs_fcntl(fd, &take_locks); -#endif - ADIOI_Assert(rc == 0); -} - -static void gpfs_wr_access_end(int fd, ADIO_Offset offset, ADIO_Offset length) -{ - int rc=0; -#ifdef HAVE_GPFS_FCNTL_H - struct { - gpfsFcntlHeader_t header; - gpfsFreeRange_t free; - } free_locks; - - - free_locks.header.totalLength = sizeof(free_locks); - free_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - free_locks.header.fcntlReserved = 0; - - free_locks.free.structLen = sizeof(free_locks.free); - free_locks.free.structType = GPFS_FREE_RANGE; - free_locks.free.start = offset; - free_locks.free.length = length; - - rc = gpfs_fcntl(fd, &free_locks); -#endif - ADIOI_Assert(rc == 0); -} - -#ifdef BGQPLATFORM -/* my_start, my_end: this processes file domain. coudd be -1,-1 for "no i/o" - * fd_start, fd_end: arrays of length fd->hints->cb_nodes specifying all file domains */ -static int gpfs_find_access_for_ion(ADIO_File fd, - ADIO_Offset my_start, ADIO_Offset my_end, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIO_Offset *start, ADIO_Offset *end) -{ - int my_ionode = BGQ_IO_node_id(); - int *rank_to_ionode; - int i, nprocs, rank; - ADIO_Offset group_start=LLONG_MAX, group_end=0; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &rank); - - rank_to_ionode = ADIOI_Calloc(nprocs, sizeof(int)); - MPI_Allgather(&my_ionode, 1, MPI_INT, rank_to_ionode, 1, MPI_INT, fd->comm); - - /* rank_to_ionode now contains a mapping from MPI rank to IO node */ - /* fd->hints->ranklist[] contains a list of MPI ranks that are aggregators */ - /* fd_start[] and fd_end[] contain a list of file domains. */ - - /* what we really want to do is take all the file domains associated - * with a given i/o node and find the begin/end of that range. - * - * Because gpfs_fcntl hints are expected to be released, we'll pass this - * start/end back to the caller, who will both declare and free this range - */ - if (my_start == -1 || my_end == -1) { - ADIOI_Free(rank_to_ionode); - return 0; /* no work to do */ - } - - for (i=0; i<fd->hints->cb_nodes; i++ ){ - if (my_ionode == rank_to_ionode[fd->hints->ranklist[i]] ) { - group_start = ADIOI_MIN(fd_start[i], group_start); - group_end = ADIOI_MAX(fd_end[i], group_end); - } - } - *start = group_start; - *end = group_end; - ADIOI_Free(rank_to_ionode); - return 1; -} -#endif // BGQPLATFORM - - -/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error - * code is created and returned in error_code. - */ -static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, - ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code) -{ -/* Send data to appropriate processes and write in sizes of no more - than coll_bufsize. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were written all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to write a distributed - array to a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ - - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ - ADIO_Offset size=0; - int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; - ADIO_Offset st_loc=-1, end_loc=-1, off, done, req_off; - char *write_buf=NULL, *write_buf2=NULL; - int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; - int *partial_recv, *sent_to_proc, *start_pos, flag; - int *send_buf_idx, *curr_to_proc, *done_to_proc; - MPI_Status status; - ADIOI_Flatlist_node *flat_buf=NULL; - MPI_Aint buftype_extent, buftype_lb; - int info_flag, coll_bufsize; - char *value; - static char myname[] = "ADIOI_EXCH_AND_WRITE"; - pthread_t io_thread; - void *thread_ret; - ADIOI_IO_ThreadFuncData io_thread_args; - - *error_code = MPI_SUCCESS; /* changed below if error */ - /* only I/O errors are currently reported */ - -/* calculate the number of writes of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - coll_bufsize = atoi(value); - ADIOI_Free(value); - - if (gpfsmpio_pthreadio == 1){ - /* ROMIO will spawn an additional thread. both threads use separate - * halves of the collective buffer*/ - coll_bufsize = coll_bufsize/2; - } - - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - st_loc = others_req[i].offsets[0]; - end_loc = others_req[i].offsets[0]; - break; - } - } - - for (i=0; i < nprocs; i++) - for (j=0; j < others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); - } - -/* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ - - ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); - - if ((st_loc==-1) && (end_loc==-1)) { - ntimes = 0; /* this process does no writing. */ - } - if (ntimes > 0) { /* only set the gpfs hint if we have io - ie this rank is - an aggregator -- otherwise will fail for deferred open */ - if (getenv("ROMIO_GPFS_DECLARE_ACCESS")!=NULL) { - gpfs_wr_access_start(fd->fd_sys, st_loc, end_loc - st_loc); - } - } - - ADIO_Offset st_loc_ion=0, end_loc_ion=0, needs_gpfs_access_cleanup=0; -#ifdef BGQPLATFORM - if (ntimes > 0) { /* only set the gpfs hint if we have io - ie this rank is - an aggregator -- otherwise will fail for deferred open */ - - if (getenv("ROMIO_GPFS_DECLARE_ION_ACCESS")!=NULL) { - if (gpfs_find_access_for_ion(fd, st_loc, end_loc, fd_start, fd_end, - &st_loc_ion, &end_loc_ion)) { - gpfs_wr_access_start(fd->fd_sys, st_loc_ion, end_loc_ion-st_loc_ion); - needs_gpfs_access_cleanup=1; - } - } - } -#endif - - MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, - fd->comm); - - write_buf = fd->io_buf; - if (gpfsmpio_pthreadio == 1) { - write_buf2 = fd->io_buf + coll_bufsize; - } - - curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* its use is explained below. calloc initializes to 0. */ - - count = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ - - partial_recv = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* if only a portion of the last off-len pair is recd. from a process - in a particular iteration, the length recd. is stored here. - calloc initializes to 0. */ - - send_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* total size of data to be sent to each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ - - recv_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration.*/ - - sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* amount of data sent to each proc so far. Used in - ADIOI_Fill_send_buffer. initialized to 0 here. */ - - send_buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - curr_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - done_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* Above three are used in ADIOI_Fill_send_buffer*/ - - start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - if (!buftype_is_contig) { - flat_buf = ADIOI_Flatten_and_find(datatype); - } - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - - -/* I need to check if there are any outstanding nonblocking writes to - the file, which could potentially interfere with the writes taking - place in this collective write call. Since this is not likely to be - common, let me do the simplest thing possible here: Each process - completes all pending nonblocking operations before completing. */ - - /*ADIOI_Complete_async(error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Barrier(fd->comm); - */ - - done = 0; - off = st_loc; - - if(gpfsmpio_pthreadio == 1) - io_thread = pthread_self(); - -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); -#endif - - for (m=0; m < ntimes; m++) { - /* go through all others_req and check which will be satisfied - by the current write */ - - /* Note that MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order and that, for writes, the - filetypes cannot specify overlapping regions in the file. This - simplifies implementation a bit compared to reads. */ - - /* off = start offset in the file for the data to be written in - this iteration - size = size of data written (bytes) corresponding to off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ - - /* first calculate what should be communicated */ - -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif - for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0; - - size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); - - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - start_pos[i] = curr_offlen_ptr[i]; - for (j=curr_offlen_ptr[i]; j<others_req[i].count; j++) { - if (partial_recv[i]) { - /* this request may have been partially - satisfied in the previous iteration. */ - req_off = others_req[i].offsets[j] + - partial_recv[i]; - req_len = others_req[i].lens[j] - - partial_recv[i]; - partial_recv[i] = 0; - /* modify the off-len pair to reflect this change */ - others_req[i].offsets[j] = req_off; - others_req[i].lens[j] = req_len; - } - else { - req_off = others_req[i].offsets[j]; - req_len = others_req[i].lens[j]; - } - if (req_off < off + size) { - count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIU_Upint)(write_buf+req_off-off)); - MPI_Get_address(write_buf+req_off-off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off)); - recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, - (unsigned)req_len)); - - if (off+size-req_off < (unsigned)req_len) - { - partial_recv[i] = (int) (off + size - req_off); - - /* --BEGIN ERROR HANDLING-- */ - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < off+size)) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_ARG, - "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", 0); - /* allow to continue since additional - * communication might have to occur - */ - } - /* --END ERROR HANDLING-- */ - break; - } - } - else break; - } - curr_offlen_ptr[i] = j; - } - } - -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); - MPE_Log_event(7, 0, "start communication"); -#endif - if (gpfsmpio_comm == 1) - ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, curr_to_proc, - done_to_proc, &hole, m, buftype_extent, buf_idx, - error_code); - else - if (gpfsmpio_comm == 0) - ADIOI_W_Exchange_data_alltoallv(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, curr_to_proc, - done_to_proc, &hole, m, buftype_extent, buf_idx, - error_code); - if (*error_code != MPI_SUCCESS) return; -#ifdef PROFILE - MPE_Log_event(8, 0, "end communication"); -#endif - - flag = 0; - for (i=0; i<nprocs; i++) - if (count[i]) flag = 1; - - if (flag) { - char round[50]; - sprintf(round, "two-phase-round=%d", m); - setenv("LIBIOLOG_EXTRA_INFO", round, 1); - ADIOI_Assert(size == (int)size); - if (gpfsmpio_pthreadio == 1) { - /* there is no such thing as "invalid pthread identifier", so - * we'll use pthread_self() instead. Before we do I/O we want - * to complete I/O from any previous iteration -- but only a - * previous iteration that had I/O work to do (i.e. set 'flag') - */ - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - io_thread_args.fd = fd; - /* do a little pointer shuffling: background I/O works from one - * buffer while two-phase machinery fills up another */ - io_thread_args.buf = write_buf; - ADIOI_SWAP(write_buf, write_buf2, char*); - io_thread_args.io_kind = ADIOI_WRITE; - io_thread_args.size = size; - io_thread_args.offset = off; - io_thread_args.status = &status; - io_thread_args.error_code = *error_code; - if ( (pthread_create(&io_thread, NULL, - ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) - io_thread = pthread_self(); - } else { - ADIO_WriteContig(fd, write_buf, (int)size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - } - } - - off += size; - done += size; - } - if (gpfsmpio_pthreadio == 1) { - if ( !pthread_equal(io_thread, pthread_self()) ) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - } - } - - for (i=0; i<nprocs; i++) count[i] = recv_size[i] = 0; -#ifdef PROFILE - MPE_Log_event(7, 0, "start communication"); -#endif - for (m=ntimes; m<max_ntimes; m++) - /* nothing to recv, but check for send. */ - if (gpfsmpio_comm == 1) - ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, - curr_to_proc, done_to_proc, &hole, m, - buftype_extent, buf_idx, error_code); - else - if (gpfsmpio_comm == 0) - ADIOI_W_Exchange_data_alltoallv(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, - curr_to_proc, done_to_proc, &hole, m, - buftype_extent, buf_idx, error_code); - if (*error_code != MPI_SUCCESS) return; -#ifdef PROFILE - MPE_Log_event(8, 0, "end communication"); -#endif - - ADIOI_Free(curr_offlen_ptr); - ADIOI_Free(count); - ADIOI_Free(partial_recv); - ADIOI_Free(send_size); - ADIOI_Free(recv_size); - ADIOI_Free(sent_to_proc); - ADIOI_Free(start_pos); - ADIOI_Free(send_buf_idx); - ADIOI_Free(curr_to_proc); - ADIOI_Free(done_to_proc); - - if (ntimes != 0 && getenv("ROMIO_GPFS_DECLARE_ACCESS")!=NULL) { - gpfs_wr_access_end(fd->fd_sys, st_loc, end_loc-st_loc); - } - - if (needs_gpfs_access_cleanup) { - gpfs_wr_access_end(fd->fd_sys, st_loc_ion, end_loc_ion-st_loc_ion); - needs_gpfs_access_cleanup=0; - } - - unsetenv("LIBIOLOG_EXTRA_INFO"); -} - - -/* Sets error_code to MPI_SUCCESS if successful, or creates an error code - * in the case of error. - */ -static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf, - ADIOI_Flatlist_node *flat_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, int size, - int *count, int *start_pos, - int *partial_recv, - int *sent_to_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int *hole, int iter, - MPI_Aint buftype_extent, int *buf_idx, - int *error_code) -{ - int i, j, k, *tmp_len, nprocs_recv, nprocs_send, err; - char **send_buf = NULL; - MPI_Request *requests, *send_req; - MPI_Datatype *recv_types; - MPI_Status *statuses, status; - int *srt_len, sum; - ADIO_Offset *srt_off; - static char myname[] = "ADIOI_W_EXCHANGE_DATA"; - -/* exchange recv_size info so that each process knows how much to - send to whom. */ - - MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); - - /* create derived datatypes for recv */ - - nprocs_recv = 0; - for (i=0; i<nprocs; i++) if (recv_size[i]) nprocs_recv++; - - recv_types = (MPI_Datatype *) - ADIOI_Malloc((nprocs_recv+1)*sizeof(MPI_Datatype)); -/* +1 to avoid a 0-size malloc */ - - tmp_len = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - j = 0; - for (i=0; i<nprocs; i++) { - if (recv_size[i]) { -/* take care if the last off-len pair is a partial recv */ - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - tmp_len[i] = others_req[i].lens[k]; - others_req[i].lens[k] = partial_recv[i]; - } - ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, recv_types+j); - /* absolute displacements; use MPI_BOTTOM in recv */ - MPI_Type_commit(recv_types+j); - j++; - } - } - - /* To avoid a read-modify-write, check if there are holes in the - data to be written. For this, merge the (sorted) offset lists - others_req using a heap-merge. */ - - sum = 0; - for (i=0; i<nprocs; i++) sum += count[i]; - srt_off = (ADIO_Offset *) ADIOI_Malloc((sum+1)*sizeof(ADIO_Offset)); - srt_len = (int *) ADIOI_Malloc((sum+1)*sizeof(int)); - /* +1 to avoid a 0-size malloc */ - - ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, - nprocs, nprocs_recv, sum); - -/* for partial recvs, restore original lengths */ - for (i=0; i<nprocs; i++) - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - others_req[i].lens[k] = tmp_len[i]; - } - ADIOI_Free(tmp_len); - - /* check if there are any holes. If yes, must do read-modify-write. - * holes can be in three places. 'middle' is what you'd expect: the - * processes are operating on noncontigous data. But holes can also show - * up at the beginning or end of the file domain (see John Bent ROMIO REQ - * #835). Missing these holes would result in us writing more data than - * recieved by everyone else. */ - *hole = 0; - if (off != srt_off[0]) /* hole at the front */ - *hole = 1; - else { /* coalesce the sorted offset-length pairs */ - for (i=1; i<sum; i++) { - if (srt_off[i] <= srt_off[0] + srt_len[0]) { - int new_len = srt_off[i] + srt_len[i] - srt_off[0]; - if (new_len > srt_len[0]) srt_len[0] = new_len; - } - else - break; - } - if (i < sum || size != srt_len[0]) /* hole in middle or end */ - *hole = 1; - } - - ADIOI_Free(srt_off); - ADIOI_Free(srt_len); - - if (nprocs_recv) { - if (*hole) { - const char * stuff = "data-sieve-in-two-phase"; - setenv("LIBIOLOG_EXTRA_INFO", stuff, 1); - ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, &err); - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(err, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, - "**ioRMWrdwr", 0); - return; - } - /* --END ERROR HANDLING-- */ - unsetenv("LIBIOLOG_EXTRA_INFO"); - } - } - - nprocs_send = 0; - for (i=0; i < nprocs; i++) if (send_size[i]) nprocs_send++; - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+1)*sizeof(MPI_Request)); - send_req = requests; - } - else { - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); - /* +1 to avoid a 0-size malloc */ - - /* post receives */ - j = 0; - for (i=0; i<nprocs; i++) { - if (recv_size[i]) { - MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, requests+j); - j++; - } - } - send_req = requests + nprocs_recv; - } - -/* post sends. if buftype_is_contig, data can be directly sent from - user buf at location given by buf_idx. else use send_buf. */ - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - if (buftype_is_contig) { - j = 0; - for (i=0; i < nprocs; i++) - if (send_size[i]) { - MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, - send_req+j); - j++; - buf_idx[i] += send_size[i]; - } - } - else if (nprocs_send) { - /* buftype is not contig */ - send_buf = (char **) ADIOI_Malloc(nprocs*sizeof(char*)); - for (i=0; i < nprocs; i++) - if (send_size[i]) - send_buf[i] = (char *) ADIOI_Malloc(send_size[i]); - - ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, - offset_list, len_list, send_size, - send_req, - sent_to_proc, nprocs, myrank, - contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - send_buf_idx, curr_to_proc, done_to_proc, iter, - buftype_extent); - /* the send is done in ADIOI_Fill_send_buffer */ - } - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - j = 0; - for (i=0; i<nprocs; i++) { - MPI_Status wkl_status; - if (recv_size[i]) { - MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, &wkl_status); - j++; - } - } - } - - for (i=0; i<nprocs_recv; i++) MPI_Type_free(recv_types+i); - ADIOI_Free(recv_types); - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - } - else { - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - } - -#ifdef NEEDS_MPI_TEST - i = 0; - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - while (!i) MPI_Testall(nprocs_send, send_req, &i, statuses); - } - else { - while (!i) MPI_Testall(nprocs_send+nprocs_recv, requests, &i, statuses); - } -#else - if (fd->atomicity) - /* bug fix from Wei-keng Liao and Kenin Coloma */ - MPI_Waitall(nprocs_send, send_req, statuses); - else - MPI_Waitall(nprocs_send+nprocs_recv, requests, statuses); -#endif - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - ADIOI_Free(statuses); - ADIOI_Free(requests); - if (!buftype_is_contig && nprocs_send) { - for (i=0; i < nprocs; i++) - if (send_size[i]) ADIOI_Free(send_buf[i]); - ADIOI_Free(send_buf); - } -} - - -#define ADIOI_BUF_INCR \ -{ \ - while (buf_incr) { \ - size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - buf_incr -= size_in_buf; \ - } \ -} - - -#define ADIOI_BUF_COPY \ -{ \ - while (size) { \ - size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \ - ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ - memcpy(&(send_buf[p][send_buf_idx[p]]), \ - ((char *) buf) + user_buf_idx, size_in_buf); \ - send_buf_idx[p] += size_in_buf; \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - size -= size_in_buf; \ - buf_incr -= size_in_buf; \ - } \ - ADIOI_BUF_INCR \ -} - -static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent) -{ -/* this function is only called if buftype is not contig */ - - int i, p, flat_buf_idx; - ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; - int jj, n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - -/* curr_to_proc[p] = amount of data sent to proc. p that has already - been accounted for so far - done_to_proc[p] = amount of data already sent to proc. p in - previous iterations - user_buf_idx = current location in user buffer - send_buf_idx[p] = current location in send_buf of proc. p */ - - for (i=0; i < nprocs; i++) { - send_buf_idx[i] = curr_to_proc[i] = 0; - done_to_proc[i] = sent_to_proc[i]; - } - jj = 0; - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - flat_buf_sz = size of current contiguous component in - flattened buf */ - - for (i=0; i<contig_access_count; i++) { - off = offset_list[i]; - rem_len = len_list[i]; - - /*this request may span the file domains of more than one process*/ - while (rem_len != 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_GPFS_Calc_aggregator(fd, - off, - min_st_offset, - &len, - fd_size, - fd_start, - fd_end); - - if (send_buf_idx[p] < send_size[p]) { - if (curr_to_proc[p]+len > done_to_proc[p]) { - if (done_to_proc[p] > curr_to_proc[p]) { - size = ADIOI_MIN(curr_to_proc[p] + len - - done_to_proc[p], send_size[p]-send_buf_idx[p]); - buf_incr = done_to_proc[p] - curr_to_proc[p]; - ADIOI_BUF_INCR - ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); - buf_incr = curr_to_proc[p] + len - done_to_proc[p]; - ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); - curr_to_proc[p] = done_to_proc[p] + size; - ADIOI_BUF_COPY - } - else { - size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); - buf_incr = len; - ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); - curr_to_proc[p] += size; - ADIOI_BUF_COPY - } - if (send_buf_idx[p] == send_size[p]) { - MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, - myrank+p+100*iter, fd->comm, requests+jj); - jj++; - } - } - else { - ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); - curr_to_proc[p] += len; - buf_incr = len; - ADIOI_BUF_INCR - } - } - else { - buf_incr = len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i=0; i < nprocs; i++) - if (send_size[i]) sent_to_proc[i] = curr_to_proc[i]; -} - - - -static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, - int nprocs, int nprocs_recv, int total_elements) -{ - typedef struct { - ADIO_Offset *off_list; - ADIO_Offset *len_list; - int nelem; - } heap_struct; - - heap_struct *a, tmp; - int i, j, heapsize, l, r, k, smallest; - - a = (heap_struct *) ADIOI_Malloc((nprocs_recv+1)*sizeof(heap_struct)); - - j = 0; - for (i=0; i<nprocs; i++) - if (count[i]) { - a[j].off_list = &(others_req[i].offsets[start_pos[i]]); - a[j].len_list = &(others_req[i].lens[start_pos[i]]); - a[j].nelem = count[i]; - j++; - } - - /* build a heap out of the first element from each list, with - the smallest element of the heap at the root */ - - heapsize = nprocs_recv; - for (i=heapsize/2 - 1; i>=0; i--) { - /* Heapify(a, i, heapsize); Algorithm from Cormen et al. pg. 143 - modified for a heap with smallest element at root. I have - removed the recursion so that there are no function calls. - Function calls are too expensive. */ - k = i; - while (1) { - l = 2*(k+1) - 1; - r = 2*(k+1); - - if ((l < heapsize) && - (*(a[l].off_list) < *(a[k].off_list))) - smallest = l; - else smallest = k; - - if ((r < heapsize) && - (*(a[r].off_list) < *(a[smallest].off_list))) - smallest = r; - - if (smallest != k) { - tmp.off_list = a[k].off_list; - tmp.len_list = a[k].len_list; - tmp.nelem = a[k].nelem; - - a[k].off_list = a[smallest].off_list; - a[k].len_list = a[smallest].len_list; - a[k].nelem = a[smallest].nelem; - - a[smallest].off_list = tmp.off_list; - a[smallest].len_list = tmp.len_list; - a[smallest].nelem = tmp.nelem; - - k = smallest; - } - else break; - } - } - - for (i=0; i<total_elements; i++) { - /* extract smallest element from heap, i.e. the root */ - srt_off[i] = *(a[0].off_list); - srt_len[i] = *(a[0].len_list); - (a[0].nelem)--; - - if (!a[0].nelem) { - a[0].off_list = a[heapsize-1].off_list; - a[0].len_list = a[heapsize-1].len_list; - a[0].nelem = a[heapsize-1].nelem; - heapsize--; - } - else { - (a[0].off_list)++; - (a[0].len_list)++; - } - - /* Heapify(a, 0, heapsize); */ - k = 0; - while (1) { - l = 2*(k+1) - 1; - r = 2*(k+1); - - if ((l < heapsize) && - (*(a[l].off_list) < *(a[k].off_list))) - smallest = l; - else smallest = k; - - if ((r < heapsize) && - (*(a[r].off_list) < *(a[smallest].off_list))) - smallest = r; - - if (smallest != k) { - tmp.off_list = a[k].off_list; - tmp.len_list = a[k].len_list; - tmp.nelem = a[k].nelem; - - a[k].off_list = a[smallest].off_list; - a[k].len_list = a[smallest].len_list; - a[k].nelem = a[smallest].nelem; - - a[smallest].off_list = tmp.off_list; - a[smallest].len_list = tmp.len_list; - a[smallest].nelem = tmp.nelem; - - k = smallest; - } - else break; - } - } - - ADIOI_Free(a); -} - - -static void ADIOI_W_Exchange_data_alltoallv( - ADIO_File fd, const void *buf, - char *write_buf, /* 1 */ - ADIOI_Flatlist_node *flat_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, int *recv_size, - ADIO_Offset off, int size, /* 2 */ - int *count, int *start_pos, int *partial_recv, - int *sent_to_proc, int nprocs, int myrank, - int buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, /* 3 */ - int *done_to_proc, int *hole, /* 4 */ - int iter, MPI_Aint buftype_extent, int *buf_idx, - int *error_code) -{ - int i, j, k=0, nprocs_recv, nprocs_send, *tmp_len, err; - char **send_buf = NULL; - MPI_Request *send_req=NULL; - MPI_Status status; - int rtail, stail; - char *sbuf_ptr, *to_ptr; - int len; - int *sdispls, *rdispls; - char *all_recv_buf, *all_send_buf; - int *srt_len, sum; - ADIO_Offset *srt_off; - static char myname[] = "ADIOI_W_EXCHANGE_DATA"; - double io_time; - - io_time = MPI_Wtime(); - /* exchange recv_size info so that each process knows how much to - send to whom. */ - MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); - - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_RECV_EXCH] += MPI_Wtime() - io_time; - io_time = MPI_Wtime(); - - nprocs_recv = 0; - for (i=0; i<nprocs; i++) if (recv_size[i]) { nprocs_recv++; } - nprocs_send = 0; - for (i=0; i<nprocs; i++) if (send_size[i]) { nprocs_send++; } - - /* receiver side data structures */ - rdispls = (int *) ADIOI_Malloc( nprocs * sizeof(int) ); - rtail = 0; - for (i=0; i<nprocs; i++) { rdispls[i] = rtail; rtail += recv_size[i]; } - - /* data buffer */ - all_recv_buf = (char *) ADIOI_Malloc( rtail ); - - /* sender side data structures */ - sdispls = (int *) ADIOI_Malloc( nprocs * sizeof(int) ); - stail = 0; - for (i=0; i<nprocs; i++) { sdispls[i] = stail; stail += send_size[i]; } - - /* data buffer */ - all_send_buf = (char *) ADIOI_Malloc( stail ); - if (buftype_is_contig) { - for (i=0; i<nprocs; i++) - { - if (send_size[i]) { - sbuf_ptr = all_send_buf + sdispls[i]; - memcpy( sbuf_ptr, buf + buf_idx[i], send_size[i] ); - buf_idx[i] += send_size[i]; - } - } - } else { - send_buf = (char **) ADIOI_Malloc( nprocs * sizeof(char *) ); - for (i=0; i<nprocs; i++) - send_buf[i] = all_send_buf + sdispls[i]; - ADIOI_Fill_send_buffer_nosend(fd, buf, flat_buf, send_buf, - offset_list, len_list, send_size, - send_req, - sent_to_proc, nprocs, myrank, - contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - send_buf_idx, curr_to_proc, done_to_proc, iter, - buftype_extent); - ADIOI_Free(send_buf); - } - - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += MPI_Wtime() - io_time; - - io_time = MPI_Wtime(); - /* alltoallv */ - MPI_Alltoallv( - all_send_buf, send_size, sdispls, MPI_BYTE, - all_recv_buf, recv_size, rdispls, MPI_BYTE, - fd->comm ); - - ADIOI_Free( all_send_buf ); - ADIOI_Free(sdispls); - - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_NET] += MPI_Wtime() - io_time; - io_time = MPI_Wtime(); - /* data sieving pre-read */ - /* To avoid a read-modify-write, check if there are holes in the - data to be written. For this, merge the (sorted) offset lists - others_req using a heap-merge. */ - - sum = 0; - for (i=0; i<nprocs; i++) sum += count[i]; - srt_off = (ADIO_Offset *) ADIOI_Malloc((sum+1)*sizeof(ADIO_Offset)); - srt_len = (int *) ADIOI_Malloc((sum+1)*sizeof(int)); - - ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, - nprocs, nprocs_recv, sum); - - /* check if there are any holes */ - *hole = 0; - /* See if there are holes before the first request or after the last request*/ - if((srt_off[0] > off) || - ((srt_off[sum-1] + srt_len[sum-1]) < (off + size))) - { - *hole = 1; - } - else /* See if there are holes between the requests, if there are more than one */ - for (i=0; i<sum-1; i++) - if (srt_off[i]+srt_len[i] < srt_off[i+1]) { - *hole = 1; - break; - } - - ADIOI_Free(srt_off); - ADIOI_Free(srt_len); - - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SORT] += MPI_Wtime() - io_time; - io_time = MPI_Wtime(); - if (nprocs_recv) { - if (*hole) { - ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, &err); - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(err, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, - "**ioRMWrdwr", 0); - return; - } - /* --END ERROR HANDLING-- */ - } - } - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SIEVE] += MPI_Wtime() - io_time; - - /* scater all_recv_buf into 4M cb_buffer */ - tmp_len = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - for (i=0; i<nprocs; i++) - { - if (recv_size[i]) { - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - tmp_len[i] = others_req[i].lens[k]; - others_req[i].lens[k] = partial_recv[i]; - } - - sbuf_ptr = all_recv_buf + rdispls[i]; - for (j=0; j<count[i]; j++) { - ADIOI_ENSURE_AINT_FITS_IN_PTR(others_req[i].mem_ptrs[ start_pos[i]+j ]); - to_ptr = (char *) ADIOI_AINT_CAST_TO_VOID_PTR ( others_req[i].mem_ptrs[ start_pos[i]+j ] ); - len = others_req[i].lens[ start_pos[i]+j ] ; - memcpy( to_ptr, sbuf_ptr, len ); - sbuf_ptr += len; - } - - /* restore */ - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - others_req[i].lens[k] = tmp_len[i]; - } - - } - } - - ADIOI_Free( tmp_len ); - ADIOI_Free( all_recv_buf ); - ADIOI_Free(rdispls); - return; -} - -static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent) -{ -/* this function is only called if buftype is not contig */ - - int i, p, flat_buf_idx; - ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; - int jj, n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - -/* curr_to_proc[p] = amount of data sent to proc. p that has already - been accounted for so far - done_to_proc[p] = amount of data already sent to proc. p in - previous iterations - user_buf_idx = current location in user buffer - send_buf_idx[p] = current location in send_buf of proc. p */ - - for (i=0; i < nprocs; i++) { - send_buf_idx[i] = curr_to_proc[i] = 0; - done_to_proc[i] = sent_to_proc[i]; - } - jj = 0; - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - flat_buf_sz = size of current contiguous component in - flattened buf */ - - for (i=0; i<contig_access_count; i++) { - off = offset_list[i]; - rem_len = len_list[i]; - - /*this request may span the file domains of more than one process*/ - while (rem_len != 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_GPFS_Calc_aggregator(fd, - off, - min_st_offset, - &len, - fd_size, - fd_start, - fd_end); - - if (send_buf_idx[p] < send_size[p]) { - if (curr_to_proc[p]+len > done_to_proc[p]) { - if (done_to_proc[p] > curr_to_proc[p]) { - size = ADIOI_MIN(curr_to_proc[p] + len - - done_to_proc[p], send_size[p]-send_buf_idx[p]); - buf_incr = done_to_proc[p] - curr_to_proc[p]; - ADIOI_BUF_INCR - ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); - buf_incr = curr_to_proc[p] + len - done_to_proc[p]; - ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); - curr_to_proc[p] = done_to_proc[p] + size; - ADIOI_BUF_COPY - } - else { - size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); - buf_incr = len; - ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); - curr_to_proc[p] += size; - ADIOI_BUF_COPY - } - /* moved to alltoallv */ - /* - if (send_buf_idx[p] == send_size[p]) { - MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, - myrank+p+100*iter, fd->comm, requests+jj); - jj++; - } - */ - } - else { - ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); - curr_to_proc[p] += (int)len; - buf_incr = len; - ADIOI_BUF_INCR - } - } - else { - buf_incr = len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i=0; i < nprocs; i++) - if (send_size[i]) sent_to_proc[i] = curr_to_proc[i]; -} diff --git a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.c b/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.c deleted file mode 100644 index f81e460fe945100635d43e4572af4563c51a8d12..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.c +++ /dev/null @@ -1,682 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_bg_aggrs.c - * \brief The externally used function from this file is is declared in ad_bg_aggrs.h - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997-2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/*#define TRACE_ON */ - -// Uncomment this line to turn tracing on for the gpfsmpio_balancecontig aggr selection optimization -// #define balancecontigtrace 1 -// #define bridgeringaggtrace 1 - -#include "adio.h" -#include "adio_cb_config_list.h" -#include "../ad_gpfs.h" -#include "ad_bg_pset.h" -#include "ad_bg_aggrs.h" -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - - -#ifdef USE_DBG_LOGGING - #define AGG_DEBUG 1 -#endif - -#ifndef TRACE_ERR -# define TRACE_ERR(format...) -#endif - -/* Comments copied from common: - * This file contains four functions: - * - * ADIOI_Calc_aggregator() - * ADIOI_Calc_file_domains() - * ADIOI_Calc_my_req() - * ADIOI_Calc_others_req() - * - * The last three of these were originally in ad_read_coll.c, but they are - * also shared with ad_write_coll.c. I felt that they were better kept with - * the rest of the shared aggregation code. - */ - -/* Discussion of values available from above: - * - * ADIO_Offset st_offsets[0..nprocs-1] - * ADIO_Offset end_offsets[0..nprocs-1] - * These contain a list of start and end offsets for each process in - * the communicator. For example, an access at loc 10, size 10 would - * have a start offset of 10 and end offset of 19. - * int nprocs - * number of processors in the collective I/O communicator - * ADIO_Offset min_st_offset - * ADIO_Offset fd_start[0..nprocs_for_coll-1] - * starting location of "file domain"; region that a given process will - * perform aggregation for (i.e. actually do I/O) - * ADIO_Offset fd_end[0..nprocs_for_coll-1] - * start + size - 1 roughly, but it can be less, or 0, in the case of - * uneven distributions - */ - -/* forward declaration */ -static void -ADIOI_BG_compute_agg_ranklist_serial ( ADIO_File fd, - const ADIOI_BG_ConfInfo_t *confInfo, - ADIOI_BG_ProcInfo_t *all_procInfo); - -/* - * Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. - * The parameters are - * . the number of aggregators (proxies) : fd->hints->cb_nodes - * . the ranks of the aggregators : fd->hints->ranklist - * By compute these two parameters in a BG-PSET-aware way, the default 2-phase collective IO of - * ADIO can work more efficiently. - */ -int -ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset) -{ - int r, s; - ADIOI_BG_ProcInfo_t *procInfo, *all_procInfo; - ADIOI_BG_ConfInfo_t *confInfo; - TRACE_ERR("Entering ADIOI_BG_gen_agg_ranklist\n"); - - MPI_Comm_size( fd->comm, &s ); - MPI_Comm_rank( fd->comm, &r ); - - /* Collect individual BG personality information */ - confInfo = ADIOI_BG_ConfInfo_new (); - procInfo = ADIOI_BG_ProcInfo_new (); - ADIOI_BG_persInfo_init( confInfo, procInfo, s, r, n_aggrs_per_pset, fd->comm); - - /* Gather BG personality infomation onto process 0 */ - /* if (r == 0) */ - all_procInfo = ADIOI_BG_ProcInfo_new_n (s); - - MPI_Gather( (void *)procInfo, sizeof(ADIOI_BG_ProcInfo_t), MPI_BYTE, - (void *)all_procInfo, sizeof(ADIOI_BG_ProcInfo_t), MPI_BYTE, - 0, - fd->comm ); - - /* Compute a list of the ranks of chosen IO proxy CN on process 0 */ - if (r == 0) { - ADIOI_BG_compute_agg_ranklist_serial (fd, confInfo, all_procInfo); - /* ADIOI_BG_ProcInfo_free (all_procInfo);*/ - } - ADIOI_BG_ProcInfo_free (all_procInfo); - - /* Send the info of IO proxy CN to all processes and keep the info in fd->hints struct. - Declared in adio_cb_config_list.h */ - ADIOI_cb_bcast_rank_map(fd); - if (gpfsmpio_balancecontig == 1) { /* additionally need to send bridgelist, - bridgelistnum and numbridges to all - ranks */ - if (r != 0) { - fd->hints->fs_hints.bg.bridgelist = - ADIOI_Malloc(fd->hints->cb_nodes*sizeof(int)); - if (fd->hints->fs_hints.bg.bridgelist == NULL) { - /* NEED TO HANDLE ENOMEM */ - } - } - MPI_Bcast(fd->hints->fs_hints.bg.bridgelist, fd->hints->cb_nodes, MPI_INT, 0, - fd->comm); - - if (r != 0) { - fd->hints->fs_hints.bg.bridgelistnum = - ADIOI_Malloc(fd->hints->cb_nodes*sizeof(int)); - if (fd->hints->fs_hints.bg.bridgelistnum == NULL) { - /* NEED TO HANDLE ENOMEM */ - } - } - MPI_Bcast(fd->hints->fs_hints.bg.bridgelistnum, fd->hints->cb_nodes, - MPI_INT, 0, fd->comm); - - MPI_Bcast(&fd->hints->fs_hints.bg.numbridges, 1, MPI_INT, 0, - fd->comm); - - } - - - ADIOI_BG_persInfo_free( confInfo, procInfo ); - TRACE_ERR("Leaving ADIOI_BG_gen_agg_ranklist\n"); - return 0; -} - - -/* There are some number of bridge nodes (randomly) distributed through the job - * We need to split the nodes among the bridge nodes */ -/* Maybe find which bridge node is closer (manhattan distance) and try to - * distribute evenly. - */ -/* - * Pick IO aggregators based on the under PSET organization and stores the ranks of the proxy CNs in tmp_ranklist. - * The first order of tmp_ranklist is : PSET number - * The secondary order of the list is determined in ADIOI_BG_select_agg_in_pset() and thus adjustable. - */ -typedef struct -{ - int rank; - int bridge; -} sortstruct; - -typedef struct -{ - int bridgeRank; - int numAggsAssigned; -} bridgeAggAssignment; - -static int intsort(const void *p1, const void *p2) -{ - sortstruct *i1, *i2; - i1 = (sortstruct *)p1; - i2 = (sortstruct *)p2; - return(i1->bridge - i2->bridge); -} - -static int -ADIOI_BG_compute_agg_ranklist_serial_do (const ADIOI_BG_ConfInfo_t *confInfo, - ADIOI_BG_ProcInfo_t *all_procInfo, - int *tmp_ranklist) -{ - TRACE_ERR("Entering ADIOI_BG_compute_agg_ranklist_serial_do\n"); - /* BES: This should be done in the init routines probably. */ - int i, j; - int aggTotal; - int *aggList; - - if (gpfsmpio_bridgeringagg > 0) { - - int numAggs = confInfo->aggRatio * confInfo->ioMinSize /*virtualPsetSize*/; - /* the number of aggregators is (numAggs per bridgenode) */ - if(numAggs == 1) - aggTotal = 1; - else - aggTotal = confInfo->numBridgeRanks * numAggs; - - aggList = (int *)ADIOI_Malloc(aggTotal * sizeof(int)); - if(aggTotal == 1) { /* special case when we only have one bridge node */ - - sortstruct *bridgelist = (sortstruct *)ADIOI_Malloc(confInfo->nProcs * sizeof(sortstruct)); - for(i=0; i < confInfo->nProcs; i++) - { - bridgelist[i].bridge = all_procInfo[i].bridgeRank; - bridgelist[i].rank = i; - TRACE_ERR("bridgelist[%d].bridge: %d .rank: %d\n", i, bridgelist[i].bridge, i); - } - - /* This list contains rank->bridge info. Now, we need to sort this list. */ - qsort(bridgelist, confInfo->nProcs, sizeof(sortstruct), intsort); - - aggList[0] = bridgelist[0].bridge; - ADIOI_Free(bridgelist); - - } - else { // aggTotal > 1 - - int currentAggListSize = 0; - int numBridgesWithAggAssignments = 0; - bridgeAggAssignment *aggAssignments = (bridgeAggAssignment *)ADIOI_Malloc(confInfo->numBridgeRanks * sizeof(bridgeAggAssignment)); - - int partitionSize = all_procInfo[0].numNodesInPartition; - int *nodesAssigned = (int *)ADIOI_Malloc(partitionSize * sizeof(int)); - for (i=0;i<partitionSize;i++) - nodesAssigned[i] = 0; - - int currentNumHops = gpfsmpio_bridgeringagg; - int allAggsAssigned = 0; - - /* Iterate thru the process infos and select aggregators starting at currentNumHops - away. Increase the currentNumHops until all bridges have numAggs assigned to them. - */ - while (!allAggsAssigned) { - /* track whether any aggs are selected durng this round */ - int startingCurrentAggListSize = currentAggListSize; - int numIterForHopsWithNoAggs = 0; - for (i=0;i<confInfo->nProcs;i++) { - if (all_procInfo[i].manhattanDistanceToBridge == currentNumHops) { - if (nodesAssigned[all_procInfo[i].nodeRank] == 0) { // node is not assigned as an agg yet - int foundBridge = 0; - for (j=0;(j<numBridgesWithAggAssignments && !foundBridge);j++) { - if (aggAssignments[j].bridgeRank == all_procInfo[i].bridgeRank) { - foundBridge = 1; - if (aggAssignments[j].numAggsAssigned < numAggs) { - aggAssignments[j].numAggsAssigned++; - nodesAssigned[all_procInfo[i].nodeRank] = 1; - aggList[currentAggListSize] = all_procInfo[i].rank; - currentAggListSize++; -#ifdef bridgeringaggtrace - printf("Assigned agg rank %d at nodeRank %d to bridge rank %d at a distance of %d hops\n",all_procInfo[i].rank,all_procInfo[i].nodeRank,all_procInfo[i].bridgeRank,currentNumHops); -#endif - } - } - } - if (!foundBridge) { - aggAssignments[numBridgesWithAggAssignments].bridgeRank = all_procInfo[i].bridgeRank; - aggAssignments[numBridgesWithAggAssignments].numAggsAssigned = 1; - numBridgesWithAggAssignments++; - nodesAssigned[all_procInfo[i].nodeRank] = 1; - aggList[currentAggListSize] = all_procInfo[i].rank; - currentAggListSize++; -#ifdef bridgeringaggtrace - printf("Assigned agg rank %d at nodeRank %d to bridge rank %d at a distance of %d hops\n",all_procInfo[i].rank,all_procInfo[i].nodeRank,all_procInfo[i].bridgeRank,currentNumHops); -#endif - } - } - } - } - - if (numBridgesWithAggAssignments == confInfo->numBridgeRanks) { - allAggsAssigned = 1; - for (i=0;(i<numBridgesWithAggAssignments && allAggsAssigned);i++) { - if (aggAssignments[i].numAggsAssigned < numAggs) - allAggsAssigned = 0; - } - } - currentNumHops++; - /* Handle the case where the numAggs is more than exists starting - * at gpfsmpio_bridgeringagg hops, wrap back and restart at 0 to - * assign the overrun - it is up to the user to realize this - * situation and adjust numAggs and gpfsmpio_bridgeringagg - * accordingly. - */ - if (currentNumHops > 16) - currentNumHops = 0; - /* If 3 rounds go by without selecting an agg abort to avoid - infinite loop. - */ - if (startingCurrentAggListSize == currentAggListSize) - numIterForHopsWithNoAggs++; - else - numIterForHopsWithNoAggs = 0; - ADIOI_Assert(numIterForHopsWithNoAggs <= 3); - } - - ADIOI_Free(aggAssignments); - ADIOI_Free(nodesAssigned); - - } // else aggTotal > 1 - - memcpy(tmp_ranklist, aggList, aggTotal*sizeof(int)); - } // gpfsmpio_bridgeringagg > 0 - - else { // gpfsmpio_bridgeringagg unset - default code - - int distance, numAggs; - - /* Aggregators will be midpoints between sorted MPI rank lists of who shares a given - * bridge node */ - - sortstruct *bridgelist = (sortstruct *)ADIOI_Malloc(confInfo->nProcs * sizeof(sortstruct)); - for(i=0; i < confInfo->nProcs; i++) - { - bridgelist[i].bridge = all_procInfo[i].bridgeRank; - bridgelist[i].rank = i; - TRACE_ERR("bridgelist[%d].bridge: %d .rank: %d\n", i, bridgelist[i].bridge, i); - } - - /* This list contains rank->bridge info. Now, we need to sort this list. */ - qsort(bridgelist, confInfo->nProcs, sizeof(sortstruct), intsort); - - /* In this array, we can pick an appropriate number of midpoints based on - * our bridgenode index and the number of aggregators */ - - numAggs = confInfo->aggRatio * confInfo->ioMinSize /*virtualPsetSize*/; - if(numAggs == 1) - aggTotal = 1; - else - /* the number of aggregators is (numAggs per bridgenode) plus each - * bridge node is an aggregator */ - aggTotal = confInfo->numBridgeRanks * (numAggs+1); - - if(aggTotal>confInfo->nProcs) aggTotal=confInfo->nProcs; - - TRACE_ERR("numBridgeRanks: %d, aggRatio: %f numBridge: %d pset size: %d/%d numAggs: %d, aggTotal: %d\n", confInfo->numBridgeRanks, confInfo->aggRatio, confInfo->numBridgeRanks, confInfo->ioMinSize, confInfo->ioMaxSize /*virtualPsetSize*/, numAggs, aggTotal); - aggList = (int *)ADIOI_Malloc(aggTotal * sizeof(int)); - - - /* For each bridge node, determine who the aggregators will be */ - /* basically, the n*distance and bridge node */ - if(aggTotal == 1) /* special case when we only have one bridge node */ - aggList[0] = bridgelist[0].bridge; - else - { - int lastBridge = bridgelist[confInfo->nProcs-1].bridge; - int nextBridge = 0, nextAggr = confInfo->numBridgeRanks; - int psetSize = 0; - int procIndex; - for(procIndex=confInfo->nProcs-1; procIndex>=0; procIndex--) - { - TRACE_ERR("bridgelist[%d].bridge %u/rank %u\n",procIndex, bridgelist[procIndex].bridge, bridgelist[procIndex].rank); - if(lastBridge == bridgelist[procIndex].bridge) - { - psetSize++; - if(procIndex) continue; - else procIndex--;/* procIndex == 0 */ - } - /* Sets up a list of nodes which will act as aggregators. numAggs - * per bridge node total. The list of aggregators is - * bridgeNode 0 - * bridgeNode 1 - * bridgeNode ... - * bridgeNode N - * bridgeNode[0]aggr[0] - * bridgeNode[0]aggr[1]... - * bridgeNode[0]aggr[N]... - * ... - * bridgeNode[N]aggr[0].. - * bridgeNode[N]aggr[N] - */ - aggList[nextBridge]=lastBridge; - distance = psetSize/numAggs; - TRACE_ERR("nextBridge %u is bridge %u, distance %u, size %u\n",nextBridge, aggList[nextBridge],distance,psetSize); - if(numAggs>1) - { - for(j = 0; j < numAggs; j++) - { - ADIOI_Assert(nextAggr<aggTotal); - aggList[nextAggr] = bridgelist[procIndex+j*distance+1].rank; - TRACE_ERR("agglist[%d] -> bridgelist[%d] = %d\n", nextAggr, procIndex+j*distance+1,aggList[nextAggr]); - if(aggList[nextAggr]==lastBridge) /* can't have bridge in the list twice */ - { - aggList[nextAggr] = bridgelist[procIndex+psetSize].rank; /* take the last one in the pset */ - TRACE_ERR("replacement agglist[%d] -> bridgelist[%d] = %d\n", nextAggr, procIndex+psetSize,aggList[nextAggr]); - } - nextAggr++; - } - } - if(procIndex<0) break; - lastBridge = bridgelist[procIndex].bridge; - psetSize = 1; - nextBridge++; - } - } - - TRACE_ERR("memcpy(tmp_ranklist, aggList, (numAggs(%u)*confInfo->numBridgeRanks(%u)+numAggs(%u)) (%u) %u*sizeof(int))\n",numAggs,confInfo->numBridgeRanks,numAggs,(numAggs*confInfo->numBridgeRanks+numAggs),aggTotal); - memcpy(tmp_ranklist, aggList, aggTotal*sizeof(int)); - for(i=0;i<aggTotal;i++) - { - TRACE_ERR("tmp_ranklist[%d]: %d\n", i, tmp_ranklist[i]); - } - - - ADIOI_Free (bridgelist); - - TRACE_ERR("Leaving ADIOI_BG_compute_agg_ranklist_serial_do\n"); - } - - ADIOI_Free (aggList); - return aggTotal; - -} - -/* - * compute aggregators ranklist and put it into fd->hints struct - */ -static void -ADIOI_BG_compute_agg_ranklist_serial ( ADIO_File fd, - const ADIOI_BG_ConfInfo_t *confInfo, - ADIOI_BG_ProcInfo_t *all_procInfo) -{ - TRACE_ERR("Entering ADIOI_BG_compute_agg_ranklist_serial\n"); - int i; - int naggs; - int size; - int *tmp_ranklist; - - /* compute the ranklist of IO aggregators and put into tmp_ranklist */ - tmp_ranklist = (int *) ADIOI_Malloc (confInfo->nProcs * sizeof(int)); - -# if AGG_DEBUG - for (i=0; i<confInfo->nProcs; i++) { - DBG_FPRINTF(stderr, "\trank = %6d\n", all_procInfo[i].rank ); - } -# endif - - naggs= - ADIOI_BG_compute_agg_ranklist_serial_do (confInfo, all_procInfo, tmp_ranklist); - -# define VERIFY 1 -# if VERIFY - DBG_FPRINTF(stderr, "\tconfInfo = min: %3d, max: %3d, naggrs: %3d, bridge: %3d, nprocs: %3d, vpset: %3d, ratio: %.4f; naggs = %d\n", - confInfo->ioMinSize , - confInfo->ioMaxSize , - confInfo->nAggrs , - confInfo->numBridgeRanks , - confInfo->nProcs , - confInfo->ioMaxSize /*virtualPsetSize*/ , - confInfo->aggRatio , - naggs ); -# endif - MPI_Comm_size( fd->comm, &size ); - /* This fix is for when the bridgenode rnk is not part of the particular - * subcomm associated with this MPI File operation. I don't know if - * this is the best/right answer but it passes the test cases at least. - * I don't know how common file IO in subcomms is anyway... */ - for(i=0;i<naggs;i++) - { - if(tmp_ranklist[i] > size) - { - TRACE_ERR("Using 0 as tmp_ranklist[%d] instead of %d for comm %x\n", - i, tmp_ranklist[i], fd->comm); - tmp_ranklist[i] = 0; - } - } - -# if AGG_DEBUG - for (i=0; i<naggs; i++) { - DBG_FPRINTF(stderr, "\taggr %-4d = %6d\n", i, tmp_ranklist[i] ); - } -# endif - if (gpfsmpio_balancecontig == 1) { - /* what comes out of this code block is the agg ranklist sorted by - * bridge set and ion id with associated bridge info stored in the - * hints structure for later access during file domain assignment */ - - // sort the agg ranklist by ions and bridges - - int *interleavedbridgeranklist = (int *) ADIOI_Malloc (naggs * sizeof(int)); // resorted agg rank list - /* list of all bridge ranks */ - int *bridgelist = (int *) ADIOI_Malloc (naggs * sizeof(int)); - - /* each entry here is the number of aggregators associated with the - * bridge rank of the same index in bridgelist */ - int *bridgelistnum = (int *) ADIOI_Malloc (naggs * sizeof(int)); - /* list of all ion IDs corresponding with bridgelist entries of same index */ - int *ionlist = (int *) ADIOI_Malloc (naggs * sizeof(int)); - - int numbridges = 0; - - for (i=0;i<naggs;i++) - bridgelistnum[i] = 0; - - /* Each entry in this list corresponds with the bridgelist and will contain the lowest bridge - * agg rank on that ion. */ - int *summarybridgeminionaggrank = (int *) ADIOI_Malloc (naggs * sizeof(int)); - for (i=0;i<naggs;i++) - summarybridgeminionaggrank[i] = -1; - - /* build the bridgelist, ionlist and bridgelistnum data by going thru each agg - * entry and find the associated bridge list index - at the end we will - * know how many aggs belong to each bridge in each ion */ - for (i=0;i<naggs;i++) { - int aggbridgerank = all_procInfo[tmp_ranklist[i]].bridgeRank; - int aggionid = all_procInfo[tmp_ranklist[i]].ionID; - int foundrank = 0; - int summaryranklistbridgeindex = 0; - int j; - for (j=0;(j<numbridges && !foundrank);j++) { - if (bridgelist[j] == aggbridgerank) { - foundrank = 1; - summaryranklistbridgeindex = j; - } - else - summaryranklistbridgeindex++; - } - if (!foundrank) { - bridgelist[summaryranklistbridgeindex] = aggbridgerank; - ionlist[summaryranklistbridgeindex] = aggionid; - - if (summarybridgeminionaggrank[summaryranklistbridgeindex] == -1) - summarybridgeminionaggrank[summaryranklistbridgeindex] = aggbridgerank; - else if (summarybridgeminionaggrank[summaryranklistbridgeindex] > aggbridgerank) - summarybridgeminionaggrank[summaryranklistbridgeindex] = aggbridgerank; - numbridges++; - } - - bridgelistnum[summaryranklistbridgeindex]++; - } - - /* at this point summarybridgeminionaggrank has the agg rank of the bridge for entries, - * need to make each entry the minimum bridge rank for the entire ion. */ - for (i=0;i<numbridges;i++) { - int aggIonId = ionlist[i]; - int j; - for (j=0;j<numbridges;j++) { - if (ionlist[j] == aggIonId) { - if (summarybridgeminionaggrank[j] < summarybridgeminionaggrank[i]) - summarybridgeminionaggrank[i] = summarybridgeminionaggrank[j]; - } - } - } - - // resort by io node minimum bridge rank - int x; - for (x=0;x<numbridges;x++) { - for (i=0;i<(numbridges-1);i++) { - if (summarybridgeminionaggrank[i] > summarybridgeminionaggrank[i+1]) { - int tmpminionaggrank = summarybridgeminionaggrank[i]; - summarybridgeminionaggrank[i] = summarybridgeminionaggrank[i+1]; - summarybridgeminionaggrank[i+1] = tmpminionaggrank; - int tmpionid = ionlist[i]; - ionlist[i] = ionlist[i+1]; - ionlist[i+1] = tmpionid; - int tmpbridgerank = bridgelist[i]; - bridgelist[i] = bridgelist[i+1]; - bridgelist[i+1] = tmpbridgerank; - int tmpbridgeranknum = bridgelistnum[i]; - bridgelistnum[i] = bridgelistnum[i+1]; - bridgelistnum[i+1] = tmpbridgeranknum; - } - } - } - - // for each io node make sure bridgelist is in rank order - int startSortIndex = -1; - int endSortIndex = -1; - int currentBridgeIndex = 0; - - while (currentBridgeIndex < numbridges) { - int currentIonId = ionlist[currentBridgeIndex]; - startSortIndex = currentBridgeIndex; - while (ionlist[currentBridgeIndex] == currentIonId) - currentBridgeIndex++; - endSortIndex = currentBridgeIndex-1; - for (x=startSortIndex;x<=endSortIndex;x++) { - for (i=startSortIndex;i<endSortIndex;i++) { - if (bridgelist[i] > bridgelist[i+1]) { - int tmpbridgerank = bridgelist[i]; - bridgelist[i] = bridgelist[i+1]; - bridgelist[i+1] = tmpbridgerank; - int tmpbridgeranknum = bridgelistnum[i]; - bridgelistnum[i] = bridgelistnum[i+1]; - bridgelistnum[i+1] = tmpbridgeranknum; - } - } - } - } - - - /* populate interleavedbridgeranklist - essentially the agg rank list - * is now sorted by the ion minimum bridge rank and bridge node */ - int currentrankoffset = 0; - for (i=0;i<numbridges;i++) { - int *thisBridgeAggList = (int *) ADIOI_Malloc (naggs * sizeof(int)); - int numAggsForThisBridge = 0; - - int k; - for (k=0;k<naggs;k++) { - int aggbridgerank = all_procInfo[tmp_ranklist[k]].bridgeRank; - if (aggbridgerank == bridgelist[i]) { - thisBridgeAggList[numAggsForThisBridge] = tmp_ranklist[k]; - numAggsForThisBridge++; - } - } - - // sort thisBridgeAggList - for (x=0;x<numAggsForThisBridge;x++) { - int n; - for (n=0;n<(numAggsForThisBridge-1);n++) { - if (thisBridgeAggList[n] > thisBridgeAggList[n+1]) { - int tmpthisBridgeAggList = thisBridgeAggList[n]; - thisBridgeAggList[n] = thisBridgeAggList[n+1]; - thisBridgeAggList[n+1] = tmpthisBridgeAggList; - } - } - } - int n; - for (n=0;n<numAggsForThisBridge;n++) { - interleavedbridgeranklist[currentrankoffset] = thisBridgeAggList[n]; - currentrankoffset++; - } - ADIOI_Free(thisBridgeAggList); - } - -#ifdef balancecontigtrace - fprintf(stderr,"Interleaved aggregator list:\n"); - for (i=0;i<naggs;i++) { - fprintf(stderr,"Agg: %d Agg rank: %d with bridge rank %d and ion ID %d\n",i,interleavedbridgeranklist[i],all_procInfo[interleavedbridgeranklist[i]].bridgeRank,all_procInfo[interleavedbridgeranklist[i]].ionID); - } - fprintf(stderr,"Bridges list:\n"); - for (i=0;i<numbridges;i++) { - fprintf(stderr,"bridge %d ion min rank %d rank %d number of aggs %d ion id %d\n",i,summarybridgeminionaggrank[i],bridgelist[i],bridgelistnum[i],ionlist[i]); - } - -#endif - /* copy the ranklist of IO aggregators to fd->hints */ - if(fd->hints->ranklist != NULL) - ADIOI_Free (fd->hints->ranklist); - if(fd->hints->fs_hints.bg.bridgelist != NULL) - ADIOI_Free (fd->hints->fs_hints.bg.bridgelist); - if(fd->hints->fs_hints.bg.bridgelistnum != NULL) - ADIOI_Free (fd->hints->fs_hints.bg.bridgelistnum); - - fd->hints->cb_nodes = naggs; - fd->hints->fs_hints.bg.numbridges = numbridges; - fd->hints->ranklist = (int *) ADIOI_Malloc (naggs * sizeof(int)); - memcpy( fd->hints->ranklist, interleavedbridgeranklist, naggs*sizeof(int) ); - - fd->hints->fs_hints.bg.bridgelist = (int *) ADIOI_Malloc (naggs * sizeof(int)); - memcpy( fd->hints->fs_hints.bg.bridgelist, bridgelist, naggs*sizeof(int) ); - - fd->hints->fs_hints.bg.bridgelistnum = (int *) ADIOI_Malloc (naggs * sizeof(int)); - memcpy( fd->hints->fs_hints.bg.bridgelistnum, bridgelistnum, naggs*sizeof(int) ); - - ADIOI_Free(summarybridgeminionaggrank); - ADIOI_Free( tmp_ranklist ); - ADIOI_Free( bridgelistnum ); - ADIOI_Free( bridgelist ); - ADIOI_Free( interleavedbridgeranklist ); - ADIOI_Free(ionlist); - - } else { - /* classic topology-agnostic copy of the ranklist of IO aggregators to - * fd->hints */ - if(fd->hints->ranklist != NULL) ADIOI_Free (fd->hints->ranklist); - - fd->hints->cb_nodes = naggs; - fd->hints->ranklist = (int *) ADIOI_Malloc (naggs * sizeof(int)); - memcpy( fd->hints->ranklist, tmp_ranklist, naggs*sizeof(int) ); - - ADIOI_Free( tmp_ranklist ); - } - TRACE_ERR("Leaving ADIOI_BG_compute_agg_ranklist_serial\n"); - return; -} diff --git a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.c b/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.c deleted file mode 100644 index 58b051af89afef8d559c4ae288ef2c712d3136ff..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.c +++ /dev/null @@ -1,414 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_bg_pset.c - * \brief Definition of functions associated to structs ADIOI_BG_ProcInfo_t and ADIOI_BG_ConfInfo_t - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* #define TRACE_ON */ -// #define bridgeringaggtrace 1 - -#include <stdlib.h> -#include <stdbool.h> -#include "../ad_gpfs.h" -#include "ad_bg_pset.h" -#include <spi/include/kernel/process.h> -#include <firmware/include/personality.h> - -#define BGQ_TORUS_MAX_DIMS 5 -#define BGQ_FULL_TORUS_SIZE 512 - -#ifndef TRACE_ERR -# define TRACE_ERR(fmt...) -#endif - -ADIOI_BG_ProcInfo_t * -ADIOI_BG_ProcInfo_new() -{ - ADIOI_BG_ProcInfo_t *p = (ADIOI_BG_ProcInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BG_ProcInfo_t)); - ADIOI_Assert ((p != NULL)); - return p; -} - -ADIOI_BG_ProcInfo_t * -ADIOI_BG_ProcInfo_new_n( int n ) -{ - ADIOI_BG_ProcInfo_t *p = (ADIOI_BG_ProcInfo_t *) ADIOI_Malloc (n * sizeof(ADIOI_BG_ProcInfo_t)); - ADIOI_Assert ((p != NULL)); - return p; -} - -void -ADIOI_BG_ProcInfo_free( ADIOI_BG_ProcInfo_t *info ) -{ - if (info != NULL) ADIOI_Free (info); -} - -ADIOI_BG_ConfInfo_t * -ADIOI_BG_ConfInfo_new () -{ - ADIOI_BG_ConfInfo_t *p = (ADIOI_BG_ConfInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BG_ConfInfo_t)); - ADIOI_Assert ((p != NULL)); - return p; -} - - -void -ADIOI_BG_ConfInfo_free( ADIOI_BG_ConfInfo_t *info ) -{ - if (info != NULL) ADIOI_Free (info); -} - - -typedef struct -{ - int rank; - int bridgeCoord; -} sortstruct; - -static int intsort(const void *p1, const void *p2) -{ - sortstruct *i1, *i2; - i1 = (sortstruct *)p1; - i2 = (sortstruct *)p2; - return(i1->bridgeCoord - i2->bridgeCoord); -} - -unsigned torusSize[BGQ_TORUS_MAX_DIMS]; -bool dimTorus[BGQ_TORUS_MAX_DIMS]; - -/* This function computes the number of hops between the torus coordinates of the - * aggCoords and bridgeCoords parameters. -*/ -static unsigned procManhattanDistance(unsigned *aggCoords, unsigned *bridgeCoords) { - - unsigned totalDistance = 0; - int i; - for (i=0;i<BGQ_TORUS_MAX_DIMS;i++) { - unsigned dimDistance = abs((int)aggCoords[i] - (int)bridgeCoords[i]); - if (dimDistance > 0) { // could torus make it closer? - if (dimTorus[i]) { - if (aggCoords[i] == torusSize[i]) { // is wrap-around closer - if ((bridgeCoords[i]+1) < dimDistance) // assume will use torus link - dimDistance = bridgeCoords[i]+1; - } - else if (bridgeCoords[i] == torusSize[i]) { // is wrap-around closer - if ((aggCoords[i]+1) < dimDistance) // assume will use torus link - dimDistance = aggCoords[i]+1; - } - } - } /* else: dimDistance == 0, meaning aggCoords[i] and bridgeCoords[i] are - the same and there's no closer point to pick */ - totalDistance += dimDistance; - } - return totalDistance; -} - -int BGQ_IO_node_id () -{ - static unsigned long IO_node_id = ULONG_MAX; - - if (IO_node_id != ULONG_MAX) - return (int)(IO_node_id>>32); - - int rc; - int fd; - char* uci_str; - char buffer[4096]; - - fd = open("/dev/bgpers", O_RDONLY, 0); - assert(fd>=0); - rc = read(fd, buffer, sizeof(buffer)); - assert(rc>0); - close(fd); - - uci_str = strstr(buffer, "BG_UCI="); - assert(uci_str); - uci_str += sizeof("BG_UCI=")-1; - - IO_node_id = strtoul(uci_str, NULL, 16); - return (int)(IO_node_id>>32); -} - -void -ADIOI_BG_persInfo_init(ADIOI_BG_ConfInfo_t *conf, - ADIOI_BG_ProcInfo_t *proc, - int size, int rank, int n_aggrs, MPI_Comm comm) -{ - int i, iambridge=0, bridgerank = -1, bridgeIndex; - int countPset; - sortstruct *bridges; - int commsize; - - TRACE_ERR("Entering BG_persInfo_init, size: %d, rank: %d, n_aggrs: %d, comm: %d\n", size, rank, n_aggrs, (int)comm); - - Personality_t pers; - - - Kernel_GetPersonality(&pers, sizeof(pers)); - Personality_Networks_t *net = &pers.Network_Config; - - TRACE_ERR("BG_persInfo_init, my coords{%u,%u,%u,%u,%u}\n",net->Acoord,net->Bcoord,net->Ccoord,net->Dcoord,net->Ecoord); - proc->rank = rank; - - if (gpfsmpio_bridgeringagg > 0) { -#ifdef bridgeringaggtrace - if (rank == 0) - fprintf(stderr,"Block dimensions:\n"); -#endif - - /* Set the numNodesInPartition and nodeRank for this proc - */ - unsigned dimMaxArray[BGQ_TORUS_MAX_DIMS]; - dimMaxArray[0] = net->Anodes; - dimMaxArray[1] = net->Bnodes; - dimMaxArray[2] = net->Cnodes; - dimMaxArray[3] = net->Dnodes; - dimMaxArray[4] = net->Enodes; - - unsigned hwCoordsArray[BGQ_TORUS_MAX_DIMS]; - hwCoordsArray[0] = net->Acoord; - hwCoordsArray[1] = net->Bcoord; - hwCoordsArray[2] = net->Ccoord; - hwCoordsArray[3] = net->Dcoord; - hwCoordsArray[4] = net->Ecoord; - proc->numNodesInPartition = net->Anodes * net->Bnodes * net->Cnodes * net->Dnodes * net->Enodes; - proc->nodeRank = 0; - /* Set the indicator for if a dimension in the partitions is a torus or not. - */ - dimTorus[0] = (bool) (ND_ENABLE_TORUS_DIM_A & net->NetFlags); - dimTorus[1] = (bool) (ND_ENABLE_TORUS_DIM_B & net->NetFlags); - dimTorus[2] = (bool) (ND_ENABLE_TORUS_DIM_C & net->NetFlags); - dimTorus[3] = (bool) (ND_ENABLE_TORUS_DIM_D & net->NetFlags); - dimTorus[4] = (bool) (ND_ENABLE_TORUS_DIM_E & net->NetFlags); - for (i=0;i<BGQ_TORUS_MAX_DIMS;i++) { - torusSize[i] = dimMaxArray[i]; - int baseNum = 1, j; - for (j=0;j<i;j++) - baseNum *= dimMaxArray[j]; - proc->nodeRank += (hwCoordsArray[i] * baseNum); -#ifdef bridgeringaggtrace - if (rank == 0) - fprintf(stderr,"numNodesInPartition is %d Dimension %d has %d elements wrap-around value is %d\n",proc->numNodesInPartition,i,torusSize[i],dimTorus[i]); -#endif - } - } - - MPI_Comm_size(comm, &commsize); - - proc->ionID = BGQ_IO_node_id (); - - if(size == 1) - { - proc->iamBridge = 1; - proc->bridgeRank = rank; - if (gpfsmpio_bridgeringagg > 0) { - proc->manhattanDistanceToBridge = 0; - } - - /* Set up the other parameters */ - proc->myIOSize = size; - proc->ioNodeIndex = 0; - conf->ioMinSize = size; - conf->ioMaxSize = size; - conf->numBridgeRanks = 1; - conf->nProcs = size; - conf->nAggrs = 1; - conf->aggRatio = 1. * conf->nAggrs / conf->ioMinSize /*virtualPsetSize*/; - if(conf->aggRatio > 1) conf->aggRatio = 1.; - TRACE_ERR("I am (single) Bridge rank\n"); - return; - } - - /* Find the nearest bridge node coords. We don't know the - rank in our comm so we will collective find/pick a bridge - rank later. - */ - int32_t bridgeCoords; - bridgeCoords = pers.Network_Config.cnBridge_A << 24 | - pers.Network_Config.cnBridge_B << 18 | - pers.Network_Config.cnBridge_C << 12 | - pers.Network_Config.cnBridge_D << 6 | - pers.Network_Config.cnBridge_E << 2; - ADIOI_Assert((bridgeCoords >= 0)); /* A dim is < 6 bits or sorting won't work */ - - if((net->Acoord == pers.Network_Config.cnBridge_A) && - (net->Bcoord == pers.Network_Config.cnBridge_B) && - (net->Ccoord == pers.Network_Config.cnBridge_C) && - (net->Dcoord == pers.Network_Config.cnBridge_D) && - (net->Ecoord == pers.Network_Config.cnBridge_E)) { - iambridge = 1; /* I am bridge */ - if (gpfsmpio_bridgeringagg > 0) { - proc->manhattanDistanceToBridge = 0; - } - } - else { // calculate manhattan distance to bridge if gpfsmpio_bridgeringagg is set - if (gpfsmpio_bridgeringagg > 0) { - unsigned aggCoords[BGQ_TORUS_MAX_DIMS],manhattanBridgeCoords[BGQ_TORUS_MAX_DIMS]; - aggCoords[0] = net->Acoord; - manhattanBridgeCoords[0] = pers.Network_Config.cnBridge_A; - aggCoords[1] = net->Bcoord; - manhattanBridgeCoords[1] = pers.Network_Config.cnBridge_B; - aggCoords[2] = net->Ccoord; - manhattanBridgeCoords[2] = pers.Network_Config.cnBridge_C; - aggCoords[3] = net->Dcoord; - manhattanBridgeCoords[3] = pers.Network_Config.cnBridge_D; - aggCoords[4] = net->Ecoord; - manhattanBridgeCoords[4] = pers.Network_Config.cnBridge_E; - - proc->manhattanDistanceToBridge= procManhattanDistance(aggCoords, manhattanBridgeCoords); -#ifdef bridgeringaggtrace - fprintf(stderr,"agg coords are %u %u %u %u %u bridge coords are %u %u %u %u %u distance is %u\n",aggCoords[0],aggCoords[1],aggCoords[2],aggCoords[3],aggCoords[4],manhattanBridgeCoords[0],manhattanBridgeCoords[1],manhattanBridgeCoords[2],manhattanBridgeCoords[3],manhattanBridgeCoords[4], proc->manhattanDistanceToBridge); -#endif - } - } - - TRACE_ERR("Bridge coords(%8.8X): %d %d %d %d %d, %d. iambridge %d\n",bridgeCoords, pers.Network_Config.cnBridge_A,pers.Network_Config.cnBridge_B,pers.Network_Config.cnBridge_C,pers.Network_Config.cnBridge_D,pers.Network_Config.cnBridge_E,0, iambridge); - - /* Allgather the ranks and bridgeCoords to determine the bridge - rank and how many ranks belong to each bridge rank*/ - bridges = (sortstruct *) ADIOI_Malloc(sizeof(sortstruct) * size); - - /* We're going to sort this structure by bridgeCoord: - - typedef struct - { - int rank; - int bridgeCoord; - } sortstruct; - - and I want the rank that IS the bridge to sort first, so - OR in '1' on non-bridge ranks that use a bridge coord. - */ - - /* My input to the collective */ - bridges[rank].rank = rank; - bridges[rank].bridgeCoord = bridgeCoords; - if(!iambridge) - bridges[rank].bridgeCoord |= 1; /* I am not bridge, turn on bit */ - - - MPI_Allgather(MPI_IN_PLACE, 2, MPI_INT, bridges, 2, MPI_INT, comm); - - qsort(bridges, size, sizeof(sortstruct), intsort); - - /* Once the list is sorted walk through it to setup bridge - info and find bridge ranks, etc. */ - - int tempCoords, tempRank, mincompute, maxcompute; - tempCoords = bridges[0].bridgeCoord & ~1; - tempRank = bridges[0].rank; - - countPset=1; - bridgeIndex = 0; - mincompute = size+1; - maxcompute = 1; - - for(i=1; i<size; i++) - { - if((bridges[i].bridgeCoord & ~1) == tempCoords) - countPset++; /* same bridge (pset), count it */ - else /* new bridge found */ - { -#ifdef TRACE_ON - if(rank == 0) - TRACE_ERR("Bridge set %u, bridge rank %d (%#8.8X) has %d ranks\n", - bridgeIndex, tempRank, tempCoords, countPset); -#endif - if(countPset > maxcompute) - maxcompute = countPset; - if(countPset < mincompute) - mincompute = countPset; - - /* Was this my bridge we finished? */ - if(tempCoords == bridgeCoords) - { - /* Am I the bridge rank? */ - if(tempRank == rank) - iambridge = 1; - else - iambridge = 0; /* Another rank on my node may have taken over */ - TRACE_ERR("Rank %u, bridge set %u, bridge rank %d (%#8.8X) has %d ranks, iambridge %u\n", - rank, bridgeIndex, tempRank, tempCoords, countPset,iambridge); - bridgerank = tempRank; - proc->myIOSize = countPset; - proc->ioNodeIndex = bridgeIndex; - } - /* Setup next bridge */ - tempCoords = bridges[i].bridgeCoord & ~1; - tempRank = bridges[i].rank; - bridgeIndex++; - countPset = 1; - } - } - /* Process last bridge */ - -#ifdef TRACE_ON - if(rank == 0) - TRACE_ERR("Bridge set %u, bridge rank %d (%#8.8X) has %d ranks\n", - bridgeIndex, tempRank, tempCoords, countPset); -#endif - if(countPset > maxcompute) - maxcompute = countPset; - if(countPset < mincompute) - mincompute = countPset; - - /* Was this my bridge? */ - if(tempCoords == bridgeCoords) - { - /* Am I the bridge rank? */ - if(tempRank == rank) - iambridge = 1; - else - iambridge = 0; /* Another rank on my node may have taken over */ - bridgerank = tempRank; - proc->myIOSize = countPset; - proc->ioNodeIndex = bridgeIndex; - } - - - if(rank == 0) - { - /* Only rank 0 has a conf structure, fill in stuff as appropriate */ - conf->ioMinSize = mincompute; - conf->ioMaxSize = maxcompute; /* equivalent to pset size */ - conf->numBridgeRanks = bridgeIndex+1; - conf->nProcs = size; - - conf->nAggrs = n_aggrs; - /* First pass gets nAggrs = -1 */ - if(conf->nAggrs <=0) - conf->nAggrs = gpfsmpio_bg_nagg_pset; - if(conf->ioMinSize <= conf->nAggrs) - conf->nAggrs = ADIOI_MAX(1,conf->ioMinSize-1); /* not including bridge itself */ -/* if(conf->nAggrs > conf->numBridgeRanks) - conf->nAggrs = conf->numBridgeRanks; -*/ - conf->aggRatio = 1. * conf->nAggrs / conf->ioMinSize /*virtualPsetSize*/; -/* if(conf->aggRatio > 1) conf->aggRatio = 1.; */ - TRACE_ERR("n_aggrs %zd, conf->nProcs %zu, conf->ioMaxSize %zu, ADIOI_BG_NAGG_PSET_DFLT %zu,conf->numBridgeRanks %zu,conf->nAggrs %zu\n",(size_t)n_aggrs, (size_t)conf->nProcs, (size_t)conf->ioMaxSize, (size_t)ADIOI_BG_NAGG_PSET_DFLT,(size_t)conf->numBridgeRanks,(size_t)conf->nAggrs); - TRACE_ERR("Maximum ranks under a bridge rank: %d, minimum: %d, nAggrs: %d, numBridgeRanks: %d pset dflt: %d naggrs: %d ratio: %f\n", maxcompute, mincompute, conf->nAggrs, conf->numBridgeRanks, ADIOI_BG_NAGG_PSET_DFLT, conf->nAggrs, conf->aggRatio); - } - - ADIOI_Assert((bridgerank != -1)); - proc->bridgeRank = bridgerank; - proc->iamBridge = iambridge; - TRACE_ERR("Rank %d has bridge set index %d (bridge rank: %d) with %d other ranks, ioNodeIndex: %d\n", rank, proc->ioNodeIndex, bridgerank, proc->myIOSize, proc->ioNodeIndex); - - ADIOI_Free(bridges); - -} - -void -ADIOI_BG_persInfo_free( ADIOI_BG_ConfInfo_t *conf, ADIOI_BG_ProcInfo_t *proc ) -{ - ADIOI_BG_ConfInfo_free( conf ); - ADIOI_BG_ProcInfo_free( proc ); -} diff --git a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.h b/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.h deleted file mode 100644 index 3f251e8275e171b8685fb394e0f55ad6822f9636..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_pset.h +++ /dev/null @@ -1,80 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_bg_pset.h - * \brief ??? - */ - -/* File: ad_bg_pset.h - * - * Defines two structures that keep BlueGene PSET specific information and their public interfaces: - * . ADIOI_BG_ProcInfo_t object keeps specific information to each process - * . ADIOI_BG_ConfInfo_t object keeps general information for the whole communicator, only kept - * on process 0. - */ - -#ifndef AD_BG_PSET_H_ -#define AD_BG_PSET_H_ - - -/* Keeps specific information to each process, will be exchanged among processes */ -typedef struct { - int ioNodeIndex; /* similar to psetNum on BGL/BGP */ - int rank; /* my rank */ - int ionID; /* ion id this cn is using */ -/* int myCoords[5]; */ - int bridgeRank; /* my bridge node (or proxy) rank */ - unsigned char threadID; /* unlikely to be useful but better than just padding */ - unsigned char __cpad[2]; - int myIOSize; /* number of ranks sharing my bridge/IO - node, i.e. psetsize*/ - int iamBridge; /* am *I* the bridge rank? */ - int __ipad[2]; - unsigned nodeRank; /* torus coords converted to an integer for use with gpfsmpio_bridgeringagg */ - unsigned numNodesInPartition; /* number of physical nodes in the job partition */ - unsigned manhattanDistanceToBridge; /* number of hops between this rank and the bridge node */ -} ADIOI_BG_ProcInfo_t __attribute__((aligned(16))); - -/* Keeps general information for the whole communicator, only on process 0 */ -typedef struct { - int ioMinSize; /* Smallest number of ranks shareing 1 bridge node */ - int ioMaxSize; /* Largest number of ranks sharing 1 bridge node */ - /* ioMaxSize will be the "psetsize" */ - int nAggrs; - int numBridgeRanks; - /*int virtualPsetSize; ppn * pset size */ - int nProcs; - int cpuIDsize; /* num ppn */ - float aggRatio; - -} ADIOI_BG_ConfInfo_t __attribute__((aligned(16))); - - -#undef MIN -#define MIN(a,b) (((a)<(b) ? (a) : (b))) - - - - -/* public funcs for ADIOI_BG_ProcInfo_t objects */ - ADIOI_BG_ProcInfo_t * ADIOI_BG_ProcInfo_new(); - ADIOI_BG_ProcInfo_t * ADIOI_BG_ProcInfo_new_n( int n ); - void ADIOI_BG_ProcInfo_free( ADIOI_BG_ProcInfo_t *info ); - - -/* public funcs for ADIOI_BG_ConfInfo_t objects */ - ADIOI_BG_ConfInfo_t * ADIOI_BG_ConfInfo_new (); - void ADIOI_BG_ConfInfo_free( ADIOI_BG_ConfInfo_t *info ); - - -/* public funcs for a pair of ADIOI_BG_ConfInfo_t and ADIOI_BG_ProcInfo_t objects */ - int BGQ_IO_node_id (); - void ADIOI_BG_persInfo_init( ADIOI_BG_ConfInfo_t *conf, - ADIOI_BG_ProcInfo_t *proc, - int s, int r, int n_aggrs, MPI_Comm comm); - void ADIOI_BG_persInfo_free( ADIOI_BG_ConfInfo_t *conf, - ADIOI_BG_ProcInfo_t *proc ); - - -#endif /* AD_BG_PSET_H_ */ diff --git a/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.c b/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.c deleted file mode 100644 index 8453238a8336359fb2eddb0108c73247c2089001..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.c +++ /dev/null @@ -1,276 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_pe_aggrs.c - * \brief The externally used function from this file is is declared in ad_pe_aggrs.h - */ - -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997-2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/*#define TRACE_ON */ - -#include "adio.h" -#include "adio_cb_config_list.h" -#include "../ad_gpfs.h" -#include "ad_pe_aggrs.h" -#include "mpiimpl.h" - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -#ifdef USE_DBG_LOGGING - #define AGG_DEBUG 1 -#endif - -#ifndef TRACE_ERR -# define TRACE_ERR(format...) -#endif - -/* - * Compute the aggregator-related parameters that are required in 2-phase - * collective IO of ADIO. - * The parameters are - * . the number of aggregators (proxies) : fd->hints->cb_nodes - * . the ranks of the aggregators : fd->hints->ranklist - * If MP_IONODEFILE is defined, POE determines all tasks on every node listed - * in the node file and defines MP_IOTASKLIST with them, making them all - * aggregators. Alternatively, the user can explictly set MP_IOTASKLIST - * themselves. The format of the MP_IOTASKLIST is a colon-delimited list of - * task ids, the first entry being the total number of aggregators, for example - * to specify 4 aggregators on task ids 0,8,16,24 the value would be: - * 4:0:8:16:24. If there is no MP_IONODEFILE, or MP_IOTASKLIST, then the - * default aggregator selection is 1 task per node for every node of the job - - * additionally, an environment variable MP_IOAGGR_CNT can be specified, which - * defines the total number of aggregators, spread evenly across all the nodes. - * The romio_cb_nodes and romio_cb_config_list hint user settings are ignored. - */ -int -ADIOI_PE_gen_agg_ranklist(ADIO_File fd) -{ - - int numAggs = 0; - char *ioTaskList = getenv( "MP_IOTASKLIST" ); - char *ioAggrCount = getenv("MP_IOAGGR_CNT"); - int i,j; - int inTERcommFlag = 0; - - int myRank,commSize; - MPI_Comm_rank(fd->comm, &myRank); - MPI_Comm_size(fd->comm, &commSize); - - MPI_Comm_test_inter(fd->comm, &inTERcommFlag); - if (inTERcommFlag) { - FPRINTF(stderr,"ERROR: ATTENTION: inTERcomms are not supported in MPI-IO - aborting....\n"); - perror("ADIOI_PE_gen_agg_ranklist:"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - if (ioTaskList) { - int ioTaskListLen = strlen(ioTaskList); - int ioTaskListPos = 0; - char tmpBuf[8]; /* Big enough for 1M tasks (7 digits task ID). */ - tmpBuf[7] = '\0'; - for (i=0; i<7; i++) { - tmpBuf[i] = *ioTaskList++; /* Maximum is 7 digits for 1 million. */ - ioTaskListPos++; - if (*ioTaskList == ':') { /* If the next char is a ':' ends it. */ - tmpBuf[i+1] = '\0'; - break; - } - } - numAggs = atoi(tmpBuf); - if (numAggs == 0) - FPRINTF(stderr,"ERROR: ATTENTION: Number of aggregators specified in MP_IOTASKLIST set at 0 - default aggregator selection will be used.\n"); - else if (!((numAggs > 0 ) && (numAggs <= commSize))) { - FPRINTF(stderr,"ERROR: ATTENTION: The number of aggregators (%s) specified in MP_IOTASKLIST is outside the communicator task range of %d.\n",tmpBuf,commSize); - numAggs = commSize; - } - fd->hints->ranklist = (int *) ADIOI_Malloc (numAggs * sizeof(int)); - - int aggIndex = 0; - while (aggIndex < numAggs) { - ioTaskList++; /* Advance past the ':' */ - ioTaskListPos++; - int allDigits=1; - for (i=0; i<7; i++) { - if (*ioTaskList < '0' || *ioTaskList > '9') - allDigits=0; - tmpBuf[i] = *ioTaskList++; - ioTaskListPos++; - if ( (*ioTaskList == ':') || (*ioTaskList == '\0') ) { - tmpBuf[i+1] = '\0'; - break; - } - } - if (allDigits) { - int newAggRank = atoi(tmpBuf); - if (!((newAggRank >= 0 ) && (newAggRank < commSize))) { - FPRINTF(stderr,"ERROR: ATTENTION: The aggregator '%s' specified in MP_IOTASKLIST is not within the communicator task range of 0 to %d - it will be ignored.\n",tmpBuf,commSize-1); - } - else { - int aggAlreadyAdded = 0; - for (i=0;i<aggIndex;i++) - if (fd->hints->ranklist[i] == newAggRank) { - aggAlreadyAdded = 1; - break; - } - if (!aggAlreadyAdded) - fd->hints->ranklist[aggIndex++] = newAggRank; - else - FPRINTF(stderr,"ERROR: ATTENTION: The aggregator '%d' is specified multiple times in MP_IOTASKLIST - duplicates are ignored.\n",newAggRank); - } - } - else { - FPRINTF(stderr,"ERROR: ATTENTION: The aggregator '%s' specified in MP_IOTASKLIST is not a valid integer task id - it will be ignored.\n",tmpBuf); - } - - /* At the end check whether the list is shorter than specified. */ - if (ioTaskListPos == ioTaskListLen) { - if (aggIndex == 0) { - FPRINTF(stderr,"ERROR: ATTENTION: No aggregators were correctly specified in MP_IOTASKLIST - default aggregator selection will be used.\n"); - ADIOI_Free(fd->hints->ranklist); - } - else if (aggIndex < numAggs) - FPRINTF(stderr,"ERROR: ATTENTION: %d aggregators were specified in MP_IOTASKLIST but only %d were correctly specified - setting the number of aggregators to %d.\n",numAggs, aggIndex,aggIndex); - numAggs = aggIndex; - } - } - } - if (numAggs == 0) { - MPID_Comm *mpidCommData; - - MPID_Comm_get_ptr(fd->comm,mpidCommData); - int localSize = mpidCommData->local_size; - - // get my node rank - int myNodeRank = mpidCommData->intranode_table[mpidCommData->rank]; - - int *allNodeRanks = (int *) ADIOI_Malloc (localSize * sizeof(int)); - - allNodeRanks[myRank] = myNodeRank; - MPI_Allgather(MPI_IN_PLACE, 1, MPI_INT, allNodeRanks, 1, MPI_INT, fd->comm); - -#ifdef AGG_DEBUG - printf("MPID_Comm data: local_size is %d\nintranode_table entries:\n",mpidCommData->local_size); - for (i=0;i<localSize;i++) { - printf("%d ",mpidCommData->intranode_table[i]); - } - printf("\ninternode_table entries:\n"); - for (i=0;i<localSize;i++) { - printf("%d ",mpidCommData->internode_table[i]); - } - printf("\n"); - - printf("\nallNodeRanks entries:\n"); - for (i=0;i<localSize;i++) { - printf("%d ",allNodeRanks[i]); - } - printf("\n"); - -#endif - - if (ioAggrCount) { - int cntType = -1; - - if ( strcasecmp(ioAggrCount, "ALL") ) { - if ( (cntType = atoi(ioAggrCount)) <= 0 ) { - /* Input is other non-digit or less than 1 the assume */ - /* 1 aggregator per node. Note: atoi(-1) reutns -1. */ - /* No warning message given here -- done earlier. */ - cntType = -1; - } - } - else { - /* ALL is specified set aggr count to localSize */ - cntType = -2; - } - switch(cntType) { - case -1: - /* 1 aggr/node case */ - { - int rankListIndex = 0; - fd->hints->ranklist = (int *) ADIOI_Malloc (localSize * sizeof(int)); - for (i=0;i<localSize;i++) { - if (allNodeRanks[i] == 0) { - fd->hints->ranklist[rankListIndex++] = i; - numAggs++; - } - } - } - break; - case -2: - /* ALL tasks case */ - fd->hints->ranklist = (int *) ADIOI_Malloc (localSize * sizeof(int)); - for (i=0;i<localSize;i++) { - fd->hints->ranklist[i] = i; - numAggs++; - } - break; - default: - /* Specific aggr count case -- MUST be less than localSize, otherwise set to localSize */ - if (cntType > localSize) - cntType = localSize; - - numAggs = cntType; - // Round-robin thru allNodeRanks - pick the 0's, then the 1's, etc - int currentNodeRank = 0; // node rank currently being selected as aggregator - int rankListIndex = 0; - int currentAllNodeIndex = 0; - - fd->hints->ranklist = (int *) ADIOI_Malloc (numAggs * sizeof(int)); - - while (rankListIndex < numAggs) { - int foundEntry = 0; - while (!foundEntry && (currentAllNodeIndex < localSize)) { - if (allNodeRanks[currentAllNodeIndex] == currentNodeRank) { - fd->hints->ranklist[rankListIndex++] = currentAllNodeIndex; - foundEntry = 1; - } - currentAllNodeIndex++; - } - if (!foundEntry) { - currentNodeRank++; - currentAllNodeIndex = 0; - } - } // while - break; - } // switch(cntType) - } // if (ioAggrCount) - - else { // default is 1 aggregator per node - // take the 0 entries from allNodeRanks - int rankListIndex = 0; - fd->hints->ranklist = (int *) ADIOI_Malloc (localSize * sizeof(int)); - for (i=0;i<localSize;i++) { - if (allNodeRanks[i] == 0) { - fd->hints->ranklist[rankListIndex++] = i; - numAggs++; - } - } - } - - ADIOI_Free(allNodeRanks); - - } - - if ( getenv("MP_I_SHOW_AGGRS") ) { - if (myRank == 0) { - printf("Agg rank list of %d generated:\n", numAggs); - for (i=0;i<numAggs;i++) { - printf("%d ",fd->hints->ranklist[i]); - } - printf("\n"); - } - } - - fd->hints->cb_nodes = numAggs; - - return 0; -} - diff --git a/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.h b/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.h deleted file mode 100644 index f779d182a5d7ff66f09786203d211cf9bf5336a2..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gpfs/pe/ad_pe_aggrs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ -/** - * \file ad_pe_aggrs.h - * \brief ??? - */ - -/* - * - * Declares functions specific for the PE platform within the GPFS - * parallel I/O solution. For now simply processes the MP_IOTASKLIST - * env var. - * - */ - -#ifndef AD_PE_AGGRS_H_ -#define AD_PE_AGGRS_H_ - -#include "adio.h" -#include <sys/stat.h> - -#if !defined(GPFS_SUPER_MAGIC) - #define GPFS_SUPER_MAGIC (0x47504653) -#endif - - /* generate a list of I/O aggregators following a methodology specific for PE */ - int ADIOI_PE_gen_agg_ranklist(ADIO_File fd); - -#endif /* AD_PE_AGGRS_H_ */ diff --git a/3rd-party/romio321/adio/ad_gridftp/Makefile.mk b/3rd-party/romio321/adio/ad_gridftp/Makefile.mk deleted file mode 100644 index 2cd83a2ad28559e18bca8b56dcdcf06783115c35..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/Makefile.mk +++ /dev/null @@ -1,27 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_GRIDFTP - -noinst_HEADERS += adio/ad_gridftp/ad_gridftp.h - -romio_other_sources += \ - adio/ad_gridftp/ad_gridftp_close.c \ - adio/ad_gridftp/ad_gridftp_open.c \ - adio/ad_gridftp/ad_gridftp_read.c \ - adio/ad_gridftp/ad_gridftp_write.c \ - adio/ad_gridftp/ad_gridftp_fcntl.c \ - adio/ad_gridftp/ad_gridftp_flush.c \ - adio/ad_gridftp/ad_gridftp_resize.c \ - adio/ad_gridftp/ad_gridftp_hints.c \ - adio/ad_gridftp/ad_gridftp_delete.c \ - adio/ad_gridftp/ad_gridftp.c \ - adio/ad_gridftp/globus_routines.c \ - adio/ad_gridftp/ad_gridftp_features.c - -endif BUILD_AD_GRIDFTP - diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.c deleted file mode 100644 index f3767dcda21775f78366a9c18adc31b59a5b3fb6..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_GRIDFTP_operations = { - ADIOI_GRIDFTP_Open, /* Open */ - ADIOI_GRIDFTP_ReadContig, /* ReadContig */ - ADIOI_GRIDFTP_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_GRIDFTP_Fcntl, /* Fcntl */ - ADIOI_GRIDFTP_SetInfo, /* SetInfo */ - ADIOI_GRIDFTP_ReadStrided, /* ReadStrided */ - ADIOI_GRIDFTP_WriteStrided, /* WriteStrided */ - ADIOI_GRIDFTP_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_GRIDFTP_Flush, /* Flush */ - ADIOI_GRIDFTP_Resize, /* Resize */ - ADIOI_GRIDFTP_Delete, /* Delete */ - ADIOI_GRIDFTP_Feature, /* Features */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.h b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.h deleted file mode 100644 index 0b94c780eaab33e0815674fd7997f2296efd3d0d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_GRIDFTP_INCLUDE -#define AD_GRIDFTP_INCLUDE - -#include <unistd.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <fcntl.h> -#include "adio.h" -#include <globus_ftp_client.h> - -/* These live in globus_routines.c */ -extern int num_gridftp_handles; -#ifndef ADIO_GRIDFTP_HANDLES_MAX -#define ADIO_GRIDFTP_HANDLES_MAX 200 -#endif /* ! ADIO_GRIDFTP_HANDLES_MAX */ -extern globus_ftp_client_handle_t gridftp_fh[ADIO_GRIDFTP_HANDLES_MAX]; -extern globus_ftp_client_operationattr_t oattr[ADIO_GRIDFTP_HANDLES_MAX]; - - -/* TODO: weed out the now-unused prototypes */ -void ADIOI_GRIDFTP_Open(ADIO_File fd, int *error_code); -void ADIOI_GRIDFTP_Close(ADIO_File fd, int *error_code); -void ADIOI_GRIDFTP_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_GRIDFTP_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_GRIDFTP_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_GRIDFTP_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_GRIDFTP_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code); -void ADIOI_GRIDFTP_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_GRIDFTP_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_WriteStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GRIDFTP_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_GRIDFTP_IwriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_GRIDFTP_Flush(ADIO_File fd, int *error_code); -void ADIOI_GRIDFTP_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_GRIDFTP_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIOI_GRIDFTP_Get_shared_fp(ADIO_File fd, int size, - ADIO_Offset *shared_fp, - int *error_code); -void ADIOI_GRIDFTP_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, - int *error_code); -void ADIOI_GRIDFTP_Delete(char *filename, int *error_code); - -void globus_err_handler(const char *routine, const char *caller, - globus_result_t result); - -#endif - - - - diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_close.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_close.c deleted file mode 100644 index c1693d65ce0dbd09640677b8c2f79747b9d5ea7d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_close.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" - -void ADIOI_GRIDFTP_Close(ADIO_File fd, int *error_code) -{ - int err; - static char myname[]="ADIOI_GRIDFTP_Close"; - - globus_result_t result; - - MPI_Barrier(fd->comm); - - /* Destroy the ftp handle and opattr */ - result = globus_ftp_client_operationattr_destroy(&(oattr[fd->fd_sys])); - if (result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_operationattr_destroy", - myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s",globus_object_printable_to_string(globus_error_get(result))); - return; - } - result=globus_ftp_client_handle_destroy(&(gridftp_fh[fd->fd_sys])); - if (result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_handle_destroy", - myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - - fd->fd_sys = -1; - fd->fp_ind=0; - fd->fp_sys_posn=0; - num_gridftp_handles--; - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_delete.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_delete.c deleted file mode 100644 index 54eb7144295364a963e1cfbc2dcf049d6a080b5b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_delete.c +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" - -static globus_mutex_t lock; -static globus_cond_t cond; -static globus_bool_t delete_done, delete_success; -static void delete_cb(void *myarg, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - else - { - delete_success=GLOBUS_TRUE; - } - delete_done=GLOBUS_TRUE; -} - -void ADIOI_GRIDFTP_Delete(char *filename, int *error_code) -{ - char myname[]="ADIOI_GRIDFTP_Delete"; - int myrank, nprocs; - globus_ftp_client_handle_t handle; - globus_result_t result; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - - globus_module_activate(GLOBUS_FTP_CLIENT_MODULE); - result=globus_ftp_client_handle_init(&handle,GLOBUS_NULL); - - if (result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_handle_init",myname,result); - *error_code= MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - - delete_done=GLOBUS_FALSE; - delete_success=GLOBUS_FALSE; - result=globus_ftp_client_delete(&handle,filename,GLOBUS_NULL,delete_cb,GLOBUS_NULL); - if (result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_delete",myname,result); - *error_code= MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&lock); - while ( delete_done!=GLOBUS_TRUE ) - globus_cond_wait(&cond,&lock); - globus_mutex_unlock(&lock); - result=globus_ftp_client_handle_destroy(&handle); - if (result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_handle_destroy",myname,result); - *error_code= MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - - if ( delete_success!=GLOBUS_TRUE ) - { - *error_code= MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - } -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_fcntl.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_fcntl.c deleted file mode 100644 index dd9cb5ee09865936fd63fed324830c37fb4dcaf1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_fcntl.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" -#include "adio_extern.h" - -globus_mutex_t fcntl_size_lock; -globus_cond_t fcntl_size_cond; -globus_bool_t fcntl_size_done; - -void fcntl_size_cb(void *myargs, globus_ftp_client_handle_t *handle, - globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&fcntl_size_lock); - fcntl_size_done=GLOBUS_TRUE; - globus_cond_signal(&fcntl_size_cond); - globus_mutex_unlock(&fcntl_size_lock); -} - -void ADIOI_GRIDFTP_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - MPI_Datatype copy_etype, copy_filetype; - int combiner, i, j, k, filetype_is_contig, err; - ADIOI_Flatlist_node *flat_file; - char myname[]="ADIOI_GRIDFTP_Fcntl"; - - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - { - globus_result_t result; - globus_off_t fsize=0; - - globus_mutex_init(&fcntl_size_lock,GLOBUS_NULL); - globus_cond_init(&fcntl_size_cond,GLOBUS_NULL); - fcntl_size_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_size(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - &(fsize), - fcntl_size_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_size",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&fcntl_size_lock); - while ( fcntl_size_done!=GLOBUS_TRUE ) - globus_cond_wait(&fcntl_size_lock,&fcntl_size_cond); - globus_mutex_unlock(&fcntl_size_lock); - globus_mutex_destroy(&fcntl_size_lock); - globus_cond_destroy(&fcntl_size_cond); - fcntl_struct->fsize=fsize; - } - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - } -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_features.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_features.c deleted file mode 100644 index cbdc39586f83cf32b48bc77bdd751e38eadd656a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_features.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -int ADIOI_GRIDFTP_Feature (ADIO_File fd, int flag) -{ - switch(flag) { - case ADIO_SCALABLE_OPEN: - case ADIO_SHARED_FP: - case ADIO_LOCKS: - case ADIO_SEQUENTIAL: - case ADIO_DATA_SIEVING_WRITES: - default: - return 0; - } -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_flush.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_flush.c deleted file mode 100644 index 795341e88895d1cd595f17fe17e9d38279380062..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_flush.c +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" - -/* GridFTP doesn't give you a way to cache writes on the client side, so - is essentially a no-op */ -/* if there is a mechanism where we can ask the server to flush data to disk we - * should do it here. I'll leave that up to Troy */ - -void ADIOI_GRIDFTP_Flush(ADIO_File fd, int *error_code) -{ - return; -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_hints.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_hints.c deleted file mode 100644 index c0b0a40ebb2efea565a5a0020ed492c6815e8b7c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_hints.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -/* - -Valid hints for ftp:// and gsiftp:// URLs (aside from the std. ones): - - ftp_control_mode extended|block|stream|compressed - (default extended for gsiftp:// URLs and stream for ftp:// URLs) - - parallelism integer number of simultaneous threads connecting to - ftp server (default 1) - - striped_ftp true|false or enable|disable; enables gsiftp striped data transfer - - tcp_buffer integer size of tcp stream buffers in bytes - - transfer_type ascii or binary (default binary) - -These *must* be specified at open time currently. -*/ - -#include "ad_gridftp.h" -#include "adioi.h" - -void ADIOI_GRIDFTP_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - - if (!(fd->info)) - { - if ( users_info==MPI_INFO_NULL ) - { - /* This must be part of the open call. */ - MPI_Info_create(&(fd->info)); - } - else - { - MPI_Info_dup(users_info,&(fd->info)); - } - } - else - { - int i,nkeys,valuelen,flag; - char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL]; - - if ( users_info!=MPI_INFO_NULL ) - { - MPI_Info_get_nkeys(users_info,&nkeys); - for (i=0;i<nkeys;i++) - { - MPI_Info_get_nthkey(users_info,i,key); - MPI_Info_get_valuelen(users_info,key,&valuelen,&flag); - if (flag) - { - ADIOI_Info_get(users_info,key,valuelen,value,&flag); - if (flag) ADIOI_Info_set(fd->info,key,value); - } - } - } - } - - /* let the generic ROMIO and MPI-I/O stuff happen... */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_open.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_open.c deleted file mode 100644 index 45aab921051451c3794ccc1c72b202d978e0e060..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_open.c +++ /dev/null @@ -1,343 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" - -static globus_mutex_t lock; -static globus_cond_t cond; - -static globus_bool_t file_exists,exists_done; -static void exists_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - else - { - file_exists=GLOBUS_TRUE; - } - exists_done=GLOBUS_TRUE; -} - -static globus_bool_t touch_ctl_done; -static void touch_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&lock); - touch_ctl_done=GLOBUS_TRUE; - globus_cond_signal(&cond); - globus_mutex_unlock(&lock); -} - -static void touch_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - if (error) - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - globus_ftp_client_register_read(handle,buffer,length,touch_data_cb,myargs); - return; -} - -void ADIOI_GRIDFTP_Open(ADIO_File fd, int *error_code) -{ - static char myname[]="ADIOI_GRIDFTP_Open"; - int myrank, nprocs, keyfound; - char hintval[MPI_MAX_INFO_VAL+1]; - globus_ftp_client_handleattr_t hattr; - globus_result_t result; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - /* activate Globus ftp client module -- can be called multiple times, so - it's safest to call once per file/connection */ - globus_module_activate(GLOBUS_FTP_CLIENT_MODULE); - fd->fd_sys = num_gridftp_handles; - /* No shared file pointers for now */ - fd->shared_fp_fname = NULL; - *error_code = MPI_SUCCESS; - - /* Access modes here mean something very different here than they - would on a "real" filesystem... As a result, the amode and hint - processing here is intermingled and a little weird because many - of them have to do with the connection rather than the file itself. - The thing that sucks about this is that read and write ops will - have to check themselves if the file is being accessed rdonly, rdwr, - or wronly. - */ - result=globus_ftp_client_handleattr_init(&hattr); - if ( result != GLOBUS_SUCCESS ) - { - - - globus_err_handler("globus_ftp_client_handleattr_init", - myname,result); - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - result = globus_ftp_client_operationattr_init(&(oattr[fd->fd_sys])); - if ( result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_operationattr_init", - myname,result); - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - - - /* Always use connection caching unless told otherwise */ - result=globus_ftp_client_handleattr_set_cache_all(&hattr,GLOBUS_TRUE); - if ( result !=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_handleattr_set_cache_all",myname,result); - - /* Assume that it's safe to cache a file if it's read-only */ - if ( (fd->access_mode&ADIO_RDONLY) && - (result=globus_ftp_client_handleattr_add_cached_url(&hattr,fd->filename))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_handleattr_add_cached_url",myname,result); - - /* Since we're (almost by definition) doing things that FTP S (stream) - control mode can't handle, default to E (extended block) control mode - for gsiftp:// URLs. ftp:// URLs use standard stream control mode - by default. This behavior can be overridden by the ftp_control_mode - hint. */ - - /* - if ( !strncmp(fd->filename,"gsiftp:",7) && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - else if ( !strncmp(fd->filename,"ftp:",4) && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_STREAM))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - */ - - /* Set append mode if necessary */ - if ( (fd->access_mode&ADIO_APPEND) && - ((result=globus_ftp_client_operationattr_set_append(&(oattr[fd->fd_sys]),GLOBUS_TRUE))!=GLOBUS_SUCCESS) ) - globus_err_handler("globus_ftp_client_operationattr_set_append",myname,result); - - /* Other hint and amode processing that would affect hattr and/or - oattr[] (eg. parallelism, striping, etc.) goes here */ - if ( fd->info!=MPI_INFO_NULL ) - { - ADIOI_Info_get(fd->info,"ftp_control_mode",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - if ( ( !strcmp(hintval,"extended") || !strcmp(hintval,"extended_block") ) && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - else if ( !strcmp(hintval,"block") && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_BLOCK))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - else if ( !strcmp(hintval,"compressed") && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_COMPRESSED))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - else if ( !strcmp(hintval,"stream") && - (result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_STREAM))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result); - } - - ADIOI_Info_get(fd->info,"parallelism",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - int nftpthreads; - - if ( sscanf(hintval,"%d",&nftpthreads)==1 ) - { - globus_ftp_control_parallelism_t parallelism; - - parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED; - parallelism.fixed.size = nftpthreads; - if ( (result=globus_ftp_client_operationattr_set_parallelism(&(oattr[fd->fd_sys]), - ¶llelism))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_parallelism",myname,result); - } - } - - ADIOI_Info_get(fd->info,"striped_ftp",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - /* if set to "true" or "enable", set up round-robin block layout */ - if ( !strncmp("true",hintval,4) || !strncmp("TRUE",hintval,4) || - !strncmp("enable",hintval,4) || !strncmp("ENABLE",hintval,4) ) - { - ADIOI_Info_get(fd->info,"striping_factor",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - int striping_factor; - - if ( sscanf(hintval,"%d",&striping_factor)==1 ) - { - globus_ftp_control_layout_t layout; - - layout.mode = GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN; - layout.round_robin.block_size = striping_factor; - if ( (result=globus_ftp_client_operationattr_set_layout(&(oattr[fd->fd_sys]), - &layout))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_layout", - myname,result); - } - } - } - } - - ADIOI_Info_get(fd->info,"tcp_buffer",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - /* set tcp buffer size */ - int buffer_size; - if ( sscanf(hintval,"%d",&buffer_size)==1 ) - { - globus_ftp_control_tcpbuffer_t tcpbuf; - - tcpbuf.mode = GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED; - tcpbuf.fixed.size = buffer_size; - if ( (result=globus_ftp_client_operationattr_set_tcp_buffer(&(oattr[fd->fd_sys]), - &tcpbuf))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_tcp_buffer",myname,result); - } - } - - ADIOI_Info_get(fd->info,"transfer_type",MPI_MAX_INFO_VAL,hintval,&keyfound); - if ( keyfound ) - { - globus_ftp_control_type_t filetype; - /* set transfer type (i.e. ASCII or binary) */ - if ( !strcmp("ascii",hintval) || !strcmp("ASCII",hintval) ) - { - filetype=GLOBUS_FTP_CONTROL_TYPE_ASCII; - } - else - { - filetype=GLOBUS_FTP_CONTROL_TYPE_IMAGE; - } - if ( (result=globus_ftp_client_operationattr_set_type(&(oattr[fd->fd_sys]),filetype))!=GLOBUS_SUCCESS ) - globus_err_handler("globus_ftp_client_operationattr_set_type",myname,result); - } - } - else - FPRINTF(stderr,"no MPI_Info object associated with %s\n",fd->filename); - - /* Create the ftp handle */ - result=globus_ftp_client_handle_init(&(gridftp_fh[fd->fd_sys]),&hattr); - if ( result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_handle_init",myname,result); - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - - /* Check for existence of the file */ - globus_mutex_init(&lock, GLOBUS_NULL); - globus_cond_init(&cond, GLOBUS_NULL); - file_exists=GLOBUS_FALSE; - exists_done=GLOBUS_FALSE; - if ( myrank==0 ) - { - if ( (result=globus_ftp_client_exists(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - exists_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_exists",myname,result); - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - /* wait till the callback completes */ - globus_mutex_lock(&lock); - while ( exists_done!=GLOBUS_TRUE ) - globus_cond_wait(&cond,&lock); - globus_mutex_unlock(&lock); - } - MPI_Barrier(fd->comm); - MPI_Bcast(&file_exists,1,MPI_INT,0,fd->comm); - - /* It turns out that this is handled by MPI_File_open() directly */ - if ( (file_exists!=GLOBUS_TRUE) && (fd->access_mode&ADIO_CREATE) && - !(fd->access_mode&ADIO_EXCL) && !(fd->access_mode&ADIO_RDONLY) ) - { - if ( myrank==0 ) - { - /* if the file doesn't exist, write a single NULL to it */ - globus_byte_t touchbuf=(globus_byte_t)'\0'; - touch_ctl_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_put(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - touch_ctl_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_put",myname,result); - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]), - (globus_byte_t *)&touchbuf, 0, - (globus_off_t)0, GLOBUS_TRUE, - touch_data_cb, GLOBUS_NULL); - - if ( result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_write",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&lock); - while ( touch_ctl_done!=GLOBUS_TRUE ) - globus_cond_wait(&cond,&lock); - globus_mutex_unlock(&lock); - } - MPI_Barrier(fd->comm); - } - else if ( (fd->access_mode&ADIO_EXCL) && (file_exists==GLOBUS_TRUE) ) - { - fd->fd_sys = -1; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", 0); - return; - } - else if ( (fd->access_mode&ADIO_RDONLY) && (file_exists!=GLOBUS_TRUE) ) - { - if ( myrank==0 ) - { - FPRINTF(stderr,"WARNING: read-only file %s does not exist!\n",fd->filename); - } - } - num_gridftp_handles++; -} diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_read.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_read.c deleted file mode 100644 index 91ed544c807191e0851bef75c2678c90d086f04d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_read.c +++ /dev/null @@ -1,465 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" -#include "adio_extern.h" - -static globus_mutex_t readcontig_ctl_lock; -static globus_cond_t readcontig_ctl_cond; -static globus_bool_t readcontig_ctl_done; -static void readcontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&readcontig_ctl_lock); - if ( readcontig_ctl_done!=GLOBUS_TRUE ) - readcontig_ctl_done=GLOBUS_TRUE; - globus_cond_signal(&readcontig_ctl_cond); - globus_mutex_unlock(&readcontig_ctl_lock); - return; -} - -static void readcontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - globus_size_t *bytes_read; - - bytes_read=(globus_size_t *)myargs; - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - *bytes_read+=length; - /* I don't understand why the data callback has to keep recalling register_read, - but everything I've done and all the examples I've seen seem to require - that behavior to work... */ - /* - * Using buffer+length seems to work, but is probably not the correct - * solution. A big read of 256kB chunks will have lines like this: - readcontig_data_cb: buffer 0x404e0008 length 0 offset 31719424 eof 1 - readcontig_data_cb: buffer 0x404a0008 length 65536 offset 31981568 eof 0 - readcontig_data_cb: buffer 0x404b0008 length 65536 offset 32047104 eof 0 - readcontig_data_cb: buffer 0x404c0008 length 65536 offset 32112640 eof 0 - readcontig_data_cb: buffer 0x404d0008 length 65536 offset 32178176 eof 0 - */ - if ( !eof ) - globus_ftp_client_register_read(handle, - buffer+length, - length, - readcontig_data_cb, - (void *)(bytes_read)); - return; -} - -static globus_mutex_t readdiscontig_ctl_lock; -static globus_cond_t readdiscontig_ctl_cond; -static globus_bool_t readdiscontig_ctl_done; -static void readdiscontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&readdiscontig_ctl_lock); - if ( readdiscontig_ctl_done!=GLOBUS_TRUE ) - readdiscontig_ctl_done=GLOBUS_TRUE; - globus_cond_signal(&readdiscontig_ctl_cond); - globus_mutex_unlock(&readdiscontig_ctl_lock); - return; -} - -static void readdiscontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - globus_size_t *bytes_read; - - bytes_read=(globus_size_t *)myargs; - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - *bytes_read+=length; - /* I don't understand why the data callback has to keep recalling register_read, - but everything I've done and all the examples I've seen seem to require - that behavior to work... */ - if ( !eof ) - globus_ftp_client_register_read(handle, - buffer, - length, - readdiscontig_data_cb, - (void *)(bytes_read)); - return; -} - -void ADIOI_GRIDFTP_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - static char myname[]="ADIOI_GRIDFTP_ReadContig"; - int myrank, nprocs; - MPI_Count datatype_size; - globus_size_t len,bytes_read=0; - globus_off_t goff; - globus_result_t result; - - if ( fd->access_mode&ADIO_WRONLY ) - { - *error_code=MPIR_ERR_MODE_WRONLY; - return; - } - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - MPI_Type_size_x(datatype, &datatype_size); - - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - offset = fd->fp_ind; - } - - /* Do the gridftp I/O transfer */ - goff = (globus_off_t)offset; - len = ((globus_size_t)datatype_size)*((globus_size_t)count); - - globus_mutex_init(&readcontig_ctl_lock, GLOBUS_NULL); - globus_cond_init(&readcontig_ctl_cond, GLOBUS_NULL); - readcontig_ctl_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_get(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - goff, - goff+(globus_off_t)len, - readcontig_ctl_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_get",myname,result); - *error_code=MPI_ERR_IO; - ADIOI_Error(fd,*error_code,myname); - return; - } - result=globus_ftp_client_register_read(&(gridftp_fh[fd->fd_sys]), - (globus_byte_t *)buf, len, readcontig_data_cb, - (void *)(&bytes_read)); - if ( result != GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_read",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - - - /* The ctl callback won't start till the data callbacks complete, so it's - safe to wait on just the ctl callback */ - globus_mutex_lock(&readcontig_ctl_lock); - while ( readcontig_ctl_done!=GLOBUS_TRUE ) - globus_cond_wait(&readcontig_ctl_cond,&readcontig_ctl_lock); - globus_mutex_unlock(&readcontig_ctl_lock); - - globus_mutex_destroy(&readcontig_ctl_lock); - globus_cond_destroy(&readcontig_ctl_cond); - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bytes_read); -#endif - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - fd->fp_ind += bytes_read; - fd->fp_sys_posn = fd->fp_ind; - } - else { - fd->fp_sys_posn = offset + bytes_read; - } -} - -void ADIOI_GRIDFTP_ReadDiscontig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - char myname[]="ADIOI_GRIDFTP_ReadDiscontig"; - int myrank,nprocs; - /* size and extent of buffer in memory */ - MPI_Aint btype_size,btype_extent,btype_lb; - /* size and extent of file record layout */ - MPI_Aint ftype_size,ftype_extent,ftype_lb; - /* size of file elemental type; seeks are done in units of this */ - MPI_Aint etype_size; - MPI_Aint extent; - ADIOI_Flatlist_node *flat_file; - int i,buf_contig,boff,nblks; - globus_off_t start,end,goff; - globus_size_t bytes_read; - globus_result_t result; - globus_byte_t *tmp; - - if ( fd->access_mode&ADIO_WRONLY ) - { - *error_code=MPIR_ERR_MODE_WRONLY; - return; - } - - *error_code=MPI_SUCCESS; - - MPI_Comm_rank(fd->comm,&myrank); - MPI_Comm_size(fd->comm,&nprocs); - - etype_size=fd->etype_size; - MPI_Type_size_x(fd->filetype,&ftype_size); - MPI_Type_get_extent(fd->filetype,&ftype_lb,&ftype_extent); - /* This is arguably unnecessary, as this routine assumes that the - buffer in memory is contiguous */ - MPI_Type_size_x(datatype,&btype_size); - MPI_Type_get_extent(datatype,&btype_lb,&btype_extent); - ADIOI_Datatype_iscontig(datatype,&buf_contig); - - if ( ( btype_extent!=btype_size ) || ( ! buf_contig ) ) - { - FPRINTF(stderr,"[%d/%d] %s called with discontigous memory buffer\n", - myrank,nprocs,myname); - fflush(stderr); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", 0 ); - return; - } - /* from here we can assume btype_extent==btype_size */ - - /* Flatten out fd->filetype so we know which blocks to skip */ - flat_file = ADIOI_Flatten_and_find(fd->filetype); - - /* Figure out how big the area to read is */ - start=(globus_off_t)(offset*etype_size); - goff=start; - boff=0; - extent=0; - nblks=0; - while ( boff < (count*btype_size) ) - { - int blklen=0; - - for (i=0;i<flat_file->count;i++) - { - /* find the length of the next block */ - if ( (boff+flat_file->blocklens[i]) < (count*btype_size) ) - blklen=flat_file->blocklens[i]; - else - blklen=(count*btype_size)-boff; - /* increment buffer size to be used */ - boff+=blklen; - /* compute extent -- the nblks*ftype_extent bit is - there so we remember how many ftypes we've already - been through */ - extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen); - if ( boff>=(count*btype_size) ) - break; - } - nblks++; - } - if ( extent < count*btype_size ) - { - FPRINTF(stderr,"[%d/%d] %s error in computing extent -- extent %d is smaller than total bytes requested %d!\n", - myrank,nprocs,myname,extent,count*btype_size); - fflush(stderr); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", 0); - return; - } - end=start+(globus_off_t)extent; - tmp=(globus_byte_t *)ADIOI_Malloc((size_t)extent*sizeof(globus_byte_t)); - - /* start up the globus partial read */ - globus_mutex_init(&readdiscontig_ctl_lock, GLOBUS_NULL); - globus_cond_init(&readdiscontig_ctl_cond, GLOBUS_NULL); - readdiscontig_ctl_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_get(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - start, - end, - readdiscontig_ctl_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_get",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - - /* Do all the actual I/Os */ - /* Since globus_ftp_client_register_read() is brain-dead and doesn't - let you specify an offset, we have to slurp the entire extent into - memory and then parse out the pieces we want... Sucks, doesn't it? - - This should probably be done in chunks (preferably of a size - set using a file hint), but that'll have to come later. - --TB */ - if ( (result=globus_ftp_client_register_read(&(gridftp_fh[fd->fd_sys]), - tmp, - (globus_size_t)extent, - readdiscontig_data_cb, - (void *)(&bytes_read)))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_read",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - /* The ctl callback won't start till the data callbacks complete, so it's - safe to wait on just the ctl callback */ - globus_mutex_lock(&readdiscontig_ctl_lock); - while ( readdiscontig_ctl_done!=GLOBUS_TRUE ) - globus_cond_wait(&readdiscontig_ctl_cond,&readdiscontig_ctl_lock); - globus_mutex_unlock(&readdiscontig_ctl_lock); - - globus_mutex_destroy(&readdiscontig_ctl_lock); - globus_cond_destroy(&readdiscontig_ctl_cond); - - boff=0; - nblks=0; - goff=0; - while ( boff < (count*btype_size) ) - { - int i,blklen; - - for (i=0;i<flat_file->count;i++) - { - if ( (boff+flat_file->blocklens[i]) < (count*btype_size) ) - blklen=flat_file->blocklens[i]; - else - blklen=(count*btype_size)-boff; - if ( blklen > 0 ) - { - goff=nblks*ftype_extent+flat_file->indices[i]; - memcpy((globus_byte_t *)buf+boff,tmp+goff,(size_t)blklen); - boff+=blklen; - if ( boff>=(count*btype_size) ) - break; - } - } - nblks++; - } - ADIOI_Free(tmp); - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bytes_read); -#endif - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - fd->fp_ind += extent; - fd->fp_sys_posn = fd->fp_ind; - } - else { - fd->fp_sys_posn = offset + extent; - } -} - -void ADIOI_GRIDFTP_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); -#ifdef PRINT_ERR_MSG - FPRINTF(stdout, "[%d/%d] ADIOI_GRIDFTP_ReadStrided called on %s\n", myrank, - nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStrided\n", myrank, - nprocs); -#endif - - ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); - - */ - - char myname[]="ADIOI_GRIDFTP_ReadStrided"; - int myrank, nprocs; - int i,j; - int buf_contig,file_contig; - MPI_Aint btype_size,bufsize; - globus_off_t start,disp; - globus_size_t bytes_read; - globus_byte_t *intermediate; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - MPI_Type_size_x(datatype,&btype_size); - bufsize=count*btype_size; - ADIOI_Datatype_iscontig(fd->filetype,&file_contig); - ADIOI_Datatype_iscontig(datatype,&buf_contig); - if ( buf_contig && !file_contig ) - { - /* Contiguous in memory, discontig in file */ - ADIOI_GRIDFTP_ReadDiscontig(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - } - else if ( !buf_contig && file_contig ) - { - /* Discontiguous in mem, contig in file -- comparatively easy */ - int posn=0; - - /* read contiguous data into intermediate buffer */ - intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize); - ADIOI_GRIDFTP_ReadContig(fd, intermediate, bufsize, MPI_BYTE, - file_ptr_type, offset, status, error_code); - - /* explode contents of intermediate buffer into main buffer */ - MPI_Unpack(intermediate,bufsize,&posn,buf,count,datatype,fd->comm); - - ADIOI_Free(intermediate); - } - else if ( !buf_contig && !file_contig ) - { - /* Discontig in both mem and file -- the hardest case */ - int posn=0; - - /* Read discontiguous data into intermediate buffer */ - intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize); - ADIOI_GRIDFTP_ReadDiscontig(fd, intermediate, bufsize, MPI_BYTE, - file_ptr_type, offset, status, error_code); - - /* explode contents of intermediate buffer into main buffer */ - posn=0; - MPI_Unpack(intermediate,bufsize,&posn,buf,count,datatype,fd->comm); - - ADIOI_Free(intermediate); - } - else - { - /* Why did you bother calling ReadStrided?!?!?! */ - ADIOI_GRIDFTP_ReadContig(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - } - -} - diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_resize.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_resize.c deleted file mode 100644 index 96c0460c42fe8dff3d11e1cae8c7ce6f2a3f9d0a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_resize.c +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" - -static globus_mutex_t resize_lock; -static globus_cond_t resize_cond; -static globus_bool_t resize_done; -static globus_bool_t resize_success; - -void resize_cb(void *myargs, globus_ftp_client_handle_t *handle, - globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - globus_mutex_lock(&resize_lock); - resize_success=GLOBUS_FALSE; - globus_mutex_unlock(&resize_lock); - } - else - { - globus_mutex_lock(&resize_lock); - resize_success=GLOBUS_TRUE; - globus_mutex_unlock(&resize_lock); - } - globus_mutex_lock(&resize_lock); - resize_done=GLOBUS_TRUE; - globus_cond_signal(&resize_cond); - globus_mutex_unlock(&resize_lock); -} - - -static void resize_wrdata_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - if (error) - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - if (!eof) - globus_ftp_client_register_read(handle, - buffer, - length, - resize_wrdata_cb, - myargs); - return; -} - - -void ADIOI_GRIDFTP_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int myrank, nprocs; - char myname[]="ADIOI_GRIDFTP_Resize"; - globus_off_t fsize; - globus_result_t result; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - /* Sanity check */ - if ( fd->access_mode&ADIO_RDONLY ) - { - FPRINTF(stderr,"%s: attempt to resize read-only file %s!\n", - myname,fd->filename); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", 0); - return; - } - - /* This routine is supposed to do the moral equivalent of truncate(), - but there's not an equivalent operation in the globus_ftp_client API. */ - globus_mutex_init(&resize_lock,GLOBUS_NULL); - globus_cond_init(&resize_cond,GLOBUS_NULL); - resize_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_size(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - &(fsize), - resize_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_size",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&resize_lock); - while ( resize_done!=GLOBUS_TRUE ) - globus_cond_wait(&resize_lock,&resize_cond); - if ( fsize < (globus_off_t)size ) - { - /* The file is smaller than the requested size, so - do a zero-byte write to where the new EOF should be. */ - globus_byte_t touchbuf=(globus_byte_t)'\0'; - resize_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - (globus_off_t)size, - (globus_off_t)size, - resize_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_put",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - - if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]), - (globus_byte_t *)&touchbuf, - 0, - (globus_off_t)0, - GLOBUS_TRUE, - resize_wrdata_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_write",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&resize_lock); - while ( resize_done!=GLOBUS_TRUE ) - globus_cond_wait(&resize_cond,&resize_lock); - globus_mutex_unlock(&resize_lock); - } - else if ( fsize > (globus_off_t)size ) - { - /* The file is bigger than the requested size, so - we'll abuse globus_ftp_client_third_party_partial_put() - into truncating it for us. */ - char *urlold; - size_t urllen; - - urllen=strlen(fd->filename); - urlold=(char *)ADIOI_Malloc(urllen+5); - ADIOI_Snprintf(urlold,urllen+5,"%s.old",fd->filename); - resize_done=GLOBUS_FALSE; - resize_success=GLOBUS_FALSE; - if ( (result=globus_ftp_client_move(&(gridftp_fh[fd->fd_sys]), - fd->filename, - urlold, - &(oattr[fd->fd_sys]), - resize_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_move",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&resize_lock); - while ( resize_done!=GLOBUS_TRUE ) - globus_cond_wait(&resize_cond,&resize_lock); - globus_mutex_unlock(&resize_lock); - if ( resize_success!=GLOBUS_TRUE ) - { - *error_code = MPI_ERR_IO; - return; - } - resize_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_third_party_transfer(&(gridftp_fh[fd->fd_sys]), - urlold, - &(oattr[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - 0, - (globus_off_t)size, - resize_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_third_party_transfer",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&resize_lock); - while ( resize_done!=GLOBUS_TRUE ) - globus_cond_wait(&resize_cond,&resize_lock); - globus_mutex_unlock(&resize_lock); - if ( resize_success!=GLOBUS_TRUE ) - { - *error_code = MPI_ERR_IO; - ADIOI_Error(fd,*error_code,myname); - return; - } - resize_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_delete(&(gridftp_fh[fd->fd_sys]), - urlold, - &(oattr[fd->fd_sys]), - resize_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_delete",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", - globus_object_printable_to_string(globus_error_get(result))); - return; - } - globus_mutex_lock(&resize_lock); - while ( resize_done!=GLOBUS_TRUE ) - globus_cond_wait(&resize_cond,&resize_lock); - globus_mutex_unlock(&resize_lock); - if ( resize_success!=GLOBUS_TRUE ) - { - *error_code = MPI_ERR_IO; - ADIOI_Error(fd,*error_code,myname); - return; - } - ADIOI_Free(urlold); - } - globus_mutex_destroy(&resize_lock); - globus_cond_destroy(&resize_cond); -} - - - - - diff --git a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_write.c b/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_write.c deleted file mode 100644 index d349d5c2318ec7a29fa5c530d3ed7eeb330cf66f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/ad_gridftp_write.c +++ /dev/null @@ -1,470 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_gridftp.h" -#include "adioi.h" -#include "adio_extern.h" - -static globus_mutex_t writecontig_ctl_lock; -static globus_cond_t writecontig_ctl_cond; -static globus_bool_t writecontig_ctl_done; -static void writecontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&writecontig_ctl_lock); - if ( writecontig_ctl_done!=GLOBUS_TRUE ) - writecontig_ctl_done=GLOBUS_TRUE; - globus_cond_signal(&writecontig_ctl_cond); - globus_mutex_unlock(&writecontig_ctl_lock); -#ifdef PRINT_ERR_MSG - FPRINTF(stderr,"finished with contig write transaction\n"); -#endif /* PRINT_ERR_MSG */ - return; -} - -static void writecontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - globus_size_t *bytes_written; - - bytes_written=(globus_size_t *)myargs; - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - *bytes_written+=length; - /* I don't understand why the data callback has to keep recalling register_write, - but everything I've done and all the examples I've seen seem to require - that behavior to work... */ - if ( !eof ) - { - globus_ftp_client_register_write(handle, - buffer, - length, - offset, - GLOBUS_TRUE, - writecontig_data_cb, - (void *)(bytes_written)); - } -#ifdef PRINT_ERR_MSG - FPRINTF(stderr,"wrote %Ld bytes...",(long long)length); -#endif /* PRINT_ERR_MSG */ - return; -} - - -static globus_mutex_t writediscontig_ctl_lock; -static globus_cond_t writediscontig_ctl_cond; -static globus_bool_t writediscontig_ctl_done; -static void writediscontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error) -{ - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - globus_mutex_lock(&writediscontig_ctl_lock); - if ( writediscontig_ctl_done!=GLOBUS_TRUE ) - writediscontig_ctl_done=GLOBUS_TRUE; - globus_cond_signal(&writediscontig_ctl_cond); - globus_mutex_unlock(&writediscontig_ctl_lock); - return; -} - -static void writediscontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error, - globus_byte_t *buffer, globus_size_t length, globus_off_t offset, - globus_bool_t eof) -{ - globus_size_t *bytes_written; - - bytes_written=(globus_size_t *)myargs; - if (error) - { - FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error)); - } - *bytes_written+=length; - /* I don't understand why the data callback has to keep recalling register_read, - but everything I've done and all the examples I've seen seem to require - that behavior to work... */ - if ( !eof ) - globus_ftp_client_register_write(handle, - buffer, - length, - offset, - eof, - writediscontig_data_cb, - (void *)(bytes_written)); - FPRINTF(stderr,"wrote %Ld bytes...",(long long)length); - return; -} - - -void ADIOI_GRIDFTP_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - char myname[]="ADIOI_GRIDFTP_WriteContig"; - int myrank, nprocs; - MPI_Count datatype_size; - globus_size_t len,bytes_written=0; - globus_off_t goff; - globus_result_t result; - - if ( fd->access_mode&ADIO_RDONLY ) - { - *error_code=MPI_ERR_AMODE; - return; - } - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - MPI_Type_size_x(datatype, &datatype_size); - - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - offset = fd->fp_ind; - } - - /* Do the gridftp I/O transfer */ - goff = (globus_off_t)offset; - len = ((globus_size_t)datatype_size)*((globus_size_t)count); - - globus_mutex_init(&writecontig_ctl_lock, GLOBUS_NULL); - globus_cond_init(&writecontig_ctl_cond, GLOBUS_NULL); - writecontig_ctl_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - goff, - goff+(globus_off_t)len, - writecontig_ctl_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_put",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]), - (globus_byte_t *)buf, - len, - goff, - GLOBUS_TRUE, - writecontig_data_cb, - (void *)(&bytes_written)))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_write",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - - - /* The ctl callback won't start till the data callbacks complete, so it's - safe to wait on just the ctl callback */ - globus_mutex_lock(&writecontig_ctl_lock); - while ( writecontig_ctl_done!=GLOBUS_TRUE ) - globus_cond_wait(&writecontig_ctl_cond,&writecontig_ctl_lock); - globus_mutex_unlock(&writecontig_ctl_lock); - - globus_mutex_destroy(&writecontig_ctl_lock); - globus_cond_destroy(&writecontig_ctl_cond); - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bytes_written); -#endif - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - offset = fd->fp_ind; - fd->fp_ind += bytes_written; - fd->fp_sys_posn = fd->fp_ind; - } - else { - fd->fp_sys_posn = offset + bytes_written; - } -} - - -void ADIOI_GRIDFTP_WriteDiscontig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - char myname[]="ADIOI_GRIDFTP_WriteDiscontig"; - int myrank,nprocs; - MPI_Aint btype_size,btype_extent,btype_lb; - MPI_Aint ftype_size,ftype_extent,ftype_lb; - MPI_Aint etype_size; - MPI_Aint extent; - ADIOI_Flatlist_node *flat_file; - int buf_contig,boff,i,nblks; - globus_off_t start,end,goff; - globus_size_t bytes_written; - globus_result_t result; - - MPI_Comm_rank(fd->comm,&myrank); - MPI_Comm_size(fd->comm,&nprocs); - etype_size=fd->etype_size; - MPI_Type_size_x(fd->filetype,&ftype_size); - MPI_Type_get_extent(fd->filetype,&ftype_lb,&ftype_extent); - /* This is arguably unnecessary, as this routine assumes that the - buffer in memory is contiguous */ - MPI_Type_size_x(datatype,&btype_size); - MPI_Type_get_extent(datatype,&btype_lb,&btype_extent); - ADIOI_Datatype_iscontig(datatype,&buf_contig); - - if ( ( btype_extent!=btype_size ) || ( ! buf_contig ) ) - { - FPRINTF(stderr,"[%d/%d] %s called with discontigous memory buffer\n", - myrank,nprocs,myname); - fflush(stderr); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - /* from here we can assume btype_extent==btype_size */ - - /* Flatten out fd->filetype so we know which blocks to skip */ - flat_file = ADIOI_Flatten_and_find(fd->filetype); - - /* Figure out how big the area to write is */ - /* ASSUMPTION: ftype_size is an integer multiple of btype_size or vice versa. */ - start=(globus_off_t)(offset*etype_size); - goff=start; - boff=0; - extent=0; - nblks=0; - while ( boff < (count*btype_size) ) - { - int blklen; - - for (i=0;i<flat_file->count;i++) - { - if ( (boff+flat_file->blocklens[i]) < (count*btype_size) ) - blklen=flat_file->blocklens[i]; - else - blklen=(count*btype_size)-boff; - boff+=blklen; - extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen); - if ( boff>=(count*btype_size) ) - break; - } - nblks++; - } - if ( extent < count*btype_size ) - { - FPRINTF(stderr,"[%d/%d] %s error in computing extent -- extent %d is smaller than total bytes requested %d!\n", - myrank,nprocs,myname,extent,count*btype_size); - fflush(stderr); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - end=start+(globus_off_t)extent; - FPRINTF(stderr,"[%d/%d] %s writing %d bytes into extent of %d bytes starting at offset %Ld\n", - myrank,nprocs,myname,count*btype_size,extent,(long long)start); - fflush(stderr); - - /* start up the globus partial write */ - globus_mutex_init(&writediscontig_ctl_lock, GLOBUS_NULL); - globus_cond_init(&writediscontig_ctl_cond, GLOBUS_NULL); - writediscontig_ctl_done=GLOBUS_FALSE; - if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]), - fd->filename, - &(oattr[fd->fd_sys]), - GLOBUS_NULL, - start, - end, - writediscontig_ctl_cb, - GLOBUS_NULL))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_partial_get",myname,result); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", globus_object_printable_to_string(globus_error_get(result))); - return; - } - - /* Do all the actual I/Os */ - boff=0; - nblks=0; - while ( boff < (count*btype_size) ) - { - int i,blklen; - - for (i=0;i<flat_file->count;i++) - { - if ( (boff+flat_file->blocklens[i]) < (count*btype_size) ) - blklen=flat_file->blocklens[i]; - else - blklen=(count*btype_size)-boff; - if ( blklen > 0 ) - { - goff=start+nblks*ftype_extent+((globus_off_t)flat_file->indices[i]); - /* - FPRINTF(stderr,"[%d/%d] %s writing %d bytes from boff=%d at goff=%Ld\n",myrank,nprocs,myname,blklen,boff,goff); - */ - if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]), - ((globus_byte_t *)buf)+boff, - (globus_size_t)blklen, - goff, - GLOBUS_TRUE, - writediscontig_data_cb, - (void *)(&bytes_written)))!=GLOBUS_SUCCESS ) - { - globus_err_handler("globus_ftp_client_register_write",myname,result); - *error_code=MPI_ERR_IO; - ADIOI_Error(fd,*error_code,myname); - return; - } - boff+=blklen; - if ( boff>=(count*btype_size) ) - break; - } - } - nblks++; - } - - - /* The ctl callback won't start till the data callbacks complete, so it's - safe to wait on just the ctl callback */ - globus_mutex_lock(&writediscontig_ctl_lock); - while ( writediscontig_ctl_done!=GLOBUS_TRUE ) - globus_cond_wait(&writediscontig_ctl_cond,&writediscontig_ctl_lock); - globus_mutex_unlock(&writediscontig_ctl_lock); - globus_mutex_destroy(&writediscontig_ctl_lock); - globus_cond_destroy(&writediscontig_ctl_cond); - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bytes_written); -#endif - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - fd->fp_ind += extent; - fd->fp_sys_posn = fd->fp_ind; - } - else { - fd->fp_sys_posn = offset + extent; - } -} - - -#define GRIDFTP_USE_GENERIC_STRIDED -void ADIOI_GRIDFTP_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ -#ifdef GRIDFTP_USE_GENERIC_STRIDED - int myrank, nprocs; - - if ( fd->access_mode&ADIO_RDONLY ) - { - *error_code=MPI_ERR_AMODE; - return; - } - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); - return; -#else - char myname[]="ADIOI_GRIDFTP_WriteStrided"; - int myrank, nprocs; - int buf_contig,file_contig; - MPI_Aint btype_size,bufsize; - globus_byte_t *intermediate; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - MPI_Type_size_x(datatype,&btype_size); - bufsize=count*btype_size; - ADIOI_Datatype_iscontig(fd->filetype,&file_contig); - ADIOI_Datatype_iscontig(datatype,&buf_contig); - if ( buf_contig && !file_contig ) - { - /* Contiguous in memory, discontig in file */ - FPRINTF(stderr,"[%d/%d] %s called w/ contig mem, discontig file\n", - myrank,nprocs,myname); - fflush(stderr); - - ADIOI_GRIDFTP_WriteDiscontig(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - } - else if ( !buf_contig && file_contig ) - { - /* Discontiguous in mem, contig in file -- comparatively easy */ - int posn=0; - - FPRINTF(stderr,"[%d/%d] %s called w/ discontig mem, contig file\n", - myrank,nprocs,myname); - fflush(stderr); - - - /* squeeze contents of main buffer into intermediate buffer*/ - intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize); - MPI_Pack(buf,count,datatype,intermediate,bufsize,&posn,fd->comm); - - /* write contiguous data from intermediate buffer */ - ADIOI_GRIDFTP_WriteContig(fd, intermediate, bufsize, MPI_BYTE, - file_ptr_type, offset, status, error_code); - - ADIOI_Free(intermediate); - } - else if ( !buf_contig && !file_contig ) - { - /* Discontig in both mem and file -- the hardest case */ - int posn=0; - - FPRINTF(stderr,"[%d/%d] %s called w/ discontig mem, discontig file\n", - myrank,nprocs,myname); - fflush(stderr); - - /* squeeze contents of main buffer into intermediate buffer*/ - intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize); - MPI_Pack(buf,count,datatype,intermediate,bufsize,&posn,fd->comm); - - /* write contiguous data from intermediate buffer */ - ADIOI_GRIDFTP_WriteDiscontig(fd, intermediate, bufsize, MPI_BYTE, - file_ptr_type, offset, status, error_code); - - ADIOI_Free(intermediate); - } - else - { - /* Why did you bother calling WriteStrided?!?!?! */ - FPRINTF(stderr,"[%d/%d] Why the heck did you call %s with contiguous buffer *and* file types?\n", - myrank,nprocs,myname); - ADIOI_GRIDFTP_WriteContig(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - } -#endif /* ! GRIDFTP_USE_GENERIC_STRIDED */ -} - diff --git a/3rd-party/romio321/adio/ad_gridftp/globus_routines.c b/3rd-party/romio321/adio/ad_gridftp/globus_routines.c deleted file mode 100644 index 1cca367a3f7841c1b916ca56201691db50b8e850..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_gridftp/globus_routines.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center. - * See COPYRIGHT notice in top-level directory. - */ - -#include <unistd.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <fcntl.h> -#include "adio.h" -#include <globus_ftp_client.h> - -/* Here are the canonical definitions of the extern's referenced by - ad_gridftp.h */ -int num_gridftp_handles=0; -#ifndef ADIO_GRIDFTP_HANDLES_MAX -#define ADIO_GRIDFTP_HANDLES_MAX 200 -#endif /* ! ADIO_GRIDFTP_HANDLES_MAX */ -/* having to keep not one but two big global tables sucks... */ -globus_ftp_client_handle_t gridftp_fh[ADIO_GRIDFTP_HANDLES_MAX]; -globus_ftp_client_operationattr_t oattr[ADIO_GRIDFTP_HANDLES_MAX]; - -void globus_err_handler(const char *routine, const char *caller, - globus_result_t result) -{ - int myrank,nprocs; - globus_object_t *err; - - MPI_Comm_rank(MPI_COMM_WORLD,&myrank); - MPI_Comm_size(MPI_COMM_WORLD,&nprocs); - err = globus_error_get(result); - FPRINTF(stderr, "[%d/%d] %s error \"%s\", called from %s\n", - myrank,nprocs,routine,globus_object_printable_to_string(err),caller); -} diff --git a/3rd-party/romio321/adio/ad_hfs/Makefile.mk b/3rd-party/romio321/adio/ad_hfs/Makefile.mk deleted file mode 100644 index 318b5076396ee67c2600799d31c04e70a5a7bcb4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/Makefile.mk +++ /dev/null @@ -1,21 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_HFS - -noinst_HEADERS += adio/ad_hfs/ad_hfs.h - -romio_other_sources += \ - adio/ad_hfs/ad_hfs_read.c \ - adio/ad_hfs/ad_hfs_open.c \ - adio/ad_hfs/ad_hfs_write.c \ - adio/ad_hfs/ad_hfs_fcntl.c \ - adio/ad_hfs/ad_hfs_resize.c \ - adio/ad_hfs/ad_hfs.c - -endif BUILD_AD_HFS - diff --git a/3rd-party/romio321/adio/ad_hfs/README b/3rd-party/romio321/adio/ad_hfs/README deleted file mode 100644 index 933677b17700a197403f8a280084806bcb2f029f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/README +++ /dev/null @@ -1 +0,0 @@ -This code is no longer supported. diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs.c deleted file mode 100644 index 5b34354cabefebf6282d33aefcd7debdbc6a7fcc..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_HFS_operations = { - ADIOI_HFS_Open, /* Open */ - ADIOI_HFS_ReadContig, /* ReadContig */ - ADIOI_HFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_HFS_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_HFS_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs.h b/3rd-party/romio321/adio/ad_hfs/ad_hfs.h deleted file mode 100644 index 2950aa50fcfe50dcc17d1f61d8367f0272d7b2ee..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_HFS_INCLUDE -#define AD_HFS_INCLUDE - -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> -#include "adio.h" -#ifdef SPPUX -# include <sys/cnx_types.h> -# include <sys/puio.h> -# include <cnx_unistd.h> -#endif - -void ADIOI_HFS_Open(ADIO_File fd, int *error_code); -void ADIOI_HFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_HFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_HFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs_fcntl.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs_fcntl.c deleted file mode 100644 index 460c73666fe19c051e389d535ebab6ab2643abaa..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs_fcntl.c +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" -#include "adio_extern.h" - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif -void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - int i, ntimes, err; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_FCNTL"; -#endif - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END); -#ifdef HPUX - if (fd->fp_sys_posn != -1) - lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); -/* not required in SPPUX since there we use pread/pwrite */ -#endif - if (fcntl_struct->fsize == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - /* will be called by one process only */ - -#ifdef HPUX - err = prealloc64(fd->fd_sys, fcntl_struct->diskspace); - /* prealloc64 works only if file is of zero length */ - if (err && (errno != ENOTEMPTY)) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - return; - } - if (err && (errno == ENOTEMPTY)) { -#endif - -#ifdef SPPUX - /* SPPUX has no prealloc64. therefore, use prealloc - if size < (2GB - 1), otherwise use long method. */ - if (fcntl_struct->diskspace <= 2147483647) { - err = prealloc(fd->fd_sys, (off_t) fcntl_struct->diskspace); - if (err && (errno != ENOTEMPTY)) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - return; - } - } - - if ((fcntl_struct->diskspace > 2147483647) || - (err && (errno == ENOTEMPTY))) { -#endif - ADIOI_GEN_Prealloc(fd,fcntl_struct->diskspace, error_code); - } - ADIOI_Free(buf); -#ifdef HPUX - if (fd->fp_sys_posn != -1) - lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - /* not required in SPPUX since there we use pread/pwrite */ -#endif - } - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_HFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs_open.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs_open.c deleted file mode 100644 index 46ee2848e562ecb91987d079abd88df484e44343..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs_open.c +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif - -void ADIOI_HFS_Open(ADIO_File fd, int *error_code) -{ - int perm, old_mask, amode; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_OPEN"; -#endif - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - fd->fd_sys = open64(fd->filename, amode, perm); - fd->fd_direct = -1; - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { - fd->fp_ind = lseek64(fd->fd_sys, 0, SEEK_END); -#ifdef HPUX - fd->fp_sys_posn = fd->fp_ind; -#endif - } - -#ifdef SPPUX - fd->fp_sys_posn = -1; /* set it to null bec. we use pread, pwrite*/ -#endif - - if (fd->fd_sys == -1 ) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(ADIO_FILE_NULL, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs_read.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs_read.c deleted file mode 100644 index eac03ab6f8006d43cb81efcede16d245330e05ed..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs_read.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif - -void ADIOI_HFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_READCONTIG"; -#endif - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - -#ifdef SPPUX - fd->fp_sys_posn = -1; /* set it to null, since we are using pread */ - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) - err = pread64(fd->fd_sys, buf, len, offset); - else { /* read from curr. location of ind. file pointer */ - err = pread64(fd->fd_sys, buf, len, fd->fp_ind); - fd->fp_ind += err; - } -#endif - -#ifdef HPUX - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - lseek64(fd->fd_sys, offset, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } -#endif - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1 ) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs_resize.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs_resize.c deleted file mode 100644 index de24ad672ae5b4eb66dfbbfc192a164d8e425d7f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs_resize.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" - -void ADIOI_HFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_RESIZE"; -#endif - - err = ftruncate64(fd->fd_sys, size); - if (err == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_hfs/ad_hfs_write.c b/3rd-party/romio321/adio/ad_hfs/ad_hfs_write.c deleted file mode 100644 index 4bffa82a2f92c627b90daa1f189a78f4ce797481..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_hfs/ad_hfs_write.c +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif - -void ADIOI_HFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_WRITECONTIG"; -#endif - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - -#ifdef SPPUX - fd->fp_sys_posn = -1; /* set it to null, since we are using pwrite */ - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) - err = pwrite64(fd->fd_sys, buf, len, offset); - else { /* write from curr. location of ind. file pointer */ - err = pwrite64(fd->fd_sys, buf, len, fd->fp_ind); - fd->fp_ind += err; - } -#endif - -#ifdef HPUX - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - lseek64(fd->fd_sys, offset, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } -#endif - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_SUCCESS; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre.c deleted file mode 100644 index f3bc3d091b0827c471b0c2205af59b92310363c4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" - -struct ADIOI_Fns_struct ADIO_LUSTRE_operations = { - ADIOI_LUSTRE_Open, /* Open */ - ADIOI_GEN_OpenColl, /* OpenColl */ - ADIOI_LUSTRE_ReadContig, /* ReadContig */ - ADIOI_LUSTRE_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_LUSTRE_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_GEN_Fcntl, /* Fcntl */ - ADIOI_LUSTRE_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_LUSTRE_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ -#if defined(ROMIO_HAVE_WORKING_AIO) && !defined(CRAY_XT_LUSTRE) - ADIOI_GEN_IreadContig, /* IreadContig */ - ADIOI_GEN_IwriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif - ADIOI_GEN_IODone, /* ReadDone */ - ADIOI_GEN_IODone, /* WriteDone */ - ADIOI_GEN_IOComplete, /* ReadComplete */ - ADIOI_GEN_IOComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_Feature, /* Features */ - "LUSTRE:", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre.h b/3rd-party/romio321/adio/ad_lustre/ad_lustre.h deleted file mode 100644 index edd2bd35efdee217d6da44db65652500fbc3fd18..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#ifndef AD_UNIX_INCLUDE -#define AD_UNIX_INCLUDE - -/* temp*/ -#define HAVE_ASM_TYPES_H 1 - -#include <unistd.h> -#include <linux/types.h> - -#ifdef __linux__ -# include <sys/ioctl.h> /* necessary for: */ -# include <time.h> -# define __USE_GNU /* O_DIRECT and */ -# include <fcntl.h> /* IO operations */ -# undef __USE_GNU -#endif /* __linux__ */ - -/*#include <fcntl.h>*/ -#include <sys/ioctl.h> -#include <lustre/lustre_user.h> -#include "adio.h" -/*#include "adioi.h"*/ - -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif - -#ifdef HAVE_AIO_LITE_H -#include <aio-lite.h> -#else - #ifdef HAVE_AIO_H - #include <aio.h> - #endif - #ifdef HAVE_SYS_AIO_H - #include <sys/aio.h> - #endif -#endif /* End of HAVE_AIO_LITE_H */ - -void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code); -void ADIOI_LUSTRE_Close(ADIO_File fd, int *error_code); -void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code); -void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - -/* the lustre utilities: */ -int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, - ADIO_Offset *len_list, int nprocs); - -void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int **striping_info_ptr, - int mode); -void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - int *striping_info, int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int ***buf_idx_ptr); - -int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, - ADIO_Offset *len, int *striping_info); -#endif /* End of AD_UNIX_INCLUDE */ diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_aggregate.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_aggregate.c deleted file mode 100644 index da54d71cf59bed93bcc3158c42c353e58cb207ac..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_aggregate.c +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" -#include "adio_extern.h" - -#undef AGG_DEBUG - -void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int **striping_info_ptr, - int mode) -{ - int *striping_info = NULL; - /* get striping information: - * striping_info[0]: stripe_size - * striping_info[1]: stripe_count - * striping_info[2]: avail_cb_nodes - */ - int stripe_size, stripe_count, CO = 1; - int avail_cb_nodes, divisor, nprocs_for_coll = fd->hints->cb_nodes; - - /* Get hints value */ - /* stripe size */ - stripe_size = fd->hints->striping_unit; - /* stripe count */ - /* stripe_size and stripe_count have been validated in ADIOI_LUSTRE_Open() */ - stripe_count = fd->hints->striping_factor; - - /* Calculate the available number of I/O clients */ - if (!mode) { - /* for collective read, - * if "CO" clients access the same OST simultaneously, - * the OST disk seek time would be much. So, to avoid this, - * it might be better if 1 client only accesses 1 OST. - * So, we set CO = 1 to meet the above requirement. - */ - CO = 1; - /*XXX: maybe there are other better way for collective read */ - } else { - /* CO also has been validated in ADIOI_LUSTRE_Open(), >0 */ - CO = fd->hints->fs_hints.lustre.co_ratio; - } - /* Calculate how many IO clients we need */ - /* Algorithm courtesy Pascal Deveze (pascal.deveze@bull.net) */ - /* To avoid extent lock conflicts, - * avail_cb_nodes should either - * - be a multiple of stripe_count, - * - or divide stripe_count exactly - * so that each OST is accessed by a maximum of CO constant clients. */ - if (nprocs_for_coll >= stripe_count) - /* avail_cb_nodes should be a multiple of stripe_count and the number - * of procs per OST should be limited to the minimum between - * nprocs_for_coll/stripe_count and CO - * - * e.g. if stripe_count=20, nprocs_for_coll=42 and CO=3 then - * avail_cb_nodes should be equal to 40 */ - avail_cb_nodes = - stripe_count * ADIOI_MIN(nprocs_for_coll/stripe_count, CO); - else { - /* nprocs_for_coll is less than stripe_count */ - /* avail_cb_nodes should divide stripe_count */ - /* e.g. if stripe_count=60 and nprocs_for_coll=8 then - * avail_cb_nodes should be egal to 6 */ - /* This could be done with : - while (stripe_count % avail_cb_nodes != 0) avail_cb_nodes--; - but this can be optimized for large values of nprocs_for_coll and - stripe_count */ - divisor = 2; - avail_cb_nodes = 1; - /* try to divise */ - while (stripe_count >= divisor*divisor) { - if ((stripe_count % divisor) == 0) { - if (stripe_count/divisor <= nprocs_for_coll) { - /* The value is found ! */ - avail_cb_nodes = stripe_count/divisor; - break; - } - /* if divisor is less than nprocs_for_coll, divisor is a - * solution, but it is not sure that it is the best one */ - else if (divisor <= nprocs_for_coll) - avail_cb_nodes = divisor; - } - divisor++; - } - } - - *striping_info_ptr = (int *) ADIOI_Malloc(3 * sizeof(int)); - striping_info = *striping_info_ptr; - striping_info[0] = stripe_size; - striping_info[1] = stripe_count; - striping_info[2] = avail_cb_nodes; -} - -int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, - ADIO_Offset *len, int *striping_info) -{ - int rank_index, rank; - ADIO_Offset avail_bytes; - int stripe_size = striping_info[0]; - int avail_cb_nodes = striping_info[2]; - - /* Produce the stripe-contiguous pattern for Lustre */ - rank_index = (int)((off / stripe_size) % avail_cb_nodes); - - /* we index into fd_end with rank_index, and fd_end was allocated to be no - * bigger than fd->hins->cb_nodes. If we ever violate that, we're - * overrunning arrays. Obviously, we should never ever hit this abort - */ - if (rank_index >= fd->hints->cb_nodes) - MPI_Abort(MPI_COMM_WORLD, 1); - - avail_bytes = (off / (ADIO_Offset)stripe_size + 1) * - (ADIO_Offset)stripe_size - off; - if (avail_bytes < *len) { - /* this proc only has part of the requested contig. region */ - *len = avail_bytes; - } - /* map our index to a rank */ - /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ - rank = fd->hints->ranklist[rank_index]; - - return rank; -} - -/* ADIOI_LUSTRE_Calc_my_req() - calculate what portions of the access requests - * of this process are located in the file domains of various processes - * (including this one) - */ - - -void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - int *striping_info, int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int ***buf_idx_ptr) -{ - /* Nothing different from ADIOI_Calc_my_req(), except calling - * ADIOI_Lustre_Calc_aggregator() instead of the old one */ - int *count_my_req_per_proc, count_my_req_procs, **buf_idx; - int i, l, proc; - ADIO_Offset avail_len, rem_len, curr_idx, off; - ADIOI_Access *my_req; - - *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - count_my_req_per_proc = *count_my_req_per_proc_ptr; - /* count_my_req_per_proc[i] gives the no. of contig. requests of this - * process in process i's file domain. calloc initializes to zero. - * I'm allocating memory of size nprocs, so that I can do an - * MPI_Alltoall later on. - */ - - buf_idx = (int **) ADIOI_Malloc(nprocs * sizeof(int*)); - - /* one pass just to calculate how much space to allocate for my_req; - * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() - */ - for (i = 0; i < contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write - */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - avail_len = len_list[i]; - /* note: we set avail_len to be the total size of the access. - * then ADIOI_LUSTRE_Calc_aggregator() will modify the value to return - * the amount that was available. - */ - proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); - count_my_req_per_proc[proc]++; - - /* figure out how many data is remaining in the access - * we'll take care of this data (if there is any) - * in the while loop below. - */ - rem_len = len_list[i] - avail_len; - - while (rem_len != 0) { - off += avail_len; /* point to first remaining byte */ - avail_len = rem_len; /* save remaining size, pass to calc */ - proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); - count_my_req_per_proc[proc]++; - rem_len -= avail_len; /* reduce remaining length by amount from fd */ - } - } - - /* buf_idx is relevant only if buftype_is_contig. - * buf_idx[i] gives the index into user_buf where data received - * from proc 'i' should be placed. This allows receives to be done - * without extra buffer. This can't be done if buftype is not contig. - */ - - /* initialize buf_idx vectors */ - for (i = 0; i < nprocs; i++) { - /* add one to count_my_req_per_proc[i] to avoid zero size malloc */ - buf_idx[i] = (int *) ADIOI_Malloc((count_my_req_per_proc[i] + 1) - * sizeof(int)); - } - - /* now allocate space for my_req, offset, and len */ - *my_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); - my_req = *my_req_ptr; - - count_my_req_procs = 0; - for (i = 0; i < nprocs; i++) { - if (count_my_req_per_proc[i]) { - my_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_my_req_per_proc[i] * - sizeof(ADIO_Offset)); - my_req[i].lens = ADIOI_Malloc(count_my_req_per_proc[i] * - sizeof(ADIO_Offset)); - count_my_req_procs++; - } - my_req[i].count = 0; /* will be incremented where needed later */ - } - - /* now fill in my_req */ - curr_idx = 0; - for (i = 0; i < contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - avail_len = len_list[i]; - proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); - - l = my_req[proc].count; - - ADIOI_Assert(curr_idx == (int) curr_idx); - ADIOI_Assert(l < count_my_req_per_proc[proc]); - buf_idx[proc][l] = (int) curr_idx; - curr_idx += avail_len; - - rem_len = len_list[i] - avail_len; - - /* store the proc, offset, and len information in an array - * of structures, my_req. Each structure contains the - * offsets and lengths located in that process's FD, - * and the associated count. - */ - my_req[proc].offsets[l] = off; - ADIOI_Assert(avail_len == (int) avail_len); - my_req[proc].lens[l] = (int) avail_len; - my_req[proc].count++; - - while (rem_len != 0) { - off += avail_len; - avail_len = rem_len; - proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, - striping_info); - - l = my_req[proc].count; - ADIOI_Assert(curr_idx == (int) curr_idx); - ADIOI_Assert(l < count_my_req_per_proc[proc]); - buf_idx[proc][l] = (int) curr_idx; - - curr_idx += avail_len; - rem_len -= avail_len; - - my_req[proc].offsets[l] = off; - ADIOI_Assert(avail_len == (int) avail_len); - my_req[proc].lens[l] = (int) avail_len; - my_req[proc].count++; - } - } - -#ifdef AGG_DEBUG - for (i = 0; i < nprocs; i++) { - if (count_my_req_per_proc[i] > 0) { - FPRINTF(stdout, "data needed from %d (count = %d):\n", - i, my_req[i].count); - for (l = 0; l < my_req[i].count; l++) { - FPRINTF(stdout, " off[%d] = %lld, len[%d] = %d\n", - l, my_req[i].offsets[l], l, my_req[i].lens[l]); - } - } - } -#endif - - *count_my_req_procs_ptr = count_my_req_procs; - *buf_idx_ptr = buf_idx; -} - -int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, - ADIO_Offset *len_list, int nprocs) -{ - /* If the processes are non-interleaved, we will check the req_size. - * if (avg_req_size > big_req_size) { - * docollect = 0; - * } - */ - - int i, docollect = 1, big_req_size = 0; - ADIO_Offset req_size = 0, total_req_size; - int avg_req_size, total_access_count; - - /* calculate total_req_size and total_access_count */ - for (i = 0; i < contig_access_count; i++) - req_size += len_list[i]; - MPI_Allreduce(&req_size, &total_req_size, 1, MPI_LONG_LONG_INT, MPI_SUM, - fd->comm); - MPI_Allreduce(&contig_access_count, &total_access_count, 1, MPI_INT, MPI_SUM, - fd->comm); - /* avoid possible divide-by-zero) */ - if (total_access_count != 0) { - /* estimate average req_size */ - avg_req_size = (int)(total_req_size / total_access_count); - } else { - avg_req_size = 0; - } - /* get hint of big_req_size */ - big_req_size = fd->hints->fs_hints.lustre.coll_threshold; - /* Don't perform collective I/O if there are big requests */ - if ((big_req_size > 0) && (avg_req_size > big_req_size)) - docollect = 0; - - return docollect; -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_fcntl.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_fcntl.c deleted file mode 100644 index a4bd6fc6d1769eb5e86422523a317c8625f37e0d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_fcntl.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - */ - -#include "ad_lustre.h" -#include "adio_extern.h" - -void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - int i, ntimes; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; -#if defined(MPICH) || !defined(PRINT_ERR_MSG) - static char myname[] = "ADIOI_LUSTRE_FCNTL"; -#endif - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - if (fcntl_struct->fsize == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - /* will be called by one process only */ - /* On file systems with no preallocation function, I have to - explicitly write - to allocate space. Since there could be holes in the file, - I need to read up to the current file size, write it back, - and then write beyond that depending on how much - preallocation is needed. - read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */ - - curr_fsize = lseek(fd->fd_sys, 0, SEEK_END); - alloc_size = fcntl_struct->diskspace; - - size = ADIOI_MIN(curr_fsize, alloc_size); - - ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; - buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); - done = 0; - - for (i=0; i<ntimes; i++) { - len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ); - ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, - &status, error_code); - if (*error_code != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", strerror(errno)); - return; - } - ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - done, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - done += len; - } - - if (alloc_size > curr_fsize) { - memset(buf, 0, ADIOI_PREALLOC_BUFSZ); - size = alloc_size - curr_fsize; - ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; - for (i=0; i<ntimes; i++) { - len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ); - ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - done, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - done += len; - } - } - ADIOI_Free(buf); - if (fd->fp_sys_posn != -1) - lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_LUSTRE_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_hints.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_hints.c deleted file mode 100644 index 1d40c86f26a9e108cea65736aa1e9750994ed1be..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_hints.c +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" -#include "adio_extern.h" -#include "hint_fns.h" -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value; - int flag; - ADIO_Offset stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1; - int myrank; - static char myname[] = "ADIOI_LUSTRE_SETINFO"; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if ( (fd->info) == MPI_INFO_NULL) { - /* This must be part of the open call. can set striping parameters - if necessary. */ - MPI_Info_create(&(fd->info)); - - ADIOI_Info_set(fd->info, "direct_read", "false"); - ADIOI_Info_set(fd->info, "direct_write", "false"); - fd->direct_read = fd->direct_write = 0; - /* initialize lustre hints */ - ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", "1"); - fd->hints->fs_hints.lustre.co_ratio = 1; - ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", "0"); - fd->hints->fs_hints.lustre.coll_threshold = 0; - ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "enable"); - fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_ENABLE; - - /* has user specified striping or server buffering parameters - and do they have the same value on all processes? */ - if (users_info != MPI_INFO_NULL) { - /* striping information */ - ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - ADIOI_Info_set(fd->info, "striping_unit", value); - str_unit=atoll(value); - } - - ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - ADIOI_Info_set(fd->info, "striping_factor", value); - str_factor=atoll(value); - } - - ADIOI_Info_get(users_info, "romio_lustre_start_iodevice", - MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); - start_iodev=atoll(value); - } - - - /* direct read and write */ - ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { - ADIOI_Info_set(fd->info, "direct_read", "true"); - fd->direct_read = 1; - } - ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { - ADIOI_Info_set(fd->info, "direct_write", "true"); - fd->direct_write = 1; - } - } - - /* set striping information with ioctl */ - MPI_Comm_rank(fd->comm, &myrank); - if (myrank == 0) { - stripe_val[0] = str_factor; - stripe_val[1] = str_unit; - stripe_val[2] = start_iodev; - } - MPI_Bcast(stripe_val, 3, MPI_OFFSET, 0, fd->comm); - - /* do not open file in hint processing. Open file in open routines, - * where we can better deal with EXCL flag . Continue to check the - * "all processors set a value" condition holds. */ - if (stripe_val[0] != str_factor - || stripe_val[1] != str_unit - || stripe_val[2] != start_iodev) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME("ADIOI_LUSTRE_SetInfo", - "str_factor or str_unit or start_iodev", - error_code); - ADIOI_Free(value); - return; - } - } - - /* get other hint */ - if (users_info != MPI_INFO_NULL) { - /* CO: IO Clients/OST, - * to keep the load balancing between clients and OSTs */ - ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_co_ratio", - &(fd->hints->fs_hints.lustre.co_ratio), myname, error_code ); - - /* coll_threshold: - * if the req size is bigger than this, collective IO may not be performed. - */ - ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_coll_threshold", - &(fd->hints->fs_hints.lustre.coll_threshold), myname, error_code ); - - /* ds_in_coll: disable data sieving in collective IO */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_lustre_ds_in_coll", - &(fd->hints->fs_hints.lustre.ds_in_coll), myname, error_code ); - - } - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - /* generic hints might step on striping_unit */ - if (users_info != MPI_INFO_NULL) { - ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", - NULL, myname, error_code); - } - - if (ADIOI_Direct_read) fd->direct_read = 1; - if (ADIOI_Direct_write) fd->direct_write = 1; - - ADIOI_Free(value); - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_open.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_open.c deleted file mode 100644 index a3b03be9eaf98b7b02c0276f6c7043a1d136ffa5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_open.c +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" - -/* what is the basis for this define? - * what happens if there are more than 1k UUIDs? */ - -#define MAX_LOV_UUID_COUNT 1000 - -void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code) -{ - int perm, old_mask, amode, amode_direct; - int lumlen, myrank, flag, set_layout=0, err; - struct lov_user_md *lum = NULL; - char *value; - ADIO_Offset str_factor = -1, str_unit=0, start_iodev=-1; - -#if defined(MPICH) || !defined(PRINT_ERR_MSG) - static char myname[] = "ADIOI_LUSTRE_OPEN"; -#endif - - MPI_Comm_rank(fd->comm, &myrank); - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - amode_direct = amode | O_DIRECT; - - /* odd length here because lov_user_md contains some fixed data and - * then a list of 'lmm_objects' representing stripe */ - lumlen = sizeof(struct lov_user_md) + - MAX_LOV_UUID_COUNT * sizeof(struct lov_user_ost_data); - lum = (struct lov_user_md *)ADIOI_Calloc(1,lumlen); - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - /* we already validated in LUSTRE_SetInfo that these are going to be the same */ - if (fd->info != MPI_INFO_NULL) { - /* striping information */ - ADIOI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) - str_unit=atoll(value); - - ADIOI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) - str_factor=atoll(value); - - ADIOI_Info_get(fd->info, "romio_lustre_start_iodevice", - MPI_MAX_INFO_VAL, value, &flag); - if (flag) - start_iodev=atoll(value); - } - if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) - set_layout = 1; - - /* if hints were set, we need to delay creation of any lustre objects. - * However, if we open the file with O_LOV_DELAY_CREATE and don't call the - * follow-up ioctl, subsequent writes will fail */ - if (myrank == 0 && set_layout) - amode = amode | O_LOV_DELAY_CREATE; - - fd->fd_sys = open(fd->filename, amode, perm); - if (fd->fd_sys == -1) goto fn_exit; - - /* we can only set these hints on new files */ - /* It was strange and buggy to open the file in the hint path. Instead, - * we'll apply the file tunings at open time */ - if ((amode & O_CREAT) && set_layout ) { - /* if user has specified striping info, process 0 tries to set it */ - if (!myrank) { - lum->lmm_magic = LOV_USER_MAGIC; - lum->lmm_pattern = 0; - /* crude check for overflow of lustre internal datatypes. - * Silently cap to large value if user provides a value - * larger than lustre supports */ - if (str_unit > UINT_MAX) - lum->lmm_stripe_size = UINT_MAX; - else - lum->lmm_stripe_size = str_unit; - - if (str_factor > USHRT_MAX) - lum->lmm_stripe_count = USHRT_MAX; - else - lum->lmm_stripe_count = str_factor; - - if (start_iodev > USHRT_MAX) - lum->lmm_stripe_offset = USHRT_MAX; - else - lum->lmm_stripe_offset = start_iodev; - err = ioctl(fd->fd_sys, LL_IOC_LOV_SETSTRIPE, lum); - if (err == -1 && errno != EEXIST) { - fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno)); - /* not a fatal error, but user might care to know */ - } - } /* End of striping parameters validation */ - } - - /* Pascal Deveze reports that, even though we pass a - * "GETSTRIPE" (read) flag to the ioctl, if some of the values of this - * struct are uninitialzed, the call can give an error. zero it out in case - * there are other members that must be initialized and in case - * lov_user_md struct changes in future */ - memset(lum, 0, lumlen); - lum->lmm_magic = LOV_USER_MAGIC; - err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *)lum); - if (!err) { - - fd->hints->striping_unit = lum->lmm_stripe_size; - sprintf(value, "%d", lum->lmm_stripe_size); - ADIOI_Info_set(fd->info, "striping_unit", value); - - fd->hints->striping_factor = lum->lmm_stripe_count; - sprintf(value, "%d", lum->lmm_stripe_count); - ADIOI_Info_set(fd->info, "striping_factor", value); - - fd->hints->fs_hints.lustre.start_iodevice = lum->lmm_stripe_offset; - sprintf(value, "%d", lum->lmm_stripe_offset); - ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); - - } - - if (fd->access_mode & ADIO_APPEND) - fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); - - fd->fd_direct = -1; - if (fd->direct_write || fd->direct_read) { - fd->fd_direct = open(fd->filename, amode_direct, perm); - if (fd->fd_direct != -1) { - fd->d_mem = fd->d_miniosz = (1<<12); - } else { - perror("cannot open file with O_Direct"); - fd->direct_write = fd->direct_read = 0; - } - } - -fn_exit: - ADIOI_Free(lum); - ADIOI_Free(value); - /* --BEGIN ERROR HANDLING-- */ - if (fd->fd_sys == -1 || ((fd->fd_direct == -1) && - (fd->direct_write || fd->direct_read))) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - /* --END ERROR HANDLING-- */ - else *error_code = MPI_SUCCESS; - -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_rwcontig.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_rwcontig.c deleted file mode 100644 index cb187a39e9c098dc424987f4228afc5ebabbb45c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_rwcontig.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include <unistd.h> - -#include <stdlib.h> -#include <malloc.h> -#include "ad_lustre.h" - -#define LUSTRE_MEMALIGN (1<<12) /* to use page_shift */ - -static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, const void *buf, int len, - ADIO_Offset offset, int *err); -static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, const void *buf, int len, - ADIO_Offset offset, int *err) -{ - int rem, size, nbytes; - if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) { - *err = pwrite(fd->fd_direct, buf, len, offset); - } else if (len < fd->d_miniosz) { - *err = pwrite(fd->fd_sys, buf, len, offset); - } else { - rem = len % fd->d_miniosz; - size = len - rem; - nbytes = pwrite(fd->fd_direct, buf, size, offset); - nbytes += pwrite(fd->fd_sys, ((char *)buf) + size, rem, offset+size); - *err = nbytes; - } -} - -static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, const void *buf, int len, - ADIO_Offset offset, int *err); -static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, const void *buf, int len, - ADIO_Offset offset, int *err) -{ - int rem, size, nbytes; - if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) - *err = pread(fd->fd_direct, (void *)buf, len, offset); - else if (len < fd->d_miniosz) - *err = pread(fd->fd_sys, (void *)buf, len, offset); - else { - rem = len % fd->d_miniosz; - size = len - rem; - nbytes = pread(fd->fd_direct, (void *)buf, size, offset); - nbytes += pread(fd->fd_sys, ((char *)buf) + size, rem, offset+size); - *err = nbytes; - } -} - - -static int ADIOI_LUSTRE_Directio(ADIO_File fd, const void *buf, int len, - off_t offset, int rw); -static int ADIOI_LUSTRE_Directio(ADIO_File fd, const void *buf, int len, - off_t offset, int rw) -{ - int err=-1, diff, size=len, nbytes = 0; - void *newbuf; - - if (offset % fd->d_miniosz) { - diff = fd->d_miniosz - (offset % fd->d_miniosz); - diff = ADIOI_MIN(diff, len); - if (rw) - nbytes = pwrite(fd->fd_sys, (void *)buf, diff, offset); - else - nbytes = pread(fd->fd_sys, (void *)buf, diff, offset); - buf = ((char *) buf) + diff; - offset += diff; - size = len - diff; - } - - if (!size) { - return diff; - } - - if (rw) { /* direct I/O enabled */ - if (!(((long) buf) % fd->d_mem)) { - ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, buf, size, offset, &err); - nbytes += err; - } else { - newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); - if (newbuf) { - memcpy(newbuf, buf, size); - ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, newbuf, size, offset, &err); - nbytes += err; - ADIOI_Free(newbuf); - } - else nbytes += pwrite(fd->fd_sys, buf, size, offset); - } - err = nbytes; - } else { - if (!(((long) buf) % fd->d_mem)) { - ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, buf, size, offset, &err); - nbytes += err; - } else { - newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); - if (newbuf) { - ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); - if (err > 0) memcpy((void *)buf, newbuf, err); - nbytes += err; - ADIOI_Free(newbuf); - } - else nbytes += pread(fd->fd_sys, (void *)buf, size, offset); - } - err = nbytes; - } - return err; -} - -static void ADIOI_LUSTRE_IOContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int io_mode, int *error_code); -static void ADIOI_LUSTRE_IOContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int io_mode, int *error_code) -{ - int err=-1; - MPI_Count datatype_size, len; - static char myname[] = "ADIOI_LUSTRE_IOCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; - } - - if (!(fd->direct_read || fd->direct_write)) { - if (fd->fp_sys_posn != offset) { - err = lseek(fd->fd_sys, offset, SEEK_SET); - if (err == -1) goto ioerr; - } - - if (io_mode) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); -#endif - err = write(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); -#endif - } else { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); -#endif - err = read(fd->fd_sys, (void *)buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); -#endif - } - } else { - err = ADIOI_LUSTRE_Directio(fd, buf, len, offset, io_mode); - } - - if (err == -1) goto ioerr; - fd->fp_sys_posn = offset + err; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += err; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (status) MPIR_Status_set_bytes(status, datatype, err); -#endif - *error_code = MPI_SUCCESS; - -ioerr: - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ -} - -void ADIOI_LUSTRE_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, - offset, status, 1, error_code); -} - -void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, - offset, status, 0, error_code); -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrcoll.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrcoll.c deleted file mode 100644 index c034d42827a2bd1f1851374a03b98ecb2df39b80..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrcoll.c +++ /dev/null @@ -1,986 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" -#include "adio_extern.h" - -/* prototypes of functions used for collective writes only. */ -static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf, - MPI_Datatype datatype, int nprocs, - int myrank, - ADIOI_Access *others_req, - ADIOI_Access *my_req, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - int *striping_info, - int **buf_idx, int *error_code); -static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf, - ADIOI_Flatlist_node *flat_buf, - char **send_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, - int *sent_to_proc, int nprocs, - int myrank, int contig_access_count, - int *striping_info, - int *send_buf_idx, - int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent); -static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf, - char *write_buf, - ADIOI_Flatlist_node *flat_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, - int size, int *count, - int *start_pos, - int *sent_to_proc, int nprocs, - int myrank, int buftype_is_contig, - int contig_access_count, - int *striping_info, - ADIOI_Access *others_req, - int *send_buf_idx, - int *curr_to_proc, - int *done_to_proc, int *hole, - int iter, MPI_Aint buftype_extent, - int *buf_idx, - ADIO_Offset **srt_off, int **srt_len, int *srt_num, - int *error_code); -void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, - int nprocs, int nprocs_recv, int total_elements); - -void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, - int file_ptr_type, ADIO_Offset offset, - ADIO_Status *status, int *error_code) -{ - /* Uses a generalized version of the extended two-phase method described - * in "An Extended Two-Phase Method for Accessing Sections of - * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - * Scientific Programming, (5)4:301--317, Winter 1996. - * http://www.mcs.anl.gov/home/thakur/ext2ph.ps - */ - - ADIOI_Access *my_req; - /* array of nprocs access structures, one for each other process has - this process's request */ - - ADIOI_Access *others_req; - /* array of nprocs access structures, one for each other process - whose request is written by this process. */ - - int i, filetype_is_contig, nprocs, myrank, do_collect = 0; - int contig_access_count = 0, buftype_is_contig, interleave_count = 0; - int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset orig_fp, start_offset, end_offset, off; - ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *end_offsets = NULL; - ADIO_Offset *len_list = NULL; - int **buf_idx = NULL, *striping_info = NULL; - int old_error, tmp_error; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - orig_fp = fd->fp_ind; - - /* IO patten identification if cb_write isn't disabled */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - /* Note: end_offset points to the last byte-offset that will be accessed. - * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 - */ - - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); - - /* each process communicates its start and end offsets to other - * processes. The result is an array each of start and end offsets - * stored in order of process rank. - */ - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, - ADIO_OFFSET, fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, - ADIO_OFFSET, fd->comm); - /* are the accesses of different processes interleaved? */ - for (i = 1; i < nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ - - /* Two typical access patterns can benefit from collective write. - * 1) the processes are interleaved, and - * 2) the req size is small. - */ - if (interleave_count > 0) { - do_collect = 1; - } else { - do_collect = ADIOI_LUSTRE_Docollect(fd, contig_access_count, - len_list, nprocs); - } - } - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - - /* Decide if collective I/O should be done */ - if ((!do_collect && fd->hints->cb_write == ADIOI_HINT_AUTO) || - fd->hints->cb_write == ADIOI_HINT_DISABLE) { - - /* use independent accesses */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - } - - fd->fp_ind = orig_fp; - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - if (buftype_is_contig && filetype_is_contig) { - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; - ADIO_WriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, - off, status, error_code); - } else - ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } else { - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - } - return; - } - - /* Get Lustre hints information */ - ADIOI_LUSTRE_Get_striping_info(fd, &striping_info, 1); - - /* calculate what portions of the access requests of this process are - * located in which process - */ - ADIOI_LUSTRE_Calc_my_req(fd, offset_list, len_list, contig_access_count, - striping_info, nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - - /* based on everyone's my_req, calculate what requests of other processes - * will be accessed by this process. - * count_others_req_procs = number of processes whose requests (including - * this process itself) will be accessed by this process - * count_others_req_per_proc[i] indicates how many separate contiguous - * requests of proc. i will be accessed by this process. - */ - - ADIOI_Calc_others_req(fd, count_my_req_procs, count_my_req_per_proc, - my_req, nprocs, myrank, &count_others_req_procs, - &others_req); - ADIOI_Free(count_my_req_per_proc); - - /* exchange data and write in sizes of no more than stripe_size. */ - ADIOI_LUSTRE_Exch_and_write(fd, buf, datatype, nprocs, myrank, - others_req, my_req, offset_list, len_list, - contig_access_count, striping_info, - buf_idx, error_code); - - /* If this collective write is followed by an independent write, - * it's possible to have those subsequent writes on other processes - * race ahead and sneak in before the read-modify-write completes. - * We carry out a collective communication at the end here so no one - * can start independent i/o before collective I/O completes. - * - * need to do some gymnastics with the error codes so that if something - * went wrong, all processes report error, but if a process has a more - * specific error code, we can still have that process report the - * additional information */ - - old_error = *error_code; - if (*error_code != MPI_SUCCESS) - *error_code = MPI_ERR_IO; - - /* optimization: if only one process performing i/o, we can perform - * a less-expensive Bcast */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_postwrite_a, 0, NULL); -#endif - if (fd->hints->cb_nodes == 1) - MPI_Bcast(error_code, 1, MPI_INT, - fd->hints->ranklist[0], fd->comm); - else { - tmp_error = *error_code; - MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, - MPI_MAX, fd->comm); - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_postwrite_b, 0, NULL); -#endif - - if ((old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO)) - *error_code = old_error; - - - if (!buftype_is_contig) - ADIOI_Delete_flattened(datatype); - - /* free all memory allocated for collective I/O */ - /* free others_req */ - for (i = 0; i < nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } - ADIOI_Free(others_req); - /* free my_req here */ - for (i = 0; i < nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } - ADIOI_Free(my_req); - for (i = 0; i < nprocs; i++) { - ADIOI_Free(buf_idx[i]); - } - ADIOI_Free(buf_idx); - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(striping_info); - -#ifdef HAVE_STATUS_SET_BYTES - if (status) { - MPI_Count bufsize, size; - /* Don't set status if it isn't needed */ - MPI_Type_size_x(datatype, &size); - bufsize = size * count; - MPIR_Status_set_bytes(status, datatype, bufsize); - } - /* This is a temporary way of filling in status. The right way is to - * keep track of how much data was actually written during collective I/O. - */ -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ -} - -/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error - * code is created and returned in error_code. - */ -static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf, - MPI_Datatype datatype, int nprocs, - int myrank, ADIOI_Access *others_req, - ADIOI_Access *my_req, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - int *striping_info, int **buf_idx, - int *error_code) -{ - /* Send data to appropriate processes and write in sizes of no more - * than lustre stripe_size. - * The idea is to reduce the amount of extra memory required for - * collective I/O. If all data were written all at once, which is much - * easier, it would require temp space more than the size of user_buf, - * which is often unacceptable. For example, to write a distributed - * array to a file, where each local array is 8Mbytes, requiring - * at least another 8Mbytes of temp space is unacceptable. - */ - - int hole, i, j, m, flag, ntimes = 1 , max_ntimes, buftype_is_contig; - ADIO_Offset st_loc = -1, end_loc = -1, min_st_loc, max_end_loc; - ADIO_Offset off, req_off, send_off, iter_st_off, *off_list; - ADIO_Offset max_size, step_size = 0; - int real_size, req_len, send_len; - int *recv_curr_offlen_ptr, *recv_count, *recv_size; - int *send_curr_offlen_ptr, *send_size; - int *sent_to_proc, *recv_start_pos; - int *send_buf_idx, *curr_to_proc, *done_to_proc; - int *this_buf_idx; - char *write_buf = NULL; - MPI_Status status; - ADIOI_Flatlist_node *flat_buf = NULL; - MPI_Aint buftype_extent, buftype_lb; - int stripe_size = striping_info[0], avail_cb_nodes = striping_info[2]; - int data_sieving = 0; - ADIO_Offset *srt_off = NULL; - int *srt_len = NULL; - int srt_num = 0; - ADIO_Offset block_offset; - int block_len; - - *error_code = MPI_SUCCESS; /* changed below if error */ - /* only I/O errors are currently reported */ - - /* calculate the number of writes of stripe size to be done. - * That gives the no. of communication phases as well. - * Note: - * Because we redistribute data in stripe-contiguous pattern for Lustre, - * each process has the same no. of communication phases. - */ - - for (i = 0; i < nprocs; i++) { - if (others_req[i].count) { - st_loc = others_req[i].offsets[0]; - end_loc = others_req[i].offsets[0]; - break; - } - } - for (i = 0; i < nprocs; i++) { - for (j = 0; j < others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] + - others_req[i].lens[j] - 1)); - } - } - /* this process does no writing. */ - if ((st_loc == -1) && (end_loc == -1)) - ntimes = 0; - MPI_Allreduce(&end_loc, &max_end_loc, 1, MPI_LONG_LONG_INT, MPI_MAX, fd->comm); - /* avoid min_st_loc be -1 */ - if (st_loc == -1) - st_loc = max_end_loc; - MPI_Allreduce(&st_loc, &min_st_loc, 1, MPI_LONG_LONG_INT, MPI_MIN, fd->comm); - /* align downward */ - min_st_loc -= min_st_loc % (ADIO_Offset)stripe_size; - - /* Each time, only avail_cb_nodes number of IO clients perform IO, - * so, step_size=avail_cb_nodes*stripe_size IO will be performed at most, - * and ntimes=whole_file_portion/step_size - */ - step_size = (ADIO_Offset) avail_cb_nodes * stripe_size; - max_ntimes = (max_end_loc - min_st_loc + 1) / step_size - + (((max_end_loc - min_st_loc + 1) % step_size) ? 1 : 0); -/* max_ntimes = (int)((max_end_loc - min_st_loc) / step_size + 1); */ - if (ntimes) - write_buf = (char *) ADIOI_Malloc(stripe_size); - - /* calculate the start offset for each iteration */ - off_list = (ADIO_Offset *) ADIOI_Malloc(max_ntimes * sizeof(ADIO_Offset)); - for (m = 0; m < max_ntimes; m ++) - off_list[m] = max_end_loc; - for (i = 0; i < nprocs; i++) { - for (j = 0; j < others_req[i].count; j ++) { - req_off = others_req[i].offsets[j]; - m = (int)((req_off - min_st_loc) / step_size); - off_list[m] = ADIOI_MIN(off_list[m], req_off); - } - } - - recv_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - send_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* their use is explained below. calloc initializes to 0. */ - - recv_count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ - - send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be sent to each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ - - recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration. */ - - sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* amount of data sent to each proc so far. Used in - ADIOI_Fill_send_buffer. initialized to 0 here. */ - - send_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - curr_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - done_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* Above three are used in ADIOI_Fill_send_buffer */ - - this_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - - recv_start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* used to store the starting value of recv_curr_offlen_ptr[i] in - this iteration */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - if (!buftype_is_contig) { - flat_buf = ADIOI_Flatten_and_find(datatype); - } - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - /* I need to check if there are any outstanding nonblocking writes to - * the file, which could potentially interfere with the writes taking - * place in this collective write call. Since this is not likely to be - * common, let me do the simplest thing possible here: Each process - * completes all pending nonblocking operations before completing. - */ - /*ADIOI_Complete_async(error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Barrier(fd->comm); - */ - - iter_st_off = min_st_loc; - - /* Although we have recognized the data according to OST index, - * a read-modify-write will be done if there is a hole between the data. - * For example: if blocksize=60, xfersize=30 and stripe_size=100, - * then rank0 will collect data [0, 30] and [60, 90] then write. There - * is a hole in [30, 60], which will cause a read-modify-write in [0, 90]. - * - * To reduce its impact on the performance, we can disable data sieving - * by hint "ds_in_coll". - */ - /* check the hint for data sieving */ - data_sieving = fd->hints->fs_hints.lustre.ds_in_coll; - - for (m = 0; m < max_ntimes; m++) { - /* go through all others_req and my_req to check which will be received - * and sent in this iteration. - */ - - /* Note that MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order and that, for writes, the - filetypes cannot specify overlapping regions in the file. This - simplifies implementation a bit compared to reads. */ - - /* - off = start offset in the file for the data to be written in - this iteration - iter_st_off = start offset of this iteration - real_size = size of data written (bytes) corresponding to off - max_size = possible maximum size of data written in this iteration - req_off = offset in the file for a particular contiguous request minus - what was satisfied in previous iteration - send_off = offset the request needed by other processes in this iteration - req_len = size corresponding to req_off - send_len = size corresponding to send_off - */ - - /* first calculate what should be communicated */ - for (i = 0; i < nprocs; i++) - recv_count[i] = recv_size[i] = send_size[i] = 0; - - off = off_list[m]; - max_size = ADIOI_MIN(step_size, max_end_loc - iter_st_off + 1); - real_size = (int) ADIOI_MIN((off / stripe_size + 1) * stripe_size - - off, - end_loc - off + 1); - - for (i = 0; i < nprocs; i++) { - if (my_req[i].count) { - this_buf_idx[i] = buf_idx[i][send_curr_offlen_ptr[i]]; - for (j = send_curr_offlen_ptr[i]; j < my_req[i].count; j++) { - send_off = my_req[i].offsets[j]; - send_len = my_req[i].lens[j]; - if (send_off < iter_st_off + max_size) { - send_size[i] += send_len; - } else { - break; - } - } - send_curr_offlen_ptr[i] = j; - } - if (others_req[i].count) { - recv_start_pos[i] = recv_curr_offlen_ptr[i]; - for (j = recv_curr_offlen_ptr[i]; j < others_req[i].count; j++) { - req_off = others_req[i].offsets[j]; - req_len = others_req[i].lens[j]; - if (req_off < iter_st_off + max_size) { - recv_count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIU_Upint)(write_buf+req_off-off)); - MPI_Get_address(write_buf + req_off - off, - &(others_req[i].mem_ptrs[j])); - recv_size[i] += req_len; - } else { - break; - } - } - recv_curr_offlen_ptr[i] = j; - } - } - /* use variable "hole" to pass data_sieving flag into W_Exchange_data */ - hole = data_sieving; - ADIOI_LUSTRE_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, real_size, - recv_count, recv_start_pos, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - striping_info, others_req, send_buf_idx, - curr_to_proc, done_to_proc, &hole, m, - buftype_extent, this_buf_idx, - &srt_off, &srt_len, &srt_num, error_code); - - if (*error_code != MPI_SUCCESS) - goto over; - - flag = 0; - for (i = 0; i < nprocs; i++) - if (recv_count[i]) { - flag = 1; - break; - } - if (flag) { - /* check whether to do data sieving */ - if(data_sieving == ADIOI_HINT_ENABLE) { - ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, - error_code); - } else { - /* if there is no hole, write data in one time; - * otherwise, write data in several times */ - if (!hole) { - ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, - error_code); - } else { - block_offset = -1; - block_len = 0; - for (i = 0; i < srt_num; ++i) { - if (srt_off[i] < off + real_size && - srt_off[i] >= off) { - if (block_offset == -1) { - block_offset = srt_off[i]; - block_len = srt_len[i]; - } else { - if (srt_off[i] == block_offset + block_len) { - block_len += srt_len[i]; - } else { - ADIO_WriteContig(fd, - write_buf + block_offset - off, - block_len, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, - block_offset, &status, - error_code); - if (*error_code != MPI_SUCCESS) - goto over; - block_offset = srt_off[i]; - block_len = srt_len[i]; - } - } - } - } - if (block_offset != -1) { - ADIO_WriteContig(fd, - write_buf + block_offset - off, - block_len, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, - block_offset, &status, - error_code); - if (*error_code != MPI_SUCCESS) - goto over; - } - } - } - if (*error_code != MPI_SUCCESS) - goto over; - } - iter_st_off += max_size; - } -over: - if (srt_off) - ADIOI_Free(srt_off); - if (srt_len) - ADIOI_Free(srt_len); - if (ntimes) - ADIOI_Free(write_buf); - ADIOI_Free(recv_curr_offlen_ptr); - ADIOI_Free(send_curr_offlen_ptr); - ADIOI_Free(recv_count); - ADIOI_Free(send_size); - ADIOI_Free(recv_size); - ADIOI_Free(sent_to_proc); - ADIOI_Free(recv_start_pos); - ADIOI_Free(send_buf_idx); - ADIOI_Free(curr_to_proc); - ADIOI_Free(done_to_proc); - ADIOI_Free(this_buf_idx); - ADIOI_Free(off_list); -} - -/* Sets error_code to MPI_SUCCESS if successful, or creates an error code - * in the case of error. - */ -static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf, - char *write_buf, - ADIOI_Flatlist_node *flat_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, - int size, int *count, - int *start_pos, - int *sent_to_proc, int nprocs, - int myrank, int buftype_is_contig, - int contig_access_count, - int *striping_info, - ADIOI_Access *others_req, - int *send_buf_idx, - int *curr_to_proc, int *done_to_proc, - int *hole, int iter, - MPI_Aint buftype_extent, - int *buf_idx, - ADIO_Offset **srt_off, int **srt_len, int *srt_num, - int *error_code) -{ - int i, j, nprocs_recv, nprocs_send, err; - char **send_buf = NULL; - MPI_Request *requests, *send_req; - MPI_Datatype *recv_types; - MPI_Status *statuses, status; - int sum_recv; - int data_sieving = *hole; - static char myname[] = "ADIOI_W_EXCHANGE_DATA"; - - /* create derived datatypes for recv */ - nprocs_recv = 0; - for (i = 0; i < nprocs; i++) - if (recv_size[i]) - nprocs_recv++; - - recv_types = (MPI_Datatype *) ADIOI_Malloc((nprocs_recv + 1) * - sizeof(MPI_Datatype)); - /* +1 to avoid a 0-size malloc */ - - j = 0; - for (i = 0; i < nprocs; i++) { - if (recv_size[i]) { - ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, recv_types + j); - /* absolute displacements; use MPI_BOTTOM in recv */ - MPI_Type_commit(recv_types + j); - j++; - } - } - - /* To avoid a read-modify-write, - * check if there are holes in the data to be written. - * For this, merge the (sorted) offset lists others_req using a heap-merge. - */ - - *srt_num = 0; - for (i = 0; i < nprocs; i++) - *srt_num += count[i]; - if (*srt_off) - *srt_off = (ADIO_Offset *) ADIOI_Realloc(*srt_off, (*srt_num + 1) * sizeof(ADIO_Offset)); - else - *srt_off = (ADIO_Offset *) ADIOI_Malloc((*srt_num + 1) * sizeof(ADIO_Offset)); - if (*srt_len) - *srt_len = (int *) ADIOI_Realloc(*srt_len, (*srt_num + 1) * sizeof(int)); - else - *srt_len = (int *) ADIOI_Malloc((*srt_num + 1) * sizeof(int)); - /* +1 to avoid a 0-size malloc */ - - ADIOI_Heap_merge(others_req, count, *srt_off, *srt_len, start_pos, - nprocs, nprocs_recv, *srt_num); - - /* check if there are any holes */ - *hole = 0; - for (i = 0; i < *srt_num - 1; i++) { - if ((*srt_off)[i] + (*srt_len)[i] < (*srt_off)[i + 1]) { - *hole = 1; - break; - } - } - /* In some cases (see John Bent ROMIO REQ # 835), an odd interaction - * between aggregation, nominally contiguous regions, and cb_buffer_size - * should be handled with a read-modify-write (otherwise we will write out - * more data than we receive from everyone else (inclusive), so override - * hole detection - */ - if (*hole == 0) { - sum_recv = 0; - for (i = 0; i < nprocs; i++) - sum_recv += recv_size[i]; - if (size > sum_recv) - *hole = 1; - } - /* check the hint for data sieving */ - if (data_sieving == ADIOI_HINT_ENABLE && nprocs_recv && *hole) { - ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, &err); - // --BEGIN ERROR HANDLING-- - if (err != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(err, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**ioRMWrdwr", 0); - ADIOI_Free(recv_types); - return; - } - // --END ERROR HANDLING-- - } - - nprocs_send = 0; - for (i = 0; i < nprocs; i++) - if (send_size[i]) - nprocs_send++; - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + 1) * - sizeof(MPI_Request)); - send_req = requests; - } else { - requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1)* - sizeof(MPI_Request)); - /* +1 to avoid a 0-size malloc */ - - /* post receives */ - j = 0; - for (i = 0; i < nprocs; i++) { - if (recv_size[i]) { - MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, - myrank + i + 100 * iter, fd->comm, requests + j); - j++; - } - } - send_req = requests + nprocs_recv; - } - - /* post sends. - * if buftype_is_contig, data can be directly sent from - * user buf at location given by buf_idx. else use send_buf. - */ - if (buftype_is_contig) { - j = 0; - for (i = 0; i < nprocs; i++) - if (send_size[i]) { - ADIOI_Assert(buf_idx[i] != -1); - MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], - MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, - send_req + j); - j++; - } - } else - if (nprocs_send) { - /* buftype is not contig */ - send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); - for (i = 0; i < nprocs; i++) - if (send_size[i]) - send_buf[i] = (char *) ADIOI_Malloc(send_size[i]); - - ADIOI_LUSTRE_Fill_send_buffer(fd, buf, flat_buf, send_buf, offset_list, - len_list, send_size, send_req, - sent_to_proc, nprocs, myrank, - contig_access_count, striping_info, - send_buf_idx, curr_to_proc, done_to_proc, - iter, buftype_extent); - /* the send is done in ADIOI_Fill_send_buffer */ - } - - /* bug fix from Wei-keng Liao and Kenin Coloma */ - if (fd->atomicity) { - j = 0; - for (i = 0; i < nprocs; i++) { - MPI_Status wkl_status; - if (recv_size[i]) { - MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, - myrank + i + 100 * iter, fd->comm, &wkl_status); - j++; - } - } - } - - for (i = 0; i < nprocs_recv; i++) - MPI_Type_free(recv_types + i); - ADIOI_Free(recv_types); - - /* bug fix from Wei-keng Liao and Kenin Coloma */ - /* +1 to avoid a 0-size malloc */ - if (fd->atomicity) { - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + 1) * - sizeof(MPI_Status)); - } else { - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * - sizeof(MPI_Status)); - } - -#ifdef NEEDS_MPI_TEST - i = 0; - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - while (!i) - MPI_Testall(nprocs_send, send_req, &i, statuses); - } else { - while (!i) - MPI_Testall(nprocs_send + nprocs_recv, requests, &i, statuses); - } -#else - /* bug fix from Wei-keng Liao and Kenin Coloma */ - if (fd->atomicity) - MPI_Waitall(nprocs_send, send_req, statuses); - else - MPI_Waitall(nprocs_send + nprocs_recv, requests, statuses); -#endif - ADIOI_Free(statuses); - ADIOI_Free(requests); - if (!buftype_is_contig && nprocs_send) { - for (i = 0; i < nprocs; i++) - if (send_size[i]) - ADIOI_Free(send_buf[i]); - ADIOI_Free(send_buf); - } -} - -#define ADIOI_BUF_INCR \ -{ \ - while (buf_incr) { \ - size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - buf_incr -= size_in_buf; \ - } \ -} - - -#define ADIOI_BUF_COPY \ -{ \ - while (size) { \ - size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \ - ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ - memcpy(&(send_buf[p][send_buf_idx[p]]), \ - ((char *) buf) + user_buf_idx, size_in_buf); \ - send_buf_idx[p] += size_in_buf; \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - size -= size_in_buf; \ - buf_incr -= size_in_buf; \ - } \ - ADIOI_BUF_INCR \ -} - -static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf, - ADIOI_Flatlist_node *flat_buf, - char **send_buf, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, - int *sent_to_proc, int nprocs, - int myrank, - int contig_access_count, - int *striping_info, - int *send_buf_idx, - int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent) -{ - /* this function is only called if buftype is not contig */ - int i, p, flat_buf_idx, size; - int flat_buf_sz, buf_incr, size_in_buf, jj, n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - - /* curr_to_proc[p] = amount of data sent to proc. p that has already - * been accounted for so far - * done_to_proc[p] = amount of data already sent to proc. p in - * previous iterations - * user_buf_idx = current location in user buffer - * send_buf_idx[p] = current location in send_buf of proc. p - */ - - for (i = 0; i < nprocs; i++) { - send_buf_idx[i] = curr_to_proc[i] = 0; - done_to_proc[i] = sent_to_proc[i]; - } - jj = 0; - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - * flat_buf_sz = size of current contiguous component in flattened buf - */ - for (i = 0; i < contig_access_count; i++) { - off = offset_list[i]; - rem_len = (ADIO_Offset) len_list[i]; - - /*this request may span to more than one process */ - while (rem_len != 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_LUSTRE_Calc_aggregator(fd, off, &len, striping_info); - - if (send_buf_idx[p] < send_size[p]) { - if (curr_to_proc[p] + len > done_to_proc[p]) { - if (done_to_proc[p] > curr_to_proc[p]) { - size = (int) ADIOI_MIN(curr_to_proc[p] + len - - done_to_proc[p], - send_size[p] - - send_buf_idx[p]); - buf_incr = done_to_proc[p] - curr_to_proc[p]; - ADIOI_BUF_INCR - ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); - buf_incr = (int) (curr_to_proc[p] + len - - done_to_proc[p]); - ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); - curr_to_proc[p] = done_to_proc[p] + size; - ADIOI_BUF_COPY - } else { - size = (int) ADIOI_MIN(len, send_size[p] - - send_buf_idx[p]); - buf_incr = (int) len; - ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); - curr_to_proc[p] += size; - ADIOI_BUF_COPY - } - if (send_buf_idx[p] == send_size[p]) { - MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, - myrank + p + 100 * iter, fd->comm, - requests + jj); - jj++; - } - } else { - ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); - curr_to_proc[p] += (int) len; - buf_incr = (int) len; - ADIOI_BUF_INCR - } - } else { - buf_incr = (int) len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i = 0; i < nprocs; i++) - if (send_size[i]) - sent_to_proc[i] = curr_to_proc[i]; -} diff --git a/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrstr.c b/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrstr.c deleted file mode 100644 index ce538d4a6b6d9a9c3bbb8ebd5612b43442f80386..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_lustre/ad_lustre_wrstr.c +++ /dev/null @@ -1,527 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * - * Copyright (C) 2007 Oak Ridge National Laboratory - * - * Copyright (C) 2008 Sun Microsystems, Lustre group - */ - -#include "ad_lustre.h" -#include "adio_extern.h" - -#define ADIOI_BUFFERED_WRITE \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - if (writebuf_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, \ - &status1, error_code); \ - if (!(fd->atomicity)) \ - ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, \ - myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - } \ - writebuf_off = req_off; \ - /* stripe_size alignment */ \ - writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ - (writebuf_off / stripe_size + 1) * \ - stripe_size - writebuf_off); \ - if (!(fd->atomicity)) \ - ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, \ - writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, \ - myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowsrc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - } \ - write_sz = (unsigned) (ADIOI_MIN(req_len, \ - writebuf_off + writebuf_len - req_off)); \ - ADIOI_Assert((ADIO_Offset)write_sz == \ - ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf + req_off - writebuf_off, (char *)buf +userbuf_off, write_sz); \ - while (write_sz != req_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (!(fd->atomicity)) \ - ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - /* stripe_size alignment */ \ - writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ - (writebuf_off / stripe_size + 1) * \ - stripe_size - writebuf_off); \ - if (!(fd->atomicity)) \ - ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, \ - writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowsrc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ - } \ -} - - -/* this macro is used when filetype is contig and buftype is not contig. - it does not do a read-modify-write and does not lock*/ -#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, \ - error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, \ - myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - writebuf_off = req_off; \ - /* stripe_size alignment */ \ - writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ - (writebuf_off / stripe_size + 1) * \ - stripe_size - writebuf_off); \ - } \ - write_sz = (unsigned) ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off); \ - ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf + req_off - writebuf_off, \ - (char *)buf + userbuf_off, write_sz); \ - while (write_sz != req_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - ADIOI_Free(writebuf); \ - return; \ - } \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - /* stripe_size alignment */ \ - writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ - (writebuf_off / stripe_size + 1) * \ - stripe_size - writebuf_off); \ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ - } \ -} - -void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status * status, - int *error_code) -{ - /* offset is in units of etype relative to the filetype. */ - ADIOI_Flatlist_node *flat_buf, *flat_file; - ADIO_Offset i_offset, sum, size_in_filetype; - int i, j, k, st_index=0; - int n_etypes_in_filetype; - ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; - char *writebuf; - unsigned bufsize, writebuf_len, write_sz; - ADIO_Status status1; - ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len; - int stripe_size; - static char myname[] = "ADIOI_LUSTRE_WriteStrided"; - - if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { - /* if user has disabled data sieving on writes, use naive - * approach instead. - */ - ADIOI_GEN_WriteStrided_naive(fd, - buf, - count, - datatype, - file_ptr_type, - offset, status, error_code); - return; - } - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if (!filetype_size) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - - /* get striping info */ - stripe_size = fd->hints->striping_unit; - - /* Different buftype to different filetype */ - if (!buftype_is_contig && filetype_is_contig) { - /* noncontiguous in memory, contiguous in file. */ - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - - start_off = off; - end_offset = start_off + bufsize - 1; - /* write stripe size buffer each time */ - writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size)); - writebuf_off = 0; - writebuf_len = 0; - - /* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, bufsize); - - for (j = 0; j < count; j++) { - for (i = 0; i < flat_buf->count; i++) { - userbuf_off = (ADIO_Offset)j * (ADIO_Offset)buftype_extent + - flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_WRITE_WITHOUT_READ - off += flat_buf->blocklens[i]; - } - } - - /* write the buffer out finally */ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, - error_code); - - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, bufsize); - if (*error_code != MPI_SUCCESS) { - ADIOI_Free(writebuf); - return; - } - ADIOI_Free(writebuf); - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind = off; - } else { - /* noncontiguous in file */ - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) - flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* fwr_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - fwr_size = flat_file->blocklens[i]; - break; - } - if (dist > 0) { - fwr_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i = 0; i < flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + - abs_off_in_filetype; - } - - start_off = offset; - - /* Wei-keng Liao:write request is within single flat_file - * contig block*/ - /* this could happen, for example, with subarray types that are - * actually fairly contiguous */ - if (buftype_is_contig && bufsize <= fwr_size) { - req_off = start_off; - req_len = bufsize; - end_offset = start_off + bufsize - 1; - writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size)); - memset(writebuf, -1, ADIOI_MIN(bufsize, stripe_size)); - writebuf_off = 0; - writebuf_len = 0; - userbuf_off = 0; - ADIOI_BUFFERED_WRITE_WITHOUT_READ - /* write the buffer out finally */ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, - error_code); - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* update MPI-IO file pointer to point to the first byte - * that can be accessed in the fileview. */ - fd->fp_ind = offset + bufsize; - if (bufsize == fwr_size) { - do { - st_index++; - if (st_index == flat_file->count) { - st_index = 0; - n_filetypes++; - } - } while (flat_file->blocklens[st_index] == 0); - fd->fp_ind = disp + flat_file->indices[st_index] - + (ADIO_Offset)n_filetypes*filetype_extent; - } - } - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -#endif - ADIOI_Free(writebuf); - return; - } - - /* Calculate end_offset, the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ - - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - i_offset = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i_offset < bufsize) { - i_offset += fwr_size; - end_offset = off + fwr_size - 1; - - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - -/* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - writebuf_off = 0; - writebuf_len = 0; - writebuf = (char *) ADIOI_Malloc(stripe_size); - memset(writebuf, -1, stripe_size); - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i_offset = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i_offset < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size);*/ - - req_off = off; - req_len = fwr_size; - userbuf_off = i_offset; - ADIOI_BUFFERED_WRITE - } - i_offset += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + - n_filetypes*(ADIO_Offset)filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], - bufsize-i_offset); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - i_offset = flat_buf->indices[0]; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ - - req_off = off; - req_len = size; - userbuf_off = i_offset; - ADIOI_BUFFERED_WRITE - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - i_offset += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - i_offset = (ADIO_Offset)buftype_extent * - (ADIO_Offset)(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - /* write the buffer out finally */ - if (writebuf_len) { - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - writebuf_off, &status1, error_code); - if (!(fd->atomicity)) - ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); - if (*error_code != MPI_SUCCESS) return; - } - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - ADIOI_Free(writebuf); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) - ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs.c deleted file mode 100644 index 763a1b4c7e5b1644cf8c8953b60781292e3018a5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_NFS_operations = { - ADIOI_NFS_Open, /* Open */ - ADIOI_FAILSAFE_OpenColl, /* OpenColl */ - ADIOI_NFS_ReadContig, /* ReadContig */ - ADIOI_NFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_NFS_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_NFS_ReadStrided, /* ReadStrided */ - ADIOI_NFS_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ - /* Even with lockd running and NFS mounted 'noac', we have been unable to - * gaurantee correct behavior over NFS with asyncronous I/O operations */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_NFS_ReadDone, /* ReadDone */ - ADIOI_NFS_WriteDone, /* WriteDone */ - ADIOI_NFS_ReadComplete, /* ReadComplete */ - ADIOI_NFS_WriteComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_NFS_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_NFS_Feature, /* Features */ - "NFS:", /* fsname: just a string */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs.h b/3rd-party/romio321/adio/ad_nfs/ad_nfs.h deleted file mode 100644 index dd02bf4a2c3a0dd9c10bb2932c50317d9b923039..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_NFS_INCLUDE -#define AD_NFS_INCLUDE - -#include "adio.h" - -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> - -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_AIO_LITE_H -#include <aio-lite.h> -#else - #ifdef HAVE_AIO_H - #include <aio.h> - #endif - #ifdef HAVE_SYS_AIO_H - #include <sys/aio.h> - #endif -#endif - -/* Workaround for incomplete set of definitions if __REDIRECT is not - defined and large file support is used in aio.h */ -#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) -#define aiocb aiocb64 -#endif - -int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, MPI_Request *request); - -#ifdef SX4 -#define lseek llseek -#endif - -void ADIOI_NFS_Open(ADIO_File fd, int *error_code); -void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp, - int *error_code); -void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); -void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -int ADIOI_NFS_Feature(ADIO_File fd, int feature_flag); - -#endif diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_done.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_done.c deleted file mode 100644 index ff688546cab67a35e39f8237c4061f9e4696e309..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_done.c +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - *error_code = MPI_SUCCESS; - return 1; -} -int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return ADIOI_NFS_ReadDone(request, status, error_code); -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_fcntl.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_fcntl.c deleted file mode 100644 index c73006e6cd93788b5db4ed88cc81ba2f68876797..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_fcntl.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" -#include "adio_extern.h" -/* #ifdef MPISGI -#include "mpisgi2.h" -#endif */ - -void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - static char myname[] = "ADIOI_NFS_FCNTL"; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - ADIOI_READ_LOCK(fd, 0, SEEK_SET, 1); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd, 0, SEEK_SET, 1); - if (fd->fp_sys_posn != -1) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - if (fcntl_struct->fsize == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_features.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_features.c deleted file mode 100644 index 05b061acf47538ca1500cbeb7c3dc7f4840d01b8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_features.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "adio.h" -#include "ad_nfs.h" - -int ADIOI_NFS_Feature(ADIO_File fd, int flag) -{ - switch(flag) { - case ADIO_SHARED_FP: - case ADIO_LOCKS: - case ADIO_SEQUENTIAL: - case ADIO_DATA_SIEVING_WRITES: - return 1; - case ADIO_SCALABLE_OPEN: - case ADIO_UNLINK_AFTER_CLOSE: - case ADIO_SCALABLE_RESIZE: - default: - return 0; - } -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_getsh.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_getsh.c deleted file mode 100644 index 974d547cc13ee516ec159f52e32e5a7e1879a5ca..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_getsh.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -/* returns the current location of the shared_fp in terms of the - no. of etypes relative to the current view, and also increments the - shared_fp by the number of etypes to be accessed (incr) in the read - or write following this function. */ - -void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp, - int *error_code) -{ - ADIO_Offset new_fp; - ssize_t err; - MPI_Comm dupcommself; - static char myname[] = "ADIOI_NFS_GET_SHARED_FP"; - - if (fd->shared_fp_fd == ADIO_FILE_NULL) { - MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); - fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, - fd->shared_fp_fname, - fd->file_system, - fd->fns, - ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, - ADIO_PERM_NULL, error_code); - if (*error_code != MPI_SUCCESS) return; - *shared_fp = 0; - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* if the file is empty, the above read may return error - (reading beyond end of file). In that case, shared_fp = 0, - set above, is the correct value. */ - } - else { - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (err == 0) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->shared_fp_fd->fd_sys, shared_fp, - sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - } - if (err == -1) { - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - return; - } - } - - if (incr == 0) {goto done;} - - new_fp = *shared_fp + incr; - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (err == 0) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->shared_fp_fd->fd_sys, &new_fp, sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - } -done: - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_hints.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_hints.c deleted file mode 100644 index 0e5386d22bb9cba056512468fb43bf49fa236d20..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_hints.c +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - ADIOI_GEN_SetInfo(fd, users_info, error_code); -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_iread.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_iread.c deleted file mode 100644 index 28d20281059ac059a23c24e45f222218ff7f4a52..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_iread.c +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -#ifdef ROMIO_HAVE_WORKING_AIO -/* nearly identical to ADIOI_GEN_IreadContig, except we lock around I/O */ -void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - MPI_Count len, typesize; - int aio_errno = 0; - static char myname[] = "ADIOI_NFS_IREADCONTIG"; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 0, request); - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - - fd->fp_sys_posn = -1; - - if (aio_errno != 0) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); - return; - /* --END ERROR HANDLING-- */ - } - else *error_code = MPI_SUCCESS; -} -#endif diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_iwrite.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_iwrite.c deleted file mode 100644 index a5f988cf2059fefaf704c008deb6c1f317bc36ba..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_iwrite.c +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -#include "../../mpi-io/mpioimpl.h" -#include "../../mpi-io/mpioprof.h" -#include "mpiu_greq.h" - -#include <string.h> - -#ifdef ROMIO_HAVE_WORKING_AIO -static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; -/* this routine is nearly identical to ADIOI_GEN_IwriteContig, except we lock - * around I/O */ -void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code) -{ - MPI_Count len, typesize; - int aio_errno = 0; - static char myname[] = "ADIOI_NFS_IWRITECONTIG"; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 1, request); - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - - fd->fp_sys_posn = -1; - - if (aio_errno != 0) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); - return; - /* --END ERROR HANDLING-- */ - } - else *error_code = MPI_SUCCESS; - return; -} -#endif - -/* This function is for implementation convenience. It is not user-visible. - * It takes care of the differences in the interface for nonblocking I/O - * on various Unix machines! If wr==1 write, wr==0 read. - * - * Returns 0 on success, -errno on failure. - */ -#ifdef ROMIO_HAVE_WORKING_AIO -int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, MPI_Request *request) -{ - int err=-1, fd_sys; - int error_code, this_errno; - - struct aiocb *aiocbp; - ADIOI_AIO_Request *aio_req; - MPI_Status status; - - fd_sys = fd->fd_sys; - - aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); - aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); - aiocbp->aio_offset = offset; - aiocbp->aio_buf = buf; - aiocbp->aio_nbytes = len; - -#ifdef HAVE_STRUCT_AIOCB_AIO_WHENCE - aiocbp->aio_whence = SEEK_SET; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_FILDES - aiocbp->aio_fildes = fd_sys; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_SIGEVENT -# ifdef AIO_SIGNOTIFY_NONE - aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; -# endif - aiocbp->aio_sigevent.sigev_signo = 0; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_REQPRIO -# ifdef AIO_PRIO_DFL - aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */ -# else - aiocbp->aio_reqprio = 0; -# endif -#endif - - if (wr) ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); - else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); - -#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES - if (wr) err = aio_write(aiocbp); - else err = aio_read(aiocbp); -#else - /* Broken IBM interface */ - if (wr) err = aio_write(fd_sys, aiocbp); - else err = aio_read(fd_sys, aiocbp); -#endif - - this_errno = errno; - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - - if (err == -1) { - if (this_errno == EAGAIN) { - /* exceeded the max. no. of outstanding requests. - complete all previous async. requests and try again. */ - ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - offset, &status, &error_code); - MPIO_Completed_request_create(&fd, len, &error_code, request); - return 0; - } else { - return -this_errno; - } - } - aio_req->aiocbp = aiocbp; - if (ADIOI_GEN_greq_class == 0) { - MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, - ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, - ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, - &ADIOI_GEN_greq_class); - } - MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); - memcpy(&(aio_req->req), request, sizeof(MPI_Request)); - return 0; -} -#endif diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_read.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_read.c deleted file mode 100644 index 6dce289311851a9a1ec90c5b86af2b5371beff3e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_read.c +++ /dev/null @@ -1,552 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" -#include "adio_extern.h" - -void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - int err=-1; - MPI_Count datatype_size, len; - static char myname[] = "ADIOI_NFS_READCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, offset, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); - else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - offset = fd->fp_ind; - if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); - else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", strerror(errno)); - return; - } - /* --END ERROR HANDLING-- */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, err); -#endif - - *error_code = MPI_SUCCESS; -} - - - -#ifdef ADIOI_MPE_LOGGING -#define ADIOI_BUFFERED_READ \ -{ \ - if (req_off >= readbuf_off + readbuf_len) { \ - readbuf_off = req_off; \ - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, readbuf_off, SEEK_SET);\ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ - err = read(fd->fd_sys, readbuf, readbuf_len);\ - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ - if (err == -1) err_flag = 1; \ - } \ - while (req_len > readbuf_off + readbuf_len - req_off) { \ - partial_read = (int) (readbuf_off + readbuf_len - req_off); \ - tmp_buf = (char *) ADIOI_Malloc(partial_read); \ - memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ - ADIOI_Free(readbuf); \ - readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ - memcpy(readbuf, tmp_buf, partial_read); \ - ADIOI_Free(tmp_buf); \ - readbuf_off += readbuf_len-partial_read; \ - readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \ - end_offset-readbuf_off+1)); \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ - err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read);\ - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ - if (err == -1) err_flag = 1; \ - } \ - memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ -} -#else -#define ADIOI_BUFFERED_READ \ -{ \ - if (req_off >= readbuf_off + readbuf_len) { \ - readbuf_off = req_off; \ - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ - lseek(fd->fd_sys, readbuf_off, SEEK_SET);\ - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ - err = read(fd->fd_sys, readbuf, readbuf_len);\ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ - if (err == -1) err_flag = 1; \ - } \ - while (req_len > readbuf_off + readbuf_len - req_off) { \ - partial_read = (int) (readbuf_off + readbuf_len - req_off); \ - tmp_buf = (char *) ADIOI_Malloc(partial_read); \ - memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ - ADIOI_Free(readbuf); \ - readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ - memcpy(readbuf, tmp_buf, partial_read); \ - ADIOI_Free(tmp_buf); \ - readbuf_off += readbuf_len-partial_read; \ - readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \ - end_offset-readbuf_off+1)); \ - lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\ - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ - err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read);\ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ - if (err == -1) err_flag = 1; \ - } \ - memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ -} -#endif - - -void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, err=-1, brd_size, st_index=0; - int num, size, sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - int req_len, partial_read; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off; - char *readbuf, *tmp_buf, *value; - int st_n_filetypes, readbuf_len; - ADIO_Offset frd_size=0, new_frd_size, st_frd_size; - int new_brd_size, err_flag=0, info_flag, max_bufsize; - - static char myname[] = "ADIOI_NFS_READSTRIDED"; - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - -/* get max_bufsize from the info object. */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - max_bufsize = atoi(value); - ADIOI_Free(value); - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - readbuf_off = off; - readbuf = (char *) ADIOI_Malloc(max_bufsize); - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); - -/* if atomicity is true, lock (exclusive) the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, readbuf_off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->fd_sys, readbuf, readbuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); - if (err == -1) err_flag = 1; - - for (j=0; j<count; j++) - for (i=0; i<flat_buf->count; i++) { - userbuf_off = j*buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_READ - off += flat_buf->blocklens[i]; - } - - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ - - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - else { /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* frd_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - frd_size = flat_file->blocklens[i]; - break; - } - if (dist > 0 ) { - frd_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } - - start_off = offset; - - /* Wei-keng Liao: read request is within a single flat_file contig - * block e.g. with subarray types that actually describe the whole - * array */ - if (buftype_is_contig && bufsize <= frd_size) { - ADIO_ReadContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - offset, status, error_code); - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* update MPI-IO file pointer to point to the first byte that - * can be accessed in the fileview. */ - fd->fp_ind = offset + bufsize; - if (bufsize == frd_size) { - do { - st_index++; - if (st_index == flat_file->count) { - st_index = 0; - n_filetypes++; - } - } while (flat_file->blocklens[st_index] == 0); - fd->fp_ind = disp + flat_file->indices[st_index] - + n_filetypes*filetype_extent; - } - } - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -#endif - return; - } - - /* Calculate end_offset, the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - i = 0; - j = st_index; - off = offset; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i < bufsize) { - i += frd_size; - end_offset = off + frd_size - 1; - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - -/* if atomicity is true, lock (exclusive) the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - /* initial read into readbuf */ - readbuf_off = offset; - readbuf = (char *) ADIOI_Malloc(max_bufsize); - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, offset, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, offset, SEEK_SET, readbuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->fd_sys, readbuf, readbuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, offset, SEEK_SET, readbuf_len); - - if (err == -1) err_flag = 1; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i < bufsize) { - if (frd_size) { - /* TYPE_UB and TYPE_LB can result in - frd_size = 0. save system call in such cases */ - /* lseek(fd->fd_sys, off, SEEK_SET); - err = read(fd->fd_sys, ((char *) buf) + i, frd_size);*/ - - req_off = off; - req_len = frd_size; - userbuf_off = i; - ADIOI_BUFFERED_READ - } - i += frd_size; - - if (off + frd_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) - off += frd_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by frd_size. */ - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - ADIO_Offset i; - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - i = flat_buf->indices[0]; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(frd_size, brd_size); - if (size) { - /* lseek(fd->fd_sys, off, SEEK_SET); - err = read(fd->fd_sys, ((char *) buf) + i, size); */ - - req_off = off; - req_len = size; - userbuf_off = i; - ADIOI_BUFFERED_READ - } - - new_frd_size = frd_size; - new_brd_size = brd_size; - - if (size == frd_size) { -/* reached end of contiguous block in file */ - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - - new_frd_size = flat_file->blocklens[j]; - if (size != brd_size) { - i += size; - new_brd_size -= size; - } - } - - if (size == brd_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - i = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_brd_size = flat_buf->blocklens[k]; - if (size != frd_size) { - off += size; - new_frd_size -= size; - } - } - num += size; - frd_size = new_frd_size; - brd_size = new_brd_size; - } - } - - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ - - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_setsh.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_setsh.c deleted file mode 100644 index 42e558cb476e0909f55e2acf67232965a8b6d7c0..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_setsh.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -/* set the shared file pointer to "offset" etypes relative to the current - view */ - -/* -This looks very similar to ADIOI_GEN_Set_shared_fp, except this -function avoids locking the file twice. The generic version does - -Write lock -ADIO_WriteContig -Unlock - -For NFS, ADIOI_NFS_WriteContig does a lock before writing to disable -caching. To avoid the lock being called twice, this version for NFS does - -Write lock -Lseek -Write -Unlock - -*/ - -void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) -{ - ssize_t err; - MPI_Comm dupcommself; - static char myname[] = "ADIOI_NFS_SET_SHARED_FP"; - - if (fd->shared_fp_fd == ADIO_FILE_NULL) { - MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); - fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, - fd->shared_fp_fname, - fd->file_system, fd->fns, - ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, - ADIO_PERM_NULL, error_code); - } - - if (*error_code != MPI_SUCCESS) return; - - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} - diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_wait.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_wait.c deleted file mode 100644 index e1037fc5513f0fa1ff4fa5e2a6892405acbaf92a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_wait.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return; -} - - -void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - ADIOI_NFS_ReadComplete(request, status, error_code); -} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_write.c b/3rd-party/romio321/adio/ad_nfs/ad_nfs_write.c deleted file mode 100644 index 06dca92ef8429007a53834901c7123025fa45048..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_write.c +++ /dev/null @@ -1,678 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" -#include "adio_extern.h" - -void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - int err=-1; - MPI_Count datatype_size, len; - static char myname[] = "ADIOI_NFS_WRITECONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, offset, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - offset = fd->fp_ind; - if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - return; - } - /* --END ERROR HANDLING-- */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, err); -#endif - - *error_code = MPI_SUCCESS; -} - - - - -#ifdef ADIOI_MPE_LOGGING -#define ADIOI_BUFFERED_WRITE \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ - err = read(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ - if (err == -1) { \ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**ioRMWrdwr", 0); \ - goto fn_exit; \ - } \ - } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ - err = read(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ - if (err == -1) { \ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**ioRMWrdwr", 0); \ - goto fn_exit; \ - } \ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} -#else -#define ADIOI_BUFFERED_WRITE \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - err = read(fd->fd_sys, writebuf, writebuf_len); \ - if (err == -1) { \ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**ioRMWrdwr", 0); \ - goto fn_exit; \ - } \ - } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - err = read(fd->fd_sys, writebuf, writebuf_len); \ - if (err == -1) { \ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**ioRMWrdwr", 0); \ - goto fn_exit; \ - } \ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} -#endif - -/* this macro is used when filetype is contig and buftype is not contig. - it does not do a read-modify-write and does not lock*/ -#ifdef ADIOI_MPE_LOGGING -#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} -#else -#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - err = write(fd->fd_sys, writebuf, writebuf_len); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (err == -1) err_flag = 1; \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} -#endif - - -void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, err=-1, bwr_size, st_index=0; - int num, size, sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - int req_len; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; - char *writebuf=NULL, *value; - int st_n_filetypes, writebuf_len, write_sz; - ADIO_Offset fwr_size = 0, new_fwr_size, st_fwr_size; - int new_bwr_size, err_flag=0, info_flag, max_bufsize; - static char myname[] = "ADIOI_NFS_WRITESTRIDED"; - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - -/* get max_bufsize from the info object. */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - max_bufsize = atoi(value); - ADIOI_Free(value); - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - writebuf_off = off; - writebuf = (char *) ADIOI_Malloc(max_bufsize); - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1)); - -/* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - for (j=0; j<count; j++) - for (i=0; i<flat_buf->count; i++) { - userbuf_off = j*buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_WRITE_WITHOUT_READ - off += flat_buf->blocklens[i]; - } - - /* write the buffer out finally */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, writebuf_off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, writebuf, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); - if (err == -1) err_flag = 1; - - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - else { /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* fwr_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - fwr_size = flat_file->blocklens[i]; - break; - } - if (dist > 0) { - fwr_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } - - start_off = offset; - /* Wei-keng Liao:write request is within single flat_file contig block*/ - /* this could happen, for example, with subarray types that are - * actually fairly contiguous */ - if (buftype_is_contig && bufsize <= fwr_size) { - ADIO_WriteContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - offset, status, error_code); - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* update MPI-IO file pointer to point to the first byte - * that can be accessed in the fileview. */ - fd->fp_ind = offset + bufsize; - if (bufsize == fwr_size) { - do { - st_index++; - if (st_index == flat_file->count) { - st_index = 0; - n_filetypes++; - } - } while (flat_file->blocklens[st_index] == 0); - fd->fp_ind = disp + flat_file->indices[st_index] - + (ADIO_Offset)n_filetypes*filetype_extent; - } - } - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -#endif - return; - } - - /* Calculate end_offset, the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ - - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - i = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i < bufsize) { - i += fwr_size; - end_offset = off + fwr_size - 1; - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - -/* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - /* initial read for the read-modify-write */ - writebuf_off = offset; - writebuf = (char *) ADIOI_Malloc(max_bufsize); - writebuf_len = (int)(ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1)); - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, writebuf_off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = read(fd->fd_sys, writebuf, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.", 0); - goto fn_exit; - } - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i, fwr_size);*/ - - req_off = off; - req_len = fwr_size; - userbuf_off = i; - ADIOI_BUFFERED_WRITE - } - i += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - ADIO_Offset i; - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - i = flat_buf->indices[0]; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i, size); */ - - req_off = off; - req_len = size; - userbuf_off = i; - ADIOI_BUFFERED_WRITE - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - i += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - i = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - /* write the buffer out finally */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, writebuf_off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, writebuf, writebuf_len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - - if (!(fd->atomicity)) - ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); - else ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (err == -1) err_flag = 1; - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -fn_exit: - if (writebuf != NULL) ADIOI_Free(writebuf); - - return; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.c deleted file mode 100644 index 97882741217bb1ae961df23b3603efd6ca9bd6e1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.c +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_NTFS_operations = { - ADIOI_NTFS_Open, /* Open */ - ADIOI_FAILSAFE_OpenColl, /* OpenColl */ - ADIOI_NTFS_ReadContig, /* ReadContig */ - ADIOI_NTFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_NTFS_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_NTFS_Close, /* Close */ - ADIOI_NTFS_IreadContig, /* IreadContig */ - ADIOI_NTFS_IwriteContig, /* IwriteContig */ - ADIOI_NTFS_ReadDone, /* ReadDone */ - ADIOI_NTFS_WriteDone, /* WriteDone */ - ADIOI_NTFS_ReadComplete, /* ReadComplete */ - ADIOI_NTFS_WriteComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_NTFS_Flush, /* Flush */ - ADIOI_NTFS_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_NTFS_Feature, /* Features */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.h b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.h deleted file mode 100644 index aed6168bd8b7a1c3b8b8ef1c3ca1381ec9bf7fb1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_NTFS_INCLUDE -#define AD_NTFS_INCLUDE - -#include <sys/types.h> -#include <fcntl.h> -#include "adio.h" - -#ifdef HAVE_INT64 -#define DWORDLOW(x) ( (DWORD) ( x & (__int64) 0xFFFFFFFF ) ) -#define DWORDHIGH(x) ( (DWORD) ( (x >> 32) & (__int64) 0xFFFFFFFF ) ) -#define DWORDTOINT64(x,y) ( (__int64) ( ( (__int64 x) << 32 ) + (__int64) y ) ) -#else -#define DWORDLOW(x) x -#define DWORDHIGH(x) 0 -#define DWORDTOINT64(x,y) x -#endif - -int ADIOI_NTFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle); - -void ADIOI_NTFS_Open(ADIO_File fd, int *error_code); -void ADIOI_NTFS_Close(ADIO_File fd, int *error_code); -void ADIOI_NTFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NTFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NTFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_NTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_NTFS_IwriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); - -#define FORMAT_MESSAGE_MIN_SIZE 100 -#define ADIOI_NTFS_ERR_MSG_MAX FORMAT_MESSAGE_MIN_SIZE -void ADIOI_NTFS_Strerror(int error, char *errMsg, int errMsgLen); - -#endif diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_close.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_close.c deleted file mode 100644 index 95022dca77b484409e723c2e2efe520980e4fcb1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_close.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Close(ADIO_File fd, int *error_code) -{ - int err; - static char myname[] = "ADIOI_NTFS_Close"; - - err = CloseHandle(fd->fd_sys); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_done.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_done.c deleted file mode 100644 index 9f4967b48baedda47345eee87e66432158f566a8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_done.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return 0; -} - - -int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return 0; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_fcntl.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_fcntl.c deleted file mode 100644 index 4c7d66cd074582d47dd8d6e118cd14a1c6fa5fcb..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_fcntl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" -#include "adio_extern.h" - -void ADIOI_NTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - DWORD err; - LONG dwTemp; - static char myname[] = "ADIOI_NTFS_FCNTL"; - - switch(flag) - { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = SetFilePointer(fd->fd_sys, 0, 0, FILE_END); - if (fd->fp_sys_posn != -1) - { - dwTemp = DWORDHIGH(fd->fp_sys_posn); - if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_sys_posn), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != NO_ERROR) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - return; - } - } - } - /* --BEGIN ERROR HANDLING-- */ - if (fcntl_struct->fsize == INVALID_SET_FILE_POINTER) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - dwTemp = GetLastError(); - ADIOI_NTFS_Strerror(dwTemp, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - /* - fd->atomicity = 0; - *error_code = MPI_ERR_UNSUPPORTED_OPERATION; - */ - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_feature.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_feature.c deleted file mode 100644 index 335b5aed57e07c338f6d09a4f9f59b1f8b941e63..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_feature.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "adio.h" - -int ADIOI_NTFS_Feature(ADIO_File fd, int flag) -{ - switch(flag) { - /* supported features */ - case ADIO_LOCKS: - case ADIO_SHARED_FP: - case ADIO_ATOMIC_MODE: - case ADIO_DATA_SIEVING_WRITES: - return 1; - break; - /* unsupported features */ - case ADIO_SCALABLE_OPEN: - case ADIO_UNLINK_AFTER_CLOSE: - default: - return 0; - break; - } -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_flush.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_flush.c deleted file mode 100644 index 7656d60fb669bcd73e901b0e3da9d547d08a0775..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_flush.c +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code) -{ - int err; - static char myname[] = "ADIOI_NTFS_Flush"; - - err = (fd->access_mode & ADIO_RDONLY) ? TRUE : - FlushFileBuffers(fd->fd_sys); - - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iread.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iread.c deleted file mode 100644 index 845401ad44a7301428ff03ca8e308833c6700e86..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iread.c +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code) -{ - MPI_Count len, typesize; - int err; - static char myname[] = "ADIOI_NTFS_IreadContig"; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) - { - offset = fd->fp_ind; - } - err = ADIOI_NTFS_aio(fd, buf, len, offset, 0, request); - if (file_ptr_type == ADIO_INDIVIDUAL) - { - fd->fp_ind += len; - } - - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) - { - *error_code = MPIO_Err_create_code(err, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", 0); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* set it to null. */ -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iwrite.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iwrite.c deleted file mode 100644 index 40a567e564b89df5c8d096b3b3f27ccda9378d75..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_iwrite.c +++ /dev/null @@ -1,303 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -#include "../../mpi-io/mpioimpl.h" -#include "../../mpi-io/mpioprof.h" -#include "mpiu_greq.h" - -static MPIX_Grequest_class ADIOI_NTFS_greq_class = 0; - -/* Fills the input buffer, errMsg, with the error message - corresponding to error code, error */ -void ADIOI_NTFS_Strerror(int error, char *errMsg, int errMsgLen) -{ - LPTSTR str; - int num_bytes; - num_bytes = FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, - &str, - FORMAT_MESSAGE_MIN_SIZE, - 0); - if (num_bytes == 0) - { - strncpy(errMsg, "\0", errMsgLen); - } - else - { - strncpy(errMsg, str, errMsgLen); - LocalFree(str); - } -} - -/* poll for completion of a single outstanding AIO request */ -int ADIOI_NTFS_aio_poll_fn(void *extra_state, MPI_Status *status) -{ - ADIOI_AIO_Request *aio_req; - int mpi_errno = MPI_SUCCESS; - - /* FIXME: Validate the args -- has it already been done by the - caller ? */ - - aio_req = (ADIOI_AIO_Request *)extra_state; - - /* XXX: test for AIO completion here */ - if(!GetOverlappedResult( aio_req->fd, aio_req->lpOvl, - &(aio_req->nbytes), FALSE)){ - if(GetLastError() == ERROR_IO_INCOMPLETE){ - /* IO in progress */ - /* TODO: need to diddle with status somehow */ - }else{ - /* Error occured */ - /* TODO: unsure how to handle this */ - } - }else{ - mpi_errno = MPI_Grequest_complete(aio_req->req); - if (mpi_errno != MPI_SUCCESS) { - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_NTFS_aio_poll_fn", __LINE__, - MPI_ERR_IO, "**mpi_grequest_complete", - 0); - } - } - return mpi_errno; -} - - -/* Wait for completion of one of the outstanding AIO requests */ -int ADIOI_NTFS_aio_wait_fn(int count, void **array_of_states, - double timeout, MPI_Status *status) -{ - int i, mpi_errno = MPI_SUCCESS; - ADIOI_AIO_Request **aio_reqlist; - LPHANDLE lpHandles; - DWORD retObject=0; - - /* FIXME: Validate the args -- has it already been done by the - caller ? */ - aio_reqlist = (ADIOI_AIO_Request **)array_of_states; - lpHandles = (LPHANDLE) ADIOI_Calloc(count, sizeof(HANDLE)); - if (lpHandles == NULL) - { - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - "ADIOI_NTFS_aio_wait_fn", __LINE__, MPI_ERR_IO, - "**nomem", "**nomem %s", "Event handles"); - return mpi_errno; - } - /* XXX: set-up arrays of outstanding requests */ - for(i=0; i<count; i++){ - lpHandles[i] = (aio_reqlist[i])->lpOvl->hEvent; - } - - /* XXX: wait for one request to complete */ - /* FIXME: Is the timeout in seconds ? */ - timeout = (timeout <= 0) ? INFINITE : (timeout * 1000); - - if((retObject = WaitForMultipleObjects(count, lpHandles, - FALSE, timeout)) != WAIT_FAILED){ - retObject = retObject - WAIT_OBJECT_0; - if(GetOverlappedResult( aio_reqlist[retObject]->fd, - aio_reqlist[retObject]->lpOvl, &(aio_reqlist[retObject]->nbytes), - FALSE)){ - /* XXX: mark completed requests as 'done'*/ - mpi_errno = MPI_Grequest_complete(aio_reqlist[retObject]->req); - if (mpi_errno != MPI_SUCCESS) { - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_NTFS_aio_wait_fn", __LINE__, - MPI_ERR_IO, "**mpi_grequest_complete", - 0); - } - }else{ - if(GetLastError() == ERROR_IO_INCOMPLETE){ - /* IO in progress */ - /* TODO: need to diddle with status somehow */ - }else{ - /* Error occured */ - /* TODO: not sure how to handle this */ - } - } - }else{ - /* TODO: How to handle error while waiting ? */ - } - ADIOI_Free(lpHandles); - return mpi_errno; -} - -int ADIOI_NTFS_aio_query_fn(void *extra_state, MPI_Status *status) -{ - ADIOI_AIO_Request *aio_req; - - aio_req = (ADIOI_AIO_Request *)extra_state; - - - MPI_Status_set_elements(status, MPI_BYTE, aio_req->nbytes); - - /* can never cancel so always true */ - MPI_Status_set_cancelled(status, 0); - - /* choose not to return a value for this */ - status->MPI_SOURCE = MPI_UNDEFINED; - /* tag has no meaning for this generalized request */ - status->MPI_TAG = MPI_UNDEFINED; - /* this generalized request never fails */ - return MPI_SUCCESS; -} - - -int ADIOI_NTFS_aio_free_fn(void *extra_state) -{ - ADIOI_AIO_Request *aio_req; - /* FIXME: Validate the args -- has it already been done by the - caller ? */ - aio_req = (ADIOI_AIO_Request*)extra_state; - CloseHandle(aio_req->lpOvl->hEvent); - ADIOI_Free(aio_req->lpOvl); - ADIOI_Free(aio_req); - return MPI_SUCCESS; -} - -void ADIOI_NTFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - MPI_Count len, typesize; - int err; - static char myname[] = "ADIOI_NTFS_IwriteContig"; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) - { - offset = fd->fp_ind; - } - err = ADIOI_NTFS_aio(fd, buf, len, offset, 1, request); - if (file_ptr_type == ADIO_INDIVIDUAL) - { - fd->fp_ind += len; - } - - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) - { - *error_code = MPIO_Err_create_code(err, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", 0); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* set it to null. */ -} - - -/* This function is for implementation convenience. It is not user-visible. - * If wr==1 write, wr==0 read. - * - * Returns MPI_SUCCESS on success, mpi_errno on failure. - */ -int ADIOI_NTFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, MPI_Request *request) -{ - static char myname[] = "ADIOI_NTFS_aio"; - - ADIOI_AIO_Request *aio_req; - static DWORD dwNumWritten, dwNumRead; - BOOL ret_val = FALSE; - FDTYPE fd_sys; - int mpi_errno = MPI_SUCCESS; - DWORD err; - - fd_sys = fd->fd_sys; - - aio_req = (ADIOI_AIO_Request *)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); - if (aio_req == NULL) - { - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**nomem", "**nomem %s", "AIO_REQ"); - return mpi_errno; - } - aio_req->lpOvl = (LPOVERLAPPED ) ADIOI_Calloc(sizeof(OVERLAPPED), 1); - if (aio_req->lpOvl == NULL) - { - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**nomem", "**nomem %s", "OVERLAPPED"); - ADIOI_Free(aio_req); - return mpi_errno; - } - aio_req->lpOvl->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (aio_req->lpOvl->hEvent == NULL) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - ADIOI_Free(aio_req->lpOvl); - ADIOI_Free(aio_req); - return mpi_errno; - } - aio_req->lpOvl->Offset = DWORDLOW(offset); - aio_req->lpOvl->OffsetHigh = DWORDHIGH(offset); - aio_req->fd = fd_sys; - - /* XXX: initiate async I/O */ - if (wr) - { - ret_val = WriteFile(fd_sys, buf, len, &dwNumWritten, aio_req->lpOvl); - } - else - { - ret_val = ReadFile(fd_sys, buf, len, &dwNumRead, aio_req->lpOvl); - } - - /* --BEGIN ERROR HANDLING-- */ - if (ret_val == FALSE) - { - mpi_errno = GetLastError(); - if (mpi_errno != ERROR_IO_PENDING) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(mpi_errno, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return mpi_errno; - } - mpi_errno = MPI_SUCCESS; - } - /* --END ERROR HANDLING-- */ - - /* XXX: set up generalized request class and request */ - if (ADIOI_NTFS_greq_class == 0) { - mpi_errno = MPIX_Grequest_class_create(ADIOI_NTFS_aio_query_fn, - ADIOI_NTFS_aio_free_fn, MPIU_Greq_cancel_fn, - ADIOI_NTFS_aio_poll_fn, ADIOI_NTFS_aio_wait_fn, - &ADIOI_NTFS_greq_class); - if(mpi_errno != MPI_SUCCESS){ - /* FIXME: Pass appropriate error code to user */ - } - } - mpi_errno = MPIX_Grequest_class_allocate(ADIOI_NTFS_greq_class, aio_req, request); - if(mpi_errno != MPI_SUCCESS){ - /* FIXME: Pass appropriate error code to user */ - } - memcpy(&(aio_req->req), request, sizeof(MPI_Request)); - return mpi_errno; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_open.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_open.c deleted file mode 100644 index 3a49418dbaab212f1bc09aa847d655d8b5ceedaa..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_open.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Open(ADIO_File fd, int *error_code) -{ - int err; - int cmode, amode, attrib; - static char myname[] = "ADIOI_NTFS_Open"; - - amode = 0; - cmode = OPEN_EXISTING; -#ifdef USE_WIN_THREADED_IO - attrib = FILE_FLAG_OVERLAPPED; -#else - attrib = FILE_ATTRIBUTE_NORMAL; -#endif - - if (fd->access_mode & ADIO_CREATE) - { - cmode = OPEN_ALWAYS; - } - if (fd->access_mode & ADIO_EXCL) - { - cmode = CREATE_NEW; - } - - if (fd->access_mode & ADIO_RDONLY) - { - amode = GENERIC_READ; - } - if (fd->access_mode & ADIO_WRONLY) - { - amode = GENERIC_WRITE; - } - if (fd->access_mode & ADIO_RDWR) - { - amode = GENERIC_READ | GENERIC_WRITE; - } - - if (fd->access_mode & ADIO_DELETE_ON_CLOSE) - { - attrib = attrib | FILE_FLAG_DELETE_ON_CLOSE; - } - if (fd->access_mode & ADIO_SEQUENTIAL) - { - attrib = attrib | FILE_FLAG_SEQUENTIAL_SCAN; - } - else - { - attrib = attrib | FILE_FLAG_RANDOM_ACCESS; - } - - fd->fd_sys = CreateFile(fd->filename, - amode, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, - cmode, - attrib, - NULL); - fd->fd_direct = -1; - - if ((fd->fd_sys != INVALID_HANDLE_VALUE) && (fd->access_mode & ADIO_APPEND)) - { - fd->fp_ind = fd->fp_sys_posn = SetFilePointer(fd->fd_sys, 0, NULL, FILE_END); - if (fd->fp_ind == INVALID_SET_FILE_POINTER) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != NO_ERROR) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - return; - } - } - } - - /* --BEGIN ERROR HANDLING-- */ - if (fd->fd_sys == INVALID_HANDLE_VALUE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_read.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_read.c deleted file mode 100644 index 7c55c1bc3764b433436270719b1107b9cc258420..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_read.c +++ /dev/null @@ -1,259 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - LONG dwTemp; - DWORD dwNumRead = 0; - int err=-1; - MPI_Count datatype_size, len; - static char myname[] = "ADIOI_NTFS_ReadContig"; - OVERLAPPED *pOvl; - - /* If file pointer is of type ADIO_INDIVIDUAL ignore the offset - and use the current location of file pointer */ - if(file_ptr_type == ADIO_INDIVIDUAL){ - offset = fd->fp_ind; - } - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - pOvl = (OVERLAPPED *) ADIOI_Calloc(sizeof(OVERLAPPED), 1); - if (pOvl == NULL) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**nomem", "**nomem %s", "OVERLAPPED"); - return; - } - pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - if (pOvl->hEvent == NULL) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - ADIOI_Free(pOvl); - return; - } - pOvl->Offset = DWORDLOW(offset); - pOvl->OffsetHigh = DWORDHIGH(offset); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) - { - if (fd->fp_sys_posn != offset) - { - dwTemp = DWORDHIGH(offset); - if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != NO_ERROR) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - } - /* - { - ADIO_Fcntl_t fcntl_struct; - int error_code; - ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); - printf("File size b: %d\n", fcntl_struct.fsize); - } - printf("ReadFile(%d bytes)\n", len);fflush(stdout); - */ - err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - switch (err) - { - case ERROR_IO_PENDING: - break; - case ERROR_HANDLE_EOF: - /*printf("EOF error\n");fflush(stdout);*/ - SetEvent(pOvl->hEvent); - break; - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != ERROR_HANDLE_EOF) /* Ignore EOF errors */ - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - if (!CloseHandle(pOvl->hEvent)) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - ADIOI_Free(pOvl); - - fd->fp_sys_posn = offset + (ADIO_Offset)dwNumRead; - /* individual file pointer not updated */ - } - else - { - /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - { - dwTemp = DWORDHIGH(fd->fp_ind); - if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != NO_ERROR) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - } - /* - { - ADIO_Fcntl_t fcntl_struct; - int error_code; - ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); - printf("File size c: %d\n", fcntl_struct.fsize); - } - printf("ReadFile(%d bytes)\n", len);fflush(stdout); - */ - err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - switch (err) - { - case ERROR_IO_PENDING: - break; - case ERROR_HANDLE_EOF: - /*printf("EOF error\n");fflush(stdout);*/ - SetEvent(pOvl->hEvent); - break; - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - if (err != ERROR_HANDLE_EOF) /* Ignore EOF errors */ - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - if (!CloseHandle(pOvl->hEvent)) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - ADIOI_Free(pOvl); - return; - } - ADIOI_Free(pOvl); - - fd->fp_ind = fd->fp_ind + (ADIO_Offset)dwNumRead; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != FALSE) - { - MPIR_Status_set_bytes(status, datatype, dwNumRead); - } -#endif - - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_resize.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_resize.c deleted file mode 100644 index 0fbeaaf9728d3a277a9259dc222de871ff4ae1ff..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_resize.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - LONG dwTemp; - DWORD err; - BOOL result; - static char myname[] = "ADIOI_NTFS_Resize"; - - dwTemp = DWORDHIGH(size); - err = SetFilePointer(fd->fd_sys, DWORDLOW(size), &dwTemp, FILE_BEGIN); - /* --BEGIN ERROR HANDLING-- */ - if (err == INVALID_SET_FILE_POINTER) - { - err = GetLastError(); - if (err != NO_ERROR) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - } - /*printf("setting file length to %d\n", size);fflush(stdout);*/ - /* --END ERROR HANDLING-- */ - result = SetEndOfFile(fd->fd_sys); - /* --BEGIN ERROR HANDLING-- */ - if (result == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_wait.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_wait.c deleted file mode 100644 index 80dfa4d3349a039554e990b49c0c2c3524bc7af1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_wait.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return; -} - - -void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return; -} diff --git a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_write.c b/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_write.c deleted file mode 100644 index 389e866936270522a7377be537d0b610c22c97a7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ntfs/ad_ntfs_write.c +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - static char myname[] = "ADIOI_NTFS_WriteContig"; - LONG dwTemp; - DWORD dwNumWritten = 0; - MPI_Count err=-1, datatype_size, len; - OVERLAPPED *pOvl; - - /* If file pointer type in ADIO_INDIVIDUAL then offset should be - ignored and the current location of file pointer should be used */ - if(file_ptr_type == ADIO_INDIVIDUAL){ - offset = fd->fp_ind; - } - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - pOvl = (OVERLAPPED *) ADIOI_Calloc(sizeof(OVERLAPPED), 1); - if (pOvl == NULL) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**nomem", "**nomem %s", "OVERLAPPED"); - return; - } - pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - if (pOvl->hEvent == NULL) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - ADIOI_Free(pOvl); - return; - } - pOvl->Offset = DWORDLOW(offset); - pOvl->OffsetHigh = DWORDHIGH(offset); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) - { - if (fd->fp_sys_posn != offset) - { - dwTemp = DWORDHIGH(offset); - if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - err = GetLastError(); - if (err != NO_ERROR) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - } - /*printf("WriteFile(%d bytes)\n", len);fflush(stdout);*/ - err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - err = GetLastError(); - if (err != ERROR_IO_PENDING) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - /* --END ERROR HANDLING-- */ - if (!CloseHandle(pOvl->hEvent)) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - ADIOI_Free(pOvl); - - fd->fp_sys_posn = offset + dwNumWritten; - /* individual file pointer not updated */ - } - else - { - /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - { - dwTemp = DWORDHIGH(fd->fp_ind); - if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - err = GetLastError(); - if (err != NO_ERROR) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - } - /*printf("WriteFile(%d bytes)\n", len);fflush(stdout);*/ - err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - err = GetLastError(); - if (err != ERROR_IO_PENDING) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - } - /* --END ERROR HANDLING-- */ - err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE); - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", errMsg); - CloseHandle(pOvl->hEvent); - ADIOI_Free(pOvl); - return; - } - /* --END ERROR HANDLING-- */ - if (!CloseHandle(pOvl->hEvent)) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", errMsg); - ADIOI_Free(pOvl); - return; - } - ADIOI_Free(pOvl); - - fd->fp_ind = fd->fp_ind + dwNumWritten; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != FALSE) - { - MPIR_Status_set_bytes(status, datatype, dwNumWritten); - } -#endif - - /* --BEGIN ERROR HANDLING-- */ - if (err == FALSE) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - err = GetLastError(); - ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", errMsg); - return; - } - /* --END ERROR HANDLING-- */ - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs.c b/3rd-party/romio321/adio/ad_panfs/ad_panfs.c deleted file mode 100644 index 8bc14fccdf2d4b8e9c3d8b32ed38bf76b2d3298e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * ad_panfs.c - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_panfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -#ifndef ROMIOCONF_H_INCLUDED -#include "romioconf.h" -#define ROMIOCONF_H_INCLUDED -#endif - - -struct ADIOI_Fns_struct ADIO_PANFS_operations = { -#ifdef HAVE_PAN_FS_CLIENT_RAIDN_ENCODING_T - ADIOI_PANFS_Open6, /* Open, using newer Panasas features */ -#else - ADIOI_PANFS_Open, /* open, but using Panasas5 and earlier features */ -#endif - ADIOI_GEN_OpenColl, - ADIOI_PANFS_ReadContig, /* ReadContig */ - ADIOI_PANFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_GEN_Fcntl, /* Fcntl */ - ADIOI_PANFS_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ -#ifdef ROMIO_HAVE_WORKING_AIO - ADIOI_GEN_IreadContig, /* IreadContig */ - ADIOI_GEN_IwriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif - ADIOI_GEN_IODone, /* ReadDone */ - ADIOI_GEN_IODone, /* WriteDone */ - ADIOI_GEN_IOComplete, /* ReadComplete */ - ADIOI_GEN_IOComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_PANFS_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_Feature, - "PANFS: Panasas PanFS", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_hints.c b/3rd-party/romio321/adio/ad_panfs/ad_panfs_hints.c deleted file mode 100644 index 94178ab0cfed8be370c49daf5288c2a0f9ec4b6e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_hints.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * ad_panfs_hints.c - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_panfs.h" -#include <pan_fs_client_cw_mode.h> -#include "hint_fns.h" - -void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ -#if defined(MPICH) || !defined(PRINT_ERR_MSG) - static char myname[] = "ADIOI_PANFS_SETINFO"; -#endif - int gen_error_code; - - *error_code = MPI_SUCCESS; - - if (fd->info == MPI_INFO_NULL) { - /* This must be part of the open call. can set striping parameters - * if necessary. - */ - MPI_Info_create(&(fd->info)); - - /* anticipate concurrent writes in an MPI-IO application */ - ADIOI_Info_set (fd->info, "panfs_concurrent_write", "1"); - - /* has user specified striping parameters - and do they have the same value on all processes? */ - if (users_info != MPI_INFO_NULL) { - - ADIOI_Info_check_and_install_int(fd, users_info, "panfs_concurrent_write", - NULL, myname, error_code); - - ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_type", - NULL, myname, error_code); - - ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_stripe_unit", - NULL, myname, error_code); - - /* strange: there was a check "layout_type == - * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE, but - * nothing ever touched layout_type */ - ADIOI_Info_check_and_install_int(fd, users_info, - "panfs_layout_parity_stripe_width", NULL, myname, error_code); - - ADIOI_Info_check_and_install_int(fd, users_info, - "panfs_layout_parity_stripe_depth", NULL, myname, error_code); - - ADIOI_Info_check_and_install_int(fd, users_info, - "panfs_layout_total_num_comps", NULL, myname, error_code); - /* this hint used to check for - * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE or - * PAN_FS_CLIENT_LAYOUT_TYPE__RAID10, but again, layout_type never - * gets updated */ - ADIOI_Info_check_and_install_int(fd, users_info, - "panfs_layout_visit_policy", NULL, myname, error_code); - } - } - - ADIOI_GEN_SetInfo(fd, users_info, &gen_error_code); - /* If this function is successful, use the error code returned from ADIOI_GEN_SetInfo - * otherwise use the error_code generated by this function - */ - if(*error_code == MPI_SUCCESS) - { - *error_code = gen_error_code; - } -} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_open.c b/3rd-party/romio321/adio/ad_panfs/ad_panfs_open.c deleted file mode 100644 index d5374ebf44830ede7fc15e3ce79fb0821dac27bb..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_open.c +++ /dev/null @@ -1,348 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * ad_panfs_open.c - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_panfs.h" -#include <string.h> -#include <pan_fs_client_cw_mode.h> -#define TEMP_BUFFER_SIZE 64 - -void ADIOI_PANFS_Open(ADIO_File fd, int *error_code) -{ - char* value; - int perm, old_mask, amode, flag; - static char myname[] = "ADIOI_PANFS_OPEN"; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = ~old_mask & 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - { - pan_fs_client_layout_agg_type_t layout_type = PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT; - unsigned long int layout_stripe_unit = 0; - unsigned long int layout_parity_stripe_width = 0; - unsigned long int layout_parity_stripe_depth = 0; - unsigned long int layout_total_num_comps = 0; - pan_fs_client_layout_visit_t layout_visit_policy = PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN; - int myrank; - - MPI_Comm_rank(fd->comm, &myrank); - - *error_code = MPI_SUCCESS; - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "panfs_layout_type", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_type = strtoul(value,NULL,10); - } - ADIOI_Info_get(fd->info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_stripe_unit = strtoul(value,NULL,10); - } - ADIOI_Info_get(fd->info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_total_num_comps = strtoul(value,NULL,10); - } - ADIOI_Info_get(fd->info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_parity_stripe_width = strtoul(value,NULL,10); - } - ADIOI_Info_get(fd->info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_parity_stripe_depth = strtoul(value,NULL,10); - } - ADIOI_Info_get(fd->info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - layout_visit_policy = strtoul(value,NULL,10); - } - ADIOI_Free(value); - - amode = amode | O_CREAT; - /* Check for valid set of hints */ - if ((layout_type < PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT) || - (layout_type > PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) - { - FPRINTF(stderr, "%s: panfs_layout_type is not a valid value: %u.\n", myname, layout_type); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if ((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) && - ((layout_stripe_unit == 0) || (layout_total_num_comps == 0))) - { - if(layout_stripe_unit == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - if(layout_total_num_comps == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) - { - if ((layout_stripe_unit == 0) || - (layout_parity_stripe_width == 0) || - (layout_parity_stripe_depth == 0) || - (layout_total_num_comps == 0)) - { - if(layout_stripe_unit == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - if(layout_total_num_comps == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - if(layout_parity_stripe_width == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_parity_stripe_width hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - if(layout_parity_stripe_depth == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_parity_stripe_depth hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - MPI_Abort(MPI_COMM_WORLD, 1); - } - if ((layout_visit_policy < PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN) || - (layout_visit_policy > PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN_WITH_HASHED_OFFSET)) - { - FPRINTF(stderr, "%s: panfs_layout_visit_policy is not a valid value: %u.\n", myname, layout_visit_policy); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) - { - if ((layout_stripe_unit == 0) || (layout_total_num_comps == 0)) - { - if(layout_stripe_unit == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID10 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - if(layout_total_num_comps == 0) - { - FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID10 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname); - } - MPI_Abort(MPI_COMM_WORLD, 1); - } - if ((layout_visit_policy < PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN) || - (layout_visit_policy > PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN_WITH_HASHED_OFFSET)) - { - FPRINTF(stderr, "%s: panfs_layout_visit_policy is not a valid value: %u.\n", myname, layout_visit_policy); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - /* Create the file via ioctl() or open(). ADIOI_PANFS_Open's caller - * already optimizes performance by only calling this function with - * ADIO_CREATE on rank 0. Therefore, we don't need to worry about - * implementing that optimization here. */ - if((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) || (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) - || (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) { - pan_fs_client_layout_create_args_t file_create_args; - int fd_dir; - char* slash; - struct stat stat_buf; - int err; - char *path; - - /* Check that the file does not exist before - * trying to create it. The ioctl itself should - * be able to handle this condition. Currently, - * the ioctl will return successfully if the file - * has been previously created. Filed bug 33862 - * to track the problem. - */ - err = stat(fd->filename,&stat_buf); - if((err == -1) && (errno != ENOENT)) - { - FPRINTF(stderr,"%s: Unexpected I/O Error calling stat() on PanFS file: %s.\n", myname, strerror(errno)); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else if (err == 0) - { - FPRINTF(stderr,"%s: Cannot create PanFS file with ioctl when file already exists.\n", myname); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else - { - /* (err == -1) && (errno == ENOENT) */ - /* File does not exist */ - path = ADIOI_Strdup(fd->filename); - slash = strrchr(path, '/'); - if (!slash) - ADIOI_Strncpy(path, ".", 2); - else { - if (slash == path) - *(path + 1) = '\0'; - else *slash = '\0'; - } - - /* create PanFS object */ - memset(&file_create_args,0,sizeof(pan_fs_client_layout_create_args_t)); - /* open directory */ - fd_dir = open(path, O_RDONLY); - if (fd_dir < 0) { - FPRINTF(stderr, "%s: I/O Error opening parent directory to create PanFS file using ioctl: %s.\n", myname, strerror(errno)); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else - { - char *file_name_ptr = fd->filename; - slash = strrchr(fd->filename, '/'); - if (slash) - { - file_name_ptr = slash + 1; - } - /* create file in the directory */ - file_create_args.mode = perm; - file_create_args.version = PAN_FS_CLIENT_LAYOUT_VERSION; - file_create_args.flags = PAN_FS_CLIENT_LAYOUT_CREATE_F__NONE; - ADIOI_Strncpy(file_create_args.filename, file_name_ptr, strlen(fd->filename)+1); - file_create_args.layout.agg_type = layout_type; - file_create_args.layout.layout_is_valid = 1; - if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) - { - file_create_args.layout.u.raid1_5_parity_stripe.total_num_comps = layout_total_num_comps; - file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_width = layout_parity_stripe_width; - file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth = layout_parity_stripe_depth; - file_create_args.layout.u.raid1_5_parity_stripe.stripe_unit = layout_stripe_unit; - file_create_args.layout.u.raid1_5_parity_stripe.layout_visit_policy = layout_visit_policy; - } - else if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) - { - file_create_args.layout.u.raid0.total_num_comps = layout_total_num_comps; - file_create_args.layout.u.raid0.stripe_unit = layout_stripe_unit; - } - else if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) - { - file_create_args.layout.u.raid10.total_num_comps = layout_total_num_comps; - file_create_args.layout.u.raid10.stripe_unit = layout_stripe_unit; - file_create_args.layout.u.raid10.layout_visit_policy = layout_visit_policy; - } - err = ioctl(fd_dir, PAN_FS_CLIENT_LAYOUT_CREATE_FILE, &file_create_args); - if (err < 0) { - FPRINTF(stderr, "%s: I/O Error doing ioctl on parent directory to create PanFS file using ioctl: %s.\n", myname, strerror(errno)); - MPI_Abort(MPI_COMM_WORLD, 1); - } - err = close(fd_dir); - } - ADIOI_Free(path); - } - } - else - { - int create_fd = open(fd->filename,amode,perm); - if(create_fd != -1) - { - close(create_fd); - } - else - { - FPRINTF(stderr, "%s: I/O Error creating PanFS file using open: %s.\n", myname, strerror(errno)); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - } - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "panfs_concurrent_write", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - unsigned long int concurrent_write = strtoul(value,NULL,10); - if(concurrent_write == 1) - { - amode = amode | O_CONCURRENT_WRITE; - } - } - ADIOI_Free(value); - - fd->fd_sys = open(fd->filename, amode, perm); - fd->fd_direct = -1; - - if (fd->fd_sys != -1) - { - int rc; - char temp_buffer[TEMP_BUFFER_SIZE]; - pan_fs_client_layout_query_args_t file_query_args; - memset(&file_query_args,0,sizeof(pan_fs_client_layout_query_args_t)); - file_query_args.version = PAN_FS_CLIENT_LAYOUT_VERSION; - rc = ioctl(fd->fd_sys, PAN_FS_CLIENT_LAYOUT_QUERY_FILE, &file_query_args); - if (rc < 0) - { - /* Error - set layout type to unknown */ - ADIOI_Info_set(fd->info, "panfs_layout_type", "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); - } - else - { - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.agg_type); - ADIOI_Info_set(fd->info, "panfs_layout_type", temp_buffer); - if (file_query_args.layout.layout_is_valid == 1) - { - switch (file_query_args.layout.agg_type) - { - case PAN_FS_CLIENT_LAYOUT_TYPE__RAID0: - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE: - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_width); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.layout_visit_policy); - ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10: - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.layout_visit_policy); - ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__INVALID: - case PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT: - MPI_Info_set(fd->info, "panfs_layout_type", - "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); - default: - break; - } - } - } - } - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) - fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); - - if (fd->fd_sys == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_read.c b/3rd-party/romio321/adio/ad_panfs/ad_panfs_read.c deleted file mode 100644 index 237e4929de34a560e623a03e5c538beb0451274a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_read.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_panfs.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - MPI_Count err = -1, datatype_size, len; - static char myname[] = "ADIOI_PANFS_READCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; - } - - if (fd->fp_sys_posn != offset) { - err = lseek(fd->fd_sys, offset, SEEK_SET); - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ - } - - AD_PANFS_RETRY(read(fd->fd_sys, buf, len),err) - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ - - fd->fp_sys_posn = offset + err; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += err; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_write.c b/3rd-party/romio321/adio/ad_panfs/ad_panfs_write.c deleted file mode 100644 index 920d2f473e7b3d304b64c8fcc34a547b7114af69..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_write.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_panfs.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_PANFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - MPI_Count err = -1, datatype_size, len; - static char myname[] = "ADIOI_PANFS_WRITECONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; - } - - if (fd->fp_sys_posn != offset) { - err = lseek(fd->fd_sys, offset, SEEK_SET); - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ - } - - AD_PANFS_RETRY(write(fd->fd_sys, buf, len),err) - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ - - fd->fp_sys_posn = offset + err; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += err; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err); -#endif - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/Makefile.mk b/3rd-party/romio321/adio/ad_pfs/Makefile.mk deleted file mode 100644 index 3521c07c863611c5ae86bbcb408142cdd60ba5ae..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/Makefile.mk +++ /dev/null @@ -1,26 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_PFS - -noinst_HEADERS += adio/ad_pfs/ad_pfs.h - -romio_other_sources += \ - adio/ad_pfs/ad_pfs_read.c \ - adio/ad_pfs/ad_pfs_open.c \ - adio/ad_pfs/ad_pfs_write.c \ - adio/ad_pfs/ad_pfs_done.c \ - adio/ad_pfs/ad_pfs_fcntl.c \ - adio/ad_pfs/ad_pfs_iread.c \ - adio/ad_pfs/ad_pfs_iwrite.c \ - adio/ad_pfs/ad_pfs_wait.c \ - adio/ad_pfs/ad_pfs_flush.c \ - adio/ad_pfs/ad_pfs_hints.c \ - adio/ad_pfs/ad_pfs.c - -endif BUILD_AD_PFS - diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs.c deleted file mode 100644 index cc480b011145d98cbbbfa4a61dccb4aca9923373..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_PFS_operations = { - ADIOI_PFS_Open, /* Open */ - ADIOI_PFS_ReadContig, /* ReadContig */ - ADIOI_PFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_PFS_Fcntl, /* Fcntl */ - ADIOI_PFS_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ - ADIOI_PFS_IreadContig, /* IreadContig */ - ADIOI_PFS_IwriteContig, /* IwriteContig */ - ADIOI_PFS_ReadDone, /* ReadDone */ - ADIOI_PFS_WriteDone, /* WriteDone */ - ADIOI_PFS_ReadComplete, /* ReadComplete */ - ADIOI_PFS_WriteComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_PFS_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs.h b/3rd-party/romio321/adio/ad_pfs/ad_pfs.h deleted file mode 100644 index fbe055ccf750e7afbf3f050c45e48ee40c29b772..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* contains definitions, declarations, and macros specific to the - implementation of ADIO on PFS */ - -#ifndef AD_PFS_INCLUDE -#define AD_PFS_INCLUDE - -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> -#include <nx.h> -#include <sys/uio.h> -#include "adio.h" - -#ifdef tflops -#define lseek eseek -#define _gopen(n,m,i,p) open(n,m,p) -#endif - -/* PFS file-pointer modes (removed most of them because they are unused) */ -#ifndef M_ASYNC -#define M_UNIX 0 -#define M_ASYNC 5 -#endif - -void ADIOI_PFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_done.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_done.c deleted file mode 100644 index 60e2d7da298bceddf9ba40907e8a807926f174bf..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_done.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - int done=0; - static char myname[] = "ADIOI_PFS_READDONE"; - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return 1; - } - - if ((*request)->queued) - done = _iodone(*((long *) (*request)->handle)); - else done = 1; /* ADIOI_Complete_Async completed this request, - but request object was not freed. */ - -#ifdef HAVE_STATUS_SET_BYTES - if ((done >= 0) && ((*request)->nbytes != -1)) - MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes); -#endif - - if (done >= 0) { - /* if request is still queued in the system, it is also there - on ADIOI_Async_list. Delete it from there. */ - if ((*request)->queued) ADIOI_Del_req_from_list(request); - - (*request)->fd->async_count--; - if ((*request)->handle) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } - - if (done == -1 && errno != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - return done; -} - - -int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - return ADIOI_PFS_ReadDone(request, status, error_code); -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_fcntl.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_fcntl.c deleted file mode 100644 index 4a2c0fd3827630bbe90d917d6f4a0f225be4af2b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_fcntl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" -#include "adio_extern.h" - -void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - int i, err; - int iomod, np_total, np_comm; - static char myname[] = "ADIOI_PFS_FCNTL"; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - if (!(fd->atomicity)) { - /* in M_ASYNC mode, all processes are not aware of changes - in file size (although the manual says otherwise). Therefore, - temporarily change to M_UNIX and then change - back to M_ASYNC.*/ - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - if (np_total == np_comm) { - err = _setiomode(fd->fd_sys, M_UNIX); - err = _setiomode(fd->fd_sys, M_ASYNC); - } - /* else it is M_UNIX anyway, so no problem */ - } - fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - err = _lsize(fd->fd_sys, fcntl_struct->diskspace, SEEK_SET); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - if (np_total == np_comm) { - iomod = (fcntl_struct->atomicity == 0) ? M_ASYNC : M_UNIX; - err = _setiomode(fd->fd_sys, iomod); - } - /* else can't do anything because setiomode is global. but - the file will have been opened with M_UNIX anyway, because - gopen is also global. */ - - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - if (err == -1) { - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - /* --END ERROR HANDLING-- */ - } - else *error_code = MPI_SUCCESS; - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPI_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_flush.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_flush.c deleted file mode 100644 index 98dedc099c362f4e2e096b53d8f1d02ed1458658..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_flush.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_Flush(ADIO_File fd, int *error_code) -{ - int err, np_total, np_comm; - static char myname[] = "ADIOI_PFS_FLUSH"; - -/* fsync is not actually needed in PFS, because it uses something - called fast-path I/O. However, it doesn't do any harm either. */ - err = fsync(fd->fd_sys); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - -/* MPI-IO requires that after an fsync all processes must see the same - file size. In PFS M_ASYNC mode, this doesn't automatically happen. - Therefore, if M_ASYNC mode, temporarily change it to M_UNIX mode - and then switch back to M_ASYNC. That updates the file size! */ - - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - if ((np_total == np_comm) && (!(fd->atomicity))) { - err = _setiomode(fd->fd_sys, M_UNIX); - err = _setiomode(fd->fd_sys, M_ASYNC); - } - /* else it is M_UNIX anyway. don't do anything. */ -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_hints.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_hints.c deleted file mode 100644 index 407a0eb7758225bc563f312981f6ce87bc7ed55d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_hints.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value, *value_in_fd; - int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; - struct sattr attr; - int err, myrank, fd_sys, perm, amode, old_mask; - - if ( (fd->info) == MPI_INFO_NULL) { - /* This must be part of the open call. can set striping parameters - if necessary. */ - MPI_Info_create(&(fd->info)); - - /* has user specified striping or server buffering parameters - and do they have the same value on all processes? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_factor=atoi(value); - tmp_val = str_factor; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != str_factor) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "striping_factor", - error_code); - return; - } - /* --END ERROR HANDLING-- */ - } - - ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_unit=atoi(value); - tmp_val = str_unit; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != str_unit) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "striping_unit", - error_code); - return; - } - /* --END ERROR HANDLING-- */ - } - - ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - start_iodev=atoi(value); - tmp_val = start_iodev; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != start_iodev) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "start_iodevice", - error_code); - return; - } - /* --END ERROR HANDLING-- */ - } - - /* if user has specified striping info, process 0 tries to set it */ - if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) { - MPI_Comm_rank(fd->comm, &myrank); - if (!myrank) { - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - fd_sys = open(fd->filename, amode, perm); - err = fcntl(fd_sys, F_GETSATTR, &attr); - - if (!err) { - if (str_unit > 0) attr.s_sunitsize = str_unit; - if ((start_iodev >= 0) && - (start_iodev < attr.s_sfactor)) - attr.s_start_sdir = start_iodev; - if ((str_factor > 0) && (str_factor < attr.s_sfactor)) - attr.s_sfactor = str_factor; - - err = fcntl(fd_sys, F_SETSATTR, &attr); - } - - close(fd_sys); - } - - MPI_Barrier(fd->comm); - } - - /* Has user asked for pfs server buffering to be turned on? - If so, mark it as true in fd->info and turn it on in - ADIOI_PFS_Open after the file is opened */ - - ADIOI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (!strcmp(value, "true"))) - ADIOI_Info_set(fd->info, "pfs_svr_buf", "true"); - else ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); - - ADIOI_Free(value); - } - else ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - } - - else { - /* The file has been opened previously and fd->fd_sys is a valid - file descriptor. cannot set striping parameters now. */ - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - /* has user specified value for pfs_svr_buf? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (!strcmp(value, "true") || !strcmp(value, "false"))) { - value_in_fd = (char *) - ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, - value_in_fd, &flag); - if (strcmp(value, value_in_fd)) { - if (!strcmp(value, "true")) { - err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, TRUE); - if (!err) - ADIOI_Info_set(fd->info, "pfs_svr_buf", "true"); - } - else { - err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, FALSE); - if (!err) - ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); - } - } - ADIOI_Free(value_in_fd); - } - ADIOI_Free(value); - } - - } - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_iread.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_iread.c deleted file mode 100644 index 78b3c592fb75e1171e24b044ebc56cec9be54b26..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_iread.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - long *id_sys; - int err=-1; - MPI_Count len, typesize; - ADIO_Offset off; - static char myname[] = "ADIOI_PFS_IREADCONTIG"; - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - id_sys = (long *) ADIOI_Malloc(sizeof(long)); - (*request)->handle = (void *) id_sys; - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : offset; - - lseek(fd->fd_sys, off, SEEK_SET); - *id_sys = _iread(fd->fd_sys, buf, len); - - if ((*id_sys == -1) && (errno == EQNOMID)) { - /* the man pages say EMREQUEST, but in reality errno is set to EQNOMID! */ - - /* exceeded the max. no. of outstanding requests. */ - - /* complete all previous async. requests */ - /*ADIOI_Complete_async(error_code); */ - if (*error_code != MPI_SUCCESS) return; - - /* try again */ - *id_sys = _iread(fd->fd_sys, buf, len); - - if ((*id_sys == -1) && (errno == EQNOMID)) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - return; - } - } - else if (*id_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - return; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - - (*request)->queued = 1; - (*request)->nbytes = len; - ADIOI_Add_req_to_list(request); - fd->async_count++; - - fd->fp_sys_posn = -1; /* set it to null. */ - - if (*id_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_iwrite.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_iwrite.c deleted file mode 100644 index 5dda2fbdeb66f878c45762b372cf11be18029e5a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_iwrite.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code) -{ - long *id_sys; - ADIO_Offset off; - int err; - MPI_Count len, typesize; - static char myname[] = "ADIOI_PFS_IWRITECONTIG"; - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - - id_sys = (long *) ADIOI_Malloc(sizeof(long)); - (*request)->handle = (void *) id_sys; - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : offset; - - lseek(fd->fd_sys, off, SEEK_SET); - *id_sys = _iwrite(fd->fd_sys, buf, len); - - if ((*id_sys == -1) && (errno == EQNOMID)) { - /* the man pages say EMREQUEST, but in reality errno is set to EQNOMID! */ - - /* exceeded the max. no. of outstanding requests. */ - - /* complete all previous async. requests */ - ADIOI_Complete_async(error_code); - if (error_code != MPI_SUCCESS) return; - - /* try again */ - *id_sys = _iwrite(fd->fd_sys, buf, len); - - if ((*id_sys == -1) && (errno == EQNOMID)) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - return; - } - } - else if (*id_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - return; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - - (*request)->queued = 1; - (*request)->nbytes = len; - ADIOI_Add_req_to_list(request); - fd->async_count++; - - fd->fp_sys_posn = -1; /* set it to null. */ - - if (*id_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_open.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_open.c deleted file mode 100644 index f814b7c0a146c922e22da24fc49f3d9692e546ad..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_open.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_Open(ADIO_File fd, int *error_code) -{ - int perm, amode, old_mask, np_comm, np_total, err, flag; - char *value; - struct sattr attr; - static char myname[] = "ADIOI_PFS_OPEN"; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - - if (np_total == np_comm) - fd->fd_sys = _gopen(fd->filename, amode, M_ASYNC, perm); - else fd->fd_sys = open(fd->filename, amode, perm); - fd->fd_direct = -1; - - if (fd->fd_sys != -1) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - /* if user has asked for pfs server buffering to be turned on, - it will be set to true in fd->info in the earlier call - to ADIOI_PFS_SetInfo. Turn it on now, since we now have a - valid file descriptor. */ - - ADIOI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (!strcmp(value, "true"))) { - err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, TRUE); - if (err) ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); - } - - /* get file striping information and set it in info */ - err = fcntl(fd->fd_sys, F_GETSATTR, &attr); - - if (!err) { - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sunitsize); - ADIOI_Info_set(fd->info, "striping_unit", value); - - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sfactor); - ADIOI_Info_set(fd->info, "striping_factor", value); - - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_start_sdir); - ADIOI_Info_set(fd->info, "start_iodevice", value); - } - ADIOI_Free(value); - - if (fd->access_mode & ADIO_APPEND) - fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); - } - - if (fd->fd_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_read.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_read.c deleted file mode 100644 index bd3b7e70e4750ddcf2fea75a8a1297dbae4bda70..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_read.c +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; - static char myname[] = "ADIOI_PFS_READCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { - lseek(fd->fd_sys, offset, SEEK_SET); - } - err = _cread(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - } - err = _cread(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_wait.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_wait.c deleted file mode 100644 index e14159521a5f6be306451ee414300d2d999beeb0..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_wait.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - int err=0; - static char myname[] = "ADIOI_PFS_READCOMPLETE"; - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return; - } - - if ((*request)->queued) { - err = _iowait(*((long *) (*request)->handle)); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } /* if ((*request)->queued) ... */ - else *error_code = MPI_SUCCESS; -#ifdef HAVE_STATUS_SET_BYTES - if ((*request)->nbytes != -1) - MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes); -#endif - - if ((*request)->queued != -1) { - - /* queued = -1 is an internal hack used when the request must - be completed, but the request object should not be - freed. This is used in ADIOI_Complete_async, because the user - will call MPI_Wait later, which would require status to - be filled. Ugly but works. queued = -1 should be used only - in ADIOI_Complete_async. - This should not affect the user in any way. */ - - /* if request is still queued in the system, it is also there - on ADIOI_Async_list. Delete it from there. */ - if ((*request)->queued) ADIOI_Del_req_from_list(request); - - (*request)->fd->async_count--; - if ((*request)->handle) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } -} - - -void ADIOI_PFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_PFS_ReadComplete(request, status, error_code); -} diff --git a/3rd-party/romio321/adio/ad_pfs/ad_pfs_write.c b/3rd-party/romio321/adio/ad_pfs/ad_pfs_write.c deleted file mode 100644 index c64e976a2b49ed892406c82ba955b24bc9770198..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pfs/ad_pfs_write.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pfs.h" - -void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - MPI_Count err=-1, datatype_size, len; - static char myname[] = "ADIOI_PFS_WRITECONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { - lseek(fd->fd_sys, offset, SEEK_SET); - } - err = _cwrite(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - } - err = _cwrite(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_piofs/Makefile.mk b/3rd-party/romio321/adio/ad_piofs/Makefile.mk deleted file mode 100644 index 4bcbd61f243864bc126745a93e52a3bb69b2ad97..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/Makefile.mk +++ /dev/null @@ -1,21 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_PIOFS - -noinst_HEADERS += adio/ad_piofs/ad_piofs.h - -romio_other_sources += \ - adio/ad_piofs/ad_piofs_read.c \ - adio/ad_piofs/ad_piofs_open.c \ - adio/ad_piofs/ad_piofs_write.c \ - adio/ad_piofs/ad_piofs_fcntl.c \ - adio/ad_piofs/ad_piofs_hints.c \ - adio/ad_piofs/ad_piofs.c - -endif BUILD_AD_PIOFS - diff --git a/3rd-party/romio321/adio/ad_piofs/README b/3rd-party/romio321/adio/ad_piofs/README deleted file mode 100644 index 933677b17700a197403f8a280084806bcb2f029f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/README +++ /dev/null @@ -1 +0,0 @@ -This code is no longer supported. diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs.c deleted file mode 100644 index 726bbf15f87be59daaaa44c0a8e442fc124bd2af..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_PIOFS_operations = { - ADIOI_PIOFS_Open, /* Open */ - ADIOI_PIOFS_ReadContig, /* ReadContig */ - ADIOI_PIOFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_PIOFS_Fcntl, /* Fcntl */ - ADIOI_PIOFS_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_PIOFS_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_PIOFS_Feature, - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs.h b/3rd-party/romio321/adio/ad_piofs/ad_piofs.h deleted file mode 100644 index e9b74c9e8721050352992fe4cdf525d509b5b790..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* contains definitions, declarations, and macros specific to the - implementation of ADIO on PIOFS */ - -#ifndef AD_PIOFS_INCLUDE -#define AD_PIOFS_INCLUDE - -#include <unistd.h> -#include <sys/uio.h> -#include <sys/types.h> -#include <fcntl.h> -#include <piofs/piofs_ioctl.h> -#include "adio.h" - -void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PIOFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PIOFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PIOFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - -void ADIOI_PIOFS_Feature(ADIO_File fd, int flag); - -#endif diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_fcntl.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_fcntl.c deleted file mode 100644 index 7d4a37cbfd5f87086cde9422a3ae4b2cd405fb9d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_fcntl.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" -#include "adio_extern.h" - -void ADIOI_PIOFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - MPI_Datatype copy_etype, copy_filetype; - int i, ntimes, err; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; - piofs_change_view_t *piofs_change_view; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_FCNTL"; -#endif - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - llseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - if (fcntl_struct->fsize == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - piofs_change_view = (piofs_change_view_t *) - ADIOI_Malloc(sizeof(piofs_change_view_t)); - piofs_change_view->Vbs = piofs_change_view->Vn = - piofs_change_view->Hbs = piofs_change_view->Hn = 1; - piofs_change_view->subfile = 0; - piofs_change_view->flags = (fcntl_struct->atomicity == 0) - ? (ACTIVE | NORMAL) : (ACTIVE | CAUTIOUS); - err = piofsioctl(fd->fd_sys, PIOFS_CHANGE_VIEW, piofs_change_view); - ADIOI_Free(piofs_change_view); - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - if (err == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_PIOFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_features.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_features.c deleted file mode 100644 index f3b0df6b21a54d65eb355e72571c90fdf54b9811..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_features.c +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -int ADIOI_PIOFS_Features(int flag) -{ - switch(flag) { - case ADIO_LOCKS: - case ADIO_SHARED_FP: - case ADIO_ATOMIC_MODE: - case ADIO_DATA_SIEVING_WRITES: - case ADIO_SCALABLE_OPEN: - default: - return 0; - break; - } -} diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_hints.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_hints.c deleted file mode 100644 index 242ebb3f07dd49a0574abb5a6055cd28d678a3b1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_hints.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - piofs_create_t piofs_create; - piofs_statfs_t piofs_statfs; - char *value, *path, *slash; - int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; - int err, myrank, perm, old_mask, nioservers; - - if ((fd->info) == MPI_INFO_NULL) { - /* This must be part of the open call. can set striping parameters - if necessary. */ - MPI_Info_create(&(fd->info)); - - /* has user specified striping parameters - and do they have the same value on all processes? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_factor=atoi(value); - tmp_val = str_factor; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_factor) { - FPRINTF(stderr, "ADIOI_PIOFS_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_unit=atoi(value); - tmp_val = str_unit; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_unit) { - FPRINTF(stderr, "ADIOI_PIOFS_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - start_iodev=atoi(value); - tmp_val = start_iodev; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != start_iodev) { - FPRINTF(stderr, "ADIOI_PIOFS_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - ADIOI_Free(value); - - /* if user has specified striping info, process 0 tries to set it */ - if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) { - MPI_Comm_rank(fd->comm, &myrank); - if (!myrank) { - int len; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - /* to find out the number of I/O servers, I need - the path to the directory containing the file */ - - path = ADIOI_Strdup(fd->filename); - len = strlen(path) + 1; - slash = strrchr(path, '/'); - if (!slash) ADIOI_Strncpy(path, ".", len); - else { - if (slash == path) *(path + 1) = '\0'; - else *slash = '\0'; - } - ADIOI_Strncpy(piofs_statfs.name, path, len); - err = piofsioctl(0, PIOFS_STATFS, &piofs_statfs); - nioservers = (err) ? -1 : piofs_statfs.f_nodes; - - ADIOI_Free(path); - - str_factor = ADIOI_MIN(nioservers, str_factor); - if (start_iodev >= nioservers) start_iodev = -1; - - ADIOI_Strncpy(piofs_create.name, fd->filename, len); - piofs_create.bsu = (str_unit > 0) ? str_unit : -1; - piofs_create.cells = (str_factor > 0) ? str_factor : -1; - piofs_create.permissions = perm; - piofs_create.base_node = (start_iodev >= 0) ? - start_iodev : -1; - piofs_create.flags = 0; - - err = piofsioctl(0, PIOFS_CREATE, &piofs_create); - } - MPI_Barrier(fd->comm); - } - } - } - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_open.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_open.c deleted file mode 100644 index e02e90cf325fa4e3d62b8f9b29c75bea941ffc84..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_open.c +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code) -{ - int amode, perm, old_mask, err; - piofs_fstat_t piofs_fstat; - char *value; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_OPEN"; -#endif - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - fd->fd_sys = open(fd->filename, amode, perm); - fd->fd_direct = -1; - - llseek(fd->fd_sys, 0, SEEK_SET); -/* required to initiate use of 64-bit offset */ - - if (fd->fd_sys != -1) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - /* get file striping information and set it in info */ - err = piofsioctl(fd->fd_sys, PIOFS_FSTAT, &piofs_fstat); - - if (!err) { - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_bsu); - ADIOI_Info_set(fd->info, "striping_unit", value); - - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_cells); - ADIOI_Info_set(fd->info, "striping_factor", value); - - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_base_node); - ADIOI_Info_set(fd->info, "start_iodevice", value); - } - ADIOI_Free(value); - - if (fd->access_mode & ADIO_APPEND) - fd->fp_ind = fd->fp_sys_posn = llseek(fd->fd_sys, 0, SEEK_END); - } - - if (fd->fd_sys == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(ADIO_FILE_NULL, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_read.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_read.c deleted file mode 100644 index 278548656e33d7a83c6a439ef4629a88ea80e550..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_read.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_READCONTIG"; -#endif - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { - llseek(fd->fd_sys, offset, SEEK_SET); - } - err = read(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { - llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - } - err = read(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_piofs/ad_piofs_write.c b/3rd-party/romio321/adio/ad_piofs/ad_piofs_write.c deleted file mode 100644 index 31836a82406694feda943b2e4f7083ce4cb9c432..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_piofs/ad_piofs_write.c +++ /dev/null @@ -1,340 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" -#include "adio_extern.h" - -void ADIOI_PIOFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_WRITECONTIG"; -#endif - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { - llseek(fd->fd_sys, offset, SEEK_SET); - } - err = write(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { - llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - } - err = write(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} - - - -void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Since PIOFS does not support file locking, can't do buffered writes - as on Unix */ - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - struct iovec *iov; - int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0; - int num, size, sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, indx, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp; - int flag, new_bwr_size, new_fwr_size, err_flag=0; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_WRITESTRIDED"; -#endif - - if (fd->atomicity) { - FPRINTF(stderr, "ROMIO cannot guarantee atomicity of noncontiguous accesses in atomic mode, as PIOFS doesn't support file locking. Use nonatomic mode and its associated semantics.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. use writev */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - -/* There is a limit of 16 on the number of iovecs for readv/writev! */ - - iov = (struct iovec *) ADIOI_Malloc(16*sizeof(struct iovec)); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; - llseek(fd->fd_sys, off, SEEK_SET); - } - else off = llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - - k = 0; - for (j=0; j<count; j++) - for (i=0; i<flat_buf->count; i++) { - iov[k].iov_base = ((char *) buf) + j*buftype_extent + - flat_buf->indices[i]; - iov[k].iov_len = flat_buf->blocklens[i]; - /*FPRINTF(stderr, "%d %d\n", iov[k].iov_base, iov[k].iov_len);*/ - - off += flat_buf->blocklens[i]; - k = (k+1)%16; - - if (!k) { - err = writev(fd->fd_sys, iov, 16); - if (err == -1) err_flag = 1; - } - } - - if (k) { - err = writev(fd->fd_sys, iov, k); - if (err == -1) err_flag = 1; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(iov); - if (err_flag) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - } /* if (!buftype_is_contig && filetype_is_contig) ... */ - - else { /* noncontiguous in file */ - -/* split up into several contiguous writes */ - -/* find starting location in the file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; - } - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(fwr_size, bufsize); - while (i < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ - llseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i, fwr_size); - if (err == -1) err_flag = 1; - } - i += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - indx = flat_buf->indices[0]; - j = st_index; - off = offset; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { - llseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + indx, size); - if (err == -1) err_flag = 1; - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - indx += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - indx = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/ad_pvfs/Makefile.mk b/3rd-party/romio321/adio/ad_pvfs/Makefile.mk deleted file mode 100644 index 50e7bd0ae60a54eada4cf3a262b0395b3818cdfb..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/Makefile.mk +++ /dev/null @@ -1,26 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_PVFS - -noinst_HEADERS += adio/ad_pvfs/ad_pvfs.h - -romio_other_sources += \ - adio/ad_pvfs/ad_pvfs_close.c \ - adio/ad_pvfs/ad_pvfs_read.c \ - adio/ad_pvfs/ad_pvfs_open.c \ - adio/ad_pvfs/ad_pvfs_write.c \ - adio/ad_pvfs/ad_pvfs_fcntl.c \ - adio/ad_pvfs/ad_pvfs_flush.c \ - adio/ad_pvfs/ad_pvfs_resize.c \ - adio/ad_pvfs/ad_pvfs_hints.c \ - adio/ad_pvfs/ad_pvfs_delete.c \ - adio/ad_pvfs/ad_pvfs.c - -endif BUILD_AD_PVFS - - diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.c deleted file mode 100644 index 27a3df8af4aab262ed7f5b5e253244c1281277b2..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_PVFS_operations = { - ADIOI_PVFS_Open, /* Open */ - ADIOI_PVFS_ReadContig, /* ReadContig */ - ADIOI_PVFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_PVFS_Fcntl, /* Fcntl */ - ADIOI_PVFS_SetInfo, /* SetInfo */ - ADIOI_PVFS_ReadStrided, /* ReadStrided */ - ADIOI_PVFS_WriteStrided, /* WriteStrided */ - ADIOI_PVFS_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_PVFS_Flush, /* Flush */ - ADIOI_PVFS_Resize, /* Resize */ - ADIOI_PVFS_Delete, /* Delete */ - ADIOI_PVFS_Feature, /* Features */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.h b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.h deleted file mode 100644 index 88e1a9f2253290bf9fca5ce99311ad4b28f3755e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_PVFS_INCLUDE -#define AD_PVFS_INCLUDE - -#ifndef ROMIOCONF_H_INCLUDED -#include "romioconf.h" -#define ROMIOCONF_H_INCLUDED -#endif -#ifdef ROMIO_PVFS_NEEDS_INT64_DEFINITION -typedef long long int int64_t; -#endif - -#include <unistd.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <fcntl.h> -#ifdef HAVE_PVFS_H -#include <pvfs.h> -#endif -#include "adio.h" - -void ADIOI_PVFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PVFS_Close(ADIO_File fd, int *error_code); -void ADIOI_PVFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_PVFS_Delete(char *filename, int *error_code); -void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - - -#endif diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_close.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_close.c deleted file mode 100644 index c2da2e360efe02d5a45b3a22a4b70d6ee2ac4d79..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_close.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_Close(ADIO_File fd, int *error_code) -{ - int err; - static char myname[] = "ADIOI_PVFS_CLOSE"; - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); -#endif - err = pvfs_close(fd->fd_sys); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); -#endif - fd->fd_sys = -1; - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_delete.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_delete.c deleted file mode 100644 index 0e322ad32ae7b707229af9589b363263c8fdac14..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_delete.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" -#include "adio.h" - -void ADIOI_PVFS_Delete(char *filename, int *error_code) -{ - int err; - static char myname[] = "ADIOI_PVFS_DELETE"; - - err = pvfs_unlink(filename); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_fcntl.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_fcntl.c deleted file mode 100644 index eeff25071894bf635b2245ee03f540ce2c062dc5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_fcntl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" -#include "adio_extern.h" - -void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - static char myname[] = "ADIOI_PVFS_FCNTL"; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - fcntl_struct->fsize = pvfs_lseek64(fd->fd_sys, 0, SEEK_END); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (fd->fp_sys_posn != -1) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - if (fcntl_struct->fsize == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = 0; - /* --BEGIN ERROR HANDLING-- */ - if (fcntl_struct->atomicity != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNSUPPORTED_OPERATION, - "PVFS does not support atomic mode", - 0); - return; - } - /* --END ERROR HANDLING-- */ - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_flush.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_flush.c deleted file mode 100644 index 340f0cb33958a8d93e6c7ccd8503592c2ba6486e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_flush.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_Flush(ADIO_File fd, int *error_code) -{ - int err, rank, dummy=0, dummy_in=0; - static char myname[] = "ADIOI_PVFS_FLUSH"; - - /* a collective routine: because we do not cache data in PVFS1, one process - * can initiate the fsync operation and broadcast the result to the others. - * One catch: MPI_File_sync has special meaning with respect to file system - * consistency. Ensure no clients have outstanding write operations. - */ - - MPI_Comm_rank(fd->comm, &rank); - MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, - fd->hints->ranklist[0], fd->comm); - if (rank == fd->hints->ranklist[0]) { - err = pvfs_fsync(fd->fd_sys); - } - MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_hints.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_hints.c deleted file mode 100644 index fdc06ed8465991851bb279e394322b96b80d5ef6..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_hints.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value; - int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; - static char myname[] = "ADIOI_PVFS_SETINFO"; - - if ((fd->info) == MPI_INFO_NULL) { - /* This must be part of the open call. can set striping parameters - if necessary. */ - MPI_Info_create(&(fd->info)); - ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", "disable"); - ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", "disable"); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; - - /* has user specified any pvfs-specific hints (striping params, listio) - and do they have the same value on all processes? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_factor=atoi(value); - tmp_val = str_factor; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_factor) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "striping_factor", - error_code); - return; - /* --END ERROR HANDLING-- */ - } - else ADIOI_Info_set(fd->info, "striping_factor", value); - } - - ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_unit=atoi(value); - tmp_val = str_unit; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_unit) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "striping_unit", - error_code); - return; - /* --END ERROR HANDLING-- */ - } - else ADIOI_Info_set(fd->info, "striping_unit", value); - } - - ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - start_iodev=atoi(value); - tmp_val = start_iodev; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != start_iodev) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "start_iodevice", - error_code); - return; - /* --END ERROR HANDLING-- */ - } - else ADIOI_Info_set(fd->info, "start_iodevice", value); - } - - ADIOI_Info_get(users_info, "romio_pvfs_listio_read", - MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) - { - ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE; - } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) - { - ADIOI_Info_set(fd->info , "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; - } - else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) - { - ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO; - } - tmp_val = fd->hints->fs_hints.pvfs.listio_read; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "romio_pvfs_listio_read", - error_code); - return; - /* --END ERROR HANDLING-- */ - } - } - ADIOI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) - { - ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE; - } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) - { - ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; - } - else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) - { - ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO; - } - tmp_val = fd->hints->fs_hints.pvfs.listio_write; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) { - /* --BEGIN ERROR HANDLING-- */ - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "romio_pvfs_listio_write", - error_code); - return; - /* --END ERROR HANDLING-- */ - } - } - ADIOI_Free(value); - } - } - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_open.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_open.c deleted file mode 100644 index c4fa28805daf3270c0ce7c1ee23d37d426342b10..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_open.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_Open(ADIO_File fd, int *error_code) -{ - int perm, amode, old_mask, flag; - char *value; - /* some really old versions of pvfs may not have a release nr */ - /* we changed the structure of pvfs_filestat in pvfs-1.5.7 */ - struct pvfs_filestat pstat = {-1,-1,-1}; - static char myname[] = "ADIOI_PVFS_OPEN"; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = O_META; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (atoi(value) > 0)) pstat.pcount = atoi(value); - - ADIOI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (atoi(value) > 0)) pstat.ssize = atoi(value); - - ADIOI_Info_get(fd->info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && (atoi(value) >= 0)) pstat.base = atoi(value); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); -#endif - fd->fd_sys = pvfs_open64(fd->filename, amode, perm, &pstat, NULL); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); -#endif - fd->fd_direct = -1; - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - fd->fp_ind = fd->fp_sys_posn = pvfs_lseek64(fd->fd_sys, 0, SEEK_END); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - } - - if (fd->fd_sys != -1) { - pvfs_ioctl(fd->fd_sys, GETMETA, &pstat); - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.pcount); - ADIOI_Info_set(fd->info, "striping_factor", value); - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.ssize); - ADIOI_Info_set(fd->info, "striping_unit", value); - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.base); - ADIOI_Info_set(fd->info, "start_iodevice", value); - } - - ADIOI_Free(value); - - if (fd->fd_sys == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_read.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_read.c deleted file mode 100644 index 7ea249f28a4d53dfdc43e567b1918322b6c2bf16..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_read.c +++ /dev/null @@ -1,784 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs.h" - -#ifdef HAVE_PVFS_LISTIO -void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -#endif - -void ADIOI_PVFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - MPI_Count err=-1, datatype_size, len; - static char myname[] = "ADIOI_PVFS_READCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, offset, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = pvfs_read(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - if (err>0) - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err = pvfs_read(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - if (err > 0) - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} - - -void ADIOI_PVFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -#ifdef HAVE_PVFS_LISTIO - if ( fd->hints->fs_hints.pvfs.listio_read == ADIOI_HINT_ENABLE) { - ADIOI_PVFS_ReadStridedListIO(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - return; - } -#endif -/* If hint set to DISABLE or AUTOMATIC, don't use listio */ - ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); -} - -#ifdef HAVE_PVFS_LISTIO -void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, l, brd_size, frd_size=0, st_index=0; - int sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, disp, start_off; - int flag, st_frd_size, st_n_filetypes; - int new_brd_size, new_frd_size; - - int mem_list_count, file_list_count; - char **mem_offsets; - int64_t *file_offsets; - int *mem_lengths; - int32_t *file_lengths; - int total_blks_to_read; - - int max_mem_list, max_file_list; - - int b_blks_read; - int f_data_read; - int size_read=0, n_read_lists, extra_blks; - - int end_brd_size, end_frd_size; - int start_k, start_j, new_file_read, new_buffer_read; - int start_mem_offset; - -#define MAX_ARRAY_SIZE 1024 - -#ifndef PRINT_ERR_MESG - static char myname[] = "ADIOI_PVFS_ReadStrided"; -#endif - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - int64_t file_offsets; - int32_t file_lengths; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - file_list_count = 1; - file_offsets = off; - file_lengths = 0; - total_blks_to_read = count*flat_buf->count; - b_blks_read = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_read > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_read; - mem_offsets = (char**)ADIOI_Malloc(mem_list_count*sizeof(char*)); - mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_read < total_blks_to_read) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = - (char*)((char *)buf + j*buftype_extent + flat_buf->indices[i]); - mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_lengths += flat_buf->blocklens[i]; - b_blks_read++; - if (!(b_blks_read % MAX_ARRAY_SIZE) || - (b_blks_read == total_blks_to_read)) { - - /* in the case of the last read list call, - adjust mem_list_count */ - if (b_blks_read == total_blks_to_read) { - mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; - /* in case last read list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } - - pvfs_read_list(fd->fd_sys ,mem_list_count, mem_offsets, - mem_lengths, file_list_count, - &file_offsets, &file_lengths); - - /* in the case of the last read list call, leave here */ - if (b_blks_read == total_blks_to_read) break; - - file_offsets += file_lengths; - file_lengths = 0; - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_read < total_blks_to_read) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This isa temporary way of filling in status. The right way is to - keep tracke of how much data was actually read adn placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - ADIOI_Delete_flattened(datatype); - - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* know file is noncontiguous from above */ - /* noncontiguous in file */ - - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - - /* for each case - ADIO_Individual pointer or explicit, find the file - offset in bytes (offset), n_filetypes (how many filetypes into - file to start), frd_size (remaining amount of data in present - file block), and st_index (start point in terms of blocks in - starting filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - frd_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - int mem_lengths; - char *mem_offsets; - - i = 0; - j = st_index; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to read */ - f_data_read = ADIOI_MIN(st_frd_size, bufsize); - total_blks_to_read = 1; - j++; - while (f_data_read < bufsize) { - f_data_read += flat_file->blocklens[j]; - total_blks_to_read++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_read%MAX_ARRAY_SIZE; - - mem_offsets = buf; - mem_lengths = 0; - - /* if at least one full readlist, allocate file arrays - at max array size and don't free until very end */ - if (n_read_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int32_t)); - } - /* if there's no full readlist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* - sizeof(int32_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_read_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_frd_size; - mem_lengths = st_frd_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + n_filetypes*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_lengths += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ - pvfs_read_list(fd->fd_sys, mem_list_count, - &mem_offsets, &mem_lengths, - file_list_count, file_offsets, - file_lengths); - mem_offsets += mem_lengths; - mem_lengths = 0; - } /* for (i=0; i<n_read_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_frd_size; - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + n_filetypes*filetype_extent + - flat_file->indices[j]; - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - (int32_t) mem_lengths - - (int32_t) mem_offsets + (int32_t) buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ - pvfs_read_list(fd->fd_sys, mem_list_count, &mem_offsets, - &mem_lengths, file_list_count, file_offsets, - file_lengths); - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fakes filling the readlist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_read += new_buffer_read; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_read < bufsize) */ - - mem_offsets = (char **)ADIOI_Malloc(max_mem_list*sizeof(char *)); - mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); - file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); - file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_frd_size and new_brd_size */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fills the allocated readlist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - mem_offsets[i] = (char*)((char *)buf + buftype_extent* - (buf_count/flat_buf->count) + - (int)flat_buf->indices[k]); - if(!i) { - mem_lengths[0] = brd_size; - mem_offsets[0] += flat_buf->blocklens[k] - brd_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_brd_size; - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + n_filetypes * - filetype_extent; - if (!i) { - file_lengths[0] = frd_size; - file_offsets[0] += flat_file->blocklens[j] - frd_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_frd_size; - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - - /* - printf("about to call read_list in noncontig/noncontig\n"); - printf("offsets and lengths in terms of integers\n"); - printf("\nmem_list_count = %d\n", mem_list_count); - for (i=0; i<mem_list_count; i++) { - printf("mem_offsets[%2d] = %2d ", i, (int)(mem_offsets[i] - (int)buf)/4); - printf("mem_lengths[%2d] = %2d\n", i, mem_lengths[i]/4); - } - printf("\nfile_list_count = %d\n", file_list_count); - for (i=0; i<file_list_count; i++) { - printf("file_offsets[%2d] = %2d ", i, (int)file_offsets[i]/4); - printf("file_lengths[%2d] = %2d\n", i, file_lengths[i]/4); - } - printf("\n\n"); - */ - pvfs_read_list(fd->fd_sys,mem_list_count, mem_offsets, - mem_lengths, file_list_count, file_offsets, - file_lengths); - size_read += new_buffer_read; - start_k = k; - start_j = j; - } /* while (size_read < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} -#endif /* HAVE_PVFS_LISTIO */ diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_resize.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_resize.c deleted file mode 100644 index b4b9553633f1679337856bfdfa605f98c656c0e5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_resize.c +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; - int rank; - static char myname[] = "ADIOI_PVFS_RESIZE"; - - /* because MPI_File_set_size is a collective operation, and PVFS1 clients - * do not cache metadata locally, one client can resize and broadcast the - * result to the others */ - MPI_Comm_rank(fd->comm, &rank); - if (rank == fd->hints->ranklist[0]) { - err = pvfs_ftruncate64(fd->fd_sys, size); - } - MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_write.c b/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_write.c deleted file mode 100644 index 5f8d7e0f12e228520706d94582e8e2b2d882875d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs/ad_pvfs_write.c +++ /dev/null @@ -1,1167 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" -#include "adio_extern.h" - -#ifdef HAVE_PVFS_LISTIO -void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -#endif - -void ADIOI_PVFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - MPI_Count err=-1, datatype_size, len; - static char myname[] = "ADIOI_PVFS_WRITECONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, offset, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err > 0) - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, buf, len); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err > 0) - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} - - - -void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Since PVFS does not support file locking, can't do buffered writes - as on Unix */ - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0; - int num, size, sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, indx, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp; - int flag, new_bwr_size, new_fwr_size, err_flag=0; - static char myname[] = "ADIOI_PVFS_WRITESTRIDED"; - -#ifdef HAVE_PVFS_LISTIO - if ( fd->hints->fs_hints.pvfs.listio_write == ADIOI_HINT_ENABLE ) { - ADIOI_PVFS_WriteStridedListIO(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; - } -#endif - /* if hint set to DISABLE or AUTOMATIC, don't use listio */ - - /* --BEGIN ERROR HANDLING-- */ - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_INTERN, - "Atomic mode set in PVFS I/O function", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - if (!buftype_is_contig && filetype_is_contig) { - char *combine_buf, *combine_buf_ptr; - ADIO_Offset combine_buf_remain; -/* noncontiguous in memory, contiguous in file. use writev */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - /* allocate our "combine buffer" to pack data into before writing */ - combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size); - combine_buf_ptr = combine_buf; - combine_buf_remain = fd->hints->ind_wr_buffer_size; - - /* seek to the right spot in the file */ - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - else { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - - /* loop through all the flattened pieces. combine into buffer until - * no more will fit, then write. - * - * special case of a given piece being bigger than the combine buffer - * is also handled. - */ - for (j=0; j<count; j++) { - for (i=0; i<flat_buf->count; i++) { - if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) { - /* there is data in the buffer; write out the buffer so far */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, - combine_buf, - fd->hints->ind_wr_buffer_size - combine_buf_remain); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - - /* reset our buffer info */ - combine_buf_ptr = combine_buf; - combine_buf_remain = fd->hints->ind_wr_buffer_size; - } - - /* TODO: heuristic for when to not bother to use combine buffer? */ - if (flat_buf->blocklens[i] >= combine_buf_remain) { - /* special case: blocklen is as big as or bigger than the combine buf; - * write directly - */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, - ((char *) buf) + j*buftype_extent + flat_buf->indices[i], - flat_buf->blocklens[i]); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ - } - else { - /* copy more data into combine buffer */ - memcpy(combine_buf_ptr, - ((char *) buf) + j*buftype_extent + flat_buf->indices[i], - flat_buf->blocklens[i]); - combine_buf_ptr += flat_buf->blocklens[i]; - combine_buf_remain -= flat_buf->blocklens[i]; - off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ - } - } - } - - if (combine_buf_ptr != combine_buf) { - /* data left in buffer to write */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, - combine_buf, - fd->hints->ind_wr_buffer_size - combine_buf_remain); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(combine_buf); - - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } /* if (!buftype_is_contig && filetype_is_contig) ... */ - - else { /* noncontiguous in file */ - -/* split up into several contiguous writes */ - -/* find starting location in the file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; - } - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(fwr_size, bufsize); - while (i < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, ((char *) buf) + i, fwr_size); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - } - i += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - indx = flat_buf->indices[0]; - j = st_index; - off = offset; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = pvfs_write(fd->fd_sys, ((char *) buf) + indx, size); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - indx += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - indx = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} - -#ifdef HAVE_PVFS_LISTIO -void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Since PVFS does not support file locking, can't do buffered writes - as on Unix */ - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0; - int size, sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, disp, start_off; - int flag, st_fwr_size, st_n_filetypes; - int new_bwr_size, new_fwr_size, err_flag=0; - - int mem_list_count, file_list_count; - char ** mem_offsets; - int64_t *file_offsets; - int *mem_lengths; - int32_t *file_lengths; - int total_blks_to_write; - - int max_mem_list, max_file_list; - - int b_blks_wrote; - int f_data_wrote; - int size_wrote=0, n_write_lists, extra_blks; - - int end_bwr_size, end_fwr_size; - int start_k, start_j, new_file_write, new_buffer_write; - int start_mem_offset; -#define MAX_ARRAY_SIZE 1024 - static char myname[] = "ADIOI_PVFS_WRITESTRIDED"; - -/* PFS file pointer modes are not relevant here, because PFS does - not support strided accesses. */ - - /* --BEGIN ERROR HANDLING-- */ - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_INTERN, - "Atomic mode set in PVFS I/O function", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - int64_t file_offsets; - int32_t file_lengths; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - else { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - - file_list_count = 1; - file_offsets = off; - file_lengths = 0; - total_blks_to_write = count*flat_buf->count; - b_blks_wrote = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_write > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_write; - mem_offsets = (char**)ADIOI_Malloc(mem_list_count*sizeof(char*)); - mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_wrote < total_blks_to_write) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = - ((char*)buf + j*buftype_extent + flat_buf->indices[i]); - mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_lengths += flat_buf->blocklens[i]; - b_blks_wrote++; - if (!(b_blks_wrote % MAX_ARRAY_SIZE) || - (b_blks_wrote == total_blks_to_write)) { - - /* in the case of the last read list call, - adjust mem_list_count */ - if (b_blks_wrote == total_blks_to_write) { - mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; - /* in case last read list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } - - pvfs_write_list(fd->fd_sys ,mem_list_count, mem_offsets, - mem_lengths, file_list_count, - &file_offsets, &file_lengths); - - /* in the case of the last read list call, leave here */ - if (b_blks_wrote == total_blks_to_write) break; - - file_offsets += file_lengths; - file_lengths = 0; - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_wrote < total_blks_to_write) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* clear this. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - ADIOI_Delete_flattened(datatype); - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* already know that file is noncontiguous from above */ - /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - - /* for each case - ADIO_Individual pointer or explicit, find offset - (file offset in bytes), n_filetypes (how many filetypes into file - to start), fwr_size (remaining amount of data in present file - block), and st_index (start point in terms of blocks in starting - filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - int mem_lengths; - char *mem_offsets; - - i = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to read */ - f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize); - total_blks_to_write = 1; - j++; - while (f_data_wrote < bufsize) { - f_data_wrote += flat_file->blocklens[j]; - total_blks_to_write++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_write_lists = total_blks_to_write/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_write%MAX_ARRAY_SIZE; - - mem_offsets = buf; - mem_lengths = 0; - - /* if at least one full readlist, allocate file arrays - at max array size and don't free until very end */ - if (n_write_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int32_t)); - } - /* if there's no full readlist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* - sizeof(int32_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_write_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_fwr_size; - mem_lengths = st_fwr_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + n_filetypes*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_lengths += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ - pvfs_write_list(fd->fd_sys, mem_list_count, - &mem_offsets, &mem_lengths, - file_list_count, file_offsets, - file_lengths); - mem_offsets += mem_lengths; - mem_lengths = 0; - } /* for (i=0; i<n_write_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_fwr_size; - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + n_filetypes*filetype_extent + - flat_file->indices[j]; - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - (int32_t) mem_lengths - - (int32_t) mem_offsets + (int32_t) buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ - pvfs_write_list(fd->fd_sys, mem_list_count, &mem_offsets, - &mem_lengths, file_list_count, file_offsets, - file_lengths); - } - } - else { - /* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fakes filling the writelist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_wrote += new_buffer_write; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_wrote < bufsize) */ - - mem_offsets = (char **)ADIOI_Malloc(max_mem_list*sizeof(char *)); - mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); - file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); - file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_fwr_size and new_bwr_size */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fills the allocated readlist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - mem_offsets[i] = ((char*)buf + buftype_extent* - (buf_count/flat_buf->count) + - (int)flat_buf->indices[k]); - - if(!i) { - mem_lengths[0] = bwr_size; - mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_bwr_size; - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + n_filetypes * - filetype_extent; - if (!i) { - file_lengths[0] = fwr_size; - file_offsets[0] += flat_file->blocklens[j] - fwr_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_fwr_size; - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - pvfs_write_list(fd->fd_sys,mem_list_count, mem_offsets, - mem_lengths, file_list_count, file_offsets, - file_lengths); - size_wrote += new_buffer_write; - start_k = k; - start_j = j; - } /* while (size_wrote < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} -#endif /* HAVE_PVFS_LISTIO */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.c deleted file mode 100644 index bdebe19d37aa07a9e0d913aac420e0a16bc6e29f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" - -#include "adio.h" - -struct ADIOI_Fns_struct ADIO_PVFS2_operations = { - ADIOI_PVFS2_Open, /* Open */ - ADIOI_SCALEABLE_OpenColl, /* OpenColl */ - ADIOI_PVFS2_ReadContig, /* ReadContig */ - ADIOI_PVFS2_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_PVFS2_Fcntl, /* Fcntl */ - ADIOI_PVFS2_SetInfo, /* SetInfo */ - ADIOI_PVFS2_ReadStrided, /* ReadStrided */ - ADIOI_PVFS2_WriteStrided, /* WriteStrided */ - ADIOI_PVFS2_Close, /* Close */ -#ifdef HAVE_MPI_GREQUEST_EXTENSIONS - ADIOI_PVFS2_IReadContig, /* IreadContig */ - ADIOI_PVFS2_IWriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_PVFS2_Flush, /* Flush */ - ADIOI_PVFS2_Resize, /* Resize */ - ADIOI_PVFS2_Delete, /* Delete */ - ADIOI_PVFS2_Feature, - "PVFS2: the PVFS v2 or OrangeFS file systems", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.h b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.h deleted file mode 100644 index 95c5912376b153ae11057792a6b2cefdecfb2c6c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_PVFS2_INCLUDE -#define AD_PVFS2_INCLUDE - -#include "adio.h" -#ifdef HAVE_PVFS2_H -#include "pvfs2.h" -#endif - -#ifdef PVFS2_VERSION_MAJOR -#include "pvfs2-compat.h" -#endif - -void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code); -void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code); -void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS2_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PVFS2_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code); -void ADIOI_PVFS2_Delete(const char *filename, int *error_code); -void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -int ADIOI_PVFS2_Feature(ADIO_File fd, int flag); - -void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -void ADIOI_PVFS2_IWriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int flag, int *error_code); -void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); - -int ADIOI_PVFS2_WriteStridedListIO(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -int ADIOI_PVFS2_WriteStridedDtypeIO(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_aio.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_aio.c deleted file mode 100644 index 88be6f1eaffaa189797b4fc876100571227b3a65..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_aio.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" -#include <string.h> - -#include "ad_pvfs2_common.h" -#include "mpiu_greq.h" -#include "../../mpi-io/mpioimpl.h" - -#define READ 0 -#define WRITE 1 - -static int ADIOI_PVFS2_greq_class = 0; -int ADIOI_PVFS2_aio_free_fn(void *extra_state); -int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status *status); -int ADIOI_PVFS2_aio_wait_fn(int count, void ** array_of_states, - double timeout, MPI_Status *status); - -void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) -{ - ADIOI_PVFS2_AIO_contig(fd, buf, count, datatype, file_ptr_type, - offset, request, READ, error_code); -} - -void ADIOI_PVFS2_IWriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) -{ - ADIOI_PVFS2_AIO_contig(fd, (void *)buf, count, datatype, file_ptr_type, - offset, request, WRITE, error_code); -} - -void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int flag, int *error_code) -{ - - int ret; - MPI_Count datatype_size, len; - ADIOI_PVFS2_fs *pvfs_fs; - ADIOI_AIO_Request *aio_req; - static char myname[] = "ADIOI_PVFS2_AIO_contig"; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->mem_req)); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in pvfs_request_contig (memory)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->file_req)); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in pvfs_request_contig (file)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* copy individual file pointer into offset variable, continue */ - offset = fd->fp_ind; - } - if (flag == READ) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_iread_a, 0, NULL ); -#endif - ret = PVFS_isys_read(pvfs_fs->object_ref, aio_req->file_req, offset, - buf, aio_req->mem_req, &(pvfs_fs->credentials), - &(aio_req->resp_io), &(aio_req->op_id), NULL); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_iread_b, 0, NULL ); -#endif - } else if (flag == WRITE) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_iwrite_a, 0, NULL ); -#endif - ret = PVFS_isys_write(pvfs_fs->object_ref, aio_req->file_req, offset, - buf, aio_req->mem_req, &(pvfs_fs->credentials), - &(aio_req->resp_io), &(aio_req->op_id), NULL); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_iwrite_b, 0, NULL ); -#endif - } - - /* --BEGIN ERROR HANDLING-- */ - if (ret < 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_isys_io", 0); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - /* posted. defered completion */ - if (ret == 0) { - if (ADIOI_PVFS2_greq_class == 0) { - MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, - ADIOI_PVFS2_aio_free_fn, MPIU_Greq_cancel_fn, - ADIOI_PVFS2_aio_poll_fn, ADIOI_PVFS2_aio_wait_fn, - &ADIOI_PVFS2_greq_class); - } - MPIX_Grequest_class_allocate(ADIOI_PVFS2_greq_class, aio_req, request); - memcpy(&(aio_req->req), request, sizeof(*request)); - } - - /* immediate completion */ - if (ret == 1) { - MPIO_Completed_request_create(&fd, len, error_code, request); - } - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += len; - } - fd->fp_sys_posn = offset + len; - - *error_code = MPI_SUCCESS; -fn_exit: - return; -} - -int ADIOI_PVFS2_aio_free_fn(void *extra_state) -{ - ADIOI_AIO_Request *aio_req; - aio_req = (ADIOI_AIO_Request*)extra_state; - - PVFS_Request_free(&(aio_req->mem_req)); - PVFS_Request_free(&(aio_req->file_req)); - ADIOI_Free(aio_req); - - return MPI_SUCCESS; -} - -int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status *status) -{ - ADIOI_AIO_Request *aio_req; - int ret, error; - - aio_req = (ADIOI_AIO_Request *)extra_state; - - /* BUG: cannot PVFS_sys_testsome: does not work for a specific request */ - ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_aio_poll_fn", &error); - if (ret == 0) { - aio_req->nbytes = aio_req->resp_io.total_completed; - MPI_Grequest_complete(aio_req->req); - return MPI_SUCCESS; - } else - return MPI_UNDEFINED; /* TODO: what's this error? */ -} - -/* wait for multiple requests to complete */ -int ADIOI_PVFS2_aio_wait_fn(int count, void ** array_of_states, - double timeout, MPI_Status *status) -{ - - ADIOI_AIO_Request **aio_reqlist; - PVFS_sys_op_id *op_id_array; - int i,j, greq_count, completed_count=0; - int *error_array; - - aio_reqlist = (ADIOI_AIO_Request **)array_of_states; - - op_id_array = (PVFS_sys_op_id*)ADIOI_Calloc(count, sizeof(PVFS_sys_op_id)); - error_array = (int *)ADIOI_Calloc(count, sizeof(int)); - greq_count = count; - - - /* PVFS-2.6: testsome actually tests all requests and fills in op_id_array - * with the ones that have completed. count is an in/out parameter. - * returns with the number of completed operations. what a mess! */ - while (completed_count < greq_count ) { - count = greq_count; - PVFS_sys_testsome(op_id_array, &count, NULL, error_array, INT_MAX); - completed_count += count; - for (i=0; i< count; i++) { - for (j=0; j<greq_count; j++) { - if (op_id_array[i] == aio_reqlist[j]->op_id) { - aio_reqlist[j]->nbytes = - aio_reqlist[j]->resp_io.total_completed; - MPI_Grequest_complete(aio_reqlist[j]->req); - } - } - } - } - return MPI_SUCCESS; /* TODO: no idea how to deal with errors */ -} - - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.c deleted file mode 100644 index ccd3c1916c68d3207c90038cf31e02aad2404ddc..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.c +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" -#include "ad_pvfs2_common.h" -#include <unistd.h> -#include <sys/types.h> -#include <time.h> -#include <stdlib.h> - -/* maybe give romio access to the globalconfig struct */ -/* keyval hack to both tell us if we've already initialized pvfs2 and also - * close it down when mpi exits */ -int ADIOI_PVFS2_Initialized = MPI_KEYVAL_INVALID; - -void ADIOI_PVFS2_End(int *error_code) -{ - int ret; - static char myname[] = "ADIOI_PVFS2_END"; - - ret = PVFS_sys_finalize(); - - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_finalize", 0); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; -} - -int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, - void *attribute_val, void *extra_state) -{ - int error_code; - ADIOI_PVFS2_End(&error_code); - MPI_Keyval_free(&keyval); - return error_code; -} - -void ADIOI_PVFS2_Init(int *error_code ) -{ - int ret; - static char myname[] = "ADIOI_PVFS2_INIT"; - char * ncache_timeout; - - /* do nothing if we've already fired up the pvfs2 interface */ - if (ADIOI_PVFS2_Initialized != MPI_KEYVAL_INVALID) { - *error_code = MPI_SUCCESS; - return; - } - - /* for consistency, we should disable the pvfs2 ncache. If the - * environtment variable is already set, assume a user knows it - * won't be a problem */ - ncache_timeout = getenv("PVFS2_NCACHE_TIMEOUT"); - if (ncache_timeout == NULL ) - setenv("PVFS2_NCACHE_TIMEOUT", "0", 1); - - ret = PVFS_util_init_defaults(); - if (ret < 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_util_init_defaults", - 0); - PVFS_perror("PVFS_util_init_defaults", ret); - - return; - } - - MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_PVFS2_End_call, - &ADIOI_PVFS2_Initialized, (void *)0); - /* just like romio does, we make a dummy attribute so we - * get cleaned up */ - MPI_Attr_put(MPI_COMM_SELF, ADIOI_PVFS2_Initialized, (void *)0); -} - -void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs) -{ - memset(attribs, 0, sizeof(PVFS_sys_attr)); - - attribs->owner = geteuid(); - attribs->group = getegid(); - attribs->perms = 0644; - attribs->mask = PVFS_ATTR_SYS_ALL_SETABLE; - attribs->atime = time(NULL); - attribs->mtime = attribs->atime; - attribs->ctime = attribs->atime; -} - - -void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials) -{ - memset(credentials, 0, sizeof(PVFS_credentials)); - - PVFS_util_gen_credentials(credentials); -} - -int ADIOI_PVFS2_error_convert(int pvfs_error) -{ - switch(pvfs_error) - { - case PVFS_EPERM: - case PVFS_EACCES: - return MPI_ERR_ACCESS; - case PVFS_ENOENT: - case PVFS_ENXIO: - case PVFS_ENODEV: - return MPI_ERR_NO_SUCH_FILE; - case PVFS_EIO: - return MPI_ERR_IO; - case PVFS_EEXIST: - return MPI_ERR_FILE_EXISTS; - case PVFS_ENOTDIR: /* ??? */ - case PVFS_EISDIR: /* ??? */ - case PVFS_ENAMETOOLONG: - return MPI_ERR_BAD_FILE; - case PVFS_EINVAL: - return MPI_ERR_FILE; - case PVFS_EFBIG: /* ??? */ - case PVFS_ENOSPC: - return MPI_ERR_NO_SPACE; - case PVFS_EROFS: - return MPI_ERR_READ_ONLY; - case PVFS_ENOSYS: - return MPI_ERR_UNSUPPORTED_OPERATION; - /* PVFS does not support quotas */ - case EDQUOT: - return MPI_ERR_QUOTA; - case PVFS_ENOMEM: - return MPI_ERR_INTERN; - default: - return MPI_UNDEFINED; - } - -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_delete.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_delete.c deleted file mode 100644 index f5770bb393c82179eb84c7d8c3d1e222631b89d7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_delete.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" -#include "adio.h" - -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_Delete(const char *filename, int *error_code) -{ - PVFS_credentials credentials; - PVFS_sysresp_getparent resp_getparent; - int ret; - PVFS_fs_id cur_fs; - static char myname[] = "ADIOI_PVFS2_DELETE"; - char pvfs_path[PVFS_NAME_MAX] = {0}; - - ADIOI_PVFS2_Init(error_code); - /* --BEGIN ERROR HANDLING-- */ - if (*error_code != MPI_SUCCESS) - { - /* ADIOI_PVFS2_INIT handles creating error codes itself */ - return; - } - /* --END ERROR HANDLING-- */ - - /* in most cases we'll store the credentials in the fs struct, but we don't - * have one of those in Delete */ - ADIOI_PVFS2_makecredentials(&credentials); - - /* given the filename, figure out which pvfs filesystem it is on */ - ret = PVFS_util_resolve(filename, &cur_fs, pvfs_path, PVFS_NAME_MAX); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_util_resolve", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ret = PVFS_sys_getparent(cur_fs, pvfs_path, &credentials, &resp_getparent); - - ret = PVFS_sys_remove(resp_getparent.basename, - resp_getparent.parent_ref, &credentials); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_remove", 0); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; - return; -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_fcntl.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_fcntl.c deleted file mode 100644 index e07291f757579738ab9d4e227a484ee7c8cd237c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_fcntl.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" -#include "adio_extern.h" -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - int ret; - ADIOI_PVFS2_fs *pvfs_fs; - PVFS_sysresp_getattr resp_getattr; - static char myname[] = "ADIOI_PVFS2_FCNTL"; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - ret = PVFS_sys_getattr(pvfs_fs->object_ref, PVFS_ATTR_SYS_SIZE, - &(pvfs_fs->credentials), &resp_getattr); - if (ret != 0 ) { - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_getattr", 0); - /* --END ERROR HANDLING-- */ - } - else { - *error_code = MPI_SUCCESS; - } - fcntl_struct->fsize = resp_getattr.attr.size; - return; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - /* --BEGIN ERROR HANDLING-- */ - case ADIO_FCNTL_SET_ATOMICITY: - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - /* --END ERROR HANDLING-- */ - } -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_features.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_features.c deleted file mode 100644 index 89a82c129fed569829867133e5256cd885bb6e37..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_features.c +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "adio.h" -#include "ad_pvfs2.h" - -int ADIOI_PVFS2_Feature(ADIO_File fd, int flag) -{ - switch(flag) { - case ADIO_SCALABLE_OPEN: - case ADIO_SCALABLE_RESIZE: - return 1; - case ADIO_SHARED_FP: - case ADIO_LOCKS: - case ADIO_SEQUENTIAL: - case ADIO_DATA_SIEVING_WRITES: - default: - return 0; - } -} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_hints.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_hints.c deleted file mode 100644 index 47522064e30f3e61db7be20f26923edd0e09c71d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_hints.c +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include <stdlib.h> -#include "ad_pvfs2.h" - -#include "hint_fns.h" - -void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value; - int flag, tmp_value; - static char myname[] = "ADIOI_PVFS_SETINFO"; - - if ((fd->info) == MPI_INFO_NULL) { - /* part of the open call */ - MPI_Info_create(&(fd->info)); - ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", "0"); - fd->hints->fs_hints.pvfs2.debugmask = 0; - - ADIOI_Info_set(fd->info, "striping_factor", "0"); - fd->hints->striping_factor = 0; - - ADIOI_Info_set(fd->info, "striping_unit", "0"); - fd->hints->striping_unit = 0; - - /* disable the aggressive strided optimizations by default */ - ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", "disable"); - ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", "disable"); - fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE; - fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE; - - ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", "disable"); - ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", "disable"); - fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE; - fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE; - - ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", "disable"); - ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", "disable"); - fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE; - fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE; - - - /* any user-provided hints? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc( (MPI_MAX_INFO_VAL+1)*sizeof(char)); - /* pvfs2 debugging */ - ADIOI_Info_get(users_info, "romio_pvfs2_debugmask", - MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - tmp_value = fd->hints->fs_hints.pvfs2.debugmask = - PVFS_debug_eventlog_to_mask(value); - - MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_value != fd->hints->fs_hints.pvfs2.debugmask) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, - "romio_pvfs2_debugmask", - error_code); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", value); - } - - /* the striping factor */ - ADIOI_Info_check_and_install_int(fd, users_info, "striping_factor", - &(fd->hints->striping_factor), myname, error_code); - - - /* the striping unit */ - ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", - &(fd->hints->striping_unit), myname, error_code); - - /* distribution name */ - ADIOI_Info_get(users_info, "romio_pvfs2_distribution_name", - MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - } - - /* POSIX read */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_read", - &(fd->hints->fs_hints.pvfs2.posix_read), myname, error_code); - - /* POSIX write */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_write", - &(fd->hints->fs_hints.pvfs2.posix_write), myname, error_code); - - /* Datatype read */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_read", - &(fd->hints->fs_hints.pvfs2.dtype_read), myname, error_code); - - /* Datatype write */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_write", - &(fd->hints->fs_hints.pvfs2.dtype_write), myname, error_code); - - /* Listio read */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_read", - &(fd->hints->fs_hints.pvfs2.listio_read), myname, error_code); - - /* Datatype write */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_write", - &(fd->hints->fs_hints.pvfs2.listio_write), myname, error_code); - ADIOI_Free(value); - } - } - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - *error_code = MPI_SUCCESS; -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io.h b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io.h deleted file mode 100644 index aefe0653ecb0ae16a8f14008e39a64c9b40a4684..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2006 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* Contig I/O helper prototypes */ - -#define READ 0 -#define WRITE 1 - -/* #define DEBUG_CONTIG */ -/* #define DEBUG_LIST */ -/* #define DEBUG_DTYPE */ - -/* Contig I/O helper prototypes */ -int ADIOI_PVFS2_Contig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code, int rw_type); - -/* List I/O helper prototypes */ -int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code, int rw_type); - -int gen_listio_arr(ADIOI_Flatlist_node *flat_buf, - int *flat_buf_index_p, - int64_t *cur_flat_buf_reg_off_p, - int flat_buf_size, - int flat_buf_extent, - ADIOI_Flatlist_node *flat_file, - int *flat_file_index_p, - int64_t *cur_flat_file_reg_off_p, - int flat_file_size, - int flat_file_extent, - int max_ol_count, - ADIO_Offset disp, - int bytes_into_filetype, - int64_t *bytes_completed, - int64_t total_io_size, - int64_t buf_off_arr[], - int32_t buf_len_arr[], - int32_t *buf_ol_count_p, - int64_t file_off_arr[], - int32_t file_len_arr[], - int32_t *file_ol_count_p); - -void print_buf_file_ol_pairs(int64_t buf_off_arr[], - int32_t buf_len_arr[], - int32_t buf_ol_count, - int64_t file_off_arr[], - int32_t file_len_arr[], - int32_t file_ol_count, - void *buf, - int rw_type); - -/* Datatype I/O helper prototypes */ -int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code, int rw_type); - -int convert_named(MPI_Datatype *mpi_dtype, - PVFS_Request *pvfs_dtype, int combiner); - -void print_dtype_info(int combiner, - int num_int, - int num_addr, - int num_dtype, - int *arr_int, - MPI_Aint *arr_addr, - MPI_Datatype *arr_dtype); - -int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype, - PVFS_Request *pvfs_dtype); - diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_dtype.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_dtype.c deleted file mode 100644 index 02219293cadcdc1ec979dd64ba170a5dacb494a1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_dtype.c +++ /dev/null @@ -1,739 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2006 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include <assert.h> -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" -#include "ad_pvfs2_io.h" -#include "ad_pvfs2_common.h" - -int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code, - int rw_type) -{ - int ret = -1, filetype_is_contig = -1; - MPI_Count filetype_size = -1; - int num_filetypes = 0, cur_flat_file_reg_off = 0; - PVFS_Request tmp_mem_req, mem_req, tmp_file_req, file_req; - PVFS_sysresp_io resp_io; - ADIO_Offset off = -1, bytes_into_filetype = 0; - MPI_Aint filetype_extent = -1, filetype_lb = -1; - int i = -1; - MPI_Count etype_size; - PVFS_size pvfs_disp = -1; - ADIOI_Flatlist_node *flat_file_p = ADIOI_Flatlist; - - /* Use for offseting the PVFS2 filetype */ - int pvfs_blk = 1; - ADIOI_PVFS2_fs *pvfs_fs; - static char myname[] = "ADIOI_PVFS2_STRIDED_DTYPE"; - - memset(&tmp_mem_req, 0, sizeof(PVFS_Request)); - memset(&mem_req, 0, sizeof(PVFS_Request)); - memset(&tmp_file_req, 0, sizeof(PVFS_Request)); - memset(&file_req, 0, sizeof(PVFS_Request)); - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - /* changed below if error */ - *error_code = MPI_SUCCESS; - - /* datatype is the memory type - * fd->filetype is the file type */ - MPI_Type_size_x(fd->filetype, &filetype_size); - if (filetype_size == 0) { - *error_code = MPI_SUCCESS; - return -1; - } - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(fd->etype, &etype_size); - if (filetype_size == 0) { - *error_code = MPI_SUCCESS; - return -1; - } - - /* offset is in units of etype relative to the filetype. We - * convert this to off in terms of actual data bytes (the offset - * minus the number of bytes that are not used). We are allowed - * to do this since PVFS2 handles offsets with respect to a - * file_req in bytes, otherwise we would have to convert into a - * pure byte offset as is done in other methods. Explicit offset - * case is handled by using fd->disp and byte-converted off. */ - - pvfs_disp = fd->disp; - if (file_ptr_type == ADIO_INDIVIDUAL) - { - if (filetype_is_contig) - { - off = fd->fp_ind - fd->disp; - } - else - { - int flag = 0; - /* Should have already been flattened in ADIO_Open*/ - while (flat_file_p->type != fd->filetype) - { - flat_file_p = flat_file_p->next; - } - num_filetypes = -1; - while (!flag) - { - num_filetypes++; - for (i = 0; i < flat_file_p->count; i++) - { - /* Start on a non zero-length region */ - if (flat_file_p->blocklens[i]) - { - if (fd->disp + flat_file_p->indices[i] + - (num_filetypes * filetype_extent) + - flat_file_p->blocklens[i] > fd->fp_ind && - fd->disp + flat_file_p->indices[i] <= - fd->fp_ind) - { - cur_flat_file_reg_off = fd->fp_ind - - (fd->disp + flat_file_p->indices[i] + - (num_filetypes * filetype_extent)); - flag = 1; - break; - } - else - bytes_into_filetype += flat_file_p->blocklens[i]; - } - } - } - /* Impossible that we don't find it in this datatype */ - assert(i != flat_file_p->count); - off = bytes_into_filetype + cur_flat_file_reg_off; - } - } - else /* ADIO_EXPLICIT */ - { - off = etype_size * offset; - } - -#ifdef DEBUG_DTYPE - fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: (fd->fp_ind=%Ld,fd->disp=%Ld," - " offset=%Ld),(pvfs_disp=%Ld,off=%Ld)\n", - fd->fp_ind, fd->disp, offset, pvfs_disp, off); -#endif - - - /* Convert the MPI memory and file datatypes into - * PVFS2 datatypes */ - ret = convert_mpi_pvfs2_dtype(&datatype, &tmp_mem_req); - if (ret < 0) - { - goto error_state; - } - ret = convert_mpi_pvfs2_dtype(&(fd->filetype), &tmp_file_req); - if (ret < 0) - { - goto error_state; - } - - ret = PVFS_Request_contiguous(count, tmp_mem_req, &mem_req); - if (ret != 0) /* TODO: convert this to MPIO error handling */ - fprintf(stderr, "ADIOI_PVFS2_stridedDtypeIO: error in final" - " CONTIG memory type\n"); - PVFS_Request_free(&tmp_mem_req); - - /* pvfs_disp is used to offset the filetype */ - ret = PVFS_Request_hindexed(1, &pvfs_blk, &pvfs_disp, - tmp_file_req, &file_req); - if (ret != 0) - fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: error in final" - " HINDEXED file type\n"); - PVFS_Request_free(&tmp_file_req); - - if (rw_type == READ) - ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, off, buf, - mem_req, &(pvfs_fs->credentials), &resp_io); - else - ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, off, buf, - mem_req, &(pvfs_fs->credentials), &resp_io); - - if (ret != 0) { - fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: Warning - PVFS_sys_" - "read/write returned %d and completed %Ld bytes.\n", - ret, (long long)resp_io.total_completed); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_io \n", 0); - goto error_state; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) - { - fd->fp_ind = off += resp_io.total_completed; - } - - error_state: - fd->fp_sys_posn = -1; /* set it to null. */ - - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - -#ifdef DEBUG_DTYPE - fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: " - "resp_io.total_completed=%Ld,ret=%d\n", - resp_io.total_completed, ret); -#endif - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); - /* This is a temporary way of filling in status. The right way is to - * keep track of how much data was actually acccessed by - * ADIOI_BUFFERED operations */ -#endif - return ret; -} - -/* convert_mpi_pvfs2_dtype - Convert a MPI datatype into - * a PVFS2 datatype so that we can natively use the PVFS2 - * datatypes in the PVFS2 I/O calls instead of converting - * all datatypes to the hindexed method - * return 1 - a leaf node - * return 0 - normal return - * return -1 - problems */ - -int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype, - PVFS_Request *pvfs_dtype) -{ - int num_int = -1, num_addr = -1, num_dtype = -1, - combiner = -1, i = -1, ret = -1, leaf = -1; - int *arr_int = NULL; - MPI_Aint *arr_addr = NULL; - MPI_Datatype *arr_dtype = NULL; - PVFS_Request *old_pvfs_dtype = NULL; - PVFS_Request *old_pvfs_dtype_arr = NULL; - int arr_count = -1; - PVFS_size *pvfs_arr_disp = NULL; - int *pvfs_arr_len = NULL; - - MPI_Type_get_envelope(*mpi_dtype, - &num_int, - &num_addr, - &num_dtype, - &combiner); - - /* Depending on type of datatype do the following - * operations */ - - if (combiner == MPI_COMBINER_NAMED) - { - convert_named(mpi_dtype, pvfs_dtype, combiner); - return 1; - } - - /* Allocate space for the arrays necessary for - * MPI_Type_get_contents */ - - if ((arr_int = ADIOI_Malloc(sizeof(int)*num_int)) == NULL) - { - fprintf(stderr, "Failed to allocate array_int\n"); - return -1; - } - if ((arr_addr = ADIOI_Malloc(sizeof(int)*num_addr)) == NULL) - { - ADIOI_Free(arr_int); - fprintf(stderr, "Failed to allocate array_addr\n"); - return -1; - } - if ((arr_dtype = ADIOI_Malloc(sizeof(MPI_Datatype)*num_dtype)) == NULL) - { - ADIOI_Free(arr_int); - ADIOI_Free(arr_addr); - fprintf(stderr, "Failed to allocate array_dtypes\n"); - return -1; - } - - MPI_Type_get_contents(*mpi_dtype, - num_int, - num_addr, - num_dtype, - arr_int, - arr_addr, - arr_dtype); - - /* If it's not a predefined datatype, it is either a - * derived datatype or a structured datatype */ - - if (combiner != MPI_COMBINER_STRUCT) - { - if ((old_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate PVFS_Request\n"); - switch (combiner) - { - case MPI_COMBINER_CONTIGUOUS: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - ret = PVFS_Request_contiguous(arr_int[0], - *old_pvfs_dtype, pvfs_dtype); - break; - case MPI_COMBINER_VECTOR: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - ret = PVFS_Request_vector(arr_int[0], arr_int[1], - arr_int[2], *old_pvfs_dtype, - pvfs_dtype); - break; - case MPI_COMBINER_HVECTOR: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - ret = PVFS_Request_hvector(arr_int[0], arr_int[1], - arr_addr[0], *old_pvfs_dtype, - pvfs_dtype); - break; - /* Both INDEXED and HINDEXED types require PVFS_size - * address arrays. Therefore, we need to copy and - * convert the data from MPI_get_contents() into - * a PVFS_size buffer */ - case MPI_COMBINER_INDEXED: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - if ((pvfs_arr_disp = - ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0) - { - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate pvfs_arr_disp\n"); - } - for (i = 0; i < arr_int[0]; i++) - { - pvfs_arr_disp[i] = - (PVFS_size) arr_int[arr_int[0]+1+i]; - } - ret = PVFS_Request_indexed(arr_int[0], &arr_int[1], - pvfs_arr_disp, - *old_pvfs_dtype, pvfs_dtype); - ADIOI_Free(pvfs_arr_disp); - break; - case MPI_COMBINER_HINDEXED: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - if ((pvfs_arr_disp = - ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0) - { - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate pvfs_arr_disp\n"); - } - for (i = 0; i < arr_int[0]; i++) - { - pvfs_arr_disp[i] = - (PVFS_size) arr_addr[i]; - } - ret = PVFS_Request_hindexed(arr_int[0], &arr_int[1], - (int64_t *)&arr_addr[0], - *old_pvfs_dtype, pvfs_dtype); - ADIOI_Free(pvfs_arr_disp); - break; - case MPI_COMBINER_DUP: - leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); - ret = PVFS_Request_contiguous(1, - *old_pvfs_dtype, pvfs_dtype); - - break; - case MPI_COMBINER_INDEXED_BLOCK: - /* No native PVFS2 support for this operation currently */ - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "INDEXED_BLOCK is unsupported\n"); - break; - case MPI_COMBINER_HINDEXED_BLOCK: - /* No native PVFS2 support for this operation currently */ - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "HINDEXED_BLOCK is unsupported\n"); - break; - case MPI_COMBINER_HINDEXED_INTEGER: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "HINDEXED_INTEGER is unsupported\n"); - break; - case MPI_COMBINER_STRUCT_INTEGER: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "STRUCT_INTEGER is unsupported\n"); - break; - case MPI_COMBINER_SUBARRAY: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "SUBARRAY is unsupported\n"); - break; - case MPI_COMBINER_DARRAY: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "DARRAY is unsupported\n"); - break; - case MPI_COMBINER_F90_REAL: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "F90_REAL is unsupported\n"); - break; - case MPI_COMBINER_F90_COMPLEX: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "F90_COMPLEX is unsupported\n"); - break; - case MPI_COMBINER_F90_INTEGER: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "F90_INTEGER is unsupported\n"); - break; - case MPI_COMBINER_RESIZED: - ADIOI_Free(old_pvfs_dtype); - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "RESIZED is unsupported\n"); - break; - default: - break; - } - - if (ret != 0) - fprintf(stderr, "Error in PVFS_Request_* " - "for a derived datatype\n"); - -#ifdef DEBUG_DTYPE - print_dtype_info(combiner, - num_int, - num_addr, - num_dtype, - arr_int, - arr_addr, - arr_dtype); -#endif - - if (leaf != 1 && combiner != MPI_COMBINER_DUP) - MPI_Type_free(&arr_dtype[0]); - - ADIOI_Free(arr_int); - ADIOI_Free(arr_addr); - ADIOI_Free(arr_dtype); - - PVFS_Request_free(old_pvfs_dtype); - ADIOI_Free(old_pvfs_dtype); - - return ret; - } - else /* MPI_COMBINER_STRUCT */ - { - MPI_Aint mpi_lb = -1, mpi_extent = -1; - PVFS_offset pvfs_lb = -1; - PVFS_size pvfs_extent = -1; - int has_lb_ub = 0; - - /* When converting into a PVFS_Request_struct, we no longer - * can use MPI_LB and MPI_UB. Therfore, we have to do the - * following. - * We simply ignore all the MPI_LB and MPI_UB types and - * get the lb and extent and pass it on through a - * PVFS resized_req */ - - arr_count = 0; - for (i = 0; i < arr_int[0]; i++) - { - if (arr_dtype[i] != MPI_LB && - arr_dtype[i] != MPI_UB) - { - arr_count++; - } - } - - if (arr_int[0] != arr_count) - { - MPI_Type_get_extent(*mpi_dtype, &mpi_lb, &mpi_extent); - pvfs_lb = mpi_lb; - pvfs_extent = mpi_extent; - if ((pvfs_arr_len = ADIOI_Malloc(arr_count*sizeof(int))) - == NULL) - { - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate pvfs_arr_len\n"); - } - has_lb_ub = 1; - } - - if ((old_pvfs_dtype_arr - = ADIOI_Malloc(arr_count*sizeof(PVFS_Request))) == NULL) - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate PVFS_Requests\n"); - - if ((pvfs_arr_disp = ADIOI_Malloc(arr_count*sizeof(PVFS_size))) - == NULL) - { - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate pvfs_arr_disp\n"); - } - - arr_count = 0; - for (i = 0; i < arr_int[0]; i++) - { - if (arr_dtype[i] != MPI_LB && - arr_dtype[i] != MPI_UB) - { - leaf = convert_mpi_pvfs2_dtype( - &arr_dtype[i], &old_pvfs_dtype_arr[arr_count]); - if (leaf != 1) - MPI_Type_free(&arr_dtype[i]); - pvfs_arr_disp[arr_count] = - (PVFS_size) arr_addr[i]; - if (has_lb_ub) - { - pvfs_arr_len[arr_count] = - arr_int[i+1]; - } - arr_count++; - } - } - - /* If a MPI_UB or MPI_LB did exist, we have to - * resize the datatype */ - if (has_lb_ub) - { - PVFS_Request *tmp_pvfs_dtype = NULL; - if ((tmp_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) - fprintf(stderr, "convert_mpi_pvfs2_dtype: " - "Failed to allocate PVFS_Request\n"); - - ret = PVFS_Request_struct(arr_count, pvfs_arr_len, - pvfs_arr_disp, - old_pvfs_dtype_arr, tmp_pvfs_dtype); - if (ret != 0) - fprintf(stderr, "Error in PVFS_Request_struct\n"); - - arr_count = 0; - for (i = 0; i < arr_int[0]; i++) - { - if (arr_dtype[i] != MPI_LB && - arr_dtype[i] != MPI_UB) - { - PVFS_Request_free(&old_pvfs_dtype_arr[arr_count]); - arr_count++; - } - } - -#ifdef DEBUG_DTYPE - fprintf(stderr, "STRUCT(WITHOUT %d LB or UB)(%d,[", - arr_int[0] - arr_count, arr_count); - for (i = 0; i < arr_count; i++) - fprintf(stderr, "(%d,%Ld) ", - pvfs_arr_len[i], - pvfs_arr_disp[i]); - fprintf(stderr, "]\n"); - fprintf(stderr, "RESIZED(LB = %Ld, EXTENT = %Ld)\n", - pvfs_lb, pvfs_extent); -#endif - ret = PVFS_Request_resized(*tmp_pvfs_dtype, - pvfs_lb, pvfs_extent, pvfs_dtype); - if (ret != 0) - fprintf(stderr, "Error in PVFS_Request_resize\n"); - - PVFS_Request_free(tmp_pvfs_dtype); - ADIOI_Free(tmp_pvfs_dtype); - } - else /* No MPI_LB or MPI_UB datatypes */ - { - ret = PVFS_Request_struct(arr_int[0], &arr_int[1], - pvfs_arr_disp, - old_pvfs_dtype_arr, pvfs_dtype); - if (ret != 0) - fprintf(stderr, "Error in PVFS_Request_struct\n"); - - for (i = 0; i < arr_int[0]; i++) - { - if (arr_dtype[i] != MPI_LB && - arr_dtype[i] != MPI_UB) - PVFS_Request_free(&old_pvfs_dtype_arr[i]); - } - -#ifdef DEBUG_DTYPE - print_dtype_info(combiner, - num_int, - num_addr, - num_dtype, - arr_int, - arr_addr, - arr_dtype); -#endif - } - - ADIOI_Free(arr_int); - ADIOI_Free(arr_addr); - ADIOI_Free(arr_dtype); - - ADIOI_Free(old_pvfs_dtype_arr); - ADIOI_Free(pvfs_arr_disp); - ADIOI_Free(pvfs_arr_len); - - return ret; - } - - /* Shouldn't have gotten here */ - fprintf(stderr, "convert_mpi_pvfs2_dtype: SERIOUS ERROR\n"); - return -1; -} - -int convert_named(MPI_Datatype *mpi_dtype, - PVFS_Request *pvfs_dtype, int combiner) -{ - int ret = -1; -#ifdef DEBUG_DTYPE - fprintf(stderr, "NAMED"); -#endif - - if (MPI_CHAR == *mpi_dtype) - { - ret = PVFS_Request_contiguous(1, PVFS_CHAR, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_CHAR\n"); -#endif - } - else if ( MPI_BYTE == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_BYTE, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_BYTE\n"); -#endif - } - else if ( MPI_SHORT == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_SHORT, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_SHORT\n"); -#endif - } - else if ( MPI_INT == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_INT, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_INT\n"); -#endif - } - else if ( MPI_LONG == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_LONG, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_LONG\n"); -#endif - } - else if ( MPI_FLOAT == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_FLOAT, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_FLOAT\n"); -#endif - } - else if ( MPI_DOUBLE == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_DOUBLE, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_DOUBLE\n"); -#endif - } - else if ( MPI_UNSIGNED_CHAR == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_CHAR, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_UNSIGNED_CHAR\n"); -#endif - } - else if ( MPI_UNSIGNED_SHORT == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_UNSIGNED_SHORT\n"); -#endif - } - else if ( MPI_UNSIGNED == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_SHORT\n"); -#endif - } - else if ( MPI_UNSIGNED_LONG == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_LONG, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_UNSIGNED_LONG\n"); -#endif - } - else if ( MPI_LONG_DOUBLE == *mpi_dtype ) - { - ret = PVFS_Request_contiguous(1, PVFS_LONG_DOUBLE, pvfs_dtype); -#ifdef DEBUG_DTYPE - fprintf(stderr, "-MPI_LONG_DOUBLE\n"); -#endif - } - else - { - fprintf(stderr, "convert_named: predefined type not found"); - return -1; - } - if (ret != 0) - fprintf(stderr, "convert_named: Datatype creation failed\n"); - return ret; -} - -void print_dtype_info(int combiner, - int num_int, - int num_addr, - int num_dtype, - int *arr_int, - MPI_Aint *arr_addr, - MPI_Datatype *arr_dtype) -{ - int i = -1; - switch (combiner) - { - case MPI_COMBINER_CONTIGUOUS: - fprintf(stderr, "CONTIG(%d)\n", arr_int[0]); - break; - case MPI_COMBINER_VECTOR: - fprintf(stderr, "VECTOR(%d,%d,%d)\n", - arr_int[0], arr_int[1], arr_int[2]); - break; - case MPI_COMBINER_HVECTOR: - fprintf(stderr, "HVECTOR(%d,%d,%ld)\n", - arr_int[0], arr_int[1],arr_addr[0]); - break; - case MPI_COMBINER_INDEXED: - fprintf(stderr, "INDEXED(%d,[", - arr_int[0]); - for (i = 0; i < arr_int[0]; i++) - fprintf(stderr, "(%d,%d) ", - arr_int[1+i], - arr_int[arr_int[0]+1+i]); - fprintf(stderr, "]\n"); - break; - case MPI_COMBINER_HINDEXED: - fprintf(stderr, "HINDEXED(%d,[", - arr_int[0]); - for (i = 0; i < arr_int[0]; i++) - fprintf(stderr, "(%d,%lld) ", - arr_int[1+i], - (long long)arr_addr[i]); - fprintf(stderr, "]\n"); - break; - case MPI_COMBINER_STRUCT: - fprintf(stderr, "STRUCT(%d,[", - arr_int[0]); - for (i = 0; i < arr_int[0]; i++) - fprintf(stderr, "(%d,%lld) ", - arr_int[1+i], - (long long) arr_addr[i]); - fprintf(stderr, "]\n"); - break; - case MPI_COMBINER_DUP: - fprintf(stderr, "DUP\n"); - break; - default: - fprintf(stderr, "no available information on this datatype"); - } -} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_list.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_list.c deleted file mode 100644 index a88aaf39faa6d6c81dcbe127b4d9637c919387c5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_io_list.c +++ /dev/null @@ -1,660 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2006 Unknown (TODO: fix this) - */ - -#include <assert.h> -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" -#include "ad_pvfs2_io.h" -#include "ad_pvfs2_common.h" - -#define COALESCE_REGIONS /* TODO: would we ever want to *not* coalesce? */ -#define MAX_OL_COUNT 64 -int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code, int rw_type) -{ - /* list I/O parameters */ - int i = -1, ret = -1; - int tmp_filetype_size = -1; - int64_t cur_io_size = 0, io_size = 0; - int etype_size = -1; - int num_etypes_in_filetype = -1, num_filetypes = -1; - int etypes_in_filetype = -1, size_in_filetype = -1; - int bytes_into_filetype = 0; - MPI_Offset total_bytes_accessed = 0; - - /* parameters for offset-length pairs arrays */ - int64_t buf_off_arr[MAX_OL_COUNT]; - int32_t buf_len_arr[MAX_OL_COUNT]; - int64_t file_off_arr[MAX_OL_COUNT]; - int32_t file_len_arr[MAX_OL_COUNT]; - int32_t buf_ol_count = 0; - int32_t file_ol_count = 0; - - /* parameters for flattened memory and file datatypes*/ - int flat_buf_index = 0; - int flat_file_index = 0; - int64_t cur_flat_buf_reg_off = 0; - int64_t cur_flat_file_reg_off = 0; - ADIOI_Flatlist_node *flat_buf_p, *flat_file_p; - MPI_Count buftype_size = -1, filetype_size = -1; - MPI_Aint filetype_extent = -1, buftype_extent = -1;; - MPI_Aint filetype_lb = -1, buftype_lb = -1;; - int buftype_is_contig = -1, filetype_is_contig = -1; - - /* PVFS2 specific parameters */ - PVFS_Request mem_req, file_req; - ADIOI_PVFS2_fs * pvfs_fs; - PVFS_sysresp_io resp_io; - static char myname[] = "ADIOI_PVFS2_STRIDED_LISTIO"; - - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "Atomic noncontiguous writes" - " are not supported by PVFS2", 0); - return -1; - } - - MPI_Type_size_x(fd->filetype, &filetype_size); - if (filetype_size == 0) { - *error_code = MPI_SUCCESS; - return -1; - } - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - io_size = buftype_size*count; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - /* Flatten the memory datatype - * (file datatype has already been flattened in ADIO open - * unless it is contibuous, then we need to flatten it manually) - * and set the correct buffers for flat_buf and flat_file */ - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - if (buftype_is_contig == 0) - { - flat_buf_p = ADIOI_Flatten_and_find(datatype); - } - else - { - /* flatten and add to the list */ - flat_buf_p = (ADIOI_Flatlist_node *) ADIOI_Malloc - (sizeof(ADIOI_Flatlist_node)); - flat_buf_p->blocklens = (ADIO_Offset*)ADIOI_Malloc(sizeof(ADIO_Offset)); - flat_buf_p->indices = - (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); - /* For the buffer, we can optimize the buftype, this is not - * possible with the filetype since it is tiled */ - buftype_size = buftype_size*count; - buftype_extent = buftype_size*count; - flat_buf_p->blocklens[0] = buftype_size; - flat_buf_p->indices[0] = 0; - flat_buf_p->count = 1; - } - if (filetype_is_contig == 0) - { - /* TODO: why does avery say this should already have been - * flattened in Open, but also says contig types don't get - * flattened */ - flat_file_p = ADIOI_Flatten_and_find(fd->filetype); - } - else - { - /* flatten and add to the list */ - flat_file_p = (ADIOI_Flatlist_node *) ADIOI_Malloc - (sizeof(ADIOI_Flatlist_node)); - flat_file_p->blocklens =(ADIO_Offset*)ADIOI_Malloc(sizeof(ADIO_Offset)); - flat_file_p->indices = - (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); - flat_file_p->blocklens[0] = filetype_size; - flat_file_p->indices[0] = 0; - flat_file_p->count = 1; - } - - /* Find out where we are in the flattened filetype (the block index, - * how far into the block, and how many bytes_into_filetype) - * If the file_ptr_type == ADIO_INDIVIDUAL we will use disp, fp_ind - * to figure this out (offset should always be zero) - * If file_ptr_type == ADIO_EXPLICIT, we will use disp and offset - * to figure this out. */ - - etype_size = fd->etype_size; - num_etypes_in_filetype = filetype_size / etype_size; - if (file_ptr_type == ADIO_INDIVIDUAL) - { - int flag = 0; - /* Should have already been flattened in ADIO_Open*/ - num_filetypes = -1; - while (!flag) - { - num_filetypes++; - for (i = 0; i < flat_file_p->count; i++) - { - /* Start on a non zero-length region */ - if (flat_file_p->blocklens[i]) - { - if (fd->disp + flat_file_p->indices[i] + - (num_filetypes * filetype_extent) + - flat_file_p->blocklens[i] > fd->fp_ind && - fd->disp + flat_file_p->indices[i] <= - fd->fp_ind) - { - flat_file_index = i; - cur_flat_file_reg_off = fd->fp_ind - - (fd->disp + flat_file_p->indices[i] + - (num_filetypes * filetype_extent)); - flag = 1; - break; - } - else - bytes_into_filetype += flat_file_p->blocklens[i]; - } - } - } - /* Impossible that we don't find it in this datatype */ - assert(i != flat_file_p->count); - } - else - { - num_filetypes = (int) (offset / num_etypes_in_filetype); - etypes_in_filetype = (int) (offset % num_etypes_in_filetype); - size_in_filetype = etypes_in_filetype * etype_size; - - tmp_filetype_size = 0; - for (i=0; i<flat_file_p->count; i++) { - tmp_filetype_size += flat_file_p->blocklens[i]; - if (tmp_filetype_size > size_in_filetype) - { - flat_file_index = i; - cur_flat_file_reg_off = flat_file_p->blocklens[i] - - (tmp_filetype_size - size_in_filetype); - bytes_into_filetype = offset * filetype_size - - flat_file_p->blocklens[i]; - break; - } - } - } -#ifdef DEBUG_LIST - fprintf(stderr, "ADIOI_PVFS2_StridedListIO: (fd->fp_ind=%Ld,fd->disp=%Ld," - " offset=%Ld)\n(flat_file_index=%d,cur_flat_file_reg_off=%Ld," - "bytes_into_filetype=%d)\n", - fd->fp_ind, fd->disp, offset, flat_file_index, - cur_flat_file_reg_off, bytes_into_filetype); -#endif -#ifdef DEBUG_LIST2 - fprintf(stderr, "flat_buf:\n"); - for (i = 0; i < flat_buf_p->count; i++) - fprintf(stderr, "(offset, length) = (%Ld, %d)\n", - flat_buf_p->indices[i], - flat_buf_p->blocklens[i]); - fprintf(stderr, "flat_file:\n"); - for (i = 0; i < flat_file_p->count; i++) - fprintf(stderr, "(offset, length) = (%Ld, %d)\n", - flat_file_p->indices[i], - flat_file_p->blocklens[i]); -#endif - - /* total data written */ - cur_io_size = 0; - while (cur_io_size != io_size) - { - /* Initialize the temporarily unrolling lists and - * and associated variables */ - buf_ol_count = 0; - file_ol_count = 0; - for (i = 0; i < MAX_OL_COUNT; i++) - { - buf_off_arr[i] = 0; - buf_len_arr[i] = 0; - file_off_arr[i] = 0; - file_len_arr[i] = 0; - } - - /* Generate the offset-length pairs for a - * list I/O operation */ - gen_listio_arr(flat_buf_p, - &flat_buf_index, - &cur_flat_buf_reg_off, - buftype_size, - buftype_extent, - flat_file_p, - &flat_file_index, - &cur_flat_file_reg_off, - filetype_size, - filetype_extent, - MAX_OL_COUNT, - fd->disp, - bytes_into_filetype, - &cur_io_size, - io_size, - buf_off_arr, - buf_len_arr, - &buf_ol_count, - file_off_arr, - file_len_arr, - &file_ol_count); - - assert(buf_ol_count <= MAX_OL_COUNT); - assert(file_ol_count <= MAX_OL_COUNT); -#ifdef DEBUG_LIST2 - print_buf_file_ol_pairs(buf_off_arr, - buf_len_arr, - buf_ol_count, - file_off_arr, - file_len_arr, - file_ol_count, - buf, - rw_type); -#endif -#ifdef DEBUG_LIST2 - do { - int y, z; - fprintf(stderr, "ad_pvfs2_io_list.c::\n"); - for (y = 0; y < buf_ol_count; y++) - { - for (z = 0; z < buf_len_arr[y]; z++) - { - fprintf(stderr, "buf[%d][%d]=%c\n", - y, z, ((char *) buf + buf_off_arr[y])[z]); - } - } - } while (0); -#endif - - /* Run list I/O operation */ - ret = PVFS_Request_hindexed(buf_ol_count, buf_len_arr, - buf_off_arr, PVFS_BYTE, &mem_req); - - ret = PVFS_Request_hindexed(file_ol_count, file_len_arr, - file_off_arr, PVFS_BYTE, &file_req); - if (rw_type == READ) - { - ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, - buf, mem_req, - &(pvfs_fs->credentials), &resp_io); - } - else - { - ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, - buf, mem_req, - &(pvfs_fs->credentials), &resp_io); - } - if (ret != 0) - { - fprintf(stderr, "ADIOI_PVFS2_StridedListIO: Warning - PVFS_sys_" - "read/write returned %d and completed %lld bytes.\n", - ret, (long long)resp_io.total_completed); - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_io \n", 0); - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - goto error_state; - } - total_bytes_accessed += resp_io.total_completed; - - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - } - -#ifdef DEBUG_LIST - fprintf(stderr, "ADIOI_PVFS2_StridedListIO: " - "total_bytes_accessed=%Ld,ret=%d\n", - total_bytes_accessed, ret); -#endif - - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind += total_bytes_accessed; - *error_code = MPI_SUCCESS; - -error_state: -#ifdef HAVE_STATUS_SET_BYTES - /* TODO: why the cast? */ - MPIR_Status_set_bytes(status, datatype, total_bytes_accessed); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - if (buftype_is_contig == 0) - ADIOI_Delete_flattened(datatype); - else - { - ADIOI_Free(flat_buf_p->blocklens); - ADIOI_Free(flat_buf_p->indices); - ADIOI_Free(flat_buf_p); - } - - if (filetype_is_contig == 0) - ADIOI_Delete_flattened(fd->filetype); - else - { - ADIOI_Free(flat_file_p->blocklens); - ADIOI_Free(flat_file_p->indices); - ADIOI_Free(flat_file_p); - } - - return 0; -} - -/* To do: Fix the code to coalesce the offset-length pairs for memory - * and file. */ - -/* gen_listio_arr - fills in offset-length pairs for memory and file - * for list I/O */ -int gen_listio_arr(ADIOI_Flatlist_node *flat_buf_p, - int *flat_buf_index_p, - int64_t *cur_flat_buf_reg_off_p, - int flat_buf_size, - int flat_buf_extent, - ADIOI_Flatlist_node *flat_file_p, - int *flat_file_index_p, - int64_t *cur_flat_file_reg_off_p, - int flat_file_size, - int flat_file_extent, - int max_ol_count, - ADIO_Offset disp, - int bytes_into_filetype, - int64_t *bytes_completed, - int64_t total_io_size, - int64_t buf_off_arr[], - int32_t buf_len_arr[], - int32_t *buf_ol_count_p, - int64_t file_off_arr[], - int32_t file_len_arr[], - int32_t *file_ol_count_p) -{ - int region_size = -1; - - /* parameters for flattened memory and file datatypes*/ - int64_t cur_flat_buf_reg_left = 0; - int64_t cur_flat_file_reg_left = 0; - -#ifdef DEBUG_LIST2 - fprintf(stderr, "gen_list_arr:\n"); -#endif - - if ((*buf_ol_count_p) != 0 ||(*file_ol_count_p) != 0) - { - fprintf(stderr, "buf_ol_count != 0 || file_ol_count != 0\n"); - return -1; - } - - /* Start on a non-zero memory and file region - * Note this does not affect the bytes_completed - * since no data is in these regions. Initialize the - * first memory and file offsets. */ - while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) - { - (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % - flat_buf_p->count; - } - buf_off_arr[*buf_ol_count_p] = - (*bytes_completed / flat_buf_size) * - flat_buf_extent + - flat_buf_p->indices[*flat_buf_index_p] + - *cur_flat_buf_reg_off_p; - buf_len_arr[*buf_ol_count_p] = 0; - - while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) - { - (*flat_file_index_p) = ((*flat_file_index_p) + 1) % - flat_file_p->count; - } - file_off_arr[*file_ol_count_p] = disp + - (((bytes_into_filetype + *bytes_completed) / flat_file_size) * - flat_file_extent) + - flat_file_p->indices[*flat_file_index_p] + - *cur_flat_file_reg_off_p; - file_len_arr[*file_ol_count_p] = 0; - -#ifdef DEBUG_LIST2 - fprintf(stderr, "initial buf_off_arr[%d] = %Ld\n", *buf_ol_count_p, - buf_off_arr[*buf_ol_count_p]); - fprintf(stderr, "initial file_off_arr[%d] = %Ld\n", *file_ol_count_p, - file_off_arr[*file_ol_count_p]); -#endif - - while (*bytes_completed != total_io_size - && (*buf_ol_count_p) < max_ol_count - && (*file_ol_count_p) < max_ol_count) - { - /* How much data is left in the current piece in - * the flattened datatypes */ - cur_flat_buf_reg_left = flat_buf_p->blocklens[*flat_buf_index_p] - - *cur_flat_buf_reg_off_p; - cur_flat_file_reg_left = flat_file_p->blocklens[*flat_file_index_p] - - *cur_flat_file_reg_off_p; - -#ifdef DEBUG_LIST2 - fprintf(stderr, - "flat_buf_index=%d flat_buf->blocklens[%d]=%d\n" - "cur_flat_buf_reg_left=%Ld " - "*cur_flat_buf_reg_off_p=%Ld\n" - "flat_file_index=%d flat_file->blocklens[%d]=%d\n" - "cur_flat_file_reg_left=%Ld " - "*cur_flat_file_reg_off_p=%Ld\n" - "bytes_completed=%Ld\n" - "buf_ol_count=%d file_ol_count=%d\n" - "buf_len_arr[%d]=%d file_len_arr[%d]=%d\n\n", - *flat_buf_index_p, *flat_buf_index_p, - flat_buf_p->blocklens[*flat_buf_index_p], - cur_flat_buf_reg_left, - *cur_flat_buf_reg_off_p, - *flat_file_index_p, *flat_file_index_p, - flat_file_p->blocklens[*flat_file_index_p], - cur_flat_file_reg_left, - *cur_flat_file_reg_off_p, - *bytes_completed, - *buf_ol_count_p, *file_ol_count_p, - *buf_ol_count_p, - buf_len_arr[*buf_ol_count_p], - *file_ol_count_p, - file_len_arr[*file_ol_count_p]); -#endif - - /* What is the size of the next contiguous region agreed - * upon by both memory and file regions that does not - * surpass the file size */ - if (cur_flat_buf_reg_left > cur_flat_file_reg_left) - region_size = cur_flat_file_reg_left; - else - region_size = cur_flat_buf_reg_left; - - if (region_size > total_io_size - *bytes_completed) - region_size = total_io_size - *bytes_completed; - - /* Add this piece to both the mem and file arrays - * coalescing offset-length pairs if possible and advance - * the pointers through the flatten mem and file datatypes - * as well Note: no more than a single piece can be done - * since we take the smallest one possible */ - - if (cur_flat_buf_reg_left == region_size) - { -#ifdef DEBUG_LIST2 - fprintf(stderr, "reached end of memory block...\n"); -#endif - (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % - flat_buf_p->count; - while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) - { - (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % - flat_buf_p->count; - } - *cur_flat_buf_reg_off_p = 0; - -#ifdef COALESCE_REGIONS - if (*buf_ol_count_p != 0) - { - if (buf_off_arr[(*buf_ol_count_p) - 1] + - buf_len_arr[(*buf_ol_count_p) - 1] == - buf_off_arr[*buf_ol_count_p]) - { - buf_len_arr[(*buf_ol_count_p) - 1] += - region_size; - } - else - { - buf_len_arr[*buf_ol_count_p] += region_size; - (*buf_ol_count_p)++; - } - } - else - { -#endif - buf_len_arr[*buf_ol_count_p] += region_size; - (*buf_ol_count_p)++; -#ifdef COALESCE_REGIONS - } -#endif - - /* Don't prepare for the next piece if we have reached - * the limit or else it will segment fault. */ - if ((*buf_ol_count_p) != max_ol_count) - { - buf_off_arr[*buf_ol_count_p] = - ((*bytes_completed + region_size) / flat_buf_size) * - flat_buf_extent + - flat_buf_p->indices[*flat_buf_index_p] + - (*cur_flat_buf_reg_off_p); - buf_len_arr[*buf_ol_count_p] = 0; - } - } - else if (cur_flat_buf_reg_left > region_size) - { -#ifdef DEBUG_LIST2 - fprintf(stderr, "advanced %d in memory block...\n", - region_size); -#endif - (*cur_flat_buf_reg_off_p) += region_size; - buf_len_arr[*buf_ol_count_p] += region_size; - } - else - { - fprintf(stderr, "gen_listio_arr: Error\n"); - } - - /* To calculate the absolute file offset we need to - * add the disp, how many filetypes we have gone through, - * the relative block offset in the filetype and how far - * into the block we have gone. */ - if (cur_flat_file_reg_left == region_size) - { -#ifdef DEBUG_LIST2 - fprintf(stderr, "reached end of file block...\n"); -#endif - (*flat_file_index_p) = ((*flat_file_index_p) + 1) % - flat_file_p->count; - while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) - { - (*flat_file_index_p) = ((*flat_file_index_p) + 1) % - flat_file_p->count; - } - (*cur_flat_file_reg_off_p) = 0; - -#ifdef COALESCE_REGIONS - if (*file_ol_count_p != 0) - { - if (file_off_arr[(*file_ol_count_p) - 1] + - file_len_arr[(*file_ol_count_p) - 1] == - file_off_arr[*file_ol_count_p]) - { - file_len_arr[(*file_ol_count_p) - 1] += - region_size; - } - else - { - file_len_arr[*file_ol_count_p] += region_size; - (*file_ol_count_p)++; - } - } - else - { -#endif - file_len_arr[*file_ol_count_p] += region_size; - (*file_ol_count_p)++; -#ifdef COALESCE_REGIONS - } -#endif - - /* Don't prepare for the next piece if we have reached - * the limit or else it will segment fault. */ - if ((*file_ol_count_p) != max_ol_count) - { - file_off_arr[*file_ol_count_p] = disp + - (((bytes_into_filetype + *bytes_completed + region_size) - / flat_file_size) * - flat_file_extent) + - flat_file_p->indices[*flat_file_index_p] + - (*cur_flat_file_reg_off_p); - file_len_arr[*file_ol_count_p] = 0; - } - } - else if (cur_flat_file_reg_left > region_size) - { -#ifdef DEBUG_LIST2 - fprintf(stderr, "advanced %d in file block...\n", - region_size); -#endif - (*cur_flat_file_reg_off_p) += region_size; - file_len_arr[*file_ol_count_p] += region_size; - } - else - { - fprintf(stderr, "gen_listio_arr: Error\n"); - } -#ifdef DEBUG_LIST2 - fprintf(stderr, - "------------------------------\n\n"); -#endif - *bytes_completed += region_size; - } - /* Increment the count if we stopped in the middle of a - * memory or file region */ - if (*cur_flat_buf_reg_off_p != 0) - (*buf_ol_count_p)++; - if (*cur_flat_file_reg_off_p != 0) - (*file_ol_count_p)++; - - return 0; -} - -void print_buf_file_ol_pairs(int64_t buf_off_arr[], - int32_t buf_len_arr[], - int32_t buf_ol_count, - int64_t file_off_arr[], - int32_t file_len_arr[], - int32_t file_ol_count, - void *buf, - int rw_type) -{ - int i = -1; - - fprintf(stderr, "buf_ol_pairs(offset,length) count = %d\n", - buf_ol_count); - for (i = 0; i < buf_ol_count; i++) - { - fprintf(stderr, "(%lld, %d) ", (long long)buf_off_arr[i], buf_len_arr[i]); - } - fprintf(stderr, "\n"); - - fprintf(stderr, "file_ol_pairs(offset,length) count = %d\n", - file_ol_count); - for (i = 0; i < file_ol_count; i++) - { - fprintf(stderr, "(%lld, %d) ", (long long)file_off_arr[i], file_len_arr[i]); - } - fprintf(stderr, "\n\n"); - -} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_open.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_open.c deleted file mode 100644 index f266c88e5c9b88a1ac6d0714e58551a602a72814..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_open.c +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" -#include "ad_pvfs2_common.h" - -/* open_status is helpful for bcasting values around */ -struct open_status_s { - int error; - PVFS_object_ref object_ref; -}; -typedef struct open_status_s open_status; - - /* steps for getting a handle: (it gets a little convoluted, but at least - * it's deterministic) - * . lookup the file. - * . if lookup succeeds, but we were passed MPI_MODE_EXCL, that's an error - * . if lookup fails, the file might not exist. - * in that case, create the file if we were passed MPI_MODE_CREATE - * . if the create fails, that means someone else created the file between - * our call to lookup and our call to create (like if N processors all - * open the same file with MPI_COMM_SELF). Then we can just look up the - * file (which now exists). - * - * the good news is that only one processor does this and broadcasts the - * handle to everyone else in the communicator - */ -static void fake_an_open(PVFS_fs_id fs_id, char *pvfs_name, int access_mode, - int nr_datafiles, PVFS_size strip_size, - ADIOI_PVFS2_fs *pvfs2_fs, - open_status *o_status) -{ - int ret; - PVFS_sysresp_lookup resp_lookup; - PVFS_sysresp_getparent resp_getparent; - PVFS_sysresp_create resp_create; - PVFS_sys_attr attribs; - PVFS_sys_dist* dist; - - ADIOI_PVFS2_makeattribs(&attribs); - if (nr_datafiles > 0 ) { - attribs.dfile_count = nr_datafiles; - attribs.mask |= PVFS_ATTR_SYS_DFILE_COUNT; - } - - dist = NULL; - - memset(&resp_lookup, 0, sizeof(resp_lookup)); - memset(&resp_getparent, 0, sizeof(resp_getparent)); - memset(&resp_create, 0, sizeof(resp_create)); - - - ret = PVFS_sys_lookup(fs_id, pvfs_name, - &(pvfs2_fs->credentials), &resp_lookup, PVFS2_LOOKUP_LINK_FOLLOW); - if ( ret == (-PVFS_ENOENT)) { - if (access_mode & ADIO_CREATE) { - ret = PVFS_sys_getparent(fs_id, pvfs_name, - &(pvfs2_fs->credentials), &resp_getparent); - if (ret < 0) { - FPRINTF(stderr, "pvfs_sys_getparent returns with %d\n", ret); - o_status->error = ret; - return; - } - - /* Set the distribution strip size if specified */ - if (0 < strip_size) { - /* Note that the distribution is hardcoded here */ - dist = PVFS_sys_dist_lookup("simple_stripe"); - ret = PVFS_sys_dist_setparam(dist, - "strip_size", - &strip_size); - if (ret < 0) - { - FPRINTF(stderr, - "pvfs_sys_dist_setparam returns with %d\n", ret); - o_status->error = ret; - } - } - - /* Perform file creation */ -#ifdef HAVE_PVFS2_CREATE_WITHOUT_LAYOUT - ret = PVFS_sys_create(resp_getparent.basename, - resp_getparent.parent_ref, attribs, - &(pvfs2_fs->credentials), dist, &resp_create); -#else - ret = PVFS_sys_create(resp_getparent.basename, - resp_getparent.parent_ref, attribs, - &(pvfs2_fs->credentials), dist, NULL, &resp_create); -#endif - - /* if many creates are happening in this directory, the earlier - * sys_lookup may have returned ENOENT, but the sys_create could - * return EEXISTS. That means the file has been created anyway, so - * less work for us and we can just open it up and return the - * handle */ - if (ret == (-PVFS_EEXIST)) { - ret = PVFS_sys_lookup(fs_id, pvfs_name, - &(pvfs2_fs->credentials), &resp_lookup, - PVFS2_LOOKUP_LINK_FOLLOW); - if ( ret < 0 ) { - o_status->error = ret; - return; - } - o_status->error = ret; - o_status->object_ref = resp_lookup.ref; - return; - } - o_status->object_ref = resp_create.ref; - } else { - FPRINTF(stderr, "cannot create file without MPI_MODE_CREATE\n"); - o_status->error = ret; - return; - } - } else if (access_mode & ADIO_EXCL) { - /* lookup should not succeed if opened with EXCL */ - o_status->error = -PVFS_EEXIST; - return; - } else { - o_status->object_ref = resp_lookup.ref; - } - o_status->error = ret; - return; - -} - - -/* ADIOI_PVFS2_Open: - * one process opens (or creates) the file, then broadcasts the result to the - * remaining processors. - * - * ADIO_Open used to perform an optimization when MPI_MODE_CREATE (and before - * that, MPI_MODE_EXCL) was set. Because PVFS2 handles file lookup and - * creation more scalably than other file systems, ADIO_Open now skips any - * special handling when CREATE is set. */ -void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code) -{ - int rank, ret; - PVFS_fs_id cur_fs; - static char myname[] = "ADIOI_PVFS2_OPEN"; - char pvfs_path[PVFS_NAME_MAX] = {0}; - - ADIOI_PVFS2_fs *pvfs2_fs; - - /* since one process is doing the open, that means one process is also - * doing the error checking. define a struct for both the object reference - * and the error code to broadcast to all the processors */ - - open_status o_status = {0, {0, 0}}; - MPI_Datatype open_status_type; - MPI_Datatype types[2] = {MPI_INT, MPI_BYTE}; - int lens[2] = {1, sizeof(PVFS_object_ref)}; - MPI_Aint offsets[2]; - - pvfs2_fs = (ADIOI_PVFS2_fs *) ADIOI_Malloc(sizeof(ADIOI_PVFS2_fs)); - - /* --BEGIN ERROR HANDLING-- */ - if (pvfs2_fs == NULL) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNKNOWN, - "Error allocating memory", 0); - return; - } - /* --END ERROR HANDLING-- */ - - MPI_Comm_rank(fd->comm, &rank); - - ADIOI_PVFS2_Init(error_code); - if (*error_code != MPI_SUCCESS) - { - /* ADIOI_PVFS2_INIT handles creating error codes on its own */ - return; - } - - /* currently everyone gets their own credentials */ - ADIOI_PVFS2_makecredentials(&(pvfs2_fs->credentials)); - - /* one process resolves name and will later bcast to others */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); -#endif - if (rank == fd->hints->ranklist[0] && fd->fs_ptr == NULL) { - /* given the filename, figure out which pvfs filesystem it is on */ - ret = PVFS_util_resolve(fd->filename, &cur_fs, - pvfs_path, PVFS_NAME_MAX); - if (ret < 0 ) { - PVFS_perror("PVFS_util_resolve", ret); - /* TODO: pick a good error for this */ - o_status.error = -1; - } else { - fake_an_open(cur_fs, pvfs_path, - fd->access_mode, fd->hints->striping_factor, - fd->hints->striping_unit, - pvfs2_fs, &o_status); - } - - /* store credentials and object reference in fd */ - pvfs2_fs->object_ref = o_status.object_ref; - fd->fs_ptr = pvfs2_fs; - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); -#endif - - /* broadcast status and (possibly valid) object reference */ - MPI_Get_address(&o_status.error, &offsets[0]); - MPI_Get_address(&o_status.object_ref, &offsets[1]); - - MPI_Type_struct(2, lens, offsets, types, &open_status_type); - MPI_Type_commit(&open_status_type); - - /* Assertion: if we hit this Bcast, then all processes collectively - * called this open. - * - * That's because deferred open never happens with PVFS2. - */ - MPI_Bcast(MPI_BOTTOM, 1, open_status_type, fd->hints->ranklist[0], - fd->comm); - MPI_Type_free(&open_status_type); - - /* --BEGIN ERROR HANDLING-- */ - if (o_status.error != 0) - { - ADIOI_Free(pvfs2_fs); - fd->fs_ptr = NULL; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(o_status.error), - "Unknown error", 0); - /* TODO: FIX STRING */ - return; - } - /* --END ERROR HANDLING-- */ - - pvfs2_fs->object_ref = o_status.object_ref; - fd->fs_ptr = pvfs2_fs; - - *error_code = MPI_SUCCESS; - return; -} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read.c deleted file mode 100644 index 007b4dc3933097caed7b7e70de7a77758ff5a7c4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read.c +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" -#include "ad_pvfs2_io.h" -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - int ret; - MPI_Count datatype_size, len; - PVFS_Request file_req, mem_req; - PVFS_sysresp_io resp_io; - ADIOI_PVFS2_fs *pvfs_fs; - static char myname[] = "ADIOI_PVFS2_READCONTIG"; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in pvfs_request_contig (memory)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in pvfs_request_contig (file)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* copy individual file pointer into offset variable, continue */ - offset = fd->fp_ind; - } - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, offset, buf, - mem_req, &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_read", 0); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += (int) resp_io.total_completed; - /* TODO: WHY THE INT CAST? */ - } - fd->fp_sys_posn = offset + (int)resp_io.total_completed; - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); -#endif - - *error_code = MPI_SUCCESS; -fn_exit: - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - return; -} - -static int ADIOI_PVFS2_ReadStridedListIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - return ADIOI_PVFS2_StridedListIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, - error_code, READ); -} - -static int ADIOI_PVFS2_ReadStridedDtypeIO(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - return ADIOI_PVFS2_StridedDtypeIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code, - READ); -} - -void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* four ways (to date) that we can carry out strided i/o accesses: - * - naive posix - * - 'true' Datatype (from avery) - * - new List I/O (from avery) - * - classic List I/O (the one that's always been in ROMIO) - * I imagine we'll keep Datatype as an optional optimization, and afer a - * release or two promote it to the default - */ - int ret = -1; - - if (fd->hints->fs_hints.pvfs2.posix_read == ADIOI_HINT_ENABLE) { - ADIOI_GEN_ReadStrided(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; - } - if (fd->hints->fs_hints.pvfs2.dtype_read == ADIOI_HINT_ENABLE) { - ret = ADIOI_PVFS2_ReadStridedDtypeIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code); - - /* Fall back to list I/O if datatype I/O didn't work */ - if (ret != 0) - { - fprintf(stderr, - "Falling back to list I/O since datatype I/O failed\n"); - ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code); - } - return; - } - if (fd->hints->fs_hints.pvfs2.listio_read == ADIOI_HINT_ENABLE) { - ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; - } - /* Use classic list I/O if no hints given base case */ - - ADIOI_PVFS2_OldReadStrided(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; -} - - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c deleted file mode 100644 index 856c5b8c2fbdc86a1102a18002e378c98e666e65..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c +++ /dev/null @@ -1,909 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" - -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* offset is in units of etype relative to the filetype. */ - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, brd_size, frd_size=0, st_index=0; - int sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp, start_off, initial_off; - int flag, st_frd_size, st_n_filetypes; - - int mem_list_count, file_list_count; - PVFS_size *mem_offsets; - int64_t *file_offsets; - int *mem_lengths; - int32_t *file_lengths; - int total_blks_to_read; - - int max_mem_list, max_file_list; - - int b_blks_read; - int f_data_read; - int size_read=0, n_read_lists, extra_blks; - - int end_brd_size, end_frd_size; - int start_k, start_j, new_file_read, new_buffer_read; - int start_mem_offset; - PVFS_Request mem_req, file_req; - ADIOI_PVFS2_fs * pvfs_fs; - PVFS_sysresp_io resp_io; - int err_flag=0; - MPI_Offset total_bytes_read = 0; - static char myname[] = "ADIOI_PVFS2_ReadStrided"; - -#define MAX_ARRAY_SIZE 64 - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - /* the HDF5 tests showed a bug in this list processing code (see many many - * lines down below). We added a workaround, but common HDF5 file types - * are actually contiguous and do not need the expensive workarond */ - if (!filetype_is_contig) { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - if (flat_file->count == 1 && !buftype_is_contig) - filetype_is_contig = 1; - } - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - int64_t file_offset; - int32_t file_length; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - file_list_count = 1; - file_offset = off; - file_length = 0; - total_blks_to_read = count*flat_buf->count; - b_blks_read = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_read > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_read; - mem_offsets = (PVFS_size*)ADIOI_Malloc(mem_list_count*sizeof(PVFS_size)); - mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); - - /* TODO: CHECK RESULTS OF MEMORY ALLOCATION */ - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_read < total_blks_to_read) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = - /* TODO: fix this compiler warning */ - ((PVFS_size)buf + j*buftype_extent + flat_buf->indices[i]); - mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_length += flat_buf->blocklens[i]; - b_blks_read++; - if (!(b_blks_read % MAX_ARRAY_SIZE) || - (b_blks_read == total_blks_to_read)) { - - /* in the case of the last read list call, - adjust mem_list_count */ - if (b_blks_read == total_blks_to_read) { - mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; - /* in case last read list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } - err_flag = PVFS_Request_hindexed(mem_list_count, - mem_lengths, mem_offsets, PVFS_BYTE, &mem_req); - if (err_flag < 0) break; - err_flag = PVFS_Request_contiguous(file_length, - PVFS_BYTE, &file_req); - if (err_flag < 0) break; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, - file_offset, PVFS_BOTTOM, mem_req, - &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_read", 0); - goto error_state; - } - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - total_bytes_read += resp_io.total_completed; - /* --END ERROR HANDLING-- */ - - /* in the case of error or the last read list call, - * leave here */ - if (err_flag || b_blks_read == total_blks_to_read) break; - - file_offset += file_length; - file_length = 0; - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_read < total_blks_to_read) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind += total_bytes_read; - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This isa temporary way of filling in status. The right way is to - keep tracke of how much data was actually read adn placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - ADIOI_Delete_flattened(datatype); - - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* know file is noncontiguous from above */ - /* noncontiguous in file */ - - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - initial_off = offset; - - - /* for each case - ADIO_Individual pointer or explicit, find the file - offset in bytes (offset), n_filetypes (how many filetypes into - file to start), frd_size (remaining amount of data in present - file block), and st_index (start point in terms of blocks in - starting filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - frd_size = (int) (disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - int mem_length=0; - intptr_t mem_offset; - - i = 0; - j = st_index; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to read */ - f_data_read = ADIOI_MIN(st_frd_size, bufsize); - total_blks_to_read = 1; - if (j < (flat_file->count-1)) j++; - else { - j = 0; - n_filetypes++; - } - while (f_data_read < bufsize) { - f_data_read += flat_file->blocklens[j]; - total_blks_to_read++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_read%MAX_ARRAY_SIZE; - - mem_offset = (intptr_t)buf; - mem_lengths = 0; - - /* if at least one full readlist, allocate file arrays - at max array size and don't free until very end */ - if (n_read_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int32_t)); - } - /* if there's no full readlist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* - sizeof(int32_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_read_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_frd_size; - mem_length = st_frd_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_lengths += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ - err_flag = PVFS_Request_contiguous(mem_length, - PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_contiguous (memory)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, - &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (file)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* PVFS_Request_hindexed already expresses the offsets into the - * file, so we should not pass in an offset if we are using - * hindexed for the file type */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, - (void *)mem_offset, mem_req, - &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_read", 0); - goto error_state; - } - /* --END ERROR HANDING-- */ - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - - total_bytes_read += resp_io.total_completed; - - mem_offset += mem_length; - mem_lengths = 0; - } /* for (i=0; i<n_read_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = ADIOI_MIN(st_frd_size, bufsize); - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent + - flat_file->indices[j]; - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - (int32_t) mem_lengths - - mem_offset + (int32_t) buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ - err_flag = PVFS_Request_contiguous(mem_length, - PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_contiguous (memory)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (file)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* as above, use 0 for 'offset' when using hindexed file type */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, - (void *)mem_offset, mem_req, &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_read", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - total_bytes_read += resp_io.total_completed; - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fakes filling the readlist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_read += new_buffer_read; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_read < bufsize) */ - - /* one last check before we actually carry out the operation: - * this code has hard-to-fix bugs when a noncontiguous file type has - * such large pieces that the sum of the lengths of the memory type is - * not larger than one of those pieces (and vice versa for large memory - * types and many pices of file types. In these cases, give up and - * fall back to naive reads and writes. The testphdf5 test created a - * type with two very large memory regions and 600 very small file - * regions. The same test also created a type with one very large file - * region and many (700) very small memory regions. both cases caused - * problems for this code */ - - if ( ( (file_list_count == 1) && - (new_file_read < flat_file->blocklens[0] ) ) || - ((mem_list_count == 1) && - (new_buffer_read < flat_buf->blocklens[0]) ) || - ((file_list_count == MAX_ARRAY_SIZE) && - (new_file_read < flat_buf->blocklens[0]) ) || - ( (mem_list_count == MAX_ARRAY_SIZE) && - (new_buffer_read < flat_file->blocklens[0])) ) - { - - ADIOI_Delete_flattened(datatype); - ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype, - file_ptr_type, initial_off, status, error_code); - return; - } - - mem_offsets = (PVFS_size*)ADIOI_Malloc(max_mem_list*sizeof(PVFS_size)); - mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); - file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); - file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_frd_size and new_brd_size */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fills the allocated readlist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - mem_offsets[i] = ((PVFS_size)buf + buftype_extent* - (buf_count/flat_buf->count) + - (int)flat_buf->indices[k]); - if(!i) { - mem_lengths[0] = brd_size; - mem_offsets[0] += flat_buf->blocklens[k] - brd_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_brd_size; - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + - ((ADIO_Offset)n_filetypes) * filetype_extent; - if (!i) { - file_lengths[0] = frd_size; - file_offsets[0] += flat_file->blocklens[j] - frd_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_frd_size; - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - err_flag = PVFS_Request_hindexed(mem_list_count, mem_lengths, - mem_offsets, PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (memory)", 0); - goto error_state; - } - /* -- END ERROR HANDLING-- */ - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (file)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* offset will be expressed in memory and file datatypes */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, - PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_read", 0); - } - /* --END ERROR HANDLING-- */ - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - total_bytes_read += resp_io.total_completed; - size_read += new_buffer_read; - start_k = k; - start_j = j; - } /* while (size_read < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - /* Other ADIO routines will convert absolute bytes into counts of datatypes */ - /* when incrementing fp_ind, need to also take into account the file type: - * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| - * if we wrote N elements, offset needs to point at beginning of type, not - * at empty region at offset N+1) - * - * As we discussed on mpich-discuss in may/june 2009, the code below might - * look wierd, but by putting fp_ind at the last byte written, the next - * time we run through the strided code we'll update the fp_ind to the - * right location. */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind = file_offsets[file_list_count-1]+ - file_lengths[file_list_count-1]; - } - - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - if (err_flag == 0) *error_code = MPI_SUCCESS; - -error_state: - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} - diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write.c deleted file mode 100644 index 93e142bb6874e3daf317fab63db27ea615ca2903..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs2.h" -#include "adio_extern.h" -#include "ad_pvfs2_io.h" -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - int ret; - MPI_Count datatype_size, len; - PVFS_Request file_req, mem_req; - PVFS_sysresp_io resp_io; - ADIOI_PVFS2_fs *pvfs_fs; - static char myname[] = "ADIOI_PVFS2_WRITECONTIG"; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_Request_contiguous (memory)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_Request_contiguous (file)", 0); - return; - } - /* --END ERROR HANDLING-- */ - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, offset, (void *)buf, - mem_req, &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_write", 0); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - fd->fp_sys_posn = offset + (int) resp_io.total_completed; - } - else { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, fd->fp_ind, (void *)buf, - mem_req, &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_write", 0); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - fd->fp_ind += (int)resp_io.total_completed; - fd->fp_sys_posn = fd->fp_ind; - } -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); -#endif - *error_code = MPI_SUCCESS; -fn_exit: - PVFS_Request_free(&file_req); - PVFS_Request_free(&mem_req); - return; -} - -int ADIOI_PVFS2_WriteStridedListIO(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - return ADIOI_PVFS2_StridedListIO(fd, (void *)buf, count, - datatype, file_ptr_type, - offset, status, - error_code, WRITE); -} - -int ADIOI_PVFS2_WriteStridedDtypeIO(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - return ADIOI_PVFS2_StridedDtypeIO(fd, (void *)buf, count, - datatype, file_ptr_type, - offset, status, error_code, - WRITE); -} - - -void ADIOI_PVFS2_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - /* four ways (to date) that we can carry out strided i/o accesses: - * - naive posix - * - 'true' Datatype (from avery) - * - new List I/O (from avery) - * - classic List I/O (the one that's always been in ROMIO) - * I imagine we'll keep Datatype as an optional optimization, and afer a - * release or two promote it to the default - */ - - /* a lot of near-duplication from ADIOI_PVFS2_ReadStrided: for - * debugging/testing it's helpful to be able to turn on and off these - * optimizations separately for the read and write cases */ - int ret = -1; - if ( fd->hints->fs_hints.pvfs2.posix_write == ADIOI_HINT_ENABLE) { - ADIOI_GEN_WriteStrided_naive(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code); - return; - } - if ( fd->hints->fs_hints.pvfs2.dtype_write == ADIOI_HINT_ENABLE) { - ret = ADIOI_PVFS2_WriteStridedDtypeIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code); - - /* Fall back to list I/O if datatype I/O didn't work */ - if (ret != 0) - { - fprintf(stderr, - "Falling back to list I/O since datatype I/O failed\n"); - ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, - datatype, file_ptr_type, - offset, status, error_code); - } - return; - } - /* Use list I/O in the base case */ - if (fd->hints->fs_hints.pvfs2.listio_write == ADIOI_HINT_ENABLE) { - ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; - } - - /* Use classic list I/O if no hints given base case */ - ADIOI_PVFS2_OldWriteStrided(fd, buf, count, datatype, - file_ptr_type, offset, status, error_code); - return; -} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c deleted file mode 100644 index 7a9758c30e37083f4643f7d8b19d3e87c5c1bb6a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c +++ /dev/null @@ -1,963 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_pvfs2.h" - -#include "ad_pvfs2_common.h" - -void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - /* as with all the other WriteStrided functions, offset is in units of - * etype relative to the filetype */ - - /* Since PVFS2 does not support file locking, can't do buffered writes - as on Unix */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, bwr_size, fwr_size=0, st_index=0; - int sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp, start_off, initial_off; - int flag, st_fwr_size, st_n_filetypes; - int err_flag=0; - - int mem_list_count, file_list_count; - PVFS_size * mem_offsets; - int64_t *file_offsets; - int *mem_lengths; - int32_t *file_lengths; - int total_blks_to_write; - - int max_mem_list, max_file_list; - - int b_blks_wrote; - int f_data_wrote; - int size_wrote=0, n_write_lists, extra_blks; - - int end_bwr_size, end_fwr_size; - int start_k, start_j, new_file_write, new_buffer_write; - int start_mem_offset; - PVFS_Request mem_req, file_req; - ADIOI_PVFS2_fs * pvfs_fs; - PVFS_sysresp_io resp_io; - MPI_Offset total_bytes_written=0; - static char myname[] = "ADIOI_PVFS2_WRITESTRIDED"; - - /* note: don't increase this: several parts of PVFS2 now - * assume this limit*/ -#define MAX_ARRAY_SIZE 64 - - /* --BEGIN ERROR HANDLING-- */ - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "Atomic noncontiguous writes are not supported by PVFS2", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - /* the HDF5 tests showed a bug in this list processing code (see many many - * lines down below). We added a workaround, but common HDF5 file types - * are actually contiguous and do not need the expensive workarond */ - if (!filetype_is_contig) { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - if (flat_file->count == 1 && !buftype_is_contig) - filetype_is_contig = 1; - } - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - int64_t file_offset; - int32_t file_length; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; - } - else off = fd->fp_ind; - - file_list_count = 1; - file_offset = off; - file_length = 0; - total_blks_to_write = count*flat_buf->count; - b_blks_wrote = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_write > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_write; - mem_offsets = (PVFS_size*)ADIOI_Malloc(mem_list_count*sizeof(PVFS_size)); - mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_wrote < total_blks_to_write) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = - /* TODO: fix this warning by casting to an integer that's - * the same size as a char * and /then/ casting to - * PVFS_size */ - ((PVFS_size)buf + j*buftype_extent + flat_buf->indices[i]); - mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_length += flat_buf->blocklens[i]; - b_blks_wrote++; - if (!(b_blks_wrote % MAX_ARRAY_SIZE) || - (b_blks_wrote == total_blks_to_write)) { - - /* in the case of the last write list call, - adjust mem_list_count */ - if (b_blks_wrote == total_blks_to_write) { - mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; - /* in case last write list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } - err_flag = PVFS_Request_hindexed(mem_list_count, - mem_lengths, mem_offsets, - PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (memory)", 0); - break; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_contiguous(file_length, - PVFS_BYTE, &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_contiguous (file)", 0); - break; - } - /* --END ERROR HANDLING-- */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, - file_offset, PVFS_BOTTOM, - mem_req, - &(pvfs_fs->credentials), - &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - total_bytes_written += resp_io.total_completed; - - /* in the case of error or the last write list call, - * leave here */ - /* --BEGIN ERROR HANDLING-- */ - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_write", 0); - break; - } - /* --END ERROR HANDLING-- */ - if (b_blks_wrote == total_blks_to_write) break; - - file_offset += file_length; - file_length = 0; - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_wrote < total_blks_to_write) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind += total_bytes_written; - - if (!err_flag) *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* clear this. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - ADIOI_Delete_flattened(datatype); - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* already know that file is noncontiguous from above */ - /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - initial_off = offset; - - /* for each case - ADIO_Individual pointer or explicit, find offset - (file offset in bytes), n_filetypes (how many filetypes into file - to start), fwr_size (remaining amount of data in present file - block), and st_index (start point in terms of blocks in starting - filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - int mem_length; - intptr_t mem_offset; - - i = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to write */ - f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize); - total_blks_to_write = 1; - if (j < (flat_file->count -1)) j++; - else { - j = 0; - n_filetypes++; - } - while (f_data_wrote < bufsize) { - f_data_wrote += flat_file->blocklens[j]; - total_blks_to_write++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_write_lists = total_blks_to_write/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_write%MAX_ARRAY_SIZE; - - mem_offset = (intptr_t) buf; - mem_length = 0; - - /* if at least one full writelist, allocate file arrays - at max array size and don't free until very end */ - if (n_write_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int32_t)); - } - /* if there's no full writelist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* - sizeof(int32_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_write_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_fwr_size; - mem_length = st_fwr_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_length += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ - - err_flag = PVFS_Request_contiguous(mem_length, - PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_contiguous (memory)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, - &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (file)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* PVFS_Request_hindexed already expresses the offsets into the - * file, so we should not pass in an offset if we are using - * hindexed for the file type */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, - (void *)mem_offset, mem_req, - &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - total_bytes_written += resp_io.total_completed; - - mem_offset += mem_length; - mem_lengths = 0; - PVFS_Request_free(&file_req); - PVFS_Request_free(&mem_req); - - } /* for (i=0; i<n_write_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last write_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = ADIOI_MIN(st_fwr_size, bufsize); - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent + - flat_file->indices[j]; - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - (int32_t) mem_lengths - - mem_offset + (int32_t) buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ - - err_flag = PVFS_Request_contiguous(mem_length, - PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_contiguous (memory)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, - &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed(file)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* as above, use 0 for 'offset' when using hindexed file type*/ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, - (void *)mem_offset, mem_req, - &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - total_bytes_written += resp_io.total_completed; - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - } - } - else { - /* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data written and data to be - written in the next immediate write list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fakes filling the writelist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_wrote += new_buffer_write; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_wrote < bufsize) */ - - /* one last check before we actually carry out the operation: - * this code has hard-to-fix bugs when a noncontiguous file type has - * such large pieces that the sum of the lengths of the memory type is - * not larger than one of those pieces (and vice versa for large memory - * types and many pices of file types. In these cases, give up and - * fall back to naive reads and writes. The testphdf5 test created a - * type with two very large memory regions and 600 very small file - * regions. The same test also created a type with one very large file - * region and many (700) very small memory regions. both cases caused - * problems for this code */ - - if ( ( (file_list_count == 1) && - (new_file_write < flat_file->blocklens[0] ) ) || - ((mem_list_count == 1) && - (new_buffer_write < flat_buf->blocklens[0]) ) || - ((file_list_count == MAX_ARRAY_SIZE) && - (new_file_write < flat_buf->blocklens[0]) ) || - ( (mem_list_count == MAX_ARRAY_SIZE) && - (new_buffer_write < flat_file->blocklens[0])) ) - { - ADIOI_Delete_flattened(datatype); - ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype, - file_ptr_type, initial_off, status, error_code); - return; - } - - - mem_offsets = (PVFS_size*)ADIOI_Malloc(max_mem_list*sizeof(PVFS_size)); - mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); - file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); - file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_fwr_size and new_bwr_size */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data written and data to be - written in the next immediate write list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fills the allocated writelist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - /* TODO: fix this warning by casting to an integer that's the - * same size as a char * and /then/ casting to PVFS_size */ - mem_offsets[i] = ((PVFS_size)buf + buftype_extent* - (buf_count/flat_buf->count) + - (int)flat_buf->indices[k]); - - if(!i) { - mem_lengths[0] = bwr_size; - mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_bwr_size; - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + - ((ADIO_Offset)n_filetypes) * filetype_extent; - if (!i) { - file_lengths[0] = fwr_size; - file_offsets[0] += flat_file->blocklens[j] - fwr_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_fwr_size; - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - - err_flag = PVFS_Request_hindexed(mem_list_count, mem_lengths, - mem_offsets, PVFS_BYTE, &mem_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed (memory)", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, - file_offsets, PVFS_BYTE, - &file_req); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_Request_hindexed", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - /* offset will be expressed in memory and file datatypes */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, - PVFS_BOTTOM, mem_req, - &(pvfs_fs->credentials), &resp_io); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(err_flag), - "Error in PVFS_sys_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - - size_wrote += new_buffer_write; - total_bytes_written += resp_io.total_completed; - start_k = k; - start_j = j; - PVFS_Request_free(&mem_req); - PVFS_Request_free(&file_req); - } /* while (size_wrote < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - /* when incrementing fp_ind, need to also take into account the file type: - * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| - * if we wrote N elements, offset needs to point at beginning of type, not - * at empty region at offset N+1). - * - * As we discussed on mpich-discuss in may/june 2009, the code below might - * look wierd, but by putting fp_ind at the last byte written, the next - * time we run through the strided code we'll update the fp_ind to the - * right location. */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind = file_offsets[file_list_count-1]+ - file_lengths[file_list_count-1]; - } - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - *error_code = MPI_SUCCESS; - -error_state: - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/ad_sfs/Makefile.mk b/3rd-party/romio321/adio/ad_sfs/Makefile.mk deleted file mode 100644 index 2db1ac26cbe690d6de8c3faa864cf5fad4a362f8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/Makefile.mk +++ /dev/null @@ -1,19 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_SFS - -noinst_HEADERS += adio/ad_sfs/ad_sfs.h - -romio_other_sources += \ - adio/ad_sfs/ad_sfs_open.c \ - adio/ad_sfs/ad_sfs_fcntl.c \ - adio/ad_sfs/ad_sfs_flush.c \ - adio/ad_sfs/ad_sfs.c - -endif BUILD_AD_SFS - diff --git a/3rd-party/romio321/adio/ad_sfs/README b/3rd-party/romio321/adio/ad_sfs/README deleted file mode 100644 index 933677b17700a197403f8a280084806bcb2f029f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/README +++ /dev/null @@ -1 +0,0 @@ -This code is no longer supported. diff --git a/3rd-party/romio321/adio/ad_sfs/ad_sfs.c b/3rd-party/romio321/adio/ad_sfs/ad_sfs.c deleted file mode 100644 index c4c1609dd29b502e7ce4ccd823d3000345556030..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/ad_sfs.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_SFS_operations = { - ADIOI_SFS_Open, /* Open */ - ADIOI_GEN_ReadContig, /* ReadContig */ - ADIOI_GEN_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_SFS_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_SFS_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_sfs/ad_sfs.h b/3rd-party/romio321/adio/ad_sfs/ad_sfs.h deleted file mode 100644 index 9f029f05580b6a713b38197dd2a5d4d33a429b59..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/ad_sfs.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_SFS_INCLUDE -#define AD_SFS_INCLUDE - -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> -#include "adio.h" - -void ADIOI_SFS_Open(ADIO_File fd, int *error_code); -void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_SFS_Flush(ADIO_File fd, int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_sfs/ad_sfs_fcntl.c b/3rd-party/romio321/adio/ad_sfs/ad_sfs_fcntl.c deleted file mode 100644 index 533e26a77b61dc036c1e0b813b48cb87090cc85f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/ad_sfs_fcntl.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" -#include "adio_extern.h" - -void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - int i, ntimes, len; - ADIO_Offset curr_fsize, alloc_size, size, done; - ADIO_Status status; - char *buf; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_SFS_FCNTL"; -#endif - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - /* On SFS, I find that a write from one process, which changes - the file size, does not automatically make the new file size - visible to other processes. Therefore, a sync-barrier-sync is - needed. (Other processes are able to read the data written - though; only file size is returned incorrectly.) */ - - fsync(fd->fd_sys); - MPI_Barrier(fd->comm); - fsync(fd->fd_sys); - - fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - llseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - if (fcntl_struct->fsize == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(fd, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_SFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} diff --git a/3rd-party/romio321/adio/ad_sfs/ad_sfs_flush.c b/3rd-party/romio321/adio/ad_sfs/ad_sfs_flush.c deleted file mode 100644 index 8fc7e358cf6e152604501fe32fbbad0b36081965..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/ad_sfs_flush.c +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_Flush(ADIO_File fd, int *error_code) -{ -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_SFS_FLUSH"; -#endif - - /* there is no fsync on SX-4 */ -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 1, - myname, (char *) 0, (char *) 0); - ADIOI_Error(fd, *error_code, myname); -#endif -} diff --git a/3rd-party/romio321/adio/ad_sfs/ad_sfs_open.c b/3rd-party/romio321/adio/ad_sfs/ad_sfs_open.c deleted file mode 100644 index ebeefdcbcbac0be9c955bc5e6220e1efe923f2a9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_sfs/ad_sfs_open.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_Open(ADIO_File fd, int *error_code) -{ - int perm, old_mask, amode; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_SFS_OPEN"; -#endif - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - fd->fd_sys = open(fd->filename, amode, perm); - fd->fd_direct = -1; - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { - fd->fp_ind = llseek(fd->fd_sys, 0, SEEK_END); - fd->fp_sys_posn = fd->fp_ind; - } - - if (fd->fd_sys == -1) { -#ifdef MPICH - *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); -#elif defined(PRINT_ERR_MSG) - *error_code = MPI_ERR_UNKNOWN; -#else /* MPICH-1 */ - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, - myname, "I/O Error", "%s", strerror(errno)); - ADIOI_Error(ADIO_FILE_NULL, *error_code, myname); -#endif - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs.c deleted file mode 100644 index 6696847c3e1ecafdc8808bdb80b6ac274c0f37f0..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs.c +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_TESTFS_operations = { - ADIOI_TESTFS_Open, /* Open */ - ADIOI_GEN_OpenColl, /* OpenColl */ - ADIOI_TESTFS_ReadContig, /* ReadContig */ - ADIOI_TESTFS_WriteContig, /* WriteContig */ - ADIOI_TESTFS_ReadStridedColl, /* ReadStridedColl */ - ADIOI_TESTFS_WriteStridedColl, /* WriteStridedColl */ - ADIOI_TESTFS_SeekIndividual, /* SeekIndividual */ - ADIOI_TESTFS_Fcntl, /* Fcntl */ - ADIOI_TESTFS_SetInfo, /* SetInfo */ - ADIOI_TESTFS_ReadStrided, /* ReadStrided */ - ADIOI_TESTFS_WriteStrided, /* WriteStrided */ - ADIOI_TESTFS_Close, /* Close */ - ADIOI_TESTFS_IreadContig, /* IreadContig */ - ADIOI_TESTFS_IwriteContig, /* IwriteContig */ - ADIOI_TESTFS_ReadDone, /* ReadDone */ - ADIOI_TESTFS_WriteDone, /* WriteDone */ - ADIOI_TESTFS_ReadComplete, /* ReadComplete */ - ADIOI_TESTFS_WriteComplete, /* WriteComplete */ - ADIOI_TESTFS_IreadStrided, /* IreadStrided */ - ADIOI_TESTFS_IwriteStrided, /* IwriteStrided */ - ADIOI_TESTFS_Flush, /* Flush */ - ADIOI_TESTFS_Resize, /* Resize */ - ADIOI_TESTFS_Delete, /* Delete */ - ADIOI_GEN_Feature, /* Features */ - "TESTFS: the logging-only file system", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs.h b/3rd-party/romio321/adio/ad_testfs/ad_testfs.h deleted file mode 100644 index 7f51ced0d2dd61233626c2396fa24ee0a6b9ce2d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_TESTFS_INCLUDE -#define AD_TESTFS_INCLUDE - -#include "adio.h" -#include <unistd.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <fcntl.h> - -void ADIOI_TESTFS_Open(ADIO_File fd, int *error_code); -void ADIOI_TESTFS_Close(ADIO_File fd, int *error_code); -void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_TESTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_TESTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_TESTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code); -void ADIOI_TESTFS_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_TESTFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_TESTFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_TESTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_TESTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIOI_TESTFS_Get_shared_fp(ADIO_File fd, int size, - ADIO_Offset *shared_fp, - int *error_code); -void ADIOI_TESTFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, - int *error_code); -void ADIOI_TESTFS_Delete(const char *filename, int *error_code); - -#endif - - - - diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_done.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs_done.c deleted file mode 100644 index 2ee3111587e644e7fc17887f67470d7a6fa49ca9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_done.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" - -int ADIOI_TESTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadDone called on ADIO_REQUEST_NULL\n", - myrank, nprocs); - return 1; -} - - -int ADIOI_TESTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); - FPRINTF(stdout, - "[%d/%d] ADIOI_TESTFS_WriteDone called on ADIO_REQUEST_NULL\n", - myrank, nprocs); - return 1; -} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_fcntl.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs_fcntl.c deleted file mode 100644 index 8b1e516d9a295a2a617d0705574037f4bb338bcc..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_fcntl.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" -#include "adio_extern.h" - -void ADIOI_TESTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - int myrank, nprocs; - static char myname[] = "ADIOI_TESTFS_FCNTL"; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Fcntl called on %s\n", - myrank, nprocs, fd->filename); - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = 0; - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_getsh.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs_getsh.c deleted file mode 100644 index 2bdb3dceb800488f2be52ece0e5eb379d6290251..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_getsh.c +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" - -void ADIOI_TESTFS_Get_shared_fp(ADIO_File fd, int size, - ADIO_Offset *shared_fp, - int *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Get_shared_fp called on %s\n", - myrank, nprocs, fd->filename); -} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_seek.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs_seek.c deleted file mode 100644 index 9366a1215e5dd554a0ec262fda899162896d14ce..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_seek.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" -#include "adio_extern.h" - -/* ADIOI_TESTFS_SeekIndividual() - * - * Implements SEEK_SET only (and doesn't test for whence type); all - * other types of whence must be converted before calling this. - * - * Returns an absolute offset in bytes. The offset passed into the call is in - * terms of the etype relative to the filetype, so some calculations are - * necessary. - */ -ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code) -{ - int myrank, nprocs; - - ADIO_Offset off; - ADIOI_Flatlist_node *flat_file; - int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0, sum; - int size_in_filetype; - int filetype_is_contig; - MPI_Count filetype_size; - MPI_Aint etype_size, filetype_extent, lb; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_SeekIndividual called on %s\n", - myrank, nprocs, fd->filename); - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - etype_size = fd->etype_size; - - if (filetype_is_contig) off = fd->disp + etype_size * offset; - else { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { - *error_code = MPI_SUCCESS; - return 0; - } - - n_etypes_in_filetype = filetype_size/etype_size; - ADIOI_Assert((offset / n_etypes_in_filetype) == (int) (offset / n_etypes_in_filetype)); - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - - if (sum > size_in_filetype) { - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - off = fd->disp + (ADIO_Offset)n_filetypes * (ADIO_Offset)filetype_extent + - abs_off_in_filetype; - } - - fd->fp_ind = off; - - return off; -} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_write.c b/3rd-party/romio321/adio/ad_testfs/ad_testfs_write.c deleted file mode 100644 index e1a59ff0101e9c13dad10f6de60cc5294a12b8dd..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_write.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" - -void ADIOI_TESTFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - MPI_Count datatype_size; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - MPI_Type_size_x(datatype, &datatype_size); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteContig called on %s\n", myrank, - nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] writing (buf = %p, loc = %lld, sz = %lld)\n", - myrank, nprocs, buf, (long long) offset, - (long long)datatype_size * (long long)count); - - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - fd->fp_ind += datatype_size * count; - fd->fp_sys_posn = fd->fp_ind; - FPRINTF(stdout, "[%d/%d] new file position is %lld\n", myrank, - nprocs, (long long) fd->fp_ind); - } - else { - fd->fp_sys_posn = offset + datatype_size * count; - } - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, datatype_size * count); -#endif -} - -void ADIOI_TESTFS_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteStrided called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_WriteStrided\n", - myrank, nprocs); - - ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); -} diff --git a/3rd-party/romio321/adio/ad_ufs/ad_ufs.c b/3rd-party/romio321/adio/ad_ufs/ad_ufs.c deleted file mode 100644 index a7134dce0b08cf9b110c6e8d96b04a90426a3f8b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ufs/ad_ufs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_UFS_operations = { - ADIOI_UFS_Open, /* Open */ - ADIOI_GEN_OpenColl, /* OpenColl */ - ADIOI_GEN_ReadContig, /* ReadContig */ - ADIOI_GEN_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_GEN_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ -#ifdef ROMIO_HAVE_WORKING_AIO - ADIOI_GEN_IreadContig, /* IreadContig */ - ADIOI_GEN_IwriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif - ADIOI_GEN_IODone, /* ReadDone */ - ADIOI_GEN_IODone, /* WriteDone */ - ADIOI_GEN_IOComplete, /* ReadComplete */ - ADIOI_GEN_IOComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_GEN_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_Feature, /* Features */ - "UFS: Generic ROMIO driver for all UNIX-like file systems", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_ufs/ad_ufs.h b/3rd-party/romio321/adio/ad_ufs/ad_ufs.h deleted file mode 100644 index 72d66f853bf39492a874101f39d5c368a10c8a32..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ufs/ad_ufs.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_UNIX_INCLUDE -#define AD_UNIX_INCLUDE - -#include "adio.h" -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> - -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_AIO_LITE_H -#include <aio-lite.h> -#else - #ifdef HAVE_AIO_H - #include <aio.h> - #endif - #ifdef HAVE_SYS_AIO_H - #include <sys/aio.h> - #endif -#endif - -/* Workaround for incomplete set of definitions if __REDIRECT is not - defined and large file support is used in aio.h */ -#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) -#define aiocb aiocb64 -#endif - -int ADIOI_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle); - -void ADIOI_UFS_Open(ADIO_File fd, int *error_code); -void ADIOI_UFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_UFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_UFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_UFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_UFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_UFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_UFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_ufs/ad_ufs_open.c b/3rd-party/romio321/adio/ad_ufs/ad_ufs_open.c deleted file mode 100644 index 9d5a2a1174171ef045dca449b9f872d2d5879929..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_ufs/ad_ufs_open.c +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_Open(ADIO_File fd, int *error_code) -{ - int perm, old_mask, amode; - static char myname[] = "ADIOI_UFS_OPEN"; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); -#endif - fd->fd_sys = open(fd->filename, amode, perm); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); -#endif - fd->fd_direct = -1; - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - - if (fd->fd_sys == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs.c deleted file mode 100644 index f43e0e86b7c8649f150c19655dad1c707b2b9934..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_XFS_operations = { - ADIOI_XFS_Open, /* Open */ - ADIOI_GEN_OpenColl, /* OpenColl */ - ADIOI_XFS_ReadContig, /* ReadContig */ - ADIOI_XFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_XFS_Fcntl, /* Fcntl */ - ADIOI_XFS_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_GEN_Close, /* Close */ -#if defined(ROMIO_HAVE_WORKING_AIO) - ADIOI_GEN_IreadContig, /* IreadContig */ - ADIOI_GEN_IwriteContig, /* IwriteContig */ -#else - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ -#endif /* ROMIO_HAVE_WORKING_AIO */ - ADIOI_GEN_IODone, /* ReadDone */ - ADIOI_GEN_IODone, /* WriteDone */ - ADIOI_GEN_IOComplete, /* ReadComplete */ - ADIOI_GEN_IOComplete, /* WriteComplete */ - ADIOI_GEN_IreadStrided, /* IreadStrided */ - ADIOI_GEN_IwriteStrided, /* IwriteStrided */ - ADIOI_GEN_Flush, /* Flush */ - ADIOI_XFS_Resize, /* Resize */ - ADIOI_GEN_Delete, /* Delete */ - ADIOI_GEN_Feature, /* Features */ - "XFS: SGI XFS", - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs.h b/3rd-party/romio321/adio/ad_xfs/ad_xfs.h deleted file mode 100644 index d14858d4aa5f7d4010d7672e77d178695c5925bd..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_XFS_INCLUDE -#define AD_XFS_INCLUDE - -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> -#include "adio.h" - -#if defined(MPISGI) -#include "xfs/xfs_fs.h" -#ifndef __USE_LARGEFILE64 -#define __USE_LARGEFILE64 -#endif -typedef struct aiocb64 aiocb64_t; -#endif - -void ADIOI_XFS_Open(ADIO_File fd, int *error_code); -void ADIOI_XFS_Close(ADIO_File fd, int *error_code); -void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_fcntl.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_fcntl.c deleted file mode 100644 index 1f19081afca8debc8be5cb5820daf53cfe97716c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_fcntl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" -#include "adio_extern.h" -#include <sys/ioctl.h> - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif - -void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) -{ - int i, err; -#if defined(LINUX) && defined(MPISGI) - struct xfs_flock64 fl; -#else - struct flock64 fl; -#endif - static char myname[] = "ADIOI_XFS_FCNTL"; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END); - if (fcntl_struct->fsize == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - i = 0; - fl.l_start = 0; - fl.l_whence = SEEK_SET; - fl.l_len = fcntl_struct->diskspace; - -#if defined(LINUX) && defined(MPISGI) - err = ioctl(fd->fd_sys, XFS_IOC_RESVSP64, &fl); -#else - err = fcntl(fd->fd_sys, F_RESVSP64, &fl); -#endif - - if (err) i = 1; - if (fcntl_struct->diskspace > lseek64(fd->fd_sys, 0, SEEK_END)) { - /* also need to set the file size */ - err = ftruncate64(fd->fd_sys, fcntl_struct->diskspace); - if (err) i = 1; - } - - if (i == 1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - return; - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_hints.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_hints.c deleted file mode 100644 index 0fe0e832f4c38e878ea792b49984fc5b7bc26fd6..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_hints.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" -#include "adio_extern.h" - -static unsigned xfs_direct_read_chunk_size; -static unsigned xfs_direct_write_chunk_size; - -void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value, * c; - int flag; - static char xfs_initialized = 0; - - if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); - - ADIOI_Info_set(fd->info, "direct_read", "false"); - ADIOI_Info_set(fd->info, "direct_write", "false"); - fd->direct_read = fd->direct_write = 0; - - if (!xfs_initialized) { - xfs_initialized = 1; - c = getenv("MPIO_DIRECT_READ_CHUNK_SIZE"); - if (c) { - int io; - io = atoi(c); - if (io <= 0) { - fprintf(stderr, -"MPI: Ignoring an invalid setting for MPIO_DIRECT_READ_CHUNK_SIZE.\n" -" It must be set to a positive integer value.\n"); - } else { - xfs_direct_read_chunk_size = io; - } - } else { - xfs_direct_read_chunk_size = 0; - } - - c = getenv("MPIO_DIRECT_WRITE_CHUNK_SIZE"); - if (c) { - int io; - io = atoi(c); - if (io <= 0) { - fprintf(stderr, -"MPI: Ignoring an invalid setting for MPIO_DIRECT_WRITE_CHUNK_SIZE.\n" -" It must be set to a positive integer value.\n"); - } else { - xfs_direct_write_chunk_size = io; - } - } else { - xfs_direct_write_chunk_size = 0; - } - } - - if (!fd->hints->initialized) { - fd->hints->fs_hints.xfs.read_chunk_sz = - xfs_direct_read_chunk_size; - fd->hints->fs_hints.xfs.write_chunk_sz = - xfs_direct_write_chunk_size; - } - - /* has user specified values for keys "direct_read" and "direct write"? */ - if (users_info != MPI_INFO_NULL) { - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - - ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && !strcmp(value, "true")) { - ADIOI_Info_set(fd->info, "direct_read", "true"); - fd->direct_read = 1; - } - - ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && !strcmp(value, "true")) { - ADIOI_Info_set(fd->info, "direct_write", "true"); - fd->direct_write = 1; - } - - ADIOI_Free(value); - } - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - /* Environment variables override MPI_Info hints */ - if (ADIOI_Direct_read) fd->direct_read = 1; - if (ADIOI_Direct_write) fd->direct_write = 1; - - /* environment variables checked in ADIO_Init */ - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_open.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_open.c deleted file mode 100644 index 5c0a9a2b8aea7ad1387afcb5c268e3314ef6b14c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_open.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#define _GNU_SOURCE // for O_DIRECT - -#include "ad_xfs.h" -#include <sys/ioctl.h> -#ifdef HAVE_STDDEF_H -#include <stddef.h> -#endif - -#ifndef HAVE_LSEEK64 -#define lseek64 lseek -#endif - -void ADIOI_XFS_Open(ADIO_File fd, int *error_code) -{ - int perm, amode, amode_direct, factor; - unsigned int old_mask; - struct dioattr st; - static char myname[] = "ADIOI_XFS_OPEN"; - unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; - unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; - - if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - - amode = 0; - if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; - if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; - if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; - if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; - - amode_direct = amode | O_DIRECT; - - if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; - - fd->fd_sys = open(fd->filename, amode, perm); - - fd->fd_direct = open(fd->filename, amode_direct, perm); - if (fd->fd_direct != -1) { - -#if defined(MPISGI) - ioctl(fd->fd_direct, XFS_IOC_DIOINFO, &st); -#else - fcntl(fd->fd_direct, F_DIOINFO, &st); -#endif - - fd->d_mem = st.d_mem; - fd->d_miniosz = st.d_miniosz; - - if (read_chunk_sz == 0) { - fd->hints->fs_hints.xfs.read_chunk_sz = st.d_maxiosz; - } else { - /* - * MPIO_DIRECT_READ_CHUNK_SIZE was set. - * Make read_chunk_sz a multiple of d_miniosz. - */ - factor = read_chunk_sz / fd->d_miniosz; - if (factor == 0 || read_chunk_sz != fd->d_miniosz * factor) { - fd->hints->fs_hints.xfs.read_chunk_sz = - fd->d_miniosz * (factor + 1); - } - } - - if (write_chunk_sz == 0) { - fd->hints->fs_hints.xfs.write_chunk_sz = st.d_maxiosz; - } else { - /* - * MPIO_DIRECT_WRITE_CHUNK_SIZE was set. - * Make write_chunk_sz a multiple of d_miniosz. - */ - factor = write_chunk_sz / fd->d_miniosz; - if (factor == 0 || write_chunk_sz != fd->d_miniosz * factor) { - fd->hints->fs_hints.xfs.write_chunk_sz = - fd->d_miniosz * (factor + 1); - } - } - - if (fd->d_mem > XFS_MEMALIGN) { - FPRINTF(stderr, "MPI: Run-time Direct-IO memory alignment, %d, does not match compile-time value, %d.\n", - fd->d_mem, XFS_MEMALIGN); - FPRINTF(stderr, "MPI: Report this error and rerun with Direct-IO disabled.\n"); - close(fd->fd_direct); - fd->fd_direct = -1; - } - } - - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) - fd->fp_ind = lseek64(fd->fd_sys, 0, SEEK_END); - - fd->fp_sys_posn = -1; /* set it to null because we use pread/pwrite */ - - if ((fd->fd_sys == -1) || (fd->fd_direct == -1)) { - *error_code = ADIOI_Err_create_code(mymame, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_read.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_read.c deleted file mode 100644 index c3c237cc15d11a9928acd3465289b7afa73ef368..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_read.c +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -/* style: allow:free:2 sig:0 */ - -static void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, - ADIO_Offset offset, int *err); - -void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - int diff, size, nbytes; - MPI_Count err=-1, datatype_size, len; - void *newbuf; - static char myname[] = "ADIOI_XFS_READCONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - fd->fp_sys_posn = -1; /* set it to null, since we are using pread */ - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - - if (!(fd->direct_read)) /* direct I/O not enabled */ - err = pread(fd->fd_sys, buf, len, offset); - else { /* direct I/O enabled */ - - /* (1) if mem_aligned && file_aligned - use direct I/O to read up to correct io_size - use buffered I/O for remaining */ - - if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) - ADIOI_XFS_Aligned_Mem_File_Read(fd, buf, len, offset, &err); - - /* (2) if !file_aligned - use buffered I/O to read up to file_aligned - At that point, if still mem_aligned, use (1) - else copy into aligned buf and then use (1) */ - else if (offset % fd->d_miniosz) { - diff = fd->d_miniosz - (offset % fd->d_miniosz); - diff = ADIOI_MIN(diff, len); - nbytes = pread(fd->fd_sys, buf, diff, offset); - - buf = ((char *) buf) + diff; - offset += diff; - size = len - diff; - if (!(((long) buf) % fd->d_mem)) { - ADIOI_XFS_Aligned_Mem_File_Read(fd, buf, size, offset, &err); - nbytes += err; - } - else { - newbuf = (void *) memalign(XFS_MEMALIGN, size); - if (newbuf) { - ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); - if (err > 0) memcpy(buf, newbuf, err); - nbytes += err; - ADIOI_Free(newbuf); - } - else nbytes += pread(fd->fd_sys, buf, size, offset); - } - err = nbytes; - } - - /* (3) if !mem_aligned && file_aligned - copy into aligned buf, then use (1) */ - else { - newbuf = (void *) memalign(XFS_MEMALIGN, len); - if (newbuf) { - ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, len, offset, &err); - if (err > 0) memcpy(buf, newbuf, err); - ADIOI_Free(newbuf); - } - else err = pread(fd->fd_sys, buf, len, offset); - } - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += err; - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); -#endif - - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} - - -void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, - ADIO_Offset offset, int *err) -{ - int ntimes, rem, newrem, i, size, nbytes; - unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; - - /* memory buffer is aligned, offset in file is aligned, - io_size may or may not be of the right size. - use direct I/O to read up to correct io_size, - use buffered I/O for remaining. */ - - if (!(len % fd->d_miniosz) && - (len >= fd->d_miniosz) && (len <= read_chunk_sz)) - *err = pread(fd->fd_direct, buf, len, offset); - else if (len < fd->d_miniosz) - *err = pread(fd->fd_sys, buf, len, offset); - else if (len > read_chunk_sz) { - ntimes = len/(read_chunk_sz); - rem = len - ntimes * read_chunk_sz; - nbytes = 0; - for (i=0; i<ntimes; i++) { - nbytes += pread(fd->fd_direct, ((char *)buf) + i * read_chunk_sz, - read_chunk_sz, offset); - offset += read_chunk_sz; - } - if (rem) { - if (!(rem % fd->d_miniosz)) - nbytes += pread(fd->fd_direct, - ((char *)buf) + ntimes * read_chunk_sz, rem, offset); - else { - newrem = rem % fd->d_miniosz; - size = rem - newrem; - if (size) { - nbytes += pread(fd->fd_direct, - ((char *)buf) + ntimes * read_chunk_sz, size, offset); - offset += size; - } - nbytes += pread(fd->fd_sys, - ((char *)buf) + ntimes * read_chunk_sz + size, newrem, offset); - } - } - *err = nbytes; - } - else { - rem = len % fd->d_miniosz; - size = len - rem; - nbytes = pread(fd->fd_direct, buf, size, offset); - nbytes += pread(fd->fd_sys, (char *)buf + size, rem, offset+size); - *err = nbytes; - } -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_resize.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_resize.c deleted file mode 100644 index 8caf8b48bd715aac9eab9c323464a3e6b547b807..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_resize.c +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; - static char myname[] = "ADIOI_XFS_RESIZE"; - - err = ftruncate64(fd->fd_sys, size); - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/ad_xfs/ad_xfs_write.c b/3rd-party/romio321/adio/ad_xfs/ad_xfs_write.c deleted file mode 100644 index 9ab82768f7658c727c04fafdd3c7b9f5bfedd209..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_xfs/ad_xfs_write.c +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -/* style: allow:free:2 sig:0 */ - -static int ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, - ADIO_Offset len, ADIO_Offset offset); - -void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code) -{ - int diff, size; - MPI_Count err=-1, datatype_size; - ssize_t len; - void *newbuf; - static char myname[] = "ADIOI_XFS_WRITECONTIG"; - - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * count; - - fd->fp_sys_posn = -1; /* set it to null, since we are using pwrite */ - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - - if (!(fd->direct_write)) { /* direct I/O not enabled */ - err = pwrite(fd->fd_sys, buf, len, offset); - if (err < 0) {goto leaving;} - } else { /* direct I/O enabled */ - - /* (1) if mem_aligned && file_aligned - use direct I/O to write up to correct io_size - use buffered I/O for remaining */ - - if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) { - err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, len, offset); - if (err < 0) {goto leaving;} - - /* (2) if !file_aligned - use buffered I/O to write up to file_aligned - At that point, if still mem_aligned, use (1) - else copy into aligned buf and then use (1) */ - } else if (offset % fd->d_miniosz) { - diff = fd->d_miniosz - (offset % fd->d_miniosz); - diff = ADIOI_MIN(diff, len); - err = pwrite(fd->fd_sys, buf, diff, offset); - if (err < 0) {goto leaving;} - - buf = ((char *) buf) + diff; - offset += diff; - size = len - diff; - if (!(((long) buf) % fd->d_mem)) { - err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, size, offset); - if (err < 0) {goto leaving;} - } - else { - newbuf = (void *) memalign(XFS_MEMALIGN, size); - if (newbuf) { - memcpy(newbuf, buf, size); - err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, size, offset); - ADIOI_Free(newbuf); - if (err < 0) {goto leaving;} - } else { - err = pwrite(fd->fd_sys, buf, size, offset); - if (err < 0) {goto leaving;} - } - } - } - - /* (3) if !mem_aligned && file_aligned - copy into aligned buf, then use (1) */ - else { - newbuf = (void *) memalign(XFS_MEMALIGN, len); - if (newbuf) { - memcpy(newbuf, buf, len); - err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, len, offset); - ADIOI_Free(newbuf); - } else { - err = pwrite(fd->fd_sys, buf, len, offset); - } - - if (err < 0) {goto leaving;} - } - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, len); -#endif -leaving: - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; -} - - -static int -ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, ADIO_Offset len, - ADIO_Offset offset) -{ - unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; - ADIO_Offset nbytes, rem, newrem, size; - int ntimes, i; - - /* memory buffer is aligned, offset in file is aligned, - io_size may or may not be of the right size. - use direct I/O to write up to correct io_size, - use buffered I/O for remaining. */ - - if (!(len % fd->d_miniosz) && - (len >= fd->d_miniosz) && (len <= write_chunk_sz)) { - nbytes = pwrite(fd->fd_direct, buf, len, offset); - if (nbytes < 0) {return -1;} - } else if (len < fd->d_miniosz) { - nbytes = pwrite(fd->fd_sys, buf, len, offset); - if (nbytes < 0) {return -1;} - } else if (len > write_chunk_sz) { - ntimes = len/(write_chunk_sz); - rem = len - ntimes * write_chunk_sz; - nbytes = 0; - for (i=0; i<ntimes; i++) { - nbytes = pwrite(fd->fd_direct, ((char *)buf) + i * write_chunk_sz, - write_chunk_sz, offset); - offset += write_chunk_sz; - if (nbytes < 0) {return -1;} - } - if (rem) { - if (!(rem % fd->d_miniosz)) { - nbytes = pwrite(fd->fd_direct, - ((char *)buf) + ntimes * write_chunk_sz, rem, offset); - if (nbytes < 0) {return -1;} - } else { - newrem = rem % fd->d_miniosz; - size = rem - newrem; - if (size) { - nbytes = pwrite(fd->fd_direct, - ((char *)buf) + ntimes * write_chunk_sz, size, offset); - offset += size; - if (nbytes < 0) {return -1;} - } - nbytes = pwrite(fd->fd_sys, - ((char *)buf) + ntimes * write_chunk_sz + size, newrem, offset); - if (nbytes < 0) {return -1;} - } - } - } - else { - rem = len % fd->d_miniosz; - size = len - rem; - nbytes = pwrite(fd->fd_direct, buf, size, offset); - if (nbytes < 0) {return -1;} - nbytes = pwrite(fd->fd_sys, (char *)buf + size, rem, offset+size); - if (nbytes < 0) {return -1;} - } - - return 0; -} diff --git a/3rd-party/romio321/adio/ad_zoidfs/Makefile.mk b/3rd-party/romio321/adio/ad_zoidfs/Makefile.mk deleted file mode 100644 index a26e59c8e0e2e434bedb2a58608e0b252e439b78..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/Makefile.mk +++ /dev/null @@ -1,27 +0,0 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : -## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. -## - -if BUILD_AD_ZOIDFS - -noinst_HEADERS += adio/ad_zoidfs/ad_zoidfs.h adio/ad_zoidfs/ad_zoidfs_common.h - -romio_other_sources += \ - adio/ad_zoidfs/ad_zoidfs.c \ - adio/ad_zoidfs/ad_zoidfs_close.c \ - adio/ad_zoidfs/ad_zoidfs_common.c \ - adio/ad_zoidfs/ad_zoidfs_delete.c \ - adio/ad_zoidfs/ad_zoidfs_fcntl.c \ - adio/ad_zoidfs/ad_zoidfs_flush.c \ - adio/ad_zoidfs/ad_zoidfs_io.c \ - adio/ad_zoidfs/ad_zoidfs_open.c \ - adio/ad_zoidfs/ad_zoidfs_resize.c \ - adio/ad_zoidfs/ad_zoidfs_features.c \ - adio/ad_zoidfs/ad_zoidfs_read_list.c \ - adio/ad_zoidfs/ad_zoidfs_write_list.c - -endif BUILD_AD_ZOIDFS - diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.c deleted file mode 100644 index 3c9131aeac45f75b7533866f0d32f634a21829e0..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" - -/* adioi.h has the ADIOI_Fns_struct define */ -#include "adioi.h" - -struct ADIOI_Fns_struct ADIO_ZOIDFS_operations = { - ADIOI_ZOIDFS_Open, /* Open */ - ADIOI_SCALEABLE_OpenColl, /* OpenColl */ - ADIOI_ZOIDFS_ReadContig, /* ReadContig */ - ADIOI_ZOIDFS_WriteContig, /* WriteContig */ - ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ - ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_ZOIDFS_Fcntl, /* Fcntl */ - ADIOI_GEN_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ - ADIOI_ZOIDFS_WriteStrided, /* WriteStrided */ - ADIOI_ZOIDFS_Close, /* Close */ - ADIOI_FAKE_IreadContig, /* IreadContig */ - ADIOI_FAKE_IwriteContig, /* IwriteContig */ - ADIOI_FAKE_IODone, /* ReadDone */ - ADIOI_FAKE_IODone, /* WriteDone */ - ADIOI_FAKE_IOComplete, /* ReadComplete */ - ADIOI_FAKE_IOComplete, /* WriteComplete */ - ADIOI_FAKE_IreadStrided, /* IreadStrided */ - ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ - ADIOI_ZOIDFS_Flush, /* Flush */ - ADIOI_ZOIDFS_Resize, /* Resize */ - ADIOI_ZOIDFS_Delete, /* Delete */ - ADIOI_ZOIDFS_Feature, - ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ - ADIOI_GEN_IwriteStridedColl /* IwriteStridedColl */ -}; - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.h b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.h deleted file mode 100644 index d4999b66228c516459619df1108ada7f4858be5a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef AD_ZOIDFS_INCLUDE -#define AD_ZOIDFS_INCLUDE - -#include "adio.h" -#ifdef HAVE_ZOIDFS_H -#include "zoidfs.h" -#endif - - -typedef zoidfs_handle_t ADIOI_ZOIDFS_object; - -void ADIOI_ZOIDFS_Open(ADIO_File fd, int *error_code); -void ADIOI_ZOIDFS_Close(ADIO_File fd, int *error_code); -void ADIOI_ZOIDFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_ZOIDFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_ZOIDFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_ZOIDFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_ZOIDFS_Delete(char *filename, int *error_code); -void ADIOI_ZOIDFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_ZOIDFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -int ADIOI_ZOIDFS_Feature(ADIO_File fd, int flag); -#endif diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_close.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_close.c deleted file mode 100644 index 0126783aa37b34abc6f8c6003216da0afa5d63ad..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_close.c +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" - -void ADIOI_ZOIDFS_Close(ADIO_File fd, int *error_code) -{ - ADIOI_Free(fd->fs_ptr); - fd->fs_ptr = NULL; - - /* At some point or another it was decided that ROMIO would not - * explicitly flush (other than any local cache) on close, because - * there is no way to *avoid* that overhead if you implement it here - * and don't actually want it. - */ - - *error_code = MPI_SUCCESS; -} -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.c deleted file mode 100644 index 018d439aaa2f600e9a158fd62aa2b710d3407e9f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "ad_zoidfs_common.h" -#include <unistd.h> -#include <sys/types.h> - -/* keyval hack to both tell us if we've already initialized zoidfs and also - * close it down when mpi exits */ -int ADIOI_ZOIDFS_Initialized = MPI_KEYVAL_INVALID; - -void ADIOI_ZOIDFS_End(int *error_code) -{ - int ret; - static char myname[] = "ADIOI_ZOIDFS_END"; - - ret = zoidfs_finalize(); - - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_finalize", 0); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; -} - -int ADIOI_ZOIDFS_End_call(MPI_Comm comm, int keyval, - void *attribute_val, void *extra_state) -{ - int error_code; - ADIOI_ZOIDFS_End(&error_code); - MPI_Keyval_free(&keyval); - return error_code; -} - -void ADIOI_ZOIDFS_Init(int rank, int *error_code ) -{ - int ret; - static char myname[] = "ADIOI_ZOIDFS_INIT"; - - /* do nothing if we've already fired up the zoidfs interface */ - if (ADIOI_ZOIDFS_Initialized != MPI_KEYVAL_INVALID) { - *error_code = MPI_SUCCESS; - return; - } - - ret = zoidfs_init(); - if (ret < 0 ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_init", - 0); - return; - } - - MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_ZOIDFS_End_call, - &ADIOI_ZOIDFS_Initialized, (void *)0); - /* just like romio does, we make a dummy attribute so we - * get cleaned up */ - MPI_Attr_put(MPI_COMM_SELF, ADIOI_ZOIDFS_Initialized, (void *)0); -} - -void ADIOI_ZOIDFS_makeattribs(zoidfs_sattr_t * attribs) -{ - memset(attribs, 0, sizeof(zoidfs_sattr_t)); - - attribs->mask = ZOIDFS_ATTR_MODE; - attribs->mode = 0644; -} - -int ADIOI_ZOIDFS_error_convert(int error) -{ - switch (error) - { - case ZFSERR_PERM: /* ??? */ - case ZFSERR_ACCES: - return MPI_ERR_ACCESS; - case ZFSERR_NOENT: - case ZFSERR_NXIO: /* ??? */ - case ZFSERR_NODEV: /* ??? */ - return MPI_ERR_NO_SUCH_FILE; - case ZFSERR_IO: - return MPI_ERR_IO; - case ZFSERR_EXIST: - return MPI_ERR_FILE_EXISTS; - case ZFSERR_NOTDIR: /* ??? */ - case ZFSERR_ISDIR: /* ??? */ - case ZFSERR_NAMETOOLONG: - return MPI_ERR_BAD_FILE; - case ZFSERR_INVAL: - case ZFSERR_STALE: - return MPI_ERR_FILE; - case ZFSERR_FBIG: /* ??? */ - case ZFSERR_NOSPC: - return MPI_ERR_NO_SPACE; - case ZFSERR_ROFS: - return MPI_ERR_READ_ONLY; - case ZFSERR_NOTIMPL: - return MPI_ERR_UNSUPPORTED_OPERATION; - case ZFSERR_DQUOT: - return MPI_ERR_QUOTA; - /* case ZFSERR_NOTEMPTY: */ - /* case ZFSERR_WFLUSH: */ - /* case ZFSERR_OTHER: */ - case ZFSERR_NOMEM: - return MPI_ERR_INTERN; - default: - return MPI_UNDEFINED; - } -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.h b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.h deleted file mode 100644 index ba985b49226132d2d1acef5c07cb9bd28b3211e3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_common.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#ifndef _AD_ZOIDFS_COMMON_H -#define _AD_ZOIDFS_COMMON_H -#include "ad_zoidfs.h" - -/* The ESTALE problem: - * The IO forwarding protocol can respond to any call with ESTALE, which means - * the handle upon which that call operates has expired from the metadata - * cache. We thus wrap any zoidfs routine (expr) in this macro. - * - * ROMIO stores the filename in the ADIOI_File structrue (fd), so we can always - * re-lookup in response to ESTALE */ - -#define NO_STALE(ret, fd, handle_p, expr) \ - do { \ - (ret) = (expr); \ - while ((ret) == ZFSERR_STALE) { \ - /* lookup again */ \ - (ret) = zoidfs_lookup(NULL, NULL, (fd)->filename, \ - (zoidfs_handle_t*)((fd)->fs_ptr), ZOIDFS_NO_OP_HINT); \ - if ((ret) == ZFS_OK) { \ - *((ADIOI_ZOIDFS_object*)handle_p) \ - = *((ADIOI_ZOIDFS_object*)((fd)->fs_ptr)); \ - /* re-execute the expr with new handle */ \ - (ret) = (expr); \ - } \ - } \ - } while (0) - -void ADIOI_ZOIDFS_Init(int rank, int *error_code ); -void ADIOI_ZOIDFS_makeattribs(zoidfs_sattr_t * attribs); -void ADIOI_ZOIDFS_End(int *error_code); -int ADIOI_ZOIDFS_End_call(MPI_Comm comm, int keyval, - void *attribute_val, void *extra_state); -int ADIOI_ZOIDFS_error_convert(int error); - -#endif diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_delete.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_delete.c deleted file mode 100644 index 87193147a56847af295ad264d3a9e7b0e6b66d35..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_delete.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "adio.h" - -#include "ad_zoidfs_common.h" - -void ADIOI_ZOIDFS_Delete(char *filename, int *error_code) -{ - int ret; - static char myname[] = "ADIOI_ZOIDFS_DELETE"; - - ADIOI_ZOIDFS_Init(0, error_code); - /* --BEGIN ERROR HANDLING-- */ - if (*error_code != MPI_SUCCESS) - { - /* ADIOI_ZOIDFS_INIT handles creating error codes itself */ - return; - } - /* --END ERROR HANDLING-- */ - - ret = zoidfs_remove(NULL, NULL, filename, NULL, ZOIDFS_NO_OP_HINT); - /* --BEGIN ERROR HANDLING-- */ - if (ret != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_remove", 0); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; - return; -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_fcntl.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_fcntl.c deleted file mode 100644 index 22c26714d808c43c304cf6403162b2535a59b99d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_fcntl.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "adio_extern.h" -#include "ad_zoidfs_common.h" - -void ADIOI_ZOIDFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - int ret; - zoidfs_attr_t attr; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - static char myname[] = "ADIOI_ZOIDFS_FCNTL"; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: - attr.mask = ZOIDFS_ATTR_SIZE; - NO_STALE(ret, fd, zoidfs_obj_ptr, - zoidfs_getattr(zoidfs_obj_ptr, &attr, ZOIDFS_NO_OP_HINT)); - if ( !(attr.mask & ZOIDFS_ATTR_SIZE) || (ret != ZFS_OK ) ) { - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_getattr", 0); - /* --END ERROR HANDLING-- */ - } - else { - *error_code = MPI_SUCCESS; - } - fcntl_struct->fsize = attr.size; - return; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - /* --BEGIN ERROR HANDLING-- */ - case ADIO_FCNTL_SET_ATOMICITY: - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - /* --END ERROR HANDLING-- */ - } -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_features.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_features.c deleted file mode 100644 index a3f5c1467e4388b444e87a001333d45e1ca79a07..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_features.c +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "adio.h" -#include "ad_zoidfs.h" - -int ADIOI_ZOIDFS_Feature(ADIO_File fd, int flag) -{ - switch(flag) { - case ADIO_SCALABLE_OPEN: - return 1; - case ADIO_SHARED_FP: - case ADIO_LOCKS: - case ADIO_SEQUENTIAL: - case ADIO_DATA_SIEVING_WRITES: - default: - return 0; - } -} diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_flush.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_flush.c deleted file mode 100644 index 8ec0b8d5518f1fd480e2553d03f6a5a3c649e7c8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_flush.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "ad_zoidfs_common.h" - -/* we want to be a bit clever here: at scale, if every client sends a - * flush request, it will stress the file system with redundant - * commit requests. Instead, one process should wait for - * everyone to catch up, do the sync, then broadcast the result. - */ - -void ADIOI_ZOIDFS_Flush(ADIO_File fd, int *error_code) -{ - int ret, rank, dummy=0, dummy_in=0; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - static char myname[] = "ADIOI_ZOIDFS_FLUSH"; - - *error_code = MPI_SUCCESS; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; - - MPI_Comm_rank(fd->comm, &rank); - - /* collective call to ensure no outstanding write requests. reduce is - * slightly less expensvie than barrier */ - MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, - fd->hints->ranklist[0], fd->comm); - - if (rank == fd->hints->ranklist[0]) { - ret = zoidfs_commit(zoidfs_obj_ptr, ZOIDFS_NO_OP_HINT); - } - MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - - /* --BEGIN ERROR HANDLING-- */ - if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_commit", 0); - } - /* --END ERROR HANDLING-- */ -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_io.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_io.c deleted file mode 100644 index 337c92f4101185a2976d1ad4f3dbe2f4d7a9c8e1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_io.c +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_zoidfs.h" - -#include "ad_zoidfs_common.h" - -#define ZOIDFS_READ 0 -#define ZOIDFS_WRITE 1 - -static void ZOIDFS_IOContig(ADIO_File fd, void * buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int flag, int *error_code) -{ - int ret; - MPI_Count datatype_size; - uint64_t file_len; - size_t mem_len; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - uint64_t file_offset = offset; - static char myname[] = "ADIOI_ZOIDFS_IOCONTIG"; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; - - MPI_Type_size_x(datatype, &datatype_size); - file_len = mem_len = datatype_size * count; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - file_offset = fd->fp_ind; - } - - if (flag == ZOIDFS_READ) { - NO_STALE(ret, fd, zoidfs_obj_ptr, - zoidfs_read(zoidfs_obj_ptr, - 1, &buf, &mem_len, - 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT)); - } else { - NO_STALE(ret, fd, zoidfs_obj_ptr, - zoidfs_write(zoidfs_obj_ptr, - 1, (const void **)&buf, &mem_len, - 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT)); - } - /* --BEGIN ERROR HANDLING-- */ - if (ret != ZFS_OK ) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in ZOIDFS I/O", 0); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += file_len; - } - fd->fp_sys_posn = file_offset + file_len; - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, file_len); -#endif - - *error_code = MPI_SUCCESS; - -fn_exit: - return; -} - -void ADIOI_ZOIDFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type, - offset, status, ZOIDFS_READ, error_code); -} - -void ADIOI_ZOIDFS_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type, - offset, status, ZOIDFS_WRITE, error_code); -} - - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_open.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_open.c deleted file mode 100644 index 3c22cb54e1f65a483d7fac6bf7923d28919fdc10..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_open.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2007 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "ad_zoidfs_common.h" - -/* open_status is helpful for bcasting values around */ -struct open_status_s { - int error; - zoidfs_handle_t handle; -}; -typedef struct open_status_s open_status; - -static void fake_an_open(char *fname, int access_mode, - int nr_datafiles, MPI_Offset strip_size, - ADIOI_ZOIDFS_object *zoidfs_ptr, - open_status *o_status) -{ - int ret, created; - zoidfs_sattr_t attribs; - zoidfs_handle_t handle; - - ADIOI_ZOIDFS_makeattribs(&attribs); - - /* zoidfs_create succeeds even if a file already exists, so we can do - * our job with fewer calls than in other cases. However, we need to - * be careful with ADIO_EXCL. - */ - if (access_mode & ADIO_CREATE) { - ret = zoidfs_create(NULL, NULL, - fname, &attribs, &handle, &created, ZOIDFS_NO_OP_HINT); - if ((ret == ZFS_OK) && !created && (access_mode & ADIO_EXCL)) { - /* lookup should not succeed if opened with EXCL */ - o_status->error = ZFSERR_EXIST; - return; - } - } - else { - ret = zoidfs_lookup(NULL, NULL, fname, &handle, ZOIDFS_NO_OP_HINT); - } - - o_status->error = ret; - o_status->handle = handle; - return; -} - - -/* ADIOI_ZOIDFS_Open: - * one process opens (or creates) the file, then broadcasts the result to the - * remaining processors. - * - * ADIO_Open used to perform an optimization when MPI_MODE_CREATE (and before - * that, MPI_MODE_EXCL) was set. Because ZoidFS handles file lookup and - * creation more scalably than traditional file systems, ADIO_Open now skips any - * special handling when CREATE is set. */ -void ADIOI_ZOIDFS_Open(ADIO_File fd, int *error_code) -{ - int rank; - static char myname[] = "ADIOI_ZOIDFS_OPEN"; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - - /* since one process is doing the open, that means one process is also - * doing the error checking. define a struct for both the object reference - * and the error code to broadcast to all the processors */ - - open_status o_status; - MPI_Datatype open_status_type; - MPI_Datatype types[2] = {MPI_INT, MPI_BYTE}; - int lens[2] = {1, sizeof(ADIOI_ZOIDFS_object)}; - MPI_Aint offsets[2]; - - memset(&o_status, 0, sizeof(o_status)); - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *) - ADIOI_Malloc(sizeof(ADIOI_ZOIDFS_object)); - /* --BEGIN ERROR HANDLING-- */ - if (zoidfs_obj_ptr == NULL) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNKNOWN, - "Error allocating memory", 0); - return; - } - /* --END ERROR HANDLING-- */ - - MPI_Comm_rank(fd->comm, &rank); - - ADIOI_ZOIDFS_Init(rank, error_code); - if (*error_code != MPI_SUCCESS) - { - /* ADIOI_ZOIDFS_INIT handles creating error codes on its own */ - ADIOI_Free(zoidfs_obj_ptr); - return; - } - - /* one process resolves name and will later bcast to others */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); -#endif - if (rank == fd->hints->ranklist[0] && fd->fs_ptr == NULL) { - fake_an_open(fd->filename, fd->access_mode, - fd->hints->striping_factor, - fd->hints->striping_unit, - zoidfs_obj_ptr, &o_status); - /* store credentials and object reference in fd */ - *zoidfs_obj_ptr = o_status.handle; - fd->fs_ptr = zoidfs_obj_ptr; - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); -#endif - - /* broadcast status and (possibly valid) object reference */ - MPI_Get_address(&o_status.error, &offsets[0]); - MPI_Get_address(&o_status.handle, &offsets[1]); - - MPI_Type_struct(2, lens, offsets, types, &open_status_type); - MPI_Type_commit(&open_status_type); - - /* Assertion: if we hit this Bcast, then all processes collectively - * called this open. - * - * That's because deferred open never happens with this fs. - */ - MPI_Bcast(MPI_BOTTOM, 1, open_status_type, fd->hints->ranklist[0], - fd->comm); - MPI_Type_free(&open_status_type); - - /* --BEGIN ERROR HANDLING-- */ - if (o_status.error != ZFS_OK) - { - ADIOI_Free(zoidfs_obj_ptr); - fd->fs_ptr = NULL; - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(o_status.error), - "Unknown error", 0); - /* TODO: FIX STRING */ - return; - } - /* --END ERROR HANDLING-- */ - - *zoidfs_obj_ptr = o_status.handle; - fd->fs_ptr = zoidfs_obj_ptr; - - *error_code = MPI_SUCCESS; - return; -} diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_read_list.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_read_list.c deleted file mode 100644 index 3537e63e8327bada2cd687cebf691b222ed5d90a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_read_list.c +++ /dev/null @@ -1,826 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_zoidfs.h" - -#include "ad_zoidfs_common.h" - -/* Copied from ADIOI_PVFS2_OldReadStrided. It would be good to have fewer - * copies of this code... */ -void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* offset is in units of etype relative to the filetype. */ - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, brd_size, frd_size=0, st_index=0; - int sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp, start_off, initial_off; - int flag, st_frd_size, st_n_filetypes; - - size_t mem_list_count, file_list_count; - void ** mem_offsets; - uint64_t *file_offsets; - size_t *mem_lengths; - uint64_t *file_lengths; - int total_blks_to_read; - - int max_mem_list, max_file_list; - - int b_blks_read; - int f_data_read; - int size_read=0, n_read_lists, extra_blks; - - int end_brd_size, end_frd_size; - int start_k, start_j, new_file_read, new_buffer_read; - int start_mem_offset; - ADIOI_ZOIDFS_object * zoidfs_obj_ptr; - int err_flag=0; - MPI_Offset total_bytes_read = 0; - static char myname[] = "ADIOI_ZOIDFS_ReadStrided"; - - /* note: I don't know what zoidfs will do if you pass it a super-long list, - * so let's keep with the PVFS limit for now */ -#define MAX_ARRAY_SIZE 64 - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - /* the HDF5 tests showed a bug in this list processing code (see many many - * lines down below). We added a workaround, but common HDF5 file types - * are actually contiguous and do not need the expensive workarond */ - if (!filetype_is_contig) { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - if (flat_file->count == 1 && !buftype_is_contig) - filetype_is_contig = 1; - } - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *)fd->fs_ptr; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - uint64_t file_offsets; - uint64_t file_lengths; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - file_list_count = 1; - file_offsets = off; - file_lengths = 0; - total_blks_to_read = count*flat_buf->count; - b_blks_read = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_read > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_read; - mem_offsets = (void*)ADIOI_Malloc(mem_list_count*sizeof(void*)); - mem_lengths = (size_t*)ADIOI_Malloc(mem_list_count*sizeof(size_t)); - - /* TODO: CHECK RESULTS OF MEMORY ALLOCATION */ - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_read < total_blks_to_read) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = - buf + j*buftype_extent + flat_buf->indices[i]; - mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_lengths += flat_buf->blocklens[i]; - b_blks_read++; - if (!(b_blks_read % MAX_ARRAY_SIZE) || - (b_blks_read == total_blks_to_read)) { - - /* in the case of the last read list call, - adjust mem_list_count */ - if (b_blks_read == total_blks_to_read) { - mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; - /* in case last read list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_read(zoidfs_obj_ptr, - mem_list_count, - mem_offsets, mem_lengths, - 1, &file_offsets, &file_lengths, ZOIDFS_NO_OP_HINT)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_read", 0); - goto error_state; - } - total_bytes_read += file_lengths; - /* --END ERROR HANDLING-- */ - - /* in the case of error or the last read list call, - * leave here */ - if (err_flag || b_blks_read == total_blks_to_read) break; - - file_offsets += file_lengths; - file_lengths = 0; - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_read < total_blks_to_read) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind += total_bytes_read; - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This isa temporary way of filling in status. The right way is to - keep tracke of how much data was actually read adn placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - ADIOI_Delete_flattened(datatype); - - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* know file is noncontiguous from above */ - /* noncontiguous in file */ - - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - initial_off = offset; - - - /* for each case - ADIO_Individual pointer or explicit, find the file - offset in bytes (offset), n_filetypes (how many filetypes into - file to start), frd_size (remaining amount of data in present - file block), and st_index (start point in terms of blocks in - starting filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - frd_size = disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - /* only one memory off-len pair, so no array here */ - size_t mem_lengths; - size_t mem_offsets; - - i = 0; - j = st_index; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to read */ - f_data_read = ADIOI_MIN(st_frd_size, bufsize); - total_blks_to_read = 1; - if (j < (flat_file->count-1)) j++; - else { - j = 0; - n_filetypes++; - } - while (f_data_read < bufsize) { - f_data_read += flat_file->blocklens[j]; - total_blks_to_read++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_read%MAX_ARRAY_SIZE; - - mem_offsets = (size_t)buf; - mem_lengths = 0; - - /* if at least one full readlist, allocate file arrays - at max array size and don't free until very end */ - if (n_read_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (uint64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(uint64_t)); - } - /* if there's no full readlist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (uint64_t*)ADIOI_Malloc(extra_blks* - sizeof(uint64_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_read_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_frd_size; - mem_lengths = st_frd_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_lengths += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ - /* --END ERROR HANDLING-- */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_read(zoidfs_obj_ptr, - 1, buf, &mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_read", 0); - goto error_state; - } - /* --END ERROR HANDING-- */ - total_bytes_read += mem_lengths; - - mem_offsets += mem_lengths; - mem_lengths = 0; - } /* for (i=0; i<n_read_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = ADIOI_MIN(st_frd_size, bufsize); - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent + - flat_file->indices[j]; - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - mem_lengths - - mem_offsets + (size_t)buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_read(zoidfs_obj_ptr, 1, - (void **)&mem_offsets, - &mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_read", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - total_bytes_read += mem_lengths; - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fakes filling the readlist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_read += new_buffer_read; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_read < bufsize) */ - - /* one last check before we actually carry out the operation: - * this code has hard-to-fix bugs when a noncontiguous file type has - * such large pieces that the sum of the lengths of the memory type is - * not larger than one of those pieces (and vice versa for large memory - * types and many pices of file types. In these cases, give up and - * fall back to naive reads and writes. The testphdf5 test created a - * type with two very large memory regions and 600 very small file - * regions. The same test also created a type with one very large file - * region and many (700) very small memory regions. both cases caused - * problems for this code */ - - if ( ( (file_list_count == 1) && - (new_file_read < flat_file->blocklens[0] ) ) || - ((mem_list_count == 1) && - (new_buffer_read < flat_buf->blocklens[0]) ) || - ((file_list_count == MAX_ARRAY_SIZE) && - (new_file_read < flat_buf->blocklens[0]) ) || - ( (mem_list_count == MAX_ARRAY_SIZE) && - (new_buffer_read < flat_file->blocklens[0])) ) - { - - ADIOI_Delete_flattened(datatype); - ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype, - file_ptr_type, initial_off, status, error_code); - return; - } - - mem_offsets = (void *)ADIOI_Malloc(max_mem_list*sizeof(void *)); - mem_lengths = (size_t*)ADIOI_Malloc(max_mem_list*sizeof(size_t)); - file_offsets = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); - file_lengths = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); - - size_read = 0; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_frd_size and new_brd_size */ - - while (size_read < bufsize) { - k = start_k; - new_buffer_read = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data read and data to be - read in the next immediate read list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k] + - size_read) > bufsize) { - end_brd_size = new_buffer_read + - flat_buf->blocklens[k] - (bufsize - size_read); - new_buffer_read = bufsize - size_read; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - else new_buffer_read = brd_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - j = start_j; - new_file_read = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_read < new_buffer_read)) { - if(file_list_count) { - if((new_file_read + flat_file->blocklens[j]) > - new_buffer_read) { - end_frd_size = new_buffer_read - new_file_read; - new_file_read = new_buffer_read; - j--; - } - else { - new_file_read += flat_file->blocklens[j]; - end_frd_size = flat_file->blocklens[j]; - } - } - else { - if (frd_size > new_buffer_read) { - new_file_read = new_buffer_read; - frd_size = new_file_read; - } - else new_file_read = frd_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_read < new_buffer_read) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_read = 0; - mem_list_count = 0; - while (new_buffer_read < new_file_read) { - if(mem_list_count) { - if((new_buffer_read + flat_buf->blocklens[k]) > - new_file_read) { - end_brd_size = new_file_read - new_buffer_read; - new_buffer_read = new_file_read; - k--; - } - else { - new_buffer_read += flat_buf->blocklens[k]; - end_brd_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_read = brd_size; - if (brd_size > (bufsize - size_read)) { - new_buffer_read = bufsize - size_read; - brd_size = new_buffer_read; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_read < new_file_read) */ - } /* if ((new_file_read < new_buffer_read) && (file_list_count - == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_read < bufsize-size_read)) */ - - /* fills the allocated readlist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - mem_offsets[i] = buf + - buftype_extent* (buf_count/flat_buf->count) + - flat_buf->indices[k]; - if(!i) { - mem_lengths[0] = brd_size; - mem_offsets[0] += flat_buf->blocklens[k] - brd_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_brd_size; - if (flat_buf->blocklens[k] == end_brd_size) - brd_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - brd_size = flat_buf->blocklens[k] - end_brd_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + - ((ADIO_Offset)n_filetypes) * filetype_extent; - if (!i) { - file_lengths[0] = frd_size; - file_offsets[0] += flat_file->blocklens[j] - frd_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_frd_size; - if (flat_file->blocklens[j] == end_frd_size) - frd_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - frd_size = flat_file->blocklens[j] - end_frd_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_read(zoidfs_obj_ptr, - mem_list_count, mem_offsets, mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_read", 0); - } - /* --END ERROR HANDLING-- */ - size_read += new_buffer_read; - total_bytes_read += new_buffer_read; /* XXX: is this right? */ - start_k = k; - start_j = j; - } /* while (size_read < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - /* Other ADIO routines will convert absolute bytes into counts of datatypes */ - /* when incrementing fp_ind, need to also take into account the file type: - * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| - * if we wrote N elements, offset needs to point at beginning of type, not - * at empty region at offset N+1) - * - * As we discussed on mpich-discuss in may/june 2009, the code below might - * look wierd, but by putting fp_ind at the last byte written, the next - * time we run through the strided code we'll update the fp_ind to the - * right location. */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind = file_offsets[file_list_count-1]+ - file_lengths[file_list_count-1]; - } - - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - if (err_flag == 0) *error_code = MPI_SUCCESS; - -error_state: - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} - diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_resize.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_resize.c deleted file mode 100644 index 60d2fcaba20e2dd556e46c1196aaaa0f7e9d702c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_resize.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_zoidfs.h" -#include "ad_zoidfs_common.h" - -/* as with flush, implement the resize operation in a scalable - * manner. one process does the work, then broadcasts the result to everyone - * else. fortunately, this operation is defined to be collective */ -void ADIOI_ZOIDFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int ret, rank; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - static char myname[] = "ADIOI_ZOIDFS_RESIZE"; - - *error_code = MPI_SUCCESS; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *)fd->fs_ptr; - - MPI_Comm_rank(fd->comm, &rank); - - - /* MPI-IO semantics treat conflicting MPI_File_set_size requests the - * same as conflicting write requests. Thus, a resize from one - * process does not have to be visible to the other processes until a - * syncronization point is reached */ - - if (rank == fd->hints->ranklist[0]) { - NO_STALE(ret, fd, zoidfs_obj_ptr, - zoidfs_resize(zoidfs_obj_ptr, size, ZOIDFS_NO_OP_HINT)); - MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - } else { - MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - } - /* --BEGIN ERROR HANDLING-- */ - if (ret != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(ret), - "Error in zoidfs_resize", 0); - return; - } - /* --END ERROR HANDLING-- */ -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_write_list.c b/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_write_list.c deleted file mode 100644 index 44376316a649dac58027fe5905405fe6b93f6586..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/ad_zoidfs/ad_zoidfs_write_list.c +++ /dev/null @@ -1,857 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "ad_zoidfs.h" - -#include "ad_zoidfs_common.h" - -/* Copied from ADIOI_PVFS2_OldWriteStrided. It would be good to have fewer - * copies of this code... */ -void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - /* as with all the other WriteStrided functions, offset is in units of - * etype relative to the filetype */ - - /* Since zoidfs does not support file locking, can't do buffered writes - as on Unix */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, bwr_size, fwr_size=0, st_index=0; - int sum, n_etypes_in_filetype, size_in_filetype; - MPI_Count bufsize; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, filetype_lb, buftype_lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp, start_off, initial_off; - int flag, st_fwr_size, st_n_filetypes; - int err_flag=0; - - size_t mem_list_count, file_list_count; - const void ** mem_offsets; - uint64_t *file_offsets; - size_t *mem_lengths; - uint64_t *file_lengths; - int total_blks_to_write; - - int max_mem_list, max_file_list; - - int b_blks_wrote; - int f_data_wrote; - int size_wrote=0, n_write_lists, extra_blks; - - int end_bwr_size, end_fwr_size; - int start_k, start_j, new_file_write, new_buffer_write; - int start_mem_offset; - ADIOI_ZOIDFS_object *zoidfs_obj_ptr; - MPI_Offset total_bytes_written=0; - static char myname[] = "ADIOI_ZOIDFS_WRITESTRIDED"; - - /* note: I don't know what zoidfs will do if you pass it a super-long list, - * so let's keep with the PVFS limit for now */ -#define MAX_ARRAY_SIZE 64 - - /* --BEGIN ERROR HANDLING-- */ - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "Atomic noncontiguous writes are not supported by ZOIDFS", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - /* the HDF5 tests showed a bug in this list processing code (see many many - * lines down below). We added a workaround, but common HDF5 file types - * are actually contiguous and do not need the expensive workarond */ - if (!filetype_is_contig) { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - if (flat_file->count == 1 && !buftype_is_contig) - filetype_is_contig = 1; - } - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &buftype_lb, &buftype_extent); - etype_size = fd->etype_size; - - bufsize = buftype_size * count; - - zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - uint64_t file_offsets; - uint64_t file_lengths; - - flat_buf = ADIOI_Flatten_and_find(datatype); - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; - } - else off = fd->fp_ind; - - file_list_count = 1; - file_offsets = off; - file_lengths = 0; - total_blks_to_write = count*flat_buf->count; - b_blks_wrote = 0; - - /* allocate arrays according to max usage */ - if (total_blks_to_write > MAX_ARRAY_SIZE) - mem_list_count = MAX_ARRAY_SIZE; - else mem_list_count = total_blks_to_write; - mem_offsets = (void*)ADIOI_Malloc(mem_list_count*sizeof(void*)); - mem_lengths = (size_t*)ADIOI_Malloc(mem_list_count*sizeof(size_t)); - - j = 0; - /* step through each block in memory, filling memory arrays */ - while (b_blks_wrote < total_blks_to_write) { - for (i=0; i<flat_buf->count; i++) { - mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = - buf + - j*buftype_extent + - flat_buf->indices[i]; - mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = - flat_buf->blocklens[i]; - file_lengths += flat_buf->blocklens[i]; - b_blks_wrote++; - if (!(b_blks_wrote % MAX_ARRAY_SIZE) || - (b_blks_wrote == total_blks_to_write)) { - - /* in the case of the last write list call, - adjust mem_list_count */ - if (b_blks_wrote == total_blks_to_write) { - mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; - /* in case last write list call fills max arrays */ - if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_write(zoidfs_obj_ptr, - mem_list_count, - mem_offsets, mem_lengths, - 1, &file_offsets, &file_lengths, ZOIDFS_NO_OP_HINT)); - - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_write", 0); - break; - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - total_bytes_written += file_lengths; - - /* in the case of error or the last write list call, - * leave here */ - /* --BEGIN ERROR HANDLING-- */ - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_write", 0); - break; - } - /* --END ERROR HANDLING-- */ - if (b_blks_wrote == total_blks_to_write) break; - - file_offsets += file_lengths; - file_lengths = 0; - } - } /* for (i=0; i<flat_buf->count; i++) */ - j++; - } /* while (b_blks_wrote < total_blks_to_write) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - - if (file_ptr_type == ADIO_INDIVIDUAL) - fd->fp_ind += total_bytes_written; - - if (!err_flag) *error_code = MPI_SUCCESS; - - fd->fp_sys_posn = -1; /* clear this. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - ADIOI_Delete_flattened(datatype); - return; - } /* if (!buftype_is_contig && filetype_is_contig) */ - - /* already know that file is noncontiguous from above */ - /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - disp = fd->disp; - initial_off = offset; - - /* for each case - ADIO_Individual pointer or explicit, find offset - (file offset in bytes), n_filetypes (how many filetypes into file - to start), fwr_size (remaining amount of data in present file - block), and st_index (start point in terms of blocks in starting - filetype) */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent + - flat_file->blocklens[i] >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - ((ADIO_Offset) n_filetypes)*filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } /* while (!flag) */ - } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + - abs_off_in_filetype; - } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ - - start_off = offset; - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - /* only one memory off-len pair, so no array */ - size_t mem_lengths; - size_t mem_offsets; - - i = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - - mem_list_count = 1; - - /* determine how many blocks in file to write */ - f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize); - total_blks_to_write = 1; - if (j < (flat_file->count -1)) j++; - else { - j = 0; - n_filetypes++; - } - while (f_data_wrote < bufsize) { - f_data_wrote += flat_file->blocklens[j]; - total_blks_to_write++; - if (j<(flat_file->count-1)) j++; - else j = 0; - } - - j = st_index; - n_filetypes = st_n_filetypes; - n_write_lists = total_blks_to_write/MAX_ARRAY_SIZE; - extra_blks = total_blks_to_write%MAX_ARRAY_SIZE; - - mem_offsets = (size_t)buf; - mem_lengths = 0; - - /* if at least one full writelist, allocate file arrays - at max array size and don't free until very end */ - if (n_write_lists) { - file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(int64_t)); - file_lengths = (uint64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* - sizeof(uint64_t)); - } - /* if there's no full writelist allocate file arrays according - to needed size (extra_blks) */ - else { - file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* - sizeof(int64_t)); - file_lengths = (uint64_t*)ADIOI_Malloc(extra_blks* - sizeof(uint64_t)); - } - - /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ - for (i=0; i<n_write_lists; i++) { - file_list_count = MAX_ARRAY_SIZE; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = st_fwr_size; - mem_lengths = st_fwr_size; - } - for (k=0; k<MAX_ARRAY_SIZE; k++) { - if (i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent - + flat_file->indices[j]; - file_lengths[k] = flat_file->blocklens[j]; - mem_lengths += file_lengths[k]; - } - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_write(zoidfs_obj_ptr, - 1, buf, &mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - total_bytes_written += mem_lengths; - - mem_offsets += mem_lengths; - mem_lengths = 0; - - } /* for (i=0; i<n_write_lists; i++) */ - - /* for file arrays smaller than MAX_ARRAY_SIZE (last write_list call) */ - if (extra_blks) { - file_list_count = extra_blks; - if(!i) { - file_offsets[0] = offset; - file_lengths[0] = ADIOI_MIN(st_fwr_size, bufsize); - } - for (k=0; k<extra_blks; k++) { - if(i || k) { - file_offsets[k] = disp + - ((ADIO_Offset)n_filetypes)*filetype_extent + - flat_file->indices[j]; - /* XXX: double-check these casts */ - if (k == (extra_blks - 1)) { - file_lengths[k] = bufsize - - mem_lengths - mem_offsets + (size_t)buf; - } - else file_lengths[k] = flat_file->blocklens[j]; - } /* if(i || k) */ - mem_lengths += file_lengths[k]; - if (j<(flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (k=0; k<extra_blks; k++) */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_write(zoidfs_obj_ptr, 1, - (const void **)&mem_offsets, - &mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ - total_bytes_written += mem_lengths; - } - } - else { - /* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - max_mem_list = 0; - max_file_list = 0; - - /* run through and file max_file_list and max_mem_list so that you - can allocate the file and memory arrays less than MAX_ARRAY_SIZE - if possible */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data written and data to be - written in the next immediate write list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fakes filling the writelist arrays of lengths found above */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - if(i) { - if (i == (mem_list_count - 1)) { - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - if (i) { - if (i == (file_list_count - 1)) { - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - size_wrote += new_buffer_write; - start_k = k; - start_j = j; - if (max_mem_list < mem_list_count) - max_mem_list = mem_list_count; - if (max_file_list < file_list_count) - max_file_list = file_list_count; - } /* while (size_wrote < bufsize) */ - - /* one last check before we actually carry out the operation: - * this code has hard-to-fix bugs when a noncontiguous file type has - * such large pieces that the sum of the lengths of the memory type is - * not larger than one of those pieces (and vice versa for large memory - * types and many pices of file types. In these cases, give up and - * fall back to naive reads and writes. The testphdf5 test created a - * type with two very large memory regions and 600 very small file - * regions. The same test also created a type with one very large file - * region and many (700) very small memory regions. both cases caused - * problems for this code */ - - if ( ( (file_list_count == 1) && - (new_file_write < flat_file->blocklens[0] ) ) || - ((mem_list_count == 1) && - (new_buffer_write < flat_buf->blocklens[0]) ) || - ((file_list_count == MAX_ARRAY_SIZE) && - (new_file_write < flat_buf->blocklens[0]) ) || - ( (mem_list_count == MAX_ARRAY_SIZE) && - (new_buffer_write < flat_file->blocklens[0])) ) - { - ADIOI_Delete_flattened(datatype); - ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype, - file_ptr_type, initial_off, status, error_code); - return; - } - - - mem_offsets = (void *)ADIOI_Malloc(max_mem_list*sizeof(void *)); - mem_lengths = (size_t*)ADIOI_Malloc(max_mem_list*sizeof(size_t)); - file_offsets = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); - file_lengths = (uint64_t*)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); - - size_wrote = 0; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - buf_count = 0; - start_mem_offset = 0; - start_k = k = 0; - start_j = st_index; - - /* this section calculates mem_list_count and file_list_count - and also finds the possibly odd sized last array elements - in new_fwr_size and new_bwr_size */ - - while (size_wrote < bufsize) { - k = start_k; - new_buffer_write = 0; - mem_list_count = 0; - while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) { - /* find mem_list_count and file_list_count such that both are - less than MAX_ARRAY_SIZE, the sum of their lengths are - equal, and the sum of all the data written and data to be - written in the next immediate write list is less than - bufsize */ - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k] + - size_wrote) > bufsize) { - end_bwr_size = new_buffer_write + - flat_buf->blocklens[k] - (bufsize - size_wrote); - new_buffer_write = bufsize - size_wrote; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - else new_buffer_write = bwr_size; - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - j = start_j; - new_file_write = 0; - file_list_count = 0; - while ((file_list_count < MAX_ARRAY_SIZE) && - (new_file_write < new_buffer_write)) { - if(file_list_count) { - if((new_file_write + flat_file->blocklens[j]) > - new_buffer_write) { - end_fwr_size = new_buffer_write - new_file_write; - new_file_write = new_buffer_write; - j--; - } - else { - new_file_write += flat_file->blocklens[j]; - end_fwr_size = flat_file->blocklens[j]; - } - } - else { - if (fwr_size > new_buffer_write) { - new_file_write = new_buffer_write; - fwr_size = new_file_write; - } - else new_file_write = fwr_size; - } - file_list_count++; - if (j < (flat_file->count - 1)) j++; - else j = 0; - - k = start_k; - if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) { - new_buffer_write = 0; - mem_list_count = 0; - while (new_buffer_write < new_file_write) { - if(mem_list_count) { - if((new_buffer_write + flat_buf->blocklens[k]) > - new_file_write) { - end_bwr_size = new_file_write - - new_buffer_write; - new_buffer_write = new_file_write; - k--; - } - else { - new_buffer_write += flat_buf->blocklens[k]; - end_bwr_size = flat_buf->blocklens[k]; - } - } - else { - new_buffer_write = bwr_size; - if (bwr_size > (bufsize - size_wrote)) { - new_buffer_write = bufsize - size_wrote; - bwr_size = new_buffer_write; - } - } - mem_list_count++; - k = (k + 1)%flat_buf->count; - } /* while (new_buffer_write < new_file_write) */ - } /* if ((new_file_write < new_buffer_write) && - (file_list_count == MAX_ARRAY_SIZE)) */ - } /* while ((mem_list_count < MAX_ARRAY_SIZE) && - (new_buffer_write < bufsize-size_wrote)) */ - - /* fills the allocated writelist arrays */ - k = start_k; - j = start_j; - for (i=0; i<mem_list_count; i++) { - mem_offsets[i] = buf + - buftype_extent* (buf_count/flat_buf->count) + - flat_buf->indices[k]; - - if(!i) { - mem_lengths[0] = bwr_size; - mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; - } - else { - if (i == (mem_list_count - 1)) { - mem_lengths[i] = end_bwr_size; - if (flat_buf->blocklens[k] == end_bwr_size) - bwr_size = flat_buf->blocklens[(k+1)% - flat_buf->count]; - else { - bwr_size = flat_buf->blocklens[k] - end_bwr_size; - k--; - buf_count--; - } - } - else { - mem_lengths[i] = flat_buf->blocklens[k]; - } - } - buf_count++; - k = (k + 1)%flat_buf->count; - } /* for (i=0; i<mem_list_count; i++) */ - for (i=0; i<file_list_count; i++) { - file_offsets[i] = disp + flat_file->indices[j] + - ((ADIO_Offset)n_filetypes) * filetype_extent; - if (!i) { - file_lengths[0] = fwr_size; - file_offsets[0] += flat_file->blocklens[j] - fwr_size; - } - else { - if (i == (file_list_count - 1)) { - file_lengths[i] = end_fwr_size; - if (flat_file->blocklens[j] == end_fwr_size) - fwr_size = flat_file->blocklens[(j+1)% - flat_file->count]; - else { - fwr_size = flat_file->blocklens[j] - end_fwr_size; - j--; - } - } - else file_lengths[i] = flat_file->blocklens[j]; - } - if (j < flat_file->count - 1) j++; - else { - j = 0; - n_filetypes++; - } - } /* for (i=0; i<file_list_count; i++) */ - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - NO_STALE(err_flag, fd, zoidfs_obj_ptr, - zoidfs_write(zoidfs_obj_ptr, - mem_list_count, mem_offsets, mem_lengths, - file_list_count, - file_offsets, file_lengths, ZOIDFS_NO_OP_HINT)); - /* --BEGIN ERROR HANDLING-- */ - if (err_flag != ZFS_OK) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_ZOIDFS_error_convert(err_flag), - "Error in zoidfs_write", 0); - goto error_state; - } - /* --END ERROR HANDLING-- */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - size_wrote += new_buffer_write; - total_bytes_written += new_buffer_write; /* XXX: is this right? */ - start_k = k; - start_j = j; - } /* while (size_wrote < bufsize) */ - ADIOI_Free(mem_offsets); - ADIOI_Free(mem_lengths); - } - /* when incrementing fp_ind, need to also take into account the file type: - * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| - * if we wrote N elements, offset needs to point at beginning of type, not - * at empty region at offset N+1). - * - * As we discussed on mpich-discuss in may/june 2009, the code below might - * look wierd, but by putting fp_ind at the last byte written, the next - * time we run through the strided code we'll update the fp_ind to the - * right location. */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind = file_offsets[file_list_count-1]+ - file_lengths[file_list_count-1]; - } - ADIOI_Free(file_offsets); - ADIOI_Free(file_lengths); - - *error_code = MPI_SUCCESS; - -error_state: - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/common/ad_aggregate.c b/3rd-party/romio321/adio/common/ad_aggregate.c deleted file mode 100644 index 77c69bdad6653ceffca15147778e8c44f3bf532e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_aggregate.c +++ /dev/null @@ -1,653 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997-2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -#undef AGG_DEBUG - -/* This file contains four functions: - * - * ADIOI_Calc_aggregator() - * ADIOI_Calc_file_domains() - * ADIOI_Calc_my_req() - * ADIOI_Calc_others_req() - * - * The last three of these were originally in ad_read_coll.c, but they are - * also shared with ad_write_coll.c. I felt that they were better kept with - * the rest of the shared aggregation code. - */ - -/* Discussion of values available from above: - * - * ADIO_Offset st_offsets[0..nprocs-1] - * ADIO_Offset end_offsets[0..nprocs-1] - * These contain a list of start and end offsets for each process in - * the communicator. For example, an access at loc 10, size 10 would - * have a start offset of 10 and end offset of 19. - * int nprocs - * number of processors in the collective I/O communicator - * ADIO_Offset min_st_offset - * ADIO_Offset fd_start[0..nprocs_for_coll-1] - * starting location of "file domain"; region that a given process will - * perform aggregation for (i.e. actually do I/O) - * ADIO_Offset fd_end[0..nprocs_for_coll-1] - * start + size - 1 roughly, but it can be less, or 0, in the case of - * uneven distributions - */ - -/* ADIOI_Calc_aggregator() - * - * The intention here is to implement a function which provides basically - * the same functionality as in Rajeev's original version of - * ADIOI_Calc_my_req(). He used a ceiling division approach to assign the - * file domains, and we use the same approach here when calculating the - * location of an offset/len in a specific file domain. Further we assume - * this same distribution when calculating the rank_index, which is later - * used to map to a specific process rank in charge of the file domain. - * - * A better (i.e. more general) approach would be to use the list of file - * domains only. This would be slower in the case where the - * original ceiling division was used, but it would allow for arbitrary - * distributions of regions to aggregators. We'd need to know the - * nprocs_for_coll in that case though, which we don't have now. - * - * Note a significant difference between this function and Rajeev's old code: - * this code doesn't necessarily return a rank in the range - * 0..nprocs_for_coll; instead you get something in 0..nprocs. This is a - * result of the rank mapping; any set of ranks in the communicator could be - * used now. - * - * Returns an integer representing a rank in the collective I/O communicator. - * - * The "len" parameter is also modified to indicate the amount of data - * actually available in this file domain. - */ -int ADIOI_Calc_aggregator(ADIO_File fd, - ADIO_Offset off, - ADIO_Offset min_off, - ADIO_Offset *len, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end) -{ - int rank_index, rank; - ADIO_Offset avail_bytes; - - ADIOI_UNREFERENCED_ARG(fd_start); - - /* get an index into our array of aggregators */ - rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); - - if (fd->hints->striping_unit > 0) { - /* wkliao: implementation for file domain alignment - fd_start[] and fd_end[] have been aligned with file lock - boundaries when returned from ADIOI_Calc_file_domains() so cannot - just use simple arithmatic as above */ - rank_index = 0; - while (off > fd_end[rank_index]) rank_index++; - } - - /* we index into fd_end with rank_index, and fd_end was allocated to be no - * bigger than fd->hins->cb_nodes. If we ever violate that, we're - * overrunning arrays. Obviously, we should never ever hit this abort */ - if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { - FPRINTF(stderr, "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", - rank_index,fd->hints->cb_nodes,fd_size,off); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - /* remember here that even in Rajeev's original code it was the case that - * different aggregators could end up with different amounts of data to - * aggregate. here we use fd_end[] to make sure that we know how much - * data this aggregator is working with. - * - * the +1 is to take into account the end vs. length issue. - */ - avail_bytes = fd_end[rank_index] + 1 - off; - if (avail_bytes < *len) { - /* this file domain only has part of the requested contig. region */ - *len = avail_bytes; - } - - /* map our index to a rank */ - /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ - rank = fd->hints->ranklist[rank_index]; - - return rank; -} - -void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset - *end_offsets, int nprocs, int nprocs_for_coll, - ADIO_Offset *min_st_offset_ptr, - ADIO_Offset **fd_start_ptr, ADIO_Offset - **fd_end_ptr, int min_fd_size, - ADIO_Offset *fd_size_ptr, - int striping_unit) -{ -/* Divide the I/O workload among "nprocs_for_coll" processes. This is - done by (logically) dividing the file into file domains (FDs); each - process may directly access only its own file domain. */ - - ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, fd_size; - int i; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5004, 0, NULL); -#endif - -#ifdef AGG_DEBUG - FPRINTF(stderr, "ADIOI_Calc_file_domains: %d aggregator(s)\n", - nprocs_for_coll); -#endif - -/* find min of start offsets and max of end offsets of all processes */ - - min_st_offset = st_offsets[0]; - max_end_offset = end_offsets[0]; - - for (i=1; i<nprocs; i++) { - min_st_offset = ADIOI_MIN(min_st_offset, st_offsets[i]); - max_end_offset = ADIOI_MAX(max_end_offset, end_offsets[i]); - } - -/* determine the "file domain (FD)" of each process, i.e., the portion of - the file that will be "owned" by each process */ - -/* partition the total file access range equally among nprocs_for_coll - processes */ - fd_size = ((max_end_offset - min_st_offset + 1) + nprocs_for_coll - - 1)/nprocs_for_coll; - /* ceiling division as in HPF block distribution */ - - /* Tweak the file domains so that no fd is smaller than a threshold. We - * have to strike a balance between efficency and parallelism: somewhere - * between 10k processes sending 32-byte requests and one process sending a - * 320k request is a (system-dependent) sweet spot */ - - if (fd_size < min_fd_size) - fd_size = min_fd_size; - - *fd_start_ptr = (ADIO_Offset *) - ADIOI_Malloc(nprocs_for_coll*sizeof(ADIO_Offset)); - *fd_end_ptr = (ADIO_Offset *) - ADIOI_Malloc(nprocs_for_coll*sizeof(ADIO_Offset)); - - fd_start = *fd_start_ptr; - fd_end = *fd_end_ptr; - - /* Wei-keng Liao: implementation for fild domain alignment to nearest file - * lock boundary (as specified by striping_unit hint). Could also - * experiment with other alignment strategies here */ - if (striping_unit > 0) { - ADIO_Offset end_off; - int rem_front, rem_back; - - /* align fd_end[0] to the nearest file lock boundary */ - fd_start[0] = min_st_offset; - end_off = fd_start[0] + fd_size; - rem_front = end_off % striping_unit; - rem_back = striping_unit - rem_front; - if (rem_front < rem_back) - end_off -= rem_front; - else - end_off += rem_back; - fd_end[0] = end_off - 1; - - /* align fd_end[i] to the nearest file lock boundary */ - for (i=1; i<nprocs_for_coll; i++) { - fd_start[i] = fd_end[i-1] + 1; - end_off = min_st_offset + fd_size * (i+1); - rem_front = end_off % striping_unit; - rem_back = striping_unit - rem_front; - if (rem_front < rem_back) - end_off -= rem_front; - else - end_off += rem_back; - fd_end[i] = end_off - 1; - } - fd_end[nprocs_for_coll-1] = max_end_offset; - } - else { /* no hints set: do things the 'old' way */ - fd_start[0] = min_st_offset; - fd_end[0] = min_st_offset + fd_size - 1; - - for (i=1; i<nprocs_for_coll; i++) { - fd_start[i] = fd_end[i-1] + 1; - fd_end[i] = fd_start[i] + fd_size - 1; - } - } - -/* take care of cases in which the total file access range is not - divisible by the number of processes. In such cases, the last - process, or the last few processes, may have unequal load (even 0). - For example, a range of 97 divided among 16 processes. - Note that the division is ceiling division. */ - - for (i=0; i<nprocs_for_coll; i++) { - if (fd_start[i] > max_end_offset) - fd_start[i] = fd_end[i] = -1; - if (fd_end[i] > max_end_offset) - fd_end[i] = max_end_offset; - } - - *fd_size_ptr = fd_size; - *min_st_offset_ptr = min_st_offset; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5005, 0, NULL); -#endif -} - - -/* ADIOI_Calc_my_req() - calculate what portions of the access requests - * of this process are located in the file domains of various processes - * (including this one) - */ -void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, ADIO_Offset fd_size, - int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int **buf_idx_ptr) -/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets? - They are used as memory buffer indices so it seems like the 2G limit is in effect */ -{ - int *count_my_req_per_proc, count_my_req_procs, *buf_idx; - int i, l, proc; - ADIO_Offset fd_len, rem_len, curr_idx, off; - ADIOI_Access *my_req; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5024, 0, NULL); -#endif - - *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs,sizeof(int)); - count_my_req_per_proc = *count_my_req_per_proc_ptr; -/* count_my_req_per_proc[i] gives the no. of contig. requests of this - process in process i's file domain. calloc initializes to zero. - I'm allocating memory of size nprocs, so that I can do an - MPI_Alltoall later on.*/ - - buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); -/* buf_idx is relevant only if buftype_is_contig. - buf_idx[i] gives the index into user_buf where data received - from proc. i should be placed. This allows receives to be done - without extra buffer. This can't be done if buftype is not contig. */ - - /* initialize buf_idx to -1 */ - for (i=0; i < nprocs; i++) buf_idx[i] = -1; - - /* one pass just to calculate how much space to allocate for my_req; - * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() - */ - for (i=0; i < contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - fd_len = len_list[i]; - /* note: we set fd_len to be the total size of the access. then - * ADIOI_Calc_aggregator() will modify the value to return the - * amount that was available from the file domain that holds the - * first part of the access. - */ - proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, - fd_start, fd_end); - count_my_req_per_proc[proc]++; - - /* figure out how much data is remaining in the access (i.e. wasn't - * part of the file domain that had the starting byte); we'll take - * care of this data (if there is any) in the while loop below. - */ - rem_len = len_list[i] - fd_len; - - while (rem_len != 0) { - off += fd_len; /* point to first remaining byte */ - fd_len = rem_len; /* save remaining size, pass to calc */ - proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, - fd_size, fd_start, fd_end); - - count_my_req_per_proc[proc]++; - rem_len -= fd_len; /* reduce remaining length by amount from fd */ - } - } - -/* now allocate space for my_req, offset, and len */ - - *my_req_ptr = (ADIOI_Access *) - ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); - my_req = *my_req_ptr; - - count_my_req_procs = 0; - for (i=0; i < nprocs; i++) { - if (count_my_req_per_proc[i]) { - my_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(ADIO_Offset)); - my_req[i].lens = - ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(ADIO_Offset)); - count_my_req_procs++; - } - my_req[i].count = 0; /* will be incremented where needed - later */ - } - -/* now fill in my_req */ - curr_idx = 0; - for (i=0; i<contig_access_count; i++) { - /* short circuit offset/len processing if len == 0 - * (zero-byte read/write */ - if (len_list[i] == 0) - continue; - off = offset_list[i]; - fd_len = len_list[i]; - proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, - fd_start, fd_end); - - /* for each separate contiguous access from this process */ - if (buf_idx[proc] == -1) - { - ADIOI_Assert(curr_idx == (int) curr_idx); - buf_idx[proc] = (int) curr_idx; - } - - l = my_req[proc].count; - curr_idx += fd_len; - - rem_len = len_list[i] - fd_len; - - /* store the proc, offset, and len information in an array - * of structures, my_req. Each structure contains the - * offsets and lengths located in that process's FD, - * and the associated count. - */ - my_req[proc].offsets[l] = off; - my_req[proc].lens[l] = fd_len; - my_req[proc].count++; - - while (rem_len != 0) { - off += fd_len; - fd_len = rem_len; - proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, - fd_size, fd_start, fd_end); - - if (buf_idx[proc] == -1) - { - ADIOI_Assert(curr_idx == (int) curr_idx); - buf_idx[proc] = (int) curr_idx; - } - - l = my_req[proc].count; - curr_idx += fd_len; - rem_len -= fd_len; - - my_req[proc].offsets[l] = off; - my_req[proc].lens[l] = fd_len; - my_req[proc].count++; - } - } - -#ifdef AGG_DEBUG - for (i=0; i<nprocs; i++) { - if (count_my_req_per_proc[i] > 0) { - FPRINTF(stdout, "data needed from %d (count = %d):\n", i, - my_req[i].count); - for (l=0; l < my_req[i].count; l++) { - FPRINTF(stdout, " off[%d] = %lld, len[%d] = %d\n", l, - my_req[i].offsets[l], l, my_req[i].lens[l]); - } - FPRINTF(stdout, "buf_idx[%d] = 0x%x\n", i, buf_idx[i]); - } - } -#endif - - *count_my_req_procs_ptr = count_my_req_procs; - *buf_idx_ptr = buf_idx; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5025, 0, NULL); -#endif -} - - - -void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs, - int *count_my_req_per_proc, - ADIOI_Access *my_req, - int nprocs, int myrank, - int *count_others_req_procs_ptr, - ADIOI_Access **others_req_ptr) -{ -/* determine what requests of other processes lie in this process's - file domain */ - -/* count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - int *count_others_req_per_proc, count_others_req_procs; - int i, j; - MPI_Request *requests; - MPI_Status *statuses; - ADIOI_Access *others_req; - -/* first find out how much to send/recv and from/to whom */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5026, 0, NULL); -#endif - count_others_req_per_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - - MPI_Alltoall(count_my_req_per_proc, 1, MPI_INT, - count_others_req_per_proc, 1, MPI_INT, fd->comm); - - *others_req_ptr = (ADIOI_Access *) - ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); - others_req = *others_req_ptr; - - count_others_req_procs = 0; - for (i=0; i<nprocs; i++) { - if (count_others_req_per_proc[i]) { - others_req[i].count = count_others_req_per_proc[i]; - others_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - others_req[i].lens = - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - others_req[i].mem_ptrs = (MPI_Aint *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(MPI_Aint)); - count_others_req_procs++; - } - else others_req[i].count = 0; - } - -/* now send the calculated offsets and lengths to respective processes */ - - requests = (MPI_Request *) - ADIOI_Malloc(1+2*(count_my_req_procs+count_others_req_procs)*sizeof(MPI_Request)); -/* +1 to avoid a 0-size malloc */ - - j = 0; - for (i=0; i<nprocs; i++) { - if (others_req[i].count) { - MPI_Irecv(others_req[i].offsets, others_req[i].count, - ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]); - j++; - MPI_Irecv(others_req[i].lens, others_req[i].count, - ADIO_OFFSET, i, i+myrank+1, fd->comm, &requests[j]); - j++; - } - } - - for (i=0; i < nprocs; i++) { - if (my_req[i].count) { - MPI_Isend(my_req[i].offsets, my_req[i].count, - ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]); - j++; - MPI_Isend(my_req[i].lens, my_req[i].count, - ADIO_OFFSET, i, i+myrank+1, fd->comm, &requests[j]); - j++; - } - } - - if (j) { - statuses = (MPI_Status *) ADIOI_Malloc(j * sizeof(MPI_Status)); - MPI_Waitall(j, requests, statuses); - ADIOI_Free(statuses); - } - - ADIOI_Free(requests); - ADIOI_Free(count_others_req_per_proc); - - *count_others_req_procs_ptr = count_others_req_procs; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5027, 0, NULL); -#endif -} - - -/* Nonblocking version of ADIOI_Calc_others_req(). - It consists of three functions - ADIOI_Icalc_others_req(), - ADIOI_Icalc_others_req_main(), and ADIOI_Icalc_others_req_fini(). */ -void ADIOI_Icalc_others_req(ADIOI_NBC_Request *nbc_req, int *error_code) -{ - ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; - - /* count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - /* first find out how much to send/recv and from/to whom */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event(5026, 0, NULL); -#endif - vars->count_others_req_per_proc = - (int *)ADIOI_Malloc(vars->nprocs * sizeof(int)); - - *error_code = MPI_Ialltoall(vars->count_my_req_per_proc, 1, MPI_INT, - vars->count_others_req_per_proc, 1, MPI_INT, vars->fd->comm, - &vars->req1); - - if (nbc_req->rdwr == ADIOI_READ) { - nbc_req->data.rd.state = ADIOI_IRC_STATE_ICALC_OTHERS_REQ; - } else { - ADIOI_Assert(nbc_req->rdwr == ADIOI_WRITE); - nbc_req->data.wr.state = ADIOI_IWC_STATE_ICALC_OTHERS_REQ; - } -} - -void ADIOI_Icalc_others_req_main(ADIOI_NBC_Request *nbc_req, int *error_code) -{ - ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; - ADIO_File fd = vars->fd; - int count_my_req_procs = vars->count_my_req_procs; - ADIOI_Access *my_req = vars->my_req; - int nprocs = vars->nprocs; - int myrank = vars->myrank; - ADIOI_Access **others_req_ptr = vars->others_req_ptr; - - /* determine what requests of other processes lie in this process's - file domain */ - - /* count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - int *count_others_req_per_proc = vars->count_others_req_per_proc; - int count_others_req_procs; - int i, j; - ADIOI_Access *others_req; - - *others_req_ptr = (ADIOI_Access *)ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); - others_req = *others_req_ptr; - - count_others_req_procs = 0; - for (i = 0; i < nprocs; i++) { - if (count_others_req_per_proc[i]) { - others_req[i].count = count_others_req_per_proc[i]; - others_req[i].offsets = (ADIO_Offset *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - others_req[i].lens = - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - others_req[i].mem_ptrs = (MPI_Aint *) - ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(MPI_Aint)); - count_others_req_procs++; - } - else others_req[i].count = 0; - } - vars->count_others_req_procs = count_others_req_procs; - - /* now send the calculated offsets and lengths to respective processes */ - - vars->req2 = (MPI_Request *) - ADIOI_Malloc(1+2*(count_my_req_procs+count_others_req_procs) - *sizeof(MPI_Request)); - /* +1 to avoid a 0-size malloc */ - - j = 0; - for (i = 0; i < nprocs; i++) { - if (others_req[i].count) { - MPI_Irecv(others_req[i].offsets, others_req[i].count, - ADIO_OFFSET, i, i+myrank, fd->comm, &vars->req2[j]); - j++; - MPI_Irecv(others_req[i].lens, others_req[i].count, - ADIO_OFFSET, i, i+myrank+1, fd->comm, &vars->req2[j]); - j++; - } - } - - for (i=0; i < nprocs; i++) { - if (my_req[i].count) { - MPI_Isend(my_req[i].offsets, my_req[i].count, - ADIO_OFFSET, i, i+myrank, fd->comm, &vars->req2[j]); - j++; - MPI_Isend(my_req[i].lens, my_req[i].count, - ADIO_OFFSET, i, i+myrank+1, fd->comm, &vars->req2[j]); - j++; - } - } - - /* keep the number of requests */ - vars->num_req2 = j; - - if (nbc_req->rdwr == ADIOI_READ) { - nbc_req->data.rd.state = ADIOI_IRC_STATE_ICALC_OTHERS_REQ_MAIN; - } else { - ADIOI_Assert(nbc_req->rdwr == ADIOI_WRITE); - nbc_req->data.wr.state = ADIOI_IWC_STATE_ICALC_OTHERS_REQ_MAIN; - } -} - -void ADIOI_Icalc_others_req_fini(ADIOI_NBC_Request *nbc_req, int *error_code) -{ - ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; - void (*next_fn)(ADIOI_NBC_Request *, int *); - - ADIOI_Free(vars->req2); - ADIOI_Free(vars->count_others_req_per_proc); - - *vars->count_others_req_procs_ptr = vars->count_others_req_procs; -#ifdef AGGREGATION_PROFILE - MPE_Log_event(5027, 0, NULL); -#endif - /* end of the calculation */ - - next_fn = vars->next_fn; - - /* free the struct for parameters and variables */ - ADIOI_Free(vars); - nbc_req->cor_vars = NULL; - - /* move to the next function */ - next_fn(nbc_req, error_code); -} - diff --git a/3rd-party/romio321/adio/common/ad_aggregate_new.c b/3rd-party/romio321/adio/common/ad_aggregate_new.c deleted file mode 100644 index aca60b27023c05a1e7b0d83de985bedbdea6d415..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_aggregate_new.c +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif -#include <assert.h> -/* #define DEBUG */ - -void ADIOI_Calc_file_realms_user_size (ADIO_File fd, int fr_size, - int nprocs_for_coll, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types); -void ADIOI_Calc_file_realms_aar (ADIO_File fd, int nprocs_for_coll, - int pfr_enabled, - ADIO_Offset min_st_offset, - ADIO_Offset max_end_offset, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types); -void ADIOI_Calc_file_realms_fsize (ADIO_File fd, - int nprocs_for_coll, - ADIO_Offset max_end_offset, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types); -void ADIOI_Create_fr_simpletype (int size, int nprocs_for_coll, - MPI_Datatype *simpletype); -static void align_fr (int fr_size, ADIO_Offset fr_off, int alignment, - int *aligned_fr_size, ADIO_Offset *aligned_fr_off); -void ADIOI_Verify_fr (int nprocs_for_coll, ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types); - -void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset, - ADIO_Offset max_end_offset) -{ - int nprocs_for_coll; - int file_realm_calc_type; - - MPI_Datatype *file_realm_types = NULL; - ADIO_Offset *file_realm_st_offs = NULL; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5004, 0, NULL); -#endif -#ifdef DEBUG - printf ("ADIOI_Calc_file_realms\n"); -#endif - - nprocs_for_coll = fd->hints->cb_nodes; - file_realm_calc_type = fd->hints->cb_fr_type; - - /* If PFRs are disabled we know these pointers are not allocated */ - if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { - fd->file_realm_st_offs = NULL; - fd->file_realm_types = NULL; - } - - if (nprocs_for_coll == 1) { - /* if there's only one aggregator, we can reset the file - * realms every single time */ - if (fd->file_realm_st_offs == NULL) - { - file_realm_st_offs = (ADIO_Offset *) - ADIOI_Malloc (sizeof(ADIO_Offset)); - file_realm_types = (MPI_Datatype *) - ADIOI_Malloc (sizeof(MPI_Datatype)); - } - else - { - file_realm_st_offs = fd->file_realm_st_offs; - file_realm_types = fd->file_realm_types; - } - *file_realm_st_offs = min_st_offset; - MPI_Type_contiguous ((max_end_offset - min_st_offset + 1), MPI_BYTE, - file_realm_types); - MPI_Type_commit (file_realm_types); - ADIOI_Add_contig_flattened (*file_realm_types); - } - else if (fd->file_realm_st_offs == NULL) { - file_realm_st_offs = (ADIO_Offset *) - ADIOI_Malloc (nprocs_for_coll * sizeof(ADIO_Offset)); - file_realm_types = (MPI_Datatype *) - ADIOI_Malloc (nprocs_for_coll * sizeof(MPI_Datatype)); - - if (file_realm_calc_type == ADIOI_FR_AAR) { - ADIOI_Calc_file_realms_aar (fd, nprocs_for_coll, - fd->hints->cb_pfr, - min_st_offset, max_end_offset, - file_realm_st_offs, file_realm_types); - /* flatten file realm datatype for future use - only one - * because all are the same*/ - ADIOI_Flatten_datatype (file_realm_types[0]); - } - else if (file_realm_calc_type == ADIOI_FR_FSZ) { - ADIOI_Calc_file_realms_fsize (fd, nprocs_for_coll, max_end_offset, - file_realm_st_offs, - file_realm_types); - /* flatten file realm datatype for future use - only one - * because all are the same*/ - ADIOI_Flatten_datatype (file_realm_types[0]); - } - else if (file_realm_calc_type == ADIOI_FR_USR_REALMS) { - /* copy user provided realm datatypes and realm offsets in - * hints to file descriptor. may also want to verify that - * the provided file realms are covering (for pfr at - * least) and non-overlapping */ - } - else if (file_realm_calc_type > 0) { - ADIOI_Calc_file_realms_user_size (fd, file_realm_calc_type, - nprocs_for_coll, - file_realm_st_offs, - file_realm_types); - /* flatten file realm datatype for future use - only one - * because all are the same */ - ADIOI_Flatten_datatype (file_realm_types[0]); - } - } - fd->file_realm_st_offs = file_realm_st_offs; - fd->file_realm_types = file_realm_types; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5005, 0, NULL); -#endif -} - -void ADIOI_Calc_file_realms_user_size (ADIO_File fd, int fr_size, - int nprocs_for_coll, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types) -{ - int i; - int aligned_fr_size; - ADIO_Offset aligned_fr_off; - MPI_Datatype simpletype; - - align_fr(fr_size, 0, fd->hints->cb_fr_alignment, &aligned_fr_size, - &aligned_fr_off); - fr_size = aligned_fr_size; - ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); - - if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) - file_realm_st_offs[0] = 0; - else - file_realm_st_offs[0] = aligned_fr_off; - file_realm_types[0] = simpletype; -#ifdef DEBUG - printf ("file_realm[0] = (%lld, %d)\n", file_realm_st_offs[0], - fr_size); -#endif - - for (i=1; i < nprocs_for_coll; i++) - { - file_realm_st_offs[i] = file_realm_st_offs[i-1] + fr_size; - file_realm_types[i] = simpletype; -#ifdef DEBUG - printf ("file_realm[%d] = (%lld, %d)\n", i, file_realm_st_offs[i], - aligned_fr_size); -#endif - } -} - -/* takes an extra romio_cb_pfr param to decide whether file realms - * should start at byte 0 of the file*/ -void ADIOI_Calc_file_realms_aar (ADIO_File fd, int nprocs_for_coll, int cb_pfr, - ADIO_Offset min_st_offset, - ADIO_Offset max_end_offset, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types) -{ - int fr_size, aligned_fr_size, i; - MPI_Datatype simpletype; - ADIO_Offset aligned_start_off; - char value[9]; - - fr_size = (max_end_offset - min_st_offset + nprocs_for_coll) / - nprocs_for_coll; - align_fr(fr_size, min_st_offset, fd->hints->cb_fr_alignment, - &aligned_fr_size, &aligned_start_off); - fr_size = aligned_fr_size; - ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); - if (cb_pfr == ADIOI_HINT_ENABLE) - file_realm_st_offs[0] = 0; - else - file_realm_st_offs[0] = aligned_start_off; - file_realm_types[0] = simpletype; - -#ifdef DEBUG - printf ("file_realm[0] = (%lld, %d)\n", file_realm_st_offs[0], - fr_size); -#endif - for (i=1; i < nprocs_for_coll; i++) - { - file_realm_st_offs[i] = file_realm_st_offs[i-1] + fr_size; - file_realm_types[i] = simpletype; -#ifdef DEBUG - printf ("file_realm[%d] = (%lld, %d)\n", i, file_realm_st_offs[i], - fr_size); -#endif - } - if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { - sprintf (value, "%d", fr_size); - ADIOI_Info_set (fd->info, "romio_cb_fr_type", value); - } -} - -void ADIOI_Calc_file_realms_fsize (ADIO_File fd, int nprocs_for_coll, - ADIO_Offset max_end_offset, - ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types) -{ - int fr_size, aligned_fr_size, error_code, i; - int fsize; - ADIO_Offset aligned_fr_off; - ADIO_Fcntl_t fcntl_struct; - MPI_Datatype simpletype; - - ADIO_Fcntl (fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); - - /* use impending file size since a write call may lengthen the file */ - fsize = ADIOI_MAX (fcntl_struct.fsize, max_end_offset+1); - fr_size = (fsize + nprocs_for_coll - 1) / nprocs_for_coll; - align_fr(fr_size, 0, fd->hints->cb_fr_alignment, - &aligned_fr_size, &aligned_fr_off); - ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); - - for (i=0; i < nprocs_for_coll; i++) - { - file_realm_st_offs[i] = fr_size * i; - file_realm_types[i] = simpletype; - } -} - -/* creates a datatype with an empty trailing edge */ -void ADIOI_Create_fr_simpletype (int size, int nprocs_for_coll, - MPI_Datatype *simpletype) -{ - int count=1, blocklens[1]; - MPI_Aint indices[1]; - MPI_Datatype old_types[1]; - MPI_Datatype inttype; - - blocklens[0] = size; - indices[0] = 0; - old_types[0] = MPI_BYTE; - - MPI_Type_create_struct (count, blocklens, indices, old_types, &inttype); - MPI_Type_create_resized (inttype, 0, size*nprocs_for_coll, simpletype); - MPI_Type_free (&inttype); - - MPI_Type_commit (simpletype); -} - -/* Verify that file realms are covering (PFRs) and non-overlapping */ -void ADIOI_Verify_fr (int nprocs_for_coll, ADIO_Offset *file_realm_st_offs, - MPI_Datatype *file_realm_types) -{ -} - -int ADIOI_Agg_idx (int rank, ADIO_File fd) { - int i, cb_nodes, *ranklist; - cb_nodes = fd->hints->cb_nodes; - ranklist = fd->hints->ranklist; - - for (i=0; i<cb_nodes; i++) { - if (ranklist[i]) - return i; - } - return -1; -} - -static void align_fr (int fr_size, ADIO_Offset fr_off, int alignment, - int *aligned_fr_size, ADIO_Offset *aligned_fr_off) { - *aligned_fr_off = fr_off - (fr_off % alignment); - *aligned_fr_size = ((fr_off + fr_size) / alignment) * alignment - - *aligned_fr_off; - if ((fr_off + fr_size) % alignment) - *aligned_fr_size += alignment; - - assert(!((*aligned_fr_off % alignment) || - (*aligned_fr_size % alignment))); -} diff --git a/3rd-party/romio321/adio/common/ad_close.c b/3rd-party/romio321/adio/common/ad_close.c deleted file mode 100644 index 0c39d9e9471c77044bd1f170a497cc935cdf3333..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_close.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIO_Close(ADIO_File fd, int *error_code) -{ - int i, j, k, combiner, myrank, err, is_contig; - static char myname[] = "ADIO_CLOSE"; - - if (fd->async_count) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - return; - } - - /* because of deferred open, this warants a bit of explaining. First, if - * we've done aggregation, - * then close the file. Then, if any process left has done independent - * i/o, close the file. Otherwise, we'll skip the fs-specific close and - * just say everything is a-ok. - * - * XXX: is it ok for those processes with a "real" communicator and those - * with "MPI_COMM_SELF" to both call ADIOI_xxx_Close at the same time ? - * everyone who ever opened the file will close it. Is order important? Is - * timing important? - */ - if (fd->hints->deferred_open && fd->is_agg) { - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); - } else { - if(fd->is_open) { - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); - } else { - *error_code = MPI_SUCCESS; - } - - } - - if (fd->access_mode & ADIO_DELETE_ON_CLOSE) { - /* if we are doing aggregation and deferred open, then it's possible - * that rank 0 does not have access to the file. make sure only an - * aggregator deletes the file.*/ - MPI_Comm_rank(fd->comm, &myrank); - if (myrank == fd->hints->ranklist[0]) { - ADIO_Delete(fd->filename, &err); - } - MPI_Barrier(fd->comm); - } - - if (fd->fortran_handle != -1) { - ADIOI_Ftable[fd->fortran_handle] = MPI_FILE_NULL; - } - - if (fd->hints) ADIOI_Free(fd->hints->ranklist); - if (fd->hints && fd->hints->cb_config_list) ADIOI_Free(fd->hints->cb_config_list); - - /* This BlueGene platform-specific free must be done in the common code - * because the malloc's for these hint data structures are done at the - * scope of ADIO_Open within the SetInfo call (ADIOI_GPFS_SetInfo which - * calls ADIOI_BG_gen_agg_ranklist). They cannot be done in the - * ADIOI_GPFS_Close because of the file creation case where the - * ADIOI_GPFS_Close and re-open via ADIOI_GPFS_Open are done which results - * in a double-free - ADIOI_GPFS_Open does not redo the SetInfo... */ -#ifdef BGQPLATFORM - if (fd->hints && fd->hints->fs_hints.bg.bridgelist) ADIOI_Free(fd->hints->fs_hints.bg.bridgelist); - if (fd->hints && fd->hints->fs_hints.bg.bridgelistnum) ADIOI_Free(fd->hints->fs_hints.bg.bridgelistnum); -#endif - - /* Persistent File Realms */ - if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { - /* AAR, FSIZE, and User provided uniform File realms */ - if (1) { - ADIOI_Delete_flattened (fd->file_realm_types[0]); - MPI_Type_free (&fd->file_realm_types[0]); - } - else { - for (i=0; i<fd->hints->cb_nodes; i++) { - ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig); - if (!is_contig) - ADIOI_Delete_flattened(fd->file_realm_types[i]); - MPI_Type_free (&fd->file_realm_types[i]); - } - } - ADIOI_Free(fd->file_realm_st_offs); - ADIOI_Free(fd->file_realm_types); - } - ADIOI_Free(fd->hints); - - - - MPI_Comm_free(&(fd->comm)); - ADIOI_Free(fd->filename); - - MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner); - if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype)); - - ADIOI_Datatype_iscontig(fd->filetype, &is_contig); - if (!is_contig) ADIOI_Delete_flattened(fd->filetype); - - MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner); - if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype)); - - MPI_Info_free(&(fd->info)); - - ADIOI_Free(fd->io_buf); - ADIOI_OneSidedCleanup(fd); - - /* memory for fd is freed in MPI_File_close */ -} diff --git a/3rd-party/romio321/adio/common/ad_coll_build_req_new.c b/3rd-party/romio321/adio/common/ad_coll_build_req_new.c deleted file mode 100644 index a15d61cc32925c1eb8d8298b1524b6ca56e4babc..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_coll_build_req_new.c +++ /dev/null @@ -1,2084 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include <assert.h> -#include "adio.h" -#include "adio_extern.h" -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif -#include "heap-sort.h" - -/* -#define DEBUG1 -#define DEBUG2 -#define DEBUG3 -*/ -/* #define DEBUG_HEAP */ - -#define DTYPE_SKIP - -#ifdef DEBUG3 -static char *off_type_name[MAX_OFF_TYPE] = {"TEMP_OFFSETS", - "REAL_OFFSETS"}; -#endif - -/* Simple function to return the size of the view_state. */ -static inline ADIO_Offset view_state_get_cur_sz(view_state *tmp_view_state_p, - int op_type) -{ - flatten_state *tmp_state_p = NULL; - switch(op_type) - { - case TEMP_OFF: - tmp_state_p = &(tmp_view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_state_p = &(tmp_view_state_p->cur_state); - break; - default: - fprintf(stderr, "op_type invalid\n"); - } - return tmp_state_p->cur_sz; -} - -/* Simple function to return the len of the next piece of the view_state. */ -static inline ADIO_Offset view_state_get_next_len(view_state *tmp_view_state_p, - int op_type) -{ - flatten_state *tmp_state_p = NULL; - switch(op_type) - { - case TEMP_OFF: - tmp_state_p = &(tmp_view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_state_p = &(tmp_view_state_p->cur_state); - break; - default: - fprintf(stderr, "op_type invalid\n"); - } - return (ADIO_Offset) - tmp_view_state_p->flat_type_p->blocklens[tmp_state_p->idx] - - tmp_state_p->cur_reg_off; -} - -/* Add up to a region of a file view and no larger than a max size. - * The view_state is always consistent with the abs_off and where the - * index and cur_reg_off point to. The regions should be coalesced if - * possible later on. */ -static inline int view_state_add_region( - ADIO_Offset max_sz, - view_state *tmp_view_state_p, - ADIO_Offset *st_reg_p, - ADIO_Offset *tmp_reg_sz_p, - int op_type) -{ - ADIOI_Flatlist_node *tmp_flat_type_p = NULL; - flatten_state *tmp_state_p = NULL; - int64_t data_sz = 0; - -#ifdef AGGREGATION_PROFILE - /* MPE_Log_event (5020, 0, NULL); */ -#endif - - switch(op_type) - { - case TEMP_OFF: - tmp_state_p = &(tmp_view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_state_p = &(tmp_view_state_p->cur_state); - break; - default: - fprintf(stderr, "op_type invalid\n"); - } - - tmp_flat_type_p = tmp_view_state_p->flat_type_p; - - *st_reg_p = tmp_state_p->abs_off; - - /* Should be looking at some data (or it's a zero len blocklens - * (i.e. placeholder). */ - assert(tmp_state_p->cur_reg_off != - tmp_flat_type_p->blocklens[tmp_state_p->idx]); - /* Shouldn't have been called if the view_state is done. */ - assert(tmp_state_p->cur_sz != tmp_view_state_p->sz); - - /* Make sure we are not in a non-zero region in the flat_type */ - assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); - -#ifdef DEBUG3 - fprintf(stderr, "view_state:(blocklens[%Ld]=%d,cur_reg_off=%Ld," - "max_sz=%Ld)\n", tmp_state_p->idx, - tmp_flat_type_p->blocklens[tmp_state_p->idx], - tmp_state_p->cur_reg_off, max_sz); -#endif - - /* Can it add the whole piece? */ - if (tmp_flat_type_p->blocklens[tmp_state_p->idx] - - tmp_state_p->cur_reg_off <= max_sz) - { - data_sz = tmp_flat_type_p->blocklens[tmp_state_p->idx] - - tmp_state_p->cur_reg_off; - - tmp_state_p->cur_sz += data_sz; - - /* Advance the abs_off to the beginning of the next piece */ - if (tmp_flat_type_p->count == 1) - { - assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); - tmp_state_p->abs_off += data_sz; -#ifdef DEBUG3 - fprintf(stderr, "view_state_add_region: %s contig type " - "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", - off_type_name[op_type], tmp_state_p->abs_off - data_sz, - tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); -#endif - } - else - { - /* Is this the last region in the datatype? */ - if (tmp_state_p->idx == (tmp_flat_type_p->count - 1)) - { - tmp_state_p->abs_off += data_sz - - tmp_flat_type_p->indices[tmp_flat_type_p->count-1] - - tmp_flat_type_p->blocklens[tmp_flat_type_p->count-1] + - tmp_view_state_p->ext; -#ifdef DEBUG3 - fprintf(stderr, "view_state_add_region: %s last region for type " - "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", - off_type_name[op_type], tmp_state_p->abs_off - data_sz, - tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); -#endif - } - else - { - tmp_state_p->abs_off += - tmp_flat_type_p->indices[tmp_state_p->idx + 1] - - (tmp_flat_type_p->indices[tmp_state_p->idx] + - tmp_state_p->cur_reg_off); -#ifdef DEBUG3 - fprintf(stderr, "view_state_add_region: %s inner region type " - "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", - off_type_name[op_type], tmp_state_p->abs_off - - (tmp_flat_type_p->indices[tmp_state_p->idx + 1] - - (tmp_flat_type_p->indices[tmp_state_p->idx] + - tmp_state_p->cur_reg_off)), tmp_state_p->abs_off, - tmp_state_p->cur_sz, data_sz); -#endif - } - /* Increment idx to next non-zero region in the flat_type */ - do { - tmp_state_p->idx = - (tmp_state_p->idx + 1) % tmp_flat_type_p->count; - } while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0); - } - tmp_state_p->cur_reg_off = 0; - } - else /* Add part of the piece */ - { - data_sz = max_sz; - tmp_state_p->cur_reg_off += data_sz; - tmp_state_p->abs_off += data_sz; - tmp_state_p->cur_sz += data_sz; -#ifdef DEBUG3 - fprintf(stderr, "view_state_add_region: %s partial region type " - "(cur_reg_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld\n", - off_type_name[op_type], tmp_state_p->cur_reg_off, - tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); -#endif - } - - *tmp_reg_sz_p = data_sz; -#ifdef AGGREGATION_PROFILE - /* MPE_Log_event (5021, 0, NULL); */ -#endif - return 0; -} - -/* Set up the abs_off, idx, and cur_reg_off of a view_state for the - * tmp_state or the cur_state. */ -int ADIOI_init_view_state(int file_ptr_type, - int nprocs, - view_state *view_state_arr, - int op_type) -{ - ADIOI_Flatlist_node *tmp_flat_type_p = NULL; - ADIO_Offset tmp_off_used = 0, st_reg = 0, tmp_reg_sz = 0; - int i; - flatten_state *tmp_state_p = NULL; - view_state *tmp_view_p = NULL; - - for (i = 0; i < nprocs; i++) - { - switch(op_type) - { - case TEMP_OFF: - tmp_state_p = &(view_state_arr[i].tmp_state); - break; - case REAL_OFF: - tmp_state_p = &(view_state_arr[i].cur_state); - break; - default: - fprintf(stderr, "op_type invalid\n"); - } - - tmp_view_p = &(view_state_arr[i]); - tmp_flat_type_p = tmp_view_p->flat_type_p; - - if (file_ptr_type == ADIO_INDIVIDUAL) - tmp_state_p->abs_off = tmp_view_p->fp_ind; - else - tmp_state_p->abs_off = tmp_view_p->disp; - - tmp_off_used = 0; - - /* initialize tmp_state idx */ - while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0) - tmp_state_p->idx = (tmp_state_p->idx + 1) % tmp_flat_type_p->count; - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) - tmp_state_p->abs_off += tmp_flat_type_p->indices[tmp_state_p->idx]; - - /* Initialize the abs_off by moving into the datatype - * byte_off bytes. Since we only do this in the beginning, we - * make the assumption that pieces are added whole until the last - * piece which MAY be partial. */ - while (tmp_off_used != tmp_view_p->byte_off) - { - view_state_add_region( - tmp_view_p->byte_off - tmp_off_used, - &(view_state_arr[i]), &st_reg, &tmp_reg_sz, - op_type); - } - - /* Re-initialize the cur_size so that the abs_off was set to - * the proper position while the actual size = 0.*/ - tmp_state_p->cur_sz = 0; -#ifdef DEBUG1 - fprintf(stderr, "init_view_state: %s (idx=%d,byte_off=%Ld," - "abs_off=%Ld,reg_off=%Ld,sz=%Ld)\n", off_type_name[op_type], - i, tmp_view_p->byte_off, tmp_state_p->abs_off, - tmp_state_p->cur_reg_off, tmp_view_p->sz); -#endif - - } - return 0; -} - -/* Return the next file realm offset and length for this datatype state - * within a particular file realm. */ -static inline int get_next_fr_off(ADIO_File fd, - ADIO_Offset off, - ADIO_Offset fr_st_off, - MPI_Datatype *fr_type_p, - ADIO_Offset *fr_next_off_p, - ADIO_Offset *fr_max_len_p) -{ - MPI_Aint fr_extent = -1, lb; - ADIO_Offset tmp_off, off_rem; - ADIOI_Flatlist_node *fr_node_p = ADIOI_Flatlist; - int i = -1, fr_dtype_ct = 0; - - /* Should have already been flattened in calc_file_realms() */ - while (fr_node_p->type != (*fr_type_p)) - fr_node_p = fr_node_p->next; - assert(fr_node_p != NULL); - - /* Did we get to the first region of the file realm? */ - if (off - fr_st_off < 0) - { - *fr_next_off_p = fr_st_off + fr_node_p->indices[0]; - *fr_max_len_p = fr_node_p->blocklens[0]; - return 0; - } - - /* Calculate how many times to loop through the fr_type - * and where the next fr_off is. */ - MPI_Type_get_extent(*fr_type_p, &lb, &fr_extent); - tmp_off = off - fr_st_off; - fr_dtype_ct = tmp_off / fr_extent; - off_rem = tmp_off % fr_extent; - for (i = 0; i < fr_node_p->count; i++) - { - if (off_rem < fr_node_p->indices[i]) - { - *fr_next_off_p = fr_st_off + - (fr_dtype_ct * fr_extent) + fr_node_p->indices[i]; - *fr_max_len_p = fr_node_p->blocklens[i]; - return 0; - } - else if (off_rem < fr_node_p->indices[i] + fr_node_p->blocklens[i]) - { - *fr_next_off_p = off; - *fr_max_len_p = fr_node_p->blocklens[i] - - (off_rem - fr_node_p->indices[i]); - return off; - } - } - - /* Shouldn't get here. */ - fprintf(stderr, "get_next_fr_off: Couldn't find the correct " - "location of the next offset for this file realm.\n"); - return -1; -} - -/* Look in all the view states for the first offset within a given - * file realm. Report the end of a contiguous region within the file - * realm (possibly more than the actual view state may be able to - * process contiguously). */ -static inline int find_next_off(ADIO_File fd, - view_state *view_state_p, - ADIO_Offset fr_st_off, - MPI_Datatype *fr_type_p, - int op_type, - ADIO_Offset *cur_off_p, - ADIO_Offset *cur_reg_max_len_p) -{ - ADIOI_Flatlist_node *tmp_flat_type_p = NULL; - ADIO_Offset tmp_off = -1, fr_next_off = -1, fr_max_len = -1, - tmp_fr_max_len = -1; - int ret = 0; - flatten_state *tmp_state_p = NULL; - ADIO_Offset tmp_st_off = 0, tmp_reg_sz = 0; -#ifdef DTYPE_SKIP - int skip_type_ct; -#endif - -#ifdef AGGREGATION_PROFILE - /* MPE_Log_event (5022, 0, NULL); */ -#endif - - switch(op_type) - { - case TEMP_OFF: - tmp_state_p = &(view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_state_p = &(view_state_p->cur_state); - break; - default: - fprintf(stderr, "op_type invalid\n"); - } - - tmp_flat_type_p = view_state_p->flat_type_p; - - /* Can we use this proc? */ - if (tmp_state_p->cur_sz < view_state_p->sz) { - tmp_st_off = 0; - tmp_reg_sz = 0; - /* If the current region is not within the file realm, advance - * the state until it is and calculate the end of the next file - * realm in fr_max_len. */ - ret = get_next_fr_off(fd, - tmp_state_p->abs_off, - fr_st_off, - fr_type_p, - &fr_next_off, - &fr_max_len); - - while ((tmp_state_p->abs_off < fr_next_off) && - (tmp_state_p->cur_sz != view_state_p->sz)) - { - - /* While this might appear to be erroneous at first, - * view_state_add_region can only add a single piece at a - * time. Therefore, it will never overshoot the beginning - * of the next file realm. When it finally does enter the - * next file realm it will not be able to go beyond its - * first piece. */ - -#ifdef DTYPE_SKIP - if (tmp_flat_type_p->count > 1) { - /* let's see if we can skip whole datatypes */ - skip_type_ct = (fr_next_off - tmp_state_p->abs_off) / - view_state_p->ext; - if (skip_type_ct > 0) { - /* before we go on, let's check if we've actually - * finished up already */ - tmp_state_p->cur_sz += skip_type_ct * - view_state_p->type_sz; - if (tmp_state_p->cur_sz >= view_state_p->sz) { - tmp_state_p->cur_sz = view_state_p->sz; - break; - } - tmp_state_p->abs_off += skip_type_ct * view_state_p->ext; - } - } -#endif - view_state_add_region( - fr_next_off - tmp_state_p->abs_off, - view_state_p, - &tmp_st_off, - &tmp_reg_sz, - op_type); - - ret = get_next_fr_off(fd, - tmp_state_p->abs_off, - fr_st_off, - fr_type_p, - &fr_next_off, - &fr_max_len); - } - - if (tmp_state_p->cur_sz != view_state_p->sz) { - tmp_off = tmp_state_p->abs_off; - /* Calculate how much of the remaining file realm there is from the - * current offset */ - tmp_fr_max_len = fr_next_off + fr_max_len - tmp_off; - } - } - - *cur_off_p = tmp_off; - *cur_reg_max_len_p = tmp_fr_max_len; -#ifdef AGGREGATION_PROFILE - /* MPE_Log_event (5023, 0, NULL); */ -#endif - return ret; -} - -/* Upon completion of a full collective buffer, end of a file realm - * region (data sieving), or the end of all I/O for an aggregator, we - * should return a list of MPI_Datatypes that correspond to client - * communication into a collective buffer, a list of corresponding - * sizes, and an aggregate MPI_Datatype which will be used as a - * filetype in MPI_File_write/read on the aggregator. */ -int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, - view_state *client_file_view_state_arr, - MPI_Datatype *client_comm_dtype_arr, - ADIO_Offset *client_comm_sz_arr, - ADIO_Offset *agg_dtype_offset_p, - MPI_Datatype *agg_dtype_p) -{ - MPI_Aint **client_disp_arr = NULL, *agg_disp_arr = NULL; - int **client_blk_arr = NULL, *agg_blk_arr = NULL; - ADIO_Offset tmp_coll_buf_sz = 0, st_reg = 0, act_reg_sz = 0; - ADIO_Offset cur_off = -1, cur_reg_max_len = -1; - ADIO_Offset ds_fr_end = -1; - ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; - MPI_Datatype *fr_type_arr = fd->file_realm_types; - int *client_ol_ct_arr = NULL; - int *client_ol_cur_ct_arr = NULL; - int agg_ol_ct = 0, agg_ol_cur_ct = 0; - int cur_off_proc = -1; - int next_off_idx = -1; - int i = 0, j = 0, all_done = -1; - int agg_idx = fd->my_cb_nodes_index; - heap_t offset_heap; - ADIO_Offset next_off = -1, next_reg_max_len = -1; - - /* Used for coalescing ol pairs next to each other. */ - ADIO_Offset *client_comm_next_off_arr = NULL; - ADIO_Offset agg_next_off = -1; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5016, 0, NULL); -#endif - - memset(client_comm_sz_arr, 0, nprocs*sizeof(ADIO_Offset)); - - if ((client_comm_next_off_arr = (ADIO_Offset *) - ADIOI_Malloc(nprocs*sizeof(ADIO_Offset))) == NULL) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: malloc client_next_off_arr " - "failed\n"); - return -1; - } - - if ((client_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: " - "malloc client_ol_ct_arr failed\n"); - return -1; - } - if ((client_ol_cur_ct_arr = - (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: " - "malloc client_ol_cur_ct_arr failed\n"); - return -1; - } - - /* On the first pass see how many offset-length pairs are - * necessary for each client. Then allocate the correct amount of - * offset-length pairs for describing the collective buffer. All - * data is processed in order by the aggregator's file realm. On - * the second pass, set the offset-length pairs to the correct - * values. */ - for (i = 0; i < MAX_OFF_TYPE; i++) - { - memset(client_comm_next_off_arr, -1, nprocs*sizeof(ADIO_Offset)); - tmp_coll_buf_sz = 0; - ds_fr_end = -1; - - /* initialize heap */ - ADIOI_Heap_create(&offset_heap, nprocs); - offset_heap.size = 0; - - for (j=0; j<nprocs; j++) { - find_next_off(fd, - &client_file_view_state_arr[j], - fr_st_off_arr[agg_idx], - &(fr_type_arr[agg_idx]), - i, - &cur_off, - &cur_reg_max_len); - if ((cur_off != -1) && (cur_reg_max_len > 0)) { - ADIOI_Heap_insert(&offset_heap, cur_off, j, cur_reg_max_len); -#ifdef DEBUG_HEAP - printf ("initial: inserting offset %lld with " - "cur_reg_max_len = %lld for p%d\n", - cur_off, cur_reg_max_len, j); -#endif - } - - } - if (!offset_heap.size) - ADIOI_Heap_insert(&offset_heap, -1, -1, -1); - - while (tmp_coll_buf_sz < fd->hints->cb_buffer_size) - { - /* Find the next process with the next region within the - * file realm and the maximum amount that can be added for - * this particular file realm as a contiguous region. */ - ADIOI_Heap_extract_min(&offset_heap, &cur_off, &cur_off_proc, - &cur_reg_max_len); -#ifdef DEBUG_HEAP - printf ("extracted cur_off %lld from proc %d\n", - cur_off, cur_off_proc); -#endif - - if (cur_off == -1) - break; - -#ifdef DEBUG3 - fprintf(stderr, "ADIOI_Build_agg_reqs: %s proc %d start/add to" - " list (max_reg_fr=%Ld,tmp_coll_buf_sz=%Ld," - "cb_buffer_size=%d)\n", off_type_name[i], cur_off_proc, - cur_reg_max_len, tmp_coll_buf_sz, - fd->hints->cb_buffer_size); -#endif - - /* We process only contiguous file realm regions if we are - * using data sieving. Note that we only do this for - * writes since reads can be data sieved across each other - * without consistency issues. */ - if ((fd->hints->ds_write == ADIOI_HINT_ENABLE || - fd->hints->ds_write == ADIOI_HINT_AUTO) && - rw_type == ADIOI_WRITE && fd->hints->cb_nodes > 1) - { -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_agg_reqs: " - "Warning - Data sieving writes on\n"); -#endif - if (ds_fr_end == -1) - { - ds_fr_end = cur_off + cur_reg_max_len; -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_agg_reqs: " - "cur_off=%Ld, cur_reg_max_len=%Ld\n" - "Data sieving file realm end initialized to %Ld\n", - cur_off, - cur_reg_max_len, - ds_fr_end); -#endif - } - else - { - /* The next off switched file realms, so we will stop - * here. */ - if (ds_fr_end != cur_off + cur_reg_max_len) - { -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_agg_reqs: " - "Data sieving file realm end changed from " - "%Ld to %Ld\n", ds_fr_end, - cur_off + cur_reg_max_len); -#endif - break; - } - } - } - - /* Add up to the end of the file realm or the collective - * buffer. */ - if (cur_reg_max_len > (fd->hints->cb_buffer_size - - tmp_coll_buf_sz)) - cur_reg_max_len = fd->hints->cb_buffer_size - tmp_coll_buf_sz; - - view_state_add_region( - cur_reg_max_len, - &(client_file_view_state_arr[cur_off_proc]), - &st_reg, &act_reg_sz, i); - - switch(i) - { - case TEMP_OFF: - /* Increment the ol list count for each proc and - * the used part of the collective buffer if the - * next region is not adjacent to the previous - * region. */ - if (client_comm_next_off_arr[cur_off_proc] != - tmp_coll_buf_sz) - { - (client_ol_ct_arr[cur_off_proc])++; - } - client_comm_next_off_arr[cur_off_proc] = - tmp_coll_buf_sz + act_reg_sz; - - if (agg_next_off != st_reg) - agg_ol_ct++; - agg_next_off = st_reg + act_reg_sz; - break; - case REAL_OFF: - /* Add this region to the proper client ol list if - * the next region is not adjacent to the previous - * region. */ - next_off_idx = client_ol_cur_ct_arr[cur_off_proc]; - if (client_comm_next_off_arr[cur_off_proc] != - tmp_coll_buf_sz) - { - client_disp_arr[cur_off_proc][next_off_idx] = - tmp_coll_buf_sz; - client_blk_arr[cur_off_proc][next_off_idx] = - act_reg_sz; - (client_ol_cur_ct_arr[cur_off_proc])++; - } - else - { - client_blk_arr[cur_off_proc][next_off_idx - 1] - += act_reg_sz; - } - client_comm_sz_arr[cur_off_proc] += act_reg_sz; - client_comm_next_off_arr[cur_off_proc] = - tmp_coll_buf_sz + act_reg_sz; - - /* Add to the aggregator filetype if the next - * region is not adjacent to the previous - * region. */ - if (agg_next_off != st_reg) - { - /* this will enable initial offsets much further into - * the file than an MPI_Aint */ - if (!agg_ol_cur_ct) - *agg_dtype_offset_p = st_reg; - agg_disp_arr[agg_ol_cur_ct] = st_reg - - (MPI_Aint) *agg_dtype_offset_p; - agg_blk_arr[agg_ol_cur_ct] = act_reg_sz; - agg_ol_cur_ct++; - } - else - { - agg_blk_arr[agg_ol_cur_ct - 1] += act_reg_sz; - } - agg_next_off = st_reg + act_reg_sz; - - break; - default: - fprintf(stderr, "ADIOI_Build_agg_reqs: Impossible type\n"); - } - tmp_coll_buf_sz += act_reg_sz; - - find_next_off(fd, - &client_file_view_state_arr[cur_off_proc], - fr_st_off_arr[agg_idx], - &(fr_type_arr[agg_idx]), - i, - &next_off, - &next_reg_max_len); - - if ((next_off != -1) || (!offset_heap.size)) { - ADIOI_Heap_insert(&offset_heap, next_off, cur_off_proc, - next_reg_max_len); -#ifdef DEBUG_HEAP - printf ("inserting offset %lld for p%d\n", next_off, - cur_off_proc); -#endif - } - } - - if (i == TEMP_OFF) - { - /* Allocate offset-length pairs for creating hindexed - * MPI_Datatypes for both the client and the aggregator. */ - if ((client_disp_arr = (MPI_Aint **) - ADIOI_Malloc(nprocs*sizeof(MPI_Aint *))) == NULL) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " - "client_disp_arr failed\n"); - return -1; - } - if ((client_blk_arr = (int **) ADIOI_Malloc( - nprocs*sizeof(int *))) == NULL) - { - ADIOI_Free(client_disp_arr); - fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " - "client_blk_arr failed\n"); - return -1; - } - for (j = 0; j < nprocs; j++) - { - if ((client_disp_arr[j] = (MPI_Aint *) ADIOI_Malloc( - client_ol_ct_arr[j]*sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " - "client_disp_arr[%d] failed\n", j); - return -1; - } - if ((client_blk_arr[j] = (int *) - ADIOI_Malloc(client_ol_ct_arr[j]*sizeof(int))) == NULL) - { - ADIOI_Free(client_disp_arr[j]); - fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " - "client_blk_arr[%d] failed\n", j); - return -1; - } - } - - if (agg_ol_ct > 0) - { - if ((agg_disp_arr = (MPI_Aint *) ADIOI_Malloc( - agg_ol_ct*sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, - "ADIOI_Build_agg_reqs: malloc disp_arr failed\n"); - return -1; - } - if ((agg_blk_arr = (int *) - ADIOI_Malloc(agg_ol_ct*sizeof(int))) == NULL) - { - ADIOI_Free(agg_disp_arr); - fprintf(stderr, - "ADIOI_Build_agg_reqs: malloc blk_arr failed\n"); - return -1; - } - } - } - ADIOI_Heap_free(&offset_heap); - } - - /* Let the clients know if this aggregator is totally finished - * with all possible client requests. */ - all_done = 1; - for (i = 0; i < nprocs; i++) - { - if ((client_file_view_state_arr[i].cur_state.cur_sz != - client_file_view_state_arr[i].sz) || - client_comm_sz_arr[i] != 0) - { - all_done = 0; - break; - } - } - if (all_done == 1) - { - for (i = 0; i < nprocs; i++) - { - client_comm_sz_arr[i] = -1; - } - } - - /* Quick check to make sure we found all the ol pairs we thought - * we did */ - for (i = 0; i < nprocs; i++) - { - if (client_ol_cur_ct_arr[i] != client_ol_ct_arr[i]) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: ERROR Process %d " - "processed only %d out of %d ol pairs\n", i, - client_ol_cur_ct_arr[i], - client_ol_ct_arr[i]); - return -1; - } - } -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_agg_reqs:(client,ol_pairs,size_req)="); - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "(%d,%d,%Ld)", i, client_ol_ct_arr[i], - client_comm_sz_arr[i]); - if (i != nprocs - 1) - fprintf(stderr, ","); - } - fprintf(stderr, "\n"); -#endif -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_agg_reqs: Generated %d of %d " - "aggregate offset-length pairs\n", agg_ol_cur_ct, agg_ol_ct); -#endif -#ifdef DEBUG2 - for (i = 0; i < nprocs; i++) - { - if (client_ol_ct_arr[i] > 0) - { - fprintf(stderr, "ADIOI_Build_agg_reqs: p %d (off,len) = ", i); - for (j = 0; j < client_ol_ct_arr[i]; j++) - { - fprintf(stderr, "[%d](%d,%d) ", j, - client_disp_arr[i][j], - client_blk_arr[i][j]); - } - fprintf(stderr, "\n"); - } - } - if (agg_ol_ct) { - fprintf(stderr, "ADIOI_Build_agg_reqs:agg_type(off,len)="); - for (i = 0; i < agg_ol_ct; i++) - { - fprintf(stderr, "[%d](%d,%d)", - i, agg_disp_arr[i], agg_blk_arr[i]); - if (i != agg_ol_ct - 1) - fprintf(stderr, ","); - } - fprintf(stderr, "\n"); - } -#endif - - assert(agg_ol_cur_ct == agg_ol_ct); - - /* Create all the client and aggregate MPI_Datatypes */ - for (i = 0; i < nprocs; i++) - { - if (client_comm_sz_arr[i] > 0) - { - MPI_Type_create_hindexed(client_ol_ct_arr[i], client_blk_arr[i], - client_disp_arr[i], MPI_BYTE, - &(client_comm_dtype_arr[i])); - MPI_Type_commit(&(client_comm_dtype_arr[i])); - } - else - { - client_comm_dtype_arr[i] = MPI_BYTE; - } - ADIOI_Free(client_blk_arr[i]); - ADIOI_Free(client_disp_arr[i]); - } - ADIOI_Free(client_blk_arr); - ADIOI_Free(client_disp_arr); - - if (agg_ol_ct > 0) { - if (agg_ol_ct == 1) - MPI_Type_contiguous (agg_blk_arr[0], MPI_BYTE, agg_dtype_p); - else if (agg_ol_ct > 1) - MPI_Type_create_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, - agg_dtype_p); - - MPI_Type_commit(agg_dtype_p); - - ADIOI_Free(agg_disp_arr); - ADIOI_Free(agg_blk_arr); - } - ADIOI_Free(client_ol_ct_arr); - ADIOI_Free(client_ol_cur_ct_arr); - ADIOI_Free(client_comm_next_off_arr); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5017, 0, NULL); -#endif - return 0; -} - -/* All sizes from all aggregators are gathered on the clients, which - * then call this function, which will generate the comm datatypes for - * each aggregator (agg_comm_dtype_arr) in the upcoming - * MPI_Alltoallw() */ -int ADIOI_Build_client_reqs(ADIO_File fd, - int nprocs, - view_state *my_mem_view_state_arr, - view_state *agg_file_view_state_arr, - ADIO_Offset *agg_comm_sz_arr, - MPI_Datatype *agg_comm_dtype_arr) -{ - MPI_Aint **agg_disp_arr = NULL; - int **agg_blk_arr = NULL; - view_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; - ADIO_Offset total_agg_comm_sz = 0, cur_total_agg_comm_sz = 0; - ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; - ADIO_Offset cur_off = -1, cur_reg_max_len = -1; - ADIO_Offset tmp_cur_off = -1, tmp_cur_reg_max_len = -1; - ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; - ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; - ADIO_Offset *agg_comm_cur_sz_arr = NULL; - MPI_Datatype *fr_type_arr = fd->file_realm_types; - int *agg_ol_ct_arr = NULL; - int *agg_ol_cur_ct_arr = NULL; - int tmp_agg_fr_idx = -1; - int cur_off_proc = -1; - int i = 0, j = 0; - int agg_next_off_idx = -1; - /* Used for coalescing ol pairs next to each other. */ - ADIO_Offset *agg_mem_next_off_arr = NULL; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5018, 0, NULL); -#endif - -#ifdef DEBUG - fprintf(stderr, "ADIOI_Build_client_reqs:(agg,size_req)="); - for (i = 0; i < nprocs; i++) - { - int tmp_agg_idx = ADIOI_Agg_idx(i, fd); - if (tmp_agg_idx >= 0) - { - fprintf(stderr, "(%d,%Ld)", i, agg_comm_sz_arr[i]); - if (i != fd->hints->cb_nodes - 1) - fprintf(stderr, ","); - } - fprintf(stderr, "\n"); - } -#endif - - if ((agg_mem_next_off_arr = (ADIO_Offset *) ADIOI_Malloc( - nprocs*sizeof(ADIO_Offset))) == NULL) - { - fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_mem_next_off_arr" - "failed\n"); - return -1; - } - - if ((agg_comm_cur_sz_arr = (ADIO_Offset *) - ADIOI_Malloc(nprocs*sizeof(ADIO_Offset))) == NULL) - { - fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_comm_cur_sz_arr" - " failed\n"); - return -1; - } - if ((agg_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) - == NULL) - { - fprintf(stderr, "ADIOI_Build_client_reqs: " - "malloc agg_ol_ct_arr failed\n"); - return -1; - } - if ((agg_ol_cur_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) - == NULL) - { - fprintf(stderr, "ADIOI_Build_client_reqs: " - "malloc agg_ol_cur_ct_arr failed\n"); - return -1; - } - - for (i = 0; i < nprocs; i++) - { - if (agg_comm_sz_arr[i] > 0) - total_agg_comm_sz += agg_comm_sz_arr[i]; - } - - /* On the first pass see how many offset-length pairs are - * necessary for each aggregator. Then allocate the correct - * amount of offset-length pairs for handling each aggregator's - * particular data size. On the last pass, we actually create the - * offset-length pairs. */ - for (i = 0; i < MAX_OFF_TYPE; i++) - { - cur_total_agg_comm_sz = 0; - memset(agg_comm_cur_sz_arr, 0, nprocs*sizeof(ADIO_Offset)); - memset(agg_mem_next_off_arr, -1, nprocs*sizeof(ADIO_Offset)); - while (total_agg_comm_sz > cur_total_agg_comm_sz) - { - /* Look for the next aggregator offset among all the - * aggregators and their respective file realms. */ - cur_off = -1; - for (j = 0; j < nprocs; j++) - { - tmp_agg_fr_idx = ADIOI_Agg_idx(j, fd); - assert(tmp_agg_fr_idx < fd->hints->cb_nodes); - - /* If this process is not an aggregator or we have - * finished all the bytes for this aggregator, move - * along. */ - if (tmp_agg_fr_idx < 0 || - agg_comm_cur_sz_arr[j] == agg_comm_sz_arr[j]) - { - continue; - } - - find_next_off(fd, - &(agg_file_view_state_arr[j]), - fr_st_off_arr[tmp_agg_fr_idx], - &(fr_type_arr[tmp_agg_fr_idx]), - i, - &tmp_cur_off, - &tmp_cur_reg_max_len); - if (tmp_cur_off == -1) - continue; - - if ((cur_off == -1) || - (cur_off > tmp_cur_off)) - { - cur_off_proc = j; - cur_off = tmp_cur_off; - cur_reg_max_len = tmp_cur_reg_max_len; - } - } - - assert(cur_off_proc != -1); - - /* Add up to the end of the file realm or as many bytes - * are left for this particular aggregator in the client's - * filetype */ - if (cur_reg_max_len > agg_comm_sz_arr[cur_off_proc] - - agg_comm_cur_sz_arr[cur_off_proc]) - { - cur_reg_max_len = agg_comm_sz_arr[cur_off_proc] - - agg_comm_cur_sz_arr[cur_off_proc]; - } - assert(cur_reg_max_len > 0); - - view_state_add_region( - cur_reg_max_len, - &(agg_file_view_state_arr[cur_off_proc]), - &st_reg, &act_reg_sz, i); - -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_reqs: %s File region" - " (proc=%d,off=%Ld,sz=%Ld)\n", - off_type_name[i], cur_off_proc, - cur_off, act_reg_sz); -#endif - - /* Before translating the file regions to memory regions, - * we first must advance to the proper point in the - * mem_view_state for this aggregator to match the - * file_view_state. */ - tmp_file_state_p = &(agg_file_view_state_arr[cur_off_proc]); - tmp_mem_state_p = &(my_mem_view_state_arr[cur_off_proc]); - assert(view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz >= - view_state_get_cur_sz(tmp_mem_state_p, i)); - while (view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz != - view_state_get_cur_sz(tmp_mem_state_p, i)) - { - ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; - view_state_add_region( - view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz - - view_state_get_cur_sz(tmp_mem_state_p, i), - tmp_mem_state_p, - &fill_st_reg, - &fill_reg_sz, i); - } - - /* Based on how large the act_reg_sz 1. Figure out how - * many memory offset-length pairs are necessary. 2. Set - * the offset-length pairs. */ - tmp_reg_sz = 0; - while (tmp_reg_sz != act_reg_sz) - { - view_state_add_region( - act_reg_sz - tmp_reg_sz, - tmp_mem_state_p, - &agg_mem_st_reg, &agg_mem_act_reg_sz, - i); - tmp_reg_sz += agg_mem_act_reg_sz; - -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_reqs: Mem region %s" - "(proc=%d,off=%Ld,sz=%Ld)\n", - off_type_name[i], cur_off_proc, - agg_mem_st_reg, agg_mem_act_reg_sz); -#endif - agg_comm_cur_sz_arr[cur_off_proc] += agg_mem_act_reg_sz; - cur_total_agg_comm_sz += agg_mem_act_reg_sz; - switch(i) - { - case TEMP_OFF: - /* Increment the ol list count a particular - * aggregator if next region is not adjacent - * to the previous region. */ - if (agg_mem_next_off_arr[cur_off_proc] != - agg_mem_st_reg) - { - agg_ol_ct_arr[cur_off_proc]++; - } - agg_mem_next_off_arr[cur_off_proc] = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - case REAL_OFF: - /* Set the ol list for the memtypes that will - * map to each aggregator, coaslescing if - * possible. */ - agg_next_off_idx = agg_ol_cur_ct_arr[cur_off_proc]; - if (agg_mem_next_off_arr[cur_off_proc] != - agg_mem_st_reg) - { - agg_disp_arr[cur_off_proc][agg_next_off_idx] = - agg_mem_st_reg; - agg_blk_arr[cur_off_proc][agg_next_off_idx] = - agg_mem_act_reg_sz; - (agg_ol_cur_ct_arr[cur_off_proc])++; - } - else - { - agg_blk_arr[cur_off_proc][agg_next_off_idx - 1] - += agg_mem_act_reg_sz; - } - agg_mem_next_off_arr[cur_off_proc] = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - default: - fprintf(stderr, "ADIOI_Build_client_reqs: " - "Impossible type\n"); - } - } - } - - /* On the first pass, allocate the memory structures for - * creating the MPI_hindexed type. */ - if (i == TEMP_OFF) - { - /* Allocate offset-length pairs for creating hindexed - * MPI_Datatypes for each aggregator */ - if ((agg_disp_arr = (MPI_Aint **) - ADIOI_Malloc(nprocs*sizeof(MPI_Aint *))) == NULL) - { - fprintf(stderr, - "ADIOI_Build_client_reqs: malloc agg_disp_arr failed\n"); - return -1; - } - if ((agg_blk_arr = (int **) ADIOI_Malloc(nprocs*sizeof(int *))) - == NULL) - { - ADIOI_Free(agg_disp_arr); - fprintf(stderr, - "ADIOI_Build_client_reqs: malloc agg_blk_arr failed\n"); - return -1; - } - for (j = 0; j < nprocs; j++) - { - if ((agg_disp_arr[j] = (MPI_Aint *) - ADIOI_Malloc(agg_ol_ct_arr[j]*sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, "ADIOI_Build_client_reqs: malloc " - "agg_disp_arr[%d] failed\n", j); - return -1; - } - if ((agg_blk_arr[j] = (int *) - ADIOI_Malloc(agg_ol_ct_arr[j]*sizeof(int))) == NULL) - { - ADIOI_Free(agg_disp_arr[j]); - fprintf(stderr, "ADIOI_Build_client_reqs: malloc " - "agg_blk_arr[%d] failed\n", j); - return -1; - } - } - } - } - -#ifdef DEBUG - fprintf(stderr, "ADIOI_Build_client_reqs:(agg,cur_ol_count=ol_count)="); - for (i = 0; i < nprocs; i++) - { - int tmp_agg_idx = ADIOI_Agg_idx(i, fd); - if (tmp_agg_idx >= 0) - { - fprintf(stderr, "(%d,%d=%d)", i, agg_ol_cur_ct_arr[i], - agg_ol_ct_arr[i]); - assert(agg_ol_ct_arr[i] == agg_ol_cur_ct_arr[i]); - if (tmp_agg_idx != fd->hints->cb_nodes - 1) - fprintf(stderr, ","); - } - } - fprintf(stderr, "\n"); -#endif - -#ifdef DEBUG2 - for (i = 0; i < nprocs; i++) - { - if (agg_ol_ct_arr[i] > 0) - { - fprintf(stderr, "ADIOI_Build_client_reqs: p %d (off,len) = ", i); - for (j = 0; j < agg_ol_ct_arr[i]; j++) - { - fprintf(stderr, "[%d](%d,%d) ", j, - agg_disp_arr[i][j], - agg_blk_arr[i][j]); - } - fprintf(stderr, "\n"); - } - } -#endif - - /* Create all the aggregator MPI_Datatypes */ - for (i = 0; i < nprocs; i++) - { - if (agg_comm_sz_arr[i] > 0) - { - MPI_Type_create_hindexed(agg_ol_ct_arr[i], agg_blk_arr[i], - agg_disp_arr[i], MPI_BYTE, - &(agg_comm_dtype_arr[i])); - MPI_Type_commit(&(agg_comm_dtype_arr[i])); - } - else - { - agg_comm_dtype_arr[i] = MPI_BYTE; - } - ADIOI_Free(agg_blk_arr[i]); - ADIOI_Free(agg_disp_arr[i]); - } - ADIOI_Free(agg_blk_arr); - ADIOI_Free(agg_disp_arr); - - ADIOI_Free(agg_mem_next_off_arr); - ADIOI_Free(agg_comm_cur_sz_arr); - ADIOI_Free(agg_ol_ct_arr); - ADIOI_Free(agg_ol_cur_ct_arr); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5019, 0, NULL); -#endif - return 0; -} -/* ADIOI_Build_client_pre_req allows a client to calculate the memtype - * offset-length pairs up (up to a limit - max_pre_req_sz or max - * ol_ct). It basically allows ADIOI_Build_client_req to do less work. - * If it called and there already exist some preprocessed memtype - * offset-length pairs, it will exit immediately if a limit has been - * reached or if will add on the old limites to reach the new - * limits. */ - -int ADIOI_Build_client_pre_req(ADIO_File fd, - int agg_rank, int agg_idx, - view_state *my_mem_view_state_p, - view_state *agg_file_view_state_p, - ADIO_Offset max_pre_req_sz, - int max_ol_ct) -{ - ADIO_Offset act_reg_sz = 0, tmp_reg_sz = 0; - ADIO_Offset cur_off = -1, cur_reg_max_len = -1; - ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; - int agg_ol_ct = 0, agg_ol_cur_ct = 0; - int i, agg_next_off_idx = -1; - - ADIO_Offset cur_sz = 0, max_sz = 0, agg_mem_next_off = -1; - ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; - ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; - MPI_Datatype *fr_type_arr = fd->file_realm_types; - MPI_Aint *tmp_disp_arr = NULL; - int *tmp_blk_arr = NULL, exit_loop = -1; - flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; -#ifdef DTYPE_SKIP - int skip_type_ct; -#endif - if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) - { - fprintf(stderr, "ADIOI_Build_client_pre_req: Invalid agg_idx %d\n", - agg_idx); - return -1; - } - - if (agg_file_view_state_p->cur_state.cur_sz == - agg_file_view_state_p->sz || max_pre_req_sz <= 0 || - max_ol_ct <= 0) - { -#ifdef DEBUG1 - fprintf(stderr, - "ADIOI_Build_client_pre_req: Nothing to preprocess\n"); -#endif - return 0; - } - - /* The new limits have already been surpassed by what already - * exists. Otherwise we will use the next restrictions */ - if ((my_mem_view_state_p->pre_sz >= max_pre_req_sz) || - (my_mem_view_state_p->pre_ol_ct >= max_ol_ct)) - { -#ifdef DEBUG1 - fprintf(stderr, - "ADIOI_Build_client_pre_req: Old values surpass new " - "pre_req values\n"); -#endif - return 0; - } - - /* General idea is to first advance the filetype to the file realm - * and then the memtype to the filetype. The memtype is advanced - * further by peeking at the filetype and then the filetype is - * advanced. */ - for (i = 0; i < MAX_OFF_TYPE; i++) - { - switch(i) - { - case TEMP_OFF: - tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); - tmp_file_state_p = &(agg_file_view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_mem_state_p = &(my_mem_view_state_p->cur_state); - tmp_file_state_p = &(agg_file_view_state_p->cur_state); - break; - default: - fprintf(stderr, "ADIOI_Build_client_pre_req: " - "Invalid off type %d\n", i); - } - - if (i == TEMP_OFF && my_mem_view_state_p->pre_sz > 0) - { - cur_sz = my_mem_view_state_p->pre_sz; - agg_ol_ct = my_mem_view_state_p->pre_ol_ct; - /* Save the old arrays */ - tmp_disp_arr = my_mem_view_state_p->pre_disp_arr; - tmp_blk_arr = my_mem_view_state_p->pre_blk_arr; - my_mem_view_state_p->pre_disp_arr = NULL; - my_mem_view_state_p->pre_blk_arr = NULL; - agg_mem_next_off = - tmp_disp_arr[agg_ol_ct - 1] + tmp_blk_arr[agg_ol_ct - 1]; - } - else if (i == REAL_OFF && my_mem_view_state_p->pre_sz > 0) - { - cur_sz = my_mem_view_state_p->pre_sz; - agg_ol_cur_ct = my_mem_view_state_p->pre_ol_ct; - - /* Copy the old data to the new data, freeing the old - * arrays */ - memcpy(my_mem_view_state_p->pre_disp_arr, tmp_disp_arr, - my_mem_view_state_p->pre_ol_ct * sizeof(MPI_Aint)); - memcpy(my_mem_view_state_p->pre_blk_arr, tmp_blk_arr, - my_mem_view_state_p->pre_ol_ct * sizeof(int)); - - ADIOI_Free(tmp_disp_arr); - ADIOI_Free(tmp_blk_arr); - - agg_mem_next_off = - my_mem_view_state_p->pre_disp_arr[agg_ol_cur_ct - 1] + - my_mem_view_state_p->pre_blk_arr[agg_ol_cur_ct - 1]; - } - else - { - cur_sz = 0; - } - - /* Max_pre_req_sz may be larger than the amount of data left - * to preprocess */ - if (max_pre_req_sz - cur_sz > - agg_file_view_state_p->sz - tmp_file_state_p->cur_sz) - { - max_sz = cur_sz + - agg_file_view_state_p->sz - tmp_file_state_p->cur_sz; - } - else - max_sz = max_pre_req_sz; - - assert(cur_sz != max_sz); -#ifdef DEBUG1 - fprintf(stderr, - "ADIOI_Build_client_pre_req: (cur_sz=%Ld,agg_ol_ct=%d," - "agg_mem_next_off=%Ld,max_sz=%Ld,max_ol_ct=%d)\n", - cur_sz, agg_ol_ct, agg_mem_next_off, max_sz, max_ol_ct); -#endif - while (cur_sz < max_sz) - { - find_next_off(fd, agg_file_view_state_p, - fr_st_off_arr[agg_rank], - &(fr_type_arr[agg_rank]), - i, - &cur_off, - &cur_reg_max_len); - - /* find_next_off may show that the file_view_state is done - * even if cur_sz != max_sz since find_next_off may - * advance the file_view_state to the end here and realize - * that it is done. */ - if (cur_off == -1) - break; - - assert(cur_off != -1); - - /* Before translating the file regions to memory regions, - * we first must advance to the proper point in the - * mem_view_state for this aggregator to match the - * file_view_state. */ - while (tmp_file_state_p->cur_sz != tmp_mem_state_p->cur_sz) - { -#ifdef DTYPE_SKIP - if (my_mem_view_state_p->flat_type_p->count > 1) { - /* let's see if we can skip whole memory datatypes */ - skip_type_ct = - (tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz) / - my_mem_view_state_p->type_sz; - if (skip_type_ct > 0) { - tmp_mem_state_p->cur_sz += - skip_type_ct * my_mem_view_state_p->type_sz; - tmp_mem_state_p->abs_off += - skip_type_ct * my_mem_view_state_p->ext; - if (tmp_mem_state_p->cur_sz == - tmp_file_state_p->cur_sz) - break; - } - } -#endif - view_state_add_region( - tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz, - my_mem_view_state_p, - &fill_st_reg, - &fill_reg_sz, i); - } - - /* Now that the filetype and memtype are advanced to the - * same position, add memtype ol-pairs while we have not - * overstepped the min(end of the current piece in the - * file view, end of the file realm, data left in - * max_sz) */ - - if (cur_reg_max_len > - view_state_get_next_len(agg_file_view_state_p, i)) - cur_reg_max_len = - view_state_get_next_len(agg_file_view_state_p, i); - - if (cur_reg_max_len > max_sz - cur_sz) - cur_reg_max_len = max_sz - cur_sz; - - assert(cur_reg_max_len > 0); - - /* Add memtype ol pairs while we have not passed - * cur_reg_max_len or the max number of ol pairs - * allowed */ - act_reg_sz = 0; - exit_loop = 0; - while ((act_reg_sz < cur_reg_max_len) && - (exit_loop == 0)) - { - view_state_add_region( - cur_reg_max_len - act_reg_sz, - my_mem_view_state_p, - &agg_mem_st_reg, &agg_mem_act_reg_sz, - i); - act_reg_sz += agg_mem_act_reg_sz; - -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_pre_req: %s Mem region" - "(proc=%d,off=%Ld,sz=%Ld)\n", - off_type_name[i], agg_rank, agg_mem_st_reg, - agg_mem_act_reg_sz); -#endif - switch(i) - { - case TEMP_OFF: - /* Increment the ol list count if the next - * region is not adjacent to the previous - * region. */ - if (agg_mem_next_off != agg_mem_st_reg) - { - agg_ol_ct++; - if (agg_ol_ct == max_ol_ct) - exit_loop = 1; - } - agg_mem_next_off = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - case REAL_OFF: - /* Set the ol list for the memtype that - * will map to our aggregator, coaslescing - * if possible. */ - agg_next_off_idx = agg_ol_cur_ct; - if (agg_mem_next_off != agg_mem_st_reg) - { - my_mem_view_state_p-> - pre_disp_arr[agg_next_off_idx] = - agg_mem_st_reg; - my_mem_view_state_p-> - pre_blk_arr[agg_next_off_idx] = - agg_mem_act_reg_sz; - agg_ol_cur_ct++; - if (agg_ol_cur_ct == agg_ol_ct) - exit_loop = 1; - } - else - { - my_mem_view_state_p-> - pre_blk_arr[agg_next_off_idx - 1] - += agg_mem_act_reg_sz; - } - agg_mem_next_off = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - default: - fprintf(stderr, "ADIOI_Build_client_pre_req: " - "Impossible type\n"); - } - } - - /* Advance the filetype flatten state appropriately to - * match the data advanced in the memtype flatten state. - * Should only take at most a single view_state_add_region - * call since the memtype cannot proceed beyond the end of - * a contig piece in the file type. */ - view_state_add_region(act_reg_sz - tmp_reg_sz, - agg_file_view_state_p, - &fill_st_reg, &fill_reg_sz, i); -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_pre_req: %s File region" - " (proc=%d,off=%Ld,sz=%Ld)\n", - off_type_name[i], agg_rank, fill_st_reg, fill_reg_sz); -#endif - if (fill_reg_sz != act_reg_sz) - { - fprintf(stderr, "ADIOI_Build_client_pre_req: " - "view_state_add_region failed to match the memtype\n"); - return -1; - } - - cur_sz += act_reg_sz; - } - - /* On the first pass, allocate the memory structures for - * storing the preprocessed information */ - if (i == TEMP_OFF) - { - if ((my_mem_view_state_p->pre_disp_arr = (MPI_Aint *) - ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " - "pre_disp_arr of size %ld failed\n", - (long int)agg_ol_ct * sizeof(MPI_Aint)); - return -1; - } - if ((my_mem_view_state_p->pre_blk_arr = (int *) - ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) - { - ADIOI_Free(my_mem_view_state_p->pre_disp_arr); - fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " - "agg_blk_arr of size %ld failed\n", - (long int)agg_ol_ct * sizeof(int)); - return -1; - } - } - } - - my_mem_view_state_p->pre_sz = cur_sz; - my_mem_view_state_p->pre_ol_ct = agg_ol_ct; - -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_client_pre_req:(agg=%d,cur_ol_count=%d" - "=ol_count=%d)\n", - agg_rank, my_mem_view_state_p->pre_ol_ct, agg_ol_ct); -#endif - -#ifdef DEBUG2 - if (agg_ol_ct > 0) - { - fprintf(stderr, "ADIOI_Build_client_pre_req: agg=%d,pre_sz=%Ld " - "(off,len) = \n", agg_rank, my_mem_view_state_p->pre_sz); - for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) - { - fprintf(stderr, "[%d](%d,%d) ", i, - my_mem_view_state_p->pre_disp_arr[i], - my_mem_view_state_p->pre_blk_arr[i]); - if (i % 5 == 0 && i != 0) - fprintf(stderr, "\n"); - } - fprintf(stderr, "\n"); - } -#endif - - return 0; -} - -/* process_pre_req() allows ADIOI_Build_client_req to use the pre_req - * information. */ - -static int process_pre_req(ADIO_File fd, - int agg_rank, - int agg_idx, - view_state *my_mem_view_state_p, - view_state *agg_file_view_state_p, - ADIO_Offset agg_comm_sz, - int off_type, - MPI_Aint *agg_disp_arr, - int *agg_blk_arr, - ADIO_Offset *agg_comm_pre_sz_p, - ADIO_Offset *agg_comm_cur_sz_p, - ADIO_Offset *agg_comm_sz_p, - int *agg_ol_cur_ct_p, - int *agg_ol_ct_p, - ADIO_Offset *agg_mem_next_off_p) -{ - int i, has_partial = 0; - MPI_Aint partial_disp = 0; - int partial_len = 0; - ADIO_Offset tmp_agg_comm_pre_sz = 0; - - assert (my_mem_view_state_p->pre_sz > 0); - switch(off_type) - { - case TEMP_OFF: - /* Use only some of the precalculated data */ - if (my_mem_view_state_p->pre_sz > *agg_comm_sz_p) - { - for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) - { - if ((my_mem_view_state_p->pre_blk_arr[i] + - *agg_comm_pre_sz_p) > *agg_comm_sz_p) - { - has_partial = 1; - partial_len = *agg_comm_sz_p - *agg_comm_pre_sz_p; - *agg_comm_pre_sz_p = *agg_comm_sz_p; - i++; - break; - } - else if ((my_mem_view_state_p->pre_blk_arr[i] + - *agg_comm_pre_sz_p) == *agg_comm_sz_p) - { - *agg_comm_pre_sz_p += - my_mem_view_state_p->pre_blk_arr[i]; - i++; - break; - } - else - *agg_comm_pre_sz_p += - my_mem_view_state_p->pre_blk_arr[i]; - } - - if (has_partial == 1) - { - *agg_mem_next_off_p = - my_mem_view_state_p->pre_disp_arr[i - 1] + - partial_len; - } - else - { - *agg_mem_next_off_p = - my_mem_view_state_p->pre_disp_arr[i - 1] + - my_mem_view_state_p->pre_blk_arr[i - 1]; - } - - *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; - *agg_ol_ct_p = i; - - } - else /* Use all the precalculated data */ - { - *agg_comm_pre_sz_p = my_mem_view_state_p->pre_sz; - *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; - *agg_ol_ct_p = my_mem_view_state_p->pre_ol_ct; - *agg_mem_next_off_p = - my_mem_view_state_p->pre_disp_arr[ - my_mem_view_state_p->pre_ol_ct - 1] + - my_mem_view_state_p->pre_blk_arr[ - my_mem_view_state_p->pre_ol_ct - 1]; - } -#ifdef DEBUG1 - fprintf(stderr, "process_pre_req: TEMP_OFF " - "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d\n", - *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p); -#endif - assert(*agg_comm_cur_sz_p <= *agg_comm_sz_p); - break; - case REAL_OFF: - /* Set the ol list for the memtype that will map to our - * aggregator, coaslescing if possible. */ - for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) - { - agg_disp_arr[i] = my_mem_view_state_p->pre_disp_arr[i]; - agg_blk_arr[i] = my_mem_view_state_p->pre_blk_arr[i]; - - if ((my_mem_view_state_p->pre_blk_arr[i] + - tmp_agg_comm_pre_sz) > *agg_comm_pre_sz_p) - { - has_partial = 1; - agg_blk_arr[i] = *agg_comm_pre_sz_p - tmp_agg_comm_pre_sz; - tmp_agg_comm_pre_sz = *agg_comm_pre_sz_p; - partial_disp = my_mem_view_state_p->pre_disp_arr[i] + - agg_blk_arr[i]; - partial_len = my_mem_view_state_p->pre_blk_arr[i] - - agg_blk_arr[i]; - i++; - break; - } - else if ((my_mem_view_state_p->pre_blk_arr[i] + - tmp_agg_comm_pre_sz) == *agg_comm_pre_sz_p) - { - tmp_agg_comm_pre_sz += - my_mem_view_state_p->pre_blk_arr[i]; - i++; - break; - } - else - tmp_agg_comm_pre_sz += - my_mem_view_state_p->pre_blk_arr[i]; - } - *agg_mem_next_off_p = agg_disp_arr[i - 1] + agg_blk_arr[i - 1]; - *agg_ol_cur_ct_p = i; - *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; - - /* Clean up the ol pairs we used */ - if ((i < my_mem_view_state_p->pre_ol_ct) || (has_partial == 1)) - { - int remain_ol_ct = - my_mem_view_state_p->pre_ol_ct - i + has_partial; - MPI_Aint *new_pre_disp_arr = NULL; - int *new_pre_blk_arr = NULL; - - if ((new_pre_disp_arr = (MPI_Aint *) - ADIOI_Malloc(remain_ol_ct * sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, "process_pre_req: malloc " - "new_pre_disp_arr failed\n"); - return -1; - } - if ((new_pre_blk_arr = (int *) - ADIOI_Malloc(remain_ol_ct * sizeof(int))) == NULL) - { - fprintf(stderr, "process_pre_req: malloc " - "new_pre_blk_arr failed\n"); - return -1; - } - - memcpy(new_pre_disp_arr, - &(my_mem_view_state_p->pre_disp_arr[i - has_partial]), - remain_ol_ct * sizeof(MPI_Aint)); - memcpy(new_pre_blk_arr, - &(my_mem_view_state_p->pre_blk_arr[i - has_partial]), - remain_ol_ct * sizeof(int)); - - /* Set the partial len of the first piece */ - if (has_partial == 1) - { - /* new_pre_disp_arr[remain_ol_ct - 1] = partial_disp; - new_pre_blk_arr[remain_ol_ct - 1] = partial_len; */ - new_pre_disp_arr[0] = partial_disp; - new_pre_blk_arr[0] = partial_len; - } - - ADIOI_Free(my_mem_view_state_p->pre_disp_arr); - ADIOI_Free(my_mem_view_state_p->pre_blk_arr); - - my_mem_view_state_p->pre_disp_arr = new_pre_disp_arr; - my_mem_view_state_p->pre_blk_arr = new_pre_blk_arr; - my_mem_view_state_p->pre_ol_ct = remain_ol_ct; - my_mem_view_state_p->pre_sz -= *agg_comm_pre_sz_p; - } - else /* Used all the precalculated ol pairs */ - { - ADIOI_Free(my_mem_view_state_p->pre_disp_arr); - ADIOI_Free(my_mem_view_state_p->pre_blk_arr); - - my_mem_view_state_p->pre_disp_arr = NULL; - my_mem_view_state_p->pre_blk_arr = NULL; - my_mem_view_state_p->pre_ol_ct = 0; - my_mem_view_state_p->pre_sz = 0; - } -#ifdef DEBUG1 - fprintf(stderr, "process_pre_req: REAL_OFF " - "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d," - "agg_ol_cur_ct=%d\n", - *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p, - *agg_ol_cur_ct_p); -#endif - break; - default: - fprintf(stderr, "process_pre_req: Invalid off_type %d\n", - off_type); - } - return 0; -} - -/* ADIOI_Build_client_req() creates a memory datatype to transfer data - * to/from a particular aggregator. */ - -int ADIOI_Build_client_req(ADIO_File fd, - int agg_rank, - int agg_idx, - view_state *my_mem_view_state_p, - view_state *agg_file_view_state_p, - ADIO_Offset agg_comm_sz, - MPI_Datatype *agg_comm_dtype_p) -{ - MPI_Aint *agg_disp_arr = NULL; - int *agg_blk_arr = NULL; - ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; - ADIO_Offset cur_off = -1, cur_reg_max_len = -1; - ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; - int agg_ol_ct = 0, agg_ol_cur_ct = 0; - int i = 0, agg_next_off_idx = -1; - ADIO_Offset agg_mem_next_off = 0, agg_comm_cur_sz = 0, agg_comm_pre_sz = 0; - ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; - MPI_Datatype *fr_type_arr = fd->file_realm_types; - flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; -#ifdef DTYPE_SKIP - int skip_type_ct; -#endif - - if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) - { -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_client_req: agg_rank %d does not map " - "to a valid node in cb_node\n", agg_rank); -#endif - return 0; - } - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5018, 0, NULL); -#endif - -#ifdef DEBUG1 - fprintf(stderr, "ADIOI_Build_client_req:(agg=%d,size_req=%Ld)\n", - agg_idx, agg_comm_sz); -#endif - - /* On the first pass see how many offset-length pairs are - * necessary for each aggregator. Then allocate the correct - * amount of offset-length pairs for handling each aggregator's - * particular data size. On the last pass, we actually create the - * offset-length pairs. */ - for (i = 0; i < MAX_OFF_TYPE; i++) - { - switch(i) - { - case TEMP_OFF: - tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); - tmp_file_state_p = &(agg_file_view_state_p->tmp_state); - break; - case REAL_OFF: - tmp_mem_state_p = &(my_mem_view_state_p->cur_state); - tmp_file_state_p = &(agg_file_view_state_p->cur_state); - break; - default: - fprintf(stderr, "ADIOI_Build_client_pre_req: " - "Invalid off type %d\n", i); - } - - agg_comm_cur_sz = 0; - agg_mem_next_off = -1; - - /* First try to preprocess anything we can */ - if (my_mem_view_state_p->pre_sz > 0) - { - process_pre_req(fd, - agg_rank, - agg_idx, - my_mem_view_state_p, - agg_file_view_state_p, - agg_comm_sz, - i, - agg_disp_arr, - agg_blk_arr, - &agg_comm_pre_sz, - &agg_comm_cur_sz, - &agg_comm_sz, - &agg_ol_cur_ct, - &agg_ol_ct, - &agg_mem_next_off); - } - - while (agg_comm_cur_sz < agg_comm_sz) - { - find_next_off(fd, agg_file_view_state_p, - fr_st_off_arr[agg_idx], - &(fr_type_arr[agg_idx]), - i, - &cur_off, - &cur_reg_max_len); - - assert(cur_off != -1); - - /* Add up to the end of the file realm or as many bytes - * are left for this particular aggregator in the client's - * filetype */ - if (cur_reg_max_len > (agg_comm_sz - agg_comm_cur_sz)) - { - cur_reg_max_len = agg_comm_sz - agg_comm_cur_sz; - } - assert(cur_reg_max_len > 0); - - view_state_add_region( - cur_reg_max_len, - agg_file_view_state_p, - &st_reg, &act_reg_sz, i); - -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_req: %s File region" - " (proc=%d,off=%Ld,sz=%Ld)\n", - off_type_name[i], agg_rank, cur_off, act_reg_sz); -#endif - - /* Before translating the file regions to memory regions, - * we first must advance to the proper point in the - * mem_view_state for this aggregator to match the - * file_view_state. */ - - assert(tmp_file_state_p->cur_sz - act_reg_sz >= - tmp_mem_state_p->cur_sz); - - while (tmp_file_state_p->cur_sz - act_reg_sz != - tmp_mem_state_p->cur_sz) - { - ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; -#ifdef DTYPE_SKIP - if (my_mem_view_state_p->flat_type_p->count > 1) { - /* let's see if we can skip whole memory datatypes */ - skip_type_ct = - (tmp_file_state_p->cur_sz - act_reg_sz - - tmp_mem_state_p->cur_sz) / - my_mem_view_state_p->type_sz; - if (skip_type_ct > 0) { - tmp_mem_state_p->cur_sz += - skip_type_ct * my_mem_view_state_p->type_sz; - tmp_mem_state_p->abs_off += - skip_type_ct * my_mem_view_state_p->ext; - if ((tmp_mem_state_p->cur_sz - act_reg_sz) == - tmp_file_state_p->cur_sz) - break; - } - } -#endif - view_state_add_region( - tmp_file_state_p->cur_sz - - act_reg_sz - tmp_mem_state_p->cur_sz, - my_mem_view_state_p, - &fill_st_reg, - &fill_reg_sz, i); - } - - /* Based on how large the act_reg_sz is, first figure - * out how many memory offset-length pairs are - * necessary and then set the offset-length pairs. */ - tmp_reg_sz = 0; - while (tmp_reg_sz != act_reg_sz) - { - view_state_add_region( - act_reg_sz - tmp_reg_sz, - my_mem_view_state_p, - &agg_mem_st_reg, &agg_mem_act_reg_sz, - i); - tmp_reg_sz += agg_mem_act_reg_sz; - -#ifdef DEBUG2 - fprintf(stderr, "ADIOI_Build_client_req: %s Mem region" - "(off=%Ld,sz=%Ld)\n", - off_type_name[i], agg_mem_st_reg, - agg_mem_act_reg_sz); -#endif - agg_comm_cur_sz += agg_mem_act_reg_sz; - switch(i) - { - case TEMP_OFF: - /* Increment the ol list count if the next - * region is not adjacent to the previous - * region. */ - if (agg_mem_next_off != agg_mem_st_reg) - { - agg_ol_ct++; - } - agg_mem_next_off = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - case REAL_OFF: - /* Set the ol list for the memtype that - * will map to our aggregator, coaslescing - * if possible. */ - agg_next_off_idx = agg_ol_cur_ct; - if (agg_mem_next_off != agg_mem_st_reg) - { - agg_disp_arr[agg_next_off_idx] = - agg_mem_st_reg; - agg_blk_arr[agg_next_off_idx] = - agg_mem_act_reg_sz; - agg_ol_cur_ct++; - } - else - { - agg_blk_arr[agg_next_off_idx - 1] - += agg_mem_act_reg_sz; - } - agg_mem_next_off = - agg_mem_st_reg + agg_mem_act_reg_sz; - break; - default: - fprintf(stderr, "ADIOI_Build_client_req: " - "Impossible type\n"); - } - } - } - - /* On the first pass, allocate the memory structures for - * creating the MPI_hindexed type. */ - if (i == TEMP_OFF) - { - /* Allocate offset-length pairs for creating hindexed - * MPI_Datatypes for each aggregator */ - if ((agg_disp_arr = (MPI_Aint *) - ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) - { - fprintf(stderr, "ADIOI_Build_client_req: malloc " - "agg_disp_arr of size %ld failed\n", - (long int)agg_ol_ct * sizeof(MPI_Aint)); - return -1; - } - if ((agg_blk_arr = (int *) - ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) - { - ADIOI_Free(agg_disp_arr); - fprintf(stderr, "ADIOI_Build_client_req: malloc " - "agg_blk_arr of size %ld failed\n", - (long int)agg_ol_ct * sizeof(int)); - return -1; - } - } - } - - assert(agg_ol_ct == agg_ol_cur_ct); -#ifdef DEBUG1 - fprintf(stderr, - "ADIOI_Build_client_req:(agg=%d,cur_ol_count=%d=ol_count=%d)\n", - agg_rank, agg_ol_cur_ct, agg_ol_ct); -#endif - -#ifdef DEBUG2 - if (agg_ol_ct > 0) - { - fprintf(stderr, "ADIOI_Build_client_req: p %d (off,len) = ", agg_rank); - for (i = 0; i < agg_ol_ct; i++) - { - fprintf(stderr, "[%d](%d,%d) ", i, - agg_disp_arr[i], agg_blk_arr[i]); - if (i % 5 == 0 && i != 0) - fprintf(stderr, "\n"); - } - fprintf(stderr, "\n"); - } -#endif -#ifdef DEBUG1 - fprintf(stderr, - "ADIOI_Build_client_req:(agg=%d,pre_ol_count=%d)\n", - agg_idx, my_mem_view_state_p->pre_ol_ct); -#endif - -#ifdef DEBUG2 - if (my_mem_view_state_p->pre_sz > 0) - { - fprintf(stderr, "ADIOI_Build_client_req: p %d pre(off,len) = ", - agg_idx); - for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) - { - fprintf(stderr, "[%d](%d,%d) ", i, - my_mem_view_state_p->pre_disp_arr[i], - my_mem_view_state_p->pre_blk_arr[i]); - if (i % 5 == 0 && i != 0) - fprintf(stderr, "\n"); - } - fprintf(stderr, "\n"); - } -#endif - - /* Create the aggregator MPI_Datatype */ - if (agg_comm_sz > 0) - { - MPI_Type_create_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, - agg_comm_dtype_p); - MPI_Type_commit(agg_comm_dtype_p); - } - else - { - *agg_comm_dtype_p = MPI_BYTE; - } - - ADIOI_Free(agg_blk_arr); - ADIOI_Free(agg_disp_arr); - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5019, 0, NULL); -#endif - return 0; -} - - diff --git a/3rd-party/romio321/adio/common/ad_coll_exch_new.c b/3rd-party/romio321/adio/common/ad_coll_exch_new.c deleted file mode 100644 index 7013a3a8554ed9ea72a21886c9d2dbb5917108bf..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_coll_exch_new.c +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include <assert.h> -#include "adio.h" -#include "adio_extern.h" -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -/* -#define DEBUG -#define DEBUG2 -*/ - -#define COUNT_EXCH 0 -#define BLOCK_LENS 1 -#define INDICES 2 -#define FPIND_DISP_OFF_SZ 3 - - -typedef struct { - int count; - ADIO_Offset fp_ind; - ADIO_Offset disp; - ADIO_Offset byte_off; - ADIO_Offset sz; - ADIO_Offset ext; - ADIO_Offset type_sz; -} amount_and_extra_data_t; - -/* Debugging function to print out an ADIOI_Flatlist_node. */ -void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p) -{ - int i; - if (flatlist_node_p == NULL) - { - fprintf(stderr, "print flatlist node of NULL ptr\n"); - return; - } - fprintf(stderr, "print flatlist node count = %d (idx,blocklen)\n", - (int)flatlist_node_p->count); - for (i = 0; i < flatlist_node_p->count; i++) - { - if (i % 5 == 0 && i != 0) - { - fprintf(stderr, "%d=(%lld,%lld)\n", i, (long long)flatlist_node_p->indices[i], - (long long)flatlist_node_p->blocklens[i]); - } - else - fprintf(stderr, "%d=(%lld,%lld) ", i, (long long)flatlist_node_p->indices[i], - (long long)flatlist_node_p->blocklens[i]); - } - fprintf(stderr, "\n"); -} - -/* Since ADIOI_Flatten_datatype won't add a contig datatype to the - * ADIOI_Flatlist, we can force it to do so with this function. */ -ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type) -{ - MPI_Count contig_type_sz = -1; - ADIOI_Flatlist_node *flat_node_p = ADIOI_Flatlist; - - /* Add contig type to the end of the list if it doesn't already - * exist. */ - while (flat_node_p->next) - { - if (flat_node_p->type == contig_type) - return flat_node_p; - flat_node_p = flat_node_p->next; - } - if (flat_node_p->type == contig_type) - return flat_node_p; - - MPI_Type_size_x(contig_type, &contig_type_sz); - if ((flat_node_p->next = (ADIOI_Flatlist_node *) ADIOI_Malloc - (sizeof(ADIOI_Flatlist_node))) == NULL) - { - fprintf(stderr, "ADIOI_Add_contig_flattened: malloc next failed\n"); - } - flat_node_p = flat_node_p->next; - flat_node_p->type = contig_type; - if ((flat_node_p->blocklens = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL) - { - fprintf(stderr, "ADIOI_Flatlist_node: malloc blocklens failed\n"); - } - if ((flat_node_p->indices = (ADIO_Offset *) - ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL) - { - fprintf(stderr, "ADIOI_Flatlist_node: malloc indices failed\n"); - } - flat_node_p->blocklens[0] = contig_type_sz; - flat_node_p->indices[0] = 0; - flat_node_p->count = 1; - flat_node_p->next = NULL; - return flat_node_p; -} - -/* ADIOI_Exchange_file_views - Sends all the aggregators the file - * views and file view states of the clients. It fills in the - * client_file_view_state_arr for the aggregators and the - * my_mem_view_state for the client. It also initializes the - * agg_file_view_state for all clients, which is the view for each - * aggregator of a client's filetype. */ -void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, - ADIO_File fd, int count, - MPI_Datatype datatype, ADIO_Offset off, - view_state *my_mem_view_state_arr, - view_state *agg_file_view_state_arr, - view_state *client_file_view_state_arr) -{ - /* Convert my own fileview to an ADIOI_Flattened type and a - * disp. MPI_Alltoall the count of ADIOI_Flatlist nodes. - * MPI_Isend/Irecv the block_lens, indices of ADIOI_Flatlist node - * to/from each of the aggregators with the rest of the file view - * state. */ - - int i = -1, j = -1; - amount_and_extra_data_t *send_count_arr = NULL; - amount_and_extra_data_t *recv_count_arr = NULL; - int send_req_arr_sz = 0; - int recv_req_arr_sz = 0; - MPI_Request *send_req_arr = NULL, *recv_req_arr = NULL; - MPI_Status *statuses = NULL; - ADIO_Offset disp_off_sz_ext_typesz[6]; - MPI_Aint memtype_extent, filetype_extent, lb; - int ret = -1; - - /* parameters for datatypes */ - ADIOI_Flatlist_node *flat_mem_p = NULL, *flat_file_p = NULL; - MPI_Count memtype_sz = -1; - int memtype_is_contig = -1; - ADIO_Offset filetype_sz = -1; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5014, 0, NULL); -#endif - /* The memtype will be freed after the call. The filetype will be - * freed in the close and should have been flattened in the file - * view. */ - MPI_Type_size_x(datatype, &memtype_sz); - MPI_Type_get_extent(datatype, &lb, &memtype_extent); - if (memtype_sz == memtype_extent) { - memtype_is_contig = 1; - flat_mem_p = ADIOI_Add_contig_flattened(datatype); - flat_mem_p->blocklens[0] = memtype_sz*count; - } - else { - flat_mem_p = ADIOI_Flatten_and_find(datatype); - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(fd->filetype, &filetype_sz); - if (filetype_extent == filetype_sz) { - flat_file_p = ADIOI_Add_contig_flattened(fd->filetype); - flat_file_p->blocklens[0] = memtype_sz*count; - filetype_extent = memtype_sz*count; - filetype_sz = filetype_extent; - } - else { - flat_file_p = ADIOI_Flatlist; - while (flat_file_p->type != fd->filetype) - flat_file_p = flat_file_p->next; - } - - disp_off_sz_ext_typesz[0] = fd->fp_ind; - disp_off_sz_ext_typesz[1] = fd->disp; - disp_off_sz_ext_typesz[2] = off; - disp_off_sz_ext_typesz[3] = memtype_sz*count; - disp_off_sz_ext_typesz[4] = (ADIO_Offset) filetype_extent; - disp_off_sz_ext_typesz[5] = (ADIO_Offset) filetype_sz; - - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - recv_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); - send_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); - } else { - send_count_arr = ADIOI_Calloc(fd->hints->cb_nodes, - sizeof(amount_and_extra_data_t)); - - /* only aggregators receive data */ - if (fd->is_agg) { - recv_count_arr = ADIOI_Calloc(nprocs, - sizeof(amount_and_extra_data_t)); - recv_req_arr = ADIOI_Malloc (nprocs * sizeof(MPI_Request)); - for (i=0; i < nprocs; i++) - MPI_Irecv (&recv_count_arr[i], sizeof(amount_and_extra_data_t), - MPI_BYTE, i, COUNT_EXCH, fd->comm, &recv_req_arr[i]); - } - - /* only send data to aggregators */ - send_req_arr = ADIOI_Calloc (fd->hints->cb_nodes, sizeof(MPI_Request)); - for (i=0; i < fd->hints->cb_nodes; i++) { - send_count_arr[i].count = flat_file_p->count; - send_count_arr[i].fp_ind = disp_off_sz_ext_typesz[0]; - send_count_arr[i].disp = disp_off_sz_ext_typesz[1]; - send_count_arr[i].byte_off = disp_off_sz_ext_typesz[2]; - send_count_arr[i].sz = disp_off_sz_ext_typesz[3]; - send_count_arr[i].ext = disp_off_sz_ext_typesz[4]; - send_count_arr[i].type_sz = disp_off_sz_ext_typesz[5]; - MPI_Isend (&send_count_arr[i], sizeof(amount_and_extra_data_t), - MPI_BYTE, fd->hints->ranklist[i], COUNT_EXCH, fd->comm, - &send_req_arr[i]); - } - } - - - /* Every client has to build mem and file view_states for each aggregator. - * We initialize their values here. and we also initialize - * send_count_arr */ - - if (memtype_is_contig) { - /* if memory is contigous, we now replace memtype_sz and - * memtype_extent with the full access size */ - memtype_sz *= count; - memtype_extent = memtype_sz; - } - - for (i = 0; i < fd->hints->cb_nodes; i++) - { - int tmp_agg_idx = fd->hints->ranklist[i]; - memset(&(my_mem_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); - my_mem_view_state_arr[tmp_agg_idx].sz = - disp_off_sz_ext_typesz[3]; - my_mem_view_state_arr[tmp_agg_idx].ext = - (ADIO_Offset) memtype_extent; - my_mem_view_state_arr[tmp_agg_idx].type_sz = - (ADIO_Offset) memtype_sz; - my_mem_view_state_arr[tmp_agg_idx].flat_type_p = flat_mem_p; - ADIOI_init_view_state(file_ptr_type, - 1, - &(my_mem_view_state_arr[tmp_agg_idx]), - TEMP_OFF); - ADIOI_init_view_state(file_ptr_type, - 1, - &(my_mem_view_state_arr[tmp_agg_idx]), - REAL_OFF); - - memset(&(agg_file_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); - agg_file_view_state_arr[tmp_agg_idx].fp_ind = - disp_off_sz_ext_typesz[0]; - agg_file_view_state_arr[tmp_agg_idx].disp = - disp_off_sz_ext_typesz[1]; - agg_file_view_state_arr[tmp_agg_idx].byte_off = - disp_off_sz_ext_typesz[2]; - agg_file_view_state_arr[tmp_agg_idx].sz = - disp_off_sz_ext_typesz[3]; - agg_file_view_state_arr[tmp_agg_idx].ext = - disp_off_sz_ext_typesz[4]; - agg_file_view_state_arr[tmp_agg_idx].type_sz = - disp_off_sz_ext_typesz[5]; - agg_file_view_state_arr[tmp_agg_idx].flat_type_p = flat_file_p; - - ADIOI_init_view_state(file_ptr_type, - 1, - &(agg_file_view_state_arr[tmp_agg_idx]), - TEMP_OFF); - ADIOI_init_view_state(file_ptr_type, - 1, - &(agg_file_view_state_arr[tmp_agg_idx]), - REAL_OFF); - - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - send_count_arr[tmp_agg_idx].count = flat_file_p->count; - send_count_arr[tmp_agg_idx].fp_ind = disp_off_sz_ext_typesz[0]; - send_count_arr[tmp_agg_idx].disp = disp_off_sz_ext_typesz[1]; - send_count_arr[tmp_agg_idx].byte_off = disp_off_sz_ext_typesz[2]; - send_count_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3]; - send_count_arr[tmp_agg_idx].ext = disp_off_sz_ext_typesz[4]; - send_count_arr[tmp_agg_idx].type_sz = disp_off_sz_ext_typesz[5]; - } - } - -#ifdef DEBUG2 - fprintf(stderr, "my own flattened memtype: "); - ADIOI_Print_flatlist_node(flat_mem_p); - fprintf(stderr, "my own flattened filetype: "); - ADIOI_Print_flatlist_node(flat_file_p); -#endif - - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - ret = MPI_Alltoall(send_count_arr, sizeof(amount_and_extra_data_t), - MPI_BYTE, - recv_count_arr, sizeof(amount_and_extra_data_t), - MPI_BYTE, fd->comm); - if (ret != MPI_SUCCESS) - { - fprintf(stderr, "ADIOI_Exchange_file_views: MPI_Alltoall failed " - "with error %d", ret); - return; - } - } else { - statuses = (MPI_Status *) ADIOI_Malloc(1 + nprocs * sizeof(MPI_Status)); - if (fd->is_agg) { - MPI_Waitall(nprocs, recv_req_arr, statuses); - ADIOI_Free(recv_req_arr); - } - MPI_Waitall(fd->hints->cb_nodes, send_req_arr, statuses); - ADIOI_Free(statuses); - ADIOI_Free(send_req_arr); - } -#ifdef DEBUG2 - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - fprintf(stderr, "send_count_arr:"); - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); - } - fprintf(stderr, "\n"); - fprintf(stderr, "recv_count_arr:"); - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); - } - fprintf(stderr, "\n"); - } else { - fprintf(stderr, "send_count_arr:"); - for (i = 0; i < fd->hints->cb_nodes; i++) - { - fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); - } - fprintf(stderr, "\n"); - if (fd->is_agg) { - fprintf(stderr, "recv_count_arr:"); - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); - } - fprintf(stderr, "\n"); - } - } -#endif - - if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { - for (i=0; i < fd->hints->cb_nodes; i++) - if (send_count_arr[i].count > 0) - send_req_arr_sz++; - } - /* Figure out how many counts to send/recv */ - for (i = 0; i < nprocs; i++) - { - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - if (send_count_arr[i].count > 0) - send_req_arr_sz++; - } - /* Only aggregators should recv*/ - if (fd->is_agg) { - if (recv_count_arr[i].count > 0) - { - if ((client_file_view_state_arr[i].flat_type_p = - (ADIOI_Flatlist_node *) ADIOI_Malloc( - sizeof(ADIOI_Flatlist_node))) == NULL) - { - fprintf(stderr, "ADIOI_Exchange_file_views: malloc " - "flat_type_p failed\n"); - } - client_file_view_state_arr[i].flat_type_p->count = - recv_count_arr[i].count; - client_file_view_state_arr[i].flat_type_p->indices = - (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, - sizeof(ADIO_Offset)); - client_file_view_state_arr[i].flat_type_p->blocklens = - (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, - sizeof(ADIO_Offset)); - - /* Copy the extra data out of the stuff we Alltoall'd */ - memcpy (&client_file_view_state_arr[i].fp_ind, - &recv_count_arr[i].fp_ind, - 6*sizeof(ADIO_Offset)); - - recv_req_arr_sz++; - } - } - } - - /* Since ADIOI_Calloc may do other things we add the +1 - * to avoid a 0-size malloc */ - send_req_arr = (MPI_Request *) ADIOI_Calloc(2*(send_req_arr_sz)+1, - sizeof(MPI_Request)); - - j = 0; - if (recv_req_arr_sz > 0) { - assert (fd->is_agg); - recv_req_arr = (MPI_Request *) ADIOI_Calloc(2*(recv_req_arr_sz), - sizeof(MPI_Request)); - for (i = 0; i < nprocs; i++) { - if (recv_count_arr[i].count > 0) { - MPI_Irecv(client_file_view_state_arr[i].flat_type_p->indices, - recv_count_arr[i].count, ADIO_OFFSET, i, - INDICES, fd->comm, &recv_req_arr[j]); - j++; - MPI_Irecv(client_file_view_state_arr[i].flat_type_p->blocklens, - recv_count_arr[i].count, ADIO_OFFSET, i, - BLOCK_LENS, fd->comm, &recv_req_arr[j]); - j++; - } - } - } - - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - j = 0; - for (i = 0; i < nprocs; i++) { - if (send_count_arr[i].count > 0) { - MPI_Isend(flat_file_p->indices, - send_count_arr[i].count, ADIO_OFFSET, i, - INDICES, fd->comm, &send_req_arr[j]); - j++; - MPI_Isend(flat_file_p->blocklens, - send_count_arr[i].count, ADIO_OFFSET, i, - BLOCK_LENS, fd->comm, &send_req_arr[j]); - j++; - } - } - } else { - j = 0; - for (i = 0; i < fd->hints->cb_nodes; i++) { - if (send_count_arr[i].count > 0) { - MPI_Isend(flat_file_p->indices, - send_count_arr[i].count, ADIO_OFFSET, - fd->hints->ranklist[i], INDICES, fd->comm, - &send_req_arr[j]); - j++; - MPI_Isend(flat_file_p->blocklens, - send_count_arr[i].count, ADIO_OFFSET, - fd->hints->ranklist[i], BLOCK_LENS, fd->comm, - &send_req_arr[j]); - j++; - } - } - } - - /* Since ADIOI_Malloc may do other things we add the +1 - * to avoid a 0-size malloc */ - statuses = (MPI_Status *) - ADIOI_Malloc(1 + 2 * ADIOI_MAX(send_req_arr_sz,recv_req_arr_sz) - * sizeof(MPI_Status)); - - if (send_req_arr_sz > 0) { - MPI_Waitall(2 * send_req_arr_sz, send_req_arr, statuses); - ADIOI_Free(send_count_arr); - ADIOI_Free(send_req_arr); - } - if (recv_req_arr_sz > 0) { - MPI_Waitall(2 * recv_req_arr_sz, recv_req_arr, statuses); - ADIOI_Free(recv_count_arr); - ADIOI_Free(recv_req_arr); - } - ADIOI_Free(statuses); - - if (fd->is_agg == 1) - { - ADIOI_init_view_state(file_ptr_type, - nprocs, - client_file_view_state_arr, - TEMP_OFF); - ADIOI_init_view_state(file_ptr_type, - nprocs, - client_file_view_state_arr, - REAL_OFF); - } - -#ifdef DEBUG - if (fd->is_agg == 1) - { - ADIOI_Flatlist_node *fr_node_p = ADIOI_Flatlist; - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "client_file_view_state_arr[%d]=(fp_ind=%Ld," - "disp=%Ld,byte_off=%Ld,sz=%Ld,ext=%Ld\n", i, - client_file_view_state_arr[i].fp_ind, - client_file_view_state_arr[i].disp, - client_file_view_state_arr[i].byte_off, - client_file_view_state_arr[i].sz, - client_file_view_state_arr[i].ext); - } - - while (fr_node_p->type != - fd->file_realm_types[fd->my_cb_nodes_index]) - fr_node_p = fr_node_p->next; - assert(fr_node_p != NULL); - - fprintf(stderr, "my file realm (idx=%d,st_off=%Ld) ", - fd->my_cb_nodes_index, - fd->file_realm_st_offs[fd->my_cb_nodes_index]); - ADIOI_Print_flatlist_node(fr_node_p); - } -#endif - -#ifdef DEBUG2 - if (fd->is_agg == 1) - { - for (i = 0; i < nprocs; i++) - { - fprintf(stderr, "client_file_view_state_arr[%d]: ", i); - ADIOI_Print_flatlist_node( - client_file_view_state_arr[i].flat_type_p); - } - } -#endif -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5015, 0, NULL); -#endif -} diff --git a/3rd-party/romio321/adio/common/ad_darray.c b/3rd-party/romio321/adio/common/ad_darray.c deleted file mode 100644 index 3c9ca36a8e188076cbdd01d6f3c2e7f7f5846886..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_darray.c +++ /dev/null @@ -1,291 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset); -static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset); - - -int ADIO_Type_create_darray(int size, int rank, int ndims, - int *array_of_gsizes, int *array_of_distribs, - int *array_of_dargs, int *array_of_psizes, - int order, MPI_Datatype oldtype, - MPI_Datatype *newtype) -{ - MPI_Datatype type_old, type_new=MPI_DATATYPE_NULL, inttype; - int procs, tmp_rank, i, tmp_size, blklen, *coords; - MPI_Aint *st_offsets, orig_extent, disp, ub, lb; - - MPI_Type_get_extent(oldtype, &lb, &orig_extent); - -/* calculate position in Cartesian grid as MPI would (row-major - ordering) */ - coords = (int *) ADIOI_Malloc(ndims*sizeof(int)); - procs = size; - tmp_rank = rank; - for (i=0; i<ndims; i++) { - procs = procs/array_of_psizes[i]; - coords[i] = tmp_rank/procs; - tmp_rank = tmp_rank % procs; - } - - st_offsets = (MPI_Aint *) ADIOI_Malloc(ndims*sizeof(MPI_Aint)); - type_old = oldtype; - - if (order == MPI_ORDER_FORTRAN) { - /* dimension 0 changes fastest */ - for (i=0; i<ndims; i++) { - switch(array_of_distribs[i]) { - case MPI_DISTRIBUTE_BLOCK: - MPIOI_Type_block(array_of_gsizes, i, ndims, - array_of_psizes[i], - coords[i], array_of_dargs[i], - order, orig_extent, - type_old, &type_new, - st_offsets+i); - break; - case MPI_DISTRIBUTE_CYCLIC: - MPIOI_Type_cyclic(array_of_gsizes, i, ndims, - array_of_psizes[i], coords[i], - array_of_dargs[i], order, - orig_extent, type_old, - &type_new, st_offsets+i); - break; - case MPI_DISTRIBUTE_NONE: - /* treat it as a block distribution on 1 process */ - MPIOI_Type_block(array_of_gsizes, i, ndims, 1, 0, - MPI_DISTRIBUTE_DFLT_DARG, order, - orig_extent, - type_old, &type_new, - st_offsets+i); - break; - } - if (i) MPI_Type_free(&type_old); - type_old = type_new; - } - - /* add displacement and UB */ - disp = st_offsets[0]; - tmp_size = 1; - for (i=1; i<ndims; i++) { - tmp_size *= array_of_gsizes[i-1]; - disp += (MPI_Aint)tmp_size*st_offsets[i]; - } - /* rest done below for both Fortran and C order */ - } - - else /* order == MPI_ORDER_C */ { - /* dimension ndims-1 changes fastest */ - for (i=ndims-1; i>=0; i--) { - switch(array_of_distribs[i]) { - case MPI_DISTRIBUTE_BLOCK: - MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], - coords[i], array_of_dargs[i], order, - orig_extent, type_old, &type_new, - st_offsets+i); - break; - case MPI_DISTRIBUTE_CYCLIC: - MPIOI_Type_cyclic(array_of_gsizes, i, ndims, - array_of_psizes[i], coords[i], - array_of_dargs[i], order, - orig_extent, type_old, &type_new, - st_offsets+i); - break; - case MPI_DISTRIBUTE_NONE: - /* treat it as a block distribution on 1 process */ - MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], - coords[i], MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, - type_old, &type_new, st_offsets+i); - break; - } - if (i != ndims-1) MPI_Type_free(&type_old); - type_old = type_new; - } - - /* add displacement and UB */ - disp = st_offsets[ndims-1]; - tmp_size = 1; - for (i=ndims-2; i>=0; i--) { - tmp_size *= array_of_gsizes[i+1]; - disp += (MPI_Aint)tmp_size*st_offsets[i]; - } - } - - disp *= orig_extent; - - ub = orig_extent; - for (i=0; i<ndims; i++) ub *= (MPI_Aint)array_of_gsizes[i]; - - blklen = 1; - - MPI_Type_create_struct(1, &blklen, &disp, &type_new, &inttype); - MPI_Type_create_resized (inttype, 0, ub, newtype); - MPI_Type_free (&inttype); - - MPI_Type_free(&type_new); - ADIOI_Free(st_offsets); - ADIOI_Free(coords); - return MPI_SUCCESS; -} - - -/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above - * needs to call MPIO_Err_return_xxx. - */ -static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset) -{ -/* nprocs = no. of processes in dimension dim of grid - rank = coordinate of this process in dimension dim */ - int blksize, global_size, mysize, i, j; - MPI_Aint stride; - - global_size = array_of_gsizes[dim]; - - if (darg == MPI_DISTRIBUTE_DFLT_DARG) - blksize = (global_size + nprocs - 1)/nprocs; - else { - blksize = darg; - - /* --BEGIN ERROR HANDLING-- */ - if (blksize <= 0) { - return MPI_ERR_ARG; - } - - if (blksize * nprocs < global_size) { - return MPI_ERR_ARG; - } - /* --END ERROR HANDLING-- */ - } - - j = global_size - blksize*rank; - mysize = ADIOI_MIN(blksize, j); - if (mysize < 0) mysize = 0; - - stride = orig_extent; - if (order == MPI_ORDER_FORTRAN) { - if (dim == 0) - MPI_Type_contiguous(mysize, type_old, type_new); - else { - for (i=0; i<dim; i++) stride *= (MPI_Aint)array_of_gsizes[i]; - MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new); - } - } - else { - if (dim == ndims-1) - MPI_Type_contiguous(mysize, type_old, type_new); - else { - for (i=ndims-1; i>dim; i--) stride *= (MPI_Aint)array_of_gsizes[i]; - MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new); - } - - } - - *st_offset = (MPI_Aint)blksize * (MPI_Aint)rank; - /* in terms of no. of elements of type oldtype in this dimension */ - if (mysize == 0) *st_offset = 0; - - return MPI_SUCCESS; -} - - -/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above - * needs to call MPIO_Err_return_xxx. - */ -static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset) -{ -/* nprocs = no. of processes in dimension dim of grid - rank = coordinate of this process in dimension dim */ - int blksize, i, blklens[3], st_index, end_index, local_size, rem, count; - MPI_Aint stride, disps[3]; - MPI_Datatype type_tmp, type_tmp1, types[3]; - - if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1; - else blksize = darg; - - /* --BEGIN ERROR HANDLING-- */ - if (blksize <= 0) { - return MPI_ERR_ARG; - } - /* --END ERROR HANDLING-- */ - - st_index = rank*blksize; - end_index = array_of_gsizes[dim] - 1; - - if (end_index < st_index) local_size = 0; - else { - local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize; - rem = (end_index - st_index + 1) % (nprocs*blksize); - local_size += ADIOI_MIN(rem, blksize); - } - - count = local_size/blksize; - rem = local_size % blksize; - - stride = (MPI_Aint)nprocs*(MPI_Aint)blksize*orig_extent; - if (order == MPI_ORDER_FORTRAN) - for (i=0; i<dim; i++) stride *= (MPI_Aint)array_of_gsizes[i]; - else for (i=ndims-1; i>dim; i--) stride *= (MPI_Aint)array_of_gsizes[i]; - - MPI_Type_create_hvector(count, blksize, stride, type_old, type_new); - - if (rem) { - /* if the last block is of size less than blksize, include - it separately using MPI_Type_struct */ - - types[0] = *type_new; - types[1] = type_old; - disps[0] = 0; - disps[1] = (MPI_Aint)count*stride; - blklens[0] = 1; - blklens[1] = rem; - - MPI_Type_create_struct(2, blklens, disps, types, &type_tmp); - - MPI_Type_free(type_new); - *type_new = type_tmp; - } - - /* In the first iteration, we need to set the displacement in that - dimension correctly. */ - if ( ((order == MPI_ORDER_FORTRAN) && (dim == 0)) || - ((order == MPI_ORDER_C) && (dim == ndims-1)) ) { - types[0] = *type_new; - disps[0] = (MPI_Aint)rank * (MPI_Aint)blksize * orig_extent; - blklens[0] = 1; - MPI_Type_create_struct(1, blklens, disps, types, &type_tmp1); - MPI_Type_create_resized (type_tmp1, 0, orig_extent * (MPI_Aint)array_of_gsizes[dim], &type_tmp); - MPI_Type_free(&type_tmp1); - MPI_Type_free(type_new); - *type_new = type_tmp; - - *st_offset = 0; /* set it to 0 because it is taken care of in - the struct above */ - } - else { - *st_offset = (MPI_Aint)rank * (MPI_Aint)blksize; - /* st_offset is in terms of no. of elements of type oldtype in - * this dimension */ - } - - if (local_size == 0) *st_offset = 0; - - return MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_delete.c b/3rd-party/romio321/adio/common/ad_delete.c deleted file mode 100644 index ae78d7e0a7e910bd879a55b55214c7ab7daf616d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_delete.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_GEN_Delete(const char *filename, int *error_code) -{ - int err; - static char myname[] = "ADIOI_GEN_DELETE"; - - err = unlink(filename); - if (err == -1) { - *error_code = ADIOI_Err_create_code(myname, filename, errno); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_done_fake.c b/3rd-party/romio321/adio/common/ad_done_fake.c deleted file mode 100644 index 59da5755e0b9010630bac3527a8f0cc27dfc8ec9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_done_fake.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* Generic implementation of ReadDone/WriteDone simply sets the - * bytes field in the status structure and frees the request. - * - * Same function is used for both reads and writes. - */ -int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - /* should not ever get called now */ - return 1; -} diff --git a/3rd-party/romio321/adio/common/ad_fcntl.c b/3rd-party/romio321/adio/common/ad_fcntl.c deleted file mode 100644 index 62067573dd1c199e861b58ee31a6ab1ec758b018..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_fcntl.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2005 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code) -{ - static char myname[] = "ADIOI_GEN_FCNTL"; - - switch(flag) { - case ADIO_FCNTL_GET_FSIZE: -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (fd->fp_sys_posn != -1) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - } - if (fcntl_struct->fsize == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - /* --BEGIN ERROR HANDLING-- */ - default: - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**flag", "**flag %d", flag); - /* --END ERROR HANDLING-- */ - } -} diff --git a/3rd-party/romio321/adio/common/ad_features.c b/3rd-party/romio321/adio/common/ad_features.c deleted file mode 100644 index 480a42c6fe4e93fac3e82876d0db14f478a2eadb..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_features.c +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "adio.h" - -int ADIOI_GEN_Feature(ADIO_File fd, int flag) -{ - switch(flag) { - case ADIO_LOCKS: - case ADIO_SHARED_FP: - case ADIO_ATOMIC_MODE: - case ADIO_DATA_SIEVING_WRITES: - case ADIO_UNLINK_AFTER_CLOSE: - case ADIO_TWO_PHASE: - case ADIO_SCALABLE_RESIZE: - return 1; - break; - case ADIO_SCALABLE_OPEN: - default: - return 0; - break; - } -} diff --git a/3rd-party/romio321/adio/common/ad_flush.c b/3rd-party/romio321/adio/common/ad_flush.c deleted file mode 100644 index 3ace6778bf47ee4f1e34f824520bab4182bdf730..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_flush.c +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_GEN_Flush(ADIO_File fd, int *error_code) -{ - int err; - static char myname[] = "ADIOI_GEN_FLUSH"; - - /* the deferred-open optimization may mean that a file has not been opened - * on this processor */ - if (fd->is_open > 0) { - err = fsync(fd->fd_sys); - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - return; - } - /* --END ERROR HANDLING-- */ - } - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_fstype.c b/3rd-party/romio321/adio/common/ad_fstype.c deleted file mode 100644 index 75fb24fee66f4c62594a46a651364a92960f6513..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_fstype.c +++ /dev/null @@ -1,872 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* This file is quickly becoming the single one, outside the ADIO - * implementations, which has "what ADIO components are built in" code in it. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif - -#ifdef HAVE_PVFS_H -#include "pvfs.h" -#endif - -#ifdef HAVE_PVFS2_H -#include "pvfs2.h" -#endif - -#ifdef HAVE_ZOIDFS_H -#include "zoidfs.h" -#endif - -#ifdef HAVE_GPFS_H -#include "gpfs.h" -#endif - -/* Notes on detection process: - * - * There are three more "general" mechanisms that we use for detecting - * file system type: - * - struct statfs's f_type field - * - struct statvfs's f_basetype field - * - struct stat's st_fstype field - * - * Otherwise we'll fall back on some OS-specific approach. - */ - -#ifdef HAVE_STRUCT_STATFS -# ifdef HAVE_SYS_VFS_H -# include <sys/vfs.h> -# endif -# ifdef HAVE_SYS_STATVFS_H -# include <sys/statvfs.h> -# endif -# ifdef HAVE_SYS_PARAM_H -# include <sys/param.h> -# endif -# ifdef HAVE_SYS_MOUNT_H -# include <sys/mount.h> -# endif - /* On Linux platforms, linux/nfs_fs.h is all messed up and cannot be - * reliably included. - */ -# if defined(ROMIO_NFS) && !defined(NFS_SUPER_MAGIC) -# define NFS_SUPER_MAGIC 0x6969 -# endif - -# if defined(ROMIO_PANFS) && !defined(PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) -# define PAN_KERNEL_FS_CLIENT_SUPER_MAGIC 0xAAD7AAEA -# endif -#endif - -# if defined(ROMIO_XFS) && !defined(XFS_SUPER_MAGIC) -# define XFS_SUPER_MAGIC 0x58465342 -# endif - -#if !defined(PVFS2_SUPER_MAGIC) -#define PVFS2_SUPER_MAGIC (0x20030528) -#endif - -#if defined(ROMIO_GPFS) && !defined(GPFS_SUPER_MAGIC) -# define GPFS_SUPER_MAGIC 0x47504653 -#endif - -#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE -# ifdef HAVE_SYS_STATVFS_H -# include <sys/statvfs.h> -# endif -# ifdef HAVE_SYS_VFS_H -# include <sys/vfs.h> -# endif -# ifdef HAVE_SYS_PARAM_H -# include <sys/param.h> -# endif -# ifdef HAVE_SYS_MOUNT_H -# include <sys/mount.h> -# endif -#endif - -#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE -# ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -# ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -# endif -#endif - -/* ADIO_FileSysType_parentdir is only used if one of these is defined. - By including this test, we avoid warnings about unused static functions - from the compiler */ -#if defined(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || \ - defined(HAVE_STRUCT_STATFS) || \ - defined(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE) -#ifndef ROMIO_NTFS -#define ROMIO_NEEDS_ADIOPARENTDIR -static void ADIO_FileSysType_parentdir(const char *filename, char **dirnamep); -#endif -#endif -static void ADIO_FileSysType_prefix(const char *filename, int *fstype, - int *error_code); -static void ADIO_FileSysType_fncall(const char *filename, int *fstype, - int *error_code); - -/* - ADIO_FileSysType_parentdir - determines a string pathname for the - parent directory of a given filename. - -Input Parameters: -. filename - pointer to file name character array - -Output Parameters: -. dirnamep - pointer to location in which to store a pointer to a string - - Note that the caller should free the memory located at the pointer returned - after the string is no longer needed. -*/ -#ifdef ROMIO_NEEDS_ADIOPARENTDIR - -/* In a strict ANSI environment, S_ISLNK may not be defined. Fix that - here. We assume that S_ISLNK is *always* defined as a macro. If - that is not universally true, then add a test to the romio - configure that trys to link a program that references S_ISLNK */ -#if !defined(S_ISLNK) -# if defined(S_IFLNK) - /* Check for the link bit */ -# define S_ISLNK(mode) ((mode) & S_IFLNK) -# else - /* no way to check if it is a link, so say false */ -# define S_ISLNK(mode) 0 -# endif -#endif /* !(S_ISLNK) */ - -/* ADIO_FileSysType_parentdir - * - * Returns pointer to string in dirnamep; that string is allocated with - * strdup and must be free()'d. - */ -static void ADIO_FileSysType_parentdir(const char *filename, char **dirnamep) -{ - int err; - char *dir = NULL, *slash; - struct stat statbuf; - - err = lstat(filename, &statbuf); - - if (err || (!S_ISLNK(statbuf.st_mode))) { - /* no such file, or file is not a link; these are the "normal" - * cases where we can just return the parent directory. - */ - dir = ADIOI_Strdup(filename); - } - else { - /* filename is a symlink. we've presumably already tried - * to stat it and found it to be missing (dangling link), - * but this code doesn't care if the target is really there - * or not. - */ - ssize_t namelen; - char *linkbuf; - - linkbuf = ADIOI_Malloc(PATH_MAX+1); - namelen = readlink(filename, linkbuf, PATH_MAX+1); - if (namelen == -1) { - /* something strange has happened between the time that - * we determined that this was a link and the time that - * we attempted to read it; punt and use the old name. - */ - dir = ADIOI_Strdup(filename); - } - else { - /* successfully read the link */ - linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */ - dir = ADIOI_Strdup(linkbuf); - } - ADIOI_Free(linkbuf); - } - - slash = strrchr(dir, '/'); - if (!slash) ADIOI_Strncpy(dir, ".", 2); - else { - if (slash == dir) *(dir + 1) = '\0'; - else *slash = '\0'; - } - - *dirnamep = dir; - return; -} -#endif /* ROMIO_NTFS */ - -/* - ADIO_FileSysType_fncall - determines the file system type for a given file - using a system-dependent function call - -Input Parameters: -. filename - pointer to file name character array - -Output Parameters: -. fstype - location in which to store file system type (ADIO_XXX) -. error_code - location in which to store error code - - MPI_SUCCESS is stored in the location pointed to by error_code on success. - - This function is used by MPI_File_open() and MPI_File_delete() to determine - file system type. Most other functions use the type which is stored when the - file is opened. - */ -static void ADIO_FileSysType_fncall(const char *filename, int *fstype, int *error_code) -{ -#if defined (ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || defined (HAVE_STRUCT_STATFS) || defined (ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE) - int err; -#endif - -#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE - struct statvfs vfsbuf; -#endif -#ifdef HAVE_STRUCT_STATFS - struct statfs fsbuf; -#endif -#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE - struct stat sbuf; -#endif - static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL"; - -/* NFS can get stuck and end up returing ESTALE "forever" */ -#define MAX_ESTALE_RETRY 10000 - int retry_cnt; - - *error_code = MPI_SUCCESS; - -#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE - /* rare: old solaris machines */ - retry_cnt=0; - do { - err = statvfs(filename, &vfsbuf); - } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); - - if (err) { - /* ENOENT may be returned in two cases: - * 1) no directory entry for "filename" - * 2) "filename" is a dangling symbolic link - * - * ADIO_FileSysType_parentdir tries to deal with both cases. - */ - if (errno == ENOENT) { - char *dir; - ADIO_FileSysType_parentdir(filename, &dir); - err = statvfs(dir, &vfsbuf); - - ADIOI_Free(dir); - } - else { - *error_code = ADIOI_Err_create_code(myname, filename, errno); - if(*error_code != MPI_SUCCESS) return; - } - } - - /* --BEGIN ERROR HANDLING-- */ - if (err) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - return; - } - /* --END ERROR HANDLING-- */ - - /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */ - if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) { - *fstype = ADIO_NFS; - return; - } - if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) { - *fstype = ADIO_XFS; - return; - } - -# ifdef ROMIO_UFS - /* if UFS support is enabled, default to that */ - *fstype = ADIO_UFS; - return; -# endif - - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - /* --END ERROR HANDLING-- */ -#endif /* STATVFS APPROACH */ - -#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) - /* common automagic fs-detection logic for any modern POSX-compliant - * environment */ - retry_cnt = 0; - do { - err = statfs(filename, &fsbuf); - } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); - - if (err) { - if(errno == ENOENT) { - char *dir; - ADIO_FileSysType_parentdir(filename, &dir); - err = statfs(dir, &fsbuf); - ADIOI_Free(dir); - } - else { - *error_code = ADIOI_Err_create_code(myname, filename, errno); - if(*error_code != MPI_SUCCESS) return; - } - } - - /* --BEGIN ERROR HANDLING-- */ - if (err) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - return; - } - /* --END ERROR HANDLING-- */ - -# ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME - /* uncommon: maybe only on Darwin ? */ - if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) { - *fstype = ADIO_NFS; - return; - } -# endif - - -#ifdef ROMIO_GPFS - if (fsbuf.f_type == GPFS_SUPER_MAGIC) { - *fstype = ADIO_GPFS; - return; - } -#endif - - /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/ -# ifdef NFS_SUPER_MAGIC - if (fsbuf.f_type == NFS_SUPER_MAGIC) { - *fstype = ADIO_NFS; - return; - } -# endif - -#ifdef ROMIO_LUSTRE -# ifndef LL_SUPER_MAGIC -# define LL_SUPER_MAGIC 0x0BD00BD0 -# endif - if (fsbuf.f_type == LL_SUPER_MAGIC) { - *fstype = ADIO_LUSTRE; - return; - } -#endif - -# ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC - if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) { - *fstype = ADIO_PANFS; - return; - } -# endif - -# ifdef MOUNT_NFS - if (fsbuf.f_type == MOUNT_NFS) { - *fstype = ADIO_NFS; - return; - } -# endif - -# ifdef MOUNT_PFS - if (fsbuf.f_type == MOUNT_PFS) { - *fstype = ADIO_PFS; - return; - } -# endif - -# ifdef PVFS_SUPER_MAGIC - if (fsbuf.f_type == PVFS_SUPER_MAGIC) { - *fstype = ADIO_PVFS; - return; - } -# endif - -# ifdef PVFS2_SUPER_MAGIC - if (fsbuf.f_type == PVFS2_SUPER_MAGIC) { - *fstype = ADIO_PVFS2; - return; - } -# endif - -# ifdef XFS_SUPER_MAGIC - if (fsbuf.f_type == XFS_SUPER_MAGIC) { - *fstype = ADIO_XFS; - return; - } -# endif - -# ifdef ROMIO_UFS - /* if UFS support is enabled, default to that */ - *fstype = ADIO_UFS; - return; -# endif - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - /* --END ERROR HANDLING-- */ -#endif /* STATFS APPROACH */ - -#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE - /* rare: maybe old NEC SX or SGI IRIX machines */ - retry_cnt = 0; - do { - err = stat(filename, &sbuf); - } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); - - if (err) { - if(errno == ENOENT) { - char *dir; - ADIO_FileSysType_parentdir(filename, &dir); - err = stat(dir, &sbuf); - ADIOI_Free(dir); - } - else{ - *error_code = ADIOI_Err_create_code(myname, filename, errno); - if(*error_code != MPI_SUCCESS) return; - } - } - - if (err) { - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - /* --END ERROR HANDLING-- */ - return; - } - else { - if (!strcmp(sbuf.st_fstype, "nfs")) *fstype = ADIO_NFS; - else *fstype = ADIO_SFS; /* assuming SX4 for now */ - } -#endif /* STAT APPROACH */ - -#ifdef ROMIO_NTFS - ADIOI_UNREFERENCED_ARG(filename); - ADIOI_UNREFERENCED_ARG(error_code); - *fstype = ADIO_NTFS; /* only supported FS on Windows */ -#elif defined(ROMIO_NFS) - *fstype = ADIO_NFS; -#elif defined(ROMIO_UFS) - *fstype = ADIO_UFS; -#else - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - /* --END ERROR HANDLING-- */ -#endif -} - -/* all proceeses opening, creating, or deleting a file end up invoking several - * stat system calls (unless a fs prefix is given). Cary out this file system - * detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes */ - -static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, const char *filename, int * file_system, int * error_code) -{ - int rank; - int buf[2]; - MPI_Comm_rank(comm, &rank); - - if (rank == 0) { - ADIO_FileSysType_fncall(filename, file_system, error_code); - buf[0] = *file_system; - buf[1] = *error_code; - } - MPI_Bcast(buf, 2, MPI_INT, 0, comm); - *file_system = buf[0]; - *error_code = buf[1]; -} - - - -/* - ADIO_FileSysType_prefix - determines file system type for a file using - a prefix on the file name. upper layer should have already determined - that a prefix is present. - -Input Parameters: -. filename - path to file, including prefix (xxx:) - -Output Parameters: -. fstype - pointer to integer in which to store file system type (ADIO_XXX) -. error_code - pointer to integer in which to store error code - - Returns MPI_SUCCESS in error_code on success. Filename not having a prefix - is considered an error. Except for on Windows systems where the default is NTFS. - - */ -static void ADIO_FileSysType_prefix(const char *filename, int *fstype, int *error_code) -{ - static char myname[] = "ADIO_RESOLVEFILETYPE_PREFIX"; - *error_code = MPI_SUCCESS; - - if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) { - *fstype = ADIO_PFS; - } - else if (!strncmp(filename, "piofs:", 6) || !strncmp(filename, "PIOFS:", 6)) { - *fstype = ADIO_PIOFS; - } - else if (!strncmp(filename, "ufs:", 4) || !strncmp(filename, "UFS:", 4)) { - *fstype = ADIO_UFS; - } - else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) { - *fstype = ADIO_NFS; - } - else if (!strncmp(filename, "panfs:", 6) || !strncmp(filename, "PANFS:", 6)) { - *fstype = ADIO_PANFS; - } - else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) { - *fstype = ADIO_HFS; - } - else if (!strncmp(filename, "xfs:", 4) || !strncmp(filename, "XFS:", 4)) { - *fstype = ADIO_XFS; - } - else if (!strncmp(filename, "sfs:", 4) || !strncmp(filename, "SFS:", 4)) { - *fstype = ADIO_SFS; - } - else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) { - *fstype = ADIO_PVFS; - } - else if (!strncmp(filename, "pvfs2:", 6)||!strncmp(filename, "PVFS2:", 6)) { - *fstype = ADIO_PVFS2; - } - else if (!strncmp(filename, "zoidfs:", 7)|| - !strncmp(filename, "ZOIDFS:", 7)) { - *fstype = ADIO_ZOIDFS; - } - else if (!strncmp(filename, "testfs:", 7) - || !strncmp(filename, "TESTFS:", 7)) - { - *fstype = ADIO_TESTFS; - } - else if (!strncmp(filename, "ftp:", 4) - || !strncmp(filename, "gsiftp:", 7)) - { - *fstype = ADIO_GRIDFTP; - } - else if (!strncmp(filename, "lustre:", 7) - || !strncmp(filename, "LUSTRE:", 7)) - { - *fstype = ADIO_LUSTRE; - } - else if (!strncmp(filename, "gpfs:", 5) || !strncmp(filename, "GPFS:", 5)) { - *fstype = ADIO_GPFS; - } - else { -#ifdef ROMIO_NTFS - *fstype = ADIO_NTFS; -#else - *fstype = 0; - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filename", "**filename %s", filename); - /* --END ERROR HANDLING-- */ -#endif - } -} - -/*@ - ADIO_ResolveFileType - determines file system type and operations from - file name string; this is a collective call - -Input Parameters: -. comm - communicator across which collective open is performed -. filename - name of file (string) - -Output Parameters: -. fstype - (pointer to) int holding file system type -. ops - (address of) pointer to table of valid file operations -. error_code - (pointer to) int holding error code - -Notes: -This code used to be in MPI_File_open(), but it has been moved into here in -order to clean things up. The goal is to separate all this "did we compile -for this fs type" code from the MPI layer and also to introduce the ADIOI_Fns -tables in a reasonable way. -- Rob, 06/06/2001 -@*/ -void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype, - ADIOI_Fns **ops, int *error_code) -{ - int myerrcode, file_system, min_code, max_code; - char *tmp; - static char myname[] = "ADIO_RESOLVEFILETYPE"; - char * p; - - file_system = -1; - if (filename == NULL) { - *error_code = ADIOI_Err_create_code(myname, filename, ENOENT); - return; - } - tmp = strchr(filename, ':'); - if (!tmp) { - int have_nfs_enabled=0; - *error_code = MPI_SUCCESS; - /* no prefix; use system-dependent function call to determine type */ - /* Optimization: we can reduce the 'storm of stats' that result from - * thousands of mpi processes determinig file type this way. Let us - * have just one process stat the file and broadcast the result to - * everyone else. - * - Note that we will not catch cases like - * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html - * (edit: now http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) - * - * where file systems are not mounted or available on other processes, - * but we'll catch those a few functions later in ADIO_Open - * - Note that if we have NFS enabled, we might have a situation where, - * for example, /home/user/data.out is UFS on one process but NFS on - * others, so we won't perform this optimization if NFS is enabled. - * - Another point: error codes and file system types are broadcast to - * all members of the communicator, so we get to skip the allreduce - * steps*/ - -#ifdef ROMIO_NFS - have_nfs_enabled=1; -#endif - if (!have_nfs_enabled) { - ADIO_FileSysType_fncall_scalable(comm, filename, &file_system, &myerrcode); - if (myerrcode != MPI_SUCCESS) { - *error_code = myerrcode; - return; - } - } else { - ADIO_FileSysType_fncall(filename, &file_system, &myerrcode); - - /* the check for file system type will hang if any process got - * an error in ADIO_FileSysType_fncall. Processes encountering - * an error will return early, before the collective file - * system type check below. This case could happen if a full - * path exists on one node but not on others, and no prefix - * like ufs: was provided. see discussion at - * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html - * (edit: now - * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) - */ - - MPI_Allreduce(&myerrcode, &max_code, 1, MPI_INT, MPI_MAX, comm); - if (max_code != MPI_SUCCESS) { - *error_code = max_code; - return; - } - /* ensure everyone came up with the same file system type */ - MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, - MPI_MIN, comm); - if (min_code == ADIO_NFS) file_system = ADIO_NFS; - } - } - else { - /* prefix specified; just match via prefix and assume everyone got - * the same thing. - * - * perhaps we should have this code go through the allreduce as well? - */ - ADIO_FileSysType_prefix(filename, &file_system, &myerrcode); - if (myerrcode != MPI_SUCCESS) { - *error_code = myerrcode; - return; - } - } - - /* lastly, there may be situations where one cannot override the file - * system detection with a prefix -- maybe the file name is passed to both - * posix and MPI-IO routines, or maybe the file name is hard-coded into an - * application. - * Assumes all processes set the same environment varialble. - * Values: the same prefix you would stick on a file path. e.g. pvfs2: -- - * including the colon! */ - p = getenv("ROMIO_FSTYPE_FORCE"); - if (p != NULL) { - ADIO_FileSysType_prefix(p, &file_system, &myerrcode); - if (myerrcode != MPI_SUCCESS) { - *error_code = myerrcode; - return; - } - } - - /* verify that we support this file system type and set ops pointer */ - if (file_system == ADIO_PFS) { -#ifndef ROMIO_PFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_PFS_operations; -#endif - } - if (file_system == ADIO_PIOFS) { -#ifndef ROMIO_PIOFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_PIOFS_operations; -#endif - } - if (file_system == ADIO_UFS) { -#ifndef ROMIO_UFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_UFS_operations; -#endif - } - if (file_system == ADIO_NFS) { -#ifndef ROMIO_NFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_NFS_operations; -#endif - } - if (file_system == ADIO_PANFS) { -#ifndef ROMIO_PANFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_PANFS_operations; -#endif - } - if (file_system == ADIO_HFS) { -#ifndef ROMIO_HFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_HFS_operations; -#endif - } - if (file_system == ADIO_XFS) { -#ifndef ROMIO_XFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_XFS_operations; -#endif - } - if (file_system == ADIO_SFS) { -#ifndef ROMIO_SFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_SFS_operations; -#endif - } - if (file_system == ADIO_PVFS) { -#ifndef ROMIO_PVFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_PVFS_operations; -#endif - } - if (file_system == ADIO_PVFS2) { -#ifndef ROMIO_PVFS2 - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_PVFS2_operations; -#endif - } - if (file_system == ADIO_NTFS) { -#ifndef ROMIO_NTFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_NTFS_operations; -#endif - } - if (file_system == ADIO_TESTFS) { -#ifndef ROMIO_TESTFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_TESTFS_operations; -#endif - } - - if (file_system == ADIO_GPFS) { -#ifndef ROMIO_GPFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_GPFS_operations; -#endif - } - - if (file_system == ADIO_GRIDFTP) { -#ifndef ROMIO_GRIDFTP - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_GRIDFTP_operations; -#endif - } - if (file_system == ADIO_LUSTRE) { -#ifndef ROMIO_LUSTRE - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_LUSTRE_operations; -#endif - } - if (file_system == ADIO_ZOIDFS) { -#ifndef ROMIO_ZOIDFS - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iofstypeunsupported", 0); - return; -#else - *ops = &ADIO_ZOIDFS_operations; -#endif - } - *error_code = MPI_SUCCESS; - *fstype = file_system; - return; -} -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/common/ad_get_sh_fp.c b/3rd-party/romio321/adio/common/ad_get_sh_fp.c deleted file mode 100644 index 12133277903156463d2bebed66a9a3c7d152f57b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_get_sh_fp.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* returns the current location of the shared_fp in terms of the - no. of etypes relative to the current view, and also increments the - shared_fp by the number of etypes to be accessed (incr) in the read - or write following this function. */ - -void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp, - int *error_code); - -void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp, - int *error_code) -{ - ADIO_Status status; - ADIO_Offset new_fp; - MPI_Comm dupcommself; - - /* Set the shared_fp in case this comes from an uninitialized stack variable - The read routines will not read into the address of this variable if the file - size of a shared pointer is 0, and if incr is always zero, this value will remain - uninitialized. Initialize it here to prevent incorrect values - */ - *shared_fp = 0; - -#ifdef ROMIO_NFS - if (fd->file_system == ADIO_NFS) { - ADIOI_NFS_Get_shared_fp(fd, incr, shared_fp, error_code); - return; - } -#endif - - if (fd->shared_fp_fd == ADIO_FILE_NULL) { - MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); - fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, - fd->shared_fp_fname, - fd->file_system, - fd->fns, - ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, - MPI_INFO_NULL, - ADIO_PERM_NULL, error_code); - if (*error_code != MPI_SUCCESS) return; - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), - MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); - /* if the file is empty, the above function may return error - (reading beyond end of file). In that case, shared_fp = 0, - set above, is the correct value. */ - } - else { - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), - MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); - if (*error_code != MPI_SUCCESS) { - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - return; - } - } - - if (incr == 0) {goto done;} - - new_fp = *shared_fp + incr; - - ADIO_WriteContig(fd->shared_fp_fd, &new_fp, sizeof(ADIO_Offset), - MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); -done: - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); -} diff --git a/3rd-party/romio321/adio/common/ad_hints.c b/3rd-party/romio321/adio/common/ad_hints.c deleted file mode 100644 index 6e89e76a3f5157f55014131bfc95fe7842ed4798..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_hints.c +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "hint_fns.h" - -void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ -/* if fd->info is null, create a new info object. - Initialize fd->info to default values. - Initialize fd->hints to default values. - Examine the info object passed by the user. If it contains values that - ROMIO understands, override the default. */ - - MPI_Info info; - char *value; - int flag, nprocs=0, len; - int ok_to_override_cb_nodes=0; - static char myname[] = "ADIOI_GEN_SETINFO"; - - - /* if we've already set up default hints and the user has not asked us to - * process any hints (MPI_INFO_NULL), then we can short-circuit hint - * processing */ - if (fd->hints->initialized && fd->info == MPI_INFO_NULL) { - *error_code = MPI_SUCCESS; - return; - } - - if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); - info = fd->info; - - MPI_Comm_size(fd->comm, &nprocs); - - /* Note that fd->hints is allocated at file open time; thus it is - * not necessary to allocate it, or check for allocation, here. - */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if (value == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return; - } - - /* initialize info and hints to default values if they haven't been - * previously initialized - */ - if (!fd->hints->initialized) { - - /* buffer size for collective I/O */ - ADIOI_Info_set(info, "cb_buffer_size", ADIOI_CB_BUFFER_SIZE_DFLT); - fd->hints->cb_buffer_size = atoi(ADIOI_CB_BUFFER_SIZE_DFLT); - - /* default is to let romio automatically decide when to use - * collective buffering - */ - ADIOI_Info_set(info, "romio_cb_read", "automatic"); - fd->hints->cb_read = ADIOI_HINT_AUTO; - ADIOI_Info_set(info, "romio_cb_write", "automatic"); - fd->hints->cb_write = ADIOI_HINT_AUTO; - - fd->hints->cb_config_list = NULL; - - /* number of processes that perform I/O in collective I/O */ - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs); - ADIOI_Info_set(info, "cb_nodes", value); - fd->hints->cb_nodes = nprocs; - - /* hint indicating that no indep. I/O will be performed on this file */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = 0; - - /* hint instructing the use of persistent file realms */ - ADIOI_Info_set(info, "romio_cb_pfr", "disable"); - fd->hints->cb_pfr = ADIOI_HINT_DISABLE; - - /* hint guiding the assignment of persistent file realms */ - ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); - fd->hints->cb_fr_type = ADIOI_FR_AAR; - - /* hint to align file realms with a certain byte value */ - ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); - fd->hints->cb_fr_alignment = 1; - - /* hint to set a threshold percentage for a datatype's size/extent at - * which data sieving should be done in collective I/O */ - ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); - fd->hints->cb_ds_threshold = 0; - - /* hint to switch between point-to-point or all-to-all for two-phase */ - ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); - fd->hints->cb_alltoall = ADIOI_HINT_AUTO; - - /* deferred_open derived from no_indep_rw and cb_{read,write} */ - fd->hints->deferred_open = 0; - - /* buffer size for data sieving in independent reads */ - ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_IND_RD_BUFFER_SIZE_DFLT); - fd->hints->ind_rd_buffer_size = atoi(ADIOI_IND_RD_BUFFER_SIZE_DFLT); - - /* buffer size for data sieving in independent writes */ - ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_IND_WR_BUFFER_SIZE_DFLT); - fd->hints->ind_wr_buffer_size = atoi(ADIOI_IND_WR_BUFFER_SIZE_DFLT); - - /* default is to let romio automatically decide when to use data - * sieving - */ - ADIOI_Info_set(info, "romio_ds_read", "automatic"); - fd->hints->ds_read = ADIOI_HINT_AUTO; - ADIOI_Info_set(info, "romio_ds_write", "automatic"); - fd->hints->ds_write = ADIOI_HINT_AUTO; - - /* still to do: tune this a bit for a variety of file systems. there's - * no good default value so just leave it unset */ - fd->hints->min_fdomain_size = 0; - fd->hints->striping_unit = 0; - - fd->hints->initialized = 1; - - /* ADIO_Open sets up collective buffering arrays. If we are in this - * path from say set_file_view, then we've don't want to adjust the - * array: we'll get a segfault during collective i/o. We only want to - * look at the users cb_nodes if it's open time */ - ok_to_override_cb_nodes = 1; - - } - - /* add in user's info if supplied */ - if (users_info != MPI_INFO_NULL) { - ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", - &(fd->hints->cb_buffer_size), myname, error_code); - - /* aligning file realms to certain sizes (e.g. stripe sizes) - * may benefit I/O performance */ - ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_alignment", - &(fd->hints->cb_fr_alignment), myname, error_code); - - /* for collective I/O, try to be smarter about when to do data sieving - * using a specific threshold for the datatype size/extent - * (percentage 0-100%) */ - ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_ds_threshold", - &(fd->hints->cb_ds_threshold), myname, error_code); - - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_alltoall", - &(fd->hints->cb_alltoall), myname, error_code); - - /* new hints for enabling/disabling coll. buffering on - * reads/writes - */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read", - &(fd->hints->cb_read), myname, error_code); - if (fd->hints->cb_read == ADIOI_HINT_DISABLE) { - /* romio_cb_read overrides no_indep_rw */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; - } - - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write", - &(fd->hints->cb_write), myname, error_code); - if (fd->hints->cb_write == ADIOI_HINT_DISABLE) { - /* romio_cb_write overrides no_indep_rw */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; - } - - /* enable/disable persistent file realms for collective I/O */ - /* may want to check for no_indep_rdwr hint as well */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_pfr", - &(fd->hints->cb_pfr), myname, error_code); - - - /* file realm assignment types ADIOI_FR_AAR(0), - ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify - a regular fr size in bytes. probably not the best way... */ - ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_type", - &(fd->hints->cb_fr_type), myname, error_code); - - /* Has the user indicated all I/O will be done collectively? */ - ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw", - &(fd->hints->no_indep_rw), myname, error_code); - if (fd->hints->no_indep_rw == 1) { - /* if 'no_indep_rw' set, also hint that we will do - * collective buffering: if we aren't doing independent io, - * then we have to do collective */ - ADIOI_Info_set(info, "romio_cb_write", "enable"); - ADIOI_Info_set(info, "romio_cb_read", "enable"); - fd->hints->cb_read = 1; - fd->hints->cb_write = 1; - } - /* new hints for enabling/disabling data sieving on - * reads/writes - */ - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read", - &(fd->hints->ds_read), myname, error_code); - ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write", - &(fd->hints->ds_write), myname, error_code); - - if (ok_to_override_cb_nodes) { - /* MPI_File_open path sets up some data structrues that don't - * get resized in the MPI_File_set_view path, so ignore - * cb_nodes in the set_view case */ - ADIOI_Info_check_and_install_int(fd, users_info, "cb_nodes", - &(fd->hints->cb_nodes), myname, error_code); - if ((fd->hints->cb_nodes <= 0) || (fd->hints->cb_nodes > nprocs)) { - /* can't ask for more aggregators than mpi processes, though it - * might be interesting to think what such oversubscription - * might mean... someday */ - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs); - ADIOI_Info_set(info, "cb_nodes", value); - fd->hints->cb_nodes = nprocs; - } - } /* if (ok_to_override_cb_nodes) */ - - ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size", - &(fd->hints->ind_wr_buffer_size), myname, error_code); - ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size", - &(fd->hints->ind_rd_buffer_size), myname, error_code); - - if (fd->hints->cb_config_list == NULL) { - /* only set cb_config_list if it isn't already set. Note that - * since we set it below, this ensures that the cb_config_list hint - * will be set at file open time either by the user or to the - * default */ - /* if it has been set already, we ignore it the second time. - * otherwise we would get an error if someone used the same info - * value with a cb_config_list value in it in a couple of calls, - * which would be irritating. */ - ADIOI_Info_check_and_install_str(fd, users_info, "cb_config_list", - &(fd->hints->cb_config_list), myname, error_code); - - } - ADIOI_Info_check_and_install_int(fd, users_info, "romio_min_fdomain_size", - &(fd->hints->min_fdomain_size), myname, error_code); - - /* Now we use striping unit in common code so we should - process hints for it. */ - ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", - &(fd->hints->striping_unit), myname, error_code); - } - - /* Begin hint post-processig: some hints take precidence over or conflict - * with others, or aren't supported by some file systems */ - - /* handle cb_config_list default value here; avoids an extra - * free/alloc and insures it is always set - */ - if (fd->hints->cb_config_list == NULL) { - ADIOI_Info_set(info, "cb_config_list", ADIOI_CB_CONFIG_LIST_DFLT); - len = (strlen(ADIOI_CB_CONFIG_LIST_DFLT)+1) * sizeof(char); - fd->hints->cb_config_list = ADIOI_Malloc(len); - if (fd->hints->cb_config_list == NULL) { - ADIOI_Free(value); - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return; - } - ADIOI_Strncpy(fd->hints->cb_config_list, ADIOI_CB_CONFIG_LIST_DFLT, len); - } - /* deferred_open won't be set by callers, but if the user doesn't - * explicitly disable collecitve buffering (two-phase) and does hint that - * io w/o independent io is going on, we'll set this internal hint as a - * convenience */ - if ( ( (fd->hints->cb_read != ADIOI_HINT_DISABLE) \ - && (fd->hints->cb_write != ADIOI_HINT_DISABLE)\ - && fd->hints->no_indep_rw ) ) { - fd->hints->deferred_open = 1; - } else { - /* setting romio_no_indep_rw enable and romio_cb_{read,write} - * disable at the same time doesn't make sense. honor - * romio_cb_{read,write} and force the no_indep_rw hint to - * 'disable' */ - ADIOI_Info_set(info, "romio_no_indep_rw", "false"); - fd->hints->no_indep_rw = 0; - fd->hints->deferred_open = 0; - } - - if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { - /* disable data sieving for fs that do not - support file locking */ - ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - /* get rid of this value if it is set */ - ADIOI_Info_delete(info, "ind_wr_buffer_size"); - } - /* note: leave ind_wr_buffer_size alone; used for other cases - * as well. -- Rob Ross, 04/22/2003 - */ - ADIOI_Info_set(info, "romio_ds_write", "disable"); - fd->hints->ds_write = ADIOI_HINT_DISABLE; - } - - ADIOI_Free(value); - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_init.c b/3rd-party/romio321/adio/common/ad_init.c deleted file mode 100644 index 88e75a5251f2196411be279b0bebf7329bc060b8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_init.c +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -ADIOI_Flatlist_node *ADIOI_Flatlist = NULL; -ADIOI_Datarep *ADIOI_Datarep_head = NULL; - /* list of datareps registered by the user */ - -/* for f2c and c2f conversion */ -ADIO_File *ADIOI_Ftable = NULL; -int ADIOI_Ftable_ptr = 0, ADIOI_Ftable_max = 0; -ADIO_Request *ADIOI_Reqtable = NULL; -int ADIOI_Reqtable_ptr = 0, ADIOI_Reqtable_max = 0; -#ifndef HAVE_MPI_INFO -MPI_Info *MPIR_Infotable = NULL; -int MPIR_Infotable_ptr = 0, MPIR_Infotable_max = 0; -#endif - -MPI_Info ADIOI_syshints = MPI_INFO_NULL; - -MPI_Op ADIO_same_amode=MPI_OP_NULL; - -#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) -int ADIOI_Direct_read = 0, ADIOI_Direct_write = 0; -#endif - -int ADIO_Init_keyval=MPI_KEYVAL_INVALID; - -MPI_Errhandler ADIOI_DFLT_ERR_HANDLER = MPI_ERRORS_RETURN; - - -static void my_consensus(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype) -{ - int i, *in, *inout; - in = (int*)invec; - inout = (int*)inoutvec; - - for (i=0; i< *len; i++) { - if (in[i] != inout[i]) - inout[i] = ADIO_AMODE_NOMATCH; - } - return; -} - -void ADIO_Init(int *argc, char ***argv, int *error_code) -{ -#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) - char *c; -#endif - - ADIOI_UNREFERENCED_ARG(argc); - ADIOI_UNREFERENCED_ARG(argv); - -#ifdef ROMIO_INSIDE_MPICH - MPIR_Ext_init(); -#endif - -/* initialize the linked list containing flattened datatypes */ - ADIOI_Flatlist = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); - ADIOI_Flatlist->type = MPI_DATATYPE_NULL; - ADIOI_Flatlist->next = NULL; - ADIOI_Flatlist->blocklens = NULL; - ADIOI_Flatlist->indices = NULL; - -#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) - c = getenv("MPIO_DIRECT_READ"); - if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) - ADIOI_Direct_read = 1; - else ADIOI_Direct_read = 0; - c = getenv("MPIO_DIRECT_WRITE"); - if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) - ADIOI_Direct_write = 1; - else ADIOI_Direct_write = 0; -#endif - - -#ifdef ADIOI_MPE_LOGGING - { - MPE_Log_get_state_eventIDs( &ADIOI_MPE_open_a, &ADIOI_MPE_open_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_read_a, &ADIOI_MPE_read_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_write_a, &ADIOI_MPE_write_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_lseek_a, &ADIOI_MPE_lseek_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_close_a, &ADIOI_MPE_close_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_writelock_a, - &ADIOI_MPE_writelock_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_readlock_a, - &ADIOI_MPE_readlock_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_unlock_a, &ADIOI_MPE_unlock_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_postwrite_a, - &ADIOI_MPE_postwrite_b ); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_openinternal_a, - &ADIOI_MPE_openinternal_b); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_stat_a, &ADIOI_MPE_stat_b); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_iread_a, &ADIOI_MPE_iread_b); - MPE_Log_get_state_eventIDs( &ADIOI_MPE_iwrite_a, &ADIOI_MPE_iwrite_b); - - int comm_world_rank; - MPI_Comm_rank( MPI_COMM_WORLD, &comm_world_rank ); - - if ( comm_world_rank == 0 ) { - MPE_Describe_state( ADIOI_MPE_open_a, ADIOI_MPE_open_b, - "open", "orange" ); - MPE_Describe_state( ADIOI_MPE_read_a, ADIOI_MPE_read_b, - "read", "green" ); - MPE_Describe_state( ADIOI_MPE_write_a, ADIOI_MPE_write_b, - "write", "blue" ); - MPE_Describe_state( ADIOI_MPE_lseek_a, ADIOI_MPE_lseek_b, - "lseek", "red" ); - MPE_Describe_state( ADIOI_MPE_close_a, ADIOI_MPE_close_b, - "close", "grey" ); - MPE_Describe_state( ADIOI_MPE_writelock_a, ADIOI_MPE_writelock_b, - "writelock", "plum" ); - MPE_Describe_state( ADIOI_MPE_readlock_a, ADIOI_MPE_readlock_b, - "readlock", "magenta" ); - MPE_Describe_state( ADIOI_MPE_unlock_a, ADIOI_MPE_unlock_b, - "unlock", "purple" ); - MPE_Describe_state( ADIOI_MPE_postwrite_a, ADIOI_MPE_postwrite_b, - "postwrite", "ivory" ); - MPE_Describe_state( ADIOI_MPE_openinternal_a, ADIOI_MPE_openinternal_b, "open system", "blue"); - MPE_Describe_state( ADIOI_MPE_stat_a, ADIOI_MPE_stat_b, "stat", "purple"); - MPE_Describe_state( ADIOI_MPE_iread_a, ADIOI_MPE_iread_b, "iread", "purple"); - MPE_Describe_state( ADIOI_MPE_iwrite_a, ADIOI_MPE_iwrite_b, "iwrite", "purple"); - } - } -#endif - - *error_code = MPI_SUCCESS; - MPI_Op_create(my_consensus, 1, &ADIO_same_amode); -} diff --git a/3rd-party/romio321/adio/common/ad_io_coll.c b/3rd-party/romio321/adio/common/ad_io_coll.c deleted file mode 100644 index 273c8a551b2365ae55a928e53278697fa946d20a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_io_coll.c +++ /dev/null @@ -1,1135 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "assert.h" -#include "adio.h" -#include "adio_extern.h" -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -/* #define ALLTOALL */ - -/* #define DEBUG */ -/* #define DEBUG2 */ /* print buffers */ - -#define USE_PRE_REQ - -static void Exch_data_amounts (ADIO_File fd, int nprocs, - ADIO_Offset *client_comm_sz_arr, - ADIO_Offset *agg_comm_sz_arr, - int *client_alltoallw_counts, - int *agg_alltoallw_counts, - int *aggregators_done); -static void post_aggregator_comm (MPI_Comm comm, int rw_type, int nproc, - void *cb_buf, - MPI_Datatype *client_comm_dtype_arr, - ADIO_Offset *client_comm_sz_arr, - MPI_Request **requests, - int *aggregators_client_count_p); - -static void post_client_comm (ADIO_File fd, int rw_type, - int agg_rank, void *buf, - MPI_Datatype agg_comm_dtype, - int agg_alltoallw_count, - MPI_Request *request); - -/* Avery Ching and Kenin Columa's reworked two-phase algorithm. Key features - * - persistent file domains - * - an option to use alltoall instead of point-to-point - */ -void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - ADIO_Offset min_st_offset=0, max_end_offset=0; - ADIO_Offset st_end_offset[2]; - ADIO_Offset *all_st_end_offsets = NULL; - int filetype_is_contig, buftype_is_contig, is_contig; - ADIO_Offset off; - int interleave_count = 0, i, nprocs, myrank, nprocs_for_coll; - int cb_enable; - ADIO_Offset bufsize; - MPI_Aint extent, lb; -#ifdef DEBUG2 - MPI_Aint bufextent; -#endif - MPI_Count size; - int agg_rank; - - ADIO_Offset agg_disp; /* aggregated file offset */ - MPI_Datatype agg_dtype; /* aggregated file datatype */ - - int aggregators_done = 0; - ADIO_Offset buffered_io_size = 0; - - int *alltoallw_disps; - - int *alltoallw_counts; - int *client_alltoallw_counts; - int *agg_alltoallw_counts; - - char *cb_buf = NULL; - - MPI_Datatype *client_comm_dtype_arr; /* aggregator perspective */ - MPI_Datatype *agg_comm_dtype_arr; /* client perspective */ - ADIO_Offset *client_comm_sz_arr; /* aggregator perspective */ - ADIO_Offset *agg_comm_sz_arr; /* client perspective */ - - /* file views for each client and aggregator */ - view_state *client_file_view_state_arr = NULL; - view_state *agg_file_view_state_arr = NULL; - /* mem views for local process */ - view_state *my_mem_view_state_arr = NULL; - - MPI_Status *agg_comm_statuses = NULL; - MPI_Request *agg_comm_requests = NULL; - MPI_Status *client_comm_statuses = NULL; - MPI_Request *client_comm_requests = NULL; - int aggs_client_count = 0; - int clients_agg_count = 0; - - MPI_Comm_size (fd->comm, &nprocs); - MPI_Comm_rank (fd->comm, &myrank); -#ifdef DEBUG - fprintf (stderr, "p%d: entering ADIOI_IOStridedColl\n", myrank); -#endif -#ifdef AGGREGATION_PROFILE - if (rdwr == ADIOI_READ) - MPE_Log_event (5010, 0, NULL); - else - MPE_Log_event (5012, 0, NULL); -#endif - - /* I need to check if there are any outstanding nonblocking writes - to the file, which could potentially interfere with the writes - taking place in this collective write call. Since this is not - likely to be common, let me do the simplest thing possible here: - Each process completes all pending nonblocking operations before - completing. */ - - nprocs_for_coll = fd->hints->cb_nodes; - - if (rdwr == ADIOI_READ) - cb_enable = fd->hints->cb_read; - else - cb_enable = fd->hints->cb_write; - - /* only check for interleaving if cb_read isn't disabled */ - if (cb_enable != ADIOI_HINT_DISABLE) { - /* find the starting and ending byte of my I/O access */ - ADIOI_Calc_bounds (fd, count, datatype, file_ptr_type, offset, - &st_end_offset[0], &st_end_offset[1]); - - /* allocate an array of start/end pairs */ - all_st_end_offsets = (ADIO_Offset *) - ADIOI_Malloc (2*nprocs*sizeof(ADIO_Offset)); - MPI_Allgather (st_end_offset, 2, ADIO_OFFSET, all_st_end_offsets, 2, - ADIO_OFFSET, fd->comm); - - min_st_offset = all_st_end_offsets[0]; - max_end_offset = all_st_end_offsets[1]; - - for (i=1; i<nprocs; i++) { - /* are the accesses of different processes interleaved? */ - if ((all_st_end_offsets[i*2] < all_st_end_offsets[i*2-1]) && - (all_st_end_offsets[i*2] <= all_st_end_offsets[i*2+1])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should - * suffice for the moment. */ - - min_st_offset = ADIOI_MIN(all_st_end_offsets[i*2], - min_st_offset); - max_end_offset = ADIOI_MAX(all_st_end_offsets[i*2+1], - max_end_offset); - } - } - - ADIOI_Datatype_iscontig (datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig (fd->filetype, &filetype_is_contig); - - if ((cb_enable == ADIOI_HINT_DISABLE - || (!interleave_count && (cb_enable == ADIOI_HINT_AUTO))) - && (fd->hints->cb_pfr != ADIOI_HINT_ENABLE)){ - if (cb_enable != ADIOI_HINT_DISABLE) { - ADIOI_Free (all_st_end_offsets); - } - - if (buftype_is_contig && filetype_is_contig) { - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (fd->etype_size) * offset; - if (rdwr == ADIOI_READ) - ADIO_ReadContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, off, status, - error_code); - else - ADIO_WriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, off, status, - error_code); - } - else { - if (rdwr == ADIOI_READ) - ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - else - ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } - } - else { - if (rdwr == ADIOI_READ) - ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - else - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - } - return; - } - - MPI_Type_get_extent(datatype, &lb, &extent); -#ifdef DEBUG2 - bufextent = extent * count; -#endif - MPI_Type_size_x(datatype, &size); - bufsize = size * (MPI_Count)count; - - /* Calculate file realms */ - if ((fd->hints->cb_pfr != ADIOI_HINT_ENABLE) || - (fd->file_realm_types == NULL)) - ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset); - - my_mem_view_state_arr = (view_state *) - ADIOI_Calloc (1, nprocs * sizeof(view_state)); - agg_file_view_state_arr = (view_state *) - ADIOI_Calloc (1, nprocs * sizeof(view_state)); - client_comm_sz_arr = (ADIO_Offset *) - ADIOI_Calloc (1, nprocs * sizeof(ADIO_Offset)); - - if (fd->is_agg) { - client_file_view_state_arr = (view_state *) - ADIOI_Calloc (1, nprocs * sizeof(view_state)); - } - else { - client_file_view_state_arr = NULL; - } - - /* Alltoallw doesn't like a null array even if the counts are - * zero. If you do not include this code, it will fail. */ - client_comm_dtype_arr = (MPI_Datatype *) - ADIOI_Calloc (1, nprocs * sizeof(MPI_Datatype)); - if (!fd->is_agg) - for (i = 0; i < nprocs; i++) - client_comm_dtype_arr[i] = MPI_BYTE; - - ADIOI_Exch_file_views (myrank, nprocs, file_ptr_type, fd, count, - datatype, offset, my_mem_view_state_arr, - agg_file_view_state_arr, - client_file_view_state_arr); - - agg_comm_sz_arr = (ADIO_Offset *) - ADIOI_Calloc (1, nprocs * sizeof(ADIO_Offset)); - agg_comm_dtype_arr = (MPI_Datatype *) - ADIOI_Malloc (nprocs * sizeof(MPI_Datatype)); - if (fd->is_agg) { - ADIOI_Build_agg_reqs (fd, rdwr, nprocs, - client_file_view_state_arr, - client_comm_dtype_arr, - client_comm_sz_arr, - &agg_disp, - &agg_dtype); - buffered_io_size = 0; - for (i=0; i <nprocs; i++) { - if (client_comm_sz_arr[i] > 0) - buffered_io_size += client_comm_sz_arr[i]; - } - } -#ifdef USE_PRE_REQ - else - { - /* Example use of ADIOI_Build_client_pre_req. to an - * appropriate section */ - - for (i = 0; i < fd->hints->cb_nodes; i++) - { - agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5040, 0, NULL); -#endif - ADIOI_Build_client_pre_req( - fd, agg_rank, (i+myrank)%fd->hints->cb_nodes, - &(my_mem_view_state_arr[agg_rank]), - &(agg_file_view_state_arr[agg_rank]), - 2*1024*1024, - 64*1024); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5041, 0, NULL); -#endif - } - } -#endif - - - if (fd->is_agg) - cb_buf = (char *) ADIOI_Malloc (fd->hints->cb_buffer_size); - alltoallw_disps = (int *) ADIOI_Calloc (nprocs, sizeof(int)); - alltoallw_counts = client_alltoallw_counts = (int *) - ADIOI_Calloc (2*nprocs, sizeof(int)); - agg_alltoallw_counts = &alltoallw_counts[nprocs]; - - if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { - /* aggregators pre-post all Irecv's for incoming data from clients */ - if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) - post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, - client_comm_dtype_arr, - client_comm_sz_arr, - &agg_comm_requests, - &aggs_client_count); - } - /* Aggregators send amounts for data requested to clients */ - Exch_data_amounts (fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, - client_alltoallw_counts, agg_alltoallw_counts, - &aggregators_done); - -#ifdef DEBUG - fprintf (stderr, "client_alltoallw_counts[ "); - for (i=0; i<nprocs; i++) { - fprintf (stderr, "%d ", client_alltoallw_counts[i]); - } - fprintf (stderr, "]\n"); - fprintf (stderr, "agg_alltoallw_counts[ "); - for (i=0; i<nprocs; i++) { - fprintf (stderr,"%d ", agg_alltoallw_counts[i]); - } - fprintf (stderr, "]\n"); -#endif - - /* keep looping while aggregators still have I/O to do */ - while (aggregators_done != nprocs_for_coll) { - if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { - /* clients should build datatypes for local memory locations - for data communication with aggregators and post - communication as the datatypes are built */ - - client_comm_requests = (MPI_Request *) - ADIOI_Calloc (fd->hints->cb_nodes, sizeof(MPI_Request)); - - for (i = 0; i < fd->hints->cb_nodes; i++) - { - clients_agg_count = 0; - agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; - if (agg_comm_sz_arr[agg_rank] > 0) { - ADIOI_Build_client_req(fd, agg_rank, - (i+myrank)%fd->hints->cb_nodes, - &(my_mem_view_state_arr[agg_rank]), - &(agg_file_view_state_arr[agg_rank]), - agg_comm_sz_arr[agg_rank], - &(agg_comm_dtype_arr[agg_rank])); - -#ifdef AGGREGATION_PROFILE - if (i == 0) - MPE_Log_event (5038, 0, NULL); -#endif - post_client_comm (fd, rdwr, agg_rank, buf, - agg_comm_dtype_arr[agg_rank], - agg_alltoallw_counts[agg_rank], - &client_comm_requests[clients_agg_count]); - clients_agg_count++; - } - } -#ifdef AGGREGATION_PROFILE - if (!clients_agg_count) - MPE_Log_event(5039, 0, NULL); -#endif - - if (rdwr == ADIOI_READ) { - if (fd->is_agg && buffered_io_size) { - ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, - ADIOI_READ, status, error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Type_free (&agg_dtype); - } - -#ifdef DEBUG - fprintf (stderr, "expecting from [agg](disp,size,cnt)="); - for (i=0; i < nprocs; i++) { - MPI_Type_size_x (agg_comm_dtype_arr[i], &size); - fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], - size, agg_alltoallw_counts[i]); - if (i != nprocs - 1) - fprintf(stderr, ","); - } - fprintf (stderr, "]\n"); - if (fd->is_agg) { - fprintf (stderr, "sending to [client](disp,size,cnt)="); - for (i=0; i < nprocs; i++) { - if (fd->is_agg) - MPI_Type_size_x (client_comm_dtype_arr[i], &size); - else - size = -1; - - fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], - size, client_alltoallw_counts[i]); - if (i != nprocs - 1) - fprintf(stderr, ","); - } - fprintf (stderr,"\n"); - } - fflush (NULL); -#endif - /* aggregators post all Isends for outgoing data to clients */ - if (fd->is_agg) - post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, - client_comm_dtype_arr, - client_comm_sz_arr, - &agg_comm_requests, - &aggs_client_count); - - if (fd->is_agg && aggs_client_count) { - agg_comm_statuses = ADIOI_Malloc(aggs_client_count * - sizeof(MPI_Status)); - MPI_Waitall(aggs_client_count, agg_comm_requests, - agg_comm_statuses); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - ADIOI_Free (agg_comm_requests); - ADIOI_Free (agg_comm_statuses); - } - - if (clients_agg_count) { - client_comm_statuses = ADIOI_Malloc(clients_agg_count * - sizeof(MPI_Status)); - MPI_Waitall(clients_agg_count, client_comm_requests, - client_comm_statuses); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5039, 0, NULL); -#endif - ADIOI_Free (client_comm_requests); - ADIOI_Free (client_comm_statuses); - } - -#ifdef DEBUG2 - fprintf (stderr, "buffered_io_size = %lld\n", buffered_io_size); - if (fd->is_agg && buffered_io_size) { - fprintf (stderr, "buf = ["); - for (i=0; i<bufextent; i++) - fprintf (stderr, "%c", ((char *) buf)[i]); - fprintf (stderr, "]\n"); - fprintf (stderr, "cb_buf = ["); - for (i=0; i<buffered_io_size; i++) - fprintf (stderr, "%c", cb_buf[i]); - fprintf (stderr, "]\n"); - fflush (NULL); - } -#endif - } - else { /* Write Case */ -#ifdef DEBUG - fprintf (stderr, "sending to [agg](disp,size,cnt)="); - for (i=0; i < nprocs; i++) { - MPI_Type_size_x (agg_comm_dtype_arr[i], &size); - fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], - size, agg_alltoallw_counts[i]); - if (i != nprocs - 1) - fprintf(stderr, ","); - } - fprintf (stderr, "]\n"); - fprintf (stderr, "expecting from [client](disp,size,cnt)="); - for (i=0; i < nprocs; i++) { - if (fd->is_agg) - MPI_Type_size_x (client_comm_dtype_arr[i], &size); - else - size = -1; - - fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], - size, client_alltoallw_counts[i]); - if (i != nprocs - 1) - fprintf(stderr, ","); - } - fprintf (stderr,"\n"); - fflush (NULL); -#endif -#ifdef DEBUG - fprintf (stderr, "buffered_io_size = %lld\n", buffered_io_size); -#endif - - if (clients_agg_count) { - client_comm_statuses = ADIOI_Malloc(clients_agg_count * - sizeof(MPI_Status)); - MPI_Waitall(clients_agg_count, client_comm_requests, - client_comm_statuses); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5039, 0, NULL); -#endif - ADIOI_Free(client_comm_requests); - ADIOI_Free(client_comm_statuses); - } -#ifdef DEBUG2 - if (bufextent) { - fprintf (stderr, "buf = ["); - for (i=0; i<bufextent; i++) - fprintf (stderr, "%c", ((char *) buf)[i]); - fprintf (stderr, "]\n"); - } -#endif - - if (fd->is_agg && buffered_io_size) { - assert (aggs_client_count != 0); - /* make sure we actually have the data to write out */ - agg_comm_statuses = (MPI_Status *) - ADIOI_Malloc (aggs_client_count*sizeof(MPI_Status)); - - MPI_Waitall (aggs_client_count, agg_comm_requests, - agg_comm_statuses); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - ADIOI_Free (agg_comm_requests); - ADIOI_Free (agg_comm_statuses); -#ifdef DEBUG2 - fprintf (stderr, "cb_buf = ["); - for (i=0; i<buffered_io_size; i++) - fprintf (stderr, "%c", cb_buf[i]); - fprintf (stderr, "]\n"); - fflush (NULL); -#endif - ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, - ADIOI_WRITE, status, error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Type_free (&agg_dtype); - } - - } - } else { - /* Alltoallw version of everything */ - ADIOI_Build_client_reqs(fd, nprocs, my_mem_view_state_arr, - agg_file_view_state_arr, - agg_comm_sz_arr, agg_comm_dtype_arr); - - if (rdwr == ADIOI_READ) { - if (fd->is_agg && buffered_io_size) { - ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, - ADIOI_READ, status, error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Type_free (&agg_dtype); - } - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - MPI_Alltoallw (cb_buf, client_alltoallw_counts, alltoallw_disps, - client_comm_dtype_arr, - buf, agg_alltoallw_counts , alltoallw_disps, - agg_comm_dtype_arr, - fd->comm); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - } - else { /* Write Case */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - MPI_Alltoallw (buf, agg_alltoallw_counts, alltoallw_disps, - agg_comm_dtype_arr, - cb_buf, client_alltoallw_counts, alltoallw_disps, - client_comm_dtype_arr, - fd->comm); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - if (fd->is_agg && buffered_io_size) { - ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, - ADIOI_WRITE, status, error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Type_free (&agg_dtype); - } - } - } - - /* Free (uncommit) datatypes for reuse */ - if (fd->is_agg) { - if (buffered_io_size > 0) { - for (i=0; i<nprocs; i++) { - if (client_comm_sz_arr[i] > 0) - MPI_Type_free (&client_comm_dtype_arr[i]); - } - } - } - for (i=0; i<nprocs; i++) { - if (agg_comm_sz_arr[i] > 0) - MPI_Type_free (&agg_comm_dtype_arr[i]); - } - - /* figure out next set up requests */ - if (fd->is_agg) { - ADIOI_Build_agg_reqs (fd, rdwr, nprocs, - client_file_view_state_arr, - client_comm_dtype_arr, - client_comm_sz_arr, - &agg_disp, - &agg_dtype); - buffered_io_size = 0; - for (i=0; i <nprocs; i++) { - if (client_comm_sz_arr[i] > 0) - buffered_io_size += client_comm_sz_arr[i]; - } - } -#ifdef USE_PRE_REQ - else { - /* Example use of ADIOI_Build_client_pre_req. to an - * appropriate section */ - for (i = 0; i < fd->hints->cb_nodes; i++) - { - agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5040, 0, NULL); -#endif - ADIOI_Build_client_pre_req( - fd, agg_rank, (i+myrank)%fd->hints->cb_nodes, - &(my_mem_view_state_arr[agg_rank]), - &(agg_file_view_state_arr[agg_rank]), - 2*1024*1024, - 64*1024); -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5041, 0, NULL); -#endif - } - } -#endif - - /* aggregators pre-post all Irecv's for incoming data from - * clients. if nothing is needed, agg_comm_requests is not - * allocated */ - if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { - if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) - post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, - client_comm_dtype_arr, - client_comm_sz_arr, - &agg_comm_requests, - &aggs_client_count); - } - - /* Aggregators send amounts for data requested to clients */ - Exch_data_amounts (fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, - client_alltoallw_counts, agg_alltoallw_counts, - &aggregators_done); - - } - - /* Clean up */ - - if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { - /* AAR, FSIZE, and User provided uniform File realms */ - if (1) { - ADIOI_Delete_flattened (fd->file_realm_types[0]); - MPI_Type_free (&fd->file_realm_types[0]); - } - else { - for (i=0; i<fd->hints->cb_nodes; i++) { - ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig); - if (!is_contig) - ADIOI_Delete_flattened(fd->file_realm_types[i]); - MPI_Type_free (&fd->file_realm_types[i]); - } - } - ADIOI_Free (fd->file_realm_types); - ADIOI_Free (fd->file_realm_st_offs); - } - - /* This memtype must be deleted from the ADIOI_Flatlist or else it - * will match incorrectly with other datatypes which use this - * pointer. */ - ADIOI_Delete_flattened(datatype); - ADIOI_Delete_flattened(fd->filetype); - - if (fd->is_agg) { - if (buffered_io_size > 0) - MPI_Type_free (&agg_dtype); - for (i=0; i<nprocs; i++) { - MPI_Type_free (&client_comm_dtype_arr[i]); - ADIOI_Free (client_file_view_state_arr[i].flat_type_p->indices); - ADIOI_Free (client_file_view_state_arr[i].flat_type_p->blocklens); - ADIOI_Free (client_file_view_state_arr[i].flat_type_p); - } - ADIOI_Free (client_file_view_state_arr); - ADIOI_Free (cb_buf); - } - for (i = 0; i<nprocs; i++) - if (agg_comm_sz_arr[i] > 0) - MPI_Type_free (&agg_comm_dtype_arr[i]); - - ADIOI_Free (client_comm_sz_arr); - ADIOI_Free (client_comm_dtype_arr); - ADIOI_Free (my_mem_view_state_arr); - ADIOI_Free (agg_file_view_state_arr); - ADIOI_Free (agg_comm_sz_arr); - ADIOI_Free (agg_comm_dtype_arr); - ADIOI_Free (alltoallw_disps); - ADIOI_Free (alltoallw_counts); - ADIOI_Free (all_st_end_offsets); - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); - /* This is a temporary way of filling in status. The right way is - * to keep track of how much data was actually read and placed in - * buf during collective I/O. */ -#endif - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef AGGREGATION_PROFILE - if (rdwr == ADIOI_READ) - MPE_Log_event (5011, 0, NULL); - else - MPE_Log_event (5013, 0, NULL); -#endif -} - - -/* Some of this code is from the old Calc_my_off_len() function. - * It calculates the 1st and last byte accessed */ -void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype, - int file_ptr_type, ADIO_Offset offset, - ADIO_Offset *st_offset, ADIO_Offset *end_offset) -{ - MPI_Count filetype_size, buftype_size, etype_size; - int sum; - MPI_Aint filetype_extent, lb; - ADIO_Offset total_io; - int filetype_is_contig; - ADIO_Offset i, remainder; - ADIOI_Flatlist_node *flat_file; - - ADIO_Offset st_byte_off, end_byte_off; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5000, 0, NULL); -#endif - - if (!count) { - /* Max signed positive value for ADIO_Offset - * (arch. dependent?). is there a better way? */ - memset (st_offset, 8, sizeof(ADIO_Offset)); - *st_offset = *st_offset / 2; - *end_offset = -1; - return; - } - - ADIOI_Datatype_iscontig (fd->filetype, &filetype_is_contig); - - MPI_Type_size_x (fd->filetype, &filetype_size); - MPI_Type_get_extent (fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x (fd->etype, &etype_size); - MPI_Type_size_x (buftype, &buftype_size); - - total_io = buftype_size * count; - - if (filetype_is_contig) { - if (file_ptr_type == ADIO_INDIVIDUAL) - st_byte_off = fd->fp_ind; - else - st_byte_off = fd->disp + etype_size * offset; - - end_byte_off = st_byte_off + total_io - 1; - } - else { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - /* we need to take care of some weirdness since fd->fp_ind - points at an accessible byte in file. the first accessible - byte in the file is not necessarily the first byte, nor is - it necessarily the first off/len pair in the filetype. */ - if (file_ptr_type == ADIO_INDIVIDUAL) { - st_byte_off = fd->fp_ind; - /* find end byte of I/O (may be in middle of an etype) */ - - /* calculate byte starting point of first filetype */ - end_byte_off = (ADIO_Offset) - ((fd->fp_ind - fd->disp - flat_file->indices[0]) / - filetype_extent) * filetype_extent + fd->disp + - flat_file->indices[0]; - /* number of absolute bytes into first filetype */ - remainder = (fd->fp_ind - fd->disp - flat_file->indices[0]) % - filetype_extent; - if (remainder) { - /* find how many file viewable bytes into first filetype */ - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if ((flat_file->indices[i] - flat_file->indices[0] + - flat_file->blocklens[i]) >= remainder) { - sum -= (flat_file->blocklens[i] - (sum - remainder)); - break; - } - } - total_io += sum; - } - /* byte starting point of last filetype */ - end_byte_off += (total_io - 1) / filetype_size * filetype_extent; - /* number of bytes into last filetype */ - remainder = total_io % filetype_size; - if (!remainder) { - for (i=flat_file->count - 1; i>=0; i--) { - if (flat_file->blocklens[i]) break; - } - assert (i > -1); - end_byte_off += flat_file->indices[i] + - flat_file->blocklens[i] - 1; - end_byte_off -= flat_file->indices[0]; - } - else { - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum >= remainder) { - end_byte_off += flat_file->indices[i] + - flat_file->blocklens[i] - sum + remainder - 1; - break; - } - } - end_byte_off -= flat_file->indices[0]; - } - } - else { - /* find starting byte of I/O (must be aligned with an etype) */ - /* byte starting point of starting filetype */ - st_byte_off = fd->disp + ((offset * etype_size) / filetype_size) * - filetype_extent; - /* number of file viewable bytes into starting filetype */ - remainder = (etype_size * offset) % filetype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum >= remainder) { - if (sum == remainder) - st_byte_off += flat_file->indices[i+1]; - else - st_byte_off += flat_file->indices[i] + - flat_file->blocklens[i] - sum + remainder; - break; - } - } - - /* find end byte of I/O (may be in middle of an etype) */ - /* byte starting point of last filetype */ - end_byte_off = fd->disp + (offset * etype_size + total_io) / - filetype_size * filetype_extent; - /* number of bytes into last filetype */ - remainder = (offset * etype_size + total_io) % filetype_size; - - if (!remainder) { - /* the last non-zero off/len pair */ - for (i=flat_file->count-1; i>=0; i--) { - if (flat_file->blocklens[i]) break; - } - assert (i >= 0); - /* back up a whole filetype, and put back up to the - * last byte of the last non-zero offlen pair */ - /* end_byte_off = (end_byte_off - filetype_extent) + - flat_file->indices[i] + - flat_file->blocklens[i] - 1; */ - /* equivalent of above commented out equation */ - end_byte_off -= filetype_extent - flat_file->indices[i] - - flat_file->blocklens[i] + 1; - } - else { - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum >= remainder) { - end_byte_off += flat_file->indices[i] + - flat_file->blocklens[i] - sum + remainder - 1; - break; - } - } - } - } - } - - *st_offset = st_byte_off; - *end_offset = end_byte_off; -#ifdef DEBUG - printf ("st_offset = %lld\nend_offset = %lld\n", - st_byte_off, end_byte_off); -#endif -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5001, 0, NULL); -#endif -} - -/* wrapper function for ADIO_WriteStrided and ADIO_ReadStrided. Used - * by new 2 phase code to pass an arbitrary file type directly to - * WriteStrided call without affecting existing code. For the new 2 - * phase code, we really only need to set a custom_ftype, and we can - * assume that this uses MPI_BYTE for the etype, and disp is 0 */ -void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Datatype custom_ftype, - int rdwr, ADIO_Status *status, int *error_code) -{ - MPI_Datatype user_filetype; - MPI_Datatype user_etype; - ADIO_Offset user_disp; - int user_ind_wr_buffer_size; - int user_ind_rd_buffer_size; - int f_is_contig, m_is_contig; - int user_ds_read, user_ds_write; - MPI_Aint f_extent, lb; - MPI_Count f_size; - int f_ds_percent; /* size/extent */ - -#ifdef AGGREGATION_PROFILE - if (rdwr == ADIOI_READ) - MPE_Log_event(5006, 0, NULL); - else - MPE_Log_event(5008, 0, NULL); -#endif - MPI_Type_get_extent(custom_ftype, &lb, &f_extent); - MPI_Type_size_x(custom_ftype, &f_size); - f_ds_percent = 100 * f_size / f_extent; - - /* temporarily store file view information */ - user_filetype = fd->filetype; - user_etype = fd->etype; - user_disp = fd->disp; - user_ds_read = fd->hints->ds_read; - user_ds_write = fd->hints->ds_write; - /* temporarily override the independent I/O datasieve buffer size */ - user_ind_wr_buffer_size = fd->hints->ind_wr_buffer_size; - user_ind_rd_buffer_size = fd->hints->ind_rd_buffer_size; - - /* set new values for temporary file view */ - fd->filetype = custom_ftype; - fd->etype = MPI_BYTE; - /* set new values for independent I/O datasieve buffer size */ - fd->hints->ind_wr_buffer_size = fd->hints->cb_buffer_size; - fd->hints->ind_rd_buffer_size = fd->hints->cb_buffer_size; - /* decide whether or not to do datasieving */ -#ifdef DEBUG - printf ("f_ds_percent = %d cb_ds_threshold = %d\n", f_ds_percent, - fd->hints->cb_ds_threshold); -#endif - if (f_ds_percent >= fd->hints->cb_ds_threshold) { - fd->hints->ds_read = ADIOI_HINT_ENABLE; - fd->hints->ds_write = ADIOI_HINT_ENABLE; - } - else { - fd->hints->ds_read = ADIOI_HINT_DISABLE; - fd->hints->ds_write = ADIOI_HINT_DISABLE; - } - - /* flatten the new filetype since the strided calls expect it to - * have been flattened in set file view. in the two phase code, - * the datatype passed down should always be MPI_BYTE, and - * therefore contiguous, but just for completeness sake, we'll - * check the memory datatype anyway */ - ADIOI_Datatype_iscontig(custom_ftype, &f_is_contig); - ADIOI_Datatype_iscontig(datatype, &m_is_contig); - if (!f_is_contig) - ADIOI_Flatten_datatype (custom_ftype); - - /* make appropriate Read/Write calls. Let ROMIO figure out file - * system specific stuff. */ - if (f_is_contig && m_is_contig) { - fd->disp = 0; - if (rdwr == ADIOI_READ) - ADIO_ReadContig(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); - else - ADIO_WriteContig(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); - } - else { - fd->disp = offset; - if (rdwr == ADIOI_READ) - ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, 0, - status, error_code); - else - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, 0, - status, error_code); - } - - /* Delete flattened temporary filetype */ - if (!f_is_contig) - ADIOI_Delete_flattened (custom_ftype); - - /* restore the user specified file view to cover our tracks */ - fd->filetype = user_filetype; - fd->etype = user_etype; - fd->disp = user_disp; - fd->hints->ds_read = user_ds_read; - fd->hints->ds_write = user_ds_write; - fd->hints->ind_wr_buffer_size = user_ind_wr_buffer_size; - fd->hints->ind_rd_buffer_size = user_ind_rd_buffer_size; -#ifdef AGGREGATION_PROFILE - if (rdwr == ADIOI_READ) - MPE_Log_event (5007, 0, NULL); - else - MPE_Log_event (5009, 0, NULL); -#endif -} - -static void Exch_data_amounts (ADIO_File fd, int nprocs, - ADIO_Offset *client_comm_sz_arr, - ADIO_Offset *agg_comm_sz_arr, - int *client_alltoallw_counts, - int *agg_alltoallw_counts, - int *aggregators_done) -{ - int i; - int recv_idx; - MPI_Request *recv_requests; - MPI_Request *send_requests; - MPI_Status status; - MPI_Status *send_statuses; - /* Aggregators send amounts for data requested to clients */ - if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { - MPI_Alltoall (client_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, - agg_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, - fd->comm); - - if (fd->is_agg) { - for (i=0; i<nprocs; i++) - if (client_comm_sz_arr[i] > 0) - client_alltoallw_counts[i] = 1; - else - client_alltoallw_counts[i] = 0; - } - *aggregators_done = 0; - for (i=0; i<nprocs; i++) { - if (agg_comm_sz_arr[i] == -1) - *aggregators_done = *aggregators_done + 1; - else if (agg_comm_sz_arr[i] > 0) - agg_alltoallw_counts[i] = 1; - else - agg_alltoallw_counts[i] = 0; - } - } else { - /* let's see if we can't reduce some communication as well as - * overlap some communication and work */ - - recv_requests = ADIOI_Malloc (fd->hints->cb_nodes * sizeof(MPI_Request)); - /* post all receives - only receive from aggregators */ - for (i = 0; i < fd->hints->cb_nodes; i++) - MPI_Irecv (&agg_comm_sz_arr[fd->hints->ranklist[i]], - sizeof(ADIO_Offset), MPI_BYTE, fd->hints->ranklist[i], - AMT_TAG, fd->comm, &recv_requests[i]); - - /* Barrier is needed here if we're worried about unexpected - * messages being dropped */ - /* MPI_Barrier (fd->comm); */ - send_requests = NULL; - if (fd->is_agg) { - /* only aggregators send data */ - send_requests = ADIOI_Malloc (nprocs * sizeof(MPI_Request)); - - /* post all sends */ - for (i = 0; i < nprocs; i++) { - MPI_Isend (&client_comm_sz_arr[i], sizeof(ADIO_Offset), - MPI_BYTE, i, AMT_TAG, fd->comm, &send_requests[i]); - - if (client_comm_sz_arr[i] > 0) - client_alltoallw_counts[i] = 1; - else - client_alltoallw_counts[i] = 0; - } - } - - *aggregators_done = 0; - for (i=0; i < fd->hints->cb_nodes; i++) { - MPI_Waitany (fd->hints->cb_nodes, recv_requests, &recv_idx, &status); - if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] == -1) - *aggregators_done = *aggregators_done + 1; - else if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] > 0) - agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 1; - else - agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 0; - } - - ADIOI_Free (recv_requests); - if (fd->is_agg) { - /* wait for all sends to complete */ - send_statuses = ADIOI_Malloc (nprocs * sizeof (MPI_Status)); - MPI_Waitall (nprocs, send_requests, send_statuses); - ADIOI_Free (send_requests); - ADIOI_Free (send_statuses); - } - } -} - -static void post_aggregator_comm (MPI_Comm comm, int rw_type, - int nproc, void *cb_buf, - MPI_Datatype *client_comm_dtype_arr, - ADIO_Offset *client_comm_sz_arr, - MPI_Request **requests_p, - int *aggs_client_count_p) -{ - int aggs_client_count = 0; - MPI_Request *requests; - int i; - -#ifdef DEBUG - printf ("posting aggregator communication\n"); -#endif - - for (i=0; i < nproc; i++) - if (client_comm_sz_arr[i] > 0) - aggs_client_count++; -#ifdef DEBUG - printf ("aggregator needs to talk to %d clients\n", - aggs_client_count); -#endif - *aggs_client_count_p = aggs_client_count; - if (aggs_client_count) { - requests = (MPI_Request *) - ADIOI_Malloc (aggs_client_count * sizeof(MPI_Request)); - aggs_client_count = 0; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - for (i=0; i < nproc; i++) { - if (client_comm_sz_arr[i] > 0) { - if (rw_type == ADIOI_WRITE) - MPI_Irecv (cb_buf, 1, client_comm_dtype_arr[i], i, - DATA_TAG, comm, - &requests[aggs_client_count]); - else - MPI_Isend (cb_buf, 1, client_comm_dtype_arr[i], i, - DATA_TAG, comm, - &requests[aggs_client_count]); - - aggs_client_count++; - } - } - *requests_p = requests; - } -} - -static void post_client_comm (ADIO_File fd, int rw_type, - int agg_rank, void *buf, - MPI_Datatype agg_comm_dtype, - int agg_alltoallw_count, - MPI_Request *request) -{ - if (agg_alltoallw_count) { - if (rw_type == ADIOI_READ) - MPI_Irecv (buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, - request); - else - MPI_Isend (buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, - request); - } -} - - - diff --git a/3rd-party/romio321/adio/common/ad_iopen.c b/3rd-party/romio321/adio/common/ad_iopen.c deleted file mode 100644 index 5deeaa2cdeb24118686f133da5f7fabfbec25299..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_iopen.c +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2002 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -void ADIO_ImmediateOpen(ADIO_File fd, int *error_code) -{ - MPI_Comm tmp_comm; - tmp_comm = fd->comm; - /* some file systems might try to be clever inside their open routine. - * e.g. Blue Gene does a stat-and-broadcast */ - fd->comm = MPI_COMM_SELF; - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - fd->is_open = 1; - fd->comm = tmp_comm; - -} diff --git a/3rd-party/romio321/adio/common/ad_iread_fake.c b/3rd-party/romio321/adio/common/ad_iread_fake.c deleted file mode 100644 index b5cbd1da27141435363666d83460f97c5765731e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_iread_fake.c +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "mpiu_greq.h" - -/* Generic implementation of IreadContig calls the blocking ReadContig - * immediately. - */ -void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - ADIO_Status status; - MPI_Count typesize; - MPI_Offset len; - - MPI_Type_size_x(datatype, &typesize); - len = (MPI_Offset)count * (MPI_Offset)typesize; - - /* Call the blocking function. It will create an error code - * if necessary. - */ - ADIOI_Assert(len == (int) len); /* the count is an int parm */ - ADIO_ReadContig(fd, buf, (int)len, MPI_BYTE, file_ptr_type, offset, - &status, error_code); - if (*error_code != MPI_SUCCESS) { - len=0; - } - MPIO_Completed_request_create(&fd, len, error_code, request); -} - - -/* Generic implementation of IreadStrided calls the blocking ReadStrided - * immediately. - */ -void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - ADIO_Status status; - MPI_Count typesize; - MPI_Offset nbytes=0; - - /* Call the blocking function. It will create an error code - * if necessary. - */ - ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - if (*error_code == MPI_SUCCESS) { - MPI_Type_size_x(datatype, &typesize); - nbytes = (MPI_Offset)count*(MPI_Offset)typesize; - } - MPIO_Completed_request_create(&fd, nbytes, error_code, request); -} diff --git a/3rd-party/romio321/adio/common/ad_iwrite.c b/3rd-party/romio321/adio/common/ad_iwrite.c deleted file mode 100644 index e72af5fe2242049291db42bbc4214d9bcb75f061..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_iwrite.c +++ /dev/null @@ -1,344 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_AIO_H -#include <aio.h> -#endif -#ifdef HAVE_SYS_AIO_H -#include <sys/aio.h> -#endif -#include <time.h> - -#include "../../mpi-io/mpioimpl.h" -#include "../../mpi-io/mpioprof.h" -#include "mpiu_greq.h" -/* Workaround for incomplete set of definitions if __REDIRECT is not - defined and large file support is used in aio.h */ -#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) -#define aiocb aiocb64 -#endif - -#ifdef ROMIO_HAVE_WORKING_AIO - -static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; - -/* ADIOI_GEN_IwriteContig - * - * This code handles only the case where ROMIO_HAVE_WORKING_AIO is - * defined. We post an asynchronous I/O operations using the appropriate aio - * routines. Otherwise, the ADIOI_Fns_struct will point to the FAKE - * version. - */ -void ADIOI_GEN_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - MPI_Count len, typesize; - int aio_errno = 0; - static char myname[] = "ADIOI_GEN_IWRITECONTIG"; - - MPI_Type_size_x(datatype, &typesize); - len = count * typesize; - ADIOI_Assert(len == (int)((ADIO_Offset)count * (ADIO_Offset)typesize)); /* the count is an int parm */ - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - /* Cast away the const'ness of 'buf' as ADIOI_GEN_aio is used for - * both read and write calls */ - aio_errno = ADIOI_GEN_aio(fd, (char *) buf, len, offset, 1, request); - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; - - fd->fp_sys_posn = -1; - - /* --BEGIN ERROR HANDLING-- */ - if (aio_errno != 0) { - MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; -} -/* This function is for implementation convenience. - * It takes care of the differences in the interface for nonblocking I/O - * on various Unix machines! If wr==1 write, wr==0 read. - * - * Returns 0 on success, -errno on failure. - */ -int ADIOI_GEN_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, MPI_Request *request) -{ - int err=-1, fd_sys; - - int error_code; - struct aiocb *aiocbp=NULL; - ADIOI_AIO_Request *aio_req=NULL; - MPI_Status status; -#if defined(ROMIO_XFS) - unsigned maxiosz = wr ? fd->hints->fs_hints.xfs.write_chunk_sz : - fd->hints->fs_hints.xfs.read_chunk_sz; -#endif /* ROMIO_XFS */ - - fd_sys = fd->fd_sys; - -#if defined(ROMIO_XFS) - /* Use Direct I/O if desired and properly aligned */ - if (fd->fns == &ADIO_XFS_operations && - ((wr && fd->direct_write) || (!wr && fd->direct_read)) && - !(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz) && - !(len % fd->d_miniosz) && (len >= fd->d_miniosz) && - (len <= maxiosz)) { - fd_sys = fd->fd_direct; - } -#endif /* ROMIO_XFS */ - - aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); - aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); - aiocbp->aio_offset = offset; - aiocbp->aio_buf = buf; - aiocbp->aio_nbytes = len; - -#ifdef HAVE_STRUCT_AIOCB_AIO_WHENCE - aiocbp->aio_whence = SEEK_SET; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_FILDES - aiocbp->aio_fildes = fd_sys; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_SIGEVENT -# ifdef AIO_SIGNOTIFY_NONE - aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; -# endif - aiocbp->aio_sigevent.sigev_signo = 0; -#endif -#ifdef HAVE_STRUCT_AIOCB_AIO_REQPRIO -# ifdef AIO_PRIO_DFL - aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */ -# else - aiocbp->aio_reqprio = 0; -# endif -#endif - -#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES -#ifndef HAVE_STRUCT_AIOCB_AIO_FILDES -#error 'No fildes set for aio structure' -#endif - if (wr) err = aio_write(aiocbp); - else err = aio_read(aiocbp); -#else - /* Broken IBM interface */ - if (wr) err = aio_write(fd_sys, aiocbp); - else err = aio_read(fd_sys, aiocbp); -#endif - - if (err == -1) { - if (errno == EAGAIN || errno == ENOSYS) { - /* exceeded the max. no. of outstanding requests. - or, aio routines are not actually implemented - treat this as a blocking request and return. */ - if (wr) - ADIO_WriteContig(fd, buf, len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); - else - ADIO_ReadContig(fd, buf, len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); - - MPIO_Completed_request_create(&fd, len, &error_code, request); - if (aiocbp != NULL) ADIOI_Free(aiocbp); - if (aio_req != NULL) ADIOI_Free(aio_req); - return 0; - } else { - ADIOI_Free(aio_req); - ADIOI_Free(aiocbp); - return errno; - } - } - aio_req->aiocbp = aiocbp; - if (ADIOI_GEN_greq_class == 0) { - MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, - ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, - ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, - &ADIOI_GEN_greq_class); - } - MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); - memcpy(&(aio_req->req), request, sizeof(MPI_Request)); - return 0; -} -#endif - - -/* Generic implementation of IwriteStrided calls the blocking WriteStrided - * immediately. - */ -void ADIOI_GEN_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) -{ - ADIO_Status status; - MPI_Count typesize; - MPI_Offset nbytes=0; - - /* Call the blocking function. It will create an error code - * if necessary. - */ - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - - if (*error_code == MPI_SUCCESS) { - MPI_Type_size_x(datatype, &typesize); - nbytes = (MPI_Offset)count * (MPI_Offset)typesize; - } - MPIO_Completed_request_create(&fd, nbytes, error_code, request); -} - -#ifdef ROMIO_HAVE_WORKING_AIO -/* generic POSIX aio completion test routine */ -int ADIOI_GEN_aio_poll_fn(void *extra_state, MPI_Status *status) -{ - ADIOI_AIO_Request *aio_req; - int errcode=MPI_SUCCESS; - - aio_req = (ADIOI_AIO_Request *)extra_state; - - /* aio_error returns an ERRNO value */ - errno = aio_error(aio_req->aiocbp); - if (errno == EINPROGRESS) { - /* TODO: need to diddle with status somehow */ - } - else if (errno == ECANCELED) { - /* TODO: unsure how to handle this */ - } else if (errno == 0) { - ssize_t n = aio_return(aio_req->aiocbp); - aio_req->nbytes = n; - errcode = MPI_Grequest_complete(aio_req->req); - /* --BEGIN ERROR HANDLING-- */ - if (errcode != MPI_SUCCESS) { - errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_aio_poll_fn", __LINE__, - MPI_ERR_IO, "**mpi_grequest_complete", - 0); - } - /* --END ERROR HANDLING-- */ - } - return errcode; -} - -/* wait for multiple requests to complete */ -int ADIOI_GEN_aio_wait_fn(int count, void ** array_of_states, - double timeout, MPI_Status *status) -{ - const struct aiocb **cblist; - int err, errcode=MPI_SUCCESS; - int nr_complete=0; - double starttime; - struct timespec aio_timer; - struct timespec *aio_timer_p = NULL; - - ADIOI_AIO_Request **aio_reqlist; - int i; - - aio_reqlist = (ADIOI_AIO_Request **)array_of_states; - - cblist = (const struct aiocb**) ADIOI_Calloc(count, sizeof(struct aiocb*)); - - starttime = MPI_Wtime(); - if (timeout >0) { - aio_timer.tv_sec = (time_t)timeout; - aio_timer.tv_nsec = timeout - aio_timer.tv_sec; - aio_timer_p = &aio_timer; - } - for (i=0; i< count; i++) - { - cblist[i] = aio_reqlist[i]->aiocbp; - } - - while(nr_complete < count) { - do { - err = aio_suspend(cblist, count, aio_timer_p); - } while (err < 0 && errno == EINTR); - if (err == 0) - { /* run through the list of requests, and mark all the completed - ones as done */ - for (i=0; i< count; i++) - { - /* aio_error returns an ERRNO value */ - if (aio_reqlist[i]->aiocbp == NULL) - continue; - errno = aio_error(aio_reqlist[i]->aiocbp); - if (errno == 0) { - ssize_t n = aio_return(aio_reqlist[i]->aiocbp); - aio_reqlist[i]->nbytes = n; - errcode = MPI_Grequest_complete(aio_reqlist[i]->req); - if (errcode != MPI_SUCCESS) { - errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_aio_wait_fn", - __LINE__, MPI_ERR_IO, - "**mpi_grequest_complete", 0); - } - ADIOI_Free(aio_reqlist[i]->aiocbp); - aio_reqlist[i]->aiocbp = NULL; - cblist[i] = NULL; - nr_complete++; - } - /* TODO: need to handle error conditions somehow*/ - } - } /* TODO: also need to handle errors here */ - if ( (timeout > 0) && (timeout < (MPI_Wtime() - starttime) )) - break; - } - - if (cblist != NULL) ADIOI_Free(cblist); - return errcode; -} - -int ADIOI_GEN_aio_free_fn(void *extra_state) -{ - ADIOI_AIO_Request *aio_req; - aio_req = (ADIOI_AIO_Request*)extra_state; - - if (aio_req->aiocbp != NULL) - ADIOI_Free(aio_req->aiocbp); - ADIOI_Free(aio_req); - - return MPI_SUCCESS; -} -#endif /* working AIO */ - -int ADIOI_GEN_aio_query_fn(void *extra_state, MPI_Status *status) -{ - ADIOI_AIO_Request *aio_req; - - aio_req = (ADIOI_AIO_Request *)extra_state; - - MPI_Status_set_elements_x(status, MPI_BYTE, aio_req->nbytes); - - /* can never cancel so always true */ - MPI_Status_set_cancelled(status, 0); - - /* choose not to return a value for this */ - status->MPI_SOURCE = MPI_UNDEFINED; - /* tag has no meaning for this generalized request */ - status->MPI_TAG = MPI_UNDEFINED; - /* this generalized request never fails */ - return MPI_SUCCESS; -} -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/common/ad_iwrite_fake.c b/3rd-party/romio321/adio/common/ad_iwrite_fake.c deleted file mode 100644 index 6210942e6639cdeb964c3f39b8c52eeaa086c845..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_iwrite_fake.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#include "mpiu_greq.h" - -/* Generic implementation of IwriteContig calls the blocking WriteContig - * immediately. - */ -void ADIOI_FAKE_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - ADIO_Status status; - MPI_Offset len; - MPI_Count typesize; - MPI_Offset nbytes=0; - - MPI_Type_size_x(datatype, &typesize); - len = (MPI_Offset)count * (MPI_Offset)typesize; - - /* Call the blocking function. It will create an error code - * if necessary. - */ - ADIOI_Assert(len == (int) len); /* the count is an int parm */ - ADIO_WriteContig(fd, buf, (int)len, MPI_BYTE, file_ptr_type, offset, - &status, error_code); - if (*error_code == MPI_SUCCESS) { - MPI_Type_size_x(datatype, &typesize); - nbytes = (MPI_Offset)count*(MPI_Offset)typesize; - } - MPIO_Completed_request_create(&fd, nbytes, error_code, request); - -} - - -/* Generic implementation of IwriteStrided calls the blocking WriteStrided - * immediately. - */ -void ADIOI_FAKE_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) -{ - ADIO_Status status; - MPI_Count typesize; - MPI_Offset nbytes=0; - - /* Call the blocking function. It will create an error code - * if necessary. - */ - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - if (*error_code == MPI_SUCCESS) { - MPI_Type_size_x(datatype, &typesize); - nbytes = (MPI_Offset)count * (MPI_Offset)typesize; - } - MPIO_Completed_request_create(&fd, nbytes, error_code, request); -} diff --git a/3rd-party/romio321/adio/common/ad_opencoll.c b/3rd-party/romio321/adio/common/ad_opencoll.c deleted file mode 100644 index 467a322a34024241b8c9d0b340b147af82058ab3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_opencoll.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2007 UChicago/Argonne LLC - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* Generic version of a "collective open". Assumes a "real" underlying - * file system (meaning no wonky consistency semantics like NFS). - * - * optimization: by having just one process create a file, close it, - * then have all N processes open it, we can possibly avoid contention - * for write locks on a directory for some file systems. - * - * Happy side-effect: exclusive create (error if file already exists) - * just falls out - * - * Note: this is not a "scalable open" (c.f. "The impact of file systems - * on MPI-IO scalability"). - */ - -void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code) -{ - int orig_amode_excl, orig_amode_wronly; - MPI_Comm tmp_comm; - - orig_amode_excl = access_mode; - - if (access_mode & ADIO_CREATE ){ - if(rank == fd->hints->ranklist[0]) { - /* remove delete_on_close flag if set */ - if (access_mode & ADIO_DELETE_ON_CLOSE) - fd->access_mode = access_mode ^ ADIO_DELETE_ON_CLOSE; - else - fd->access_mode = access_mode; - - tmp_comm = fd->comm; - fd->comm = MPI_COMM_SELF; - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - fd->comm = tmp_comm; - MPI_Bcast(error_code, 1, MPI_INT, \ - fd->hints->ranklist[0], fd->comm); - /* if no error, close the file and reopen normally below */ - if (*error_code == MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); - - fd->access_mode = access_mode; /* back to original */ - } - else MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - - if (*error_code != MPI_SUCCESS) { - return; - } - else { - /* turn off CREAT (and EXCL if set) for real multi-processor open */ - access_mode ^= ADIO_CREATE; - if (access_mode & ADIO_EXCL) - access_mode ^= ADIO_EXCL; - } - } - fd->blksize = 1024*1024*4; /* this large default value should be good for - most file systems. any ROMIO driver is free - to stat the file and find an optimial value */ - - /* if we are doing deferred open, non-aggregators should return now */ - if (fd->hints->deferred_open ) { - if (!(fd->is_agg)) { - /* we might have turned off EXCL for the aggregators. - * restore access_mode that non-aggregators get the right - * value from get_amode */ - fd->access_mode = orig_amode_excl; - /* In file-system specific open, a driver might collect some - * information via stat(). Deferred open means not every process - * participates in fs-specific open, but they all participate in - * this open call. Broadcast a bit of information in case - * lower-level file system driver (e.g. 'bluegene') collected it - * (not all do)*/ - MPI_Bcast(&(fd->blksize), 1, MPI_LONG, fd->hints->ranklist[0], fd->comm); - *error_code = MPI_SUCCESS; - ADIOI_Assert(fd->blksize > 0); - return; - } - } - -/* For writing with data sieving, a read-modify-write is needed. If - the file is opened for write_only, the read will fail. Therefore, - if write_only, open the file as read_write, but record it as write_only - in fd, so that get_amode returns the right answer. */ - - /* observation from David Knaak: file systems that do not support data - * sieving do not need to change the mode */ - - orig_amode_wronly = access_mode; - if ( (access_mode & ADIO_WRONLY) && - ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) ) { - access_mode = access_mode ^ ADIO_WRONLY; - access_mode = access_mode | ADIO_RDWR; - } - fd->access_mode = access_mode; - - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* if error, may be it was due to the change in amode above. - therefore, reopen with access mode provided by the user.*/ - fd->access_mode = orig_amode_wronly; - if (*error_code != MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* if we turned off EXCL earlier, then we should turn it back on */ - if (fd->access_mode != orig_amode_excl) fd->access_mode = orig_amode_excl; - - /* broadcast a bit of information (blocksize for now) to all proceses in - * communicator, not just those who participated in open */ - MPI_Bcast(&(fd->blksize), 1, MPI_LONG, fd->hints->ranklist[0], fd->comm); - /* file domain code will get terribly confused in a hard-to-debug way if - * gpfs blocksize not sensible */ - ADIOI_Assert( fd->blksize > 0); - /* for deferred open: this process has opened the file (because if we are - * not an aggregaor and we are doing deferred open, we returned earlier)*/ - fd->is_open = 1; - -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/common/ad_opencoll_failsafe.c b/3rd-party/romio321/adio/common/ad_opencoll_failsafe.c deleted file mode 100644 index 962f191c1f9e8f9be2a57b6e8009dd360d1205c3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_opencoll_failsafe.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2007 UChicago/Argonne LLC - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - - -/* this "collective" open is useful for frankly broken file systems such - * as NFS where a create from one client might not be immediately - * visible on another */ - -void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code) -{ - MPI_Comm tmp_comm; - int orig_amode_excl, orig_amode_wronly; - - orig_amode_excl = access_mode; - if ((access_mode & ADIO_CREATE) && (access_mode & ADIO_EXCL)) { - /* the open should fail if the file exists. Only *1* process - * should check this. Otherwise, if all processes try to check - * and the file does not exist, one process will create the file - * and others who reach later will return error. */ - if(rank == fd->hints->ranklist[0]) { - fd->access_mode = access_mode; - - /* if the lower-level file system tries to communicate, COMM_SELF - * will ensure it doesn't get stuck waiting for non-existant - * participants */ - tmp_comm = fd->comm; - fd->comm = MPI_COMM_SELF; - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - MPI_Bcast(error_code, 1, MPI_INT, \ - fd->hints->ranklist[0], tmp_comm); - /* if no error, close the file and reopen normally below */ - if (*error_code == MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); - /* and put it all back the way we found it for subsequent code */ - fd->comm = tmp_comm; - } - else MPI_Bcast(error_code, 1, MPI_INT, - fd->hints->ranklist[0], fd->comm); - if (*error_code != MPI_SUCCESS) { - return; - } - else { - /* turn off EXCL for real open */ - access_mode = access_mode ^ ADIO_EXCL; - } - } - /* if we are doing deferred open, non-aggregators should return now */ - if (fd->hints->deferred_open && !(fd->is_agg)) { - /* we might have turned off EXCL for the aggregators. - * restore access_mode that non-aggregators get the right - * value from get_amode */ - fd->access_mode = orig_amode_excl; - *error_code = MPI_SUCCESS; - return; - } - -/* For writing with data sieving, a read-modify-write is needed. If - the file is opened for write_only, the read will fail. Therefore, - if write_only, open the file as read_write, but record it as write_only - in fd, so that get_amode returns the right answer. */ - - orig_amode_wronly = access_mode; - if (access_mode & ADIO_WRONLY) { - access_mode = access_mode ^ ADIO_WRONLY; - access_mode = access_mode | ADIO_RDWR; - } - fd->access_mode = access_mode; - - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* if error, may be it was due to the change in amode above. - therefore, reopen with access mode provided by the user.*/ - fd->access_mode = orig_amode_wronly; - if (*error_code != MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - if(*error_code != MPI_SUCCESS) return; - /* if we turned off EXCL earlier, then we should turn it back on */ - if (fd->access_mode != orig_amode_excl) fd->access_mode = orig_amode_excl; - - /* for deferred open: this process has opened the file (because if we are - * not an aggregaor and we are doing deferred open, we returned earlier)*/ - fd->is_open = 1; -} - - - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/common/ad_opencoll_scalable.c b/3rd-party/romio321/adio/common/ad_opencoll_scalable.c deleted file mode 100644 index 1c472017f531712393d1aa5f961e75ddb7397859..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_opencoll_scalable.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2007 UChicago/Argonne LLC - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* - * Scalable open: for file systems capable of having one process - * create/open a file and broadcast the result to everyone else. - * - Does not need one process to create the file - * - Does not need special handling for CREATE|EXCL - */ -void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code) -{ - int orig_amode_wronly; - - /* if we are doing deferred open, non-aggregators should return now */ - if (fd->hints->deferred_open && !(fd->is_agg)) { - *error_code = MPI_SUCCESS; - return; - } - - /* For writing with data sieving, a read-modify-write is needed. If - the file is opened for write_only, the read will fail. Therefore, - if write_only, open the file as read_write, but record it as - write_only in fd, so that get_amode returns the right answer. */ - - orig_amode_wronly = access_mode; - if (access_mode & ADIO_WRONLY) { - access_mode = access_mode ^ ADIO_WRONLY; - access_mode = access_mode | ADIO_RDWR; - } - fd->access_mode = access_mode; - - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* if error, may be it was due to the change in amode above. - therefore, reopen with access mode provided by the user.*/ - fd->access_mode = orig_amode_wronly; - if (*error_code != MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* for deferred open: this process has opened the file (because if we are - * not an aggregaor and we are doing deferred open, we returned earlier)*/ - fd->is_open = 1; - -} - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/adio/common/ad_prealloc.c b/3rd-party/romio321/adio/common/ad_prealloc.c deleted file mode 100644 index 9462f775aa621c69675d9446ccfa11c9d32bf453..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_prealloc.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -/* this used to be implemented in every file system as an fcntl, but the code - * is identical for all file systems without a real "preallocate" system call. - * This naive approach will get the job done, but not in a terribly efficient - * manner. - */ -void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code) -{ - ADIO_Offset curr_fsize, alloc_size, size, len, done, ntimes; - ADIO_Status status; - int i; - char *buf; - ADIO_Fcntl_t *fcntl_struct; - static char myname[] = "ADIOI_GEN_PREALLOC"; - - /* will be called by one process only */ - /* On file systems with no preallocation function, we have to - explicitly write - to allocate space. Since there could be holes in the file, - we need to read up to the current file size, write it back, - and then write beyond that depending on how much - preallocation is needed. - read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */ - - /*curr_fsize = fd->fp_ind; */ - fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); - ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, error_code); - - curr_fsize = fcntl_struct->fsize; /* don't rely on fd->fp_ind: might be - working on a pre-existing file */ - alloc_size = diskspace; - - size = ADIOI_MIN(curr_fsize, alloc_size); - - ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; - buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); - done = 0; - - for (i=0; i<ntimes; i++) { - len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ); - ADIO_ReadContig(fd, buf, - (int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), - so it fits in an int parameter */ - MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, - &status, error_code); - if (*error_code != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, - "**iopreallocrdwr", - 0); - return; - } - ADIO_WriteContig(fd, buf, - (int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), - so it fits in an int parameter */ - MPI_BYTE, ADIO_EXPLICIT_OFFSET, - done, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - done += len; - } - - if (alloc_size > curr_fsize) { - memset(buf, 0, ADIOI_PREALLOC_BUFSZ); - size = alloc_size - curr_fsize; - ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; - for (i=0; i<ntimes; i++) { - len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ); - ADIO_WriteContig(fd, buf, - (int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), - so it fits in an int parameter */ - MPI_BYTE, ADIO_EXPLICIT_OFFSET, - done, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - done += len; - } - } - ADIOI_Free(fcntl_struct); - ADIOI_Free(buf); - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_read.c b/3rd-party/romio321/adio/common/ad_read.c deleted file mode 100644 index 75b6c4823bbff1b4f557c796adb6203243fe496c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_read.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#include "adio.h" -#include <unistd.h> - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif -#ifdef ROMIO_GPFS -# include "adio/ad_gpfs/ad_gpfs_tuning.h" -#endif - -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - ssize_t err = -1; - MPI_Count datatype_size; - ADIO_Offset len, bytes_xfered=0; - size_t rd_count; - static char myname[] = "ADIOI_GEN_READCONTIG"; -#ifdef ROMIO_GPFS - double io_time=0; -#endif - char *p; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5034, 0, NULL); -#endif - MPI_Type_size_x(datatype, &datatype_size); - len = datatype_size * (ADIO_Offset)count; - -#ifdef ROMIO_GPFS - io_time = MPI_Wtime(); - if (gpfsmpio_timing) { - gpfsmpio_prof_cr[ GPFSMPIO_CIO_DATA_SIZE ] += len; - } -#endif - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; - } - - p=buf; - while (bytes_xfered < len) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); -#endif - rd_count = len - bytes_xfered; - /* stupid FreeBSD and Darwin do not like a count larger than a signed - int, even though size_t is eight bytes... */ - if (rd_count > INT_MAX) - rd_count = INT_MAX; -#ifdef ROMIO_GPFS - if (gpfsmpio_devnullio) - err = pread(fd->null_fd, p, rd_count, offset+bytes_xfered); - else -#endif - err = pread(fd->fd_sys, p, rd_count, offset+bytes_xfered); - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ - if (err == 0) { - /* end of file */ - break; - } - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); -#endif - bytes_xfered += err; - p += err; - } -#ifdef ROMIO_GPFS - if (gpfsmpio_timing) gpfsmpio_prof_cr[ GPFSMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time); -#endif - fd->fp_sys_posn = offset + bytes_xfered; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += bytes_xfered; - } - -#ifdef HAVE_STATUS_SET_BYTES - /* what if we only read half a datatype? */ - /* bytes_xfered could be larger than int */ - if (err != -1) MPIR_Status_set_bytes(status, datatype, bytes_xfered); -#endif - - *error_code = MPI_SUCCESS; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5035, 0, NULL); -#endif -#ifdef ROMIO_GPFS - if (gpfsmpio_timing) gpfsmpio_prof_cr[ GPFSMPIO_CIO_T_MPIO_RW ] += (MPI_Wtime() - io_time); -#endif -} diff --git a/3rd-party/romio321/adio/common/ad_read_coll.c b/3rd-party/romio321/adio/common/ad_read_coll.c deleted file mode 100644 index eaf99e6c2dcf2793144c10444b2d8646fe84ad81..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_read_coll.c +++ /dev/null @@ -1,1063 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#ifdef USE_DBG_LOGGING - #define RDCOLL_DEBUG 1 -#endif -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -/* prototypes of functions used for collective reads only. */ -static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code); -static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, - int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, - MPI_Aint buftype_extent, int *buf_idx); -void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, - unsigned *recv_size, - MPI_Request *requests, MPI_Status *statuses, - int *recd_from_proc, int nprocs, - int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - MPI_Aint buftype_extent); - - -void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ - - ADIOI_Access *my_req; - /* array of nprocs structures, one for each other process in - whose file domain this process's request lies */ - - ADIOI_Access *others_req; - /* array of nprocs structures, one for each other process - whose request lies in this process's file domain. */ - - int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int contig_access_count=0, interleave_count = 0, buftype_is_contig; - int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; - ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, - *fd_end = NULL, *end_offsets = NULL; - ADIO_Offset *len_list = NULL; - int *buf_idx = NULL; - -#ifdef HAVE_STATUS_SET_BYTES - MPI_Count bufsize, size; -#endif - - if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { - ADIOI_IOStridedColl (fd, buf, count, ADIOI_READ, datatype, - file_ptr_type, offset, status, error_code); - return; - } - - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - /* number of aggregators, cb_nodes, is stored in the hints */ - nprocs_for_coll = fd->hints->cb_nodes; - orig_fp = fd->fp_ind; - - /* only check for interleaving if cb_read isn't disabled */ - if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { - /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); - -#ifdef RDCOLL_DEBUG - for (i=0; i<contig_access_count; i++) { - DBG_FPRINTF(stderr, "rank %d off %lld len %lld\n", - myrank, offset_list[i], len_list[i]); - } -#endif - - /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets - stored in order of process rank. */ - - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, - ADIO_OFFSET, fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, - ADIO_OFFSET, fd->comm); - - /* are the accesses of different processes interleaved? */ - for (i=1; i<nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - - if (fd->hints->cb_read == ADIOI_HINT_DISABLE - || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) - { - /* don't do aggregation */ - if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - } - - fd->fp_ind = orig_fp; - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - if (buftype_is_contig && filetype_is_contig) { - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (fd->etype_size) * offset; - ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, error_code); - } - else ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } - else ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - - return; - } - - /* We're going to perform aggregation of I/O. Here we call - * ADIOI_Calc_file_domains() to determine what processes will handle I/O - * to what regions. We pass nprocs_for_coll into this function; it is - * used to determine how many processes will perform I/O, which is also - * the number of regions into which the range of bytes must be divided. - * These regions are called "file domains", or FDs. - * - * When this function returns, fd_start, fd_end, fd_size, and - * min_st_offset will be filled in. fd_start holds the starting byte - * location for each file domain. fd_end holds the ending byte location. - * min_st_offset holds the minimum byte location that will be accessed. - * - * Both fd_start[] and fd_end[] are indexed by an aggregator number; this - * needs to be mapped to an actual rank in the communicator later. - * - */ - ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - - /* calculate where the portions of the access requests of this process - * are located in terms of the file domains. this could be on the same - * process or on other processes. this function fills in: - * count_my_req_procs - number of processes (including this one) for which - * this process has requests in their file domain - * count_my_req_per_proc - count of requests for each process, indexed - * by rank of the process - * my_req[] - array of data structures describing the requests to be - * performed by each process (including self). indexed by rank. - * buf_idx[] - array of locations into which data can be directly moved; - * this is only valid for contiguous buffer case - */ - ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - - /* perform a collective communication in order to distribute the - * data calculated above. fills in the following: - * count_others_req_procs - number of processes (including this - * one) which have requests in this process's file domain. - * count_others_req_per_proc[] - number of separate contiguous - * requests from proc i lie in this process's file domain. - */ - ADIOI_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, &count_others_req_procs, - &others_req); - - /* my_req[] and count_my_req_per_proc aren't needed at this point, so - * let's free the memory - */ - ADIOI_Free(count_my_req_per_proc); - for (i=0; i<nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } - ADIOI_Free(my_req); - - - /* read data in sizes of no more than ADIOI_Coll_bufsize, - * communicate, and fill user buf. - */ - ADIOI_Read_and_exch(fd, buf, datatype, nprocs, myrank, - others_req, offset_list, - len_list, contig_access_count, min_st_offset, - fd_size, fd_start, fd_end, buf_idx, error_code); - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); - - /* free all memory allocated for collective I/O */ - for (i=0; i<nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } - ADIOI_Free(others_req); - - ADIOI_Free(buf_idx); - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - -#ifdef HAVE_STATUS_SET_BYTES - MPI_Type_size_x(datatype, &size); - bufsize = size * count; - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - during collective I/O. */ -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ -} - -void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype - datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, ADIO_Offset - **len_list_ptr, ADIO_Offset *start_offset_ptr, - ADIO_Offset *end_offset_ptr, int - *contig_access_count_ptr) -{ - MPI_Count filetype_size, etype_size; - MPI_Count buftype_size; - int i, j, k; - ADIO_Offset i_offset; - ADIO_Offset frd_size=0, old_frd_size=0; - int st_index=0; - ADIO_Offset n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - ADIO_Offset bufsize; - ADIO_Offset sum, n_etypes_in_filetype, size_in_filetype; - int contig_access_count, filetype_is_contig; - ADIO_Offset *len_list; - MPI_Aint filetype_extent, filetype_lb; - ADIOI_Flatlist_node *flat_file; - ADIO_Offset *offset_list, off, end_offset=0, disp; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5028, 0, NULL); -#endif - -/* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - etype_size = fd->etype_size; - - if ( ! filetype_size ) { - *contig_access_count_ptr = 0; - *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - /* 2 is for consistency. everywhere I malloc one more than needed */ - - offset_list = *offset_list_ptr; - len_list = *len_list_ptr; - offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - len_list[0] = 0; - *start_offset_ptr = offset_list[0]; - *end_offset_ptr = offset_list[0] + len_list[0] - 1; - - return; - } - - if (filetype_is_contig) { - *contig_access_count_ptr = 1; - *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - /* 2 is for consistency. everywhere I malloc one more than needed */ - - offset_list = *offset_list_ptr; - len_list = *len_list_ptr; - offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - len_list[0] = (ADIO_Offset)bufcount * (ADIO_Offset)buftype_size; - *start_offset_ptr = offset_list[0]; - *end_offset_ptr = offset_list[0] + len_list[0] - 1; - - /* update file pointer */ - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = *end_offset_ptr + 1; - } - - else { - - /* First calculate what size of offset_list and len_list to allocate */ - - /* filetype already flattened in ADIO_Open or ADIO_Fcntl */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - -#ifdef RDCOLL_DEBUG - { - int ii; - DBG_FPRINTF(stderr, "flattened %3lld : ", flat_file->count ); - for (ii=0; ii<flat_file->count; ii++) { - DBG_FPRINTF(stderr, "%16lld:%-16lld", flat_file->indices[ii], flat_file->blocklens[ii] ); - } - DBG_FPRINTF(stderr, "\n" ); - } -#endif - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* frd_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - frd_size = flat_file->blocklens[i]; - break; - } - if (dist > 0) { - frd_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + n_filetypes* (ADIO_Offset)filetype_extent + - abs_off_in_filetype; - } - - /* calculate how much space to allocate for offset_list, len_list */ - - old_frd_size = frd_size; - contig_access_count = i_offset = 0; - j = st_index; - bufsize = (ADIO_Offset)buftype_size * (ADIO_Offset)bufcount; - frd_size = ADIOI_MIN(frd_size, bufsize); - while (i_offset < bufsize) { - if (frd_size) contig_access_count++; - i_offset += frd_size; - j = (j + 1) % flat_file->count; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - - /* allocate space for offset_list and len_list */ - - *offset_list_ptr = (ADIO_Offset *) - ADIOI_Malloc((contig_access_count+1)*sizeof(ADIO_Offset)); - *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc((contig_access_count+1)*sizeof(ADIO_Offset)); - /* +1 to avoid a 0-size malloc */ - - offset_list = *offset_list_ptr; - len_list = *len_list_ptr; - - /* find start offset, end offset, and fill in offset_list and len_list */ - - *start_offset_ptr = offset; /* calculated above */ - - i_offset = k = 0; - j = st_index; - off = offset; - frd_size = ADIOI_MIN(old_frd_size, bufsize); - while (i_offset < bufsize) { - if (frd_size) { - offset_list[k] = off; - len_list[k] = frd_size; - k++; - } - i_offset += frd_size; - end_offset = off + frd_size - 1; - - /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - if (off + frd_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + - n_filetypes* (ADIO_Offset)filetype_extent) - { - off += frd_size; - /* did not reach end of contiguous block in filetype. - * no more I/O needed. off is incremented by frd_size. - */ - } - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - /* hit end of flattened filetype; start at beginning - * again */ - } - off = disp + flat_file->indices[j] + - n_filetypes* (ADIO_Offset)filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - } - - /* update file pointer */ - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - *contig_access_count_ptr = contig_access_count; - *end_offset_ptr = end_offset; - } -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5029, 0, NULL); -#endif -} - -static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code) -{ -/* Read in sizes of no more than coll_bufsize, an info parameter. - Send data to appropriate processes. - Place recd. data in user buf. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were read all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to read a distributed - array from a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ - - int i, j, m, ntimes, max_ntimes, buftype_is_contig; - ADIO_Offset st_loc=-1, end_loc=-1, off, done, real_off, req_off; - char *read_buf = NULL, *tmp_buf; - int *curr_offlen_ptr, *count, *send_size, *recv_size; - int *partial_send, *recd_from_proc, *start_pos; - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ - ADIO_Offset real_size, size, for_curr_iter, for_next_iter; - int req_len, flag, rank; - MPI_Status status; - ADIOI_Flatlist_node *flat_buf=NULL; - MPI_Aint buftype_extent, lb; - int coll_bufsize; - - *error_code = MPI_SUCCESS; /* changed below if error */ - /* only I/O errors are currently reported */ - -/* calculate the number of reads of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. - coll_bufsize is obtained from the hints object. */ - - coll_bufsize = fd->hints->cb_buffer_size; - - /* grab some initial values for st_loc and end_loc */ - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - st_loc = others_req[i].offsets[0]; - end_loc = others_req[i].offsets[0]; - break; - } - } - - /* now find the real values */ - for (i=0; i < nprocs; i++) - for (j=0; j<others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); - } - - /* calculate ntimes, the number of times this process must perform I/O - * operations in order to complete all the requests it has received. - * the need for multiple I/O operations comes from the restriction that - * we only use coll_bufsize bytes of memory for internal buffering. - */ - if ((st_loc==-1) && (end_loc==-1)) { - /* this process does no I/O. */ - ntimes = 0; - } - else { - /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ - ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); - } - - MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); - - read_buf = fd->io_buf; /* Allocated at open time */ - - curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* its use is explained below. calloc initializes to 0. */ - - count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ - - partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* if only a portion of the last off-len pair is sent to a process - in a particular iteration, the length sent is stored here. - calloc initializes to 0. */ - - send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be sent to each proc. in an iteration */ - - recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ - - recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* amount of data recd. so far from each proc. Used in - ADIOI_Fill_user_buffer. initialized to 0 here. */ - - start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - if (!buftype_is_contig) { - flat_buf = ADIOI_Flatten_and_find(datatype); - } - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - - done = 0; - off = st_loc; - for_curr_iter = for_next_iter = 0; - - MPI_Comm_rank(fd->comm, &rank); - - for (m=0; m<ntimes; m++) { - /* read buf of size coll_bufsize (or less) */ - /* go through all others_req and check if any are satisfied - by the current read */ - - /* since MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order, I can maintain a pointer - (curr_offlen_ptr) to - current off-len pair for each process in others_req and scan - further only from there. There is still a problem of filetypes - such as: (1, 2, 3 are not process nos. They are just numbers for - three chunks of data, specified by a filetype.) - - 1 -------!-- - 2 -----!---- - 3 --!----- - - where ! indicates where the current read_size limitation cuts - through the filetype. I resolve this by reading up to !, but - filling the communication buffer only for 1. I copy the portion - left over for 2 into a tmp_buf for use in the next - iteration. i.e., 2 and 3 will be satisfied in the next - iteration. This simplifies filling in the user's buf at the - other end, as only one off-len pair with incomplete data - will be sent. I also don't need to send the individual - offsets and lens along with the data, as the data is being - sent in a particular order. */ - - /* off = start offset in the file for the data actually read in - this iteration - size = size of data read corresponding to off - real_off = off minus whatever data was retained in memory from - previous iteration for cases like 2, 3 illustrated above - real_size = size plus the extra corresponding to real_off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ - - size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); - real_off = off - for_curr_iter; - real_size = size + for_curr_iter; - - for (i=0; i<nprocs; i++) count[i] = send_size[i] = 0; - for_next_iter = 0; - - for (i=0; i<nprocs; i++) { -#ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "rank %d, i %d, others_count %d\n", rank, i, others_req[i].count); -#endif - if (others_req[i].count) { - start_pos[i] = curr_offlen_ptr[i]; - for (j=curr_offlen_ptr[i]; j<others_req[i].count; - j++) { - if (partial_send[i]) { - /* this request may have been partially - satisfied in the previous iteration. */ - req_off = others_req[i].offsets[j] + - partial_send[i]; - req_len = others_req[i].lens[j] - - partial_send[i]; - partial_send[i] = 0; - /* modify the off-len pair to reflect this change */ - others_req[i].offsets[j] = req_off; - others_req[i].lens[j] = req_len; - } - else { - req_off = others_req[i].offsets[j]; - req_len = others_req[i].lens[j]; - } - if (req_off < real_off + real_size) { - count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+req_off-real_off) == (ADIO_Offset)(MPIU_Upint)(read_buf+req_off-real_off)); - MPI_Get_address(read_buf+req_off-real_off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off)); - send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off, - (ADIO_Offset)(unsigned)req_len)); - - if (real_off+real_size-req_off < (ADIO_Offset)(unsigned)req_len) { - partial_send[i] = (int) (real_off + real_size - req_off); - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < - real_off+real_size)) { - /* this is the case illustrated in the - figure above. */ - for_next_iter = ADIOI_MAX(for_next_iter, - real_off + real_size - others_req[i].offsets[j+1]); - /* max because it must cover requests - from different processes */ - } - break; - } - } - else break; - } - curr_offlen_ptr[i] = j; - } - } - - flag = 0; - for (i=0; i<nprocs; i++) - if (count[i]) flag = 1; - - if (flag) { - ADIOI_Assert(size == (int)size); - ADIO_ReadContig(fd, read_buf+for_curr_iter, (int)size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - } - - for_curr_iter = for_next_iter; - - ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, - m, buftype_extent, buf_idx); - - - if (for_next_iter) { - tmp_buf = (char *) ADIOI_Malloc(for_next_iter); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+real_size-for_next_iter) == (ADIO_Offset)(MPIU_Upint)(read_buf+real_size-for_next_iter)); - ADIOI_Assert((ADIO_Size) (for_next_iter+coll_bufsize) == (size_t)(for_next_iter+coll_bufsize)); - memcpy(tmp_buf, read_buf+real_size-for_next_iter, for_next_iter); - ADIOI_Free(fd->io_buf); - fd->io_buf = (char *) ADIOI_Malloc(for_next_iter+coll_bufsize); - memcpy(fd->io_buf, tmp_buf, for_next_iter); - read_buf = fd->io_buf; - ADIOI_Free(tmp_buf); - } - - off += size; - done += size; - } - - for (i=0; i<nprocs; i++) count[i] = send_size[i] = 0; - for (m=ntimes; m<max_ntimes; m++) -/* nothing to send, but check for recv. */ - ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, - send_size, recv_size, count, - start_pos, partial_send, recd_from_proc, nprocs, - myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, m, - buftype_extent, buf_idx); - - ADIOI_Free(curr_offlen_ptr); - ADIOI_Free(count); - ADIOI_Free(partial_send); - ADIOI_Free(send_size); - ADIOI_Free(recv_size); - ADIOI_Free(recd_from_proc); - ADIOI_Free(start_pos); -} - -static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, ADIO_Offset - *len_list, int *send_size, int *recv_size, - int *count, int *start_pos, int *partial_send, - int *recd_from_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int iter, MPI_Aint buftype_extent, int *buf_idx) -{ - int i, j, k=0, tmp=0, nprocs_recv, nprocs_send; - char **recv_buf = NULL; - MPI_Request *requests; - MPI_Datatype send_type; - MPI_Status *statuses; - -/* exchange send_size info so that each process knows how much to - receive from whom and how much memory to allocate. */ - - MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); - - nprocs_recv = 0; - for (i=0; i < nprocs; i++) if (recv_size[i]) nprocs_recv++; - - nprocs_send = 0; - for (i=0; i<nprocs; i++) if (send_size[i]) nprocs_send++; - - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); -/* +1 to avoid a 0-size malloc */ - -/* post recvs. if buftype_is_contig, data can be directly recd. into - user buf at location given by buf_idx. else use recv_buf. */ - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - - if (buftype_is_contig) { - j = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - MPI_Irecv(((char *) buf) + buf_idx[i], recv_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, requests+j); - j++; - buf_idx[i] += recv_size[i]; - } - } - else { -/* allocate memory for recv_buf and post receives */ - recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char*)); - for (i=0; i < nprocs; i++) - if (recv_size[i]) recv_buf[i] = - (char *) ADIOI_Malloc(recv_size[i]); - - j = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, - myrank+i+100*iter, fd->comm, requests+j); - j++; -#ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", - myrank, recv_size[i], myrank+i+100*iter); -#endif - } - } - -/* create derived datatypes and send data */ - - j = 0; - for (i=0; i<nprocs; i++) { - if (send_size[i]) { -/* take care if the last off-len pair is a partial send */ - if (partial_send[i]) { - k = start_pos[i] + count[i] - 1; - tmp = others_req[i].lens[k]; - others_req[i].lens[k] = partial_send[i]; - } - ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, &send_type); - /* absolute displacement; use MPI_BOTTOM in send */ - MPI_Type_commit(&send_type); - MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank+i+100*iter, - fd->comm, requests+nprocs_recv+j); - MPI_Type_free(&send_type); - if (partial_send[i]) others_req[i].lens[k] = tmp; - j++; - } - } - - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - - /* wait on the receives */ - if (nprocs_recv) { -#ifdef NEEDS_MPI_TEST - j = 0; - while (!j) MPI_Testall(nprocs_recv, requests, &j, statuses); -#else - MPI_Waitall(nprocs_recv, requests, statuses); -#endif - - /* if noncontiguous, to the copies from the recv buffers */ - if (!buftype_is_contig) - ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, - offset_list, len_list, (unsigned*)recv_size, - requests, statuses, recd_from_proc, - nprocs, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - buftype_extent); - } - - /* wait on the sends*/ - MPI_Waitall(nprocs_send, requests+nprocs_recv, statuses+nprocs_recv); - - ADIOI_Free(statuses); - ADIOI_Free(requests); - - if (!buftype_is_contig) { - for (i=0; i < nprocs; i++) - if (recv_size[i]) ADIOI_Free(recv_buf[i]); - ADIOI_Free(recv_buf); - } -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif -} - -#define ADIOI_BUF_INCR \ -{ \ - while (buf_incr) { \ - size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - buf_incr -= size_in_buf; \ - } \ -} - - -#define ADIOI_BUF_COPY \ -{ \ - while (size) { \ - size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \ - ADIOI_Assert((ADIO_Size) size_in_buf == (size_t)size_in_buf); \ - memcpy(((char *) buf) + user_buf_idx, \ - &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ - recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - size -= size_in_buf; \ - buf_incr -= size_in_buf; \ - } \ - ADIOI_BUF_INCR \ -} - -void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, - unsigned *recv_size, - MPI_Request *requests, MPI_Status *statuses, - int *recd_from_proc, int nprocs, - int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - MPI_Aint buftype_extent) -{ - -/* this function is only called if buftype is not contig */ - - int i, p, flat_buf_idx; - ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; - int n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - /* Not sure unsigned is necessary, but it makes the math safer */ - unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; - - ADIOI_UNREFERENCED_ARG(requests); - ADIOI_UNREFERENCED_ARG(statuses); - -/* curr_from_proc[p] = amount of data recd from proc. p that has already - been accounted for so far - done_from_proc[p] = amount of data already recd from proc. p and - filled into user buffer in previous iterations - user_buf_idx = current location in user buffer - recv_buf_idx[p] = current location in recv_buf of proc. p */ - curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - done_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - recv_buf_idx = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); - - for (i=0; i < nprocs; i++) { - recv_buf_idx[i] = curr_from_proc[i] = 0; - done_from_proc[i] = recd_from_proc[i]; - } - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - flat_buf_sz = size of current contiguous component in - flattened buf */ - - for (i=0; i<contig_access_count; i++) { - off = offset_list[i]; - rem_len = len_list[i]; - - /* this request may span the file domains of more than one process */ - while (rem_len != 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_Calc_aggregator(fd, - off, - min_st_offset, - &len, - fd_size, - fd_start, - fd_end); - - if (recv_buf_idx[p] < recv_size[p]) { - if (curr_from_proc[p]+len > done_from_proc[p]) { - if (done_from_proc[p] > curr_from_proc[p]) { - size = ADIOI_MIN(curr_from_proc[p] + len - - done_from_proc[p], recv_size[p]-recv_buf_idx[p]); - buf_incr = done_from_proc[p] - curr_from_proc[p]; - ADIOI_BUF_INCR - buf_incr = curr_from_proc[p]+len-done_from_proc[p]; - ADIOI_Assert((done_from_proc[p] + size) == (unsigned)((ADIO_Offset)done_from_proc[p] + size)); - curr_from_proc[p] = done_from_proc[p] + size; - ADIOI_BUF_COPY - } - else { - size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]); - buf_incr = len; - ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size)); - curr_from_proc[p] += (unsigned) size; - ADIOI_BUF_COPY - } - } - else { - ADIOI_Assert((curr_from_proc[p] + len) == (unsigned)((ADIO_Offset)curr_from_proc[p] + len)); - curr_from_proc[p] += (unsigned) len; - buf_incr = len; - ADIOI_BUF_INCR - } - } - else { - buf_incr = len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i=0; i < nprocs; i++) - if (recv_size[i]) recd_from_proc[i] = curr_from_proc[i]; - - ADIOI_Free(curr_from_proc); - ADIOI_Free(done_from_proc); - ADIOI_Free(recv_buf_idx); -} diff --git a/3rd-party/romio321/adio/common/ad_read_str.c b/3rd-party/romio321/adio/common/ad_read_str.c deleted file mode 100644 index fbb4bbe3c1e7d8c25b5f657a0d613bbf361a28ee..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_read_str.c +++ /dev/null @@ -1,403 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#define ADIOI_BUFFERED_READ \ -{ \ - if (req_off >= readbuf_off + readbuf_len) { \ - readbuf_off = req_off; \ - readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ - ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) return; \ - } \ - while (req_len > readbuf_off + readbuf_len - req_off) { \ - ADIOI_Assert((readbuf_off + readbuf_len - req_off) == (int) (readbuf_off + readbuf_len - req_off));\ - partial_read = (int) (readbuf_off + readbuf_len - req_off); \ - tmp_buf = (char *) ADIOI_Malloc(partial_read); \ - memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ - ADIOI_Free(readbuf); \ - readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ - memcpy(readbuf, tmp_buf, partial_read); \ - ADIOI_Free(tmp_buf); \ - readbuf_off += readbuf_len-partial_read; \ - readbuf_len = (unsigned) (partial_read + ADIOI_MIN(max_bufsize, \ - end_offset-readbuf_off+1)); \ - ADIO_ReadContig(fd, readbuf+partial_read, readbuf_len-partial_read, \ - MPI_BYTE, ADIO_EXPLICIT_OFFSET, readbuf_off+partial_read, \ - &status1, error_code); \ - if (*error_code != MPI_SUCCESS) return; \ - } \ - ADIOI_Assert((ADIO_Size) req_len == (size_t)req_len); \ - memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ -} - - -void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - ADIO_Offset i_offset, new_brd_size, brd_size, size; - int i, j, k, st_index=0; - MPI_Count num, bufsize; - int n_etypes_in_filetype; - ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype; - ADIO_Offset abs_off_in_filetype=0, new_frd_size, frd_size=0, st_frd_size; - MPI_Count filetype_size, etype_size, buftype_size, partial_read; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off, req_len, sum; - ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off; - char *readbuf, *tmp_buf, *value; - int info_flag; - unsigned max_bufsize, readbuf_len; - ADIO_Status status1; - - if (fd->hints->ds_read == ADIOI_HINT_DISABLE) { - /* if user has disabled data sieving on reads, use naive - * approach instead. - */ - ADIOI_GEN_ReadStrided_naive(fd, - buf, - count, - datatype, - file_ptr_type, - offset, - status, - error_code); - return; - } - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(MPI_Count)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - -/* get max_bufsize from the info object. */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - max_bufsize = atoi(value); - ADIOI_Free(value); - - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - readbuf_off = off; - readbuf = (char *) ADIOI_Malloc(max_bufsize); - readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); - -/* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); - if (*error_code != MPI_SUCCESS) return; - - for (j=0; j<count; j++) - { - for (i=0; i<flat_buf->count; i++) { - userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_READ - off += flat_buf->blocklens[i]; - } - } - - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(readbuf); - } - - else { /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* frd_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - frd_size = flat_file->blocklens[i]; - break; - } - if (dist > 0) { - frd_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } - - start_off = offset; - - /* Wei-keng Liao: read request is within a single flat_file contig - * block e.g. with subarray types that actually describe the whole - * array */ - if (buftype_is_contig && bufsize <= frd_size) { - /* a count of bytes can overflow. operate on original type instead */ - ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, error_code); - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* update MPI-IO file pointer to point to the first byte that - * can be accessed in the fileview. */ - fd->fp_ind = offset + bufsize; - if (bufsize == frd_size) { - do { - st_index++; - if (st_index == flat_file->count) { - st_index = 0; - n_filetypes++; - } - } while (flat_file->blocklens[st_index] == 0); - fd->fp_ind = disp + flat_file->indices[st_index] - + n_filetypes*filetype_extent; - } - } - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -#endif - return; - } - - /* Calculate end_offset, the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - i_offset = 0; - j = st_index; - off = offset; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i_offset < bufsize) { - i_offset += frd_size; - end_offset = off + frd_size - 1; - - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + n_filetypes*(ADIO_Offset)filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - -/* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - readbuf_off = 0; - readbuf_len = 0; - readbuf = (char *) ADIOI_Malloc(max_bufsize); - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i_offset = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i_offset < bufsize) { - if (frd_size) { - /* TYPE_UB and TYPE_LB can result in - frd_size = 0. save system call in such cases */ - /* lseek(fd->fd_sys, off, SEEK_SET); - err = read(fd->fd_sys, ((char *) buf) + i, frd_size);*/ - - req_off = off; - req_len = frd_size; - userbuf_off = i_offset; - ADIOI_BUFFERED_READ - } - i_offset += frd_size; - - if (off + frd_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) - off += frd_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by frd_size. */ - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - i_offset = flat_buf->indices[0]; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(frd_size, brd_size); - if (size) { - /* lseek(fd->fd_sys, off, SEEK_SET); - err = read(fd->fd_sys, ((char *) buf) + i, size); */ - - req_off = off; - req_len = size; - userbuf_off = i_offset; - ADIOI_BUFFERED_READ - } - - new_frd_size = frd_size; - new_brd_size = brd_size; - - if (size == frd_size) { -/* reached end of contiguous block in file */ - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_frd_size = flat_file->blocklens[j]; - if (size != brd_size) { - i_offset += size; - new_brd_size -= size; - } - } - - if (size == brd_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - i_offset = ((ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + - flat_buf->indices[k]); - new_brd_size = flat_buf->blocklens[k]; - if (size != frd_size) { - off += size; - new_frd_size -= size; - } - } - ADIOI_Assert(((ADIO_Offset)num + size) == (unsigned)(num + size)); - num += size; - frd_size = new_frd_size; - brd_size = new_brd_size; - } - } - - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - by ADIOI_BUFFERED_READ. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/common/ad_read_str_naive.c b/3rd-party/romio321/adio/common/ad_read_str_naive.c deleted file mode 100644 index a65eede95589eab63803102865b6564da1835be7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_read_str_naive.c +++ /dev/null @@ -1,380 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, - MPI_Datatype buftype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - ADIO_Offset size, brd_size, frd_size=0, req_len, sum; - int b_index; - int n_etypes_in_filetype; - ADIO_Offset n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - MPI_Count bufsize, filetype_size, buftype_size, size_in_filetype; - ADIO_Offset etype_size; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, start_off; - ADIO_Status status1; - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, buftype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(buftype, &buftype_size); - MPI_Type_get_extent(buftype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - - /* contiguous in buftype and filetype is handled elsewhere */ - - if (!buftype_is_contig && filetype_is_contig) { - int b_count; - /* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(buftype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - - /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - /* for each region in the buffer, grab the data and put it in - * place - */ - for (b_count=0; b_count < count; b_count++) { - for (b_index=0; b_index < flat_buf->count; b_index++) { - userbuf_off = (ADIO_Offset)b_count*(ADIO_Offset)buftype_extent + - flat_buf->indices[b_index]; - req_off = off; - req_len = flat_buf->blocklens[b_index]; - - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIOI_Assert(req_len == (int) req_len); - ADIO_ReadContig(fd, - (char *) buf + userbuf_off, - req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - - /* off is (potentially) used to save the final offset later */ - off += flat_buf->blocklens[b_index]; - } - } - - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - } - - else { /* noncontiguous in file */ - int f_index, st_index = 0; - ADIO_Offset st_n_filetypes; - ADIO_Offset st_frd_size; - int flag; - - /* First we're going to calculate a set of values for use in all - * the noncontiguous in file cases: - * start_off - starting byte position of data in file - * end_offset - last byte offset to be acessed in the file - * st_n_filetypes - how far into the file we start in terms of - * whole filetypes - * st_index - index of block in first filetype that we will be - * starting in (?) - * st_frd_size - size of the data in the first filetype block - * that we will read (accounts for being part-way - * into reading this block of the filetype - * - */ - - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - start_off = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (f_index=0; f_index < flat_file->count; f_index++) { - if (disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent + - flat_file->blocklens[f_index] >= start_off) - { - /* this block contains our starting position */ - - st_index = f_index; - frd_size = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent + - flat_file->blocklens[f_index] - start_off; - flag = 1; - break; - } - } - } - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = (unsigned)etype_in_filetype * (unsigned)etype_size; - - sum = 0; - for (f_index=0; f_index < flat_file->count; f_index++) { - sum += flat_file->blocklens[f_index]; - if (sum > size_in_filetype) { - st_index = f_index; - frd_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[f_index] + - size_in_filetype - - (sum - flat_file->blocklens[f_index]); - break; - } - } - - /* abs. offset in bytes in the file */ - start_off = disp + n_filetypes*(ADIO_Offset)filetype_extent + - abs_off_in_filetype; - } - - st_frd_size = frd_size; - st_n_filetypes = n_filetypes; - - /* start_off, st_n_filetypes, st_index, and st_frd_size are - * all calculated at this point - */ - - /* Calculate end_offset, the last byte-offset that will be accessed. - * e.g., if start_off=0 and 100 bytes to be read, end_offset=99 - */ - userbuf_off = 0; - f_index = st_index; - off = start_off; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (userbuf_off < bufsize) { - userbuf_off += frd_size; - end_offset = off + frd_size - 1; - - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(unsigned)userbuf_off); - } - - /* End of calculations. At this point the following values have - * been calculated and are ready for use: - * - start_off - * - end_offset - * - st_n_filetypes - * - st_index - * - st_frd_size - */ - - /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (buftype_is_contig && !filetype_is_contig) { - /* contiguous in memory, noncontiguous in file. should be the - * most common case. - */ - - userbuf_off = 0; - f_index = st_index; - off = start_off; - n_filetypes = st_n_filetypes; - frd_size = ADIOI_MIN(st_frd_size, bufsize); - - /* while there is still space in the buffer, read more data */ - while (userbuf_off < bufsize) { - if (frd_size) { - /* TYPE_UB and TYPE_LB can result in - frd_size = 0. save system call in such cases */ - req_off = off; - req_len = frd_size; - - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIOI_Assert(req_len == (int) req_len); - ADIO_ReadContig(fd, - (char *) buf + userbuf_off, - req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - } - userbuf_off += frd_size; - - if (off + frd_size < disp + flat_file->indices[f_index] + - flat_file->blocklens[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent) - { - /* important that this value be correct, as it is - * used to set the offset in the fd near the end of - * this function. - */ - off += frd_size; - } - /* did not reach end of contiguous block in filetype. - * no more I/O needed. off is incremented by frd_size. - */ - else { - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(unsigned)userbuf_off); - } - } - } - else { - ADIO_Offset i_offset, tmp_bufsize = 0; - /* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(buftype); - - b_index = buf_count = 0; - i_offset = flat_buf->indices[0]; - f_index = st_index; - off = start_off; - n_filetypes = st_n_filetypes; - frd_size = st_frd_size; - brd_size = flat_buf->blocklens[0]; - - /* while we haven't read size * count bytes, keep going */ - while (tmp_bufsize < bufsize) { - ADIO_Offset new_brd_size = brd_size, new_frd_size = frd_size; - - size = ADIOI_MIN(frd_size, brd_size); - if (size) { - req_off = off; - req_len = size; - userbuf_off = i_offset; - - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIOI_Assert(req_len == (int) req_len); - ADIO_ReadContig(fd, - (char *) buf + userbuf_off, - req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - } - - if (size == frd_size) { - /* reached end of contiguous block in file */ - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_frd_size = flat_file->blocklens[f_index]; - if (size != brd_size) { - i_offset += size; - new_brd_size -= size; - } - } - - if (size == brd_size) { - /* reached end of contiguous block in memory */ - - b_index = (b_index + 1)%flat_buf->count; - buf_count++; - i_offset = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[b_index]; - new_brd_size = flat_buf->blocklens[b_index]; - if (size != frd_size) { - off += size; - new_frd_size -= size; - } - } - tmp_bufsize += size; - frd_size = new_frd_size; - brd_size = new_brd_size; - } - } - - /* unlock the file region if we locked it */ - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && - (fd->file_system != ADIO_PVFS) && (fd->file_system != ADIO_PVFS2)) - { - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - } /* end of (else noncontiguous in file) */ - - fd->fp_sys_posn = -1; /* mark it as invalid. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, buftype, bufsize); - /* This is a temporary way of filling in status. The right way is to - * keep track of how much data was actually read and placed in buf - */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(buftype); -} diff --git a/3rd-party/romio321/adio/common/ad_resize.c b/3rd-party/romio321/adio/common/ad_resize.c deleted file mode 100644 index a6be2c1760800d437c5608b0103cd956401b137a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_resize.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err, rank; - static char myname[] = "ADIOI_GEN_RESIZE"; - - MPI_Comm_rank(fd->comm, &rank); - - /* first aggregator performs ftruncate() */ - if (rank == fd->hints->ranklist[0]) { - ADIOI_Assert(size == (off_t) size); - err = ftruncate(fd->fd_sys, (off_t)size); - } - - /* bcast return value */ - MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - return; - } - /* --END ERROR HANDLING-- */ - - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_seek.c b/3rd-party/romio321/adio/common/ad_seek.c deleted file mode 100644 index 2d6f75fd54e4d50a1774130201da209c54f57d58..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_seek.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code) -{ -/* implemented for whence=SEEK_SET only. SEEK_CUR and SEEK_END must - be converted to the equivalent with SEEK_SET before calling this - routine. */ -/* offset is in units of etype relative to the filetype */ - - ADIO_Offset off; - ADIOI_Flatlist_node *flat_file; - - int i; - ADIO_Offset n_etypes_in_filetype, n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - ADIO_Offset size_in_filetype, sum; - MPI_Count filetype_size, etype_size; - int filetype_is_contig; - MPI_Aint filetype_extent, lb; - - ADIOI_UNREFERENCED_ARG(whence); - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - etype_size = fd->etype_size; - - if (filetype_is_contig) off = fd->disp + etype_size * offset; - else { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { - /* Since offset relative to the filetype size, we can't - do compute the offset when that result is zero. - Return zero for the offset for now */ - *error_code = MPI_SUCCESS; - return 0; - } - - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - off = fd->disp + n_filetypes * filetype_extent + - abs_off_in_filetype; - } - -/* - * we used to call lseek here and update both fp_ind and fp_sys_posn, but now - * we don't seek and only update fp_ind (ROMIO's idea of where we are in the - * file). We leave the system file descriptor and fp_sys_posn alone. - * The fs-specifc ReadContig and WriteContig will seek to the correct place in - * the file before reading/writing if the 'offset' parameter doesn't match - * fp_sys_posn - */ - fd->fp_ind = off; - - *error_code = MPI_SUCCESS; - - return off; -} diff --git a/3rd-party/romio321/adio/common/ad_set_sh_fp.c b/3rd-party/romio321/adio/common/ad_set_sh_fp.c deleted file mode 100644 index c55f2efe5a9998cf1ddc93f00f11ebd09e77d1ba..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_set_sh_fp.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* set the shared file pointer to "offset" etypes relative to the current - view */ - -void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); - -void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) -{ - ADIO_Status status; - MPI_Comm dupcommself; - -#ifdef ROMIO_NFS - if (fd->file_system == ADIO_NFS) { - ADIOI_NFS_Set_shared_fp(fd, offset, error_code); - return; - } -#endif - - if (fd->shared_fp_fd == ADIO_FILE_NULL) { - MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); - fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, - fd->shared_fp_fname, - fd->file_system, - fd->fns, - ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, - MPI_INFO_NULL, - ADIO_PERM_NULL, error_code); - } - - if (*error_code != MPI_SUCCESS) return; - - ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); - ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset), - MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); - ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); -} - diff --git a/3rd-party/romio321/adio/common/ad_set_view.c b/3rd-party/romio321/adio/common/ad_set_view.c deleted file mode 100644 index 18becf269a9869b54705dd438d2e783f547f3778..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_set_view.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -/* this used to be implemented in every file system as an fcntl. It makes - * deferred open easier if we know ADIO_Fcntl will always need a file to really - * be open. set_view doesn't modify anything related to the open files. - */ -void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, MPI_Info info, int *error_code) -{ - int combiner, i, j, k, err, filetype_is_contig; - MPI_Datatype copy_etype, copy_filetype; - ADIOI_Flatlist_node *flat_file; - /* free copies of old etypes and filetypes and delete flattened - version of filetype if necessary */ - - MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner); - if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype)); - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype); - - MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner); - if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype)); - - /* set new info */ - ADIO_SetInfo(fd, info, &err); - - /* set new etypes and filetypes */ - - ADIOI_Type_get_envelope(etype, &i, &j, &k, &combiner); - if (combiner == MPI_COMBINER_NAMED) fd->etype = etype; - else { - MPI_Type_contiguous(1, etype, ©_etype); - MPI_Type_commit(©_etype); - fd->etype = copy_etype; - } - ADIOI_Type_get_envelope(filetype, &i, &j, &k, &combiner); - if (combiner == MPI_COMBINER_NAMED) - fd->filetype = filetype; - else { - MPI_Type_contiguous(1, filetype, ©_filetype); - MPI_Type_commit(©_filetype); - fd->filetype = copy_filetype; - ADIOI_Flatten_datatype(fd->filetype); - /* this function will not flatten the filetype if it turns out - to be all contiguous. */ - } - - MPI_Type_size_x(fd->etype, &(fd->etype_size)); - fd->disp = disp; - - /* reset MPI-IO file pointer to point to the first byte that can - be accessed in this view. */ - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - if (filetype_is_contig) fd->fp_ind = disp; - else { - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) - flat_file = flat_file->next; - for (i=0; i<flat_file->count; i++) { - if (flat_file->blocklens[i]) { - fd->fp_ind = disp + flat_file->indices[i]; - break; - } - } - } - *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_subarray.c b/3rd-party/romio321/adio/common/ad_subarray.c deleted file mode 100644 index c6eb9450ce64e4ffc0b59b93e5ce7c0919ad93e7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_subarray.c +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -int ADIO_Type_create_subarray(int ndims, - int *array_of_sizes, - int *array_of_subsizes, - int *array_of_starts, - int order, - MPI_Datatype oldtype, - MPI_Datatype *newtype) -{ - MPI_Aint extent, disp, size, lb, ub; - int i, blklen; - MPI_Datatype tmp1, tmp2, inttype; - - MPI_Type_get_extent(oldtype, &lb, &extent); - - if (order == MPI_ORDER_FORTRAN) { - /* dimension 0 changes fastest */ - if (ndims == 1) { - MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); - } - else { - MPI_Type_vector(array_of_subsizes[1], - array_of_subsizes[0], - array_of_sizes[0], oldtype, &tmp1); - - size = (MPI_Aint)array_of_sizes[0]*extent; - for (i=2; i<ndims; i++) { - size *= (MPI_Aint)array_of_sizes[i-1]; - MPI_Type_create_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); - MPI_Type_free(&tmp1); - tmp1 = tmp2; - } - } - - /* add displacement and UB */ - disp = array_of_starts[0]; - size = 1; - for (i=1; i<ndims; i++) { - size *= (MPI_Aint)array_of_sizes[i-1]; - disp += size*(MPI_Aint)array_of_starts[i]; - } - /* rest done below for both Fortran and C order */ - } - - else /* order == MPI_ORDER_C */ { - /* dimension ndims-1 changes fastest */ - if (ndims == 1) { - MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); - } - else { - MPI_Type_vector(array_of_subsizes[ndims-2], - array_of_subsizes[ndims-1], - array_of_sizes[ndims-1], oldtype, &tmp1); - - size = (MPI_Aint)array_of_sizes[ndims-1]*extent; - for (i=ndims-3; i>=0; i--) { - size *= (MPI_Aint)array_of_sizes[i+1]; - MPI_Type_create_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); - MPI_Type_free(&tmp1); - tmp1 = tmp2; - } - } - - /* add displacement and UB */ - disp = array_of_starts[ndims-1]; - size = 1; - for (i=ndims-2; i>=0; i--) { - size *= (MPI_Aint)array_of_sizes[i+1]; - disp += size*(MPI_Aint)array_of_starts[i]; - } - } - - disp *= extent; - - ub = extent; - for (i=0; i<ndims; i++) ub *= (MPI_Aint)array_of_sizes[i]; - - blklen = 1; - - MPI_Type_create_struct(1, &blklen, &disp, &tmp1, &inttype); - MPI_Type_create_resized (inttype, 0, ub, newtype); - MPI_Type_free(&inttype); - - MPI_Type_free(&tmp1); - - return MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/ad_threaded_io.c b/3rd-party/romio321/adio/common/ad_threaded_io.c deleted file mode 100644 index 2436a7a519af605647d7cce7a016992b7ce85214..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_threaded_io.c +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997-2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#include <pthread.h> -/* Function for running in another thread for doing the file reading while the - * main thread is doing data aggregation - useful only when multiple rounds are - * needed due to file size relative to the read buffer size and number of - * aggregators */ - -void *ADIOI_IO_Thread_Func(void *vptr_args) { - ADIOI_IO_ThreadFuncData *args = (ADIOI_IO_ThreadFuncData*)vptr_args; - - ADIOI_Assert(args->size == (int)(args->size)); - - if (args->io_kind == ADIOI_READ) { - ADIO_ReadContig(args->fd, args->buf, args->size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, args->offset, - args->status, &(args->error_code)); - } else { - ADIO_WriteContig(args->fd, args->buf, args->size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, args->offset, - args->status, &(args->error_code)); - } - pthread_exit(&(args->error_code)); - return NULL; -} diff --git a/3rd-party/romio321/adio/common/ad_wait_fake.c b/3rd-party/romio321/adio/common/ad_wait_fake.c deleted file mode 100644 index 16947baa1fb33a69cc0afc34611098042243189b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_wait_fake.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* Generic implementation of ReadComplete/WriteComplete simply sets the - * bytes field in the status structure and frees the request. - * - * Same function is used for both reads and writes. - */ -void ADIOI_FAKE_IOComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) -{ - *error_code = MPI_SUCCESS; - return; -} diff --git a/3rd-party/romio321/adio/common/ad_write.c b/3rd-party/romio321/adio/common/ad_write.c deleted file mode 100644 index d1c24ac45ed4d09ddc08e616d0a780ecf1a75bd1..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_write.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#include "adio.h" -#include <unistd.h> - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -#ifdef ROMIO_GPFS -#include "adio/ad_gpfs/ad_gpfs_tuning.h" -#endif - -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - - -void ADIOI_GEN_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) -{ - ssize_t err = -1; - MPI_Count datatype_size; - ADIO_Offset len, bytes_xfered=0; - size_t wr_count; - static char myname[] = "ADIOI_GEN_WRITECONTIG"; -#ifdef ROMIO_GPFS - double io_time=0; -#endif - char * p; - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5036, 0, NULL); -#endif - - MPI_Type_size_x(datatype, &datatype_size); - len = (ADIO_Offset)datatype_size * (ADIO_Offset)count; - -#ifdef ROMIO_GPFS - io_time = MPI_Wtime(); - if (gpfsmpio_timing) { - gpfsmpio_prof_cw[ GPFSMPIO_CIO_DATA_SIZE ] += len; - } -#endif - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; - } - - p = (char *)buf; - while (bytes_xfered < len) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - wr_count = len - bytes_xfered; - /* Frustrating! FreeBSD and OS X do not like a count larger than 2^31 */ - if (wr_count > INT_MAX) - wr_count = INT_MAX; - -#ifdef ROMIO_GPFS - if (gpfsmpio_devnullio) - err = pwrite(fd->null_fd, p, wr_count, offset+bytes_xfered); - else -#endif - err = pwrite(fd->fd_sys, p, wr_count, offset+bytes_xfered); - /* --BEGIN ERROR HANDLING-- */ - if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - fd->fp_sys_posn = -1; - return; - } - /* --END ERROR HANDLING-- */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - bytes_xfered += err; - p += err; - } - -#ifdef ROMIO_GPFS - if (gpfsmpio_timing) gpfsmpio_prof_cw[ GPFSMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time); -#endif - fd->fp_sys_posn = offset + bytes_xfered; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - fd->fp_ind += bytes_xfered; - } - -#ifdef ROMIO_GPFS - if (gpfsmpio_timing) gpfsmpio_prof_cw[ GPFSMPIO_CIO_T_MPIO_RW ] += (MPI_Wtime() - io_time); -#endif - -#ifdef HAVE_STATUS_SET_BYTES - /* bytes_xfered could be larger than int */ - if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, bytes_xfered); -#endif - - *error_code = MPI_SUCCESS; -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5037, 0, NULL); -#endif -} diff --git a/3rd-party/romio321/adio/common/ad_write_coll.c b/3rd-party/romio321/adio/common/ad_write_coll.c deleted file mode 100644 index 6a2e09771bffc8fcfc93e39d9dacd8dbcd00a482..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_write_coll.c +++ /dev/null @@ -1,1086 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#ifdef AGGREGATION_PROFILE -#include "mpe.h" -#endif - -/* prototypes of functions used for collective writes only. */ -static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, int myrank, - ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code); -static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, - ADIOI_Flatlist_node *flat_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, int size, - int *count, int *start_pos, int *partial_recv, - int *sent_to_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int *hole, int iter, - MPI_Aint buftype_extent, int *buf_idx, int *error_code); -void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent); -void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, - int nprocs, int nprocs_recv, int total_elements); - - -void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ - - ADIOI_Access *my_req; - /* array of nprocs access structures, one for each other process in - whose file domain this process's request lies */ - - ADIOI_Access *others_req; - /* array of nprocs access structures, one for each other process - whose request lies in this process's file domain. */ - - int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int contig_access_count=0, interleave_count = 0, buftype_is_contig; - int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; - ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, - *fd_end = NULL, *end_offsets = NULL; - int *buf_idx = NULL; - ADIO_Offset *len_list = NULL; - int old_error, tmp_error; - - if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { - /* Cast away const'ness as the below function is used for read - * and write */ - ADIOI_IOStridedColl (fd, (char *) buf, count, ADIOI_WRITE, datatype, - file_ptr_type, offset, status, error_code); - return; - } - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - -/* the number of processes that actually perform I/O, nprocs_for_coll, - * is stored in the hints off the ADIO_File structure - */ - nprocs_for_coll = fd->hints->cb_nodes; - orig_fp = fd->fp_ind; - - /* only check for interleaving if cb_write isn't disabled */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - - /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); - - /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets stored - in order of process rank. */ - - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, - ADIO_OFFSET, fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, - ADIO_OFFSET, fd->comm); - - /* are the accesses of different processes interleaved? */ - for (i=1; i<nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) - interleave_count++; - /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - - if (fd->hints->cb_write == ADIOI_HINT_DISABLE || - (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) - { - /* use independent accesses */ - if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - } - - fd->fp_ind = orig_fp; - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - if (buftype_is_contig && filetype_is_contig) { - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; - ADIO_WriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, - off, status, error_code); - } - else ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); - } - else ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); - - return; - } - -/* Divide the I/O workload among "nprocs_for_coll" processes. This is - done by (logically) dividing the file into file domains (FDs); each - process may directly access only its own file domain. */ - - ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, - nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, - fd->hints->min_fdomain_size, &fd_size, - fd->hints->striping_unit); - - -/* calculate what portions of the access requests of this process are - located in what file domains */ - - ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); - -/* based on everyone's my_req, calculate what requests of other - processes lie in this process's file domain. - count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - ADIOI_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, - &count_others_req_procs, &others_req); - - ADIOI_Free(count_my_req_per_proc); - for (i=0; i < nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } - ADIOI_Free(my_req); - -/* exchange data and write in sizes of no more than coll_bufsize. */ - /* Cast away const'ness for the below function */ - ADIOI_Exch_and_write(fd, (char *) buf, datatype, nprocs, myrank, - others_req, offset_list, - len_list, contig_access_count, min_st_offset, - fd_size, fd_start, fd_end, buf_idx, error_code); - - /* If this collective write is followed by an independent write, - * it's possible to have those subsequent writes on other processes - * race ahead and sneak in before the read-modify-write completes. - * We carry out a collective communication at the end here so no one - * can start independent i/o before collective I/O completes. - * - * need to do some gymnastics with the error codes so that if something - * went wrong, all processes report error, but if a process has a more - * specific error code, we can still have that process report the - * additional information */ - - old_error = *error_code; - if (*error_code != MPI_SUCCESS) *error_code = MPI_ERR_IO; - - /* optimization: if only one process performing i/o, we can perform - * a less-expensive Bcast */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_postwrite_a, 0, NULL ); -#endif - if (fd->hints->cb_nodes == 1) - MPI_Bcast(error_code, 1, MPI_INT, - fd->hints->ranklist[0], fd->comm); - else { - tmp_error = *error_code; - MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, - MPI_MAX, fd->comm); - } -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_postwrite_b, 0, NULL ); -#endif -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5012, 0, NULL); -#endif - - if ( (old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO) ) - *error_code = old_error; - - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); - -/* free all memory allocated for collective I/O */ - - for (i=0; i<nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } - ADIOI_Free(others_req); - - ADIOI_Free(buf_idx); - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); - ADIOI_Free(fd_start); - ADIOI_Free(fd_end); - -#ifdef HAVE_STATUS_SET_BYTES - if (status) { - MPI_Count bufsize, size; - /* Don't set status if it isn't needed */ - MPI_Type_size_x(datatype, &size); - bufsize = size * count; - MPIR_Status_set_bytes(status, datatype, bufsize); - } -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written during collective I/O. */ -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5013, 0, NULL); -#endif -} - - - -/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error - * code is created and returned in error_code. - */ -static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, - int myrank, - ADIOI_Access - *others_req, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code) -{ -/* Send data to appropriate processes and write in sizes of no more - than coll_bufsize. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were written all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to write a distributed - array to a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ - - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ - ADIO_Offset size=0; - int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; - ADIO_Offset st_loc=-1, end_loc=-1, off, done, req_off; - char *write_buf=NULL; - int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; - int *partial_recv, *sent_to_proc, *start_pos, flag; - int *send_buf_idx, *curr_to_proc, *done_to_proc; - MPI_Status status; - ADIOI_Flatlist_node *flat_buf=NULL; - MPI_Aint buftype_extent, lb; - int info_flag, coll_bufsize; - char *value; - static char myname[] = "ADIOI_EXCH_AND_WRITE"; - - *error_code = MPI_SUCCESS; /* changed below if error */ - /* only I/O errors are currently reported */ - -/* calculate the number of writes of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. */ - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - coll_bufsize = atoi(value); - ADIOI_Free(value); - - - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - st_loc = others_req[i].offsets[0]; - end_loc = others_req[i].offsets[0]; - break; - } - } - - for (i=0; i < nprocs; i++) - for (j=0; j < others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); - } - -/* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ - - ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); - - if ((st_loc==-1) && (end_loc==-1)) { - ntimes = 0; /* this process does no writing. */ - } - - MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, - fd->comm); - - write_buf = fd->io_buf; - - curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* its use is explained below. calloc initializes to 0. */ - - count = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ - - partial_recv = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* if only a portion of the last off-len pair is recd. from a process - in a particular iteration, the length recd. is stored here. - calloc initializes to 0. */ - - send_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* total size of data to be sent to each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ - - recv_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration.*/ - - sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); - /* amount of data sent to each proc so far. Used in - ADIOI_Fill_send_buffer. initialized to 0 here. */ - - send_buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - curr_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - done_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* Above three are used in ADIOI_Fill_send_buffer*/ - - start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - if (!buftype_is_contig) { - flat_buf = ADIOI_Flatten_and_find(datatype); - } - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - - -/* I need to check if there are any outstanding nonblocking writes to - the file, which could potentially interfere with the writes taking - place in this collective write call. Since this is not likely to be - common, let me do the simplest thing possible here: Each process - completes all pending nonblocking operations before completing. */ - - /*ADIOI_Complete_async(error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Barrier(fd->comm); - */ - - done = 0; - off = st_loc; - - for (m=0; m < ntimes; m++) { - /* go through all others_req and check which will be satisfied - by the current write */ - - /* Note that MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order and that, for writes, the - filetypes cannot specify overlapping regions in the file. This - simplifies implementation a bit compared to reads. */ - - /* off = start offset in the file for the data to be written in - this iteration - size = size of data written (bytes) corresponding to off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ - - /* first calculate what should be communicated */ - - for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0; - - size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); - - for (i=0; i < nprocs; i++) { - if (others_req[i].count) { - start_pos[i] = curr_offlen_ptr[i]; - for (j=curr_offlen_ptr[i]; j<others_req[i].count; j++) { - if (partial_recv[i]) { - /* this request may have been partially - satisfied in the previous iteration. */ - req_off = others_req[i].offsets[j] + - partial_recv[i]; - req_len = others_req[i].lens[j] - - partial_recv[i]; - partial_recv[i] = 0; - /* modify the off-len pair to reflect this change */ - others_req[i].offsets[j] = req_off; - others_req[i].lens[j] = req_len; - } - else { - req_off = others_req[i].offsets[j]; - req_len = others_req[i].lens[j]; - } - if (req_off < off + size) { - count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIU_Upint)(write_buf+req_off-off)); - MPI_Get_address(write_buf+req_off-off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off)); - recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, - (unsigned)req_len)); - - if (off+size-req_off < (unsigned)req_len) - { - partial_recv[i] = (int) (off + size - req_off); - - /* --BEGIN ERROR HANDLING-- */ - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < off+size)) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_ARG, - "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", 0); - /* allow to continue since additional - * communication might have to occur - */ - } - /* --END ERROR HANDLING-- */ - break; - } - } - else break; - } - curr_offlen_ptr[i] = j; - } - } - - ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, curr_to_proc, - done_to_proc, &hole, m, buftype_extent, buf_idx, - error_code); - if (*error_code != MPI_SUCCESS) return; - - flag = 0; - for (i=0; i<nprocs; i++) - if (count[i]) flag = 1; - - if (flag) { - ADIOI_Assert(size == (int)size); - ADIO_WriteContig(fd, write_buf, (int)size, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - off, &status, error_code); - if (*error_code != MPI_SUCCESS) return; - } - - off += size; - done += size; - } - - for (i=0; i<nprocs; i++) count[i] = recv_size[i] = 0; - for (m=ntimes; m<max_ntimes; m++) { - ADIOI_Assert(size == (int)size); - /* nothing to recv, but check for send. */ - ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, - len_list, send_size, recv_size, off, (int)size, count, - start_pos, partial_recv, - sent_to_proc, nprocs, myrank, - buftype_is_contig, contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - others_req, send_buf_idx, - curr_to_proc, done_to_proc, &hole, m, - buftype_extent, buf_idx, error_code); - if (*error_code != MPI_SUCCESS) return; - } - - ADIOI_Free(curr_offlen_ptr); - ADIOI_Free(count); - ADIOI_Free(partial_recv); - ADIOI_Free(send_size); - ADIOI_Free(recv_size); - ADIOI_Free(sent_to_proc); - ADIOI_Free(start_pos); - ADIOI_Free(send_buf_idx); - ADIOI_Free(curr_to_proc); - ADIOI_Free(done_to_proc); -} - - -/* Sets error_code to MPI_SUCCESS if successful, or creates an error code - * in the case of error. - */ -static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, - ADIOI_Flatlist_node *flat_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - int *recv_size, ADIO_Offset off, int size, - int *count, int *start_pos, - int *partial_recv, - int *sent_to_proc, int nprocs, - int myrank, int - buftype_is_contig, int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - ADIOI_Access *others_req, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int *hole, int iter, - MPI_Aint buftype_extent, int *buf_idx, - int *error_code) -{ - int i, j, k, *tmp_len, nprocs_recv, nprocs_send, err; - char **send_buf = NULL; - MPI_Request *requests, *send_req; - MPI_Datatype *recv_types; - MPI_Status *statuses, status; - int *srt_len=NULL, sum; - ADIO_Offset *srt_off=NULL; - static char myname[] = "ADIOI_W_EXCHANGE_DATA"; - -/* exchange recv_size info so that each process knows how much to - send to whom. */ - - MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); - - /* create derived datatypes for recv */ - - nprocs_recv = 0; - for (i=0; i<nprocs; i++) if (recv_size[i]) nprocs_recv++; - - recv_types = (MPI_Datatype *) - ADIOI_Malloc((nprocs_recv+1)*sizeof(MPI_Datatype)); -/* +1 to avoid a 0-size malloc */ - - tmp_len = (int *) ADIOI_Malloc(nprocs*sizeof(int)); - j = 0; - for (i=0; i<nprocs; i++) { - if (recv_size[i]) { -/* take care if the last off-len pair is a partial recv */ - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - tmp_len[i] = others_req[i].lens[k]; - others_req[i].lens[k] = partial_recv[i]; - } - ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, recv_types+j); - /* absolute displacements; use MPI_BOTTOM in recv */ - MPI_Type_commit(recv_types+j); - j++; - } - } - - /* To avoid a read-modify-write, check if there are holes in the - data to be written. For this, merge the (sorted) offset lists - others_req using a heap-merge. */ - - sum = 0; - for (i=0; i<nprocs; i++) sum += count[i]; - /* valgrind-detcted optimization: if there is no work on this process we do - * not need to search for holes */ - if (sum) { - srt_off = (ADIO_Offset *) ADIOI_Malloc(sum*sizeof(ADIO_Offset)); - srt_len = (int *) ADIOI_Malloc(sum*sizeof(int)); - - ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, - nprocs, nprocs_recv, sum); - } - -/* for partial recvs, restore original lengths */ - for (i=0; i<nprocs; i++) - if (partial_recv[i]) { - k = start_pos[i] + count[i] - 1; - others_req[i].lens[k] = tmp_len[i]; - } - ADIOI_Free(tmp_len); - - /* check if there are any holes. If yes, must do read-modify-write. - * holes can be in three places. 'middle' is what you'd expect: the - * processes are operating on noncontigous data. But holes can also show - * up at the beginning or end of the file domain (see John Bent ROMIO REQ - * #835). Missing these holes would result in us writing more data than - * recieved by everyone else. */ - - *hole = 0; - if (sum) { - if (off != srt_off[0]) /* hole at the front */ - *hole = 1; - else { /* coalesce the sorted offset-length pairs */ - for (i=1; i<sum; i++) { - if (srt_off[i] <= srt_off[0] + srt_len[0]) { - /* ok to cast: operating on cb_buffer_size chunks */ - int new_len = (int)srt_off[i] + srt_len[i] - (int)srt_off[0]; - if (new_len > srt_len[0]) srt_len[0] = new_len; - } - else - break; - } - if (i < sum || size != srt_len[0]) /* hole in middle or end */ - *hole = 1; - } - - ADIOI_Free(srt_off); - ADIOI_Free(srt_len); - } - - if (nprocs_recv) { - if (*hole) { - ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, &err); - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) { - *error_code = MPIO_Err_create_code(err, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, - "**ioRMWrdwr", 0); - return; - } - /* --END ERROR HANDLING-- */ - } - } - - nprocs_send = 0; - for (i=0; i < nprocs; i++) if (send_size[i]) nprocs_send++; - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+1)*sizeof(MPI_Request)); - send_req = requests; - } - else { - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); - /* +1 to avoid a 0-size malloc */ - - /* post receives */ - j = 0; - for (i=0; i<nprocs; i++) { - if (recv_size[i]) { - MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, requests+j); - j++; - } - } - send_req = requests + nprocs_recv; - } - -/* post sends. if buftype_is_contig, data can be directly sent from - user buf at location given by buf_idx. else use send_buf. */ - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); -#endif - if (buftype_is_contig) { - j = 0; - for (i=0; i < nprocs; i++) - if (send_size[i]) { - MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, - send_req+j); - j++; - buf_idx[i] += send_size[i]; - } - } - else if (nprocs_send) { - /* buftype is not contig */ - send_buf = (char **) ADIOI_Malloc(nprocs*sizeof(char*)); - for (i=0; i < nprocs; i++) - if (send_size[i]) - send_buf[i] = (char *) ADIOI_Malloc(send_size[i]); - - ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, - offset_list, len_list, send_size, - send_req, - sent_to_proc, nprocs, myrank, - contig_access_count, - min_st_offset, fd_size, fd_start, fd_end, - send_buf_idx, curr_to_proc, done_to_proc, iter, - buftype_extent); - /* the send is done in ADIOI_Fill_send_buffer */ - } - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - j = 0; - for (i=0; i<nprocs; i++) { - MPI_Status wkl_status; - if (recv_size[i]) { - MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, &wkl_status); - j++; - } - } - } - - for (i=0; i<nprocs_recv; i++) MPI_Type_free(recv_types+i); - ADIOI_Free(recv_types); - - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - } - else { - statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ - sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ - } - -#ifdef NEEDS_MPI_TEST - i = 0; - if (fd->atomicity) { - /* bug fix from Wei-keng Liao and Kenin Coloma */ - while (!i) MPI_Testall(nprocs_send, send_req, &i, statuses); - } - else { - while (!i) MPI_Testall(nprocs_send+nprocs_recv, requests, &i, statuses); - } -#else - if (fd->atomicity) - /* bug fix from Wei-keng Liao and Kenin Coloma */ - MPI_Waitall(nprocs_send, send_req, statuses); - else - MPI_Waitall(nprocs_send+nprocs_recv, requests, statuses); -#endif - -#ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); -#endif - ADIOI_Free(statuses); - ADIOI_Free(requests); - if (!buftype_is_contig && nprocs_send) { - for (i=0; i < nprocs; i++) - if (send_size[i]) ADIOI_Free(send_buf[i]); - ADIOI_Free(send_buf); - } -} - -#define ADIOI_BUF_INCR \ -{ \ - while (buf_incr) { \ - size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - buf_incr -= size_in_buf; \ - } \ -} - - -#define ADIOI_BUF_COPY \ -{ \ - while (size) { \ - size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \ - ADIOI_Assert((ADIO_Size) size_in_buf == (size_t)size_in_buf); \ - memcpy(&(send_buf[p][send_buf_idx[p]]), \ - ((char *) buf) + user_buf_idx, size_in_buf); \ - send_buf_idx[p] += size_in_buf; \ - user_buf_idx += size_in_buf; \ - flat_buf_sz -= size_in_buf; \ - if (!flat_buf_sz) { \ - if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ - else { \ - flat_buf_idx = 0; \ - n_buftypes++; \ - } \ - user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ - flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ - } \ - size -= size_in_buf; \ - buf_incr -= size_in_buf; \ - } \ - ADIOI_BUF_INCR \ -} - - - - - -void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, - ADIO_Offset min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent) -{ -/* this function is only called if buftype is not contig */ - - int i, p, flat_buf_idx; - ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; - int jj, n_buftypes; - ADIO_Offset off, len, rem_len, user_buf_idx; - -/* curr_to_proc[p] = amount of data sent to proc. p that has already - been accounted for so far - done_to_proc[p] = amount of data already sent to proc. p in - previous iterations - user_buf_idx = current location in user buffer - send_buf_idx[p] = current location in send_buf of proc. p */ - - for (i=0; i < nprocs; i++) { - send_buf_idx[i] = curr_to_proc[i] = 0; - done_to_proc[i] = sent_to_proc[i]; - } - jj = 0; - - user_buf_idx = flat_buf->indices[0]; - flat_buf_idx = 0; - n_buftypes = 0; - flat_buf_sz = flat_buf->blocklens[0]; - - /* flat_buf_idx = current index into flattened buftype - flat_buf_sz = size of current contiguous component in - flattened buf */ - - for (i=0; i<contig_access_count; i++) { - off = offset_list[i]; - rem_len = len_list[i]; - - /*this request may span the file domains of more than one process*/ - while (rem_len != 0) { - len = rem_len; - /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no - * longer than the single region that processor "p" is responsible - * for. - */ - p = ADIOI_Calc_aggregator(fd, - off, - min_st_offset, - &len, - fd_size, - fd_start, - fd_end); - - if (send_buf_idx[p] < send_size[p]) { - if (curr_to_proc[p]+len > done_to_proc[p]) { - if (done_to_proc[p] > curr_to_proc[p]) { - size = ADIOI_MIN(curr_to_proc[p] + len - - done_to_proc[p], send_size[p]-send_buf_idx[p]); - buf_incr = done_to_proc[p] - curr_to_proc[p]; - ADIOI_BUF_INCR - ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); - buf_incr = curr_to_proc[p] + len - done_to_proc[p]; - ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); - /* ok to cast: bounded by cb buffer size */ - curr_to_proc[p] = done_to_proc[p] + (int)size; - ADIOI_BUF_COPY - } - else { - size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); - buf_incr = len; - ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); - curr_to_proc[p] += size; - ADIOI_BUF_COPY - } - if (send_buf_idx[p] == send_size[p]) { - MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, - myrank+p+100*iter, fd->comm, requests+jj); - jj++; - } - } - else { - ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); - curr_to_proc[p] += len; - buf_incr = len; - ADIOI_BUF_INCR - } - } - else { - buf_incr = len; - ADIOI_BUF_INCR - } - off += len; - rem_len -= len; - } - } - for (i=0; i < nprocs; i++) - if (send_size[i]) sent_to_proc[i] = curr_to_proc[i]; -} - - - -void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, - int nprocs, int nprocs_recv, int total_elements) -{ - typedef struct { - ADIO_Offset *off_list; - ADIO_Offset *len_list; - int nelem; - } heap_struct; - - heap_struct *a, tmp; - int i, j, heapsize, l, r, k, smallest; - - a = (heap_struct *) ADIOI_Malloc((nprocs_recv+1)*sizeof(heap_struct)); - - j = 0; - for (i=0; i<nprocs; i++) - if (count[i]) { - a[j].off_list = &(others_req[i].offsets[start_pos[i]]); - a[j].len_list = &(others_req[i].lens[start_pos[i]]); - a[j].nelem = count[i]; - j++; - } - - /* build a heap out of the first element from each list, with - the smallest element of the heap at the root */ - - heapsize = nprocs_recv; - for (i=heapsize/2 - 1; i>=0; i--) { - /* Heapify(a, i, heapsize); Algorithm from Cormen et al. pg. 143 - modified for a heap with smallest element at root. I have - removed the recursion so that there are no function calls. - Function calls are too expensive. */ - k = i; - for(;;) { - l = 2*(k+1) - 1; - r = 2*(k+1); - - if ((l < heapsize) && - (*(a[l].off_list) < *(a[k].off_list))) - smallest = l; - else smallest = k; - - if ((r < heapsize) && - (*(a[r].off_list) < *(a[smallest].off_list))) - smallest = r; - - if (smallest != k) { - tmp.off_list = a[k].off_list; - tmp.len_list = a[k].len_list; - tmp.nelem = a[k].nelem; - - a[k].off_list = a[smallest].off_list; - a[k].len_list = a[smallest].len_list; - a[k].nelem = a[smallest].nelem; - - a[smallest].off_list = tmp.off_list; - a[smallest].len_list = tmp.len_list; - a[smallest].nelem = tmp.nelem; - - k = smallest; - } - else break; - } - } - - for (i=0; i<total_elements; i++) { - /* extract smallest element from heap, i.e. the root */ - srt_off[i] = *(a[0].off_list); - srt_len[i] = *(a[0].len_list); - (a[0].nelem)--; - - if (!a[0].nelem) { - a[0].off_list = a[heapsize-1].off_list; - a[0].len_list = a[heapsize-1].len_list; - a[0].nelem = a[heapsize-1].nelem; - heapsize--; - } - else { - (a[0].off_list)++; - (a[0].len_list)++; - } - - /* Heapify(a, 0, heapsize); */ - k = 0; - for (;;) { - l = 2*(k+1) - 1; - r = 2*(k+1); - - if ((l < heapsize) && - (*(a[l].off_list) < *(a[k].off_list))) - smallest = l; - else smallest = k; - - if ((r < heapsize) && - (*(a[r].off_list) < *(a[smallest].off_list))) - smallest = r; - - if (smallest != k) { - tmp.off_list = a[k].off_list; - tmp.len_list = a[k].len_list; - tmp.nelem = a[k].nelem; - - a[k].off_list = a[smallest].off_list; - a[k].len_list = a[smallest].len_list; - a[k].nelem = a[smallest].nelem; - - a[smallest].off_list = tmp.off_list; - a[smallest].len_list = tmp.len_list; - a[smallest].nelem = tmp.nelem; - - k = smallest; - } - else break; - } - } - ADIOI_Free(a); -} diff --git a/3rd-party/romio321/adio/common/ad_write_nolock.c b/3rd-party/romio321/adio/common/ad_write_nolock.c deleted file mode 100644 index 7532a499b9e5ad9db45294491c055c744b26d3b2..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_write_nolock.c +++ /dev/null @@ -1,406 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#include "adio.h" -#include "adio_extern.h" -#include <unistd.h> - - -/* #define IO_DEBUG 1 */ -void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ -/* borrowed from old-school PVFS (v1) code. A driver for file systems that - * cannot or do not support client-side buffering - * Does not do data sieving optimization - * Does contain write-combining optimization for noncontig in memory, contig in - * file - */ - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - int j, k, st_index=0; - off_t err_lseek=-1; - ssize_t err=-1; - ADIO_Offset fwr_size=0, bwr_size, new_bwr_size, new_fwr_size, i_offset, num; - ADIO_Offset bufsize, n_etypes_in_filetype; - ADIO_Offset n_filetypes, etype_in_filetype, size, sum; - ADIO_Offset abs_off_in_filetype=0, size_in_filetype; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, indx, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset off, disp; - int flag, err_flag=0; - static char myname[] = "ADIOI_NOLOCK_WRITESTRIDED"; -#ifdef IO_DEBUG - int rank,nprocs; -#endif - - /* --BEGIN ERROR HANDLING-- */ - if (fd->atomicity) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_INTERN, - "Atomic mode set in I/O function", 0); - return; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - -#ifdef IO_DEBUG - MPI_Comm_rank(fd->comm, &rank); - MPI_Comm_size(fd->comm, &nprocs); -#endif - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - - if (!buftype_is_contig && filetype_is_contig) { - char *combine_buf, *combine_buf_ptr; - ADIO_Offset combine_buf_remain; -/* noncontiguous in memory, contiguous in file. use writev */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - /* allocate our "combine buffer" to pack data into before writing */ - combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size); - combine_buf_ptr = combine_buf; - combine_buf_remain = fd->hints->ind_wr_buffer_size; - - /* seek to the right spot in the file */ - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + etype_size * offset; - lseek(fd->fd_sys, off, SEEK_SET); - } - else off = lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - - /* loop through all the flattened pieces. combine into buffer until - * no more will fit, then write. - * - * special case of a given piece being bigger than the combine buffer - * is also handled. - */ - for (j=0; j<count; j++) { - int i; - for (i=0; i<flat_buf->count; i++) { - if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) { - /* there is data in the buffer; write out the buffer so far */ -#ifdef IO_DEBUG - printf("[%d/%d] nc mem c file (0) writing loc = %Ld sz = %Ld\n", - rank, nprocs, off, - fd->hints->ind_wr_buffer_size-combine_buf_remain); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, - combine_buf, - fd->hints->ind_wr_buffer_size - combine_buf_remain); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - - /* reset our buffer info */ - combine_buf_ptr = combine_buf; - combine_buf_remain = fd->hints->ind_wr_buffer_size; - } - - /* TODO: heuristic for when to not bother to use combine buffer? */ - if (flat_buf->blocklens[i] >= combine_buf_remain) { - /* special case: blocklen is as big as or bigger than the combine buf; - * write directly - */ -#ifdef IO_DEBUG - printf("[%d/%d] nc mem c file (1) writing loc = %Ld sz = %d\n", - rank, nprocs, off, - flat_buf->blocklens[i]); -#endif - ADIOI_Assert(flat_buf->blocklens[i] == (unsigned)flat_buf->blocklens[i]); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]) == (ADIO_Offset)((MPIU_Upint)buf + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i])); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, - ((char *) buf) + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i], - (unsigned)flat_buf->blocklens[i]); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ - } - else { - /* copy more data into combine buffer */ - memcpy(combine_buf_ptr, - ((char *) buf) + j*buftype_extent + flat_buf->indices[i], - flat_buf->blocklens[i]); - combine_buf_ptr += flat_buf->blocklens[i]; - combine_buf_remain -= flat_buf->blocklens[i]; - off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ - } - } - } - - if (combine_buf_ptr != combine_buf) { - /* data left in buffer to write */ -#ifdef IO_DEBUG - printf("[%d/%d] nc mem c file (2) writing loc = %Ld sz = %Ld\n", - rank, nprocs, off, - fd->hints->ind_wr_buffer_size-combine_buf_remain); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - err = write(fd->fd_sys, - combine_buf, - fd->hints->ind_wr_buffer_size - combine_buf_remain); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - ADIOI_Free(combine_buf); - - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } /* if (!buftype_is_contig && filetype_is_contig) ... */ - - else { /* noncontiguous in file */ - -/* split up into several contiguous writes */ - -/* find starting location in the file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - int i; - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - if (disp + flat_file->indices[i] + - n_filetypes*(ADIO_Offset)filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - fwr_size = disp + flat_file->indices[i] + - n_filetypes*(ADIO_Offset)filetype_extent - + flat_file->blocklens[i] - offset; - flag = 1; - break; - } - } - } - } - else { - int i; - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + n_filetypes*(ADIO_Offset)filetype_extent + abs_off_in_filetype; - } - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i_offset = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(fwr_size, bufsize); - while (i_offset < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); -#endif -#ifdef IO_DEBUG - printf("[%d/%d] c mem nc file writing loc = %Ld sz = %d\n", - rank, nprocs, off, fwr_size); -#endif - err_lseek = lseek(fd->fd_sys, off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); -#endif - if (err_lseek == -1) err_flag = 1; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); -#endif - err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); -#endif - if (err == -1) err_flag = 1; - } - i_offset += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - indx = flat_buf->indices[0]; - j = st_index; - off = offset; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { -#ifdef IO_DEBUG - printf("[%d/%d] nc mem nc file writing loc = %Ld sz = %d\n", - rank, nprocs, off, size); -#endif -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); -#endif - lseek(fd->fd_sys, off, SEEK_SET); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); -#endif - ADIOI_Assert((ADIO_Size) size == (size_t) size); - ADIOI_Assert(off == (off_t) off); - err = write(fd->fd_sys, ((char *) buf) + indx, size); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); -#endif - if (err == -1) err_flag = 1; - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - indx += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - indx = buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - if (err_flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(errno)); - } - else *error_code = MPI_SUCCESS; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -} diff --git a/3rd-party/romio321/adio/common/ad_write_str.c b/3rd-party/romio321/adio/common/ad_write_str.c deleted file mode 100644 index 83f2420ddc9b1a3ed1a15d76e55042da2a0beed9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_write_str.c +++ /dev/null @@ -1,486 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -#define ADIOI_BUFFERED_WRITE \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - if (writebuf_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - goto fn_exit; \ - } \ - } \ - writebuf_off = req_off; \ - writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowsrc", 0); \ - goto fn_exit; \ - } \ - } \ - write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - goto fn_exit; \ - } \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowsrc", 0); \ - goto fn_exit; \ - } \ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} - - -/* this macro is used when filetype is contig and buftype is not contig. - it does not do a read-modify-write and does not lock*/ -#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ -{ \ - if (req_off >= writebuf_off + writebuf_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - goto fn_exit; \ - } \ - writebuf_off = req_off; \ - writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - } \ - write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ - ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ - memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ - while (write_sz != req_len) { \ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ - ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) { \ - *error_code = MPIO_Err_create_code(*error_code, \ - MPIR_ERR_RECOVERABLE, myname, \ - __LINE__, MPI_ERR_IO, \ - "**iowswc", 0); \ - goto fn_exit; \ - } \ - req_len -= write_sz; \ - userbuf_off += write_sz; \ - writebuf_off += writebuf_len; \ - writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ - write_sz = ADIOI_MIN(req_len, writebuf_len); \ - memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ - } \ -} -void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - -/* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - ADIO_Offset i_offset, sum, size_in_filetype; - int i, j, k, st_index=0; - ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; - ADIO_Offset n_etypes_in_filetype, abs_off_in_filetype=0; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; - char *writebuf=NULL; - unsigned writebuf_len, max_bufsize, write_sz; - MPI_Aint bufsize; - ADIO_Status status1; - ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len; - static char myname[] = "ADIOI_GEN_WriteStrided"; - - if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { - /* if user has disabled data sieving on reads, use naive - * approach instead. - */ - - ADIOI_GEN_WriteStrided_naive(fd, - buf, - count, - datatype, - file_ptr_type, - offset, - status, - error_code); - return; - } - - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(datatype, &buftype_size); - MPI_Type_get_extent(datatype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((MPI_Count)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - -/* get max_bufsize from the info object. */ - - max_bufsize = fd->hints->ind_wr_buffer_size; - - if (!buftype_is_contig && filetype_is_contig) { - -/* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - writebuf_off = off; - writebuf = (char *) ADIOI_Malloc(max_bufsize); - writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-writebuf_off+1)); - -/* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - for (j=0; j<count; j++) - { - for (i=0; i<flat_buf->count; i++) { - userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_WRITE_WITHOUT_READ - off += flat_buf->blocklens[i]; - } - } - - /* write the buffer out finally */ - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - writebuf_off, &status1, error_code); - - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (*error_code != MPI_SUCCESS) goto fn_exit; - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - } - - else { /* noncontiguous in file */ - -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* Wei-keng reworked type processing to be a bit more efficient */ - offset = fd->fp_ind - disp; - n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; - offset -= (ADIO_Offset)n_filetypes * filetype_extent; - /* now offset is local to this extent */ - - /* find the block where offset is located, skip blocklens[i]==0 */ - for (i=0; i<flat_file->count; i++) { - ADIO_Offset dist; - if (flat_file->blocklens[i] == 0) continue; - dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; - /* fwr_size is from offset to the end of block i */ - if (dist == 0) { - i++; - offset = flat_file->indices[i]; - fwr_size = flat_file->blocklens[i]; - break; - } - if (dist > 0) { - fwr_size = dist; - break; - } - } - st_index = i; /* starting index in flat_file->indices[] */ - offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - st_index = i; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + - abs_off_in_filetype; - } - - start_off = offset; - - /* Wei-keng Liao:write request is within single flat_file contig block*/ - /* this could happen, for example, with subarray types that are - * actually fairly contiguous */ - if (buftype_is_contig && bufsize <= fwr_size) { - /* though MPI api has an integer 'count' parameter, derived - * datatypes might describe more bytes than can fit into an integer. - * if we've made it this far, we can pass a count of original - * datatypes, instead of a count of bytes (which might overflow) - * Other WriteContig calls in this path are operating on data - * sieving buffer */ - ADIO_WriteContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, error_code); - - if (file_ptr_type == ADIO_INDIVIDUAL) { - /* update MPI-IO file pointer to point to the first byte - * that can be accessed in the fileview. */ - fd->fp_ind = offset + bufsize; - if (bufsize == fwr_size) { - do { - st_index++; - if (st_index == flat_file->count) { - st_index = 0; - n_filetypes++; - } - } while (flat_file->blocklens[st_index] == 0); - fd->fp_ind = disp + flat_file->indices[st_index] - + (ADIO_Offset)n_filetypes*filetype_extent; - } - } - fd->fp_sys_posn = -1; /* set it to null. */ -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, bufsize); -#endif - goto fn_exit; - } - - /* Calculate end_offset, the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ - - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - i_offset = 0; - j = st_index; - off = offset; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i_offset < bufsize) { - i_offset += fwr_size; - end_offset = off + fwr_size - 1; - - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); - } - -/* if atomicity is true, lock the region to be accessed */ - if (fd->atomicity) - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - writebuf_off = 0; - writebuf_len = 0; - writebuf = (char *) ADIOI_Malloc(max_bufsize); - memset(writebuf, -1, max_bufsize); - - if (buftype_is_contig && !filetype_is_contig) { - -/* contiguous in memory, noncontiguous in file. should be the most - common case. */ - - i_offset = 0; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i_offset < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size);*/ - - req_off = off; - req_len = fwr_size; - userbuf_off = i_offset; - ADIOI_BUFFERED_WRITE - } - i_offset += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) - off += fwr_size; - /* did not reach end of contiguous block in filetype. - no more I/O needed. off is incremented by fwr_size. */ - else { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], - bufsize-i_offset); - } - } - } - else { -/* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(datatype); - - k = num = buf_count = 0; - i_offset = flat_buf->indices[0]; - j = st_index; - off = offset; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - - while (num < bufsize) { - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { - /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ - - req_off = off; - req_len = size; - userbuf_off = i_offset; - ADIOI_BUFFERED_WRITE - } - - new_fwr_size = fwr_size; - new_bwr_size = bwr_size; - - if (size == fwr_size) { -/* reached end of contiguous block in file */ - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - while (flat_file->blocklens[j]==0) { - j = (j+1) % flat_file->count; - n_filetypes += (j == 0) ? 1 : 0; - } - - off = disp + flat_file->indices[j] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_fwr_size = flat_file->blocklens[j]; - if (size != bwr_size) { - i_offset += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { -/* reached end of contiguous block in memory */ - - k = (k + 1)%flat_buf->count; - buf_count++; - i_offset = (ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + - flat_buf->indices[k]; - new_bwr_size = flat_buf->blocklens[k]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - num += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - /* write the buffer out finally */ - if (writebuf_len) { - ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, - writebuf_off, &status1, error_code); - if (!(fd->atomicity)) - ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); - if (*error_code != MPI_SUCCESS) goto fn_exit; - } - if (fd->atomicity) - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - } - - fd->fp_sys_posn = -1; /* set it to null. */ - -#ifdef HAVE_STATUS_SET_BYTES - /* datatypes returning negagive values, probably related to tt 1893 */ - MPIR_Status_set_bytes(status, datatype, bufsize); -/* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); -fn_exit: - if (writebuf != NULL) ADIOI_Free(writebuf); -} - diff --git a/3rd-party/romio321/adio/common/ad_write_str_naive.c b/3rd-party/romio321/adio/common/ad_write_str_naive.c deleted file mode 100644 index 4ab4920bc168f2b277c6c7be40d94708590c4ce4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/ad_write_str_naive.c +++ /dev/null @@ -1,379 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count, - MPI_Datatype buftype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) -{ - /* offset is in units of etype relative to the filetype. */ - - ADIOI_Flatlist_node *flat_buf, *flat_file; - /* bwr == buffer write; fwr == file write */ - ADIO_Offset bwr_size, fwr_size=0, sum, size_in_filetype; - int b_index; - MPI_Count bufsize; - ADIO_Offset n_etypes_in_filetype; - ADIO_Offset size, n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0, req_len; - MPI_Count filetype_size, etype_size, buftype_size; - MPI_Aint filetype_extent, buftype_extent, lb; - int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; - ADIO_Offset off, req_off, disp, end_offset=0, start_off; - ADIO_Status status1; - - *error_code = MPI_SUCCESS; /* changed below if error */ - - ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - - MPI_Type_size_x(fd->filetype, &filetype_size); - if ( ! filetype_size ) { -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, buftype, 0); -#endif - *error_code = MPI_SUCCESS; - return; - } - - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - MPI_Type_size_x(buftype, &buftype_size); - MPI_Type_get_extent(buftype, &lb, &buftype_extent); - etype_size = fd->etype_size; - - ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); - bufsize = buftype_size * count; - - /* contiguous in buftype and filetype is handled elsewhere */ - - if (!buftype_is_contig && filetype_is_contig) { - int b_count; - /* noncontiguous in memory, contiguous in file. */ - - flat_buf = ADIOI_Flatten_and_find(buftype); - - off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + (ADIO_Offset)etype_size * offset; - - start_off = off; - end_offset = off + bufsize - 1; - - /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - /* for each region in the buffer, grab the data and put it in - * place - */ - for (b_count=0; b_count < count; b_count++) { - for (b_index=0; b_index < flat_buf->count; b_index++) { - userbuf_off = (ADIO_Offset)b_count*(ADIO_Offset)buftype_extent + - flat_buf->indices[b_index]; - req_off = off; - req_len = flat_buf->blocklens[b_index]; - - ADIOI_Assert(req_len == (int) req_len); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIO_WriteContig(fd, - (char *) buf + userbuf_off, - (int)req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - - /* off is (potentially) used to save the final offset later */ - off += flat_buf->blocklens[b_index]; - } - } - - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - - } - - else { /* noncontiguous in file */ - int f_index, st_index = 0; - ADIO_Offset st_fwr_size, st_n_filetypes; - int flag; - - /* First we're going to calculate a set of values for use in all - * the noncontiguous in file cases: - * start_off - starting byte position of data in file - * end_offset - last byte offset to be acessed in the file - * st_n_filetypes - how far into the file we start in terms of - * whole filetypes - * st_index - index of block in first filetype that we will be - * starting in (?) - * st_fwr_size - size of the data in the first filetype block - * that we will write (accounts for being part-way - * into writing this block of the filetype - * - */ - - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - disp = fd->disp; - - if (file_ptr_type == ADIO_INDIVIDUAL) { - start_off = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (f_index=0; f_index < flat_file->count; f_index++) { - if (disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent + - flat_file->blocklens[f_index] >= start_off) - { - /* this block contains our starting position */ - - st_index = f_index; - fwr_size = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent + - flat_file->blocklens[f_index] - start_off; - flag = 1; - break; - } - } - } - } - else { - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (f_index=0; f_index < flat_file->count; f_index++) { - sum += flat_file->blocklens[f_index]; - if (sum > size_in_filetype) { - st_index = f_index; - fwr_size = sum - size_in_filetype; - abs_off_in_filetype = flat_file->indices[f_index] + - size_in_filetype - - (sum - flat_file->blocklens[f_index]); - break; - } - } - - /* abs. offset in bytes in the file */ - start_off = disp + n_filetypes*(ADIO_Offset)filetype_extent + - abs_off_in_filetype; - } - - st_fwr_size = fwr_size; - st_n_filetypes = n_filetypes; - - /* start_off, st_n_filetypes, st_index, and st_fwr_size are - * all calculated at this point - */ - - /* Calculate end_offset, the last byte-offset that will be accessed. - * e.g., if start_off=0 and 100 bytes to be written, end_offset=99 - */ - userbuf_off = 0; - f_index = st_index; - off = start_off; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (userbuf_off < bufsize) { - userbuf_off += fwr_size; - end_offset = off + fwr_size - 1; - - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(unsigned)userbuf_off); - } - - /* End of calculations. At this point the following values have - * been calculated and are ready for use: - * - start_off - * - end_offset - * - st_n_filetypes - * - st_index - * - st_fwr_size - */ - - /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (buftype_is_contig && !filetype_is_contig) { - /* contiguous in memory, noncontiguous in file. should be the - * most common case. - */ - - userbuf_off = 0; - f_index = st_index; - off = start_off; - n_filetypes = st_n_filetypes; - fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - - /* while there is still space in the buffer, write more data */ - while (userbuf_off < bufsize) { - if (fwr_size) { - /* TYPE_UB and TYPE_LB can result in - fwr_size = 0. save system call in such cases */ - req_off = off; - req_len = fwr_size; - - ADIOI_Assert(req_len == (int) req_len); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIO_WriteContig(fd, - (char *) buf + userbuf_off, - (int)req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - } - userbuf_off += fwr_size; - - if (off + fwr_size < disp + flat_file->indices[f_index] + - flat_file->blocklens[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent) - { - /* important that this value be correct, as it is - * used to set the offset in the fd near the end of - * this function. - */ - off += fwr_size; - } - /* did not reach end of contiguous block in filetype. - * no more I/O needed. off is incremented by fwr_size. - */ - else { - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(unsigned)userbuf_off); - } - } - } - else { - ADIO_Offset i_offset, tmp_bufsize = 0; - /* noncontiguous in memory as well as in file */ - - flat_buf = ADIOI_Flatten_and_find(buftype); - - b_index = buf_count = 0; - i_offset = flat_buf->indices[0]; - f_index = st_index; - off = start_off; - n_filetypes = st_n_filetypes; - fwr_size = st_fwr_size; - bwr_size = flat_buf->blocklens[0]; - - /* while we haven't read size * count bytes, keep going */ - while (tmp_bufsize < bufsize) { - ADIO_Offset new_bwr_size = bwr_size, new_fwr_size = fwr_size; - - size = ADIOI_MIN(fwr_size, bwr_size); - if (size) { - req_off = off; - req_len = size; - userbuf_off = i_offset; - - ADIOI_Assert(req_len == (int) req_len); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + userbuf_off)); - ADIO_WriteContig(fd, - (char *) buf + userbuf_off, - (int)req_len, - MPI_BYTE, - ADIO_EXPLICIT_OFFSET, - req_off, - &status1, - error_code); - if (*error_code != MPI_SUCCESS) return; - } - - if (size == fwr_size) { - /* reached end of contiguous block in file */ - if (f_index < (flat_file->count - 1)) f_index++; - else { - f_index = 0; - n_filetypes++; - } - - off = disp + flat_file->indices[f_index] + - n_filetypes*(ADIO_Offset)filetype_extent; - - new_fwr_size = flat_file->blocklens[f_index]; - if (size != bwr_size) { - i_offset += size; - new_bwr_size -= size; - } - } - - if (size == bwr_size) { - /* reached end of contiguous block in memory */ - - b_index = (b_index + 1)%flat_buf->count; - buf_count++; - i_offset = (ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + - flat_buf->indices[b_index]; - new_bwr_size = flat_buf->blocklens[b_index]; - if (size != fwr_size) { - off += size; - new_fwr_size -= size; - } - } - tmp_bufsize += size; - fwr_size = new_fwr_size; - bwr_size = new_bwr_size; - } - } - - /* unlock the file region if we locked it */ - if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) - { - ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); - } - - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - } /* end of (else noncontiguous in file) */ - - fd->fp_sys_posn = -1; /* mark it as invalid. */ - -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, buftype, bufsize); - /* This is a temporary way of filling in status. The right way is to - * keep track of how much data was actually written and placed in buf - */ -#endif - - if (!buftype_is_contig) ADIOI_Delete_flattened(buftype); -} diff --git a/3rd-party/romio321/adio/common/adi_close.c b/3rd-party/romio321/adio/common/adi_close.c deleted file mode 100644 index cdc18737850978a526a9846bc98503ec2ca64787..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/adi_close.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - - - -void ADIOI_GEN_Close(ADIO_File fd, int *error_code) -{ - int err, derr=0; - static char myname[] = "ADIOI_GEN_CLOSE"; - -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); -#endif - err = close(fd->fd_sys); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); -#endif - if (fd->fd_direct >= 0) { -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); -#endif - derr = close(fd->fd_direct); -#ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); -#endif - } - - fd->fd_sys = -1; - fd->fd_direct = -1; - - if (err == -1 || derr == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; -} diff --git a/3rd-party/romio321/adio/common/async_list.c b/3rd-party/romio321/adio/common/async_list.c deleted file mode 100644 index 239dbe587bae0069026cf0e2c675d6bf4fe8fbb3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/async_list.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -ADIOI_Async_node *ADIOI_Malloc_async_node(void) -{ -/* returns a pointer to a new node that can be added to ADIOI_Async_list. - To reduce the number of system calls, mallocs NUM nodes at a time - and maintains list of available nodes. Supplies a node from this - list if available, else mallocs a new set of NUM and provides one - from that set. Is NUM=100 a good number? */ - -#define NUM 100 - - ADIOI_Async_node *curr, *ptr; - int i; - - if (!ADIOI_Async_avail_head) { - ADIOI_Async_avail_head = (ADIOI_Async_node *) - ADIOI_Malloc(NUM*sizeof(ADIOI_Async_node)); - curr = ADIOI_Async_avail_head; - for (i=1; i<NUM; i++) { - curr->next = ADIOI_Async_avail_head+i; - curr = curr->next; - } - curr->next = NULL; - ADIOI_Async_avail_tail = curr; - - /* keep track of malloced area that needs to be freed later */ - if (!ADIOI_Malloc_async_tail) { - ADIOI_Malloc_async_tail = (ADIOI_Malloc_async *) - ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); - ADIOI_Malloc_async_head = ADIOI_Malloc_async_tail; - ADIOI_Malloc_async_head->ptr = ADIOI_Async_avail_head; - ADIOI_Malloc_async_head->next = NULL; - } - else { - ADIOI_Malloc_async_tail->next = (ADIOI_Malloc_async *) - ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); - ADIOI_Malloc_async_tail = ADIOI_Malloc_async_tail->next; - ADIOI_Malloc_async_tail->ptr = ADIOI_Async_avail_head; - ADIOI_Malloc_async_tail->next = NULL; - } - } - - ptr = ADIOI_Async_avail_head; - ADIOI_Async_avail_head = ADIOI_Async_avail_head->next; - if (!ADIOI_Async_avail_head) ADIOI_Async_avail_tail = NULL; - - return ptr; -} - - -void ADIOI_Free_async_node(ADIOI_Async_node *node) -{ -/* moves this node to available pool. does not actually free it. */ - - if (!ADIOI_Async_avail_tail) - ADIOI_Async_avail_head = ADIOI_Async_avail_tail = node; - else { - ADIOI_Async_avail_tail->next = node; - ADIOI_Async_avail_tail = node; - } - node->next = NULL; -} - - -void ADIOI_Add_req_to_list(ADIO_Request *request) -{ -/* add request to list of outstanding requests */ - - ADIOI_Async_node *curr; - - if (!ADIOI_Async_list_head) { - ADIOI_Async_list_head = ADIOI_Malloc_async_node(); - ADIOI_Async_list_head->request = request; - ADIOI_Async_list_head->prev = ADIOI_Async_list_head->next = NULL; - ADIOI_Async_list_tail = ADIOI_Async_list_head; - (*request)->ptr_in_async_list = ADIOI_Async_list_head; - } - else { - curr = ADIOI_Async_list_tail; - curr->next = ADIOI_Malloc_async_node(); - ADIOI_Async_list_tail = curr->next; - ADIOI_Async_list_tail->request = request; - ADIOI_Async_list_tail->prev = curr; - ADIOI_Async_list_tail->next = NULL; - (*request)->ptr_in_async_list = ADIOI_Async_list_tail; - } -} - -/* Sets error_code to MPI_SUCCESS on success, creates an error code on - * failure. - */ -void ADIOI_Complete_async(int *error_code) -{ -/* complete all outstanding async I/O operations so that new ones can be - initiated. Remove them all from async_list. */ - - ADIO_Status status; - ADIO_Request *request; - ADIOI_Async_node *tmp; - static char myname[] = "ADIOI_Complete_async"; - - *error_code = MPI_SUCCESS; - - while (ADIOI_Async_list_head) { - request = ADIOI_Async_list_head->request; - (*request)->queued = -1; /* ugly internal hack that prevents - ADIOI_xxxComplete from freeing the request object. - This is required, because the user will call MPI_Wait - later, which would require status to be filled. */ - switch ((*request)->optype) { - case ADIOI_READ: -/* (*((*request)->fd->fns->ADIOI_xxx_ReadComplete))(request, - &status,error_code);*/ - ADIO_ReadComplete(request, &status, error_code); - break; - case ADIOI_WRITE: -/* (*((*request)->fd->fns->ADIOI_xxx_WriteComplete))(request, - &status, error_code);*/ - ADIO_WriteComplete(request, &status, error_code); - break; - default: - /* --BEGIN ERROR HANDLING-- */ - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_INTERN, - "Unknown request optype", 0); - return; - /* --END ERROR HANDLING-- */ - } - (*request)->queued = 0; /* dequeued, but request object not - freed */ - - tmp = ADIOI_Async_list_head; - ADIOI_Async_list_head = ADIOI_Async_list_head->next; - ADIOI_Free_async_node(tmp); - } - ADIOI_Async_list_tail = NULL; -} - - -void ADIOI_Del_req_from_list(ADIO_Request *request) -{ -/* Delete a request that has already been completed from the async - list and move it to the list of available nodes. Typically called - from within an ADIO_Test/ADIO_Wait. */ - - ADIOI_Async_node *curr, *prev, *next; - - curr = (*request)->ptr_in_async_list; - prev = curr->prev; - - if (prev) prev->next = curr->next; - else ADIOI_Async_list_head = curr->next; - - next = curr->next; - if (next) next->prev = prev; - else ADIOI_Async_list_tail = prev; - - ADIOI_Free_async_node(curr); -} diff --git a/3rd-party/romio321/adio/common/byte_offset.c b/3rd-party/romio321/adio/common/byte_offset.c deleted file mode 100644 index 7c3d1fe1c7d952c0e6c99bbe5fd9eb171c03122b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/byte_offset.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -/* Returns the absolute byte position in the file corresponding to - "offset" etypes relative to the current view. */ - -void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp) -{ - ADIOI_Flatlist_node *flat_file; - int i; - ADIO_Offset n_filetypes, etype_in_filetype, sum, abs_off_in_filetype=0, size_in_filetype; - MPI_Count n_etypes_in_filetype, filetype_size, etype_size; - int filetype_is_contig; - MPI_Aint filetype_extent, lb; - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - etype_size = fd->etype_size; - - if (filetype_is_contig) *disp = fd->disp + etype_size * offset; - else { -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - MPI_Type_size_x(fd->filetype, &filetype_size); - n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = offset / n_etypes_in_filetype; - etype_in_filetype = offset % n_etypes_in_filetype; - size_in_filetype = etype_in_filetype * etype_size; - - sum = 0; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (sum > size_in_filetype) { - abs_off_in_filetype = flat_file->indices[i] + - size_in_filetype - (sum - flat_file->blocklens[i]); - break; - } - } - - /* abs. offset in bytes in the file */ - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - *disp = fd->disp + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + abs_off_in_filetype; - } -} diff --git a/3rd-party/romio321/adio/common/cb_config_list.c b/3rd-party/romio321/adio/common/cb_config_list.c deleted file mode 100644 index 1fd827d7d2b15522ef3750edcfb51d8fca41f6e7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/cb_config_list.c +++ /dev/null @@ -1,756 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* cb_config_list.c - * - * The important, externally used functions from this file are: - * ADIOI_cb_bcast_rank_map() - * ADIOI_cb_gather_name_array() - * ADIOI_cb_config_list_parse() - * ADIOI_cb_copy_name_array() - * ADIOI_cb_delete_name_array() - * - * Prototypes for these are in adio/include/adio_cb_config_list.h - */ - -#include "adio.h" -#include "mpi.h" -#include "adio_cb_config_list.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* token types */ -#define AGG_WILDCARD 1 -#define AGG_STRING 2 -#define AGG_COMMA 3 -#define AGG_COLON 4 -#define AGG_ERROR -1 -#define AGG_EOS 0 - -#undef CB_CONFIG_LIST_DEBUG - -/* a couple of globals keep things simple */ -int ADIOI_cb_config_list_keyval = MPI_KEYVAL_INVALID; -static char *yylval; -static char *token_ptr; - -/* internal stuff */ -static int get_max_procs(int cb_nodes); -static int match_procs(char *name, int max_per_proc, char *procnames[], - char used_procnames[], - int nr_procnames, int ranks[], int nr_ranks, - int *nr_ranks_allocated); -static int match_this_proc(char *name, int cur_proc, int max_matches, - char *procnames[], char used_procnames[], - int nr_procnames, int ranks[], - int nr_ranks, int nr_ranks_allocated); -static int find_name(char *name, char *procnames[], char used_procnames[], - int nr_procnames, int start_ind); -static int cb_config_list_lex(void); - - -/* ADIOI_cb_bcast_rank_map() - broadcast the rank array - * - * Parameters: - * fd - ADIO_File for which update is occurring. cb_nodes and ranklist - * parameters must be up-to-date on rank 0 of the fd->comm. - * - * should probably be a void fn. - */ -int ADIOI_cb_bcast_rank_map(ADIO_File fd) -{ - int my_rank; - char *value; - int error_code = MPI_SUCCESS; - static char myname[] = "ADIOI_cb_bcast_rank_map"; - char *p; - int i; - - MPI_Bcast(&(fd->hints->cb_nodes), 1, MPI_INT, 0, fd->comm); - if (fd->hints->cb_nodes > 0) { - MPI_Comm_rank(fd->comm, &my_rank); - if (my_rank != 0) { - fd->hints->ranklist = ADIOI_Malloc(fd->hints->cb_nodes*sizeof(int)); - if (fd->hints->ranklist == NULL) { - error_code = MPIO_Err_create_code(error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return error_code; - } - } - MPI_Bcast(fd->hints->ranklist, fd->hints->cb_nodes, MPI_INT, 0, - fd->comm); - } - /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR - * FS-INDEP. */ - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", fd->hints->cb_nodes); - ADIOI_Info_set(fd->info, "cb_nodes", value); - p = value; - /* the (by MPI rank) list of aggregators can be larger than - * MPI_MAX_INFO_VAL, so we will simply truncate when we reach capacity. I - * wasn't clever enough to figure out how to rewind and put '...' at the - * end in the truncate case */ - for (i=0; i< fd->hints->cb_nodes; i++) { - int incr, remain = (MPI_MAX_INFO_VAL) - (p-value); - incr = ADIOI_Snprintf(p, remain, "%d ", fd->hints->ranklist[i]); - if (incr >= remain) break; - p += incr; - } - ADIOI_Info_set(fd->info, "romio_aggregator_list", value); - ADIOI_Free(value); - - return 0; -} - -/* ADIOI_cb_gather_name_array() - gather a list of processor names from all processes - * in a communicator and store them on rank 0. - * - * This is a collective call on the communicator(s) passed in. - * - * Obtains a rank-ordered list of processor names from the processes in - * "dupcomm". - * - * Returns 0 on success, -1 on failure. - * - * NOTE: Needs some work to cleanly handle out of memory cases! - */ -int ADIOI_cb_gather_name_array(MPI_Comm comm, - MPI_Comm dupcomm, - ADIO_cb_name_array *arrayp) -{ - char my_procname[MPI_MAX_PROCESSOR_NAME], **procname = 0; - int *procname_len = NULL, my_procname_len, *disp = NULL, i; - int commsize, commrank, found; - ADIO_cb_name_array array = NULL; - int alloc_size; - - if (ADIOI_cb_config_list_keyval == MPI_KEYVAL_INVALID) { - /* cleaned up by ADIOI_End_call */ - MPI_Comm_create_keyval((MPI_Comm_copy_attr_function *) ADIOI_cb_copy_name_array, - (MPI_Comm_delete_attr_function *) ADIOI_cb_delete_name_array, - &ADIOI_cb_config_list_keyval, NULL); - } - else { - MPI_Comm_get_attr(comm, ADIOI_cb_config_list_keyval, (void *) &array, &found); - if (found) { - ADIOI_Assert(array != NULL); - *arrayp = array; - return 0; - } - } - - MPI_Comm_size(dupcomm, &commsize); - MPI_Comm_rank(dupcomm, &commrank); - - MPI_Get_processor_name(my_procname, &my_procname_len); - - /* allocate space for everything */ - array = (ADIO_cb_name_array) ADIOI_Malloc(sizeof(*array)); - if (array == NULL) { - return -1; - } - array->refct = 2; /* we're going to associate this with two comms */ - - if (commrank == 0) { - /* process 0 keeps the real list */ - array->namect = commsize; - - array->names = (char **) ADIOI_Malloc(sizeof(char *) * commsize); - if (array->names == NULL) { - return -1; - } - procname = array->names; /* simpler to read */ - - procname_len = (int *) ADIOI_Malloc(commsize * sizeof(int)); - if (procname_len == NULL) { - return -1; - } - } - else { - /* everyone else just keeps an empty list as a placeholder */ - array->namect = 0; - array->names = NULL; - } - /* gather lengths first */ - MPI_Gather(&my_procname_len, 1, MPI_INT, - procname_len, 1, MPI_INT, 0, dupcomm); - - if (commrank == 0) { -#ifdef CB_CONFIG_LIST_DEBUG - for (i=0; i < commsize; i++) { - FPRINTF(stderr, "len[%d] = %d\n", i, procname_len[i]); - } -#endif - - alloc_size = 0; - for (i=0; i < commsize; i++) { - /* add one to the lengths because we need to count the - * terminator, and we are going to use this list of lengths - * again in the gatherv. - */ - alloc_size += ++procname_len[i]; - } - - procname[0] = ADIOI_Malloc(alloc_size); - if (procname[0] == NULL) { - ADIOI_Free(array); - return -1; - } - - for (i=1; i < commsize; i++) { - procname[i] = procname[i-1] + procname_len[i-1]; - } - - /* create our list of displacements for the gatherv. we're going - * to do everything relative to the start of the region allocated - * for procname[0] - */ - disp = ADIOI_Malloc(commsize * sizeof(int)); - disp[0] = 0; - for (i=1; i < commsize; i++) { - disp[i] = (int) (procname[i] - procname[0]); - } - - } - - /* now gather strings */ - if (commrank == 0) { - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, - procname[0], procname_len, disp, MPI_CHAR, - 0, dupcomm); - } - else { - /* if we didn't do this, we would need to allocate procname[] - * on all processes...which seems a little silly. - */ - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, - NULL, NULL, NULL, MPI_CHAR, 0, dupcomm); - } - - if (commrank == 0) { - /* no longer need the displacements or lengths */ - ADIOI_Free(disp); - ADIOI_Free(procname_len); - -#ifdef CB_CONFIG_LIST_DEBUG - for (i=0; i < commsize; i++) { - FPRINTF(stderr, "name[%d] = %s\n", i, procname[i]); - } -#endif - } - - /* store the attribute; we want to store SOMETHING on all processes - * so that they can all tell if we have gone through this procedure - * or not for the given communicator. - * - * specifically we put it on both the original comm, so we can find - * it next time an open is performed on this same comm, and on the - * dupcomm, so we can use it in I/O operations. - */ - MPI_Comm_set_attr (comm, ADIOI_cb_config_list_keyval, array); - MPI_Comm_set_attr (dupcomm, ADIOI_cb_config_list_keyval, array); - *arrayp = array; - return 0; -} - - -/* ADIOI_cb_config_list_parse() - parse the cb_config_list and build the - * ranklist - * - * Parameters: - * (pretty self explanatory) - * - * Returns number of ranks allocated in parsing, -1 on error. - */ -int ADIOI_cb_config_list_parse(char *config_list, - ADIO_cb_name_array array, - int ranklist[], - int cb_nodes) -{ - int token, max_procs, cur_rank = 0, nr_procnames; - char *cur_procname, *cur_procname_p, **procnames; - char *used_procnames; - - nr_procnames = array->namect; - procnames = array->names; - - /* nothing big goes on the stack */ - /* we use info val here and for yylval because we know the string - * cannot be any bigger than this. - */ - cur_procname = ADIOI_Malloc((MPI_MAX_INFO_VAL+1) * sizeof(char)); - if (cur_procname == NULL) { - return -1; - } - - yylval = ADIOI_Malloc((MPI_MAX_INFO_VAL+1) * sizeof(char)); - if (yylval == NULL) { - ADIOI_Free(cur_procname); - return -1; - } - - token_ptr = config_list; - - /* right away let's make sure cb_nodes isn't too big */ - if (cb_nodes > nr_procnames) cb_nodes = nr_procnames; - - /* used_procnames is used as a mask so that we don't have to destroy - * our procnames array - */ - used_procnames = ADIOI_Malloc(array->namect * sizeof(char)); - if (used_procnames == NULL) { - ADIOI_Free(cur_procname); - ADIOI_Free(yylval); - yylval = NULL; - return -1; - } - memset(used_procnames, 0, array->namect); - - /* optimization for "*:*"; arguably this could be done before we - * build the list of processor names...but that would make things - * messy. - */ - if (strcmp(config_list, "*:*") == 0) { - for (cur_rank = 0; cur_rank < cb_nodes; cur_rank++) { - ranklist[cur_rank] = cur_rank; - } - ADIOI_Free(cur_procname); - ADIOI_Free(yylval); - yylval = NULL; - ADIOI_Free(used_procnames); - return cb_nodes; - } - - while (cur_rank < cb_nodes) { - token = cb_config_list_lex(); - - if (token == AGG_EOS) { - ADIOI_Free(cur_procname); - ADIOI_Free(yylval); - yylval = NULL; - ADIOI_Free(used_procnames); - return cur_rank; - } - - if (token != AGG_WILDCARD && token != AGG_STRING) { - /* maybe ignore and try to keep going? */ - FPRINTF(stderr, "error parsing config list\n"); - ADIOI_Free(cur_procname); - ADIOI_Free(yylval); - yylval = NULL; - ADIOI_Free(used_procnames); - return cur_rank; - } - - if (token == AGG_WILDCARD) { - cur_procname_p = NULL; - } - else { - /* AGG_STRING is the only remaining case */ - /* save procname (for now) */ - ADIOI_Strncpy(cur_procname, yylval, MPI_MAX_INFO_VAL+1); - cur_procname_p = cur_procname; - } - - /* after we have saved the current procname, we can grab max_procs */ - max_procs = get_max_procs(cb_nodes); - -#ifdef CB_CONFIG_LIST_DEBUG - if (token == AGG_WILDCARD) { - FPRINTF(stderr, "looking for *:%d\n", max_procs); - } - else { - FPRINTF(stderr, "looking for %s:%d\n", cur_procname, max_procs); - } -#endif - - /* do the matching for this piece of the cb_config_list */ - match_procs(cur_procname_p, max_procs, procnames, used_procnames, - nr_procnames, ranklist, cb_nodes, &cur_rank); - } - ADIOI_Free(cur_procname); - ADIOI_Free(yylval); - yylval = NULL; - ADIOI_Free(used_procnames); - return cur_rank; -} - -/* ADIOI_cb_copy_name_array() - attribute copy routine - */ -int ADIOI_cb_copy_name_array(MPI_Comm comm, - int keyval, - void *extra, - void *attr_in, - void **attr_out, - int *flag) -{ - ADIO_cb_name_array array; - - ADIOI_UNREFERENCED_ARG(comm); - ADIOI_UNREFERENCED_ARG(keyval); - ADIOI_UNREFERENCED_ARG(extra); - - array = (ADIO_cb_name_array) attr_in; - if (array != NULL) array->refct++; - - *attr_out = attr_in; - *flag = 1; /* make a copy in the new communicator */ - - return MPI_SUCCESS; -} - -/* ADIOI_cb_delete_name_array() - attribute destructor - */ -int ADIOI_cb_delete_name_array(MPI_Comm comm, - int keyval, - void *attr_val, - void *extra) -{ - ADIO_cb_name_array array; - - ADIOI_UNREFERENCED_ARG(comm); - ADIOI_UNREFERENCED_ARG(extra); - - array = (ADIO_cb_name_array) attr_val; - ADIOI_Assert(array != NULL); - array->refct--; - - if (array->refct <= 0) { - /* time to free the structures (names, array of ptrs to names, struct) - */ - if (array->namect) { - /* Note that array->names[i], where i > 0, - * are just pointers into the allocated region array->names[0] - */ - ADIOI_Free(array->names[0]); - } - if (array->names != NULL) ADIOI_Free(array->names); - ADIOI_Free(array); - } - return MPI_SUCCESS; -} - -/* match_procs() - given a name (or NULL for wildcard) and a max. number - * of aggregator processes (per processor name), this - * matches in the procnames[] array and puts appropriate - * ranks in the ranks array. - * - * Parameters: - * name - processor name (or NULL for wildcard) - * max_per_proc - maximum # of processes to use for aggregation from a - * single processor - * procnames - array of processor names - * nr_procnames - length of procnames array - * ranks - array of process ranks - * nr_ranks - length of process ranks array (also max. # of aggregators) - * nr_ranks_allocated - # of array entries which have been filled in, - * which is also the index to the first empty entry - * - * Returns number of matches. - */ -static int match_procs(char *name, - int max_per_proc, - char *procnames[], - char used_procnames[], - int nr_procnames, - int ranks[], - int nr_ranks, - int *nr_ranks_allocated) -{ - int wildcard_proc, cur_proc, old_nr_allocated, ret; - - /* save this so we can report on progress */ - old_nr_allocated = *nr_ranks_allocated; - - if (name == NULL) { - /* wildcard case */ - - /* optimize for *:0 case */ - if (max_per_proc == 0) { - /* loop through procnames and mark them all as used */ - for (cur_proc = 0; cur_proc < nr_procnames; cur_proc++) { - used_procnames[cur_proc] = 1; - } - return 0; - } - - /* the plan here is to start at the beginning of the procnames - * array looking for processor names to apply the wildcard to. - * - * we set wildcard_proc to 0 here but do the search inside the - * while loop so that we aren't starting our search from the - * beginning of the procnames array each time. - */ - wildcard_proc = 0; - - while (nr_ranks - *nr_ranks_allocated > 0) { - /* find a name */ - while ((wildcard_proc < nr_procnames) && - (used_procnames[wildcard_proc] != 0)) - { - wildcard_proc++; - } - - if (wildcard_proc == nr_procnames) { - /* we have used up the entire procnames list */ - return *nr_ranks_allocated - old_nr_allocated; - } - -#ifdef CB_CONFIG_LIST_DEBUG - FPRINTF(stderr, "performing wildcard match (*:%d) starting with %s (%d)\n", - max_per_proc, procnames[wildcard_proc], wildcard_proc); -#endif - - cur_proc = wildcard_proc; - -#ifdef CB_CONFIG_LIST_DEBUG - FPRINTF(stderr, " assigning name %s (%d) to rank %d in mapping\n", - procnames[cur_proc], cur_proc, *nr_ranks_allocated); -#endif - - /* alloc max_per_proc from this host; cur_proc points to - * the first one. We want to save this name for use in - * our while loop. - */ - ranks[*nr_ranks_allocated] = cur_proc; - *nr_ranks_allocated = *nr_ranks_allocated + 1; - cur_proc++; - - /* so, to accomplish this we use the match_this_proc() to - * alloc max_per_proc-1. we increment cur_proc so that the - * procnames[] entry doesn't get trashed. then AFTER the call - * we clean up the first instance of the name. - */ - ret = match_this_proc(procnames[wildcard_proc], cur_proc, - max_per_proc-1, procnames, used_procnames, - nr_procnames, - ranks, nr_ranks, *nr_ranks_allocated); - if (ret > 0) *nr_ranks_allocated = *nr_ranks_allocated + ret; - - /* clean up and point wildcard_proc to the next entry, since - * we know that this one is NULL now. - */ - used_procnames[wildcard_proc] = 1; - wildcard_proc++; - } - } - else { - /* specific host was specified; this one is easy */ -#ifdef CB_CONFIG_LIST_DEBUG - FPRINTF(stderr, "performing name match (%s:%d)\n", name, max_per_proc); -#endif - - ret = match_this_proc(name, 0, max_per_proc, procnames, used_procnames, - nr_procnames, ranks, nr_ranks, - *nr_ranks_allocated); - if (ret > 0) *nr_ranks_allocated = *nr_ranks_allocated + ret; - } - return *nr_ranks_allocated - old_nr_allocated; -} - -/* match_this_proc() - find each instance of processor name "name" in - * the "procnames" array, starting with index "cur_proc" - * and add the first "max_matches" into the "ranks" - * array. remove all instances of "name" from - * "procnames". - * - * Parameters: - * name - processor name to match - * cur_proc - index into procnames[] at which to start matching - * procnames - array of processor names - * used_procnames - array of values indicating if a given procname has - * been allocated or removed already - * nr_procnames - length of procnames array - * ranks - array of processor ranks - * nr_ranks - length of ranks array - * nr_ranks_allocated - number of ranks already filled in, or the next - * entry to fill in (equivalent) - * - * Returns number of ranks filled in (allocated). - */ -static int match_this_proc(char *name, - int cur_proc, - int max_matches, - char *procnames[], - char used_procnames[], - int nr_procnames, - int ranks[], - int nr_ranks, - int nr_ranks_allocated) -{ - int ranks_remaining, nr_to_alloc, old_nr_allocated; - - old_nr_allocated = nr_ranks_allocated; - - /* calculate how many ranks we want to allocate */ - ranks_remaining = nr_ranks - nr_ranks_allocated; - nr_to_alloc = (max_matches < ranks_remaining) ? - max_matches : ranks_remaining; - - while (nr_to_alloc > 0) { - cur_proc = find_name(name, procnames, used_procnames, nr_procnames, - cur_proc); - if (cur_proc < 0) { - /* didn't find it */ - return nr_ranks_allocated - old_nr_allocated; - } - - /* need bounds checking on ranks */ -#ifdef CB_CONFIG_LIST_DEBUG - FPRINTF(stderr, " assigning name %s (%d) to rank %d in mapping\n", - procnames[cur_proc], cur_proc, nr_ranks_allocated); -#endif - - ranks[nr_ranks_allocated] = cur_proc; - nr_ranks_allocated++; - used_procnames[cur_proc] = 1; - - cur_proc++; - nr_to_alloc--; - } - - /* take all other instances of this host out of the list */ - while (cur_proc >= 0) { - cur_proc = find_name(name, procnames, used_procnames, nr_procnames, - cur_proc); - if (cur_proc >= 0) { -#ifdef CB_CONFIG_LIST_DEBUG - FPRINTF(stderr, " taking name %s (%d) out of procnames\n", - procnames[cur_proc], cur_proc); -#endif - used_procnames[cur_proc] = 1; - cur_proc++; - } - } - return nr_ranks_allocated - old_nr_allocated; -} - - -/* find_name() - finds the first entry in procnames[] which matches name, - * starting at index start_ind - * - * Returns an index [0..nr_procnames-1] on success, -1 if not found. - */ -static int find_name(char *name, - char *procnames[], - char used_procnames[], - int nr_procnames, - int start_ind) -{ - int i; - - for (i=start_ind; i < nr_procnames; i++) { - if (!used_procnames[i] && !strcmp(name, procnames[i])) break; - } - - if (i < nr_procnames) return i; - else return -1; -} - -/* get_max_procs() - grab the maximum number of processes to use out of - * the cb_config_list string - * - * Parameters: - * cb_nodes - cb_nodes value. this is returned when a "*" is encountered - * as the max_procs value. - * - * Returns # of processes, or -1 on error. - */ -static int get_max_procs(int cb_nodes) -{ - int token, max_procs = -1; - char *errptr; - - token = cb_config_list_lex(); - - switch(token) { - case AGG_EOS: - case AGG_COMMA: - return 1; - case AGG_COLON: - token = cb_config_list_lex(); - if (token != AGG_WILDCARD && token != AGG_STRING) return -1; - if (token == AGG_WILDCARD) max_procs = cb_nodes; - else if (token == AGG_STRING) { - max_procs = (int)strtol(yylval, &errptr, 10); - if (*errptr != '\0') { - /* some garbage value; default to 1 */ - max_procs = 1; - } - } - /* strip off next comma (if there is one) */ - token = cb_config_list_lex(); - if (token != AGG_COMMA && token != AGG_EOS) return -1; - - /* return max_procs */ - if (max_procs < 0) return -1; - else return max_procs; - } - return -1; -} - - -/* cb_config_list_lex() - lexical analyzer for cb_config_list language - * - * Returns a token of types defined at top of this file. - */ -#if defined(BGQPLATFORM) -/* On BlueGene, the ',' character shows up in get_processor_name, so we have to - * use a different delimiter */ -#define COLON ':' -#define COMMA ';' -#define DELIMS ":;" -#else -/* these tokens work for every other platform */ -#define COLON ':' -#define COMMA ',' -#define DELIMS ":," -#endif - -static int cb_config_list_lex(void) -{ - int slen; - - if (*token_ptr == '\0') return AGG_EOS; - - slen = (int)strcspn(token_ptr, DELIMS); - - if (*token_ptr == COLON) { - token_ptr++; - return AGG_COLON; - } - if (*token_ptr == COMMA) { - token_ptr++; - return AGG_COMMA; - } - - if (*token_ptr == '*') { - /* make sure that we don't have characters after the '*' */ - if (slen == 1) { - token_ptr++; - return AGG_WILDCARD; - } - else return AGG_ERROR; - } - - /* last case: some kind of string. for now we copy the string. */ - - /* it would be a good idea to look at the string and make sure that - * it doesn't have any illegal characters in it. in particular we - * should ensure that no one tries to use wildcards with strings - * (e.g. "ccn*"). - */ - ADIOI_Strncpy(yylval, token_ptr, slen); - yylval[slen] = '\0'; - token_ptr += slen; - return AGG_STRING; -} diff --git a/3rd-party/romio321/adio/common/eof_offset.c b/3rd-party/romio321/adio/common/eof_offset.c deleted file mode 100644 index ea3c51f6eab333ecd68854cc66fe4e8352bdf9c5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/eof_offset.c +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -/* return the current end of file in etype units relative to the - current view */ - -void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset) -{ - MPI_Count filetype_size; - int error_code, filetype_is_contig; - ADIO_Offset fsize, disp, sum=0, size_in_file, n_filetypes, rem, etype_size; - int flag, i; - ADIO_Fcntl_t *fcntl_struct; - MPI_Aint filetype_extent, lb; - ADIOI_Flatlist_node *flat_file; - - /* find the eof in bytes */ - fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); - ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code); - fsize = fcntl_struct->fsize; - ADIOI_Free(fcntl_struct); - - /* Find the offset in etype units corresponding to eof. - The eof could lie in a hole in the current view, or in the - middle of an etype. In that case the offset will be the offset - corresponding to the start of the next etype in the current view.*/ - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - etype_size = fd->etype_size; - - if (filetype_is_contig) - *eof_offset = (fsize - fd->disp + etype_size - 1)/etype_size; - /* ceiling division in case fsize is not a multiple of etype_size;*/ - else { - /* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) - flat_file = flat_file->next; - - MPI_Type_size_x(fd->filetype, &filetype_size); - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - - disp = fd->disp; - n_filetypes = -1; - flag = 0; - while (!flag) { - sum = 0; - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (disp + flat_file->indices[i] + - n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + - flat_file->blocklens[i] >= fsize) { - if (disp + flat_file->indices[i] + - n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent >= fsize) - sum -= flat_file->blocklens[i]; - else { - rem = (disp + flat_file->indices[i] + - n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent - + flat_file->blocklens[i] - fsize); - sum -= rem; - } - flag = 1; - break; - } - } - } - size_in_file = n_filetypes*(ADIO_Offset)filetype_size + sum; - *eof_offset = (size_in_file+etype_size-1)/etype_size; /* ceiling division */ - } -} diff --git a/3rd-party/romio321/adio/common/error.c b/3rd-party/romio321/adio/common/error.c deleted file mode 100644 index 20e211d9fc1a88584d48d36074c5af9502b52e0f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/error.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -/* NOTE: THIS FUNCTION IS DEPRECATED AND ONLY EXISTS HERE BECAUSE - * SOME DEPRECATED ADIO IMPLEMENTATIONS STILL CALL IT (SFS, HFS, PIOFS). - */ -int ADIOI_Error(ADIO_File fd, int error_code, char *string) -{ - char buf[MPI_MAX_ERROR_STRING]; - int myrank, result_len; - MPI_Errhandler err_handler; - - if (fd == ADIO_FILE_NULL) err_handler = ADIOI_DFLT_ERR_HANDLER; - else err_handler = fd->err_handler; - - MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - if (err_handler == MPI_ERRORS_ARE_FATAL) { - MPI_Error_string(error_code, buf, &result_len); - FPRINTF(stderr, "[%d] - %s : %s\n", myrank, string, buf); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else if (err_handler != MPI_ERRORS_RETURN) { - /* MPI_File_call_errorhandler(fd, error_code); */ - - FPRINTF(stderr, "Only MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL are currently supported as error handlers for files\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - return error_code; -} -/* Check for special error codes for those MPI error - classes that relate to particular problems. - Returns an MPI error code corresponding to "my_errno", for function "myname" - * and the given file, "filename". */ -int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno) -{ - int error_code = MPI_SUCCESS; - if(!my_errno) return MPI_SUCCESS; - - /* --BEGIN ERROR HANDLING-- */ - switch(my_errno) { - case EACCES: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_ACCESS, - "**fileaccess", - "**fileaccess %s", - filename ); - break; - case ENAMETOOLONG: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_BAD_FILE, - "**filenamelong", - "**filenamelong %s %d", - filename, - strlen(filename)); - break; - case ENOENT: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_NO_SUCH_FILE, - "**filenoexist", - "**filenoexist %s", - filename); - break; - case EISDIR: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_BAD_FILE, - "**filenamedir", - "**filenamedir %s", - filename); - break; - case EROFS: - /* Read only file or file system and write access requested */ - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_READ_ONLY, - "**ioneedrd", 0 ); - break; - case EEXIST: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_FILE_EXISTS, - "**fileexist", 0); - break; - case ENOTDIR: - case ELOOP: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_BAD_FILE, - "**filenamedir", - "**filenamedir %s", - filename); - break; - case ENOSPC: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_NO_SPACE, - "**filenospace", 0); - break; - case EDQUOT: - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_QUOTA, - "**filequota", 0); - break; - default: - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, "**io", - "**io %s", strerror(my_errno)); - break; - } - /* --END ERROR HANDLING-- */ - - return error_code; -} diff --git a/3rd-party/romio321/adio/common/flatten.c b/3rd-party/romio321/adio/common/flatten.c deleted file mode 100644 index b468ec2f0f4025149f28f2a4aff1642150bfca1f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/flatten.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -/* #ifdef MPISGI -#include "mpisgi2.h" -#endif */ - -#ifdef USE_DBG_LOGGING - #define FLATTEN_DEBUG 1 -#endif - -struct adio_short_int { - short elem_s; - int elem_i; -}; - -struct adio_double_int { - double elem_d; - int elem_i; -}; - -struct adio_long_int { - long elem_l; - int elem_i; -}; - -struct adio_long_double_int { - long double elem_ld; - int elem_i; -}; - -int ADIOI_Type_get_envelope (MPI_Datatype datatype, int *num_integers, - int *num_addresses, int *num_datatypes, int *combiner) -{ - int rc, is_contig; - - ADIOI_Datatype_iscontig(datatype, &is_contig); - - rc = MPI_Type_get_envelope (datatype, num_integers, num_addresses, num_datatypes, combiner); - if (MPI_SUCCESS != rc || MPI_COMBINER_NAMED != *combiner || is_contig) { - return rc; - } - - if (MPI_SHORT_INT == datatype || MPI_DOUBLE_INT == datatype || MPI_LONG_DOUBLE_INT == datatype || - MPI_LONG_INT == datatype) { - *num_integers = 2; - *num_addresses = 2; - *num_datatypes = 2; - *combiner = MPI_COMBINER_STRUCT; - } - - return rc; -} - -int ADIOI_Type_get_contents (MPI_Datatype datatype, int max_integers, - int max_addresses, int max_datatypes, int array_of_integers[], - MPI_Aint array_of_addresses[], MPI_Datatype array_of_datatypes[]) -{ - int dontcare, combiner; - int rc; - - rc = MPI_Type_get_envelope (datatype, &dontcare, &dontcare, &dontcare, &combiner); - if (MPI_SUCCESS != rc) { - return rc; - } - - if (MPI_COMBINER_NAMED != combiner) { - return MPI_Type_get_contents (datatype, max_integers, max_addresses, max_datatypes, - array_of_integers, array_of_addresses, array_of_datatypes); - } - - array_of_integers[0] = 1; - array_of_integers[1] = 1; - array_of_addresses[0] = 0; - array_of_datatypes[1] = MPI_INT; - - if (MPI_SHORT_INT == datatype) { - array_of_datatypes[0] = MPI_SHORT; - array_of_addresses[1] = offsetof (struct adio_short_int, elem_i); - } else if (MPI_DOUBLE_INT == datatype) { - array_of_datatypes[0] = MPI_DOUBLE; - array_of_addresses[1] = offsetof (struct adio_double_int, elem_i); - } else if (MPI_LONG_DOUBLE_INT == datatype) { - array_of_datatypes[0] = MPI_LONG_DOUBLE; - array_of_addresses[1] = offsetof (struct adio_long_double_int, elem_i); - } else if (MPI_LONG_INT == datatype) { - array_of_datatypes[0] = MPI_LONG; - array_of_addresses[1] = offsetof (struct adio_long_int, elem_i); - } else { - rc = MPI_ERR_TYPE; - } - - return rc; -} - -void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type); -/* flatten datatype and add it to Flatlist */ -void ADIOI_Flatten_datatype(MPI_Datatype datatype) -{ -#ifdef HAVE_MPIR_TYPE_FLATTEN - MPI_Aint flatten_idx; -#endif - MPI_Count curr_index=0; - int is_contig; - ADIOI_Flatlist_node *flat, *prev=0; - - /* check if necessary to flatten. */ - - /* is it entirely contiguous? */ - ADIOI_Datatype_iscontig(datatype, &is_contig); - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: is_contig %#X\n",is_contig); - #endif - if (is_contig) return; - - /* has it already been flattened? */ - flat = ADIOI_Flatlist; - while (flat) { - if (flat->type == datatype) { - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: found datatype %#X\n", datatype); - #endif - return; - } - else { - prev = flat; - flat = flat->next; - } - } - - /* flatten and add to the list */ - flat = prev; - flat->next = (ADIOI_Flatlist_node *)ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); - flat = flat->next; - - flat->type = datatype; - flat->next = NULL; - flat->blocklens = NULL; - flat->indices = NULL; - flat->lb_idx = flat->ub_idx = -1; - - flat->count = ADIOI_Count_contiguous_blocks(datatype, &curr_index); -#ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: count %llX, cur_idx = %#llX\n",flat->count,curr_index); -#endif -/* DBG_FPRINTF(stderr, "%d\n", flat->count);*/ - - if (flat->count) { - flat->blocklens = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset)); - flat->indices = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset)); - } - - curr_index = 0; -#ifdef HAVE_MPIR_TYPE_FLATTEN - flatten_idx = (MPI_Aint) flat->count; - MPIR_Type_flatten(datatype, flat->indices, flat->blocklens, &flatten_idx); - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: MPIR_Type_flatten\n"); - #endif -#else - ADIOI_Flatten(datatype, flat, 0, &curr_index); - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: ADIOI_Flatten\n"); - #endif - - ADIOI_Optimize_flattened(flat); -#endif -/* debug */ -#ifdef FLATTEN_DEBUG - { - int i; - for (i=0; i<flat->count; i++) - DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: i %#X, blocklens %#llX, indices %#llX\n", - i, - flat->blocklens[i], - flat->indices[i] - ); - } -#endif -} - -/* ADIOI_Flatten() - * - * Assumption: input datatype is not a basic!!!! - */ -void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, - ADIO_Offset st_offset, MPI_Count *curr_index) -{ - int k, m, n, is_hindexed_block=0; - int lb_updated=0; - int combiner, old_combiner, old_is_contig; - int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset top_count; - MPI_Count i, j, old_size, prev_index, basic_num, num, nonzeroth; - MPI_Aint old_extent, lb;/* Assume extents are non-negative */ - int *ints; - MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ - MPI_Datatype *types; - ADIOI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); - if (combiner == MPI_COMBINER_NAMED) { - return; /* can't do anything else: calling get_contents on a builtin - type is an error */ - } - ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int)); - adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint)); - types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype)); - ADIOI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); - - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: st_offset %#llX, curr_index %#llX\n",st_offset,*curr_index); - DBG_FPRINTF(stderr,"ADIOI_Flatten:: nints %#X, nadds %#X, ntypes %#X\n",nints, nadds, ntypes); - for(i=0; i< nints; ++i) - { - DBG_FPRINTF(stderr,"ADIOI_Flatten:: ints[%lld]=%#X\n",i,ints[i]); - } - for(i=0; i< nadds; ++i) - { - DBG_FPRINTF(stderr,"ADIOI_Flatten:: adds[%lld]="MPI_AINT_FMT_HEX_SPEC"\n",i,adds[i]); - } - for(i=0; i< ntypes; ++i) - { - DBG_FPRINTF(stderr,"ADIOI_Flatten:: types[%lld]=%#llX\n",i,(unsigned long long)(unsigned long)types[i]); - } - #endif - /* Chapter 4, page 83: when processing datatypes, note this item from the - * standard: - Most datatype constructors have replication count or block length - arguments. Allowed values are non-negative integers. If the value is - zero, no elements are generated in the type map and there is no effect - on datatype bounds or extent. */ - - switch (combiner) { -#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP - case MPI_COMBINER_DUP: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DUP\n"); - #endif - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, st_offset, curr_index); - break; -#endif -#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY - case MPI_COMBINER_SUBARRAY: - { - int dims = ints[0]; - MPI_Datatype stype; - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_SUBARRAY\n"); - #endif - - ADIO_Type_create_subarray(dims, - &ints[1], /* sizes */ - &ints[dims+1], /* subsizes */ - &ints[2*dims+1], /* starts */ - ints[3*dims+1], /* order */ - types[0], /* type */ - &stype); - ADIOI_Flatten(stype, flat, st_offset, curr_index); - MPI_Type_free(&stype); - } - break; -#endif -#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY - case MPI_COMBINER_DARRAY: - { - int dims = ints[2]; - MPI_Datatype dtype; - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY\n"); - #endif - - ADIO_Type_create_darray(ints[0], /* size */ - ints[1], /* rank */ - dims, - &ints[3], /* gsizes */ - &ints[dims+3], /* distribs */ - &ints[2*dims+3], /* dargs */ - &ints[3*dims+3], /* psizes */ - ints[4*dims+3], /* order */ - types[0], - &dtype); - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY <ADIOI_Flatten(dtype, flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#llX);\n", - 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); - #endif - ADIOI_Flatten(dtype, flat, st_offset, curr_index); - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY >ADIOI_Flatten(dtype, flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#llX);\n", - 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); - #endif - MPI_Type_free(&dtype); - } - break; -#endif - case MPI_COMBINER_CONTIGUOUS: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_CONTIGUOUS\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, st_offset, curr_index); - - if (prev_index == *curr_index) { -/* simplest case, made up of basic or contiguous types */ - j = *curr_index; - flat->indices[j] = st_offset; - MPI_Type_size_x(types[0], &old_size); - flat->blocklens[j] = top_count * old_size; - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",j, flat->indices[j], j, flat->blocklens[j]); - #endif - (*curr_index)++; - } - else { -/* made up of noncontiguous derived types */ - j = *curr_index; - num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated count times */ - MPI_Type_get_extent(types[0], &lb, &old_extent); - for (m=1; m<top_count; m++) { - for (i=0; i<num; i++) { - flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: derived flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",j, flat->indices[j], j, flat->blocklens[j]); - #endif - j++; - } - } - *curr_index = j; - } - break; - - case MPI_COMBINER_VECTOR: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_VECTOR\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, st_offset, curr_index); - - if (prev_index == *curr_index) { -/* simplest case, vector of basic or contiguous types */ - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1], stride = ints[2]; - j = *curr_index; - flat->indices[j] = st_offset; - MPI_Type_size_x(types[0], &old_size); - flat->blocklens[j] = blocklength * old_size; - for (i=j+1; i<j+top_count; i++) { - flat->indices[i] = flat->indices[i-1] + stride * old_size; - flat->blocklens[i] = flat->blocklens[j]; - } - *curr_index = i; - } - else { -/* vector of noncontiguous derived types */ - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1], stride = ints[2]; - - j = *curr_index; - num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklen times - and then strided. Replicate the first one. */ - MPI_Type_get_extent(types[0], &lb, &old_extent); - for (m=1; m<blocklength; m++) { - for (i=0; i<num; i++) { - flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - -/* Now repeat with strides. */ - num = *curr_index - prev_index; - for (i=1; i<top_count; i++) { - for (m=0; m<num; m++) { - flat->indices[j] = flat->indices[j-num] + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - } - break; - - case MPI_COMBINER_HVECTOR: - case MPI_COMBINER_HVECTOR_INTEGER: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_HVECTOR_INTEGER\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, st_offset, curr_index); - - if (prev_index == *curr_index) { -/* simplest case, vector of basic or contiguous types */ - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1]; - j = *curr_index; - flat->indices[j] = st_offset; - MPI_Type_size_x(types[0], &old_size); - flat->blocklens[j] = blocklength * old_size; - for (i=j+1; i<j+top_count; i++) { - flat->indices[i] = flat->indices[i-1] + adds[0]; - flat->blocklens[i] = flat->blocklens[j]; - } - *curr_index = i; - } - else { -/* vector of noncontiguous derived types */ - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1]; - - j = *curr_index; - num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklen times - and then strided. Replicate the first one. */ - MPI_Type_get_extent(types[0], &lb, &old_extent); - for (m=1; m<blocklength; m++) { - for (i=0; i<num; i++) { - flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - -/* Now repeat with strides. */ - num = *curr_index - prev_index; - for (i=1; i<top_count; i++) { - for (m=0; m<num; m++) { - flat->indices[j] = flat->indices[j-num] + adds[0]; - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - } - break; - - case MPI_COMBINER_INDEXED: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_INDEXED\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - MPI_Type_get_extent(types[0], &lb, &old_extent); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset stride = ints[top_count+1]; - ADIOI_Flatten(types[0], flat, - st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index); - } - - if (prev_index == *curr_index) { -/* simplest case, indexed type made up of basic or contiguous types */ - j = *curr_index; - for (i=j, nonzeroth=i; i<j+top_count; i++) { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1+i-j], stride = ints[top_count+1+i-j]; - if (blocklength > 0) { - flat->indices[nonzeroth] = - st_offset + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = - blocklength* ADIOI_AINT_CAST_TO_OFFSET old_extent; - nonzeroth++; - } else { - flat->count--; /* don't count/consider any zero-length blocklens */ - } - } - *curr_index = i; - } - else { -/* indexed type made up of noncontiguous derived types */ - - j = *curr_index; - num = *curr_index - prev_index; - basic_num = num; - -/* The noncontiguous types have to be replicated blocklens[i] times - and then strided. Replicate the first one. */ - for (m=1; m<ints[1]; m++) { - for (i=0, nonzeroth = j; i<num; i++) { - if (flat->blocklens[j-num] > 0) { - flat->indices[nonzeroth] = - flat->indices[nonzeroth-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = - flat->blocklens[nonzeroth-num]; - j++; - nonzeroth++; - } else { - flat->count --; - } - } - } - *curr_index = j; - -/* Now repeat with strides. */ - for (i=1; i<top_count; i++) { - num = *curr_index - prev_index; - prev_index = *curr_index; - for (m=0, nonzeroth=j; m<basic_num; m++) { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset stride = ints[top_count+1+i]-ints[top_count+i]; - if (flat->blocklens[j-num] > 0 ) { - flat->indices[nonzeroth] = - flat->indices[j-num] + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = flat->blocklens[j-num]; - j++; - nonzeroth++; - } else { - flat->count--; - } - } - *curr_index = j; - for (m=1; m<ints[1+i]; m++) { - for (k=0, nonzeroth=j; k<basic_num; k++) { - if (flat->blocklens[j-basic_num] > 0) { - flat->indices[nonzeroth] = - flat->indices[j-basic_num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = flat->blocklens[j-basic_num]; - j++; - nonzeroth++; - } else { - flat->count --; - } - } - } - *curr_index = j; - } - } - break; - -#if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK - case MPI_COMBINER_HINDEXED_BLOCK: - is_hindexed_block=1; - /* deliberate fall-through */ -#endif - case MPI_COMBINER_INDEXED_BLOCK: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_INDEXED_BLOCK\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - MPI_Type_get_extent(types[0], &lb, &old_extent); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset stride = ints[1+1]; - if (is_hindexed_block) { - ADIOI_Flatten(types[0], flat, - st_offset+adds[0], curr_index); - } else { - ADIOI_Flatten(types[0], flat, - st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index); - } - } - - if (prev_index == *curr_index) { -/* simplest case, indexed type made up of basic or contiguous types */ - j = *curr_index; - for (i=j; i<j+top_count; i++) { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1]; - if (is_hindexed_block) { - flat->indices[i] = st_offset + adds[i-j]; - } else { - ADIO_Offset stride = ints[1+1+i-j]; - flat->indices[i] = st_offset + - stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; - } - flat->blocklens[i] = blocklength* ADIOI_AINT_CAST_TO_OFFSET old_extent; - } - *curr_index = i; - } - else { -/* vector of noncontiguous derived types */ - - j = *curr_index; - num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklens[i] times - and then strided. Replicate the first one. */ - for (m=1; m<ints[1]; m++) { - for (i=0; i<num; i++) { - if (is_hindexed_block) { - /* this is the one place the hindexed case uses the - * extent of a type */ - MPI_Type_get_extent(types[0], &lb, &old_extent); - } - flat->indices[j] = flat->indices[j-num] + - ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - -/* Now repeat with strides. */ - num = *curr_index - prev_index; - for (i=1; i<top_count; i++) { - for (m=0; m<num; m++) { - if (is_hindexed_block) { - flat->indices[j] = flat->indices[j-num] + - adds[i] - adds[i-1]; - } else { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset stride = ints[2+i]-ints[1+i]; - flat->indices[j] = flat->indices[j-num] + - stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; - } - flat->blocklens[j] = flat->blocklens[j-num]; - j++; - } - } - *curr_index = j; - } - break; - - case MPI_COMBINER_HINDEXED: - case MPI_COMBINER_HINDEXED_INTEGER: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_HINDEXED_INTEGER\n"); - #endif - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - { - ADIOI_Flatten(types[0], flat, st_offset+adds[0], curr_index); - } - - if (prev_index == *curr_index) { -/* simplest case, indexed type made up of basic or contiguous types */ - j = *curr_index; - MPI_Type_size_x(types[0], &old_size); - for (i=j, nonzeroth=j; i<j+top_count; i++) { - if (ints[1+i-j] > 0) { - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - ADIO_Offset blocklength = ints[1+i-j]; - flat->indices[nonzeroth] = st_offset + adds[i-j]; - flat->blocklens[nonzeroth] = blocklength*old_size; - nonzeroth++; - } else { - flat->count--; - } - } - *curr_index = i; - } - else { -/* indexed type made up of noncontiguous derived types */ - - j = *curr_index; - num = *curr_index - prev_index; - basic_num = num; - -/* The noncontiguous types have to be replicated blocklens[i] times - and then strided. Replicate the first one. */ - MPI_Type_get_extent(types[0], &lb, &old_extent); - for (m=1; m<ints[1]; m++) { - for (i=0, nonzeroth=j; i<num; i++) { - if (flat->blocklens[j-num] > 0) { - flat->indices[nonzeroth] = - flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = flat->blocklens[j-num]; - j++; - nonzeroth++; - } else { - flat->count--; - } - } - } - *curr_index = j; - -/* Now repeat with strides. */ - for (i=1; i<top_count; i++) { - num = *curr_index - prev_index; - prev_index = *curr_index; - for (m=0, nonzeroth=j; m<basic_num; m++) { - if (flat->blocklens[j-num] > 0) { - flat->indices[nonzeroth] = - flat->indices[j-num] + adds[i] - adds[i-1]; - flat->blocklens[nonzeroth] = flat->blocklens[j-num]; - j++; - nonzeroth++; - } else { - flat->count--; - } - } - *curr_index = j; - for (m=1; m<ints[1+i]; m++) { - for (k=0,nonzeroth=j; k<basic_num; k++) { - if (flat->blocklens[j-basic_num] >0) { - flat->indices[nonzeroth] = - flat->indices[j-basic_num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[nonzeroth] = flat->blocklens[j-basic_num]; - j++; - nonzeroth++; - } - } - } - *curr_index = j; - } - } - break; - - case MPI_COMBINER_STRUCT: - case MPI_COMBINER_STRUCT_INTEGER: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_STRUCT_INTEGER\n"); - #endif - top_count = ints[0]; - for (n=0; n<top_count; n++) { - ADIOI_Type_get_envelope(types[n], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[n], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[n], flat, st_offset+adds[n], curr_index); - - if (prev_index == *curr_index) { -/* simplest case, current type is basic or contiguous types */ - /* By using ADIO_Offset we preserve +/- sign and - avoid >2G integer arithmetic problems */ - if (ints[1+n] > 0) { - ADIO_Offset blocklength = ints[1+n]; - j = *curr_index; - flat->indices[j] = st_offset + adds[n]; - MPI_Type_size_x(types[n], &old_size); - flat->blocklens[j] = blocklength * old_size; -#ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",n,adds[n],j, flat->indices[j], j, flat->blocklens[j]); -#endif - (*curr_index)++; - } - } - else { -/* current type made up of noncontiguous derived types */ - - j = *curr_index; - num = *curr_index - prev_index; - -/* The current type has to be replicated blocklens[n] times */ - MPI_Type_get_extent(types[n], &lb, &old_extent); - for (m=1; m<ints[1+n]; m++) { - for (i=0; i<num; i++) { - flat->indices[j] = - flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; - flat->blocklens[j] = flat->blocklens[j-num]; -#ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple old_extent "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",old_extent,j, flat->indices[j], j, flat->blocklens[j]); -#endif - j++; - } - } - *curr_index = j; - } - } - break; - - case MPI_COMBINER_RESIZED: - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_RESIZED\n"); - #endif - - /* This is done similar to a type_struct with an lb, datatype, ub */ - - /* handle the Lb */ - j = *curr_index; - /* when we process resized types, we (recursively) process the lower - * bound, the type being resized, then the upper bound. In the - * resized-of-resized case, we might find ourselves updating the upper - * bound based on the inner type, but the lower bound based on the - * upper type. check both lb and ub to prevent mixing updates */ - if (flat->lb_idx == -1 && flat->ub_idx == -1) { - flat->indices[j] = st_offset + adds[0]; - /* this zero-length blocklens[] element, unlike eleswhere in the - * flattening code, is correct and is used to indicate a lower bound - * marker */ - flat->blocklens[j] = 0; - flat->lb_idx = *curr_index; - lb_updated=1; - - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]); - #endif - - (*curr_index)++; - } else { - /* skipped over this chunk because something else higher-up in the - * type construction set this for us already */ - flat->count--; - st_offset -= adds[0]; - } - - /* handle the datatype */ - - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { - ADIOI_Flatten(types[0], flat, st_offset+adds[0], curr_index); - } - else { - /* current type is basic or contiguous */ - j = *curr_index; - flat->indices[j] = st_offset; - MPI_Type_size_x(types[0], &old_size); - flat->blocklens[j] = old_size; - - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]); - #endif - - (*curr_index)++; - } - - /* take care of the extent as a UB */ - /* see note above about mixing updates for why we check lb and ub */ - if ((flat->lb_idx == -1 && flat->ub_idx == -1) || lb_updated) { - j = *curr_index; - flat->indices[j] = st_offset + adds[0] + adds[1]; - /* again, zero-element ok: an upper-bound marker explicitly set by the - * constructor of this resized type */ - flat->blocklens[j] = 0; - flat->ub_idx = *curr_index; - } else { - /* skipped over this chunk because something else higher-up in the - * type construction set this for us already */ - flat->count--; - (*curr_index)--; - } - - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",1,adds[1],j, flat->indices[j], j, flat->blocklens[j]); - #endif - - (*curr_index)++; - - break; - - default: - /* TODO: FIXME (requires changing prototypes to return errors...) */ - DBG_FPRINTF(stderr, "Error: Unsupported datatype passed to ADIOI_Flatten\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -#ifndef MPISGI -/* There is a bug in SGI's impl. of MPI_Type_get_contents. It doesn't - return new datatypes. Therefore no need to free. */ - for (i=0; i<ntypes; i++) { - MPI_Type_get_envelope(types[i], &old_nints, &old_nadds, &old_ntypes, - &old_combiner); - if (old_combiner != MPI_COMBINER_NAMED) MPI_Type_free(types+i); - } -#endif - - ADIOI_Free(ints); - ADIOI_Free(adds); - ADIOI_Free(types); - - #ifdef FLATTEN_DEBUG - DBG_FPRINTF(stderr,"ADIOI_Flatten:: return st_offset %#llX, curr_index %#llX\n",st_offset,*curr_index); - #endif - -} - -/********************************************************/ - -/* ADIOI_Count_contiguous_blocks - * - * Returns number of contiguous blocks in type, and also updates - * curr_index to reflect the space for the additional blocks. - * - * ASSUMES THAT TYPE IS NOT A BASIC!!! - */ -MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, MPI_Count *curr_index) -{ - int i, n; - MPI_Count count=0, prev_index, num, basic_num; - int top_count, combiner, old_combiner, old_is_contig; - int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; - int *ints; - MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ - MPI_Datatype *types; - - ADIOI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); - if (combiner == MPI_COMBINER_NAMED) { - return 1; /* builtin types not supposed to be passed to this routine - */ - } - ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int)); - adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint)); - types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype)); - MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); - - switch (combiner) { -#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP - case MPI_COMBINER_DUP: - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else { - count = 1; - (*curr_index)++; - } - break; -#endif -#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY - case MPI_COMBINER_SUBARRAY: - { - int dims = ints[0]; - MPI_Datatype stype; - - ADIO_Type_create_subarray(dims, - &ints[1], /* sizes */ - &ints[dims+1], /* subsizes */ - &ints[2*dims+1], /* starts */ - ints[3*dims+1], /* order */ - types[0], /* type */ - &stype); - count = ADIOI_Count_contiguous_blocks(stype, curr_index); - /* curr_index will have already been updated; just pass - * count back up. - */ - MPI_Type_free(&stype); - - } - break; -#endif -#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY - case MPI_COMBINER_DARRAY: - { - int dims = ints[2]; - MPI_Datatype dtype; - - ADIO_Type_create_darray(ints[0], /* size */ - ints[1], /* rank */ - dims, - &ints[3], /* gsizes */ - &ints[dims+3], /* distribs */ - &ints[2*dims+3], /* dargs */ - &ints[3*dims+3], /* psizes */ - ints[4*dims+3], /* order */ - types[0], - &dtype); - count = ADIOI_Count_contiguous_blocks(dtype, curr_index); - /* curr_index will have already been updated; just pass - * count back up. - */ - MPI_Type_free(&dtype); - } - break; -#endif - case MPI_COMBINER_CONTIGUOUS: - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else count = 1; - - if (prev_index == *curr_index) -/* simplest case, made up of basic or contiguous types */ - (*curr_index)++; - else { -/* made up of noncontiguous derived types */ - num = *curr_index - prev_index; - count *= top_count; - *curr_index += (top_count - 1)*num; - } - break; - - case MPI_COMBINER_VECTOR: - case MPI_COMBINER_HVECTOR: - case MPI_COMBINER_HVECTOR_INTEGER: - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else count = 1; - - if (prev_index == *curr_index) { -/* simplest case, vector of basic or contiguous types */ - count = top_count; - *curr_index += count; - } - else { -/* vector of noncontiguous derived types */ - num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklen times - and then strided. */ - count *= ints[1] * top_count; - -/* First one */ - *curr_index += (ints[1] - 1)*num; - -/* Now repeat with strides. */ - num = *curr_index - prev_index; - *curr_index += (top_count - 1)*num; - } - break; - - case MPI_COMBINER_INDEXED: - case MPI_COMBINER_HINDEXED: - case MPI_COMBINER_HINDEXED_INTEGER: - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else count = 1; - - if (prev_index == *curr_index) { -/* simplest case, indexed type made up of basic or contiguous types */ - count = top_count; - *curr_index += count; - } - else { -/* indexed type made up of noncontiguous derived types */ - basic_num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklens[i] times - and then strided. */ - *curr_index += (ints[1]-1) * basic_num; - count *= ints[1]; - -/* Now repeat with strides. */ - for (i=1; i<top_count; i++) { - count += ints[1+i] * basic_num; - *curr_index += ints[1+i] * basic_num; - } - } - break; - -#if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK - case MPI_COMBINER_HINDEXED_BLOCK: -#endif - case MPI_COMBINER_INDEXED_BLOCK: - top_count = ints[0]; - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else count = 1; - - if (prev_index == *curr_index) { -/* simplest case, indexed type made up of basic or contiguous types */ - count = top_count; - *curr_index += count; - } - else { -/* indexed type made up of noncontiguous derived types */ - basic_num = *curr_index - prev_index; - -/* The noncontiguous types have to be replicated blocklens[i] times - and then strided. */ - *curr_index += (ints[1]-1) * basic_num; - count *= ints[1]; - -/* Now repeat with strides. */ - *curr_index += (top_count-1) * count; - count *= top_count; - } - break; - - case MPI_COMBINER_STRUCT: - case MPI_COMBINER_STRUCT_INTEGER: - top_count = ints[0]; - count = 0; - for (n=0; n<top_count; n++) { - ADIOI_Type_get_envelope(types[n], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[n], &old_is_contig); - - prev_index = *curr_index; - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - count += ADIOI_Count_contiguous_blocks(types[n], curr_index); - - if (prev_index == *curr_index) { -/* simplest case, current type is basic or contiguous types */ - count++; - (*curr_index)++; - } - else { -/* current type made up of noncontiguous derived types */ -/* The current type has to be replicated blocklens[n] times */ - - num = *curr_index - prev_index; - count += (ints[1+n]-1)*num; - (*curr_index) += (ints[1+n]-1)*num; - } - } - break; - - case MPI_COMBINER_RESIZED: - /* treat it as a struct with lb, type, ub */ - - /* add 2 for lb and ub */ - (*curr_index) += 2; - count += 2; - - /* add for datatype */ - ADIOI_Type_get_envelope(types[0], &old_nints, &old_nadds, - &old_ntypes, &old_combiner); - ADIOI_Datatype_iscontig(types[0], &old_is_contig); - - if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { - count += ADIOI_Count_contiguous_blocks(types[0], curr_index); - } - else { - /* basic or contiguous type */ - count++; - (*curr_index)++; - } - break; - - default: - /* TODO: FIXME */ - DBG_FPRINTF(stderr, "Error: Unsupported datatype passed to ADIOI_Count_contiguous_blocks, combiner = %d\n", combiner); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -#ifndef MPISGI -/* There is a bug in SGI's impl. of MPI_Type_get_contents. It doesn't - return new datatypes. Therefore no need to free. */ - for (i=0; i<ntypes; i++) { - MPI_Type_get_envelope(types[i], &old_nints, &old_nadds, &old_ntypes, - &old_combiner); - if (old_combiner != MPI_COMBINER_NAMED) MPI_Type_free(types+i); - } -#endif - - ADIOI_Free(ints); - ADIOI_Free(adds); - ADIOI_Free(types); - return count; -} - - -/****************************************************************/ - -/* ADIOI_Optimize_flattened() - * - * Scans the blocks of a flattened type and merges adjacent blocks - * together, resulting in a shorter blocklist (and thus fewer - * contiguous operations). - * - * NOTE: a further optimization would be to remove zero length blocks. However, - * the first and last blocks must remain as zero length first or last block - * indicates UB and LB. Furthermore, once the "zero length blocklen" fix - * went in, the flattened representation should no longer have zero-length - * blocks except for UB and LB markers. - */ -void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type) -{ - int i, j, opt_blocks; - ADIO_Offset *opt_blocklens; - ADIO_Offset *opt_indices; - - opt_blocks = 1; - - /* save number of noncontiguous blocks in opt_blocks */ - for (i=0; i < (flat_type->count - 1); i++) { - if ((flat_type->indices[i] + flat_type->blocklens[i] != - flat_type->indices[i + 1])) - opt_blocks++; - } - - /* if we can't reduce the number of blocks, quit now */ - if (opt_blocks == flat_type->count) return; - - opt_blocklens = (ADIO_Offset *) ADIOI_Malloc(opt_blocks * sizeof(ADIO_Offset)); - opt_indices = (ADIO_Offset *)ADIOI_Malloc(opt_blocks*sizeof(ADIO_Offset)); - - /* fill in new blocklists */ - opt_blocklens[0] = flat_type->blocklens[0]; - opt_indices[0] = flat_type->indices[0]; - j = 0; - for (i=0; i < (flat_type->count - 1); i++) { - if ((flat_type->indices[i] + flat_type->blocklens[i] == - flat_type->indices[i + 1])) - opt_blocklens[j] += flat_type->blocklens[i + 1]; - else { - j++; - opt_indices[j] = flat_type->indices[i + 1]; - opt_blocklens[j] = flat_type->blocklens[i + 1]; - } - } - flat_type->count = opt_blocks; - ADIOI_Free(flat_type->blocklens); - ADIOI_Free(flat_type->indices); - flat_type->blocklens = opt_blocklens; - flat_type->indices = opt_indices; - return; -} - -void ADIOI_Delete_flattened(MPI_Datatype datatype) -{ - ADIOI_Flatlist_node *flat, *prev; - - prev = flat = ADIOI_Flatlist; - while (flat && (flat->type != datatype)) { - prev = flat; - flat = flat->next; - } - if (flat) { - prev->next = flat->next; - if (flat->blocklens) ADIOI_Free(flat->blocklens); - if (flat->indices) ADIOI_Free(flat->indices); - ADIOI_Free(flat); - } -} - -ADIOI_Flatlist_node * ADIOI_Flatten_and_find(MPI_Datatype datatype) -{ - ADIOI_Flatlist_node *node; - ADIOI_Flatten_datatype(datatype); - node = ADIOI_Flatlist; - while (node->type != datatype) node = node->next; - return node; -} diff --git a/3rd-party/romio321/adio/common/get_fp_posn.c b/3rd-party/romio321/adio/common/get_fp_posn.c deleted file mode 100644 index f2e025d00f8f0697b7475b86e3630b2b3a6970cf..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/get_fp_posn.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "adioi.h" - -/* returns the current position of the individual file pointer - in etype units relative to the current view. */ - -void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset) -{ - ADIOI_Flatlist_node *flat_file; - int i, flag; - MPI_Count filetype_size, etype_size; - int filetype_is_contig; - MPI_Aint filetype_extent, lb; - ADIO_Offset disp, byte_offset, sum=0, size_in_file, n_filetypes, frd_size; - - ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - etype_size = fd->etype_size; - - if (filetype_is_contig) *offset = (fd->fp_ind - fd->disp)/etype_size; - else { -/* filetype already flattened in ADIO_Open */ - flat_file = ADIOI_Flatlist; - while (flat_file->type != fd->filetype) flat_file = flat_file->next; - - MPI_Type_size_x(fd->filetype, &filetype_size); - MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); - - disp = fd->disp; - byte_offset = fd->fp_ind; - n_filetypes = -1; - flag = 0; - while (!flag) { - sum = 0; - n_filetypes++; - for (i=0; i<flat_file->count; i++) { - sum += flat_file->blocklens[i]; - if (disp + flat_file->indices[i] + - n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + flat_file->blocklens[i] - >= byte_offset) { - frd_size = disp + flat_file->indices[i] + - n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent - + flat_file->blocklens[i] - byte_offset; - sum -= frd_size; - flag = 1; - break; - } - } - } - size_in_file = n_filetypes * (ADIO_Offset)filetype_size + sum; - *offset = size_in_file/etype_size; - } -} diff --git a/3rd-party/romio321/adio/common/greq_fns.c b/3rd-party/romio321/adio/common/greq_fns.c deleted file mode 100644 index aff8ff77e5dd5bd9dbabf4fbdd19852e34660126..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/greq_fns.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "mpiu_greq.h" - -/* In cases where nonblocking operation will carry out blocking version, - * instantiate and complete a generalized request */ - -void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset bytes, - int *error_code, MPI_Request *request) -{ - MPI_Status *status; - status = (MPI_Status *)ADIOI_Malloc(sizeof(MPI_Status)); - - status->MPI_ERROR = *error_code; -#ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, MPI_BYTE, bytes); -#endif - /* --BEGIN ERROR HANDLING-- */ - if (*error_code != MPI_SUCCESS) - *error_code = MPIO_Err_return_file(*fh, *error_code); - /* --END ERROR HANDLING-- */ - MPI_Grequest_start(MPIU_Greq_query_fn, MPIU_Greq_free_fn, - MPIU_Greq_cancel_fn, status, request); - MPI_Grequest_complete(*request); -} diff --git a/3rd-party/romio321/adio/common/heap-sort.c b/3rd-party/romio321/adio/common/heap-sort.c deleted file mode 100644 index c398e41aeea204836bb96c272067ea1dc4db915d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/heap-sort.c +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "heap-sort.h" -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include <math.h> - -#define NOEXP2 - -static void heapify(heap_t *heap, int i); - -/* From Introduction To Algorithms by Cormen, Leiserson, and Rivest */ - -static inline int parent(int i) { - return (i/2); -} - -static inline int left(int i) { - return (2*i); -} - -static inline int right(int i) { - return (2*i + 1); -} - -int ADIOI_Heap_create(heap_t *heap, int size) { - heap->size = size; - heap->nodes = (heap_node_t *) ADIOI_Calloc (size, sizeof(heap_node_t)); - if (heap->nodes == NULL) - return 1; - else - return 0; -} - -void ADIOI_Heap_free(heap_t *heap) { - ADIOI_Free(heap->nodes); -} - -/* should suppress unused warnings on GCC */ -static void build_heap(heap_t *heap) ATTRIBUTE((unused, used)); - -static void build_heap(heap_t *heap) -{ - int i; - for (i=(heap->size/2-1); i >= 0; i--) - heapify(heap, i); -} - -static void heapify(heap_t *heap, int i) { - int l, r, smallest; - heap_node_t *nodes; - heap_node_t tmp_node; - - nodes = heap->nodes; - - l = left(i); - r = right(i); - - if ((l <= heap->size) && (nodes[l].offset < nodes[i].offset)) - smallest = l; - else - smallest = i; - - if ((r <= heap->size) && (nodes[r].offset < nodes[smallest].offset)) - smallest = r; - - if (smallest != i) { - tmp_node = nodes[i]; - nodes[i] = nodes[smallest]; - nodes[smallest] = tmp_node; - heapify(heap, smallest); - } -} - -void ADIOI_Heap_insert(heap_t *heap, ADIO_Offset offset, int proc, - ADIO_Offset reg_max_len) { - heap_node_t *nodes; - int i; - nodes = heap->nodes; - i = ++heap->size - 1; - while ((i > 0) && (nodes[parent(i)].offset > offset)) { - nodes[i] = nodes[parent(i)]; - i = parent(i); - } - nodes[i].offset = offset; - nodes[i].proc = proc; - nodes[i].reg_max_len = reg_max_len; -} - -void ADIOI_Heap_extract_min(heap_t *heap, ADIO_Offset* offset, int *proc, - ADIO_Offset *reg_max_len) { - heap_node_t *nodes; - nodes = heap->nodes; - - assert (heap->size > 0); - *offset = nodes[0].offset; - *proc = nodes[0].proc; - *reg_max_len = nodes[0].reg_max_len; - nodes[0] = nodes[heap->size-1]; - heap->size--; - heapify(heap, 0); -} - -/* should suppress unused warnings on GCC */ -static void print_heap(heap_t *heap) ATTRIBUTE((unused, used)); - -static void print_heap(heap_t *heap) -{ -#ifndef NOEXP2 - int i; - double level = 0; - int next_level_idx = 1; - - printf ("heap->size = %d\n", heap->size); - printf ("offsets:\n"); - for (i=0; i < heap->size; i++) { - printf ("%lld ", heap->nodes[i].offset); - - if ((i+1) == next_level_idx) { - printf ("\n"); - next_level_idx += (int) exp2(level+1); - level++; - } - } - printf ("\n"); -#endif -} diff --git a/3rd-party/romio321/adio/common/hint_fns.c b/3rd-party/romio321/adio/common/hint_fns.c deleted file mode 100644 index 284e4a96272bc11be83d35e1706b8b48d7c3c797..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/hint_fns.c +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2013 UChicago/Argonne, LLC - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "hint_fns.h" - - -int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code) -{ - int intval, tmp_val, flag, ret=0; - char *value; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if (value == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - funcname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return -1; - } - - ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - intval = atoi(value); - tmp_val = intval; - - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != intval) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, - key, - error_code); - ret = -1; - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - ADIOI_Info_set(fd->info, key, value); - /* some file systems do not cache hints in the fd struct */ - if (local_cache != NULL) *local_cache = intval; - } -fn_exit: - ADIOI_Free(value); - return ret; -} - -int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code) -{ - int tmp_val, flag, ret=0; - char *value; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if (value == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - funcname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return -1; - } - - ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { - ADIOI_Info_set(fd->info, key, value); - *local_cache = ADIOI_HINT_ENABLE; - } - else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { - ADIOI_Info_set(fd->info, key, value); - *local_cache = ADIOI_HINT_DISABLE; - } - else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) - { - ADIOI_Info_set(fd->info, key, value); - *local_cache = ADIOI_HINT_AUTO; - } - - tmp_val = *local_cache; - - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != *local_cache) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, - key, - error_code); - ret = -1; - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - } -fn_exit: - ADIOI_Free(value); - return ret; -} -int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code) -{ - int flag, tmp_val, ret=0; - char *value; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if (value == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - funcname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return -1; - } - - ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - if (flag) { - if (!strcmp(value, "true") || !strcmp(value, "TRUE")) { - ADIOI_Info_set(fd->info, key, value); - *local_cache = 1; - } - else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) { - ADIOI_Info_set(fd->info, key, value); - *local_cache = 0; - } - tmp_val = *local_cache; - - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_val != *local_cache) { - MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, - key, - error_code); - ret = -1; - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - } -fn_exit: - ADIOI_Free(value); - return ret; -} -int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key, - char **local_cache, char *funcname, int *error_code) -{ - int flag, ret=0; - size_t len; - char *value; - - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - if (value == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - funcname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return -1; - } - - ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - ADIOI_Info_set(fd->info, "cb_config_list", value); - len = (strlen(value)+1) * sizeof(char); - *local_cache = ADIOI_Malloc(len); - if (*local_cache == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - funcname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - ret = -1; - goto fn_exit; - } - ADIOI_Strncpy(*local_cache, value, len); - } - /* if it has been set already, we ignore it the second time. - * otherwise we would get an error if someone used the same - * info value with a cb_config_list value in it in a couple - * of calls, which would be irritating. */ -fn_exit: - ADIOI_Free(value); - return ret; -} diff --git a/3rd-party/romio321/adio/common/lock.c b/3rd-party/romio321/adio/common/lock.c deleted file mode 100644 index 2590d77433a601c4ee4c27d31c895473711352ae..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/lock.c +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef ROMIO_NTFS -/* This assumes that lock will always remain in the common directory and - * that the ntfs directory will always be called ad_ntfs. */ -#include "..\ad_ntfs\ad_ntfs.h" -int ADIOI_Set_lock(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whence, - ADIO_Offset len) -{ - static char myname[] = "ADIOI_Set_lock"; - int ret_val, error_code = MPI_SUCCESS; - OVERLAPPED Overlapped; - DWORD dwFlags; - - ADIOI_UNREFERENCED_ARG(whence); - - if (len == 0) return MPI_SUCCESS; - - dwFlags = type; - - Overlapped.hEvent = /*0;*/CreateEvent(NULL, TRUE, FALSE, NULL); -#ifdef HAVE_INT64 - Overlapped.Offset = ( (DWORD) ( offset & (__int64) 0xFFFFFFFF ) ); - Overlapped.OffsetHigh = ( (DWORD) ( (offset >> 32) & (__int64) 0xFFFFFFFF ) ); - - if (cmd == ADIOI_LOCK_CMD) - { - /*printf("locking %d\n", (int)fd);fflush(stdout);*/ - ret_val = LockFileEx(fd, dwFlags, 0, - ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), - ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), - &Overlapped); - } - else - { - /*printf("unlocking %d\n", (int)fd);fflush(stdout);*/ - ret_val = UnlockFileEx(fd, 0, - ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), - ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), - &Overlapped); - } -#else - Overlapped.Offset = offset; - Overlapped.OffsetHigh = 0; - - if (cmd == ADIOI_LOCK_CMD) - { - /*printf("locking %d\n", (int)fd);fflush(stdout);*/ - ret_val = LockFileEx(fd, dwFlags, 0, len, 0, &Overlapped); - } - else - { - /*printf("unlocking %d\n", (int)fd);fflush(stdout);*/ - ret_val = UnlockFileEx(fd, 0, len, 0, &Overlapped); - } -#endif - - if (!ret_val) - { - char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; - /* - FPRINTF(stderr, "File locking failed in ADIOI_Set_lock.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - */ - ret_val = GetLastError(); - if (ret_val == ERROR_IO_PENDING) - { - DWORD dummy; - ret_val = GetOverlappedResult(fd, &Overlapped, &dummy, TRUE); - if (ret_val) - { - CloseHandle(Overlapped.hEvent); - return MPI_SUCCESS; - } - ret_val = GetLastError(); - } - ADIOI_NTFS_Strerror(ret_val, errMsg, ADIOI_NTFS_ERR_MSG_MAX); - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_IO, "**io", "**io %s", errMsg); - } - CloseHandle(Overlapped.hEvent); - - return error_code; -} -#else -int ADIOI_Set_lock(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whence, - ADIO_Offset len) -{ - int err, error_code, err_count = 0, sav_errno; - struct flock lock; - - if (len == 0) return MPI_SUCCESS; - - - /* Depending on the compiler flags and options, struct flock - may not be defined with types that are the same size as - ADIO_Offsets. */ -/* FIXME: This is a temporary hack until we use flock64 where - available. It also doesn't fix the broken Solaris header sys/types.h - header file, which declars off_t as a UNION ! Configure tests to - see if the off64_t is a union if large file support is requested; - if so, it does not select large file support. -*/ -#ifdef NEEDS_INT_CAST_WITH_FLOCK - lock.l_type = type; - lock.l_start = (int)offset; - lock.l_whence = whence; - lock.l_len = (int)len; -#else - lock.l_type = type; - lock.l_whence = whence; - lock.l_start = offset; - lock.l_len = len; -#endif - - sav_errno = errno; /* save previous errno in case we recover from retryable errors */ - errno = 0; - do { - err = fcntl(fd, cmd, &lock); -#ifdef USE_DBG_LOGGING -/* if (MPIU_DBG_SELECTED(ROMIO,TERSE)) */ - { - if (err && ((errno == EINTR) || (errno == EINPROGRESS))) - { - if((err_count < 5) || (err_count > 9995)) - { - fprintf(stderr, "File locking failed in ADIOI_Set_lock(fd %#X,cmd %s/%#X,type %s/%#X,whence %#X) with return value %#X and errno %#X. Retry (%d).\n", - fd, - ((cmd == F_GETLK )? "F_GETLK" : - ((cmd == F_SETLK )? "F_SETLK" : - ((cmd == F_SETLKW )? "F_SETLKW" : "UNEXPECTED"))), - cmd, - ((type == F_RDLCK )? "F_RDLCK" : - ((type == F_WRLCK )? "F_WRLCK" : - ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), - type, - whence, err, errno, err_count); - perror("ADIOI_Set_lock:"); - fprintf(stderr,"ADIOI_Set_lock:offset %#llx, length %#llx\n",(unsigned long long)offset, (unsigned long long)len); - } - } - } -#endif - } while (err && ((errno == EINTR) || ((errno == EINPROGRESS) && (++err_count < 10000)))); - - if (err && (errno != EBADF)) { - /* FIXME: This should use the error message system, - especially for MPICH */ - FPRINTF(stderr, "This requires fcntl(2) to be implemented. As of 8/25/2011 it is not. Generic MPICH Message: File locking failed in ADIOI_Set_lock(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" - "- If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n" - "- If the file system is LUSTRE, ensure that the directory is mounted with the 'flock' option.\n", - fd, - ((cmd == F_GETLK )? "F_GETLK" : - ((cmd == F_SETLK )? "F_SETLK" : - ((cmd == F_SETLKW )? "F_SETLKW" : "UNEXPECTED"))), - cmd, - ((type == F_RDLCK )? "F_RDLCK" : - ((type == F_WRLCK )? "F_WRLCK" : - ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), - type, - whence, err, errno); - perror("ADIOI_Set_lock:"); - FPRINTF(stderr,"ADIOI_Set_lock:offset %llu, length %llu\n",(unsigned long long)offset, (unsigned long long)len); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - if(!err) /* report fcntl failure errno's (EBADF), otherwise */ - errno = sav_errno; /* restore previous errno in case we recovered from retryable errors */ - - error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; - return error_code; -} -#endif - -#if (defined(ROMIO_HFS) || defined(ROMIO_XFS)) -int ADIOI_Set_lock64(FDTYPE fd, int cmd, int type, ADIO_Offset offset, - int whence, - ADIO_Offset len) -{ - int err, error_code; - struct flock64 lock; - - if (len == 0) return MPI_SUCCESS; - - lock.l_type = type; - lock.l_start = offset; - lock.l_whence = whence; - lock.l_len = len; - - do { - err = fcntl(fd, cmd, &lock); - } while (err && (errno == EINTR)); - - if (err && (errno != EBADF)) { - FPRINTF(stderr, "File locking failed in ADIOI_Set_lock64(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" - "If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n", - fd, - ((cmd == F_GETLK )? "F_GETLK" : - ((cmd == F_SETLK )? "F_SETLK" : - ((cmd == F_SETLKW )? "F_SETLKW" : - ((cmd == F_GETLK64 )? "F_GETLK64" : - ((cmd == F_SETLK64 )? "F_SETLK64" : - ((cmd == F_SETLKW64)? "F_SETLKW64" : "UNEXPECTED")))))), - cmd, - ((type == F_RDLCK )? "F_RDLCK" : - ((type == F_WRLCK )? "F_WRLCK" : - ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), - type, - whence, err, errno); - perror("ADIOI_Set_lock64:"); - FPRINTF(stderr,"ADIOI_Set_lock:offset %llu, length %llu\n",(unsigned long long)offset, (unsigned long long)len); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; - return error_code; -} -#endif diff --git a/3rd-party/romio321/adio/common/onesided_aggregation.c b/3rd-party/romio321/adio/common/onesided_aggregation.c deleted file mode 100644 index 71a5b7bee6e6b9278f1b73d282cad08988a88bfe..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/onesided_aggregation.c +++ /dev/null @@ -1,2174 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2015 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#ifdef ROMIO_GPFS -/* right now this is GPFS only but TODO: extend this to all file systems */ -#include "../ad_gpfs/ad_gpfs_tuning.h" -#else -int gpfsmpio_onesided_no_rmw = 0; -int gpfsmpio_write_aggmethod = 0; -int gpfsmpio_read_aggmethod = 0; -int gpfsmpio_onesided_always_rmw = 0; -#endif - -#include <pthread.h> - -// #define onesidedtrace 1 - - -/* This data structure holds the number of extents, the index into the flattened buffer and the remnant length - * beyond the flattened buffer index corresponding to the base buffer offset for non-contiguous source data - * for the range to be written coresponding to the round and target agg. - */ -typedef struct NonContigSourceBufOffset { - int dataTypeExtent; - int flatBufIndice; - ADIO_Offset indiceOffset; -} NonContigSourceBufOffset; - -/* This data structure holds the access state of the source buffer for target - * file domains within aggregators corresponding to the target data blocks. It - * is designed to be initialized with a starting point for a given file domain - * with an aggregator, after which the data access for data written to a given - * file domain from this compute is linear and uninterupted, and this serves as - * a key optimization for feeding the target aggs. For contigous source data - * the starting point is a single-value offset, for non-contiguous data it is - * the number of extents, the index into the flattened buffer and the remnant - * length beyond the flattened buffer index. The validity of the usage of this - * structure relies on the requirement that only 1 aggregator can write to a - * given file domain. */ -typedef struct FDSourceBufferState { - - ADIO_Offset indiceOffset; - MPI_Aint bufTypeExtent; - int dataTypeExtent; - int flatBufIndice; - - ADIO_Offset sourceBufferOffset; - -} FDSourceBufferState; - - -static int ADIOI_OneSidedSetup(ADIO_File fd, int procs) { - int ret = MPI_SUCCESS; - - ret = MPI_Win_create(fd->io_buf,fd->hints->cb_buffer_size,1, - MPI_INFO_NULL,fd->comm, &fd->io_buf_window); - if (ret != MPI_SUCCESS) goto fn_exit; - fd->io_buf_put_amounts = (int *) ADIOI_Malloc(procs*sizeof(int)); - ret =MPI_Win_create(fd->io_buf_put_amounts,procs*sizeof(int),sizeof(int), - MPI_INFO_NULL,fd->comm, &fd->io_buf_put_amounts_window); -fn_exit: - return ret; -} - -int ADIOI_OneSidedCleanup(ADIO_File fd) -{ - int ret = MPI_SUCCESS; - if (fd->io_buf_window != MPI_WIN_NULL) - ret = MPI_Win_free(&fd->io_buf_window); - if (fd->io_buf_put_amounts_window != MPI_WIN_NULL) - ret = MPI_Win_free(&fd->io_buf_put_amounts_window); - if (fd->io_buf_put_amounts != NULL) - ADIOI_Free(fd->io_buf_put_amounts); - - return ret; -} - -/* This funtion packs a contigous buffer of data from the non-contgious source - * buffer for a specified chunk of data and advances the FDSourceBufferState - * machinery, so subsequent calls with the FDSourceBufferState will return the - * next linear chunk. - * Parameters: - * in: sourceDataBuffer - pointer to source data buffer. - * in: flatBuf - pointer to flattened source data buffer - * in: targetNumBytes - number of bytes to return and advance. - * in: packing - whether data is being packed from the source buffer to the - * packed buffer (1) or unpacked from the packed buffer to the source - * buffer (0) - * in/out: currentFDSourceBufferState - pointer to FDSourceBufferState structure, current - * data used as starting point, will be updated with - * the new state after targetNumBytes advance. - * out: packedDataBufer - pointer to the output packed data buffer. If the - * value is NULL then no data will be written. - * - */ -inline static void nonContigSourceDataBufferAdvance(char *sourceDataBuffer, - ADIOI_Flatlist_node *flatBuf, int targetNumBytes, int packing, - FDSourceBufferState *currentFDSourceBufferState, char *packedDataBufer) -{ - // make currentDataTypeExtent and bufTypeExtent ADIO_Offset since they are - // used in offset calculations - ADIO_Offset currentIndiceOffset = currentFDSourceBufferState->indiceOffset; - ADIO_Offset bufTypeExtent = (ADIO_Offset)currentFDSourceBufferState->bufTypeExtent; - ADIO_Offset currentDataTypeExtent = - (ADIO_Offset)currentFDSourceBufferState->dataTypeExtent; - int currentFlatBufIndice = currentFDSourceBufferState->flatBufIndice; - - int targetSendDataIndex = 0; - -#ifdef onesidedtrace - printf("nonContigSourceDataBufferAdvance: currentFlatBufIndice is %d currentDataTypeExtent is %ld currentIndiceOffset is %ld\n",currentFlatBufIndice,currentDataTypeExtent,currentIndiceOffset); -#endif - - int remainingBytesToLoad = targetNumBytes; - while (remainingBytesToLoad > 0) { - if ((flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset) >= remainingBytesToLoad) { // we can get the rest of our data from this indice - ADIO_Offset physicalSourceBufferOffset = (currentDataTypeExtent * bufTypeExtent) + flatBuf->indices[currentFlatBufIndice] + currentIndiceOffset; - -#ifdef onesidedtrace - printf("loading remainingBytesToLoad %d from src buffer offset %ld to targetSendDataIndex %d\n",remainingBytesToLoad,physicalSourceBufferOffset,targetSendDataIndex); -#endif - - if (packedDataBufer != NULL) { - if (packing) - memcpy(&(packedDataBufer[targetSendDataIndex]),&(sourceDataBuffer[physicalSourceBufferOffset]),remainingBytesToLoad); - else - memcpy(&(sourceDataBuffer[physicalSourceBufferOffset]),&(packedDataBufer[targetSendDataIndex]),remainingBytesToLoad); - } - - targetSendDataIndex += remainingBytesToLoad; - currentIndiceOffset += (ADIO_Offset)remainingBytesToLoad; - if (currentIndiceOffset >= flatBuf->blocklens[currentFlatBufIndice]) { - currentIndiceOffset = (ADIO_Offset)0; - currentFlatBufIndice++; - if (currentFlatBufIndice == flatBuf->count) { - currentFlatBufIndice = 0; - currentDataTypeExtent++; - } - } - remainingBytesToLoad = 0; - - } - else { // we can only get part of our data from this indice - int amountDataToLoad = (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); - ADIO_Offset physicalSourceBufferOffset = (currentDataTypeExtent * bufTypeExtent) + flatBuf->indices[currentFlatBufIndice] + currentIndiceOffset; - -#ifdef onesidedtrace - printf("loading amountDataToLoad %d from src buffer offset %ld to targetSendDataIndex %d\n",amountDataToLoad,physicalSourceBufferOffset,targetSendDataIndex); -#endif - if (packedDataBufer != NULL) { - if (packing) - memcpy(&(packedDataBufer[targetSendDataIndex]),&(sourceDataBuffer[physicalSourceBufferOffset]),amountDataToLoad); - else - memcpy(&(sourceDataBuffer[physicalSourceBufferOffset]),&(packedDataBufer[targetSendDataIndex]),amountDataToLoad); - } - - targetSendDataIndex += amountDataToLoad; - currentIndiceOffset = (ADIO_Offset)0; - currentFlatBufIndice++; - if (currentFlatBufIndice == flatBuf->count) { - currentFlatBufIndice = 0; - currentDataTypeExtent++; - } - remainingBytesToLoad -= amountDataToLoad; - } - } // while - - /* update machinery with new flatbuf position - */ - currentFDSourceBufferState->indiceOffset = currentIndiceOffset; - currentFDSourceBufferState->dataTypeExtent = (int) currentDataTypeExtent; - currentFDSourceBufferState->flatBufIndice = currentFlatBufIndice; -#ifdef onesidedtrace - printf("source buf advanced to currentFlatBufIndice %d currentDataTypeExtent %ld currentIndiceOffset %ld\n",currentFlatBufIndice,currentDataTypeExtent,currentIndiceOffset); -#endif -} - - -void ADIOI_OneSidedWriteAggregation(ADIO_File fd, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - const void *buf, - MPI_Datatype datatype, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int numNonZeroDataOffsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end, - int *hole_found) - -{ - int i,j; /* generic iterators */ - -#ifdef onesidedtrace - if (buf == NULL) { - printf("ADIOI_OneSidedWriteAggregation - buf is NULL contig_access_count is %d\n",contig_access_count); - for (i=0;i<contig_access_count;i++) - printf("offset_list[%d] is %ld len_list[%d] is %ld\n", - i,offset_list[i],i,len_list[i]); - } - if (contig_access_count < 0) - printf("ADIOI_OneSidedWriteAggregation - contig_access_count " - "of %d is less than 0\n",contig_access_count); -#endif - - int lenListOverZero = 0; - for (i=0;((i<contig_access_count) && (!lenListOverZero));i++) - if (len_list[i] > 0) - lenListOverZero = 1; - - - *error_code = MPI_SUCCESS; /* initialize to success */ - -#ifdef ROMIO_GPFS - double startTimeBase,endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - MPI_Status status; - pthread_t io_thread; - void *thread_ret; - ADIOI_IO_ThreadFuncData io_thread_args; - - int nprocs,myrank; - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); -#ifdef onesidedtrace -printf("ADIOI_OneSidedWriteAggregation started on rank %d\n",myrank); -#endif - - - if (fd->io_buf_window == MPI_WIN_NULL || - fd->io_buf_put_amounts_window == MPI_WIN_NULL) - { - ADIOI_OneSidedSetup(fd, nprocs); - } - - /* This flag denotes whether the source datatype is contiguous, which is referenced throughout the algorithm - * and defines how the source buffer offsets and data chunks are determined. If the value is 1 (true - contiguous data) - * things are profoundly simpler in that the source buffer offset for a given target offset simply linearly increases - * by the chunk sizes being written. If the value is 0 (non-contiguous) then these values are based on calculations - * from the flattened source datatype. - */ - int bufTypeIsContig; - - MPI_Aint bufTypeExtent, lb; - ADIOI_Flatlist_node *flatBuf=NULL; - ADIOI_Datatype_iscontig(datatype, &bufTypeIsContig); - - if (!bufTypeIsContig) { - /* Flatten the non-contiguous source datatype and set the extent. */ - flatBuf = ADIOI_Flatten_and_find(datatype); - MPI_Type_get_extent(datatype, &lb, &bufTypeExtent); -#ifdef onesidedtrace - printf("flatBuf->count is %d bufTypeExtent is %d\n", flatBuf->count,bufTypeExtent); - for (i=0;i<flatBuf->count;i++) - printf("flatBuf->blocklens[%d] is %d flatBuf->indices[%d] is %ld\n",i,flatBuf->blocklens[i],i,flatBuf->indices[i]); -#endif - } - - int naggs = fd->hints->cb_nodes; - - /* Track the state of the source buffer for feeding the target data blocks. - * For GPFS the number of file domains per agg is always 1 so we just need 1 agg - * dimension to track the data, in the case of lustre we will need 2 dimensions - * agg and file domain since aggs write to multiple file domains in the case of lustre. - * This structure will be modified as the data is written to reflect the current state - * of the offset. - */ - -#ifdef onesidedtrace - printf("sizeof(FDSourceBufferState) is %d - make sure is 32 for 32-byte memalign optimal\n",sizeof(FDSourceBufferState)); -#endif - FDSourceBufferState *currentFDSourceBufferState; - - currentFDSourceBufferState = (FDSourceBufferState *) ADIOI_Malloc(naggs * sizeof(FDSourceBufferState)); - for (i=0;i<naggs;i++) { - /* initialize based on the bufType to indicate that it is unset. - */ - if (bufTypeIsContig) { - currentFDSourceBufferState[i].sourceBufferOffset = -1; - } - else { - currentFDSourceBufferState[i].indiceOffset = -1; - } - } - -#ifdef onesidedtrace - printf(" ADIOI_OneSidedWriteAggregation bufTypeIsContig is %d contig_access_count is %d\n",bufTypeIsContig,contig_access_count); -#endif - - /* maxNumContigOperations keeps track of how many different chunks we will need to send - * for the purpose of pre-allocating the data structures to hold them. - */ - int maxNumContigOperations = contig_access_count; - - ADIO_Offset lastFileOffset = 0, firstFileOffset = -1; - /* Get the total range being written - in the case of just 1 byte the starting and ending offsets - * will match the same as they would for 0 bytes so to distinguish we need the actual data count. - */ - for (j=0;j<numNonZeroDataOffsets;j++) { -#ifdef onesidedtrace -printf("end_offsets[%d] is %ld st_offsets[%d] is %ld\n",j,end_offsets[j],j,st_offsets[j]); -#endif - lastFileOffset = ADIOI_MAX(lastFileOffset,end_offsets[j]); - if (firstFileOffset == -1) - firstFileOffset = st_offsets[j]; - else - firstFileOffset = ADIOI_MIN(firstFileOffset,st_offsets[j]); - } - - int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ - int iAmUsedAgg = 0; /* whether or not this rank is used as an aggregator. */ - - /* Make coll_bufsize an ADIO_Offset since it is used in calculations with offsets. - */ - ADIO_Offset coll_bufsize = (ADIO_Offset)(fd->hints->cb_buffer_size); -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio == 1) { - /* split buffer in half for a kind of double buffering with the threads*/ - coll_bufsize = (ADIO_Offset)(fd->hints->cb_buffer_size/2); - } -#endif - - /* This logic defines values that are used later to determine what offsets define the portion - * of the file domain the agg is writing this round. - */ - int greatestFileDomainAggRank = -1,smallestFileDomainAggRank = -1; - ADIO_Offset greatestFileDomainOffset = 0; - ADIO_Offset smallestFileDomainOffset = lastFileOffset; - for (j=0;j<naggs;j++) { - if (fd_end[j] > greatestFileDomainOffset) { - greatestFileDomainOffset = fd_end[j]; - greatestFileDomainAggRank = j; - } - if (fd_start[j] < smallestFileDomainOffset) { - smallestFileDomainOffset = fd_start[j]; - smallestFileDomainAggRank = j; - } - if (fd->hints->ranklist[j] == myrank) { - myAggRank = j; - if (fd_end[j] > fd_start[j]) { - iAmUsedAgg = 1; - } - } - } - -#ifdef onesidedtrace - printf("contig_access_count is %d lastFileOffset is %ld firstFileOffset is %ld\n",contig_access_count,lastFileOffset,firstFileOffset); - for (j=0;j<contig_access_count;j++) { - printf("offset_list[%d]: %ld , len_list[%d]: %ld\n",j,offset_list[j],j,len_list[j]); - - } -#endif - - /* Compute number of rounds. - */ - int numberOfRounds = 0; - for (j=0;j<naggs;j++) { - int currentNumberOfRounds = (int)(((fd_end[j] - fd_start[j])+(ADIO_Offset)1)/coll_bufsize); - if (((ADIO_Offset)currentNumberOfRounds*coll_bufsize) < ((fd_end[j] - fd_start[j])+(ADIO_Offset)1)) - currentNumberOfRounds++; - if (currentNumberOfRounds > numberOfRounds) - numberOfRounds = currentNumberOfRounds; - } - - /* Data structures to track what data this compute needs to send to whom. - * For lustre they will all need another dimension for the file domain. - */ - int *targetAggsForMyData = (int *)ADIOI_Malloc(naggs * sizeof(int)); - ADIO_Offset *targetAggsForMyDataFDStart = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - ADIO_Offset *targetAggsForMyDataFDEnd = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - int numTargetAggs = 0; - - /* This data structure holds the beginning offset and len list index for the range to be written - * coresponding to the round and target agg. Initialize to -1 to denote being unset. - */ - int **targetAggsForMyDataFirstOffLenIndex = (int **)ADIOI_Malloc(numberOfRounds * sizeof(int *)); - for (i=0;i<numberOfRounds;i++) { - targetAggsForMyDataFirstOffLenIndex[i] = (int *)ADIOI_Malloc(naggs * sizeof(int)); - for (j=0;j<naggs;j++) - targetAggsForMyDataFirstOffLenIndex[i][j] = -1; - } - - /* This data structure holds the ending offset and len list index for the range to be written - * coresponding to the round and target agg. - */ - int **targetAggsForMyDataLastOffLenIndex = (int **)ADIOI_Malloc(numberOfRounds * sizeof(int *)); - for (i=0;i<numberOfRounds;i++) - targetAggsForMyDataLastOffLenIndex[i] = (int *)ADIOI_Malloc(naggs * sizeof(int)); - -#ifdef onesidedtrace - printf("NumberOfRounds is %d\n",numberOfRounds); - for (i=0;i<naggs;i++) - printf("fd->hints->ranklist[%d]is %d fd_start is %ld fd_end is %ld\n",i,fd->hints->ranklist[i],fd_start[i],fd_end[i]); - for (j=0;j<contig_access_count;j++) - printf("offset_list[%d] is %ld len_list is %ld\n",j,offset_list[j],len_list[j]); -#endif - - int currentAggRankListIndex = 0; - int maxNumNonContigSourceChunks = 0; - - ADIO_Offset currentSourceBufferOffset = 0; - int currentDataTypeExtent = 0; - int currentFlatBufIndice=0; - ADIO_Offset currentIndiceOffset = 0; - - /* This denotes the coll_bufsize boundaries within the source buffer for writing for the same round. - */ - ADIO_Offset intraRoundCollBufsizeOffset = 0; - - /* This data structure tracks what target aggs need to be written to on what rounds. - */ - int *targetAggsForMyDataCurrentRoundIter = (int *)ADIOI_Malloc(naggs * sizeof(int)); - for (i=0;i<naggs;i++) - targetAggsForMyDataCurrentRoundIter[i] = 0; - - /* This is the first of the two main loops in this algorithm. The purpose of this loop is essentially to populate - * the data structures defined above for what source data blocks needs to go where (target agg and file domain) and when - * (round iter). For lustre essentially an additional layer of nesting will be required for the multiple file domains - * within the target agg. - */ - if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { - int blockIter; - for (blockIter=0;blockIter<contig_access_count;blockIter++) { - - /* Determine the starting source buffer offset for this block - for iter 0 skip it since that value is 0. - */ - if (blockIter>0) { - if (bufTypeIsContig) { - currentSourceBufferOffset += len_list[blockIter-1]; - } - else { - - /* Non-contiguous source datatype, count up the extents and indices to this point - * in the blocks for use in computing the source starting buffer offset for target aggs - * and file domains. - */ - ADIO_Offset sourceBlockTotal = 0; - int lastIndiceUsed = currentFlatBufIndice; - int numNonContigSourceChunks = 0; - - while (sourceBlockTotal < len_list[blockIter-1]) { - numNonContigSourceChunks++; - sourceBlockTotal += (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); - lastIndiceUsed = currentFlatBufIndice; - currentFlatBufIndice++; - if (currentFlatBufIndice == flatBuf->count) { - currentFlatBufIndice = 0; - currentDataTypeExtent++; - } - currentIndiceOffset = (ADIO_Offset)0; - } - if (sourceBlockTotal > len_list[blockIter-1]) { - currentFlatBufIndice--; - if (currentFlatBufIndice < 0 ) { - currentDataTypeExtent--; - currentFlatBufIndice = flatBuf->count-1; - } - currentIndiceOffset = len_list[blockIter-1] - (sourceBlockTotal - flatBuf->blocklens[lastIndiceUsed]); - // ADIOI_Assert((currentIndiceOffset >= 0) && (currentIndiceOffset < flatBuf->blocklens[currentFlatBufIndice])); - } - else - currentIndiceOffset = (ADIO_Offset)0; - maxNumContigOperations += (numNonContigSourceChunks+2); - if (numNonContigSourceChunks > maxNumNonContigSourceChunks) - maxNumNonContigSourceChunks = numNonContigSourceChunks; - -#ifdef onesidedtrace - printf("blockiter %d currentFlatBufIndice is now %d currentDataTypeExtent is now %d currentIndiceOffset is now %ld maxNumContigOperations is now %d\n",blockIter,currentFlatBufIndice,currentDataTypeExtent,currentIndiceOffset,maxNumContigOperations); -#endif - } // !bufTypeIsContig - } // blockIter > 0 - - /* For the last iteration we need to include these maxNumContigOperations and maxNumNonContigSourceChunks - * for non-contig case even though we did not need to compute the next starting offset. - */ - if ((blockIter == (contig_access_count-1)) && (!bufTypeIsContig)) { - ADIO_Offset sourceBlockTotal = 0; - int tmpCurrentFlatBufIndice = currentFlatBufIndice; - int lastNumNonContigSourceChunks = 0; - while (sourceBlockTotal < len_list[blockIter]) { - lastNumNonContigSourceChunks++; - sourceBlockTotal += flatBuf->blocklens[tmpCurrentFlatBufIndice]; - tmpCurrentFlatBufIndice++; - if (tmpCurrentFlatBufIndice == flatBuf->count) { - tmpCurrentFlatBufIndice = 0; - } - } - maxNumContigOperations += (lastNumNonContigSourceChunks+2); - if (lastNumNonContigSourceChunks > maxNumNonContigSourceChunks) - maxNumNonContigSourceChunks = lastNumNonContigSourceChunks; - - } - - ADIO_Offset blockStart = offset_list[blockIter], blockEnd = offset_list[blockIter]+len_list[blockIter]-(ADIO_Offset)1; - - /* Find the starting target agg for this block - normally it will be the current agg so guard the expensive - * while loop with a cheap if-check which for large numbers of small blocks will usually be false. - */ - if (!((blockStart >= fd_start[currentAggRankListIndex]) && (blockStart <= fd_end[currentAggRankListIndex]))) { - while (!((blockStart >= fd_start[currentAggRankListIndex]) && (blockStart <= fd_end[currentAggRankListIndex]))) - currentAggRankListIndex++; - }; - -#ifdef onesidedtrace - printf("currentAggRankListIndex is %d blockStart %ld blockEnd %ld fd_start[currentAggRankListIndex] %ld fd_end[currentAggRankListIndex] %ld\n",currentAggRankListIndex,blockStart,blockEnd,fd_start[currentAggRankListIndex],fd_end[currentAggRankListIndex]); -#endif - - /* Determine if this is a new target agg. - */ - if (blockIter>0) { - if ((offset_list[blockIter-1]+len_list[blockIter-1]-(ADIO_Offset)1) < fd_start[currentAggRankListIndex]) { - numTargetAggs++; - } - } - - /* Determine which round to start writing - data is written coll_bufsize per round from the aggregator - * so if our starting offset in the file domain is multiple coll_bufsize that will correspond to the round. - */ - if ((blockStart - fd_start[currentAggRankListIndex]) >= coll_bufsize) { - ADIO_Offset currentRoundBlockStart = fd_start[currentAggRankListIndex]; - int startingRound = 0; - while (blockStart > (currentRoundBlockStart + coll_bufsize - (ADIO_Offset)1)) { - currentRoundBlockStart+=coll_bufsize; - startingRound++; - } - targetAggsForMyDataCurrentRoundIter[numTargetAggs] = startingRound; - } - - /* Initialize the data structures if this is the first offset in the round/target agg. - */ - if (targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] == -1) { - targetAggsForMyData[numTargetAggs] = fd->hints->ranklist[currentAggRankListIndex]; - targetAggsForMyDataFDStart[numTargetAggs] = fd_start[currentAggRankListIndex]; - /* Round up file domain to the first actual offset used if this is the first file domain. - */ - if (currentAggRankListIndex == smallestFileDomainAggRank) { - if (targetAggsForMyDataFDStart[numTargetAggs] < firstFileOffset) - targetAggsForMyDataFDStart[numTargetAggs] = firstFileOffset; - } - targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[currentAggRankListIndex]; - /* Round down file domain to the last actual offset used if this is the last file domain. - */ - if (currentAggRankListIndex == greatestFileDomainAggRank) { - if (targetAggsForMyDataFDEnd[numTargetAggs] > lastFileOffset) - targetAggsForMyDataFDEnd[numTargetAggs] = lastFileOffset; - } - targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - /* Set the source buffer state starting point for data access for this - agg and file domain. */ - - if (bufTypeIsContig) { - if (currentFDSourceBufferState[numTargetAggs].sourceBufferOffset == -1) { - - currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = currentSourceBufferOffset; -#ifdef onesidedtrace - printf("For agg %d sourceBufferOffset initialized to %ld\n",currentAggRankListIndex,currentSourceBufferOffset); -#endif - } - } - else { - if (currentFDSourceBufferState[numTargetAggs].indiceOffset == -1) { - currentFDSourceBufferState[numTargetAggs].indiceOffset = currentIndiceOffset; - currentFDSourceBufferState[numTargetAggs].bufTypeExtent = bufTypeExtent; - currentFDSourceBufferState[numTargetAggs].dataTypeExtent = currentDataTypeExtent; - currentFDSourceBufferState[numTargetAggs].flatBufIndice = currentFlatBufIndice; -#ifdef onesidedtrace - printf("For agg %d dataTypeExtent initialized to %d flatBufIndice to %d indiceOffset to %ld\n",numTargetAggs,currentDataTypeExtent,currentFlatBufIndice,currentIndiceOffset); -#endif - } - } - - intraRoundCollBufsizeOffset = fd_start[currentAggRankListIndex] + ((ADIO_Offset)(targetAggsForMyDataCurrentRoundIter[numTargetAggs]+1) * coll_bufsize); - -#ifdef onesidedtrace - printf("Initial settings numTargetAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld currentSourceBufferOffset set to %ld intraRoundCollBufsizeOffset set to %ld\n",numTargetAggs,blockIter,offset_list[blockIter],fd_start[currentAggRankListIndex],len_list[blockIter],currentSourceBufferOffset,intraRoundCollBufsizeOffset); -#endif - } - - /* Replace the last offset block iter with this one. - */ - targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - - /* If this blocks extends into the next file domain advance to the next target aggs and source buffer states. - */ - if (blockEnd > fd_end[currentAggRankListIndex]) { -#ifdef onesidedtrace - printf("block extends past current fd, blockEnd %ld >= fd_end[currentAggRankListIndex] %ld total block size is %ld blockStart was %ld\n",blockEnd,fd_end[currentAggRankListIndex], len_list[blockIter],blockStart); -#endif - ADIO_Offset amountToAdvanceSBOffsetForFD = 0; - int additionalFDCounter = 0; - - while (blockEnd >= fd_end[currentAggRankListIndex]) { - ADIO_Offset thisAggBlockEnd = fd_end[currentAggRankListIndex]; - if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { - while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { - targetAggsForMyDataCurrentRoundIter[numTargetAggs]++; - intraRoundCollBufsizeOffset += coll_bufsize; - targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; -#ifdef onesidedtrace - printf("targetAggsForMyDataCurrentRoundI%d] is now %d intraRoundCollBufsizeOffset is now %ld\n",numTargetAggs,targetAggsForMyDataCurrentRoundIter[numTargetAggs],intraRoundCollBufsizeOffset); -#endif - } // while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) - } // if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) - - int prevAggRankListIndex = currentAggRankListIndex; - currentAggRankListIndex++; - - /* Skip over unused aggs. - */ - if (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) { - while (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) - currentAggRankListIndex++; - - } // (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) - - /* Start new target agg. - */ - if (blockEnd >= fd_start[currentAggRankListIndex]) { - numTargetAggs++; - targetAggsForMyData[numTargetAggs] = fd->hints->ranklist[currentAggRankListIndex]; - targetAggsForMyDataFDStart[numTargetAggs] = fd_start[currentAggRankListIndex]; - /* Round up file domain to the first actual offset used if this is the first file domain. - */ - if (currentAggRankListIndex == smallestFileDomainAggRank) { - if (targetAggsForMyDataFDStart[numTargetAggs] < firstFileOffset) - targetAggsForMyDataFDStart[numTargetAggs] = firstFileOffset; - } - targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[currentAggRankListIndex]; - /* Round down file domain to the last actual offset used if this is the last file domain. - */ - if (currentAggRankListIndex == greatestFileDomainAggRank) { - if (targetAggsForMyDataFDEnd[numTargetAggs] > lastFileOffset) - targetAggsForMyDataFDEnd[numTargetAggs] = lastFileOffset; - } - targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - /* For the first additonal file domain the source buffer offset - * will be incremented relative to the state of this first main - * loop but for subsequent full file domains the offset will be - * incremented by the size - * of the file domain. - */ - if (additionalFDCounter == 0) - amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex] - - blockStart) + (ADIO_Offset)1; - else - amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex] - -fd_start[prevAggRankListIndex]) +(ADIO_Offset)1; - - if (bufTypeIsContig) { - ADIOI_Assert(numTargetAggs > 0); - if (currentFDSourceBufferState[numTargetAggs].sourceBufferOffset == -1) { - if (additionalFDCounter == 0) { // first file domain, still use the current data counter - currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = - currentSourceBufferOffset+amountToAdvanceSBOffsetForFD; - } - else { // 2nd file domain, advance full file domain from last source buffer state - currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = - currentFDSourceBufferState[numTargetAggs-1].sourceBufferOffset+amountToAdvanceSBOffsetForFD; - } - -#ifdef onesidedtrace - printf("Crossed into new FD - for agg %d sourceBufferOffset initialized to %ld amountToAdvanceSBOffsetForFD is %ld\n",numTargetAggs,currentFDSourceBufferState[numTargetAggs].sourceBufferOffset,amountToAdvanceSBOffsetForFD); -#endif - } - } - else if (currentFDSourceBufferState[numTargetAggs].indiceOffset == -1) { - // non-contiguos source buffer - ADIOI_Assert(numTargetAggs > 0); - - /* Initialize the source buffer state appropriately and then - * advance it with the - * nonContigSourceDataBufferAdvance function. - */ - if (additionalFDCounter == 0) { - // first file domain, still use the current data counter - currentFDSourceBufferState[numTargetAggs].indiceOffset = - currentIndiceOffset; - currentFDSourceBufferState[numTargetAggs].bufTypeExtent = bufTypeExtent; - currentFDSourceBufferState[numTargetAggs].dataTypeExtent = - currentDataTypeExtent; - currentFDSourceBufferState[numTargetAggs].flatBufIndice = - currentFlatBufIndice; - } - else { - // 2nd file domain, advance full file domain from last source buffer state - currentFDSourceBufferState[numTargetAggs].indiceOffset = - currentFDSourceBufferState[numTargetAggs-1].indiceOffset; - currentFDSourceBufferState[numTargetAggs].bufTypeExtent = - currentFDSourceBufferState[numTargetAggs-1].bufTypeExtent; - currentFDSourceBufferState[numTargetAggs].dataTypeExtent = - currentFDSourceBufferState[numTargetAggs-1].dataTypeExtent; - currentFDSourceBufferState[numTargetAggs].flatBufIndice = - currentFDSourceBufferState[numTargetAggs-1].flatBufIndice; - } - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, - (int)amountToAdvanceSBOffsetForFD, 1, - ¤tFDSourceBufferState[numTargetAggs], NULL); -#ifdef onesidedtrace - printf("Crossed into new FD - for agg %d dataTypeExtent initialized to %d flatBufIndice to %d indiceOffset to %ld amountToAdvanceSBOffsetForFD is %d\n",numTargetAggs,currentFDSourceBufferState[numTargetAggs].dataTypeExtent,currentFDSourceBufferState[numTargetAggs].flatBufIndice,currentFDSourceBufferState[numTargetAggs].indiceOffset,amountToAdvanceSBOffsetForFD); -#endif - } - additionalFDCounter++; - -#ifdef onesidedtrace - printf("block extended beyond fd init settings numTargetAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld\n",numTargetAggs,i,offset_list[blockIter],fd_start[currentAggRankListIndex],len_list[blockIter]); -#endif - intraRoundCollBufsizeOffset = fd_start[currentAggRankListIndex] + coll_bufsize; - targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - } // if (blockEnd >= fd_start[currentAggRankListIndex]) - } // while (blockEnd >= fd_end[currentAggRankListIndex]) - } // if (blockEnd > fd_end[currentAggRankListIndex]) - - /* If we are still in the same file domain / target agg but have gone - * past the coll_bufsize and need to advance to the next round - - * initialize tracking data appropriately. - */ - if (blockEnd >= intraRoundCollBufsizeOffset) { - ADIO_Offset currentBlockEnd = blockEnd; - while (currentBlockEnd >= intraRoundCollBufsizeOffset) { - targetAggsForMyDataCurrentRoundIter[numTargetAggs]++; - intraRoundCollBufsizeOffset += coll_bufsize; - targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; - targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] = blockIter; -#ifdef onesidedtrace - printf("smaller than fd currentBlockEnd is now %ld intraRoundCollBufsizeOffset is now %ld targetAggsForMyDataCurrentRoundIter[%d] is now %d\n",currentBlockEnd, intraRoundCollBufsizeOffset, numTargetAggs,targetAggsForMyDataCurrentRoundIter[numTargetAggs]); -#endif - } // while (currentBlockEnd >= intraRoundCollBufsizeOffset) - } // if (blockEnd >= intraRoundCollBufsizeOffset) - - /* Need to advance numTargetAggs if this is the last target offset to - * include this one. - */ - if (blockIter == (contig_access_count-1)) - numTargetAggs++; - } - -#ifdef onesidedtrace - printf("numTargetAggs is %d\n",numTargetAggs); - for (i=0;i<numTargetAggs;i++) { - for (j=0;j<=targetAggsForMyDataCurrentRoundIter[i];j++) - printf("targetAggsForMyData[%d] is %d targetAggsForMyDataFDStart[%d] is %ld targetAggsForMyDataFDEnd is %ld targetAggsForMyDataFirstOffLenIndex is %d with value %ld targetAggsForMyDataLastOffLenIndex is %d with value %ld\n",i,targetAggsForMyData[i],i,targetAggsForMyDataFDStart[i],targetAggsForMyDataFDEnd[i],targetAggsForMyDataFirstOffLenIndex[j][i],offset_list[targetAggsForMyDataFirstOffLenIndex[j][i]],targetAggsForMyDataLastOffLenIndex[j][i],offset_list[targetAggsForMyDataLastOffLenIndex[j][i]]); - - } -#endif - - } // if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) - - ADIOI_Free(targetAggsForMyDataCurrentRoundIter); - - int currentWriteBuf = 0; - int useIOBuffer = 0; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio && (numberOfRounds>1)) { - useIOBuffer = 1; - io_thread = pthread_self(); - } -#endif - - /* use the write buffer allocated in the file_open */ - char *write_buf0 = fd->io_buf; - char *write_buf1 = fd->io_buf + coll_bufsize; - - /* start off pointing to the first buffer. If we use the 2nd buffer (threaded - * case) we'll swap later */ - char *write_buf = write_buf0; - MPI_Win write_buf_window = fd->io_buf_window; - - int *write_buf_put_amounts = fd->io_buf_put_amounts; - if(!gpfsmpio_onesided_no_rmw) { - *hole_found = 0; - for (i=0;i<nprocs;i++) - write_buf_put_amounts[i] = 0; - } - - /* Counters to track the offset range being written by the used aggs. - */ - ADIO_Offset currentRoundFDStart = 0; - ADIO_Offset currentRoundFDEnd = 0; - - if (iAmUsedAgg) { - currentRoundFDStart = fd_start[myAggRank]; - if (myAggRank == smallestFileDomainAggRank) { - if (currentRoundFDStart < firstFileOffset) - currentRoundFDStart = firstFileOffset; - } - else if (myAggRank == greatestFileDomainAggRank) { - if (currentRoundFDEnd > lastFileOffset) - currentRoundFDEnd = lastFileOffset; - } -#ifdef onesidedtrace -printf("iAmUsedAgg - currentRoundFDStart initialized to %ld currentRoundFDEnd to %ld\n",currentRoundFDStart,currentRoundFDEnd); -#endif - if (gpfsmpio_onesided_always_rmw) { // read in the first buffer - ADIO_Offset tmpCurrentRoundFDEnd = 0; - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - if (myAggRank == greatestFileDomainAggRank) { - if (fd_end[myAggRank] > lastFileOffset) - tmpCurrentRoundFDEnd = lastFileOffset; - else - tmpCurrentRoundFDEnd = fd_end[myAggRank]; - } - else - tmpCurrentRoundFDEnd = fd_end[myAggRank]; - } - else - tmpCurrentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset)1; -#ifdef onesidedtrace -printf("gpfsmpio_onesided_always_rmw - first buffer pre-read for file offsets %ld to %ld total is %d\n",currentRoundFDStart,tmpCurrentRoundFDEnd,(int)(tmpCurrentRoundFDEnd - currentRoundFDStart)+1); -#endif - ADIO_ReadContig(fd, write_buf, (int)(tmpCurrentRoundFDEnd - currentRoundFDStart)+1, - MPI_BYTE, ADIO_EXPLICIT_OFFSET,currentRoundFDStart, &status, error_code); - - } - } - if (gpfsmpio_onesided_always_rmw) // wait until the first buffer is read - MPI_Barrier(fd->comm); - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase-startTimeBase); - startTimeBase = MPI_Wtime(); -#endif - - /* This is the second main loop of the algorithm, actually nested loop of target aggs within rounds. There are 2 flavors of this. - * For gpfsmpio_write_aggmethod of 1 each nested iteration for the target - * agg does an mpi_put on a contiguous chunk using a primative datatype - * determined using the data structures from the first main loop. For - * gpfsmpio_write_aggmethod of 2 each nested iteration for the target agg - * builds up data to use in created a derived data type for 1 mpi_put that is done for the target agg for each round. - * To support lustre there will need to be an additional layer of nesting - * for the multiple file domains within target aggs. - */ - int roundIter; - - for (roundIter=0;roundIter<numberOfRounds;roundIter++) { - if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { - - - int aggIter; - for (aggIter=0;aggIter<numTargetAggs;aggIter++) { - - int numBytesPutThisAggRound = 0; - /* If we have data for the round/agg process it. - */ - if (targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter] != -1) { - ADIO_Offset currentRoundFDStartForMyTargetAgg = (ADIO_Offset)((ADIO_Offset)targetAggsForMyDataFDStart[aggIter] + (ADIO_Offset)((ADIO_Offset)roundIter*coll_bufsize)); - ADIO_Offset currentRoundFDEndForMyTargetAgg = (ADIO_Offset)((ADIO_Offset)targetAggsForMyDataFDStart[aggIter] + (ADIO_Offset)((ADIO_Offset)(roundIter+1)*coll_bufsize) - (ADIO_Offset)1); - - int targetAggContigAccessCount = 0; - - /* These data structures are used for the derived datatype mpi_put - * in the gpfsmpio_write_aggmethod of 2 case. - */ - int *targetAggBlockLengths=NULL; - MPI_Aint *targetAggDisplacements=NULL, *sourceBufferDisplacements=NULL; - MPI_Datatype *targetAggDataTypes=NULL; - - char *derivedTypePackedSourceBuffer=NULL; - int derivedTypePackedSourceBufferOffset = 0; - int allocatedDerivedTypeArrays = 0; - ADIO_Offset amountOfDataWrittenThisRoundAgg = 0; - -#ifdef onesidedtrace - printf("roundIter %d processing targetAggsForMyData %d \n",roundIter,targetAggsForMyData[aggIter]); -#endif - - /* Process the range of offsets for this target agg. - */ - int offsetIter; - int startingOffLenIndex = targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter], endingOffLenIndex = targetAggsForMyDataLastOffLenIndex[roundIter][aggIter]; - for (offsetIter=startingOffLenIndex;offsetIter<=endingOffLenIndex;offsetIter++) { - if (currentRoundFDEndForMyTargetAgg > targetAggsForMyDataFDEnd[aggIter]) - currentRoundFDEndForMyTargetAgg = targetAggsForMyDataFDEnd[aggIter]; - - ADIO_Offset offsetStart = offset_list[offsetIter], offsetEnd = (offset_list[offsetIter]+len_list[offsetIter]-(ADIO_Offset)1); - -#ifdef onesidedtrace - printf("roundIter %d target iter %d targetAggsForMyData is %d offset_list[%d] is %ld len_list[%d] is %ld targetAggsForMyDataFDStart is %ld targetAggsForMyDataFDEnd is %ld currentRoundFDStartForMyTargetAgg is %ld currentRoundFDEndForMyTargetAgg is %ld targetAggsForMyDataFirstOffLenIndex is %ld\n", - roundIter,aggIter,targetAggsForMyData[aggIter],offsetIter,offset_list[offsetIter],offsetIter,len_list[offsetIter], - targetAggsForMyDataFDStart[aggIter],targetAggsForMyDataFDEnd[aggIter], - currentRoundFDStartForMyTargetAgg,currentRoundFDEndForMyTargetAgg, targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter]); -#endif - - /* Determine the amount of data and exact source buffer offsets to use. - */ - int bufferAmountToSend = 0; - - if ((offsetStart >= currentRoundFDStartForMyTargetAgg) && (offsetStart <= currentRoundFDEndForMyTargetAgg)) { - if (offsetEnd > currentRoundFDEndForMyTargetAgg) - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - offsetStart) +1; - else - bufferAmountToSend = (offsetEnd - offsetStart) +1; - } - else if ((offsetEnd >= currentRoundFDStartForMyTargetAgg) && (offsetEnd <= currentRoundFDEndForMyTargetAgg)) { - if (offsetEnd > currentRoundFDEndForMyTargetAgg) - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) +1; - else - bufferAmountToSend = (offsetEnd - currentRoundFDStartForMyTargetAgg) +1; - if (offsetStart < currentRoundFDStartForMyTargetAgg) { - offsetStart = currentRoundFDStartForMyTargetAgg; - } - } - else if ((offsetStart <= currentRoundFDStartForMyTargetAgg) && (offsetEnd >= currentRoundFDEndForMyTargetAgg)) { - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) +1; - offsetStart = currentRoundFDStartForMyTargetAgg; - } - - numBytesPutThisAggRound += bufferAmountToSend; -#ifdef onesidedtrace - printf("bufferAmountToSend is %d\n",bufferAmountToSend); -#endif - if (bufferAmountToSend > 0) { /* we have data to send this round */ - if (gpfsmpio_write_aggmethod == 2) { - /* Only allocate these arrays if we are using method 2 and only do it once for this round/target agg. - */ - if (!allocatedDerivedTypeArrays) { - targetAggBlockLengths = (int *)ADIOI_Malloc(maxNumContigOperations * sizeof(int)); - targetAggDisplacements = (MPI_Aint *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Aint)); - sourceBufferDisplacements = (MPI_Aint *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Aint)); - targetAggDataTypes = (MPI_Datatype *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Datatype)); - if (!bufTypeIsContig) { - int k; - for (k=targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter];k<=targetAggsForMyDataLastOffLenIndex[roundIter][aggIter];k++) - amountOfDataWrittenThisRoundAgg += len_list[k]; - -#ifdef onesidedtrace - printf("derivedTypePackedSourceBuffer mallocing %ld\n",amountOfDataWrittenThisRoundAgg); -#endif - if (amountOfDataWrittenThisRoundAgg > 0) - derivedTypePackedSourceBuffer = (char *)ADIOI_Malloc(amountOfDataWrittenThisRoundAgg * sizeof(char)); - else - derivedTypePackedSourceBuffer = NULL; - } - allocatedDerivedTypeArrays = 1; - } - } - - /* Determine the offset into the target window. - */ - MPI_Aint targetDisplacementToUseThisRound = (MPI_Aint) (offsetStart - currentRoundFDStartForMyTargetAgg); - - /* If using the thread writer select the appropriate side of the split window. - */ - if (useIOBuffer && (write_buf == write_buf1)) { - targetDisplacementToUseThisRound += (MPI_Aint) coll_bufsize; - } - - /* For gpfsmpio_write_aggmethod of 1 do the mpi_put using the primitive MPI_BYTE type for each contiguous - * chunk in the target, of source data is non-contiguous then pack the data first. - */ - - if (gpfsmpio_write_aggmethod == 1) { - MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, write_buf_window); - if (bufTypeIsContig) { - MPI_Put(((char*)buf) + currentFDSourceBufferState[aggIter].sourceBufferOffset,bufferAmountToSend, MPI_BYTE,targetAggsForMyData[aggIter],targetDisplacementToUseThisRound, bufferAmountToSend,MPI_BYTE,write_buf_window); - currentFDSourceBufferState[aggIter].sourceBufferOffset += (ADIO_Offset)bufferAmountToSend; - } - else { - char *putSourceData = (char *) ADIOI_Malloc(bufferAmountToSend*sizeof(char)); - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, bufferAmountToSend, 1, ¤tFDSourceBufferState[aggIter], putSourceData); - MPI_Put(putSourceData,bufferAmountToSend, MPI_BYTE,targetAggsForMyData[aggIter],targetDisplacementToUseThisRound, bufferAmountToSend,MPI_BYTE,write_buf_window); - ADIOI_Free(putSourceData); - } - MPI_Win_unlock(targetAggsForMyData[aggIter], write_buf_window); - } - - /* For gpfsmpio_write_aggmethod of 2 populate the data structures for this round/agg for this offset iter - * to be used subsequently when building the derived type for 1 mpi_put for all the data for this - * round/agg. - */ - else if (gpfsmpio_write_aggmethod == 2) { - - if (bufTypeIsContig) { - targetAggBlockLengths[targetAggContigAccessCount]= bufferAmountToSend; - targetAggDataTypes[targetAggContigAccessCount] = MPI_BYTE; - targetAggDisplacements[targetAggContigAccessCount] = targetDisplacementToUseThisRound; - sourceBufferDisplacements[targetAggContigAccessCount] = (MPI_Aint)currentFDSourceBufferState[aggIter].sourceBufferOffset; - currentFDSourceBufferState[aggIter].sourceBufferOffset += (ADIO_Offset)bufferAmountToSend; - targetAggContigAccessCount++; - } - else { - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, bufferAmountToSend, 1, ¤tFDSourceBufferState[aggIter], &derivedTypePackedSourceBuffer[derivedTypePackedSourceBufferOffset]); - targetAggBlockLengths[targetAggContigAccessCount]= bufferAmountToSend; - targetAggDataTypes[targetAggContigAccessCount] = MPI_BYTE; - targetAggDisplacements[targetAggContigAccessCount] = targetDisplacementToUseThisRound; - sourceBufferDisplacements[targetAggContigAccessCount] = (MPI_Aint)derivedTypePackedSourceBufferOffset; - targetAggContigAccessCount++; - derivedTypePackedSourceBufferOffset += (ADIO_Offset)bufferAmountToSend; - } - } -#ifdef onesidedtrace - printf("roundIter %d bufferAmountToSend is %d offsetStart is %ld currentRoundFDStartForMyTargetAgg is %ld targetDisplacementToUseThisRound is %ld targetAggsForMyDataFDStart[aggIter] is %ld\n",roundIter, bufferAmountToSend, offsetStart,currentRoundFDStartForMyTargetAgg,targetDisplacementToUseThisRound,targetAggsForMyDataFDStart[aggIter]); -#endif - - } // bufferAmountToSend > 0 - } // contig list - - /* For gpfsmpio_write_aggmethod of 2 now build the derived type using the data from this round/agg and do 1 single mpi_put. - */ - if (gpfsmpio_write_aggmethod == 2) { - - MPI_Datatype sourceBufferDerivedDataType, targetBufferDerivedDataType; - MPI_Type_create_struct(targetAggContigAccessCount, targetAggBlockLengths, sourceBufferDisplacements, targetAggDataTypes, &sourceBufferDerivedDataType); - MPI_Type_commit(&sourceBufferDerivedDataType); - MPI_Type_create_struct(targetAggContigAccessCount, targetAggBlockLengths, targetAggDisplacements, targetAggDataTypes, &targetBufferDerivedDataType); - MPI_Type_commit(&targetBufferDerivedDataType); - -#ifdef onesidedtrace - printf("mpi_put of derived type to agg %d targetAggContigAccessCount is %d\n",targetAggsForMyData[aggIter],targetAggContigAccessCount); -#endif - if (targetAggContigAccessCount > 0) { - MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, write_buf_window); - if (bufTypeIsContig) { - MPI_Put(((char*)buf),1, sourceBufferDerivedDataType,targetAggsForMyData[aggIter],0, 1,targetBufferDerivedDataType,write_buf_window); - } - else { - MPI_Put(derivedTypePackedSourceBuffer,1, sourceBufferDerivedDataType,targetAggsForMyData[aggIter],0, 1,targetBufferDerivedDataType,write_buf_window); - } - - - MPI_Win_unlock(targetAggsForMyData[aggIter], write_buf_window); - } - - if (allocatedDerivedTypeArrays) { - ADIOI_Free(targetAggBlockLengths); - ADIOI_Free(targetAggDisplacements); - ADIOI_Free(targetAggDataTypes); - ADIOI_Free(sourceBufferDisplacements); - if (!bufTypeIsContig) - if (derivedTypePackedSourceBuffer != NULL) - ADIOI_Free(derivedTypePackedSourceBuffer); - } - if (targetAggContigAccessCount > 0) { - MPI_Type_free(&sourceBufferDerivedDataType); - MPI_Type_free(&targetBufferDerivedDataType); - } - } - if (!gpfsmpio_onesided_no_rmw) { - MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, fd->io_buf_put_amounts_window); - MPI_Put(&numBytesPutThisAggRound,1, MPI_INT,targetAggsForMyData[aggIter],myrank, 1,MPI_INT,fd->io_buf_put_amounts_window); - MPI_Win_unlock(targetAggsForMyData[aggIter], fd->io_buf_put_amounts_window); - } - } // baseoffset != -1 - } // target aggs - } /// contig_access_count > 0 - -#ifdef onesidedtrace -printf("first barrier roundIter %d\n",roundIter); -#endif - MPI_Barrier(fd->comm); - - if (iAmUsedAgg) { - /* Determine what offsets define the portion of the file domain the agg is writing this round. - */ - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - if (myAggRank == greatestFileDomainAggRank) { - if (fd_end[myAggRank] > lastFileOffset) - currentRoundFDEnd = lastFileOffset; - else - currentRoundFDEnd = fd_end[myAggRank]; - } - else - currentRoundFDEnd = fd_end[myAggRank]; - } - else - currentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset)1; - -#ifdef onesidedtrace - printf("used agg about to writecontig - currentRoundFDStart is %ld currentRoundFDEnd is %ld within file domeain %ld to %ld\n",currentRoundFDStart,currentRoundFDEnd,fd_start[myAggRank],fd_end[myAggRank]); -#endif - - int doWriteContig = 1; - if (!gpfsmpio_onesided_no_rmw) { - int numBytesPutIntoBuf = 0; - for (i=0;i<nprocs;i++) { - numBytesPutIntoBuf += write_buf_put_amounts[i]; - write_buf_put_amounts[i] = 0; - } - if (numBytesPutIntoBuf != ((int)(currentRoundFDEnd - currentRoundFDStart)+1)) { - doWriteContig = 0; - *hole_found = 1; - } - } - - if (!useIOBuffer) { - if (doWriteContig) - ADIO_WriteContig(fd, write_buf, (int)(currentRoundFDEnd - currentRoundFDStart)+1, - MPI_BYTE, ADIO_EXPLICIT_OFFSET,currentRoundFDStart, &status, error_code); - - } else { /* use the thread writer */ - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - io_thread_args.fd = fd; - /* do a little pointer shuffling: background I/O works from one - * buffer while two-phase machinery fills up another */ - - if (currentWriteBuf == 0) { - io_thread_args.buf = write_buf0; - currentWriteBuf = 1; - write_buf = write_buf1; - } - else { - io_thread_args.buf = write_buf1; - currentWriteBuf = 0; - write_buf = write_buf0; - } - if (doWriteContig) { - io_thread_args.io_kind = ADIOI_WRITE; - io_thread_args.size = (currentRoundFDEnd-currentRoundFDStart) + 1; - io_thread_args.offset = currentRoundFDStart; - io_thread_args.status = &status; - io_thread_args.error_code = *error_code; - - if ( (pthread_create(&io_thread, NULL, - ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) - io_thread = pthread_self(); - } - } // useIOBuffer - - } // iAmUsedAgg - - if (!iAmUsedAgg && useIOBuffer) { - if (currentWriteBuf == 0) { - currentWriteBuf = 1; - write_buf = write_buf1; - } - else { - currentWriteBuf = 0; - write_buf = write_buf0; - } - } - - if (iAmUsedAgg) { - currentRoundFDStart += coll_bufsize; - - if (gpfsmpio_onesided_always_rmw && (roundIter<(numberOfRounds-1))) { // read in the buffer for the next round unless this is the last round - ADIO_Offset tmpCurrentRoundFDEnd = 0; - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - if (myAggRank == greatestFileDomainAggRank) { - if (fd_end[myAggRank] > lastFileOffset) - tmpCurrentRoundFDEnd = lastFileOffset; - else - tmpCurrentRoundFDEnd = fd_end[myAggRank]; - } - else - tmpCurrentRoundFDEnd = fd_end[myAggRank]; - } - else - tmpCurrentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset)1; -#ifdef onesidedtrace -printf("gpfsmpio_onesided_always_rmw - round %d buffer pre-read for file offsets %ld to %ld total is %d\n",roundIter, currentRoundFDStart,tmpCurrentRoundFDEnd,(int)(tmpCurrentRoundFDEnd - currentRoundFDStart)+1); -#endif - ADIO_ReadContig(fd, write_buf, (int)(tmpCurrentRoundFDEnd - currentRoundFDStart)+1, - MPI_BYTE, ADIO_EXPLICIT_OFFSET,currentRoundFDStart, &status, error_code); - - } - } - - if (roundIter<(numberOfRounds-1)) { -#ifdef onesidedtrace -printf("second barrier roundIter %d\n",roundIter); -#endif - MPI_Barrier(fd->comm); - } - - } /* for-loop roundIter */ - - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase-startTimeBase); -#endif - - if (useIOBuffer) { /* thread writer cleanup */ - - if ( !pthread_equal(io_thread, pthread_self()) ) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - } - - } - -#ifdef onesidedtrace -printf("freeing datastructures\n"); -#endif - ADIOI_Free(targetAggsForMyData); - ADIOI_Free(targetAggsForMyDataFDStart); - ADIOI_Free(targetAggsForMyDataFDEnd); - - for (i=0;i<numberOfRounds;i++) { - ADIOI_Free(targetAggsForMyDataFirstOffLenIndex[i]); - ADIOI_Free(targetAggsForMyDataLastOffLenIndex[i]); - } - ADIOI_Free(targetAggsForMyDataFirstOffLenIndex); - ADIOI_Free(targetAggsForMyDataLastOffLenIndex); - - ADIOI_Free(currentFDSourceBufferState); - - if (!bufTypeIsContig) - ADIOI_Delete_flattened(datatype); - return; -} - - -void ADIOI_OneSidedReadAggregation(ADIO_File fd, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - const void *buf, - MPI_Datatype datatype, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int numNonZeroDataOffsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end) -{ - int i,j; /* generic iterators */ - -#ifdef onesidedtrace - if (buf == NULL) { - printf("ADIOI_OneSidedWriteAggregation - buf is NULL contig_access_count is %d\n",contig_access_count); - for (i=0;i<contig_access_count;i++) - printf("offset_list[%d] is %ld len_list[%d] is %ld\n",i,offset_list[i],i,len_list[i]); - } - if (contig_access_count < 0) - printf("ADIOI_OneSidedWriteAggregation - contig_access_count of %d is less than 0\n",contig_access_count); -#endif - - int lenListOverZero = 0; - for (i=0;((i<contig_access_count) && (!lenListOverZero));i++) - if (len_list[i] > 0) - lenListOverZero = 1; - - *error_code = MPI_SUCCESS; /* initialize to success */ - -#ifdef ROMIO_GPFS - double startTimeBase,endTimeBase; - startTimeBase = MPI_Wtime(); -#endif - - MPI_Status status; - pthread_t io_thread; - void *thread_ret; - ADIOI_IO_ThreadFuncData io_thread_args; - - int nprocs,myrank; - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - -#ifdef onesidedtrace -printf("ADIOI_OneSidedReadAggregation started on rank %d\n",myrank); -#endif - - if (fd->io_buf_window == MPI_WIN_NULL || - fd->io_buf_put_amounts_window == MPI_WIN_NULL) - { - ADIOI_OneSidedSetup(fd, nprocs); - } - /* This flag denotes whether the source datatype is contiguus, which is referenced throughout the algorithm - * and defines how the source buffer offsets and data chunks are determined. If the value is 1 (true - contiguous data) - * things are profoundly simpler in that the source buffer offset for a given source offset simply linearly increases - * by the chunk sizes being read. If the value is 0 (non-contiguous) then these values are based on calculations - * from the flattened source datatype. - */ - int bufTypeIsContig; - - MPI_Aint bufTypeExtent, lb; - ADIOI_Flatlist_node *flatBuf=NULL; - ADIOI_Datatype_iscontig(datatype, &bufTypeIsContig); - - if (!bufTypeIsContig) { - /* Flatten the non-contiguous source datatype. - */ - flatBuf = ADIOI_Flatten_and_find(datatype); - MPI_Type_get_extent(datatype, &lb, &bufTypeExtent); -#ifdef onesidedtrace - printf("flatBuf->count is %d bufTypeExtent is %d\n", flatBuf->count,bufTypeExtent); - for (i=0;i<flatBuf->count;i++) - printf("flatBuf->blocklens[%d] is %d flatBuf->indices[%d] is %ld\n",i,flatBuf->blocklens[i],i,flatBuf->indices[i]); -#endif - } -#ifdef onesidedtrace - printf("ADIOI_OneSidedReadAggregation bufTypeIsContig is %d contig_access_count is %d\n",bufTypeIsContig,contig_access_count); -#endif - - int naggs = fd->hints->cb_nodes; - - /* Track the state of the source buffer for feeding the target data blocks. - * For GPFS the number of file domains per agg is always 1 so we just need 1 agg - * dimension to track the data, in the case of lustre we will need 2 dimensions - * agg and file domain since aggs write to multiple file domains in the - * case of lustre. - * This structure will be modified as the data is written to reflect the - * current state of the offset. - */ - -#ifdef onesidedtrace - printf("sizeof(FDSourceBufferState) is %d - make sure is 32 for 32-byte memalign optimal\n",sizeof(FDSourceBufferState)); -#endif - FDSourceBufferState *currentFDSourceBufferState; - - currentFDSourceBufferState = (FDSourceBufferState *) ADIOI_Malloc(naggs * sizeof(FDSourceBufferState)); - for (i=0;i<naggs;i++) { - /* initialize based on the bufType to indicate that it is unset. - */ - if (bufTypeIsContig) { - currentFDSourceBufferState[i].sourceBufferOffset = -1; - } - else { - currentFDSourceBufferState[i].indiceOffset = -1; - } - } - -#ifdef onesidedtrace - printf(" ADIOI_OneSidedReadAggregation bufTypeIsContig is %d contig_access_count is %d\n",bufTypeIsContig,contig_access_count); -#endif - - /* maxNumContigOperations keeps track of how many different chunks we will - * need to recv for the purpose of pre-allocating the data structures to - * hold them. - */ - int maxNumContigOperations = contig_access_count; - - - ADIO_Offset lastFileOffset = 0, firstFileOffset = -1; - - /* Get the total range being read. - */ - for (j=0;j<numNonZeroDataOffsets;j++) { -#ifdef onesidedtrace -printf("end_offsets[%d] is %ld st_offsets[%d] is %ld\n",j,end_offsets[j],j,st_offsets[j]); -#endif - lastFileOffset = ADIOI_MAX(lastFileOffset,end_offsets[j]); - if (firstFileOffset == -1) - firstFileOffset = st_offsets[j]; - else - firstFileOffset = ADIOI_MIN(firstFileOffset,st_offsets[j]); - } - - int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ - int iAmUsedAgg = 0; /* whether or not this rank is used as an aggregator. */ - - int coll_bufsize = fd->hints->cb_buffer_size; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio == 1) { - /* split buffer in half for a kind of double buffering with the threads*/ - coll_bufsize = fd->hints->cb_buffer_size/2; - } -#endif - - /* This logic defines values that are used later to determine what offsets define the portion - * of the file domain the agg is reading this round. - */ - int greatestFileDomainAggRank = -1,smallestFileDomainAggRank = -1; - ADIO_Offset greatestFileDomainOffset = 0; - ADIO_Offset smallestFileDomainOffset = lastFileOffset; - for (j=0;j<naggs;j++) { - if (fd_end[j] > greatestFileDomainOffset) { - greatestFileDomainOffset = fd_end[j]; - greatestFileDomainAggRank = j; - } - if (fd_start[j] < smallestFileDomainOffset) { - smallestFileDomainOffset = fd_start[j]; - smallestFileDomainAggRank = j; - } - if (fd->hints->ranklist[j] == myrank) { - myAggRank = j; - if (fd_end[j] > fd_start[j]) { - iAmUsedAgg = 1; - } - } - } - -#ifdef onesidedtrace - printf("contig_access_count is %d lastFileOffset is %ld firstFileOffset is %ld\n",contig_access_count,lastFileOffset,firstFileOffset); - for (j=0;j<contig_access_count;j++) { - printf("offset_list[%d]: %ld , len_list[%d]: %ld\n",j,offset_list[j],j,len_list[j]); - } -#endif - - /* Compute number of rounds. - */ - int numberOfRounds = 0; - for (j=0;j<naggs;j++) { - int currentNumberOfRounds = (int)(((fd_end[j] - fd_start[j])+(ADIO_Offset)1)/coll_bufsize); - if (((ADIO_Offset)currentNumberOfRounds*coll_bufsize) < ((fd_end[j] - fd_start[j])+(ADIO_Offset)1)) - currentNumberOfRounds++; - if (currentNumberOfRounds > numberOfRounds) - numberOfRounds = currentNumberOfRounds; - } - - /* Data structures to track what data this compute needs to receive from whom. - * For lustre they will all need another dimension for the file domain. - */ int *sourceAggsForMyData = (int *)ADIOI_Malloc(naggs * sizeof(int)); - ADIO_Offset *sourceAggsForMyDataFDStart = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - ADIO_Offset *sourceAggsForMyDataFDEnd = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - int numSourceAggs = 0; - - /* This data structure holds the beginning offset and len list index for the range to be read - * coresponding to the round and source agg. Initialize to -1 to denote being unset. - */ - int **sourceAggsForMyDataFirstOffLenIndex = (int **)ADIOI_Malloc(numberOfRounds * sizeof(int *)); - for (i=0;i<numberOfRounds;i++) { - sourceAggsForMyDataFirstOffLenIndex[i] = (int *)ADIOI_Malloc(naggs * sizeof(int)); - for (j=0;j<naggs;j++) - sourceAggsForMyDataFirstOffLenIndex[i][j] = -1; - } - - /* This data structure holds the ending offset and len list index for the range to be read - * coresponding to the round and source agg. - */ - int **sourceAggsForMyDataLastOffLenIndex = (int **)ADIOI_Malloc(numberOfRounds * sizeof(int *)); - for (i=0;i<numberOfRounds;i++) - sourceAggsForMyDataLastOffLenIndex[i] = (int *)ADIOI_Malloc(naggs * sizeof(int)); - -#ifdef onesidedtrace - printf("NumberOfRounds is %d\n",numberOfRounds); - for (i=0;i<naggs;i++) - printf("fd->hints->ranklist[%d]is %d fd_start is %ld fd_end is %ld\n",i,fd->hints->ranklist[i],fd_start[i],fd_end[i]); - for (j=0;j<contig_access_count;j++) - printf("offset_list[%d] is %ld len_list is %ld\n",j,offset_list[j],len_list[j]); -#endif - - int currentAggRankListIndex = 0; - int maxNumNonContigSourceChunks = 0; - - ADIO_Offset currentRecvBufferOffset = 0; - int currentDataTypeExtent = 0; - int currentFlatBufIndice=0; - ADIO_Offset currentIndiceOffset = 0; - - /* This denotes the coll_bufsize boundaries within the source buffer for reading for 1 round. - */ - ADIO_Offset intraRoundCollBufsizeOffset = 0; - - /* This data structure tracks what source aggs need to be read to on what rounds. - */ - int *sourceAggsForMyDataCurrentRoundIter = (int *)ADIOI_Malloc(naggs * sizeof(int)); - for (i=0;i<naggs;i++) - sourceAggsForMyDataCurrentRoundIter[i] = 0; - - /* This is the first of the two main loops in this algorithm. The purpose of this loop is essentially to populate - * the data structures defined above for what read data blocks needs to go where (source agg and file domain) and when - * (round iter). For lustre essentially an additional layer of nesting will be required for the multiple file domains - * within the source agg. - */ - if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { - int blockIter; - for (blockIter=0;blockIter<contig_access_count;blockIter++) { - - /* Determine the starting source buffer offset for this block - for iter 0 skip it since that value is 0. - */ - if (blockIter>0) { - if (bufTypeIsContig) { - currentRecvBufferOffset += len_list[blockIter-1]; - } - else { - /* Non-contiguous source datatype, count up the extents and indices to this point - * in the blocks. - */ - ADIO_Offset sourceBlockTotal = 0; - int lastIndiceUsed = currentFlatBufIndice; - int numNonContigSourceChunks = 0; - while (sourceBlockTotal < len_list[blockIter-1]) { - numNonContigSourceChunks++; - sourceBlockTotal += (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); - lastIndiceUsed = currentFlatBufIndice; - currentFlatBufIndice++; - if (currentFlatBufIndice == flatBuf->count) { - currentFlatBufIndice = 0; - currentDataTypeExtent++; - } - currentIndiceOffset = (ADIO_Offset)0; - } - if (sourceBlockTotal > len_list[blockIter-1]) { - currentFlatBufIndice--; - if (currentFlatBufIndice < 0 ) { - currentDataTypeExtent--; - currentFlatBufIndice = flatBuf->count-1; - } - currentIndiceOffset = len_list[blockIter-1] - (sourceBlockTotal - flatBuf->blocklens[lastIndiceUsed]); - // ADIOI_Assert((currentIndiceOffset >= 0) && (currentIndiceOffset < flatBuf->blocklens[currentFlatBufIndice])); - } - else - currentIndiceOffset = 0; - maxNumContigOperations += (numNonContigSourceChunks+2); - if (numNonContigSourceChunks > maxNumNonContigSourceChunks) - maxNumNonContigSourceChunks = numNonContigSourceChunks; - -#ifdef onesidedtrace - printf("block iter %d currentFlatBufIndice is now %d currentDataTypeExtent is now %d currentIndiceOffset is now %ld maxNumContigOperations is now %d\n",blockIter,currentFlatBufIndice,currentDataTypeExtent,currentIndiceOffset,maxNumContigOperations); -#endif - } // !bufTypeIsContig - } // blockIter > 0 - - /* For the last iteration we need to include these maxNumContigOperations and maxNumNonContigSourceChunks - * for non-contig case even though we did not need to compute the next starting offset. - */ - if ((blockIter == (contig_access_count-1)) && (!bufTypeIsContig)) { - ADIO_Offset sourceBlockTotal = 0; - int tmpCurrentFlatBufIndice = currentFlatBufIndice; - int lastNumNonContigSourceChunks = 0; - while (sourceBlockTotal < len_list[blockIter]) { - lastNumNonContigSourceChunks++; - sourceBlockTotal += flatBuf->blocklens[tmpCurrentFlatBufIndice]; - tmpCurrentFlatBufIndice++; - if (tmpCurrentFlatBufIndice == flatBuf->count) { - tmpCurrentFlatBufIndice = 0; - } - } - maxNumContigOperations += (lastNumNonContigSourceChunks+2); - if (lastNumNonContigSourceChunks > maxNumNonContigSourceChunks) - maxNumNonContigSourceChunks = lastNumNonContigSourceChunks; - - } - - ADIO_Offset blockStart = offset_list[blockIter], blockEnd = offset_list[blockIter]+len_list[blockIter]-(ADIO_Offset)1; - - /* Find the starting source agg for this block - normally it will be the current agg so guard the expensive - * while loop with a cheap if-check which for large numbers of small blocks will usually be false. - */ - if (!((blockStart >= fd_start[currentAggRankListIndex]) && (blockStart <= fd_end[currentAggRankListIndex]))) { - while (!((blockStart >= fd_start[currentAggRankListIndex]) && (blockStart <= fd_end[currentAggRankListIndex]))) - currentAggRankListIndex++; - }; - - /* Determine if this is a new source agg. - */ - if (blockIter>0) { - if ((offset_list[blockIter-1]+len_list[blockIter-1]-(ADIO_Offset)1) < fd_start[currentAggRankListIndex]) - numSourceAggs++; - } - - /* Determine which round to start reading. - */ - if ((blockStart - fd_start[currentAggRankListIndex]) >= coll_bufsize) { - ADIO_Offset currentRoundBlockStart = fd_start[currentAggRankListIndex]; - int startingRound = 0; - while (blockStart > (currentRoundBlockStart + coll_bufsize - (ADIO_Offset)1)) { - currentRoundBlockStart+=coll_bufsize; - startingRound++; - } - sourceAggsForMyDataCurrentRoundIter[numSourceAggs] = startingRound; - } - - /* Initialize the data structures if this is the first offset in the round/source agg. - */ - if (sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] == -1) { - sourceAggsForMyData[numSourceAggs] = fd->hints->ranklist[currentAggRankListIndex]; - sourceAggsForMyDataFDStart[numSourceAggs] = fd_start[currentAggRankListIndex]; - /* Round up file domain to the first actual offset used if this is the first file domain. - */ - if (currentAggRankListIndex == smallestFileDomainAggRank) { - if (sourceAggsForMyDataFDStart[numSourceAggs] < firstFileOffset) - sourceAggsForMyDataFDStart[numSourceAggs] = firstFileOffset; - } - sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[currentAggRankListIndex]; - /* Round down file domain to the last actual offset used if this is the last file domain. - */ - if (currentAggRankListIndex == greatestFileDomainAggRank) { - if (sourceAggsForMyDataFDEnd[numSourceAggs] > lastFileOffset) - sourceAggsForMyDataFDEnd[numSourceAggs] = lastFileOffset; - } - sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - - /* Set the source buffer state starting point for data access for this agg and file domain. - */ - if (bufTypeIsContig) { - if (currentFDSourceBufferState[numSourceAggs].sourceBufferOffset == -1) { - - currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = currentRecvBufferOffset; -#ifdef onesidedtrace - printf("For agg %d sourceBufferOffset initialized to %ld\n",currentAggRankListIndex,currentRecvBufferOffset); -#endif - } - } - else { - if (currentFDSourceBufferState[numSourceAggs].indiceOffset == -1) { - currentFDSourceBufferState[numSourceAggs].indiceOffset = currentIndiceOffset; - currentFDSourceBufferState[numSourceAggs].bufTypeExtent = bufTypeExtent; - currentFDSourceBufferState[numSourceAggs].dataTypeExtent = currentDataTypeExtent; - currentFDSourceBufferState[numSourceAggs].flatBufIndice = currentFlatBufIndice; -#ifdef onesidedtrace - printf("For agg %d dataTypeExtent initialized to %d flatBufIndice to %d indiceOffset to %ld\n",numSourceAggs,currentDataTypeExtent,currentFlatBufIndice,currentIndiceOffset); -#endif - } - } - intraRoundCollBufsizeOffset = fd_start[currentAggRankListIndex] + ((ADIO_Offset)(sourceAggsForMyDataCurrentRoundIter[numSourceAggs]+1) * coll_bufsize); -#ifdef onesidedtrace - printf("init settings numSourceAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld currentRecvBufferOffset set to %ld intraRoundCollBufsizeOffset set to %ld\n",numSourceAggs,blockIter,offset_list[blockIter],fd_start[currentAggRankListIndex],len_list[blockIter],currentRecvBufferOffset,intraRoundCollBufsizeOffset); -#endif - - } - - /* Replace the last offset block iter with this one. - */ - sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - - /* If this blocks extends into the next file domain advance to the next source aggs and source buffer states. - */ - if (blockEnd > fd_end[currentAggRankListIndex]) { -#ifdef onesidedtrace - printf("block extends past current fd, blockEnd %ld >= fd_end[currentAggRankListIndex] %ld total block size is %ld blockStart was %ld\n",blockEnd,fd_end[currentAggRankListIndex], len_list[blockIter],blockStart); -#endif - ADIO_Offset amountToAdvanceSBOffsetForFD = 0; - int additionalFDCounter = 0; - while (blockEnd >= fd_end[currentAggRankListIndex]) { - ADIO_Offset thisAggBlockEnd = fd_end[currentAggRankListIndex]; - if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { - while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { - sourceAggsForMyDataCurrentRoundIter[numSourceAggs]++; - intraRoundCollBufsizeOffset += coll_bufsize; - sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; -#ifdef onesidedtrace - printf("sourceAggsForMyDataCurrentRoundI%d] is now %d intraRoundCollBufsizeOffset is now %ld\n",numSourceAggs,sourceAggsForMyDataCurrentRoundIter[numSourceAggs],intraRoundCollBufsizeOffset); -#endif - } // while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) - } // if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) - - int prevAggRankListIndex = currentAggRankListIndex; - currentAggRankListIndex++; - - /* Skip over unused aggs. - */ - if (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) { - while (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) - currentAggRankListIndex++; - - } // (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) - - /* Start new source agg. - */ - if (blockEnd >= fd_start[currentAggRankListIndex]) { - numSourceAggs++; - sourceAggsForMyData[numSourceAggs] = fd->hints->ranklist[currentAggRankListIndex]; - sourceAggsForMyDataFDStart[numSourceAggs] = fd_start[currentAggRankListIndex]; - /* Round up file domain to the first actual offset used if this is the first file domain. - */ - if (currentAggRankListIndex == smallestFileDomainAggRank) { - if (sourceAggsForMyDataFDStart[numSourceAggs] < firstFileOffset) - sourceAggsForMyDataFDStart[numSourceAggs] = firstFileOffset; - } - sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[currentAggRankListIndex]; - /* Round down file domain to the last actual offset used if this is the last file domain. - */ - if (currentAggRankListIndex == greatestFileDomainAggRank) { - if (sourceAggsForMyDataFDEnd[numSourceAggs] > lastFileOffset) - sourceAggsForMyDataFDEnd[numSourceAggs] = lastFileOffset; - } - sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - - - /* For the first additonal file domain the source buffer offset - * will be incremented relative to the state of this first main - * loop but for subsequent full file domains the offset will be - * incremented by the size of the file domain. - */ - if (additionalFDCounter == 0) - amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex] - blockStart) + (ADIO_Offset)1; - else - amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex]-fd_start[prevAggRankListIndex]) +(ADIO_Offset)1; - - if (bufTypeIsContig) { - ADIOI_Assert(numSourceAggs > 0); - if (currentFDSourceBufferState[numSourceAggs].sourceBufferOffset == -1) { - if (additionalFDCounter == 0) { // first file domain, still use the current data counter - currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = currentRecvBufferOffset+amountToAdvanceSBOffsetForFD; - } - else { // 2nd file domain, advance full file domain from last source buffer state - currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = currentFDSourceBufferState[numSourceAggs-1].sourceBufferOffset+amountToAdvanceSBOffsetForFD; - } - -#ifdef onesidedtrace - printf("Crossed into new FD - for agg %d sourceBufferOffset initialized to %ld amountToAdvanceSBOffsetForFD is %ld\n",numSourceAggs,currentFDSourceBufferState[numSourceAggs].sourceBufferOffset,amountToAdvanceSBOffsetForFD); -#endif - } - } - else if (currentFDSourceBufferState[numSourceAggs].indiceOffset == -1) { - // non-contiguos source buffer - ADIOI_Assert(numSourceAggs > 0); - - /* Initialize the source buffer state appropriately and then - * advance it with the nonContigSourceDataBufferAdvance function. - */ - if (additionalFDCounter == 0) { - // first file domain, still use the current data counter - currentFDSourceBufferState[numSourceAggs].indiceOffset = currentIndiceOffset; - currentFDSourceBufferState[numSourceAggs].bufTypeExtent = bufTypeExtent; - currentFDSourceBufferState[numSourceAggs].dataTypeExtent = currentDataTypeExtent; - currentFDSourceBufferState[numSourceAggs].flatBufIndice = currentFlatBufIndice; - } - else { - // 2nd file domain, advance full file domain from last source - // buffer state - currentFDSourceBufferState[numSourceAggs].indiceOffset = currentFDSourceBufferState[numSourceAggs-1].indiceOffset; - currentFDSourceBufferState[numSourceAggs].bufTypeExtent = currentFDSourceBufferState[numSourceAggs-1].bufTypeExtent; - currentFDSourceBufferState[numSourceAggs].dataTypeExtent = currentFDSourceBufferState[numSourceAggs-1].dataTypeExtent; - currentFDSourceBufferState[numSourceAggs].flatBufIndice = currentFDSourceBufferState[numSourceAggs-1].flatBufIndice; - } - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, (int)amountToAdvanceSBOffsetForFD, 0, ¤tFDSourceBufferState[numSourceAggs], NULL); -#ifdef onesidedtrace - printf("Crossed into new FD - for agg %d dataTypeExtent initialized to %d flatBufIndice to %d indiceOffset to %ld amountToAdvanceSBOffsetForFD is %d\n",numSourceAggs,currentFDSourceBufferState[numSourceAggs].dataTypeExtent,currentFDSourceBufferState[numSourceAggs].flatBufIndice,currentFDSourceBufferState[numSourceAggs].indiceOffset,amountToAdvanceSBOffsetForFD); -#endif - } - - additionalFDCounter++; - - -#ifdef onesidedtrace - printf("block extended beyond fd init settings numSourceAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld\n",numSourceAggs,i,offset_list[blockIter],fd_start[currentAggRankListIndex],len_list[blockIter]); -#endif - intraRoundCollBufsizeOffset = fd_start[currentAggRankListIndex] + coll_bufsize; - sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - } // if (blockEnd >= fd_start[currentAggRankListIndex]) - } // while (blockEnd >= fd_end[currentAggRankListIndex]) - } // if (blockEnd > fd_end[currentAggRankListIndex]) - - /* If we are still in the same file domain / source agg but have gone past the coll_bufsize and need - * to advance to the next round handle this situation. - */ - if (blockEnd >= intraRoundCollBufsizeOffset) { - ADIO_Offset currentBlockEnd = blockEnd; - while (currentBlockEnd >= intraRoundCollBufsizeOffset) { - sourceAggsForMyDataCurrentRoundIter[numSourceAggs]++; - intraRoundCollBufsizeOffset += coll_bufsize; - sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; - sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] = blockIter; -#ifdef onesidedtrace - printf("block less than fd currentBlockEnd is now %ld intraRoundCollBufsizeOffset is now %ld sourceAggsForMyDataCurrentRoundIter[%d] is now %d\n",currentBlockEnd, intraRoundCollBufsizeOffset, numSourceAggs,sourceAggsForMyDataCurrentRoundIter[numSourceAggs]); -#endif - } // while (currentBlockEnd >= intraRoundCollBufsizeOffset) - } // if (blockEnd >= intraRoundCollBufsizeOffset) - - /* Need to advance numSourceAggs if this is the last source offset to - * include this one. - */ - if (blockIter == (contig_access_count-1)) - numSourceAggs++; - } - -#ifdef onesidedtrace - printf("numSourceAggs is %d\n",numSourceAggs); - for (i=0;i<numSourceAggs;i++) { - for (j=0;j<=sourceAggsForMyDataCurrentRoundIter[i];j++) - printf("sourceAggsForMyData[%d] is %d sourceAggsForMyDataFDStart[%d] is %ld sourceAggsForMyDataFDEnd is %ld sourceAggsForMyDataFirstOffLenIndex is %d with value %ld sourceAggsForMyDataLastOffLenIndex is %d with value %ld\n",i,sourceAggsForMyData[i],i,sourceAggsForMyDataFDStart[i],sourceAggsForMyDataFDEnd[i],sourceAggsForMyDataFirstOffLenIndex[j][i],offset_list[sourceAggsForMyDataFirstOffLenIndex[j][i]],sourceAggsForMyDataLastOffLenIndex[j][i],offset_list[sourceAggsForMyDataLastOffLenIndex[j][i]]); - - } -#endif - - } // if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) - - ADIOI_Free(sourceAggsForMyDataCurrentRoundIter); - - /* use the two-phase buffer allocated in the file_open - no app should ever - * be both reading and reading at the same time */ - char *read_buf0 = fd->io_buf; - char *read_buf1 = fd->io_buf + coll_bufsize; - /* if threaded i/o selected, we'll do a kind of double buffering */ - char *read_buf = read_buf0; - - int currentReadBuf = 0; - int useIOBuffer = 0; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio && (numberOfRounds>1)) { - useIOBuffer = 1; - io_thread = pthread_self(); - } -#endif - - MPI_Win read_buf_window = fd->io_buf_window; - - ADIO_Offset currentRoundFDStart = 0, nextRoundFDStart = 0; - ADIO_Offset currentRoundFDEnd = 0, nextRoundFDEnd = 0; - - if (iAmUsedAgg) { - currentRoundFDStart = fd_start[myAggRank]; - nextRoundFDStart = fd_start[myAggRank]; - if (myAggRank == smallestFileDomainAggRank) { - if (currentRoundFDStart < firstFileOffset) - currentRoundFDStart = firstFileOffset; - if (nextRoundFDStart < firstFileOffset) - nextRoundFDStart = firstFileOffset; - } - else if (myAggRank == greatestFileDomainAggRank) { - if (currentRoundFDEnd > lastFileOffset) - currentRoundFDEnd = lastFileOffset; - if (nextRoundFDEnd > lastFileOffset) - nextRoundFDEnd = lastFileOffset; - } -#ifdef onesidedtrace -printf("iAmUsedAgg - currentRoundFDStart initialized " - "to %ld currentRoundFDEnd to %ld\n", - currentRoundFDStart,currentRoundFDEnd); -#endif - - - } - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase-startTimeBase); - startTimeBase = MPI_Wtime(); -#endif - - - /* This is the second main loop of the algorithm, actually nested loop of target aggs within rounds. There are 2 flavors of this. - * For gpfsmpio_read_aggmethod of 1 each nested iteration for the source agg does an mpi_put on a contiguous chunk using a primative datatype - * determined using the data structures from the first main loop. For gpfsmpio_read_aggmethod of 2 each nested iteration for the source agg - * builds up data to use in created a derived data type for 1 mpi_put that is done for the target agg for each round. - * To support lustre there will need to be an additional layer of nesting for the multiple file domains - * within target aggs. - */ - int roundIter; - for (roundIter=0;roundIter<numberOfRounds;roundIter++) { - - if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) - { - /* determine what offsets define the portion of the file domain the agg is reading this round */ - if (iAmUsedAgg) { - - currentRoundFDStart = nextRoundFDStart; - - if (!useIOBuffer || (roundIter == 0)) { - int amountDataToReadThisRound; - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - currentRoundFDEnd = fd_end[myAggRank]; - amountDataToReadThisRound = ((currentRoundFDEnd-currentRoundFDStart)+1); - } - else { - currentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset)1; - amountDataToReadThisRound = coll_bufsize; - } - - /* read currentRoundFDEnd bytes */ - ADIO_ReadContig(fd, read_buf,amountDataToReadThisRound, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, currentRoundFDStart, - &status, error_code); - currentReadBuf = 1; - - } - if (useIOBuffer) { /* use the thread reader for the next round */ - /* switch back and forth between the read buffers so that the data aggregation code is diseminating 1 buffer while the thread is reading into the other */ - - if (roundIter > 0) - currentRoundFDEnd = nextRoundFDEnd; - - if (roundIter < (numberOfRounds-1)) { - nextRoundFDStart += coll_bufsize; - int amountDataToReadNextRound; - if ((fd_end[myAggRank] - nextRoundFDStart) < coll_bufsize) { - nextRoundFDEnd = fd_end[myAggRank]; - amountDataToReadNextRound = ((nextRoundFDEnd-nextRoundFDStart)+1); - } - else { - nextRoundFDEnd = nextRoundFDStart + coll_bufsize - (ADIO_Offset)1; - amountDataToReadNextRound = coll_bufsize; - } - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - io_thread_args.fd = fd; - /* do a little pointer shuffling: background I/O works from one - * buffer while two-phase machinery fills up another */ - - if (currentReadBuf == 0) { - io_thread_args.buf = read_buf0; - currentReadBuf = 1; - read_buf = read_buf1; - } - else { - io_thread_args.buf = read_buf1; - currentReadBuf = 0; - read_buf = read_buf0; - } - io_thread_args.io_kind = ADIOI_READ; - io_thread_args.size = amountDataToReadNextRound; - io_thread_args.offset = nextRoundFDStart; - io_thread_args.status = &status; - io_thread_args.error_code = *error_code; - if ( (pthread_create(&io_thread, NULL, - ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) - io_thread = pthread_self(); - - } - else { /* last round */ - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - if (currentReadBuf == 0) { - read_buf = read_buf0; - } - else { - read_buf = read_buf1; - } - - } - } /* useIOBuffer */ - } /* IAmUsedAgg */ - else if (useIOBuffer) { - if (roundIter < (numberOfRounds-1)) { - if (currentReadBuf == 0) { - currentReadBuf = 1; - read_buf = read_buf1; - } - else { - currentReadBuf = 0; - read_buf = read_buf0; - } - } - else { - if (currentReadBuf == 0) { - read_buf = read_buf0; - } - else { - read_buf = read_buf1; - } - } - - } - // wait until the read buffers are full before we start pulling from the source procs - MPI_Barrier(fd->comm); - - int aggIter; - for (aggIter=0;aggIter<numSourceAggs;aggIter++) { - - /* If we have data for the round/agg process it. - */ - if (sourceAggsForMyDataFirstOffLenIndex[roundIter][aggIter] != -1) { - - ADIO_Offset currentRoundFDStartForMySourceAgg = (ADIO_Offset)((ADIO_Offset)sourceAggsForMyDataFDStart[aggIter] + (ADIO_Offset)((ADIO_Offset)roundIter*coll_bufsize)); - ADIO_Offset currentRoundFDEndForMySourceAgg = (ADIO_Offset)((ADIO_Offset)sourceAggsForMyDataFDStart[aggIter] + (ADIO_Offset)((ADIO_Offset)(roundIter+1)*coll_bufsize) - (ADIO_Offset)1); - - int sourceAggContigAccessCount = 0; - - /* These data structures are used for the derived datatype mpi_get - * in the gpfsmpio_read_aggmethod of 2 case. - */ - int *sourceAggBlockLengths=NULL; - MPI_Aint *sourceAggDisplacements=NULL, *recvBufferDisplacements=NULL; - MPI_Datatype *sourceAggDataTypes=NULL; - char *derivedTypePackedSourceBuffer=NULL; - int derivedTypePackedSourceBufferOffset = 0; - int allocatedDerivedTypeArrays = 0; - ADIO_Offset amountOfDataReadThisRoundAgg = 0; - - /* Process the range of offsets for this source agg. - */ - int offsetIter; - int startingOffLenIndex = sourceAggsForMyDataFirstOffLenIndex[roundIter][aggIter], endingOffLenIndex = sourceAggsForMyDataLastOffLenIndex[roundIter][aggIter]; - for (offsetIter=startingOffLenIndex;offsetIter<=endingOffLenIndex;offsetIter++) { - if (currentRoundFDEndForMySourceAgg > sourceAggsForMyDataFDEnd[aggIter]) - currentRoundFDEndForMySourceAgg = sourceAggsForMyDataFDEnd[aggIter]; - - ADIO_Offset offsetStart = offset_list[offsetIter], offsetEnd = (offset_list[offsetIter]+len_list[offsetIter]-(ADIO_Offset)1); - - /* Determine the amount of data and exact source buffer offsets to use. - */ - int bufferAmountToRecv = 0; - - if ((offsetStart >= currentRoundFDStartForMySourceAgg) && (offsetStart <= currentRoundFDEndForMySourceAgg)) { - if (offsetEnd > currentRoundFDEndForMySourceAgg) - bufferAmountToRecv = (currentRoundFDEndForMySourceAgg - offsetStart) +1; - else - bufferAmountToRecv = (offsetEnd - offsetStart) +1; - } - else if ((offsetEnd >= currentRoundFDStartForMySourceAgg) && (offsetEnd <= currentRoundFDEndForMySourceAgg)) { - if (offsetEnd > currentRoundFDEndForMySourceAgg) - bufferAmountToRecv = (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) +1; - else - bufferAmountToRecv = (offsetEnd - currentRoundFDStartForMySourceAgg) +1; - if (offsetStart < currentRoundFDStartForMySourceAgg) { - offsetStart = currentRoundFDStartForMySourceAgg; - } - } - else if ((offsetStart <= currentRoundFDStartForMySourceAgg) && (offsetEnd >= currentRoundFDEndForMySourceAgg)) { - bufferAmountToRecv = (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) +1; - offsetStart = currentRoundFDStartForMySourceAgg; - } - - if (bufferAmountToRecv > 0) { /* we have data to recv this round */ - if (gpfsmpio_read_aggmethod == 2) { - /* Only allocate these arrays if we are using method 2 and only do it once for this round/source agg. - */ - if (!allocatedDerivedTypeArrays) { - sourceAggBlockLengths = (int *)ADIOI_Malloc(maxNumContigOperations * sizeof(int)); - sourceAggDisplacements = (MPI_Aint *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Aint)); - recvBufferDisplacements = (MPI_Aint *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Aint)); - sourceAggDataTypes = (MPI_Datatype *)ADIOI_Malloc(maxNumContigOperations * sizeof(MPI_Datatype)); - if (!bufTypeIsContig) { - int k; - for (k=sourceAggsForMyDataFirstOffLenIndex[roundIter][aggIter];k<=sourceAggsForMyDataLastOffLenIndex[roundIter][aggIter];k++) - amountOfDataReadThisRoundAgg += len_list[k]; - -#ifdef onesidedtrace - printf("derivedTypePackedSourceBuffer mallocing %ld\n",amountOfDataReadThisRoundAgg); -#endif - if (amountOfDataReadThisRoundAgg > 0) - derivedTypePackedSourceBuffer = (char *)ADIOI_Malloc(amountOfDataReadThisRoundAgg * sizeof(char)); - else - derivedTypePackedSourceBuffer = NULL; - } - allocatedDerivedTypeArrays = 1; - } - } - - /* Determine the offset into the source window. - */ - MPI_Aint sourceDisplacementToUseThisRound = (MPI_Aint) (offsetStart - currentRoundFDStartForMySourceAgg); - - /* If using the thread reader select the appropriate side of the split window. - */ - if (useIOBuffer && (read_buf == read_buf1)) { - sourceDisplacementToUseThisRound += (MPI_Aint)coll_bufsize; - } - - /* For gpfsmpio_read_aggmethod of 1 do the mpi_get using the primitive MPI_BYTE type from each - * contiguous chunk from the target, if the source is non-contiguous then unpack the data after - * the MPI_Win_unlock is done to make sure the data has arrived first. - */ - if (gpfsmpio_read_aggmethod == 1) { - MPI_Win_lock(MPI_LOCK_SHARED, sourceAggsForMyData[aggIter], 0, read_buf_window); - char *getSourceData = NULL; - if (bufTypeIsContig) { - MPI_Get(((char*)buf) + currentFDSourceBufferState[aggIter].sourceBufferOffset,bufferAmountToRecv, MPI_BYTE,sourceAggsForMyData[aggIter],sourceDisplacementToUseThisRound, bufferAmountToRecv,MPI_BYTE,read_buf_window); - currentFDSourceBufferState[aggIter].sourceBufferOffset += (ADIO_Offset)bufferAmountToRecv; - - } - else { - getSourceData = (char *) ADIOI_Malloc(bufferAmountToRecv*sizeof(char)); - MPI_Get(getSourceData,bufferAmountToRecv, MPI_BYTE,sourceAggsForMyData[aggIter],sourceDisplacementToUseThisRound, bufferAmountToRecv,MPI_BYTE,read_buf_window); - - } - MPI_Win_unlock(sourceAggsForMyData[aggIter], read_buf_window); - if (!bufTypeIsContig) { - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, bufferAmountToRecv, 0, ¤tFDSourceBufferState[aggIter], getSourceData); - ADIOI_Free(getSourceData); - } - } - - /* For gpfsmpio_read_aggmethod of 2 populate the data structures for this round/agg for this offset iter - * to be used subsequently when building the derived type for 1 mpi_put for all the data for this - * round/agg. - */ - else if (gpfsmpio_read_aggmethod == 2) { - if (bufTypeIsContig) { - sourceAggBlockLengths[sourceAggContigAccessCount]= bufferAmountToRecv; - sourceAggDataTypes[sourceAggContigAccessCount] = MPI_BYTE; - sourceAggDisplacements[sourceAggContigAccessCount] = sourceDisplacementToUseThisRound; - recvBufferDisplacements[sourceAggContigAccessCount] = (MPI_Aint)currentFDSourceBufferState[aggIter].sourceBufferOffset; - currentFDSourceBufferState[aggIter].sourceBufferOffset += (ADIO_Offset)bufferAmountToRecv; - sourceAggContigAccessCount++; - } - else { - sourceAggBlockLengths[sourceAggContigAccessCount]= bufferAmountToRecv; - sourceAggDataTypes[sourceAggContigAccessCount] = MPI_BYTE; - sourceAggDisplacements[sourceAggContigAccessCount] = sourceDisplacementToUseThisRound; - recvBufferDisplacements[sourceAggContigAccessCount] = (MPI_Aint)derivedTypePackedSourceBufferOffset; - derivedTypePackedSourceBufferOffset += (ADIO_Offset)bufferAmountToRecv; - sourceAggContigAccessCount++; - } - } - } // bufferAmountToRecv > 0 - } // contig list - - /* For gpfsmpio_read_aggmethod of 2 now build the derived type using the data from this round/agg and do 1 single mpi_put. - */ - if (gpfsmpio_read_aggmethod == 2) { - MPI_Datatype recvBufferDerivedDataType, sourceBufferDerivedDataType; - - MPI_Type_create_struct(sourceAggContigAccessCount, sourceAggBlockLengths, recvBufferDisplacements, sourceAggDataTypes, &recvBufferDerivedDataType); - MPI_Type_commit(&recvBufferDerivedDataType); - MPI_Type_create_struct(sourceAggContigAccessCount, sourceAggBlockLengths, sourceAggDisplacements, sourceAggDataTypes, &sourceBufferDerivedDataType); - MPI_Type_commit(&sourceBufferDerivedDataType); - - if (sourceAggContigAccessCount > 0) { - - MPI_Win_lock(MPI_LOCK_SHARED, sourceAggsForMyData[aggIter], 0, read_buf_window); - if (bufTypeIsContig) { - MPI_Get(((char*)buf),1, recvBufferDerivedDataType,sourceAggsForMyData[aggIter],0, 1,sourceBufferDerivedDataType,read_buf_window); - } - else { - MPI_Get(derivedTypePackedSourceBuffer,1, recvBufferDerivedDataType,sourceAggsForMyData[aggIter],0, 1,sourceBufferDerivedDataType,read_buf_window); - } - - MPI_Win_unlock(sourceAggsForMyData[aggIter], read_buf_window); - if (!bufTypeIsContig) { - nonContigSourceDataBufferAdvance(((char*)buf), flatBuf, derivedTypePackedSourceBufferOffset, 0, ¤tFDSourceBufferState[aggIter], derivedTypePackedSourceBuffer); - } - } - - if (allocatedDerivedTypeArrays) { - ADIOI_Free(sourceAggBlockLengths); - ADIOI_Free(sourceAggDisplacements); - ADIOI_Free(sourceAggDataTypes); - ADIOI_Free(recvBufferDisplacements); - if (!bufTypeIsContig) - if (derivedTypePackedSourceBuffer != NULL) - ADIOI_Free(derivedTypePackedSourceBuffer); - } - if (sourceAggContigAccessCount > 0) { - MPI_Type_free(&recvBufferDerivedDataType); - MPI_Type_free(&sourceBufferDerivedDataType); - } - } - } // baseoffset != -1 - } // source aggs - } // contig_access_count > 0 - /* the source procs recv the requested data to the aggs */ - - MPI_Barrier(fd->comm); - - nextRoundFDStart = currentRoundFDStart + coll_bufsize; - - } /* for-loop roundIter */ - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase-startTimeBase); -#endif - - if (useIOBuffer) { /* thread readr cleanup */ - - if ( !pthread_equal(io_thread, pthread_self()) ) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - } - - } - - ADIOI_Free(sourceAggsForMyData); - ADIOI_Free(sourceAggsForMyDataFDStart); - ADIOI_Free(sourceAggsForMyDataFDEnd); - - for (i=0;i<numberOfRounds;i++) { - ADIOI_Free(sourceAggsForMyDataFirstOffLenIndex[i]); - ADIOI_Free(sourceAggsForMyDataLastOffLenIndex[i]); - } - ADIOI_Free(sourceAggsForMyDataFirstOffLenIndex); - ADIOI_Free(sourceAggsForMyDataLastOffLenIndex); - - ADIOI_Free(currentFDSourceBufferState); - - if (!bufTypeIsContig) - ADIOI_Delete_flattened(datatype); - return; -} diff --git a/3rd-party/romio321/adio/common/p2p_aggregation.c b/3rd-party/romio321/adio/common/p2p_aggregation.c deleted file mode 100644 index ac77a8f876ef5bbcd4bb5254a89ecb0ac8671efd..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/p2p_aggregation.c +++ /dev/null @@ -1,916 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" -#include "../ad_gpfs/ad_gpfs_tuning.h" - -#include <pthread.h> - -/* #define p2pcontigtrace 1 */ - -void ADIOI_P2PContigWriteAggregation(ADIO_File fd, - const void *buf, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end) -{ - - *error_code = MPI_SUCCESS; /* initialize to success */ - -#ifdef ROMIO_GPFS - double startTimeBase,endTimeBase; -#endif - - MPI_Status status; - pthread_t io_thread; - void *thread_ret; - ADIOI_IO_ThreadFuncData io_thread_args; - - int nprocs,myrank; - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - ADIO_Offset myOffsetStart = st_offsets[myrank], myOffsetEnd = end_offsets[myrank]; - - int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ - int iAmUsedAgg = 0; - -#ifdef ROMIO_GPFS - startTimeBase = MPI_Wtime(); -#endif - - int naggs = fd->hints->cb_nodes; - int coll_bufsize = fd->hints->cb_buffer_size; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio == 1) { - /* split buffer in half for a kind of double buffering with the threads*/ - coll_bufsize = fd->hints->cb_buffer_size/2; - } -#endif - - int j; - for (j=0;j<naggs;j++) { - if (fd->hints->ranklist[j] == myrank) { - myAggRank = j; - if (fd_end[j] > fd_start[j]) { - iAmUsedAgg = 1; - } - } - } - - /* Determine how much data and to whom I need to send. For source proc - * targets, also determine the target file domain offsets locally to - * reduce communication overhead */ - int *targetAggsForMyData = (int *)ADIOI_Malloc(naggs * sizeof(int)); - ADIO_Offset *targetAggsForMyDataFDStart = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - ADIO_Offset *targetAggsForMyDataFDEnd = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - int numTargetAggs = 0; - int i; - for (i=0;i<naggs;i++) { - if ( ((myOffsetStart >= fd_start[i]) && (myOffsetStart <= fd_end[i])) || ((myOffsetEnd >= fd_start[i]) && (myOffsetEnd <= fd_end[i]))) { - targetAggsForMyData[numTargetAggs] = fd->hints->ranklist[i]; - targetAggsForMyDataFDStart[numTargetAggs] = fd_start[i]; - targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[i]; - numTargetAggs++; - } - } - - /* these 3 arrays track info on the procs that feed an aggregtor */ - int *sourceProcsForMyData=NULL; - int *remainingDataAmountToGetPerProc=NULL; - ADIO_Offset *remainingDataOffsetToGetPerProc=NULL; - - int numSourceProcs = 0; - - if (iAmUsedAgg) { /* for the used aggregators figure out how much data I - need from what procs */ - - /* count numSourceProcs so we know how large to make the arrays */ - for (i=0;i<nprocs;i++) - if ( ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) - numSourceProcs++; - - sourceProcsForMyData = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int)); - remainingDataAmountToGetPerProc = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int)); - remainingDataOffsetToGetPerProc = (ADIO_Offset *)ADIOI_Malloc(numSourceProcs * sizeof(ADIO_Offset)); - - /* everybody has the st_offsets and end_offsets for all ranks so if I am a - * used aggregator go thru them and figure out which ranks have data that - * falls into my file domain assigned to me */ - numSourceProcs = 0; - for (i=0;i<nprocs;i++) { - if ( ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) { - sourceProcsForMyData[numSourceProcs] = i; - if ( ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) && ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) { - remainingDataAmountToGetPerProc[numSourceProcs] = (end_offsets[i] - st_offsets[i])+1; - remainingDataOffsetToGetPerProc[numSourceProcs] = st_offsets[i]; - } - else if ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) {/* starts in this fd and goes past it */ - remainingDataAmountToGetPerProc[numSourceProcs] = (fd_end[myAggRank] - st_offsets[i]) +1; - remainingDataOffsetToGetPerProc[numSourceProcs] = st_offsets[i]; - } - else { /* starts in fd before this and ends in it */ - remainingDataAmountToGetPerProc[numSourceProcs] = (end_offsets[i] - fd_start[myAggRank]) +1; - remainingDataOffsetToGetPerProc[numSourceProcs] = fd_start[myAggRank]; - } -#ifdef p2pcontigtrace - printf("getting %ld bytes from source proc %d in fd rank %d with borders %ld to %ld\n",remainingDataAmountToGetPerProc[numSourceProcs],i,fd->hints->ranklist[myAggRank],fd_start[myAggRank],fd_end[myAggRank]); -#endif - numSourceProcs++; - } - } - } - - int *amountOfDataReqestedByTargetAgg = (int *)ADIOI_Malloc(naggs * sizeof(int)); - for (i=0;i<numTargetAggs;i++) { - amountOfDataReqestedByTargetAgg[i] = 0; - } - - int totalAmountDataReceived = 0; - MPI_Request *mpiSizeToSendRequest = (MPI_Request *) ADIOI_Malloc(numTargetAggs * sizeof(MPI_Request)); - MPI_Request *mpiRecvDataRequest = (MPI_Request *) ADIOI_Malloc(numSourceProcs * sizeof(MPI_Request)); - MPI_Request *mpiSendDataSizeRequest = (MPI_Request *) ADIOI_Malloc(numSourceProcs * sizeof(MPI_Request)); - - MPI_Request *mpiSendDataToTargetAggRequest = (MPI_Request *) ADIOI_Malloc(numTargetAggs * sizeof(MPI_Request)); - MPI_Status mpiWaitAnyStatusFromTargetAggs,mpiWaitAnyStatusFromSourceProcs; - MPI_Status mpiIsendStatusForSize, mpiIsendStatusForData; - - /* use the write buffer allocated in the file_open */ - char *write_buf0 = fd->io_buf; - char *write_buf1 = fd->io_buf + coll_bufsize; - - /* start off pointing to the first buffer. If we use the 2nd buffer (threaded - * case) we'll swap later */ - char *write_buf = write_buf0; - - /* compute number of rounds */ - ADIO_Offset numberOfRounds = (ADIO_Offset)((((ADIO_Offset)(end_offsets[nprocs-1]-st_offsets[0]))/((ADIO_Offset)((ADIO_Offset)coll_bufsize*(ADIO_Offset)naggs)))) + 1; - - int currentWriteBuf = 0; - int useIOBuffer = 0; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio && (numberOfRounds>1)) { - useIOBuffer = 1; - io_thread = pthread_self(); - } -#endif - - ADIO_Offset currentRoundFDStart = 0; - ADIO_Offset currentRoundFDEnd = 0; - - if (iAmUsedAgg) { - currentRoundFDStart = fd_start[myAggRank]; - } - - int *dataSizeGottenThisRoundPerProc = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int)); - int *mpiRequestMapPerProc = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int)); - int *targetAggIndexesForMyDataThisRound = (int *)ADIOI_Malloc(numTargetAggs * sizeof(int)); - int *sendBufferOffsetsThisRound = (int *)ADIOI_Malloc(numTargetAggs * sizeof(int)); - int *bufferAmountsToSendThisRound = (int *)ADIOI_Malloc(numTargetAggs * sizeof(int)); - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_MYREQ] += (endTimeBase-startTimeBase); - startTimeBase = MPI_Wtime(); -#endif - - /* each iteration of this loop writes a coll_bufsize portion of the file - * domain */ - int roundIter; - for (roundIter=0;roundIter<numberOfRounds;roundIter++) { - - /* determine what target aggs I need to send data to this round */ - int numTargetAggsThisRound = 0; - for (i=0;i<numTargetAggs;i++) { - if ( ((myOffsetStart >= targetAggsForMyDataFDStart[i]) && (myOffsetStart <= targetAggsForMyDataFDEnd[i])) || - ((myOffsetEnd >= targetAggsForMyDataFDStart[i]) && (myOffsetEnd <= targetAggsForMyDataFDEnd[i]))) { - /* we know that we need to send data to this target agg at some point, now need to figure out how much this round */ - - /* here are the offsets currently being collected by the aggregator during this round */ - ADIO_Offset currentRoundFDStartForMyTargetAgg = (ADIO_Offset)((ADIO_Offset)targetAggsForMyDataFDStart[i] + (ADIO_Offset)((ADIO_Offset)roundIter*(ADIO_Offset)coll_bufsize)); - ADIO_Offset currentRoundFDEndForMyTargetAgg = (ADIO_Offset)((ADIO_Offset)targetAggsForMyDataFDStart[i] + (ADIO_Offset)((ADIO_Offset)(roundIter+1)*(ADIO_Offset)coll_bufsize) - (ADIO_Offset)1); - if (currentRoundFDEndForMyTargetAgg > targetAggsForMyDataFDEnd[i]) - currentRoundFDEndForMyTargetAgg = targetAggsForMyDataFDEnd[i]; - -#ifdef p2pcontigtrace - printf("roundIter %d target iter %d targetAggsForMyData is %d myOffsetStart is %ld myOffsetEnd is %ld targetAggsForMyDataFDStart is %ld targetAggsForMyDataFDEnd is %ld currentRoundFDStartForMyTargetAgg is %ld currentRoundFDEndForMyTargetAgg is %ld\n", - roundIter,i,targetAggsForMyData[i],myOffsetStart,myOffsetEnd, - targetAggsForMyDataFDStart[i],targetAggsForMyDataFDEnd[i], - currentRoundFDStartForMyTargetAgg,currentRoundFDEndForMyTargetAgg); -#endif - - /* send the portion of my data that is within - * currentRoundFDStartForMyTargetAgg to - * currentRoundFDEndForMyTargetAgg */ - /* find the offset into the send buffer and the amount - * of data to send */ - int sendBufferOffset = 0; - int bufferAmountToSend = 0; - - if ((myOffsetStart >= currentRoundFDStartForMyTargetAgg) && (myOffsetStart <= currentRoundFDEndForMyTargetAgg)) { - if (myOffsetEnd > currentRoundFDEndForMyTargetAgg) - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - myOffsetStart) +1; - else - bufferAmountToSend = (myOffsetEnd - myOffsetStart) +1; - } - else if ((myOffsetEnd >= currentRoundFDStartForMyTargetAgg) && (myOffsetEnd <= currentRoundFDEndForMyTargetAgg)) { - sendBufferOffset = (int) (currentRoundFDStartForMyTargetAgg - myOffsetStart); - if (myOffsetEnd > currentRoundFDEndForMyTargetAgg) - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) +1; - else - bufferAmountToSend = (myOffsetEnd - currentRoundFDStartForMyTargetAgg) +1; - } - else if ((myOffsetStart <= currentRoundFDStartForMyTargetAgg) && (myOffsetEnd >= currentRoundFDEndForMyTargetAgg)) { - sendBufferOffset = (int) (currentRoundFDStartForMyTargetAgg - myOffsetStart); - bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) +1; - } - - if (bufferAmountToSend > 0) { /* we have data to send this round */ - targetAggIndexesForMyDataThisRound[numTargetAggsThisRound] = i; - sendBufferOffsetsThisRound[numTargetAggsThisRound] = sendBufferOffset; - bufferAmountsToSendThisRound[numTargetAggsThisRound] = bufferAmountToSend; -#ifdef p2pcontigtrace - printf("bufferAmountToSend is %d sendBufferOffset is %d\n",bufferAmountToSend,sendBufferOffset); -#endif - /* only need to be pinged by the agg for rounds after the first one - for the first one just - * send the data without being pinged */ - if (roundIter > 0) - MPI_Irecv(&amountOfDataReqestedByTargetAgg[numTargetAggsThisRound],1, - MPI_INT,targetAggsForMyData[i],0, - fd->comm,&mpiSizeToSendRequest[numTargetAggsThisRound]); - numTargetAggsThisRound++; - - } - } - } - - /* determine what offsets define the portion of the file domain the agg is writing this round */ - if (iAmUsedAgg) { - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - currentRoundFDEnd = fd_end[myAggRank]; - } - else - currentRoundFDEnd = currentRoundFDStart + coll_bufsize - 1; -#ifdef p2pcontigtrace - printf("currentRoundFDStart is %ld currentRoundFDEnd is %ld within file domeain %ld to %ld\n",currentRoundFDStart,currentRoundFDEnd,fd_start[myAggRank],fd_end[myAggRank]); -#endif - } - - int irecv,isend; - int numSourceProcsSentData = 0; - - /* the aggs send the amount of data they need to their source procs */ - for (i=0;i<numSourceProcs;i++) { - if ((remainingDataOffsetToGetPerProc[i] >= currentRoundFDStart) && (remainingDataOffsetToGetPerProc[i] <= currentRoundFDEnd)) { - if ((remainingDataOffsetToGetPerProc[i] + remainingDataAmountToGetPerProc[i]) <= currentRoundFDEnd) - dataSizeGottenThisRoundPerProc[i] = remainingDataAmountToGetPerProc[i]; - else - dataSizeGottenThisRoundPerProc[i] = (currentRoundFDEnd - remainingDataOffsetToGetPerProc[i]) +1; - } - else if (((remainingDataOffsetToGetPerProc[i]+remainingDataAmountToGetPerProc[i]) >= currentRoundFDStart) && ((remainingDataOffsetToGetPerProc[i]+remainingDataAmountToGetPerProc[i]) <= currentRoundFDEnd)) { - if ((remainingDataOffsetToGetPerProc[i]) >= currentRoundFDStart) - dataSizeGottenThisRoundPerProc[i] = remainingDataAmountToGetPerProc[i]; - else - dataSizeGottenThisRoundPerProc[i] = (remainingDataOffsetToGetPerProc[i]-currentRoundFDStart) +1; - } - else - dataSizeGottenThisRoundPerProc[i] = 0; - -#ifdef p2pcontigtrace - printf("dataSizeGottenThisRoundPerProc[%d] set to %d - remainingDataOffsetToGetPerProc is %d remainingDataAmountToGetPerProc is %d currentRoundFDStart is %d currentRoundFDEnd is %d\n",i,dataSizeGottenThisRoundPerProc[i],remainingDataOffsetToGetPerProc[i],remainingDataAmountToGetPerProc[i],currentRoundFDStart,currentRoundFDEnd); -#endif - if (dataSizeGottenThisRoundPerProc[i] > 0) { - if (roundIter > 0) { - MPI_Isend(&dataSizeGottenThisRoundPerProc[i],1,MPI_INT, - sourceProcsForMyData[i],0,fd->comm, - &mpiSendDataSizeRequest[numSourceProcsSentData]); - numSourceProcsSentData++; - } - } - } - - int numDataSendToWaitFor = 0; - /* the source procs send the requested data to the aggs */ - for (i = 0; i < numTargetAggsThisRound; i++) { - - /* the source procs aren't pinged by the target aggs on the first round */ - if (roundIter > 0) { - - MPI_Waitany(numTargetAggsThisRound,mpiSizeToSendRequest, - &irecv,&mpiWaitAnyStatusFromTargetAggs); - -#ifdef p2pcontigtrace - printf("irecv is %d amountOfDataReqestedByTargetAgg is %d bufferAmountsToSendThisRound is %d sendBufferOffsetsThisRound is %d targetAggsForMyData is %d\n",irecv,amountOfDataReqestedByTargetAgg[irecv], bufferAmountsToSendThisRound[irecv], sendBufferOffsetsThisRound[irecv],targetAggsForMyData[targetAggIndexesForMyDataThisRound[irecv]]); -#endif - ADIOI_Assert(amountOfDataReqestedByTargetAgg[irecv] == bufferAmountsToSendThisRound[irecv]); - MPI_Isend(&((char*)buf)[sendBufferOffsetsThisRound[irecv]], - bufferAmountsToSendThisRound[irecv],MPI_BYTE, - targetAggsForMyData[targetAggIndexesForMyDataThisRound[irecv]], - 0,fd->comm,&mpiSendDataToTargetAggRequest[irecv]); - - } - else { -#ifdef p2pcontigtrace - printf("i is %d bufferAmountsToSendThisRound is %d sendBufferOffsetsThisRound is %d targetAggsForMyData is %d\n",i, bufferAmountsToSendThisRound[i], sendBufferOffsetsThisRound[i],targetAggsForMyData[targetAggIndexesForMyDataThisRound[i]]); -#endif - MPI_Isend(&((char*)buf)[sendBufferOffsetsThisRound[i]],bufferAmountsToSendThisRound[i],MPI_BYTE, - targetAggsForMyData[targetAggIndexesForMyDataThisRound[i]],0,fd->comm,&mpiSendDataToTargetAggRequest[i]); - } - numDataSendToWaitFor++; - } - -#ifdef ROMIO_GPFS - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase-startTimeBase); - startTimeBase = MPI_Wtime(); -#endif - - /* the aggs receive the data from the source procs */ - int numDataRecvToWaitFor = 0; - for (i=0;i<numSourceProcs;i++) { - - int currentWBOffset = 0; - for (j=0;j<i;j++) - currentWBOffset += dataSizeGottenThisRoundPerProc[j]; - - /* only receive from source procs that will send > 0 count data */ - if (dataSizeGottenThisRoundPerProc[i] > 0) { -#ifdef p2pcontigtrace - printf("receiving data from rank %d dataSizeGottenThisRoundPerProc is %d currentWBOffset is %d\n",sourceProcsForMyData[i],dataSizeGottenThisRoundPerProc[i],currentWBOffset); -#endif - MPI_Irecv(&((char*)write_buf)[currentWBOffset],dataSizeGottenThisRoundPerProc[i], - MPI_BYTE,sourceProcsForMyData[i],0, - fd->comm,&mpiRecvDataRequest[numDataRecvToWaitFor]); - mpiRequestMapPerProc[numDataRecvToWaitFor] = i; - numDataRecvToWaitFor++; - } - -#ifdef p2pcontigtrace - printf("MPI_Irecv from rank %d\n",targetAggsForMyData[i]); -#endif - } - - int totalDataReceivedThisRound = 0; - for (i = 0; i < numDataRecvToWaitFor; i++) { - MPI_Waitany(numDataRecvToWaitFor,mpiRecvDataRequest, - &irecv,&mpiWaitAnyStatusFromSourceProcs); - totalDataReceivedThisRound += - dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; - totalAmountDataReceived += - dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; - -#ifdef p2pcontigtrace - printf("numDataRecvToWaitFor is %d was sent %d bytes data for %d remaining bytes from rank %d irecv index %d\n",numDataRecvToWaitFor,dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]],remainingDataAmountToGetPerProc[mpiRequestMapPerProc[irecv]],sourceProcsForMyData[mpiRequestMapPerProc[irecv]],irecv); -#endif - remainingDataAmountToGetPerProc[mpiRequestMapPerProc[irecv]] -= - dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; - remainingDataOffsetToGetPerProc[mpiRequestMapPerProc[irecv]] += - dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; - - } - - /* clean up the MPI_Request object for the MPI_Isend which told the - * source procs how much data to send */ - for (i=0;i<numSourceProcsSentData;i++) { - MPI_Waitany(numSourceProcsSentData,mpiSendDataSizeRequest, - &isend,&mpiIsendStatusForSize); - } - - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_NET] += (endTimeBase-startTimeBase); -#endif - /* the aggs now write the data */ - if (numDataRecvToWaitFor > 0) { - -#ifdef p2pcontigtrace - printf("totalDataReceivedThisRound is %d\n",totalDataReceivedThisRound); -#endif - if (!useIOBuffer) { - - ADIO_WriteContig(fd, write_buf, (int)totalDataReceivedThisRound, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, - currentRoundFDStart, &status, error_code); - } else { /* use the thread writer */ - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - io_thread_args.fd = fd; - /* do a little pointer shuffling: background I/O works from one - * buffer while two-phase machinery fills up another */ - - if (currentWriteBuf == 0) { - io_thread_args.buf = write_buf0; - currentWriteBuf = 1; - write_buf = write_buf1; - } - else { - io_thread_args.buf = write_buf1; - currentWriteBuf = 0; - write_buf = write_buf0; - } - io_thread_args.io_kind = ADIOI_WRITE; - io_thread_args.size = totalDataReceivedThisRound; - io_thread_args.offset = currentRoundFDStart; - io_thread_args.status = &status; - io_thread_args.error_code = *error_code; - if ( (pthread_create(&io_thread, NULL, - ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) - io_thread = pthread_self(); - - } - - } /* numDataRecvToWaitFor > 0 */ - - if (iAmUsedAgg) - currentRoundFDStart += coll_bufsize; - for (i = 0; i < numDataSendToWaitFor; i++) { - MPI_Wait(&mpiSendDataToTargetAggRequest[i], - &mpiIsendStatusForData); - } - - } /* for-loop roundIter */ - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase-startTimeBase); -#endif - - if (useIOBuffer) { /* thread writer cleanup */ - - if ( !pthread_equal(io_thread, pthread_self()) ) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - } - - } - - - - if (iAmUsedAgg) { - ADIOI_Free(sourceProcsForMyData); - ADIOI_Free(remainingDataAmountToGetPerProc); - ADIOI_Free(remainingDataOffsetToGetPerProc); - } - - ADIOI_Free(targetAggsForMyData); - ADIOI_Free(targetAggsForMyDataFDStart); - ADIOI_Free(targetAggsForMyDataFDEnd); - ADIOI_Free(targetAggIndexesForMyDataThisRound); - ADIOI_Free(sendBufferOffsetsThisRound); - ADIOI_Free(bufferAmountsToSendThisRound); - ADIOI_Free(amountOfDataReqestedByTargetAgg); - ADIOI_Free(mpiSizeToSendRequest); - ADIOI_Free(mpiRecvDataRequest); - ADIOI_Free(mpiSendDataSizeRequest); - ADIOI_Free(mpiSendDataToTargetAggRequest); - ADIOI_Free(dataSizeGottenThisRoundPerProc); - ADIOI_Free(mpiRequestMapPerProc); - - /* TODO: still need a barrier here? */ - MPI_Barrier(fd->comm); - return; -} - -void ADIOI_P2PContigReadAggregation(ADIO_File fd, - const void *buf, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end) -{ - - *error_code = MPI_SUCCESS; /* initialize to success */ - -#ifdef ROMIO_GPFS - double startTimeBase,endTimeBase; -#endif - - MPI_Status status; - pthread_t io_thread; - void *thread_ret; - ADIOI_IO_ThreadFuncData io_thread_args; - -#ifdef ROMIO_GPFS - startTimeBase = MPI_Wtime(); -#endif - - int nprocs,myrank; - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - - ADIO_Offset myOffsetStart = st_offsets[myrank], myOffsetEnd = end_offsets[myrank]; - - int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ - int iAmUsedAgg = 0; - - int naggs = fd->hints->cb_nodes; - int coll_bufsize = fd->hints->cb_buffer_size; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio == 1) - /* share buffer between working threads */ - coll_bufsize = coll_bufsize/2; -#endif - - int j; - for (j=0;j<naggs;j++) { - if (fd->hints->ranklist[j] == myrank) { - myAggRank = j; - if (fd_end[j] > fd_start[j]) { - iAmUsedAgg = 1; - } - } - } - - /* for my offset range determine how much data and from whom I need to get - * it. For source ag targets, also determine the source file domain - * offsets locally to reduce communication overhead */ - int *sourceAggsForMyData = (int *)ADIOI_Malloc(naggs * sizeof(int)); - ADIO_Offset *sourceAggsForMyDataFDStart = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - ADIO_Offset *sourceAggsForMyDataFDEnd = (ADIO_Offset *)ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); - int numSourceAggs = 0; - int i; - for (i=0;i<naggs;i++) { - if ( ((myOffsetStart >= fd_start[i]) && (myOffsetStart <= fd_end[i])) || - ((myOffsetEnd >= fd_start[i]) && (myOffsetEnd <= fd_end[i]))) { - sourceAggsForMyData[numSourceAggs] = fd->hints->ranklist[i]; - sourceAggsForMyDataFDStart[numSourceAggs] = fd_start[i]; - sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[i]; - numSourceAggs++; - } - } - - /* these 3 arrays track info on the procs that are fed from an aggregtor - - * to sacrifice some performance at setup to save on memory instead of - * using max size of nprocs for the arrays could determine exact size first - * and then allocate that size */ - int *targetProcsForMyData=NULL; - int *remainingDataAmountToSendPerProc=NULL; - ADIO_Offset *remainingDataOffsetToSendPerProc=NULL; - - int numTargetProcs = 0; - - if (iAmUsedAgg) { - /* for the used aggregators figure out how much data I need from what procs */ - - /* count numTargetProcs so we know how large to make the arrays */ - for (i=0;i<nprocs;i++) - if ( ((st_offsets[i] >= fd_start[myAggRank]) && - (st_offsets[i] <= fd_end[myAggRank])) || - ((end_offsets[i] >= fd_start[myAggRank]) && - (end_offsets[i] <= fd_end[myAggRank])) ) - numTargetProcs++; - - targetProcsForMyData = - (int *)ADIOI_Malloc(numTargetProcs * sizeof(int)); - remainingDataAmountToSendPerProc = - (int *)ADIOI_Malloc(numTargetProcs * sizeof(int)); - remainingDataOffsetToSendPerProc = - (ADIO_Offset *)ADIOI_Malloc(numTargetProcs * sizeof(ADIO_Offset)); - - /* everybody has the st_offsets and end_offsets for all ranks so if I am a - * used aggregator go thru them and figure out which ranks have data that - * falls into my file domain assigned to me */ - numTargetProcs = 0; - for (i=0;i<nprocs;i++) { - if ( ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) { - targetProcsForMyData[numTargetProcs] = i; - if ( ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) && ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) { - remainingDataAmountToSendPerProc[numTargetProcs] = (end_offsets[i] - st_offsets[i])+1; - remainingDataOffsetToSendPerProc[numTargetProcs] = st_offsets[i]; - } - else if ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) {/* starts in this fd and goes past it */ - remainingDataAmountToSendPerProc[numTargetProcs] = (fd_end[myAggRank] - st_offsets[i]) +1; - remainingDataOffsetToSendPerProc[numTargetProcs] = st_offsets[i]; - } - else { /* starts in fd before this and ends in it */ - remainingDataAmountToSendPerProc[numTargetProcs] = (end_offsets[i] - fd_start[myAggRank]) +1; - remainingDataOffsetToSendPerProc[numTargetProcs] = fd_start[myAggRank]; - } - numTargetProcs++; - } - } - } - - - MPI_Request *mpiRecvDataFromSourceAggsRequest = (MPI_Request *) ADIOI_Malloc(numSourceAggs * sizeof(MPI_Request)); - MPI_Request *mpiSendDataToTargetProcRequest = (MPI_Request *) ADIOI_Malloc(numTargetProcs * sizeof(MPI_Request)); - MPI_Status mpiWaitAnyStatusFromSourceProcs,mpiIsendStatusForData; - - /* use the two-phase buffer allocated in the file_open - no app should ever - * be both reading and writing at the same time */ - char *read_buf0 = fd->io_buf; - char *read_buf1 = fd->io_buf + coll_bufsize; - /* if threaded i/o selected, we'll do a kind of double buffering */ - char *read_buf = read_buf0; - - /* compute number of rounds */ - ADIO_Offset numberOfRounds = (ADIO_Offset)((((ADIO_Offset)(end_offsets[nprocs-1]-st_offsets[0]))/((ADIO_Offset)((ADIO_Offset)coll_bufsize*(ADIO_Offset)naggs)))) + 1; - - ADIO_Offset currentRoundFDStart = 0, nextRoundFDStart = 0; - ADIO_Offset currentRoundFDEnd = 0, nextRoundFDEnd = 0; - - if (iAmUsedAgg) { - currentRoundFDStart = fd_start[myAggRank]; - nextRoundFDStart = fd_start[myAggRank]; - } - - int *dataSizeSentThisRoundPerProc = (int *)ADIOI_Malloc(numTargetProcs * sizeof(int)); - int *sourceAggIndexesForMyDataThisRound = (int *)ADIOI_Malloc(numSourceAggs * sizeof(int)); - int *recvBufferOffsetsThisRound = (int *)ADIOI_Malloc(numSourceAggs * sizeof(int)); - int *bufferAmountsToGetThisRound = (int *)ADIOI_Malloc(numSourceAggs * sizeof(int)); - *error_code = MPI_SUCCESS; - - int currentReadBuf = 0; - int useIOBuffer = 0; -#ifdef ROMIO_GPFS - if (gpfsmpio_pthreadio && (numberOfRounds>1)) { - useIOBuffer = 1; - io_thread = pthread_self(); - } -#endif - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); - gpfsmpio_prof_cw[GPFSMPIO_CIO_T_MYREQ] += (endTimeBase-startTimeBase); -#endif - - - /* each iteration of this loop reads a coll_bufsize portion of the file domain */ - int roundIter; - for (roundIter=0;roundIter<numberOfRounds;roundIter++) { - - int irecv,isend; - /* determine what offsets define the portion of the file domain the agg is reading this round */ - if (iAmUsedAgg) { - - currentRoundFDStart = nextRoundFDStart; - - if (!useIOBuffer || (roundIter == 0)) { - int amountDataToReadThisRound; - if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { - currentRoundFDEnd = fd_end[myAggRank]; - amountDataToReadThisRound = ((currentRoundFDEnd-currentRoundFDStart)+1); - } - else { - currentRoundFDEnd = currentRoundFDStart + coll_bufsize - 1; - amountDataToReadThisRound = coll_bufsize; - } - - /* read currentRoundFDEnd bytes */ - ADIO_ReadContig(fd, read_buf,amountDataToReadThisRound, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, currentRoundFDStart, - &status, error_code); - currentReadBuf = 1; - -#ifdef ROMIO_GPFS - endTimeBase = MPI_Wtime(); -#endif - } - - if (useIOBuffer) { /* use the thread reader for the next round */ - /* switch back and forth between the read buffers so that the data aggregation code is diseminating 1 buffer while the thread is reading into the other */ - - if (roundIter > 0) - currentRoundFDEnd = nextRoundFDEnd; - - if (roundIter < (numberOfRounds-1)) { - nextRoundFDStart += coll_bufsize; - int amountDataToReadNextRound; - if ((fd_end[myAggRank] - nextRoundFDStart) < coll_bufsize) { - nextRoundFDEnd = fd_end[myAggRank]; - amountDataToReadNextRound = ((nextRoundFDEnd-nextRoundFDStart)+1); - } - else { - nextRoundFDEnd = nextRoundFDStart + coll_bufsize - 1; - amountDataToReadNextRound = coll_bufsize; - } - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - io_thread_args.fd = fd; - /* do a little pointer shuffling: background I/O works from one - * buffer while two-phase machinery fills up another */ - - if (currentReadBuf == 0) { - io_thread_args.buf = read_buf0; - currentReadBuf = 1; - read_buf = read_buf1; - } - else { - io_thread_args.buf = read_buf1; - currentReadBuf = 0; - read_buf = read_buf0; - } - io_thread_args.io_kind = ADIOI_READ; - io_thread_args.size = amountDataToReadNextRound; - io_thread_args.offset = nextRoundFDStart; - io_thread_args.status = &status; - io_thread_args.error_code = *error_code; - if ( (pthread_create(&io_thread, NULL, - ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) - io_thread = pthread_self(); - - } - else { /* last round */ - - if(!pthread_equal(io_thread, pthread_self())) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - if (*error_code != MPI_SUCCESS) return; - io_thread = pthread_self(); - - } - if (currentReadBuf == 0) { - read_buf = read_buf1; - } - else { - read_buf = read_buf0; - } - - } - } /* useIOBuffer */ - } /* IAmUsedAgg */ - - /* determine what source aggs I need to get data from this round and - * recv only from them */ - int numSourceAggsThisRound = 0; - for (i=0;i<numSourceAggs;i++) { - if ( ((myOffsetStart >= sourceAggsForMyDataFDStart[i]) && (myOffsetStart <= sourceAggsForMyDataFDEnd[i])) - || ((myOffsetEnd >= sourceAggsForMyDataFDStart[i]) && (myOffsetEnd <= sourceAggsForMyDataFDEnd[i])) ) { - /* we know that we need to get data from this source agg at - * some point, now need to figure out how much this round */ - - /* here are the offsets currently being sent by the aggregator - * during this round */ - ADIO_Offset currentRoundFDStartForMySourceAgg = - (ADIO_Offset)((ADIO_Offset)sourceAggsForMyDataFDStart[i] + - (ADIO_Offset)((ADIO_Offset)roundIter*(ADIO_Offset)coll_bufsize)); - ADIO_Offset currentRoundFDEndForMySourceAgg = - (ADIO_Offset)((ADIO_Offset)sourceAggsForMyDataFDStart[i] + - (ADIO_Offset)((ADIO_Offset)(roundIter+1)*(ADIO_Offset)coll_bufsize) - (ADIO_Offset)1); - if (currentRoundFDEndForMySourceAgg > sourceAggsForMyDataFDEnd[i]) - currentRoundFDEndForMySourceAgg = sourceAggsForMyDataFDEnd[i]; - -#ifdef p2pcontigtrace - printf("roundIter %d source iter %d sourceAggsForMyData is %d myOffsetStart is %ld myOffsetEnd is %ld sourceAggsForMyDataFDStart is %ld sourceAggsForMyDataFDEnd is %ld currentRoundFDStartForMySourceAgg is %ld currentRoundFDEndForMySourceAgg is %ld\n",roundIter,i,sourceAggsForMyData[i],myOffsetStart,myOffsetEnd,sourceAggsForMyDataFDStart[i],sourceAggsForMyDataFDEnd[i],currentRoundFDStartForMySourceAgg,currentRoundFDEndForMySourceAgg); -#endif - - /* get the portion of my data that is within currentRoundFDStartForMySourceAgg to currentRoundFDEndForMySourceAgg */ - /* find the offset into the recv buffer and the amount of data to get */ - int recvBufferOffset = 0; - int bufferAmountToGet = 0; - - if ((myOffsetStart >= currentRoundFDStartForMySourceAgg) && (myOffsetStart <= currentRoundFDEndForMySourceAgg)) { - if (myOffsetEnd > currentRoundFDEndForMySourceAgg) - bufferAmountToGet = (currentRoundFDEndForMySourceAgg - myOffsetStart) +1; - else - bufferAmountToGet = (myOffsetEnd - myOffsetStart) +1; - } - else if ((myOffsetEnd >= currentRoundFDStartForMySourceAgg) && (myOffsetEnd <= currentRoundFDEndForMySourceAgg)) { - recvBufferOffset = (int) (currentRoundFDStartForMySourceAgg - myOffsetStart); - if (myOffsetEnd > currentRoundFDEndForMySourceAgg) - bufferAmountToGet = (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) +1; - else - bufferAmountToGet = (myOffsetEnd - currentRoundFDStartForMySourceAgg) +1; - } - else if ((myOffsetStart <= currentRoundFDStartForMySourceAgg) && (myOffsetEnd >= currentRoundFDEndForMySourceAgg)) { - recvBufferOffset = (int) (currentRoundFDStartForMySourceAgg - myOffsetStart); - bufferAmountToGet = (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) +1; - } - - - if (bufferAmountToGet > 0) { /* we have data to get this round */ - sourceAggIndexesForMyDataThisRound[numSourceAggsThisRound] = i; - recvBufferOffsetsThisRound[numSourceAggsThisRound] = recvBufferOffset; - bufferAmountsToGetThisRound[numSourceAggsThisRound] = bufferAmountToGet; -#ifdef p2pcontigtrace - printf("bufferAmountToGet is %d recvBufferOffset is %d\n",bufferAmountToGet,recvBufferOffset); -#endif - numSourceAggsThisRound++; - } - } - } - - /* the aggs determine the amount of data they will be sending to their - * source procs */ - for (i=0;i<numTargetProcs;i++) { - if ((remainingDataOffsetToSendPerProc[i] >= currentRoundFDStart) && - (remainingDataOffsetToSendPerProc[i] <= currentRoundFDEnd)) { - if ((remainingDataOffsetToSendPerProc[i] + - remainingDataAmountToSendPerProc[i]) <= currentRoundFDEnd) - dataSizeSentThisRoundPerProc[i] = remainingDataAmountToSendPerProc[i]; - else - dataSizeSentThisRoundPerProc[i] = - (currentRoundFDEnd - remainingDataOffsetToSendPerProc[i]) +1; - } - else if (((remainingDataOffsetToSendPerProc[i]+ - remainingDataAmountToSendPerProc[i]) >= - currentRoundFDStart) && - ((remainingDataOffsetToSendPerProc[i]+ - remainingDataAmountToSendPerProc[i]) <= currentRoundFDEnd)) { - if ((remainingDataOffsetToSendPerProc[i]) >= currentRoundFDStart) - dataSizeSentThisRoundPerProc[i] = remainingDataAmountToSendPerProc[i]; - else - dataSizeSentThisRoundPerProc[i] = - (remainingDataOffsetToSendPerProc[i]-currentRoundFDStart) +1; - } - else - dataSizeSentThisRoundPerProc[i] = 0; - - } - - /* the target procs get the data from the source aggs */ - for (i = 0; i < numSourceAggsThisRound; i++) { - MPI_Irecv(&((char*)buf)[recvBufferOffsetsThisRound[i]], - bufferAmountsToGetThisRound[i],MPI_BYTE, - sourceAggsForMyData[sourceAggIndexesForMyDataThisRound[i]],0,fd->comm, - &mpiRecvDataFromSourceAggsRequest[i]); - } - - /* the source aggs send the data to the target procs */ - int numTargetProcsSentThisRound = 0; - for (i=0;i<numTargetProcs;i++) { - - int currentWBOffset = 0; - for (j=0;j<i;j++) - currentWBOffset += dataSizeSentThisRoundPerProc[j]; - - /* only send to target procs that will recv > 0 count data */ - if (dataSizeSentThisRoundPerProc[i] > 0) { - MPI_Isend(&((char*)read_buf)[currentWBOffset], - dataSizeSentThisRoundPerProc[i], - MPI_BYTE,targetProcsForMyData[i],0, - fd->comm,&mpiSendDataToTargetProcRequest[numTargetProcsSentThisRound]); - numTargetProcsSentThisRound++; - remainingDataAmountToSendPerProc[i] -= dataSizeSentThisRoundPerProc[i]; - remainingDataOffsetToSendPerProc[i] += dataSizeSentThisRoundPerProc[i]; - } - } - - /* wait for the target procs to get their data */ - for (i = 0; i < numSourceAggsThisRound; i++) { - MPI_Waitany(numSourceAggsThisRound,mpiRecvDataFromSourceAggsRequest, - &irecv,&mpiWaitAnyStatusFromSourceProcs); - } - - nextRoundFDStart = currentRoundFDStart + coll_bufsize; - - /* clean up the MPI_Isend MPI_Requests */ - for (i=0;i<numTargetProcsSentThisRound;i++) { - MPI_Waitany(numTargetProcsSentThisRound,mpiSendDataToTargetProcRequest, - &isend,&mpiIsendStatusForData); - } - - MPI_Barrier(fd->comm); /* need to sync up the source aggs which did the isend with the target procs which did the irecvs to give the target procs time to get the data before overwriting with next round readcontig */ - - } /* for-loop roundIter */ - - if (useIOBuffer) { /* thread reader cleanup */ - - if ( !pthread_equal(io_thread, pthread_self()) ) { - pthread_join(io_thread, &thread_ret); - *error_code = *(int *)thread_ret; - } - } - - if (iAmUsedAgg) { - ADIOI_Free(targetProcsForMyData); - ADIOI_Free(remainingDataAmountToSendPerProc); - ADIOI_Free(remainingDataOffsetToSendPerProc); - } - - ADIOI_Free(sourceAggsForMyData); - ADIOI_Free(sourceAggsForMyDataFDStart); - ADIOI_Free(sourceAggsForMyDataFDEnd); - - ADIOI_Free(mpiRecvDataFromSourceAggsRequest); - ADIOI_Free(mpiSendDataToTargetProcRequest); - ADIOI_Free(dataSizeSentThisRoundPerProc); - ADIOI_Free(sourceAggIndexesForMyDataThisRound); - ADIOI_Free(recvBufferOffsetsThisRound); - ADIOI_Free(bufferAmountsToGetThisRound); - - /* TODO: is Barrier here needed? */ - MPI_Barrier(fd->comm); - - return; - -} diff --git a/3rd-party/romio321/adio/common/req_malloc.c b/3rd-party/romio321/adio/common/req_malloc.c deleted file mode 100644 index 61018e1a684a5f2632d2ab13cd0d8d0c846e0137..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/req_malloc.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "adio_extern.h" - -struct ADIOI_RequestD *ADIOI_Malloc_request(void) -{ -/* returns a pointer to a new request object. - To reduce the number of system calls, mallocs NUM requests at a time - and maintains list of available requests. Supplies an object from this - list if available, else mallocs a new set of NUM and provides one - from that set. Is NUM=100 a good number? */ - -#define NUM 100 - - ADIOI_Req_node *curr, *ptr; - int i; - - if (!ADIOI_Req_avail_head) { - ADIOI_Req_avail_head = (ADIOI_Req_node *) - ADIOI_Malloc(NUM*sizeof(ADIOI_Req_node)); - if (ADIOI_Req_avail_head == NULL) - { - /* FIXME: Insert error here */ - return NULL; - } - curr = ADIOI_Req_avail_head; - for (i=1; i<NUM; i++) { - curr->next = ADIOI_Req_avail_head+i; - curr = curr->next; - } - curr->next = NULL; - ADIOI_Req_avail_tail = curr; - - /* keep track of malloced area that needs to be freed later */ - if (!ADIOI_Malloc_req_tail) { - ADIOI_Malloc_req_tail = (ADIOI_Malloc_req *) - ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); - ADIOI_Malloc_req_head = ADIOI_Malloc_req_tail; - ADIOI_Malloc_req_head->ptr = ADIOI_Req_avail_head; - ADIOI_Malloc_req_head->next = NULL; - } - else { - ADIOI_Malloc_req_tail->next = (ADIOI_Malloc_req *) - ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); - ADIOI_Malloc_req_tail = ADIOI_Malloc_req_tail->next; - ADIOI_Malloc_req_tail->ptr = ADIOI_Req_avail_head; - ADIOI_Malloc_req_tail->next = NULL; - } - } - - ptr = ADIOI_Req_avail_head; - ADIOI_Req_avail_head = ADIOI_Req_avail_head->next; - if (!ADIOI_Req_avail_head) ADIOI_Req_avail_tail = NULL; - - (ptr->reqd).cookie = ADIOI_REQ_COOKIE; - return &(ptr->reqd); -} - - -void ADIOI_Free_request(ADIOI_Req_node *node) -{ -/* This function could be called as ADIOI_Free_request(ADIO_Request request), - because request would be a pointer to the first element of ADIOI_Req_node.*/ - -/* moves this node to available pool. does not actually free it. */ - - (node->reqd).cookie = 0; - - if (!ADIOI_Req_avail_tail) - ADIOI_Req_avail_head = ADIOI_Req_avail_tail = node; - else { - ADIOI_Req_avail_tail->next = node; - ADIOI_Req_avail_tail = node; - } - node->next = NULL; -} - diff --git a/3rd-party/romio321/adio/common/shfp_fname.c b/3rd-party/romio321/adio/common/shfp_fname.c deleted file mode 100644 index dfa5bafc2cf61fd2c1c2bd408e1ad5f1993c7b8c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/shfp_fname.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_TIME_H -#include <time.h> -#endif -/* The following function selects the name of the file to be used to - store the shared file pointer. The shared-file-pointer file is a - hidden file in the same directory as the real file being accessed. - If the real file is /tmp/thakur/testfile, the shared-file-pointer - file will be /tmp/thakur/.testfile.shfp.yyy.xxxx, where yyy - is rank 0's process id and xxxx is a random number. If the - underlying file system supports shared file pointers - (PVFS does not, for example), the file name is always - constructed. This file is created only if the shared - file pointer functions are used and is deleted when the real - file is closed. */ - -void ADIOI_Shfp_fname(ADIO_File fd, int rank, int *error_code) -{ - int i; - int len; - char *slash, *ptr, tmp[128]; - int pid = 0; - - fd->shared_fp_fname = (char *) ADIOI_Malloc(PATH_MAX); - - if (!rank) { - srand(time(NULL)); - i = rand(); - pid = (int)getpid(); - - if (ADIOI_Strncpy(fd->shared_fp_fname, fd->filename, PATH_MAX)) { - *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", - fd->filename, ENAMETOOLONG); - return; - } - -#ifdef ROMIO_NTFS - slash = strrchr(fd->filename, '\\'); -#else - slash = strrchr(fd->filename, '/'); -#endif - if (!slash) { - if (ADIOI_Strncpy(fd->shared_fp_fname, ".", 2)) { - *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", - fd->filename, ENAMETOOLONG); - return; - } - if (ADIOI_Strncpy(fd->shared_fp_fname + 1, fd->filename, PATH_MAX-1)) { - *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", - fd->filename, ENAMETOOLONG); - return; - } - } - else { - ptr = slash; -#ifdef ROMIO_NTFS - slash = strrchr(fd->shared_fp_fname, '\\'); -#else - slash = strrchr(fd->shared_fp_fname, '/'); -#endif - if (ADIOI_Strncpy(slash + 1, ".", 2)) { - *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", - fd->filename, ENAMETOOLONG); - return; - } - /* ok to cast: file names bounded by PATH_MAX and NAME_MAX */ - len = (int) (PATH_MAX - (slash+2 - fd->shared_fp_fname)); - if (ADIOI_Strncpy(slash + 2, ptr + 1, len)) { - *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", - ptr + 1, ENAMETOOLONG); - return; - } - } - - ADIOI_Snprintf(tmp, 128, ".shfp.%d.%d", pid, i); - /* ADIOI_Strnapp will return non-zero if truncated. That's ok */ - ADIOI_Strnapp(fd->shared_fp_fname, tmp, PATH_MAX); - - len = (int)strlen(fd->shared_fp_fname); - MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm); - MPI_Bcast(fd->shared_fp_fname, len+1, MPI_CHAR, 0, fd->comm); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm); - MPI_Bcast(fd->shared_fp_fname, len+1, MPI_CHAR, 0, fd->comm); - } -} diff --git a/3rd-party/romio321/adio/common/status_setb.c b/3rd-party/romio321/adio/common/status_setb.c deleted file mode 100644 index ec1e4ff7f69256d9530342016beb71aa5e14dc80..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/status_setb.c +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "mpi.h" - -#if defined(MPICH2) || (defined(MPICH) && (MPICH_NAME >= 3)) -/* Not quite correct, but much closer for MPI2 */ -/* TODO: still needs to handle partial datatypes and situations where the mpi - * implementation fills status with something other than bytes (globus2 might - * do this) */ -int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, - MPI_Count nbytes) -{ - ADIOI_UNREFERENCED_ARG(datatype); - /* it's ok that ROMIO stores number-of-bytes in status, not - * count-of-copies, as long as MPI_GET_COUNT knows what to do */ - if (status != MPI_STATUS_IGNORE) - MPI_Status_set_elements_x(status, MPI_BYTE, nbytes); - return MPI_SUCCESS; -} -#elif defined(MPILAM) || defined(MPISGI) -int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, - MPI_Count nbytes) -{ - /* Bogusness to silence compiler warnings */ - if (datatype == MPI_DATATYPE_NULL); - - if (status != MPI_STATUS_IGNORE) - status->st_length = nbytes; - return MPI_SUCCESS; -} -#endif diff --git a/3rd-party/romio321/adio/common/strfns.c b/3rd-party/romio321/adio/common/strfns.c deleted file mode 100644 index 65e5ac24e74d45ba27deef8c0208c7312e28532f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/strfns.c +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* style: allow:sprintf:3 sig:0 */ - -/* - * Below are the "safe" versions of the various string and printf - * operations. They are directly taken from MPICH, with MPIU replaced by ADIOI. - */ - -/* - * ADIOI_Strncpy - Copy at most n character. Stop once a null is reached. - * - * This is different from strncpy, which null pads so that exactly - * n characters are copied. The strncpy behavior is correct for many - * applications because it guarantees that the string has no uninitialized - * data. - * - * If n characters are copied without reaching a null, return an error. - * Otherwise, return 0. - * - */ -/*@ ADIOI_Strncpy - Copy a string with a maximum length - -Input Parameters: -+ instr - String to copy -- maxlen - Maximum total length of 'outstr' - -Output Parameters: -. outstr - String to copy into - - Notes: - This routine is the routine that you wish 'strncpy' was. In copying - 'instr' to 'outstr', it stops when either the end of 'outstr' (the - null character) is seen or the maximum length 'maxlen' is reached. - Unlike 'strncpy', it does not add enough nulls to 'outstr' after - copying 'instr' in order to move precisely 'maxlen' characters. - Thus, this routine may be used anywhere 'strcpy' is used, without any - performance cost related to large values of 'maxlen'. - - Module: - Utility - @*/ -int ADIOI_Strncpy( char *dest, const char *src, size_t n ) -{ - char * restrict d_ptr = dest; - const char * restrict s_ptr = src; - register int i; - - i = (int)n; - while (*s_ptr && i-- > 0) { - *d_ptr++ = *s_ptr++; - } - - if (i > 0) { - *d_ptr = 0; - return 0; - } - else - /* We may want to force an error message here, at least in the - debugging version */ - return 1; -} - -/* Append src to dest, but only allow dest to contain n characters (including - any null, which is always added to the end of the line */ -/*@ ADIOI_Strnapp - Append to a string with a maximum length - -Input Parameters: -+ instr - String to copy -- maxlen - Maximum total length of 'outstr' - -Output Parameters: -. outstr - String to copy into - - Notes: - This routine is similar to 'strncat' except that the 'maxlen' argument - is the maximum total length of 'outstr', rather than the maximum - number of characters to move from 'instr'. Thus, this routine is - easier to use when the declared size of 'instr' is known. - - Module: - Utility - @*/ -int ADIOI_Strnapp( char *dest, const char *src, size_t n ) -{ - char * restrict d_ptr = dest; - const char * restrict s_ptr = src; - register int i; - - /* Get to the end of dest */ - i = (int)n; - while (i-- > 0 && *d_ptr) d_ptr++; - if (i <= 0) return 1; - - /* Append. d_ptr points at first null and i is remaining space. */ - while (*s_ptr && i-- > 0) { - *d_ptr++ = *s_ptr++; - } - - /* We allow i >= (not just >) here because the first while decrements - i by one more than there are characters, leaving room for the null */ - if (i >= 0) { - *d_ptr = 0; - return 0; - } - else { - /* Force the null at the end */ - *--d_ptr = 0; - - /* We may want to force an error message here, at least in the - debugging version */ - return 1; - } -} - -/*@ - ADIOI_Strdup - Duplicate a string - - Synopsis: -.vb - char *ADIOI_Strdup( const char *str ) -.ve - -Input Parameters: -. str - null-terminated string to duplicate - - Return value: - A pointer to a copy of the string, including the terminating null. A - null pointer is returned on error, such as out-of-memory. - - Notes: - Like 'ADIOI_Malloc' and 'ADIOI_Free', this will often be implemented as a - macro but may use 'ADIOI_trstrdup' to provide a tracing version. - - Module: - Utility - @*/ -char *ADIOI_Strdup( const char *str ) -{ - char *p = ADIOI_Malloc( strlen(str) + 1 ); - char *in_p = (char *)str; - char *save_p; - - save_p = p; - if (p) { - while (*in_p) { - *p++ = *in_p++; - } - *p = '\0'; - } - return save_p; -} - - -/* - * We need an snprintf replacement for systems without one - */ -#ifndef HAVE_SNPRINTF -#include <ctype.h> -/* FIXME: Really need a check for varargs.h vs stdarg.h */ -#include <stdarg.h> -/* - * This is an approximate form which is suitable for most uses within - * the MPICH code - */ -int ADIOI_Snprintf( char *str, size_t size, const char *format, ... ) -{ - int n; - const char *p; - char *out_str = str; - va_list list; - - va_start(list, format); - - p = format; - while (*p && size > 0) { - char *nf; - - nf = strchr(p, '%'); - if (!nf) { - /* No more format characters */ - while (size-- > 0 && *p) { - *out_str++ = *p++; - } - } - else { - int nc; - int width = -1; - - /* Copy until nf */ - while (p < nf && size-- > 0) { - *out_str++ = *p++; - } - /* p now points at nf */ - /* Handle the format character */ - nc = nf[1]; - if (isdigit(nc)) { - /* Get the field width */ - /* FIXME : Assumes ASCII */ - width = nc - '0'; - p = nf + 2; - while (*p && isdigit(*p)) { - width = 10 * width + (*p++ - '0'); - } - /* When there is no longer a digit, get the format - character */ - nc = *p++; - } - else { - /* Skip over the format string */ - p += 2; - } - - switch (nc) { - case '%': - *out_str++ = '%'; - size--; - break; - - case 'd': - { - int val; - char tmp[20]; - char *t = tmp; - /* Get the argument, of integer type */ - val = va_arg( list, int ); - sprintf( tmp, "%d", val ); - if (width > 0) { - int tmplen = strlen(tmp); - /* If a width was specified, pad with spaces on the - left (on the right if %-3d given; not implemented yet */ - while (size-- > 0 && width-- > tmplen) - *out_str++ = ' '; - } - while (size-- > 0 && *t) { - *out_str++ = *t++; - } - } - break; - - case 'x': - { - int val; - char tmp[20]; - char *t = tmp; - /* Get the argument, of integer type */ - val = va_arg( list, int ); - sprintf( tmp, "%x", val ); - if (width > 0) { - int tmplen = strlen(tmp); - /* If a width was specified, pad with spaces on the - left (on the right if %-3d given; not implemented yet */ - while (size-- > 0 && width-- > tmplen) - *out_str++ = ' '; - } - while (size-- > 0 && *t) { - *out_str++ = *t++; - } - } - break; - - case 'p': - { - void *val; - char tmp[20]; - char *t = tmp; - val = va_arg( list, void * ); - sprintf( tmp, "%p", val ); - if (width > 0) { - int tmplen = strlen(tmp); - /* If a width was specified, pad with spaces on the - left (on the right if %-3d given; not implemented yet */ - while (size-- > 0 && width-- > tmplen) - *out_str++ = ' '; - } - while (size-- > 0 && *t) { - *out_str++ = *t++; - } - } - break; - - case 's': - { - char *s_arg; - /* Get the argument, of pointer to char type */ - s_arg = va_arg( list, char * ); - while (size-- > 0 && s_arg && *s_arg) { - *out_str++ = *s_arg++; - } - } - break; - - default: - /* Error, unknown case */ - return -1; - break; - } - } - } - - va_end(list); - - if (size-- > 0) *out_str++ = '\0'; - - n = (int)(out_str - str); - return n; -} -#endif diff --git a/3rd-party/romio321/adio/common/system_hints.c b/3rd-party/romio321/adio/common/system_hints.c deleted file mode 100644 index 1b049b1ff5b6bf4f5a274f03d90787d8e120b624..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/common/system_hints.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 2007 UChicago/Argonne LLC. - * See COPYRIGHT notice in top-level directory. - */ - -#include <adio.h> - -#include <stdio.h> - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_IO_H -#include <io.h> -#endif - -/*#define SYSHINT_DEBUG 1 */ - -#define ROMIO_HINT_DEFAULT_CFG "/etc/romio-hints" -#define ROMIO_HINT_ENV_VAR "ROMIO_HINTS" - -/* debug function: a routine I want in the library to make my life easier when - * using a source debugger. Now optionally used in ADIO_Open. */ -void ADIOI_Info_print_keyvals(MPI_Info info) -{ - int i, nkeys, flag; - char key[MPI_MAX_INFO_KEY+1]; - char value[MPI_MAX_INFO_VAL+1]; - - if (info == MPI_INFO_NULL) - return; - - MPI_Info_get_nkeys(info, &nkeys); - - for (i=0; i<nkeys; i++) { - MPI_Info_get_nthkey(info, i, key); - ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - printf("key = %-25s value = %-10s\n", key, value); - } - return; -} - -/* if user set the environment variable, use its value to find the - * file-of-hints. Otherwise, we'll look for the default config file. i.e. let - * the user override systemwide hint processing */ - -static int find_file(void) -{ - int fd=-1; - char * hintfile; - - hintfile = getenv(ROMIO_HINT_ENV_VAR); - if(hintfile) - fd = open(hintfile, O_RDONLY); - if (fd < 0 ) - fd = open(ROMIO_HINT_DEFAULT_CFG, O_RDONLY); - - return fd; -} - -/* parse the file-of-hints. Format is zero or more lines of "<key> <value>\n". - * A # in collumn zero is a comment and the line will be ignored. Do our best - * to ignore badly formed lines too. - * - * The caller provides an 'info' object. Each key-value pair found by the - * parser will get added to the info object. any keys already set will be left - * alone on the assumption that the caller knows best. - * - * because MPI-IO hints are optional, we can get away with limited error - * reporting. - * - * for better scalability, the config file will be read on one processor and - * broadcast to all others */ -static int file_to_info_all(int fd, MPI_Info info, int rank, MPI_Comm comm) -{ - char *buffer, *token, *key, *val, *garbage; - char *pos1=NULL, *pos2=NULL; - int flag; - ssize_t ret; - int valuelen; - - /* assumption: config files will be small */ -#define HINTFILE_MAX_SIZE 1024*4 - buffer = (char *)ADIOI_Calloc(HINTFILE_MAX_SIZE, sizeof (char)); - - if (rank == 0) { - ret = read(fd, buffer, HINTFILE_MAX_SIZE); - /* any error: bad/nonexistent fd, no perms, anything: set up a null - * buffer and the subsequent string parsing will quit immediately */ - if (ret == -1) - buffer[0] = '\0'; - } - MPI_Bcast(buffer, HINTFILE_MAX_SIZE, MPI_BYTE, 0, comm); - - token = strtok_r(buffer, "\n", &pos1); - if (token == NULL) - goto fn_exit; - do { - if ( (key = strtok_r(token, " \t", &pos2)) == NULL) - /* malformed line: found no items */ - continue; - if (token[0] == '#') - /* ignore '#'-delimited comments */ - continue; - if ( (val = strtok_r(NULL, " \t", &pos2)) == NULL) - /* malformed line: found key without value */ - continue; - if ( (garbage = strtok_r(NULL, " \t", &pos2)) != NULL) - /* malformed line: more than two items */ - continue; - -#ifdef SYSHINT_DEBUG - printf("found: key=%s val=%s\n", key, val); -#endif - /* don't actually care what the value is. only want to know if key - * exists: we leave it alone if so*/ - ADIOI_Info_get_valuelen(info, key, &valuelen, &flag); - if (flag == 1) continue; - ADIOI_Info_set(info, key, val); - } while ((token = strtok_r(NULL, "\n", &pos1)) != NULL); - -fn_exit: - ADIOI_Free(buffer); - return 0; -} - -void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info) -{ - int hintfd=-1, rank; - - MPI_Comm_rank(fd->comm, &rank); - if (rank == 0) { - hintfd = find_file(); - } - /* hintfd only significant on rank 0. -1 (on rank 0) means no hintfile found */ - file_to_info_all(hintfd, info, rank, fd->comm); - - if (hintfd != -1) - close(hintfd); -} - -/* given 'info', incorporate any hints in 'sysinfo' that are not already set - * into 'new_info'. Caller must free 'new_info' later. */ -void ADIOI_incorporate_system_hints(MPI_Info info, - MPI_Info sysinfo, - MPI_Info *new_info) -{ - int i, nkeys_sysinfo, nkeys_info=0, flag=0; /* must initialize flag to 0 */ - int valuelen; - - char val[MPI_MAX_INFO_VAL+1], key[MPI_MAX_INFO_KEY+1]; - - if (sysinfo == MPI_INFO_NULL) - nkeys_sysinfo = 0; - else - MPI_Info_get_nkeys(sysinfo, &nkeys_sysinfo); - - /* short-circuit: return immediately if no hints to process */ - if (info == MPI_INFO_NULL && nkeys_sysinfo == 0) { - *new_info = MPI_INFO_NULL; - return; - } - - if (info == MPI_INFO_NULL) - MPI_Info_create(new_info); - else { - /* tiny optimization: if 'info' has no keys, we can skip the check if a - * hint is set: no keys means nothing has been set, and there's nothing - * we might step on */ - MPI_Info_get_nkeys(info, &nkeys_info); - MPI_Info_dup(info, new_info); - } - - for (i=0; i<nkeys_sysinfo; i++) { - MPI_Info_get_nthkey(sysinfo, i, key); - /* don't care about the value, just want to know if hint set already*/ - if (info != MPI_INFO_NULL && nkeys_info) - ADIOI_Info_get_valuelen(info, key, &valuelen, &flag); - if (flag == 1) continue; /* skip any hints already set by user */ - ADIOI_Info_get(sysinfo, key, MPI_MAX_INFO_VAL, val, &flag); - ADIOI_Info_set(*new_info, key, val); - flag = 0; - } - - return; -} - - diff --git a/3rd-party/romio321/adio/include/BaseIOErrMsgs.msg b/3rd-party/romio321/adio/include/BaseIOErrMsgs.msg deleted file mode 100644 index 0ca0526619a4eb5ef6de7fd36e5fe7eb98842d87..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/BaseIOErrMsgs.msg +++ /dev/null @@ -1,51 +0,0 @@ -$set 12 MPI_ERR_ARG -12 65 "Invalid offset argument" -12 67 "Null datarep argument" -12 69 "Invalid count argument" -12 71 "Invalid size argument" -12 73 "Invalid whence argument" -12 75 "flag argument must be the same on all processes" -12 77 "Invalid displacement argument" -12 79 "Invalid etype argument" -12 81 "Invalid filetype argument" -12 83 "size argument must be the same on all processes" -12 85 "offset points to a negative location in the file" -12 87 "whence argument must be the same on all processes" -12 89 "offset argument must be the same on all processes" -$set 21 MPI_ERR_AMODE -21 1 "Invalid amode" -21 3 "Exactly one of MPI_MODE_RDONLY, MPI_MODE_WRONLY, or MPI_MODE_RDWR must be specified" -21 5 "Cannot use MPI_MODE_CREATE or MPI_MODE_EXCL with MPI_MODE_RDONLY" -21 7 "Cannot specify MPI_MODE_SEQUENTIAL with MPI_MODE_RDWR" -$set 27 MPI_ERR_FILE -27 1 "Invalid file handle" -27 3 "Null file handle" -27 5 "Corrupted file handle" -$set 32 MPI_ERR_IO -32 1 "I/O Error" -32 2 "%s" 1 -32 3 "Only an integral number of etypes can be accessed" -32 5 "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file system (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:, pvfs2:, ftp:, gsiftp:)" -32 7 "ROMIO has not been configured to use the PFS file system" -32 9 "ROMIO has not been configured to use the PIOFS file system" -32 11 "ROMIO has not been configured to use the UFS file system" -32 13 "ROMIO has not been configured to use the NFS file system" -32 15 "ROMIO has not been configured to use the HFS file system" -32 17 "ROMIO has not been configured to use the XFS file system" -32 19 "ROMIO has not been configured to use the SFS file system" -32 21 "ROMIO has not been configured to use the PVFS file system" -32 23 "Only one active split collective I/O operation allowed per file handle" -32 25 "No previous split collective begin" -32 27 "There are outstanding nonblocking I/O operations on this file" -32 29 "ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR." -32 31 "To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR." -32 33 "Filetype must be constructed out of one or more etypes" -$set 43 MPI_ERR_UNSUPPORTED_DATAREP -43 1 "Unsupported data representation" -43 3 "Only native data representation currently supported" -$set 44 MPI_ERR_UNSUPPORTED_OPERATION -44 1 "Unsupported operation" -44 3 "Shared file pointer not supported on PIOFS and PVFS" -44 5 "Cannot use this function when file is opened with amode MPI_MODE_SEQUENTIAL" -44 7 "Cannot read from a file opened with amode MPI_MODE_WRONLY" -44 9 "MPI_MODE_SEQUENTIAL not supported on PIOFS and PVFS" diff --git a/3rd-party/romio321/adio/include/adio.h b/3rd-party/romio321/adio/include/adio.h deleted file mode 100644 index fedd8f58f551bd45c4f89d913c0e73f71a0a2f9c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/adio.h +++ /dev/null @@ -1,474 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* main include file for ADIO. - contains general definitions, declarations, and macros independent - of the underlying file system */ - -/* Functions and datataypes that are "internal" to the ADIO implementation - prefixed ADIOI_. Functions and datatypes that are part of the - "externally visible" (documented) ADIO interface are prefixed ADIO_. - - An implementation of MPI-IO, or any other high-level interface, should - not need to use any of the ADIOI_ functions/datatypes. - Only someone implementing ADIO on a new file system, or modifying - an existing ADIO implementation, would need to use the ADIOI_ - functions/datatypes. */ - -#ifndef ADIO_INCLUDE -#define ADIO_INCLUDE - -#ifdef SPPUX -#define _POSIX_SOURCE -#endif - -#ifdef USE_FORT_STDCALL -#define FORT_CALL __stdcall -#elif defined (USE_FORT_CDECL) -#define FORT_CALL __cdecl -#else -#define FORT_CALL -#endif - -#ifdef USE_FORT_MIXED_STR_LEN -#define FORT_MIXED_LEN_DECL , int -#define FORT_END_LEN_DECL -#define FORT_MIXED_LEN(a) , int a -#define FORT_END_LEN(a) -#else -#define FORT_MIXED_LEN_DECL -#define FORT_END_LEN_DECL , int -#define FORT_MIXED_LEN(a) -#define FORT_END_LEN(a) , int a -#endif - -#ifdef HAVE_FORTRAN_API -# ifdef FORTRAN_EXPORTS -# define FORTRAN_API __declspec(dllexport) -# else -# define FORTRAN_API __declspec(dllimport) -# endif -#else -# define FORTRAN_API -#endif - -/* Use this macro for each parameter to a function that is not referenced in the body of the function */ -#ifdef HAVE_WINDOWS_H -#define ADIOI_UNREFERENCED_ARG(a) a -#else -#define ADIOI_UNREFERENCED_ARG(a) -#endif - -/* Include romioconf.h if we haven't already (some include files may - need to include romioconf before some system includes) */ -#ifndef ROMIOCONF_H_INCLUDED -#include "romioconf.h" -#define ROMIOCONF_H_INCLUDED -#endif - -#include "mpi.h" -#include "mpio.h" -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#include <sys/stat.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#ifdef SPPUX -#include <sys/cnx_fcntl.h> -#endif - -#ifdef ROMIO_NTFS -#include <winsock2.h> -#include <windows.h> -#define FDTYPE HANDLE -#else -#define FDTYPE int -#endif - -#ifdef MPI_OFFSET_IS_INT - typedef int ADIO_Offset; - typedef unsigned ADIO_Size; -# define ADIO_OFFSET MPI_INT -#elif defined(HAVE_LONG_LONG_64) - typedef long long ADIO_Offset; - typedef unsigned long long ADIO_Size; -# ifdef HAVE_MPI_LONG_LONG_INT -# define ADIO_OFFSET MPI_LONG_LONG_INT -# else -# define ADIO_OFFSET MPI_DOUBLE -# endif -#elif defined(HAVE_INT64) - typedef __int64 ADIO_Offset; - typedef unsigned __int64 ADIO_Size; -# define ADIO_OFFSET MPI_DOUBLE -#else - typedef long ADIO_Offset; - typedef unsigned long ADIO_Size; -# define ADIO_OFFSET MPI_LONG -#endif - -#define ADIO_Status MPI_Status - -#ifndef MPIO_INCLUDE -# ifdef NEEDS_MPI_FINT - typedef int MPI_Fint; -# endif -#endif - -#if (!defined(HAVE_MPI_INFO) && !defined(MPIO_INCLUDE)) - typedef struct MPIR_Info *MPI_Info; -# define MPI_INFO_NULL 0 -# define MPI_MAX_INFO_VAL 1024 - -int MPI_Info_create(MPI_Info *info); -int MPI_Info_set(MPI_Info info, char *key, char *value); -int MPI_Info_delete(MPI_Info info, char *key); -int MPI_Info_get(MPI_Info info, char *key, int valuelen, - char *value, int *flag); -int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag); -int MPI_Info_get_nkeys(MPI_Info info, int *nkeys); -int MPI_Info_get_nthkey(MPI_Info info, int n, char *key); -int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo); -int MPI_Info_free(MPI_Info *info); - -#ifdef MPI_Info_f2c -#undef MPI_Info_f2c -#endif -#ifdef MPI_Info_c2f -#undef MPI_Info_c2f -#endif -/* above needed for some versions of mpi.h in MPICH!! */ -MPI_Fint MPI_Info_c2f(MPI_Info info); -MPI_Info MPI_Info_f2c(MPI_Fint info); - -int PMPI_Info_create(MPI_Info *info); -int PMPI_Info_set(MPI_Info info, char *key, char *value); -int PMPI_Info_delete(MPI_Info info, char *key); -int PMPI_Info_get(MPI_Info info, char *key, int valuelen, - char *value, int *flag); -int PMPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag); -int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys); -int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key); -int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo); -int PMPI_Info_free(MPI_Info *info); - -MPI_Fint PMPI_Info_c2f(MPI_Info info); -MPI_Info PMPI_Info_f2c(MPI_Fint info); - -#endif - -/* style: allow:strdup:1 sig:0 */ - -#if defined(HAVE_STRDUP) && defined(NEEDS_STRDUP_DECL) && !defined(strdup) -char *strdup(const char *s); -# endif -#if defined(HAVE_READLINK) && defined(NEEDS_READLINK_DECL) && !defined(readlink) -ssize_t readlink(const char *path, char *buf, size_t bufsiz); -# endif -#if defined(HAVE_LSTAT) && defined(NEEDS_LSTAT_DECL) && !defined(lstat) -int lstat(const char *file_name, struct stat *buf); -# endif -#if defined(HAVE_FSYNC) && defined(NEEDS_FSYNC_DECL) && !defined(fsync) -int fsync(int fd); -# endif -#if defined(HAVE_FTRUNCATE) && defined(NEEDS_FTRUNCATE_DECL) && !defined(ftruncate) -int ftruncate(int fd, off_t length); -# endif - - -typedef struct ADIOI_Fns_struct ADIOI_Fns; -typedef struct ADIOI_Hints_struct ADIOI_Hints; - -typedef struct ADIOI_FileD { - int cookie; /* for error checking */ - FDTYPE fd_sys; /* system file descriptor */ - FDTYPE null_fd; /* the null-device file descriptor: debug only (obviously)*/ - int fd_direct; /* On XFS, this is used for direct I/O; - fd_sys is used for buffered I/O */ - int direct_read; /* flag; 1 means use direct read */ - int direct_write; /* flag; 1 means use direct write */ - /* direct I/O attributes */ - unsigned d_mem; /* data buffer memory alignment */ - unsigned d_miniosz; /* min xfer size, xfer size multiple, - and file seek offset alignment */ - long blksize; /* some optimizations benefit from knowing - underlying block size */ - ADIO_Offset fp_ind; /* individual file pointer in MPI-IO (in bytes)*/ - ADIO_Offset fp_sys_posn; /* current location of the system file-pointer - in bytes */ - ADIOI_Fns *fns; /* struct of I/O functions to use */ - MPI_Comm comm; /* communicator indicating who called open */ - int is_open; /* deferred open: 0: not open yet 1: is open */ - int is_agg; /* bool: if I am an aggregator */ - char *filename; - int file_system; /* type of file system */ - int access_mode; /* Access mode (sequential, append, etc.), - possibly modified to deal with - data sieving or deferred open*/ - int orig_access_mode; /* Access mode provided by user: unmodified */ - ADIO_Offset disp; /* reqd. for MPI-IO */ - MPI_Datatype etype; /* reqd. for MPI-IO */ - MPI_Datatype filetype; /* reqd. for MPI-IO */ - MPI_Count etype_size; /* in bytes */ - ADIOI_Hints *hints; /* structure containing fs-indep. info values */ - MPI_Info info; - - /* The following support the split collective operations */ - int split_coll_count; /* count of outstanding split coll. ops. */ - MPI_Status split_status; /* status used for split collectives */ - MPI_Datatype split_datatype; /* datatype used for split collectives */ - - /* The following support the shared file operations */ - char *shared_fp_fname; /* name of file containing shared file pointer */ - struct ADIOI_FileD *shared_fp_fd; /* file handle of file - containing shared fp */ - int async_count; /* count of outstanding nonblocking operations */ - int perm; - int atomicity; /* true=atomic, false=nonatomic */ - int fortran_handle; /* handle for Fortran interface if needed */ - MPI_Errhandler err_handler; - void *fs_ptr; /* file-system specific information */ - - /* Two phase collective I/O support */ - ADIO_Offset *file_realm_st_offs; /* file realm starting offsets */ - MPI_Datatype *file_realm_types; /* file realm datatypes */ - int my_cb_nodes_index; /* my index into cb_config_list. -1 if N/A */ - char *io_buf; /* two-phase buffer allocated out of i/o path */ - MPI_Win io_buf_window; /* Window over the io_buf to support one-sided aggregation */ - int *io_buf_put_amounts; /* array tracking the amount of data mpi_put into the io_buf - during the same round of one-sided write aggregation */ - MPI_Win io_buf_put_amounts_window; /* Window over the io_buf_put_amounts */ - /* External32 */ - int is_external32; /* bool: 0 means native view */ - -} ADIOI_FileD; - -typedef struct ADIOI_FileD *ADIO_File; - -typedef MPI_Request ADIO_Request; - -/* fcntl structure */ -typedef struct { - ADIO_Offset disp; - MPI_Datatype etype; - MPI_Datatype filetype; - MPI_Info info; - int atomicity; - ADIO_Offset fsize; /* for get_fsize only */ - ADIO_Offset diskspace; /* for file preallocation */ -} ADIO_Fcntl_t; /* should contain more stuff */ - - -/* access modes */ -#define ADIO_CREATE 1 -#define ADIO_RDONLY 2 -#define ADIO_WRONLY 4 -#define ADIO_RDWR 8 -#define ADIO_DELETE_ON_CLOSE 16 -#define ADIO_UNIQUE_OPEN 32 -#define ADIO_EXCL 64 -#define ADIO_APPEND 128 -#define ADIO_SEQUENTIAL 256 - -#define ADIO_AMODE_NOMATCH ~(ADIO_CREATE|ADIO_RDONLY|ADIO_WRONLY|ADIO_RDWR|ADIO_DELETE_ON_CLOSE|ADIO_UNIQUE_OPEN|ADIO_EXCL|ADIO_APPEND|ADIO_SEQUENTIAL) - -/* file-pointer types */ -#define ADIO_EXPLICIT_OFFSET 100 -#define ADIO_INDIVIDUAL 101 -#define ADIO_SHARED 102 - -#define ADIO_REQUEST_NULL ((ADIO_Request) 0) -#define ADIO_FILE_NULL ((ADIO_File) 0) - -/* file systems */ -#define ADIO_NFS 150 -#define ADIO_PIOFS 151 /* IBM */ -#define ADIO_UFS 152 /* Unix file system */ -#define ADIO_PFS 153 /* Intel */ -#define ADIO_XFS 154 /* SGI */ -#define ADIO_HFS 155 /* HP/Convex */ -#define ADIO_SFS 156 /* NEC */ -#define ADIO_PVFS 157 /* PVFS for Linux Clusters from Clemson Univ. */ -#define ADIO_NTFS 158 /* NTFS for Windows NT */ -#define ADIO_TESTFS 159 /* fake file system for testing */ -#define ADIO_PVFS2 160 /* PVFS2: 2nd generation PVFS */ -#define ADIO_PANFS 161 /* Panasas FS */ -#define ADIO_GRIDFTP 162 /* Globus GridFTP */ -#define ADIO_LUSTRE 163 /* Lustre */ -/* #define ADIO_BGL 164 */ /* IBM BGL */ -/* #define ADIO_BGLOCKLESS 165 */ /* IBM BGL (lock-free) */ -#define ADIO_ZOIDFS 167 /* ZoidFS: the I/O forwarding fs */ -/* #define ADIO_BG 168 */ -#define ADIO_GPFS 168 - -#define ADIO_SEEK_SET SEEK_SET -#define ADIO_SEEK_CUR SEEK_CUR -#define ADIO_SEEK_END SEEK_END - -#define ADIO_FCNTL_SET_ATOMICITY 180 -#define ADIO_FCNTL_SET_DISKSPACE 188 -#define ADIO_FCNTL_GET_FSIZE 200 - -/* file system feature tests */ -#define ADIO_LOCKS 300 /* file system supports fcntl()-style locking */ -#define ADIO_SHARED_FP 301 /* file system supports shared file pointers */ -#define ADIO_ATOMIC_MODE 302 /* file system supports atomic mode */ -#define ADIO_DATA_SIEVING_WRITES 303 /* file system supports data sieving for writes */ -#define ADIO_SCALABLE_OPEN 304 /* one process can open the file and - broadcast result to all other - processors */ -#define ADIO_UNLINK_AFTER_CLOSE 305 /* supports posix semantic of keeping a - deleted file around until all - processors have closed it */ -#define ADIO_TWO_PHASE 306 /* file system implements some version of - two-phase collective buffering with - aggregation */ -#define ADIO_SCALABLE_RESIZE 307 /* file system supports resizing from one - processor (nfs, e.g. does not) */ - -/* for default file permissions */ -#define ADIO_PERM_NULL -1 - -#define ADIOI_FILE_COOKIE 2487376 -#define ADIOI_REQ_COOKIE 3493740 - -/* ADIO function prototypes */ -/* all these may not be necessary, as many of them are macro replaced to - function pointers that point to the appropriate functions for each - different file system (in adioi.h), but anyway... */ - -void ADIO_Init(int *argc, char ***argv, int *error_code); -void ADIO_End(int *error_code); -MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, const char *filename, - int file_system, ADIOI_Fns *ops, - int access_mode, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, - MPI_Info info, int perm, int *error_code); -void ADIOI_OpenColl(ADIO_File fd, int rank, int acces_mode, int *error_code); -void ADIO_ImmediateOpen(ADIO_File fd, int *error_code); -void ADIO_Close(ADIO_File fd, int *error_code); -void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, - int file_ptr_type, ADIO_Offset offset, - ADIO_Status *status, int *error_code); -void ADIO_WriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, int *bytes_written, int - *error_code); -void ADIO_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIO_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIO_ReadDone(ADIO_Request *request, ADIO_Status *status, - int *error_code); -int ADIO_WriteDone(ADIO_Request *request, ADIO_Status *status, - int *error_code); -int ADIO_ReadIcomplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIO_WriteIcomplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIO_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIO_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIO_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIO_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIO_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIO_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIO_WriteStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIO_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIO_IwriteStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIO_IreadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIO_IwriteStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -ADIO_Offset ADIO_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIO_Delete(char *filename, int *error_code); -void ADIO_Flush(ADIO_File fd, int *error_code); -void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype, - ADIOI_Fns **ops, int *error_code); -void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp, - int *error_code); -void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); -void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, MPI_Info info, int *error_code); -int ADIO_Feature(ADIO_File fd, int flag); - -/* functions to help deal with the array datatypes */ -int ADIO_Type_create_subarray(int ndims, - int *array_of_sizes, - int *array_of_subsizes, - int *array_of_starts, - int order, - MPI_Datatype oldtype, - MPI_Datatype *newtype); -int ADIO_Type_create_darray(int size, int rank, int ndims, - int *array_of_gsizes, int *array_of_distribs, - int *array_of_dargs, int *array_of_psizes, - int order, MPI_Datatype oldtype, - MPI_Datatype *newtype); - -/* MPI_File management functions (in mpio_file.c) */ -MPI_File MPIO_File_create(int size); -ADIO_File MPIO_File_resolve(MPI_File mpi_fh); -void MPIO_File_free(MPI_File *mpi_fh); -MPI_File MPIO_File_f2c(MPI_Fint fh); -MPI_Fint MPIO_File_c2f(MPI_File fh); -int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], - int line, int error_class, const char generic_msg[], - const char specific_msg[], ... ); -int MPIO_Err_return_file(MPI_File mpi_fh, int error_code); -int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code); - -/* request managment helper functions */ -void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset nbytes, - int * error_code, MPI_Request *request); - -#include "adioi.h" -#include "adioi_fs_proto.h" -#include "mpio_error.h" -#include "mpipr.h" - -/* these two defines don't appear to be in any other header file */ -#define MPIR_ERR_FATAL 1 -#define MPIR_ERR_RECOVERABLE 0 - -#endif diff --git a/3rd-party/romio321/adio/include/adio_cb_config_list.h b/3rd-party/romio321/adio/include/adio_cb_config_list.h deleted file mode 100644 index ab2c5b501f7e1bdc9eafbe4a1bb96db157d3b539..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/adio_cb_config_list.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -/* I have no idea what the "D" stands for; it's how things are done in adio.h - */ -struct ADIO_cb_name_arrayD { - int refct; - int namect; - char **names; -}; - -typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; - -int ADIOI_cb_gather_name_array(MPI_Comm comm, MPI_Comm dupcomm, - ADIO_cb_name_array *arrayp); -int ADIOI_cb_copy_name_array(MPI_Comm comm, int keyval, void *extra, - void *attr_in, - void **attr_out, int *flag); -int ADIOI_cb_delete_name_array(MPI_Comm comm, int keyval, void *attr_val, - void *extra); -int ADIOI_cb_config_list_parse(char *config_list, ADIO_cb_name_array array, - int ranklist[], int cb_nodes); -int ADIOI_cb_bcast_rank_map(ADIO_File fd); diff --git a/3rd-party/romio321/adio/include/adioi.h b/3rd-party/romio321/adio/include/adioi.h deleted file mode 100644 index 5656f10bae79d7a5be6025b5f748d0dd4db3ac22..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/adioi.h +++ /dev/null @@ -1,1104 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -/* contains general definitions, declarations, and macros internal to - the ADIO implementation, though independent of the underlying file - system. This file is included in adio.h */ - -/* Functions and datataypes that are "internal" to the ADIO implementation - prefixed ADIOI_. Functions and datatypes that are part of the - "externally visible" (documented) ADIO interface are prefixed ADIO_. - - An implementation of MPI-IO, or any other high-level interface, should - not need to use any of the ADIOI_ functions/datatypes. - Only someone implementing ADIO on a new file system, or modifying - an existing ADIO implementation, would need to use the ADIOI_ - functions/datatypes. */ - - -#ifndef ADIOI_INCLUDE -#define ADIOI_INCLUDE -/* used to keep track of hint/info values. - * Note that there are a lot of int-sized values in here...they are - * used as int-sized entities other places as well. This would be a - * problem on 32-bit systems using > 2GB files in some cases... - */ -struct ADIOI_Hints_struct { - int initialized; - int striping_factor; - int striping_unit; - int cb_read; - int cb_write; - int cb_nodes; - int cb_buffer_size; - int cb_pfr; - int cb_fr_type; - int cb_fr_alignment; - int cb_ds_threshold; - int cb_alltoall; - int ds_read; - int ds_write; - int no_indep_rw; - int ind_rd_buffer_size; - int ind_wr_buffer_size; - int deferred_open; - int min_fdomain_size; - char *cb_config_list; - int *ranklist; - union { - struct { - int listio_read; - int listio_write; - } pvfs; - struct { - int debugmask; - int posix_read; - int posix_write; - int listio_read; - int listio_write; - int dtype_read; - int dtype_write; - } pvfs2; - struct { - int start_iodevice; - int co_ratio; - int coll_threshold; - int ds_in_coll; - } lustre; - struct { - unsigned read_chunk_sz; /* chunk size for direct reads */ - unsigned write_chunk_sz; /* chunk size for direct writes */ - } xfs; - struct { - int *bridgelist; /* list of all bride ranks */ - int *bridgelistnum; /* each entry here is the number of aggregators - associated with the bridge rank of the same - index in bridgelist */ - int numbridges; /* total number of bridges */ - } bg; - } fs_hints; - -}; - -typedef struct ADIOI_Datarep { - char *name; - void *state; - MPI_Datarep_extent_function *extent_fn; - MPI_Datarep_conversion_function *read_conv_fn; - MPI_Datarep_conversion_function *write_conv_fn; - struct ADIOI_Datarep *next; /* pointer to next datarep */ -} ADIOI_Datarep; - -/* Values for use with cb_read, cb_write, ds_read, and ds_write - * and some fs-specific hints - (IBM xlc, Compaq Tru64 compilers object to a comma after the last item) - (that's just wrong) - */ -enum { - ADIOI_HINT_AUTO = 0, - ADIOI_HINT_ENABLE = 1, - ADIOI_HINT_DISABLE = 2 -}; - -/* flattened datatypes. Each datatype is stored as a node of a - globally accessible linked list. Once attribute caching on a - datatype is available (in MPI-2), that should be used instead. */ - -typedef struct ADIOI_Fl_node { - MPI_Datatype type; - MPI_Count count; /* no. of contiguous blocks */ - ADIO_Offset *blocklens; /* array of contiguous block lengths (bytes)*/ - ADIO_Offset *indices; /* array of byte offsets of each block */ - /* the type processing code in ROMIO loops through the flattened - * representation to tile file views. so, we cannot simply indicate a - * lower bound and upper bound with entries here -- those are instead - * indicated by offset-length pairs with zero length. In order to deal - * with repeatedly resetting the LB and UB though (as in resized of - * resized, or struct of resized, perhaps?), indicate where in the - * tuple-stream the lb and ub parts are kept - * (-1 indicates "not explicitly set") */ - ADIO_Offset lb_idx; - ADIO_Offset ub_idx; - struct ADIOI_Fl_node *next; /* pointer to next node */ -} ADIOI_Flatlist_node; - -#ifdef ROMIO_PVFS2 -#include <pvfs2.h> -#endif -typedef struct ADIOI_AIO_req_str { - /* very wierd: if this MPI_Request is a pointer, some C++ compilers - * will clobber it when the MPICH C++ bindings are used */ - MPI_Request req; - MPI_Offset nbytes; - /* should probably make this a union */ -#ifdef ROMIO_HAVE_WORKING_AIO - struct aiocb *aiocbp; -#endif -#ifdef ROMIO_PVFS2 - PVFS_sys_op_id op_id; - PVFS_sysresp_io resp_io; - PVFS_Request file_req; - PVFS_Request mem_req; -#endif -#ifdef ROMIO_NTFS - /* Ptr to Overlapped struct */ - LPOVERLAPPED lpOvl; - /* Ptr to file handle */ - HANDLE fd; -#endif -} ADIOI_AIO_Request; - -struct ADIOI_Fns_struct { - void (*ADIOI_xxx_Open) (ADIO_File fd, int *error_code); - void (*ADIOI_xxx_OpenColl) (ADIO_File fd, int rank, - int access_mode, int *error_code); - void (*ADIOI_xxx_ReadContig) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - void (*ADIOI_xxx_WriteContig) (ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - void (*ADIOI_xxx_ReadStridedColl) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - void (*ADIOI_xxx_WriteStridedColl) (ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - ADIO_Offset (*ADIOI_xxx_SeekIndividual) (ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); - void (*ADIOI_xxx_Fcntl) (ADIO_File fd, int flag, - ADIO_Fcntl_t *fcntl_struct, int *error_code); - void (*ADIOI_xxx_SetInfo) (ADIO_File fd, MPI_Info users_info, - int *error_code); - void (*ADIOI_xxx_ReadStrided) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - void (*ADIOI_xxx_WriteStrided) (ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int *error_code); - void (*ADIOI_xxx_Close) (ADIO_File fd, int *error_code); - void (*ADIOI_xxx_IreadContig) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); - void (*ADIOI_xxx_IwriteContig) (ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); - int (*ADIOI_xxx_ReadDone) (ADIO_Request *request, ADIO_Status *status, - int *error_code); - int (*ADIOI_xxx_WriteDone) (ADIO_Request *request, ADIO_Status *status, - int *error_code); - void (*ADIOI_xxx_ReadComplete) (ADIO_Request *request, ADIO_Status *status, - int *error_code); - void (*ADIOI_xxx_WriteComplete) (ADIO_Request *request, ADIO_Status *status, - int *error_code); - void (*ADIOI_xxx_IreadStrided) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); - void (*ADIOI_xxx_IwriteStrided) (ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); - void (*ADIOI_xxx_Flush) (ADIO_File fd, int *error_code); - void (*ADIOI_xxx_Resize) (ADIO_File fd, ADIO_Offset size, int *error_code); - void (*ADIOI_xxx_Delete) (const char *filename, int *error_code); - int (*ADIOI_xxx_Feature) (ADIO_File fd, int flag); - const char *fsname; - void (*ADIOI_xxx_IreadStridedColl) (ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); - void (*ADIOI_xxx_IwriteStridedColl) (ADIO_File fd, const void *buf, - int count, MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code); -}; - -/* optypes for ADIO_RequestD */ -#define ADIOI_READ 26 -#define ADIOI_WRITE 27 - -#define ADIOI_MIN(a, b) ((a) < (b) ? (a) : (b)) -#define ADIOI_MAX(a, b) ((a) > (b) ? (a) : (b)) -/* thanks stackoverflow: - * http://stackoverflow.com/questions/3982348/implement-generic-swap-macro-in-c */ -#define ADIOI_SWAP(x, y, T) do { T temp##x##y = x; x = y; y = temp##x##y; } while (0); - -#define ADIOI_PREALLOC_BUFSZ 16777216 /* buffer size used to - preallocate disk space */ - - -/* default values for some hints */ - /* buffer size for collective I/O = 16 MB */ -#define ADIOI_CB_BUFFER_SIZE_DFLT "16777216" - /* buffer size for data sieving in independent reads = 4MB */ -#define ADIOI_IND_RD_BUFFER_SIZE_DFLT "4194304" - /* buffer size for data sieving in independent writes = 512KB. default is - smaller than for reads, because write requires read-modify-write - with file locking. If buffer size is large there is more contention - for locks. */ -#define ADIOI_IND_WR_BUFFER_SIZE_DFLT "524288" - /* use one process per processor name by default */ -#define ADIOI_CB_CONFIG_LIST_DFLT "*:1" - - -/* some of the ADIO functions are macro-replaced */ - -#define ADIOI_OpenColl(fd, rank, access_mode, error_code) \ - (*(fd->fns->ADIOI_xxx_OpenColl))(fd, rank, access_mode, error_code) - -#define ADIO_ReadContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_ReadContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_WriteContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_WriteContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_SeekIndividual(fd,offset,whence,error_code) \ - (*(fd->fns->ADIOI_xxx_SeekIndividual))(fd,offset,whence,error_code) - -#define ADIO_Fcntl(fd,flag,fcntl_struct,error_code) \ - (*(fd->fns->ADIOI_xxx_Fcntl))(fd,flag,fcntl_struct,error_code) - -#define ADIO_IreadContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IreadContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -#define ADIO_IwriteContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IwriteContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -/* in these routines a pointer to request is passed */ -#define ADIO_ReadDone(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_ReadDone))(request,status,error_code) - -#define ADIO_WriteDone(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_WriteDone))(request,status,error_code) - -#define ADIO_ReadIcomplete(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_ReadIcomplete))(request,status,error_code) - -#define ADIO_WriteIcomplete(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_WriteIcomplete))(request,status,error_code) - -#define ADIO_ReadComplete(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_ReadComplete))(request,status,error_code) - -#define ADIO_WriteComplete(request,status,error_code) \ - (*((*(request))->fd->fns->ADIOI_xxx_WriteComplete))(request,status,error_code) - -#define ADIO_ReadStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_ReadStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_WriteStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_WriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_ReadStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_ReadStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_WriteStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ - (*(fd->fns->ADIOI_xxx_WriteStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) - -#define ADIO_IreadStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IreadStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -#define ADIO_IwriteStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IwriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -#define ADIO_IreadStridedColl(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IreadStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -#define ADIO_IwriteStridedColl(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ - (*(fd->fns->ADIOI_xxx_IwriteStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) - -#define ADIO_Flush(fd,error_code) (*(fd->fns->ADIOI_xxx_Flush))(fd,error_code) - -#define ADIO_Resize(fd,size,error_code) \ - (*(fd->fns->ADIOI_xxx_Resize))(fd,size,error_code) - -#define ADIO_Delete(filename,error_code) \ - (*(fd->fns->ADIOI_xxx_Delete))(filename,error_code) - -#define ADIO_SetInfo(fd, users_info, error_code) \ - (*(fd->fns->ADIOI_xxx_SetInfo))(fd, users_info, error_code) - -#define ADIO_Feature(fd, flag) \ - (*(fd->fns->ADIOI_xxx_Feature))(fd, flag) - - -/* structure for storing access info of this process's request - from the file domain of other processes, and vice-versa. used - as array of structures indexed by process number. */ -typedef struct { - ADIO_Offset *offsets; /* array of offsets */ - ADIO_Offset *lens; /* array of lengths */ - MPI_Aint *mem_ptrs; /* array of pointers. used in the read/write - phase to indicate where the data - is stored in memory */ - int count; /* size of above arrays */ -} ADIOI_Access; - -/* structure for storing generic offset/length pairs. used to describe - file realms among other things */ -typedef struct { - ADIO_Offset *offsets; /* array of offsets */ - ADIO_Offset *lens; /* array of lengths */ - int count; /* size of above arrays */ -} ADIOI_Offlen; - -/* prototypes for ADIO internal functions */ - - -int ADIOI_Type_get_envelope (MPI_Datatype datatype, int *num_integers, - int *num_addresses, int *num_datatypes, int *combiner); -int ADIOI_Type_get_contents (MPI_Datatype datatype, int max_integers, - int max_addresses, int max_datatypes, int array_of_integers[], - MPI_Aint array_of_addresses[], MPI_Datatype array_of_datatypes[]); -void ADIOI_SetFunctions(ADIO_File fd); -void ADIOI_Flatten_datatype(MPI_Datatype type); -void ADIOI_Flatten(MPI_Datatype type, ADIOI_Flatlist_node *flat, - ADIO_Offset st_offset, MPI_Count *curr_index); -void ADIOI_Delete_flattened(MPI_Datatype datatype); -ADIOI_Flatlist_node * ADIOI_Flatten_and_find(MPI_Datatype); -MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype type, MPI_Count *curr_index); -void ADIOI_Complete_async(int *error_code); -void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname); -void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname); -void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname); -void ADIOI_Free_fn(void *ptr, int lineno, const char *fname); -void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); -void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset); -void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset); -void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, - ADIO_Offset *disp); -void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info); -void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo, - MPI_Info *new_info); -void ADIOI_Info_print_keyvals(MPI_Info info); - - -void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, - int *error_code); -void ADIOI_GEN_Flush(ADIO_File fd, int *error_code); -void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code); -void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code); -void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, - int access_mode, int *error_code); -void ADIOI_GEN_Delete(const char *filename, int *error_code); -void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -int ADIOI_GEN_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, MPI_Request *request); -void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_GEN_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); -void ADIOI_GEN_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -void ADIOI_GEN_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code); -int ADIOI_GEN_IODone(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_GEN_IOComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -int ADIOI_GEN_aio_poll_fn(void *extra_state, ADIO_Status *status); -int ADIOI_GEN_aio_wait_fn(int count, void **array_of_states, double timeout, - ADIO_Status *status); -int ADIOI_GEN_aio_query_fn(void *extra_state, ADIO_Status *status); -int ADIOI_GEN_aio_free_fn(void *extra_state); -int ADIOI_GEN_Feature(ADIO_File fd, int feature); - -void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, - MPI_Datatype buftype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -#ifdef HAVE_MPI_GREQUEST_EXTENSIONS -void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -#else -#define ADIOI_GEN_IreadStridedColl NULL -#endif -void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -#ifdef HAVE_MPI_GREQUEST_EXTENSIONS -void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -#else -#define ADIOI_GEN_IwriteStridedColl NULL -#endif -void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype - datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, ADIO_Offset - **len_list_ptr, ADIO_Offset *start_offset_ptr, - ADIO_Offset *end_offset_ptr, int - *contig_access_count_ptr); -void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset - *end_offsets, int nprocs, int nprocs_for_coll, - ADIO_Offset *min_st_offset_ptr, - ADIO_Offset **fd_start_ptr, ADIO_Offset - **fd_end_ptr, int min_fd_size, - ADIO_Offset *fd_size_ptr, - int striping_unit); -int ADIOI_Calc_aggregator(ADIO_File fd, - ADIO_Offset off, - ADIO_Offset min_off, - ADIO_Offset *len, - ADIO_Offset fd_size, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end); -void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, - ADIO_Offset *len_list, int - contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, ADIO_Offset fd_size, - int nprocs, - int *count_my_req_procs_ptr, - int **count_my_req_per_proc_ptr, - ADIOI_Access **my_req_ptr, - int **buf_idx_ptr); -void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs, - int *count_my_req_per_proc, - ADIOI_Access *my_req, - int nprocs, int myrank, - int *count_others_req_procs_ptr, - ADIOI_Access **others_req_ptr); - - -/* Nonblocking Collective I/O internals */ -typedef enum { - ADIOI_IRC_STATE_GEN_IREADSTRIDEDCOLL, - ADIOI_IRC_STATE_GEN_IREADSTRIDEDCOLL_INDIO, - ADIOI_IRC_STATE_ICALC_OTHERS_REQ, - ADIOI_IRC_STATE_ICALC_OTHERS_REQ_MAIN, - ADIOI_IRC_STATE_IREAD_AND_EXCH, - ADIOI_IRC_STATE_IREAD_AND_EXCH_L1_BEGIN, - ADIOI_IRC_STATE_R_IEXCHANGE_DATA, - ADIOI_IRC_STATE_R_IEXCHANGE_DATA_RECV, - ADIOI_IRC_STATE_R_IEXCHANGE_DATA_FILL, - ADIOI_IRC_STATE_COMPLETE -} ADIOI_IRC_State; - -typedef enum { - ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL, - ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_INDIO, - ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_BCAST, - ADIOI_IWC_STATE_ICALC_OTHERS_REQ, - ADIOI_IWC_STATE_ICALC_OTHERS_REQ_MAIN, - ADIOI_IWC_STATE_IEXCH_AND_WRITE, - ADIOI_IWC_STATE_IEXCH_AND_WRITE_L1_BODY, - ADIOI_IWC_STATE_W_IEXCHANGE_DATA, - ADIOI_IWC_STATE_W_IEXCHANGE_DATA_HOLE, - ADIOI_IWC_STATE_W_IEXCHANGE_DATA_SEND, - ADIOI_IWC_STATE_W_IEXCHANGE_DATA_WAIT, - ADIOI_IWC_STATE_COMPLETE -} ADIOI_IWC_State; - -typedef struct ADIOI_NBC_Request ADIOI_NBC_Request; - -typedef struct ADIOI_GEN_IreadStridedColl_vars ADIOI_GEN_IreadStridedColl_vars; -typedef struct ADIOI_Iread_and_exch_vars ADIOI_Iread_and_exch_vars; -typedef struct ADIOI_R_Iexchange_data_vars ADIOI_R_Iexchange_data_vars; - -typedef struct ADIOI_GEN_IwriteStridedColl_vars ADIOI_GEN_IwriteStridedColl_vars; -typedef struct ADIOI_Iexch_and_write_vars ADIOI_Iexch_and_write_vars; -typedef struct ADIOI_W_Iexchange_data_vars ADIOI_W_Iexchange_data_vars; - -typedef struct ADIOI_Icalc_others_req_vars { - /* requests */ - MPI_Request req1; - MPI_Request *req2; - int num_req2; - - /* parameters */ - ADIO_File fd; - int count_my_req_procs; - int *count_my_req_per_proc; - ADIOI_Access *my_req; - int nprocs; - int myrank; - int *count_others_req_procs_ptr; - ADIOI_Access **others_req_ptr; - - /* stack variables */ - int *count_others_req_per_proc; - int count_others_req_procs; - ADIOI_Access *others_req; - - /* next function to be called */ - void (*next_fn)(ADIOI_NBC_Request *, int *); -} ADIOI_Icalc_others_req_vars; - -struct ADIOI_NBC_Request { - int rdwr; /* ADIOI_READ or ADIOI_WRITE */ - MPI_Request req; /* MPIX_Grequest */ - MPI_Count nbytes; /* data read or written */ - - union { - struct { - ADIOI_IRC_State state; /* progress state */ - ADIOI_GEN_IreadStridedColl_vars *rsc_vars; - ADIOI_Iread_and_exch_vars *rae_vars; - ADIOI_R_Iexchange_data_vars *red_vars; - } rd; - struct { - ADIOI_IWC_State state; /* progress state */ - ADIOI_GEN_IwriteStridedColl_vars *wsc_vars; - ADIOI_Iexch_and_write_vars *eaw_vars; - ADIOI_W_Iexchange_data_vars *wed_vars; - } wr; - } data; - ADIOI_Icalc_others_req_vars *cor_vars; -}; - -void ADIOI_Icalc_others_req(ADIOI_NBC_Request *nbc_req, int *error_code); -void ADIOI_Icalc_others_req_main(ADIOI_NBC_Request *nbc_req, int *error_code); -void ADIOI_Icalc_others_req_fini(ADIOI_NBC_Request *nbc_req, int *error_code); - - -/* KC && AC - New Collective I/O internals*/ - -#define TEMP_OFF 0 -#define REAL_OFF 1 -#define MAX_OFF_TYPE 2 - -/* Communication Tags */ -#define DATA_TAG 30 -#define AMT_TAG 31 - -/* cb_fr_type user size is non-zero */ -#define ADIOI_FR_AAR 0 -#define ADIOI_FR_FSZ -1 -#define ADIOI_FR_USR_REALMS -2 - -typedef struct flatten_state -{ - ADIO_Offset abs_off; - ADIO_Offset cur_sz; - ADIO_Offset idx; - ADIO_Offset cur_reg_off; -} flatten_state; - -typedef struct view_state -{ - ADIO_Offset fp_ind; /* file view params*/ - ADIO_Offset disp; /* file view params*/ - ADIO_Offset byte_off; - ADIO_Offset sz; - ADIO_Offset ext; /* preserved extent from MPI_Type_extent */ - ADIO_Offset type_sz; - - /* Current state */ - flatten_state cur_state; - /* Scratch state for counting up ol pairs */ - flatten_state tmp_state; - - /* Preprocessed data amount and ol pairs */ - ADIO_Offset pre_sz; - int pre_ol_ct; - MPI_Aint *pre_disp_arr; - int *pre_blk_arr; - - ADIOI_Flatlist_node *flat_type_p; -} view_state; - -void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype, - int file_ptr_type, ADIO_Offset offset, - ADIO_Offset *st_offset, ADIO_Offset *end_offset); -int ADIOI_Agg_idx (int rank, ADIO_File fd); -void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset, - ADIO_Offset max_end_offset); -void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Datatype custom_ftype, - int rdwr, ADIO_Status *status, int - *error_code); -void ADIOI_IOStridedColl(ADIO_File fd, void *buf, int count, int rdwr, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p); -ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type); -void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, - ADIO_File fd, int count, - MPI_Datatype datatype, ADIO_Offset off, - view_state *my_mem_view_state_arr, - view_state *agg_file_view_state_arr, - view_state *client_file_view_state_arr); -int ADIOI_init_view_state(int file_ptr_type, - int nprocs, - view_state *view_state_arr, - int op_type); -int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, - view_state *client_file_view_state_arr, - MPI_Datatype *client_comm_dtype_arr, - ADIO_Offset *client_comm_sz_arr, - ADIO_Offset *agg_dtype_offset_p, - MPI_Datatype *agg_dtype_p); -int ADIOI_Build_client_reqs(ADIO_File fd, - int nprocs, - view_state *my_mem_view_state_arr, - view_state *agg_file_view_state_arr, - ADIO_Offset *agg_comm_sz_arr, - MPI_Datatype *agg_comm_dtype_arr); -int ADIOI_Build_client_pre_req(ADIO_File fd, - int agg_rank, - int agg_idx, - view_state *my_mem_view_state_p, - view_state *agg_file_view_state_p, - ADIO_Offset max_pre_req_sz, - int max_ol_ct); -int ADIOI_Build_client_req(ADIO_File fd, - int agg_rank, - int agg_idx, - view_state *my_mem_view_state_p, - view_state *agg_file_view_state_p, - ADIO_Offset agg_comm_sz, - MPI_Datatype *agg_comm_dtype_p); - -void ADIOI_P2PContigWriteAggregation(ADIO_File fd, - const void *buf, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offset, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end); - -void ADIOI_P2PContigReadAggregation(ADIO_File fd, - const void *buf, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offset, - ADIO_Offset *fd_start, - ADIO_Offset *fd_end); - -int ADIOI_OneSidedCleanup(ADIO_File fd); -void ADIOI_OneSidedWriteAggregation(ADIO_File fd, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - const void *buf, - MPI_Datatype datatype, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int numNonZeroDataOffsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end, - int *hole_found); -void ADIOI_OneSidedReadAggregation(ADIO_File fd, - ADIO_Offset *offset_list, - ADIO_Offset *len_list, - int contig_access_count, - const void *buf, - MPI_Datatype datatype, - int *error_code, - ADIO_Offset *st_offsets, - ADIO_Offset *end_offsets, - int numNonZeroDataOffsets, - ADIO_Offset *fd_start, - ADIO_Offset* fd_end); -ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIOI_GEN_Close(ADIO_File fd, int *error_code); -void ADIOI_Shfp_fname(ADIO_File fd, int rank, int *error_code); -void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset size, int *error_code); -int ADIOI_Error(ADIO_File fd, int error_code, char *string); -int MPIR_Err_setmsg( int, int, const char *, const char *, const char *, ... ); -int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); -int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, MPI_Count nbytes); -int ADIOI_Uses_generic_read(ADIO_File fd); -int ADIOI_Uses_generic_write(ADIO_File fd); -int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno); -int ADIOI_Type_create_hindexed_x(int count, - const MPI_Count array_of_blocklengths[], - const MPI_Aint array_of_displacements[], - MPI_Datatype oldtype, - MPI_Datatype *newtype); - - -int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_FAKE_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_FAKE_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code); -void ADIOI_FAKE_IOComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); - - -/* File I/O common functionality */ -int MPIOI_File_read(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status); -int MPIOI_File_write(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status); -int MPIOI_File_read_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status); -int MPIOI_File_write_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status); -int MPIOI_File_read_all_begin(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname); -int MPIOI_File_write_all_begin(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname); -int MPIOI_File_read_all_end(MPI_File fh, - void *buf, - char *myname, - MPI_Status *status); -int MPIOI_File_write_all_end(MPI_File fh, - const void *buf, - char *myname, - MPI_Status *status); -int MPIOI_File_iwrite(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request); -int MPIOI_File_iread(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request); -int MPIOI_File_iwrite_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request); -int MPIOI_File_iread_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request); - - - -/* Unix-style file locking */ - -#if (defined(ROMIO_HFS) || defined(ROMIO_XFS)) - -# define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ - do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ - ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_WRLCK, offset, whence, len);\ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); } while (0) - -# define ADIOI_READ_LOCK(fd, offset, whence, len) \ - do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ - ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_RDLCK, offset, whence, len);\ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); }while (0) - -# define ADIOI_UNLOCK(fd, offset, whence, len) \ - do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ - ADIOI_Set_lock64((fd)->fd_sys, F_SETLK64, F_UNLCK, offset, whence, len); \ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); }while (0) - -#elif (defined(ROMIO_NTFS)) - -#define ADIOI_LOCK_CMD 0 -#define ADIOI_UNLOCK_CMD 1 - -# define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, LOCKFILE_EXCLUSIVE_LOCK, offset, whence, len) -# define ADIOI_READ_LOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, 0, offset, whence, len) -# define ADIOI_UNLOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, ADIOI_UNLOCK_CMD, LOCKFILE_FAIL_IMMEDIATELY, offset, whence, len) - -#else - -#ifdef ADIOI_MPE_LOGGING -# define ADIOI_WRITE_LOCK(fd, offset, whence, len) do { \ - MPE_Log_event( ADIOI_MPE_writelock_a, 0, NULL ); \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); \ - MPE_Log_event( ADIOI_MPE_writelock_b, 0, NULL ); } while( 0 ) -# define ADIOI_READ_LOCK(fd, offset, whence, len) \ - MPE_Log_event( ADIOI_MPE_readlock_a, 0, NULL ); do { \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); \ - MPE_Log_event( ADIOI_MPE_readlock_b, 0, NULL ); } while( 0 ) -# define ADIOI_UNLOCK(fd, offset, whence, len) do { \ - MPE_Log_event( ADIOI_MPE_unlock_a, 0, NULL ); \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); \ - MPE_Log_event( ADIOI_MPE_unlock_b, 0, NULL ); } while( 0 ) -#else -# define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len) -# define ADIOI_READ_LOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len) -# define ADIOI_UNLOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len) -#endif - -#endif - -int ADIOI_Set_lock(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len); -int ADIOI_Set_lock64(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len); - -#define ADIOI_Malloc(a) ADIOI_Malloc_fn(a,__LINE__,__FILE__) -#define ADIOI_Calloc(a,b) ADIOI_Calloc_fn(a,b,__LINE__,__FILE__) -#define ADIOI_Realloc(a,b) ADIOI_Realloc_fn(a,b,__LINE__,__FILE__) -#define ADIOI_Free(a) ADIOI_Free_fn(a,__LINE__,__FILE__) - -int ADIOI_Strncpy( char *outstr, const char *instr, size_t maxlen ); -int ADIOI_Strnapp( char *, const char *, size_t ); -char *ADIOI_Strdup( const char * ); - -/* the current MPI standard is not const-correct, and modern compilers warn - * about the following sort of code: - * - * MPI_Info_set(info, "key", "val"); - * - * reminding us that "key" and "val" are const. We use the following macros to - * cast away the const and suppress the warning. */ -#define ADIOI_Info_set(info_,key_str_,val_) \ - MPI_Info_set((info_),((char*)key_str_),(char*)(val_)) -#define ADIOI_Info_get(info_,key_str_,val_len_,val_,flag_) \ - MPI_Info_get((info_),((char*)key_str_),(val_len_),(val_),(flag_)) -#define ADIOI_Info_get_valuelen(info_,key_str_,val_len_,flag_) \ - MPI_Info_get_valuelen((info_),((char*)key_str_),(val_len_),(flag_)) -#define ADIOI_Info_delete(info_,key_str_) \ - MPI_Info_delete((info_),((char*)key_str_)) - - -/* Provide a fallback snprintf for systems that do not have one */ -/* Define attribute as empty if it has no definition */ -#ifndef ATTRIBUTE -#ifdef HAVE_GCC_ATTRIBUTE -#define ATTRIBUTE(a) __attribute__(a) -#else -#define ATTRIBUTE(a) -#endif -#endif - -/* style: allow:snprintf:1 sig:0 */ - -#ifdef HAVE_SNPRINTF -#define ADIOI_Snprintf snprintf -/* Sometimes systems don't provide prototypes for snprintf */ -#ifdef NEEDS_SNPRINTF_DECL -extern int snprintf( char *, size_t, const char *, ... ) ATTRIBUTE((format(printf,3,4))); -#endif -#else -int ADIOI_Snprintf( char *str, size_t size, const char *format, ... ) - ATTRIBUTE((format(printf,3,4))); -#endif /* HAVE_SNPRINTF */ - -#define FPRINTF fprintf - -#ifndef HAVE_STRERROR -# ifdef HAVE_SYSERRLIST - extern char *sys_errlist[]; -# define strerror(n) sys_errlist[n] -# else -# define PRINT_ERR_MSG -# endif -#endif - -#include "adioi_error.h" - -/* MPE logging variables */ - -#ifdef ADIOI_MPE_LOGGING -#include "mpe.h" - -int ADIOI_MPE_open_a; -int ADIOI_MPE_open_b; -int ADIOI_MPE_read_a; -int ADIOI_MPE_read_b; -int ADIOI_MPE_write_a; -int ADIOI_MPE_write_b; -int ADIOI_MPE_lseek_a; -int ADIOI_MPE_lseek_b; -int ADIOI_MPE_close_a; -int ADIOI_MPE_close_b; -int ADIOI_MPE_writelock_a; -int ADIOI_MPE_writelock_b; -int ADIOI_MPE_readlock_a; -int ADIOI_MPE_readlock_b; -int ADIOI_MPE_unlock_a; -int ADIOI_MPE_unlock_b; -int ADIOI_MPE_postwrite_a; -int ADIOI_MPE_postwrite_b; -int ADIOI_MPE_openinternal_a; -int ADIOI_MPE_openinternal_b; -int ADIOI_MPE_stat_a; -int ADIOI_MPE_stat_b; -int ADIOI_MPE_iread_a; -int ADIOI_MPE_iread_b; -int ADIOI_MPE_iwrite_a; -int ADIOI_MPE_iwrite_b; -#endif - -#ifdef ROMIO_INSIDE_MPICH -/* Assert that this MPI_Aint value can be cast to a ptr value without problem.*/ -/* Basic idea is the value should be unchanged after casting - (no loss of (meaningful) high order bytes in 8 byte MPI_Aint - to (possible) 4 byte ptr cast) */ -/* Should work even on 64bit or old 32bit configs */ - /* Use MPIU_Ensure_Aint_fits_in_pointer from mpiutil.h and - MPIU_AINT_CAST_TO_VOID_PTR from configure (mpi.h) */ - #include "glue_romio.h" - - #define ADIOI_AINT_CAST_TO_VOID_PTR (void*)(MPIU_Pint) - /* The next two casts are only used when you don't want sign extension - when casting a (possible 4 byte) aint to a (8 byte) long long or offset */ - #define ADIOI_AINT_CAST_TO_LONG_LONG (long long) - #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG - - #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value) MPIR_Ext_ensure_Aint_fits_in_pointer(aint_value) - #define ADIOI_Assert MPIR_Ext_assert -#else - #include <assert.h> - #define ADIOI_AINT_CAST_TO_VOID_PTR (void*) - #define ADIOI_AINT_CAST_TO_LONG_LONG (long long) - #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG - #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value) - #define ADIOI_Assert assert - #define MPIU_Upint unsigned long - #define MPID_THREADPRIV_DECL -#endif - -#ifdef USE_DBG_LOGGING /*todo fix dependency on mpich?*/ -/* DBGT_FPRINTF terse level printing */ -#define DBGT_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ -if (MPIR_Ext_dbg_romio_terse_enabled) fprintf -/* DBG_FPRINTF default (typical level) printing */ -#define DBG_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ -if (MPIR_Ext_dbg_romio_typical_enabled) fprintf -/* DBGV_FPRINTF verbose level printing */ -#define DBGV_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ - if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf -#else /* compile it out */ -#define DBGT_FPRINTF if (0) fprintf -#define DBG_FPRINTF if (0) fprintf -#define DBGV_FPRINTF if (0) fprintf -#endif - -/* declarations for threaded I/O */ -/* i/o thread data structure (bgmpio_pthreadwc) */ -typedef struct wcThreadFuncData { - ADIO_File fd; - int io_kind; - char *buf; - int size; - ADIO_Offset offset; - ADIO_Status *status; - int error_code; -} ADIOI_IO_ThreadFuncData; - -void *ADIOI_IO_Thread_Func(void *vptr_args); - - -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -#ifndef PATH_MAX -#define PATH_MAX 65535 -#endif - -#if (HAVE_DECL_PWRITE == 0) -#include <sys/types.h> -#include <unistd.h> -ssize_t pread(int fd, void *buf, size_t count, off_t offset); -ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); - -#endif - -#endif /* ADIOI_INCLUDE */ diff --git a/3rd-party/romio321/adio/include/adioi_error.h b/3rd-party/romio321/adio/include/adioi_error.h deleted file mode 100644 index 300a0638615b42ad917dc9759fe04f44ed9ee722..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/adioi_error.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#include <string.h> /* for strerror() */ - -/* MPIO_CHECK_XXX macros are used to clean up error checking and - * handling in many of the romio/mpi-io/ source files. - */ -#define MPIO_CHECK_FILE_HANDLE(fh, myname, error_code) \ -if ((fh <= (ADIO_File) 0) || \ - ((fh)->cookie != ADIOI_FILE_COOKIE)) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_FILE, \ - "**iobadfh", 0); \ - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);\ - goto fn_exit; \ -} - -/* TODO could add more glue code to help check for handle validity, or perhaps - * do some sort of always-safe attribute/info call to check for handle validity */ -#define MPIO_CHECK_COMM(comm_, myname_, error_code_) \ - do { \ - if ((comm_) == MPI_COMM_NULL) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - (myname_), __LINE__, \ - MPI_ERR_COMM, \ - "**commnull", 0); \ - error_code_ = MPIO_Err_return_file(MPI_FILE_NULL, (error_code_)); \ - goto fn_exit; \ - } \ - } while (0) - -#define MPIO_CHECK_COUNT(fh, count, myname, error_code) \ -if (count < 0) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_COUNT, \ - "**iobadcount", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code) \ -if (count*datatype_size != (ADIO_Offset)(unsigned)count*(ADIO_Offset)datatype_size) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_ARG, \ - "**iobadcount", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code) \ - do { \ - if (datatype == MPI_DATATYPE_NULL) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_TYPE, \ - "**dtypenull", 0); \ - } \ - else { \ - MPIO_DATATYPE_ISCOMMITTED(datatype, error_code); \ - } \ - if (error_code != MPI_SUCCESS) { \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ - } \ - } while (0) - -#define MPIO_CHECK_READABLE(fh, myname, error_code) \ -if (fh->access_mode & ADIO_WRONLY) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_ACCESS, \ - "**iowronly", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_WRITABLE(fh, myname, error_code) \ -if (fh->access_mode & ADIO_RDONLY) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_READ_ONLY, \ - "**iordonly", \ - 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code) \ -if (fh->access_mode & ADIO_SEQUENTIAL) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_UNSUPPORTED_OPERATION, \ - "**ioamodeseq", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_INTEGRAL_ETYPE(fh, count, dtype_size, myname, error_code) \ -if ((count*dtype_size) % fh->etype_size != 0) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, MPI_ERR_IO, \ - "**ioetype", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -#define MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code) \ -if (!ADIO_Feature(fh, ADIO_SHARED_FP)) \ -{ \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_UNSUPPORTED_OPERATION, \ - "**iosharedunsupported", 0); \ - error_code = MPIO_Err_return_file(fh, error_code); \ - goto fn_exit; \ -} - -/* MPIO_ERR_CREATE_CODE_XXX macros are used to clean up creation of - * error codes for common cases in romio/adio/ - */ -#define MPIO_ERR_CREATE_CODE_ERRNO(myname, myerrno, error_code_p) \ -*(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_IO, \ - "System call I/O error", \ - "Syscall error from %s: %s", \ - myname, \ - strerror(myerrno)); - -#define MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, key, error_code_p) \ -*(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ - MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, \ - MPI_ERR_NOT_SAME, \ - "Value for info key not same across processes", \ - "Value for info key %s not same across processes",\ - key); - - -/* TODO: handle the independent io case more gracefully */ -#define ADIOI_TEST_DEFERRED(fh, myname, error_code)\ - if(! (fh)->is_open ) {\ - ADIO_ImmediateOpen((fh), (error_code)); } - -/* Check MPI_Info object by calling MPI_Info_dup, if the info object is valid -then the dup operation will succeed */ -/* a collective check for error makes this macro collective */ -#define MPIO_CHECK_INFO_ALL(info, error_code, comm) { \ - MPI_Info dupinfo; \ - int tmp_err = MPI_SUCCESS; \ - if (info == MPI_INFO_NULL) { \ - dupinfo = MPI_INFO_NULL; \ - error_code = MPI_SUCCESS; \ - } else { \ - error_code = MPI_Info_dup(info, &dupinfo); \ - } \ - MPI_Allreduce(&error_code, &tmp_err, 1, MPI_INT, MPI_MAX, comm); \ - if(tmp_err != MPI_SUCCESS) { \ - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, \ - myname, __LINE__, MPI_ERR_OTHER, "**info", 0); \ - goto fn_fail; \ - } \ - if (dupinfo != MPI_INFO_NULL) { \ - MPI_Info_free(&dupinfo); \ - } \ -} diff --git a/3rd-party/romio321/adio/include/adioi_fs_proto.h b/3rd-party/romio321/adio/include/adioi_fs_proto.h deleted file mode 100644 index e3af91708214fccbe0a7670e96f0149e911d136c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/adioi_fs_proto.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#ifndef ADIO_PROTO -#define ADIO_PROTO - -#ifdef ROMIO_NFS -extern struct ADIOI_Fns_struct ADIO_NFS_operations; -/* prototypes are in adio/ad_nfs/ad_nfs.h */ -#endif - -#ifdef ROMIO_PANFS -extern struct ADIOI_Fns_struct ADIO_PANFS_operations; -/* prototypes are in adio/ad_panfs/ad_panfs.h */ -#endif - -#ifdef ROMIO_PFS -extern struct ADIOI_Fns_struct ADIO_PFS_operations; -/* prototypes are in adio/ad_pfs/ad_pfs.h */ -#endif - -#ifdef ROMIO_PIOFS -extern struct ADIOI_Fns_struct ADIO_PIOFS_operations; -/* prototypes are in adio/ad_piofs/ad_piofs.h */ -#endif - -#ifdef ROMIO_UFS -extern struct ADIOI_Fns_struct ADIO_UFS_operations; -/* prototypes are in adio/ad_ufs/ad_ufs.h */ -#endif - -#ifdef ROMIO_HFS -extern struct ADIOI_Fns_struct ADIO_HFS_operations; -/* prototypes are in adio/ad_hfs/ad_hfs.h */ -#endif - -#ifdef ROMIO_XFS -extern struct ADIOI_Fns_struct ADIO_XFS_operations; -/* prototypes are in adio/ad_xfs/ad_xfs.h */ -#endif - -#ifdef ROMIO_SFS -extern struct ADIOI_Fns_struct ADIO_SFS_operations; -/* prototypes are in adio/ad_sfs/ad_sfs.h */ -#endif - -#ifdef ROMIO_LUSTRE -extern struct ADIOI_Fns_struct ADIO_LUSTRE_operations; -/* prototypes are in adio/ad_lustre/ad_lustre.h */ -#endif - -#ifdef ROMIO_NTFS -extern struct ADIOI_Fns_struct ADIO_NTFS_operations; -/* prototypes are in adio/ad_ntfs/ad_ntfs.h */ -#endif - -#ifdef ROMIO_PVFS -extern struct ADIOI_Fns_struct ADIO_PVFS_operations; -/* prototypes are in adio/ad_pvfs/ad_pvfs.h */ -#endif - -#ifdef ROMIO_PVFS2 -extern struct ADIOI_Fns_struct ADIO_PVFS2_operations; -/* prototypes are in adio/ad_pvfs2/ad_pvfs2.h */ -#endif - -#ifdef ROMIO_TESTFS -extern struct ADIOI_Fns_struct ADIO_TESTFS_operations; -/* prototypes are in adio/ad_testfs/ad_testfs.h */ -#endif - -#ifdef ROMIO_GPFS -extern struct ADIOI_Fns_struct ADIO_GPFS_operations; -/* prototypes are in adio/ad_gpfs/ad_gpfs.h */ -#endif - -#ifdef ROMIO_GRIDFTP -/* prototypes are in adio/ad_gridftp/ad_gridftp.h */ -extern struct ADIOI_Fns_struct ADIO_GRIDFTP_operations; -#endif - -#ifdef ROMIO_ZOIDFS -/* prototypes are in adio/ad_zoidfs/ad_zoidfs.h */ -extern struct ADIOI_Fns_struct ADIO_ZOIDFS_operations; -#endif - -#endif diff --git a/3rd-party/romio321/adio/include/heap-sort.h b/3rd-party/romio321/adio/include/heap-sort.h deleted file mode 100644 index 903a1e80606b0e1e4d317bfe06cfa23d6086d543..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/heap-sort.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "adio.h" - -typedef struct { - ADIO_Offset offset; - int proc; - ADIO_Offset reg_max_len; -} heap_node_t; - -typedef struct { - heap_node_t *nodes; - int size; -} heap_t; - -/*static inline int parent(heap_t *heap, int i); -static inline int left(heap_t *heap, int i); -static inline int right(heap_t *heap, int i); */ -void ADIOI_Heap_free(heap_t *heap); -int ADIOI_Heap_create(heap_t *heap, int size); -void ADIOI_Heap_insert(heap_t *heap, ADIO_Offset offset, int proc, - ADIO_Offset reg_max_len); -void ADIOI_Heap_extract_min(heap_t *heap, ADIO_Offset* key, int *proc, - ADIO_Offset *reg_max_len); diff --git a/3rd-party/romio321/adio/include/hint_fns.h b/3rd-party/romio321/adio/include/hint_fns.h deleted file mode 100644 index 7c20177deb982e3f8686b19f9e0df4a7e78e4706..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/hint_fns.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2013 UChicago/Argonne LLC - * See COPYRIGHT in top-level directory. - */ - -#ifndef _HINT_FNS_H -#define _HINT_FNS_H - -int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code); - -int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code); - -int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key, - int *local_cache, char *funcname, int *error_code); - -int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key, - char **local_cache, char *funcname, int *error_code); - -#endif diff --git a/3rd-party/romio321/adio/include/mpiu_external32.h b/3rd-party/romio321/adio/include/mpiu_external32.h deleted file mode 100644 index 43023737741c14dbe1b3ccbb263e3b47d87f1c26..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/mpiu_external32.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2012 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#ifndef _MPIU_EXTERNAL32_H_ -#define _MPIU_EXTERNAL32_H_ - -int MPIU_write_external32_conversion_fn (const void *userbuf, MPI_Datatype datatype, - int count, void *filebuf); -int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype, - int count, void *filebuf); -int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint *size); - -/* given a buffer, count, and datatype, return an apropriately sized and - * * external32-formatted buffer, suitable for handing off to a subsequent write - * * routine */ -int MPIU_external32_buffer_setup(const void * buf, int count, MPI_Datatype type, void **newbuf); - -#endif diff --git a/3rd-party/romio321/adio/include/mpiu_greq.h b/3rd-party/romio321/adio/include/mpiu_greq.h deleted file mode 100644 index e3fce1c41d859b6c77f9f2420d9261866a8eb920..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/adio/include/mpiu_greq.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2003 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#ifndef _MPIU_GREQUEST_H -#define _MPIU_GREQUEST_H - -int MPIU_Greq_query_fn(void *extra_state, MPI_Status *status); -int MPIU_Greq_free_fn(void *extra_state); -int MPIU_Greq_cancel_fn(void *extra_state, int complete); - -#endif diff --git a/3rd-party/romio321/autogen.sh b/3rd-party/romio321/autogen.sh deleted file mode 100755 index dcc84c738a72328efec54ec42651146fd96a63dd..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -${AUTORECONF:-autoreconf} ${autoreconf_args:-"-vif"} -I confdb diff --git a/3rd-party/romio321/confdb/aclocal_atomic.m4 b/3rd-party/romio321/confdb/aclocal_atomic.m4 deleted file mode 100644 index 4e96cfbf366128e01f9e87b73c6411feaf0fa2f6..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/confdb/aclocal_atomic.m4 +++ /dev/null @@ -1,227 +0,0 @@ -dnl /*D PAC_C_MEMATOMIC - Try and determine how to implement memory-atomic -dnl operations with the selected C compiler -dnl -dnl Synopsis: -dnl PAC_C_MEMATOMIC -dnl -dnl Notes: -dnl Defines names of the following form -dnl + HAVE_GCC_ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - gcc __asm__ will issue -dnl mfence, lfence, or sfence -dnl . HAVE___ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - __asm _emit will issue -dnl mfence, lfence, or sfence -dnl . HAVE_ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - asm("...") will issue -dnl mfence, lfence, or sfence -dnl . HAVE__INTERLOCKEDEXCHANGE - _InterlockedExchange intrinsic is available -dnl (IA64) -dnl . HAVE_GCC_ASM_SPARC_MEMBAR - gcc __asm__ will issue SPARC architecture -dnl memory barrier instruction -dnl . HAVE_SOLARIS_ASM_SPARC_MEMBAR - Solaris asm() will issue SPARC -dnl architecture memory barrier instruction -dnl . HAVE_GCC_ASM_SPARC_STBAR - gcc __asm__ will issue stbar -dnl - HAVE_SOLARIS_ASM_SPARC_STBAR - Solaris __asm() will issue stbar -dnl -dnl D*/ -AC_DEFUN([PAC_C_MEMATOMIC],[ -AC_CACHE_CHECK([for x86 mfence instruction using __asm__], - pac_cv_have_gcc_asm_and_x86_mfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xf0" ::: "memory" ); - exit(0); -} -], -pac_cv_have_gcc_asm_and_x86_mfence=yes,pac_cv_have_gcc_asm_and_x86_mfence=no)]) - -if test "$pac_cv_have_gcc_asm_and_x86_mfence" = "yes" ; then - AC_DEFINE(HAVE_GCC_ASM_AND_X86_MFENCE, 1, [Define if using gcc on a x86 system with the mfence instruction]) -fi - -AC_CACHE_CHECK([for x86 sfence instruction using __asm__], - pac_cv_have_gcc_asm_and_x86_sfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xf8" ::: "memory" ); - exit(0); -} -], -pac_cv_have_gcc_asm_and_x86_sfence=yes,pac_cv_have_gcc_asm_and_x86_sfence=no)]) - -if test "$pac_cv_have_gcc_asm_and_x86_sfence" = "yes" ; then - AC_DEFINE(HAVE_GCC_ASM_AND_X86_SFENCE, 1, [Define if using gcc on a x86 system with the sfence instruction]) -fi - -AC_CACHE_CHECK([for x86 lfence instruction using __asm__], - pac_cv_have_gcc_asm_and_x86_lfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xe8" ::: "memory" ); - exit(0); -} -], -pac_cv_have_gcc_asm_and_x86_lfence=yes,pac_cv_have_gcc_asm_and_x86_lfence=no)]) - -if test "$pac_cv_have_gcc_asm_and_x86_lfence" = "yes" ; then - AC_DEFINE(HAVE_GCC_ASM_AND_X86_LFENCE, 1, [Define if using gcc on a x86 system with the lfence instruction]) -fi - -dnl Some compilers, like icc, may want __asm _emit -AC_CACHE_CHECK([for x86 mfence instruction using __asm], - pac_cv_have___asm_and_x86_mfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm _emit 0x0f __asm _emit 0xae __asm _emit 0xf0 ; - exit(0); -} -], -pac_cv_have___asm_and_x86_mfence=yes,pac_cv_have___asm_and_x86_mfence=no)]) - -if test "$pac_cv_have___asm_and_x86_mfence" = "yes" ; then - AC_DEFINE(HAVE___ASM_AND_X86_MFENCE, 1, [Define if using __asm on a x86 system with the mfence instruction]) -fi - -AC_CACHE_CHECK([for x86 sfence instruction using __asm], - pac_cv_have___asm_and_x86_sfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm sfence ; - exit(0); -} -], -pac_cv_have___asm_and_x86_sfence=yes,pac_cv_have___asm_and_x86_sfence=no)]) - -if test "$pac_cv_have___asm_and_x86_sfence" = "yes" ; then - AC_DEFINE(HAVE___ASM_AND_X86_SFENCE, 1, [Define if using __asm on a x86 system with the sfence instruction]) -fi - -AC_CACHE_CHECK([for x86 lfence instruction using __asm], - pac_cv_have___asm_and_x86_lfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - __asm _emit 0x0f __asm _emit 0xae __asm _emit 0xe8 ; - exit(0); -} -], -pac_cv_have___asm_and_x86_lfence=yes,pac_cv_have___asm_and_x86_lfence=no)]) - -if test "$lac_cv_have___asm_and_x86_lfence" = "yes" ; then - AC_DEFINE(HAVE___ASM_AND_X86_LFENCE, 1, [Define if using __asm on a x86 system with the lfence instruction]) -fi - -dnl -dnl Some compilers, such as pgcc, may require additional arguments. -dnl pgcc may need -Masmkeyword flag. We may want to try this with and -dnl without adding -Masmkeyword to CFLAGS - -AC_CACHE_CHECK([for x86 mfence instruction using asm()], - pac_cv_have_asm_and_x86_mfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - asm("_emit 0x0f __asm _emit 0xae __asm _emit 0xf0"); - exit(0); -} -], -pac_cv_have_asm_and_x86_mfence=yes,pac_cv_have_asm_and_x86_mfence=no)]) - -if test "$pac_cv_have_asm_and_x86_mfence" = "yes" ; then - AC_DEFINE(HAVE_ASM_AND_X86_MFENCE, 1, [Define if using asm() on a x86 system with the mfence instruction]) -fi - -AC_CACHE_CHECK([for x86 sfence instruction using asm()], - pac_cv_have_asm_and_x86_sfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - asm("sfence"); - exit(0); -} -], -pac_cv_have_asm_and_x86_sfence=yes,pac_cv_have_asm_and_x86_sfence=no)]) - -if test "$pac_cv_have_asm_and_x86_sfence" = "yes" ; then - AC_DEFINE(HAVE_ASM_AND_X86_SFENCE, 1, [Define if using asm() on a x86 system with the sfence instruction]) -fi - -AC_CACHE_CHECK([for x86 lfence instruction using asm()], - pac_cv_have_asm_and_x86_lfence,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - asm("_emit 0x0f __asm _emit 0xae __asm _emit 0xe8"); - exit(0); -} -], -pac_cv_have_asm_and_x86_lfence=yes,pac_cv_have_asm_and_x86_lfence=no)]) - -if test "$pac_cv_have_asm_and_x86_lfence" = "yes" ; then - AC_DEFINE(HAVE_ASM_AND_X86_LFENCE, 1, [Define if using asm() on a x86 system with the lfence instruction]) -fi - -AC_CACHE_CHECK([for _InterlockedExchange intrinsic], - pac_cv_have__InterlockedExchange,[ -AC_TRY_RUN([ -int main(int argc, char **argv) -{ - unsigned long lock, *lock_ptr; - lock_ptr = &lock; - _InterlockedExchange(lock_ptr, 1); - exit(0); -} -], -pac_cv_have__InterlockedExchange=yes,pac_cv_have__InterlockedExchange=no)]) - -if test "$pac_cv_have__InterlockedExchange" = "yes" ; then - AC_DEFINE(HAVE__INTERLOCKEDEXCHANGE, 1, [Define if _InterlockedExchange intrinsic is available]) -fi - -AC_CACHE_CHECK([for SPARC membar instruction with gcc], - pac_cv_gcc_sparc_membar,[ -AC_TRY_RUN([ -int main(int argc, char **argv){ - __asm__ __volatile__ ( "membar #StoreLoad | #StoreStore" : : : "memory" ); - exit(0); -}],pac_cv_gcc_sparc_membar=yes,pac_cv_gcc_sparc_membar=no)]) -if test "$pac_cv_gcc_sparc_membar" = yes ; then - AC_DEFINE(HAVE_GCC_ASM_SPARC_MEMBAR,1,[Define if gcc asm membar supported]) -fi - -AC_CACHE_CHECK([for SPARC membar instruction with Solaris C], - pac_cv_solaris_sparc_membar,[ -AC_TRY_RUN([ -int main(int argc, char **argv){ - __asm ( "membar #StoreLoad | #StoreStore"); - exit(0); -}],pac_cv_solaris_sparc_membar=yes,pac_cv_solaris_sparc_membar=no)]) -if test "$pac_cv_solaris_sparc_membar" = yes ; then - AC_DEFINE(HAVE_SOLARIS_ASM_SPARC_MEMBAR,1,[Define if solaris asm membar supported]) -fi - -AC_CACHE_CHECK([for SPARC stbar instruction with gcc], - pac_cv_gcc_sparc_stbar,[ -AC_TRY_RUN([ -int main(int argc, char **argv){ - __asm__ __volatile__ ( "stbar" : : : "memory" ); - exit(0); -}],pac_cv_gcc_sparc_stbar=yes,pac_cv_gcc_sparc_stbar=no)]) -if test "$pac_cv_gcc_sparc_stbar" = yes ; then - AC_DEFINE(HAVE_GCC_ASM_SPARC_STBAR,1,[Define if gcc asm stbar supported]) -fi - -AC_CACHE_CHECK([for SPARC stbar instruction with Solaris C], - pac_cv_solaris_sparc_stbar,[ -AC_TRY_RUN([ -int main(int argc, char **argv){ - __asm ( "stbar" ); - exit(0); -}],pac_cv_solaris_sparc_stbar=yes,pac_cv_solaris_sparc_stbar=no)]) -if test "$pac_cv_solaris_sparc_stbar" = yes ; then - AC_DEFINE(HAVE_SOLARIS_ASM_SPARC_STBAR,1,[Define if solaris asm stbar supported]) -fi -]) \ No newline at end of file diff --git a/3rd-party/romio321/confdb/aclocal_mpi.m4 b/3rd-party/romio321/confdb/aclocal_mpi.m4 deleted file mode 100644 index f0013a9bd1874f16a823f12639cfe853ea95e4d6..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/confdb/aclocal_mpi.m4 +++ /dev/null @@ -1,519 +0,0 @@ -dnl -dnl/*D -dnl PAC_LIB_MPI - Check for MPI library -dnl -dnl Synopsis: -dnl PAC_LIB_MPI([action if found],[action if not found]) -dnl -dnl Output Effect: -dnl -dnl Notes: -dnl Currently, only checks for lib mpi and mpi.h. Later, we will add -dnl MPI_Pcontrol prototype (const int or not?). -dnl -dnl Prerequisites: -dnl autoconf version 2.13 (for AC_SEARCH_LIBS) -dnl D*/ -dnl Other tests to add: -dnl Version of MPI -dnl MPI-2 I/O? -dnl MPI-2 Spawn? -dnl MPI-2 RMA? -dnl PAC_LIB_MPI([found text],[not found text]) -AC_DEFUN([PAC_LIB_MPI],[ -dnl Set the prereq to 2.50 to avoid having -AC_PREREQ(2.50) -if test "X$pac_lib_mpi_is_building" != "Xyes" ; then - # Use CC if TESTCC is defined - if test "X$pac_save_level" != "X" ; then - pac_save_TESTCC="${TESTCC}" - pac_save_TESTCPP="${TESTCPP}" - CC="$pac_save_CC" - if test "X$pac_save_CPP" != "X" ; then - CPP="$pac_save_CPP" - fi - fi - # Look for MPILIB first if it is defined - AC_SEARCH_LIBS(MPI_Init,$MPILIB mpi mpich) - if test "$ac_cv_search_MPI_Init" = "no" ; then - ifelse($2,, - AC_MSG_ERROR([Could not find MPI library]),[$2]) - fi - AC_CHECK_HEADER(mpi.h,pac_have_mpi_h="yes",pac_have_mpi_h="no") - if test $pac_have_mpi_h = "no" ; then - ifelse($2,, - AC_MSG_ERROR([Could not find mpi.h include file]),[$2]) - fi - if test "X$pac_save_level" != "X" ; then - CC="$pac_save_TESTCC" - CPP="$pac_save_TESTCPP" - fi -fi -ifelse($1,,,[$1]) -]) - -dnl This should also set MPIRUN. -dnl -dnl/*D -dnl PAC_ARG_MPI_TYPES - Add command-line switches for different MPI -dnl environments -dnl -dnl Synopsis: -dnl PAC_ARG_MPI_TYPES([default]) -dnl -dnl Output Effects: -dnl Adds the following command line options to configure -dnl+ \-\-with\-mpich[=path] - MPICH. 'path' is the location of MPICH commands -dnl. \-\-with\-ibmmpi - IBM MPI -dnl. \-\-with\-lammpi[=path] - LAM/MPI -dnl. \-\-with\-mpichnt - MPICH NT -dnl- \-\-with\-sgimpi - SGI MPI -dnl If no type is selected, and a default ("mpich", "ibmmpi", or "sgimpi") -dnl is given, that type is used as if '--with-<default>' was given. -dnl -dnl Sets 'CC', 'F77', 'TESTCC', 'TESTF77', and 'MPILIBNAME'. Does `not` -dnl perform an AC_SUBST for these values. -dnl Also sets 'MPIBOOT' and 'MPIUNBOOT'. These are used to specify -dnl programs that may need to be run before and after running MPI programs. -dnl For example, 'MPIBOOT' may start demons necessary to run MPI programs and -dnl 'MPIUNBOOT' will stop those demons. -dnl -dnl The two forms of the compilers are to allow for tests of the compiler -dnl when the MPI version of the compiler creates executables that cannot -dnl be run on the local system (for example, the IBM SP, where executables -dnl created with mpcc will not run locally, but executables created -dnl with xlc may be used to discover properties of the compiler, such as -dnl the size of data types). -dnl -dnl Historical note: -dnl Some common autoconf tests, such as AC_CHECK_SIZEOF, used to require -dnl running a program. But some MPI compilers (often really compilation -dnl scripts) produced programs that could only be run with special commands, -dnl such as a batch submission system. To allow these test programs to be -dnl run, a separate set of compiler variables, TESTCC, TESTF77, etc., -dnl were defined. However, in later versions of autoconf, it both became -dnl unnecessary to run programs for tests such as AC_CHECK_SIZEOF and -dnl it became necessary to define CC etc. before invoking AC_PROG_CC (and -dnl the othe language compilers), because those commands now do much, much -dnl more than just determining the compiler. -dnl -dnl To address the change, we still define the TESTCC etc. compilers where -dnl possible to allow the use of AC_TRY_RUN when required, but we define -dnl the CC etc variables and do not define ac_cv_prog_CC etc., as these -dnl cause autoconf to skip all of the other initialization code that -dnl AC_PROG_CC etc. runs. Note also that this command must occur before -dnl AC_PROG_CC (or anything that might cause AC_PROG_CC to be invoked). -dnl -dnl See also: -dnl PAC_LANG_PUSH_COMPILERS, PAC_LIB_MPI -dnl D*/ -AC_DEFUN([PAC_ARG_MPI_TYPES],[ -# known types -PAC_ARG_MPI_KNOWN_TYPES -# find compilers -PAC_MPI_FIND_COMPILER_SCRIPTS -PAC_MPI_FIND_COMPILERS -# check for MPI library -PAC_MPI_CHECK_MPI_LIB -]) -dnl -dnl To keep autoconf from prematurely invoking the compiler check scripts, -dnl we need a command that first sets the compilers and a separate one -dnl that makes any necessary checks for libraries -dnl -AC_DEFUN([PAC_ARG_MPI_KNOWN_TYPES],[ -AC_ARG_WITH(mpich, -[--with-mpich=path - Assume that we are building with MPICH], -ac_mpi_type=mpich) -# Allow MPICH as well as MPICH -AC_ARG_WITH(mpich, -[--with-mpich=path - Assume that we are building with MPICH], -ac_mpi_type=mpich) -AC_ARG_WITH(lammpi, -[--with-lammpi=path - Assume that we are building with LAM/MPI], -ac_mpi_type=lammpi) -AC_ARG_WITH(ibmmpi, -[--with-ibmmpi - Use the IBM SP implementation of MPI], -ac_mpi_type=ibmmpi) -AC_ARG_WITH(sgimpi, -[--with-sgimpi - Use the SGI implementation of MPI], -ac_mpi_type=sgimpi) -AC_ARG_WITH(mpichnt, -[--with-mpichnt - Use MPICH for Windows NT ], -ac_mpi_type=mpichnt) -AC_ARG_WITH(mpi, -[--with-mpi=path - Use an MPI implementation with compile scripts mpicc - and mpif77 in path/bin],ac_mpi_type=generic) - -if test "X$ac_mpi_type" = "X" ; then - if test "X$1" != "X" ; then - ac_mpi_type=$1 - else - ac_mpi_type=unknown - fi -fi -if test "$ac_mpi_type" = "unknown" -a "$pac_lib_mpi_is_building" = "yes" ; then - ac_mpi_type="mpich" -fi -]) -dnl -dnl Because autoconf insists on moving code to the beginning of -dnl certain definitions, it is *not possible* to define a single command -dnl that selects compilation scripts and also check for other options. -dnl Thus, this needs to be divided into -dnl MPI_FIND_COMPILER_SCRIPTS -dnl which can fail (i.e., not find a script), and -dnl MPI_FIND_COMPILERS -dnl which runs the various PROC_xx for the compilers. -dnl WARNING: this function ignores --program-suffix and --program-prefix. -dnl However, this function is not currently used at all. -AC_DEFUN([PAC_MPI_FIND_COMPILER_SCRIPTS],[ -# Set defaults -MPIRUN_NP="-np " -MPIEXEC_N="-n " -AC_SUBST(MPIRUN_NP) -AC_SUBST(MPIEXEC_N) -dnl -AC_ARG_VAR([MPIEXEC],[Name and path of mpiexec program]) -AC_ARG_VAR([MPIRUN],[Name and path of mpirun program]) -AC_ARG_VAR([MPIBOOT],[Name and path of program to run before mpirun]) -AC_ARG_VAR([MPIUNBOOT],[Name and path of program to run after all mpirun]) -AC_ARG_VAR([MPICC],[Name and absolute path of program used to compile MPI programs in C]) -AC_ARG_VAR([MPIF77],[Name and absolute path of program used to compile MPI programs in F77]) -AC_ARG_VAR([MPICXX],[Name and absolute path of program used to compile MPI programs in C++]) -AC_ARG_VAR([MPIF90],[Name and absolute path of program used to compile MPI programs in F90]) -# -# Check for things that will cause trouble. For example, -# if MPICC is defined but does not contain a / or \, then PATH_PROG will -# ignore the value -if test -n "$MPICC" ; then - case $MPICC in -changequote(<<,>>) - [\\/]* | ?:[\\/]*) -changequote([,]) - # Ok, PATH_PROG will figure it out - ;; - *) - AC_MSG_ERROR([MPICC must be set to an absolute path if it is set]) - esac -fi -if test -n "$MPICXX" ; then - case $MPICXX in -changequote(<<,>>) - [\\/]* | ?:[\\/]*) -changequote([,]) - # Ok, PATH_PROG will figure it out - ;; - *) - AC_MSG_ERROR([MPICXX must be set to an absolute path if it is set]) - esac -fi -if test -n "$MPIF77" ; then - case $MPIF77 in -changequote(<<,>>) - [\\/]* | ?:[\\/]*) -changequote([,]) - # Ok, PATH_PROG will figure it out - ;; - *) - AC_MSG_ERROR([MPIF77 must be set to an absolute path if it is set]) - esac -fi -if test -n "$MPIF90" ; then - case $MPIF90 in -changequote(<<,>>) - [\\/]* | ?:[\\/]*) -changequote([,]) - # Ok, PATH_PROG will figure it out - ;; - *) - AC_MSG_ERROR([MPIF90 must be set to an absolute path if it is set]) - esac -fi - -case $ac_mpi_type in - mpich) - dnl - dnl This isn't correct. It should try to get the underlying compiler - dnl from the mpicc and mpif77 scripts or mpireconfig - if test "X$pac_lib_mpi_is_building" != "Xyes" ; then - PAC_PUSH_FLAG([PATH]) - if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then - # Look for commands; if not found, try adding bin to the - # path - if test ! -x $with_mpich/mpicc -a -x $with_mpich/bin/mpicc ; then - with_mpich="$with_mpich/bin" - fi - PATH=$with_mpich:${PATH} - fi - AC_PATH_PROG(MPICC,mpicc) - if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi - CC="$MPICC" - # Note that autoconf may unconditionally change the value of - # CC (!) in some other command. Thus, we define CCMASTER - CCMASTER=$CC - # Force autoconf to respect this choice - ac_ct_CC=$CC - # to permit configure codes to recover the correct CC. This - # is an ugly not-quite-correct workaround for the fact that - # does not want you to change the C compiler once you have set it - # (But since it does so unconditionally, it silently creates - # bogus output files.) - AC_PATH_PROG(MPIF77,mpif77) - if test -z "$TESTF77" ; then TESTF77=${F77-f77} ; fi - F77="$MPIF77" - AC_PATH_PROG(MPIFC,mpif90) - if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi - FC="$MPIFC" - AC_PATH_PROG(MPICXX,mpiCC) - if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi - CXX="$MPICXX" - # We may want to restrict this to the path containing mpirun - AC_PATH_PROG(MPIEXEC,mpiexec) - AC_PATH_PROG(MPIRUN,mpirun) - AC_PATH_PROG(MPIBOOT,mpichboot) - AC_PATH_PROG(MPIUNBOOT,mpichstop) - PAC_POP_FLAG([PATH]) - MPILIBNAME="mpich" - else - # All of the above should have been passed in the environment! - : - fi - ;; - - mpichnt) - ;; - - lammpi) - dnl - dnl This isn't correct. It should try to get the underlying compiler - dnl from the mpicc and mpif77 scripts or mpireconfig - PAC_PUSH_FLAG([PATH]) - if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then - # Look for commands; if not found, try adding bin to the path - if test ! -x $with_lammpi/mpicc -a -x $with_lammpi/bin/mpicc ; then - with_lammpi="$with_lammpi/bin" - fi - PATH=$with_lammpi:${PATH} - fi - AC_PATH_PROG(MPICC,mpicc) - if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi - CC="$MPICC" - AC_PATH_PROG(MPIF77,mpif77) - if test -z "$TESTCC" ; then TESTF77=${F77-f77} ; fi - F77="$MPIF77" - AC_PATH_PROG(MPIFC,mpif90) - TESTFC=${FC-f90} - if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi - FC="$MPIFC" - AC_PATH_PROG(MPICXX,mpiCC) - if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi - CXX="$MPICXX" - PAC_POP_FLAG([PATH]) - MPILIBNAME="lammpi" - MPIBOOT="lamboot" - MPIUNBOOT="wipe" - MPIRUN="mpirun" - ;; - - ibmmpi) - AC_CHECK_PROGS(MPCC,mpcc) - AC_CHECK_PROGS(MPXLF,mpxlf mpfort) - if test -z "$MPCC" -o -z "$MPXLF" ; then - AC_MSG_ERROR([Could not find IBM MPI compilation scripts. Either mpcc or mpxlf/mpfort is missing]) - fi - if test -z "$TESTCC" ; then TESTCC=${CC-xlC} ; fi - if test -z "$TESTF77" ; then TESTF77=${F77-xlf}; fi - CC=mpcc; F77=$MPXLF - # There is no mpxlf90, but the options langlvl and free can - # select the Fortran 90 version of xlf - if test "$enable_f90" != no ; then - AC_CHECK_PROGS(MPIXLF90,mpxlf90 mpfort) - if test -z "$TESTFC" ; then TESTFC=${FC-xlf90}; fi - if test "X$MPIXLF90" != "X" ; then - FC="$MPIXLF90" - else - FC="$MPXLF -qlanglvl=90ext -qfree=f90" - fi - fi - MPILIBNAME="" - cross_compiling=yes - # Turn off the autoconf version 3 warning message - ac_tool_warned=yes - ;; - - sgimpi) - if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi - if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi - if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi - if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi - # Must check for the MPI library in a separate macro - adding - # a test here will cause autoconf to prematurely define the - # C compiler - MPIRUN=mpirun - MPIBOOT="" - MPIUNBOOT="" - ;; - - generic) - # in $with_mpi/bin or $with_mpi - if test "X$MPICC" = "X" ; then - if test -x "$with_mpi/bin/mpicc" ; then - MPICC=$with_mpi/bin/mpicc - elif test -x "$with_mpi/mpicc" ; then - MPICC=$with_mpi/mpicc - fi - fi - if test "X$MPICXX" = "X" ; then - if test -x "$with_mpi/bin/mpicxx" ; then - MPICXX=$with_mpi/bin/mpicxx - elif test -x "$with_mpi/mpicxx" ; then - MPICXX=$with_mpi/mpicxx - fi - fi - if test "X$MPIF77" = "X" ; then - if test -x "$with_mpi/bin/mpif77" ; then - MPIF77=$with_mpi/bin/mpif77 - elif test -x "$with_mpi/mpif77" ; then - MPIF77=$with_mpi/mpif77 - fi - fi - if test "X$MPIF90" = "X" ; then - if test -x "$with_mpi/bin/mpif90" ; then - MPIF90=$with_mpi/bin/mpif90 - elif test -x "$with_mpi/mpif90" ; then - MPIF90=$with_mpi/mpif90 - fi - fi - if test "X$MPIEXEC" = "X" ; then - if test -x "$with_mpi/bin/mpiexec" ; then - MPIEXEC=$with_mpi/bin/mpiexec - elif test -x "$with_mpi/mpiexec" ; then - MPIEXEC=$with_mpi/mpiexec - fi - fi - CC=$MPICC - F77=$MPIF77 - if test "X$MPICXX" != "X" ; then CXX=$MPICXX ; fi - if test "X$MPIF90" != "X" ; then F90=$MPIF90 ; fi - ;; - - *) - # Use the default choices for the compilers - ;; -esac -]) - -AC_DEFUN([PAC_MPI_FIND_COMPILERS],[ -# Tell autoconf to determine properties of the compilers (these are the -# compilers for MPI programs) -PAC_PROG_CC -if test "$enable_f77" != no -a "$enable_fortran" != no ; then - AC_PROG_F77 -fi -if test "$enable_cxx" != no ; then - AC_PROG_CXX -fi -if test "$enable_f90" != no ; then - PAC_PROG_FC -fi -]) - -dnl -dnl This uses the selected CC etc to check for include paths and libraries -AC_DEFUN([PAC_MPI_CHECK_MPI_LIB],[ -AC_REQUIRE([AC_PROG_CC]) -case $ac_mpi_type in - mpich) - ;; - - mpichnt) - dnl - dnl This isn't adequate, but it helps with using MPICH-NT/SDK.gcc - PAC_PUSH_FLAG([CFLAGS]) - CFLAGS="$CFLAGS -I$with_mpichnt/include" - PAC_PUSH_FLAG([CPPFLAGS]) - CPPFLAGS="$CPPFLAGS -I$with_mpichnt/include" - PAC_PUSH_FLAG([LDFLAGS]) - LDFLAGS="$LDFLAGS -L$with_mpichnt/lib" - AC_CHECK_LIB(mpich,MPI_Init,found="yes",found="no") - if test "$found" = "no" ; then - AC_CHECK_LIB(mpich,MPI_Init,found="yes",found="no") - fi - if test "$enable_cxx" != no ; then - AC_PROG_CXX - fi - if test "$enable_f90" != no ; then - PAC_PROG_FC - fi - # Set defaults for the TEST versions if not already set - if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi - if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi - if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi - if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi - if test "$found" = "no" ; then - PAC_POP_FLAG([CFLAGS]) - PAC_POP_FLAG([CPPFLAGS]) - PAC_POP_FLAG([LDFLAGS]) - fi - ;; - - lammpi) - ;; - - ibmmpi) - ;; - - sgimpi) - AC_CHECK_LIB(mpi,MPI_Init) - if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then - MPILIBNAME="mpi" - fi - ;; - - generic) - AC_SEARCH_LIBS(MPI_Init,mpi mpich mpich) - if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then - MPILIBNAME="mpi" - fi - ;; - - *) - ;; -esac -]) - -dnl -dnl/*D -dnl PAC_MPI_F2C - Determine if MPI has the MPI-2 functions MPI_xxx_f2c and -dnl MPI_xxx_c2f -dnl -dnl Output Effect: -dnl Define 'HAVE_MPI_F2C' if the routines are found. -dnl -dnl Notes: -dnl Looks only for 'MPI_Request_c2f'. -dnl D*/ -AC_DEFUN([PAC_MPI_F2C],[ -AC_CACHE_CHECK([for MPI F2C and C2F routines], -pac_cv_mpi_f2c, -[ -AC_TRY_LINK([#include "mpi.h"], -[MPI_Request request;MPI_Fint a;a = MPI_Request_c2f(request);], -pac_cv_mpi_f2c="yes",pac_cv_mpi_f2c="no") -]) -if test "$pac_cv_mpi_f2c" = "yes" ; then - AC_DEFINE(HAVE_MPI_F2C,1,[Define if MPI has F2C]) -fi -]) -dnl -dnl/*D -dnl PAC_HAVE_ROMIO - make mpi.h include mpio.h if romio enabled -dnl -dnl Output Effect: -dnl expands @HAVE_ROMIO@ in mpi.h into #include "mpio.h" -dnl D*/ -AC_DEFUN([PAC_HAVE_ROMIO],[ -if test "$enable_romio" = "yes" ; then HAVE_ROMIO='#include "mpio.h"'; fi -AC_SUBST(HAVE_ROMIO) -]) diff --git a/3rd-party/romio321/confdb/ax_prefix_config_h.m4 b/3rd-party/romio321/confdb/ax_prefix_config_h.m4 deleted file mode 100644 index 83f8df6f4b714b1df4c2ea5aca8b84dafee607c7..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/confdb/ax_prefix_config_h.m4 +++ /dev/null @@ -1,219 +0,0 @@ -# =========================================================================== -# http://autoconf-archive.cryp.to/ax_prefix_config_h.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])] -# -# DESCRIPTION -# -# This is a new variant from ac_prefix_config_ this one will use a -# lowercase-prefix if the config-define was starting with a -# lowercase-char, e.g. "#define const", "#define restrict", or "#define -# off_t", (and this one can live in another directory, e.g. -# testpkg/config.h therefore I decided to move the output-header to be the -# first arg) -# -# takes the usual config.h generated header file; looks for each of the -# generated "#define SOMEDEF" lines, and prefixes the defined name (ie. -# makes it "#define PREFIX_SOMEDEF". The result is written to the output -# config.header file. The PREFIX is converted to uppercase for the -# conversions. -# -# Defaults: -# -# OUTPUT-HEADER = $PACKAGE-config.h -# PREFIX = $PACKAGE -# ORIG-HEADER, from AM_CONFIG_HEADER(config.h) -# -# Your configure.ac script should contain both macros in this order, and -# unlike the earlier variations of this prefix-macro it is okay to place -# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation. -# -# Example: -# -# AC_INIT(config.h.in) # config.h.in as created by "autoheader" -# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE -# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in -# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it.. -# AC_MEMORY_H # makes "#undef NEED_MEMORY_H" -# AC_C_CONST_H # makes "#undef const" -# AC_OUTPUT(Makefile) # creates the "config.h" now -# # and also mylib/_config.h -# -# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the -# default outputfile would have been called simply "testpkg-config.h", but -# even under the name "mylib/_config.h" it contains prefix-defines like -# -# #ifndef TESTPKG_VERSION -# #define TESTPKG_VERSION "0.1.1" -# #endif -# #ifndef TESTPKG_NEED_MEMORY_H -# #define TESTPKG_NEED_MEMORY_H 1 -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const _const -# #endif -# -# and this "mylib/_config.h" can be installed along with other -# header-files, which is most convenient when creating a shared library -# (that has some headers) where some functionality is dependent on the -# OS-features detected at compile-time. No need to invent some -# "mylib-confdefs.h.in" manually. :-) -# -# Note that some AC_DEFINEs that end up in the config.h file are actually -# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T -# say that they "will define inline|const|off_t if the system does not do -# it by itself". You might want to clean up about these - consider an -# extra mylib/conf.h that reads something like: -# -# #include <mylib/_config.h> -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# and then start using _testpkg_const in the header files. That is also a -# good thing to differentiate whether some library-user has starting to -# take up with a different compiler, so perhaps it could read something -# like this: -# -# #ifdef _MSC_VER -# #include <mylib/_msvc.h> -# #else -# #include <mylib/_config.h> -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# LAST MODIFICATION -# -# 2008-04-12 -# -# COPYLEFT -# -# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> -# Copyright (c) 2008 Marten Svantesson -# Copyright (c) 2008 Gerald Point <Gerald.Point@labri.fr> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Macro Archive. When you make and -# distribute a modified version of the Autoconf Macro, you may extend this -# special exception to the GPL to apply to your modified version as well. - -AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl -AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl -AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl -AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl -AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl -AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl -AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl -AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl -AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl -m4_pushdef([_script],[conftest.prefix])dnl -m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl -_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)` -_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"` -_PKG=`echo ifelse($2, , $PACKAGE, $2)` -_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"` -_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"` -_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'` -if test ".$_INP" = "."; then - for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue - case "$ac_file" in - *.h) _INP=$ac_file ;; - *) - esac - test ".$_INP" != "." && break - done -fi -if test ".$_INP" = "."; then - case "$_OUT" in - */*) _INP=`basename "$_OUT"` - ;; - *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"` - ;; - *) _INP=config.h - ;; - esac -fi -if test -z "$_PKG" ; then - AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H]) -else - if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then - _INP="$srcdir/$_INP" - fi fi - AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines) - if test -f $_INP ; then - echo "s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script - echo "s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script - echo "s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script - echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script - echo "@%:@endif/" >>_script - echo "s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script - echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script - echo "@%:@endif/" >> _script - # now executing _script on _DEF input to create _OUT output file - echo "@%:@ifndef $_DEF" >$tmp/pconfig.h - echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h - - sed -f _script $_INP >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h - echo "@%:@endif" >>$tmp/pconfig.h - if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then - AC_MSG_NOTICE([$_OUT is unchanged]) - else - ac_dir=`AS_DIRNAME(["$_OUT"])` - AS_MKDIR_P(["$ac_dir"]) - rm -f "$_OUT" - mv $tmp/pconfig.h "$_OUT" - fi - cp _script _configs.sed - else - AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT]) - fi - rm -f conftest.* -fi -m4_popdef([_symbol])dnl -m4_popdef([_script])dnl -AS_VAR_POPDEF([_INP])dnl -AS_VAR_POPDEF([_UPP])dnl -AS_VAR_POPDEF([_LOW])dnl -AS_VAR_POPDEF([_PKG])dnl -AS_VAR_POPDEF([_DEF])dnl -AS_VAR_POPDEF([_OUT])dnl -],[PACKAGE="$PACKAGE"])]) - -dnl implementation note: a bug report (31.5.2005) from Marten Svantesson points -dnl out a problem where `echo "\1"` results in a Control-A. The unix standard -dnl http://www.opengroup.org/onlinepubs/000095399/utilities/echo.html -dnl defines all backslash-sequences to be inherently non-portable asking -dnl for replacement mit printf. Some old systems had problems with that -dnl one either. However, the latest libtool (!) release does export an $ECHO -dnl (and $echo) that does the right thing - just one question is left: what -dnl was the first version to have it? Is it greater 2.58 ? diff --git a/3rd-party/romio321/confdb/ax_tls.m4 b/3rd-party/romio321/confdb/ax_tls.m4 deleted file mode 100644 index 3f6a0ac04f4a29542053831671e746d6753aa909..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/confdb/ax_tls.m4 +++ /dev/null @@ -1,90 +0,0 @@ -# =========================================================================== -# http://www.nongnu.org/autoconf-archive/ax_tls.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_TLS -# -# DESCRIPTION -# -# Provides a test for the compiler support of thread local storage (TLS) -# extensions. Defines TLS if it is found. Currently only knows about GCC -# and MSVC. I think SunPro uses the same as GCC, and Borland apparently -# supports either. -# -# LICENSE -# -# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -AC_DEFUN([AX_TLS], [ - AC_MSG_CHECKING(for thread local storage specifier) - AC_CACHE_VAL(ac_cv_tls, [ - ax_tls_keywords="__thread __declspec(thread) none" - for ax_tls_keyword in $ax_tls_keywords; do - case $ax_tls_keyword in - none) ac_cv_tls=none ; break ;; - *) - # MPICH modification: This was an AC_TRY_COMPILE before, but - # Darwin with non-standard compilers will accept __thread at - # compile time but fail to link due to an undefined - # "__emutls_get_address" symbol unless -lgcc_eh is added to the - # link line. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([$ax_tls_keyword int bar = 5;],[++bar;])], - [ac_cv_tls=$ax_tls_keyword], - [ac_cv_tls=none]) - - # MPICH modification: Also test with the extern keyword. - # The intel compiler on Darwin (at least as of 15.0.1) - # seems to break with the above error when the extern - # keyword is specified in shared library builds. - PAC_PUSH_FLAG([LIBS]) - PAC_APPEND_FLAG([-shared],[LIBS]) - if test "$ac_cv_tls" != "none" ; then - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([extern $ax_tls_keyword int bar;],[++bar;])], - [ac_cv_tls=$ax_tls_keyword], - [ac_cv_tls=none]) - fi - PAC_POP_FLAG([LIBS]) - - if test "$ac_cv_tls" != "none" ; then break ; fi - esac - done -]) - - if test "$ac_cv_tls" != "none"; then - # MPICH modification: this was "TLS" before instead of - # "MPICH_TLS_SPECIFIER", but TLS had a reasonably high chance of conflicting - # with a system library. - AC_DEFINE_UNQUOTED([MPICH_TLS_SPECIFIER], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here]) - fi - AC_MSG_RESULT($ac_cv_tls) -]) diff --git a/3rd-party/romio321/doc/users-guide.pdf b/3rd-party/romio321/doc/users-guide.pdf deleted file mode 100644 index 4d060499a959feaa1ae376a97bc5a1c7190ec773..0000000000000000000000000000000000000000 Binary files a/3rd-party/romio321/doc/users-guide.pdf and /dev/null differ diff --git a/3rd-party/romio321/include/ompi_grequestx.h b/3rd-party/romio321/include/ompi_grequestx.h deleted file mode 100644 index 3aae40d8fb5db6bad394cf5d1c33dd49ace3d07d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/include/ompi_grequestx.h +++ /dev/null @@ -1,34 +0,0 @@ -#define HAVE_MPI_GREQUEST_EXTENSIONS 1 - -extern void opal_progress(void); - -typedef int (MPIX_Grequest_poll_function)(void *, MPI_Status *); -typedef int (MPIX_Grequest_wait_function)(int, void **, double, MPI_Status *); -typedef int MPIX_Grequest_class; - -extern int ompi_grequestx_start( - MPI_Grequest_query_function *gquery, - MPI_Grequest_free_function *gfree, - MPI_Grequest_cancel_function *gcancel, - MPIX_Grequest_poll_function *gpoll, - void* gstate, - MPI_Request* request); - -extern int ompi_grequestx_class_create( - MPI_Grequest_query_function *gquery, - MPI_Grequest_free_function *gfree, - MPI_Grequest_cancel_function *gcancel, - MPIX_Grequest_poll_function *gpoll, - MPIX_Grequest_wait_function *gwait, - MPIX_Grequest_class *greq_class); - -extern int ompi_grequestx_class_allocate( - MPIX_Grequest_class greq_class, - void *extra_state, - MPI_Request* request); - -#define MPIR_Ext_cs_yield opal_progress -#define PMPIX_Grequest_class_allocate(greq_class,extra_state,request) ompi_grequestx_class_allocate(greq_class,extra_state,request) -#define PMPIX_Grequest_class_create(query_fn,free_fn,cancel_fn,poll_fn,wait_fn,greq_class) ompi_grequestx_class_create(query_fn,free_fn,cancel_fn,poll_fn,wait_fn,greq_class) -#define PMPIX_Grequest_start(query_fn,free_fn,cancel_fn,poll_fn,extra_state,request) ompi_grequestx_start(query_fn,free_fn,cancel_fn,poll_fn,extra_state,request) - diff --git a/3rd-party/romio321/mpi-io/glue/default/mpio_err.c b/3rd-party/romio321/mpi-io/glue/default/mpio_err.c deleted file mode 100644 index 880de9077a6797a158503119e498df81773142fb..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/glue/default/mpio_err.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" -#include "adio_extern.h" - -#include <stdarg.h> -#include <stdio.h> - -/* Default error handling implementation. - * - * Note that only MPI_ERRORS_ARE_FATAL and MPI_ERRORS_RETURN are - * handled correctly; other handlers cause an abort. - */ - -int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], - int line, int error_class, const char generic_msg[], - const char specific_msg[], ... ) -{ - va_list Argp; - int idx = 0; - char *buf; - - buf = (char *) ADIOI_Malloc(1024); - if (buf != NULL) { - idx += ADIOI_Snprintf(buf, 1023, "%s (line %d): ", fcname, line); - if (specific_msg == NULL) { - ADIOI_Snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg); - } - else { - va_start(Argp, specific_msg); - vsnprintf(&buf[idx], 1023 - idx, specific_msg, Argp); - va_end(Argp); - } - FPRINTF(stderr, "%s", buf); - ADIOI_Free(buf); - } - - return error_class; -} - -int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) -{ - ADIO_File adio_fh; - - if (mpi_fh == MPI_FILE_NULL) - { - if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_ARE_FATAL || - ADIOI_DFLT_ERR_HANDLER != MPI_ERRORS_RETURN) - { - MPI_Abort(MPI_COMM_WORLD, 1); - } - else - { - return error_code; - } - } - - adio_fh = MPIO_File_resolve(mpi_fh); - - if (adio_fh->err_handler == MPI_ERRORS_ARE_FATAL || - adio_fh->err_handler != MPI_ERRORS_RETURN) - { - MPI_Abort(MPI_COMM_WORLD, 1); - } - else - { - return error_code; - } -} - -int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) -{ - MPI_Errhandler errh; - - MPI_Errhandler_get(mpi_comm, &errh); - - if (errh == MPI_ERRORS_ARE_FATAL || - errh != MPI_ERRORS_RETURN) - { - MPI_Abort(mpi_comm, 1); - } - - return error_code; -} diff --git a/3rd-party/romio321/mpi-io/glue/default/mpio_file.c b/3rd-party/romio321/mpi-io/glue/default/mpio_file.c deleted file mode 100644 index 38222f77f28053231ba91302d05f5e082e24f2b0..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/glue/default/mpio_file.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -/* Hooks for allocation of MPI_File handles. - * - * Three functions are used in ROMIO for allocation/deallocation - * of MPI_File structures: - * - MPIO_File_create(size) - * - MPIO_File_resolve(mpi_fh) - * - MPIO_File_free(mpi_fh) - * - */ - -MPI_File MPIO_File_create(int size) -{ - MPI_File mpi_fh; - - mpi_fh = (MPI_File) ADIOI_Calloc(size,1); - return mpi_fh; -} - -ADIO_File MPIO_File_resolve(MPI_File mpi_fh) -{ - return mpi_fh; -} - -void MPIO_File_free(MPI_File *mpi_fh) -{ - ADIOI_Free(*mpi_fh); - *mpi_fh = MPI_FILE_NULL; -} - -extern ADIO_File *ADIOI_Ftable; -extern int ADIOI_Ftable_ptr; -extern int ADIOI_Ftable_max; - -MPI_File MPIO_File_f2c(MPI_Fint fh) -{ -#ifndef INT_LT_POINTER - return (MPI_File) ((void *) fh); - /* the extra cast is to get rid of a compiler warning on Exemplar. - The warning is because MPI_File points to a structure containing - longlongs, which may be 8-byte aligned. But MPI_Fint itself - may not be 8-byte aligned.*/ -#else - if (!fh) return MPI_FILE_NULL; - if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { - FPRINTF(stderr, "MPI_File_f2c: Invalid file handle\n"); - /* there is no way to return an error from MPI_File_f2c */ - return MPI_FILE_NULL; - } - return ADIOI_Ftable[fh]; -#endif -} - -MPI_Fint MPIO_File_c2f(MPI_File fh) -{ -#ifndef INT_LT_POINTER - return (MPI_Fint) fh; -#else - int i; - - if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE)) - return (MPI_Fint) 0; - if (!ADIOI_Ftable) { - ADIOI_Ftable_max = 1024; - ADIOI_Ftable = (MPI_File *) - ADIOI_Malloc(ADIOI_Ftable_max*sizeof(MPI_File)); - ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because - MPI_FILE_NULL=0 */ - for (i=0; i<ADIOI_Ftable_max; i++) ADIOI_Ftable[i] = MPI_FILE_NULL; - } - if (ADIOI_Ftable_ptr == ADIOI_Ftable_max-1) { - ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable, - (ADIOI_Ftable_max+1024)*sizeof(MPI_File)); - for (i=ADIOI_Ftable_max; i<ADIOI_Ftable_max+1024; i++) - ADIOI_Ftable[i] = MPI_FILE_NULL; - ADIOI_Ftable_max += 1024; - } - ADIOI_Ftable_ptr++; - ADIOI_Ftable[ADIOI_Ftable_ptr] = fh; - return (MPI_Fint) ADIOI_Ftable_ptr; -#endif -} diff --git a/3rd-party/romio321/mpi-io/glue/mpich/mpio_err.c b/3rd-party/romio321/mpi-io/glue/mpich/mpio_err.c deleted file mode 100644 index 520ba1ae8058953951820c73202d7cc91d035c4c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/glue/mpich/mpio_err.c +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include <stdarg.h> -#include <stdio.h> - -#include "mpioimpl.h" -#include "adio_extern.h" - -/* MPICH error handling implementation */ -/* FIXME: These external prototypes should be included from - mpich/src/include/mpiext.h */ -int MPIR_Err_create_code_valist(int, int, const char [], int, int, - const char [], const char [], va_list ); -int MPIR_Err_is_fatal(int); - -void MPIR_Get_file_error_routine( MPI_Errhandler, - void (**)(MPI_File *, int *, ...), - int * ); -int MPIR_File_call_cxx_errhandler( MPI_File *, int *, - void (*)(MPI_File *, int *, ... ) ); - -typedef int (* MPIR_Err_get_class_string_func_t)(int error, char *str, int length); -void MPIR_Err_get_string( int, char *, int, MPIR_Err_get_class_string_func_t ); - -struct MPID_Comm; -int MPID_Abort(struct MPID_Comm *comm, int mpi_errno, int exit_code, const char *error_msg); - -int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], - int line, int error_class, const char generic_msg[], - const char specific_msg[], ... ) -{ - va_list Argp; - int error_code; - - va_start(Argp, specific_msg); - - error_code = MPIR_Err_create_code_valist(lastcode, fatal, fcname, line, - error_class, generic_msg, - specific_msg, Argp); - - va_end(Argp); - - return error_code; -} - -int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) -{ - MPI_Errhandler e; - void (*c_errhandler)(MPI_File *, int *, ... ); - int kind; /* Error handler kind (see below) */ - char error_msg[4096]; - int len; - - /* If the file pointer is not valid, we use the handler on - MPI_FILE_NULL (MPI-2, section 9.7). For now, this code assumes that - MPI_FILE_NULL has the default handler (return). FIXME. See - below - the set error handler uses ADIOI_DFLT_ERR_HANDLER; - */ - - /* First, get the handler and the corresponding function */ - if (mpi_fh == MPI_FILE_NULL) { - e = ADIOI_DFLT_ERR_HANDLER; - } - else { - ADIO_File fh; - - fh = MPIO_File_resolve(mpi_fh); - e = fh->err_handler; - } - - /* Actually, e is just the value provide by the MPICH routines - file_set_errhandler. This is actually a *pointer* to the - errhandler structure. We don't know that, so we ask - the MPICH code to translate this object into an error handler. - kind = 0: errors are fatal - kind = 1: errors return - kind = 2: errors call function - */ - if (e == MPI_ERRORS_RETURN || e == MPIR_ERRORS_THROW_EXCEPTIONS || !e) { - /* FIXME: This is a hack in case no error handler was set */ - kind = 1; - c_errhandler = 0; - } - else { - MPIR_Get_file_error_routine( e, &c_errhandler, &kind ); - } - - /* --BEGIN ERROR HANDLING-- */ - if (MPIR_Err_is_fatal(error_code) || kind == 0) - { - ADIOI_Snprintf(error_msg, 4096, "I/O error: "); - len = (int)strlen(error_msg); - MPIR_Err_get_string(error_code, &error_msg[len], 4096-len, NULL); - MPID_Abort(NULL, MPI_SUCCESS, error_code, error_msg); - } - /* --END ERROR HANDLING-- */ - else if (kind == 2) { - (*c_errhandler)( &mpi_fh, &error_code, 0 ); - } - else if (kind == 3) { - MPIR_File_call_cxx_errhandler( &mpi_fh, &error_code, c_errhandler ); - } - - /* kind == 1 just returns */ - return error_code; -} - -int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) -{ - /* note: MPI calls inside the MPICH implementation are prefixed - * with an "N", indicating a nested call. - */ - MPI_Comm_call_errhandler(mpi_comm, error_code); - return error_code; -} diff --git a/3rd-party/romio321/mpi-io/glue/mpich/mpio_file.c b/3rd-party/romio321/mpi-io/glue/mpich/mpio_file.c deleted file mode 100644 index a5e54a7b4bceeca218435a857421e7b8bd46babe..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/glue/mpich/mpio_file.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#include "adio_extern.h" - -/* Hooks for allocation of MPI_File handles. - * - * Three functions are used in ROMIO for allocation/deallocation - * of MPI_File structures: - * - MPIO_File_create(size) - * - MPIO_File_resolve(mpi_fh) - * - MPIO_File_free(mpi_fh) - * - */ - -MPI_File MPIO_File_create(int size) -{ - MPI_File mpi_fh; - - mpi_fh = (MPI_File) ADIOI_Calloc(size,1); - return mpi_fh; -} - -ADIO_File MPIO_File_resolve(MPI_File mpi_fh) -{ - return mpi_fh; -} - -void MPIO_File_free(MPI_File *mpi_fh) -{ - ADIOI_Free(*mpi_fh); - *mpi_fh = MPI_FILE_NULL; -} - -MPI_File MPIO_File_f2c(MPI_Fint fh) -{ -#ifndef INT_LT_POINTER - return (MPI_File) ((void *) fh); - /* the extra cast is to get rid of a compiler warning on Exemplar. - The warning is because MPI_File points to a structure containing - longlongs, which may be 8-byte aligned. But MPI_Fint itself - may not be 8-byte aligned.*/ -#else - if (!fh) return MPI_FILE_NULL; - if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { - /* there is no way to return an error from MPI_File_f2c */ - return MPI_FILE_NULL; - } - return ADIOI_Ftable[fh]; -#endif -} - -MPI_Fint MPIO_File_c2f(MPI_File fh) -{ -#ifndef INT_LT_POINTER - return (MPI_Fint) fh; -#else - int i; - - if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE)) - return (MPI_Fint) 0; - - if (fh->fortran_handle != -1) - return fh->fortran_handle; - - if (!ADIOI_Ftable) { - ADIOI_Ftable_max = 1024; - ADIOI_Ftable = (MPI_File *) - ADIOI_Malloc(ADIOI_Ftable_max*sizeof(MPI_File)); - ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because - MPI_FILE_NULL=0 */ - for (i=0; i<ADIOI_Ftable_max; i++) ADIOI_Ftable[i] = MPI_FILE_NULL; - } - if (ADIOI_Ftable_ptr == ADIOI_Ftable_max-1) { - ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable, - (ADIOI_Ftable_max+1024)*sizeof(MPI_File)); - for (i=ADIOI_Ftable_max; i<ADIOI_Ftable_max+1024; i++) - ADIOI_Ftable[i] = MPI_FILE_NULL; - ADIOI_Ftable_max += 1024; - } - ADIOI_Ftable_ptr++; - ADIOI_Ftable[ADIOI_Ftable_ptr] = fh; - fh->fortran_handle = ADIOI_Ftable_ptr; - return (MPI_Fint) ADIOI_Ftable_ptr; -#endif -} diff --git a/3rd-party/romio321/mpi-io/iotestall.c b/3rd-party/romio321/mpi-io/iotestall.c deleted file mode 100644 index 24dd8b2bc58ae8f98511ed832f123eb874a855c8..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/iotestall.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPIO_Testall = PMPIO_Testall -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPIO_Testall MPIO_Testall -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPIO_Testall as PMPIO_Testall -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* - This is a temporary function until we switch to using MPI-2's generalized - requests. -*/ - -int MPIO_Testall(int count, MPIO_Request requests[], int *flag, - MPI_Status statuses[]) -{ - int done, i, err; - MPID_THREADPRIV_DECL; - - ROMIO_THREAD_CS_ENTER(); - if (count == 1) { - err = MPIO_Test( requests, flag, statuses ); - goto fn_exit; - } - - /* This is actually very difficult to do. We can't use MPIO_Test, - since we must change the requests only if *ALL* requests are complete - */ - /* FIXME: THIS IS NOT CORRECT (see above). But most applications won't - care */ - done = 1; - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], flag, &statuses[i] ); - if (!*flag) done = 0; - if (err) goto fn_exit; - } - else { -#ifdef MPICH - /* need to set empty status */ - if (statuses != MPI_STATUSES_IGNORE) { - statuses[i].MPI_SOURCE = MPI_ANY_SOURCE; - statuses[i].MPI_TAG = MPI_ANY_TAG; - MPIR_STATUS_SET_COUNT(statuses[i], 0); - MPIR_STATUS_SET_CANCEL_BIT(statuses[i], 0); - } -#else - ; -#endif - } - } - - *flag = done; - - err = MPI_SUCCESS; -fn_exit: - ROMIO_THREAD_CS_EXIT(); - return err; -} - diff --git a/3rd-party/romio321/mpi-io/iotestsome.c b/3rd-party/romio321/mpi-io/iotestsome.c deleted file mode 100644 index a7d7d4c949ff682954d77577f20156734a104c83..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/iotestsome.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPIO_Testsome = PMPIO_Testsome -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPIO_Testsome MPIO_Testsome -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPIO_Testsome as PMPIO_Testsome -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* - This is a temporary function until we switch to using MPI-2's generalized - requests. -*/ - -int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount, - int indices[], MPI_Status *statuses) -{ - int i, err; - int flag; - MPID_THREADPRIV_DECL; - - ROMIO_THREAD_CS_ENTER(); - - if (count == 1) { - err = MPIO_Test( requests, &flag, statuses ); - if (!err) { - if (flag) { - indices[0] = 0; - *outcount = 1; - } - else { - *outcount = 0; - } - } - goto fn_exit; - } - - /* Check for no active requests */ - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - break; - } - } - if (i == count) { - *outcount = MPI_UNDEFINED; - err = MPI_SUCCESS; - goto fn_exit; - } - - err = MPI_SUCCESS; - *outcount = 0; - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], &flag, statuses ); - if (flag) { - if (!err) { - indices[0] = i; - indices++; - statuses++; - *outcount = *outcount + 1; - } - } - } - } - -fn_exit: - - ROMIO_THREAD_CS_EXIT(); - return err; -} diff --git a/3rd-party/romio321/mpi-io/iowaitall.c b/3rd-party/romio321/mpi-io/iowaitall.c deleted file mode 100644 index 3e5e5b89da5b949cad29af299935a56307220d47..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/iowaitall.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPIO_Waitall = PMPIO_Waitall -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPIO_Waitall MPIO_Waitall -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPIO_Waitall as PMPIO_Waitall -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* - This is a temporary function until we switch to using MPI-2's generalized - requests. -*/ - -int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] ) -{ - int notdone, i, flag, err; - MPID_THREADPRIV_DECL; - - ROMIO_THREAD_CS_ENTER(); - - if (count == 1) { - err = MPIO_Wait(requests, statuses); - goto fn_exit; - } - - - do { - notdone = 0; - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], &flag, &statuses[i] ); - if (!flag) notdone = 1; - if (err) goto fn_exit; - } - else { -#ifdef MPICH - /* need to set empty status */ - if (statuses != MPI_STATUSES_IGNORE) { - statuses[i].MPI_SOURCE = MPI_ANY_SOURCE; - statuses[i].MPI_TAG = MPI_ANY_TAG; - MPIR_STATUS_SET_COUNT(statuses[i], 0); - MPIR_STATUS_SET_CANCEL_BIT(statuses[i], 0); - } -#else - ; -#endif - } - } - } while (notdone); - - err = MPI_SUCCESS; -fn_exit: - - ROMIO_THREAD_CS_EXIT(); - return err; -} - diff --git a/3rd-party/romio321/mpi-io/iowaitany.c b/3rd-party/romio321/mpi-io/iowaitany.c deleted file mode 100644 index 747aa5bc48fc39d6c6ab0fd867e36b87fd3d6af4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/iowaitany.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPIO_Waitany = PMPIO_Waitany -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPIO_Waitany MPIO_Waitany -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPIO_Waitany as PMPIO_Waitany -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* - This is a temporary function until we switch to using MPI-2's generalized - requests. -*/ - -int MPIO_Waitany(int count, MPIO_Request requests[], int *index, - MPI_Status *status) -{ - int i, flag, err; - MPID_THREADPRIV_DECL; - - ROMIO_THREAD_CS_ENTER(); - - if (count == 1) { - err = MPIO_Wait( requests, status ); - if (!err) *index = 0; - goto fn_exit; - } - - /* Check for no active requests */ - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - break; - } - } - if (i == count) { - *index = MPI_UNDEFINED; -#ifdef MPICH - /* need to set empty status */ - if (status != MPI_STATUS_IGNORE) { - status->MPI_SOURCE = MPI_ANY_SOURCE; - status->MPI_TAG = MPI_ANY_TAG; - MPIR_STATUS_SET_COUNT(*status, 0); - MPIR_STATUS_SET_CANCEL_BIT(*status, 0); - } -#endif - err = MPI_SUCCESS; - goto fn_exit; - } - - err = MPI_SUCCESS; - do { - flag = 0; - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], &flag, status ); - if (flag) { - if (!err) *index = i; - break; - } - } - } - } while (flag == 0); - -fn_exit: - ROMIO_THREAD_CS_EXIT(); - - return err; -} diff --git a/3rd-party/romio321/mpi-io/iowaitsome.c b/3rd-party/romio321/mpi-io/iowaitsome.c deleted file mode 100644 index 1bca9c661be83e7958d9175ce599a090bd29867a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/iowaitsome.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPIO_Waitsome = PMPIO_Waitsome -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPIO_Waitsome MPIO_Waitsome -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPIO_Waitsome as PMPIO_Waitsome -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* - This is a temporary function until we switch to using MPI-2's generalized - requests. -*/ - -int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount, - int indices[], MPI_Status *statuses) -{ - int i, flag, err; - MPID_THREADPRIV_DECL; - - ROMIO_THREAD_CS_ENTER(); - - if (count == 1) { - err = MPIO_Wait( requests, statuses ); - if (!err) { - *outcount = 1; - indices[0] = 0; - } - goto fn_exit; - } - - /* Check for no active requests */ - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - break; - } - } - if (i == count) { - *outcount = MPI_UNDEFINED; - err = MPI_SUCCESS; - goto fn_exit; - } - - err = MPI_SUCCESS; - *outcount = 0; - do { - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], &flag, statuses ); - if (flag) { - if (!err) { - indices[0] = i; - indices++; - statuses++; - *outcount = *outcount + 1; - } - } - } - } - } while (*outcount == 0); - -fn_exit: - ROMIO_THREAD_CS_EXIT(); - return err; -} diff --git a/3rd-party/romio321/mpi-io/mpir-mpioinit.c b/3rd-party/romio321/mpi-io/mpir-mpioinit.c deleted file mode 100644 index 90a2739a210be2f78a45649fcd883823001bedbe..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/mpir-mpioinit.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2009 UChicago/Argonne LLC - * See COPYRIGHT in top-level directory. - */ -#include "mpioimpl.h" -#include <string.h> - -#ifdef HAVE_WEAK_SYMBOLS -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -extern int ADIO_Init_keyval; - -/* common code to stuff an attribute on a communicator for the purpose of - * cleaning up in MPI_Finalize() */ - -void MPIR_MPIOInit(int * error_code) { - - int flag; - char myname[] = "MPIR_MPIOInit"; - - /* first check if ADIO has been initialized. If not, initialize it */ - if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) { - MPI_Initialized(&flag); - - /* --BEGIN ERROR HANDLING-- */ - if (!flag) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_OTHER, "**initialized", 0); - *error_code = MPIO_Err_return_file(MPI_FILE_NULL, *error_code); - return; - } - /* --END ERROR HANDLING-- */ - - MPI_Comm_create_keyval (MPI_COMM_NULL_COPY_FN, ADIOI_End_call, &ADIO_Init_keyval, - (void *) 0); - - /* put a dummy attribute on MPI_COMM_SELF, because we want the delete - function to be called when MPI_COMM_SELF is freed. Clarified - in MPI-2 section 4.8, the standard mandates that attributes on - MPI_COMM_SELF get cleaned up early in MPI_Finalize */ - - MPI_Comm_set_attr (MPI_COMM_SELF, ADIO_Init_keyval, (void *) 0); - - /* initialize ADIO */ - ADIO_Init( (int *)0, (char ***)0, error_code); - } - *error_code = MPI_SUCCESS; -} -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/mpi-io/seek.c b/3rd-party/romio321/mpi-io/seek.c deleted file mode 100644 index c68394a18a8ae3d53674cddfa5d502b6dce1490c..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/seek.c +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" -#include "adioi.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_seek = PMPI_File_seek -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_seek MPI_File_seek -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_seek as PMPI_File_seek -/* end of weak pragmas */ -#elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) __attribute__((weak,alias("PMPI_File_seek"))); -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_seek - Updates the individual file pointer - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (integer) -. whence - update mode (state) - -.N fortran -@*/ -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) -{ - int error_code; - ADIO_File adio_fh; - static char myname[] = "MPI_FILE_SEEK"; - MPI_Offset curr_offset, eof_offset; - -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILESEEK, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); -#endif /* MPI_hpux */ - - ROMIO_THREAD_CS_ENTER(); - - adio_fh = MPIO_File_resolve(fh); - - /* --BEGIN ERROR HANDLING-- */ - MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); - /* --END ERROR HANDLING-- */ - - switch(whence) { - case MPI_SEEK_SET: - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - break; - case MPI_SEEK_CUR: - /* find offset corr. to current location of file pointer */ - ADIOI_Get_position(adio_fh, &curr_offset); - offset += curr_offset; - - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_ARG, - "**ionegoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - break; - case MPI_SEEK_END: - /* we can in many cases do seeks w/o a file actually opened, but not in - * the MPI_SEEK_END case */ - ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_seek", &error_code); - - /* find offset corr. to end of file */ - ADIOI_Get_eof_offset(adio_fh, &eof_offset); - offset += eof_offset; - - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_ARG, - "**ionegoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - break; - default: - /* --BEGIN ERROR HANDLING-- */ - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadwhence", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - /* --END ERROR HANDLING-- */ - } - - ADIO_SeekIndividual(adio_fh, offset, ADIO_SEEK_SET, &error_code); - /* TODO: what do we do with this error? */ - - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); - /* --END ERROR HANDLING-- */ - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); -#endif /* MPI_hpux */ - - error_code = MPI_SUCCESS; - -fn_exit: - ROMIO_THREAD_CS_EXIT(); - return error_code; -} diff --git a/3rd-party/romio321/mpi-io/seek_sh.c b/3rd-party/romio321/mpi-io/seek_sh.c deleted file mode 100644 index d3ce1ab8aa998c6a13296e993c0966945f14bc2a..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/seek_sh.c +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_seek_shared = PMPI_File_seek_shared -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_seek_shared MPI_File_seek_shared -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_seek_shared as PMPI_File_seek_shared -/* end of weak pragmas */ -#elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) __attribute__((weak,alias("PMPI_File_seek_shared"))); -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_seek_shared - Updates the shared file pointer - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (integer) -. whence - update mode (state) - -.N fortran -@*/ -int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) -{ - int error_code=MPI_SUCCESS, tmp_whence, myrank; - static char myname[] = "MPI_FILE_SEEK_SHARED"; - MPI_Offset curr_offset, eof_offset, tmp_offset; - ADIO_File adio_fh; - - ROMIO_THREAD_CS_ENTER(); - - adio_fh = MPIO_File_resolve(fh); - - /* --BEGIN ERROR HANDLING-- */ - MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); - MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code); - /* --END ERROR HANDLING-- */ - - tmp_offset = offset; - MPI_Bcast(&tmp_offset, 1, ADIO_OFFSET, 0, adio_fh->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_offset != offset) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**notsame", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - tmp_whence = whence; - MPI_Bcast(&tmp_whence, 1, MPI_INT, 0, adio_fh->comm); - /* --BEGIN ERROR HANDLING-- */ - if (tmp_whence != whence) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadwhence", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_seek_shared", &error_code); - - MPI_Comm_rank(adio_fh->comm, &myrank); - - if (!myrank) - { - switch(whence) - { - case MPI_SEEK_SET: - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - break; - case MPI_SEEK_CUR: - /* get current location of shared file pointer */ - ADIO_Get_shared_fp(adio_fh, 0, &curr_offset, &error_code); - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_FATAL, - myname, __LINE__, - MPI_ERR_INTERN, - "**iosharedfailed", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - offset += curr_offset; - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**ionegoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - break; - case MPI_SEEK_END: - /* find offset corr. to end of file */ - ADIOI_Get_eof_offset(adio_fh, &eof_offset); - offset += eof_offset; - /* --BEGIN ERROR HANDLING-- */ - if (offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**ionegoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - break; - default: - /* --BEGIN ERROR HANDLING-- */ - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadwhence", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - /* --END ERROR HANDLING-- */ - } - - ADIO_Set_shared_fp(adio_fh, offset, &error_code); - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_FATAL, - myname, __LINE__, - MPI_ERR_INTERN, - "**iosharedfailed", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - } - - /* FIXME: explain why the barrier is necessary */ - MPI_Barrier(adio_fh->comm); - - error_code = MPI_SUCCESS; - -fn_exit: - ROMIO_THREAD_CS_EXIT(); - - return error_code; -} diff --git a/3rd-party/romio321/mpi-io/set_view.c b/3rd-party/romio321/mpi-io/set_view.c deleted file mode 100644 index 4d98fdd184442dc516443a22bb0e42265a069054..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi-io/set_view.c +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_set_view = PMPI_File_set_view -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_set_view MPI_File_set_view -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_set_view as PMPI_File_set_view -/* end of weak pragmas */ -#elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, - const char *datarep, MPI_Info info) __attribute__((weak,alias("PMPI_File_set_view"))); -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_set_view - Sets the file view - -Input Parameters: -. fh - file handle (handle) -. disp - displacement (nonnegative integer) -. etype - elementary datatype (handle) -. filetype - filetype (handle) -. datarep - data representation (string) -. info - info object (handle) - -.N fortran -@*/ -int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, ROMIO_CONST char *datarep, MPI_Info info) -{ - int error_code; - MPI_Count filetype_size, etype_size; - static char myname[] = "MPI_FILE_SET_VIEW"; - ADIO_Offset shared_fp, byte_off; - ADIO_File adio_fh; - - ROMIO_THREAD_CS_ENTER(); - - adio_fh = MPIO_File_resolve(fh); - - /* --BEGIN ERROR HANDLING-- */ - MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - - if ((disp < 0) && (disp != MPI_DISPLACEMENT_CURRENT)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobaddisp", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - - /* rudimentary checks for incorrect etype/filetype.*/ - if (etype == MPI_DATATYPE_NULL) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**ioetype", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - MPIO_DATATYPE_ISCOMMITTED(etype, error_code); - if (error_code != MPI_SUCCESS) { - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - - if (filetype == MPI_DATATYPE_NULL) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iofiletype", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - MPIO_DATATYPE_ISCOMMITTED(filetype, error_code); - if (error_code != MPI_SUCCESS) { - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - - if ((adio_fh->access_mode & MPI_MODE_SEQUENTIAL) && - (disp != MPI_DISPLACEMENT_CURRENT)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iodispifseq", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - - if ((disp == MPI_DISPLACEMENT_CURRENT) && - !(adio_fh->access_mode & MPI_MODE_SEQUENTIAL)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iodispifseq", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - MPIO_CHECK_INFO_ALL(info, error_code, adio_fh->comm); - /* --END ERROR HANDLING-- */ - - MPI_Type_size_x(filetype, &filetype_size); - MPI_Type_size_x(etype, &etype_size); - - /* --BEGIN ERROR HANDLING-- */ - if (etype_size != 0 && filetype_size % etype_size != 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iofiletype", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - - if ((datarep == NULL) || (strcmp(datarep, "native") && - strcmp(datarep, "NATIVE") && - strcmp(datarep, "external32") && - strcmp(datarep, "EXTERNAL32") && - strcmp(datarep, "internal") && - strcmp(datarep, "INTERNAL")) ) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNSUPPORTED_DATAREP, - "**unsupporteddatarep",0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - if (disp == MPI_DISPLACEMENT_CURRENT) { - MPI_Barrier(adio_fh->comm); - ADIO_Get_shared_fp(adio_fh, 0, &shared_fp, &error_code); - /* TODO: check error code */ - - MPI_Barrier(adio_fh->comm); - ADIOI_Get_byte_offset(adio_fh, shared_fp, &byte_off); - /* TODO: check error code */ - - disp = byte_off; - } - - ADIO_Set_view(adio_fh, disp, etype, filetype, info, &error_code); - - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) { - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ - - /* reset shared file pointer to zero */ - if (ADIO_Feature(adio_fh, ADIO_SHARED_FP) && - (adio_fh->shared_fp_fd != ADIO_FILE_NULL)) - { - /* only one process needs to set it to zero, but I don't want to - create the shared-file-pointer file if shared file pointers have - not been used so far. Therefore, every process that has already - opened the shared-file-pointer file sets the shared file pointer - to zero. If the file was not opened, the value is automatically - zero. Note that shared file pointer is stored as no. of etypes - relative to the current view, whereas indiv. file pointer is - stored in bytes. */ - - ADIO_Set_shared_fp(adio_fh, 0, &error_code); - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); - /* --END ERROR HANDLING-- */ - } - - if (ADIO_Feature(adio_fh, ADIO_SHARED_FP)) - { - MPI_Barrier(adio_fh->comm); /* for above to work correctly */ - } - if (strcmp(datarep, "external32") && strcmp(datarep, "EXTERNAL32")) - adio_fh->is_external32 = 0; - else - adio_fh->is_external32 = 1; - -fn_exit: - ROMIO_THREAD_CS_EXIT(); - - return error_code; -fn_fail: - /* --BEGIN ERROR HANDLING-- */ - error_code = MPIO_Err_return_file(fh, error_code); - goto fn_exit; - /* --END ERROR HANDLING-- */ -} diff --git a/3rd-party/romio321/mpi2-other/array/Makefile.in b/3rd-party/romio321/mpi2-other/array/Makefile.in deleted file mode 100644 index 41a366e398b090502d44010a7f2fbcf849506e3b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/array/Makefile.in +++ /dev/null @@ -1,80 +0,0 @@ -CC = @CC@ -AR = @AR@ -LIBNAME = @LIBNAME@ -RANLIB = @RANLIB@ -srcdir = @srcdir@ -CC_SHL = @CC_SHL@ -SHLIBNAME = @SHLIBNAME@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../include -I${srcdir}/../../mpi-io -I${srcdir}/../../adio/include -I../../adio/include -CFLAGS = @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) - -top_builddir = @master_topbuild_dir@ -LIBTOOL = @LIBTOOL@ -C_COMPILE_SHL = $(CC_SHL) - -@VPATH@ - -MPIO_OBJECTS = subarray.o darray.o - -MPIO_TMP_POBJECTS = subarray.p darray.p - -MPIO_REAL_POBJECTS = _subarray.o _darray.o - -all: $(LIBNAME) - @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ - $(MAKE) $(SHLIBNAME).la ;\ - fi - -.SUFFIXES: $(SUFFIXES) .p .sp .lo - -.c.o: - $(CC) $(CFLAGS) -c $< -.c.lo: - $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o - @mv -f _s$*.o $*.lo - -.c.p: - @cp $(srcdir)/$*.c _$*.c - $(CC) $(CFLAGS) -c _$*.c - @rm -f _$*.c - -.c.sp: - $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _$*.lo - -profile: $(MPIO_REAL_POBJECTS) - $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) - $(RANLIB) $(LIBNAME) - @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ - $(MAKE) P$(SHLIBNAME).la ;\ - fi - @rm -f _*.o - -$(LIBNAME): $(MPIO_OBJECTS) - $(AR) $(LIBNAME) $(MPIO_OBJECTS) - $(RANLIB) $(LIBNAME) - -MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) -$(SHLIBNAME).la: $(MPIO_LOOBJECTS) - $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) - -# -------------------------------------------------------------------------- -# We use P$(SHLBNAME) simply to distinguish the regular lib build from the -# profiling library build -MPIO_LOPOBJECTS = $(MPIO_REAL_POBJECTS:.o=.lo) -MPIO_TMP_LOPOBJECTS = ${MPIO_TMP_POBJECTS:.p=.sp} -P$(SHLIBNAME).la: $(MPIO_TMP_LOPOBJECTS) - $(AR) $(SHLIBNAME).la $(MPIO_LOPOBJECTS) -# -------------------------------------------------------------------------- - -clean: - @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg - @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda - @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg - -# Rules for the profiling objects -_subarray.o: subarray.c - $(CC) $(CFLAGS) -c $(srcdir)/subarray.c -o _subarray.o -_darray.o: darray.c - $(CC) $(CFLAGS) -c $(srcdir)/darray.c -o _darray.o - diff --git a/3rd-party/romio321/mpi2-other/array/darray.c b/3rd-party/romio321/mpi2-other/array/darray.c deleted file mode 100644 index 17ee2a1fce68576dfe2d8e14edf57c5ffb27efea..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/array/darray.c +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_Type_create_darray = PMPI_Type_create_darray -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_Type_create_darray MPI_Type_create_darray -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_Type_create_darray as PMPI_Type_create_darray -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ -MPI_Type_create_darray - Creates a datatype corresponding to a distributed, multidimensional array - -Input Parameters: -. size - size of process group (positive integer) -. rank - rank in process group (nonnegative integer) -. ndims - number of array dimensions as well as process grid dimensions (positive integer) -. array_of_gsizes - number of elements of type oldtype in each dimension of global array (array of positive integers) -. array_of_distribs - distribution of array in each dimension (array of state) -. array_of_dargs - distribution argument in each dimension (array of positive integers) -. array_of_psizes - size of process grid in each dimension (array of positive integers) -. order - array storage order flag (state) -. oldtype - old datatype (handle) - -Output Parameters: -. newtype - new datatype (handle) - -.N fortran -@*/ -int MPI_Type_create_darray(int size, int rank, int ndims, - int *array_of_gsizes, int *array_of_distribs, - int *array_of_dargs, int *array_of_psizes, - int order, MPI_Datatype oldtype, - MPI_Datatype *newtype) -{ - int err, error_code; - int i; - MPI_Aint orig_extent, orig_lb, size_with_aint; - MPI_Offset size_with_offset; - static char myname[] = "MPI_TYPE_CREATE_DARRAY"; - - /* --BEGIN ERROR HANDLING-- */ - if (size <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid size argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (rank < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid rank argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (ndims <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid ndoms argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_gsizes <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_gsizes argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_distribs <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_distribs argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_dargs <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_dargs argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_psizes <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_psizes argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - for (i=0; i<ndims; i++) { - if (array_of_gsizes[i] <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS,MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid gsize argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - /* array_of_distribs checked below */ - - if ((array_of_dargs[i] != MPI_DISTRIBUTE_DFLT_DARG) && - (array_of_dargs[i] <= 0)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid darg argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - if (array_of_psizes[i] <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid psize argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_distribs[i] != MPI_DISTRIBUTE_BLOCK && - array_of_distribs[i] != MPI_DISTRIBUTE_CYCLIC && - array_of_distribs[i] != MPI_DISTRIBUTE_NONE) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "Invalid distrib argument", - 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_distribs[i] == MPI_DISTRIBUTE_NONE && - array_of_psizes[i] != 1) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "For MPI_DISTRIBUTE_NONE, the number of processes in that dimension of the grid must be 1", - 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - } - - /* order argument checked below */ - - if (oldtype == MPI_DATATYPE_NULL) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid type argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - MPI_Type_get_extent(oldtype, &orig_lb, &orig_extent); - -/* check if MPI_Aint is large enough for size of global array. - if not, complain. */ - - size_with_aint = orig_extent; - for (i=0; i<ndims; i++) size_with_aint *= array_of_gsizes[i]; - size_with_offset = orig_extent; - for (i=0; i<ndims; i++) size_with_offset *= array_of_gsizes[i]; - - if (size_with_aint != size_with_offset) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array size", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid order argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - /* --END ERROR HANDLING-- */ - - err = ADIO_Type_create_darray(size, - rank, - ndims, - array_of_gsizes, - array_of_distribs, - array_of_dargs, - array_of_psizes, - order, - oldtype, - newtype); - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, err, - "Internal error", 0); - } - /* --END ERROR HANDLING-- */ - - return MPI_SUCCESS; -} - diff --git a/3rd-party/romio321/mpi2-other/array/fortran/Makefile.in b/3rd-party/romio321/mpi2-other/array/fortran/Makefile.in deleted file mode 100644 index 63c8fe5e02a3f9c1197cbe595af772ae11bdcb15..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/array/fortran/Makefile.in +++ /dev/null @@ -1,48 +0,0 @@ -CC = @CC@ -AR = @AR@ -RANLIB = @RANLIB@ -LIBNAME = @LIBNAME@ -srcdir = @srcdir@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../mpi-io -I${srcdir}/../../../adio/include -I../../../adio/include -CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) - -@VPATH@ - -MPIO_FOBJECTS = subarrayf.o darrayf.o - -MPIO_TMP_PFOBJECTS = subarrayf.p darrayf.p - -MPIO_REAL_PFOBJECTS = _subarrayf.o _darrayf.o - -all: $(LIBNAME) - -.SUFFIXES: $(SUFFIXES) .p - -.c.o: - $(CC) $(CFLAGS) -c $< - -.c.p: - @cp $(srcdir)/$*.c _$*.c - $(CC) $(CFLAGS) -c _$*.c - @rm -f _$*.c - -profile: $(MPIO_REAL_PFOBJECTS) - $(AR) $(LIBNAME) $(MPIO_REAL_PFOBJECTS) - $(RANLIB) $(LIBNAME) - @rm -f _*.o - -$(LIBNAME): $(MPIO_FOBJECTS) - $(AR) $(LIBNAME) $(MPIO_FOBJECTS) - $(RANLIB) $(LIBNAME) - -clean: - @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg - @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda - @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg - -# Rules for the profiling objects -_subarrayf.o: subarrayf.c - $(CC) $(CFLAGS) -c $(srcdir)/subarrayf.c -o _subarrayf.o -_darrayf.o: darrayf.c - $(CC) $(CFLAGS) -c $(srcdir)/darrayf.c -o _darrayf.o diff --git a/3rd-party/romio321/mpi2-other/array/fortran/darrayf.c b/3rd-party/romio321/mpi2-other/array/fortran/darrayf.c deleted file mode 100644 index 7a16bbb3cc8556c0245b0383db77f3a38d2a6185..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/array/fortran/darrayf.c +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "mpio.h" - -#if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS) - -#if defined(HAVE_WEAK_SYMBOLS) -#if defined(HAVE_PRAGMA_WEAK) -#if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_DARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); -#pragma weak MPI_TYPE_CREATE_DARRAY = PMPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_type_create_darray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); -#pragma weak mpi_type_create_darray__ = pmpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_type_create_darray(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); -#pragma weak mpi_type_create_darray = pmpi_type_create_darray -#else -extern FORTRAN_API void FORT_CALL mpi_type_create_darray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); -#pragma weak mpi_type_create_darray_ = pmpi_type_create_darray_ -#endif - -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#if defined(FORTRANCAPS) -#pragma _HP_SECONDARY_DEF PMPI_TYPE_CREATE_DARRAY MPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray__ mpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray mpi_type_create_darray -#else -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ mpi_type_create_darray_ -#endif - -#elif defined(HAVE_PRAGMA_CRI_DUP) -#if defined(FORTRANCAPS) -#pragma _CRI duplicate MPI_TYPE_CREATE_DARRAY as PMPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#pragma _CRI duplicate mpi_type_create_darray__ as pmpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -#pragma _CRI duplicate mpi_type_create_darray as pmpi_type_create_darray -#else -#pragma _CRI duplicate mpi_type_create_darray_ as pmpi_type_create_darray_ -#endif - -/* end of weak pragmas */ -#endif -/* Include mapping from MPI->PMPI */ -#include "mpioprof.h" -#endif - -#ifdef FORTRANCAPS -#define mpi_type_create_darray_ PMPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#define mpi_type_create_darray_ pmpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray pmpi_type_create_darray_ -#endif -#define mpi_type_create_darray_ pmpi_type_create_darray -#else -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ pmpi_type_create_darray -#endif -#define mpi_type_create_darray_ pmpi_type_create_darray_ -#endif - -#else - -#ifdef FORTRANCAPS -#define mpi_type_create_darray_ MPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#define mpi_type_create_darray_ mpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF mpi_type_create_darray mpi_type_create_darray_ -#endif -#define mpi_type_create_darray_ mpi_type_create_darray -#else -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF mpi_type_create_darray_ mpi_type_create_darray -#endif -#endif -#endif - -#ifdef MPIHP -/* Prototype to keep compiler happy */ -void mpi_type_create_darray_(int *size,int *rank,int *ndims, - int *array_of_gsizes,int *array_of_distribs, - int *array_of_dargs,int *array_of_psizes, - int *order, MPI_Fint *oldtype, - MPI_Fint *newtype, int *ierr ); - -void mpi_type_create_darray_(int *size,int *rank,int *ndims, - int *array_of_gsizes,int *array_of_distribs, - int *array_of_dargs,int *array_of_psizes, - int *order, MPI_Fint *oldtype, - MPI_Fint *newtype, int *ierr ) -{ - MPI_Datatype oldtype_c, newtype_c; - - oldtype_c = MPI_Type_f2c(*oldtype); - - *ierr = MPI_Type_create_darray(*size,*rank,*ndims,array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,*order,oldtype_c,&newtype_c); - - *newtype = MPI_Type_c2f(newtype_c); -} - -#else -/* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL void mpi_type_create_darray_(MPI_Fint *size,MPI_Fint *rank,MPI_Fint *ndims, - MPI_Fint *array_of_gsizes,MPI_Fint *array_of_distribs, - MPI_Fint *array_of_dargs,MPI_Fint *array_of_psizes, - MPI_Fint *order,MPI_Fint *oldtype, - MPI_Fint *newtype, MPI_Fint *ierr); - -FORTRAN_API void FORT_CALL void mpi_type_create_darray_(MPI_Fint *size,MPI_Fint *rank,MPI_Fint *ndims, - MPI_Fint *array_of_gsizes,MPI_Fint *array_of_distribs, - MPI_Fint *array_of_dargs,MPI_Fint *array_of_psizes, - MPI_Fint *order,MPI_Fint *oldtype, - MPI_Fint *newtype, MPI_Fint *ierr ) -{ - *ierr = MPI_Type_create_darray(*size,*rank,*ndims,array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,*order,*oldtype,newtype); -} -#endif diff --git a/3rd-party/romio321/mpi2-other/array/subarray.c b/3rd-party/romio321/mpi2-other/array/subarray.c deleted file mode 100644 index 006abce19c8fde2572c880f4e69a02ce86c5eb8f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/array/subarray.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_Type_create_subarray = PMPI_Type_create_subarray -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_Type_create_subarray MPI_Type_create_subarray -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_Type_create_subarray as PMPI_Type_create_subarray -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ -MPI_Type_create_subarray - Creates a datatype describing a subarray of a multidimensional array - -Input Parameters: -. ndims - number of array dimensions (positive integer) -. array_of_sizes - number of elements of type oldtype in each dimension of the full array (array of positive integers) -. array_of_subsizes - number of elements of type oldtype in each dimension of the subarray (array of positive integers) -. array_of_starts - starting coordinates of the subarray in each dimension (array of nonnegative integers) -. order - array storage order flag (state) -. oldtype - old datatype (handle) - -Output Parameters: -. newtype - new datatype (handle) - -.N fortran -@*/ -int MPI_Type_create_subarray(int ndims, int *array_of_sizes, - int *array_of_subsizes, int *array_of_starts, - int order, MPI_Datatype oldtype, - MPI_Datatype *newtype) -{ - MPI_Aint extent, lb, size_with_aint; - int i, err, error_code; - MPI_Offset size_with_offset; - - /* --BEGIN ERROR HANDLING-- */ - if (ndims <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid ndims argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_sizes <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_sizes argument", - 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_subsizes <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_subsizes argument", - 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_starts <= (int *) 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid array_of_starts argument", - 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - for (i=0; i<ndims; i++) { - if (array_of_sizes[i] <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid size argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_subsizes[i] <= 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid subsize argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_starts[i] < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid start argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_subsizes[i] > array_of_sizes[i]) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid subsize argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - if (array_of_starts[i] > (array_of_sizes[i] - array_of_subsizes[i])) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid start argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - } - - /* order argument checked below */ - - if (oldtype == MPI_DATATYPE_NULL) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid type argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - MPI_Type_get_extent(oldtype, &lb, &extent); - -/* check if MPI_Aint is large enough for size of global array. - if not, complain. */ - - size_with_aint = extent; - for (i=0; i<ndims; i++) size_with_aint *= array_of_sizes[i]; - size_with_offset = extent; - for (i=0; i<ndims; i++) size_with_offset *= array_of_sizes[i]; - if (size_with_aint != size_with_offset) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid size argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - - if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "Invalid order argument", 0); - return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); - } - /* --END ERROR HANDLING-- */ - - err = ADIO_Type_create_subarray(ndims, - array_of_sizes, - array_of_subsizes, - array_of_starts, - order, - oldtype, - newtype); - /* --BEGIN ERROR HANDLING-- */ - if (err != MPI_SUCCESS) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, err, - "Internal error", 0); - } - /* --END ERROR HANDLING-- */ - - return MPI_SUCCESS; -} diff --git a/3rd-party/romio321/mpi2-other/info/Makefile.in b/3rd-party/romio321/mpi2-other/info/Makefile.in deleted file mode 100644 index b77f08e2b3acf651c5caed1bc9f0a1ae8e948bb3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/info/Makefile.in +++ /dev/null @@ -1,105 +0,0 @@ -CC = @CC@ -AR = @AR@ -LIBNAME = @LIBNAME@ -RANLIB = @RANLIB@ -srcdir = @srcdir@ -CC_SHL = @CC_SHL@ -SHLIBNAME = @SHLIBNAME@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../include -I${srcdir}/../../mpi-io -I${srcdir}/../../adio/include -I../../adio/include -CFLAGS = -DHAVE_MPI_INFO_SRC @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) - -top_builddir = @master_topbuild_dir@ -LIBTOOL = @LIBTOOL@ -C_COMPILE_SHL = $(CC_SHL) - -@VPATH@ - -MPIO_OBJECTS = info_create.o info_dup.o info_get.o info_getnth.o \ - info_set.o info_delete.o info_free.o info_getnks.o info_getvln.o \ - info_c2f.o info_f2c.o - -MPIO_TMP_POBJECTS = info_create.p info_dup.p info_get.p info_getnth.p \ - info_set.p info_delete.p info_free.p info_getnks.p info_getvln.p \ - info_c2f.p info_f2c.p - -MPIO_REAL_POBJECTS = _info_create.o _info_dup.o _info_get.o _info_getnth.o \ - _info_set.o _info_delete.o _info_free.o _info_getnks.o _info_getvln.o \ - _info_c2f.o _info_f2c.o - -all: $(LIBNAME) - @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ - $(MAKE) $(SHLIBNAME).la ;\ - fi - -.SUFFIXES: $(SUFFIXES) .p .sp .lo - -.c.o: - $(CC) $(CFLAGS) -c $< - -.c.lo: - $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o - @mv -f _s$*.o $*.lo - -.c.p: - @cp $(srcdir)/$*.c _$*.c - $(CC) $(CFLAGS) -c _$*.c - @rm -f _$*.c - -.c.sp: - $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _$*.lo - -profile: $(MPIO_REAL_POBJECTS) - $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) - $(RANLIB) $(LIBNAME) - @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ - $(MAKE) P$(SHLIBNAME).la ;\ - fi - @rm -f _*.o - -$(LIBNAME): $(MPIO_OBJECTS) - $(AR) $(LIBNAME) $(MPIO_OBJECTS) - $(RANLIB) $(LIBNAME) - -MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) -$(SHLIBNAME).la: $(MPIO_LOOBJECTS) - $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) - -# -------------------------------------------------------------------------- -# We use P$(SHLBNAME) simply to distinguish the regular lib build from the -# profiling library build -MPIO_LOPOBJECTS = $(MPIO_REAL_POBJECTS:.o=.lo) -MPIO_TMP_LOPOBJECTS = ${MPIO_TMP_POBJECTS:.p=.sp} -P$(SHLIBNAME).la: $(MPIO_TMP_LOPOBJECTS) - $(AR) $(SHLIBNAME).la $(MPIO_LOPOBJECTS) -# -------------------------------------------------------------------------- - -clean: - @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg - @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda - @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg - - -# Rules for the profiling objects -info_create.o: infocreate.c - $(CC) $(CFLAGS) -c $(srcdir)/infocreate.c -o _info_create.o -info_dup.o: infodup.c - $(CC) $(CFLAGS) -c $(srcdir)/infodup.c -o _info_dup.o -info_get.o: infoget.c - $(CC) $(CFLAGS) -c $(srcdir)/infoget.c -o _info_get.o -info_getnth.o: infogetnth.c - $(CC) $(CFLAGS) -c $(srcdir)/infogetnth.c -o _info_getnth.o -info_set.o: infoset.c - $(CC) $(CFLAGS) -c $(srcdir)/infoset.c -o _info_set.o -info_delete.o: infodelete.c - $(CC) $(CFLAGS) -c $(srcdir)/infodelete.c -o _info_delete.o -info_free.o: infofree.c - $(CC) $(CFLAGS) -c $(srcdir)/infofree.c -o _info_free.o -info_getnks.o: infogetnks.c - $(CC) $(CFLAGS) -c $(srcdir)/infogetnks.c -o _info_getnks.o -info_getvln.o: infogetvln.c - $(CC) $(CFLAGS) -c $(srcdir)/infogetvln.c -o _info_getvln.o -info_c2f.o: infoc2f.c - $(CC) $(CFLAGS) -c $(srcdir)/infoc2f.c -o _info_c2f.o -info_f2c.o: infof2c.c - $(CC) $(CFLAGS) -c $(srcdir)/infof2c.c -o _info_f2c.o diff --git a/3rd-party/romio321/mpi2-other/info/fortran/Makefile.in b/3rd-party/romio321/mpi2-other/info/fortran/Makefile.in deleted file mode 100644 index c84769c54674e4e7bb996e32aaa5c7aec3888f80..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/mpi2-other/info/fortran/Makefile.in +++ /dev/null @@ -1,65 +0,0 @@ -CC = @CC@ -AR = @AR@ -LIBNAME = @LIBNAME@ -RANLIB = @RANLIB@ -srcdir = @srcdir@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../adio/include -I${srcdir}/../../../mpi-io -I../../../adio/include -CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) - -@VPATH@ - -MPIO_OBJECTS = info_createf.o info_dupf.o info_getf.o info_getnthf.o \ - info_setf.o info_deletef.o info_freef.o info_getnksf.o info_getvlnf.o - -MPIO_TMP_POBJECTS = info_createf.p info_dupf.p info_getf.p info_getnthf.p \ - info_setf.p info_deletef.p info_freef.p info_getnksf.p info_getvlnf.p - -MPIO_REAL_POBJECTS = _info_createf.o _info_dupf.o _info_getf.o _info_getnthf.o\ - _info_setf.o _info_deletef.o _info_freef.o _info_getnksf.o _info_getvlnf.o - -all: $(LIBNAME) - -.SUFFIXES: $(SUFFIXES) .p - -.c.o: - $(CC) $(CFLAGS) -c $< - -.c.p: - @cp $(srcdir)/$*.c _$*.c - $(CC) $(CFLAGS) -c _$*.c - @rm -f _$*.c - -profile: $(MPIO_REAL_POBJECTS) - $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) - $(RANLIB) $(LIBNAME) - @rm -f _*.o - -$(LIBNAME): $(MPIO_OBJECTS) - $(AR) $(LIBNAME) $(MPIO_OBJECTS) - $(RANLIB) $(LIBNAME) - -clean: - @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg - @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda - @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg - -# Rules for the profiling objects -_info_createf.o: info_createf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_createf.c -o _info_createf.o -_info_dupf.o: info_dupf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_dupf.c -o _info_dupf.o -_info_getf.o: info_getf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_getf.c -o _info_getf.o -_info_getnthf.o: info_getnthf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_getnthf.c -o _info_getnthf.o -_info_setf.o: info_setf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_setf.c -o _info_setf.o -_info_deletef.o: info_deletef.c - $(CC) $(CFLAGS) -c $(srcdir)/info_deletef.c -o _info_deletef.o -_info_freef.o: info_freef.c - $(CC) $(CFLAGS) -c $(srcdir)/info_freef.c -o _info_freef.o -_info_getnksf.o: info_getnksf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_getnksf.c -o _info_getnksf.o -_info_getvlnf.o: info_getvlnf.c - $(CC) $(CFLAGS) -c $(srcdir)/info_getvlnf.c -o _info_getvlnf.o diff --git a/3rd-party/romio321/test-internal/file_realms_test.c b/3rd-party/romio321/test-internal/file_realms_test.c deleted file mode 100644 index b848259e0efdf8ec2c06b1a10bf376f5eb5cb3c2..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test-internal/file_realms_test.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "../adio/include/adio.h" -#include "../adio/include/adio_extern.h" -#include "mpi.h" - -int main (int argc, char **argv) -{ - int i; - ADIO_File fd; - ADIO_Offset min_st_offset, max_end_offset; - int rank; - int nprocs_for_coll; - int lb; - MPI_Count size, extent; - - MPI_Init (&argc, &argv); - MPI_Comm_rank (MPI_COMM_WORLD, &rank); - - if (argc != 4) { - if (!rank) - printf ("Usage: file_realms_test <number of aggregators> <lower bound> <upper bound>\n" - " simulates file_realm calculation\n"); - MPI_Finalize(); - return 1; - } - - nprocs_for_coll = atoi (argv[1]); - - min_st_offset = atoi (argv[2]); - max_end_offset = atoi (argv[3]); - - if (max_end_offset < min_st_offset){ - if (!rank) - printf ("end offset %lld is less then start offset %lld\n", - max_end_offset, min_st_offset); - MPI_Finalize(); - return 1; - } - - printf ("min_st_offset = %lld\nmax_end_offset = %lld\n", - min_st_offset, max_end_offset); - - fd = (ADIO_File) ADIOI_Malloc (sizeof (struct ADIOI_FileD)); - fd->hints = (ADIOI_Hints *) - ADIOI_Malloc (sizeof(struct ADIOI_Hints_struct)); - fd->hints->cb_nodes = nprocs_for_coll; - ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset); - - for (i=0; i < nprocs_for_coll; i++) { - printf ("file_realm_st_offs[%d] = %lld\n", i, fd->file_realm_st_offs[i]); - } - for (i=0; i < nprocs_for_coll; i++) { - MPI_Type_size_x (fd->file_realm_types[i], &size); - printf ("file_realm [%d] size = %d\n", i, size); - } - for (i=0; i < nprocs_for_coll; i++) { - MPI_Type_get_extent (fd->file_realm_types[i], &lb, &extent); - printf ("file_realm [%d] extent = %d\n", i, extent); - } - - for (i=0; i < nprocs_for_coll; i++) - MPI_Type_free (&fd->file_realm_types[i]); - ADIOI_Free (fd->file_realm_st_offs); - ADIOI_Free (fd->file_realm_types); - ADIOI_Free (fd->hints); - ADIOI_Free (fd); - - MPI_Finalize(); - - return 0; -} diff --git a/3rd-party/romio321/test-internal/heap_test.c b/3rd-party/romio321/test-internal/heap_test.c deleted file mode 100644 index 2f0041df3689d68b14b1660f7ad2059b714f24ab..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test-internal/heap_test.c +++ /dev/null @@ -1,459 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "../adio/include/heap-sort.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#define PREDEF_TESTS 2 -/* test types */ -#define ALL 0 -#define RANDOM -1 -#define CUSTOM -2 - -/* ACTIONS */ -#define BUILD 0 -#define INSERT 1 -#define EXTRACT 2 -#define EXTRACT_INSERT 3 - -typedef struct { - char name[64]; - int heap_size; - int print; - int verify; - int action_arr_sz; - int *action_arr; - int *action_count_arr; - ADIO_Offset *offsets; - ADIO_Offset *correct_order; -} test_params_t; - -void print_usage(); -void print_keys(ADIO_Offset* offsets, int size); -void print_params(test_params_t *params); -int run_test(test_params_t *test); -void fill_random_test(test_params_t *params); -void init_predefined_test(test_params_t *params, int index); -void dumb_sort(test_params_t *params); - -int main(int argc, char **argv) { - int i, print = 1, verify = 1; - int adding_elements; - int curr_add_idx; - int test_type = RANDOM; - test_params_t predefined_tests[PREDEF_TESTS]; - test_params_t test; - - /* parse args */ - adding_elements = 0; - curr_add_idx = 0; - if (argc == 1) { - print_usage(); - return 1; - } - i = 1; - while (i < argc) { - if (!strcmp("-A", argv[i])) { - adding_elements = 0; - test_type = ALL; - i++; - } - else if (!strcmp("-T", argv[i])) { - adding_elements = 0; - test_type = atoi(argv[i+1]); - i += 2; - } - else if (!strcmp("-r", argv[i])) { - adding_elements = 0; - test.heap_size = atoi(argv[i+1]); - if (test.heap_size <= 0) { - printf("heap size should be a positive integer\n"); - return 1; - } - test.offsets = (ADIO_Offset *) malloc(test.heap_size*sizeof(ADIO_Offset)); - test_type = RANDOM; - i += 2; - } - else if (!strcmp("-e", argv[i])) { - test.heap_size = argc - 2; - if (test.heap_size <= 0) { - printf("need at least one key\n"); - return 1; - } - test.offsets = (ADIO_Offset *) malloc(test.heap_size*sizeof(ADIO_Offset)); - adding_elements = 1; - test_type = CUSTOM; - i++; - } - else if (!strcmp("-v", argv[i])) { - verify = 1; - i++; - } - else if (!strcmp("-p", argv[i])) { - print = 1; - i++; - } - else if (!strcmp("-V", argv[i])) { - verify = 0; - i++; - } - else if (!strcmp("-P", argv[i])) { - print = 0; - i++; - } - else if (adding_elements) { - test.offsets[curr_add_idx] = atoi(argv[i]); - curr_add_idx++; - i++; - } - else { - printf("Illegal argument: %s", argv[i]); - print_usage(); - return 1; - } - } - - if (test_type == RANDOM) { - fill_random_test(&test); - strcpy(test.name, "RANDOMIZED TEST"); - } - else if (test_type == CUSTOM) - strcpy(test.name, "CUSTOM TEST"); - if ((test_type == CUSTOM) || (test_type == RANDOM)) { - test.print = print; - test.verify = verify; - test.action_arr_sz = 2; - test.action_arr = (int *) malloc(test.action_arr_sz*sizeof(int)); - test.action_count_arr = (int *) malloc(test.action_arr_sz*sizeof(int)); - /* build the entire heap */ - /* test.action_arr[0] = BUILD; - test.action_count_arr[0] = 1; */ - /* insert keys one at a time */ - test.action_arr[0] = INSERT; - test.action_count_arr[0] = test.heap_size; - /* extract all the keys */ - test.action_arr[1] = EXTRACT; - test.action_count_arr[1] = test.heap_size; - - if (verify) { - test.correct_order = (ADIO_Offset *)malloc(test.heap_size*sizeof(ADIO_Offset)); - dumb_sort(&test); - } - if (print) - print_params(&test); - run_test(&test); - } - else { - if (test_type == ALL) { - for (i=0; i<PREDEF_TESTS; i++) { - predefined_tests[i].print = print; - predefined_tests[i].verify = verify; - init_predefined_test(&predefined_tests[i], i); - if (print) - print_params(&test); - run_test(&predefined_tests[i]); - } - } - else { - predefined_tests[test_type-1].print = print; - predefined_tests[test_type-1].verify = verify; - init_predefined_test(&predefined_tests[test_type-1], test_type-1); - if (print) - print_params(&predefined_tests[test_type-1]); - run_test(&predefined_tests[test_type-1]); - } - } - - return 0; -} - -void print_usage() { - printf( - "Usage: test <options>\n" - " -r <size> Create a random test and verify of size <size>\n" - " -e <keys> test with the space delimited list of keys\n" - " -p print parameters and keys (default)\n" - " -P do not print parameters and keys\n" - " -v verify keys (default)\n" - " -V do not verify keys\n" - ); -} - -void print_keys(ADIO_Offset *offsets, int size) { - int i; - for (i=0; i < size; i++) - printf("%lld ", offsets[i]); -} - -void print_params(test_params_t *params) { - int i; - static char action_map[3][8] = {"BUILD", "INSERT", "EXTRACT"}; - - printf("----------------Test Parameters---------------\n"); - printf("Actions:\n"); - for (i=0; i<params->action_arr_sz; i++) { - printf("%sx%d\n", action_map[params->action_arr[i]], - params->action_count_arr[i]); - } - - printf("Initial order :\n"); - print_keys(params->offsets, params->heap_size); - printf("\n"); - - if (params->verify) { - printf("Expected order:\n"); - print_keys(params->correct_order, params->heap_size); - printf("\n"); - } - printf("----------------------------------------------\n"); -} - -void fill_random_test(test_params_t *params) { - int i; - int max_key; - time_t seed; - int order = 0; - - time(&seed); - srand(seed); - - order = 0; - max_key = 1; - while (order < 25) { - max_key *= 10; - if (!((int) (params->heap_size / max_key))) - break; - order++; - } - for (i=0; i < params->heap_size; i++) - params->offsets[i] = (rand() % max_key); -} - -void dumb_sort(test_params_t *params) { - ADIO_Offset *offsets, tmp_offset; - int i, j; - - offsets = params->correct_order; - memcpy(offsets, params->offsets, params->heap_size*sizeof(ADIO_Offset)); - for (i=0; i < params->heap_size; i++) { - for (j=i; j < params->heap_size; j++) { - if (offsets[j] < offsets[i]) { - tmp_offset = offsets[i]; - offsets[i] = offsets[j]; - offsets[j] = tmp_offset; - } - } - } -} - -int run_test(test_params_t *test) { - heap_t myheap; - ADIO_Offset *extracted; - int stored_proc; - ADIO_Offset stored_reg_max_len; - int i, j, k, err_flag = 0; - int curr_insert_idx = 0; - int curr_extract_idx = 0; - - create_heap(&myheap, test->heap_size); - myheap.size = 0; - - extracted = (ADIO_Offset *) malloc(test->heap_size * sizeof(ADIO_Offset)); - for (i=0; i < test->action_arr_sz; i++) { - for (j=0; j<test->action_count_arr[i]; j++) { - switch (test->action_arr[i]) - { - case BUILD: - myheap.size = test->heap_size; - for (k=0; k < test->heap_size; k++) { - myheap.nodes[k].offset = test->offsets[k]; - myheap.nodes[k].proc = k; - } - build_heap(&myheap); - break; - case INSERT: - ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], - curr_insert_idx, curr_insert_idx); - curr_insert_idx++; - break; - case EXTRACT: - heap_extract_min(&myheap, &extracted[curr_extract_idx], - &stored_proc, &stored_reg_max_len); - if (test->verify && (extracted[curr_extract_idx] != - test->correct_order[curr_extract_idx])) - err_flag++; - curr_extract_idx++; - break; - case EXTRACT_INSERT: - heap_extract_min(&myheap, &extracted[curr_extract_idx], - &stored_proc, &stored_reg_max_len); - if (test->verify &&(extracted[curr_extract_idx] != - test->correct_order[curr_extract_idx])) - err_flag++; - curr_extract_idx++; - - ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], - curr_insert_idx, curr_insert_idx); - curr_insert_idx++; - break; - default: - break; - } - } - } - - if (test->verify) { - if (err_flag) { - printf("***%s FAILED***\n", test->name); - if (test->print) { - printf("Min extraction:\n"); - print_keys(extracted, test->heap_size); - printf("\n"); - } - } - else - printf("***%s PASSED***\n", test->name); - } - - free_heap(&myheap); - free(extracted); - /* clean up test params */ - free(test->offsets); - if (test->verify) - free(test->correct_order); - free(test->action_arr); - free(test->action_count_arr); - - return err_flag; -} - -void init_predefined_test(test_params_t *params, int index) { - - switch (index) - { - case 0: - strcpy(params->name, "TEST 1"); - params->heap_size = 15; - params->action_arr_sz = 3; - - /* allocate space */ - params->action_arr = - (int *) malloc (params->action_arr_sz*sizeof(int)); - params->action_count_arr = - (int *) malloc (params->action_arr_sz*sizeof(int)); - params->offsets = (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); - if (params->verify) - params->correct_order = - (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); - - /* Set procs */ - params->offsets[0] = 65; - params->offsets[1] = 53; - params->offsets[2] = 51; - params->offsets[3] = 74; - params->offsets[4] = 1; - params->offsets[5] = 3; - params->offsets[6] = 86; - params->offsets[7] = 82; - params->offsets[8] = 42; - params->offsets[9] = 62; - params->offsets[10] = 33; - params->offsets[11] = 12; - params->offsets[12] = 79; - params->offsets[13] = 13; - params->offsets[14] = 28; - - if (params->verify) { - params->correct_order[0] = 1; - params->correct_order[1] = 3; - params->correct_order[2] = 12; - params->correct_order[3] = 33; - params->correct_order[4] = 13; - params->correct_order[5] = 28; - params->correct_order[6] = 42; - params->correct_order[7] = 51; - params->correct_order[8] = 53; - params->correct_order[9] = 62; - params->correct_order[10] = 65; - params->correct_order[11] = 74; - params->correct_order[12] = 79; - params->correct_order[13] = 82; - params->correct_order[14] = 86; - } - - params->action_arr[0] = INSERT; - params->action_arr[1] = EXTRACT_INSERT; - params->action_arr[11] = EXTRACT; - - params->action_count_arr[0] = 10; - params->action_count_arr[1] = 5; - params->action_count_arr[11] = 10; - break; - case 1: - strcpy(params->name, "TEST 1"); - params->heap_size = 15; - params->action_arr_sz = 3; - - /* allocate space */ - params->action_arr = - (int *) malloc (params->action_arr_sz*sizeof(int)); - params->action_count_arr = - (int *) malloc (params->action_arr_sz*sizeof(int)); - params->offsets = (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); - if (params->verify) - params->correct_order = - (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); - - /* Set values */ - params->offsets[0] = 65; - params->offsets[1] = 53; - params->offsets[2] = 51; - params->offsets[3] = 74; - params->offsets[4] = 1; - params->offsets[5] = 3; - params->offsets[6] = 86; - params->offsets[7] = 82; - params->offsets[8] = 42; - params->offsets[9] = 62; - params->offsets[10] = 33; - params->offsets[11] = 12; - params->offsets[12] = 79; - params->offsets[13] = 13; - params->offsets[14] = 28; - - if (params->verify) { - params->correct_order[0] = 1; - params->correct_order[1] = 3; - params->correct_order[2] = 12; - params->correct_order[3] = 33; - params->correct_order[4] = 13; - params->correct_order[5] = 28; - params->correct_order[6] = 42; - params->correct_order[7] = 51; - params->correct_order[8] = 53; - params->correct_order[9] = 62; - params->correct_order[10] = 65; - params->correct_order[11] = 74; - params->correct_order[12] = 79; - params->correct_order[13] = 82; - params->correct_order[14] = 86; - } - - params->action_arr[0] = INSERT; - params->action_arr[1] = EXTRACT_INSERT; - params->action_arr[11] = EXTRACT; - - params->action_count_arr[0] = 10; - params->action_count_arr[1] = 5; - params->action_count_arr[11] = 10; - break; - default: - break; - } -} diff --git a/3rd-party/romio321/test-internal/io_bounds_test.c b/3rd-party/romio321/test-internal/io_bounds_test.c deleted file mode 100644 index f7514764e42e939341351413911729a65f2906a3..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test-internal/io_bounds_test.c +++ /dev/null @@ -1,302 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2008 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "../adio/include/adio.h" -#include "../adio/include/adioi.h" -#include "../adio/include/adio_extern.h" -#include "mpi.h" - -#define PREDEF_TESTS 5 -#define MAX_OFF_LENS 4 - -typedef struct { - ADIO_Offset offset; - int count; - int type_blocklens[MAX_OFF_LENS]; - int type_indices[MAX_OFF_LENS]; - MPI_Datatype type_oldtypes[MAX_OFF_LENS]; - int type_count; - - ADIO_Offset correct_st_offset; - ADIO_Offset correct_end_offset; -} test_param_t; - -int run_test (test_param_t *test); -int setup_predefined (test_param_t *tests_arr, int count); -int print_usage (void); -int print_test_params (test_param_t *test); - -int main (int argc, char **argv) { - int rank; - int run_test_number = 0; - int failed; - int while_condition; - int i; - - test_param_t predefined_tests[PREDEF_TESTS]; - - MPI_Init (&argc, &argv); - MPI_Comm_rank (MPI_COMM_WORLD, &rank); - - if (argc != 1) { - if (!rank) { - printf ("Use only one process\n"); - print_usage (); - } - MPI_Finalize(); - return 1; - } - i = 1; - while (i < argc) { - if (!strcmp (argv[i], "-A")) { - run_test_number = 0; - i++; - } - else if (!strcmp (argv[i], "-T")) { - run_test_number = atoi (argv[i+1]); - if ((run_test_number > PREDEF_TESTS) || (run_test_number < 1)) { - if (!rank) - printf ("Invalid test number, only %d tests\n", - PREDEF_TESTS); - MPI_Finalize (); - return 1; - } - i += 2; - } - else { - if (!rank) { - printf ("Invalid Argument: %s\n", argv[i]); - print_usage (); - } - i++; - } - } - - setup_predefined (predefined_tests, PREDEF_TESTS); - - if (!run_test_number) { - i = 0; - while_condition = PREDEF_TESTS; - } - else { - i = run_test_number - 1; - while_condition = run_test_number; - } - while (i < while_condition) { - printf ("***** Test %d *****\n", i+1); - failed = run_test (&predefined_tests[i]); - printf ("******************\n"); - i++; - } - - MPI_Finalize (); - - return 0; -} - -int run_test (test_param_t *test) { - ADIO_Offset st_offset, end_offset; - MPI_File fh; - int is_contig; - int ind_err = 0, exp_err = 0; - - MPI_Datatype filetype; - - MPI_Type_struct (test->type_count, test->type_blocklens, - test->type_indices, test->type_oldtypes, &filetype); - MPI_Type_commit (&filetype); - - MPI_File_open (MPI_COMM_WORLD, "test_file.txt" , MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - MPI_File_set_view (fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); - - MPI_File_seek (fh, test->offset, MPI_SEEK_SET); - ADIOI_Calc_bounds ((ADIO_File) fh, test->count, MPI_BYTE, ADIO_INDIVIDUAL, - test->offset, &st_offset, &end_offset); - - ind_err = 0; - if (st_offset != test->correct_st_offset) { - printf ("Individual st_offset = %lld end_offset = %lld\n", - st_offset, end_offset); - ind_err = 1; - } - if (end_offset != test->correct_end_offset) { - printf ("Individual st_offset = %lld end_offset = %lld\n", - st_offset, end_offset); - ind_err = 1; - } - MPI_File_close (&fh); - if (ind_err) - printf ("Individual Calc FAILED\n"); - - MPI_File_open (MPI_COMM_WORLD, "test_file.txt" , MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - if (!is_contig) - MPI_File_set_view (fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); - - MPI_File_seek (fh, 0, MPI_SEEK_SET); - ADIOI_Calc_bounds ((ADIO_File) fh, test->count, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, test->offset, &st_offset, - &end_offset); - - exp_err = 0; - if (st_offset != test->correct_st_offset) { - printf ("Explicit st_offset = %lld end_offset = %lld\n", - st_offset, end_offset); - exp_err = 1; - } - if (end_offset != test->correct_end_offset) { - printf ("Explicit st_offset = %lld end_offset = %lld\n", - st_offset, end_offset); - exp_err = 1; - } - if (exp_err) - printf ("Explicit Calc FAILED\n"); - - MPI_File_close (&fh); - - if (!is_contig) - MPI_Type_free (&filetype); - - return (exp_err || ind_err); -} - -int print_usage () -{ - printf ( - "Usage:\n" - " io_bounds_test -A -T <test #>\n"); -} - -int print_test_params (test_param_t *test) -{ - int i; - printf ( - "I/O offset: %lld\n" - "bytes: %d\n" - "Filetype [n](disp, lens, type):\n", - test->offset, test->count); - - for (i=0; i<test->type_count; i++) { - printf ( - " [%d](%lld, %d, ", - i, - test->type_blocklens[i], - test->type_indices[i]); - if (test->type_oldtypes[i] == MPI_BYTE) { - printf ( "%s)\n", "MPI_BYTE"); - } - else if (test->type_oldtypes[i] == MPI_UB) { - printf ( "%s)\n", "MPI_UB"); - } - else if (test->type_oldtypes[i] == MPI_LB) { - printf ( "%s)\n", "MPI_LB"); - } - } - printf ( - "Expected Start offset: %lld\n" - "Expected End offset: %lld\n", - test->correct_st_offset, - test->correct_end_offset); -} - -int setup_predefined (test_param_t *tests_arr, int count) -{ - int i; - for (i=0; i < PREDEF_TESTS; i++) { - switch (i) - { - case 0: - tests_arr[i].offset = 0; - tests_arr[i].count = 0; - tests_arr[i].type_count = 0; - tests_arr[i].type_indices[0] = 0; - tests_arr[i].type_blocklens[0] = 0; - tests_arr[i].type_oldtypes[0] = MPI_BYTE; - tests_arr[i].type_indices[1] = 0; - tests_arr[i].type_blocklens[1] = 0; - tests_arr[i].type_oldtypes[1] = MPI_BYTE; - tests_arr[i].type_indices[2] = 0; - tests_arr[i].type_blocklens[2] = 0; - tests_arr[i].type_oldtypes[2] = MPI_BYTE; - tests_arr[i].type_indices[3] = 0; - tests_arr[i].type_blocklens[3] = 0; - tests_arr[i].type_oldtypes[3] = MPI_BYTE; - break; - case 1: - tests_arr[i].offset = 0; - tests_arr[i].count = 0; - tests_arr[i].type_count = 0; - tests_arr[i].type_indices[0] = 0; - tests_arr[i].type_blocklens[0] = 0; - tests_arr[i].type_oldtypes[0] = MPI_BYTE; - tests_arr[i].type_indices[1] = 0; - tests_arr[i].type_blocklens[1] = 0; - tests_arr[i].type_oldtypes[1] = MPI_BYTE; - tests_arr[i].type_indices[2] = 0; - tests_arr[i].type_blocklens[2] = 0; - tests_arr[i].type_oldtypes[2] = MPI_BYTE; - tests_arr[i].type_indices[3] = 0; - tests_arr[i].type_blocklens[3] = 0; - tests_arr[i].type_oldtypes[3] = MPI_BYTE; - break; - case 2: - tests_arr[i].offset = 0; - tests_arr[i].count = 0; - tests_arr[i].type_count = 0; - tests_arr[i].type_indices[0] = 0; - tests_arr[i].type_blocklens[0] = 0; - tests_arr[i].type_oldtypes[0] = MPI_BYTE; - tests_arr[i].type_indices[1] = 0; - tests_arr[i].type_blocklens[1] = 0; - tests_arr[i].type_oldtypes[1] = MPI_BYTE; - tests_arr[i].type_indices[2] = 0; - tests_arr[i].type_blocklens[2] = 0; - tests_arr[i].type_oldtypes[2] = MPI_BYTE; - tests_arr[i].type_indices[3] = 0; - tests_arr[i].type_blocklens[3] = 0; - tests_arr[i].type_oldtypes[3] = MPI_BYTE; - break; - case 3: - tests_arr[i].offset = 0; - tests_arr[i].count = 0; - tests_arr[i].type_count = 0; - tests_arr[i].type_indices[0] = 0; - tests_arr[i].type_blocklens[0] = 0; - tests_arr[i].type_oldtypes[0] = MPI_BYTE; - tests_arr[i].type_indices[1] = 0; - tests_arr[i].type_blocklens[1] = 0; - tests_arr[i].type_oldtypes[1] = MPI_BYTE; - tests_arr[i].type_indices[2] = 0; - tests_arr[i].type_blocklens[2] = 0; - tests_arr[i].type_oldtypes[2] = MPI_BYTE; - tests_arr[i].type_indices[3] = 0; - tests_arr[i].type_blocklens[3] = 0; - tests_arr[i].type_oldtypes[3] = MPI_BYTE; - break; - case 4: - tests_arr[i].offset = 0; - tests_arr[i].count = 0; - tests_arr[i].type_count = 0; - tests_arr[i].type_indices[0] = 0; - tests_arr[i].type_blocklens[0] = 0; - tests_arr[i].type_oldtypes[0] = MPI_BYTE; - tests_arr[i].type_indices[1] = 0; - tests_arr[i].type_blocklens[1] = 0; - tests_arr[i].type_oldtypes[1] = MPI_BYTE; - tests_arr[i].type_indices[2] = 0; - tests_arr[i].type_blocklens[2] = 0; - tests_arr[i].type_oldtypes[2] = MPI_BYTE; - tests_arr[i].type_indices[3] = 0; - tests_arr[i].type_blocklens[3] = 0; - tests_arr[i].type_oldtypes[3] = MPI_BYTE; - break; - } - } - return 0; -} diff --git a/3rd-party/romio321/test/aggregation1.c b/3rd-party/romio321/test/aggregation1.c deleted file mode 100644 index dee42d60a5c4b64307c569498d886b5d42fc610f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/aggregation1.c +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2007 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -/* Test case from John Bent (ROMIO req #835) - * Aggregation code was not handling certain access patterns when collective - * buffering forced */ -#define _XOPEN_SOURCE 500 /* strdup not in string.h otherwsie */ -#include <unistd.h> -#include <stdlib.h> -#include <mpi.h> -#include <stdio.h> -#include <string.h> - -#define NUM_OBJS 4 -#define OBJ_SIZE 1048576 - -extern char *optarg; -extern int optind, opterr, optopt; - - -char *prog = NULL; -int debug = 0; - -static void -Usage( int line ) { - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - if ( rank == 0 ) { - fprintf( stderr, - "Usage (line %d): %s [-d] [-h] -f filename\n" - "\t-d for debugging\n" - "\t-h to turn on the hints to force collective aggregation\n", - line, prog ); - } - exit( 0 ); -} - -static void -fatal_error( int mpi_ret, MPI_Status *mpi_stat, const char *msg ) { - fprintf( stderr, "Fatal error %s: %d\n", msg, mpi_ret ); - MPI_Abort( MPI_COMM_WORLD, -1 ); -} - -static void -print_hints( int rank, MPI_File *mfh ) { - MPI_Info info; - int nkeys; - int i, dummy_int; - char key[1024]; - char value[1024]; - - MPI_Barrier( MPI_COMM_WORLD ); - if ( rank == 0 ) { - MPI_File_get_info( *mfh, &info ); - MPI_Info_get_nkeys( info, &nkeys ); - - printf( "HINTS:\n" ); - for( i = 0; i < nkeys; i++ ) { - MPI_Info_get_nthkey( info, i, key ); - printf( "%35s -> ", key ); - MPI_Info_get( info, key, 1024, value, &dummy_int ); - printf( "%s\n", value ); - } - MPI_Info_free(&info); - } - MPI_Barrier( MPI_COMM_WORLD ); -} - -static void -fill_buffer( char *buffer, int bufsize, int rank, MPI_Offset offset ) { - memset( (void*)buffer, 0, bufsize ); - snprintf( buffer, bufsize, "Hello from %d at %lld\n", rank, offset ); -} - -static MPI_Offset -get_offset( int rank, int num_objs, int obj_size, int which_obj ) { - MPI_Offset offset; - offset = (MPI_Offset)rank * num_objs * obj_size + which_obj * obj_size; - return offset; -} - -static void -write_file( char *target, int rank, MPI_Info *info ) { - MPI_File wfh; - MPI_Status mpi_stat; - int mpi_ret; - int i; - char *buffer; - - buffer = malloc(OBJ_SIZE); - - if ( debug ) printf( "%d writing file %s\n", rank, target ); - - if( (mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, - MPI_MODE_WRONLY | MPI_MODE_CREATE, *info, &wfh ) ) - != MPI_SUCCESS ) - { - fatal_error( mpi_ret, NULL, "open for write" ); - } - - for( i = 0; i < NUM_OBJS; i++ ) { - MPI_Offset offset = get_offset( rank, NUM_OBJS, OBJ_SIZE, i ); - fill_buffer( buffer, OBJ_SIZE, rank, offset ); - if ( debug ) printf( "%s", buffer ); - if ( (mpi_ret = MPI_File_write_at_all( wfh, offset, buffer, OBJ_SIZE, - MPI_CHAR, &mpi_stat ) ) != MPI_SUCCESS ) - { - fatal_error( mpi_ret, &mpi_stat, "write" ); - } - } - - if ( debug ) print_hints( rank, &wfh ); - - if( (mpi_ret = MPI_File_close( &wfh ) ) != MPI_SUCCESS ) { - fatal_error( mpi_ret, NULL, "close for write" ); - } - if ( debug ) printf( "%d wrote file %s\n", rank, target ); - free(buffer); -} - -static int -reduce_corruptions( int corrupt_blocks ) { - int mpi_ret; - int sum; - if ( ( mpi_ret = MPI_Reduce( &corrupt_blocks, &sum, 1, - MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD ) ) != MPI_SUCCESS ) - { - fatal_error( mpi_ret, NULL, "MPI_Reduce" ); - } - return sum; -} - -static void -read_file( char *target, int rank, MPI_Info *info, int *corrupt_blocks ) { - MPI_File rfh; - MPI_Status mpi_stat; - int mpi_ret; - int i; - char *buffer; - char *verify_buf = NULL; - buffer = malloc(OBJ_SIZE); - verify_buf = (char *)malloc(OBJ_SIZE); - - if ( debug ) printf( "%d reading file %s\n", rank, target ); - - if( (mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, - MPI_MODE_RDONLY, *info, &rfh ) ) != MPI_SUCCESS ) - { - fatal_error( mpi_ret, NULL, "open for read" ); - } - - for( i = 0; i < NUM_OBJS; i++ ) { - MPI_Offset offset = get_offset( rank, NUM_OBJS, OBJ_SIZE, i ); - fill_buffer( verify_buf, OBJ_SIZE, rank, offset ); - if ( debug ) printf( "Expecting %s", buffer ); - if ( (mpi_ret = MPI_File_read_at_all( rfh, offset, buffer, OBJ_SIZE, - MPI_CHAR, &mpi_stat ) ) != MPI_SUCCESS ) - { - fatal_error( mpi_ret, &mpi_stat, "read" ); - } - if ( memcmp( verify_buf, buffer, OBJ_SIZE ) != 0 ) { - (*corrupt_blocks)++; - printf( "Corruption at %lld\n", offset ); - if ( debug ) { - printf( "\tExpecting %s\n" - "\tRecieved %s\n", - verify_buf, buffer ); - } - } - } - - if( (mpi_ret = MPI_File_close( &rfh ) ) != MPI_SUCCESS ) { - fatal_error( mpi_ret, NULL, "close for read" ); - } - free (buffer); - free(verify_buf); - -} - -static void -set_hints( MPI_Info *info ) { - MPI_Info_set( *info, "romio_cb_write", "enable" ); - MPI_Info_set( *info, "romio_no_indep_rw", "1" ); - MPI_Info_set( *info, "cb_nodes", "1" ); - MPI_Info_set( *info, "cb_buffer_size", "4194304" ); -} - -/* -void -set_hints( MPI_Info *info, char *hints ) { - char *delimiter = " "; - char *hints_cp = strdup( hints ); - char *key = strtok( hints_cp, delimiter ); - char *val; - while( key ) { - val = strtok( NULL, delimiter ); - if ( debug ) printf( "HINT: %s = %s\n", key, val ); - if ( ! val ) { - Usage( __LINE__ ); - } - MPI_Info_set( *info, key, val ); - key = strtok( NULL, delimiter ); - } - free( hints_cp ); -} -*/ - -int -main( int argc, char *argv[] ) { - int nproc = 1, rank = 0; - char *target = NULL; - int c; - MPI_Info info; - int mpi_ret; - int corrupt_blocks = 0; - - MPI_Init( &argc, &argv ); - MPI_Comm_size(MPI_COMM_WORLD, &nproc); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - if( (mpi_ret = MPI_Info_create(&info)) != MPI_SUCCESS) { - if(rank == 0) fatal_error( mpi_ret, NULL, "MPI_info_create.\n"); - } - - prog = strdup( argv[0] ); - - while( ( c = getopt( argc, argv, "df:h" ) ) != EOF ) { - switch( c ) { - case 'd': - debug = 1; - break; - case 'f': - target = strdup( optarg ); - break; - case 'h': - set_hints( &info ); - break; - default: - Usage( __LINE__ ); - } - } - if ( ! target ) { - Usage( __LINE__ ); - } - - write_file( target, rank, &info ); - read_file( target, rank, &info, &corrupt_blocks ); - - corrupt_blocks = reduce_corruptions( corrupt_blocks ); - if ( rank == 0 ) { - if (corrupt_blocks == 0) { - fprintf(stdout, " No Errors\n"); - } else { - fprintf(stdout, "%d/%d blocks corrupt\n", - corrupt_blocks, nproc * NUM_OBJS ); - } - } - MPI_Info_free(&info); - - MPI_Finalize(); - free(prog); - exit( 0 ); -} diff --git a/3rd-party/romio321/test/aggregation2.c b/3rd-party/romio321/test/aggregation2.c deleted file mode 100644 index a35ebe0caf5e3c525b722c92674643e774244b8f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/aggregation2.c +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2007 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -/* Look for regressions in aggregator code. A more simple access pattern than - * aggregation1 */ - -#include <mpi.h> - -#include <stdlib.h> -#include <stdio.h> -#include <time.h> - -#include <sys/types.h> -#include <unistd.h> - -#include <string.h> - -#define BUFSIZE 512 - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -int main(int argc, char ** argv) -{ - MPI_Info info = MPI_INFO_NULL; - MPI_File fh; - MPI_Offset off=0; - MPI_Status status; - int errcode; - int i, rank, errs=0, toterrs, buffer[BUFSIZE], buf2[BUFSIZE]; - - MPI_Init(&argc, &argv); - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - MPI_Info_create(&info); - MPI_Info_set(info, "romio_cb_write", "enable"); - MPI_Info_set(info, "cb_nodes", "1"); - - for (i=0; i<BUFSIZE; i++) { - buffer[i] = 10000+rank; - } - off = rank*sizeof(buffer); - - errcode = MPI_File_open(MPI_COMM_WORLD, argv[1], - MPI_MODE_WRONLY|MPI_MODE_CREATE, info, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open"); - errcode = MPI_File_write_at_all(fh, off, buffer, BUFSIZE, - MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_write_at_all"); - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close"); - - errcode = MPI_File_open(MPI_COMM_WORLD, argv[1], - MPI_MODE_RDONLY, info, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open"); - errcode = MPI_File_read_at_all(fh, off, buf2, BUFSIZE, - MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_read_at_all"); - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close"); - - for (i=0; i<BUFSIZE; i++) { - if (buf2[i] != 10000+rank) - errs++; - } - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - MPI_Info_free(&info); - MPI_Finalize(); - - return 0; -} diff --git a/3rd-party/romio321/test/async-multiple.c b/3rd-party/romio321/test/async-multiple.c deleted file mode 100644 index ec9726ce55dc8a4f0a7f5a3a3fc9baa1f4c4ca0f..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/async-multiple.c +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SIZE (65536) -#define NR_NBOPS (32) - -/* Uses asynchronous I/O. Each process writes to separate files and - reads them back. The file name is taken as a command-line argument, - and the process rank is appended to it.*/ - -void handle_error(int errcode, const char *str); - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} -int main(int argc, char **argv) -{ - int *buf, i, rank, nints, len; - char *filename, *tmp; - int errs=0, toterrs; - MPI_File fh; - MPI_Status status[NR_NBOPS]; - MPI_Request request[NR_NBOPS]; - int errcode = 0; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: async -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - buf = (int *) malloc(SIZE); - nints = SIZE/sizeof(int); - for (i=0; i<nints; i++) buf[i] = rank*100000 + i; - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); - for (i=0; i<NR_NBOPS; i++) { - errcode = MPI_File_iwrite_at(fh, nints/NR_NBOPS*i, - buf+(nints/NR_NBOPS*i), nints/NR_NBOPS, MPI_INT, &(request[i])); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_iwrite"); - } - } - MPI_Waitall(NR_NBOPS, request, status); - - MPI_File_close(&fh); - - /* reopen the file and read the data back */ - - for (i=0; i<nints; i++) buf[i] = 0; - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); - for (i=0; i<NR_NBOPS; i++) { - errcode = MPI_File_iread_at(fh, nints/NR_NBOPS*i, - buf+(nints/NR_NBOPS*i), nints/NR_NBOPS, MPI_INT, &(request[i])); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - } - MPI_Waitall(NR_NBOPS, request, status); - - MPI_File_close(&fh); - - /* check if the data read is correct */ - for (i=0; i<nints; i++) { - if (buf[i] != (rank*100000 + i)) { - errs++; - fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], rank*100000+i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - free(buf); - free(filename); - free(tmp); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/async.c b/3rd-party/romio321/test/async.c deleted file mode 100644 index 8882716dfed44f6782fd02ff08ac4afa16b2b5b5..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/async.c +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SIZE (65536) - -/* Uses asynchronous I/O. Each process writes to separate files and - reads them back. The file name is taken as a command-line argument, - and the process rank is appended to it.*/ - -void handle_error(int errcode, const char *str); - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} -int main(int argc, char **argv) -{ - int *buf, i, rank, nints, len; - char *filename, *tmp; - int errs=0, toterrs; - MPI_File fh; - MPI_Status status; - MPIO_Request request; - int errcode = 0; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: async -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - buf = (int *) malloc(SIZE); - nints = SIZE/sizeof(int); - for (i=0; i<nints; i++) buf[i] = rank*100000 + i; - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); - errcode = MPI_File_iwrite(fh, buf, nints, MPI_INT, &request); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_iwrite"); - } -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait( &request, &status ); -#else - MPIO_Wait(&request, &status); -#endif - MPI_File_close(&fh); - - /* reopen the file and read the data back */ - - for (i=0; i<nints; i++) buf[i] = 0; - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); - errcode = MPI_File_iread(fh, buf, nints, MPI_INT, &request); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait( &request, &status ); -#else - MPIO_Wait(&request, &status); -#endif - - MPI_File_close(&fh); - - /* check if the data read is correct */ - for (i=0; i<nints; i++) { - if (buf[i] != (rank*100000 + i)) { - errs++; - fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], rank*100000+i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - free(buf); - free(filename); - free(tmp); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/atomicity.c b/3rd-party/romio321/test/atomicity.c deleted file mode 100644 index 7797075ed95fec9f0f6561f4b9a762febcaca987..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/atomicity.c +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests whether atomicity semantics are satisfied for overlapping accesses - in atomic mode. The probability of detecting errors is higher if you run - it on 8 or more processes. */ - -/* The file name is taken as a command-line argument. */ - -#define BUFSIZE 10000 /* no. of integers */ -#define VERBOSE 0 -int main(int argc, char **argv) -{ - int *writebuf, *readbuf, i, mynod, nprocs, len, err; - char *filename; - int errs=0, toterrs; - MPI_Datatype newtype; - MPI_File fh; - MPI_Status status; - MPI_Info info; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - writebuf = (int *) malloc(BUFSIZE*sizeof(int)); - readbuf = (int *) malloc(BUFSIZE*sizeof(int)); - -/* test atomicity of contiguous accesses */ - -/* initialize file to all zeros */ - if (!mynod) { - MPI_File_delete(filename, MPI_INFO_NULL); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - for (i=0; i<BUFSIZE; i++) writebuf[i] = 0; - MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status); - MPI_File_close(&fh); -#if VERBOSE - fprintf(stderr, "\ntesting contiguous accesses\n"); -#endif - } - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<BUFSIZE; i++) writebuf[i] = 10; - for (i=0; i<BUFSIZE; i++) readbuf[i] = 20; - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - -/* set atomicity to true */ - err = MPI_File_set_atomicity(fh, 1); - if (err != MPI_SUCCESS) { - fprintf(stderr, "Atomic mode not supported on this file system.\n");fflush(stderr); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - MPI_Barrier(MPI_COMM_WORLD); - -/* process 0 writes and others concurrently read. In atomic mode, - the data read must be either all old values or all new values; nothing - in between. */ - - if (!mynod) MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status); - else { - err = MPI_File_read(fh, readbuf, BUFSIZE, MPI_INT, &status); - if (err == MPI_SUCCESS) { - if (readbuf[0] == 0) { /* the rest must also be 0 */ - for (i=1; i<BUFSIZE; i++) - if (readbuf[i] != 0) { - errs++; - fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 0\n", mynod, i, readbuf[i]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - else if (readbuf[0] == 10) { /* the rest must also be 10 */ - for (i=1; i<BUFSIZE; i++) - if (readbuf[i] != 10) { - errs++; - fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 10\n", mynod, i, readbuf[i]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - else { - errs++; - fprintf(stderr, "Process %d: readbuf[0] is %d, should be either 0 or 10\n", mynod, readbuf[0]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - -/* repeat the same test with a noncontiguous filetype */ - - MPI_Type_vector(BUFSIZE, 1, 2, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - - MPI_Info_create(&info); - /* I am setting these info values for testing purposes only. It is - better to use the default values in practice. */ - MPI_Info_set(info, "ind_rd_buffer_size", "1209"); - MPI_Info_set(info, "ind_wr_buffer_size", "1107"); - - if (!mynod) { - MPI_File_delete(filename, MPI_INFO_NULL); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, info, &fh); - for (i=0; i<BUFSIZE; i++) writebuf[i] = 0; - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status); - MPI_File_close(&fh); -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous accesses\n"); -#endif - } - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<BUFSIZE; i++) writebuf[i] = 10; - for (i=0; i<BUFSIZE; i++) readbuf[i] = 20; - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, info, &fh); - MPI_File_set_atomicity(fh, 1); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status); - else { - err = MPI_File_read(fh, readbuf, BUFSIZE, MPI_INT, &status); - if (err == MPI_SUCCESS) { - if (readbuf[0] == 0) { - for (i=1; i<BUFSIZE; i++) - if (readbuf[i] != 0) { - errs++; - fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 0\n", mynod, i, readbuf[i]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - else if (readbuf[0] == 10) { - for (i=1; i<BUFSIZE; i++) - if (readbuf[i] != 10) { - errs++; - fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 10\n", mynod, i, readbuf[i]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - else { - errs++; - fprintf(stderr, "Process %d: readbuf[0] is %d, should be either 0 or 10\n", mynod, readbuf[0]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - MPI_Type_free(&newtype); - MPI_Info_free(&info); - free(writebuf); - free(readbuf); - free(filename); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/big_extents.c b/3rd-party/romio321/test/big_extents.c deleted file mode 100644 index a1a9e5ff68ba25687c7f1b24ccc431afbfd7838e..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/big_extents.c +++ /dev/null @@ -1,212 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2007 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -/* a test to exercise very large extents: on most platforms with 32 bit - * integers, we'd expect these tests to give unexpected values. On platforms - * with 64 bit integers, these tests will be fine. On BlueGene we're not sure - * yet :> - */ - - -#include <mpi.h> -#include <stdint.h> -#include <math.h> -#include <stdio.h> - -#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, NULL); } - - -static void handle_error(int errcode, char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -static void typestats(MPI_Datatype type) -{ - MPI_Aint lb, extent; - MPI_Count size; - - MPI_Type_get_extent(type, &lb, &extent); - MPI_Type_size_x(type, &size); - - printf("dtype %d: lb = %ld extent = %ld size = %ld...", - type, (long)lb, (long)extent, size); - -} - -static int verify_type(char *filename, MPI_Datatype type, - int64_t expected_extent, int do_coll) -{ - int rank, canary; - MPI_Count tsize; - int compare=-1; - int errs=0, toterrs=0; - MPI_Status status; - MPI_File fh; - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - CHECK( MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE|MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); - CHECK( MPI_File_set_view(fh, rank*sizeof(int), - MPI_BYTE, type, "native", MPI_INFO_NULL)); - - MPI_Type_size_x(type, &tsize); - - canary=rank+1000000; - - /* skip over first instance of type */ - if (do_coll) { - CHECK( MPI_File_write_at_all(fh, tsize, &canary, 1, MPI_INT, &status)); - } else { - CHECK( MPI_File_write_at(fh, tsize, &canary, 1, MPI_INT, &status)); - } - - CHECK( MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", - MPI_INFO_NULL)); - - if (do_coll) { - CHECK( MPI_File_read_at_all(fh, expected_extent/sizeof(int)+rank, - &compare, 1, MPI_INT, &status)); - } else { - CHECK( MPI_File_read_at(fh, expected_extent/sizeof(int)+rank, - &compare, 1, MPI_INT, &status)); - } - - if (compare != canary) - errs=1; - MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - - MPI_File_close(&fh); - - if (toterrs) { - printf("%d: got %d expected %d\n", rank, compare, canary); - /* keep file if there's an error */ - } else { - if (rank == 0) MPI_File_delete(filename, MPI_INFO_NULL); - } - - return (toterrs); - -} - -static int testtype(char *filename, MPI_Datatype type, int64_t expected_extent) -{ - int rank, ret, errs=0; - int collective=1, nocollective=0; - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - if (!rank) typestats(type); - - ret = verify_type(filename, type, expected_extent, nocollective); - if (ret) { - errs++; - fprintf(stderr, "type %d failed indep\n", type); - } else - if (!rank) printf("indep: OK "); - - ret = verify_type(filename, type, expected_extent, collective); - if (ret) { - errs++; - fprintf(stderr, "type %d failed collective\n", type); - } else - if (!rank) printf("coll: OK\n"); - - return errs; -} - -int main(int argc, char **argv) -{ - int count=2; - int blocks[2]; - int disps[2]; - - int ndims=2; - int sizes[2]; - int subs[2]; - int starts[2]; - - MPI_Datatype baseindex, indexed1G, indexed3G, indexed6G; - MPI_Datatype subarray1G, subarray3G, subarray6G; - int ret, rank; - - MPI_Init(&argc, &argv); - - if (argc != 2) { - fprintf(stderr, "usage: %s <filename>\n", argv[0]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - /* base type: 1MB indexed type of ints*/ - count = 2; - blocks[0] = 1; - disps[0] = 0; - blocks[1] = 1; - disps[1] = 1024*256-1; - - MPI_Type_indexed(count, blocks, disps, MPI_INT, &baseindex); - /* simple case: 1GB extent */ - MPI_Type_contiguous(1024, baseindex, &indexed1G); - MPI_Type_commit(&indexed1G); - - /* a little trickier: 3Gb extent */ - MPI_Type_contiguous(3072, baseindex, &indexed3G); - MPI_Type_commit(&indexed3G); - - /* and finally 6GB extent */ - MPI_Type_contiguous(6144, baseindex, &indexed6G); - MPI_Type_commit(&indexed6G); - - /* TODO: - * - add a darray test - * - add a test with crazy extents */ - sizes[0] = 1024*16; - sizes[1] = 1024*16; - subs[0] = subs[1] = 256; - starts[0] = starts[1] = 0; - - MPI_Type_create_subarray(ndims, sizes, subs, starts, - MPI_ORDER_C, MPI_INT, &subarray1G); - MPI_Type_commit(&subarray1G); - - sizes[1] = 1024*16*3; - MPI_Type_create_subarray(ndims, sizes, subs, starts, - MPI_ORDER_C, MPI_INT, &subarray3G); - MPI_Type_commit(&subarray3G); - - sizes[1] = 1024*16*6; - MPI_Type_create_subarray(ndims, sizes, subs, starts, - MPI_ORDER_C, MPI_INT, &subarray6G); - MPI_Type_commit(&subarray6G); - - /* assume command line arguments make it out to all processes */ - ret = testtype(argv[1], indexed1G, (int64_t)1024*1024*1024); - - ret = testtype(argv[1], indexed3G, (int64_t)1024*1024*1024*3); - - ret = testtype(argv[1], indexed6G, (int64_t)1024*1024*1024*6); - - ret = testtype(argv[1], subarray1G, (int64_t)1024*1024*1024); - - ret = testtype(argv[1], subarray3G, (int64_t)1024*1024*1024*3); - - ret = testtype(argv[1], subarray6G, (int64_t)1024*1024*1024*6); - - if(!ret && !rank) fprintf(stderr, " No Errors\n"); - - MPI_Finalize(); - return (-ret); - -} -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/test/coll_perf.c b/3rd-party/romio321/test/coll_perf.c deleted file mode 100644 index 0f9042d5ff54b400265f9a4b99aed3535765e514..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/coll_perf.c +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* The file name is taken as a command-line argument. */ - -/* Measures the I/O bandwidth for writing/reading a 3D - block-distributed array to a file corresponding to the global array - in row-major (C) order. - Note that the file access pattern is noncontiguous. - - Array size 128^3. For other array sizes, change array_of_gsizes below.*/ - - -int main(int argc, char **argv) -{ - MPI_Datatype newtype; - int i, ndims, array_of_gsizes[3], array_of_distribs[3]; - int order, nprocs, len, *buf, mynod; - MPI_Count bufcount; - int array_of_dargs[3], array_of_psizes[3]; - MPI_File fh; - MPI_Status status; - double stim, write_tim, new_write_tim, write_bw; - double read_tim, new_read_tim, read_bw; - char *filename; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: coll_perf -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - ndims = 3; - order = MPI_ORDER_C; - - array_of_gsizes[0] = 128*17; - array_of_gsizes[1] = 128*9; - array_of_gsizes[2] = 128*11; - - array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; - - array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; - - for (i=0; i<ndims; i++) array_of_psizes[i] = 0; - MPI_Dims_create(nprocs, ndims, array_of_psizes); - - MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, - array_of_distribs, array_of_dargs, - array_of_psizes, order, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - - MPI_Type_size_x(newtype, &bufcount); - bufcount = bufcount/sizeof(int); - buf = (int *) malloc(bufcount * sizeof(int)); - -/* to eliminate paging effects, do the operations once but don't time - them */ - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status); - MPI_File_seek(fh, 0, MPI_SEEK_SET); - MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status); - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); -/* now time write_all */ - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status); - write_tim = MPI_Wtime() - stim; - MPI_File_close(&fh); - - MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - - if (mynod == 0) { - write_bw = (array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]*sizeof(int))/(new_write_tim*1024.0*1024.0); - fprintf(stderr, "Global array size %d x %d x %d integers\n", array_of_gsizes[0], array_of_gsizes[1], array_of_gsizes[2]); - fprintf(stderr, "Collective write time = %f sec, Collective write bandwidth = %f Mbytes/sec\n", new_write_tim, write_bw); - } - - MPI_Barrier(MPI_COMM_WORLD); -/* now time read_all */ - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status); - read_tim = MPI_Wtime() - stim; - MPI_File_close(&fh); - - MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - - if (mynod == 0) { - read_bw = (array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]*sizeof(int))/(new_read_tim*1024.0*1024.0); - fprintf(stderr, "Collective read time = %f sec, Collective read bandwidth = %f Mbytes/sec\n", new_read_tim, read_bw); - } - - MPI_Type_free(&newtype); - free(buf); - free(filename); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/coll_test.c b/3rd-party/romio321/test/coll_test.c deleted file mode 100644 index 4efc4d25b026c26cc87648cc7cc93cbba8f7dc08..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/coll_test.c +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -/* A 32^3 array. For other array sizes, change array_of_gsizes below. */ - -/* Uses collective I/O. Writes a 3D block-distributed array to a file - corresponding to the global array in row-major (C) order, reads it - back, and checks that the data read is correct. */ - -/* The file name is taken as a command-line argument. */ - -/* Note that the file access pattern is noncontiguous. */ - -void handle_error(int errcode, const char *str); - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -int main(int argc, char **argv) -{ - MPI_Datatype newtype; - int i, ndims, array_of_gsizes[3], array_of_distribs[3]; - int order, nprocs, j, len; - int array_of_dargs[3], array_of_psizes[3]; - int *readbuf, *writebuf, mynod, *tmpbuf, array_size; - MPI_Count bufcount; - char *filename; - int errs=0, toterrs; - MPI_File fh; - MPI_Status status; - MPI_Request request; - MPI_Info info = MPI_INFO_NULL; - int errcode; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - -/* create the distributed array filetype */ - ndims = 3; - order = MPI_ORDER_C; - - array_of_gsizes[0] = 32; - array_of_gsizes[1] = 32; - array_of_gsizes[2] = 32; - - array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; - - array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; - - for (i=0; i<ndims; i++) array_of_psizes[i] = 0; - MPI_Dims_create(nprocs, ndims, array_of_psizes); - - MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, - array_of_distribs, array_of_dargs, - array_of_psizes, order, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - -/* initialize writebuf */ - - MPI_Type_size_x(newtype, &bufcount); - bufcount = bufcount/sizeof(int); - writebuf = (int *) malloc(bufcount * sizeof(int)); - for (i=0; i<bufcount; i++) writebuf[i] = 1; - - array_size = array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]; - tmpbuf = (int *) calloc(array_size, sizeof(int)); - MPI_Irecv(tmpbuf, 1, newtype, mynod, 10, MPI_COMM_WORLD, &request); - MPI_Send(writebuf, bufcount, MPI_INT, mynod, 10, MPI_COMM_WORLD); - MPI_Wait(&request, &status); - - j = 0; - for (i=0; i<array_size; i++) - if (tmpbuf[i]) { - writebuf[j] = i; - j++; - } - free(tmpbuf); - - if (j != bufcount) { - fprintf(stderr, "Error in initializing writebuf on process %d\n", mynod); - MPI_Abort(MPI_COMM_WORLD, 1); - } -/* end of initialization */ - - /* write the array to the file */ - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open"); - - errcode = MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_set_view"); - - errcode = MPI_File_write_all(fh, writebuf, bufcount, MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_write_all"); - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close"); - - if (!mynod) { - /* wkl suggests potential for false " No Errors" if both read - * and write use the same file view */ - /* solution: rank 0 reads entire file and checks write values */ - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_RDONLY, info, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open"); - - readbuf = (int *) malloc(array_size * sizeof(int)); - errcode = MPI_File_read(fh, readbuf, array_size, MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_read"); - - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close"); - - for (i=0; i<array_size; i++) - if (readbuf[i] != i) { - errs++; - fprintf(stderr, "Error: write integer %d but read %d\n", - i,readbuf[i]); - break; - } - free(readbuf); - } - MPI_Barrier(MPI_COMM_WORLD); - - /* now read it back */ - readbuf = (int *) malloc(bufcount * sizeof(int)); - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open"); - - errcode = MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_set_view"); - errcode = MPI_File_read_all(fh, readbuf, bufcount, MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_read_all"); - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close"); - - /* check the data read */ - for (i=0; i<bufcount; i++) { - if (readbuf[i] != writebuf[i]) { - errs++; - fprintf(stderr, "Process %d, readbuf %d, writebuf %d, i %d\n", mynod, readbuf[i], writebuf[i], i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - MPI_Type_free(&newtype); - free(readbuf); - free(writebuf); - free(filename); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/creat_excl.c b/3rd-party/romio321/test/creat_excl.c deleted file mode 100644 index 858df00e8a1bd769eab4eeb475b32eeac6afbb11..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/creat_excl.c +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -/* - * the new defered open code made some changes to the way we manage CREAT|EXCL, - * so test out that code path */ - -struct options { - char *fname; - int verbose; - int do_aggregation; -}; -typedef struct options options; - - -void handle_error(int errcode, char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -void parse_args(int argc, char ** argv, int rank, options *opts) -{ - int i, len=0; - if (rank == 0) { - i = 1; - while (i < argc) { - if (strcmp("-fname", argv[i]) == 0) { - len = strlen(argv[i+1]); - opts->fname = (char *) malloc(len + 1); - strcpy(opts->fname, argv[i+1]); - i+=2;/* option and argument */ - continue; - } - if (strcmp("-aggregate", argv[i]) == 0) { - opts->do_aggregation = 1; - i++; - continue; - } - if (strcmp("-verbose", argv[i]) == 0) { - opts->verbose = 1; - i++; - continue; - } - } - if (opts->fname == NULL) { /* didn't get a filename */ - fprintf(stderr, "Usage: %s -fname filename [-aggregate] [-verbose]\n", argv[0]); - MPI_Abort(MPI_COMM_WORLD, 1); - } - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(opts->fname, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); - } else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - opts->fname = (char *) malloc(len + 1); - MPI_Bcast(opts->fname, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); - } - -} - -int main(int argc, char ** argv) { - int nprocs, mynod, errcode; - options my_options = {NULL, 0, 0}; - MPI_File fh; - MPI_Status status; - MPI_Info info; - - MPI_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - parse_args(argc, argv, mynod, &my_options); - - if (my_options.do_aggregation) { - MPI_Info_create(&info); - MPI_Info_set(info, "romio_no_indep_rw", "true"); - MPI_Info_set(info, "cb_config_list", "leela.mcs.anl.gov:1"); - } else { - info = MPI_INFO_NULL; - } - - /* create the file w/o EXCL: this must not fail */ - errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, - MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_close"); - } - - /* now try to open w/ CREAT|EXCL: this must fail */ - errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, - MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_RDWR, info, &fh); - if (errcode == MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open: expected an error: got"); - } - - /* ignore the error: File_delete is not aggregator-aware */ - MPI_File_delete(my_options.fname, info); - - /* this must succeed: the file no longer exists */ - errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, - MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_RDWR, info, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_close"); - } - - if (mynod == 0) { - printf(" No Errors\n"); - } - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/darray_read.c b/3rd-party/romio321/test/darray_read.c deleted file mode 100644 index 7b8e4c59e8c5336c0a46df4dc096b64887d25929..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/darray_read.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <mpi.h> - -#define NSIDE 5 -#define NBLOCK 3 -#define NPROC 2 - -#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn);} - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - - -int main(int argc, char *argv[]) -{ - int i, j, nerrors=0, total_errors=0; - - int rank, size; - int bpos; - - MPI_Datatype darray; - MPI_Status status; - MPI_File mpi_fh; - - /* Define array distribution - A 2x2 block size works with ROMIO, a 3x3 block size breaks it. */ - int distrib[2] = { MPI_DISTRIBUTE_CYCLIC, MPI_DISTRIBUTE_CYCLIC }; - int bsize[2] = { NBLOCK, NBLOCK }; - int gsize[2] = { NSIDE, NSIDE }; - int psize[2] = { NPROC, NPROC }; - - double data[NSIDE*NSIDE]; - double *ldata, *pdata; - - int tsize, nelem; - - MPI_File dfile; - - MPI_Init(&argc, &argv); - - MPI_Comm_size(MPI_COMM_WORLD, &size); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - /* Set up type */ - CHECK(MPI_Type_create_darray(size, rank, 2, gsize, distrib, - bsize, psize, MPI_ORDER_FORTRAN, MPI_DOUBLE, &darray)); - CHECK(MPI_Type_commit(&darray)); - CHECK(MPI_Type_size(darray, &tsize)); - nelem = tsize / sizeof(double); - - for(i = 0; i < (NSIDE*NSIDE); i++) data[i] = i; - - if (rank == 0) { - CHECK(MPI_File_open(MPI_COMM_SELF, argv[1], - MPI_MODE_CREATE|MPI_MODE_WRONLY, MPI_INFO_NULL, &dfile)); - CHECK(MPI_File_write(dfile, data, NSIDE*NSIDE, MPI_DOUBLE, &status)); - CHECK(MPI_File_close(&dfile)); - } - MPI_Barrier(MPI_COMM_WORLD); - - /* Allocate buffer */ - ldata = (double *)malloc(tsize); - pdata = (double *)malloc(tsize); - - /* Use Pack to pull out array */ - bpos = 0; - CHECK(MPI_Pack(data, 1, darray, pdata, tsize, &bpos, MPI_COMM_WORLD)); - - MPI_Barrier(MPI_COMM_WORLD); - - /* Read in array from file. */ - CHECK(MPI_File_open(MPI_COMM_WORLD, argv[1], MPI_MODE_RDONLY, MPI_INFO_NULL, &mpi_fh)); - CHECK(MPI_File_set_view(mpi_fh, 0, MPI_DOUBLE, darray, "native", MPI_INFO_NULL)); - CHECK(MPI_File_read_all(mpi_fh, ldata, nelem, MPI_DOUBLE, &status)); - CHECK(MPI_File_close(&mpi_fh)); - - for(i = 0; i < size; i++) { -#ifdef VERBOSE - MPI_Barrier(MPI_COMM_WORLD); - if(rank == i) { - printf("=== Rank %i === (%i elements) \nPacked: ", rank, nelem); - for(j = 0; j < nelem; j++) { - printf("%4.1f ", pdata[j]); - fflush(stdout); - } - printf("\nRead: "); - for(j = 0; j < nelem; j++) { - printf("%4.1f ", ldata[j]); - fflush(stdout); - } - printf("\n\n"); - fflush(stdout); - } -#endif - if(rank == i) { - for (j=0; j< nelem; j++) { - if (pdata[j] != ldata[j]) { - fprintf(stderr, "rank %d at index %d: packbuf %4.1f filebuf %4.1f\n", - rank, j, pdata[j], ldata[j]); - nerrors++; - } - } - } - } - MPI_Allreduce(&nerrors, &total_errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - if (rank == 0 && total_errors == 0) - printf(" No Errors\n"); - - free(ldata); - free(pdata); - MPI_Type_free(&darray); - MPI_Finalize(); - - exit(total_errors); - -} diff --git a/3rd-party/romio321/test/error.c b/3rd-party/romio321/test/error.c deleted file mode 100644 index ee24e964596fcd8e60781f7a17306215e827e021..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/error.c +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define VERBOSE 0 -/* tests if error message is printed correctly */ - -int main(int argc, char **argv) -{ - int i, rank, len, err; - int errs = 0; - char *filename, *tmp; - MPI_File fh; - char string[MPI_MAX_ERROR_STRING]; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -#if VERBOSE - if (!rank) { - fprintf(stderr, "Tests if errors are reported correctly...\n"); - fprintf(stderr, "Should say \"Invalid displacement argument\"\n\n"); - } -#endif - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - err = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE+MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - err = MPI_File_set_view(fh, -1, MPI_BYTE, MPI_BYTE, "native", - MPI_INFO_NULL); - /* disp is deliberately passed as -1 */ - - /* This test is designed for ROMIO specifically and tests for a - specific error message */ - if (err != MPI_SUCCESS) { - MPI_Error_string(err, string, &len); - if (!rank) { -#if VERBOSE - fprintf(stderr, "%s\n", string); -#else - /* check for the word "displacement" in the message. - This allows other formatting of the message */ - if (strstr( string, "displacement" ) == 0) { - fprintf( stderr, "Unexpected error message %s\n", string ); - errs++; - } -#endif - } - } - else { - errs++; - fprintf( stderr, "File set view did not return an error\n" ); - } - - MPI_File_close(&fh); - - free(filename); - free(tmp); - - if (!rank) { - if (errs == 0) { - printf( " No Errors\n" ); - } - else { - printf( " Found %d errors\n", errs ); - } - } - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/excl.c b/3rd-party/romio321/test/excl.c deleted file mode 100644 index e48bb3deee5bd70d2760c3e6d167a579a0722483..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/excl.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests MPI_MODE_EXCL */ - -int main(int argc, char **argv) -{ - MPI_File fh; - int rank, len, err, i; - int errs=0, toterrs; - char *filename; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: excl -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - if (!rank) MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); - - /* this open should succeed */ - err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL , &fh); - if (err != MPI_SUCCESS) { - errs++; - fprintf(stderr, "Process %d: open failed when it should have succeeded\n", rank); - } - else MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - /* this open should fail */ - err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL , &fh); - if (err == MPI_SUCCESS) { - errs++; - fprintf(stderr, "Process %d: open succeeded when it should have failed\n", rank); - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/external32.c b/3rd-party/romio321/test/external32.c deleted file mode 100644 index bca3555ae86909c102a9848a7f901bda9ee71911..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/external32.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This code was written by Intel Corporation. Copyright (C) 2011-2012 Intel Corporation. - * Intel provides this material to Argonne National Laboratory subject to - * Software Grant and Corporate Contributor License Agreement dated February 8, 2012. - * - * See COPYRIGHT in top-level directory. - */ - -#include <stdlib.h> -#include <stdio.h> -#include "mpi.h" - -#define TEST_LE 0x1 -#define TEST_BE 0x2 -#define TEST_FILENAME "test.datarep" - -#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, NULL); } - -static void handle_error(int errcode, char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: (%d) %s\n", str, errcode, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - - - -static void is_little_or_big_endian( const char* datarep, char* c, char* c_le, int len ) { - int i, is_le = 1, is_be = 1; - for( i = 0; i < len; i++ ) { - is_le = is_le && ( c[i] == c_le[i] ); - is_be = is_be && ( c[i] == c_le[len-1-i] ); - } - printf( "%s datarep is ", datarep ); - switch ((is_le ? TEST_LE : 0x0) | (is_be ? TEST_BE : 0x0) ) { - case TEST_LE: printf( "LITTLE ENDIAN\n" ); break; - case TEST_BE: printf( "BIG ENDIAN\n" ); break; - case TEST_LE | TEST_BE: printf( "LITTLE or BIG ENDIAN\n" ); break; - default: printf( "unknown\n" ); break; - } -} - -/* This test checks if datareps given are little- or big-endian */ -int main( int argc, char* argv[] ) { - int sample_i = 123456789, i, j; - char sample_i_le[4] = {0x15,0xcd,0x5b,0x07}, c[4]; - const char* datarep[3] = { "native", "external32", "internal" }; - MPI_File fileh; - int rank; - FILE* fileh_std; - - if( sizeof(int) != 4 ) { printf( "non-supported sizeof(int)=%ld\n", sizeof(int) ); return (-1); } - - MPI_Init( &argc, &argv ); - MPI_Comm_rank( MPI_COMM_WORLD, &rank ); - - /* For each datarep */ - for( i = 0; i < 3; i++ ) { - - /* Open file */ - CHECK(MPI_File_open( MPI_COMM_WORLD, TEST_FILENAME, - MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fileh ) ); - - /* Set view */ - CHECK(MPI_File_set_view( fileh, 0, MPI_INT, MPI_INT, datarep[i], MPI_INFO_NULL )); - - /* Write into file */ - CHECK(MPI_File_write_at( fileh, (MPI_Offset)rank, (void*)&sample_i, 1, - MPI_INT, MPI_STATUS_IGNORE )); - - /* Close file */ - CHECK(MPI_File_close( &fileh )); - - /* Check if your datarep is little or big endian */ - MPI_Barrier( MPI_COMM_WORLD ); - if( rank == 0 ) { - fileh_std = fopen( TEST_FILENAME, "r" ); - for( j = 0; j < 4; j++ ) { - if( feof( fileh_std ) ) { printf( "unexpected eof, aborted\n" ); return (-1); } - fscanf( fileh_std, "%c", &c[j] ); - } - is_little_or_big_endian( datarep[i], c, sample_i_le, 4 ); - fclose( fileh_std ); - } - - /* Delete file */ - if( rank == 0 ) { - CHECK(MPI_File_delete( TEST_FILENAME, MPI_INFO_NULL )); - } - } - - MPI_Finalize(); - - return 0; -} diff --git a/3rd-party/romio321/test/file_info.c b/3rd-party/romio321/test/file_info.c deleted file mode 100644 index fba618974fcd1aa7e4738b7aea35f8bd18a1c955..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/file_info.c +++ /dev/null @@ -1,421 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -/* Change for BG/L made by Hao Yu, yuh@us.ibm.com - */ - -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} -/* this test wants to compare the hints it gets from a file with a set of - * default hints. These hints are specific to the MPI-IO implementation, so if - * you want to test something besides the default you'll have to use a command - * line argument */ - -typedef struct hint_defaults { - int cb_buffer_size; - int ind_rd_buffer_size; - int ind_wr_buffer_size; - const char *romio_cb_read; - const char *romio_cb_write; - const char *cb_config_list; -} hint_defaults; - -hint_defaults UFS_DEFAULTS = { - .cb_buffer_size = 16777216, - .ind_rd_buffer_size = 4194304, - .ind_wr_buffer_size = 524288, - .romio_cb_read = "automatic", - .romio_cb_write = "automatic", - .cb_config_list = "*:1" -}; - -hint_defaults BLUEGENE_DEFAULTS = { - .cb_buffer_size = 16777216, - .ind_rd_buffer_size = 4194304, - .ind_wr_buffer_size = 4194304, - .romio_cb_read = "enable", - .romio_cb_write = "enable", - .cb_config_list = NULL}; - -/* #undef INFO_DEBUG */ - -/* Test will print out information about unexpected hint keys or values that - * differ from the default. Since this is often interesting but rarely an - * error, default will be to increment errror cound for true error conditions - * but not print out these "interesting" non-error cases. */ - -static int verbose = 0; -static int test_ufs = 0; -static int test_bluegene = 0; - -int main(int argc, char **argv) -{ - int i, len, nkeys, flag, mynod, default_striping_factor=0, nprocs, errs = 0; - MPI_File fh; - MPI_Info info, info_used; - char *filename, key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL]; - hint_defaults *defaults; - int ret; - - MPI_Init(&argc,&argv); - - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - if (!strcmp("-v", *argv)) verbose = 1; - else if (!strcmp("-u", *argv)) test_ufs = 1; - else if (!strcmp("-b", *argv)) test_bluegene = 1; - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: file_info [-v] -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&test_ufs, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&test_bluegene, 1, MPI_INT, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&test_ufs, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&test_bluegene, 1, MPI_INT, 0, MPI_COMM_WORLD); - } - if (test_ufs) { - defaults = &UFS_DEFAULTS; - } else if (test_bluegene) { - defaults = &BLUEGENE_DEFAULTS; - } else { - defaults = NULL; - } - - -/* open the file with MPI_INFO_NULL */ - ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_open"); - -/* check the default values set by ROMIO */ - MPI_File_get_info(fh, &info_used); - MPI_Info_get_nkeys(info_used, &nkeys); - - if (defaults != NULL) { - for (i=0; i<nkeys; i++) { - MPI_Info_get_nthkey(info_used, i, key); - MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL-1, value, &flag); -#ifdef INFO_DEBUG - if (!mynod) - fprintf(stderr, "Process %d, Default: key = %s, value = %s\n", mynod, - key, value); -#endif - if (!strcmp("striping_factor", key)) { - default_striping_factor = atoi(value); - /* no check */ - } - else if (!strcmp("cb_buffer_size", key)) { - if (atoi(value) != defaults->cb_buffer_size) { - errs++; - if (verbose) fprintf(stderr, "cb_buffer_size is %d; should be %d\n", - atoi(value), defaults->cb_buffer_size); - } - } - else if (!strcmp("romio_cb_read", key)) { - if (strcmp(defaults->romio_cb_read, value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_read is set to %s; should be %s\n", - value, defaults->romio_cb_read); - } - } - else if (!strcmp("romio_cb_write", key)) { - if (strcmp(defaults->romio_cb_write, value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_write is set to %s; should be %s\n", - value, defaults->romio_cb_write); - } - } - else if (!strcmp("cb_nodes", key)) { - /* unreliable test -- just ignore value */ - } - else if (!strcmp("romio_no_indep_rw", key)) { - if (strcmp("false", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n", - value, "false"); - } - } - else if (!strcmp("ind_rd_buffer_size", key)) { - if (atoi(value) != defaults->ind_rd_buffer_size) { - errs++; - if (verbose) fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n", - atoi(value), defaults->ind_rd_buffer_size); - } - } - else if (!strcmp("ind_wr_buffer_size", key)) { - if (atoi(value) != defaults->ind_wr_buffer_size) { - errs++; - if (verbose) fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n", - atoi(value), defaults->ind_wr_buffer_size); - } - } - else if (!strcmp("romio_ds_read", key)) { - if (strcmp("automatic", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_ds_read is set to %s; should be %s\n", - value, "automatic"); - } - } - else if (!strcmp("romio_ds_write", key)) { - /* Unreliable test -- value is file system dependent. Ignore. */ - } - else if (!strcmp("cb_config_list", key)) { -#ifndef SKIP_CB_CONFIG_LIST_TEST - if (strcmp(defaults->cb_config_list, value)) { - errs++; - if (verbose) fprintf(stderr, "cb_config_list is set to %s; should be %s\n", - value, defaults->cb_config_list); - } -#endif - } - /* don't care about the defaults for these keys */ - else if (!strcmp("romio_cb_pfr", key)) { - } - else if (!strcmp("romio_cb_fr_types", key)) { - } - else if (!strcmp("romio_cb_fr_alignment", key)) { - } - else if (!strcmp("romio_cb_ds_threshold", key)) { - } - else if (!strcmp("romio_cb_alltoall", key)) { - } - else { - if (verbose) fprintf(stderr, "unexpected key %s (not counted as an error)\n", key); - } - } - } - MPI_Info_free(&info_used); - - MPI_File_close(&fh); - - /* delete the file */ - if (!mynod) MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); - -/* set new info values. */ - - MPI_Info_create(&info); - -/* The following four hints are accepted on all machines. They can - be specified at file-open time or later (any number of times). */ - - /* buffer size for collective I/O */ - MPI_Info_set(info, "cb_buffer_size", "8388608"); - - /* number of processes that actually perform I/O in collective I/O */ - sprintf(value, "%d", nprocs/2); - MPI_Info_set(info, "cb_nodes", value); - - /* buffer size for data sieving in independent reads */ - MPI_Info_set(info, "ind_rd_buffer_size", "2097152"); - - /* buffer size for data sieving in independent writes */ - MPI_Info_set(info, "ind_wr_buffer_size", "1048576"); - - -/* The following three hints related to file striping are accepted only - on Intel PFS and IBM PIOFS file systems and are ignored elsewhere. - They can be specified only at file-creation time; if specified later - they will be ignored. */ - - /* number of I/O devices across which the file will be striped. - accepted only if 0 < value < default_striping_factor; - ignored otherwise */ - if (default_striping_factor - 1 > 0) { - sprintf(value, "%d", default_striping_factor-1); - MPI_Info_set(info, "striping_factor", value); - } - else { - sprintf(value, "%d", default_striping_factor); - MPI_Info_set(info, "striping_factor", value); - } - - /* the striping unit in bytes */ - MPI_Info_set(info, "striping_unit", "131072"); - -#ifndef SKIP_CB_CONFIG_LIST_TEST - /* set the cb_config_list so we'll get deterministic cb_nodes output */ - MPI_Info_set(info, "cb_config_list", "*:*"); -#endif - - /* the I/O device number from which to start striping the file. - accepted only if 0 <= value < default_striping_factor; - ignored otherwise */ - sprintf(value, "%d", default_striping_factor-2); - MPI_Info_set(info, "start_iodevice", value); - - -/* The following hint about PFS server buffering is accepted only on - Intel PFS. It can be specified anytime. */ - MPI_Info_set(info, "pfs_svr_buf", "true"); - -/* open the file and set new info */ - ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_open"); - -/* check the values set */ - ret = MPI_File_get_info(fh, &info_used); - if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_get_info"); - MPI_Info_get_nkeys(info_used, &nkeys); - - for (i=0; i<nkeys; i++) { - MPI_Info_get_nthkey(info_used, i, key); - MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL-1, value, &flag); -#ifdef INFO_DEBUG - if (!mynod) fprintf(stderr, "Process %d, key = %s, value = %s\n", mynod, - key, value); -#endif - if (!strcmp("striping_factor", key)) { - if ((default_striping_factor - 1 > 0) && (atoi(value) != default_striping_factor-1)) { - errs++; - if (verbose) fprintf(stderr, "striping_factor is %d; should be %d\n", - atoi(value), default_striping_factor-1); - } - else if (atoi(value) != default_striping_factor) { - errs++; - if (verbose) fprintf(stderr, "striping_factor is %d; should be %d\n", - atoi(value), default_striping_factor); - } - } - else if (!strcmp("cb_buffer_size", key)) { - if (atoi(value) != 8388608) { - errs++; - if (verbose) fprintf(stderr, "cb_buffer_size is %d; should be %d\n", - atoi(value), 8388608); - } - } - /* only check the hints we set */ - else if (!strcmp("cb_nodes", key)) { - /* unreliable test: just skip */ - } - else if (!strcmp("romio_no_indep_rw", key)) { - if (strcmp("false", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n", - value, "false"); - } - } - else if (!strcmp("ind_rd_buffer_size", key)) { - if (atoi(value) != 2097152) { - errs++; - if (verbose) fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n", - atoi(value), 2097152); - } - } - else if (!strcmp("ind_wr_buffer_size", key)) { - if (atoi(value) != 1048576) { - errs++; - if (verbose) fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n", - atoi(value), 1048576); - } - } - else if (!strcmp("romio_ds_read", key)) { - if (strcmp("automatic", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_ds_read is set to %s; should be %s\n", - value, "automatic"); - } - } - else if (!strcmp("romio_ds_write", key)) { - /* Unreliable test -- value is file system dependent. Ignore. */ - } - else if (!strcmp("cb_config_list", key)) { -#ifndef SKIP_CB_CONFIG_LIST_TEST - if (strcmp("*:*", value)) { - errs++; - if (verbose) fprintf(stderr, "cb_config_list is set to %s; should be %s\n", - value, "*:*"); - } -#endif - } - else if (!strcmp("romio_cb_pfr", key)) { - if(strcmp("disable", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_pfr is set to %s; should be %s\n", - value, "automatic"); - } - } - else if (!strcmp("romio_cb_fr_types", key)) { - if(strcmp("aar", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_fr_types is set to %s; should be %s\n", - value, "aar"); - } - } - else if (!strcmp("romio_cb_fr_alignment", key)) { - if(strcmp("1", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_fr_alignment is set to %s; should be %s\n", - value, "1"); - } - } - else if (!strcmp("romio_cb_ds_threshold", key)) { - if(strcmp("0", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_ds_threshold is set to %s; should be %s\n", - value, "0"); - } - } - else if (!strcmp("romio_cb_alltoall", key)) { - if(strcmp("automatic", value)) { - errs++; - if (verbose) fprintf(stderr, "romio_cb_alltoall is set to %s; should be %s\n", - value, "automatic"); - } - } - - else { - if (verbose) fprintf(stderr, "unexpected key %s (not counted as an error)\n", key); - } - } - - /* Q: SHOULD WE BOTHER LOOKING AT THE OTHER PROCESSES? */ - if (!mynod) { - if (errs) fprintf(stderr, "Found %d errors.\n", errs); - else printf(" No Errors\n"); - } - - MPI_File_close(&fh); - free(filename); - MPI_Info_free(&info_used); - MPI_Info_free(&info); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/hindexed.c b/3rd-party/romio321/test/hindexed.c deleted file mode 100644 index ebc0ae81c65a09e7700c98c7ad3fa80014e6f857..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/hindexed.c +++ /dev/null @@ -1,260 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * (C) 2008 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -/* Wei-keng Liao (wkliao@ece.northwestern.edu) September 8, 2008 */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <mpi.h> - -#define YLEN 5 -#define XLEN 10 -#define SUB_XLEN 3 - -/* rjl: I was just too lazy to compute this at run-time */ -char compare_buf[XLEN*4][YLEN*4] = { - {'0','1','2',0,0,'3','4','5',0,0,'D','E','F',0,0,'G','H','I'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'6','7','8',0,0,'9',':',';',0,0,'J','K','L',0,0,'M','N','O'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'X','Y','Z',0,0,'[','\\',']',0,0,'l','m','n',0,0,'o','p','q'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'^','_','`',0,0,'a','b','c',0,0,'r','s','t',0,0,'u','v','w'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'0','1','2',0,0,'3','4','5',0,0,'D','E','F',0,0,'G','H','I'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'6','7','8',0,0,'9',':',';',0,0,'J','K','L',0,0,'M','N','O'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'X','Y','Z',0,0,'[','\\',']',0,0,'l','m','n',0,0,'o','p','q'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {'^','_','`',0,0,'a','b','c',0,0,'r','s','t',0,0,'u','v','w'}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -}; - - -/* set this if you want a dump of the global array -#define VERBOSE 1 -*/ - -/*----< main() >------------------------------------------------------------*/ -int main(int argc, char **argv) { - int i, j, err, rank, np, num_io; - char *buf, *filename; - int rank_dim[2], array_of_sizes[2]; - int array_of_subsizes[2]; - int count, *blocklengths, global_array_size; - MPI_Count ftype_size; - MPI_Aint *displacements; - MPI_File fh; - MPI_Datatype ftype; - MPI_Status status; - MPI_Offset offset=0; - int nr_errors=0; -#ifdef VERBOSE - int k; -#endif - - MPI_Init(&argc, &argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &np); - - if (np != 4) { - if (!rank) printf("Please run with 4 processes. Exiting ...\n\n"); - MPI_Finalize(); - return 1; - } - - filename = argv[1]; - - num_io = 2; - - /*-----------------------------------------------------------------------*/ - /* process rank in each dimension */ - rank_dim[0] = rank / 2; - rank_dim[1] = rank % 2; - - /* global 2D array size */ - array_of_sizes[0] = YLEN * 2; - array_of_sizes[1] = XLEN * 2; - - global_array_size = array_of_sizes[0] * array_of_sizes[1]; - - array_of_subsizes[0] = YLEN / 2; - array_of_subsizes[1] = XLEN * SUB_XLEN / 5; - - offset = rank_dim[0] * YLEN * array_of_sizes[1] + - rank_dim[1] * XLEN; - - /* define data type for file view */ - count = array_of_subsizes[0] * 2; /* 2 is the no. blocks along X */ - blocklengths = (int*) malloc(count*sizeof(int)); - displacements = (MPI_Aint*)malloc(count*sizeof(MPI_Aint)); - for (i=0; i<count; i++) - blocklengths[i] = array_of_subsizes[1] / 2; - for (i=0; i<array_of_subsizes[0]; i++) - for (j=0; j<2; j++) - displacements[i*2+j] = offset + i*2*array_of_sizes[1] + j * XLEN/2; - MPI_Type_create_hindexed(count, blocklengths, displacements, MPI_CHAR, &ftype); - MPI_Type_commit(&ftype); - MPI_Type_size_x(ftype, &ftype_size); - -/* subarray's layout in the global array - - P0's 's layout P1's layout - [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] | [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] -[ 0] 0 1 2 3 4 5 | D E F G H I -[ 1] | -[ 2] 6 7 8 9 : ; | J K L M N O -[ 3] | -[ 4] | -[ 5] | -[ 6] | -[ 7] | -[ 8] | -[ 9] | - - P2's 's layout P3's layout - [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] | [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] -[ 0] | -[ 1] | -[ 2] | -[ 3] | -[ 4] | -[ 5] X Y Z [ \ ] | l m n o p q -[ 6] | -[ 7] ^ _ ` a b c | r s t u v w -[ 8] | -[ 9] | -*/ - - /* initialize the write buffer */ - buf = (char*) malloc(array_of_subsizes[0]*array_of_subsizes[1]); - for (i=0; i<array_of_subsizes[0]*array_of_subsizes[1]; i++) - buf[i] = '0' + rank*20 + i%79; - - /* zero file contents ---------------------------------------------------*/ - if (rank == 0) { - char *wr_buf = (char*) calloc(num_io*global_array_size,1); - MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); - MPI_File_write(fh, wr_buf, num_io*global_array_size, MPI_CHAR, &status); - MPI_File_close(&fh); - free(wr_buf); - } - /* open the file --------------------------------------------------------*/ - err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); - if (err != MPI_SUCCESS) { - printf("Error: MPI_File_open() filename %s\n",filename); - MPI_Abort(MPI_COMM_WORLD, -1); - exit(1); - } - - /* MPI collective write */ - for (i=0; i<num_io; i++) { - offset = i * global_array_size; - /* set the file view */ - MPI_File_set_view(fh, offset, MPI_BYTE, ftype, "native", MPI_INFO_NULL); - MPI_File_write_all(fh, buf, ftype_size, MPI_CHAR, &status); - } - MPI_File_close(&fh); - - /* read and print file contents -----------------------------------------*/ - if (rank == 0) { - char *ptr; - char *rd_buf = (char*) calloc(num_io*global_array_size,1); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); - MPI_File_read(fh, rd_buf, num_io*global_array_size, MPI_CHAR, &status); - MPI_File_close(&fh); - -#ifdef VERBOSE - printf("-------------------------------------------------------\n"); - printf(" ["); - for (i=0; i<2; i++) { - for (j=0; j<XLEN; j++) printf(" %d",j); - printf(" "); - } - printf("]\n\n"); - - - ptr = rd_buf; - for (k=0; k<num_io; k++) { - for (i=0; i<2*YLEN; i++) { - printf("[%2d]",k*2*YLEN+i); - for (j=0; j<2*XLEN; j++) { - if (j>0 && j%XLEN==0) printf(" "); - if (*ptr != 0) - printf(" %c",*ptr); - else - printf(" "); - ptr++; - } - printf("\n"); - } - printf("\n"); - } -#endif - ptr = rd_buf; - for(i=0; i<2*YLEN*num_io; i++) { - for(j=0; j<2*XLEN; j++) { - if( *ptr != compare_buf[i][j]) { - fprintf(stderr, "expected %d got %d at [%d][%d]\n", - *ptr, compare_buf[i][j], i, j); - nr_errors++; - } - ptr++; - } - } - free(rd_buf); - - if (nr_errors == 0) - fprintf(stdout, " No Errors\n"); - else - fprintf(stderr, "Found %d errors\n", nr_errors); - } - - free(blocklengths); - free(displacements); - free(buf); - MPI_Type_free(&ftype); - MPI_Finalize(); - return 0; -} - -/* command-line outputs are: (the global array is written twice) - -% mpiexec -n 4 wkl_subarray -------------------------------------------------------- - [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ] - -[ 0] 0 1 2 3 4 5 D E F G H I -[ 1] -[ 2] 6 7 8 9 : ; J K L M N O -[ 3] -[ 4] -[ 5] X Y Z [ \ ] l m n o p q -[ 6] -[ 7] ^ _ ` a b c r s t u v w -[ 8] -[ 9] - -[10] 0 1 2 3 4 5 D E F G H I -[11] -[12] 6 7 8 9 : ; J K L M N O -[13] -[14] -[15] X Y Z [ \ ] l m n o p q -[16] -[17] ^ _ ` a b c r s t u v w -[18] -[19] - -*/ - diff --git a/3rd-party/romio321/test/i_noncontig.c b/3rd-party/romio321/test/i_noncontig.c deleted file mode 100644 index db5bd36f0f93e95142c36de9adacdbf83c74f7ce..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/i_noncontig.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests noncontiguous reads/writes using nonblocking I/O */ - -#define SIZE 5000 - -#define VERBOSE 0 - -int main(int argc, char **argv) -{ - int *buf, i, mynod, nprocs, len, b[3]; - int errs=0, toterrs; - MPI_Aint d[3]; - MPI_File fh; - MPI_Status status; - char *filename; - MPI_Datatype typevec, newtype, t[3]; - MPIO_Request req; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - if (nprocs != 2) { - fprintf(stderr, "Run this program on two processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: i_noncontig -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(SIZE*sizeof(int)); - - MPI_Type_vector(SIZE/2, 1, 2, MPI_INT, &typevec); - - b[0] = b[1] = b[2] = 1; - d[0] = 0; - d[1] = mynod*sizeof(int); - d[2] = SIZE*sizeof(int); - t[0] = MPI_LB; - t[1] = typevec; - t[2] = MPI_UB; - - MPI_Type_struct(3, b, d, t, &newtype); - MPI_Type_commit(&newtype); - MPI_Type_free(&typevec); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using nonblocking I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_iwrite(fh, buf, 1, newtype, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_iread_at(fh, 0, buf, 1, newtype, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, contiguous in file using nonblocking I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_iwrite_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_iread_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting contiguous in memory, noncontiguous in file using nonblocking I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_iwrite(fh, buf, SIZE, MPI_INT, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_iread_at(fh, 0, buf, SIZE, MPI_INT, &req); -#ifdef MPIO_USES_MPI_REQUEST - MPI_Wait(&req, &status); -#else - MPIO_Wait(&req, &status); -#endif - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if (buf[i] != i) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if (buf[i] != i + mynod*SIZE) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - } - } - - MPI_File_close(&fh); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - MPI_Type_free(&newtype); - free(buf); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/large_array.c b/3rd-party/romio321/test/large_array.c deleted file mode 100644 index 617c895dc9b392e9f6fa04f7ce67a9485dac062d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/large_array.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* Writes a 4-Gbyte distributed array, reads it back, and then deletes the - file. Uses collective I/O. */ -/* The file name is taken as a command-line argument. */ -/* Run it only on a machine with sufficient memory and a file system - on which ROMIO supports large files, i.e., PIOFS, XFS, SFS, and HFS */ - -/* This program will work only if the MPI implementation defines MPI_Aint - as a 64-bit integer. */ - -int main(int argc, char **argv) -{ - MPI_Datatype newtype; - int i, ndims, array_of_gsizes[3], array_of_distribs[3]; - int order, nprocs, len, flag, err; - int array_of_dargs[3], array_of_psizes[3]; - int *readbuf, *writebuf, mynod; - MPI_Count bufcount; - char filename[1024]; - MPI_File fh; - MPI_Status status; - MPI_Aint size_with_aint; - MPI_Offset size_with_offset; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: large_array -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - fprintf(stderr, "This program creates a 4 Gbyte file. Don't run it if you don't have that much disk space!\n"); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - -/* create the distributed array filetype */ - ndims = 3; - order = MPI_ORDER_C; - - array_of_gsizes[0] = 1024; - array_of_gsizes[1] = 1024; - array_of_gsizes[2] = 4*1024/sizeof(int); - - array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; - - array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; - - for (i=0; i<ndims; i++) array_of_psizes[i] = 0; - MPI_Dims_create(nprocs, ndims, array_of_psizes); - -/* check if MPI_Aint is large enough for size of global array. - if not, complain. */ - - size_with_aint = sizeof(int); - for (i=0; i<ndims; i++) size_with_aint *= array_of_gsizes[i]; - size_with_offset = sizeof(int); - for (i=0; i<ndims; i++) size_with_offset *= array_of_gsizes[i]; - if (size_with_aint != size_with_offset) { - fprintf(stderr, "Can't use an array of this size unless the MPI implementation defines a 64-bit MPI_Aint\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, - array_of_distribs, array_of_dargs, - array_of_psizes, order, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - -/* initialize writebuf */ - - MPI_Type_size_x(newtype, &bufcount); - bufcount = bufcount/sizeof(int); - writebuf = (int *) malloc(bufcount * sizeof(int)); - if (!writebuf) fprintf(stderr, "Process %d, not enough memory for writebuf\n", mynod); - for (i=0; i<bufcount; i++) writebuf[i] = mynod*1024 + i; - - /* write the array to the file */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - MPI_File_write_all(fh, writebuf, bufcount, MPI_INT, &status); - MPI_File_close(&fh); - - free(writebuf); - - /* now read it back */ - readbuf = (int *) calloc(bufcount, sizeof(int)); - if (!readbuf) fprintf(stderr, "Process %d, not enough memory for readbuf\n", mynod); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - MPI_File_read_all(fh, readbuf, bufcount, MPI_INT, &status); - MPI_File_close(&fh); - - /* check the data read */ - flag = 0; - for (i=0; i<bufcount; i++) - if (readbuf[i] != mynod*1024 + i) { - fprintf(stderr, "Process %d, readbuf=%d, writebuf=%d\n", mynod, readbuf[i], mynod*1024 + i); - flag = 1; - } - if (!flag) fprintf(stderr, "Process %d: data read back is correct\n", mynod); - - MPI_Type_free(&newtype); - free(readbuf); - - MPI_Barrier(MPI_COMM_WORLD); - if (!mynod) { - err = MPI_File_delete(filename, MPI_INFO_NULL); - if (err == MPI_SUCCESS) fprintf(stderr, "file deleted\n"); - } - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/large_file.c.in b/3rd-party/romio321/test/large_file.c.in deleted file mode 100644 index 3189e836fa29a74233fa05434efc2f13895466ed..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/large_file.c.in +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -/* writes a file of size 4 Gbytes and reads it back. - should be run on one process only*/ -/* The file name is taken as a command-line argument. */ -/* Can be used only on file systems on which ROMIO supports large files, - i.e., PIOFS, XFS, SFS, and HFS. */ - -#define SIZE 1048576*4 /* no. of long longs in each write/read */ -#define NTIMES 128 /* no. of writes/reads */ - -int main(int argc, char **argv) -{ - MPI_File fh; - MPI_Status status; - MPI_Offset size; - long long *buf, i; - char *filename; - int j, mynod, nprocs, len, flag, err; - - MPI_Init(&argc,&argv); - - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - - if (nprocs != 1) { - fprintf(stderr, "Run this program on one process only\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: large -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - fprintf(stderr, "This program creates an 4 Gbyte file. Don't run it if you don't have that much disk space!\n"); - - buf = (long long *) malloc(SIZE * sizeof(long long)); - if (!buf) { - fprintf(stderr, "not enough memory to allocate buffer\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - for (i=0; i<NTIMES; i++) { - for (j=0; j<SIZE; j++) - buf[j] = i*SIZE + j; - - err = MPI_File_write(fh, buf, SIZE, MPI_DOUBLE, &status); - /* MPI_DOUBLE because not all MPI implementations define - MPI_LONG_LONG_INT, even though the C compiler supports long long. */ - if (err != MPI_SUCCESS) { - fprintf(stderr, "MPI_File_write returned error\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - MPI_File_get_size(fh, &size); - fprintf(stderr, "file size = %@LL@ bytes\n", size); - - MPI_File_seek(fh, 0, MPI_SEEK_SET); - - for (j=0; j<SIZE; j++) buf[j] = -1; - - flag = 0; - for (i=0; i<NTIMES; i++) { - err = MPI_File_read(fh, buf, SIZE, MPI_DOUBLE, &status); - /* MPI_DOUBLE because not all MPI implementations define - MPI_LONG_LONG_INT, even though the C compiler supports long long. */ - if (err != MPI_SUCCESS) { - fprintf(stderr, "MPI_File_write returned error\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - for (j=0; j<SIZE; j++) - if (buf[j] != i*SIZE + j) { - fprintf(stderr, "error: buf %d is %@LL@, should be %@LL@ \n", j, buf[j], - i*SIZE + j); - flag = 1; - } - } - - if (!flag) fprintf(stderr, "Data read back is correct\n"); - MPI_File_close(&fh); - - free(buf); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/misc.c.in b/3rd-party/romio321/test/misc.c.in deleted file mode 100644 index 5fad3968c07c7c0ed589ad9a71c606f7fa8b2893..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/misc.c.in +++ /dev/null @@ -1,263 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -/* tests various miscellaneous functions. */ -#define VERBOSE 0 - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); -} - -int main(int argc, char **argv) -{ - int buf[1024], amode, flag, mynod, len, i; - int errs = 0, toterrs; - MPI_File fh; - MPI_Status status; - MPI_Datatype newtype; - MPI_Offset disp, offset; - MPI_Group group; - MPI_Datatype etype, filetype; - char datarep[25], *filename; - int errcode=0; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: misc -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - errcode = MPI_File_write(fh, buf, 1024, MPI_INT, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_write"); - } - - errcode = MPI_File_sync(fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_sync"); - } - - errcode = MPI_File_get_amode(fh, &amode); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_amode"); - } -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_get_amode\n"); -#endif - if (amode != (MPI_MODE_CREATE | MPI_MODE_RDWR)) { - errs++; - fprintf(stderr, "amode is %d, should be %d\n\n", - amode, MPI_MODE_CREATE | MPI_MODE_RDWR); - } - - errcode = MPI_File_get_atomicity(fh, &flag); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_atomicity"); - } - if (flag) { - errs++; - fprintf(stderr, "atomicity is %d, should be 0\n", flag); - } -#if VERBOSE - if (!mynod) fprintf(stderr, "setting atomic mode\n"); -#endif - errcode = MPI_File_set_atomicity(fh, 1); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_set_atomicity"); - } - errcode = MPI_File_get_atomicity(fh, &flag); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_atomicity"); - } - if (!flag) { - errs++; - fprintf(stderr, "atomicity is %d, should be 1\n", flag); - } - errcode = MPI_File_set_atomicity(fh, 0); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_set_atomicity"); - } -#if VERBOSE - if (!mynod) fprintf(stderr, "reverting back to nonatomic mode\n"); -#endif - - MPI_Type_vector(10, 10, 20, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - - errcode = MPI_File_set_view(fh, 1000, MPI_INT, newtype, "native", MPI_INFO_NULL); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_set_view"); - } -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_get_view\n"); -#endif - errcode = MPI_File_get_view(fh, &disp, &etype, &filetype, datarep); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_view"); - } - if ((disp != 1000) || strcmp(datarep, "native")) { - errs++; - fprintf(stderr, "disp = %@LL@, datarep = %s, should be 1000, native\n\n", disp, datarep); - } -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_get_byte_offset\n"); -#endif - errcode = MPI_File_get_byte_offset(fh, 10, &disp); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_byte_offset"); - } - if (disp != (1000+20*sizeof(int))) { - errs++; - fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", - disp, (int) (1000+20*sizeof(int))); - } - - errcode = MPI_File_get_group(fh, &group); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_group"); - } - -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_set_size\n"); -#endif - errcode = MPI_File_set_size(fh, 1000+15*sizeof(int)); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_set_size"); - } - MPI_Barrier(MPI_COMM_WORLD); - errcode = MPI_File_sync(fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_sync"); - } - errcode = MPI_File_get_size(fh, &disp); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_size"); - } - if (disp != 1000+15*sizeof(int)) { - errs++; - fprintf(stderr, "file size = %@LL@, should be %d\n\n", - disp, (int) (1000+15*sizeof(int))); - } - -#if VERBOSE - if (!mynod) fprintf(stderr, "seeking to eof and testing MPI_File_get_position\n"); -#endif - errcode = MPI_File_seek(fh, 0, MPI_SEEK_END); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_seek"); - } - errcode = MPI_File_get_position(fh, &disp); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_position"); - } - if (disp != 10) { - errs++; - fprintf(stderr, "file pointer posn = %@LL@, should be 10\n\n", disp); - } - -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_get_byte_offset\n"); -#endif - errcode = MPI_File_get_byte_offset(fh, disp, &offset); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_byte_offset"); - } - if (offset != (1000+20*sizeof(int))) { - errs++; - fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", - offset, (int) (1000+20*sizeof(int))); - } - MPI_Barrier(MPI_COMM_WORLD); - -#if VERBOSE - if (!mynod) fprintf(stderr, "testing MPI_File_seek with MPI_SEEK_CUR\n"); -#endif - errcode = MPI_File_seek(fh, -10, MPI_SEEK_CUR); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_seek"); - } - errcode = MPI_File_get_position(fh, &disp); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_position"); - } - errcode = MPI_File_get_byte_offset(fh, disp, &offset); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_get_byte_offset"); - } - if (offset != 1000) { - errs++; - fprintf(stderr, "file pointer posn in bytes = %@LL@, should be 1000\n\n", offset); - } - -#if VERBOSE - if (!mynod) fprintf(stderr, "preallocating disk space up to 8192 bytes\n"); -#endif - errcode = MPI_File_preallocate(fh, 8192); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_Preallocate"); - } - -#if VERBOSE - if (!mynod) fprintf(stderr, "closing the file and deleting it\n"); -#endif - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - if (!mynod) MPI_File_delete(filename, MPI_INFO_NULL); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - MPI_Type_free(&newtype); - MPI_Type_free(&filetype); - MPI_Group_free(&group); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/noncontig.c b/3rd-party/romio321/test/noncontig.c deleted file mode 100644 index 8be18dc67030b912630ad44f2724737cf75a1c99..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/noncontig.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests noncontiguous reads/writes using independent I/O */ - -#define SIZE 5000 - -#define VERBOSE 0 -int main(int argc, char **argv) -{ - int *buf, i, mynod, nprocs, len, b[3]; - int errs=0, toterrs; - MPI_Aint d[3]; - MPI_File fh; - MPI_Status status; - char *filename; - MPI_Datatype typevec, newtype, t[3]; - MPI_Info info; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - if (nprocs != 2) { - fprintf(stderr, "Run this program on two processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes (length first, then string) */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: noncontig -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(SIZE*sizeof(int)); - - MPI_Type_vector(SIZE/2, 1, 2, MPI_INT, &typevec); - - /* create a struct type with explicitly set LB and UB; displacements - * of typevec are such that the types for the two processes won't - * overlap. - */ - b[0] = b[1] = b[2] = 1; - d[0] = 0; - d[1] = mynod*sizeof(int); - d[2] = SIZE*sizeof(int); - t[0] = MPI_LB; - t[1] = typevec; - t[2] = MPI_UB; - - /* keep the struct, ditch the vector */ - MPI_Type_struct(3, b, d, t, &newtype); - MPI_Type_commit(&newtype); - MPI_Type_free(&typevec); - - MPI_Info_create(&info); - /* I am setting these info values for testing purposes only. It is - better to use the default values in practice. */ - MPI_Info_set(info, "ind_rd_buffer_size", "1209"); - MPI_Info_set(info, "ind_wr_buffer_size", "1107"); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using independent I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - - /* set the file view for each process -- now writes go into the non- - * overlapping but interleaved region defined by the struct type up above - */ - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - - /* fill our buffer with a pattern and write, using our type again */ - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write(fh, buf, 1, newtype, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - /* fill the entire buffer with -1's. read back with type. - * note that the result of this read should be that every other value - * in the buffer is still -1, as defined by our type. - */ - for (i=0; i<SIZE; i++) buf[i] = -1; - MPI_File_read_at(fh, 0, buf, 1, newtype, &status); - - /* check that all the values read are correct and also that we didn't - * overwrite any of the -1 values that we shouldn't have. - */ - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, contiguous in file using independent I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - - /* in this case we write to either the first half or the second half - * of the file space, so the regions are not interleaved. this is done - * by leaving the file view at its default. - */ - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - /* same as before; fill buffer with -1's and then read; every other - * value should still be -1 after the read - */ - for (i=0; i<SIZE; i++) buf[i] = -1; - MPI_File_read_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &status); - - /* verify that the buffer looks like it should */ - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting contiguous in memory, noncontiguous in file using independent I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - - /* set the file view so that we have interleaved access again */ - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - - /* this time write a contiguous buffer */ - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write(fh, buf, SIZE, MPI_INT, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - /* fill buffer with -1's; this time they will all be overwritten */ - for (i=0; i<SIZE; i++) buf[i] = -1; - MPI_File_read_at(fh, 0, buf, SIZE, MPI_INT, &status); - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if (buf[i] != i) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if (buf[i] != i + mynod*SIZE) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - } - } - - MPI_File_close(&fh); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - MPI_Type_free(&newtype); - MPI_Info_free(&info); - free(buf); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/noncontig_coll.c b/3rd-party/romio321/test/noncontig_coll.c deleted file mode 100644 index 2916776a63ce381f2008a363448817432cbe6f7d..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/noncontig_coll.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests noncontiguous reads/writes using collective I/O */ - -#define SIZE 5000 - -#define VERBOSE 0 -int main(int argc, char **argv) -{ - int *buf, i, mynod, nprocs, len, b[3]; - int errs=0, toterrs; - MPI_Aint d[3]; - MPI_File fh; - MPI_Status status; - char *filename; - MPI_Datatype typevec, newtype, t[3]; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - if (nprocs != 2) { - fprintf(stderr, "Run this program on two processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: noncontig_coll -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(SIZE*sizeof(int)); - - MPI_Type_vector(SIZE/2, 1, 2, MPI_INT, &typevec); - - b[0] = b[1] = b[2] = 1; - d[0] = 0; - d[1] = mynod*sizeof(int); - d[2] = SIZE*sizeof(int); - t[0] = MPI_LB; - t[1] = typevec; - t[2] = MPI_UB; - - MPI_Type_struct(3, b, d, t, &newtype); - MPI_Type_commit(&newtype); - MPI_Type_free(&typevec); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using collective I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write_all(fh, buf, 1, newtype, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_read_at_all(fh, 0, buf, 1, newtype, &status); - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting noncontiguous in memory, contiguous in file using collective I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write_at_all(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_read_at_all(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &status); - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if ((i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - if (!(i%2) && (buf[i] != i)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if ((i%2) && (buf[i] != i + mynod*SIZE)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - if (!(i%2) && (buf[i] != -1)) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - } - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { -#if VERBOSE - fprintf(stderr, "\ntesting contiguous in memory, noncontiguous in file using collective I/O\n"); -#endif - MPI_File_delete(filename, MPI_INFO_NULL); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - - for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE; - MPI_File_write_all(fh, buf, SIZE, MPI_INT, &status); - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - MPI_File_read_at_all(fh, 0, buf, SIZE, MPI_INT, &status); - - for (i=0; i<SIZE; i++) { - if (!mynod) { - if (buf[i] != i) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i); - } - } - else { - if (buf[i] != i + mynod*SIZE) { - errs++; - fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], i + mynod*SIZE); - } - } - } - - MPI_File_close(&fh); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - MPI_Type_free(&newtype); - free(buf); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/noncontig_coll2.c b/3rd-party/romio321/test/noncontig_coll2.c deleted file mode 100644 index 4699da89aca8c6fb4ed43fb2c07ce13872e9a27b..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/noncontig_coll2.c +++ /dev/null @@ -1,539 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* tests noncontiguous reads/writes using collective I/O */ - -/* this test is almost exactly like noncontig_coll.c with the following changes: - * - * . generalized file writing/reading to handle arbitrary number of processors - * . provides the "cb_config_list" hint with several permutations of the - * avaliable processors. - * [ makes use of code copied from ROMIO's ADIO code to collect the names of - * the processors ] - */ - -/* we are going to muck with this later to make it evenly divisible by however many compute nodes we have */ -#define STARTING_SIZE 5000 - -int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, - const char *msg, int verbose); - -#define ADIOI_Free free -#define ADIOI_Malloc malloc -#define FPRINTF fprintf -/* I have no idea what the "D" stands for; it's how things are done in adio.h - */ -struct ADIO_cb_name_arrayD { - int refct; - int namect; - char **names; -}; -typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; - -void handle_error(int errcode, const char *str); -int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp); -void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest); -void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest); -void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest); -void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest); - - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - - -/* cb_gather_name_array() - gather a list of processor names from all processes - * in a communicator and store them on rank 0. - * - * This is a collective call on the communicator(s) passed in. - * - * Obtains a rank-ordered list of processor names from the processes in - * "dupcomm". - * - * Returns 0 on success, -1 on failure. - * - * NOTE: Needs some work to cleanly handle out of memory cases! - */ -int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) -{ - /* this is copied from ROMIO, but since this test is for correctness, - * not performance, note that we have removed the parts where ROMIO - * uses a keyval to cache the name array. We'll just rebuild it if we - * need to */ - - char my_procname[MPI_MAX_PROCESSOR_NAME], **procname = 0; - int *procname_len = NULL, my_procname_len, *disp = NULL, i; - int commsize, commrank; - ADIO_cb_name_array array = NULL; - - MPI_Comm_size(comm, &commsize); - MPI_Comm_rank(comm, &commrank); - - MPI_Get_processor_name(my_procname, &my_procname_len); - - /* allocate space for everything */ - array = (ADIO_cb_name_array) malloc(sizeof(*array)); - if (array == NULL) { - return -1; - } - array->refct = 1; - - if (commrank == 0) { - /* process 0 keeps the real list */ - array->namect = commsize; - - array->names = (char **) ADIOI_Malloc(sizeof(char *) * commsize); - if (array->names == NULL) { - return -1; - } - procname = array->names; /* simpler to read */ - - procname_len = (int *) ADIOI_Malloc(commsize * sizeof(int)); - if (procname_len == NULL) { - return -1; - } - } - else { - /* everyone else just keeps an empty list as a placeholder */ - array->namect = 0; - array->names = NULL; - } - /* gather lengths first */ - MPI_Gather(&my_procname_len, 1, MPI_INT, - procname_len, 1, MPI_INT, 0, comm); - - if (commrank == 0) { -#ifdef CB_CONFIG_LIST_DEBUG - for (i=0; i < commsize; i++) { - FPRINTF(stderr, "len[%d] = %d\n", i, procname_len[i]); - } -#endif - - for (i=0; i < commsize; i++) { - /* add one to the lengths because we need to count the - * terminator, and we are going to use this list of lengths - * again in the gatherv. - */ - procname_len[i]++; - procname[i] = malloc(procname_len[i]); - if (procname[i] == NULL) { - return -1; - } - } - - /* create our list of displacements for the gatherv. we're going - * to do everything relative to the start of the region allocated - * for procname[0] - * - * I suppose it is theoretically possible that the distance between - * malloc'd regions could be more than will fit in an int. We don't - * cover that case. - */ - disp = malloc(commsize * sizeof(int)); - disp[0] = 0; - for (i=1; i < commsize; i++) { - disp[i] = (int) (procname[i] - procname[0]); - } - - } - - /* now gather strings */ - if (commrank == 0) { - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, - procname[0], procname_len, disp, MPI_CHAR, - 0, comm); - } - else { - /* if we didn't do this, we would need to allocate procname[] - * on all processes...which seems a little silly. - */ - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, - NULL, NULL, NULL, MPI_CHAR, 0, comm); - } - - if (commrank == 0) { - /* no longer need the displacements or lengths */ - free(disp); - free(procname_len); - -#ifdef CB_CONFIG_LIST_DEBUG - for (i=0; i < commsize; i++) { - fprintf(stderr, "name[%d] = %s\n", i, procname[i]); - } -#endif - } - - *arrayp = array; - return 0; -} - -void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest) -{ - char *ptr; - int i, p; - if (!mynod) { - ptr = dest; - for (i=0; i<array->namect; i++ ) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - /* chop off that last comma */ - dest[strlen(dest) - 1] = '\0'; - } - MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); -} -void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest) -{ - char *ptr; - int i, p; - if (!mynod) { - ptr = dest; - for (i=(array->namect - 1); i >= 0; i-- ) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - dest[strlen(dest) - 1] = '\0'; - } - MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); -} - -void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest) -{ - char *ptr; - int i, p; - if (!mynod) { - ptr = dest; - /* evens */ - for (i=(array->namect - 1); i>= 0; i-=2 ) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - /* odds */ - for (i=(array->namect - 2); i > 0; i-=2 ) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - dest[strlen(dest) - 1] = '\0'; - } - MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); -} - -void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest) -{ - char *ptr; - int i, p; - if (!mynod) { - ptr = dest; - for (i=(array->namect / 2 ); i < array->namect; i++) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - for (i=0; i < (array->namect / 2); i++ ) { - p = snprintf(ptr, len, "%s,", array->names[i]); - ptr += p; - } - dest[strlen(dest) - 1] = '\0'; - } - MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); -} - -int main(int argc, char **argv) -{ - int i, mynod, nprocs, len, errs=0, sum_errs=0, verbose=0; - char *filename; - char * cb_config_string; - int cb_config_len; - ADIO_cb_name_array array; - - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - - - /* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - /* TODO: at some point, accept -v for verbose */ - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: noncontig_coll -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - /* want to hint the cb_config_list, but do so in a non-sequential way */ - cb_gather_name_array(MPI_COMM_WORLD, &array); - - /* sanity check */ - if (!mynod) { - if (array->namect < 2 ) { - fprintf(stderr, "Run this test on two or more hosts\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - /* get space for the permuted cb_config_string */ - if (!mynod) { - cb_config_len = 0; - for (i=0; i < array->namect; i++) { - /* +1: space for either a , or \0 if last */ - cb_config_len += strlen(array->names[i]) + 1; - } - ++cb_config_len; - } - MPI_Bcast(&cb_config_len, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( (cb_config_string = malloc(cb_config_len)) == NULL ) { - perror("malloc"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - /* first, no hinting */ - errs += test_file(filename, mynod, nprocs, NULL, "collective w/o hinting", verbose); - - /* hint, but no change in order */ - default_str(mynod, cb_config_len, array, cb_config_string); - errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: default order", verbose); - - /* reverse order */ - reverse_str(mynod, cb_config_len, array, cb_config_string); - errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: reverse order", verbose); - - /* reverse, every other */ - reverse_alternating_str(mynod, cb_config_len, array, cb_config_string); - errs += test_file(filename, mynod, nprocs, cb_config_string,"collective w/ hinting: permutation1", verbose); - - /* second half, first half */ - simple_shuffle_str(mynod, cb_config_len, array, cb_config_string); - errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: permutation2", verbose); - - MPI_Allreduce(&errs, &sum_errs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - - if (!mynod) { - if (sum_errs) fprintf(stderr, "Found %d error cases\n", sum_errs); - else printf(" No Errors\n"); - } - free(filename); - free(cb_config_string); - MPI_Finalize(); - return 0; -} - -#define SEEDER(x,y,z) ((x)*1000000 + (y) + (x)*(z)) - -int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, const char *msg, int verbose) -{ - MPI_Datatype typevec, newtype, t[3]; - int *buf, i, b[3], errcode, errors=0; - MPI_File fh; - MPI_Aint d[3]; - MPI_Status status; - int SIZE = (STARTING_SIZE/nprocs)*nprocs; - MPI_Info info; - - if (mynod==0 && verbose) fprintf(stderr, "%s\n", msg); - - buf = (int *) malloc(SIZE*sizeof(int)); - if (buf == NULL) { - perror("test_file"); - MPI_Abort(MPI_COMM_WORLD, -1); - } - - - if (cb_hosts != NULL ) { - MPI_Info_create(&info); - MPI_Info_set(info, "cb_config_list", cb_hosts); - } else { - info = MPI_INFO_NULL; - } - - MPI_Type_vector(SIZE/nprocs, 1, nprocs, MPI_INT, &typevec); - - b[0] = b[1] = b[2] = 1; - d[0] = 0; - d[1] = mynod*sizeof(int); - d[2] = SIZE*sizeof(int); - t[0] = MPI_LB; - t[1] = typevec; - t[2] = MPI_UB; - - MPI_Type_struct(3, b, d, t, &newtype); - MPI_Type_commit(&newtype); - MPI_Type_free(&typevec); - - if (!mynod) { - if(verbose) fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using collective I/O\n"); - MPI_File_delete(filename, info); - } - MPI_Barrier(MPI_COMM_WORLD); - - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - - for (i=0; i<SIZE; i++) buf[i] = SEEDER(mynod,i,SIZE); - errcode = MPI_File_write_all(fh, buf, 1, newtype, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "nc mem - nc file: MPI_File_write_all"); - } - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - errcode = MPI_File_read_at_all(fh, 0, buf, 1, newtype, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "nc mem - nc file: MPI_File_read_at_all"); - } - - /* the verification for N compute nodes is tricky. Say we have 3 - * processors. - * process 0 sees: 0 -1 -1 3 -1 -1 ... - * process 1 sees: -1 34 -1 -1 37 -1 ... - * process 2 sees: -1 -1 68 -1 -1 71 ... */ - - /* verify those leading -1s exist if they should */ - for (i=0; i<mynod; i++ ) { - if ( buf[i] != -1 ) { - if(verbose) fprintf(stderr, "Process %d: buf is %d, should be -1\n", mynod, buf[i]); - errors++; - } - } - /* now the modulo games are hairy. processor 0 sees real data in the 0th, - * 3rd, 6th... elements of the buffer (assuming nprocs==3 ). proc 1 sees - * the data in 1st, 4th, 7th..., and proc 2 sees it in 2nd, 5th, 8th */ - - for(/* 'i' set in above loop */; i<SIZE; i++) { - if ( ((i-mynod)%nprocs) && buf[i] != -1) { - if(verbose) fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - errors++; - } - if ( !((i-mynod)%nprocs) && buf[i] != SEEDER(mynod,i,SIZE) ) { - if(verbose) fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], SEEDER(mynod,i,SIZE)); - errors++; - } - } - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { - if(verbose) fprintf(stderr, "\ntesting noncontiguous in memory, contiguous in file using collective I/O\n"); - MPI_File_delete(filename, info); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - - for (i=0; i<SIZE; i++) buf[i] = SEEDER(mynod,i,SIZE); - errcode = MPI_File_write_at_all(fh, mynod*(SIZE/nprocs)*sizeof(int), - buf, 1, newtype, &status); - if (errcode != MPI_SUCCESS) - handle_error(errcode, "nc mem - c file: MPI_File_write_at_all"); - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - errcode = MPI_File_read_at_all(fh, mynod*(SIZE/nprocs)*sizeof(int), - buf, 1, newtype, &status); - if (errcode != MPI_SUCCESS) - handle_error(errcode, "nc mem - c file: MPI_File_read_at_all"); - - /* just like as above */ - for (i=0; i<mynod; i++ ) { - if ( buf[i] != -1 ) { - if(verbose) fprintf(stderr, "Process %d: buf is %d, should be -1\n", mynod, buf[i]); - errors++; - } - } - for(/* i set in above loop */; i<SIZE; i++) { - if ( ((i-mynod)%nprocs) && buf[i] != -1) { - if(verbose) fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", - mynod, i, buf[i]); - errors++; - } - if ( !((i-mynod)%nprocs) && buf[i] != SEEDER(mynod,i,SIZE)) { - if(verbose) fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", - mynod, i, buf[i], SEEDER(mynod,i,SIZE) ); - errors++; - } - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - if (!mynod) { - if(verbose) fprintf(stderr, "\ntesting contiguous in memory, noncontiguous in file using collective I/O\n"); - MPI_File_delete(filename, info); - } - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - info, &fh); - - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); - - for (i=0; i<SIZE; i++) buf[i] = SEEDER(mynod, i, SIZE); - errcode = MPI_File_write_all(fh, buf, SIZE, MPI_INT, &status); - if (errcode != MPI_SUCCESS) - handle_error(errcode, "c mem - nc file: MPI_File_write_all"); - - MPI_Barrier(MPI_COMM_WORLD); - - for (i=0; i<SIZE; i++) buf[i] = -1; - - errcode = MPI_File_read_at_all(fh, 0, buf, SIZE, MPI_INT, &status); - if (errcode != MPI_SUCCESS) - handle_error(errcode, "c mem - nc file: MPI_File_read_at_all"); - - /* same crazy checking */ - for (i=0; i<SIZE; i++) { - if (buf[i] != SEEDER(mynod, i, SIZE)) { - if(verbose) fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], SEEDER(mynod, i, SIZE)); - errors++; - } - } - - MPI_File_close(&fh); - - MPI_Type_free(&newtype); - free(buf); - if (info != MPI_INFO_NULL) MPI_Info_free(&info); - return errors; -} diff --git a/3rd-party/romio321/test/ordered_fp.c b/3rd-party/romio321/test/ordered_fp.c deleted file mode 100644 index 8090e1f6c55c4903225a1e8f205e10bea745e457..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/ordered_fp.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define COUNT (200) -#undef TIMING - -void handle_error(int errcode, const char *str); - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -/* tests shared file pointer functions */ - -int main(int argc, char **argv) -{ - int *buf, i, rank, nprocs, len, sum; - int global_sum; - int errs=0, toterrs, errcode; - char *filename; - MPI_File fh; - MPI_Status status; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - double wr_stime, wr_etime, wr_time, wr_sumtime; - double rd_stime, rd_etime, rd_time, rd_sumtime; - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(COUNT * sizeof(int)); - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - - for (i=0; i<COUNT; i++) buf[i] = COUNT*rank + i; - - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - wr_stime = MPI_Wtime(); - - errcode = MPI_File_write_ordered(fh, buf, COUNT, MPI_INT, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_write_shared"); - } - wr_etime = MPI_Wtime(); - - for (i=0; i<COUNT; i++) buf[i] = 0; - - MPI_Barrier(MPI_COMM_WORLD); - - rd_stime = MPI_Wtime(); - errcode = MPI_File_seek_shared(fh, 0, MPI_SEEK_SET); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_seek_shared"); - } - - errcode = MPI_File_read_ordered(fh, buf, COUNT, MPI_INT, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_read_shared"); - } - - rd_etime = MPI_Wtime(); - MPI_File_close(&fh); - - sum = 0; - for (i=0; i<COUNT; i++) sum += buf[i]; - - MPI_Allreduce(&sum, &global_sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - - wr_time = wr_etime - wr_stime; - rd_time = rd_etime - rd_stime; - - MPI_Allreduce(&wr_time, &wr_sumtime, 1, - MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(&rd_time, &rd_sumtime, 1, - MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - - if (global_sum != (((COUNT*nprocs - 1)*(COUNT*nprocs))/2)) { - errs++; - fprintf(stderr, "Error: sum %d, global_sum %d, %d\n", - sum, global_sum,(((COUNT*nprocs - 1)*(COUNT*nprocs))/2)); - } - - free(buf); - free(filename); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); -#ifdef TIMING - fprintf( stderr, "nprocs: %d bytes: %d write: %f read %f\n", - nprocs, COUNT*sizeof(int), wr_sumtime, rd_sumtime); -#endif - } - } - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/perf.c b/3rd-party/romio321/test/perf.c deleted file mode 100644 index b72cf145f8cf46177fa25bddc86c6cea8d2e45a4..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/perf.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -/* A simple performance test. The file name is taken as a - command-line argument. */ - -#define SIZE (1048576*4) /* read/write size per node in bytes */ - -int main(int argc, char **argv) -{ - int *buf, i, j, mynod, nprocs, ntimes=5, len, err, flag; - double stim, read_tim, write_tim, new_read_tim, new_write_tim; - double min_read_tim=10000000.0, min_write_tim=10000000.0, read_bw, write_bw; - MPI_File fh; - MPI_Status status; - char *filename; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: perf -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - fprintf(stderr, "Access size per process = %d bytes, ntimes = %d\n", SIZE, ntimes); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - buf = (int *) malloc(SIZE); - - for (j=0; j<ntimes; j++) { - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - MPI_File_seek(fh, mynod*SIZE, MPI_SEEK_SET); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_write(fh, buf, SIZE, MPI_BYTE, &status); - write_tim = MPI_Wtime() - stim; - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - MPI_File_seek(fh, mynod*SIZE, MPI_SEEK_SET); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_read(fh, buf, SIZE, MPI_BYTE, &status); - read_tim = MPI_Wtime() - stim; - - MPI_File_close(&fh); - - MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - - min_read_tim = (new_read_tim < min_read_tim) ? - new_read_tim : min_read_tim; - min_write_tim = (new_write_tim < min_write_tim) ? - new_write_tim : min_write_tim; - } - - if (mynod == 0) { - read_bw = (SIZE*nprocs)/(min_read_tim*1024.0*1024.0); - write_bw = (SIZE*nprocs)/(min_write_tim*1024.0*1024.0); - fprintf(stderr, "Write bandwidth without file sync = %f Mbytes/sec\n", write_bw); - fprintf(stderr, "Read bandwidth without prior file sync = %f Mbytes/sec\n", read_bw); - } - - min_write_tim=10000000.0; - min_read_tim=10000000.0; - - flag = 0; - for (j=0; j<ntimes; j++) { - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - MPI_File_seek(fh, mynod*SIZE, MPI_SEEK_SET); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_write(fh, buf, SIZE, MPI_BYTE, &status); - err = MPI_File_sync(fh); - write_tim = MPI_Wtime() - stim; - if (err == MPI_ERR_UNKNOWN) { - flag = 1; - break; - } - - MPI_File_close(&fh); - - MPI_Barrier(MPI_COMM_WORLD); - - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | - MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - MPI_File_seek(fh, mynod*SIZE, MPI_SEEK_SET); - - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - MPI_File_read(fh, buf, SIZE, MPI_BYTE, &status); - read_tim = MPI_Wtime() - stim; - - MPI_File_close(&fh); - - MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - - min_read_tim = (new_read_tim < min_read_tim) ? - new_read_tim : min_read_tim; - min_write_tim = (new_write_tim < min_write_tim) ? - new_write_tim : min_write_tim; - } - - if (mynod == 0) { - if (flag) fprintf(stderr, "MPI_File_sync returns error.\n"); - else { - read_bw = (SIZE*nprocs)/(min_read_tim*1024.0*1024.0); - write_bw = (SIZE*nprocs)/(min_write_tim*1024.0*1024.0); - fprintf(stderr, "Write bandwidth including file sync = %f Mbytes/sec\n", write_bw); - fprintf(stderr, "Read bandwidth after file sync = %f Mbytes/sec\n", read_bw); - } - } - - free(buf); - free(filename); - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/psimple.c b/3rd-party/romio321/test/psimple.c deleted file mode 100644 index 1fc91f3e226dac20167bcd4d417005f9fb90f1e9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/psimple.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SIZE (65536) - -/* This is the same as simple.c, but uses the PMPI versions of all - MPI functions in order to test the profiling interface. */ - -/* Each process writes to separate files and reads them back. - The file name is taken as a command-line argument, and the process rank - is appended to it. */ - -int main(int argc, char **argv) -{ - int *buf, i, rank, nints, len; - char *filename, *tmp; - int errs=0, toterrs; - MPI_File fh; - MPI_Status status; - - PMPI_Init(&argc,&argv); - PMPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); - PMPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - PMPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - PMPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - buf = (int *) malloc(SIZE); - nints = SIZE/sizeof(int); - for (i=0; i<nints; i++) buf[i] = rank*100000 + i; - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - PMPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - PMPI_File_write(fh, buf, nints, MPI_INT, &status); - PMPI_File_close(&fh); - - /* reopen the file and read the data back */ - - for (i=0; i<nints; i++) buf[i] = 0; - PMPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - PMPI_File_read(fh, buf, nints, MPI_INT, &status); - PMPI_File_close(&fh); - - /* check if the data read is correct */ - for (i=0; i<nints; i++) { - if (buf[i] != (rank*100000 + i)) { - errs++; - fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], rank*100000+i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - free(buf); - free(filename); - free(tmp); - - PMPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/shared_fp.c b/3rd-party/romio321/test/shared_fp.c deleted file mode 100644 index df41bdd818daebd64cbd7295ce909b13116c19f9..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/shared_fp.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define COUNT 1024 - -void handle_error(int errcode, const char *str); - -void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -/* tests shared file pointer functions */ - -int main(int argc, char **argv) -{ - int *buf, i, rank, nprocs, len, sum, global_sum; - int errs=0, toterrs, errcode; - char *filename; - MPI_File fh; - MPI_Status status; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(COUNT * sizeof(int)); - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - - for (i=0; i<COUNT; i++) buf[i] = COUNT*rank + i; - - errcode = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_open"); - } - - errcode = MPI_File_write_shared(fh, buf, COUNT, MPI_INT, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_write_shared"); - } - - for (i=0; i<COUNT; i++) buf[i] = 0; - - MPI_Barrier(MPI_COMM_WORLD); - - errcode = MPI_File_seek_shared(fh, 0, MPI_SEEK_SET); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_seek_shared"); - } - - errcode = MPI_File_read_shared(fh, buf, COUNT, MPI_INT, &status); - if (errcode != MPI_SUCCESS) { - handle_error(errcode, "MPI_File_read_shared"); - } - - MPI_File_close(&fh); - - sum = 0; - for (i=0; i<COUNT; i++) sum += buf[i]; - - MPI_Allreduce(&sum, &global_sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - - if (global_sum != (((COUNT*nprocs - 1)*(COUNT*nprocs))/2)) { - errs++; - fprintf(stderr, "Error: sum %d, global_sum %d, %d\n", - sum, global_sum,(((COUNT*nprocs - 1)*(COUNT*nprocs))/2)); - } - - free(buf); - free(filename); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/simple.c b/3rd-party/romio321/test/simple.c deleted file mode 100644 index 2e90c9dca99ad6d2550803868699701cfb6fde23..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/simple.c +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SIZE (65536) - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} -/* Each process writes to separate files and reads them back. - The file name is taken as a command-line argument, and the process rank - is appended to it. */ - -int main(int argc, char **argv) -{ - int *buf, i, rank, nints, len; - char *filename, *tmp; - int errs = 0, toterrs, errcode; - MPI_File fh; - MPI_Status status; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - - buf = (int *) malloc(SIZE); - nints = SIZE/sizeof(int); - for (i=0; i<nints; i++) buf[i] = rank*100000 + i; - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open(1)"); - - errcode = MPI_File_write(fh, buf, nints, MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_write"); - - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_clode (1)"); - - /* reopen the file and read the data back */ - - for (i=0; i<nints; i++) buf[i] = 0; - errcode = MPI_File_open(MPI_COMM_SELF, filename, - MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open(2)"); - - errcode = MPI_File_read(fh, buf, nints, MPI_INT, &status); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_read"); - - errcode = MPI_File_close(&fh); - if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close(2)"); - - /* check if the data read is correct */ - for (i=0; i<nints; i++) { - if (buf[i] != (rank*100000 + i)) { - errs++; - fprintf(stderr, "Process %d: error, read %d, should be %d\n", - rank, buf[i], rank*100000+i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - free(buf); - free(filename); - free(tmp); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/split_coll.c b/3rd-party/romio321/test/split_coll.c deleted file mode 100644 index cc3d039b569c07518c3d3bcbbb318b7aa0a9a087..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/split_coll.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -/* A 32^3 array. For other array sizes, change array_of_gsizes below. */ - -/* Uses split collective I/O. Writes a 3D block-distributed array to a file - corresponding to the global array in row-major (C) order, reads it - back, and checks that the data read is correct. */ - -/* The file name is taken as a command-line argument. */ - -/* Note that the file access pattern is noncontiguous. */ - -int main(int argc, char **argv) -{ - MPI_Datatype newtype; - int i, ndims, array_of_gsizes[3], array_of_distribs[3]; - int order, nprocs, j, len; - int array_of_dargs[3], array_of_psizes[3]; - int *readbuf, *writebuf, mynod, *tmpbuf, array_size; - MPI_Count bufcount; - int errs=0, toterrs; - char *filename; - MPI_File fh; - MPI_Status status; - MPI_Request request; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!mynod) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+1); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+1); - MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - -/* create the distributed array filetype */ - ndims = 3; - order = MPI_ORDER_C; - - array_of_gsizes[0] = 32; - array_of_gsizes[1] = 32; - array_of_gsizes[2] = 32; - - array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; - array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; - - array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; - array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; - - for (i=0; i<ndims; i++) array_of_psizes[i] = 0; - MPI_Dims_create(nprocs, ndims, array_of_psizes); - - MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, - array_of_distribs, array_of_dargs, - array_of_psizes, order, MPI_INT, &newtype); - MPI_Type_commit(&newtype); - -/* initialize writebuf */ - - MPI_Type_size_x(newtype, &bufcount); - bufcount = bufcount/sizeof(int); - writebuf = (int *) malloc(bufcount * sizeof(int)); - for (i=0; i<bufcount; i++) writebuf[i] = 1; - - array_size = array_of_gsizes[0]*array_of_gsizes[1]*array_of_gsizes[2]; - tmpbuf = (int *) calloc(array_size, sizeof(int)); - MPI_Irecv(tmpbuf, 1, newtype, mynod, 10, MPI_COMM_WORLD, &request); - MPI_Send(writebuf, bufcount, MPI_INT, mynod, 10, MPI_COMM_WORLD); - MPI_Wait(&request, &status); - - j = 0; - for (i=0; i<array_size; i++) - if (tmpbuf[i]) { - writebuf[j] = i; - j++; - } - free(tmpbuf); - - if (j != bufcount) { - fprintf(stderr, "Error in initializing writebuf on process %d\n", mynod); - MPI_Abort(MPI_COMM_WORLD, 1); - } -/* end of initialization */ - - /* write the array to the file */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - MPI_File_write_all_begin(fh, writebuf, bufcount, MPI_INT); - MPI_File_write_all_end(fh, writebuf, &status); - MPI_File_close(&fh); - - - /* now read it back */ - readbuf = (int *) malloc(bufcount * sizeof(int)); - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); - MPI_File_read_all_begin(fh, readbuf, bufcount, MPI_INT); - MPI_File_read_all_end(fh, readbuf, &status); - MPI_File_close(&fh); - - /* check the data read */ - for (i=0; i<bufcount; i++) { - if (readbuf[i] != writebuf[i]) { - errs++; - fprintf(stderr, "Process %d, readbuf %d, writebuf %d, i %d\n", - mynod, readbuf[i], writebuf[i], i); - } - } - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (mynod == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - - MPI_Type_free(&newtype); - free(readbuf); - free(writebuf); - free(filename); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/status.c b/3rd-party/romio321/test/status.c deleted file mode 100644 index d64d5b2b0e031a15b1e67dd85e7c0b5aa2c11d52..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/status.c +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#define SIZE (65536) - -/* Checks if the status objects is filled correctly by I/O functions */ - -int main(int argc, char **argv) -{ - int *buf, i, rank, nints, len, count, elements; - char *filename, *tmp; - int errs=0, toterrs; - MPI_File fh; - MPI_Status status; - - MPI_Init(&argc,&argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - -/* process 0 takes the file name as a command-line argument and - broadcasts it to other processes */ - if (!rank) { - i = 1; - while ((i < argc) && strcmp("-fname", *argv)) { - i++; - argv++; - } - if (i >= argc) { - fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - argv++; - len = strlen(*argv); - filename = (char *) malloc(len+10); - strcpy(filename, *argv); - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - else { - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); - filename = (char *) malloc(len+10); - MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); - } - - buf = (int *) malloc(SIZE); - nints = SIZE/sizeof(int); - - /* each process opens a separate file called filename.'myrank' */ - tmp = (char *) malloc(len+10); - strcpy(tmp, filename); - sprintf(filename, "%s.%d", tmp, rank); - - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_write(fh, buf, nints, MPI_INT, &status); - - MPI_Get_count(&status, MPI_INT, &count); - MPI_Get_elements(&status, MPI_INT, &elements); - if (!rank) { - if (count != nints) { - errs++; - printf("count = %d, should be %d\n", count, nints); - } - if (elements != nints) { - errs++; - printf("elements = %d, should be %d\n", elements, nints); - } - } - - MPI_File_close(&fh); - - MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); - if (rank == 0) { - if( toterrs > 0) { - fprintf( stderr, "Found %d errors\n", toterrs ); - } - else { - fprintf( stdout, " No Errors\n" ); - } - } - free(buf); - free(filename); - free(tmp); - - MPI_Finalize(); - return 0; -} diff --git a/3rd-party/romio321/test/types_with_zeros.c b/3rd-party/romio321/test/types_with_zeros.c deleted file mode 100644 index e2f7799605b6c8ecc0c1a8773896baec93244131..0000000000000000000000000000000000000000 --- a/3rd-party/romio321/test/types_with_zeros.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/uio.h> - -#include <mpi.h> - -#define MAXLEN 9 - -static void handle_error(int errcode, const char *str) -{ - char msg[MPI_MAX_ERROR_STRING]; - int resultlen; - MPI_Error_string(errcode, msg, &resultlen); - fprintf(stderr, "%s: %s\n", str, msg); - MPI_Abort(MPI_COMM_WORLD, 1); -} - -enum { - INDEXED, - HINDEXED, - STRUCT -} testcases; - -static int test_indexed_with_zeros(char *filename, int testcase) -{ - int i, rank, np, buflen, num, err, nr_errors=0; - int nelms[MAXLEN], buf[MAXLEN], indices[MAXLEN], blocklen[MAXLEN]; - MPI_File fh; - MPI_Status status; - MPI_Datatype filetype; - MPI_Datatype types[MAXLEN]; - MPI_Aint addrs[MAXLEN]; - - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &np); - - /* set up the number of integers to write in each iteration */ - for (i=0; i<MAXLEN; i++) nelms[i] = 0; - if (rank == 0) nelms[4]=nelms[5]=nelms[7]=1; - if (rank == 1) nelms[0]=nelms[1]=nelms[2]=nelms[3]=nelms[6]=nelms[8]=1; - - /* pre-fill the file with integers -999 */ - if (rank == 0) { - for (i=0; i<MAXLEN; i++) buf[i] = -999; - err =MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE|MPI_MODE_WRONLY, - MPI_INFO_NULL, &fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_open"); - err = MPI_File_write(fh, buf, MAXLEN, MPI_INT, &status); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_write"); - err = MPI_File_close(&fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_close"); - } - MPI_Barrier(MPI_COMM_WORLD); - - /* define a filetype with spurious leading zeros */ - buflen = num = 0; - for (i=0; i<MAXLEN; i++) { - buflen += nelms[i]; - indices[num] = i; - addrs[num] = i*sizeof(int); - blocklen[num] = nelms[i]; - types[num] = MPI_INT; - num++; - } - switch (testcase) { - case INDEXED: - MPI_Type_indexed(num, blocklen, indices, MPI_INT, &filetype); - break; - case HINDEXED: - MPI_Type_hindexed(num, blocklen, addrs, MPI_INT, &filetype); - break; - case STRUCT: - MPI_Type_create_struct(num, blocklen, addrs, types, &filetype); - break; - default: - fprintf(stderr, "unknown testcase!\n"); - return(-100); - - } - - MPI_Type_commit(&filetype); - - /* initialize write buffer and write to file*/ - for (i=0; i<MAXLEN; i++) buf[i] = 1; - err =MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_open"); - err = MPI_File_set_view(fh, 0, MPI_INT, filetype, "native", MPI_INFO_NULL); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_set_view"); - err = MPI_File_write_all(fh, buf, buflen, MPI_INT, &status); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_write_all"); - MPI_Type_free(&filetype); - err = MPI_File_close(&fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_close"); - - /* read back and check */ - if (rank == 0) { - err = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_open"); - err = MPI_File_read(fh,buf, MAXLEN, MPI_INT, &status); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_read"); - err = MPI_File_close(&fh); - if (err != MPI_SUCCESS) handle_error(err, "MPI_File_close"); - for (i=0; i<MAXLEN; i++) { - if (buf[i] < 0) { - nr_errors++; - printf("Error: unexpected value for case %d at buf[%d] == %d\n", - testcase,i,buf[i]); - } - } - } - return nr_errors; -} - -int main(int argc, char **argv) -{ - - int nr_errors, rank, np; - - MPI_Init(&argc, &argv); - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &np); - - if (np != 2) { - if (rank == 0) fprintf(stderr,"Must run on 2 MPI processes\n"); - MPI_Finalize(); return 1; - } - nr_errors = test_indexed_with_zeros(argv[1], INDEXED); - nr_errors += test_indexed_with_zeros(argv[1], HINDEXED); - nr_errors += test_indexed_with_zeros(argv[1], STRUCT); - - if (rank == 0 && nr_errors == 0) printf(" No Errors\n"); - - MPI_Finalize(); - return 0; -} - diff --git a/3rd-party/romio321/.codingcheck b/3rd-party/romio341/.codingcheck similarity index 98% rename from 3rd-party/romio321/.codingcheck rename to 3rd-party/romio341/.codingcheck index 9b52b35ce4229f4d94578226a1f7afefd0918635..bc77906acb328df0e371d474a21f4f6f2661419a 100644 --- a/3rd-party/romio321/.codingcheck +++ b/3rd-party/romio341/.codingcheck @@ -28,7 +28,6 @@ 'PVFS_.+' => romio, 'MPI_hpux'=> romio, 'FORTRANCAPS'=> romio, - 'MPILAM'=> romio, 'NEEDS_ADIOCB_T'=> romio, 'AGG_DEBUG'=> romio, 'SOLARIS'=> romio, diff --git a/3rd-party/romio321/.config_params b/3rd-party/romio341/.config_params similarity index 100% rename from 3rd-party/romio321/.config_params rename to 3rd-party/romio341/.config_params diff --git a/3rd-party/romio321/Makefile.am b/3rd-party/romio341/Makefile.am similarity index 80% rename from 3rd-party/romio321/Makefile.am rename to 3rd-party/romio341/Makefile.am index 71d82a9fa7338d29edeef402a02e91e029ef8529..70e54c899b3e571e4fc50725e2f302a35071dd9a 100644 --- a/3rd-party/romio321/Makefile.am +++ b/3rd-party/romio341/Makefile.am @@ -1,24 +1,25 @@ -# -*- Mode: Makefile; -*- -# Copyright (c) 2004-2006 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 Cisco Systems, Inc. All rights reserved. +## Copyright (c) 2004-2006 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 Cisco Systems, Inc. All rights reserved. +## Copyright (c) 2020 Research Organization for Information Science +## and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ -# -# (C) 2011 by Argonne National Laboratory. -# See COPYRIGHT in top-level directory. -# +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## # OMPI: include a top level makefile with some options include $(top_srcdir)/Makefile.options @@ -36,10 +37,17 @@ ACLOCAL_AMFLAGS = -I confdb include_HEADERS = nodist_include_HEADERS = noinst_HEADERS = +AM_CFLAGS = @VISIBILITY_CFLAGS@ EXTRA_DIST = SUFFIXES = doc1_src_txt = +external_subdirs = @mpl_srcdir@ +external_dist_subdirs = @mpl_dist_srcdir@ +external_includes = @mpl_includedir@ +external_ldflags = @mpl_libdir@ +external_libs = @mpl_lib@ + # ------------------------------------------------------------------------ # variables to be populated by the included Makefile.mk fragments: @@ -62,19 +70,16 @@ AM_CPPFLAGS += $(MPI_H_INCLUDE) # ------------------------------------------------------------------------ # handle the "include" directory here -AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include $(external_includes) # nodist_ b/c these are created by config.status and should not be distributed # Open MPI: do not install mpio.h noinst_HEADERS += include/mpio.h noinst_HEADERS += include/io_romio_conv.h -# Included for Open MPI's --enable-grequest-extensions feature. -noinst_HEADERS += include/ompi_grequestx.h - # ------------------------------------------------------------------------ -SUBDIRS = -DIST_SUBDIRS = test test-internal +SUBDIRS = $(external_subdirs) +DIST_SUBDIRS = test test-internal $(external_dist_subdirs) # for the sake of parallel make and avoiding an excessive number of convenience # libs, we use a subdir automake fragment strategy @@ -106,7 +111,12 @@ if BUILD_PROFILING_LIB noinst_LTLIBRARIES += libpromio.la libpromio_la_SOURCES = $(romio_mpi_sources) libpromio_la_CPPFLAGS = $(AM_CPPFLAGS) -DMPIO_BUILD_PROFILING -endif BUILD_PROFILING_LIB +libpromio_la_LDFLAGS = $(external_ldflags) +libpromio_la_LIBADD = $(external_libs) +else !BUILD_PROFILING_LIB +libromio_dist_la_LDFLAGS = $(external_ldflags) +libromio_dist_la_LIBADD = $(external_libs) +endif !BUILD_PROFILING_LIB else !BUILD_ROMIO_EMBEDDED lib_LTLIBRARIES = libromio.la @@ -193,3 +203,11 @@ htmldoc-local: $(romio_mpi_sources:.c=.html-phony) $(doc1_src_txt:.txt=.html1-ph # -------------------------------------------------------------------------- +# sometimes helpful when debugging macros to see the preprocessed output. +# Also using '-CC' because comments provide useful landmarks + +SUFFIXES += .i + +.c.i: + $(COMPILE) -CC -E -o $@ $< + diff --git a/3rd-party/romio321/Makefile.options b/3rd-party/romio341/Makefile.options similarity index 100% rename from 3rd-party/romio321/Makefile.options rename to 3rd-party/romio341/Makefile.options diff --git a/3rd-party/romio321/README b/3rd-party/romio341/README similarity index 100% rename from 3rd-party/romio321/README rename to 3rd-party/romio341/README diff --git a/3rd-party/romio321/adio/Makefile.mk b/3rd-party/romio341/adio/Makefile.mk similarity index 72% rename from 3rd-party/romio321/adio/Makefile.mk rename to 3rd-party/romio341/adio/Makefile.mk index ffc05cb415182e23666dc7bbb10c8a65da50bcbe..408e113c0ed923b31377e7ba1a3995852856f735 100644 --- a/3rd-party/romio321/adio/Makefile.mk +++ b/3rd-party/romio341/adio/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## AM_CPPFLAGS += -I$(top_builddir)/adio/include -I$(top_srcdir)/adio/include @@ -15,7 +13,9 @@ noinst_HEADERS += \ adio/include/adioi_errmsg.h \ adio/include/adioi_error.h \ adio/include/adioi_fs_proto.h \ - adio/include/heap-sort.h \ + adio/include/ad_tuning.h \ + adio/include/heap_sort.h \ + adio/include/lock_internal.h \ adio/include/mpio_error.h \ adio/include/mpipr.h \ adio/include/mpiu_greq.h \ @@ -24,24 +24,19 @@ noinst_HEADERS += \ adio/include/mpiu_external32.h \ adio/include/hint_fns.h +include $(top_srcdir)/adio/ad_daos/Makefile.mk include $(top_srcdir)/adio/ad_gpfs/Makefile.mk include $(top_srcdir)/adio/ad_gpfs/bg/Makefile.mk include $(top_srcdir)/adio/ad_gpfs/pe/Makefile.mk -include $(top_srcdir)/adio/ad_gridftp/Makefile.mk -include $(top_srcdir)/adio/ad_hfs/Makefile.mk include $(top_srcdir)/adio/ad_lustre/Makefile.mk include $(top_srcdir)/adio/ad_nfs/Makefile.mk ## NTFS builds are handled entirely by the separate Windows build system ##include $(top_srcdir)/adio/ad_ntfs/Makefile.mk include $(top_srcdir)/adio/ad_panfs/Makefile.mk -include $(top_srcdir)/adio/ad_pfs/Makefile.mk -include $(top_srcdir)/adio/ad_piofs/Makefile.mk -include $(top_srcdir)/adio/ad_pvfs/Makefile.mk include $(top_srcdir)/adio/ad_pvfs2/Makefile.mk -include $(top_srcdir)/adio/ad_sfs/Makefile.mk include $(top_srcdir)/adio/ad_testfs/Makefile.mk include $(top_srcdir)/adio/ad_ufs/Makefile.mk include $(top_srcdir)/adio/ad_xfs/Makefile.mk -include $(top_srcdir)/adio/ad_zoidfs/Makefile.mk +include $(top_srcdir)/adio/ad_ime/Makefile.mk +include $(top_srcdir)/adio/ad_quobytefs/Makefile.mk include $(top_srcdir)/adio/common/Makefile.mk - diff --git a/3rd-party/romio341/adio/ad_daos/Makefile.mk b/3rd-party/romio341/adio/ad_daos/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..a97cb6bd3b7c364ada7c4db976f122f050cf2a4a --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/Makefile.mk @@ -0,0 +1,24 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +if BUILD_AD_DAOS + +noinst_HEADERS += adio/ad_daos/ad_daos.h + +romio_other_sources += \ + adio/ad_daos/ad_daos.c \ + adio/ad_daos/ad_daos_close.c \ + adio/ad_daos/ad_daos_common.c \ + adio/ad_daos/ad_daos_fcntl.c \ + adio/ad_daos/ad_daos_features.c \ + adio/ad_daos/ad_daos_hhash.c \ + adio/ad_daos/ad_daos_hints.c \ + adio/ad_daos/ad_daos_io.c \ + adio/ad_daos/ad_daos_io_str.c \ + adio/ad_daos/ad_daos_open.c \ + adio/ad_daos/ad_daos_resize.c + +endif BUILD_AD_DAOS + diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos.c b/3rd-party/romio341/adio/ad_daos/ad_daos.c new file mode 100644 index 0000000000000000000000000000000000000000..00d0d965c50c3615db8cf842b5b11a60afc8bcfa --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_DAOS_operations = { + ADIOI_DAOS_Open, /* Open */ + ADIOI_DAOS_OpenColl, /* OpenColl */ + ADIOI_DAOS_ReadContig, /* ReadContig */ + ADIOI_DAOS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_DAOS_Fcntl, /* Fcntl */ + ADIOI_DAOS_SetInfo, /* SetInfo */ + ADIOI_DAOS_ReadStrided, /* ReadStrided */ + ADIOI_DAOS_WriteStrided, /* WriteStrided */ + ADIOI_DAOS_Close, /* Close */ + ADIOI_DAOS_IReadContig, /* IreadContig */ + ADIOI_DAOS_IWriteContig, /* IwriteContig */ + ADIOI_FAKE_IODone, /* ReadDone */ + ADIOI_FAKE_IODone, /* WriteDone */ + ADIOI_FAKE_IOComplete, /* ReadComplete */ + ADIOI_FAKE_IOComplete, /* WriteComplete */ + ADIOI_DAOS_IreadStrided, /* IreadStrided */ + ADIOI_DAOS_IwriteStrided, /* IwriteStrided */ + ADIOI_DAOS_Flush, /* Flush */ + ADIOI_DAOS_Resize, /* Resize */ + ADIOI_DAOS_Delete, /* Delete */ + ADIOI_DAOS_Feature, /* Features */ + "DAOS: ROMIO driver for DAOS", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos.h b/3rd-party/romio341/adio/ad_daos/ad_daos.h new file mode 100644 index 0000000000000000000000000000000000000000..fed1f829595898069eaf978378d80db3e802ab5c --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_DAOS_H_INCLUDED +#define AD_DAOS_H_INCLUDED + +#include "adio.h" +#include <assert.h> +#include <gurt/list.h> +#include <daos.h> +#include <daos_fs.h> +#include <daos_uns.h> + +/* #define D_PRINT_IO */ +/* #define D_PRINT_IO_MEM */ + +#define PRINT_MSG(str, fmt, ...) \ + do { \ + fprintf(str, "%s:%d %s() - " fmt"\n" , \ + __FILE__, __LINE__, __func__, ##__VA_ARGS__); \ + } while (0) + +struct adio_daos_hdl { + d_list_t entry; + uuid_t uuid; + daos_handle_t open_hdl; + dfs_t *dfs; + int ref; + int type; +}; + +struct ADIO_DAOS_cont { + /** pool, container uuids + other attributes */ + struct duns_attr_t attr; + /** Container name (Path to the file opened) */ + char *cont_name; + /** Object name (File name) */ + char *obj_name; + /** pool open handle */ + daos_handle_t poh; + /** container open handle */ + daos_handle_t coh; + /** flat namespace mount */ + dfs_t *dfs; + /** dfs object for file */ + dfs_obj_t *obj; + /** Array Object ID for the MPI file */ + daos_obj_id_t oid; + /** file open mode */ + unsigned int amode; + /** Event queue to store all async requests on file */ + daos_handle_t eqh; + /** pool handle for directory holding the file object */ + struct adio_daos_hdl *p; + /** container handle for directory holding the file object */ + struct adio_daos_hdl *c; +}; + +struct ADIO_DAOS_req { + MPI_Request req; + daos_size_t nbytes; + daos_event_t daos_event; + dfs_iod_t iod; + daos_range_t rg; + d_sg_list_t sgl; + d_iov_t iov; + daos_range_t *rgs; + d_iov_t *iovs; +}; + +/** initialize the DAOS library and hashtables for handles */ +void ADIOI_DAOS_Init(int *error_code); + +/** Container/Pool Handle Hash functions */ +int adio_daos_hash_init(void); +void adio_daos_hash_finalize(void); +struct adio_daos_hdl *adio_daos_poh_lookup(const uuid_t uuid); +int adio_daos_poh_insert(uuid_t uuid, daos_handle_t poh, struct adio_daos_hdl **hdl); +int adio_daos_poh_lookup_connect(uuid_t uuid, struct adio_daos_hdl **hdl); +void adio_daos_poh_release(struct adio_daos_hdl *hdl); +struct adio_daos_hdl *adio_daos_coh_lookup(const uuid_t uuid); +int adio_daos_coh_insert(uuid_t uuid, daos_handle_t coh, struct adio_daos_hdl **hdl); +int adio_daos_coh_lookup_create(daos_handle_t poh, uuid_t uuid, int amode, + bool create, struct adio_daos_hdl **hdl); +void adio_daos_coh_release(struct adio_daos_hdl *hdl); + +int ADIOI_DAOS_aio_free_fn(void *extra_state); +int ADIOI_DAOS_aio_poll_fn(void *extra_state, MPI_Status * status); +int ADIOI_DAOS_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status); +int ADIOI_DAOS_err(const char *myname, const char *filename, int line, int rc); + +void ADIOI_DAOS_Open(ADIO_File fd, int *error_code); +void ADIOI_DAOS_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code); +int ADIOI_DAOS_Feature(ADIO_File fd, int flag); +void ADIOI_DAOS_Flush(ADIO_File fd, int *error_code); +void ADIOI_DAOS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_DAOS_Close(ADIO_File fd, int *error_code); +void ADIOI_DAOS_Delete(const char *filename, int *error_code); +void ADIOI_DAOS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); +void ADIOI_DAOS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_DAOS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_DAOS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_DAOS_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +void ADIOI_DAOS_IWriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +void ADIOI_DAOS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_DAOS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_DAOS_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_DAOS_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +#endif /* AD_DAOS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_close.c b/3rd-party/romio341/adio/ad_daos/ad_daos_close.c new file mode 100644 index 0000000000000000000000000000000000000000..c32a872943bea08659bd7955e0a48790776a498f --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_close.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +void ADIOI_DAOS_Close(ADIO_File fd, int *error_code) +{ + int rank; + struct ADIO_DAOS_cont *cont = (struct ADIO_DAOS_cont *) fd->fs_ptr; + static char myname[] = "ADIOI_DAOS_CLOSE"; + int rc; + + MPI_Barrier(fd->comm); + MPI_Comm_rank(fd->comm, &rank); + + /* release the dfs object handle for the file. */ + rc = dfs_release(cont->obj); + if (rc != 0) { + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, rc); + return; + } + + /* decrement ref count on the container and pool in the hashtable. */ + adio_daos_coh_release(cont->c); + cont->c = NULL; + adio_daos_poh_release(cont->p); + cont->p = NULL; + + if (rank == 0) { + ADIOI_Free(cont->obj_name); + ADIOI_Free(cont->cont_name); + } + ADIOI_Free(fd->fs_ptr); + fd->fs_ptr = NULL; + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_common.c b/3rd-party/romio341/adio/ad_daos/ad_daos_common.c new file mode 100644 index 0000000000000000000000000000000000000000..9e0e3b3ab5c01e0324664f536bcceea36a4f510f --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_common.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" +#include <daos_errno.h> + +int ADIOI_DAOS_Initialized = MPI_KEYVAL_INVALID; + +static int ad_daos_end(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state) +{ + int error_code = MPI_SUCCESS; + int rc; + + adio_daos_hash_finalize(); + rc = daos_fini(); + + if (rc != 0) { + error_code = ADIOI_DAOS_err("ad_daos_end", "DAOS Finalize Error", __LINE__, rc); + return error_code; + } + + MPI_Keyval_free(&keyval); + return error_code; +} + +void ADIOI_DAOS_Init(int *error_code) +{ + static char myname[] = "ADIOI_DAOS_INIT"; + int rc; + + *error_code = MPI_SUCCESS; + + /** nothing to do if already initialized */ + if (ADIOI_DAOS_Initialized != MPI_KEYVAL_INVALID) + return; + + rc = daos_init(); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, "DAOS Init Error", __LINE__, rc); + fprintf(stderr, "daos_init() failed with %d\n", rc); + return; + } + + rc = adio_daos_hash_init(); + if (rc < 0) { + *error_code = ADIOI_DAOS_err(myname, "DAOS Init Error", __LINE__, rc); + fprintf(stderr, "Failed to init daos handle hash table\n"); + return; + } + + /** attach to comm_self destroy to finalize DAOS */ + MPI_Keyval_create(MPI_NULL_COPY_FN, ad_daos_end, &ADIOI_DAOS_Initialized, (void *) 0); + MPI_Attr_put(MPI_COMM_SELF, ADIOI_DAOS_Initialized, (void *) 0); +} + +int ADIOI_DAOS_err(const char *myname, const char *filename, int line, int rc) +{ + int error_code = MPI_SUCCESS; + + if (rc == 0) + return MPI_SUCCESS; + + switch (rc) { + case -DER_NO_PERM: + case EPERM: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + line, MPI_ERR_ACCESS, + "**fileaccess", "**fileaccess %s", filename); + break; + case -DER_ENOENT: + case -DER_NONEXIST: + case -DER_NO_HDL: + case ENOENT: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + line, MPI_ERR_NO_SUCH_FILE, + "**filenoexist", "**filenoexist %s", filename); + break; + case -DER_IO: + case EIO: + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, line, MPI_ERR_IO, "**io", + "**io %s", filename); + break; + case -DER_EXIST: + case EEXIST: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + line, MPI_ERR_FILE_EXISTS, "**fileexist", 0); + break; + case -DER_NOTDIR: + case ENOTDIR: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, line, + MPI_ERR_BAD_FILE, + "**filenamedir", "**filenamedir %s", filename); + break; + case -DER_NOSPACE: + case ENOSPC: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, line, + MPI_ERR_NO_SPACE, "**filenospace", 0); + break; + case -DER_INVAL: + case EINVAL: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, line, + MPI_ERR_ARG, "**arg", 0); + break; + case -DER_NOSYS: + case ENOSYS: + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, line, + MPI_ERR_UNSUPPORTED_OPERATION, + "**fileopunsupported", 0); + break; + case -DER_NOMEM: + case ENOMEM: + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, line, MPI_ERR_NO_MEM, "**allocmem", 0); + break; + default: + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, line, MPI_ERR_IO, "**io", + "**io %s", filename); + break; + } + + return error_code; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_fcntl.c b/3rd-party/romio341/adio/ad_daos/ad_daos_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..00b45de506d9b34f638acd869ec887fd95b4dec9 --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_fcntl.c @@ -0,0 +1,36 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +void ADIOI_DAOS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int rc; + struct ADIO_DAOS_cont *cont = fd->fs_ptr; + static char myname[] = "ADIOI_DAOS_FCNTL"; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + { + daos_size_t fsize; + + rc = dfs_get_size(cont->dfs, cont->obj, &fsize); + if (rc != 0) { + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, rc); + break; + } + *error_code = MPI_SUCCESS; + fcntl_struct->fsize = (ADIO_Offset) fsize; + break; + } + case ADIO_FCNTL_SET_DISKSPACE: + case ADIO_FCNTL_SET_ATOMICITY: + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + } +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_features.c b/3rd-party/romio341/adio/ad_daos/ad_daos_features.c new file mode 100644 index 0000000000000000000000000000000000000000..5c415e450b7e6edcc992005ef97abb936d1e0b4c --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_features.c @@ -0,0 +1,25 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "ad_daos.h" + +int ADIOI_DAOS_Feature(ADIO_File fd, int flag) +{ + switch (flag) { + case ADIO_SCALABLE_OPEN: + case ADIO_SCALABLE_RESIZE: + return 1; + case ADIO_TWO_PHASE: + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + case ADIO_ATOMIC_MODE: + case ADIO_UNLINK_AFTER_CLOSE: + default: + return 0; + } +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_hhash.c b/3rd-party/romio341/adio/ad_daos/ad_daos_hhash.c new file mode 100644 index 0000000000000000000000000000000000000000..f3c02dc0ec188ebc68ffb61f53481a27f4be9d2e --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_hhash.c @@ -0,0 +1,307 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" +#include "gurt/hash.h" +#include <gurt/common.h> + +static struct d_hash_table *coh_hash; +static struct d_hash_table *poh_hash; + +enum { + DAOS_POOL, + DAOS_CONT, +}; + +static inline struct adio_daos_hdl *hdl_obj(d_list_t * rlink) +{ + return container_of(rlink, struct adio_daos_hdl, entry); +} + +static bool +key_cmp(struct d_hash_table *htable, d_list_t * rlink, const void *key, unsigned int ksize) +{ + struct adio_daos_hdl *hdl = hdl_obj(rlink); + + return (uuid_compare(hdl->uuid, key) == 0); +} + +static void rec_addref(struct d_hash_table *htable, d_list_t * rlink) +{ + hdl_obj(rlink)->ref++; +} + +static bool rec_decref(struct d_hash_table *htable, d_list_t * rlink) +{ + struct adio_daos_hdl *hdl = hdl_obj(rlink); + + assert(hdl->ref > 0); + hdl->ref--; + return (hdl->ref == 0); +} + +static void rec_free(struct d_hash_table *htable, d_list_t * rlink) +{ + struct adio_daos_hdl *hdl = hdl_obj(rlink); + + assert(d_hash_rec_unlinked(&hdl->entry)); + assert(hdl->ref == 0); + + if (hdl->type == DAOS_POOL) + daos_pool_disconnect(hdl->open_hdl, NULL); + else if (hdl->type == DAOS_CONT) { + dfs_umount(hdl->dfs); + daos_cont_close(hdl->open_hdl, NULL); + } else + assert(0); + ADIOI_Free(hdl); +} + +static d_hash_table_ops_t hdl_hash_ops = { + .hop_key_cmp = key_cmp, + .hop_rec_addref = rec_addref, + .hop_rec_decref = rec_decref, + .hop_rec_free = rec_free +}; + +int adio_daos_hash_init(void) +{ + int rc; + + rc = d_hash_table_create(0, 16, NULL, &hdl_hash_ops, &poh_hash); + if (rc) + return rc; + + return d_hash_table_create(0, 16, NULL, &hdl_hash_ops, &coh_hash); +} + +void adio_daos_hash_finalize(void) +{ + d_hash_table_destroy(coh_hash, true /* force */); + d_hash_table_destroy(poh_hash, true /* force */); +} + +struct adio_daos_hdl *adio_daos_poh_lookup(const uuid_t uuid) +{ + d_list_t *rlink; + + rlink = d_hash_rec_find(poh_hash, uuid, sizeof(uuid_t)); + if (rlink == NULL) + return NULL; + + return hdl_obj(rlink); +} + +void adio_daos_poh_release(struct adio_daos_hdl *hdl) +{ + d_hash_rec_decref(poh_hash, &hdl->entry); +} + +int adio_daos_poh_insert(uuid_t uuid, daos_handle_t poh, struct adio_daos_hdl **hdl) +{ + struct adio_daos_hdl *phdl; + int rc; + + phdl = (struct adio_daos_hdl *) ADIOI_Calloc(1, sizeof(struct adio_daos_hdl)); + if (phdl == NULL) + return -1; + + phdl->type = DAOS_POOL; + uuid_copy(phdl->uuid, uuid); + phdl->open_hdl.cookie = poh.cookie; + + rc = d_hash_rec_insert(poh_hash, phdl->uuid, sizeof(uuid_t), &phdl->entry, true); + if (rc) { + PRINT_MSG(stderr, "Failed to add phdl to hashtable (%d)\n", rc); + goto free_hdl; + } + + d_hash_rec_addref(poh_hash, &phdl->entry); + *hdl = phdl; + + return 0; + + free_hdl: + ADIOI_Free(phdl); + return rc; +} + +int adio_daos_poh_lookup_connect(uuid_t uuid, struct adio_daos_hdl **hdl) +{ + struct adio_daos_hdl *phdl; + int rc; + + phdl = adio_daos_poh_lookup(uuid); + if (phdl != NULL) { + *hdl = phdl; + return 0; + } + + phdl = (struct adio_daos_hdl *) ADIOI_Calloc(1, sizeof(struct adio_daos_hdl)); + if (phdl == NULL) + return -1; + + phdl->type = DAOS_POOL; + uuid_copy(phdl->uuid, uuid); + + /** Get the SVCL and Server group from env variables. This is temp as those + * won't be needed later */ + char *svcl_str = NULL; + char *group = NULL; + daos_pool_info_t pool_info; + d_rank_list_t *svcl = NULL; + + svcl_str = getenv("DAOS_SVCL"); + if (svcl_str != NULL) { + svcl = daos_rank_list_parse(svcl_str, ":"); + if (svcl == NULL) { + PRINT_MSG(stderr, "Failed to parse SVC list env\n"); + rc = -1; + goto free_hdl; + } + } + group = getenv("DAOS_GROUP"); + + rc = daos_pool_connect(uuid, group, svcl, DAOS_PC_RW, &phdl->open_hdl, &pool_info, NULL); + d_rank_list_free(svcl); + if (rc < 0) { + PRINT_MSG(stderr, "Failed to connect to pool (%d)\n", rc); + goto free_hdl; + } + + rc = d_hash_rec_insert(poh_hash, phdl->uuid, sizeof(uuid_t), &phdl->entry, true); + if (rc) { + PRINT_MSG(stderr, "Failed to add phdl to hashtable (%d)\n", rc); + goto err_pool; + } + + d_hash_rec_addref(poh_hash, &phdl->entry); + *hdl = phdl; + + return 0; + + err_pool: + daos_pool_disconnect(phdl->open_hdl, NULL); + free_hdl: + ADIOI_Free(phdl); + return rc; +} + +struct adio_daos_hdl *adio_daos_coh_lookup(const uuid_t uuid) +{ + d_list_t *rlink; + + rlink = d_hash_rec_find(coh_hash, uuid, sizeof(uuid_t)); + if (rlink == NULL) + return NULL; + + return hdl_obj(rlink); +} + +void adio_daos_coh_release(struct adio_daos_hdl *hdl) +{ + d_hash_rec_decref(coh_hash, &hdl->entry); +} + +int adio_daos_coh_insert(uuid_t uuid, daos_handle_t coh, struct adio_daos_hdl **hdl) +{ + struct adio_daos_hdl *co_hdl; + int rc; + + co_hdl = (struct adio_daos_hdl *) ADIOI_Calloc(1, sizeof(struct adio_daos_hdl)); + if (co_hdl == NULL) + return -1; + + co_hdl->type = DAOS_CONT; + uuid_copy(co_hdl->uuid, uuid); + co_hdl->open_hdl.cookie = coh.cookie; + + rc = d_hash_rec_insert(coh_hash, co_hdl->uuid, sizeof(uuid_t), &co_hdl->entry, true); + if (rc) { + PRINT_MSG(stderr, "Failed to add co_hdl to hashtable (%d)\n", rc); + goto err_coh; + } + + d_hash_rec_addref(coh_hash, &co_hdl->entry); + *hdl = co_hdl; + + return 0; + + err_coh: + ADIOI_Free(co_hdl); + return rc; +} + +int +adio_daos_coh_lookup_create(daos_handle_t poh, uuid_t uuid, int amode, + bool create, struct adio_daos_hdl **hdl) +{ + struct adio_daos_hdl *co_hdl; + int rc; + + co_hdl = adio_daos_coh_lookup(uuid); + if (co_hdl != NULL) { + *hdl = co_hdl; + return 0; + } + + co_hdl = (struct adio_daos_hdl *) ADIOI_Calloc(1, sizeof(struct adio_daos_hdl)); + if (co_hdl == NULL) + return -1; + + co_hdl->type = DAOS_CONT; + uuid_copy(co_hdl->uuid, uuid); + + /* Try to open the DAOS container first (the parent directory) */ + rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &co_hdl->open_hdl, NULL, NULL); + /* If fails with NOEXIST we can create it then reopen if create mode */ + if (rc == -DER_NONEXIST && create) { + rc = dfs_cont_create(poh, uuid, NULL, &co_hdl->open_hdl, &co_hdl->dfs); + /** if someone got there first, re-open*/ + if (rc == EEXIST) { + rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &co_hdl->open_hdl, NULL, NULL); + if (rc) { + PRINT_MSG(stderr, "Failed to create DFS container (%d)\n", rc); + goto free_coh; + } + rc = dfs_mount(poh, co_hdl->open_hdl, amode, &co_hdl->dfs); + if (rc) { + PRINT_MSG(stderr, "Failed to mount DFS namesapce (%d)\n", rc); + goto err_cont; + } + } else if (rc) { + PRINT_MSG(stderr, "Failed to create DFS container (%d)\n", rc); + goto free_coh; + } + } else if (rc == 0) { + /* Mount a DFS namespace on the container */ + rc = dfs_mount(poh, co_hdl->open_hdl, amode, &co_hdl->dfs); + if (rc) { + PRINT_MSG(stderr, "Failed to mount DFS namespace (%d)\n", rc); + goto err_cont; + } + } else { + goto free_coh; + } + + rc = d_hash_rec_insert(coh_hash, co_hdl->uuid, sizeof(uuid_t), &co_hdl->entry, true); + if (rc) { + PRINT_MSG(stderr, "Failed to add co_hdl to hashtable (%d)\n", rc); + goto err_dfs; + } + + d_hash_rec_addref(coh_hash, &co_hdl->entry); + *hdl = co_hdl; + + return 0; + + err_dfs: + dfs_umount(co_hdl->dfs); + err_cont: + daos_cont_close(co_hdl->open_hdl, NULL); + free_coh: + ADIOI_Free(co_hdl); + return rc; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_hints.c b/3rd-party/romio341/adio/ad_daos/ad_daos_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..bb2c5544c36aac1e1d46e79062843899dd6448d6 --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_hints.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +#include "hint_fns.h" + +void ADIOI_DAOS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + static char myname[] = "ADIOI_DAOS_SETINFO"; + + if ((fd->info) == MPI_INFO_NULL) { + /* part of the open call */ + MPI_Info_create(&(fd->info)); + + ADIOI_Info_set(fd->info, "romio_daos_chunk_size", "0"); + fd->hints->fs_hints.daos.chunk_size = 0; + + ADIOI_Info_set(fd->info, "romio_daos_obj_class", "OC_UNKNOWN"); + fd->hints->fs_hints.daos.obj_class = OC_UNKNOWN; + + if (users_info != MPI_INFO_NULL) { + char *oclass = NULL; + + /* Chunk size in each dkey */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_daos_chunk_size", + &(fd->hints->fs_hints.daos.chunk_size), myname, + error_code); + + /* object class for each file */ + ADIOI_Info_check_and_install_str(fd, users_info, "romio_daos_obj_class", + &oclass, myname, error_code); + + if (oclass) { + fd->hints->fs_hints.daos.obj_class = daos_oclass_name2id(oclass); + ADIOI_Free(oclass); + } + } + } + + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_io.c b/3rd-party/romio341/adio/ad_daos/ad_daos_io.c new file mode 100644 index 0000000000000000000000000000000000000000..91ed8588f8729f5cbf460dbd596656eaab00b567 --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_io.c @@ -0,0 +1,216 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +#include "../../mpi-io/mpioimpl.h" +#ifdef MPIO_BUILD_PROFILING +#include "../../mpi-io/mpioprof.h" +#endif +#include "mpiu_greq.h" + +enum { + DAOS_WRITE, + DAOS_READ +}; + +static MPIX_Grequest_class ADIOI_DAOS_greq_class = 0; + +static void DAOS_IOContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + MPI_Request * request, int flag, int *error_code) +{ + MPI_Count datatype_size; + uint64_t len; + d_sg_list_t *sgl, loc_sgl; + d_iov_t *iov, loc_iov; + daos_size_t *nbytes, loc_nbytes; + int ret; + struct ADIO_DAOS_cont *cont = fd->fs_ptr; + struct ADIO_DAOS_req *aio_req; + static char myname[] = "ADIOI_DAOS_IOCONTIG"; + + MPI_Type_size_x(datatype, &datatype_size); + len = (ADIO_Offset) datatype_size *(ADIO_Offset) count; + + if (request) { + aio_req = (struct ADIO_DAOS_req *) ADIOI_Calloc(sizeof(struct ADIO_DAOS_req), 1); + daos_event_init(&aio_req->daos_event, DAOS_HDL_INVAL, NULL); + + sgl = &aio_req->sgl; + iov = &aio_req->iov; + nbytes = &aio_req->nbytes; + + if (ADIOI_DAOS_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_DAOS_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_DAOS_aio_poll_fn, ADIOI_DAOS_aio_wait_fn, + &ADIOI_DAOS_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_DAOS_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + } else { + sgl = &loc_sgl; + iov = &loc_iov; + nbytes = &loc_nbytes; + } + + if (len == 0) { + *nbytes = 0; + goto done; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + /** set memory location */ + sgl->sg_nr = 1; + sgl->sg_nr_out = 0; + d_iov_set(iov, buf, len); + sgl->sg_iovs = iov; +#ifdef D_PRINT_IO_MEM + printf("MEM : off %lld len %zu\n", buf, len); +#endif + +#ifdef D_PRINT_IO + int mpi_rank; + + MPI_Comm_rank(fd->comm, &mpi_rank); + printf("(%d) CONTIG IO OP %d, Off %llu, Len %zu\n", mpi_rank, flag, offset, len); +#endif + + if (flag == DAOS_WRITE) { + ret = dfs_write(cont->dfs, cont->obj, sgl, offset, (request ? &aio_req->daos_event : NULL)); + if (ret != 0) { + PRINT_MSG(stderr, "dfs_write() failed with %d\n", ret); + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, ret); + return; + } + *nbytes = len; + } else if (flag == DAOS_READ) { + ret = dfs_read(cont->dfs, cont->obj, sgl, offset, nbytes, + (request ? &aio_req->daos_event : NULL)); + if (ret != 0) { + PRINT_MSG(stderr, "dfs_read() failed with %d\n", ret); + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, ret); + return; + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += len; + } + + fd->fp_sys_posn = offset + len; + + done: +#ifdef HAVE_STATUS_SET_BYTES + if (request == NULL && status) + MPIR_Status_set_bytes(status, datatype, *nbytes); +#endif + + *error_code = MPI_SUCCESS; +} + +void ADIOI_DAOS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + DAOS_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, status, NULL, DAOS_READ, error_code); +} + +void ADIOI_DAOS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + DAOS_IOContig(fd, (void *) buf, count, datatype, file_ptr_type, + offset, status, NULL, DAOS_WRITE, error_code); +} + +void ADIOI_DAOS_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + DAOS_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, NULL, request, DAOS_READ, error_code); +} + +void ADIOI_DAOS_IWriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + DAOS_IOContig(fd, (void *) buf, count, datatype, file_ptr_type, + offset, NULL, request, DAOS_WRITE, error_code); +} + +int ADIOI_DAOS_aio_free_fn(void *extra_state) +{ + struct ADIO_DAOS_req *aio_req = (struct ADIO_DAOS_req *) extra_state; + + if (aio_req->iovs) + ADIOI_Free(aio_req->iovs); + + if (aio_req->rgs) + ADIOI_Free(aio_req->rgs); + + ADIOI_Free(aio_req); + + return MPI_SUCCESS; +} + +int ADIOI_DAOS_aio_poll_fn(void *extra_state, MPI_Status * status) +{ + struct ADIO_DAOS_req *aio_req = (struct ADIO_DAOS_req *) extra_state;; + int ret; + bool flag; + + /* MSC - MPICH hangs if we just test with NOWAIT.. */ + ret = daos_event_test(&aio_req->daos_event, DAOS_EQ_WAIT, &flag); + if (ret != 0) + return MPI_UNDEFINED; + + if (flag) + MPI_Grequest_complete(aio_req->req); + else + return MPI_UNDEFINED; + + if (aio_req->daos_event.ev_error != 0) + ret = ADIOI_DAOS_err("ADIOI_DAOS_aio_poll_fn", "DAOS Event Error", __LINE__, ret); + else + ret = MPI_SUCCESS; + + return ret; +} + +/* wait for multiple requests to complete */ +int ADIOI_DAOS_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status) +{ + + struct ADIO_DAOS_req **aio_reqlist; + int i, nr_complete, ret; + + aio_reqlist = (struct ADIO_DAOS_req **) array_of_states; + + nr_complete = 0; + while (nr_complete < count) { + for (i = 0; i < count; i++) { + bool flag; + + ret = daos_event_test(&aio_reqlist[i]->daos_event, + (timeout > 0) ? (int64_t) timeout : DAOS_EQ_WAIT, &flag); + if (ret != 0) + return MPI_UNDEFINED; + + if (flag) { + MPI_Grequest_complete(aio_reqlist[i]->req); + nr_complete++; + } + } + } + return MPI_SUCCESS; /* TODO: no idea how to deal with errors */ +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_io_str.c b/3rd-party/romio341/adio/ad_daos/ad_daos_io_str.c new file mode 100644 index 0000000000000000000000000000000000000000..a763abf8abe0382a29fcbbe65432f3adb31b331a --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_io_str.c @@ -0,0 +1,384 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" +#include "adio_extern.h" +#include <assert.h> + +#include "../../mpi-io/mpioimpl.h" +#ifdef MPIO_BUILD_PROFILING +#include "../../mpi-io/mpioprof.h" +#endif +#include "mpiu_greq.h" + +enum { + DAOS_WRITE, + DAOS_READ +}; + +static void +ADIOI_DAOS_StridedListIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + MPI_Request * request, int rw_type, int *error_code); + +static MPIX_Grequest_class ADIOI_DAOS_greq_class = 0; +int ADIOI_DAOS_aio_free_fn(void *extra_state); +int ADIOI_DAOS_aio_poll_fn(void *extra_state, MPI_Status * status); +int ADIOI_DAOS_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status); + +void ADIOI_DAOS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ADIOI_DAOS_StridedListIO(fd, buf, count, datatype, file_ptr_type, + offset, status, NULL, DAOS_READ, error_code); + return; +} + +void ADIOI_DAOS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ADIOI_DAOS_StridedListIO(fd, (void *) buf, count, datatype, file_ptr_type, + offset, status, NULL, DAOS_WRITE, error_code); + return; +} + +void ADIOI_DAOS_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + ADIOI_DAOS_StridedListIO(fd, buf, count, datatype, file_ptr_type, + offset, NULL, request, DAOS_READ, error_code); + return; +} + +void ADIOI_DAOS_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + ADIOI_DAOS_StridedListIO(fd, (void *) buf, count, datatype, file_ptr_type, + offset, NULL, request, DAOS_WRITE, error_code); + return; +} + + +static void +ADIOI_DAOS_StridedListIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + MPI_Request * request, int rw_type, int *error_code) +{ + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, fwr_size = 0, st_index = 0; + int sum, n_etypes_in_filetype, size_in_filetype; + MPI_Count bufsize; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off; + int flag, st_fwr_size, st_n_filetypes; + int mem_list_count; + int64_t file_length; + int total_blks_to_write; + int f_data_wrote; + int n_write_lists; + struct ADIO_DAOS_cont *cont = fd->fs_ptr; + struct ADIO_DAOS_req *aio_req = NULL; + static char myname[] = "ADIOI_DAOS_StridedListIO"; + int err_flag = 0, ret; + int mpi_rank; + + MPI_Comm_rank(fd->comm, &mpi_rank); + *error_code = MPI_SUCCESS; + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + + d_sg_list_t *sgl, loc_sgl; + d_iov_t *iovs; + dfs_iod_t *iod, loc_iod; + daos_range_t *rgs; + daos_size_t *nbytes, loc_nbytes; + + if (request) { + aio_req = (struct ADIO_DAOS_req *) ADIOI_Calloc(sizeof(struct ADIO_DAOS_req), 1); + daos_event_init(&aio_req->daos_event, DAOS_HDL_INVAL, NULL); + iod = &aio_req->iod; + sgl = &aio_req->sgl; + nbytes = &aio_req->nbytes; + + if (ADIOI_DAOS_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_DAOS_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_DAOS_aio_poll_fn, ADIOI_DAOS_aio_wait_fn, + &ADIOI_DAOS_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_DAOS_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + } else { + iod = &loc_iod; + sgl = &loc_sgl; + nbytes = &loc_nbytes; + } + + if (filetype_size == 0) { +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + if (bufsize == 0) { +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + /* Create Memory SGL */ + file_length = 0; + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + mem_list_count = count * flat_buf->count; + + iovs = (d_iov_t *) ADIOI_Malloc(mem_list_count * sizeof(d_iov_t)); + + k = 0; + for (j = 0; j < count; j++) { + for (i = 0; i < flat_buf->count; i++) { + ADIO_Offset tmp_off; + + if (flat_buf->blocklens[i] == 0) { + continue; + } + if (file_length + flat_buf->blocklens[i] > bufsize) + break; + + tmp_off = ((size_t) buf + j * buftype_extent + flat_buf->indices[i]); + file_length += flat_buf->blocklens[i]; + d_iov_set(&iovs[k++], (char *) tmp_off, flat_buf->blocklens[i]); + +#ifdef D_PRINT_IO_MEM + printf("(MEM %d) %d: off %lld len %zu\n", mpi_rank, k, + tmp_off, flat_buf->blocklens[i]); +#endif + } + } + } else { + k = 1; + iovs = (d_iov_t *) ADIOI_Malloc(sizeof(d_iov_t)); + file_length = bufsize; + d_iov_set(iovs, (void *) buf, bufsize); +#ifdef D_PRINT_IO_MEM + printf("(MEM SINGLE) off %lld len %zu\n", buf, bufsize); +#endif + } + sgl->sg_nr = k; + sgl->sg_nr_out = 0; + sgl->sg_iovs = iovs; + if (request) + aio_req->iovs = iovs; + + if (filetype_is_contig) { + n_write_lists = 1; + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) + off = fd->disp + etype_size * offset; + else + off = fd->fp_ind; + + rgs = (daos_range_t *) ADIOI_Malloc(sizeof(daos_range_t)); + rgs->rg_idx = off; + rgs->rg_len = bufsize; +#ifdef D_PRINT_IO + printf("(%d) Single: idx %lld len %zu\n", mpi_rank, rgs->rg_idx, rgs->rg_len); +#endif + } else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + /* for each case - ADIO_Individual pointer or explicit, find offset + * (file offset in bytes), n_filetypes (how many filetypes into file to + * start), fwr_size (remaining amount of data in present file block), + * and st_index (start point in terms of blocks in starting filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + start_off = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] >= start_off) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] - start_off; + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = (int) (offset / n_etypes_in_filetype); + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + /* abs. offset in bytes in the file */ + start_off = disp + ((ADIO_Offset) n_filetypes) * filetype_extent + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + i = 0; + j = st_index; + f_data_wrote = MPL_MIN(st_fwr_size, bufsize); + n_filetypes = st_n_filetypes; + + /* determine how many blocks in file to write */ + total_blks_to_write = 1; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + + while (f_data_wrote < bufsize) { + f_data_wrote += flat_file->blocklens[j]; + if (flat_file->blocklens[j]) + total_blks_to_write++; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_write_lists = total_blks_to_write; + + rgs = (daos_range_t *) ADIOI_Malloc(sizeof(daos_range_t) * n_write_lists); + +#if 0 + for (i = 0; i < flat_file->count; i++) + fprintf(stderr, "(%d) FF: %d: off %lld, len %zu\n", mpi_rank, i, + flat_file->indices[i], flat_file->blocklens[i]); + fprintf(stderr, "NUM IO lists = %d\n", n_write_lists); +#endif + + for (i = 0; i < n_write_lists; i++) { + if (!i) { + rgs[i].rg_idx = start_off; + rgs[i].rg_len = MPL_MIN(f_data_wrote, st_fwr_size); +#ifdef D_PRINT_IO + printf("(%d) %d: idx %lld len %zu\n", mpi_rank, i, rgs[i].rg_idx, rgs[i].rg_len); +#endif + } else { + if (flat_file->blocklens[j]) { + rgs[i].rg_idx = disp + + ((ADIO_Offset) n_filetypes) * filetype_extent + flat_file->indices[j]; + rgs[i].rg_len = flat_file->blocklens[j]; +#ifdef D_PRINT_IO + printf("(%d) %d: idx %lld len %zu\n", + mpi_rank, i, rgs[i].rg_idx, rgs[i].rg_len); +#endif + } else + i--; + } + + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } + } + + /** set array location */ + iod->iod_nr = n_write_lists; + iod->iod_rgs = rgs; + if (request) + aio_req->rgs = rgs; + + if (rw_type == DAOS_WRITE) { + ret = dfs_writex(cont->dfs, cont->obj, iod, sgl, (request ? &aio_req->daos_event : NULL)); + if (ret != 0) { + PRINT_MSG(stderr, "dfs_writex() failed with %d\n", ret); + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, ret); + return; + } + *nbytes = bufsize; + } else if (rw_type == DAOS_READ) { + ret = dfs_readx(cont->dfs, cont->obj, iod, sgl, nbytes, + (request ? &aio_req->daos_event : NULL)); + if (ret != 0) { + PRINT_MSG(stderr, "dfs_readx() failed with %d\n", ret); + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, ret); + return; + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + if (filetype_is_contig) + fd->fp_ind += bufsize; + else + fd->fp_ind = rgs[n_write_lists - 1].rg_idx + rgs[n_write_lists - 1].rg_len; + } + + if (!err_flag) + *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* clear this. */ + +#ifdef HAVE_STATUS_SET_BYTES + if (request == NULL && status) { + MPIR_Status_set_bytes(status, datatype, *nbytes); + } +#endif + + if (!request) { + ADIOI_Free(iovs); + ADIOI_Free(rgs); + } + + return; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_open.c b/3rd-party/romio341/adio/ad_daos/ad_daos_open.c new file mode 100644 index 0000000000000000000000000000000000000000..17dcb881b305846abbcf0c22c22533849cef6de0 --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_open.c @@ -0,0 +1,574 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" +#include <libgen.h> +#include <uuid/uuid.h> +#include <gurt/common.h> + +static int parse_filename(const char *path, char **_obj_name, char **_cont_name) +{ + char *f1; + char *f2; + char *fname; + char *cont_name; + int rc = 0; + + f1 = ADIOI_Strdup(path); + if (f1 == NULL) + return ENOMEM; + + f2 = ADIOI_Strdup(path); + if (f2 == NULL) { + ADIOI_Free(f1); + return ENOMEM; + } + + fname = basename(f1); + cont_name = dirname(f2); + + if (cont_name[0] == '.') { + char *ptr; + char cwd[PATH_MAX]; + + ptr = getcwd(cwd, PATH_MAX); + if (ptr == NULL) { + rc = errno; + goto out; + } + + if (strcmp(cont_name, ".") == 0) { + cont_name = ADIOI_Strdup(cwd); + if (cont_name == NULL) { + rc = ENOMEM; + goto out; + } + } + *_cont_name = cont_name; + } else { + *_cont_name = ADIOI_Strdup(cont_name); + if (*_cont_name == NULL) { + rc = ENOMEM; + goto out; + } + } + + *_obj_name = ADIOI_Strdup(fname); + if (*_obj_name == NULL) { + rc = ENOMEM; + goto out; + } + + out: + ADIOI_Free(f1); + ADIOI_Free(f2); + return rc; +} + + +static int cache_handles(struct ADIO_DAOS_cont *cont) +{ + int rc; + + cont->c = adio_daos_coh_lookup(cont->attr.da_cuuid); + if (cont->c == NULL) { + /** insert handle into container hashtable */ + rc = adio_daos_coh_insert(cont->attr.da_cuuid, cont->coh, &cont->c); + } else { + /** g2l handle not needed, already cached */ + rc = daos_cont_close(cont->coh, NULL); + cont->coh = cont->c->open_hdl; + } + if (rc) + return rc; + + cont->p = adio_daos_poh_lookup(cont->attr.da_puuid); + if (cont->p == NULL) { + /** insert handle into pool hashtable */ + rc = adio_daos_poh_insert(cont->attr.da_puuid, cont->poh, &cont->p); + } else { + /** g2l handle not needed, already cached */ + rc = daos_pool_disconnect(cont->poh, NULL); + cont->poh = cont->p->open_hdl; + } + + return rc; +} + +static int share_cont_info(struct ADIO_DAOS_cont *cont, int rank, MPI_Comm comm) +{ + char uuid_buf[74]; + d_iov_t pool_hdl = { NULL, 0, 0 }; + d_iov_t cont_hdl = { NULL, 0, 0 }; + d_iov_t dfs_hdl = { NULL, 0, 0 }; + d_iov_t file_hdl = { NULL, 0, 0 }; + char *buf = NULL; + uint64_t total_size = 0; + int rc = 0; + + if (rank == 0) { + rc = daos_pool_local2global(cont->poh, &pool_hdl); + if (rc) + return rc; + rc = daos_cont_local2global(cont->coh, &cont_hdl); + if (rc) + return rc; + rc = dfs_local2global(cont->dfs, &dfs_hdl); + if (rc) + return rc; + rc = dfs_obj_local2global(cont->dfs, cont->obj, &file_hdl); + if (rc) + return rc; + + total_size = sizeof(uuid_buf) + pool_hdl.iov_buf_len + cont_hdl.iov_buf_len + + dfs_hdl.iov_buf_len + file_hdl.iov_buf_len + sizeof(daos_size_t) * 4; + } + + /** broadcast size to all peers */ + rc = MPI_Bcast(&total_size, 1, MPI_UINT64_T, 0, comm); + if (rc != MPI_SUCCESS) + return -1; + + /** allocate buffers */ + buf = ADIOI_Malloc(total_size); + if (buf == NULL) + return -1; + + if (rank == 0) { + char *ptr = buf; + + uuid_unparse(cont->attr.da_puuid, ptr); + ptr += 37; + uuid_unparse(cont->attr.da_cuuid, ptr); + ptr += 37; + + *((daos_size_t *) ptr) = pool_hdl.iov_buf_len; + ptr += sizeof(daos_size_t); + pool_hdl.iov_buf = ptr; + pool_hdl.iov_len = pool_hdl.iov_buf_len; + rc = daos_pool_local2global(cont->poh, &pool_hdl); + if (rc) + goto out; + ptr += pool_hdl.iov_buf_len; + + *((daos_size_t *) ptr) = cont_hdl.iov_buf_len; + ptr += sizeof(daos_size_t); + cont_hdl.iov_buf = ptr; + cont_hdl.iov_len = cont_hdl.iov_buf_len; + rc = daos_cont_local2global(cont->coh, &cont_hdl); + if (rc) + goto out; + ptr += cont_hdl.iov_buf_len; + + *((daos_size_t *) ptr) = dfs_hdl.iov_buf_len; + ptr += sizeof(daos_size_t); + dfs_hdl.iov_buf = ptr; + dfs_hdl.iov_len = dfs_hdl.iov_buf_len; + rc = dfs_local2global(cont->dfs, &dfs_hdl); + if (rc) + goto out; + ptr += dfs_hdl.iov_buf_len; + + *((daos_size_t *) ptr) = file_hdl.iov_buf_len; + ptr += sizeof(daos_size_t); + file_hdl.iov_buf = ptr; + file_hdl.iov_len = file_hdl.iov_buf_len; + rc = dfs_obj_local2global(cont->dfs, cont->obj, &file_hdl); + if (rc) + goto out; + } + + rc = MPI_Bcast(buf, total_size, MPI_BYTE, 0, comm); + if (rc != MPI_SUCCESS) + goto out; + + if (rank != 0) { + char *ptr = buf; + + rc = uuid_parse(ptr, cont->attr.da_puuid); + if (rc) + goto out; + ptr += 37; + + rc = uuid_parse(ptr, cont->attr.da_cuuid); + if (rc) + goto out; + ptr += 37; + + pool_hdl.iov_buf_len = *((daos_size_t *) ptr); + ptr += sizeof(daos_size_t); + pool_hdl.iov_buf = ptr; + pool_hdl.iov_len = pool_hdl.iov_buf_len; + rc = daos_pool_global2local(pool_hdl, &cont->poh); + if (rc) + goto out; + ptr += pool_hdl.iov_buf_len; + + cont_hdl.iov_buf_len = *((daos_size_t *) ptr); + ptr += sizeof(daos_size_t); + cont_hdl.iov_buf = ptr; + cont_hdl.iov_len = cont_hdl.iov_buf_len; + rc = daos_cont_global2local(cont->poh, cont_hdl, &cont->coh); + if (rc) + goto out; + ptr += cont_hdl.iov_buf_len; + + rc = cache_handles(cont); + if (rc) + goto out; + + dfs_hdl.iov_buf_len = *((daos_size_t *) ptr); + ptr += sizeof(daos_size_t); + dfs_hdl.iov_buf = ptr; + dfs_hdl.iov_len = dfs_hdl.iov_buf_len; + rc = dfs_global2local(cont->poh, cont->coh, O_RDWR, dfs_hdl, &cont->dfs); + if (rc) + goto out; + ptr += dfs_hdl.iov_buf_len; + + if (rank != 0) { + if (cont->c->dfs == NULL) { + cont->c->dfs = cont->dfs; + } else { + dfs_umount(cont->dfs); + cont->dfs = cont->c->dfs; + } + } + + file_hdl.iov_buf_len = *((daos_size_t *) ptr); + ptr += sizeof(daos_size_t); + file_hdl.iov_buf = ptr; + file_hdl.iov_len = file_hdl.iov_buf_len; + rc = dfs_obj_global2local(cont->dfs, 0, file_hdl, &cont->obj); + if (rc) + goto out; + } + + out: + ADIOI_Free(buf); + return rc; +} + +static int get_pool_cont_uuids(const char *path, struct duns_attr_t *attr) +{ + bool bypass_duns = false; + char *uuid_str; + int rc; + + d_getenv_bool("DAOS_BYPASS_DUNS", &bypass_duns); + + if (!bypass_duns) { + attr->da_no_prefix = true; + rc = duns_resolve_path(path, attr); + if (rc) { + PRINT_MSG(stderr, "duns_resolve_path() failed on path %s (%d)\n", path, rc); + return rc; + } + return 0; + } + + /* use the env variables to retrieve the pool and container */ + uuid_str = getenv("DAOS_POOL"); + if (uuid_str == NULL) { + PRINT_MSG(stderr, "Can't retrieve DAOS pool uuid\n"); + return EINVAL; + } + if (uuid_parse(uuid_str, attr->da_puuid) < 0) { + PRINT_MSG(stderr, "Failed to parse pool uuid\n"); + return EINVAL; + } + + uuid_str = getenv("DAOS_CONT"); + if (uuid_str == NULL) { + PRINT_MSG(stderr, "Can't retrieve DAOS cont uuid\n"); + return EINVAL; + } + if (uuid_parse(uuid_str, attr->da_cuuid) < 0) { + PRINT_MSG(stderr, "Failed to parse container uuid\n"); + return EINVAL; + } + + attr->da_oclass_id = OC_UNKNOWN; + attr->da_chunk_size = 0; + + return 0; +} + +void ADIOI_DAOS_Open(ADIO_File fd, int *error_code) +{ + struct ADIO_DAOS_cont *cont = fd->fs_ptr; + static char myname[] = "ADIOI_DAOS_OPEN"; + dfs_obj_t *parent = NULL; + int perm, old_mask, amode; + int rc; + + *error_code = MPI_SUCCESS; + + rc = parse_filename(fd->filename, &cont->obj_name, &cont->cont_name); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont->cont_name, __LINE__, rc); + return; + } + + rc = get_pool_cont_uuids(cont->cont_name, &cont->attr); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont->cont_name, __LINE__, rc); + return; + } + + /** Info object setting should override */ + if (fd->hints->fs_hints.daos.obj_class != OC_UNKNOWN) + cont->attr.da_oclass_id = fd->hints->fs_hints.daos.obj_class; + if (fd->hints->fs_hints.daos.chunk_size != 0) + cont->attr.da_chunk_size = fd->hints->fs_hints.daos.chunk_size; + +#if 0 + { + char uuid_str[37]; + uuid_unparse(cont->attr.da_cuuid, uuid_str); + + fprintf(stderr, "Container Open %s %s\n", cont->cont_name, uuid_str); + fprintf(stderr, "File %s\n", cont->obj_name); + } + fprintf(stderr, "chunk_size = %d\n", cont->attr.da_chunk_size); + fprintf(stderr, "OCLASS = %d\n", cont->attr.da_oclass_id); +#endif + + rc = adio_daos_poh_lookup_connect(cont->attr.da_puuid, &cont->p); + if (rc) { + PRINT_MSG(stderr, "Failed to connect to DAOS Pool (%d)\n", rc); + *error_code = ADIOI_DAOS_err(myname, cont->cont_name, __LINE__, rc); + return; + } + + cont->poh = cont->p->open_hdl; + + rc = adio_daos_coh_lookup_create(cont->poh, cont->attr.da_cuuid, O_RDWR, + (fd->access_mode & ADIO_CREATE), &cont->c); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont->cont_name, __LINE__, rc); + goto err_pool; + } + + cont->coh = cont->c->open_hdl; + + assert(cont->c->dfs); + cont->dfs = cont->c->dfs; + + /* Set file access flags */ + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + /* Set DFS permission mode + object type */ + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else { + perm = fd->perm; + } + perm = S_IFREG | perm; + + /* Lookup the parent directory. this will be NULL in case of root */ + if (cont->attr.da_rel_path) { + rc = dfs_lookup(cont->dfs, cont->attr.da_rel_path, amode, &parent, NULL, NULL); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, rc); + goto err_cont; + } + } + + rc = dfs_open(cont->dfs, parent, cont->obj_name, perm, amode, + cont->attr.da_oclass_id, cont->attr.da_chunk_size, NULL, &cont->obj); + + if (parent) + dfs_release(parent); + + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, rc); + goto err_cont; + } + + out: + return; + err_obj: + dfs_release(cont->obj); + if (fd->access_mode & ADIO_CREATE) + dfs_remove(cont->dfs, NULL, cont->obj_name, true, NULL); + err_cont: + adio_daos_coh_release(cont->c); + cont->c = NULL; + err_pool: + adio_daos_poh_release(cont->p); + cont->p = NULL; + err_free: + ADIOI_Free(cont->obj_name); + ADIOI_Free(cont->cont_name); + goto out; +} + +void ADIOI_DAOS_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code) +{ + struct ADIO_DAOS_cont *cont; + int amode, orig_amode_wronly; + MPI_Comm comm = fd->comm; + int mpi_size; + int rc; + static char myname[] = "ADIOI_DAOS_OPENCOLL"; + + ADIOI_DAOS_Init(error_code); + if (*error_code != MPI_SUCCESS) + return; + + MPI_Comm_size(comm, &mpi_size); + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + amode = 0; + if (access_mode & ADIO_RDONLY) + amode = DAOS_COO_RO; + else + amode = DAOS_COO_RW; + + cont = (struct ADIO_DAOS_cont *) ADIOI_Calloc(1, sizeof(struct ADIO_DAOS_cont)); + if (cont == NULL) { + *error_code = MPI_ERR_NO_MEM; + return; + } + + fd->access_mode = access_mode; + cont->amode = amode; + fd->fs_ptr = cont; + + if (rank == 0) { + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + MPI_Error_class(*error_code, &rc); + } + + if (mpi_size > 1) { + MPI_Bcast(&rc, 1, MPI_INT, 0, comm); + + if (rank != 0) { + if (rc) + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, rc, "File Open error", 0); + else + *error_code = MPI_SUCCESS; + } + } + if (*error_code != MPI_SUCCESS) + goto err_free; + + if (mpi_size > 1) { + rc = share_cont_info(cont, rank, comm); + if (rc) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, + __LINE__, rc, "File Open error", 0); + goto err_free; + } + } + + fd->is_open = 1; + fd->access_mode = orig_amode_wronly; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + + return; + + err_free: + ADIOI_Free(cont); + return; +} + +void ADIOI_DAOS_Flush(ADIO_File fd, int *error_code) +{ + MPI_Barrier(fd->comm); + *error_code = MPI_SUCCESS; +} + +void ADIOI_DAOS_Delete(const char *filename, int *error_code) +{ + struct adio_daos_hdl *p, *c; + dfs_t *dfs; + char *obj_name, *cont_name; + struct duns_attr_t attr = { }; + static char myname[] = "ADIOI_DAOS_DELETE"; + int rc; + + ADIOI_DAOS_Init(error_code); + if (*error_code != MPI_SUCCESS) + return; + + rc = parse_filename(filename, &obj_name, &cont_name); + if (rc) { + *error_code = MPI_ERR_NO_MEM; + return; + } + + rc = get_pool_cont_uuids(cont_name, &attr); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, cont_name, __LINE__, rc); + return; + } + + rc = adio_daos_poh_lookup_connect(attr.da_puuid, &p); + if (rc || p == NULL) { + PRINT_MSG(stderr, "Failed to connect to pool\n"); + *error_code = ADIOI_DAOS_err(myname, cont_name, __LINE__, rc); + goto out_free; + } + + rc = adio_daos_coh_lookup_create(p->open_hdl, attr.da_cuuid, O_RDWR, false, &c); + if (rc || c == NULL) { + *error_code = ADIOI_DAOS_err(myname, cont_name, __LINE__, rc); + goto out_pool; + } + + if (c->dfs == NULL) { + /* Mount a flat namespace on the container */ + rc = dfs_mount(p->open_hdl, c->open_hdl, O_RDWR, &dfs); + if (rc) { + PRINT_MSG(stderr, "Failed to mount flat namespace (%d)\n", rc); + *error_code = ADIOI_DAOS_err(myname, obj_name, __LINE__, rc); + goto out_cont; + } + c->dfs = dfs; + } + + /* Remove the file from the flat namespace */ + rc = dfs_remove(c->dfs, NULL, obj_name, true, NULL); + if (rc) { + *error_code = ADIOI_DAOS_err(myname, obj_name, __LINE__, rc); + goto out_cont; + } + + *error_code = MPI_SUCCESS; + + out_cont: + adio_daos_coh_release(c); + out_pool: + adio_daos_poh_release(p); + out_free: + ADIOI_Free(obj_name); + ADIOI_Free(cont_name); + return; +} diff --git a/3rd-party/romio341/adio/ad_daos/ad_daos_resize.c b/3rd-party/romio341/adio/ad_daos/ad_daos_resize.c new file mode 100644 index 0000000000000000000000000000000000000000..f95d5f71168492ac7bd8f5f8eb696af07a9f2013 --- /dev/null +++ b/3rd-party/romio341/adio/ad_daos/ad_daos_resize.c @@ -0,0 +1,24 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_daos.h" + +void ADIOI_DAOS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int ret, rank; + struct ADIO_DAOS_cont *cont = fd->fs_ptr; + static char myname[] = "ADIOI_DAOS_RESIZE"; + + *error_code = MPI_SUCCESS; + MPI_Comm_rank(fd->comm, &rank); + MPI_Barrier(fd->comm); + + if (rank == fd->hints->ranklist[0]) + ret = dfs_punch(cont->dfs, cont->obj, size, DFS_MAX_FSIZE); + + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + if (ret != 0) + *error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, ret); +} diff --git a/3rd-party/romio321/adio/ad_gpfs/.gitignore b/3rd-party/romio341/adio/ad_gpfs/.gitignore similarity index 100% rename from 3rd-party/romio321/adio/ad_gpfs/.gitignore rename to 3rd-party/romio341/adio/ad_gpfs/.gitignore diff --git a/3rd-party/romio321/adio/ad_gpfs/Makefile.mk b/3rd-party/romio341/adio/ad_gpfs/Makefile.mk similarity index 87% rename from 3rd-party/romio321/adio/ad_gpfs/Makefile.mk rename to 3rd-party/romio341/adio/ad_gpfs/Makefile.mk index db8737be5c79047648cbd4e68f84e9fa62d7dc83..9f71ca2b1f3df0b9063ea46d9d1c44d9647f588f 100644 --- a/3rd-party/romio321/adio/ad_gpfs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_gpfs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2012 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_GPFS diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.c new file mode 100644 index 0000000000000000000000000000000000000000..203fbdedeff859ed66d99d387e40e2c384443a01 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs.c + * \brief ??? + */ + +#include "ad_gpfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_GPFS_operations = { + ADIOI_GPFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* Collective open */ + ADIOI_GEN_ReadContig, /* ReadContig */ + ADIOI_GEN_WriteContig, /* WriteContig */ + ADIOI_GPFS_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GPFS_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ +#if defined(BGQPLATFORM) || defined(PEPLATFORM) + ADIOI_GPFS_SetInfo, /* SetInfo for BlueGene or PE */ +#else + ADIOI_GEN_SetInfo, /* SetInfo for any platform besides BlueGene or PE */ +#endif + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_GPFS_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO +#warning Consider BG support for NFS before enabling this. + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GPFS_Flush, /* Flush */ + ADIOI_GEN_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ +#ifdef BGQPLATFORM + "GPFS+BGQ: IBM GPFS for Blue Gene", +#elif PEPLATFORM + "GPFS+PE: IBM GPFS for PE", +#else + "GPFS: IBM GPFS", +#endif + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.h b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.h new file mode 100644 index 0000000000000000000000000000000000000000..2523b82746aaf17c8c744b5ecfac34c3cffd99e8 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs.h + * \brief ??? + */ + +#ifndef AD_GPFS_H_INCLUDED +#define AD_GPFS_H_INCLUDED + +#include "adio.h" +#include <unistd.h> +#include <stdlib.h> +#include <sys/types.h> +#include <fcntl.h> + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif +#ifdef HAVE_AIO_LITE_H +#include <aio-lite.h> +#elif defined HAVE_AIO_H +#include <aio.h> +#endif + + +void ADIOI_GPFS_Open(ADIO_File fd, int *error_code); + +void ADIOI_GPFS_Close(ADIO_File fd, int *error_code); + +void ADIOI_GPFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GPFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); + +void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +void ADIOI_GPFS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GPFS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); + +void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); + +void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); + +void ADIOI_GPFS_Flush(ADIO_File fd, int *error_code); + +#include "ad_tuning.h" +#include "ad_gpfs_tuning.h" + + +#endif /* AD_GPFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.c new file mode 100644 index 0000000000000000000000000000000000000000..c261e22d6b0463c97e644fd35177d769fb4feea6 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.c @@ -0,0 +1,771 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_aggrs.c + * \brief The externally used function from this file is is declared in ad_gpfs_aggrs.h + */ + +#include "adio.h" +#include "adio_cb_config_list.h" +#include "ad_gpfs.h" +#include "ad_gpfs_aggrs.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + + +#ifdef MPL_USE_DBG_LOGGING +#define AGG_DEBUG 1 +#endif + +#ifndef TRACE_ERR +#define TRACE_ERR(format...) +#endif + +/* Comments copied from common: + * This file contains four functions: + * + * ADIOI_Calc_aggregator() + * ADIOI_Calc_file_domains() + * ADIOI_Calc_my_req() + * ADIOI_Calc_others_req() + * + * The last three of these were originally in ad_read_coll.c, but they are + * also shared with ad_write_coll.c. I felt that they were better kept with + * the rest of the shared aggregation code. + */ + +/* Discussion of values available from above: + * + * ADIO_Offset st_offsets[0..nprocs-1] + * ADIO_Offset end_offsets[0..nprocs-1] + * These contain a list of start and end offsets for each process in + * the communicator. For example, an access at loc 10, size 10 would + * have a start offset of 10 and end offset of 19. + * int nprocs + * number of processors in the collective I/O communicator + * ADIO_Offset min_st_offset + * ADIO_Offset fd_start[0..nprocs_for_coll-1] + * starting location of "file domain"; region that a given process will + * perform aggregation for (i.e. actually do I/O) + * ADIO_Offset fd_end[0..nprocs_for_coll-1] + * start + size - 1 roughly, but it can be less, or 0, in the case of + * uneven distributions + */ + +/* Description from common/ad_aggregate.c. (Does it completely apply to bg?) + * ADIOI_Calc_aggregator() + * + * The intention here is to implement a function which provides basically + * the same functionality as in Rajeev's original version of + * ADIOI_Calc_my_req(). He used a ceiling division approach to assign the + * file domains, and we use the same approach here when calculating the + * location of an offset/len in a specific file domain. Further we assume + * this same distribution when calculating the rank_index, which is later + * used to map to a specific process rank in charge of the file domain. + * + * A better (i.e. more general) approach would be to use the list of file + * domains only. This would be slower in the case where the + * original ceiling division was used, but it would allow for arbitrary + * distributions of regions to aggregators. We'd need to know the + * nprocs_for_coll in that case though, which we don't have now. + * + * Note a significant difference between this function and Rajeev's old code: + * this code doesn't necessarily return a rank in the range + * 0..nprocs_for_coll; instead you get something in 0..nprocs. This is a + * result of the rank mapping; any set of ranks in the communicator could be + * used now. + * + * Returns an integer representing a rank in the collective I/O communicator. + * + * The "len" parameter is also modified to indicate the amount of data + * actually available in this file domain. + */ +/* + * This is more general aggregator search function which does not base on the assumption + * that each aggregator hosts the file domain with the same size + */ +int ADIOI_GPFS_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset * len, + ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end) +{ + int rank_index, rank; + ADIO_Offset avail_bytes; + TRACE_ERR("Entering ADIOI_GPFS_Calc_aggregator\n"); + + ADIOI_Assert((off <= fd_end[fd->hints->cb_nodes - 1] && off >= min_off && + fd_start[0] >= min_off)); + + /* binary search --> rank_index is returned */ + int ub = fd->hints->cb_nodes; + int lb = 0; + /* get an index into our array of aggregators */ + /* Common code for striping - bg doesn't use it but it's + * here to make diff'ing easier. + * rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); + * + * if (fd->hints->striping_unit > 0) { + * * wkliao: implementation for file domain alignment + * fd_start[] and fd_end[] have been aligned with file lock + * boundaries when returned from ADIOI_Calc_file_domains() so cannot + * just use simple arithmatic as above * + * rank_index = 0; + * while (off > fd_end[rank_index]) rank_index++; + * } + * bg does it's own striping below + */ + rank_index = fd->hints->cb_nodes / 2; + while (off < fd_start[rank_index] || off > fd_end[rank_index]) { + if (off > fd_end[rank_index]) { + lb = rank_index; + rank_index = (rank_index + ub) / 2; + } else if (off < fd_start[rank_index]) { + ub = rank_index; + rank_index = (rank_index + lb) / 2; + } + } + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort */ + if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { + FPRINTF(stderr, + "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", + rank_index, fd->hints->cb_nodes, (long long) fd_size, (long long) off); + MPI_Abort(MPI_COMM_WORLD, 1); + } + /* DBG_FPRINTF ("ADIOI_GPFS_Calc_aggregator: rank_index = %d\n", + * rank_index); */ + + /* + * remember here that even in Rajeev's original code it was the case that + * different aggregators could end up with different amounts of data to + * aggregate. here we use fd_end[] to make sure that we know how much + * data this aggregator is working with. + * + * the +1 is to take into account the end vs. length issue. + */ + avail_bytes = fd_end[rank_index] + 1 - off; + if (avail_bytes < *len && avail_bytes > 0) { + /* this file domain only has part of the requested contig. region */ + + *len = avail_bytes; + } + + /* map our index to a rank */ + /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ + rank = fd->hints->ranklist[rank_index]; + TRACE_ERR("Leaving ADIOI_GPFS_Calc_aggregator\n"); + + return rank; +} + +/* + * Compute a dynamic access range based file domain partition among I/O aggregators, + * which align to the GPFS block size + * Divide the I/O workload among "nprocs_for_coll" processes. This is + * done by (logically) dividing the file into file domains (FDs); each + * process may directly access only its own file domain. + * Additional effort is to make sure that each I/O aggregator get + * a file domain that aligns to the GPFS block size. So, there will + * not be any false sharing of GPFS file blocks among multiple I/O nodes. + * + * The common version of this now accepts a min_fd_size and striping_unit. + * It doesn't seem necessary here (using GPFS block sizes) but keep it in mind + * (e.g. we could pass striping unit instead of using fs_ptr->blksize). + */ +void ADIOI_GPFS_Calc_file_domains(ADIO_File fd, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + int nprocs, + int nprocs_for_coll, + ADIO_Offset * min_st_offset_ptr, + ADIO_Offset ** fd_start_ptr, + ADIO_Offset ** fd_end_ptr, + ADIO_Offset * fd_size_ptr, void *fs_ptr) +{ + ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, *fd_size; + int i, aggr; + TRACE_ERR("Entering ADIOI_GPFS_Calc_file_domains\n"); + blksize_t blksize; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5004, 0, NULL); +#endif + +#if AGG_DEBUG + static char myname[] = "ADIOI_GPFS_Calc_file_domains"; + DBG_FPRINTF(stderr, "%s(%d): %d aggregator(s)\n", myname, __LINE__, nprocs_for_coll); +#endif + if (fd->blksize <= 0) + /* default to 1M if blksize unset */ + fd->blksize = 1048576; + blksize = fd->blksize; + +#if AGG_DEBUG + DBG_FPRINTF(stderr, "%s(%d): Blocksize=%ld\n", myname, __LINE__, blksize); +#endif +/* find min of start offsets and max of end offsets of all processes */ + min_st_offset = st_offsets[0]; + max_end_offset = end_offsets[0]; + for (i = 1; i < nprocs; i++) { + min_st_offset = MPL_MIN(min_st_offset, st_offsets[i]); + max_end_offset = MPL_MAX(max_end_offset, end_offsets[i]); + } + + /* DBG_FPRINTF(stderr, "_calc_file_domains, min_st_offset, max_ + * = %qd, %qd\n", min_st_offset, max_end_offset); */ + + /* determine the "file domain (FD)" of each process, i.e., the portion of + * the file that will be "owned" by each process */ + + ADIO_Offset gpfs_ub = (max_end_offset + blksize - 1) / blksize * blksize - 1; + ADIO_Offset gpfs_lb = min_st_offset / blksize * blksize; + ADIO_Offset gpfs_ub_rdoff = + (max_end_offset + blksize - 1) / blksize * blksize - 1 - max_end_offset; + ADIO_Offset gpfs_lb_rdoff = min_st_offset - min_st_offset / blksize * blksize; + ADIO_Offset fd_gpfs_range = gpfs_ub - gpfs_lb + 1; + + int naggs = nprocs_for_coll; + + /* Tweak the file domains so that no fd is smaller than a threshold. We + * have to strike a balance between efficency and parallelism: somewhere + * between 10k processes sending 32-byte requests and one process sending a + * 320k request is a (system-dependent) sweet spot + + This is from the common code - the new min_fd_size parm that we didn't implement. + (And common code uses a different declaration of fd_size so beware) + + if (fd_size < min_fd_size) + fd_size = min_fd_size; + */ + fd_size = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * sizeof(ADIO_Offset)); + *fd_start_ptr = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * 2 * sizeof(ADIO_Offset)); + *fd_end_ptr = *fd_start_ptr + nprocs_for_coll; + fd_start = *fd_start_ptr; + fd_end = *fd_end_ptr; + + /* each process will have a file domain of some number of gpfs blocks, but + * the division of blocks is not likely to be even. Some file domains will + * be "large" and others "small" + * + * Example: consider 17 blocks distributed over 3 aggregators. + * nb_cn_small = 17/3 = 5 + * naggs_large = 17 - 3*(17/3) = 17 - 15 = 2 + * naggs_small = 3 - 2 = 1 + * + * and you end up with file domains of {5-blocks, 6-blocks, 6-blocks} + * + * what about (relatively) small files? say, a file of 1000 blocks + * distributed over 2064 aggregators: + * nb_cn_small = 1000/2064 = 0 + * naggs_large = 1000 - 2064*(1000/2064) = 1000 + * naggs_small = 2064 - 1000 = 1064 + * and you end up with domains of {0, 0, 0, ... 1, 1, 1 ...} + * + * it might be a good idea instead of having all the zeros up front, to + * "mix" those zeros into the fd_size array. that way, no pset/bridge-set + * is left with zero work. In fact, even if the small file domains aren't + * zero, it's probably still a good idea to mix the "small" file domains + * across the fd_size array to keep the io nodes in balance */ + + + ADIO_Offset n_gpfs_blk = fd_gpfs_range / blksize; + ADIO_Offset nb_cn_small = n_gpfs_blk / naggs; + ADIO_Offset naggs_large = n_gpfs_blk - naggs * (n_gpfs_blk / naggs); + ADIO_Offset naggs_small = naggs - naggs_large; + +#ifdef BGQPLATFORM + if (gpfsmpio_balancecontig == 1) { + /* File domains blocks are assigned to aggregators in a breadth-first + * fashion relative to the ions - additionally, file domains on the + * aggregators sharing the same bridgeset and ion have contiguous + * offsets. */ + + // initialize everything to small + for (i = 0; i < naggs; i++) + fd_size[i] = nb_cn_small * blksize; + + // go thru and distribute the large across the bridges + + /* bridelistoffset: agg rank list offsets using the bridgelist - each + * entry is created by adding up the indexes for the aggs from all + * previous bridges */ + int *bridgelistoffset = + (int *) ADIOI_Malloc(fd->hints->fs_hints.bg.numbridges * sizeof(int)); + /* tmpbridgelistnum: copy of the bridgelistnum whose entries can be + * decremented to keep track of bridge assignments during the actual + * large block assignments to the agg rank list*/ + int *tmpbridgelistnum = + (int *) ADIOI_Malloc(fd->hints->fs_hints.bg.numbridges * sizeof(int)); + + int j; + for (j = 0; j < fd->hints->fs_hints.bg.numbridges; j++) { + int k, bridgerankoffset = 0; + for (k = 0; k < j; k++) { + bridgerankoffset += fd->hints->fs_hints.bg.bridgelistnum[k]; + } + bridgelistoffset[j] = bridgerankoffset; + } + + for (j = 0; j < fd->hints->fs_hints.bg.numbridges; j++) + tmpbridgelistnum[j] = fd->hints->fs_hints.bg.bridgelistnum[j]; + int bridgeiter = 0; + + /* distribute the large blocks across the aggs going breadth-first + * across the bridgelist - this distributes the fd sizes across the + * ions, so later in the file domain assignment when it iterates thru + * the ranklist the offsets will be contiguous within the bridge and + * ion as well */ + for (j = 0; j < naggs_large; j++) { + int foundbridge = 0; + int numbridgelistpasses = 0; + while (!foundbridge) { + if (tmpbridgelistnum[bridgeiter] > 0) { + foundbridge = 1; + /* + * printf("bridgeiter is %d tmpbridgelistnum[bridgeiter] is %d bridgelistoffset[bridgeiter] is %d\n",bridgeiter,tmpbridgelistnum[bridgeiter],bridgelistoffset[bridgeiter]); + * printf("naggs is %d bridgeiter is %d bridgelistoffset[bridgeiter] is %d tmpbridgelistnum[bridgeiter] is %d\n",naggs, bridgeiter,bridgelistoffset[bridgeiter],tmpbridgelistnum[bridgeiter]); + * printf("naggs is %d bridgeiter is %d setting fd_size[%d]\n",naggs, bridgeiter,bridgelistoffset[bridgeiter]+(fd->hints->bridgelistnum[bridgeiter]-tmpbridgelistnum[bridgeiter])); + */ + int currentbridgelistnum = + (fd->hints->fs_hints.bg.bridgelistnum[bridgeiter] - + tmpbridgelistnum[bridgeiter]); + int currentfdsizeindex = bridgelistoffset[bridgeiter] + currentbridgelistnum; + fd_size[currentfdsizeindex] = (nb_cn_small + 1) * blksize; + tmpbridgelistnum[bridgeiter]--; + } + if (bridgeiter == (fd->hints->fs_hints.bg.numbridges - 1)) { + /* guard against infinite loop - should only ever make 1 pass + * thru bridgelist */ + ADIOI_Assert(numbridgelistpasses == 0); + numbridgelistpasses++; + bridgeiter = 0; + } else + bridgeiter++; + } + } + ADIOI_Free(tmpbridgelistnum); + ADIOI_Free(bridgelistoffset); + + } else { + /* BG/L- and BG/P-style distribution of file domains: simple allocation of + * file domins to each aggregator */ + for (i = 0; i < naggs; i++) { + if (i < naggs_large) { + fd_size[i] = (nb_cn_small + 1) * blksize; + } else { + fd_size[i] = nb_cn_small * blksize; + } + } + } +#ifdef balancecontigtrace + int myrank; + MPI_Comm_rank(fd->comm, &myrank); + if (myrank == 0) { + fprintf(stderr, "naggs_small is %d nb_cn_small is %d\n", naggs_small, nb_cn_small); + for (i = 0; i < naggs; i++) { + fprintf(stderr, "fd_size[%d] set to %d agg rank is %d\n", i, fd_size[i], + fd->hints->ranklist[i]); + } + } +#endif + +#else // not BGQ platform + for (i = 0; i < naggs; i++) { + if (i < naggs_large) { + fd_size[i] = (nb_cn_small + 1) * blksize; + } else { + fd_size[i] = nb_cn_small * blksize; + } + } + +#endif + + +#if AGG_DEBUG + DBG_FPRINTF(stderr, "%s(%d): " + "gpfs_ub %llu, " + "gpfs_lb %llu, " + "gpfs_ub_rdoff %llu, " + "gpfs_lb_rdoff %llu, " + "fd_gpfs_range %llu, " + "n_gpfs_blk %llu, " + "nb_cn_small %llu, " + "naggs_large %llu, " + "naggs_small %llu, " + "\n", + myname, __LINE__, + gpfs_ub, + gpfs_lb, + gpfs_ub_rdoff, + gpfs_lb_rdoff, fd_gpfs_range, n_gpfs_blk, nb_cn_small, naggs_large, naggs_small); +#endif + + fd_size[0] -= gpfs_lb_rdoff; + fd_size[naggs - 1] -= gpfs_ub_rdoff; + + /* compute the file domain for each aggr */ + ADIO_Offset offset = min_st_offset; + for (aggr = 0; aggr < naggs; aggr++) { + fd_start[aggr] = offset; + fd_end[aggr] = offset + fd_size[aggr] - 1; + offset += fd_size[aggr]; + } + + *fd_size_ptr = fd_size[0]; + *min_st_offset_ptr = min_st_offset; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5005, 0, NULL); +#endif + ADIOI_Free(fd_size); + TRACE_ERR("Leaving ADIOI_GPFS_Calc_file_domains\n"); +} + +/* + * ADIOI_GPFS_Calc_my_req() overrides ADIOI_Calc_my_req for the default implementation + * is specific for static file domain partitioning. + * + * ADIOI_Calc_my_req() - calculate what portions of the access requests + * of this process are located in the file domains of various processes + * (including this one) + */ +void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * len_list, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr) +/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets? + They are used as memory buffer indices so it seems like the 2G limit is in effect */ +{ + int *count_my_req_per_proc, count_my_req_procs; + MPI_Aint *buf_idx; + int i, l, proc; + ADIO_Offset fd_len, rem_len, curr_idx, off; + ADIOI_Access *my_req; + TRACE_ERR("Entering ADIOI_GPFS_Calc_my_req\n"); + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5024, 0, NULL); +#endif + *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + count_my_req_per_proc = *count_my_req_per_proc_ptr; +/* count_my_req_per_proc[i] gives the no. of contig. requests of this + process in process i's file domain. calloc initializes to zero. + I'm allocating memory of size nprocs, so that I can do an + MPI_Alltoall later on.*/ + + buf_idx = (MPI_Aint *) ADIOI_Malloc(nprocs * sizeof(MPI_Aint)); +/* buf_idx is relevant only if buftype_is_contig. + buf_idx[i] gives the index into user_buf where data received + from proc. i should be placed. This allows receives to be done + without extra buffer. This can't be done if buftype is not contig. */ + + /* initialize buf_idx to -1 */ + for (i = 0; i < nprocs; i++) + buf_idx[i] = -1; + + /* one pass just to calculate how much space to allocate for my_req; + * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() + */ + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + fd_len = len_list[i]; + /* note: we set fd_len to be the total size of the access. then + * ADIOI_Calc_aggregator() will modify the value to return the + * amount that was available from the file domain that holds the + * first part of the access. + */ + /* BES */ + proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, + fd_start, fd_end); + count_my_req_per_proc[proc]++; + + /* figure out how much data is remaining in the access (i.e. wasn't + * part of the file domain that had the starting byte); we'll take + * care of this data (if there is any) in the while loop below. + */ + rem_len = len_list[i] - fd_len; + + while (rem_len > 0) { + off += fd_len; /* point to first remaining byte */ + fd_len = rem_len; /* save remaining size, pass to calc */ + proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + count_my_req_per_proc[proc]++; + rem_len -= fd_len; /* reduce remaining length by amount from fd */ + } + } + +/* now allocate space for my_req, offset, and len */ + + *my_req_ptr = (ADIOI_Access *) + ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + my_req = *my_req_ptr; + + count_my_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i]) { + my_req[i].offsets = (ADIO_Offset *) + ADIOI_Malloc(count_my_req_per_proc[i] * 2 * sizeof(ADIO_Offset)); + my_req[i].lens = my_req[i].offsets + count_my_req_per_proc[i]; + count_my_req_procs++; + } + my_req[i].count = 0; /* will be incremented where needed + * later */ + } + +/* now fill in my_req */ + curr_idx = 0; + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + fd_len = len_list[i]; + proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, + fd_start, fd_end); + + /* for each separate contiguous access from this process */ + if (buf_idx[proc] == -1) { + ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx); + buf_idx[proc] = (MPI_Aint) curr_idx; + } + + l = my_req[proc].count; + curr_idx += fd_len; + + rem_len = len_list[i] - fd_len; + + /* store the proc, offset, and len information in an array + * of structures, my_req. Each structure contains the + * offsets and lengths located in that process's FD, + * and the associated count. + */ + my_req[proc].offsets[l] = off; + my_req[proc].lens[l] = fd_len; + my_req[proc].count++; + + while (rem_len > 0) { + off += fd_len; + fd_len = rem_len; + proc = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + if (buf_idx[proc] == -1) { + ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx); + buf_idx[proc] = (MPI_Aint) curr_idx; + } + + l = my_req[proc].count; + curr_idx += fd_len; + rem_len -= fd_len; + + my_req[proc].offsets[l] = off; + my_req[proc].lens[l] = fd_len; + my_req[proc].count++; + } + } + + + +#ifdef AGG_DEBUG + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i] > 0) { + DBG_FPRINTF(stderr, "data needed from %d (count = %d):\n", i, my_req[i].count); + for (l = 0; l < my_req[i].count; l++) { + DBG_FPRINTF(stderr, " off[%d] = %lld, len[%d] = %lld\n", l, + (long long) my_req[i].offsets[l], l, (long long) my_req[i].lens[l]); + } + } + DBG_FPRINTF(stderr, "buf_idx[%d] = 0x%x\n", i, buf_idx[i]); + } +#endif + + *count_my_req_procs_ptr = count_my_req_procs; + *buf_idx_ptr = buf_idx; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5025, 0, NULL); +#endif + TRACE_ERR("Leaving ADIOI_GPFS_Calc_my_req\n"); +} + +/* + * ADIOI_Calc_others_req (copied to bg and switched to all to all for performance) + * + * param[in] count_my_req_procs Number of processes whose file domain my + * request touches. + * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of + * contig. requests of this process in + * process i's file domain. + * param[in] my_req A structure defining my request + * param[in] nprocs Number of nodes in the block + * param[in] myrank Rank of this node + * param[out] count_others_req_proc_ptr Number of processes whose requests lie in + * my process's file domain (including my + * process itself) + * param[out] others_req_ptr Array of other process' requests that lie + * in my process's file domain + */ +void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access * my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, ADIOI_Access ** others_req_ptr) +{ + TRACE_ERR("Entering ADIOI_GPFS_Calc_others_req\n"); +/* determine what requests of other processes lie in this process's + file domain */ + +/* count_others_req_procs = number of processes whose requests lie in + this process's file domain (including this process itself) + count_others_req_per_proc[i] indicates how many separate contiguous + requests of proc. i lie in this process's file domain. */ + + int *count_others_req_per_proc, count_others_req_procs; + int i; + ADIOI_Access *others_req; + + /* Parameters for MPI_Alltoallv */ + int *scounts, *sdispls, *rcounts, *rdispls; + + /* Parameters for MPI_Alltoallv. These are the buffers, which + * are later computed to be the lowest address of all buffers + * to be sent/received for offsets and lengths. Initialize to + * the highest possible address which is the current minimum. + */ + void *sendBuf = (void *) 0xFFFFFFFFFFFFFFFF, *recvBuf = (void *) 0xFFFFFFFFFFFFFFFF; + +/* first find out how much to send/recv and from/to whom */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5026, 0, NULL); +#endif + /* Send 1 int to each process. count_my_req_per_proc[i] is the number of + * requests that my process will do to the file domain owned by process[i]. + * Receive 1 int from each process. count_others_req_per_proc[i] is the number of + * requests that process[i] will do to the file domain owned by my process. + */ + count_others_req_per_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); +/* cora2a1=timebase(); */ +/*for(i=0;i<nprocs;i++) ?*/ + MPI_Alltoall(count_my_req_per_proc, 1, MPI_INT, + count_others_req_per_proc, 1, MPI_INT, fd->comm); + +/* total_cora2a+=timebase()-cora2a1; */ + + /* Allocate storage for an array of other nodes' accesses of our + * node's file domain. Also allocate storage for the alltoallv + * parameters. + */ + *others_req_ptr = (ADIOI_Access *) + ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + others_req = *others_req_ptr; + + scounts = ADIOI_Malloc(nprocs * sizeof(int)); + sdispls = ADIOI_Malloc(nprocs * sizeof(int)); + rcounts = ADIOI_Malloc(nprocs * sizeof(int)); + rdispls = ADIOI_Malloc(nprocs * sizeof(int)); + + /* If process[i] has any requests in my file domain, + * initialize an ADIOI_Access structure that will describe each request + * from process[i]. The offsets, lengths, and buffer pointers still need + * to be obtained to complete the setting of this structure. + */ + count_others_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_others_req_per_proc[i]) { + others_req[i].count = count_others_req_per_proc[i]; + + others_req[i].offsets = (ADIO_Offset *) + ADIOI_Malloc(count_others_req_per_proc[i] * 2 * sizeof(ADIO_Offset)); + others_req[i].lens = others_req[i].offsets + count_others_req_per_proc[i]; + + if ((uintptr_t) others_req[i].offsets < (uintptr_t) recvBuf) + recvBuf = others_req[i].offsets; + + others_req[i].mem_ptrs = (MPI_Aint *) + ADIOI_Malloc(count_others_req_per_proc[i] * sizeof(MPI_Aint)); + + count_others_req_procs++; + } else { + others_req[i].count = 0; + others_req[i].offsets = NULL; + others_req[i].mem_ptrs = NULL; + others_req[i].lens = NULL; + } + } + /* If no recv buffer was allocated in the loop above, make it NULL */ + if (recvBuf == (void *) 0xFFFFFFFFFFFFFFFF) + recvBuf = NULL; + + /* Now send the calculated offsets and lengths to respective processes */ + + /************************/ + /* Exchange the offsets */ + /************************/ + + /* Determine the lowest sendBuf */ + for (i = 0; i < nprocs; i++) { + if ((my_req[i].count) && ((uintptr_t) my_req[i].offsets <= (uintptr_t) sendBuf)) { + sendBuf = my_req[i].offsets; + } + /* my_req[i].offsets and my_req[i].lens have been malloc-ed together */ + } + + /* If no send buffer was found in the loop above, make it NULL */ + if (sendBuf == (void *) 0xFFFFFFFFFFFFFFFF) + sendBuf = NULL; + + /* Calculate the displacements from the sendBuf */ + for (i = 0; i < nprocs; i++) { + /* Send these offsets and lengths to process i. */ + scounts[i] = count_my_req_per_proc[i] * 2; + if (scounts[i] == 0) + sdispls[i] = 0; + else + sdispls[i] = (int) + (((uintptr_t) my_req[i].offsets - + (uintptr_t) sendBuf) / (uintptr_t) sizeof(ADIO_Offset)); + + /* Receive these offsets and lengths from process i. */ + rcounts[i] = count_others_req_per_proc[i] * 2; + if (rcounts[i] == 0) + rdispls[i] = 0; + else + rdispls[i] = (int) + (((uintptr_t) others_req[i].offsets - + (uintptr_t) recvBuf) / (uintptr_t) sizeof(ADIO_Offset)); + } + + /* Exchange the offsets and lengths */ + MPI_Alltoallv(sendBuf, scounts, sdispls, ADIO_OFFSET, + recvBuf, rcounts, rdispls, ADIO_OFFSET, fd->comm); + + /* Clean up */ + ADIOI_Free(count_others_req_per_proc); + ADIOI_Free(scounts); + ADIOI_Free(sdispls); + ADIOI_Free(rcounts); + ADIOI_Free(rdispls); + + *count_others_req_procs_ptr = count_others_req_procs; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5027, 0, NULL); +#endif + TRACE_ERR("Leaving ADIOI_GPFS_Calc_others_req\n"); +} diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.h b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.h new file mode 100644 index 0000000000000000000000000000000000000000..234e5c5b1d80a092b213ef3d76954b61d226dd32 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_aggrs.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_aggrs.h + * \brief ??? + */ + +/* + * File: ad_gpfs_aggrs.h + * + * Declares functions optimized specifically for GPFS parallel I/O solution. + * + */ + +#ifndef AD_GPFS_AGGRS_H_INCLUDED +#define AD_GPFS_AGGRS_H_INCLUDED + +#include "adio.h" +#include <sys/stat.h> + +#ifdef HAVE_GPFS_H +#include <gpfs.h> +#endif + + + /* overriding ADIOI_Calc_file_domains() to apply 'aligned file domain partitioning'. */ +void ADIOI_GPFS_Calc_file_domains(ADIO_File fd, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + int nprocs, + int nprocs_for_coll, + ADIO_Offset * min_st_offset_ptr, + ADIO_Offset ** fd_start_ptr, + ADIO_Offset ** fd_end_ptr, + ADIO_Offset * fd_size_ptr, void *fs_ptr); + + /* overriding ADIOI_Calc_aggregator() for the default implementation is specific for + * static file domain partitioning */ +int ADIOI_GPFS_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset * len, + ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end); + + /* overriding ADIOI_Calc_my_req for the default implementation is specific for + * static file domain partitioning */ +void ADIOI_GPFS_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * len_list, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr); + + /* + * ADIOI_Calc_others_req + * + * param[in] count_my_req_procs Number of processes whose file domain my + * request touches. + * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of + * contig. requests of this process in + * process i's file domain. + * param[in] my_req A structure defining my request + * param[in] nprocs Number of nodes in the block + * param[in] myrank Rank of this node + * param[out] count_others_req_proc_ptr Number of processes whose requests lie in + * my process's file domain (including my + * process itself) + * param[out] others_req_ptr Array of other process' requests that lie + * in my process's file domain + */ +void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access * my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, ADIOI_Access ** others_req_ptr); + + +#endif /* AD_GPFS_AGGRS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_close.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_close.c new file mode 100644 index 0000000000000000000000000000000000000000..f96112ed7802613d9dfe1fcf024547d4a12e5bdd --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_close.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_close.c + * \brief ??? + */ + +#include "ad_gpfs.h" +#include "ad_gpfs_tuning.h" +#include <unistd.h> + +void ADIOI_GPFS_Close(ADIO_File fd, int *error_code) +{ + int err, derr = 0; + static char myname[] = "ADIOI_GPFS_CLOSE"; + +#ifdef PROFILE + MPE_Log_event(9, 0, "start close"); +#endif + + if (fd->null_fd >= 0) + close(fd->null_fd); + + err = close(fd->fd_sys); + if (fd->fd_direct >= 0) { + derr = close(fd->fd_direct); + } +#ifdef PROFILE + MPE_Log_event(10, 0, "end close"); +#endif + +/* FPRINTF(stderr,"%s(%d):'%s'. Free %#X\n",myname,__LINE__,fd->filename,(int)fd->fs_ptr);*/ + if (fd->fs_ptr != NULL) { + ADIOI_Free(fd->fs_ptr); + fd->fs_ptr = NULL; + } + fd->fd_sys = -1; + fd->fd_direct = -1; + + if (err == -1 || derr == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_flush.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_flush.c similarity index 50% rename from 3rd-party/romio321/adio/ad_gpfs/ad_gpfs_flush.c rename to 3rd-party/romio341/adio/ad_gpfs/ad_gpfs_flush.c index 555002f639d14fa40db36671e2dce2123310a839..02dde79515e8322f23c9d581a9fc4f33e50f1b7e 100644 --- a/3rd-party/romio321/adio/ad_gpfs/ad_gpfs_flush.c +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_flush.c @@ -1,23 +1,18 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + /** * \file ad_gpfs_flush.c * \brief Scalable flush for GPFS */ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - #include "ad_gpfs.h" void ADIOI_GPFS_Flush(ADIO_File fd, int *error_code) { - int err=0; + int err = 0; static char myname[] = "ADIOI_GPFS_FLUSH"; int rank; @@ -36,33 +31,31 @@ void ADIOI_GPFS_Flush(ADIO_File fd, int *error_code) MPI_Barrier(fd->comm); if (rank == fd->hints->ranklist[0]) { - err = fsync(fd->fd_sys); - DBG_FPRINTF(stderr,"aggregation:fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); - /* We want errno, not the return code if it failed */ - if (err == -1) err = errno; - else err = 0; + err = fsync(fd->fd_sys); + DBG_FPRINTF(stderr, "aggregation:fsync %s, err=%#X, errno=%#X\n", fd->filename, err, errno); + /* We want errno, not the return code if it failed */ + if (err == -1) + err = errno; + else + err = 0; } MPI_Bcast(&err, 1, MPI_UNSIGNED, fd->hints->ranklist[0], fd->comm); - DBGV_FPRINTF(stderr,"aggregation result:fsync %s, errno %#X,\n",fd->filename, err); + DBGV_FPRINTF(stderr, "aggregation result:fsync %s, errno %#X,\n", fd->filename, err); - if (err) /* if it's non-zero, it must be an errno */ - { - errno = err; - err = -1; + if (err) { /* if it's non-zero, it must be an errno */ + errno = err; + err = -1; } /* --BEGIN ERROR HANDLING-- */ - if (err == -1) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", - "**io %s", strerror(errno)); - DBGT_FPRINTF(stderr,"fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); - return; + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + DBGT_FPRINTF(stderr, "fsync %s, err=%#X, errno=%#X\n", fd->filename, err, errno); + return; } /* --END ERROR HANDLING-- */ *error_code = MPI_SUCCESS; } - diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_hints.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..4b41a680eb9767fb9f88b4d7eb92bf4c5de47718 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_hints.c @@ -0,0 +1,282 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_hints.c + * \brief GPFS hint processing - for now, only used for BlueGene and PE platforms + */ + +#include "adio.h" +#include "adio_extern.h" +#include "hint_fns.h" + +#include "ad_gpfs.h" + +#define ADIOI_GPFS_CB_BUFFER_SIZE_DFLT "16777216" +#define ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT "4194304" +#define ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT "4194304" + +#ifdef BGQPLATFORM +#define ADIOI_BG_NAGG_IN_PSET_HINT_NAME "bg_nodes_pset" +#endif + +/** \page mpiio_vars MPIIO Configuration + * + * GPFS MPIIO configuration and performance tuning. Used by ad_gpfs ADIO. + * + * Used for BlueGene and PE platforms, which each have their own aggregator selection + * algorithms that ignore user provided cb_config_list. + * + * \section hint_sec Hints + * - bg_nodes_pset - BlueGene only - specify how many aggregators to use per pset. + * This hint will override the cb_nodes hint based on BlueGene psets. + * - N - Use N nodes per pset as aggregators. + * - Default is based on partition configuration and cb_nodes. + * + * The following default key/value pairs may differ from other platform defaults. + * + * - key = cb_buffer_size value = 16777216 + * - key = romio_cb_read value = enable + * - key = romio_cb_write value = enable + * - key = ind_rd_buffer_size value = 4194304 + * - key = ind_wr_buffer_size value = 4194304 + */ + +#ifdef BGQPLATFORM +/* Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. */ +extern int ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_proxy_per_pset); +#elif PEPLATFORM +extern int ADIOI_PE_gen_agg_ranklist(ADIO_File fd); +#endif + +void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ +/* if fd->info is null, create a new info object. + Initialize fd->info to default values. + Initialize fd->hints to default values. + Examine the info object passed by the user. If it contains values that + ROMIO understands, override the default. */ + + MPI_Info info; + char *value; + int flag, intval, nprocs = 0, nprocs_is_valid = 0; + static char myname[] = "ADIOI_GPFS_SETINFO"; + + int did_anything = 0; + + if (fd->info == MPI_INFO_NULL) + MPI_Info_create(&(fd->info)); + info = fd->info; + + /* Note that fd->hints is allocated at file open time; thus it is + * not necessary to allocate it, or check for allocation, here. + */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Assert((value != NULL)); + + /* initialize info and hints to default values if they haven't been + * previously initialized + */ + if (!fd->hints->initialized) { + + ad_get_env_vars(); + ad_gpfs_get_env_vars(); + did_anything = 1; + + /* buffer size for collective I/O */ + ADIOI_Info_set(info, "cb_buffer_size", ADIOI_GPFS_CB_BUFFER_SIZE_DFLT); + fd->hints->cb_buffer_size = atoi(ADIOI_GPFS_CB_BUFFER_SIZE_DFLT); + + /* default is to let romio automatically decide when to use + * collective buffering + */ + ADIOI_Info_set(info, "romio_cb_read", "enable"); + fd->hints->cb_read = ADIOI_HINT_ENABLE; + ADIOI_Info_set(info, "romio_cb_write", "enable"); + fd->hints->cb_write = ADIOI_HINT_ENABLE; + + if (fd->hints->cb_config_list != NULL) + ADIOI_Free(fd->hints->cb_config_list); + fd->hints->cb_config_list = NULL; + + /* number of processes that perform I/O in collective I/O */ + MPI_Comm_size(fd->comm, &nprocs); + nprocs_is_valid = 1; + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", nprocs); + ADIOI_Info_set(info, "cb_nodes", value); + fd->hints->cb_nodes = -1; + + /* hint indicating that no indep. I/O will be performed on this file */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + + /* gpfs is not implementing file realms (ADIOI_IOStridedColl), + * initialize to disabled it. */ + /* hint instructing the use of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_pfr", "disable"); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + + /* hint guiding the assignment of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); + fd->hints->cb_fr_type = ADIOI_FR_AAR; + + /* hint to align file realms with a certain byte value */ + ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); + fd->hints->cb_fr_alignment = 1; + + /* hint to set a threshold percentage for a datatype's size/extent at + * which data sieving should be done in collective I/O */ + ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); + fd->hints->cb_ds_threshold = 0; + + /* hint to switch between point-to-point or all-to-all for two-phase */ + ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); + fd->hints->cb_alltoall = ADIOI_HINT_AUTO; + + /* deferred_open derived from no_indep_rw and cb_{read,write} */ + fd->hints->deferred_open = 0; + + /* buffer size for data sieving in independent reads */ + ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT); + fd->hints->ind_rd_buffer_size = atoi(ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT); + + /* buffer size for data sieving in independent writes */ + ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT); + fd->hints->ind_wr_buffer_size = atoi(ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT); + + + ADIOI_Info_set(info, "romio_ds_read", "automatic"); + fd->hints->ds_read = ADIOI_HINT_AUTO; + ADIOI_Info_set(info, "romio_ds_write", "automatic"); + fd->hints->ds_write = ADIOI_HINT_AUTO; + + /* still to do: tune this a bit for a variety of file systems. there's + * no good default value so just leave it unset */ + fd->hints->min_fdomain_size = 0; + fd->hints->striping_unit = 0; + + fd->hints->initialized = 1; + } + + /* add in user's info if supplied */ + if (users_info != MPI_INFO_NULL) { + ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", + &(fd->hints->cb_buffer_size), myname, error_code); + /* new hints for enabling/disabling coll. buffering on + * reads/writes + */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read", + &(fd->hints->cb_read), myname, error_code); + if (fd->hints->cb_read == ADIOI_HINT_DISABLE) { + /* romio_cb_read overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write", + &(fd->hints->cb_write), myname, error_code); + if (fd->hints->cb_write == ADIOI_HINT_DISABLE) { + /* romio_cb_write overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + /* Has the user indicated all I/O will be done collectively? */ + ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw", + &(fd->hints->no_indep_rw), myname, error_code); + if (fd->hints->no_indep_rw == 1) { + /* if 'no_indep_rw' set, also hint that we will do + * collective buffering: if we aren't doing independent io, + * then we have to do collective */ + ADIOI_Info_set(info, "romio_cb_write", "enable"); + ADIOI_Info_set(info, "romio_cb_read", "enable"); + fd->hints->cb_read = 1; + fd->hints->cb_write = 1; + } + + /* new hints for enabling/disabling data sieving on + * reads/writes + */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read", + &(fd->hints->ds_read), myname, error_code); + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write", + &(fd->hints->ds_write), myname, error_code); + + ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size", + &(fd->hints->ind_wr_buffer_size), myname, error_code); + ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size", + &(fd->hints->ind_rd_buffer_size), myname, error_code); + + memset(value, 0, MPI_MAX_INFO_VAL + 1); + ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL, value, &flag); + if (flag && ((intval = atoi(value)) > 0)) { + ADIOI_Info_set(info, "romio_min_fdomain_size", value); + fd->hints->min_fdomain_size = intval; + } + /* Now we use striping unit in common code so we should + * process hints for it. */ + ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", + &(fd->hints->striping_unit), myname, error_code); + +#ifdef BGQPLATFORM + memset(value, 0, MPI_MAX_INFO_VAL + 1); + ADIOI_Info_get(users_info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, MPI_MAX_INFO_VAL, value, &flag); + if (flag && ((intval = atoi(value)) > 0)) { + + did_anything = 1; + ADIOI_Info_set(info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, value); + fd->hints->cb_nodes = intval; + } +#endif + } + + /* special CB aggregator assignment */ + if (did_anything) { +#ifdef BGQPLATFORM + ADIOI_BG_gen_agg_ranklist(fd, fd->hints->cb_nodes); +#elif PEPLATFORM + ADIOI_PE_gen_agg_ranklist(fd); +#endif + } + + /* deferred_open won't be set by callers, but if the user doesn't + * explicitly disable collecitve buffering (two-phase) and does hint that + * io w/o independent io is going on, we'll set this internal hint as a + * convenience */ + if (((fd->hints->cb_read != ADIOI_HINT_DISABLE) + && (fd->hints->cb_write != ADIOI_HINT_DISABLE) + && fd->hints->no_indep_rw)) { + fd->hints->deferred_open = 1; + } else { + /* setting romio_no_indep_rw enable and romio_cb_{read,write} + * disable at the same time doesn't make sense. honor + * romio_cb_{read,write} and force the no_indep_rw hint to + * 'disable' */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + fd->hints->deferred_open = 0; + } + + /* BobC commented this out, but since hint processing runs on both bg and + * bglockless, we need to keep DS writes enabled on gpfs and disabled on + * PVFS */ + if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { + /* disable data sieving for fs that do not + * support file locking */ + ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + /* get rid of this value if it is set */ + ADIOI_Info_delete(info, "ind_wr_buffer_size"); + } + /* note: leave ind_wr_buffer_size alone; used for other cases + * as well. -- Rob Ross, 04/22/2003 + */ + ADIOI_Info_set(info, "romio_ds_write", "disable"); + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + + ADIOI_Free(value); + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_open.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_open.c new file mode 100644 index 0000000000000000000000000000000000000000..46bf0d478796e75296d1e38ee7ae081e53118e6c --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_open.c @@ -0,0 +1,145 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_open.c + * \brief ??? + */ + +#include "ad_gpfs.h" +#include "ad_gpfs_tuning.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> + + +#ifdef HAVE_GPFS_H +#include <gpfs.h> +#endif +#ifdef HAVE_GPFS_FCNTL_H +#include <gpfs_fcntl.h> +#endif + +#ifdef HAVE_GPFS_FCNTL_H +static void gpfs_free_all_locks(int fd) +{ + int rc; + struct { + gpfsFcntlHeader_t header; + gpfsFreeRange_t release; + } release_all; + + release_all.header.totalLength = sizeof(release_all); + release_all.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + release_all.header.fcntlReserved = 0; + + release_all.release.structLen = sizeof(release_all.release); + release_all.release.structType = GPFS_FREE_RANGE; + release_all.release.start = 0; + release_all.release.length = 0; + + rc = gpfs_fcntl(fd, &release_all); + if (rc != 0) { + DBGV_FPRINTF(stderr, "GPFS fcntl release failed with rc=%d, errno=%d\n", rc, errno); + } +} +#endif + + +void ADIOI_GPFS_Open(ADIO_File fd, int *error_code) +{ + int perm, old_mask, amode, rank, rc; + static char myname[] = "ADIOI_GPFS_OPEN"; + + /* set internal variables for tuning environment variables */ + ad_gpfs_get_env_vars(); + + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); +#endif + fd->fd_sys = open(fd->filename, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + DBG_FPRINTF(stderr, "open('%s',%#X,%#X) rc=%d, errno=%d\n", fd->filename, amode, perm, + fd->fd_sys, errno); + fd->fd_direct = -1; + + if (gpfsmpio_devnullio == 1) { + fd->null_fd = open("/dev/null", O_RDWR); + } else { + fd->null_fd = -1; + } + + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); + + if (fd->fd_sys != -1) { + + fd->blksize = 1048576; /* default to 1M */ + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_stat_a, 0, NULL); +#endif + /* in this fs-specific routine, we might not be called over entire + * communicator (deferred open). Collect statistics on one process. + * ADIOI_GEN_Opencoll (common-code caller) will take care of the + * broadcast */ + + MPI_Comm_rank(fd->comm, &rank); + if ((rank == fd->hints->ranklist[0]) || (fd->comm == MPI_COMM_SELF)) { + struct stat gpfs_statbuf; + /* Get the (real) underlying file system block size */ + rc = stat(fd->filename, &gpfs_statbuf); + if (rc >= 0) { + fd->blksize = gpfs_statbuf.st_blksize; + DBGV_FPRINTF(stderr, "Successful stat '%s'. Blocksize=%ld\n", + fd->filename, gpfs_statbuf.st_blksize); + } else { + DBGV_FPRINTF(stderr, "Stat '%s' failed with rc=%d, errno=%d\n", + fd->filename, rc, errno); + } + } + /* all other ranks have incorrect fd->blocksize, but ADIOI_GEN_Opencoll + * will take care of that in both standard and deferred-open case */ + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_stat_b, 0, NULL); +#endif + +#ifdef HAVE_GPFS_FCNTL_H + /* in parallel workload, might be helpful to immediately release block + * tokens. Or, system call overhead will outweigh any benefits... */ + if (getenv("ROMIO_GPFS_FREE_LOCKS") != NULL) + gpfs_free_all_locks(fd->fd_sys); + +#endif + } + + if (fd->fd_sys == -1) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_rdcoll.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_rdcoll.c new file mode 100644 index 0000000000000000000000000000000000000000..8135dc163c540392847ff76fd949a3149181bbc6 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_rdcoll.c @@ -0,0 +1,1231 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_rdcoll.c + * \brief ??? + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_gpfs.h" +#include "ad_gpfs_aggrs.h" + +#ifdef PROFILE +#include "mpe.h" +#endif + +#ifdef MPL_USE_DBG_LOGGING +#define RDCOLL_DEBUG 1 +#endif +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* prototypes of functions used for collective reads only. */ +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code); +static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, + int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx); +static void ADIOI_R_Exchange_data_alltoallv(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, + int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx); +static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **recv_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, + unsigned *recv_size, + MPI_Request * requests, MPI_Status * statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, MPI_Aint buftype_extent); + +extern void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype + datatype, int file_ptr_type, ADIO_Offset + offset, ADIO_Offset ** offset_list_ptr, ADIO_Offset + ** len_list_ptr, ADIO_Offset * start_offset_ptr, + ADIO_Offset * end_offset_ptr, int + *contig_access_count_ptr); + + + +void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs structures, one for each other process in + * whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs structures, one for each other process + * whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count = 0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *gpfs_offsets0 = NULL, *gpfs_offsets = NULL; + ADIO_Offset *count_sizes; + int ii; + ADIO_Offset *len_list = NULL; + MPI_Aint *buf_idx = NULL; + + GPFSMPIO_T_CIO_RESET(r); + +#ifdef HAVE_STATUS_SET_BYTES + MPI_Count bufsize, size; +#endif + +#if 0 + /* From common code - not implemented for bg. */ + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl(fd, buf, count, ADIOI_READ, datatype, + file_ptr_type, offset, status, error_code); + return; + } +#endif +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* number of aggregators, cb_nodes, is stored in the hints */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + + GPFSMPIO_T_CIO_SET_GET(r, 1, 0, GPFSMPIO_CIO_T_MPIO_CRW, GPFSMPIO_CIO_LAST); + GPFSMPIO_T_CIO_SET_GET(r, 1, 0, GPFSMPIO_CIO_T_LCOMP, GPFSMPIO_CIO_LAST); + + /* only check for interleaving if cb_read isn't disabled */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + * lengths in the file and determine the start and end offsets. + * Note: end_offset points to the last byte-offset to be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 + */ + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_GATHER, GPFSMPIO_CIO_T_LCOMP); +#ifdef RDCOLL_DEBUG + for (i = 0; i < contig_access_count; i++) { + DBG_FPRINTF(stderr, "rank %d off %lld len %lld\n", + myrank, (long long) offset_list[i], (long long) len_list[i]); + } +#endif + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets + * stored in order of process rank. */ + + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + end_offsets = st_offsets + nprocs; + + ADIO_Offset my_count_size = 0; + /* One-sided aggregation needs the amount of data per rank as well + * because the difference in starting and ending offsets for 1 byte is + * 0 the same as 0 bytes so it cannot be distiguished. + */ + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + count_sizes = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); + MPI_Count buftype_size; + MPI_Type_size_x(datatype, &buftype_size); + my_count_size = (ADIO_Offset) count *(ADIO_Offset) buftype_size; + } + if (romio_tunegather) { + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(6 * nprocs * sizeof(ADIO_Offset)); + gpfs_offsets = gpfs_offsets0 + 3 * nprocs; + for (ii = 0; ii < nprocs; ii++) { + gpfs_offsets0[ii * 3] = 0; + gpfs_offsets0[ii * 3 + 1] = 0; + gpfs_offsets0[ii * 3 + 2] = 0; + } + gpfs_offsets0[myrank * 3] = start_offset; + gpfs_offsets0[myrank * 3 + 1] = end_offset; + gpfs_offsets0[myrank * 3 + 2] = my_count_size; + MPI_Allreduce(gpfs_offsets0, gpfs_offsets, nprocs * 3, ADIO_OFFSET, MPI_MAX, + fd->comm); + for (ii = 0; ii < nprocs; ii++) { + st_offsets[ii] = gpfs_offsets[ii * 3]; + end_offsets[ii] = gpfs_offsets[ii * 3 + 1]; + count_sizes[ii] = gpfs_offsets[ii * 3 + 2]; + } + } else { + gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(4 * nprocs * sizeof(ADIO_Offset)); + gpfs_offsets = gpfs_offsets0 + 2 * nprocs; + for (ii = 0; ii < nprocs; ii++) { + gpfs_offsets0[ii * 2] = 0; + gpfs_offsets0[ii * 2 + 1] = 0; + } + gpfs_offsets0[myrank * 2] = start_offset; + gpfs_offsets0[myrank * 2 + 1] = end_offset; + + MPI_Allreduce(gpfs_offsets0, gpfs_offsets, nprocs * 2, ADIO_OFFSET, MPI_MAX, + fd->comm); + + for (ii = 0; ii < nprocs; ii++) { + st_offsets[ii] = gpfs_offsets[ii * 2]; + end_offsets[ii] = gpfs_offsets[ii * 2 + 1]; + } + } + ADIOI_Free(gpfs_offsets0); + } else { + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm); + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + MPI_Allgather(&count_sizes, 1, ADIO_OFFSET, count_sizes, 1, ADIO_OFFSET, fd->comm); + } + } + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_PATANA, GPFSMPIO_CIO_T_GATHER); + + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + * for the moment. */ + } + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + if (fd->hints->cb_read == ADIOI_HINT_DISABLE + || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) { + /* don't do aggregation */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; + ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, status, error_code); + } else + ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code); + } else + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + + return; + } + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_FD_PART, GPFSMPIO_CIO_T_PATANA); + + /* We're going to perform aggregation of I/O. Here we call + * ADIOI_Calc_file_domains() to determine what processes will handle I/O + * to what regions. We pass nprocs_for_coll into this function; it is + * used to determine how many processes will perform I/O, which is also + * the number of regions into which the range of bytes must be divided. + * These regions are called "file domains", or FDs. + * + * When this function returns, fd_start, fd_end, fd_size, and + * min_st_offset will be filled in. fd_start holds the starting byte + * location for each file domain. fd_end holds the ending byte location. + * min_st_offset holds the minimum byte location that will be accessed. + * + * Both fd_start[] and fd_end[] are indexed by an aggregator number; this + * needs to be mapped to an actual rank in the communicator later. + * + */ + int currentNonZeroDataIndex = 0; + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + /* Take out the 0-data offsets by shifting the indexes with data to the + * front and keeping track of the non-zero data index for use as the + * length. By doing this we will optimally use all available aggs + * and spread the actual data across them instead of having offsets + * with empty data potentially dilute the file domains and create + * problems for the one-sided aggregation. + */ + for (i = 0; i < nprocs; i++) { + if (count_sizes[i] > 0) { + st_offsets[currentNonZeroDataIndex] = st_offsets[i]; + end_offsets[currentNonZeroDataIndex] = end_offsets[i]; + currentNonZeroDataIndex++; + } + } + } + if (gpfsmpio_tuneblocking) { + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, currentNonZeroDataIndex, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + } else { + ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + } + } else { + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + ADIOI_Calc_file_domains(st_offsets, end_offsets, currentNonZeroDataIndex, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + } else { + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + } + } + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_MYREQ, GPFSMPIO_CIO_T_FD_PART); + if ((romio_read_aggmethod == 1) || (romio_read_aggmethod == 2)) { + /* If the user has specified to use a one-sided aggregation method then + * do that at this point instead of the two-phase I/O. + */ + ADIOI_OneSidedReadAggregation(fd, offset_list, len_list, contig_access_count, buf, + datatype, error_code, st_offsets, end_offsets, + currentNonZeroDataIndex, fd_start, fd_end); + GPFSMPIO_T_CIO_REPORT(0, fd, myrank, nprocs); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + ADIOI_Free(count_sizes); + goto fn_exit; + } + if (gpfsmpio_p2pcontig == 1) { + /* For some simple yet common(?) workloads, full-on two-phase I/O is + * overkill. We can establish sub-groups of processes and their + * aggregator, and then these sub-groups will carry out a simplified + * two-phase over that sub-group. + * + * First verify that the filetype is contig and the offsets are + * increasing in rank order*/ + int x, inOrderAndNoGaps = 1; + for (x = 0; x < (nprocs - 1); x++) { + if (end_offsets[x] != (st_offsets[x + 1] - 1)) + inOrderAndNoGaps = 0; + } + if (inOrderAndNoGaps && buftype_is_contig) { + /* if these conditions exist then execute the P2PContig code else + * execute the original code */ + ADIOI_P2PContigReadAggregation(fd, buf, + error_code, st_offsets, end_offsets, fd_start, fd_end); + + /* NOTE: we are skipping the rest of two-phase in this path */ + GPFSMPIO_T_CIO_REPORT(0, fd, myrank, nprocs); + + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + goto fn_exit; + } + } + + /* calculate where the portions of the access requests of this process + * are located in terms of the file domains. this could be on the same + * process or on other processes. this function fills in: + * count_my_req_procs - number of processes (including this one) for which + * this process has requests in their file domain + * count_my_req_per_proc - count of requests for each process, indexed + * by rank of the process + * my_req[] - array of data structures describing the requests to be + * performed by each process (including self). indexed by rank. + * buf_idx[] - array of locations into which data can be directly moved; + * this is only valid for contiguous buffer case + */ + if (gpfsmpio_tuneblocking) + ADIOI_GPFS_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, &buf_idx); + else + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, &count_my_req_per_proc, &my_req, &buf_idx); + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_OTHREQ, GPFSMPIO_CIO_T_MYREQ); + + /* perform a collective communication in order to distribute the + * data calculated above. fills in the following: + * count_others_req_procs - number of processes (including this + * one) which have requests in this process's file domain. + * count_others_req_per_proc[] - number of separate contiguous + * requests from proc i lie in this process's file domain. + */ + if (gpfsmpio_tuneblocking) + ADIOI_GPFS_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + else + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + + GPFSMPIO_T_CIO_SET_GET(r, 1, 1, GPFSMPIO_CIO_T_DEXCH, GPFSMPIO_CIO_T_OTHREQ); + + /* my_req[] and count_my_req_per_proc aren't needed at this point, so + * let's free the memory + */ + ADIOI_Free(count_my_req_per_proc); + ADIOI_Free(my_req[0].offsets); + ADIOI_Free(my_req); + + /* read data in sizes of no more than ADIOI_Coll_bufsize, + * communicate, and fill user buf. + */ + ADIOI_Read_and_exch(fd, buf, datatype, nprocs, myrank, + others_req, offset_list, + len_list, contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, buf_idx, error_code); + + GPFSMPIO_T_CIO_SET_GET(r, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_DEXCH); + GPFSMPIO_T_CIO_SET_GET(r, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_MPIO_CRW); + GPFSMPIO_T_CIO_REPORT(0, fd, myrank, nprocs); + + /* free all memory allocated for collective I/O */ + if (others_req[0].offsets) { + ADIOI_Free(others_req[0].offsets); + } + if (others_req[0].mem_ptrs) { + ADIOI_Free(others_req[0].mem_ptrs); + } + ADIOI_Free(others_req); + + ADIOI_Free(buf_idx); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + MPI_Type_size_x(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + during collective I/O. */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +} + +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code) +{ +/* Read in sizes of no more than coll_bufsize, an info parameter. + Send data to appropriate processes. + Place recd. data in user buf. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were read all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to read a distributed + array from a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + int i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, off, done, real_off, req_off; + char *read_buf = NULL, *tmp_buf; + int *curr_offlen_ptr, *count, *send_size, *recv_size; + int *partial_send, *recd_from_proc, *start_pos; + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ + ADIO_Offset real_size, size, for_curr_iter, for_next_iter; + int req_len, flag, rank; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint lb, buftype_extent; + int coll_bufsize; +#ifdef RDCOLL_DEBUG + int iii; +#endif + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of reads of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. + coll_bufsize is obtained from the hints object. */ + + coll_bufsize = fd->hints->cb_buffer_size; + + /* grab some initial values for st_loc and end_loc */ + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + /* now find the real values */ + for (i = 0; i < nprocs; i++) + for (j = 0; j < others_req[i].count; j++) { + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + + /* calculate ntimes, the number of times this process must perform I/O + * operations in order to complete all the requests it has received. + * the need for multiple I/O operations comes from the restriction that + * we only use coll_bufsize bytes of memory for internal buffering. + */ + if ((st_loc == -1) && (end_loc == -1)) { + /* this process does no I/O. */ + ntimes = 0; + } else { + /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize) */ + ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); + } + + MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); + + read_buf = fd->io_buf; + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* to store count of how many off-len pairs per proc are satisfied + * in an iteration. */ + + partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* if only a portion of the last off-len pair is sent to a process + * in a particular iteration, the length sent is stored here. + * calloc initializes to 0. */ + + send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be sent to each proc. in an iteration */ + + recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration. + * Of size nprocs so that I can use MPI_Alltoall later. */ + + recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* amount of data recd. so far from each proc. Used in + * ADIOI_Fill_user_buffer. initialized to 0 here. */ + + start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* used to store the starting value of curr_offlen_ptr[i] in + * this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + } + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + + done = 0; + off = st_loc; + for_curr_iter = for_next_iter = 0; + + MPI_Comm_rank(fd->comm, &rank); + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); +#endif + + for (m = 0; m < ntimes; m++) { + /* read buf of size coll_bufsize (or less) */ + /* go through all others_req and check if any are satisfied + * by the current read */ + + /* since MPI guarantees that displacements in filetypes are in + * monotonically nondecreasing order, I can maintain a pointer + * (curr_offlen_ptr) to + * current off-len pair for each process in others_req and scan + * further only from there. There is still a problem of filetypes + * such as: (1, 2, 3 are not process nos. They are just numbers for + * three chunks of data, specified by a filetype.) + * + * 1 -------!-- + * 2 -----!---- + * 3 --!----- + * + * where ! indicates where the current read_size limitation cuts + * through the filetype. I resolve this by reading up to !, but + * filling the communication buffer only for 1. I copy the portion + * left over for 2 into a tmp_buf for use in the next + * iteration. i.e., 2 and 3 will be satisfied in the next + * iteration. This simplifies filling in the user's buf at the + * other end, as only one off-len pair with incomplete data + * will be sent. I also don't need to send the individual + * offsets and lens along with the data, as the data is being + * sent in a particular order. */ + + /* off = start offset in the file for the data actually read in + * this iteration + * size = size of data read corresponding to off + * real_off = off minus whatever data was retained in memory from + * previous iteration for cases like 2, 3 illustrated above + * real_size = size plus the extra corresponding to real_off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ + +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + size = MPL_MIN((unsigned) coll_bufsize, end_loc - st_loc + 1 - done); + real_off = off - for_curr_iter; + real_size = size + for_curr_iter; + + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; + for_next_iter = 0; + + for (i = 0; i < nprocs; i++) { +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "rank %d, i %d, others_count %d\n", rank, i, others_req[i].count); +#endif + if (others_req[i].count) { + start_pos[i] = curr_offlen_ptr[i]; + for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { + if (partial_send[i]) { + /* this request may have been partially + * satisfied in the previous iteration. */ + req_off = others_req[i].offsets[j] + partial_send[i]; + req_len = others_req[i].lens[j] - partial_send[i]; + partial_send[i] = 0; + /* modify the off-len pair to reflect this change */ + others_req[i].offsets[j] = req_off; + others_req[i].lens[j] = req_len; + } else { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + } + if (req_off < real_off + real_size) { + count[i]++; + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + req_off - real_off) == + (ADIO_Offset) (uintptr_t) (read_buf + req_off - real_off)); + MPI_Get_address(read_buf + req_off - real_off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((real_off + real_size - req_off) == + (int) (real_off + real_size - req_off)); + send_size[i] += + (int) (MPL_MIN + (real_off + real_size - req_off, + (ADIO_Offset) (unsigned) req_len)); + + if (real_off + real_size - req_off < (ADIO_Offset) (unsigned) req_len) { + partial_send[i] = (int) (real_off + real_size - req_off); + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < real_off + real_size)) { + /* this is the case illustrated in the + * figure above. */ + for_next_iter = MPL_MAX(for_next_iter, + real_off + real_size - + others_req[i].offsets[j + 1]); + /* max because it must cover requests + * from different processes */ + } + break; + } + } else + break; + } + curr_offlen_ptr[i] = j; + } + } + + flag = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) + flag = 1; + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); +#endif + if (flag) { + char round[50]; + MPL_snprintf(round, sizeof(round), "two-phase-round=%d", m); + setenv("LIBIOLOG_EXTRA_INFO", round, 1); + ADIOI_Assert(size == (int) size); + ADIO_ReadContig(fd, read_buf + for_curr_iter, (int) size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, error_code); +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "\tread_coll: 700, data read [%lld] = ", (long long) size); + for (iii = 0; iii < size && iii < 80; iii++) { + DBGV_FPRINTF(stderr, "%3d,", *((unsigned char *) read_buf + for_curr_iter + iii)); + } + DBG_FPRINTF(stderr, "\n"); +#endif + + if (*error_code != MPI_SUCCESS) + return; + } + + for_curr_iter = for_next_iter; + +#ifdef PROFILE + MPE_Log_event(7, 0, "start communication"); +#endif + if (gpfsmpio_comm == 1) + ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + else if (gpfsmpio_comm == 0) { + ADIOI_R_Exchange_data_alltoallv(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + } +#ifdef PROFILE + MPE_Log_event(8, 0, "end communication"); +#endif + + if (for_next_iter) { + tmp_buf = (char *) ADIOI_Malloc(for_next_iter); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + real_size - for_next_iter) == + (ADIO_Offset) (uintptr_t) (read_buf + real_size - for_next_iter)); + ADIOI_Assert((for_next_iter + coll_bufsize) == (size_t) (for_next_iter + coll_bufsize)); + memcpy(tmp_buf, read_buf + real_size - for_next_iter, for_next_iter); + ADIOI_Free(fd->io_buf); + fd->io_buf = (char *) ADIOI_Malloc(for_next_iter + coll_bufsize); + memcpy(fd->io_buf, tmp_buf, for_next_iter); + read_buf = fd->io_buf; + ADIOI_Free(tmp_buf); + } + + off += size; + done += size; + } + + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; +#ifdef PROFILE + MPE_Log_event(7, 0, "start communication"); +#endif + for (m = ntimes; m < max_ntimes; m++) +/* nothing to send, but check for recv. */ + + if (gpfsmpio_comm == 1) + ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + else /* strncmp(env_switch, "alltoall", 8) == 0 */ if (gpfsmpio_comm == 0) + ADIOI_R_Exchange_data_alltoallv(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + +#ifdef PROFILE + MPE_Log_event(8, 0, "end communication"); +#endif + + ADIOI_Free(curr_offlen_ptr); + ADIOI_Free(count); + ADIOI_Free(partial_send); + ADIOI_Free(send_size); + ADIOI_Free(recv_size); + ADIOI_Free(recd_from_proc); + ADIOI_Free(start_pos); + + unsetenv("LIBIOLOG_EXTRA_INFO"); +} + +static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx) +{ + int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send; + char **recv_buf = NULL; + MPI_Request *requests; + MPI_Datatype send_type; + MPI_Status *statuses; + +/* exchange send_size info so that each process knows how much to + receive from whom and how much memory to allocate. */ + + MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); + + nprocs_recv = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + nprocs_recv++; + + nprocs_send = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) + nprocs_send++; + + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); +/* +1 to avoid a 0-size malloc */ + +/* post recvs. if buftype_is_contig, data can be directly recd. into + user buf at location given by buf_idx. else use recv_buf. */ + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) { + MPI_Irecv(((char *) buf) + buf_idx[i], recv_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, requests + j); + j++; + buf_idx[i] += recv_size[i]; + } + } else { +/* allocate memory for recv_buf and post receives */ + recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) + recv_buf[i] = (char *) ADIOI_Malloc(recv_size[i]); + } + + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, + myrank + i + 100 * iter, fd->comm, requests + j); + j++; +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", + myrank, recv_size[i], myrank + i + 100 * iter); +#endif + } + } + } + +/* create derived datatypes and send data */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (send_size[i]) { +/* take care if the last off-len pair is a partial send */ + if (partial_send[i]) { + k = start_pos[i] + count[i] - 1; + tmp = others_req[i].lens[k]; + others_req[i].lens[k] = partial_send[i]; + } + ADIOI_Type_create_hindexed_x(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, &send_type); + /* absolute displacement; use MPI_BOTTOM in send */ + MPI_Type_commit(&send_type); + MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank + i + 100 * iter, + fd->comm, requests + nprocs_recv + j); + MPI_Type_free(&send_type); + if (partial_send[i]) + others_req[i].lens[k] = tmp; + j++; + } + } + +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ +#endif + + /* wait on the receives */ + if (nprocs_recv) { +#ifdef NEEDS_MPI_TEST + j = 0; + while (!j) + MPI_Testall(nprocs_recv, requests, &j, statuses); +#else + MPI_Waitall(nprocs_recv, requests, statuses); +#endif + + /* if noncontiguous, to the copies from the recv buffers */ + if (!buftype_is_contig) + ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, + offset_list, len_list, (unsigned *) recv_size, + requests, statuses, recd_from_proc, + nprocs, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, buftype_extent); + } + + /* wait on the sends */ + MPI_Waitall(nprocs_send, requests + nprocs_recv, statuses + nprocs_recv); + +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + ADIOI_Free(requests); + + if (!buftype_is_contig) { + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + ADIOI_Free(recv_buf[i]); + ADIOI_Free(recv_buf); + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif +} + +#define ADIOI_BUF_INCR \ + { \ + while (buf_incr) { \ + size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ + } + + +#define ADIOI_BUF_COPY \ + { \ + while (size) { \ + size_in_buf = MPL_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(uintptr_t)buf) + user_buf_idx) == (ADIO_Offset)(uintptr_t)(buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(((char *) buf) + user_buf_idx, \ + &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ + recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ + } + +static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **recv_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, + unsigned *recv_size, + MPI_Request * requests, MPI_Status * statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, MPI_Aint buftype_extent) +{ + +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + /* Not sure unsigned is necessary, but it makes the math safer */ + unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; + + MPL_UNREFERENCED_ARG(requests); + MPL_UNREFERENCED_ARG(statuses); + +/* curr_from_proc[p] = amount of data recd from proc. p that has already + been accounted for so far + done_from_proc[p] = amount of data already recd from proc. p and + filled into user buffer in previous iterations + user_buf_idx = current location in user buffer + recv_buf_idx[p] = current location in recv_buf of proc. p */ + curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + done_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + recv_buf_idx = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + + for (i = 0; i < nprocs; i++) { + recv_buf_idx[i] = curr_from_proc[i] = 0; + done_from_proc[i] = recd_from_proc[i]; + } + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in + * flattened buf */ + + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = len_list[i]; + + /* this request may span the file domains of more than one process */ + while (rem_len > 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &len, fd_size, fd_start, fd_end); + + if (recv_buf_idx[p] < recv_size[p]) { + if (curr_from_proc[p] + len > done_from_proc[p]) { + if (done_from_proc[p] > curr_from_proc[p]) { + size = MPL_MIN(curr_from_proc[p] + len - + done_from_proc[p], recv_size[p] - recv_buf_idx[p]); + buf_incr = done_from_proc[p] - curr_from_proc[p]; + ADIOI_BUF_INCR buf_incr = curr_from_proc[p] + len - done_from_proc[p]; + ADIOI_Assert((done_from_proc[p] + size) == + (unsigned) ((ADIO_Offset) done_from_proc[p] + size)); + curr_from_proc[p] = done_from_proc[p] + size; + ADIOI_BUF_COPY} else { + size = MPL_MIN(len, recv_size[p] - recv_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_from_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_from_proc[p] + size)); + curr_from_proc[p] += (unsigned) size; + ADIOI_BUF_COPY} + } else { + ADIOI_Assert((curr_from_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_from_proc[p] + len)); + curr_from_proc[p] += (unsigned) len; + buf_incr = len; + ADIOI_BUF_INCR} + } else { + buf_incr = len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + recd_from_proc[i] = curr_from_proc[i]; + + ADIOI_Free(curr_from_proc); + ADIOI_Free(done_from_proc); + ADIOI_Free(recv_buf_idx); +} + +static void ADIOI_R_Exchange_data_alltoallv(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx) +{ + int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send; + char **recv_buf = NULL; + MPI_Request *requests = NULL; + MPI_Status *statuses = NULL; + int rtail, stail; + char *sbuf_ptr, *from_ptr; + int len; + int *sdispls, *rdispls; + char *all_recv_buf, *all_send_buf; + + /* exchange send_size info so that each process knows how much to + * receive from whom and how much memory to allocate. */ + MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); + + nprocs_recv = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) { + nprocs_recv++; + break; + } + + nprocs_send = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + nprocs_send++; + break; + } + + /* receiver side data structures */ + rdispls = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + rtail = 0; + for (i = 0; i < nprocs; i++) { + rdispls[i] = rtail; + rtail += recv_size[i]; + } + + /* data buffer */ + all_recv_buf = (char *) ADIOI_Malloc(rtail); + recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + for (i = 0; i < nprocs; i++) { + recv_buf[i] = all_recv_buf + rdispls[i]; + } + + /* sender side data structures */ + sdispls = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + stail = 0; + for (i = 0; i < nprocs; i++) { + sdispls[i] = stail; + stail += send_size[i]; + } + + /* data buffer */ + all_send_buf = (char *) ADIOI_Malloc(stail); + for (i = 0; i < nprocs; i++) { + if (send_size[i]) { + if (partial_send[i]) { + k = start_pos[i] + count[i] - 1; + tmp = others_req[i].lens[k]; + others_req[i].lens[k] = partial_send[i]; + } + sbuf_ptr = all_send_buf + sdispls[i]; + for (j = 0; j < count[i]; j++) { + from_ptr = + (char *) ADIOI_AINT_CAST_TO_VOID_PTR(others_req[i].mem_ptrs[start_pos[i] + j]); + len = others_req[i].lens[start_pos[i] + j]; + memcpy(sbuf_ptr, from_ptr, len); + sbuf_ptr += len; + } + if (partial_send[i]) + others_req[i].lens[k] = tmp; + } + } + +#if RDCOLL_DEBUG + DBG_FPRINTF(stderr, "\tsend_size = [%d]%2d,", 0, send_size[0]); + for (i = 1; i < nprocs; i++) + if (send_size[i - 1] != send_size[i]) { + DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, send_size[i]); + } + DBG_FPRINTF(stderr, "\trecv_size = [%d]%2d,", 0, recv_size[0]); + for (i = 1; i < nprocs; i++) + if (recv_size[i - 1] != recv_size[i]) { + DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, recv_size[i]); + } + DBG_FPRINTF(stderr, "\tsdispls = [%d]%2d,", 0, sdispls[0]); + for (i = 1; i < nprocs; i++) + if (sdispls[i - 1] != sdispls[i]) { + DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, sdispls[i]); + } + DBG_FPRINTF(stderr, "\trdispls = [%d]%2d,", 0, rdispls[0]); + for (i = 1; i < nprocs; i++) + if (rdispls[i - 1] != rdispls[i]) { + DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, rdispls[i]); + } + DBG_FPRINTF(stderr, "\ttails = %4d, %4d\n", stail, rtail); + if (nprocs_send) { + DBG_FPRINTF(stderr, "\tall_send_buf = [%d]%2d,", 0, all_send_buf[0]); + /* someone at some point found it useful to look at the 128th kilobyte of data from each processor, but this segfaults in many situations if "all debugging" enabled */ + //for (i=1; i<nprocs; i++) if (all_send_buf[(i-1)*131072]!=all_send_buf[i*131072]){ DBG_FPRINTF(stderr, "\t\t[%d]%2d,", i, all_send_buf [i*131072]); } + } +#endif + + /* alltoallv */ + MPI_Alltoallv(all_send_buf, send_size, sdispls, MPI_BYTE, + all_recv_buf, recv_size, rdispls, MPI_BYTE, fd->comm); + +#if 0 + DBG_FPRINTF(stderr, "\tall_recv_buf = "); + for (i = 131072; i < 131073; i++) { + DBG_FPRINTF(stderr, "%2d,", all_recv_buf[i]); + } + DBG_FPRINTF(stderr, "\n"); +#endif + + /* unpack at the receiver side */ + if (nprocs_recv) { + if (!buftype_is_contig) + ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, offset_list, len_list, (unsigned *) recv_size, requests, statuses, /* never used inside */ + recd_from_proc, + nprocs, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, buftype_extent); + else { + rtail = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) { + memcpy((char *) buf + buf_idx[i], all_recv_buf + rtail, recv_size[i]); + buf_idx[i] += recv_size[i]; + rtail += recv_size[i]; + } + } + } + + ADIOI_Free(all_send_buf); + ADIOI_Free(all_recv_buf); + ADIOI_Free(recv_buf); + ADIOI_Free(sdispls); + ADIOI_Free(rdispls); + return; +} diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.c new file mode 100644 index 0000000000000000000000000000000000000000..6158784d974672a43299b16805c00d1fa6410108 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.c @@ -0,0 +1,263 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_tuning.c + * \brief Defines ad_gpfs performance tuning + */ + +/*--------------------------------------------------------------------- + * ad_gpfs_tuning.c + * + * defines global variables and functions for performance tuning and + * functional debugging. + *---------------------------------------------------------------------*/ + +#include "ad_gpfs_tuning.h" +#include "mpi.h" + +#if !defined(PVFS2_SUPER_MAGIC) +#define PVFS2_SUPER_MAGIC (0x20030528) +#endif + + +int gpfsmpio_timing; +int gpfsmpio_timing2; +int gpfsmpio_timing_cw_level; +int gpfsmpio_comm; +int gpfsmpio_tuneblocking; +long bglocklessmpio_f_type; +int gpfsmpio_bg_nagg_pset; +int gpfsmpio_pthreadio; +int gpfsmpio_p2pcontig; +int gpfsmpio_balancecontig; +int gpfsmpio_devnullio; +int gpfsmpio_bridgeringagg; + +double gpfsmpio_prof_cw[GPFSMPIO_CIO_LAST + 1]; +double gpfsmpio_prof_cr[GPFSMPIO_CIO_LAST + 1]; + +/* set internal variables for tuning environment variables */ +/** \page mpiio_vars MPIIO Configuration + \section env_sec Environment Variables + * - GPFSMPIO_COMM - Define how data is exchanged on collective + * reads and writes. Possible values: + * - 0 - Use MPI_Alltoallv. + * - 1 - Use MPI_Isend/MPI_Irecv. + * - Default is 0. + * + * - GPFSMPIO_TIMING - collect timing breakdown for MPI I/O collective calls. + * Possible values: + * - 0 - Do not collect/report timing. + * - 1 - Collect/report timing. + * - Default is 0. + * + * - GPFSMPIO_TUNEBLOCKING - Tune how aggregate file domains are + * calculated (block size). Possible values: + * - 0 - Evenly calculate file domains across aggregators. Also use + * MPI_Isend/MPI_Irecv to exchange domain information. + * - 1 - Align file domains with the underlying file system's block size. Also use + * MPI_Alltoallv to exchange domain information. + * - Default is 1. + * + * - BGLOCKLESSMPIO_F_TYPE - Specify a filesystem type that should run + * the ad_bglockless driver. NOTE: Using romio prefixes (such as + * "bg:" or "bglockless:") on a file name will override this environment + * variable. Possible values: + * - 0xnnnnnnnn - Any valid file system type (or "magic number") from + * statfs() field f_type. + * - The default is 0x20030528 (PVFS2_SUPER_MAGIC) + * + * - GPFSMPIO_NAGG_PSET - Specify a ratio of "I/O aggregators" to use for each + * compute group (compute nodes + i/o nodes). Possible values: + * - any integer + * - Default is 8 + * + * - GPFSMPIO_PTHREADIO - Enables a very simple form of asyncronous io where a + * pthread is spawned to do the posix writes while the main thread does the + * data aggregation - useful for large files where multiple rounds are + * required (more that the cb_buffer_size of data per aggregator). User + * must ensure there is hw resource available for the thread to run. I + * am sure there is a better way to do this involving comm threads - this is + * just a start. NOTE: For some reason the stats collected when this is + * enabled misses some of the data so the data sizes are off a bit - this is + * a statistical issue only, the data is still accurately written out + * + * - GPFSMPIO_P2PCONTIG - Does simple point-to-point communication between the + * aggregator and the procs that feed it. Performance could be enhanced by a + * one-sided put algorithm. Current implementation allows only 1 round of + * data. Useful/allowed only when: + * 1.) The datatype is contiguous. + * 2.) The offsets are increasing in rank-order. + * 3.) There are no gaps between the offsets. + * 4.) No single rank has a data size which spans multiple file domains. + * + * - GPFSMPIO_BALANCECONTIG - Relevant only to BGQ. File domain blocks are assigned + * to aggregators in a breadth-first fashion relative to the ions - additionally, + * file domains on the aggregators sharing the same bridgeset and ion have contiguous + * offsets. The breadth-first assignment improves performance in the case of + * a relatively small file of size less than the gpfs block size multiplied + * by the number of ions. Files: ad_gpfs_aggrs.c ad_bg_aggrs.c. Possible Values + * - 0 - assign file domain blocks in the traditional manner + * - 1 - if there are variable sized file domain blocks, spread them out + * (balance) across bridge nodes + * + * - GPFSMPIO_DEVNULLIO - do everything *except* write to / read from the file + * system. When experimenting with different two-phase I/O strategies, it's + * helpful to remove the highly variable file system from the experiment. + * - 0 (disabled) or 1 (enabled) + * - Default is 0 + * + * - GPFSMPIO_BRIDGERINGAGG - Relevant only to BGQ. Aggregator placement + * optimization whch forms a 5-d ring around the bridge node starting at + * GPFSMPIO_BRIDGERINGAGG hops away. Experimental performance results + * suggest best value is 1 and only in conjunction with GPFSMPIO_P2PCONTIG + * and GPFSMPIO_BALANCECONTIG. The number of aggregators selected is still + * GPFSMPIO_NAGG_PSET however the bridge node itself is NOT selected. + * + */ + +void ad_gpfs_get_env_vars() +{ + char *x, *dummy; + + gpfsmpio_comm = 0; + x = getenv("GPFSMPIO_COMM"); + if (x) + gpfsmpio_comm = atoi(x); + gpfsmpio_timing = 0; + x = getenv("GPFSMPIO_TIMING"); + if (x) + gpfsmpio_timing = atoi(x); + gpfsmpio_tuneblocking = 1; + x = getenv("GPFSMPIO_TUNEBLOCKING"); + if (x) + gpfsmpio_tuneblocking = atoi(x); + bglocklessmpio_f_type = PVFS2_SUPER_MAGIC; + x = getenv("BGLOCKLESSMPIO_F_TYPE"); + if (x) + bglocklessmpio_f_type = strtol(x, &dummy, 0); + DBG_FPRINTF(stderr, "BGLOCKLESSMPIO_F_TYPE=%ld/%#lX\n", + bglocklessmpio_f_type, bglocklessmpio_f_type); + /* note: this value will be 'sanity checked' in ADIOI_BG_persInfo_init(), + * when we know a bit more about what "largest possible value" and + * "smallest possible value" should be */ + gpfsmpio_bg_nagg_pset = ADIOI_BG_NAGG_PSET_DFLT; + x = getenv("GPFSMPIO_NAGG_PSET"); + if (x) + gpfsmpio_bg_nagg_pset = atoi(x); + + gpfsmpio_p2pcontig = 0; + x = getenv("GPFSMPIO_P2PCONTIG"); + if (x) + gpfsmpio_p2pcontig = atoi(x); + + gpfsmpio_balancecontig = 0; + x = getenv("GPFSMPIO_BALANCECONTIG"); + if (x) + gpfsmpio_balancecontig = atoi(x); + + gpfsmpio_devnullio = 0; + x = getenv("GPFSMPIO_DEVNULLIO"); + if (x) + gpfsmpio_devnullio = atoi(x); + + gpfsmpio_bridgeringagg = 0; + x = getenv("GPFSMPIO_BRIDGERINGAGG"); + if (x) + gpfsmpio_bridgeringagg = atoi(x); + +} + +/* report timing breakdown for MPI I/O collective call */ +void ad_gpfs_timing_crw_report(int rw, ADIO_File fd, int myrank, int nprocs) +{ + int i; + + if (gpfsmpio_timing) { + /* Timing across the whole communicator is a little bit interesting, + * but what is *more* interesting is if we single out the aggregators + * themselves. non-aggregators spend a lot of time in "exchange" not + * exchanging data, but blocked because they are waiting for + * aggregators to finish writing. If we focus on just the aggregator + * processes we will get a more clear picture about the data exchange + * vs. i/o time breakdown */ + + /* if deferred open enabled, we could use the aggregator communicator */ + MPI_Comm agg_comm; + int nr_aggs, agg_rank; + MPI_Comm_split(fd->comm, (fd->is_agg ? 1 : MPI_UNDEFINED), 0, &agg_comm); + if (agg_comm != MPI_COMM_NULL) { + MPI_Comm_size(agg_comm, &nr_aggs); + MPI_Comm_rank(agg_comm, &agg_rank); + } + + double *gpfsmpio_prof_org = gpfsmpio_prof_cr; + if (rw) + gpfsmpio_prof_org = gpfsmpio_prof_cw; + + double gpfsmpio_prof_avg[GPFSMPIO_CIO_LAST]; + double gpfsmpio_prof_max[GPFSMPIO_CIO_LAST]; + + if (agg_comm != MPI_COMM_NULL) { + MPI_Reduce(gpfsmpio_prof_org, gpfsmpio_prof_avg, GPFSMPIO_CIO_LAST, MPI_DOUBLE, MPI_SUM, + 0, agg_comm); + MPI_Reduce(gpfsmpio_prof_org, gpfsmpio_prof_max, GPFSMPIO_CIO_LAST, MPI_DOUBLE, MPI_MAX, + 0, agg_comm); + } + if (agg_comm != MPI_COMM_NULL && agg_rank == 0) { + + for (i = 0; i < GPFSMPIO_CIO_LAST; i++) + gpfsmpio_prof_avg[i] /= nr_aggs; + + gpfsmpio_prof_avg[GPFSMPIO_CIO_B_POSI_RW] = + gpfsmpio_prof_avg[GPFSMPIO_CIO_DATA_SIZE] * nr_aggs / + gpfsmpio_prof_max[GPFSMPIO_CIO_T_POSI_RW]; + gpfsmpio_prof_avg[GPFSMPIO_CIO_B_MPIO_RW] = + gpfsmpio_prof_avg[GPFSMPIO_CIO_DATA_SIZE] * nr_aggs / + gpfsmpio_prof_max[GPFSMPIO_CIO_T_MPIO_RW]; + + gpfsmpio_prof_avg[GPFSMPIO_CIO_B_MPIO_CRW] = + gpfsmpio_prof_avg[GPFSMPIO_CIO_DATA_SIZE] * nr_aggs / + gpfsmpio_prof_max[GPFSMPIO_CIO_T_MPIO_CRW]; + + fprintf(stderr, "TIMING-%1s,", (rw ? "W" : "R")); + fprintf(stderr, "SIZE: %12.4lld , ", + (long long int) (gpfsmpio_prof_avg[GPFSMPIO_CIO_DATA_SIZE] * nr_aggs)); + fprintf(stderr, "SEEK-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_SEEK]); + fprintf(stderr, "SEEK-max: %10.3f , ", gpfsmpio_prof_max[GPFSMPIO_CIO_T_SEEK]); + fprintf(stderr, "LOCAL-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_LCOMP]); + fprintf(stderr, "GATHER-max: %10.3f , ", gpfsmpio_prof_max[GPFSMPIO_CIO_T_GATHER]); + fprintf(stderr, "PATTERN-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_PATANA]); + fprintf(stderr, "FILEDOMAIN-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_FD_PART]); + fprintf(stderr, "MYREQ-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_MYREQ]); + fprintf(stderr, "OTHERREQ-max: %10.3f , ", gpfsmpio_prof_max[GPFSMPIO_CIO_T_OTHREQ]); + fprintf(stderr, "EXCHANGE-max: %10.3f , ", gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH]); + fprintf(stderr, "EXCHANGE-RECV_EXCH-max: %10.3f , ", + gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH_RECV_EXCH]); + fprintf(stderr, "EXCHANGE-SETUP-max: %10.3f , ", + gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH_SETUP]); + fprintf(stderr, "EXCHANGE-NET-max: %10.3f , ", + gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH_NET]); + fprintf(stderr, "EXCHANGE-SORT-max: %10.3f , ", + gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH_SORT]); + fprintf(stderr, "EXCHANGE-SIEVE-max: %10.3f , ", + gpfsmpio_prof_max[GPFSMPIO_CIO_T_DEXCH_SIEVE]); + fprintf(stderr, "POSIX-TIME-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_T_POSI_RW]); + fprintf(stderr, "POSIX-TIME-max: %10.3f , ", gpfsmpio_prof_max[GPFSMPIO_CIO_T_POSI_RW]); + fprintf(stderr, "MPIIO-CONTIG-TIME-avg: %10.3f , ", + gpfsmpio_prof_avg[GPFSMPIO_CIO_T_MPIO_RW]); + fprintf(stderr, "MPIIO-STRIDED-TIME-avg: %10.3f , ", + gpfsmpio_prof_avg[GPFSMPIO_CIO_T_MPIO_CRW]); + fprintf(stderr, "POSIX-BW-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_B_POSI_RW]); + fprintf(stderr, "MPI-BW-avg: %10.3f , ", gpfsmpio_prof_avg[GPFSMPIO_CIO_B_MPIO_RW]); + fprintf(stderr, "MPI-BW-collective-avg: %10.3f\n ", + gpfsmpio_prof_avg[GPFSMPIO_CIO_B_MPIO_CRW]); + } + if (agg_comm != MPI_COMM_NULL) + MPI_Comm_free(&agg_comm); + } + +} diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.h b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.h new file mode 100644 index 0000000000000000000000000000000000000000..d34b304249bd3db52968d7df92cf8c32f1f746c5 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_tuning.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_tuning.h + * \brief ??? + */ + +/*--------------------------------------------------------------------- + * ad_gpfs_tuning.h + * + * declares global variables and macros for performance tuning and + * functional debugging. + *---------------------------------------------------------------------*/ + +#ifndef AD_GPFS_TUNING_H_INCLUDED +#define AD_GPFS_TUNING_H_INCLUDED + +#include "adio.h" + + +/*----------------------------------------- + * Global variables for the control of + * 1. timing + * 2. select specific optimizations + * 3. global flags for certain optimizations + *-----------------------------------------*/ + +/* timing fields */ +enum { + GPFSMPIO_CIO_DATA_SIZE = 0, + GPFSMPIO_CIO_T_SEEK, + GPFSMPIO_CIO_T_LCOMP, /* time for ADIOI_Calc_my_off_len(), local */ + GPFSMPIO_CIO_T_GATHER, /* time for previous MPI_Allgather, now Allreduce */ + GPFSMPIO_CIO_T_PATANA, /* time for a quick test if access is contiguous or not, local */ + GPFSMPIO_CIO_T_FD_PART, /* time for file domain partitioning, local */ + GPFSMPIO_CIO_T_MYREQ, /* time for ADIOI_Calc_my_req(), local */ + GPFSMPIO_CIO_T_OTHREQ, /* time for ADIOI_Calc_others_req(), short Alltoall */ + GPFSMPIO_CIO_T_DEXCH, /* time for I/O data exchange */ + /* the next DEXCH_* timers capture finer-grained portions of T_DEXCH */ + GPFSMPIO_CIO_T_DEXCH_RECV_EXCH, /* time for each process to exchange recieve + * size info with everyone else */ + GPFSMPIO_CIO_T_DEXCH_SETUP, /* time for setup portion of I/O data exchange */ + GPFSMPIO_CIO_T_DEXCH_NET, /* time for network portion of I/O data exchange */ + GPFSMPIO_CIO_T_DEXCH_SORT, /* time to sort requesst in I/O data exchange */ + GPFSMPIO_CIO_T_DEXCH_SIEVE, /* time for read portion of RMW in two phase */ + GPFSMPIO_CIO_T_POSI_RW, + GPFSMPIO_CIO_B_POSI_RW, + GPFSMPIO_CIO_T_MPIO_RW, /* time for ADIOI_WriteContig() */ + GPFSMPIO_CIO_B_MPIO_RW, + GPFSMPIO_CIO_T_MPIO_CRW, /* time for ADIOI_GPFS_WriteStridedColl() */ + GPFSMPIO_CIO_B_MPIO_CRW, + GPFSMPIO_CIO_LAST +}; + +/* +1 because GPFSMPIO_CIO_LAST is actually used to say "zero this counter"" */ +extern double gpfsmpio_prof_cw[GPFSMPIO_CIO_LAST + 1]; +extern double gpfsmpio_prof_cr[GPFSMPIO_CIO_LAST + 1]; + +/* corresponds to environment variables to select optimizations and timing level */ +extern int gpfsmpio_timing; +extern int gpfsmpio_timing_cw_level; +extern int gpfsmpio_comm; +extern int gpfsmpio_tuneblocking; +extern long bglocklessmpio_f_type; +extern int gpfsmpio_pthreadio; +extern int gpfsmpio_p2pcontig; +extern int gpfsmpio_balancecontig; +extern int gpfsmpio_devnullio; +extern int gpfsmpio_bridgeringagg; + +/* Default is, well, kind of complicated. Blue Gene /L and /P had "psets": one + * i/o node and all compute nodes wired to it. On Blue Gene /Q that + * relationship is a lot more fluid. There are still I/O nodes, and compute + * nodes are assigned to an i/o node, but there are two routes to the i/o node, + * via compute nodes designated as "bridge nodes". In this code, what we used + * to call a "pset" is actually "compute nodes associated with and including a + * bridge node". So, "nAgg" is roughly "number of aggregators per bridge", but + * look closely at ADIOI_BG_persInfo_init() for the details */ + +#define ADIOI_BG_NAGG_PSET_DFLT 16 + +extern int gpfsmpio_bg_nagg_pset; + + +/* set internal variables for tuning environment variables */ +void ad_gpfs_get_env_vars(void); + +/* report timing breakdown for MPI I/O collective call */ +void ad_gpfs_timing_crw_report(int rw, ADIO_File fd, int myrank, int nprocs); + +/* note: + * T := timing; + * CIO := collective I/O + */ +#define GPFSMPIO_T_CIO_RESET(RW) \ + { \ + int _i; \ + for (_i = 0; _i < GPFSMPIO_CIO_LAST; _i ++) \ + gpfsmpio_prof_c##RW [ _i ] = 0; \ + } + +#define GPFSMPIO_T_CIO_REPORT(RW, FD, MYRANK, NPROCS) \ + ad_gpfs_timing_crw_report (RW, FD, MYRANK, NPROCS); \ + +#define GPFSMPIO_T_CIO_SET_GET(RW, ISSET, ISGET, VAR1, VAR2) \ + { \ + double temp = MPI_Wtime(); \ + if (ISSET) gpfsmpio_prof_c##RW [ VAR1 ] = temp; \ + if (ISGET) gpfsmpio_prof_c##RW [ VAR2 ] = temp - gpfsmpio_prof_c##RW [ VAR2 ] ; \ + } + +#endif /* AD_GPFS_TUNING_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_wrcoll.c b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_wrcoll.c new file mode 100644 index 0000000000000000000000000000000000000000..13d31282204152e0f4cacb34beeda0cdcb8aea69 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/ad_gpfs_wrcoll.c @@ -0,0 +1,1756 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_gpfs_wrcoll.c + * \brief ??? + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_gpfs.h" +#include "ad_gpfs_aggrs.h" + +#ifdef BGQPLATFORM +#include "bg/ad_bg_pset.h" +#endif + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#ifdef PROFILE +#include "mpe.h" +#endif + +#include <pthread.h> + +#ifdef HAVE_GPFS_H +#include <gpfs.h> +#endif +#ifdef HAVE_GPFS_FCNTL_H +#include <gpfs_fcntl.h> +#endif + +#include <limits.h> +/* prototypes of functions used for collective writes only. */ +static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype + datatype, int nprocs, int myrank, ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code); +static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf, + ADIOI_Flatlist_node * flat_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, int size, + int *count, int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int *hole, int iter, + MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code); +static void ADIOI_W_Exchange_data_alltoallv(ADIO_File fd, const void *buf, char *write_buf, /* 1 */ + ADIOI_Flatlist_node * flat_buf, ADIO_Offset * offset_list, ADIO_Offset * len_list, int *send_size, int *recv_size, ADIO_Offset off, int size, /* 2 */ + int *count, int *start_pos, int *partial_recv, int *sent_to_proc, int nprocs, int myrank, int buftype_is_contig, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end, ADIOI_Access * others_req, int *send_buf_idx, int *curr_to_proc, /* 3 */ + int *done_to_proc, int *hole, /* 4 */ + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx, + int *error_code); +static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent); +static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent); +static void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements); + + +void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs access structures, one for each other process in + * whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs access structures, one for each other process + * whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count = 0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *gpfs_offsets0 = NULL, *gpfs_offsets = NULL; + ADIO_Offset *count_sizes; + int ii; + + MPI_Aint *buf_idx = NULL; + ADIO_Offset *len_list = NULL; + GPFSMPIO_T_CIO_RESET(w) +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + +/* the number of processes that actually perform I/O, nprocs_for_coll, + * is stored in the hints off the ADIO_File structure + */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + + GPFSMPIO_T_CIO_SET_GET(w, 1, 0, GPFSMPIO_CIO_T_MPIO_CRW, GPFSMPIO_CIO_LAST); + GPFSMPIO_T_CIO_SET_GET(w, 1, 0, GPFSMPIO_CIO_T_LCOMP, GPFSMPIO_CIO_LAST); + + /* only check for interleaving if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + * lengths in the file and determine the start and end offsets. + * Note: end_offset points to the last byte-offset to be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 + */ + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_GATHER, GPFSMPIO_CIO_T_LCOMP); + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets stored + * in order of process rank. */ + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + end_offsets = st_offsets + nprocs; + + ADIO_Offset my_count_size = 0; + /* One-sided aggregation needs the amount of data per rank as well + * because the difference in starting and ending offsets for 1 byte is + * 0 the same as 0 bytes so it cannot be distiguished. + */ + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + count_sizes = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); + MPI_Count buftype_size; + MPI_Type_size_x(datatype, &buftype_size); + my_count_size = (ADIO_Offset) count *(ADIO_Offset) buftype_size; + } + if (romio_tunegather) { + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(6 * nprocs * sizeof(ADIO_Offset)); + gpfs_offsets = gpfs_offsets0 + 3 * nprocs; + for (ii = 0; ii < nprocs; ii++) { + gpfs_offsets0[ii * 3] = 0; + gpfs_offsets0[ii * 3 + 1] = 0; + gpfs_offsets0[ii * 3 + 2] = 0; + } + gpfs_offsets0[myrank * 3] = start_offset; + gpfs_offsets0[myrank * 3 + 1] = end_offset; + gpfs_offsets0[myrank * 3 + 2] = my_count_size; + MPI_Allreduce(gpfs_offsets0, gpfs_offsets, nprocs * 3, ADIO_OFFSET, MPI_MAX, + fd->comm); + for (ii = 0; ii < nprocs; ii++) { + st_offsets[ii] = gpfs_offsets[ii * 3]; + end_offsets[ii] = gpfs_offsets[ii * 3 + 1]; + count_sizes[ii] = gpfs_offsets[ii * 3 + 2]; + } + } else { + gpfs_offsets0 = (ADIO_Offset *) ADIOI_Malloc(2 * nprocs * sizeof(ADIO_Offset)); + gpfs_offsets = (ADIO_Offset *) ADIOI_Malloc(2 * nprocs * sizeof(ADIO_Offset)); + for (ii = 0; ii < nprocs; ii++) { + gpfs_offsets0[ii * 2] = 0; + gpfs_offsets0[ii * 2 + 1] = 0; + } + gpfs_offsets0[myrank * 2] = start_offset; + gpfs_offsets0[myrank * 2 + 1] = end_offset; + + MPI_Allreduce(gpfs_offsets0, gpfs_offsets, nprocs * 2, ADIO_OFFSET, MPI_MAX, + fd->comm); + + for (ii = 0; ii < nprocs; ii++) { + st_offsets[ii] = gpfs_offsets[ii * 2]; + end_offsets[ii] = gpfs_offsets[ii * 2 + 1]; + } + } + ADIOI_Free(gpfs_offsets0); + } else { + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm); + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + MPI_Allgather(&my_count_size, 1, ADIO_OFFSET, count_sizes, 1, + ADIO_OFFSET, fd->comm); + } + } + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_PATANA, GPFSMPIO_CIO_T_GATHER); + + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + * for the moment. */ + } + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + if (fd->hints->cb_write == ADIOI_HINT_DISABLE || + (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) { + /* use independent accesses */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, error_code); + } else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code); + } else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + + return; + } + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_FD_PART, GPFSMPIO_CIO_T_PATANA) + +/* Divide the I/O workload among "nprocs_for_coll" processes. This is + done by (logically) dividing the file into file domains (FDs); each + process may directly access only its own file domain. */ + ADIO_Offset lastFileOffset = 0, firstFileOffset = -1; + int currentValidDataIndex = 0; + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + /* Take out the 0-data offsets by shifting the indexes with data to the front + * and keeping track of the valid data index for use as the length. + */ + for (i = 0; i < nprocs; i++) { + if (count_sizes[i] > 0) { + st_offsets[currentValidDataIndex] = st_offsets[i]; + end_offsets[currentValidDataIndex] = end_offsets[i]; + lastFileOffset = MPL_MAX(lastFileOffset, end_offsets[currentValidDataIndex]); + if (firstFileOffset == -1) + firstFileOffset = st_offsets[currentValidDataIndex]; + else + firstFileOffset = MPL_MIN(firstFileOffset, st_offsets[currentValidDataIndex]); + + currentValidDataIndex++; + } + } + } + + if (gpfsmpio_tuneblocking) { + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, + currentValidDataIndex, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + } else { + ADIOI_GPFS_Calc_file_domains(fd, st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + } + } else { + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + ADIOI_Calc_file_domains(st_offsets, end_offsets, currentValidDataIndex, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + } else { + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + } + } + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_MYREQ, GPFSMPIO_CIO_T_FD_PART); + + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + /* If the user has specified to use a one-sided aggregation method then do that at + * this point instead of the two-phase I/O. + */ + /* pass this datastructure to indicate we are a non-striping filesystem + * to the onesided algorithm by setting stripe size to 0. + */ + ADIOI_OneSidedStripeParms noStripeParms; + noStripeParms.stripeSize = 0; + noStripeParms.segmentLen = 0; + noStripeParms.stripesPerAgg = 0; + noStripeParms.segmentIter = 0; + noStripeParms.flushCB = 1; + noStripeParms.stripedLastFileOffset = 0; + noStripeParms.firstStripedWriteCall = 0; + noStripeParms.lastStripedWriteCall = 0; + noStripeParms.iWasUsedStripingAgg = 0; + noStripeParms.numStripesUsed = 0; + noStripeParms.amountOfStripedDataExpected = 0; + noStripeParms.bufTypeExtent = 0; + noStripeParms.lastDataTypeExtent = 0; + noStripeParms.lastFlatBufIndice = 0; + noStripeParms.lastIndiceOffset = 0; + + int holeFound = 0; + ADIOI_OneSidedWriteAggregation(fd, offset_list, len_list, contig_access_count, + buf, datatype, error_code, firstFileOffset, lastFileOffset, + currentValidDataIndex, fd_start, fd_end, &holeFound, + &noStripeParms); + int anyHolesFound = 0; + if (!romio_onesided_no_rmw) + MPI_Allreduce(&holeFound, &anyHolesFound, 1, MPI_INT, MPI_MAX, fd->comm); + if (anyHolesFound == 0) { + GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + ADIOI_Free(count_sizes); + goto fn_exit; + } else { + /* Holes are found in the data and the user has not set + * romio_onesided_no_rmw --- set romio_onesided_always_rmw to 1 + * and re-call ADIOI_OneSidedWriteAggregation and if the user has + * romio_onesided_inform_rmw set then inform him of this condition + * and behavior. + */ + + if (romio_onesided_inform_rmw && (myrank == 0)) + FPRINTF(stderr, "Information: Holes found during one-sided " + "write aggregation algorithm --- re-running one-sided " + "write aggregation with ROMIO_ONESIDED_ALWAYS_RMW set to 1.\n"); + romio_onesided_always_rmw = 1; + int prev_romio_onesided_no_rmw = romio_onesided_no_rmw; + romio_onesided_no_rmw = 1; + ADIOI_OneSidedWriteAggregation(fd, offset_list, len_list, contig_access_count, buf, + datatype, error_code, firstFileOffset, lastFileOffset, + currentValidDataIndex, fd_start, fd_end, &holeFound, + &noStripeParms); + romio_onesided_no_rmw = prev_romio_onesided_no_rmw; + GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + ADIOI_Free(count_sizes); + goto fn_exit; + } + } + if (gpfsmpio_p2pcontig == 1) { + /* For some simple yet common(?) workloads, full-on two-phase I/O is + * overkill. We can establish sub-groups of processes and their + * aggregator, and then these sub-groups will carry out a simplified + * two-phase over that sub-group. + * + * First verify that the filetype is contig and the offsets are + * increasing in rank order + */ + int inOrderAndNoGaps = 1; + for (i = 0; i < (nprocs - 1); i++) { + if (end_offsets[i] != (st_offsets[i + 1] - 1)) + inOrderAndNoGaps = 0; + } + if (inOrderAndNoGaps && buftype_is_contig) { + /* if these conditions exist then execute the P2PContig code else + * execute the original code */ + ADIOI_P2PContigWriteAggregation(fd, buf, + error_code, st_offsets, end_offsets, fd_start, fd_end); + /* NOTE: we are skipping the rest of two-phase in this path */ + GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs); + + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + goto fn_exit; + } + } + +/* calculate what portions of the access requests of this process are + located in what file domains */ + + if (gpfsmpio_tuneblocking) + ADIOI_GPFS_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, &buf_idx); + else + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, &count_my_req_per_proc, &my_req, &buf_idx); + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_OTHREQ, GPFSMPIO_CIO_T_MYREQ); + + /* based on everyone's my_req, calculate what requests of other + * processes lie in this process's file domain. + * count_others_req_procs = number of processes whose requests lie in + * this process's file domain (including this process itself) + * count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i lie in this process's file domain. + */ + if (gpfsmpio_tuneblocking) + ADIOI_GPFS_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + else + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + + GPFSMPIO_T_CIO_SET_GET(w, 1, 1, GPFSMPIO_CIO_T_DEXCH, GPFSMPIO_CIO_T_OTHREQ); + + ADIOI_Free(count_my_req_per_proc); + ADIOI_Free(my_req[0].offsets); + ADIOI_Free(my_req); + + /* exchange data and write in sizes of no more than coll_bufsize. */ + ADIOI_Exch_and_write(fd, buf, datatype, nprocs, myrank, + others_req, offset_list, + len_list, contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, buf_idx, error_code); + + GPFSMPIO_T_CIO_SET_GET(w, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_DEXCH); + GPFSMPIO_T_CIO_SET_GET(w, 0, 1, GPFSMPIO_CIO_LAST, GPFSMPIO_CIO_T_MPIO_CRW); + GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs); + + /* free all memory allocated for collective I/O */ + if (others_req[0].offsets) { + ADIOI_Free(others_req[0].offsets); + } + if (others_req[0].mem_ptrs) { + ADIOI_Free(others_req[0].mem_ptrs); + } + ADIOI_Free(others_req); + + ADIOI_Free(buf_idx); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status) { + MPI_Count bufsize, size; + /* Don't set status if it isn't needed */ + MPI_Type_size_x(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); + } +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written during collective I/O. */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5013, 0, NULL); +#endif +} + +static void gpfs_wr_access_start(int fd, ADIO_Offset offset, ADIO_Offset length) +{ + int rc = 0; +#ifdef HAVE_GPFS_FCNTL_H + struct { + gpfsFcntlHeader_t header; + gpfsAccessRange_t access; + } take_locks; + + take_locks.header.totalLength = sizeof(take_locks); + take_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + take_locks.header.fcntlReserved = 0; + + take_locks.access.structLen = sizeof(take_locks.access); + take_locks.access.structType = GPFS_ACCESS_RANGE; + take_locks.access.start = offset; + take_locks.access.length = length; + take_locks.access.isWrite = 1; + + rc = gpfs_fcntl(fd, &take_locks); +#endif + ADIOI_Assert(rc == 0); +} + +static void gpfs_wr_access_end(int fd, ADIO_Offset offset, ADIO_Offset length) +{ + int rc = 0; +#ifdef HAVE_GPFS_FCNTL_H + struct { + gpfsFcntlHeader_t header; + gpfsFreeRange_t free; + } free_locks; + + + free_locks.header.totalLength = sizeof(free_locks); + free_locks.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + free_locks.header.fcntlReserved = 0; + + free_locks.free.structLen = sizeof(free_locks.free); + free_locks.free.structType = GPFS_FREE_RANGE; + free_locks.free.start = offset; + free_locks.free.length = length; + + rc = gpfs_fcntl(fd, &free_locks); +#endif + ADIOI_Assert(rc == 0); +} + +#ifdef BGQPLATFORM +/* my_start, my_end: this processes file domain. coudd be -1,-1 for "no i/o" + * fd_start, fd_end: arrays of length fd->hints->cb_nodes specifying all file domains */ +static int gpfs_find_access_for_ion(ADIO_File fd, + ADIO_Offset my_start, ADIO_Offset my_end, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIO_Offset * start, ADIO_Offset * end) +{ + int my_ionode = BGQ_IO_node_id(); + int *rank_to_ionode; + int i, nprocs, rank; + ADIO_Offset group_start = LLONG_MAX, group_end = 0; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &rank); + + rank_to_ionode = ADIOI_Calloc(nprocs, sizeof(int)); + MPI_Allgather(&my_ionode, 1, MPI_INT, rank_to_ionode, 1, MPI_INT, fd->comm); + + /* rank_to_ionode now contains a mapping from MPI rank to IO node */ + /* fd->hints->ranklist[] contains a list of MPI ranks that are aggregators */ + /* fd_start[] and fd_end[] contain a list of file domains. */ + + /* what we really want to do is take all the file domains associated + * with a given i/o node and find the begin/end of that range. + * + * Because gpfs_fcntl hints are expected to be released, we'll pass this + * start/end back to the caller, who will both declare and free this range + */ + if (my_start == -1 || my_end == -1) { + ADIOI_Free(rank_to_ionode); + return 0; /* no work to do */ + } + + for (i = 0; i < fd->hints->cb_nodes; i++) { + if (my_ionode == rank_to_ionode[fd->hints->ranklist[i]]) { + group_start = MPL_MIN(fd_start[i], group_start); + group_end = MPL_MAX(fd_end[i], group_end); + } + } + *start = group_start; + *end = group_end; + ADIOI_Free(rank_to_ionode); + return 1; +} +#endif // BGQPLATFORM + + +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ +static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, + ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code) +{ +/* Send data to appropriate processes and write in sizes of no more + than coll_bufsize. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were written all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to write a distributed + array to a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ + ADIO_Offset size = 0; + int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, off, done, req_off; + char *write_buf = NULL, *write_buf2 = NULL; + int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; + int *partial_recv, *sent_to_proc, *start_pos, flag; + int *send_buf_idx, *curr_to_proc, *done_to_proc; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint lb, buftype_extent; + int info_flag, coll_bufsize; + char *value; + static char myname[] = "ADIOI_EXCH_AND_WRITE"; + pthread_t io_thread; + void *thread_ret; + ADIOI_IO_ThreadFuncData io_thread_args; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of writes of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); + coll_bufsize = atoi(value); + ADIOI_Free(value); + + if (gpfsmpio_pthreadio == 1) { + /* ROMIO will spawn an additional thread. both threads use separate + * halves of the collective buffer*/ + coll_bufsize = coll_bufsize / 2; + } + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + for (i = 0; i < nprocs; i++) + for (j = 0; j < others_req[i].count; j++) { + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + +/* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ + + ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); + + if ((st_loc == -1) && (end_loc == -1)) { + ntimes = 0; /* this process does no writing. */ + } + if (ntimes > 0) { /* only set the gpfs hint if we have io - ie this rank is + * an aggregator -- otherwise will fail for deferred open */ + if (getenv("ROMIO_GPFS_DECLARE_ACCESS") != NULL) { + gpfs_wr_access_start(fd->fd_sys, st_loc, end_loc - st_loc); + } + } + + ADIO_Offset st_loc_ion = 0, end_loc_ion = 0, needs_gpfs_access_cleanup = 0; +#ifdef BGQPLATFORM + if (ntimes > 0) { /* only set the gpfs hint if we have io - ie this rank is + * an aggregator -- otherwise will fail for deferred open */ + + if (getenv("ROMIO_GPFS_DECLARE_ION_ACCESS") != NULL) { + if (gpfs_find_access_for_ion(fd, st_loc, end_loc, fd_start, fd_end, + &st_loc_ion, &end_loc_ion)) { + gpfs_wr_access_start(fd->fd_sys, st_loc_ion, end_loc_ion - st_loc_ion); + needs_gpfs_access_cleanup = 1; + } + } + } +#endif + + MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); + + write_buf = fd->io_buf; + if (gpfsmpio_pthreadio == 1) { + write_buf2 = fd->io_buf + coll_bufsize; + } + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* to store count of how many off-len pairs per proc are satisfied + * in an iteration. */ + + partial_recv = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* if only a portion of the last off-len pair is recd. from a process + * in a particular iteration, the length recd. is stored here. + * calloc initializes to 0. */ + + send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be sent to each proc. in an iteration. + * Of size nprocs so that I can use MPI_Alltoall later. */ + + recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration. */ + + sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* amount of data sent to each proc so far. Used in + * ADIOI_Fill_send_buffer. initialized to 0 here. */ + + send_buf_idx = (int *) ADIOI_Malloc(nprocs * 3 * sizeof(int)); + curr_to_proc = send_buf_idx + nprocs; + done_to_proc = curr_to_proc + nprocs; + /* Above three are used in ADIOI_Fill_send_buffer */ + + start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* used to store the starting value of curr_offlen_ptr[i] in + * this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + } + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + + +/* I need to check if there are any outstanding nonblocking writes to + the file, which could potentially interfere with the writes taking + place in this collective write call. Since this is not likely to be + common, let me do the simplest thing possible here: Each process + completes all pending nonblocking operations before completing. */ + + /*ADIOI_Complete_async(error_code); + * if (*error_code != MPI_SUCCESS) return; + * MPI_Barrier(fd->comm); + */ + + done = 0; + off = st_loc; + + if (gpfsmpio_pthreadio == 1) + io_thread = pthread_self(); + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); +#endif + + for (m = 0; m < ntimes; m++) { + /* go through all others_req and check which will be satisfied + * by the current write */ + + /* Note that MPI guarantees that displacements in filetypes are in + * monotonically nondecreasing order and that, for writes, the + * filetypes cannot specify overlapping regions in the file. This + * simplifies implementation a bit compared to reads. */ + + /* off = start offset in the file for the data to be written in + * this iteration + * size = size of data written (bytes) corresponding to off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ + + /* first calculate what should be communicated */ + +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; + + size = MPL_MIN((unsigned) coll_bufsize, end_loc - st_loc + 1 - done); + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + start_pos[i] = curr_offlen_ptr[i]; + for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { + if (partial_recv[i]) { + /* this request may have been partially + * satisfied in the previous iteration. */ + req_off = others_req[i].offsets[j] + partial_recv[i]; + req_len = others_req[i].lens[j] - partial_recv[i]; + partial_recv[i] = 0; + /* modify the off-len pair to reflect this change */ + others_req[i].offsets[j] = req_off; + others_req[i].lens[j] = req_len; + } else { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + } + if (req_off < off + size) { + count[i]++; + ADIOI_Assert((((ADIO_Offset) (uintptr_t) write_buf) + req_off - off) == + (ADIO_Offset) (uintptr_t) (write_buf + req_off - off)); + MPI_Get_address(write_buf + req_off - off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((off + size - req_off) == (int) (off + size - req_off)); + recv_size[i] += (int) (MPL_MIN(off + size - req_off, (unsigned) req_len)); + + if (off + size - req_off < (unsigned) req_len) { + partial_recv[i] = (int) (off + size - req_off); + + /* --BEGIN ERROR HANDLING-- */ + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < off + size)) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, + __LINE__, + MPI_ERR_ARG, + "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", + 0); + /* allow to continue since additional + * communication might have to occur + */ + } + /* --END ERROR HANDLING-- */ + break; + } + } else + break; + } + curr_offlen_ptr[i] = j; + } + } + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); + MPE_Log_event(7, 0, "start communication"); +#endif + if (gpfsmpio_comm == 1) + ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, curr_to_proc, + done_to_proc, &hole, m, buftype_extent, buf_idx, error_code); + else if (gpfsmpio_comm == 0) + ADIOI_W_Exchange_data_alltoallv(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, curr_to_proc, + done_to_proc, &hole, m, buftype_extent, buf_idx, + error_code); + if (*error_code != MPI_SUCCESS) + return; +#ifdef PROFILE + MPE_Log_event(8, 0, "end communication"); +#endif + + flag = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) + flag = 1; + + if (flag) { + char round[50]; + MPL_snprintf(round, sizeof(round), "two-phase-round=%d", m); + setenv("LIBIOLOG_EXTRA_INFO", round, 1); + ADIOI_Assert(size == (int) size); + if (gpfsmpio_pthreadio == 1) { + /* there is no such thing as "invalid pthread identifier", so + * we'll use pthread_self() instead. Before we do I/O we want + * to complete I/O from any previous iteration -- but only a + * previous iteration that had I/O work to do (i.e. set 'flag') + */ + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + io_thread_args.fd = fd; + /* do a little pointer shuffling: background I/O works from one + * buffer while two-phase machinery fills up another */ + io_thread_args.buf = write_buf; + write_buf = write_buf2; + write_buf2 = io_thread_args.buf; + io_thread_args.io_kind = ADIOI_WRITE; + io_thread_args.size = size; + io_thread_args.offset = off; + io_thread_args.status = &status; + io_thread_args.error_code = *error_code; + if ((pthread_create(&io_thread, NULL, + ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) + io_thread = pthread_self(); + } else { + ADIO_WriteContig(fd, write_buf, (int) size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + } + + off += size; + done += size; + } + if (gpfsmpio_pthreadio == 1) { + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + } + } + + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; +#ifdef PROFILE + MPE_Log_event(7, 0, "start communication"); +#endif + for (m = ntimes; m < max_ntimes; m++) + /* nothing to recv, but check for send. */ + if (gpfsmpio_comm == 1) + ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, + curr_to_proc, done_to_proc, &hole, m, + buftype_extent, buf_idx, error_code); + else if (gpfsmpio_comm == 0) + ADIOI_W_Exchange_data_alltoallv(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, + curr_to_proc, done_to_proc, &hole, m, + buftype_extent, buf_idx, error_code); + if (*error_code != MPI_SUCCESS) + return; +#ifdef PROFILE + MPE_Log_event(8, 0, "end communication"); +#endif + + ADIOI_Free(curr_offlen_ptr); + ADIOI_Free(count); + ADIOI_Free(partial_recv); + ADIOI_Free(send_size); + ADIOI_Free(recv_size); + ADIOI_Free(sent_to_proc); + ADIOI_Free(start_pos); + ADIOI_Free(send_buf_idx); + + if (ntimes != 0 && getenv("ROMIO_GPFS_DECLARE_ACCESS") != NULL) { + gpfs_wr_access_end(fd->fd_sys, st_loc, end_loc - st_loc); + } + + if (needs_gpfs_access_cleanup) { + gpfs_wr_access_end(fd->fd_sys, st_loc_ion, end_loc_ion - st_loc_ion); + needs_gpfs_access_cleanup = 0; + } + + unsetenv("LIBIOLOG_EXTRA_INFO"); +} + + +/* Sets error_code to MPI_SUCCESS if successful, or creates an error code + * in the case of error. + */ +static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf, + ADIOI_Flatlist_node * flat_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, int size, + int *count, int *start_pos, + int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int *hole, int iter, + MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code) +{ + int i, j, k, *tmp_len, nprocs_recv, nprocs_send, err; + char **send_buf = NULL; + MPI_Request *requests, *send_req; + MPI_Datatype *recv_types; + MPI_Status *statuses, status; + int *srt_len, sum; + ADIO_Offset *srt_off; + static char myname[] = "ADIOI_W_EXCHANGE_DATA"; + +/* exchange recv_size info so that each process knows how much to + send to whom. */ + + MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); + + /* create derived datatypes for recv */ + + nprocs_recv = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + nprocs_recv++; + + recv_types = (MPI_Datatype *) + ADIOI_Malloc((nprocs_recv + 1) * sizeof(MPI_Datatype)); +/* +1 to avoid a 0-size malloc */ + + tmp_len = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { +/* take care if the last off-len pair is a partial recv */ + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + tmp_len[i] = others_req[i].lens[k]; + others_req[i].lens[k] = partial_recv[i]; + } + ADIOI_Type_create_hindexed_x(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, recv_types + j); + /* absolute displacements; use MPI_BOTTOM in recv */ + MPI_Type_commit(recv_types + j); + j++; + } + } + + /* To avoid a read-modify-write, check if there are holes in the + * data to be written. For this, merge the (sorted) offset lists + * others_req using a heap-merge. */ + + sum = 0; + for (i = 0; i < nprocs; i++) + sum += count[i]; + srt_off = (ADIO_Offset *) ADIOI_Malloc((sum + 1) * sizeof(ADIO_Offset)); + srt_len = (int *) ADIOI_Malloc((sum + 1) * sizeof(int)); + /* +1 to avoid a 0-size malloc */ + + ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, nprocs, nprocs_recv, sum); + +/* for partial recvs, restore original lengths */ + for (i = 0; i < nprocs; i++) + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + others_req[i].lens[k] = tmp_len[i]; + } + ADIOI_Free(tmp_len); + + /* check if there are any holes. If yes, must do read-modify-write. + * holes can be in three places. 'middle' is what you'd expect: the + * processes are operating on noncontigous data. But holes can also show + * up at the beginning or end of the file domain (see John Bent ROMIO REQ + * #835). Missing these holes would result in us writing more data than + * recieved by everyone else. */ + *hole = 0; + if (off != srt_off[0]) /* hole at the front */ + *hole = 1; + else { /* coalesce the sorted offset-length pairs */ + for (i = 1; i < sum; i++) { + if (srt_off[i] <= srt_off[0] + srt_len[0]) { + int new_len = srt_off[i] + srt_len[i] - srt_off[0]; + if (new_len > srt_len[0]) + srt_len[0] = new_len; + } else + break; + } + if (i < sum || size != srt_len[0]) /* hole in middle or end */ + *hole = 1; + } + + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + + if (nprocs_recv) { + if (*hole) { + const char *stuff = "data-sieve-in-two-phase"; + setenv("LIBIOLOG_EXTRA_INFO", stuff, 1); + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, &err); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**ioRMWrdwr", 0); + return; + } + /* --END ERROR HANDLING-- */ + unsetenv("LIBIOLOG_EXTRA_INFO"); + } + } + + nprocs_send = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) + nprocs_send++; + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Request)); + send_req = requests; + } else { + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, requests + j); + j++; + } + } + send_req = requests + nprocs_recv; + } + +/* post sends. if buftype_is_contig, data can be directly sent from + user buf at location given by buf_idx. else use send_buf. */ + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, send_req + j); + j++; + buf_idx[i] += send_size[i]; + } + } else if (nprocs_send) { + /* buftype is not contig */ + size_t msgLen = 0; + for (i = 0; i < nprocs; i++) + msgLen += send_size[i]; + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + send_buf[0] = (char *) ADIOI_Malloc(msgLen * sizeof(char)); + for (i = 1; i < nprocs; i++) + send_buf[i] = send_buf[i - 1] + send_size[i - 1]; + + ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, + offset_list, len_list, send_size, + send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + send_buf_idx, curr_to_proc, done_to_proc, iter, buftype_extent); + /* the send is done in ADIOI_Fill_send_buffer */ + } + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + j = 0; + for (i = 0; i < nprocs; i++) { + MPI_Status wkl_status; + if (recv_size[i]) { + MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, &wkl_status); + j++; + } + } + } + + for (i = 0; i < nprocs_recv; i++) + MPI_Type_free(recv_types + i); + ADIOI_Free(recv_types); + +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } +#endif + +#ifdef NEEDS_MPI_TEST + i = 0; + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) + MPI_Testall(nprocs_send, send_req, &i, statuses); + } else { + while (!i) + MPI_Testall(nprocs_send + nprocs_recv, requests, &i, statuses); + } +#else + if (fd->atomicity) + /* bug fix from Wei-keng Liao and Kenin Coloma */ + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send + nprocs_recv, requests, statuses); +#endif + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + ADIOI_Free(requests); + if (!buftype_is_contig && nprocs_send) { + ADIOI_Free(send_buf[0]); + ADIOI_Free(send_buf); + } +} + + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = MPL_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(uintptr_t)buf) + user_buf_idx) == (ADIO_Offset)(uintptr_t)((uintptr_t)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(&(send_buf[p][send_buf_idx[p]]), \ + ((char *) buf) + user_buf_idx, size_in_buf); \ + send_buf_idx[p] += size_in_buf; \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + +static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent) +{ +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + +/* curr_to_proc[p] = amount of data sent to proc. p that has already + been accounted for so far + done_to_proc[p] = amount of data already sent to proc. p in + previous iterations + user_buf_idx = current location in user buffer + send_buf_idx[p] = current location in send_buf of proc. p */ + + for (i = 0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in + * flattened buf */ + + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = len_list[i]; + + /*this request may span the file domains of more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &len, fd_size, fd_start, fd_end); + + if (send_buf_idx[p] < send_size[p]) { + if (curr_to_proc[p] + len > done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = MPL_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p] - send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == + (unsigned) (curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == + (unsigned) (done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY} else { + size = MPL_MIN(len, send_size[p] - send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY} + if (send_buf_idx[p] == send_size[p]) { + MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank + p + 100 * iter, fd->comm, requests + jj); + jj++; + } + } else { + ADIOI_Assert((curr_to_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + len)); + curr_to_proc[p] += len; + buf_incr = len; + ADIOI_BUF_INCR} + } else { + buf_incr = len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (send_size[i]) + sent_to_proc[i] = curr_to_proc[i]; +} + + + +static void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements) +{ + typedef struct { + ADIO_Offset *off_list; + ADIO_Offset *len_list; + int nelem; + } heap_struct; + + heap_struct *a, tmp; + int i, j, heapsize, l, r, k, smallest; + + a = (heap_struct *) ADIOI_Malloc((nprocs_recv + 1) * sizeof(heap_struct)); + + j = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) { + a[j].off_list = &(others_req[i].offsets[start_pos[i]]); + a[j].len_list = &(others_req[i].lens[start_pos[i]]); + a[j].nelem = count[i]; + j++; + } + + /* build a heap out of the first element from each list, with + * the smallest element of the heap at the root */ + + heapsize = nprocs_recv; + for (i = heapsize / 2 - 1; i >= 0; i--) { + /* Heapify(a, i, heapsize); Algorithm from Cormen et al. pg. 143 + * modified for a heap with smallest element at root. I have + * removed the recursion so that there are no function calls. + * Function calls are too expensive. */ + k = i; + while (1) { + l = 2 * (k + 1) - 1; + r = 2 * (k + 1); + + if ((l < heapsize) && (*(a[l].off_list) < *(a[k].off_list))) + smallest = l; + else + smallest = k; + + if ((r < heapsize) && (*(a[r].off_list) < *(a[smallest].off_list))) + smallest = r; + + if (smallest != k) { + tmp.off_list = a[k].off_list; + tmp.len_list = a[k].len_list; + tmp.nelem = a[k].nelem; + + a[k].off_list = a[smallest].off_list; + a[k].len_list = a[smallest].len_list; + a[k].nelem = a[smallest].nelem; + + a[smallest].off_list = tmp.off_list; + a[smallest].len_list = tmp.len_list; + a[smallest].nelem = tmp.nelem; + + k = smallest; + } else + break; + } + } + + for (i = 0; i < total_elements; i++) { + /* extract smallest element from heap, i.e. the root */ + srt_off[i] = *(a[0].off_list); + srt_len[i] = *(a[0].len_list); + (a[0].nelem)--; + + if (!a[0].nelem) { + a[0].off_list = a[heapsize - 1].off_list; + a[0].len_list = a[heapsize - 1].len_list; + a[0].nelem = a[heapsize - 1].nelem; + heapsize--; + } else { + (a[0].off_list)++; + (a[0].len_list)++; + } + + /* Heapify(a, 0, heapsize); */ + k = 0; + while (1) { + l = 2 * (k + 1) - 1; + r = 2 * (k + 1); + + if ((l < heapsize) && (*(a[l].off_list) < *(a[k].off_list))) + smallest = l; + else + smallest = k; + + if ((r < heapsize) && (*(a[r].off_list) < *(a[smallest].off_list))) + smallest = r; + + if (smallest != k) { + tmp.off_list = a[k].off_list; + tmp.len_list = a[k].len_list; + tmp.nelem = a[k].nelem; + + a[k].off_list = a[smallest].off_list; + a[k].len_list = a[smallest].len_list; + a[k].nelem = a[smallest].nelem; + + a[smallest].off_list = tmp.off_list; + a[smallest].len_list = tmp.len_list; + a[smallest].nelem = tmp.nelem; + + k = smallest; + } else + break; + } + } + + ADIOI_Free(a); +} + + +static void ADIOI_W_Exchange_data_alltoallv(ADIO_File fd, const void *buf, char *write_buf, /* 1 */ + ADIOI_Flatlist_node * flat_buf, ADIO_Offset * offset_list, ADIO_Offset * len_list, int *send_size, int *recv_size, ADIO_Offset off, int size, /* 2 */ + int *count, int *start_pos, int *partial_recv, int *sent_to_proc, int nprocs, int myrank, int buftype_is_contig, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end, ADIOI_Access * others_req, int *send_buf_idx, int *curr_to_proc, /* 3 */ + int *done_to_proc, int *hole, /* 4 */ + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx, + int *error_code) +{ + int i, j, k = 0, nprocs_recv, nprocs_send, *tmp_len, err; + char **send_buf = NULL; + MPI_Request *send_req = NULL; + MPI_Status status; + int rtail, stail; + char *sbuf_ptr, *to_ptr; + int len; + int *sdispls, *rdispls; + char *all_recv_buf, *all_send_buf; + int *srt_len, sum; + ADIO_Offset *srt_off; + static char myname[] = "ADIOI_W_EXCHANGE_DATA"; + double io_time; + + io_time = MPI_Wtime(); + /* exchange recv_size info so that each process knows how much to + * send to whom. */ + MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); + + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_RECV_EXCH] += MPI_Wtime() - io_time; + io_time = MPI_Wtime(); + + nprocs_recv = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) { + nprocs_recv++; + } + nprocs_send = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + nprocs_send++; + } + + /* receiver side data structures */ + rdispls = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + rtail = 0; + for (i = 0; i < nprocs; i++) { + rdispls[i] = rtail; + rtail += recv_size[i]; + } + + /* data buffer */ + all_recv_buf = (char *) ADIOI_Malloc(rtail); + + /* sender side data structures */ + sdispls = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + stail = 0; + for (i = 0; i < nprocs; i++) { + sdispls[i] = stail; + stail += send_size[i]; + } + + /* data buffer */ + all_send_buf = (char *) ADIOI_Malloc(stail); + if (buftype_is_contig) { + for (i = 0; i < nprocs; i++) { + if (send_size[i]) { + sbuf_ptr = all_send_buf + sdispls[i]; + memcpy(sbuf_ptr, (char *) buf + buf_idx[i], send_size[i]); + buf_idx[i] += send_size[i]; + } + } + } else { + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + for (i = 0; i < nprocs; i++) + send_buf[i] = all_send_buf + sdispls[i]; + ADIOI_Fill_send_buffer_nosend(fd, buf, flat_buf, send_buf, + offset_list, len_list, send_size, + send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + send_buf_idx, curr_to_proc, done_to_proc, iter, + buftype_extent); + ADIOI_Free(send_buf); + } + + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += MPI_Wtime() - io_time; + + io_time = MPI_Wtime(); + /* alltoallv */ + MPI_Alltoallv(all_send_buf, send_size, sdispls, MPI_BYTE, + all_recv_buf, recv_size, rdispls, MPI_BYTE, fd->comm); + + ADIOI_Free(all_send_buf); + ADIOI_Free(sdispls); + + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_NET] += MPI_Wtime() - io_time; + io_time = MPI_Wtime(); + /* data sieving pre-read */ + /* To avoid a read-modify-write, check if there are holes in the + * data to be written. For this, merge the (sorted) offset lists + * others_req using a heap-merge. */ + + sum = 0; + for (i = 0; i < nprocs; i++) + sum += count[i]; + srt_off = (ADIO_Offset *) ADIOI_Malloc((sum + 1) * sizeof(ADIO_Offset)); + srt_len = (int *) ADIOI_Malloc((sum + 1) * sizeof(int)); + + ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, nprocs, nprocs_recv, sum); + + /* check if there are any holes */ + *hole = 0; + /* See if there are holes before the first request or after the last request */ + if ((srt_off[0] > off) || ((srt_off[sum - 1] + srt_len[sum - 1]) < (off + size))) { + *hole = 1; + } else /* See if there are holes between the requests, if there are more than one */ + for (i = 0; i < sum - 1; i++) + if (srt_off[i] + srt_len[i] < srt_off[i + 1]) { + *hole = 1; + break; + } + + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SORT] += MPI_Wtime() - io_time; + io_time = MPI_Wtime(); + if (nprocs_recv) { + if (*hole) { + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, &err); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**ioRMWrdwr", 0); + return; + } + /* --END ERROR HANDLING-- */ + } + } + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SIEVE] += MPI_Wtime() - io_time; + + /* scater all_recv_buf into 4M cb_buffer */ + tmp_len = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + tmp_len[i] = others_req[i].lens[k]; + others_req[i].lens[k] = partial_recv[i]; + } + + sbuf_ptr = all_recv_buf + rdispls[i]; + for (j = 0; j < count[i]; j++) { + to_ptr = + (char *) ADIOI_AINT_CAST_TO_VOID_PTR(others_req[i].mem_ptrs[start_pos[i] + j]); + len = others_req[i].lens[start_pos[i] + j]; + memcpy(to_ptr, sbuf_ptr, len); + sbuf_ptr += len; + } + + /* restore */ + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + others_req[i].lens[k] = tmp_len[i]; + } + + } + } + + ADIOI_Free(tmp_len); + ADIOI_Free(all_recv_buf); + ADIOI_Free(rdispls); + return; +} + +static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent) +{ +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + +/* curr_to_proc[p] = amount of data sent to proc. p that has already + been accounted for so far + done_to_proc[p] = amount of data already sent to proc. p in + previous iterations + user_buf_idx = current location in user buffer + send_buf_idx[p] = current location in send_buf of proc. p */ + + for (i = 0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in + * flattened buf */ + + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = len_list[i]; + + /*this request may span the file domains of more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_GPFS_Calc_aggregator(fd, off, min_st_offset, &len, fd_size, fd_start, fd_end); + + if (send_buf_idx[p] < send_size[p]) { + if (curr_to_proc[p] + len > done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = MPL_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p] - send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == + (unsigned) (curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == + (unsigned) (done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY} else { + size = MPL_MIN(len, send_size[p] - send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY} + /* moved to alltoallv */ + /* + * if (send_buf_idx[p] == send_size[p]) { + * MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + * myrank+p+100*iter, fd->comm, requests+jj); + * jj++; + * } + */ + } else { + ADIOI_Assert((curr_to_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + len)); + curr_to_proc[p] += (int) len; + buf_incr = len; + ADIOI_BUF_INCR} + } else { + buf_incr = len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (send_size[i]) + sent_to_proc[i] = curr_to_proc[i]; +} diff --git a/3rd-party/romio321/adio/ad_gpfs/bg/Makefile.mk b/3rd-party/romio341/adio/ad_gpfs/bg/Makefile.mk similarity index 73% rename from 3rd-party/romio321/adio/ad_gpfs/bg/Makefile.mk rename to 3rd-party/romio341/adio/ad_gpfs/bg/Makefile.mk index 1d957ef8f6f1ded0989044a953f59875ed15e558..682a85c98eb998d8c46154057275a5293f2a8380 100644 --- a/3rd-party/romio321/adio/ad_gpfs/bg/Makefile.mk +++ b/3rd-party/romio341/adio/ad_gpfs/bg/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2012 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_BG diff --git a/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.c b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.c new file mode 100644 index 0000000000000000000000000000000000000000..d58c472265c4920ee83c20e8eab3fad342f7aa8b --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.c @@ -0,0 +1,679 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_bg_aggrs.c + * \brief The externally used function from this file is is declared in ad_bg_aggrs.h + */ + +/*#define TRACE_ON */ + +// Uncomment this line to turn tracing on for the gpfsmpio_balancecontig aggr selection optimization +// #define balancecontigtrace 1 +// #define bridgeringaggtrace 1 + +#include "adio.h" +#include "adio_cb_config_list.h" +#include "../ad_gpfs.h" +#include "ad_bg_pset.h" +#include "ad_bg_aggrs.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + + +#ifdef MPL_USE_DBG_LOGGING +#define AGG_DEBUG 1 +#endif + +#ifndef TRACE_ERR +#define TRACE_ERR(format...) +#endif + +/* Comments copied from common: + * This file contains four functions: + * + * ADIOI_Calc_aggregator() + * ADIOI_Calc_file_domains() + * ADIOI_Calc_my_req() + * ADIOI_Calc_others_req() + * + * The last three of these were originally in ad_read_coll.c, but they are + * also shared with ad_write_coll.c. I felt that they were better kept with + * the rest of the shared aggregation code. + */ + +/* Discussion of values available from above: + * + * ADIO_Offset st_offsets[0..nprocs-1] + * ADIO_Offset end_offsets[0..nprocs-1] + * These contain a list of start and end offsets for each process in + * the communicator. For example, an access at loc 10, size 10 would + * have a start offset of 10 and end offset of 19. + * int nprocs + * number of processors in the collective I/O communicator + * ADIO_Offset min_st_offset + * ADIO_Offset fd_start[0..nprocs_for_coll-1] + * starting location of "file domain"; region that a given process will + * perform aggregation for (i.e. actually do I/O) + * ADIO_Offset fd_end[0..nprocs_for_coll-1] + * start + size - 1 roughly, but it can be less, or 0, in the case of + * uneven distributions + */ + +/* forward declaration */ +static void +ADIOI_BG_compute_agg_ranklist_serial(ADIO_File fd, + const ADIOI_BG_ConfInfo_t * confInfo, + ADIOI_BG_ProcInfo_t * all_procInfo); + +/* + * Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. + * The parameters are + * . the number of aggregators (proxies) : fd->hints->cb_nodes + * . the ranks of the aggregators : fd->hints->ranklist + * By compute these two parameters in a BG-PSET-aware way, the default 2-phase collective IO of + * ADIO can work more efficiently. + */ +int ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset) +{ + int r, s; + ADIOI_BG_ProcInfo_t *procInfo, *all_procInfo; + ADIOI_BG_ConfInfo_t *confInfo; + TRACE_ERR("Entering ADIOI_BG_gen_agg_ranklist\n"); + + MPI_Comm_size(fd->comm, &s); + MPI_Comm_rank(fd->comm, &r); + + /* Collect individual BG personality information */ + confInfo = ADIOI_BG_ConfInfo_new(); + procInfo = ADIOI_BG_ProcInfo_new(); + ADIOI_BG_persInfo_init(confInfo, procInfo, s, r, n_aggrs_per_pset, fd->comm); + + /* Gather BG personality infomation onto process 0 */ + /* if (r == 0) */ + all_procInfo = ADIOI_BG_ProcInfo_new_n(s); + + MPI_Gather((void *) procInfo, sizeof(ADIOI_BG_ProcInfo_t), MPI_BYTE, + (void *) all_procInfo, sizeof(ADIOI_BG_ProcInfo_t), MPI_BYTE, 0, fd->comm); + + /* Compute a list of the ranks of chosen IO proxy CN on process 0 */ + if (r == 0) { + ADIOI_BG_compute_agg_ranklist_serial(fd, confInfo, all_procInfo); + /* ADIOI_BG_ProcInfo_free (all_procInfo); */ + } + ADIOI_BG_ProcInfo_free(all_procInfo); + + /* Send the info of IO proxy CN to all processes and keep the info in fd->hints struct. + * Declared in adio_cb_config_list.h */ + ADIOI_cb_bcast_rank_map(fd); + if (gpfsmpio_balancecontig == 1) { /* additionally need to send bridgelist, + * bridgelistnum and numbridges to all + * ranks */ + if (r != 0) { + fd->hints->fs_hints.bg.bridgelist = ADIOI_Malloc(fd->hints->cb_nodes * sizeof(int)); + if (fd->hints->fs_hints.bg.bridgelist == NULL) { + /* NEED TO HANDLE ENOMEM */ + } + } + MPI_Bcast(fd->hints->fs_hints.bg.bridgelist, fd->hints->cb_nodes, MPI_INT, 0, fd->comm); + + if (r != 0) { + fd->hints->fs_hints.bg.bridgelistnum = ADIOI_Malloc(fd->hints->cb_nodes * sizeof(int)); + if (fd->hints->fs_hints.bg.bridgelistnum == NULL) { + /* NEED TO HANDLE ENOMEM */ + } + } + MPI_Bcast(fd->hints->fs_hints.bg.bridgelistnum, fd->hints->cb_nodes, MPI_INT, 0, fd->comm); + + MPI_Bcast(&fd->hints->fs_hints.bg.numbridges, 1, MPI_INT, 0, fd->comm); + + } + + + ADIOI_BG_persInfo_free(confInfo, procInfo); + TRACE_ERR("Leaving ADIOI_BG_gen_agg_ranklist\n"); + return 0; +} + + +/* There are some number of bridge nodes (randomly) distributed through the job + * We need to split the nodes among the bridge nodes */ +/* Maybe find which bridge node is closer (manhattan distance) and try to + * distribute evenly. + */ +/* + * Pick IO aggregators based on the under PSET organization and stores the ranks of the proxy CNs in tmp_ranklist. + * The first order of tmp_ranklist is : PSET number + * The secondary order of the list is determined in ADIOI_BG_select_agg_in_pset() and thus adjustable. + */ +typedef struct { + int rank; + int bridge; +} sortstruct; + +typedef struct { + int bridgeRank; + int numAggsAssigned; +} bridgeAggAssignment; + +static int intsort(const void *p1, const void *p2) +{ + sortstruct *i1, *i2; + i1 = (sortstruct *) p1; + i2 = (sortstruct *) p2; + return (i1->bridge - i2->bridge); +} + +static int +ADIOI_BG_compute_agg_ranklist_serial_do(const ADIOI_BG_ConfInfo_t * confInfo, + ADIOI_BG_ProcInfo_t * all_procInfo, int *tmp_ranklist) +{ + TRACE_ERR("Entering ADIOI_BG_compute_agg_ranklist_serial_do\n"); + /* BES: This should be done in the init routines probably. */ + int i, j; + int aggTotal; + int *aggList; + + if (gpfsmpio_bridgeringagg > 0) { + + int numAggs = confInfo->aggRatio * confInfo->ioMinSize /*virtualPsetSize */ ; + /* the number of aggregators is (numAggs per bridgenode) */ + if (numAggs == 1) + aggTotal = 1; + else + aggTotal = confInfo->numBridgeRanks * numAggs; + + aggList = (int *) ADIOI_Malloc(aggTotal * sizeof(int)); + if (aggTotal == 1) { /* special case when we only have one bridge node */ + + sortstruct *bridgelist = + (sortstruct *) ADIOI_Malloc(confInfo->nProcs * sizeof(sortstruct)); + for (i = 0; i < confInfo->nProcs; i++) { + bridgelist[i].bridge = all_procInfo[i].bridgeRank; + bridgelist[i].rank = i; + TRACE_ERR("bridgelist[%d].bridge: %d .rank: %d\n", i, bridgelist[i].bridge, i); + } + + /* This list contains rank->bridge info. Now, we need to sort this list. */ + qsort(bridgelist, confInfo->nProcs, sizeof(sortstruct), intsort); + + aggList[0] = bridgelist[0].bridge; + ADIOI_Free(bridgelist); + + } else { // aggTotal > 1 + + int currentAggListSize = 0; + int numBridgesWithAggAssignments = 0; + bridgeAggAssignment *aggAssignments = + (bridgeAggAssignment *) ADIOI_Malloc(confInfo->numBridgeRanks * + sizeof(bridgeAggAssignment)); + + int partitionSize = all_procInfo[0].numNodesInPartition; + int *nodesAssigned = (int *) ADIOI_Malloc(partitionSize * sizeof(int)); + for (i = 0; i < partitionSize; i++) + nodesAssigned[i] = 0; + + int currentNumHops = gpfsmpio_bridgeringagg; + int allAggsAssigned = 0; + + /* Iterate thru the process infos and select aggregators starting at currentNumHops + * away. Increase the currentNumHops until all bridges have numAggs assigned to them. + */ + while (!allAggsAssigned) { + /* track whether any aggs are selected durng this round */ + int startingCurrentAggListSize = currentAggListSize; + int numIterForHopsWithNoAggs = 0; + for (i = 0; i < confInfo->nProcs; i++) { + if (all_procInfo[i].manhattanDistanceToBridge == currentNumHops) { + if (nodesAssigned[all_procInfo[i].nodeRank] == 0) { // node is not assigned as an agg yet + int foundBridge = 0; + for (j = 0; (j < numBridgesWithAggAssignments && !foundBridge); j++) { + if (aggAssignments[j].bridgeRank == all_procInfo[i].bridgeRank) { + foundBridge = 1; + if (aggAssignments[j].numAggsAssigned < numAggs) { + aggAssignments[j].numAggsAssigned++; + nodesAssigned[all_procInfo[i].nodeRank] = 1; + aggList[currentAggListSize] = all_procInfo[i].rank; + currentAggListSize++; +#ifdef bridgeringaggtrace + printf + ("Assigned agg rank %d at nodeRank %d to bridge rank %d at a distance of %d hops\n", + all_procInfo[i].rank, all_procInfo[i].nodeRank, + all_procInfo[i].bridgeRank, currentNumHops); +#endif + } + } + } + if (!foundBridge) { + aggAssignments[numBridgesWithAggAssignments].bridgeRank = + all_procInfo[i].bridgeRank; + aggAssignments[numBridgesWithAggAssignments].numAggsAssigned = 1; + numBridgesWithAggAssignments++; + nodesAssigned[all_procInfo[i].nodeRank] = 1; + aggList[currentAggListSize] = all_procInfo[i].rank; + currentAggListSize++; +#ifdef bridgeringaggtrace + printf + ("Assigned agg rank %d at nodeRank %d to bridge rank %d at a distance of %d hops\n", + all_procInfo[i].rank, all_procInfo[i].nodeRank, + all_procInfo[i].bridgeRank, currentNumHops); +#endif + } + } + } + } + + if (numBridgesWithAggAssignments == confInfo->numBridgeRanks) { + allAggsAssigned = 1; + for (i = 0; (i < numBridgesWithAggAssignments && allAggsAssigned); i++) { + if (aggAssignments[i].numAggsAssigned < numAggs) + allAggsAssigned = 0; + } + } + currentNumHops++; + /* Handle the case where the numAggs is more than exists starting + * at gpfsmpio_bridgeringagg hops, wrap back and restart at 0 to + * assign the overrun - it is up to the user to realize this + * situation and adjust numAggs and gpfsmpio_bridgeringagg + * accordingly. + */ + if (currentNumHops > 16) + currentNumHops = 0; + /* If 3 rounds go by without selecting an agg abort to avoid + * infinite loop. + */ + if (startingCurrentAggListSize == currentAggListSize) + numIterForHopsWithNoAggs++; + else + numIterForHopsWithNoAggs = 0; + ADIOI_Assert(numIterForHopsWithNoAggs <= 3); + } + + ADIOI_Free(aggAssignments); + ADIOI_Free(nodesAssigned); + + } // else aggTotal > 1 + + memcpy(tmp_ranklist, aggList, aggTotal * sizeof(int)); + } // gpfsmpio_bridgeringagg > 0 + + else { // gpfsmpio_bridgeringagg unset - default code + + int distance, numAggs; + + /* Aggregators will be midpoints between sorted MPI rank lists of who shares a given + * bridge node */ + + sortstruct *bridgelist = (sortstruct *) ADIOI_Malloc(confInfo->nProcs * sizeof(sortstruct)); + for (i = 0; i < confInfo->nProcs; i++) { + bridgelist[i].bridge = all_procInfo[i].bridgeRank; + bridgelist[i].rank = i; + TRACE_ERR("bridgelist[%d].bridge: %d .rank: %d\n", i, bridgelist[i].bridge, i); + } + + /* This list contains rank->bridge info. Now, we need to sort this list. */ + qsort(bridgelist, confInfo->nProcs, sizeof(sortstruct), intsort); + + /* In this array, we can pick an appropriate number of midpoints based on + * our bridgenode index and the number of aggregators */ + + numAggs = confInfo->aggRatio * confInfo->ioMinSize /*virtualPsetSize */ ; + if (numAggs == 1) + aggTotal = 1; + else + /* the number of aggregators is (numAggs per bridgenode) plus each + * bridge node is an aggregator */ + aggTotal = confInfo->numBridgeRanks * (numAggs + 1); + + if (aggTotal > confInfo->nProcs) + aggTotal = confInfo->nProcs; + + TRACE_ERR + ("numBridgeRanks: %d, aggRatio: %f numBridge: %d pset size: %d/%d numAggs: %d, aggTotal: %d\n", + confInfo->numBridgeRanks, confInfo->aggRatio, confInfo->numBridgeRanks, + confInfo->ioMinSize, confInfo->ioMaxSize /*virtualPsetSize */ , numAggs, aggTotal); + aggList = (int *) ADIOI_Malloc(aggTotal * sizeof(int)); + + + /* For each bridge node, determine who the aggregators will be */ + /* basically, the n*distance and bridge node */ + if (aggTotal == 1) /* special case when we only have one bridge node */ + aggList[0] = bridgelist[0].bridge; + else { + int lastBridge = bridgelist[confInfo->nProcs - 1].bridge; + int nextBridge = 0, nextAggr = confInfo->numBridgeRanks; + int psetSize = 0; + int procIndex; + for (procIndex = confInfo->nProcs - 1; procIndex >= 0; procIndex--) { + TRACE_ERR("bridgelist[%d].bridge %u/rank %u\n", procIndex, + bridgelist[procIndex].bridge, bridgelist[procIndex].rank); + if (lastBridge == bridgelist[procIndex].bridge) { + psetSize++; + if (procIndex) + continue; + else + procIndex--; /* procIndex == 0 */ + } + /* Sets up a list of nodes which will act as aggregators. numAggs + * per bridge node total. The list of aggregators is + * bridgeNode 0 + * bridgeNode 1 + * bridgeNode ... + * bridgeNode N + * bridgeNode[0]aggr[0] + * bridgeNode[0]aggr[1]... + * bridgeNode[0]aggr[N]... + * ... + * bridgeNode[N]aggr[0].. + * bridgeNode[N]aggr[N] + */ + aggList[nextBridge] = lastBridge; + distance = psetSize / numAggs; + TRACE_ERR("nextBridge %u is bridge %u, distance %u, size %u\n", nextBridge, + aggList[nextBridge], distance, psetSize); + if (numAggs > 1) { + for (j = 0; j < numAggs; j++) { + ADIOI_Assert(nextAggr < aggTotal); + aggList[nextAggr] = bridgelist[procIndex + j * distance + 1].rank; + TRACE_ERR("agglist[%d] -> bridgelist[%d] = %d\n", nextAggr, + procIndex + j * distance + 1, aggList[nextAggr]); + if (aggList[nextAggr] == lastBridge) { /* can't have bridge in the list twice */ + aggList[nextAggr] = bridgelist[procIndex + psetSize].rank; /* take the last one in the pset */ + TRACE_ERR("replacement agglist[%d] -> bridgelist[%d] = %d\n", nextAggr, + procIndex + psetSize, aggList[nextAggr]); + } + nextAggr++; + } + } + if (procIndex < 0) + break; + lastBridge = bridgelist[procIndex].bridge; + psetSize = 1; + nextBridge++; + } + } + + TRACE_ERR + ("memcpy(tmp_ranklist, aggList, (numAggs(%u)*confInfo->numBridgeRanks(%u)+numAggs(%u)) (%u) %u*sizeof(int))\n", + numAggs, confInfo->numBridgeRanks, numAggs, + (numAggs * confInfo->numBridgeRanks + numAggs), aggTotal); + memcpy(tmp_ranklist, aggList, aggTotal * sizeof(int)); + for (i = 0; i < aggTotal; i++) { + TRACE_ERR("tmp_ranklist[%d]: %d\n", i, tmp_ranklist[i]); + } + + + ADIOI_Free(bridgelist); + + TRACE_ERR("Leaving ADIOI_BG_compute_agg_ranklist_serial_do\n"); + } + + ADIOI_Free(aggList); + return aggTotal; + +} + +/* + * compute aggregators ranklist and put it into fd->hints struct + */ +static void +ADIOI_BG_compute_agg_ranklist_serial(ADIO_File fd, + const ADIOI_BG_ConfInfo_t * confInfo, + ADIOI_BG_ProcInfo_t * all_procInfo) +{ + TRACE_ERR("Entering ADIOI_BG_compute_agg_ranklist_serial\n"); + int i; + int naggs; + int size; + int *tmp_ranklist; + + /* compute the ranklist of IO aggregators and put into tmp_ranklist */ + tmp_ranklist = (int *) ADIOI_Malloc(confInfo->nProcs * sizeof(int)); + +#if AGG_DEBUG + for (i = 0; i < confInfo->nProcs; i++) { + DBG_FPRINTF(stderr, "\trank = %6d\n", all_procInfo[i].rank); + } +#endif + + naggs = ADIOI_BG_compute_agg_ranklist_serial_do(confInfo, all_procInfo, tmp_ranklist); + +#define VERIFY 1 +#if VERIFY + DBG_FPRINTF(stderr, + "\tconfInfo = min: %3d, max: %3d, naggrs: %3d, bridge: %3d, nprocs: %3d, vpset: %3d, ratio: %.4f; naggs = %d\n", + confInfo->ioMinSize, confInfo->ioMaxSize, confInfo->nAggrs, + confInfo->numBridgeRanks, confInfo->nProcs, + confInfo->ioMaxSize /*virtualPsetSize */ , + confInfo->aggRatio, naggs); +#endif + MPI_Comm_size(fd->comm, &size); + /* This fix is for when the bridgenode rnk is not part of the particular + * subcomm associated with this MPI File operation. I don't know if + * this is the best/right answer but it passes the test cases at least. + * I don't know how common file IO in subcomms is anyway... */ + for (i = 0; i < naggs; i++) { + if (tmp_ranklist[i] > size) { + TRACE_ERR("Using 0 as tmp_ranklist[%d] instead of %d for comm %x\n", + i, tmp_ranklist[i], fd->comm); + tmp_ranklist[i] = 0; + } + } + +#if AGG_DEBUG + for (i = 0; i < naggs; i++) { + DBG_FPRINTF(stderr, "\taggr %-4d = %6d\n", i, tmp_ranklist[i]); + } +#endif + if (gpfsmpio_balancecontig == 1) { + /* what comes out of this code block is the agg ranklist sorted by + * bridge set and ion id with associated bridge info stored in the + * hints structure for later access during file domain assignment */ + + // sort the agg ranklist by ions and bridges + + int *interleavedbridgeranklist = (int *) ADIOI_Malloc(naggs * sizeof(int)); // resorted agg rank list + /* list of all bridge ranks */ + int *bridgelist = (int *) ADIOI_Malloc(naggs * sizeof(int)); + + /* each entry here is the number of aggregators associated with the + * bridge rank of the same index in bridgelist */ + int *bridgelistnum = (int *) ADIOI_Malloc(naggs * sizeof(int)); + /* list of all ion IDs corresponding with bridgelist entries of same index */ + int *ionlist = (int *) ADIOI_Malloc(naggs * sizeof(int)); + + int numbridges = 0; + + for (i = 0; i < naggs; i++) + bridgelistnum[i] = 0; + + /* Each entry in this list corresponds with the bridgelist and will contain the lowest bridge + * agg rank on that ion. */ + int *summarybridgeminionaggrank = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (i = 0; i < naggs; i++) + summarybridgeminionaggrank[i] = -1; + + /* build the bridgelist, ionlist and bridgelistnum data by going thru each agg + * entry and find the associated bridge list index - at the end we will + * know how many aggs belong to each bridge in each ion */ + for (i = 0; i < naggs; i++) { + int aggbridgerank = all_procInfo[tmp_ranklist[i]].bridgeRank; + int aggionid = all_procInfo[tmp_ranklist[i]].ionID; + int foundrank = 0; + int summaryranklistbridgeindex = 0; + int j; + for (j = 0; (j < numbridges && !foundrank); j++) { + if (bridgelist[j] == aggbridgerank) { + foundrank = 1; + summaryranklistbridgeindex = j; + } else + summaryranklistbridgeindex++; + } + if (!foundrank) { + bridgelist[summaryranklistbridgeindex] = aggbridgerank; + ionlist[summaryranklistbridgeindex] = aggionid; + + if (summarybridgeminionaggrank[summaryranklistbridgeindex] == -1) + summarybridgeminionaggrank[summaryranklistbridgeindex] = aggbridgerank; + else if (summarybridgeminionaggrank[summaryranklistbridgeindex] > aggbridgerank) + summarybridgeminionaggrank[summaryranklistbridgeindex] = aggbridgerank; + numbridges++; + } + + bridgelistnum[summaryranklistbridgeindex]++; + } + + /* at this point summarybridgeminionaggrank has the agg rank of the bridge for entries, + * need to make each entry the minimum bridge rank for the entire ion. */ + for (i = 0; i < numbridges; i++) { + int aggIonId = ionlist[i]; + int j; + for (j = 0; j < numbridges; j++) { + if (ionlist[j] == aggIonId) { + if (summarybridgeminionaggrank[j] < summarybridgeminionaggrank[i]) + summarybridgeminionaggrank[i] = summarybridgeminionaggrank[j]; + } + } + } + + // resort by io node minimum bridge rank + int x; + for (x = 0; x < numbridges; x++) { + for (i = 0; i < (numbridges - 1); i++) { + if (summarybridgeminionaggrank[i] > summarybridgeminionaggrank[i + 1]) { + int tmpminionaggrank = summarybridgeminionaggrank[i]; + summarybridgeminionaggrank[i] = summarybridgeminionaggrank[i + 1]; + summarybridgeminionaggrank[i + 1] = tmpminionaggrank; + int tmpionid = ionlist[i]; + ionlist[i] = ionlist[i + 1]; + ionlist[i + 1] = tmpionid; + int tmpbridgerank = bridgelist[i]; + bridgelist[i] = bridgelist[i + 1]; + bridgelist[i + 1] = tmpbridgerank; + int tmpbridgeranknum = bridgelistnum[i]; + bridgelistnum[i] = bridgelistnum[i + 1]; + bridgelistnum[i + 1] = tmpbridgeranknum; + } + } + } + + // for each io node make sure bridgelist is in rank order + int startSortIndex = -1; + int endSortIndex = -1; + int currentBridgeIndex = 0; + + while (currentBridgeIndex < numbridges) { + int currentIonId = ionlist[currentBridgeIndex]; + startSortIndex = currentBridgeIndex; + while (ionlist[currentBridgeIndex] == currentIonId) + currentBridgeIndex++; + endSortIndex = currentBridgeIndex - 1; + for (x = startSortIndex; x <= endSortIndex; x++) { + for (i = startSortIndex; i < endSortIndex; i++) { + if (bridgelist[i] > bridgelist[i + 1]) { + int tmpbridgerank = bridgelist[i]; + bridgelist[i] = bridgelist[i + 1]; + bridgelist[i + 1] = tmpbridgerank; + int tmpbridgeranknum = bridgelistnum[i]; + bridgelistnum[i] = bridgelistnum[i + 1]; + bridgelistnum[i + 1] = tmpbridgeranknum; + } + } + } + } + + + /* populate interleavedbridgeranklist - essentially the agg rank list + * is now sorted by the ion minimum bridge rank and bridge node */ + int currentrankoffset = 0; + for (i = 0; i < numbridges; i++) { + int *thisBridgeAggList = (int *) ADIOI_Malloc(naggs * sizeof(int)); + int numAggsForThisBridge = 0; + + int k; + for (k = 0; k < naggs; k++) { + int aggbridgerank = all_procInfo[tmp_ranklist[k]].bridgeRank; + if (aggbridgerank == bridgelist[i]) { + thisBridgeAggList[numAggsForThisBridge] = tmp_ranklist[k]; + numAggsForThisBridge++; + } + } + + // sort thisBridgeAggList + for (x = 0; x < numAggsForThisBridge; x++) { + int n; + for (n = 0; n < (numAggsForThisBridge - 1); n++) { + if (thisBridgeAggList[n] > thisBridgeAggList[n + 1]) { + int tmpthisBridgeAggList = thisBridgeAggList[n]; + thisBridgeAggList[n] = thisBridgeAggList[n + 1]; + thisBridgeAggList[n + 1] = tmpthisBridgeAggList; + } + } + } + int n; + for (n = 0; n < numAggsForThisBridge; n++) { + interleavedbridgeranklist[currentrankoffset] = thisBridgeAggList[n]; + currentrankoffset++; + } + ADIOI_Free(thisBridgeAggList); + } + +#ifdef balancecontigtrace + fprintf(stderr, "Interleaved aggregator list:\n"); + for (i = 0; i < naggs; i++) { + fprintf(stderr, "Agg: %d Agg rank: %d with bridge rank %d and ion ID %d\n", i, + interleavedbridgeranklist[i], + all_procInfo[interleavedbridgeranklist[i]].bridgeRank, + all_procInfo[interleavedbridgeranklist[i]].ionID); + } + fprintf(stderr, "Bridges list:\n"); + for (i = 0; i < numbridges; i++) { + fprintf(stderr, "bridge %d ion min rank %d rank %d number of aggs %d ion id %d\n", i, + summarybridgeminionaggrank[i], bridgelist[i], bridgelistnum[i], ionlist[i]); + } + +#endif + /* copy the ranklist of IO aggregators to fd->hints */ + if (fd->hints->ranklist != NULL) + ADIOI_Free(fd->hints->ranklist); + if (fd->hints->fs_hints.bg.bridgelist != NULL) + ADIOI_Free(fd->hints->fs_hints.bg.bridgelist); + if (fd->hints->fs_hints.bg.bridgelistnum != NULL) + ADIOI_Free(fd->hints->fs_hints.bg.bridgelistnum); + + fd->hints->cb_nodes = naggs; + fd->hints->fs_hints.bg.numbridges = numbridges; + fd->hints->ranklist = (int *) ADIOI_Malloc(naggs * sizeof(int)); + memcpy(fd->hints->ranklist, interleavedbridgeranklist, naggs * sizeof(int)); + + fd->hints->fs_hints.bg.bridgelist = (int *) ADIOI_Malloc(naggs * sizeof(int)); + memcpy(fd->hints->fs_hints.bg.bridgelist, bridgelist, naggs * sizeof(int)); + + fd->hints->fs_hints.bg.bridgelistnum = (int *) ADIOI_Malloc(naggs * sizeof(int)); + memcpy(fd->hints->fs_hints.bg.bridgelistnum, bridgelistnum, naggs * sizeof(int)); + + ADIOI_Free(summarybridgeminionaggrank); + ADIOI_Free(tmp_ranklist); + ADIOI_Free(bridgelistnum); + ADIOI_Free(bridgelist); + ADIOI_Free(interleavedbridgeranklist); + ADIOI_Free(ionlist); + + } else { + /* classic topology-agnostic copy of the ranklist of IO aggregators to + * fd->hints */ + if (fd->hints->ranklist != NULL) + ADIOI_Free(fd->hints->ranklist); + + fd->hints->cb_nodes = naggs; + fd->hints->ranklist = (int *) ADIOI_Malloc(naggs * sizeof(int)); + memcpy(fd->hints->ranklist, tmp_ranklist, naggs * sizeof(int)); + + ADIOI_Free(tmp_ranklist); + } + TRACE_ERR("Leaving ADIOI_BG_compute_agg_ranklist_serial\n"); + return; +} diff --git a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.h b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.h similarity index 53% rename from 3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.h rename to 3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.h index b154722850ca560cabd98fb2230fc6000a49c9aa..8668ff394484ea2e0281081a805f1ae8f3bd74ff 100644 --- a/3rd-party/romio321/adio/ad_gpfs/bg/ad_bg_aggrs.h +++ b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_aggrs.h @@ -1,12 +1,14 @@ -/* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ -/* ---------------------------------------------------------------- */ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + /** * \file ad_bg_aggrs.h * \brief ??? */ -/* +/* * * Declares functions specific for the BlueGene platform within the GPFS * parallel I/O solution. Implements aligned file-domain partitioning @@ -14,8 +16,8 @@ * */ -#ifndef AD_BG_AGGRS_H_ -#define AD_BG_AGGRS_H_ +#ifndef AD_BG_AGGRS_H_INCLUDED +#define AD_BG_AGGRS_H_INCLUDED #include "adio.h" #include <sys/stat.h> @@ -24,10 +26,10 @@ #include <gpfs.h> #endif #if !defined(GPFS_SUPER_MAGIC) - #define GPFS_SUPER_MAGIC (0x47504653) +#define GPFS_SUPER_MAGIC (0x47504653) #endif /* generate a list of I/O aggregators that utilizes BG-PSET orginization. */ - int ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset); +int ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset); -#endif /* AD_BG_AGGRS_H_ */ +#endif /* AD_BG_AGGRS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.c b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.c new file mode 100644 index 0000000000000000000000000000000000000000..1d3f00e7f5019bffde7d9444cef0b6bb8bb8eb3c --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.c @@ -0,0 +1,422 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_bg_pset.c + * \brief Definition of functions associated to structs ADIOI_BG_ProcInfo_t and ADIOI_BG_ConfInfo_t + */ + +/* #define TRACE_ON */ +// #define bridgeringaggtrace 1 + +#include <stdlib.h> +#include <stdbool.h> +#include "../ad_gpfs.h" +#include "ad_bg_pset.h" +#include <spi/include/kernel/process.h> +#include <firmware/include/personality.h> + +#define BGQ_TORUS_MAX_DIMS 5 +#define BGQ_FULL_TORUS_SIZE 512 + +#ifndef TRACE_ERR +#define TRACE_ERR(fmt...) +#endif + +ADIOI_BG_ProcInfo_t *ADIOI_BG_ProcInfo_new() +{ + ADIOI_BG_ProcInfo_t *p = (ADIOI_BG_ProcInfo_t *) ADIOI_Malloc(sizeof(ADIOI_BG_ProcInfo_t)); + ADIOI_Assert((p != NULL)); + return p; +} + +ADIOI_BG_ProcInfo_t *ADIOI_BG_ProcInfo_new_n(int n) +{ + ADIOI_BG_ProcInfo_t *p = (ADIOI_BG_ProcInfo_t *) ADIOI_Malloc(n * sizeof(ADIOI_BG_ProcInfo_t)); + ADIOI_Assert((p != NULL)); + return p; +} + +void ADIOI_BG_ProcInfo_free(ADIOI_BG_ProcInfo_t * info) +{ + if (info != NULL) + ADIOI_Free(info); +} + +ADIOI_BG_ConfInfo_t *ADIOI_BG_ConfInfo_new() +{ + ADIOI_BG_ConfInfo_t *p = (ADIOI_BG_ConfInfo_t *) ADIOI_Malloc(sizeof(ADIOI_BG_ConfInfo_t)); + ADIOI_Assert((p != NULL)); + return p; +} + + +void ADIOI_BG_ConfInfo_free(ADIOI_BG_ConfInfo_t * info) +{ + if (info != NULL) + ADIOI_Free(info); +} + + +typedef struct { + int rank; + int bridgeCoord; +} sortstruct; + +static int intsort(const void *p1, const void *p2) +{ + sortstruct *i1, *i2; + i1 = (sortstruct *) p1; + i2 = (sortstruct *) p2; + return (i1->bridgeCoord - i2->bridgeCoord); +} + +unsigned torusSize[BGQ_TORUS_MAX_DIMS]; +bool dimTorus[BGQ_TORUS_MAX_DIMS]; + +/* This function computes the number of hops between the torus coordinates of the + * aggCoords and bridgeCoords parameters. +*/ +static unsigned procManhattanDistance(unsigned *aggCoords, unsigned *bridgeCoords) +{ + + unsigned totalDistance = 0; + int i; + for (i = 0; i < BGQ_TORUS_MAX_DIMS; i++) { + unsigned dimDistance = abs((int) aggCoords[i] - (int) bridgeCoords[i]); + if (dimDistance > 0) { // could torus make it closer? + if (dimTorus[i]) { + if (aggCoords[i] == torusSize[i]) { // is wrap-around closer + if ((bridgeCoords[i] + 1) < dimDistance) // assume will use torus link + dimDistance = bridgeCoords[i] + 1; + } else if (bridgeCoords[i] == torusSize[i]) { // is wrap-around closer + if ((aggCoords[i] + 1) < dimDistance) // assume will use torus link + dimDistance = aggCoords[i] + 1; + } + } + } /* else: dimDistance == 0, meaning aggCoords[i] and bridgeCoords[i] are + * the same and there's no closer point to pick */ + totalDistance += dimDistance; + } + return totalDistance; +} + +int BGQ_IO_node_id() +{ + static unsigned long IO_node_id = ULONG_MAX; + + if (IO_node_id != ULONG_MAX) + return (int) (IO_node_id >> 32); + + int rc; + int fd; + char *uci_str; + char buffer[4096]; + + fd = open("/dev/bgpers", O_RDONLY, 0); + assert(fd >= 0); + rc = read(fd, buffer, sizeof(buffer)); + assert(rc > 0); + close(fd); + + uci_str = strstr(buffer, "BG_UCI="); + assert(uci_str); + uci_str += sizeof("BG_UCI=") - 1; + + IO_node_id = strtoul(uci_str, NULL, 16); + return (int) (IO_node_id >> 32); +} + +void +ADIOI_BG_persInfo_init(ADIOI_BG_ConfInfo_t * conf, + ADIOI_BG_ProcInfo_t * proc, int size, int rank, int n_aggrs, MPI_Comm comm) +{ + int i, iambridge = 0, bridgerank = -1, bridgeIndex; + int countPset; + sortstruct *bridges; + int commsize; + + TRACE_ERR("Entering BG_persInfo_init, size: %d, rank: %d, n_aggrs: %d, comm: %d\n", size, rank, + n_aggrs, (int) comm); + + Personality_t pers; + + + Kernel_GetPersonality(&pers, sizeof(pers)); + Personality_Networks_t *net = &pers.Network_Config; + + TRACE_ERR("BG_persInfo_init, my coords{%u,%u,%u,%u,%u}\n", net->Acoord, net->Bcoord, + net->Ccoord, net->Dcoord, net->Ecoord); + proc->rank = rank; + + if (gpfsmpio_bridgeringagg > 0) { +#ifdef bridgeringaggtrace + if (rank == 0) + fprintf(stderr, "Block dimensions:\n"); +#endif + + /* Set the numNodesInPartition and nodeRank for this proc + */ + unsigned dimMaxArray[BGQ_TORUS_MAX_DIMS]; + dimMaxArray[0] = net->Anodes; + dimMaxArray[1] = net->Bnodes; + dimMaxArray[2] = net->Cnodes; + dimMaxArray[3] = net->Dnodes; + dimMaxArray[4] = net->Enodes; + + unsigned hwCoordsArray[BGQ_TORUS_MAX_DIMS]; + hwCoordsArray[0] = net->Acoord; + hwCoordsArray[1] = net->Bcoord; + hwCoordsArray[2] = net->Ccoord; + hwCoordsArray[3] = net->Dcoord; + hwCoordsArray[4] = net->Ecoord; + proc->numNodesInPartition = + net->Anodes * net->Bnodes * net->Cnodes * net->Dnodes * net->Enodes; + proc->nodeRank = 0; + /* Set the indicator for if a dimension in the partitions is a torus or not. + */ + dimTorus[0] = (bool) (ND_ENABLE_TORUS_DIM_A & net->NetFlags); + dimTorus[1] = (bool) (ND_ENABLE_TORUS_DIM_B & net->NetFlags); + dimTorus[2] = (bool) (ND_ENABLE_TORUS_DIM_C & net->NetFlags); + dimTorus[3] = (bool) (ND_ENABLE_TORUS_DIM_D & net->NetFlags); + dimTorus[4] = (bool) (ND_ENABLE_TORUS_DIM_E & net->NetFlags); + for (i = 0; i < BGQ_TORUS_MAX_DIMS; i++) { + torusSize[i] = dimMaxArray[i]; + int baseNum = 1, j; + for (j = 0; j < i; j++) + baseNum *= dimMaxArray[j]; + proc->nodeRank += (hwCoordsArray[i] * baseNum); +#ifdef bridgeringaggtrace + if (rank == 0) + fprintf(stderr, + "numNodesInPartition is %d Dimension %d has %d elements wrap-around value is %d\n", + proc->numNodesInPartition, i, torusSize[i], dimTorus[i]); +#endif + } + } + + MPI_Comm_size(comm, &commsize); + + proc->ionID = BGQ_IO_node_id(); + + if (size == 1) { + proc->iamBridge = 1; + proc->bridgeRank = rank; + if (gpfsmpio_bridgeringagg > 0) { + proc->manhattanDistanceToBridge = 0; + } + + /* Set up the other parameters */ + proc->myIOSize = size; + proc->ioNodeIndex = 0; + conf->ioMinSize = size; + conf->ioMaxSize = size; + conf->numBridgeRanks = 1; + conf->nProcs = size; + conf->nAggrs = 1; + conf->aggRatio = 1. * conf->nAggrs / conf->ioMinSize /*virtualPsetSize */ ; + if (conf->aggRatio > 1) + conf->aggRatio = 1.; + TRACE_ERR("I am (single) Bridge rank\n"); + return; + } + + /* Find the nearest bridge node coords. We don't know the + * rank in our comm so we will collective find/pick a bridge + * rank later. + */ + int32_t bridgeCoords; + bridgeCoords = pers.Network_Config.cnBridge_A << 24 | + pers.Network_Config.cnBridge_B << 18 | + pers.Network_Config.cnBridge_C << 12 | + pers.Network_Config.cnBridge_D << 6 | pers.Network_Config.cnBridge_E << 2; + ADIOI_Assert((bridgeCoords >= 0)); /* A dim is < 6 bits or sorting won't work */ + + if ((net->Acoord == pers.Network_Config.cnBridge_A) && + (net->Bcoord == pers.Network_Config.cnBridge_B) && + (net->Ccoord == pers.Network_Config.cnBridge_C) && + (net->Dcoord == pers.Network_Config.cnBridge_D) && + (net->Ecoord == pers.Network_Config.cnBridge_E)) { + iambridge = 1; /* I am bridge */ + if (gpfsmpio_bridgeringagg > 0) { + proc->manhattanDistanceToBridge = 0; + } + } else { // calculate manhattan distance to bridge if gpfsmpio_bridgeringagg is set + if (gpfsmpio_bridgeringagg > 0) { + unsigned aggCoords[BGQ_TORUS_MAX_DIMS], manhattanBridgeCoords[BGQ_TORUS_MAX_DIMS]; + aggCoords[0] = net->Acoord; + manhattanBridgeCoords[0] = pers.Network_Config.cnBridge_A; + aggCoords[1] = net->Bcoord; + manhattanBridgeCoords[1] = pers.Network_Config.cnBridge_B; + aggCoords[2] = net->Ccoord; + manhattanBridgeCoords[2] = pers.Network_Config.cnBridge_C; + aggCoords[3] = net->Dcoord; + manhattanBridgeCoords[3] = pers.Network_Config.cnBridge_D; + aggCoords[4] = net->Ecoord; + manhattanBridgeCoords[4] = pers.Network_Config.cnBridge_E; + + proc->manhattanDistanceToBridge = + procManhattanDistance(aggCoords, manhattanBridgeCoords); +#ifdef bridgeringaggtrace + fprintf(stderr, + "agg coords are %u %u %u %u %u bridge coords are %u %u %u %u %u distance is %u\n", + aggCoords[0], aggCoords[1], aggCoords[2], aggCoords[3], aggCoords[4], + manhattanBridgeCoords[0], manhattanBridgeCoords[1], manhattanBridgeCoords[2], + manhattanBridgeCoords[3], manhattanBridgeCoords[4], + proc->manhattanDistanceToBridge); +#endif + } + } + + TRACE_ERR("Bridge coords(%8.8X): %d %d %d %d %d, %d. iambridge %d\n", bridgeCoords, + pers.Network_Config.cnBridge_A, pers.Network_Config.cnBridge_B, + pers.Network_Config.cnBridge_C, pers.Network_Config.cnBridge_D, + pers.Network_Config.cnBridge_E, 0, iambridge); + + /* Allgather the ranks and bridgeCoords to determine the bridge + * rank and how many ranks belong to each bridge rank */ + bridges = (sortstruct *) ADIOI_Malloc(sizeof(sortstruct) * size); + + /* We're going to sort this structure by bridgeCoord: + * + * typedef struct + * { + * int rank; + * int bridgeCoord; + * } sortstruct; + * + * and I want the rank that IS the bridge to sort first, so + * OR in '1' on non-bridge ranks that use a bridge coord. + */ + + /* My input to the collective */ + bridges[rank].rank = rank; + bridges[rank].bridgeCoord = bridgeCoords; + if (!iambridge) + bridges[rank].bridgeCoord |= 1; /* I am not bridge, turn on bit */ + + + MPI_Allgather(MPI_IN_PLACE, 2, MPI_INT, bridges, 2, MPI_INT, comm); + + qsort(bridges, size, sizeof(sortstruct), intsort); + + /* Once the list is sorted walk through it to setup bridge + * info and find bridge ranks, etc. */ + + int tempCoords, tempRank, mincompute, maxcompute; + tempCoords = bridges[0].bridgeCoord & ~1; + tempRank = bridges[0].rank; + + countPset = 1; + bridgeIndex = 0; + mincompute = size + 1; + maxcompute = 1; + + for (i = 1; i < size; i++) { + if ((bridges[i].bridgeCoord & ~1) == tempCoords) + countPset++; /* same bridge (pset), count it */ + else { /* new bridge found */ + +#ifdef TRACE_ON + if (rank == 0) + TRACE_ERR("Bridge set %u, bridge rank %d (%#8.8X) has %d ranks\n", + bridgeIndex, tempRank, tempCoords, countPset); +#endif + if (countPset > maxcompute) + maxcompute = countPset; + if (countPset < mincompute) + mincompute = countPset; + + /* Was this my bridge we finished? */ + if (tempCoords == bridgeCoords) { + /* Am I the bridge rank? */ + if (tempRank == rank) + iambridge = 1; + else + iambridge = 0; /* Another rank on my node may have taken over */ + TRACE_ERR + ("Rank %u, bridge set %u, bridge rank %d (%#8.8X) has %d ranks, iambridge %u\n", + rank, bridgeIndex, tempRank, tempCoords, countPset, iambridge); + bridgerank = tempRank; + proc->myIOSize = countPset; + proc->ioNodeIndex = bridgeIndex; + } + /* Setup next bridge */ + tempCoords = bridges[i].bridgeCoord & ~1; + tempRank = bridges[i].rank; + bridgeIndex++; + countPset = 1; + } + } + /* Process last bridge */ + +#ifdef TRACE_ON + if (rank == 0) + TRACE_ERR("Bridge set %u, bridge rank %d (%#8.8X) has %d ranks\n", + bridgeIndex, tempRank, tempCoords, countPset); +#endif + if (countPset > maxcompute) + maxcompute = countPset; + if (countPset < mincompute) + mincompute = countPset; + + /* Was this my bridge? */ + if (tempCoords == bridgeCoords) { + /* Am I the bridge rank? */ + if (tempRank == rank) + iambridge = 1; + else + iambridge = 0; /* Another rank on my node may have taken over */ + bridgerank = tempRank; + proc->myIOSize = countPset; + proc->ioNodeIndex = bridgeIndex; + } + + + if (rank == 0) { + /* Only rank 0 has a conf structure, fill in stuff as appropriate */ + conf->ioMinSize = mincompute; + conf->ioMaxSize = maxcompute; /* equivalent to pset size */ + conf->numBridgeRanks = bridgeIndex + 1; + conf->nProcs = size; + + conf->nAggrs = n_aggrs; + /* First pass gets nAggrs = -1 */ + if (conf->nAggrs <= 0) + conf->nAggrs = gpfsmpio_bg_nagg_pset; + if (conf->ioMinSize <= conf->nAggrs) + conf->nAggrs = MPL_MAX(1, conf->ioMinSize - 1); /* not including bridge itself */ +/* if (conf->nAggrs > conf->numBridgeRanks) + conf->nAggrs = conf->numBridgeRanks; +*/ + conf->aggRatio = 1. * conf->nAggrs / conf->ioMinSize /*virtualPsetSize */ ; +/* if (conf->aggRatio > 1) conf->aggRatio = 1.; */ + TRACE_ERR + ("n_aggrs %zd, conf->nProcs %zu, conf->ioMaxSize %zu, ADIOI_BG_NAGG_PSET_DFLT %zu,conf->numBridgeRanks %zu,conf->nAggrs %zu\n", + (size_t) n_aggrs, (size_t) conf->nProcs, (size_t) conf->ioMaxSize, + (size_t) ADIOI_BG_NAGG_PSET_DFLT, (size_t) conf->numBridgeRanks, + (size_t) conf->nAggrs); + TRACE_ERR + ("Maximum ranks under a bridge rank: %d, minimum: %d, nAggrs: %d, numBridgeRanks: %d pset dflt: %d naggrs: %d ratio: %f\n", + maxcompute, mincompute, conf->nAggrs, conf->numBridgeRanks, ADIOI_BG_NAGG_PSET_DFLT, + conf->nAggrs, conf->aggRatio); + } + + ADIOI_Assert((bridgerank != -1)); + proc->bridgeRank = bridgerank; + proc->iamBridge = iambridge; + TRACE_ERR + ("Rank %d has bridge set index %d (bridge rank: %d) with %d other ranks, ioNodeIndex: %d\n", + rank, proc->ioNodeIndex, bridgerank, proc->myIOSize, proc->ioNodeIndex); + + ADIOI_Free(bridges); + +} + +void ADIOI_BG_persInfo_free(ADIOI_BG_ConfInfo_t * conf, ADIOI_BG_ProcInfo_t * proc) +{ + ADIOI_BG_ConfInfo_free(conf); + ADIOI_BG_ProcInfo_free(proc); +} diff --git a/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.h b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.h new file mode 100644 index 0000000000000000000000000000000000000000..e76bdcf0bde5e714fb7b9cee924e5b5751a7a2a7 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/bg/ad_bg_pset.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_bg_pset.h + * \brief ??? + */ + +/* File: ad_bg_pset.h + * + * Defines two structures that keep BlueGene PSET specific information and their public interfaces: + * . ADIOI_BG_ProcInfo_t object keeps specific information to each process + * . ADIOI_BG_ConfInfo_t object keeps general information for the whole communicator, only kept + * on process 0. + */ + +#ifndef AD_BG_PSET_H_INCLUDED +#define AD_BG_PSET_H_INCLUDED + + +/* Keeps specific information to each process, will be exchanged among processes */ +typedef struct { + int ioNodeIndex; /* similar to psetNum on BGL/BGP */ + int rank; /* my rank */ + int ionID; /* ion id this cn is using */ +/* int myCoords[5]; */ + int bridgeRank; /* my bridge node (or proxy) rank */ + unsigned char threadID; /* unlikely to be useful but better than just padding */ + unsigned char __cpad[2]; + int myIOSize; /* number of ranks sharing my bridge/IO + * node, i.e. psetsize */ + int iamBridge; /* am *I* the bridge rank? */ + int __ipad[2]; + unsigned nodeRank; /* torus coords converted to an integer for use with gpfsmpio_bridgeringagg */ + unsigned numNodesInPartition; /* number of physical nodes in the job partition */ + unsigned manhattanDistanceToBridge; /* number of hops between this rank and the bridge node */ +} ADIOI_BG_ProcInfo_t __attribute__ ((aligned(16))); + +/* Keeps general information for the whole communicator, only on process 0 */ +typedef struct { + int ioMinSize; /* Smallest number of ranks shareing 1 bridge node */ + int ioMaxSize; /* Largest number of ranks sharing 1 bridge node */ + /* ioMaxSize will be the "psetsize" */ + int nAggrs; + int numBridgeRanks; + /*int virtualPsetSize; ppn * pset size */ + int nProcs; + int cpuIDsize; /* num ppn */ + float aggRatio; + +} ADIOI_BG_ConfInfo_t __attribute__ ((aligned(16))); + + + + + +/* public funcs for ADIOI_BG_ProcInfo_t objects */ +ADIOI_BG_ProcInfo_t *ADIOI_BG_ProcInfo_new(); +ADIOI_BG_ProcInfo_t *ADIOI_BG_ProcInfo_new_n(int n); +void ADIOI_BG_ProcInfo_free(ADIOI_BG_ProcInfo_t * info); + + +/* public funcs for ADIOI_BG_ConfInfo_t objects */ +ADIOI_BG_ConfInfo_t *ADIOI_BG_ConfInfo_new(); +void ADIOI_BG_ConfInfo_free(ADIOI_BG_ConfInfo_t * info); + + +/* public funcs for a pair of ADIOI_BG_ConfInfo_t and ADIOI_BG_ProcInfo_t objects */ +int BGQ_IO_node_id(); +void ADIOI_BG_persInfo_init(ADIOI_BG_ConfInfo_t * conf, + ADIOI_BG_ProcInfo_t * proc, int s, int r, int n_aggrs, MPI_Comm comm); +void ADIOI_BG_persInfo_free(ADIOI_BG_ConfInfo_t * conf, ADIOI_BG_ProcInfo_t * proc); + + +#endif /* AD_BG_PSET_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/ad_gpfs/pe/Makefile.mk b/3rd-party/romio341/adio/ad_gpfs/pe/Makefile.mk similarity index 64% rename from 3rd-party/romio321/adio/ad_gpfs/pe/Makefile.mk rename to 3rd-party/romio341/adio/ad_gpfs/pe/Makefile.mk index 6173bd7fe0a3716273d88ddf0465d5c2b19de8c5..cc5d406b4dcf5588d7071ec6f8ea5cabac712d4f 100644 --- a/3rd-party/romio321/adio/ad_gpfs/pe/Makefile.mk +++ b/3rd-party/romio341/adio/ad_gpfs/pe/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2012 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_PE diff --git a/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.c b/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.c new file mode 100644 index 0000000000000000000000000000000000000000..b6564c74151c579b47fb2164935428b9065e8238 --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.c @@ -0,0 +1,280 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_pe_aggrs.c + * \brief The externally used function from this file is is declared in ad_pe_aggrs.h + */ + +/*#define TRACE_ON */ + +#include "adio.h" +#include "adio_cb_config_list.h" +#include "../ad_gpfs.h" +#include "ad_pe_aggrs.h" +#include "mpiimpl.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +#ifdef MPL_USE_DBG_LOGGING +#define AGG_DEBUG 1 +#endif + +#ifndef TRACE_ERR +#define TRACE_ERR(format...) +#endif + +/* + * Compute the aggregator-related parameters that are required in 2-phase + * collective IO of ADIO. + * The parameters are + * . the number of aggregators (proxies) : fd->hints->cb_nodes + * . the ranks of the aggregators : fd->hints->ranklist + * If MP_IONODEFILE is defined, POE determines all tasks on every node listed + * in the node file and defines MP_IOTASKLIST with them, making them all + * aggregators. Alternatively, the user can explictly set MP_IOTASKLIST + * themselves. The format of the MP_IOTASKLIST is a colon-delimited list of + * task ids, the first entry being the total number of aggregators, for example + * to specify 4 aggregators on task ids 0,8,16,24 the value would be: + * 4:0:8:16:24. If there is no MP_IONODEFILE, or MP_IOTASKLIST, then the + * default aggregator selection is 1 task per node for every node of the job - + * additionally, an environment variable MP_IOAGGR_CNT can be specified, which + * defines the total number of aggregators, spread evenly across all the nodes. + * The romio_cb_nodes and romio_cb_config_list hint user settings are ignored. + */ +int ADIOI_PE_gen_agg_ranklist(ADIO_File fd) +{ + + int numAggs = 0; + char *ioTaskList = getenv("MP_IOTASKLIST"); + char *ioAggrCount = getenv("MP_IOAGGR_CNT"); + int i, j; + int inTERcommFlag = 0; + + int myRank, commSize; + MPI_Comm_rank(fd->comm, &myRank); + MPI_Comm_size(fd->comm, &commSize); + + MPI_Comm_test_inter(fd->comm, &inTERcommFlag); + if (inTERcommFlag) { + FPRINTF(stderr, + "ERROR: ATTENTION: inTERcomms are not supported in MPI-IO - aborting....\n"); + perror("ADIOI_PE_gen_agg_ranklist:"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + if (ioTaskList) { + int ioTaskListLen = strlen(ioTaskList); + int ioTaskListPos = 0; + char tmpBuf[8]; /* Big enough for 1M tasks (7 digits task ID). */ + tmpBuf[7] = '\0'; + for (i = 0; i < 7; i++) { + tmpBuf[i] = *ioTaskList++; /* Maximum is 7 digits for 1 million. */ + ioTaskListPos++; + if (*ioTaskList == ':') { /* If the next char is a ':' ends it. */ + tmpBuf[i + 1] = '\0'; + break; + } + } + numAggs = atoi(tmpBuf); + if (numAggs == 0) + FPRINTF(stderr, + "ERROR: ATTENTION: Number of aggregators specified in MP_IOTASKLIST set at 0 - default aggregator selection will be used.\n"); + else if (!((numAggs > 0) && (numAggs <= commSize))) { + FPRINTF(stderr, + "ERROR: ATTENTION: The number of aggregators (%s) specified in MP_IOTASKLIST is outside the communicator task range of %d.\n", + tmpBuf, commSize); + numAggs = commSize; + } + fd->hints->ranklist = (int *) ADIOI_Malloc(numAggs * sizeof(int)); + + int aggIndex = 0; + while (aggIndex < numAggs) { + ioTaskList++; /* Advance past the ':' */ + ioTaskListPos++; + int allDigits = 1; + for (i = 0; i < 7; i++) { + if (*ioTaskList < '0' || *ioTaskList > '9') + allDigits = 0; + tmpBuf[i] = *ioTaskList++; + ioTaskListPos++; + if ((*ioTaskList == ':') || (*ioTaskList == '\0')) { + tmpBuf[i + 1] = '\0'; + break; + } + } + if (allDigits) { + int newAggRank = atoi(tmpBuf); + if (!((newAggRank >= 0) && (newAggRank < commSize))) { + FPRINTF(stderr, + "ERROR: ATTENTION: The aggregator '%s' specified in MP_IOTASKLIST is not within the communicator task range of 0 to %d - it will be ignored.\n", + tmpBuf, commSize - 1); + } else { + int aggAlreadyAdded = 0; + for (i = 0; i < aggIndex; i++) + if (fd->hints->ranklist[i] == newAggRank) { + aggAlreadyAdded = 1; + break; + } + if (!aggAlreadyAdded) + fd->hints->ranklist[aggIndex++] = newAggRank; + else + FPRINTF(stderr, + "ERROR: ATTENTION: The aggregator '%d' is specified multiple times in MP_IOTASKLIST - duplicates are ignored.\n", + newAggRank); + } + } else { + FPRINTF(stderr, + "ERROR: ATTENTION: The aggregator '%s' specified in MP_IOTASKLIST is not a valid integer task id - it will be ignored.\n", + tmpBuf); + } + + /* At the end check whether the list is shorter than specified. */ + if (ioTaskListPos == ioTaskListLen) { + if (aggIndex == 0) { + FPRINTF(stderr, + "ERROR: ATTENTION: No aggregators were correctly specified in MP_IOTASKLIST - default aggregator selection will be used.\n"); + ADIOI_Free(fd->hints->ranklist); + } else if (aggIndex < numAggs) + FPRINTF(stderr, + "ERROR: ATTENTION: %d aggregators were specified in MP_IOTASKLIST but only %d were correctly specified - setting the number of aggregators to %d.\n", + numAggs, aggIndex, aggIndex); + numAggs = aggIndex; + } + } + } + if (numAggs == 0) { + MPIR_Comm *mpidCommData; + + MPIR_Comm_get_ptr(fd->comm, mpidCommData); + int localSize = mpidCommData->local_size; + + // get my node rank + int myNodeRank = mpidCommData->intranode_table[mpidCommData->rank]; + + int *allNodeRanks = (int *) ADIOI_Malloc(localSize * sizeof(int)); + + allNodeRanks[myRank] = myNodeRank; + MPI_Allgather(MPI_IN_PLACE, 1, MPI_INT, allNodeRanks, 1, MPI_INT, fd->comm); + +#ifdef AGG_DEBUG + printf("MPIR_Comm data: local_size is %d\nintranode_table entries:\n", + mpidCommData->local_size); + for (i = 0; i < localSize; i++) { + printf("%d ", mpidCommData->intranode_table[i]); + } + printf("\ninternode_table entries:\n"); + for (i = 0; i < localSize; i++) { + printf("%d ", mpidCommData->internode_table[i]); + } + printf("\n"); + + printf("\nallNodeRanks entries:\n"); + for (i = 0; i < localSize; i++) { + printf("%d ", allNodeRanks[i]); + } + printf("\n"); + +#endif + + if (ioAggrCount) { + int cntType = -1; + + if (strcasecmp(ioAggrCount, "ALL")) { + if ((cntType = atoi(ioAggrCount)) <= 0) { + /* Input is other non-digit or less than 1 the assume */ + /* 1 aggregator per node. Note: atoi(-1) reutns -1. */ + /* No warning message given here -- done earlier. */ + cntType = -1; + } + } else { + /* ALL is specified set aggr count to localSize */ + cntType = -2; + } + switch (cntType) { + case -1: + /* 1 aggr/node case */ + { + int rankListIndex = 0; + fd->hints->ranklist = (int *) ADIOI_Malloc(localSize * sizeof(int)); + for (i = 0; i < localSize; i++) { + if (allNodeRanks[i] == 0) { + fd->hints->ranklist[rankListIndex++] = i; + numAggs++; + } + } + } + break; + case -2: + /* ALL tasks case */ + fd->hints->ranklist = (int *) ADIOI_Malloc(localSize * sizeof(int)); + for (i = 0; i < localSize; i++) { + fd->hints->ranklist[i] = i; + numAggs++; + } + break; + default: + /* Specific aggr count case -- MUST be less than localSize, otherwise set to localSize */ + if (cntType > localSize) + cntType = localSize; + + numAggs = cntType; + // Round-robin thru allNodeRanks - pick the 0's, then the 1's, etc + int currentNodeRank = 0; // node rank currently being selected as aggregator + int rankListIndex = 0; + int currentAllNodeIndex = 0; + + fd->hints->ranklist = (int *) ADIOI_Malloc(numAggs * sizeof(int)); + + while (rankListIndex < numAggs) { + int foundEntry = 0; + while (!foundEntry && (currentAllNodeIndex < localSize)) { + if (allNodeRanks[currentAllNodeIndex] == currentNodeRank) { + fd->hints->ranklist[rankListIndex++] = currentAllNodeIndex; + foundEntry = 1; + } + currentAllNodeIndex++; + } + if (!foundEntry) { + currentNodeRank++; + currentAllNodeIndex = 0; + } + } // while + break; + } // switch(cntType) + } // if (ioAggrCount) + + else { // default is 1 aggregator per node + // take the 0 entries from allNodeRanks + int rankListIndex = 0; + fd->hints->ranklist = (int *) ADIOI_Malloc(localSize * sizeof(int)); + for (i = 0; i < localSize; i++) { + if (allNodeRanks[i] == 0) { + fd->hints->ranklist[rankListIndex++] = i; + numAggs++; + } + } + } + + ADIOI_Free(allNodeRanks); + + } + + if (getenv("MP_I_SHOW_AGGRS")) { + if (myRank == 0) { + printf("Agg rank list of %d generated:\n", numAggs); + for (i = 0; i < numAggs; i++) { + printf("%d ", fd->hints->ranklist[i]); + } + printf("\n"); + } + } + + fd->hints->cb_nodes = numAggs; + + return 0; +} diff --git a/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.h b/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.h new file mode 100644 index 0000000000000000000000000000000000000000..38df48e9673b7e558eaac730bac5969770d36e8b --- /dev/null +++ b/3rd-party/romio341/adio/ad_gpfs/pe/ad_pe_aggrs.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_pe_aggrs.h + * \brief ??? + */ + +/* + * + * Declares functions specific for the PE platform within the GPFS + * parallel I/O solution. For now simply processes the MP_IOTASKLIST + * env var. + * + */ + +#ifndef AD_PE_AGGRS_H_INCLUDED +#define AD_PE_AGGRS_H_INCLUDED + +#include "adio.h" +#include <sys/stat.h> + +#if !defined(GPFS_SUPER_MAGIC) +#define GPFS_SUPER_MAGIC (0x47504653) +#endif + + /* generate a list of I/O aggregators following a methodology specific for PE */ +int ADIOI_PE_gen_agg_ranklist(ADIO_File fd); + +#endif /* AD_PE_AGGRS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_ime/Makefile.mk b/3rd-party/romio341/adio/ad_ime/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..0d25a9878b4ee8c60d2e82620a0ce9ea866da657 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/Makefile.mk @@ -0,0 +1,22 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +if BUILD_AD_IME + +noinst_HEADERS += adio/ad_ime/ad_ime.h adio/ad_ime/ad_ime_common.h + +romio_other_sources += \ + adio/ad_ime/ad_ime.c \ + adio/ad_ime/ad_ime_close.c \ + adio/ad_ime/ad_ime_common.c \ + adio/ad_ime/ad_ime_delete.c \ + adio/ad_ime/ad_ime_fcntl.c \ + adio/ad_ime/ad_ime_flush.c \ + adio/ad_ime/ad_ime_io.c \ + adio/ad_ime/ad_ime_open.c \ + adio/ad_ime/ad_ime_resize.c \ + adio/ad_ime/ad_ime_features.c + +endif BUILD_AD_IME diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime.c b/3rd-party/romio341/adio/ad_ime/ad_ime.c new file mode 100644 index 0000000000000000000000000000000000000000..bb9f9a4f1385d127e4adf8f40b87a4f529846852 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_IME_operations = { + ADIOI_IME_Open, /* Open */ + ADIOI_SCALEABLE_OpenColl, /* OpenColl */ /*XXX*/ + ADIOI_IME_ReadContig, /* ReadContig */ + ADIOI_IME_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_IME_Fcntl, /* Fcntl */ + ADIOI_GEN_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_IME_Close, /* Close */ + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ + ADIOI_FAKE_IODone, /* ReadDone */ + ADIOI_FAKE_IODone, /* WriteDone */ + ADIOI_FAKE_IOComplete, /* ReadComplete */ + ADIOI_FAKE_IOComplete, /* WriteComplete */ + ADIOI_FAKE_IreadStrided, /* IreadStrided */ + ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ + ADIOI_IME_Flush, /* Flush */ + ADIOI_IME_Resize, /* Resize */ + ADIOI_IME_Delete, /* Delete */ + ADIOI_IME_Feature, + ADIOI_IME_PREFIX, +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime.h b/3rd-party/romio341/adio/ad_ime/ad_ime.h new file mode 100644 index 0000000000000000000000000000000000000000..8db4d2cb5fa2ced1034b75356286de0852f0fbc6 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_IME_H_INCLUDED +#define AD_IME_H_INCLUDED + +#include "adio.h" +#ifdef HAVE_IME_NATIVE_H +#include "ime_native.h" +#endif + +#define ADIOI_IME_PREFIX "ime:" +#define ADIOI_IME_PREFIX_LEN (sizeof(ADIOI_IME_PREFIX) - 1) + +void ADIOI_IME_Open(ADIO_File fd, int *error_code); + +void ADIOI_IME_Close(ADIO_File fd, int *error_code); + +void ADIOI_IME_ReadContig(ADIO_File fd, + void *buf, + int count, + MPI_Datatype datatype, + int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + +void ADIOI_IME_WriteContig(ADIO_File fd, + const void *buf, + int count, + MPI_Datatype datatype, + int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + +void ADIOI_IME_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); + +void ADIOI_IME_Flush(ADIO_File fd, int *error_code); + +void ADIOI_IME_Delete(const char *filename, int *error_code); + +void ADIOI_IME_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); + +void ADIOI_IME_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +int ADIOI_IME_Feature(ADIO_File fd, int flag); +#endif /* AD_IME_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_close.c b/3rd-party/romio341/adio/ad_ime/ad_ime_close.c new file mode 100644 index 0000000000000000000000000000000000000000..2aabde8d21b07af6325d201a64b2a3de2da5d1c6 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_close.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "ad_ime_common.h" +#include <assert.h> + +void ADIOI_IME_Close(ADIO_File fd, int *error_code) +{ + static char myname[] = "ADIOI_IME_CLOSE"; + int ret; + struct ADIOI_IME_fs_s *ime_fs; + int tmp_error_code; + + ret = ime_native_close(fd->fd_sys); + if (ret != 0) { + tmp_error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNKNOWN, "Error in ime_native_close", 0); + } else { + tmp_error_code = MPI_SUCCESS; + } + + if (error_code) { + *error_code = tmp_error_code; + } + + ime_fs = (ADIOI_IME_fs *) fd->fs_ptr; + assert(ime_fs); + ADIOI_Free(ime_fs->ime_filename); + ime_fs->ime_filename = NULL; + ADIOI_Free(ime_fs); + + /* reset fds */ + fd->fd_direct = -1; + fd->fd_sys = -1; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_common.c b/3rd-party/romio341/adio/ad_ime/ad_ime_common.c new file mode 100644 index 0000000000000000000000000000000000000000..7851b6dfd47a63be45b9402059f2f70a0ceb3e71 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_common.c @@ -0,0 +1,81 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "ad_ime_common.h" +#include <unistd.h> +#include <sys/types.h> + +/* keyval hack to both tell us if we've already initialized im and also + * close it down when mpi exits */ +int ADIOI_IME_Initialized = MPI_KEYVAL_INVALID; + +void ADIOI_IME_End(int *error_code) +{ + int ret; + static char myname[] = "ADIOI_IME_END"; + + ret = ime_native_finalize(); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_FILE, "Error in ime_native_finalize", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + +int ADIOI_IME_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state) +{ + int error_code; + ADIOI_IME_End(&error_code); + MPI_Keyval_free(&keyval); + return error_code; +} + +void ADIOI_IME_Init(int rank, int *error_code) +{ + /* do nothing if we've already fired up the im interface */ + if (ADIOI_IME_Initialized != MPI_KEYVAL_INVALID) { + *error_code = MPI_SUCCESS; + return; + } + + ime_native_init(); + + *error_code = MPI_SUCCESS; + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_IME_End_call, &ADIOI_IME_Initialized, (void *) 0); + /* just like romio does, we make a dummy attribute so we + * get cleaned up */ + MPI_Attr_put(MPI_COMM_SELF, ADIOI_IME_Initialized, (void *) 0); +} + +/* Return an IME-compatible filename (add 'ime:' prefix). + * New filename must be free'd by the user */ +char *ADIOI_IME_Add_prefix(const char *filename) +{ + static char myname[] = "ADIOI_IME_ADD_PREFIX"; + size_t f_len = strlen(filename) + 1; + char *ime_filename = ADIOI_Malloc(f_len + ADIOI_IME_PREFIX_LEN); + + if (!ime_filename) { + + MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_UNKNOWN, "Error allocating memory", 0); + + return NULL; + } + + ADIOI_Strncpy(ime_filename, ADIOI_IME_PREFIX, ADIOI_IME_PREFIX_LEN); + ADIOI_Strncpy((ime_filename + ADIOI_IME_PREFIX_LEN), filename, f_len); + return ime_filename; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_common.h b/3rd-party/romio341/adio/ad_ime/ad_ime_common.h new file mode 100644 index 0000000000000000000000000000000000000000..f090009f0c2e5c0b5462786fd4f9fb38de1c14f3 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_common.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_IME_COMMON_H_INCLUDED +#define AD_IME_COMMON_H_INCLUDED +#include "ad_ime.h" + +struct ADIOI_IME_fs_s { + char *ime_filename; +}; + +typedef struct ADIOI_IME_fs_s ADIOI_IME_fs; + +void ADIOI_IME_Init(int rank, int *error_code); +void ADIOI_IME_End(int *error_code); +int ADIOI_IME_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); + +char *ADIOI_IME_Add_prefix(const char *filename); +#endif /* AD_IME_COMMON_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_delete.c b/3rd-party/romio341/adio/ad_ime/ad_ime_delete.c new file mode 100644 index 0000000000000000000000000000000000000000..188456f4fca3ccb21def824f434d5129b5971bbf --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_delete.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "adio.h" + +#include "ad_ime_common.h" + +void ADIOI_IME_Delete(const char *filename, int *error_code) +{ + int ret; + static char myname[] = "ADIOI_IME_DELETE"; + + char *ime_filename = ADIOI_IME_Add_prefix(filename); + ret = ime_native_unlink(ime_filename); + ADIOI_Free(ime_filename); + if (ret) + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_FILE, "Error in ime_native_unlink", 0); + else + *error_code = MPI_SUCCESS; + + return; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_fcntl.c b/3rd-party/romio341/adio/ad_ime/ad_ime_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..b2b5d2cd202639bd0afdb005bf09877697d34190 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_fcntl.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "adio_extern.h" +#include "ad_ime_common.h" +#include <assert.h> + +void ADIOI_IME_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int ret; + static char myname[] = "ADIOI_IME_FCNTL"; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + { + struct stat stbuf; + + stbuf.st_size = 0; + struct ADIOI_IME_fs_s *ime_fs = (ADIOI_IME_fs *) fd->fs_ptr; + assert(ime_fs); + ret = ime_native_stat(ime_fs->ime_filename, &stbuf); + + if (ret) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_FILE, "Error in ime_native_stat", 0); + return; + } + + fcntl_struct->fsize = stbuf.st_size; + *error_code = MPI_SUCCESS; + break; + } + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + break; + }; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_features.c b/3rd-party/romio341/adio/ad_ime/ad_ime_features.c new file mode 100644 index 0000000000000000000000000000000000000000..cc26f68fb135bf2faf2ba7f796b29ae8e8f519b3 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_features.c @@ -0,0 +1,20 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "ad_ime.h" + +int ADIOI_IME_Feature(ADIO_File fd, int flag) +{ + switch (flag) { + case ADIO_SCALABLE_OPEN: + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_flush.c b/3rd-party/romio341/adio/ad_ime/ad_ime_flush.c new file mode 100644 index 0000000000000000000000000000000000000000..3f7d39e290e8b651b9626beb39ddfdbfcf05ec55 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_flush.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "ad_ime_common.h" + +#include <assert.h> + +void ADIOI_IME_Flush(ADIO_File fd, int *error_code) +{ + int ret; + static char myname[] = "ADIOI_IME_FLUSH"; + + if (!error_code) { + return; + } + + if (!fd) { + *error_code = MPI_ERR_FILE; + return; + } + + ret = ime_native_fsync(fd->fd_sys); + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_FILE, "Error in ime_native_fsync", 0); + return; + } + + *error_code = MPI_SUCCESS; + + return; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_io.c b/3rd-party/romio341/adio/ad_ime/ad_ime_io.c new file mode 100644 index 0000000000000000000000000000000000000000..052022983cf241b496f241e7e7b539b579bedf00 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_io.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_ime.h" + +#include "ad_ime_common.h" + +#include <stdint.h> + +#define IME_READ 0 +#define IME_WRITE 1 + +static void IME_IOContig(ADIO_File fd, + void *buf, + int count, + MPI_Datatype datatype, + int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int io_flag, int *error_code) +{ + ssize_t ret; + MPI_Count datatype_size; + size_t mem_len; + uint64_t file_offset = offset; + static char myname[] = "ADIOI_IME_IOCONTIG"; + + if (count == 0) { + ret = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + mem_len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) + file_offset = fd->fp_ind; + + switch (io_flag) { + case IME_READ: + ret = ime_native_pread(fd->fd_sys, buf, mem_len, offset); + break; + case IME_WRITE: + ret = ime_native_pwrite(fd->fd_sys, buf, mem_len, offset); + break; + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "Unknown flag", 0); + goto exit; + + break; + }; + + /* Let the application decide how to fail */ + if (ret < 0) { + *error_code = MPI_SUCCESS; + goto exit; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += ret; + fd->fp_sys_posn = file_offset + ret; + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, ret); +#endif + + *error_code = MPI_SUCCESS; + + exit: + return; +} + +void ADIOI_IME_ReadContig(ADIO_File fd, + void *buf, + int count, + MPI_Datatype datatype, + int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + IME_IOContig(fd, buf, count, datatype, file_ptr_type, offset, status, IME_READ, error_code); +} + +void ADIOI_IME_WriteContig(ADIO_File fd, + const void *buf, + int count, + MPI_Datatype datatype, + int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + IME_IOContig(fd, + (void *) buf, + count, datatype, file_ptr_type, offset, status, IME_WRITE, error_code); +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_open.c b/3rd-party/romio341/adio/ad_ime/ad_ime_open.c new file mode 100644 index 0000000000000000000000000000000000000000..6a9b07c648e86c0c41c6a80948a1bb50d8c70e40 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_open.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "ad_ime_common.h" + +#include <assert.h> + +void ADIOI_IME_Open(ADIO_File fd, int *error_code) +{ + static char myname[] = "ADIOI_IME_OPEN"; + struct ADIOI_IME_fs_s *ime_fs; + int perm; + int amode = 0; + int ret; + int rank = 0; + mode_t old_mask; + + /* validate input args */ + if (!fd) { + *error_code = MPI_ERR_FILE; + return; + } + if (!error_code) { + *error_code = MPI_ERR_FILE; + return; + } + + /* setup file permissions */ + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + /* setup the file access mode */ + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + /* XXX no O_APPEND support */ + assert((fd->access_mode & ADIO_APPEND) == 0); + + /* init IME */ + MPI_Comm_rank(fd->comm, &rank); + ADIOI_IME_Init(rank, error_code); + if (*error_code != MPI_SUCCESS) + return; + + ime_fs = (ADIOI_IME_fs *) ADIOI_Malloc(sizeof(ADIOI_IME_fs)); + + /* --BEGIN ERROR HANDLING-- */ + if (ime_fs == NULL) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNKNOWN, "Error allocating memory", 0); + return; + } + + ime_fs->ime_filename = ADIOI_IME_Add_prefix(fd->filename); + + /* all processes open the file */ + ret = ime_native_open(ime_fs->ime_filename, amode, perm); + if (ret < 0) { + *error_code = MPI_ERR_FILE; + ADIOI_Free(ime_fs->ime_filename); + ADIOI_Free(ime_fs); + return; + } + + fd->fd_sys = ret; + fd->fd_direct = -1; + fd->fs_ptr = ime_fs; + + *error_code = MPI_SUCCESS; + + return; +} diff --git a/3rd-party/romio341/adio/ad_ime/ad_ime_resize.c b/3rd-party/romio341/adio/ad_ime/ad_ime_resize.c new file mode 100644 index 0000000000000000000000000000000000000000..abe41875fb0400b4f730354740f70d7edab9f998 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ime/ad_ime_resize.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ime.h" +#include "ad_ime_common.h" +#include <assert.h> + +void ADIOI_IME_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int ret; + static char myname[] = "ADIOI_IME_RESIZE"; + + if (!error_code) + return; + if (!fd) { + *error_code = MPI_ERR_FILE; + return; + } + + ret = ime_native_ftruncate(fd->fd_sys, size); + + if (ret != 0) + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_FILE, "Error in ime_native_ftruncate", 0); + else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_lustre/Makefile.mk b/3rd-party/romio341/adio/ad_lustre/Makefile.mk similarity index 67% rename from 3rd-party/romio321/adio/ad_lustre/Makefile.mk rename to 3rd-party/romio341/adio/ad_lustre/Makefile.mk index 43eaa025b94f44ac284f5b89a2ef41f9cb7e6345..2ce2b58648ecc00961e3a632ec5f46761dad9f70 100644 --- a/3rd-party/romio321/adio/ad_lustre/Makefile.mk +++ b/3rd-party/romio341/adio/ad_lustre/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_LUSTRE @@ -18,5 +16,9 @@ romio_other_sources += \ adio/ad_lustre/ad_lustre_hints.c \ adio/ad_lustre/ad_lustre_aggregate.c -endif BUILD_AD_LUSTRE +if LUSTRE_LOCKAHEAD +romio_other_sources += \ + adio/ad_lustre/ad_lustre_lock.c +endif LUSTRE_LOCKAHEAD +endif BUILD_AD_LUSTRE diff --git a/3rd-party/romio321/adio/ad_lustre/README b/3rd-party/romio341/adio/ad_lustre/README similarity index 100% rename from 3rd-party/romio321/adio/ad_lustre/README rename to 3rd-party/romio341/adio/ad_lustre/README diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre.c new file mode 100644 index 0000000000000000000000000000000000000000..b7f5108bbf210d370b55fac8959ff053759ee930 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" + +struct ADIOI_Fns_struct ADIO_LUSTRE_operations = { + ADIOI_LUSTRE_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_LUSTRE_ReadContig, /* ReadContig */ + ADIOI_LUSTRE_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_LUSTRE_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ + ADIOI_LUSTRE_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_LUSTRE_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ +#if defined(ROMIO_HAVE_WORKING_AIO) && !defined(CRAY_XT_LUSTRE) + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Flush, /* Flush */ + ADIOI_GEN_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ + "LUSTRE:", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre.h b/3rd-party/romio341/adio/ad_lustre/ad_lustre.h new file mode 100644 index 0000000000000000000000000000000000000000..0190d7628b50948aa0f366ccca0929ea2d7aba71 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_LUSTRE_H_INCLUDED +#define AD_LUSTRE_H_INCLUDED + +/* temp*/ +#define HAVE_ASM_TYPES_H 1 + +#include "adio.h" +#define _GNU_SOURCE 1 +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <unistd.h> +#include <linux/types.h> + +#ifdef __linux__ +#include <sys/ioctl.h> /* necessary for: */ +#include <time.h> +#ifndef __USE_GNU +#define __USE_GNU 1 /* O_DIRECT and */ +#include <fcntl.h> /* IO operations */ +#endif +#undef __USE_GNU +#endif /* __linux__ */ + +#include <sys/ioctl.h> + +#include "ad_tuning.h" + +#ifdef HAVE_LUSTRE_LUSTRE_USER_H +#include <lustre/lustre_user.h> +#endif +#ifdef HAVE_LINUX_LUSTRE_LUSTRE_USER_H +#include <linux/lustre/lustre_user.h> +#endif + + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + +#ifdef HAVE_AIO_LITE_H +#include <aio-lite.h> +#else +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif +#endif /* End of HAVE_AIO_LITE_H */ + +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code); +void ADIOI_LUSTRE_Close(ADIO_File fd, int *error_code); +void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +/* the lustre utilities: */ +int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, + ADIO_Offset * len_list, int nprocs); + +void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int *striping_info, int mode); +void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + int *striping_info, int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, ADIO_Offset *** buf_idx_ptr); + +int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, + ADIO_Offset * len, int *striping_info); +#endif /* AD_LUSTRE_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_aggregate.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_aggregate.c new file mode 100644 index 0000000000000000000000000000000000000000..493abaa0377499c790eafc91aa70db3b669e5684 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_aggregate.c @@ -0,0 +1,313 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +#undef AGG_DEBUG + +void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int *striping_info, int mode) +{ + /* get striping information: + * striping_info[0]: stripe_size + * striping_info[1]: stripe_count + * striping_info[2]: avail_cb_nodes + */ + int stripe_size, stripe_count, CO = 1; + int avail_cb_nodes, divisor, nprocs_for_coll = fd->hints->cb_nodes; + + /* Get hints value */ + /* stripe size */ + stripe_size = fd->hints->striping_unit; + /* stripe count */ + /* stripe_size and stripe_count have been validated in ADIOI_LUSTRE_Open() */ + stripe_count = fd->hints->striping_factor; + + /* Calculate the available number of I/O clients */ + if (!mode) { + /* for collective read, + * if "CO" clients access the same OST simultaneously, + * the OST disk seek time would be much. So, to avoid this, + * it might be better if 1 client only accesses 1 OST. + * So, we set CO = 1 to meet the above requirement. + */ + CO = 1; + /*XXX: maybe there are other better way for collective read */ + } else { + /* CO also has been validated in ADIOI_LUSTRE_Open(), >0 */ + CO = fd->hints->fs_hints.lustre.co_ratio; + } + /* Calculate how many IO clients we need */ + /* Algorithm courtesy Pascal Deveze (pascal.deveze@bull.net) */ + /* To avoid extent lock conflicts, + * avail_cb_nodes should either + * - be a multiple of stripe_count, + * - or divide stripe_count exactly + * so that each OST is accessed by a maximum of CO constant clients. */ + if (nprocs_for_coll >= stripe_count) + /* avail_cb_nodes should be a multiple of stripe_count and the number + * of procs per OST should be limited to the minimum between + * nprocs_for_coll/stripe_count and CO + * + * e.g. if stripe_count=20, nprocs_for_coll=42 and CO=3 then + * avail_cb_nodes should be equal to 40 */ + avail_cb_nodes = stripe_count * MPL_MIN(nprocs_for_coll / stripe_count, CO); + else { + /* nprocs_for_coll is less than stripe_count */ + /* avail_cb_nodes should divide stripe_count */ + /* e.g. if stripe_count=60 and nprocs_for_coll=8 then + * avail_cb_nodes should be egal to 6 */ + /* This could be done with : + * while (stripe_count % avail_cb_nodes != 0) avail_cb_nodes--; + * but this can be optimized for large values of nprocs_for_coll and + * stripe_count */ + divisor = 2; + avail_cb_nodes = 1; + /* try to divise */ + while (stripe_count >= divisor * divisor) { + if ((stripe_count % divisor) == 0) { + if (stripe_count / divisor <= nprocs_for_coll) { + /* The value is found ! */ + avail_cb_nodes = stripe_count / divisor; + break; + } + /* if divisor is less than nprocs_for_coll, divisor is a + * solution, but it is not sure that it is the best one */ + else if (divisor <= nprocs_for_coll) + avail_cb_nodes = divisor; + } + divisor++; + } + } + + striping_info[0] = stripe_size; + striping_info[1] = stripe_count; + striping_info[2] = avail_cb_nodes; +} + +int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, + ADIO_Offset * len, int *striping_info) +{ + int rank_index, rank; + ADIO_Offset avail_bytes; + int stripe_size = striping_info[0]; + int avail_cb_nodes = striping_info[2]; + + /* Produce the stripe-contiguous pattern for Lustre */ + rank_index = (int) ((off / stripe_size) % avail_cb_nodes); + + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort + */ + if (rank_index >= fd->hints->cb_nodes) + MPI_Abort(MPI_COMM_WORLD, 1); + + avail_bytes = (off / (ADIO_Offset) stripe_size + 1) * (ADIO_Offset) stripe_size - off; + if (avail_bytes < *len) { + /* this proc only has part of the requested contig. region */ + *len = avail_bytes; + } + /* map our index to a rank */ + /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ + rank = fd->hints->ranklist[rank_index]; + + return rank; +} + +/* ADIOI_LUSTRE_Calc_my_req() - calculate what portions of the access requests + * of this process are located in the file domains of various processes + * (including this one) + */ + + +void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + int *striping_info, int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, ADIO_Offset *** buf_idx_ptr) +{ + /* Nothing different from ADIOI_Calc_my_req(), except calling + * ADIOI_Lustre_Calc_aggregator() instead of the old one */ + int *count_my_req_per_proc, count_my_req_procs; + int i, l, proc; + size_t memLen; + ADIO_Offset avail_len, rem_len, curr_idx, off, **buf_idx, *ptr; + ADIOI_Access *my_req; + + *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + count_my_req_per_proc = *count_my_req_per_proc_ptr; + /* count_my_req_per_proc[i] gives the no. of contig. requests of this + * process in process i's file domain. calloc initializes to zero. + * I'm allocating memory of size nprocs, so that I can do an + * MPI_Alltoall later on. + */ + + /* one pass just to calculate how much space to allocate for my_req; + * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() + */ + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write + */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + avail_len = len_list[i]; + /* note: we set avail_len to be the total size of the access. + * then ADIOI_LUSTRE_Calc_aggregator() will modify the value to return + * the amount that was available. + */ + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + count_my_req_per_proc[proc]++; + + /* figure out how many data is remaining in the access + * we'll take care of this data (if there is any) + * in the while loop below. + */ + rem_len = len_list[i] - avail_len; + + while (rem_len != 0) { + off += avail_len; /* point to first remaining byte */ + avail_len = rem_len; /* save remaining size, pass to calc */ + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + count_my_req_per_proc[proc]++; + rem_len -= avail_len; /* reduce remaining length by amount from fd */ + } + } + + /* buf_idx is relevant only if buftype_is_contig. + * buf_idx[i] gives the index into user_buf where data received + * from proc 'i' should be placed. This allows receives to be done + * without extra buffer. This can't be done if buftype is not contig. + */ + + memLen = 0; + for (i = 0; i < nprocs; i++) + memLen += count_my_req_per_proc[i]; + ptr = (ADIO_Offset *) ADIOI_Malloc((memLen * 3 + nprocs) * sizeof(ADIO_Offset)); + + /* initialize buf_idx vectors */ + buf_idx = (ADIO_Offset **) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset *)); + buf_idx[0] = ptr; + for (i = 1; i < nprocs; i++) + buf_idx[i] = buf_idx[i - 1] + count_my_req_per_proc[i - 1] + 1; + ptr += memLen + nprocs; /* "+ nprocs" puts a terminal index at the end */ + + /* now allocate space for my_req, offset, and len */ + *my_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + my_req = *my_req_ptr; + my_req[0].offsets = ptr; + + count_my_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i]) { + my_req[i].offsets = ptr; + ptr += count_my_req_per_proc[i]; + my_req[i].lens = ptr; + ptr += count_my_req_per_proc[i]; + count_my_req_procs++; + } + my_req[i].count = 0; /* will be incremented where needed later */ + } + + /* now fill in my_req */ + curr_idx = 0; + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + avail_len = len_list[i]; + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + + l = my_req[proc].count; + + ADIOI_Assert(l < count_my_req_per_proc[proc]); + buf_idx[proc][l] = curr_idx; + curr_idx += avail_len; + + rem_len = len_list[i] - avail_len; + + /* store the proc, offset, and len information in an array + * of structures, my_req. Each structure contains the + * offsets and lengths located in that process's FD, + * and the associated count. + */ + my_req[proc].offsets[l] = off; + ADIOI_Assert(avail_len == (int) avail_len); + my_req[proc].lens[l] = (int) avail_len; + my_req[proc].count++; + + while (rem_len != 0) { + off += avail_len; + avail_len = rem_len; + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + + l = my_req[proc].count; + ADIOI_Assert(l < count_my_req_per_proc[proc]); + buf_idx[proc][l] = curr_idx; + + curr_idx += avail_len; + rem_len -= avail_len; + + my_req[proc].offsets[l] = off; + ADIOI_Assert(avail_len == (int) avail_len); + my_req[proc].lens[l] = (int) avail_len; + my_req[proc].count++; + } + } + +#ifdef AGG_DEBUG + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i] > 0) { + FPRINTF(stdout, "data needed from %d (count = %d):\n", i, my_req[i].count); + for (l = 0; l < my_req[i].count; l++) { + FPRINTF(stdout, " off[%d] = %lld, len[%d] = %d\n", + l, (long long) my_req[i].offsets[l], l, (long long) my_req[i].lens[l]); + } + } + } +#endif + + *count_my_req_procs_ptr = count_my_req_procs; + *buf_idx_ptr = buf_idx; +} + +int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, + ADIO_Offset * len_list, int nprocs) +{ + /* If the processes are non-interleaved, we will check the req_size. + * if (avg_req_size > big_req_size) { + * docollect = 0; + * } + */ + + int i, docollect = 1, big_req_size = 0; + ADIO_Offset req_size = 0, total_req_size; + int avg_req_size, total_access_count; + + /* calculate total_req_size and total_access_count */ + for (i = 0; i < contig_access_count; i++) + req_size += len_list[i]; + MPI_Allreduce(&req_size, &total_req_size, 1, MPI_LONG_LONG_INT, MPI_SUM, fd->comm); + MPI_Allreduce(&contig_access_count, &total_access_count, 1, MPI_INT, MPI_SUM, fd->comm); + /* avoid possible divide-by-zero) */ + if (total_access_count != 0) { + /* estimate average req_size */ + avg_req_size = (int) (total_req_size / total_access_count); + } else { + avg_req_size = 0; + } + /* get hint of big_req_size */ + big_req_size = fd->hints->fs_hints.lustre.coll_threshold; + /* Don't perform collective I/O if there are big requests */ + if ((big_req_size > 0) && (avg_req_size > big_req_size)) + docollect = 0; + + return docollect; +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_fcntl.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..5d9f4026214aaf4d3b52b7676ab597a744f57ba0 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_fcntl.c @@ -0,0 +1,97 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int i, ntimes; + ADIO_Offset curr_fsize, alloc_size, size, len, done; + ADIO_Status status; + char *buf; +#if defined(MPICH) || !defined(PRINT_ERR_MSG) + static char myname[] = "ADIOI_LUSTRE_FCNTL"; +#endif + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); + if (fd->fp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + if (fcntl_struct->fsize == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + /* will be called by one process only */ + /* On file systems with no preallocation function, I have to + * explicitly write + * to allocate space. Since there could be holes in the file, + * I need to read up to the current file size, write it back, + * and then write beyond that depending on how much + * preallocation is needed. + * read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */ + + curr_fsize = lseek(fd->fd_sys, 0, SEEK_END); + alloc_size = fcntl_struct->diskspace; + + size = MPL_MIN(curr_fsize, alloc_size); + + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1) / ADIOI_PREALLOC_BUFSZ; + buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); + done = 0; + + for (i = 0; i < ntimes; i++) { + len = MPL_MIN(size - done, ADIOI_PREALLOC_BUFSZ); + ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, + &status, error_code); + if (*error_code != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + strerror(errno)); + return; + } + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + done, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + done += len; + } + + if (alloc_size > curr_fsize) { + memset(buf, 0, ADIOI_PREALLOC_BUFSZ); + size = alloc_size - curr_fsize; + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1) / ADIOI_PREALLOC_BUFSZ; + for (i = 0; i < ntimes; i++) { + len = MPL_MIN(alloc_size - done, ADIOI_PREALLOC_BUFSZ); + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + done, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + done += len; + } + } + ADIOI_Free(buf); + if (fd->fp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + FPRINTF(stderr, "Unknown flag passed to ADIOI_LUSTRE_Fcntl\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_hints.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..152ba31f6f93a50152170e35aee7a74fe7417cc1 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_hints.c @@ -0,0 +1,182 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" +#include "hint_fns.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value; + int flag; + ADIO_Offset stripe_val[3], str_factor = -1, str_unit = 0, start_iodev = -1; + int myrank; + static char myname[] = "ADIOI_LUSTRE_SETINFO"; + + +#ifdef HAVE_LUSTRE_LOCKAHEAD + /* Set lock ahead default hints */ + fd->hints->fs_hints.lustre.lock_ahead_read = 0; + fd->hints->fs_hints.lustre.lock_ahead_write = 0; + fd->hints->fs_hints.lustre.lock_ahead_num_extents = 500; + fd->hints->fs_hints.lustre.lock_ahead_flags = 0; +#endif + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if ((fd->info) == MPI_INFO_NULL) { + /* This must be part of the open call. can set striping parameters + * if necessary. */ + MPI_Info_create(&(fd->info)); + + ADIOI_Info_set(fd->info, "direct_read", "false"); + ADIOI_Info_set(fd->info, "direct_write", "false"); + fd->direct_read = fd->direct_write = 0; + /* initialize lustre hints */ + ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", "1"); + fd->hints->fs_hints.lustre.co_ratio = 1; + ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", "0"); + fd->hints->fs_hints.lustre.coll_threshold = 0; + ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "enable"); + fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_ENABLE; + + /* has user specified striping or server buffering parameters + * and do they have the same value on all processes? */ + if (users_info != MPI_INFO_NULL) { + /* striping information */ + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + ADIOI_Info_set(fd->info, "striping_unit", value); + str_unit = atoll(value); + } + + ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + ADIOI_Info_set(fd->info, "striping_factor", value); + str_factor = atoll(value); + } + + ADIOI_Info_get(users_info, "romio_lustre_start_iodevice", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); + start_iodev = atoll(value); + } + + + /* direct read and write */ + ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, value, &flag); + if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { + ADIOI_Info_set(fd->info, "direct_read", "true"); + fd->direct_read = 1; + } + ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, value, &flag); + if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { + ADIOI_Info_set(fd->info, "direct_write", "true"); + fd->direct_write = 1; + } +#ifdef HAVE_LUSTRE_LOCKAHEAD + /* Get lock ahead hints */ + + ADIOI_Info_check_and_install_int(fd, users_info, + "romio_lustre_cb_lock_ahead_write", + &(fd->hints->fs_hints.lustre.lock_ahead_write), + myname, error_code); + ADIOI_Info_check_and_install_int(fd, users_info, + "romio_lustre_cb_lock_ahead_read", + &(fd->hints->fs_hints.lustre.lock_ahead_read), + myname, error_code); + + /* If, and only if, we're using lock ahead, + * process/set the number of extents to pre-lock and the flags */ + if (fd->hints->fs_hints.lustre.lock_ahead_read || + fd->hints->fs_hints.lustre.lock_ahead_write) { + /* Get user's number of extents */ + ADIOI_Info_check_and_install_int(fd, users_info, + "romio_lustre_cb_lock_ahead_num_extents", + &(fd->hints->fs_hints. + lustre.lock_ahead_num_extents), myname, + error_code); + + /* ADIOI_Info_check_and_install_int doesn't set the + * value in fd unless it was in user_info, but knowing + * the value - default or explicit - is useful. + * Set the final number of extents in the fd->info */ + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", + fd->hints->fs_hints.lustre.lock_ahead_num_extents); + ADIOI_Info_set(fd->info, "romio_lustre_cb_lock_ahead_num_extents", value); + + /* Get user's flags */ + ADIOI_Info_check_and_install_int(fd, users_info, + "romio_lustre_cb_lock_ahead_flags", + &(fd->hints->fs_hints.lustre.lock_ahead_flags), + myname, error_code); + } +#endif + } + + + + /* set striping information with ioctl */ + MPI_Comm_rank(fd->comm, &myrank); + if (myrank == 0) { + stripe_val[0] = str_factor; + stripe_val[1] = str_unit; + stripe_val[2] = start_iodev; + } + MPI_Bcast(stripe_val, 3, MPI_OFFSET, 0, fd->comm); + + /* do not open file in hint processing. Open file in open routines, + * where we can better deal with EXCL flag . Continue to check the + * "all processors set a value" condition holds. */ + if (stripe_val[0] != str_factor + || stripe_val[1] != str_unit || stripe_val[2] != start_iodev) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME("ADIOI_LUSTRE_SetInfo", + "str_factor or str_unit or start_iodev", error_code); + ADIOI_Free(value); + return; + } + } + + /* get other hint */ + if (users_info != MPI_INFO_NULL) { + /* CO: IO Clients/OST, + * to keep the load balancing between clients and OSTs */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_co_ratio", + &(fd->hints->fs_hints.lustre.co_ratio), myname, + error_code); + + /* coll_threshold: + * if the req size is bigger than this, collective IO may not be performed. + */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_coll_threshold", + &(fd->hints->fs_hints.lustre.coll_threshold), myname, + error_code); + + /* ds_in_coll: disable data sieving in collective IO */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_lustre_ds_in_coll", + &(fd->hints->fs_hints.lustre.ds_in_coll), myname, + error_code); + + } + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + /* generic hints might step on striping_unit */ + if (users_info != MPI_INFO_NULL) { + ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", NULL, myname, error_code); + } + + if (ADIOI_Direct_read) + fd->direct_read = 1; + if (ADIOI_Direct_write) + fd->direct_write = 1; + + ADIOI_Free(value); + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_lock.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_lock.c new file mode 100644 index 0000000000000000000000000000000000000000..eb4e6307888bc49fc14044a89b0c02dc91ad3a9f --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_lock.c @@ -0,0 +1,407 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#include "ad_lustre.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <stdint.h> + +/* If necessary (older luster client headers) define the new + locking structures. */ + + + + + + +//#define LOCK_AHEAD_DEBUG + +#ifndef LL_IOC_LADVISE +#define LL_IOC_LADVISE _IOR('f', 250, struct llapi_lu_ladvise) + +enum lu_ladvise_type { + LU_LADVISE_INVALID = 0, + LU_LADVISE_WILLREAD = 1, + LU_LADVISE_DONTNEED = 2, + LU_LADVISE_LOCKNOEXPAND = 3, + LU_LADVISE_LOCKAHEAD = 4, + LU_LADVISE_MAX +}; + +#define LU_LADVISE_NAMES { \ + [LU_LADVISE_WILLREAD] = "willread", \ + [LU_LADVISE_DONTNEED] = "dontneed", \ + [LU_LADVISE_LOCKNOEXPAND] = "locknoexpand", \ + [LU_LADVISE_LOCKAHEAD] = "lockahead", \ +} + +/* This is the userspace argument for ladvise. It is currently the same as + * what goes on the wire (struct lu_ladvise), but is defined separately as we + * may need info which is only used locally. */ +struct llapi_lu_ladvise { + __u16 lla_advice; /* advice type */ + __u16 lla_value1; /* values for different advice types */ + __u32 lla_value2; + __u64 lla_start; /* first byte of extent for advice */ + __u64 lla_end; /* last byte of extent for advice */ + __u32 lla_value3; + __u32 lla_value4; +}; +enum ladvise_flag { + LF_ASYNC = 0x00000001, + LF_UNSET = 0x00000002, + /* For lock requests */ + LF_NONBLOCK = 0x00000003, +}; + +#define LADVISE_MAGIC 0x1ADF1CE0 +/* Masks of valid flags for each advice */ +#define LF_LOCKNOEXPAND_MASK LF_UNSET +#define LF_LOCKAHEAD_MASK LF_NONBLOCK +/* Flags valid for all advices not explicitly specified */ +#define LF_DEFAULT_MASK LF_ASYNC +/* All flags */ +#define LF_MASK (LF_ASYNC | LF_UNSET | LF_NONBLOCK) + +#define lla_lockahead_mode lla_value1 +#define lla_peradvice_flags lla_value2 +#define lla_lockahead_result lla_value3 + +/* This is the userspace argument for ladvise, corresponds to ladvise_hdr which + * is used on the wire. It is defined separately as we may need info which is + * only used locally. */ +struct llapi_ladvise_hdr { + __u32 lah_magic; /* LADVISE_MAGIC */ + __u32 lah_count; /* number of advices */ + __u64 lah_flags; /* from enum ladvise_flag */ + __u32 lah_value1; /* unused */ + __u32 lah_value2; /* unused */ + __u64 lah_value3; /* unused */ + struct llapi_lu_ladvise lah_advise[0]; /* advices in this header */ +}; + +#define LAH_COUNT_MAX (1024) + +enum lock_mode_user { + MODE_READ_USER = 1, + MODE_WRITE_USER, + MODE_MAX_USER, +}; + +#define LOCK_MODE_NAMES { \ + [MODE_READ_USER] = "READ",\ + [MODE_WRITE_USER] = "WRITE"\ +} + +enum lockahead_results { + LLA_RESULT_SENT = 0, + LLA_RESULT_DIFFERENT, + LLA_RESULT_SAME, +}; +#endif + + +int llapi_ladvise_lock(ADIO_File fd, unsigned long long flags, int num_advise, + ADIO_Offset * offset, int stripe_size, int num_extents, + ADIO_Offset step_size) +{ + struct llapi_ladvise_hdr *ladvise_hdr; + int rc; + int i; + enum lock_mode_user mode = 0; + + if (num_advise < 1 || num_advise >= LAH_COUNT_MAX) { + errno = EINVAL; + /*llapi_error(LLAPI_MSG_ERROR, -EINVAL, + * "bad advice number %d", num_advise); */ + return -1; + } + + ladvise_hdr = + ADIOI_Malloc(sizeof(struct llapi_ladvise_hdr) + + sizeof(struct llapi_lu_ladvise) * num_advise); + + if (ladvise_hdr == NULL) { + errno = ENOMEM; + //llapi_error(LLAPI_MSG_ERROR, -ENOMEM, "not enough memory"); + return -1; + } + ladvise_hdr->lah_magic = LADVISE_MAGIC; + ladvise_hdr->lah_count = num_advise; + ladvise_hdr->lah_flags = flags & LF_MASK; + ladvise_hdr->lah_value1 = 0; + ladvise_hdr->lah_value2 = 0; + ladvise_hdr->lah_value3 = 0; + + if (fd->hints->fs_hints.lustre.lock_ahead_write) + mode = MODE_WRITE_USER; + else if (fd->hints->fs_hints.lustre.lock_ahead_read) /* read only */ + mode = MODE_READ_USER; + else + MPI_Abort(MPI_COMM_WORLD, 1); + + for (i = 0; i < num_extents; ++i) { + ladvise_hdr->lah_advise[i].lla_advice = LU_LADVISE_LOCKAHEAD; + ladvise_hdr->lah_advise[i].lla_lockahead_mode = mode; + ladvise_hdr->lah_advise[i].lla_peradvice_flags = flags | LF_ASYNC; + ladvise_hdr->lah_advise[i].lla_start = *offset; + ladvise_hdr->lah_advise[i].lla_end = *offset + stripe_size - 1;; + ladvise_hdr->lah_advise[i].lla_value3 = 0; + ladvise_hdr->lah_advise[i].lla_value4 = 0; + ladvise_hdr->lah_advise[i].lla_lockahead_result = 0; + *offset += step_size; + } + + + rc = ioctl(fd->fd_sys, LL_IOC_LADVISE, ladvise_hdr); + + if (rc < 0) { + ADIOI_Free(ladvise_hdr); + //llapi_error(LLAPI_MSG_ERROR, -errno, "cannot give advice"); + return -1; + } + + + /* Simply save the new start/end extents, forget what we aleady had locked + * since lustre may reclaim it at any time. */ + fd->hints->fs_hints.lustre.lock_ahead_start_extent = ladvise_hdr->lah_advise[0].lla_start; + fd->hints->fs_hints.lustre.lock_ahead_end_extent = + ladvise_hdr->lah_advise[num_extents - 1].lla_end; + + +#ifdef LOCK_AHEAD_DEBUG + /* Print any per extent errors */ + for (i = 0; i < num_extents; ++i) { + if (ladvise_hdr->lah_advise[i].lla_lockahead_result) { + fprintf(stderr, "%s(%d) " + "lock ahead extent[%4.4d] {%ld,%ld} stripe {%ld,%ld} error %d\n", + __func__, __LINE__, + i, + (long int) ladvise_hdr->lah_advise[i].lla_start, + (long int) ladvise_hdr->lah_advise[i].lla_end, + (long int) ladvise_hdr->lah_advise[i].lla_start / stripe_size, + (long int) ladvise_hdr->lah_advise[i].lla_end / stripe_size, + ladvise_hdr->lah_advise[i].lla_lockahead_result); + } + } + +#endif + ADIOI_Free(ladvise_hdr); + + return 0; +} + + + + + + + +/* Set lustre locks to only lock the requested byte range, do not + extend any locks to 'infinity' which is the normal behavior. + This will enhance 'lock ahead' extent locking, which we do not + want to auto-extend. */ +int ADIOI_LUSTRE_request_only_lock_ioctl(ADIO_File fd) +{ + int err = 0; + + struct llapi_ladvise_hdr *noexpand_hdr; + noexpand_hdr = ADIOI_Malloc(sizeof(struct llapi_ladvise_hdr) + sizeof(struct llapi_lu_ladvise)); + if (!noexpand_hdr) { + err = -ENOMEM; + goto out; + } + + noexpand_hdr->lah_magic = LADVISE_MAGIC; + noexpand_hdr->lah_count = 1; + noexpand_hdr->lah_flags = 0; + noexpand_hdr->lah_value1 = 0; + noexpand_hdr->lah_value2 = 0; + noexpand_hdr->lah_value3 = 0; + noexpand_hdr->lah_advise[0].lla_advice = LU_LADVISE_LOCKNOEXPAND; + noexpand_hdr->lah_advise[0].lla_peradvice_flags = 0; + + noexpand_hdr->lah_advise[0].lla_value1 = 0; + noexpand_hdr->lah_advise[0].lla_start = 0; + noexpand_hdr->lah_advise[0].lla_end = 0; + noexpand_hdr->lah_advise[0].lla_value3 = 0; + noexpand_hdr->lah_advise[0].lla_value4 = 0; + + int rc = ioctl(fd->fd_sys, LL_IOC_LADVISE, noexpand_hdr); + if (rc < 0) { + ADIOI_Free(noexpand_hdr); + //llapi_error(LLAPI_MSG_ERROR, -errno, "cannot give advice"); + return -1; + } + + ADIOI_Free(noexpand_hdr); + + + out: + + return err; +} + +/* Use group locks to 'clear' existing locks on the file + before attempting 'lock ahead' extent locking. */ +int ADIOI_LUSTRE_clear_locks(ADIO_File fd) +{ + int err = 0; + int id; + + if (!fd->my_cb_nodes_index) { + srand(time(NULL)); + id = rand(); + err = ioctl(fd->fd_sys, LL_IOC_GROUP_LOCK, id); + err = ioctl(fd->fd_sys, LL_IOC_GROUP_UNLOCK, id); + } + return err; +} + +/* Lock a predefined series of 'extents' in the file. + The intent is to match the aggregator locking pattern. */ +void ADIOI_LUSTRE_lock_ahead_ioctl(ADIO_File fd, int avail_cb_nodes, ADIO_Offset next_offset, + int *error_code) +{ + + int err = 0; + int num_extents = fd->hints->fs_hints.lustre.lock_ahead_num_extents; + int flags = fd->hints->fs_hints.lustre.lock_ahead_flags; + ADIO_Offset offset = 0, step_size = 0; + int stripe_size = fd->hints->striping_unit; + + int agg_idx = fd->my_cb_nodes_index; + + /* Not a collective aggregator? Do nothing and return + * since current code is based on aggregator/stripes */ + if (agg_idx < 0) { + /* Disable further lock ahead ... + * fd->hints->fs_hints.lustre.lock_ahead_read = 0; + * fd->hints->fs_hints.lustre.lock_ahead_write = 0; + * fd->hints->fs_hints.lustre.lock_ahead_start_extent = 0; + * fd->hints->fs_hints.lustre.lock_ahead_end_extent = INT64_MAX; + */ + return; + } +#ifdef LOCK_AHEAD_DEBUG + { + /* Debug check. Calculate the expected rank for this stripe */ + int rank_index; + rank_index = (int) ((next_offset / stripe_size) % avail_cb_nodes); + /* Not sure why, but this happens in the generic read coll? + * It doesn't do the aggregation striped quite as expected. + * We'll probably lock the wrong stripes for this read ... + * but we're more interested in write locks than read locks + * so stick with the lustre specific calculations for now. + * Consider dropping read support if performance isn't improved + * or ad_lustre doesn't add read coll code. + */ + if (agg_idx != rank_index) { + fprintf(stderr, "%s(%d) rank[%d] file system %d " + "lock ahead debug R(%d)/W(%d), " + "aggregator %d(%d)/%d(%d), " + "offset %lld, start offset %lld, stripe %lld " + "num_extents %d\n", + __func__, __LINE__, + fd->hints->ranklist[agg_idx], + fd->file_system, + fd->hints->fs_hints.lustre.lock_ahead_read, + fd->hints->fs_hints.lustre.lock_ahead_write, + agg_idx, rank_index, + avail_cb_nodes, fd->hints->cb_nodes, + (long long) next_offset, (long long) (next_offset / stripe_size * stripe_size), + (long long) next_offset / stripe_size, num_extents); + } + /* Just checking the config vs what was passed in */ + if (agg_idx >= avail_cb_nodes) { + fprintf(stderr, "%s(%d) file system %d " + "lock ahead debug R(%d)/W(%d), " + "aggregator %d(%d)/%d(%d), " + "num_extents %d\n", + __func__, __LINE__, fd->file_system, + fd->hints->fs_hints.lustre.lock_ahead_read, + fd->hints->fs_hints.lustre.lock_ahead_write, + agg_idx, rank_index, avail_cb_nodes, fd->hints->cb_nodes, num_extents); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } +#endif + + /* Check file access vs requested lock ahead */ + if (fd->access_mode & ADIO_RDONLY) { + /* Don't need write lock ahead */ + fd->hints->fs_hints.lustre.lock_ahead_write = 0; + + /* Do need read lock ahead or give up. */ + if (!(fd->hints->fs_hints.lustre.lock_ahead_read)) { + fd->hints->fs_hints.lustre.lock_ahead_start_extent = 0; + fd->hints->fs_hints.lustre.lock_ahead_end_extent = INT64_MAX; + return; + } + } + if (fd->access_mode & ADIO_WRONLY) { + /* Don't need read lock ahead */ + fd->hints->fs_hints.lustre.lock_ahead_read = 0; + + /* Do need write lock ahead or give up. */ + if (!(fd->hints->fs_hints.lustre.lock_ahead_write)) { + fd->hints->fs_hints.lustre.lock_ahead_start_extent = 0; + fd->hints->fs_hints.lustre.lock_ahead_end_extent = INT64_MAX; + return; + } + } + + + step_size = (ADIO_Offset) avail_cb_nodes *stripe_size; + + if (next_offset == 0) { /* 1st call, calculate our starting offset */ + offset = (ADIO_Offset) agg_idx *stripe_size; + } else /* Have to assume we're writing to one of our stripes */ + offset = next_offset / stripe_size * stripe_size; /* start of stripe */ + + err = llapi_ladvise_lock(fd, flags, num_extents, &offset, stripe_size, num_extents, step_size); + + + if (err == -1) { /* turn off lock ahead after a failure */ +#ifdef LOCK_AHEAD_DEBUG + fprintf(stderr, "%s(%d) file system %d " + "lock ahead failure R(%d)/W(%d), " + "aggregator %d/%d, " + "next offset %lld, stripe %lld, " + "last offset %lld, stripe %lld, " + "step %lld, stripe size %lld " + "num_extents %d\n", + __func__, __LINE__, fd->file_system, + fd->hints->fs_hints.lustre.lock_ahead_read, + fd->hints->fs_hints.lustre.lock_ahead_write, + agg_idx, + avail_cb_nodes, + (long long) next_offset, (long long) next_offset / stripe_size, + (long long) offset, (long long) offset / stripe_size, + (long long) step_size, (long long) stripe_size, num_extents); +#endif + fd->hints->fs_hints.lustre.lock_ahead_read = 0; + fd->hints->fs_hints.lustre.lock_ahead_write = 0; + fd->hints->fs_hints.lustre.lock_ahead_start_extent = 0; + fd->hints->fs_hints.lustre.lock_ahead_end_extent = INT64_MAX; + + *error_code = ADIOI_Err_create_code("ADIOI_LUSTRE_lock_ahead_ioctl", fd->filename, errno); + if (agg_idx == 0) { + fprintf(stderr, "%s: ioctl(LL_IOC_LADVISE) \'%s\'\n", __func__, strerror(errno)); + } + /* Note: it's too late to turn off 'request only' locking, which + * could affect performance without also having 'lock ahead'. + * + * We expect lustre to support this (turning it off) later */ + } + + + return; +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_open.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_open.c new file mode 100644 index 0000000000000000000000000000000000000000..7fbd4d03f628f816f23cdbdc8e27594e9cac90de --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_open.c @@ -0,0 +1,176 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" + +/* what is the basis for this define? + * what happens if there are more than 1k UUIDs? */ + +#define MAX_LOV_UUID_COUNT 1000 + +int ADIOI_LUSTRE_clear_locks(ADIO_File fd); /* in ad_lustre_lock.c */ +int ADIOI_LUSTRE_request_only_lock_ioctl(ADIO_File fd); /* in ad_lustre_lock.c */ + +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code) +{ + int perm, old_mask, amode, amode_direct; + int lumlen, myrank, flag, set_layout = 0, err; + struct lov_user_md *lum = NULL; + char *value; + ADIO_Offset str_factor = -1, str_unit = 0, start_iodev = -1; + size_t value_sz = (MPI_MAX_INFO_VAL + 1) * sizeof(char); + +#if defined(MPICH) || !defined(PRINT_ERR_MSG) + static char myname[] = "ADIOI_LUSTRE_OPEN"; +#endif + + MPI_Comm_rank(fd->comm, &myrank); + + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + amode_direct = amode | O_DIRECT; + + /* odd length here because lov_user_md contains some fixed data and + * then a list of 'lmm_objects' representing stripe */ + lumlen = sizeof(struct lov_user_md) + MAX_LOV_UUID_COUNT * sizeof(struct lov_user_ost_data); + lum = (struct lov_user_md *) ADIOI_Calloc(1, lumlen); + + value = (char *) ADIOI_Malloc(value_sz); + /* we already validated in LUSTRE_SetInfo that these are going to be the same */ + if (fd->info != MPI_INFO_NULL) { + /* striping information */ + ADIOI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL, value, &flag); + if (flag) + str_unit = atoll(value); + + ADIOI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL, value, &flag); + if (flag) + str_factor = atoll(value); + + ADIOI_Info_get(fd->info, "romio_lustre_start_iodevice", MPI_MAX_INFO_VAL, value, &flag); + if (flag) + start_iodev = atoll(value); + } + if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) + set_layout = 1; + + /* if hints were set, we need to delay creation of any lustre objects. + * However, if we open the file with O_LOV_DELAY_CREATE and don't call the + * follow-up ioctl, subsequent writes will fail */ + if (myrank == 0 && set_layout) + amode = amode | O_LOV_DELAY_CREATE; + + fd->fd_sys = open(fd->filename, amode, perm); + if (fd->fd_sys == -1) + goto fn_exit; + + /* we can only set these hints on new files */ + /* It was strange and buggy to open the file in the hint path. Instead, + * we'll apply the file tunings at open time */ + if ((amode & O_CREAT) && set_layout) { + /* if user has specified striping info, first aggregator tries to set + * it */ + if (myrank == fd->hints->ranklist[0] || fd->comm == MPI_COMM_SELF) { + lum->lmm_magic = LOV_USER_MAGIC; + lum->lmm_pattern = 0; + /* crude check for overflow of lustre internal datatypes. + * Silently cap to large value if user provides a value + * larger than lustre supports */ + if (str_unit > UINT_MAX) + lum->lmm_stripe_size = UINT_MAX; + else + lum->lmm_stripe_size = str_unit; + + if (str_factor > USHRT_MAX) + lum->lmm_stripe_count = USHRT_MAX; + else + lum->lmm_stripe_count = str_factor; + + if (start_iodev > USHRT_MAX) + lum->lmm_stripe_offset = USHRT_MAX; + else + lum->lmm_stripe_offset = start_iodev; + err = ioctl(fd->fd_sys, LL_IOC_LOV_SETSTRIPE, lum); + if (err == -1 && errno != EEXIST) { + fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno)); + /* not a fatal error, but user might care to know */ + } + } /* End of striping parameters validation */ + } + + /* Pascal Deveze reports that, even though we pass a + * "GETSTRIPE" (read) flag to the ioctl, if some of the values of this + * struct are uninitialzed, the call can give an error. zero it out in case + * there are other members that must be initialized and in case + * lov_user_md struct changes in future */ + memset(lum, 0, lumlen); + lum->lmm_magic = LOV_USER_MAGIC; + err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *) lum); + if (!err) { + + fd->hints->striping_unit = lum->lmm_stripe_size; + MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_size); + ADIOI_Info_set(fd->info, "striping_unit", value); + + fd->hints->striping_factor = lum->lmm_stripe_count; + MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_count); + ADIOI_Info_set(fd->info, "striping_factor", value); + + fd->hints->start_iodevice = lum->lmm_stripe_offset; + MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_offset); + ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); + + } + + if (fd->access_mode & ADIO_APPEND) + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); + + fd->fd_direct = -1; + if (fd->direct_write || fd->direct_read) { + fd->fd_direct = open(fd->filename, amode_direct, perm); + if (fd->fd_direct != -1) { + fd->d_mem = fd->d_miniosz = (1 << 12); + } else { + perror("cannot open file with O_Direct"); + fd->direct_write = fd->direct_read = 0; + } + } +#ifdef HAVE_LUSTRE_LOCKAHEAD + if (fd->hints->fs_hints.lustre.lock_ahead_read || fd->hints->fs_hints.lustre.lock_ahead_write) { + ADIOI_LUSTRE_clear_locks(fd); + ADIOI_LUSTRE_request_only_lock_ioctl(fd); + } +#endif + + + fn_exit: + ADIOI_Free(lum); + ADIOI_Free(value); + /* --BEGIN ERROR HANDLING-- */ + if (fd->fd_sys == -1 || ((fd->fd_direct == -1) && (fd->direct_write || fd->direct_read))) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } + /* --END ERROR HANDLING-- */ + else + *error_code = MPI_SUCCESS; + +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_rwcontig.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_rwcontig.c new file mode 100644 index 0000000000000000000000000000000000000000..f0c04127400471262c4601a2199c9555a9743178 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_rwcontig.c @@ -0,0 +1,251 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" + +#include <unistd.h> + +#include <stdlib.h> +#include <malloc.h> + +#define LUSTRE_MEMALIGN (1<<12) /* to use page_shift */ + +static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, const void *buf, MPI_Count len, + ADIO_Offset offset, ssize_t * err); +static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, const void *buf, MPI_Count len, + ADIO_Offset offset, ssize_t * err) +{ + ssize_t rem, size, nbytes; + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) { + *err = pwrite(fd->fd_direct, buf, len, offset); + } else if (len < fd->d_miniosz) { + *err = pwrite(fd->fd_sys, buf, len, offset); + } else { + rem = len % fd->d_miniosz; + size = len - rem; + *err = pwrite(fd->fd_direct, buf, size, offset); + if (*err == -1) + return; + nbytes = *err; + *err = pwrite(fd->fd_sys, ((char *) buf) + size, rem, offset + size); + if (*err == -1) + return; + *err += nbytes; + } +} + +static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, const void *buf, MPI_Count len, + ADIO_Offset offset, ssize_t * err); +static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, const void *buf, MPI_Count len, + ADIO_Offset offset, ssize_t * err) +{ + MPI_Count rem, size; + ssize_t nbytes; + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) + *err = pread(fd->fd_direct, (void *) buf, len, offset); + else if (len < fd->d_miniosz) + *err = pread(fd->fd_sys, (void *) buf, len, offset); + else { + rem = len % fd->d_miniosz; + size = len - rem; + *err = pread(fd->fd_direct, (void *) buf, size, offset); + if (*err == -1) + return; + nbytes = *err; + *err = pread(fd->fd_sys, ((char *) buf) + size, rem, offset + size); + if (*err == -1) + return; + *err += nbytes; + } +} + +static ssize_t ADIOI_LUSTRE_Directio(ADIO_File fd, const void *buf, MPI_Count len, + off_t offset, int rw); +static ssize_t ADIOI_LUSTRE_Directio(ADIO_File fd, const void *buf, MPI_Count len, + off_t offset, int rw) +{ + ssize_t err = -1, diff, nbytes = 0; + MPI_Count size = len; + void *newbuf; + + if (offset % fd->d_miniosz) { + diff = fd->d_miniosz - (offset % fd->d_miniosz); + diff = MPL_MIN(diff, len); + if (rw) + nbytes = pwrite(fd->fd_sys, (void *) buf, diff, offset); + else + nbytes = pread(fd->fd_sys, (void *) buf, diff, offset); + if (nbytes == -1) + return -1; + buf = ((char *) buf) + diff; + offset += diff; + size = len - diff; + } + + if (!size) { + return nbytes; + } + + if (rw) { /* direct I/O enabled */ + if (!(((long) buf) % fd->d_mem)) { + ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, buf, size, offset, &err); + if (err == -1) + return -1; + nbytes += err; + } else { + newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); + if (newbuf) { + memcpy(newbuf, buf, size); + ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, newbuf, size, offset, &err); + if (err == -1) + return -1; + nbytes += err; + ADIOI_Free(newbuf); + } else { + err = pwrite(fd->fd_sys, buf, size, offset); + if (err == -1) + return -1; + nbytes += err; + } + } + } else { + if (!(((long) buf) % fd->d_mem)) { + ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, buf, size, offset, &err); + if (err == -1) + return -1; + nbytes += err; + } else { + newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); + if (newbuf) { + ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); + if (err == -1) + return -1; + if (err > 0) + memcpy((void *) buf, newbuf, err); + nbytes += err; + ADIOI_Free(newbuf); + } else { + err = pread(fd->fd_sys, (void *) buf, size, offset); + if (err == -1) + return -1; + nbytes += err; + } + } + } + return nbytes; +} + +static void ADIOI_LUSTRE_IOContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int io_mode, int *error_code); +static void ADIOI_LUSTRE_IOContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int io_mode, int *error_code) +{ + ssize_t err = 0; + size_t rw_count; + ADIO_Offset bytes_xfered = 0; + MPI_Count datatype_size, len; + static char myname[] = "ADIOI_LUSTRE_IOCONTIG"; + char *p; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if ((!io_mode && !fd->direct_read) || (io_mode && !fd->direct_write)) { + + p = (char *) buf; + if (io_mode) { + while (bytes_xfered < len) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + rw_count = len - bytes_xfered; + err = pwrite(fd->fd_sys, p, rw_count, offset + bytes_xfered); + if (err == -1) + goto ioerr; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == 0) + break; + bytes_xfered += err; + p += err; + } + } else { + while (bytes_xfered < len) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + rw_count = len - bytes_xfered; + err = pread(fd->fd_sys, p, rw_count, offset + bytes_xfered); + if (err == -1) + goto ioerr; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + if (err == 0) + break; + bytes_xfered += err; + p += err; + } + } + } else { + err = ADIOI_LUSTRE_Directio(fd, buf, len, offset, io_mode); + if (err == -1) + goto ioerr; + bytes_xfered = err; + } + + fd->fp_sys_posn = offset + bytes_xfered; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_xfered; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, bytes_xfered); +#endif + *error_code = MPI_SUCCESS; + + ioerr: + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ +} + +void ADIOI_LUSTRE_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, offset, status, 1, error_code); +} + +void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, offset, status, 0, error_code); +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrcoll.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrcoll.c new file mode 100644 index 0000000000000000000000000000000000000000..c96136282bb43d7b202fe6c72e494da37d6f90ae --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrcoll.c @@ -0,0 +1,1418 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + + +#ifdef HAVE_LUSTRE_LOCKAHEAD +/* in ad_lustre_lock.c */ +void ADIOI_LUSTRE_lock_ahead_ioctl(ADIO_File fd, + int avail_cb_nodes, ADIO_Offset next_offset, int *error_code); + +/* Handle lock ahead. If this write is outside our locked region, lock it now */ +#define ADIOI_LUSTRE_WR_LOCK_AHEAD(fd,cb_nodes,offset,error_code) \ +if (fd->hints->fs_hints.lustre.lock_ahead_write) { \ + if (offset > fd->hints->fs_hints.lustre.lock_ahead_end_extent) { \ + ADIOI_LUSTRE_lock_ahead_ioctl(fd, cb_nodes, offset, error_code); \ + } \ + else if (offset < fd->hints->fs_hints.lustre.lock_ahead_start_extent) { \ + ADIOI_LUSTRE_lock_ahead_ioctl(fd, cb_nodes, offset, error_code); \ + } \ +} +#else +#define ADIOI_LUSTRE_WR_LOCK_AHEAD(fd,cb_nodes,offset,error_code) + +#endif + + +/* prototypes of functions used for collective writes only. */ +static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf, + MPI_Datatype datatype, int nprocs, + int myrank, + ADIOI_Access * others_req, + ADIOI_Access * my_req, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + int *striping_info, + ADIO_Offset ** buf_idx, int *error_code); +static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf, + ADIOI_Flatlist_node * flat_buf, + char **send_buf, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, + int *sent_to_proc, int nprocs, + int myrank, int contig_access_count, + int *striping_info, + ADIO_Offset * send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent); +static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf, + char *write_buf, + ADIOI_Flatlist_node * flat_buf, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, + int size, int *count, + int *start_pos, + int *sent_to_proc, int nprocs, + int myrank, int buftype_is_contig, + int contig_access_count, + int *striping_info, + ADIOI_Access * others_req, + ADIO_Offset * send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int *hole, + int iter, MPI_Aint buftype_extent, + ADIO_Offset * buf_idx, + ADIO_Offset ** srt_off, int **srt_len, int *srt_num, + int *error_code); +void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements); + +static void ADIOI_LUSTRE_IterateOneSided(ADIO_File fd, const void *buf, int *striping_info, + ADIO_Offset * offset_list, ADIO_Offset * len_list, + int contig_access_count, int currentValidDataIndex, + int count, int file_ptr_type, ADIO_Offset offset, + ADIO_Offset start_offset, ADIO_Offset end_offset, + ADIO_Offset firstFileOffset, ADIO_Offset lastFileOffset, + MPI_Datatype datatype, int myrank, int *error_code); + +void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Status * status, int *error_code) +{ + /* Uses a generalized version of the extended two-phase method described + * in "An Extended Two-Phase Method for Accessing Sections of + * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + * Scientific Programming, (5)4:301--317, Winter 1996. + * http://www.mcs.anl.gov/home/thakur/ext2ph.ps + */ + + ADIOI_Access *my_req; + /* array of nprocs access structures, one for each other process has + * this process's request */ + + ADIOI_Access *others_req; + /* array of nprocs access structures, one for each other process + * whose request is written by this process. */ + + int i, filetype_is_contig, nprocs, myrank, do_collect = 0; + int contig_access_count = 0, buftype_is_contig, interleave_count = 0; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset orig_fp, start_offset, end_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *end_offsets = NULL; + ADIO_Offset *len_list = NULL; + int striping_info[3]; + ADIO_Offset **buf_idx = NULL; + int old_error, tmp_error; + ADIO_Offset *lustre_offsets0, *lustre_offsets, *count_sizes = NULL; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + orig_fp = fd->fp_ind; + + /* IO patten identification if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + * lengths in the file and determine the start and end offsets. + * Note: end_offset points to the last byte-offset to be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 + */ + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets + * stored in order of process rank. + */ + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + end_offsets = st_offsets + nprocs; + ADIO_Offset my_count_size = 0; + /* One-sided aggregation needs the amount of data per rank as well + * because the difference in starting and ending offsets for 1 byte is + * 0 the same as 0 bytes so it cannot be distiguished. + */ + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + count_sizes = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); + MPI_Count buftype_size; + MPI_Type_size_x(datatype, &buftype_size); + my_count_size = (ADIO_Offset) count *(ADIO_Offset) buftype_size; + } + if (romio_tunegather) { + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + lustre_offsets0 = (ADIO_Offset *) ADIOI_Malloc(6 * nprocs * sizeof(ADIO_Offset)); + lustre_offsets = lustre_offsets0 + 3 * nprocs; + for (i = 0; i < nprocs; i++) { + lustre_offsets0[i * 3] = 0; + lustre_offsets0[i * 3 + 1] = 0; + lustre_offsets0[i * 3 + 2] = 0; + } + lustre_offsets0[myrank * 3] = start_offset; + lustre_offsets0[myrank * 3 + 1] = end_offset; + lustre_offsets0[myrank * 3 + 2] = my_count_size; + MPI_Allreduce(lustre_offsets0, lustre_offsets, nprocs * 3, ADIO_OFFSET, MPI_MAX, + fd->comm); + for (i = 0; i < nprocs; i++) { + st_offsets[i] = lustre_offsets[i * 3]; + end_offsets[i] = lustre_offsets[i * 3 + 1]; + count_sizes[i] = lustre_offsets[i * 3 + 2]; + } + } else { + lustre_offsets0 = (ADIO_Offset *) ADIOI_Malloc(4 * nprocs * sizeof(ADIO_Offset)); + lustre_offsets = lustre_offsets0 + 2 * nprocs; + for (i = 0; i < nprocs; i++) { + lustre_offsets0[i * 2] = 0; + lustre_offsets0[i * 2 + 1] = 0; + } + lustre_offsets0[myrank * 2] = start_offset; + lustre_offsets0[myrank * 2 + 1] = end_offset; + + MPI_Allreduce(lustre_offsets0, lustre_offsets, nprocs * 2, ADIO_OFFSET, MPI_MAX, + fd->comm); + + for (i = 0; i < nprocs; i++) { + st_offsets[i] = lustre_offsets[i * 2]; + end_offsets[i] = lustre_offsets[i * 2 + 1]; + } + } + ADIOI_Free(lustre_offsets0); + } else { + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm); + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + MPI_Allgather(&my_count_size, 1, ADIO_OFFSET, count_sizes, 1, + ADIO_OFFSET, fd->comm); + } + } + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + * for the moment. */ + + /* Two typical access patterns can benefit from collective write. + * 1) the processes are interleaved, and + * 2) the req size is small. + */ + if (interleave_count > 0) { + do_collect = 1; + } else { + do_collect = ADIOI_LUSTRE_Docollect(fd, contig_access_count, len_list, nprocs); + } + } + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + /* Decide if collective I/O should be done */ + if ((!do_collect && fd->hints->cb_write == ADIOI_HINT_AUTO) || + fd->hints->cb_write == ADIOI_HINT_DISABLE) { + + /* use independent accesses */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) + ADIOI_Free(count_sizes); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, error_code); + } else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code); + } else { + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + } + return; + } + + ADIO_Offset lastFileOffset = 0, firstFileOffset = -1; + int currentValidDataIndex = 0; + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + /* Take out the 0-data offsets by shifting the indexes with data to the front + * and keeping track of the valid data index for use as the length. + */ + for (i = 0; i < nprocs; i++) { + if (count_sizes[i] > 0) { + st_offsets[currentValidDataIndex] = st_offsets[i]; + end_offsets[currentValidDataIndex] = end_offsets[i]; + + lastFileOffset = MPL_MAX(lastFileOffset, end_offsets[currentValidDataIndex]); + if (firstFileOffset == -1) + firstFileOffset = st_offsets[currentValidDataIndex]; + else + firstFileOffset = MPL_MIN(firstFileOffset, st_offsets[currentValidDataIndex]); + + currentValidDataIndex++; + } + } + } + + /* Get Lustre hints information */ + ADIOI_LUSTRE_Get_striping_info(fd, striping_info, 1); + /* If the user has specified to use a one-sided aggregation method then do + * that at this point instead of the two-phase I/O. + */ + if ((romio_write_aggmethod == 1) || (romio_write_aggmethod == 2)) { + + ADIOI_LUSTRE_IterateOneSided(fd, buf, striping_info, offset_list, len_list, + contig_access_count, currentValidDataIndex, count, + file_ptr_type, offset, start_offset, end_offset, + firstFileOffset, lastFileOffset, datatype, myrank, error_code); + + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(count_sizes); + goto fn_exit; + } // onesided aggregation + + /* calculate what portions of the access requests of this process are + * located in which process + */ + ADIOI_LUSTRE_Calc_my_req(fd, offset_list, len_list, contig_access_count, + striping_info, nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, &buf_idx); + + /* based on everyone's my_req, calculate what requests of other processes + * will be accessed by this process. + * count_others_req_procs = number of processes whose requests (including + * this process itself) will be accessed by this process + * count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i will be accessed by this process. + */ + + ADIOI_Calc_others_req(fd, count_my_req_procs, count_my_req_per_proc, + my_req, nprocs, myrank, &count_others_req_procs, &others_req); + ADIOI_Free(count_my_req_per_proc); + + /* exchange data and write in sizes of no more than stripe_size. */ + ADIOI_LUSTRE_Exch_and_write(fd, buf, datatype, nprocs, myrank, + others_req, my_req, offset_list, len_list, + contig_access_count, striping_info, buf_idx, error_code); + + /* If this collective write is followed by an independent write, + * it's possible to have those subsequent writes on other processes + * race ahead and sneak in before the read-modify-write completes. + * We carry out a collective communication at the end here so no one + * can start independent i/o before collective I/O completes. + * + * need to do some gymnastics with the error codes so that if something + * went wrong, all processes report error, but if a process has a more + * specific error code, we can still have that process report the + * additional information */ + + old_error = *error_code; + if (*error_code != MPI_SUCCESS) + *error_code = MPI_ERR_IO; + + /* optimization: if only one process performing i/o, we can perform + * a less-expensive Bcast */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_a, 0, NULL); +#endif + if (fd->hints->cb_nodes == 1) + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + else { + tmp_error = *error_code; + MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, MPI_MAX, fd->comm); + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_b, 0, NULL); +#endif + + if ((old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO)) + *error_code = old_error; + + /* free all memory allocated for collective I/O */ + /* free others_req */ + ADIOI_Free(others_req[0].offsets); + ADIOI_Free(others_req[0].mem_ptrs); + ADIOI_Free(others_req); + ADIOI_Free(buf_idx[0]); /* also my_req[*].offsets and my_req[*].lens */ + ADIOI_Free(buf_idx); + ADIOI_Free(my_req); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status) { + MPI_Count bufsize, size; + /* Don't set status if it isn't needed */ + MPI_Type_size_x(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); + } + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually written during collective I/O. + */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +} + +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ +static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf, + MPI_Datatype datatype, int nprocs, + int myrank, ADIOI_Access * others_req, + ADIOI_Access * my_req, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + int *striping_info, ADIO_Offset ** buf_idx, int *error_code) +{ + /* Send data to appropriate processes and write in sizes of no more + * than lustre stripe_size. + * The idea is to reduce the amount of extra memory required for + * collective I/O. If all data were written all at once, which is much + * easier, it would require temp space more than the size of user_buf, + * which is often unacceptable. For example, to write a distributed + * array to a file, where each local array is 8Mbytes, requiring + * at least another 8Mbytes of temp space is unacceptable. + */ + + int hole, i, j, m, flag, ntimes = 1, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, min_st_loc, max_end_loc; + ADIO_Offset off, req_off, send_off, iter_st_off, *off_list; + ADIO_Offset max_size, step_size = 0; + int real_size, req_len, send_len; + int *recv_curr_offlen_ptr, *recv_count, *recv_size; + int *send_curr_offlen_ptr, *send_size; + int *sent_to_proc, *recv_start_pos; + int *curr_to_proc, *done_to_proc; + ADIO_Offset *send_buf_idx, *this_buf_idx; + char *write_buf = NULL; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint lb, buftype_extent; + int stripe_size = striping_info[0], avail_cb_nodes = striping_info[2]; + int data_sieving = 0; + ADIO_Offset *srt_off = NULL; + int *srt_len = NULL; + int srt_num = 0; + ADIO_Offset block_offset; + int block_len; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + + /* calculate the number of writes of stripe size to be done. + * That gives the no. of communication phases as well. + * Note: + * Because we redistribute data in stripe-contiguous pattern for Lustre, + * each process has the same no. of communication phases. + */ + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + for (i = 0; i < nprocs; i++) { + for (j = 0; j < others_req[i].count; j++) { + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + others_req[i].lens[j] - 1)); + } + } + /* this process does no writing. */ + if ((st_loc == -1) && (end_loc == -1)) + ntimes = 0; + MPI_Allreduce(&end_loc, &max_end_loc, 1, MPI_LONG_LONG_INT, MPI_MAX, fd->comm); + /* avoid min_st_loc be -1 */ + if (st_loc == -1) + st_loc = max_end_loc; + MPI_Allreduce(&st_loc, &min_st_loc, 1, MPI_LONG_LONG_INT, MPI_MIN, fd->comm); + /* align downward */ + min_st_loc -= min_st_loc % (ADIO_Offset) stripe_size; + + /* Each time, only avail_cb_nodes number of IO clients perform IO, + * so, step_size=avail_cb_nodes*stripe_size IO will be performed at most, + * and ntimes=whole_file_portion/step_size + */ + step_size = (ADIO_Offset) avail_cb_nodes *stripe_size; + max_ntimes = (max_end_loc - min_st_loc + 1) / step_size + + (((max_end_loc - min_st_loc + 1) % step_size) ? 1 : 0); +/* max_ntimes = (int)((max_end_loc - min_st_loc) / step_size + 1); */ + if (ntimes) + write_buf = (char *) ADIOI_Malloc(stripe_size); + + /* calculate the start offset for each iteration */ + off_list = (ADIO_Offset *) ADIOI_Malloc((max_ntimes + 2 * nprocs) * sizeof(ADIO_Offset)); + send_buf_idx = off_list + max_ntimes; + this_buf_idx = send_buf_idx + nprocs; + + for (m = 0; m < max_ntimes; m++) + off_list[m] = max_end_loc; + for (i = 0; i < nprocs; i++) { + for (j = 0; j < others_req[i].count; j++) { + req_off = others_req[i].offsets[j]; + m = (int) ((req_off - min_st_loc) / step_size); + off_list[m] = MPL_MIN(off_list[m], req_off); + } + } + + recv_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs * 9, sizeof(int)); + send_curr_offlen_ptr = recv_curr_offlen_ptr + nprocs; + /* their use is explained below. calloc initializes to 0. */ + + recv_count = send_curr_offlen_ptr + nprocs; + /* to store count of how many off-len pairs per proc are satisfied + * in an iteration. */ + + send_size = recv_count + nprocs; + /* total size of data to be sent to each proc. in an iteration. + * Of size nprocs so that I can use MPI_Alltoall later. */ + + recv_size = send_size + nprocs; + /* total size of data to be recd. from each proc. in an iteration. */ + + sent_to_proc = recv_size + nprocs; + /* amount of data sent to each proc so far. Used in + * ADIOI_Fill_send_buffer. initialized to 0 here. */ + + curr_to_proc = sent_to_proc + nprocs; + done_to_proc = curr_to_proc + nprocs; + /* Above three are used in ADIOI_Fill_send_buffer */ + + recv_start_pos = done_to_proc + nprocs; + /* used to store the starting value of recv_curr_offlen_ptr[i] in + * this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + } + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + /* I need to check if there are any outstanding nonblocking writes to + * the file, which could potentially interfere with the writes taking + * place in this collective write call. Since this is not likely to be + * common, let me do the simplest thing possible here: Each process + * completes all pending nonblocking operations before completing. + */ + /*ADIOI_Complete_async(error_code); + * if (*error_code != MPI_SUCCESS) return; + * MPI_Barrier(fd->comm); + */ + + iter_st_off = min_st_loc; + + /* Although we have recognized the data according to OST index, + * a read-modify-write will be done if there is a hole between the data. + * For example: if blocksize=60, xfersize=30 and stripe_size=100, + * then rank0 will collect data [0, 30] and [60, 90] then write. There + * is a hole in [30, 60], which will cause a read-modify-write in [0, 90]. + * + * To reduce its impact on the performance, we can disable data sieving + * by hint "ds_in_coll". + */ + /* check the hint for data sieving */ + data_sieving = fd->hints->fs_hints.lustre.ds_in_coll; + + for (m = 0; m < max_ntimes; m++) { + /* go through all others_req and my_req to check which will be received + * and sent in this iteration. + */ + + /* Note that MPI guarantees that displacements in filetypes are in + * monotonically nondecreasing order and that, for writes, the + * filetypes cannot specify overlapping regions in the file. This + * simplifies implementation a bit compared to reads. */ + + /* + * off = start offset in the file for the data to be written in + * this iteration + * iter_st_off = start offset of this iteration + * real_size = size of data written (bytes) corresponding to off + * max_size = possible maximum size of data written in this iteration + * req_off = offset in the file for a particular contiguous request minus + * what was satisfied in previous iteration + * send_off = offset the request needed by other processes in this iteration + * req_len = size corresponding to req_off + * send_len = size corresponding to send_off + */ + + /* first calculate what should be communicated */ + for (i = 0; i < nprocs; i++) + recv_count[i] = recv_size[i] = send_size[i] = 0; + + off = off_list[m]; + max_size = MPL_MIN(step_size, max_end_loc - iter_st_off + 1); + real_size = (int) MPL_MIN((off / stripe_size + 1) * stripe_size - off, end_loc - off + 1); + + for (i = 0; i < nprocs; i++) { + if (my_req[i].count) { + this_buf_idx[i] = buf_idx[i][send_curr_offlen_ptr[i]]; + for (j = send_curr_offlen_ptr[i]; j < my_req[i].count; j++) { + send_off = my_req[i].offsets[j]; + send_len = my_req[i].lens[j]; + if (send_off < iter_st_off + max_size) { + send_size[i] += send_len; + } else { + break; + } + } + send_curr_offlen_ptr[i] = j; + } + if (others_req[i].count) { + recv_start_pos[i] = recv_curr_offlen_ptr[i]; + for (j = recv_curr_offlen_ptr[i]; j < others_req[i].count; j++) { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + if (req_off < iter_st_off + max_size) { + recv_count[i]++; + ADIOI_Assert((((ADIO_Offset) (uintptr_t) write_buf) + req_off - off) == + (ADIO_Offset) (uintptr_t) (write_buf + req_off - off)); + MPI_Get_address(write_buf + req_off - off, &(others_req[i].mem_ptrs[j])); + recv_size[i] += req_len; + } else { + break; + } + } + recv_curr_offlen_ptr[i] = j; + } + } + /* use variable "hole" to pass data_sieving flag into W_Exchange_data */ + hole = data_sieving; + ADIOI_LUSTRE_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, real_size, + recv_count, recv_start_pos, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + striping_info, others_req, send_buf_idx, + curr_to_proc, done_to_proc, &hole, m, + buftype_extent, this_buf_idx, + &srt_off, &srt_len, &srt_num, error_code); + + if (*error_code != MPI_SUCCESS) + goto over; + + flag = 0; + for (i = 0; i < nprocs; i++) + if (recv_count[i]) { + flag = 1; + break; + } + if (flag) { + /* check whether to do data sieving */ + if (data_sieving == ADIOI_HINT_ENABLE) { + ADIOI_LUSTRE_WR_LOCK_AHEAD(fd, striping_info[2], off, error_code); + ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, error_code); + } else { + /* if there is no hole, write data in one time; + * otherwise, write data in several times */ + if (!hole) { + ADIOI_LUSTRE_WR_LOCK_AHEAD(fd, striping_info[2], off, error_code); + ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, error_code); + } else { + block_offset = -1; + block_len = 0; + for (i = 0; i < srt_num; ++i) { + if (srt_off[i] < off + real_size && srt_off[i] >= off) { + if (block_offset == -1) { + block_offset = srt_off[i]; + block_len = srt_len[i]; + } else { + if (srt_off[i] == block_offset + block_len) { + block_len += srt_len[i]; + } else { + ADIOI_LUSTRE_WR_LOCK_AHEAD(fd, striping_info[2], block_offset, + error_code); + ADIO_WriteContig(fd, write_buf + block_offset - off, block_len, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, block_offset, + &status, error_code); + if (*error_code != MPI_SUCCESS) + goto over; + block_offset = srt_off[i]; + block_len = srt_len[i]; + } + } + } + } + if (block_offset != -1) { + ADIOI_LUSTRE_WR_LOCK_AHEAD(fd, striping_info[2], block_offset, error_code); + ADIO_WriteContig(fd, + write_buf + block_offset - off, + block_len, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, + block_offset, &status, error_code); + if (*error_code != MPI_SUCCESS) + goto over; + } + } + } + if (*error_code != MPI_SUCCESS) + goto over; + } + iter_st_off += max_size; + } + over: + if (srt_off) + ADIOI_Free(srt_off); + if (srt_len) + ADIOI_Free(srt_len); + if (ntimes) + ADIOI_Free(write_buf); + ADIOI_Free(recv_curr_offlen_ptr); + ADIOI_Free(off_list); +} + +/* Sets error_code to MPI_SUCCESS if successful, or creates an error code + * in the case of error. + */ +static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf, + char *write_buf, + ADIOI_Flatlist_node * flat_buf, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, + int size, int *count, + int *start_pos, + int *sent_to_proc, int nprocs, + int myrank, int buftype_is_contig, + int contig_access_count, + int *striping_info, + ADIOI_Access * others_req, + ADIO_Offset * send_buf_idx, + int *curr_to_proc, int *done_to_proc, + int *hole, int iter, + MPI_Aint buftype_extent, + ADIO_Offset * buf_idx, + ADIO_Offset ** srt_off, int **srt_len, int *srt_num, + int *error_code) +{ + int i, j, k, nprocs_recv, nprocs_send, err; + char **send_buf = NULL; + MPI_Request *requests, *send_req; + MPI_Datatype *recv_types; + MPI_Status *statuses, status; + int sum_recv; + int data_sieving = *hole; + static size_t malloc_srt_num = 0; + size_t send_total_size; + static char myname[] = "ADIOI_W_EXCHANGE_DATA"; + + /* create derived datatypes for recv */ + *srt_num = 0; + sum_recv = 0; + nprocs_recv = 0; + nprocs_send = 0; + send_total_size = 0; + for (i = 0; i < nprocs; i++) { + *srt_num += count[i]; + sum_recv += recv_size[i]; + if (recv_size[i]) + nprocs_recv++; + if (send_size[i]) { + nprocs_send++; + send_total_size += send_size[i]; + } + } + + *hole = (size > sum_recv) ? 1 : 0; + + recv_types = (MPI_Datatype *) ADIOI_Malloc((nprocs_recv + 1) * sizeof(MPI_Datatype)); + /* +1 to avoid a 0-size malloc */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + ADIOI_Type_create_hindexed_x(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, recv_types + j); + /* absolute displacements; use MPI_BOTTOM in recv */ + MPI_Type_commit(recv_types + j); + j++; + } + } + + /* To avoid a read-modify-write, + * check if there are holes in the data to be written. + * For this, merge the (sorted) offset lists others_req using a heap-merge. + */ + + if (*srt_num) { + if (*srt_off == NULL || *srt_num > malloc_srt_num) { + /* must check srt_off against NULL, as the collective write can be + * called more than once */ + if (*srt_off != NULL) { + ADIOI_Free(*srt_off); + ADIOI_Free(*srt_len); + } + *srt_off = (ADIO_Offset *) ADIOI_Malloc(*srt_num * sizeof(ADIO_Offset)); + *srt_len = (int *) ADIOI_Malloc(*srt_num * sizeof(int)); + malloc_srt_num = *srt_num; + } + + ADIOI_Heap_merge(others_req, count, *srt_off, *srt_len, start_pos, + nprocs, nprocs_recv, *srt_num); + } + + /* In some cases (see John Bent ROMIO REQ # 835), an odd interaction + * between aggregation, nominally contiguous regions, and cb_buffer_size + * should be handled with a read-modify-write (otherwise we will write out + * more data than we receive from everyone else (inclusive), so override + * hole detection + */ + if (*hole == 0) { + for (i = 0; i < *srt_num - 1; i++) { + if ((*srt_off)[i] + (*srt_len)[i] < (*srt_off)[i + 1]) { + *hole = 1; + break; + } + } + } + + /* check the hint for data sieving */ + if (data_sieving == ADIOI_HINT_ENABLE && nprocs_recv && *hole) { + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, ADIO_EXPLICIT_OFFSET, off, &status, &err); + // --BEGIN ERROR HANDLING-- + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**ioRMWrdwr", 0); + ADIOI_Free(recv_types); + return; + } + // --END ERROR HANDLING-- + } + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Request)); + send_req = requests; + } else { + requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * + sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, + myrank + i + 100 * iter, fd->comm, requests + j); + j++; + } + } + send_req = requests + nprocs_recv; + } + + /* post sends. + * if buftype_is_contig, data can be directly sent from + * user buf at location given by buf_idx. else use send_buf. + */ + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + ADIOI_Assert(buf_idx[i] != -1); + MPI_Issend(((char *) buf) + buf_idx[i], send_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, send_req + j); + j++; + } + } else if (nprocs_send) { + /* buftype is not contig */ + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + send_buf[0] = (char *) ADIOI_Malloc(send_total_size); + for (i = 1; i < nprocs; i++) + send_buf[i] = send_buf[i - 1] + send_size[i - 1]; + + ADIOI_LUSTRE_Fill_send_buffer(fd, buf, flat_buf, send_buf, offset_list, + len_list, send_size, send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, striping_info, + send_buf_idx, curr_to_proc, done_to_proc, + iter, buftype_extent); + /* the send is done in ADIOI_Fill_send_buffer */ + } + + /* bug fix from Wei-keng Liao and Kenin Coloma */ + if (fd->atomicity) { + j = 0; + for (i = 0; i < nprocs; i++) { + MPI_Status wkl_status; + if (recv_size[i]) { + MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, + myrank + i + 100 * iter, fd->comm, &wkl_status); + j++; + } + } + } + + for (i = 0; i < nprocs_recv; i++) + MPI_Type_free(recv_types + i); + ADIOI_Free(recv_types); + +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + /* bug fix from Wei-keng Liao and Kenin Coloma */ + /* +1 to avoid a 0-size malloc */ + if (fd->atomicity) { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Status)); + } else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * + sizeof(MPI_Status)); + } +#endif + +#ifdef NEEDS_MPI_TEST + i = 0; + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) + MPI_Testall(nprocs_send, send_req, &i, statuses); + } else { + while (!i) + MPI_Testall(nprocs_send + nprocs_recv, requests, &i, statuses); + } +#else + /* bug fix from Wei-keng Liao and Kenin Coloma */ + if (fd->atomicity) + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send + nprocs_recv, requests, statuses); +#endif + +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + ADIOI_Free(requests); + if (!buftype_is_contig && nprocs_send) { + ADIOI_Free(send_buf[0]); + ADIOI_Free(send_buf); + } +} + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = MPL_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(uintptr_t)buf) + user_buf_idx) == (ADIO_Offset)(uintptr_t)((uintptr_t)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(&(send_buf[p][send_buf_idx[p]]), \ + ((char *) buf) + user_buf_idx, size_in_buf); \ + send_buf_idx[p] += size_in_buf; \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + +static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf, + ADIOI_Flatlist_node * flat_buf, + char **send_buf, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, + int *sent_to_proc, int nprocs, + int myrank, + int contig_access_count, + int *striping_info, + ADIO_Offset * send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent) +{ + /* this function is only called if buftype is not contig */ + int i, p, flat_buf_idx, size; + int flat_buf_sz, buf_incr, size_in_buf, jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + + /* curr_to_proc[p] = amount of data sent to proc. p that has already + * been accounted for so far + * done_to_proc[p] = amount of data already sent to proc. p in + * previous iterations + * user_buf_idx = current location in user buffer + * send_buf_idx[p] = current location in send_buf of proc. p + */ + + for (i = 0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in flattened buf + */ + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = (ADIO_Offset) len_list[i]; + + /*this request may span to more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_LUSTRE_Calc_aggregator(fd, off, &len, striping_info); + + if (send_buf_idx[p] < send_size[p]) { + if (curr_to_proc[p] + len > done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = (int) MPL_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p] - send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == + (unsigned) (curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = (int) (curr_to_proc[p] + len - done_to_proc[p]); + ADIOI_Assert((done_to_proc[p] + size) == + (unsigned) (done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY} else { + size = (int) MPL_MIN(len, send_size[p] - send_buf_idx[p]); + buf_incr = (int) len; + ADIOI_Assert((curr_to_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY} + if (send_buf_idx[p] == send_size[p]) { + MPI_Issend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank + p + 100 * iter, fd->comm, requests + jj); + jj++; + } + } else { + ADIOI_Assert((curr_to_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + len)); + curr_to_proc[p] += (int) len; + buf_incr = (int) len; + ADIOI_BUF_INCR} + } else { + buf_incr = (int) len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (send_size[i]) + sent_to_proc[i] = curr_to_proc[i]; +} + +/* This function calls ADIOI_OneSidedWriteAggregation iteratively to + * essentially pack stripes of data into the collective buffer and then + * flush the collective buffer to the file when fully packed, repeating this + * process until all the data is written to the file. + */ +static void ADIOI_LUSTRE_IterateOneSided(ADIO_File fd, const void *buf, int *striping_info, + ADIO_Offset * offset_list, ADIO_Offset * len_list, + int contig_access_count, int currentValidDataIndex, + int count, int file_ptr_type, ADIO_Offset offset, + ADIO_Offset start_offset, ADIO_Offset end_offset, + ADIO_Offset firstFileOffset, ADIO_Offset lastFileOffset, + MPI_Datatype datatype, int myrank, int *error_code) +{ + int i; + int stripesPerAgg = fd->hints->cb_buffer_size / striping_info[0]; + if (stripesPerAgg == 0) { + /* The striping unit is larger than the collective buffer size + * therefore we must abort since the buffer has already been + * allocated during the open. + */ + FPRINTF(stderr, "Error: The collective buffer size %d is less " + "than the striping unit size %d - the ROMIO " + "Lustre one-sided write aggregation algorithm " + "cannot continue.\n", fd->hints->cb_buffer_size, striping_info[0]); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + /* Based on the co_ratio the number of aggregators we can use is the number of + * stripes used in the file times this co_ratio - each stripe is written by + * co_ratio aggregators this information is contained in the striping_info. + */ + int numStripedAggs = striping_info[2]; + + int orig_cb_nodes = fd->hints->cb_nodes; + fd->hints->cb_nodes = numStripedAggs; + + /* Declare ADIOI_OneSidedStripeParms here - these parameters will be locally managed + * for this invokation of ADIOI_LUSTRE_IterateOneSided. This will allow for concurrent + * one-sided collective writes via multi-threading as well as multiple communicators. + */ + ADIOI_OneSidedStripeParms stripeParms; + stripeParms.stripeSize = striping_info[0]; + stripeParms.stripedLastFileOffset = lastFileOffset; + stripeParms.iWasUsedStripingAgg = 0; + stripeParms.numStripesUsed = 0; + stripeParms.amountOfStripedDataExpected = 0; + stripeParms.bufTypeExtent = 0; + stripeParms.lastDataTypeExtent = 0; + stripeParms.lastFlatBufIndice = 0; + stripeParms.lastIndiceOffset = 0; + + /* The general algorithm here is to divide the file up into segements, a segment + * being defined as a contiguous region of the file which has up to one occurrence + * of each stripe - the data for each stripe being written out by a particular + * aggregator. The segmentLen is the maximum size in bytes of each segment + * (stripeSize*number of aggs). Iteratively call ADIOI_OneSidedWriteAggregation + * for each segment to aggregate the data to the collective buffers, but only do + * the actual write (via flushCB stripe parm) once stripesPerAgg stripes + * have been packed or the aggregation for all the data is complete, minimizing + * synchronization. + */ + stripeParms.segmentLen = ((ADIO_Offset) numStripedAggs) * ((ADIO_Offset) (striping_info[0])); + + /* These arrays define the file offsets for the stripes for a given segment - similar + * to the concept of file domains in GPFS, essentially file domeains for the segment. + */ + ADIO_Offset *segment_stripe_start = + (ADIO_Offset *) ADIOI_Malloc(numStripedAggs * sizeof(ADIO_Offset)); + ADIO_Offset *segment_stripe_end = + (ADIO_Offset *) ADIOI_Malloc(numStripedAggs * sizeof(ADIO_Offset)); + + /* Find the actual range of stripes in the file that have data in the offset + * ranges being written -- skip holes at the front and back of the file. + */ + int currentOffsetListIndex = 0; + int fileSegmentIter = 0; + int startingStripeWithData = 0; + int foundStartingStripeWithData = 0; + while (!foundStartingStripeWithData) { + if (((startingStripeWithData + 1) * (ADIO_Offset) (striping_info[0])) > firstFileOffset) + foundStartingStripeWithData = 1; + else + startingStripeWithData++; + } + + ADIO_Offset currentSegementOffset = + (ADIO_Offset) startingStripeWithData * (ADIO_Offset) (striping_info[0]); + + int numSegments = + (int) ((lastFileOffset + (ADIO_Offset) 1 - currentSegementOffset) / stripeParms.segmentLen); + if ((lastFileOffset + (ADIO_Offset) 1 - currentSegementOffset) % stripeParms.segmentLen > 0) + numSegments++; + + /* To support read-modify-write use a while-loop to redo the aggregation if necessary + * to fill in the holes. + */ + int doAggregation = 1; + int holeFound = 0; + + /* Remember romio_onesided_no_rmw setting if we have to re-do + * the aggregation if holes are found. + */ + int prev_romio_onesided_no_rmw = romio_onesided_no_rmw; + + while (doAggregation) { + + int totalDataWrittenLastRound = 0; + + /* This variable tracks how many segment stripes we have packed into the agg + * buffers so we know when to flush to the file system. + */ + stripeParms.segmentIter = 0; + + /* stripeParms.stripesPerAgg is the number of stripes to aggregate before doing a flush. + */ + stripeParms.stripesPerAgg = stripesPerAgg; + if (stripeParms.stripesPerAgg > numSegments) + stripeParms.stripesPerAgg = numSegments; + + for (fileSegmentIter = 0; fileSegmentIter < numSegments; fileSegmentIter++) { + + int dataWrittenThisRound = 0; + + /* Define the segment range in terms of file offsets. + */ + ADIO_Offset segmentFirstFileOffset = currentSegementOffset; + if ((currentSegementOffset + stripeParms.segmentLen - (ADIO_Offset) 1) > lastFileOffset) + currentSegementOffset = lastFileOffset; + else + currentSegementOffset += (stripeParms.segmentLen - (ADIO_Offset) 1); + ADIO_Offset segmentLastFileOffset = currentSegementOffset; + currentSegementOffset++; + + ADIO_Offset segment_stripe_offset = segmentFirstFileOffset; + for (i = 0; i < numStripedAggs; i++) { + if (firstFileOffset > segment_stripe_offset) + segment_stripe_start[i] = firstFileOffset; + else + segment_stripe_start[i] = segment_stripe_offset; + if ((segment_stripe_offset + (ADIO_Offset) (striping_info[0])) > lastFileOffset) + segment_stripe_end[i] = lastFileOffset; + else + segment_stripe_end[i] = + segment_stripe_offset + (ADIO_Offset) (striping_info[0]) - (ADIO_Offset) 1; + segment_stripe_offset += (ADIO_Offset) (striping_info[0]); + } + + /* In the interest of performance for non-contiguous data with large offset lists + * essentially modify the given offset and length list appropriately for this segment + * and then pass pointers to the sections of the lists being used for this segment + * to ADIOI_OneSidedWriteAggregation. Remember how we have modified the list for this + * segment, and then restore it appropriately after processing for this segment has + * concluded, so it is ready for the next segment. + */ + int segmentContigAccessCount = 0; + int startingOffsetListIndex = -1; + int endingOffsetListIndex = -1; + ADIO_Offset startingOffsetAdvancement = 0; + ADIO_Offset startingLenTrim = 0; + ADIO_Offset endingLenTrim = 0; + + while (((offset_list[currentOffsetListIndex] + + ((ADIO_Offset) (len_list[currentOffsetListIndex])) - (ADIO_Offset) 1) < + segmentFirstFileOffset) && (currentOffsetListIndex < (contig_access_count - 1))) + currentOffsetListIndex++; + startingOffsetListIndex = currentOffsetListIndex; + endingOffsetListIndex = currentOffsetListIndex; + int offsetInSegment = 0; + ADIO_Offset offsetStart = offset_list[currentOffsetListIndex]; + ADIO_Offset offsetEnd = + (offset_list[currentOffsetListIndex] + + ((ADIO_Offset) (len_list[currentOffsetListIndex])) - (ADIO_Offset) 1); + + if (len_list[currentOffsetListIndex] == 0) + offsetInSegment = 0; + else if ((offsetStart >= segmentFirstFileOffset) && + (offsetStart <= segmentLastFileOffset)) { + offsetInSegment = 1; + } else if ((offsetEnd >= segmentFirstFileOffset) && + (offsetEnd <= segmentLastFileOffset)) { + offsetInSegment = 1; + } else if ((offsetStart <= segmentFirstFileOffset) && + (offsetEnd >= segmentLastFileOffset)) { + offsetInSegment = 1; + } + + if (!offsetInSegment) { + segmentContigAccessCount = 0; + } else { + /* We are in the segment, advance currentOffsetListIndex until we are out of segment. + */ + segmentContigAccessCount = 1; + + while ((offset_list[currentOffsetListIndex] <= segmentLastFileOffset) && + (currentOffsetListIndex < contig_access_count)) { + dataWrittenThisRound += (int) len_list[currentOffsetListIndex]; + currentOffsetListIndex++; + } + + if (currentOffsetListIndex > startingOffsetListIndex) { + /* If we did advance, if we are at the end need to check if we are still in segment. + */ + if (currentOffsetListIndex == contig_access_count) { + currentOffsetListIndex--; + } else if (offset_list[currentOffsetListIndex] > segmentLastFileOffset) { + /* We advanced into the last one and it still in the segment. + */ + currentOffsetListIndex--; + } else { + dataWrittenThisRound += (int) len_list[currentOffsetListIndex]; + } + segmentContigAccessCount += (currentOffsetListIndex - startingOffsetListIndex); + endingOffsetListIndex = currentOffsetListIndex; + } + } + + if (segmentContigAccessCount > 0) { + /* Trim edges here so all data in the offset list range fits exactly in the segment. + */ + if (offset_list[startingOffsetListIndex] < segmentFirstFileOffset) { + startingOffsetAdvancement = + segmentFirstFileOffset - offset_list[startingOffsetListIndex]; + offset_list[startingOffsetListIndex] += startingOffsetAdvancement; + dataWrittenThisRound -= (int) startingOffsetAdvancement; + startingLenTrim = startingOffsetAdvancement; + len_list[startingOffsetListIndex] -= startingLenTrim; + } + + if ((offset_list[endingOffsetListIndex] + + ((ADIO_Offset) (len_list[endingOffsetListIndex])) - (ADIO_Offset) 1) > + segmentLastFileOffset) { + endingLenTrim = + offset_list[endingOffsetListIndex] + + ((ADIO_Offset) (len_list[endingOffsetListIndex])) - (ADIO_Offset) 1 - + segmentLastFileOffset; + len_list[endingOffsetListIndex] -= endingLenTrim; + dataWrittenThisRound -= (int) endingLenTrim; + } + } + + int holeFoundThisRound = 0; + + /* Once we have packed the collective buffers do the actual write. + */ + if ((stripeParms.segmentIter == (stripeParms.stripesPerAgg - 1)) || + (fileSegmentIter == (numSegments - 1))) { + stripeParms.flushCB = 1; + } else + stripeParms.flushCB = 0; + + stripeParms.firstStripedWriteCall = 0; + stripeParms.lastStripedWriteCall = 0; + if (fileSegmentIter == 0) { + stripeParms.firstStripedWriteCall = 1; + } else if (fileSegmentIter == (numSegments - 1)) + stripeParms.lastStripedWriteCall = 1; + + /* The difference in calls to ADIOI_OneSidedWriteAggregation is based on the whether the buftype is + * contiguous. The algorithm tracks the position in the source buffer when called + * multiple times -- in the case of contiguous data this is simple and can be externalized with + * a buffer offset, in the case of non-contiguous data this is complex and the state must be tracked + * internally, therefore no external buffer offset. Care was taken to minimize + * ADIOI_OneSidedWriteAggregation changes at the expense of some added complexity to the caller. + */ + int bufTypeIsContig; + ADIOI_Datatype_iscontig(datatype, &bufTypeIsContig); + if (bufTypeIsContig) { + ADIOI_OneSidedWriteAggregation(fd, + (ADIO_Offset *) & + (offset_list[startingOffsetListIndex]), + (ADIO_Offset *) & + (len_list[startingOffsetListIndex]), + segmentContigAccessCount, + buf + totalDataWrittenLastRound, datatype, + error_code, segmentFirstFileOffset, + segmentLastFileOffset, currentValidDataIndex, + segment_stripe_start, segment_stripe_end, + &holeFoundThisRound, &stripeParms); + } else { + ADIOI_OneSidedWriteAggregation(fd, + (ADIO_Offset *) & + (offset_list[startingOffsetListIndex]), + (ADIO_Offset *) & + (len_list[startingOffsetListIndex]), + segmentContigAccessCount, buf, datatype, error_code, + segmentFirstFileOffset, segmentLastFileOffset, + currentValidDataIndex, segment_stripe_start, + segment_stripe_end, &holeFoundThisRound, + &stripeParms); + } + + if (stripeParms.flushCB) { + stripeParms.segmentIter = 0; + if (stripesPerAgg > (numSegments - fileSegmentIter - 1)) + stripeParms.stripesPerAgg = numSegments - fileSegmentIter - 1; + else + stripeParms.stripesPerAgg = stripesPerAgg; + } else + stripeParms.segmentIter++; + + if (holeFoundThisRound) + holeFound = 1; + + /* If we know we won't be doing a pre-read in a subsequent call to + * ADIOI_OneSidedWriteAggregation which will have a barrier to keep + * feeder ranks from doing rma to the collective buffer before the + * write completes that we told it do with the stripeParms.flushCB + * flag then we need to do a barrier here. + */ + if (!romio_onesided_always_rmw && stripeParms.flushCB) { + if (fileSegmentIter < (numSegments - 1)) { + MPI_Barrier(fd->comm); + } + } + + /* Restore the offset_list and len_list to values that are ready for the + * next iteration. + */ + if (segmentContigAccessCount > 0) { + offset_list[endingOffsetListIndex] += len_list[endingOffsetListIndex]; + len_list[endingOffsetListIndex] = endingLenTrim; + } + totalDataWrittenLastRound += dataWrittenThisRound; + } // fileSegmentIter for-loop + + /* Check for holes in the data unless romio_onesided_no_rmw is set. + * If a hole is found redo the entire aggregation and write. + */ + if (!romio_onesided_no_rmw) { + int anyHolesFound = 0; + MPI_Allreduce(&holeFound, &anyHolesFound, 1, MPI_INT, MPI_MAX, fd->comm); + + if (anyHolesFound) { + ADIOI_Free(offset_list); + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + currentSegementOffset = + (ADIO_Offset) startingStripeWithData *(ADIO_Offset) (striping_info[0]); + romio_onesided_always_rmw = 1; + romio_onesided_no_rmw = 1; + + /* Holes are found in the data and the user has not set + * romio_onesided_no_rmw --- set romio_onesided_always_rmw to 1 + * and redo the entire aggregation and write and if the user has + * romio_onesided_inform_rmw set then inform him of this condition + * and behavior. + */ + if (romio_onesided_inform_rmw && (myrank == 0)) { + FPRINTF(stderr, "Information: Holes found during one-sided " + "write aggregation algorithm --- re-running one-sided " + "write aggregation with ROMIO_ONESIDED_ALWAYS_RMW set to 1.\n"); + } + } else + doAggregation = 0; + } else + doAggregation = 0; + } // while doAggregation + romio_onesided_no_rmw = prev_romio_onesided_no_rmw; + + ADIOI_Free(segment_stripe_start); + ADIOI_Free(segment_stripe_end); + + fd->hints->cb_nodes = orig_cb_nodes; + +} diff --git a/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrstr.c b/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrstr.c new file mode 100644 index 0000000000000000000000000000000000000000..f9e03d58a0aeaf6313db5d39962737ec2d8c2049 --- /dev/null +++ b/3rd-party/romio341/adio/ad_lustre/ad_lustre_wrstr.c @@ -0,0 +1,512 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +#define ADIOI_BUFFERED_WRITE \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + if (writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, \ + &status1, error_code); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + } \ + writebuf_off = req_off; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, \ + writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + } \ + write_sz = (unsigned) (MPL_MIN(req_len, \ + writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == \ + MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf + req_off - writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, \ + writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } + + +/* this macro is used when filetype is contig and buftype is not contig. + it does not do a read-modify-write and does not lock*/ +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, \ + error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + writebuf_off = req_off; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + } \ + write_sz = (unsigned) MPL_MIN(req_len, writebuf_off + writebuf_len - req_off); \ + ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf + req_off - writebuf_off, \ + (char *)buf + userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } + +void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, sum, size_in_filetype; + int i, j, k, st_index = 0; + int n_etypes_in_filetype; + ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; + ADIO_Offset abs_off_in_filetype = 0; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset = 0, writebuf_off, start_off; + char *writebuf; + unsigned bufsize, writebuf_len, write_sz; + ADIO_Status status1; + ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size = 0, bwr_size, req_len; + int stripe_size; + static char myname[] = "ADIOI_LUSTRE_WriteStrided"; + + if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on writes, use naive + * approach instead. + */ + ADIOI_GEN_WriteStrided_naive(fd, + buf, + count, datatype, file_ptr_type, offset, status, error_code); + return; + } + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == + ((ADIO_Offset) (unsigned) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + + /* get striping info */ + stripe_size = fd->hints->striping_unit; + + /* Different buftype to different filetype */ + if (!buftype_is_contig && filetype_is_contig) { + /* noncontiguous in memory, contiguous in file. */ + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + + start_off = off; + end_offset = start_off + bufsize - 1; + /* write stripe size buffer each time */ + writebuf = (char *) ADIOI_Malloc(MPL_MIN(bufsize, stripe_size)); + writebuf_off = 0; + writebuf_len = 0; + + /* if atomicity is true or data sieving is not disable, lock the region + * to be accessed */ + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, bufsize); + + for (j = 0; j < count; j++) { + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = (ADIO_Offset) j *(ADIO_Offset) buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ; + off += flat_buf->blocklens[i]; + } + } + + /* write the buffer out finally */ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); + + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, bufsize); + if (*error_code != MPI_SUCCESS) { + ADIOI_Free(writebuf); + return; + } + ADIOI_Free(writebuf); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } else { + /* noncontiguous in file */ + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao:write request is within single flat_file + * contig block*/ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + req_off = start_off; + req_len = bufsize; + end_offset = start_off + bufsize - 1; + writebuf = (char *) ADIOI_Malloc(MPL_MIN(bufsize, stripe_size)); + memset(writebuf, -1, MPL_MIN(bufsize, stripe_size)); + writebuf_off = 0; + writebuf_len = 0; + userbuf_off = 0; + ADIOI_BUFFERED_WRITE_WITHOUT_READ; + /* write the buffer out finally */ + if (fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); + if (fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset) n_filetypes *filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + ADIOI_Free(writebuf); + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be write, end_offset=99 */ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + i_offset += fwr_size; + end_offset = off + fwr_size - 1; + + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + + /* if atomicity is true or data sieving is not disable, lock the region + * to be accessed */ + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + writebuf_off = 0; + writebuf_len = 0; + writebuf = (char *) ADIOI_Malloc(stripe_size); + memset(writebuf, -1, stripe_size); + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + * fwr_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size); */ + + req_off = off; + req_len = fwr_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. */ + else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(fwr_size, bwr_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + i_offset = (ADIO_Offset) buftype_extent * + (ADIO_Offset) (buf_count / flat_buf->count) + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* write the buffer out finally */ + if (writebuf_len) { + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + if (*error_code != MPI_SUCCESS) + return; + } + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + ADIOI_Free(writebuf); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + +} diff --git a/3rd-party/romio321/adio/ad_nfs/Makefile.mk b/3rd-party/romio341/adio/ad_nfs/Makefile.mk similarity index 80% rename from 3rd-party/romio321/adio/ad_nfs/Makefile.mk rename to 3rd-party/romio341/adio/ad_nfs/Makefile.mk index ca25e20cbeacb1f36c28eb33788b27233bff2103..73d0fb279df4a493ceb231384402e8e5bf9a2c19 100644 --- a/3rd-party/romio321/adio/ad_nfs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_nfs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_NFS @@ -25,4 +23,3 @@ romio_other_sources += \ adio/ad_nfs/ad_nfs_features.c endif BUILD_AD_NFS - diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs.c new file mode 100644 index 0000000000000000000000000000000000000000..d9806d497ddc566e41de7c393565f5b7cf3c85ba --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_NFS_operations = { + ADIOI_NFS_Open, /* Open */ + ADIOI_FAILSAFE_OpenColl, /* OpenColl */ + ADIOI_NFS_ReadContig, /* ReadContig */ + ADIOI_NFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_NFS_Fcntl, /* Fcntl */ + ADIOI_GEN_SetInfo, /* SetInfo */ + ADIOI_NFS_ReadStrided, /* ReadStrided */ + ADIOI_NFS_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ + /* Even with lockd running and NFS mounted 'noac', we have been unable to + * gaurantee correct behavior over NFS with asyncronous I/O operations */ + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ + ADIOI_NFS_ReadDone, /* ReadDone */ + ADIOI_NFS_WriteDone, /* WriteDone */ + ADIOI_NFS_ReadComplete, /* ReadComplete */ + ADIOI_NFS_WriteComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Flush, /* Flush */ + ADIOI_NFS_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_NFS_Feature, /* Features */ + "NFS:", /* fsname: just a string */ + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs.h b/3rd-party/romio341/adio/ad_nfs/ad_nfs.h new file mode 100644 index 0000000000000000000000000000000000000000..05f6d74613ef6d579059a058c9cdc9b37d8b0227 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_NFS_H_INCLUDED +#define AD_NFS_H_INCLUDED + +#include "adio.h" + +#include <unistd.h> +#include <sys/types.h> +#include <fcntl.h> + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_AIO_LITE_H +#include <aio-lite.h> +#else +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif +#endif + +/* Workaround for incomplete set of definitions if __REDIRECT is not + defined and large file support is used in aio.h */ +#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) +#define aiocb aiocb64 +#endif + +int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, + int wr, MPI_Request * request); + +#ifdef SX4 +#define lseek llseek +#endif + +void ADIOI_NFS_Open(ADIO_File fd, int *error_code); +void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +int ADIOI_NFS_ReadDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +int ADIOI_NFS_WriteDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_ReadComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_WriteComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); +void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset * shared_fp, + int *error_code); +void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); +void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +int ADIOI_NFS_Feature(ADIO_File fd, int feature_flag); + +#endif /* AD_NFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_done.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_done.c new file mode 100644 index 0000000000000000000000000000000000000000..0fdee009a403527861bac33d4c3c744bcdb142e1 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_done.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +int ADIOI_NFS_ReadDone(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + *error_code = MPI_SUCCESS; + return 1; +} + +int ADIOI_NFS_WriteDone(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + return ADIOI_NFS_ReadDone(request, status, error_code); +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_fcntl.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..2b82d2018048706b5dca71b31a44460f76f950d8 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_fcntl.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" +#include "adio_extern.h" + +void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + static char myname[] = "ADIOI_NFS_FCNTL"; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + ADIOI_READ_LOCK(fd, 0, SEEK_SET, 1); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + ADIOI_UNLOCK(fd, 0, SEEK_SET, 1); + if (fd->fp_sys_posn != -1) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + } + if (fcntl_struct->fsize == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + return; + /* --END ERROR HANDLING-- */ + } +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_features.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_features.c new file mode 100644 index 0000000000000000000000000000000000000000..41edbc3d411d25571cf6b59fa25c756f90084956 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_features.c @@ -0,0 +1,23 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "ad_nfs.h" + +int ADIOI_NFS_Feature(ADIO_File fd, int flag) +{ + switch (flag) { + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + return 1; + case ADIO_SCALABLE_OPEN: + case ADIO_UNLINK_AFTER_CLOSE: + case ADIO_SCALABLE_RESIZE: + default: + return 0; + } +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_getsh.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_getsh.c new file mode 100644 index 0000000000000000000000000000000000000000..484add75c04bab7df17d495dc411882bf0225ab8 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_getsh.c @@ -0,0 +1,103 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +/* returns the current location of the shared_fp in terms of the + no. of etypes relative to the current view, and also increments the + shared_fp by the number of etypes to be accessed (incr) in the read + or write following this function. */ + +void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset * shared_fp, + int *error_code) +{ + ADIO_Offset new_fp; + ssize_t err; + MPI_Comm dupcommself; + static char myname[] = "ADIOI_NFS_GET_SHARED_FP"; + + if (fd->shared_fp_fd == ADIO_FILE_NULL) { + MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); + fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, + fd->shared_fp_fname, + fd->file_system, + fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, + ADIO_PERM_NULL, error_code); + if (*error_code != MPI_SUCCESS) + return; + *shared_fp = 0; + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* if the file is empty, the above read may return error + * (reading beyond end of file). In that case, shared_fp = 0, + * set above, is the correct value. */ + } else { + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (err == 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + } + if (err == -1) { + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + return; + } + } + + if (incr == 0) { + goto done; + } + + new_fp = *shared_fp + incr; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (err == 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->shared_fp_fd->fd_sys, &new_fp, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + } + done: + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_hints.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..3cacb905dfe86ac7e377016d52c723b71e0b5659 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_hints.c @@ -0,0 +1,11 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + ADIOI_GEN_SetInfo(fd, users_info, error_code); +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_iread.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_iread.c new file mode 100644 index 0000000000000000000000000000000000000000..cc1689dbcd7ebdde29d2a354b4c17e9ab9b370d0 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_iread.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +#ifdef ROMIO_HAVE_WORKING_AIO +/* nearly identical to ADIOI_GEN_IreadContig, except we lock around I/O */ +void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + MPI_Count len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_NFS_IREADCONTIG"; + + MPI_Type_size_x(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 0, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + if (aio_errno != 0) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + /* --END ERROR HANDLING-- */ + } else + *error_code = MPI_SUCCESS; +} +#endif diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_iwrite.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_iwrite.c new file mode 100644 index 0000000000000000000000000000000000000000..9424ca5591a4fa15ac71d62ee4d9725f73d9885d --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_iwrite.c @@ -0,0 +1,139 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +#include "../../mpi-io/mpioimpl.h" +#ifdef MPIO_BUILD_PROFILING +#include "../../mpi-io/mpioprof.h" +#endif +#include "mpiu_greq.h" + +#include <string.h> + +#ifdef ROMIO_HAVE_WORKING_AIO +static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; +/* this routine is nearly identical to ADIOI_GEN_IwriteContig, except we lock + * around I/O */ +void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + MPI_Count len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_NFS_IWRITECONTIG"; + + MPI_Type_size_x(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 1, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + if (aio_errno != 0) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + /* --END ERROR HANDLING-- */ + } else + *error_code = MPI_SUCCESS; + return; +} +#endif + +/* This function is for implementation convenience. It is not user-visible. + * It takes care of the differences in the interface for nonblocking I/O + * on various Unix machines! If wr==1 write, wr==0 read. + * + * Returns 0 on success, -errno on failure. + */ +#ifdef ROMIO_HAVE_WORKING_AIO +int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, + int wr, MPI_Request * request) +{ + int err = -1, fd_sys; + int error_code, this_errno; + + struct aiocb *aiocbp; + ADIOI_AIO_Request *aio_req; + MPI_Status status; + + fd_sys = fd->fd_sys; + + aio_req = (ADIOI_AIO_Request *) ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); + aiocbp->aio_offset = offset; + aiocbp->aio_buf = buf; + aiocbp->aio_nbytes = len; + +#ifdef HAVE_STRUCT_AIOCB_AIO_WHENCE + aiocbp->aio_whence = SEEK_SET; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_FILDES + aiocbp->aio_fildes = fd_sys; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_SIGEVENT +#ifdef AIO_SIGNOTIFY_NONE + aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; +#endif + aiocbp->aio_sigevent.sigev_signo = 0; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_REQPRIO +#ifdef AIO_PRIO_DFL + aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */ +#else + aiocbp->aio_reqprio = 0; +#endif +#endif + + if (wr) + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + else + ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + +#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES + if (wr) + err = aio_write(aiocbp); + else + err = aio_read(aiocbp); +#else + /* Broken IBM interface */ + if (wr) + err = aio_write(fd_sys, aiocbp); + else + err = aio_read(fd_sys, aiocbp); +#endif + + this_errno = errno; + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + + if (err == -1) { + if (this_errno == EAGAIN) { + /* exceeded the max. no. of outstanding requests. + * complete all previous async. requests and try again. */ + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, &status, &error_code); + MPIO_Completed_request_create(&fd, len, &error_code, request); + return 0; + } else { + return -this_errno; + } + } + aio_req->aiocbp = aiocbp; + if (ADIOI_GEN_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, + &ADIOI_GEN_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return 0; +} +#endif diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_open.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_open.c similarity index 52% rename from 3rd-party/romio321/adio/ad_nfs/ad_nfs_open.c rename to 3rd-party/romio341/adio/ad_nfs/ad_nfs_open.c index d8763292b91d39dd4235cebeb2ad36c28f0c8b2b..ab898e134af1452d3a87c245cc21c890f89d9ab0 100644 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_open.c +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_open.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_nfs.h" @@ -14,45 +12,45 @@ void ADIOI_NFS_Open(ADIO_File fd, int *error_code) static char myname[] = "ADIOI_NFS_OPEN"; if (fd->perm == ADIO_PERM_NULL) { - old_mask = umask(022); - umask(old_mask); - perm = old_mask ^ 0666; - } - else perm = fd->perm; - + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + amode = 0; if (fd->access_mode & ADIO_CREATE) - amode = amode | O_CREAT; + amode = amode | O_CREAT; if (fd->access_mode & ADIO_RDONLY) - amode = amode | O_RDONLY; + amode = amode | O_RDONLY; if (fd->access_mode & ADIO_WRONLY) - amode = amode | O_WRONLY; + amode = amode | O_WRONLY; if (fd->access_mode & ADIO_RDWR) - amode = amode | O_RDWR; + amode = amode | O_RDWR; if (fd->access_mode & ADIO_EXCL) - amode = amode | O_EXCL; + amode = amode | O_EXCL; #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); #endif fd->fd_sys = open(fd->filename, amode, perm); #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); #endif fd->fd_direct = -1; if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); #endif fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); #endif } if (fd->fd_sys == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else *error_code = MPI_SUCCESS; + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; } diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_read.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_read.c new file mode 100644 index 0000000000000000000000000000000000000000..1b5daa6f8acb6901b9bd0b1ace1fc2165f383c50 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_read.c @@ -0,0 +1,545 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" +#include "adio_extern.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ssize_t err = -1; + MPI_Count datatype_size, len; + ADIO_Offset bytes_xfered = 0; + size_t rd_count; + static char myname[] = "ADIOI_NFS_READCONTIG"; + char *p; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + p = buf; + while (bytes_xfered < len) { + rd_count = len - bytes_xfered; + /* FreeBSD and Darwin workaround: bigger than INT_MAX is an error */ + if (rd_count > INT_MAX) + rd_count = INT_MAX; + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, offset + bytes_xfered, SEEK_SET, rd_count); + else + ADIOI_READ_LOCK(fd, offset + bytes_xfered, SEEK_SET, rd_count); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = pread(fd->fd_sys, p, rd_count, offset + bytes_xfered); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + } + /* --END ERROR HANDLING-- */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + ADIOI_UNLOCK(fd, offset + bytes_xfered, SEEK_SET, rd_count); + if (err == 0) { + /* end of file */ + break; + } + bytes_xfered += err; + p += err; + } + + fd->fp_sys_posn = offset + bytes_xfered; + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_xfered; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, bytes_xfered); +#endif + + *error_code = MPI_SUCCESS; +} + + + +#ifdef ADIOI_MPE_LOGGING +#define ADIOI_BUFFERED_READ \ + { \ + if (req_off >= readbuf_off + readbuf_len) { \ + readbuf_off = req_off; \ + readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1)); \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, readbuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); \ + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); \ + err = read(fd->fd_sys, readbuf, readbuf_len); \ + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); \ + if (err == -1) err_flag = 1; \ + } \ + while (req_len > readbuf_off + readbuf_len - req_off) { \ + partial_read = (int) (readbuf_off + readbuf_len - req_off); \ + tmp_buf = (char *) ADIOI_Malloc(partial_read); \ + memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ + ADIOI_Free(readbuf); \ + readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ + memcpy(readbuf, tmp_buf, partial_read); \ + ADIOI_Free(tmp_buf); \ + readbuf_off += readbuf_len-partial_read; \ + readbuf_len = (int) (partial_read + MPL_MIN(max_bufsize, \ + end_offset-readbuf_off+1)); \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read); \ + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); \ + err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read); \ + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read); \ + if (err == -1) err_flag = 1; \ + } \ + memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ + } +#else +#define ADIOI_BUFFERED_READ \ + { \ + if (req_off >= readbuf_off + readbuf_len) { \ + readbuf_off = req_off; \ + readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1)); \ + lseek(fd->fd_sys, readbuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); \ + err = read(fd->fd_sys, readbuf, readbuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); \ + if (err == -1) err_flag = 1; \ + } \ + while (req_len > readbuf_off + readbuf_len - req_off) { \ + partial_read = (int) (readbuf_off + readbuf_len - req_off); \ + tmp_buf = (char *) ADIOI_Malloc(partial_read); \ + memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ + ADIOI_Free(readbuf); \ + readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ + memcpy(readbuf, tmp_buf, partial_read); \ + ADIOI_Free(tmp_buf); \ + readbuf_off += readbuf_len-partial_read; \ + readbuf_len = (int) (partial_read + MPL_MIN(max_bufsize, \ + end_offset-readbuf_off+1)); \ + lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read); \ + err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read); \ + if (err == -1) err_flag = 1; \ + } \ + memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ + } +#endif + + +void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, new_brd_size, brd_size, size; + int i, j, k, err, err_flag = 0, st_index = 0; + MPI_Count num, bufsize; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype; + ADIO_Offset abs_off_in_filetype = 0, new_frd_size, frd_size = 0, st_frd_size; + MPI_Count filetype_size, etype_size, buftype_size, partial_read; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off, req_len, sum; + ADIO_Offset off, req_off, disp, end_offset = 0, readbuf_off, start_off; + char *readbuf, *tmp_buf, *value; + int info_flag; + unsigned max_bufsize, readbuf_len; + + static char myname[] = "ADIOI_NFS_READSTRIDED"; + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == + ((ADIO_Offset) (MPI_Count) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); + max_bufsize = atoi(value); + ADIOI_Free(value); + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : fd->disp + etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + readbuf_off = off; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset - readbuf_off + 1)); + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, readbuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->fd_sys, readbuf, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); + if (err == -1) + err_flag = 1; + + for (j = 0; j < count; j++) + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = (ADIO_Offset) j *buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_READ off += flat_buf->blocklens[i]; + } + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ + + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + + else { /* noncontiguous in file */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + frd_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao: read request is within a single flat_file contig + * block e.g. with subarray types that actually describe the whole + * array */ + if (buftype_is_contig && bufsize <= frd_size) { + /* a count of bytes can overflow. operate on original type instead */ + ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte that + * can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == frd_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + n_filetypes * filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ + + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + frd_size = MPL_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + i_offset += frd_size; + end_offset = off + frd_size - 1; + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + /* initial read into readbuf */ + readbuf_off = offset; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset - readbuf_off + 1)); + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_READ_LOCK(fd, offset, SEEK_SET, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->fd_sys, readbuf, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, offset, SEEK_SET, readbuf_len); + + if (err == -1) + err_flag = 1; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = MPL_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + if (frd_size) { + /* TYPE_UB and TYPE_LB can result in + * frd_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = read(fd->fd_sys, ((char *) buf) + i, frd_size); */ + + req_off = off; + req_len = frd_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ} + i_offset += frd_size; + + if (off + frd_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += frd_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by frd_size. */ + else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(frd_size, brd_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = read(fd->fd_sys, ((char *) buf) + i, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ} + + new_frd_size = frd_size; + new_brd_size = brd_size; + + if (size == frd_size) { +/* reached end of contiguous block in file */ + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_frd_size = flat_file->blocklens[j]; + if (size != brd_size) { + i_offset += size; + new_brd_size -= size; + } + } + + if (size == brd_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + i_offset = buftype_extent * (buf_count / flat_buf->count) + + flat_buf->indices[k]; + new_brd_size = flat_buf->blocklens[k]; + if (size != frd_size) { + off += size; + new_frd_size -= size; + } + } + num += size; + frd_size = new_frd_size; + brd_size = new_brd_size; + } + } + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ + + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + +} diff --git a/3rd-party/romio321/adio/ad_nfs/ad_nfs_resize.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_resize.c similarity index 70% rename from 3rd-party/romio321/adio/ad_nfs/ad_nfs_resize.c rename to 3rd-party/romio341/adio/ad_nfs/ad_nfs_resize.c index d86dfcc77ed6daef3dda64e66390c984d6f33f0b..0b4e1553629ab97e2e55c9f1fd0d2fa2551dcc5b 100644 --- a/3rd-party/romio321/adio/ad_nfs/ad_nfs_resize.c +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_resize.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_nfs.h" @@ -26,8 +24,8 @@ void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) /* --BEGIN ERROR HANDLING-- */ if (err == -1) { - *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - return; + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + return; } /* --END ERROR HANDLING-- */ diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_setsh.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_setsh.c new file mode 100644 index 0000000000000000000000000000000000000000..c8cafa96916d11e44444a538812cd4cda182b7b4 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_setsh.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +/* set the shared file pointer to "offset" etypes relative to the current + view */ + +/* +This looks very similar to ADIOI_GEN_Set_shared_fp, except this +function avoids locking the file twice. The generic version does + +Write lock +ADIO_WriteContig +Unlock + +For NFS, ADIOI_NFS_WriteContig does a lock before writing to disable +caching. To avoid the lock being called twice, this version for NFS does + +Write lock +Lseek +Write +Unlock + +*/ + +void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) +{ + ssize_t err; + MPI_Comm dupcommself; + static char myname[] = "ADIOI_NFS_SET_SHARED_FP"; + + if (fd->shared_fp_fd == ADIO_FILE_NULL) { + MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); + fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, + fd->shared_fp_fname, + fd->file_system, fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, + ADIO_PERM_NULL, error_code); + } + + if (*error_code != MPI_SUCCESS) + return; + + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_wait.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_wait.c new file mode 100644 index 0000000000000000000000000000000000000000..66f1aa545774942ef5c5fa95859d0562abd2db11 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_wait.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" + +void ADIOI_NFS_ReadComplete(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + return; +} + + +void ADIOI_NFS_WriteComplete(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + ADIOI_NFS_ReadComplete(request, status, error_code); +} diff --git a/3rd-party/romio341/adio/ad_nfs/ad_nfs_write.c b/3rd-party/romio341/adio/ad_nfs/ad_nfs_write.c new file mode 100644 index 0000000000000000000000000000000000000000..992d52ffe412442f17c0e248bf31c44454ce4e58 --- /dev/null +++ b/3rd-party/romio341/adio/ad_nfs/ad_nfs_write.c @@ -0,0 +1,684 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_nfs.h" +#include "adio_extern.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ssize_t err = -1; + MPI_Count datatype_size, len; + ADIO_Offset bytes_xfered = 0; + size_t wr_count; + static char myname[] = "ADIOI_NFS_WRITECONTIG"; + char *p; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * (ADIO_Offset) count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + p = (char *) buf; + while (bytes_xfered < len) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + wr_count = len - bytes_xfered; + /* work around FreeBSD and OS X defects */ + if (wr_count > INT_MAX) + wr_count = INT_MAX; + + ADIOI_WRITE_LOCK(fd, offset + bytes_xfered, SEEK_SET, wr_count); + err = pwrite(fd->fd_sys, p, wr_count, offset + bytes_xfered); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + ADIOI_UNLOCK(fd, offset + bytes_xfered, SEEK_SET, wr_count); + bytes_xfered += err; + p += err; + } + fd->fp_sys_posn = offset + bytes_xfered; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_xfered; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, bytes_xfered); +#endif + + *error_code = MPI_SUCCESS; +} + + + + +#ifdef ADIOI_MPE_LOGGING +#define ADIOI_BUFFERED_WRITE \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); \ + if (err == -1) { \ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**ioRMWrdwr", 0); \ + goto fn_exit; \ + } \ + } \ + write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); \ + if (err == -1) { \ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**ioRMWrdwr", 0); \ + goto fn_exit; \ + } \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } +#else +#define ADIOI_BUFFERED_WRITE \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -1) { \ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**ioRMWrdwr", 0); \ + goto fn_exit; \ + } \ + } \ + write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -1) { \ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**ioRMWrdwr", 0); \ + goto fn_exit; \ + } \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } +#endif + +/* this macro is used when filetype is contig and buftype is not contig. + it does not do a read-modify-write and does not lock*/ +#ifdef ADIOI_MPE_LOGGING +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + } \ + write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } +#else +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + } \ + write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } +#endif + + +void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, err = -1, bwr_size, st_index = 0; + ADIO_Offset i_offset, sum, size_in_filetype; + ADIO_Offset num, size, n_etypes_in_filetype; + MPI_Count bufsize; + ADIO_Offset n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + int req_len; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset = 0, writebuf_off, start_off; + char *writebuf = NULL, *value; + int st_n_filetypes, writebuf_len, write_sz; + ADIO_Offset fwr_size = 0, new_fwr_size, st_fwr_size; + int new_bwr_size, err_flag = 0, info_flag, max_bufsize; + static char myname[] = "ADIOI_NFS_WRITESTRIDED"; + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); + max_bufsize = atoi(value); + ADIOI_Free(value); + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : fd->disp + etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + writebuf_off = off; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + writebuf_len = (int) (MPL_MIN(max_bufsize, end_offset - writebuf_off + 1)); + +/* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + for (j = 0; j < count; j++) + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = j * buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ; + off += flat_buf->blocklens[i]; + } + + /* write the buffer out finally */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + if (err == -1) + err_flag = 1; + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + + else { /* noncontiguous in file */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + abs_off_in_filetype; + } + + start_off = offset; + /* Wei-keng Liao:write request is within single flat_file contig block */ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + /* though MPI api has an integer 'count' parameter, derived + * datatypes might describe more bytes than can fit into an integer. + * if we've made it this far, we can pass a count of original + * datatypes, instead of a count of bytes (which might overflow) + * Other WriteContig calls in this path are operating on data + * sieving buffer */ + ADIO_WriteContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset) n_filetypes *filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + goto fn_exit; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be write, end_offset=99 */ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + i_offset += fwr_size; + end_offset = off + fwr_size - 1; + + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + +/* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + /* initial read for the read-modify-write */ + writebuf_off = offset; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + memset(writebuf, -1, max_bufsize); + writebuf_len = (int) (MPL_MIN(max_bufsize, end_offset - writebuf_off + 1)); + if (!(fd->atomicity)) + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, + "ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.", + 0); + goto fn_exit; + } + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + * fwr_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i, fwr_size); */ + + req_off = off; + req_len = fwr_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. */ + else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(fwr_size, bwr_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + i_offset = + (ADIO_Offset) buftype_extent *(ADIO_Offset) (buf_count / flat_buf->count) + + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* write the buffer out finally */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (!(fd->atomicity)) + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + else + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (err == -1) + err_flag = 1; + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + fn_exit: + if (writebuf != NULL) + ADIOI_Free(writebuf); + + return; +} diff --git a/3rd-party/romio321/adio/ad_panfs/Makefile.mk b/3rd-party/romio341/adio/ad_panfs/Makefile.mk similarity index 78% rename from 3rd-party/romio321/adio/ad_panfs/Makefile.mk rename to 3rd-party/romio341/adio/ad_panfs/Makefile.mk index ad412d9bb08635445ddcb89586409b7795624908..59573df63074f7bd20cf4b18dd4a087b70b9f3da 100644 --- a/3rd-party/romio321/adio/ad_panfs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_panfs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_PANFS_OPEN6 @@ -25,4 +23,3 @@ romio_other_sources += \ adio/ad_panfs/ad_panfs_write.c endif BUILD_AD_PANFS - diff --git a/3rd-party/romio341/adio/ad_panfs/ad_panfs.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs.c new file mode 100644 index 0000000000000000000000000000000000000000..1a59e0503f9acef082d80e3bf84b483a3a10cc32 --- /dev/null +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_panfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +#ifndef ROMIOCONF_H_INCLUDED +#include "romioconf.h" +#define ROMIOCONF_H_INCLUDED +#endif + + +struct ADIOI_Fns_struct ADIO_PANFS_operations = { +#ifdef HAVE_PAN_FS_CLIENT_RAIDN_ENCODING_T + ADIOI_PANFS_Open6, /* Open, using newer Panasas features */ +#else + ADIOI_PANFS_Open, /* open, but using Panasas5 and earlier features */ +#endif + ADIOI_GEN_OpenColl, + ADIOI_PANFS_ReadContig, /* ReadContig */ + ADIOI_PANFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ + ADIOI_PANFS_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Flush, /* Flush */ + ADIOI_PANFS_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, + "PANFS: Panasas PanFS", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs.h b/3rd-party/romio341/adio/ad_panfs/ad_panfs.h similarity index 50% rename from 3rd-party/romio321/adio/ad_panfs/ad_panfs.h rename to 3rd-party/romio341/adio/ad_panfs/ad_panfs.h index 31a0f3d8a8b633da3ea9b2925d62a2a0ce752e48..e6af35e78d2e2dd34c72f19cdce06e0c17c8c48e 100644 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs.h +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs.h @@ -1,49 +1,44 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * ad_panfs.h - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ -#ifndef AD_PANFS_INCLUDE -#define AD_PANFS_INCLUDE +#ifndef AD_PANFS_H_INCLUDED +#define AD_PANFS_H_INCLUDED +#include "adio.h" #include <unistd.h> #include <sys/types.h> #include <fcntl.h> -#include "adio.h" #ifndef NO_AIO -# ifdef AIO_SUN -# include <sys/asynch.h> -# else - #ifdef HAVE_AIO_LITE_H - #include <aio-lite.h> - #else - #ifdef HAVE_AIO_H - #include <aio.h> - #endif - #ifdef HAVE_SYS_AIO_H - #include <sys/aio.h> - #endif - #endif -# endif +#ifdef AIO_SUN +#include <sys/asynch.h> +#else +#ifdef HAVE_AIO_LITE_H +#include <aio-lite.h> +#else +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif +#endif +#endif #endif void ADIOI_PANFS_Open(ADIO_File fd, int *error_code); /* Panasas 6 introduced some new features */ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code); void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); +void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); void ADIOI_PANFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); void ADIOI_PANFS_WriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code); + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); /* TODO: move this to common code and have all routines retry. */ /* TODO: also check for EWOULDBLOCK */ @@ -57,9 +52,9 @@ int usleep(useconds_t usec); #define AD_PANFS_RETRY(_op_,_rc_) \ { \ _rc_ = (_op_); \ - while(_rc_ == -1 && errno == EAGAIN) \ + while (_rc_ == -1 && errno == EAGAIN) \ { \ - if(usleep(AD_PANFS_RETRY_DELAY) == -1) \ + if (usleep(AD_PANFS_RETRY_DELAY) == -1) \ { \ break; \ } \ @@ -67,4 +62,4 @@ int usleep(useconds_t usec); } \ } -#endif +#endif /* AD_PANFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_panfs/ad_panfs_hints.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..daa5ab7560ad9ee6f79621a419d81fdc4ef12329 --- /dev/null +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_hints.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_panfs.h" +#include <pan_fs_client_cw_mode.h> +#include "hint_fns.h" + +void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ +#if defined(MPICH) || !defined(PRINT_ERR_MSG) + static char myname[] = "ADIOI_PANFS_SETINFO"; +#endif + int gen_error_code; + + *error_code = MPI_SUCCESS; + + if (fd->info == MPI_INFO_NULL) { + /* This must be part of the open call. can set striping parameters + * if necessary. + */ + MPI_Info_create(&(fd->info)); + + /* anticipate concurrent writes in an MPI-IO application */ + ADIOI_Info_set(fd->info, "panfs_concurrent_write", "1"); + + /* has user specified striping parameters + * and do they have the same value on all processes? */ + if (users_info != MPI_INFO_NULL) { + + ADIOI_Info_check_and_install_int(fd, users_info, "panfs_concurrent_write", + NULL, myname, error_code); + + ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_type", + NULL, myname, error_code); + + ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_stripe_unit", + NULL, myname, error_code); + + /* strange: there was a check "layout_type == + * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE, but + * nothing ever touched layout_type */ + ADIOI_Info_check_and_install_int(fd, users_info, + "panfs_layout_parity_stripe_width", NULL, myname, + error_code); + + ADIOI_Info_check_and_install_int(fd, users_info, + "panfs_layout_parity_stripe_depth", NULL, myname, + error_code); + + ADIOI_Info_check_and_install_int(fd, users_info, + "panfs_layout_total_num_comps", NULL, myname, + error_code); + /* this hint used to check for + * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE or + * PAN_FS_CLIENT_LAYOUT_TYPE__RAID10, but again, layout_type never + * gets updated */ + ADIOI_Info_check_and_install_int(fd, users_info, + "panfs_layout_visit_policy", NULL, myname, error_code); + } + } + + ADIOI_GEN_SetInfo(fd, users_info, &gen_error_code); + /* If this function is successful, use the error code returned from ADIOI_GEN_SetInfo + * otherwise use the error_code generated by this function + */ + if (*error_code == MPI_SUCCESS) { + *error_code = gen_error_code; + } +} diff --git a/3rd-party/romio341/adio/ad_panfs/ad_panfs_open.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_open.c new file mode 100644 index 0000000000000000000000000000000000000000..a0d3890ed493109d3779f9bd1bdbb7c6ac12c9d9 --- /dev/null +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_open.c @@ -0,0 +1,348 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_panfs.h" +#include <string.h> +#include <pan_fs_client_cw_mode.h> +#define TEMP_BUFFER_SIZE 64 + +void ADIOI_PANFS_Open(ADIO_File fd, int *error_code) +{ + char *value; + int perm, old_mask, amode, flag; + static char myname[] = "ADIOI_PANFS_OPEN"; + + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = ~old_mask & 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) { + pan_fs_client_layout_agg_type_t layout_type = PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT; + unsigned long int layout_stripe_unit = 0; + unsigned long int layout_parity_stripe_width = 0; + unsigned long int layout_parity_stripe_depth = 0; + unsigned long int layout_total_num_comps = 0; + pan_fs_client_layout_visit_t layout_visit_policy = PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN; + int myrank; + + MPI_Comm_rank(fd->comm, &myrank); + + *error_code = MPI_SUCCESS; + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "panfs_layout_type", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + layout_type = strtoul(value, NULL, 10); + } + ADIOI_Info_get(fd->info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + layout_stripe_unit = strtoul(value, NULL, 10); + } + ADIOI_Info_get(fd->info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + layout_total_num_comps = strtoul(value, NULL, 10); + } + ADIOI_Info_get(fd->info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + layout_parity_stripe_width = strtoul(value, NULL, 10); + } + ADIOI_Info_get(fd->info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + layout_parity_stripe_depth = strtoul(value, NULL, 10); + } + ADIOI_Info_get(fd->info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + layout_visit_policy = strtoul(value, NULL, 10); + } + ADIOI_Free(value); + + amode = amode | O_CREAT; + /* Check for valid set of hints */ + if ((layout_type < PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT) || + (layout_type > PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) { + FPRINTF(stderr, "%s: panfs_layout_type is not a valid value: %u.\n", myname, + layout_type); + MPI_Abort(MPI_COMM_WORLD, 1); + } + if ((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) && + ((layout_stripe_unit == 0) || (layout_total_num_comps == 0))) { + if (layout_stripe_unit == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + if (layout_total_num_comps == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + MPI_Abort(MPI_COMM_WORLD, 1); + } + if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) { + if ((layout_stripe_unit == 0) || + (layout_parity_stripe_width == 0) || + (layout_parity_stripe_depth == 0) || (layout_total_num_comps == 0)) { + if (layout_stripe_unit == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + if (layout_total_num_comps == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + if (layout_parity_stripe_width == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_parity_stripe_width hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + if (layout_parity_stripe_depth == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_parity_stripe_depth hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + MPI_Abort(MPI_COMM_WORLD, 1); + } + if ((layout_visit_policy < PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN) || + (layout_visit_policy > PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN_WITH_HASHED_OFFSET)) + { + FPRINTF(stderr, "%s: panfs_layout_visit_policy is not a valid value: %u.\n", myname, + layout_visit_policy); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) { + if ((layout_stripe_unit == 0) || (layout_total_num_comps == 0)) { + if (layout_stripe_unit == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID10 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + if (layout_total_num_comps == 0) { + FPRINTF(stderr, + "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID10 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", + myname); + } + MPI_Abort(MPI_COMM_WORLD, 1); + } + if ((layout_visit_policy < PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN) || + (layout_visit_policy > PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN_WITH_HASHED_OFFSET)) + { + FPRINTF(stderr, "%s: panfs_layout_visit_policy is not a valid value: %u.\n", myname, + layout_visit_policy); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + /* Create the file via ioctl() or open(). ADIOI_PANFS_Open's caller + * already optimizes performance by only calling this function with + * ADIO_CREATE on rank 0. Therefore, we don't need to worry about + * implementing that optimization here. */ + if ((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) || + (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) + || (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) { + pan_fs_client_layout_create_args_t file_create_args; + int fd_dir; + char *slash; + struct stat stat_buf; + int err; + char *path; + + /* Check that the file does not exist before + * trying to create it. The ioctl itself should + * be able to handle this condition. Currently, + * the ioctl will return successfully if the file + * has been previously created. Filed bug 33862 + * to track the problem. + */ + err = stat(fd->filename, &stat_buf); + if ((err == -1) && (errno != ENOENT)) { + FPRINTF(stderr, "%s: Unexpected I/O Error calling stat() on PanFS file: %s.\n", + myname, strerror(errno)); + MPI_Abort(MPI_COMM_WORLD, 1); + } else if (err == 0) { + FPRINTF(stderr, + "%s: Cannot create PanFS file with ioctl when file already exists.\n", + myname); + MPI_Abort(MPI_COMM_WORLD, 1); + } else { + /* (err == -1) && (errno == ENOENT) */ + /* File does not exist */ + path = ADIOI_Strdup(fd->filename); + slash = strrchr(path, '/'); + if (!slash) + ADIOI_Strncpy(path, ".", 2); + else { + if (slash == path) + *(path + 1) = '\0'; + else + *slash = '\0'; + } + + /* create PanFS object */ + memset(&file_create_args, 0, sizeof(pan_fs_client_layout_create_args_t)); + /* open directory */ + fd_dir = open(path, O_RDONLY); + if (fd_dir < 0) { + FPRINTF(stderr, + "%s: I/O Error opening parent directory to create PanFS file using ioctl: %s.\n", + myname, strerror(errno)); + MPI_Abort(MPI_COMM_WORLD, 1); + } else { + char *file_name_ptr = fd->filename; + slash = strrchr(fd->filename, '/'); + if (slash) { + file_name_ptr = slash + 1; + } + /* create file in the directory */ + file_create_args.mode = perm; + file_create_args.version = PAN_FS_CLIENT_LAYOUT_VERSION; + file_create_args.flags = PAN_FS_CLIENT_LAYOUT_CREATE_F__NONE; + ADIOI_Strncpy(file_create_args.filename, file_name_ptr, + strlen(fd->filename) + 1); + file_create_args.layout.agg_type = layout_type; + file_create_args.layout.layout_is_valid = 1; + if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) { + file_create_args.layout.u.raid1_5_parity_stripe.total_num_comps = + layout_total_num_comps; + file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_width = + layout_parity_stripe_width; + file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth = + layout_parity_stripe_depth; + file_create_args.layout.u.raid1_5_parity_stripe.stripe_unit = + layout_stripe_unit; + file_create_args.layout.u.raid1_5_parity_stripe.layout_visit_policy = + layout_visit_policy; + } else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) { + file_create_args.layout.u.raid0.total_num_comps = layout_total_num_comps; + file_create_args.layout.u.raid0.stripe_unit = layout_stripe_unit; + } else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) { + file_create_args.layout.u.raid10.total_num_comps = layout_total_num_comps; + file_create_args.layout.u.raid10.stripe_unit = layout_stripe_unit; + file_create_args.layout.u.raid10.layout_visit_policy = layout_visit_policy; + } + err = ioctl(fd_dir, PAN_FS_CLIENT_LAYOUT_CREATE_FILE, &file_create_args); + if (err < 0) { + FPRINTF(stderr, + "%s: I/O Error doing ioctl on parent directory to create PanFS file using ioctl: %s.\n", + myname, strerror(errno)); + MPI_Abort(MPI_COMM_WORLD, 1); + } + err = close(fd_dir); + } + ADIOI_Free(path); + } + } else { + int create_fd = open(fd->filename, amode, perm); + if (create_fd != -1) { + close(create_fd); + } else { + FPRINTF(stderr, "%s: I/O Error creating PanFS file using open: %s.\n", myname, + strerror(errno)); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + } + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "panfs_concurrent_write", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + unsigned long int concurrent_write = strtoul(value, NULL, 10); + if (concurrent_write == 1) { + amode = amode | O_CONCURRENT_WRITE; + } + } + ADIOI_Free(value); + + fd->fd_sys = open(fd->filename, amode, perm); + fd->fd_direct = -1; + + if (fd->fd_sys != -1) { + int rc; + char temp_buffer[TEMP_BUFFER_SIZE]; + pan_fs_client_layout_query_args_t file_query_args; + memset(&file_query_args, 0, sizeof(pan_fs_client_layout_query_args_t)); + file_query_args.version = PAN_FS_CLIENT_LAYOUT_VERSION; + rc = ioctl(fd->fd_sys, PAN_FS_CLIENT_LAYOUT_QUERY_FILE, &file_query_args); + if (rc < 0) { + /* Error - set layout type to unknown */ + ADIOI_Info_set(fd->info, "panfs_layout_type", "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); + } else { + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", file_query_args.layout.agg_type); + ADIOI_Info_set(fd->info, "panfs_layout_type", temp_buffer); + if (file_query_args.layout.layout_is_valid == 1) { + switch (file_query_args.layout.agg_type) { + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID0: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid0.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid0.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u. + raid1_5_parity_stripe.parity_stripe_width); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u. + raid1_5_parity_stripe.parity_stripe_depth); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u. + raid1_5_parity_stripe.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u. + raid1_5_parity_stripe.layout_visit_policy); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.layout_visit_policy); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__INVALID: + case PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT: + MPI_Info_set(fd->info, "panfs_layout_type", + "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); + default: + break; + } + } + } + } + + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); + + if (fd->fd_sys == -1) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_open6.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_open6.c similarity index 78% rename from 3rd-party/romio321/adio/ad_panfs/ad_panfs_open6.c rename to 3rd-party/romio341/adio/ad_panfs/ad_panfs_open6.c index 6906ff08d7e4c693e480d59eb05891ea9b7011e5..762bf84189558561efcee32443a086d80ffc7e6e 100644 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_open6.c +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_open6.c @@ -1,9 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * ad_panfs_open.c - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_panfs.h" @@ -21,8 +18,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) old_mask = umask(022); umask(old_mask); perm = ~old_mask & 0666; - } - else + } else perm = fd->perm; amode = 0; @@ -224,8 +220,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) FPRINTF(stderr, "%s: Unexpected I/O Error calling stat() on PanFS file: %s.\n", myname, strerror(errno)); MPI_Abort(MPI_COMM_WORLD, 1); - } - else if (err == 0) { + } else if (err == 0) { /* ensure that we have the same semantics here and in the call to creat(). In the latter, we do not * use O_EXCL so a create on an existing file should not fail. */ @@ -233,8 +228,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) "%s: Cannot create PanFS file with ioctl when file already exists, using open() syscall.\n", myname); goto use_open_syscall; - } - else { + } else { /* (err == -1) && (errno == ENOENT) */ /* File does not exist */ path = ADIOI_Strdup(fd->filename); @@ -257,8 +251,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) "%s: I/O Error opening parent directory to create PanFS file using ioctl: %s.\n", myname, strerror(errno)); MPI_Abort(MPI_COMM_WORLD, 1); - } - else { + } else { char *file_name_ptr = fd->filename; slash = strrchr(fd->filename, '/'); if (slash) { @@ -284,8 +277,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) file_create_args.layout.u.raidn_parity_stripe.max_faults = layout_max_faults; file_create_args.layout.u.raidn_parity_stripe.encoding = layout_encoding; - } - else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) { + } else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) { file_create_args.layout.u.raid1_5_parity_stripe.total_num_comps = layout_total_num_comps; file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_width = @@ -296,8 +288,7 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) layout_stripe_unit; file_create_args.layout.u.raid1_5_parity_stripe.layout_visit_policy = layout_visit_policy; - } - else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) { + } else if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) { file_create_args.layout.u.raid10.total_num_comps = layout_total_num_comps; file_create_args.layout.u.raid10.stripe_unit = layout_stripe_unit; file_create_args.layout.u.raid10.layout_visit_policy = layout_visit_policy; @@ -313,14 +304,12 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) } ADIOI_Free(path); } - } - else { + } else { use_open_syscall:; int create_fd = open(fd->filename, amode, perm); if (create_fd != -1) { close(create_fd); - } - else { + } else { FPRINTF(stderr, "%s: I/O Error creating PanFS file using open: %s.\n", myname, strerror(errno)); MPI_Abort(MPI_COMM_WORLD, 1); @@ -359,71 +348,71 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) if (rc < 0) { /* Error - set layout type to unknown */ ADIOI_Info_set(fd->info, "panfs_layout_type", "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); - } - else { - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", file_query_args.layout.agg_type); + } else { + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", file_query_args.layout.agg_type); ADIOI_Info_set(fd->info, "panfs_layout_type", temp_buffer); if (file_query_args.layout.layout_is_valid == 1) { switch (file_query_args.layout.agg_type) { - case PAN_FS_CLIENT_LAYOUT_TYPE__RAIDN_PARITY_STRIPE: - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe. - parity_stripe_width); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe. - parity_stripe_depth); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe.max_faults); - ADIOI_Info_set(fd->info, "panfs_layout_max_faults", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raidn_parity_stripe.encoding); - ADIOI_Info_set(fd->info, "panfs_layout_encoding", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE: - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid1_5_parity_stripe. - parity_stripe_width); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid1_5_parity_stripe. - parity_stripe_depth); - ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid1_5_parity_stripe. - layout_visit_policy); - ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10: - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid10.stripe_unit); - ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid10.total_num_comps); - ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); - ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", - file_query_args.layout.u.raid10.layout_visit_policy); - ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); - break; - case PAN_FS_CLIENT_LAYOUT_TYPE__INVALID: - case PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT: - MPI_Info_set(fd->info, "panfs_layout_type", - "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); - default: - break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAIDN_PARITY_STRIPE: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe. + parity_stripe_width); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe. + parity_stripe_depth); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe.max_faults); + ADIOI_Info_set(fd->info, "panfs_layout_max_faults", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raidn_parity_stripe.encoding); + ADIOI_Info_set(fd->info, "panfs_layout_encoding", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid1_5_parity_stripe. + parity_stripe_width); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid1_5_parity_stripe. + parity_stripe_depth); + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u. + raid1_5_parity_stripe.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid1_5_parity_stripe. + layout_visit_policy); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10: + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", + file_query_args.layout.u.raid10.layout_visit_policy); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__INVALID: + case PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT: + MPI_Info_set(fd->info, "panfs_layout_type", + "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID"); + default: + break; } } } @@ -434,7 +423,6 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code) if (fd->fd_sys == -1) { *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); - } - else + } else *error_code = MPI_SUCCESS; } diff --git a/3rd-party/romio341/adio/ad_panfs/ad_panfs_read.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_read.c new file mode 100644 index 0000000000000000000000000000000000000000..5fcc10a638a90cc001fc3d799999635cb1988fb9 --- /dev/null +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_read.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_panfs.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + MPI_Count err = -1, datatype_size, len; + static char myname[] = "ADIOI_PANFS_READCONTIG"; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { + err = lseek(fd->fd_sys, offset, SEEK_SET); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + + AD_PANFS_RETRY(read(fd->fd_sys, buf, len), err) + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_panfs/ad_panfs_resize.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_resize.c similarity index 51% rename from 3rd-party/romio321/adio/ad_panfs/ad_panfs_resize.c rename to 3rd-party/romio341/adio/ad_panfs/ad_panfs_resize.c index 5c41126c4deb588223a18c02d79abbd086db29ae..3fb67d6ae577a40c5cdbd598f691773025b85cdd 100644 --- a/3rd-party/romio321/adio/ad_panfs/ad_panfs_resize.c +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_resize.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_panfs.h" @@ -19,29 +17,26 @@ void ADIOI_PANFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) static char myname[] = "ADIOI_PANFS_RESIZE"; MPI_Comm_rank(fd->comm, &myrank); - if (!myrank) - { - AD_PANFS_RETRY(ftruncate(fd->fd_sys,size),err); + if (!myrank) { + AD_PANFS_RETRY(ftruncate(fd->fd_sys, size), err); MPI_Barrier(fd->comm); - } - else - { + } else { MPI_Barrier(fd->comm); - AD_PANFS_RETRY(fstat(fd->fd_sys,&stat_buf),err); - if(((ADIO_Offset)stat_buf.st_size) != size) - { + AD_PANFS_RETRY(fstat(fd->fd_sys, &stat_buf), err); + if (((ADIO_Offset) stat_buf.st_size) != size) { /* This should never happen otherwise there is a coherency problem. */ - FPRINTF(stderr, "%s: Rank %d: Resize failed: requested=%llu actual=%llu.\n",myname,myrank,size,(unsigned long long)stat_buf.st_size); + FPRINTF(stderr, "%s: Rank %d: Resize failed: requested=%llu actual=%llu.\n", myname, + myrank, size, (unsigned long long) stat_buf.st_size); MPI_Abort(MPI_COMM_WORLD, 1); } } /* --BEGIN ERROR HANDLING-- */ if (err == -1) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**io", "**io %s", strerror(errno)); - return; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + return; } /* --END ERROR HANDLING-- */ diff --git a/3rd-party/romio341/adio/ad_panfs/ad_panfs_write.c b/3rd-party/romio341/adio/ad_panfs/ad_panfs_write.c new file mode 100644 index 0000000000000000000000000000000000000000..dc6feb87304a7996e1a5a7d40f0fc130a206175d --- /dev/null +++ b/3rd-party/romio341/adio/ad_panfs/ad_panfs_write.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_panfs.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_PANFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + MPI_Count err = -1, datatype_size, len; + static char myname[] = "ADIOI_PANFS_WRITECONTIG"; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { + err = lseek(fd->fd_sys, offset, SEEK_SET); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + + AD_PANFS_RETRY(write(fd->fd_sys, buf, len), err) + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_pvfs2/Makefile.mk b/3rd-party/romio341/adio/ad_pvfs2/Makefile.mk similarity index 78% rename from 3rd-party/romio321/adio/ad_pvfs2/Makefile.mk rename to 3rd-party/romio341/adio/ad_pvfs2/Makefile.mk index 4ee9d0fd362265aac31011d4c06be88f9cf68f80..c5bf0e1fed8f1d651e14cdebc59c70e747bd88c6 100644 --- a/3rd-party/romio321/adio/ad_pvfs2/Makefile.mk +++ b/3rd-party/romio341/adio/ad_pvfs2/Makefile.mk @@ -1,15 +1,14 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_PVFS2 -noinst_HEADERS += adio/ad_pvfs2/ad_pvfs2.h \ - adio/ad_pvfs2/ad_pvfs2_io.h \ - adio/ad_pvfs2/ad_pvfs2_common.h +noinst_HEADERS += \ + adio/ad_pvfs2/ad_pvfs2.h \ + adio/ad_pvfs2/ad_pvfs2_io.h \ + adio/ad_pvfs2/ad_pvfs2_common.h romio_other_sources += \ adio/ad_pvfs2/ad_pvfs2_close.c \ @@ -31,4 +30,3 @@ romio_other_sources += \ adio/ad_pvfs2/ad_pvfs2_features.c endif BUILD_AD_PVFS2 - diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.c new file mode 100644 index 0000000000000000000000000000000000000000..aa591644749899e78e8e1ef0774f80eb5aa7cac1 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" + +#include "adio.h" + +struct ADIOI_Fns_struct ADIO_PVFS2_operations = { + ADIOI_PVFS2_Open, /* Open */ + ADIOI_SCALEABLE_OpenColl, /* OpenColl */ + ADIOI_PVFS2_ReadContig, /* ReadContig */ + ADIOI_PVFS2_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_PVFS2_Fcntl, /* Fcntl */ + ADIOI_PVFS2_SetInfo, /* SetInfo */ + ADIOI_PVFS2_ReadStrided, /* ReadStrided */ + ADIOI_PVFS2_WriteStrided, /* WriteStrided */ + ADIOI_PVFS2_Close, /* Close */ +#ifdef HAVE_MPI_GREQUEST_EXTENSIONS + ADIOI_PVFS2_IReadContig, /* IreadContig */ + ADIOI_PVFS2_IWriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_FAKE_IODone, /* ReadDone */ + ADIOI_FAKE_IODone, /* WriteDone */ + ADIOI_FAKE_IOComplete, /* ReadComplete */ + ADIOI_FAKE_IOComplete, /* WriteComplete */ + ADIOI_FAKE_IreadStrided, /* IreadStrided */ + ADIOI_FAKE_IwriteStrided, /* IwriteStrided */ + ADIOI_PVFS2_Flush, /* Flush */ + ADIOI_PVFS2_Resize, /* Resize */ + ADIOI_PVFS2_Delete, /* Delete */ + ADIOI_PVFS2_Feature, + "PVFS2: the PVFS v2 or OrangeFS file systems", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.h b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.h new file mode 100644 index 0000000000000000000000000000000000000000..1c14802fa14d7ce0c056128cddcb4dc9b5867e03 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_PVFS2_H_INCLUDED +#define AD_PVFS2_H_INCLUDED + +#include "adio.h" +#ifdef HAVE_PVFS2_H +#include "pvfs2.h" +#endif + +#ifdef PVFS2_VERSION_MAJOR +#include "pvfs2-compat.h" +#endif + +void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_PVFS2_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); +void ADIOI_PVFS2_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_Delete(const char *filename, int *error_code); +void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +int ADIOI_PVFS2_Feature(ADIO_File fd, int flag); + +void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +void ADIOI_PVFS2_IWriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int flag, int *error_code); +void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); + +int ADIOI_PVFS2_WriteStridedListIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +int ADIOI_PVFS2_WriteStridedDtypeIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + +#endif /* AD_PVFS2_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_aio.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_aio.c new file mode 100644 index 0000000000000000000000000000000000000000..058db4a8b113932087ac62cb790c18b355d99ec2 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_aio.c @@ -0,0 +1,207 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include <string.h> + +#include "ad_pvfs2_common.h" +#include "mpiu_greq.h" +#include "../../mpi-io/mpioimpl.h" + +#define READ 0 +#define WRITE 1 + +static int ADIOI_PVFS2_greq_class = 0; +int ADIOI_PVFS2_aio_free_fn(void *extra_state); +int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status * status); +int ADIOI_PVFS2_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status); + +void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + ADIOI_PVFS2_AIO_contig(fd, buf, count, datatype, file_ptr_type, + offset, request, READ, error_code); +} + +void ADIOI_PVFS2_IWriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + ADIOI_PVFS2_AIO_contig(fd, (void *) buf, count, datatype, file_ptr_type, + offset, request, WRITE, error_code); +} + +void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int flag, int *error_code) +{ + + int ret; + MPI_Count datatype_size, len; + ADIOI_PVFS2_fs *pvfs_fs; + ADIOI_AIO_Request *aio_req; + static char myname[] = "ADIOI_PVFS2_AIO_contig"; + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + aio_req = (ADIOI_AIO_Request *) ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->mem_req)); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->file_req)); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* copy individual file pointer into offset variable, continue */ + offset = fd->fp_ind; + } + if (flag == READ) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_iread_a, 0, NULL); +#endif + ret = PVFS_isys_read(pvfs_fs->object_ref, aio_req->file_req, offset, + buf, aio_req->mem_req, &(pvfs_fs->credentials), + &(aio_req->resp_io), &(aio_req->op_id), NULL); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_iread_b, 0, NULL); +#endif + } else if (flag == WRITE) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_iwrite_a, 0, NULL); +#endif + ret = PVFS_isys_write(pvfs_fs->object_ref, aio_req->file_req, offset, + buf, aio_req->mem_req, &(pvfs_fs->credentials), + &(aio_req->resp_io), &(aio_req->op_id), NULL); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_iwrite_b, 0, NULL); +#endif + } + + /* --BEGIN ERROR HANDLING-- */ + if (ret < 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_isys_io", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + /* posted. defered completion */ + if (ret == 0) { + if (ADIOI_PVFS2_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_PVFS2_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_PVFS2_aio_poll_fn, ADIOI_PVFS2_aio_wait_fn, + &ADIOI_PVFS2_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_PVFS2_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(*request)); + } + + /* immediate completion */ + if (ret == 1) { + MPIO_Completed_request_create(&fd, len, error_code, request); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += len; + } + fd->fp_sys_posn = offset + len; + + *error_code = MPI_SUCCESS; + fn_exit: + return; +} + +int ADIOI_PVFS2_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + aio_req = (ADIOI_AIO_Request *) extra_state; + + PVFS_Request_free(&(aio_req->mem_req)); + PVFS_Request_free(&(aio_req->file_req)); + ADIOI_Free(aio_req); + + return MPI_SUCCESS; +} + +int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status * status) +{ + ADIOI_AIO_Request *aio_req; + int ret, error; + + aio_req = (ADIOI_AIO_Request *) extra_state; + + /* BUG: cannot PVFS_sys_testsome: does not work for a specific request */ + ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_aio_poll_fn", &error); + if (ret == 0) { + aio_req->nbytes = aio_req->resp_io.total_completed; + MPI_Grequest_complete(aio_req->req); + return MPI_SUCCESS; + } else + return MPI_UNDEFINED; /* TODO: what's this error? */ +} + +/* wait for multiple requests to complete */ +int ADIOI_PVFS2_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status) +{ + + ADIOI_AIO_Request **aio_reqlist; + PVFS_sys_op_id *op_id_array; + int i, j, greq_count, completed_count = 0; + int *error_array; + + aio_reqlist = (ADIOI_AIO_Request **) array_of_states; + + op_id_array = (PVFS_sys_op_id *) ADIOI_Calloc(count, sizeof(PVFS_sys_op_id)); + error_array = (int *) ADIOI_Calloc(count, sizeof(int)); + greq_count = count; + + + /* PVFS-2.6: testsome actually tests all requests and fills in op_id_array + * with the ones that have completed. count is an in/out parameter. + * returns with the number of completed operations. what a mess! */ + while (completed_count < greq_count) { + count = greq_count; + PVFS_sys_testsome(op_id_array, &count, NULL, error_array, INT_MAX); + completed_count += count; + for (i = 0; i < count; i++) { + for (j = 0; j < greq_count; j++) { + if (op_id_array[i] == aio_reqlist[j]->op_id) { + aio_reqlist[j]->nbytes = aio_reqlist[j]->resp_io.total_completed; + MPI_Grequest_complete(aio_reqlist[j]->req); + } + } + } + } + return MPI_SUCCESS; /* TODO: no idea how to deal with errors */ +} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_close.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_close.c similarity index 71% rename from 3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_close.c rename to 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_close.c index 847dd8341cd57d838d5e35afba0c2f590e71d77e..a040927685bf3f96354a12545a8328cbc73d7f29 100644 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_close.c +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_close.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_pvfs2.h" @@ -23,6 +21,3 @@ void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code) *error_code = MPI_SUCCESS; } -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.c new file mode 100644 index 0000000000000000000000000000000000000000..371285460c66d84d6edcb3fd658965a0c9b3227e --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.c @@ -0,0 +1,141 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" +#include <unistd.h> +#include <sys/types.h> +#include <time.h> +#include <stdlib.h> + +/* maybe give romio access to the globalconfig struct */ +/* keyval hack to both tell us if we've already initialized pvfs2 and also + * close it down when mpi exits */ +int ADIOI_PVFS2_Initialized = MPI_KEYVAL_INVALID; + +void ADIOI_PVFS2_End(int *error_code) +{ + int ret; + static char myname[] = "ADIOI_PVFS2_END"; + + ret = PVFS_sys_finalize(); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_finalize", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + +int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state) +{ + int error_code; + ADIOI_PVFS2_End(&error_code); + MPI_Keyval_free(&keyval); + return error_code; +} + +void ADIOI_PVFS2_Init(int *error_code) +{ + int ret; + static char myname[] = "ADIOI_PVFS2_INIT"; + char *ncache_timeout; + + /* do nothing if we've already fired up the pvfs2 interface */ + if (ADIOI_PVFS2_Initialized != MPI_KEYVAL_INVALID) { + *error_code = MPI_SUCCESS; + return; + } + + /* for consistency, we should disable the pvfs2 ncache. If the + * environtment variable is already set, assume a user knows it + * won't be a problem */ + ncache_timeout = getenv("PVFS2_NCACHE_TIMEOUT"); + if (ncache_timeout == NULL) + setenv("PVFS2_NCACHE_TIMEOUT", "0", 1); + + ret = PVFS_util_init_defaults(); + if (ret < 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_util_init_defaults", 0); + PVFS_perror("PVFS_util_init_defaults", ret); + + return; + } + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_PVFS2_End_call, &ADIOI_PVFS2_Initialized, (void *) 0); + /* just like romio does, we make a dummy attribute so we + * get cleaned up */ + MPI_Attr_put(MPI_COMM_SELF, ADIOI_PVFS2_Initialized, (void *) 0); +} + +void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs) +{ + memset(attribs, 0, sizeof(PVFS_sys_attr)); + + attribs->owner = geteuid(); + attribs->group = getegid(); + attribs->perms = 0644; + attribs->mask = PVFS_ATTR_SYS_ALL_SETABLE; + attribs->atime = time(NULL); + attribs->mtime = attribs->atime; + attribs->ctime = attribs->atime; +} + + +void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials) +{ + memset(credentials, 0, sizeof(PVFS_credentials)); + + PVFS_util_gen_credentials(credentials); +} + +int ADIOI_PVFS2_error_convert(int pvfs_error) +{ + switch (pvfs_error) { + case PVFS_EPERM: + case PVFS_EACCES: + return MPI_ERR_ACCESS; + case PVFS_ENOENT: + case PVFS_ENXIO: + case PVFS_ENODEV: + return MPI_ERR_NO_SUCH_FILE; + case PVFS_EIO: + return MPI_ERR_IO; + case PVFS_EEXIST: + return MPI_ERR_FILE_EXISTS; + case PVFS_ENOTDIR: /* ??? */ + case PVFS_EISDIR: /* ??? */ + case PVFS_ENAMETOOLONG: + return MPI_ERR_BAD_FILE; + case PVFS_EINVAL: + return MPI_ERR_FILE; + case PVFS_EFBIG: /* ??? */ + case PVFS_ENOSPC: + return MPI_ERR_NO_SPACE; + case PVFS_EROFS: + return MPI_ERR_READ_ONLY; + case PVFS_ENOSYS: + return MPI_ERR_UNSUPPORTED_OPERATION; + /* PVFS does not support quotas */ + case EDQUOT: + return MPI_ERR_QUOTA; + case PVFS_ENOMEM: + return MPI_ERR_INTERN; + default: + return MPI_UNDEFINED; + } + +} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.h b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.h similarity index 54% rename from 3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.h rename to 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.h index f63f84a27bde9b282e19d00618940eea8a0d4ae8..93305ac3e0e1ea826958c1ee50050581945f7a1d 100644 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_common.h +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_common.h @@ -1,16 +1,14 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- - * vim: ts=8 sts=4 sw=4 noexpandtab - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ -#ifndef _AD_PVFS2_COMMON_H -#define _AD_PVFS2_COMMON_H +#ifndef AD_PVFS2_COMMON_H_INCLUDED +#define AD_PVFS2_COMMON_H_INCLUDED #include "ad_pvfs2.h" /* useful values: - * 0: no debugging + * 0: no debugging * CLIENT_DEBUG: debug client state machines */ #define ADIOI_PVFS2_DEBUG_MASK 0 @@ -24,12 +22,11 @@ struct ADIOI_PVFS2_fs_s { typedef struct ADIOI_PVFS2_fs_s ADIOI_PVFS2_fs; -void ADIOI_PVFS2_Init(int *error_code ); +void ADIOI_PVFS2_Init(int *error_code); void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs); void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials); void ADIOI_PVFS2_End(int *error_code); -int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, - void *attribute_val, void *extra_state); +int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); int ADIOI_PVFS2_error_convert(int pvfs_error); -#endif +#endif /* AD_PVFS2_COMMON_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_delete.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_delete.c new file mode 100644 index 0000000000000000000000000000000000000000..fff32069a7c036cbbc2e4e8abacda3c975a880de --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_delete.c @@ -0,0 +1,61 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" +#include "adio.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_Delete(const char *filename, int *error_code) +{ + PVFS_credentials credentials; + PVFS_sysresp_getparent resp_getparent; + int ret; + PVFS_fs_id cur_fs; + static char myname[] = "ADIOI_PVFS2_DELETE"; + char pvfs_path[PVFS_NAME_MAX] = { 0 }; + + ADIOI_PVFS2_Init(error_code); + /* --BEGIN ERROR HANDLING-- */ + if (*error_code != MPI_SUCCESS) { + /* ADIOI_PVFS2_INIT handles creating error codes itself */ + return; + } + /* --END ERROR HANDLING-- */ + + /* in most cases we'll store the credentials in the fs struct, but we don't + * have one of those in Delete */ + ADIOI_PVFS2_makecredentials(&credentials); + + /* given the filename, figure out which pvfs filesystem it is on */ + ret = PVFS_util_resolve(filename, &cur_fs, pvfs_path, PVFS_NAME_MAX); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_util_resolve", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_sys_getparent(cur_fs, pvfs_path, &credentials, &resp_getparent); + + ret = PVFS_sys_remove(resp_getparent.basename, resp_getparent.parent_ref, &credentials); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_remove", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; + return; +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_fcntl.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..af467bb958d96152390e7a15de2fd72c51ca7280 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_fcntl.c @@ -0,0 +1,50 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" +#include "adio_extern.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int ret; + ADIOI_PVFS2_fs *pvfs_fs; + PVFS_sysresp_getattr resp_getattr; + static char myname[] = "ADIOI_PVFS2_FCNTL"; + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + ret = PVFS_sys_getattr(pvfs_fs->object_ref, PVFS_ATTR_SYS_SIZE, + &(pvfs_fs->credentials), &resp_getattr); + if (ret != 0) { + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_getattr", 0); + /* --END ERROR HANDLING-- */ + } else { + *error_code = MPI_SUCCESS; + } + fcntl_struct->fsize = resp_getattr.attr.size; + return; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + /* --BEGIN ERROR HANDLING-- */ + case ADIO_FCNTL_SET_ATOMICITY: + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + /* --END ERROR HANDLING-- */ + } +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_features.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_features.c new file mode 100644 index 0000000000000000000000000000000000000000..43980a3d84e08e7a21b299f11f11c80639cf0031 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_features.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "ad_pvfs2.h" + +int ADIOI_PVFS2_Feature(ADIO_File fd, int flag) +{ + switch (flag) { + case ADIO_SCALABLE_OPEN: + case ADIO_SCALABLE_RESIZE: + return 1; + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_flush.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_flush.c similarity index 51% rename from 3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_flush.c rename to 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_flush.c index 18061084a8552ced323022f9792590e9bfe89be5..82f5f259b70a7120360bc232d853556766a56362 100644 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_flush.c +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_flush.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_pvfs2.h" @@ -12,44 +10,39 @@ * flush request, it will stress the PVFS2 servers with redundant * PVFS_sys_flush requests. Instead, one process should wait for * everyone to catch up, do the sync, then broadcast the result. We can - * get away with this thanks to PVFS2's stateless design + * get away with this thanks to PVFS2's stateless design */ -void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code) -{ - int ret, rank, dummy=0, dummy_in=0; +void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code) +{ + int ret, rank, dummy = 0, dummy_in = 0; ADIOI_PVFS2_fs *pvfs_fs; static char myname[] = "ADIOI_PVFS2_FLUSH"; *error_code = MPI_SUCCESS; - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; MPI_Comm_rank(fd->comm, &rank); /* unlike ADIOI_PVFS2_Resize, MPI_File_sync() does not perform any * syncronization */ - MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, - fd->hints->ranklist[0], fd->comm); + MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, fd->hints->ranklist[0], fd->comm); /* io_worker computed in ADIO_Open */ if (rank == fd->hints->ranklist[0]) { - ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials)); + ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials)); } MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); /* --BEGIN ERROR HANDLING-- */ if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_flush", 0); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_flush", 0); } /* --END ERROR HANDLING-- */ } - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_hints.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..a637f7636ddd655353672b6151b5299c0ec06e78 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_hints.c @@ -0,0 +1,117 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <stdlib.h> +#include "ad_pvfs2.h" + +#include "hint_fns.h" + +void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value; + int flag, tmp_value; + static char myname[] = "ADIOI_PVFS_SETINFO"; + + if ((fd->info) == MPI_INFO_NULL) { + /* part of the open call */ + MPI_Info_create(&(fd->info)); + ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", "0"); + fd->hints->fs_hints.pvfs2.debugmask = 0; + + ADIOI_Info_set(fd->info, "striping_factor", "0"); + fd->hints->striping_factor = 0; + + ADIOI_Info_set(fd->info, "striping_unit", "0"); + fd->hints->striping_unit = 0; + + /* disable the aggressive strided optimizations by default */ + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", "disable"); + fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE; + + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", "disable"); + fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE; + + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", "disable"); + fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE; + + + /* any user-provided hints? */ + if (users_info != MPI_INFO_NULL) { + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + /* pvfs2 debugging */ + ADIOI_Info_get(users_info, "romio_pvfs2_debugmask", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + tmp_value = fd->hints->fs_hints.pvfs2.debugmask = + PVFS_debug_eventlog_to_mask(value); + + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_value != fd->hints->fs_hints.pvfs2.debugmask) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, "romio_pvfs2_debugmask", error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", value); + } + + /* the striping factor */ + ADIOI_Info_check_and_install_int(fd, users_info, "striping_factor", + &(fd->hints->striping_factor), myname, error_code); + + + /* the striping unit */ + ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", + &(fd->hints->striping_unit), myname, error_code); + + /* distribution name */ + ADIOI_Info_get(users_info, "romio_pvfs2_distribution_name", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + } + + /* POSIX read */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_read", + &(fd->hints->fs_hints.pvfs2.posix_read), myname, + error_code); + + /* POSIX write */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_write", + &(fd->hints->fs_hints.pvfs2.posix_write), myname, + error_code); + + /* Datatype read */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_read", + &(fd->hints->fs_hints.pvfs2.dtype_read), myname, + error_code); + + /* Datatype write */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_write", + &(fd->hints->fs_hints.pvfs2.dtype_write), myname, + error_code); + + /* Listio read */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_read", + &(fd->hints->fs_hints.pvfs2.listio_read), myname, + error_code); + + /* Datatype write */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_write", + &(fd->hints->fs_hints.pvfs2.listio_write), myname, + error_code); + ADIOI_Free(value); + } + } + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io.h b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io.h new file mode 100644 index 0000000000000000000000000000000000000000..881912db48c01a6388cba5fe1b284b46176691c1 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_PVFS2_IO_H_INCLUDED +#define AD_PVFS2_IO_H_INCLUDED + +/* Contig I/O helper prototypes */ + +#define READ 0 +#define WRITE 1 + +/* #define DEBUG_CONTIG */ +/* #define DEBUG_LIST */ +/* #define DEBUG_DTYPE */ + +/* Contig I/O helper prototypes */ +int ADIOI_PVFS2_Contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code, int rw_type); + +/* List I/O helper prototypes */ +int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int *error_code, int rw_type); + +int gen_listio_arr(ADIOI_Flatlist_node * flat_buf, + int *flat_buf_index_p, + int64_t * cur_flat_buf_reg_off_p, + int flat_buf_size, + int flat_buf_extent, + ADIOI_Flatlist_node * flat_file, + int *flat_file_index_p, + int64_t * cur_flat_file_reg_off_p, + int flat_file_size, + int flat_file_extent, + int max_ol_count, + ADIO_Offset disp, + int bytes_into_filetype, + int64_t * bytes_completed, + int64_t total_io_size, + int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t * buf_ol_count_p, + int64_t file_off_arr[], int32_t file_len_arr[], int32_t * file_ol_count_p); + +void print_buf_file_ol_pairs(int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t buf_ol_count, + int64_t file_off_arr[], + int32_t file_len_arr[], int32_t file_ol_count, void *buf, int rw_type); + +/* Datatype I/O helper prototypes */ +int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int *error_code, int rw_type); + +int convert_named(MPI_Datatype * mpi_dtype, PVFS_Request * pvfs_dtype, int combiner); + +void print_dtype_info(int combiner, + int num_int, + int num_addr, + int num_dtype, int *arr_int, MPI_Aint * arr_addr, MPI_Datatype * arr_dtype); + +int convert_mpi_pvfs2_dtype(MPI_Datatype * mpi_dtype, PVFS_Request * pvfs_dtype); + +#endif /* AD_PVFS2_IO_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_dtype.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_dtype.c new file mode 100644 index 0000000000000000000000000000000000000000..491af6d3858237f34147eee8ee40f3deec4ab7a3 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_dtype.c @@ -0,0 +1,583 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include <assert.h> +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code, int rw_type) +{ + int ret = -1, filetype_is_contig = -1; + MPI_Count filetype_size = -1; + int num_filetypes = 0, cur_flat_file_reg_off = 0; + PVFS_Request tmp_mem_req, mem_req, tmp_file_req, file_req; + PVFS_sysresp_io resp_io; + ADIO_Offset off = -1, bytes_into_filetype = 0; + MPI_Aint lb, filetype_extent = -1; + int i = -1; + MPI_Count etype_size; + PVFS_size pvfs_disp = -1; + ADIOI_Flatlist_node *flat_file_p; + + /* Use for offseting the PVFS2 filetype */ + int pvfs_blk = 1; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_STRIDED_DTYPE"; + + memset(&tmp_mem_req, 0, sizeof(PVFS_Request)); + memset(&mem_req, 0, sizeof(PVFS_Request)); + memset(&tmp_file_req, 0, sizeof(PVFS_Request)); + memset(&file_req, 0, sizeof(PVFS_Request)); + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* changed below if error */ + *error_code = MPI_SUCCESS; + + /* datatype is the memory type + * fd->filetype is the file type */ + MPI_Type_size_x(fd->filetype, &filetype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(fd->etype, &etype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + + /* offset is in units of etype relative to the filetype. We + * convert this to off in terms of actual data bytes (the offset + * minus the number of bytes that are not used). We are allowed + * to do this since PVFS2 handles offsets with respect to a + * file_req in bytes, otherwise we would have to convert into a + * pure byte offset as is done in other methods. Explicit offset + * case is handled by using fd->disp and byte-converted off. */ + + pvfs_disp = fd->disp; + if (file_ptr_type == ADIO_INDIVIDUAL) { + if (filetype_is_contig) { + off = fd->fp_ind - fd->disp; + } else { + int flag = 0; + flat_file_p = ADIOI_Flatten_and_find(fd->filetype); + num_filetypes = -1; + while (!flag) { + num_filetypes++; + for (i = 0; i < flat_file_p->count; i++) { + /* Start on a non zero-length region */ + if (flat_file_p->blocklens[i]) { + if (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent) + + flat_file_p->blocklens[i] > fd->fp_ind && + fd->disp + flat_file_p->indices[i] <= fd->fp_ind) { + cur_flat_file_reg_off = fd->fp_ind - + (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent)); + flag = 1; + break; + } else + bytes_into_filetype += flat_file_p->blocklens[i]; + } + } + } + /* Impossible that we don't find it in this datatype */ + assert(i != flat_file_p->count); + off = bytes_into_filetype + cur_flat_file_reg_off; + } + } else { /* ADIO_EXPLICIT */ + + off = etype_size * offset; + } + +#ifdef DEBUG_DTYPE + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: (fd->fp_ind=%Ld,fd->disp=%Ld," + " offset=%Ld),(pvfs_disp=%Ld,off=%Ld)\n", fd->fp_ind, fd->disp, offset, pvfs_disp, off); +#endif + + + /* Convert the MPI memory and file datatypes into + * PVFS2 datatypes */ + ret = convert_mpi_pvfs2_dtype(&datatype, &tmp_mem_req); + if (ret < 0) { + goto error_state; + } + ret = convert_mpi_pvfs2_dtype(&(fd->filetype), &tmp_file_req); + if (ret < 0) { + goto error_state; + } + + ret = PVFS_Request_contiguous(count, tmp_mem_req, &mem_req); + if (ret != 0) /* TODO: convert this to MPIO error handling */ + fprintf(stderr, "ADIOI_PVFS2_stridedDtypeIO: error in final" " CONTIG memory type\n"); + PVFS_Request_free(&tmp_mem_req); + + /* pvfs_disp is used to offset the filetype */ + ret = PVFS_Request_hindexed(1, &pvfs_blk, &pvfs_disp, tmp_file_req, &file_req); + if (ret != 0) + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: error in final" " HINDEXED file type\n"); + PVFS_Request_free(&tmp_file_req); + + if (rw_type == READ) + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, off, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); + else + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, off, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); + + if (ret != 0) { + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: Warning - PVFS_sys_" + "read/write returned %d and completed %Ld bytes.\n", + ret, (long long) resp_io.total_completed); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_io \n", 0); + goto error_state; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind = off += resp_io.total_completed; + } + + error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + +#ifdef DEBUG_DTYPE + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: " + "resp_io.total_completed=%Ld,ret=%d\n", resp_io.total_completed, ret); +#endif + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually acccessed by + * ADIOI_BUFFERED operations */ +#endif + return ret; +} + +/* convert_mpi_pvfs2_dtype - Convert a MPI datatype into + * a PVFS2 datatype so that we can natively use the PVFS2 + * datatypes in the PVFS2 I/O calls instead of converting + * all datatypes to the hindexed method + * return 1 - a leaf node + * return 0 - normal return + * return -1 - problems */ + +int convert_mpi_pvfs2_dtype(MPI_Datatype * mpi_dtype, PVFS_Request * pvfs_dtype) +{ + int num_int = -1, num_addr = -1, num_dtype = -1, combiner = -1, i = -1, ret = -1, leaf = -1; + int *arr_int = NULL; + MPI_Aint *arr_addr = NULL; + MPI_Datatype *arr_dtype = NULL; + PVFS_Request *old_pvfs_dtype = NULL; + PVFS_Request *old_pvfs_dtype_arr = NULL; + int arr_count = -1; + PVFS_size *pvfs_arr_disp = NULL; + int *pvfs_arr_len = NULL; + + MPI_Type_get_envelope(*mpi_dtype, &num_int, &num_addr, &num_dtype, &combiner); + + /* Depending on type of datatype do the following + * operations */ + + if (combiner == MPI_COMBINER_NAMED) { + convert_named(mpi_dtype, pvfs_dtype, combiner); + return 1; + } + + /* Allocate space for the arrays necessary for + * MPI_Type_get_contents */ + + if ((arr_int = ADIOI_Malloc(sizeof(int) * num_int)) == NULL) { + fprintf(stderr, "Failed to allocate array_int\n"); + return -1; + } + if ((arr_addr = ADIOI_Malloc(sizeof(int) * num_addr)) == NULL) { + ADIOI_Free(arr_int); + fprintf(stderr, "Failed to allocate array_addr\n"); + return -1; + } + if ((arr_dtype = ADIOI_Malloc(sizeof(MPI_Datatype) * num_dtype)) == NULL) { + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + fprintf(stderr, "Failed to allocate array_dtypes\n"); + return -1; + } + + MPI_Type_get_contents(*mpi_dtype, num_int, num_addr, num_dtype, arr_int, arr_addr, arr_dtype); + + /* If it's not a predefined datatype, it is either a + * derived datatype or a structured datatype */ + + if (combiner != MPI_COMBINER_STRUCT) { + if ((old_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "Failed to allocate PVFS_Request\n"); + switch (combiner) { + case MPI_COMBINER_CONTIGUOUS: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_contiguous(arr_int[0], *old_pvfs_dtype, pvfs_dtype); + break; + case MPI_COMBINER_VECTOR: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_vector(arr_int[0], arr_int[1], + arr_int[2], *old_pvfs_dtype, pvfs_dtype); + break; + case MPI_COMBINER_HVECTOR: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_hvector(arr_int[0], arr_int[1], + arr_addr[0], *old_pvfs_dtype, pvfs_dtype); + break; + /* Both INDEXED and HINDEXED types require PVFS_size + * address arrays. Therefore, we need to copy and + * convert the data from MPI_get_contents() into + * a PVFS_size buffer */ + case MPI_COMBINER_INDEXED: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + if ((pvfs_arr_disp = ADIOI_Malloc(arr_int[0] * sizeof(PVFS_size))) == 0) { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_disp\n"); + } + for (i = 0; i < arr_int[0]; i++) { + pvfs_arr_disp[i] = (PVFS_size) arr_int[arr_int[0] + 1 + i]; + } + ret = PVFS_Request_indexed(arr_int[0], &arr_int[1], + pvfs_arr_disp, *old_pvfs_dtype, pvfs_dtype); + ADIOI_Free(pvfs_arr_disp); + break; + case MPI_COMBINER_HINDEXED: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + if ((pvfs_arr_disp = ADIOI_Malloc(arr_int[0] * sizeof(PVFS_size))) == 0) { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_disp\n"); + } + for (i = 0; i < arr_int[0]; i++) { + pvfs_arr_disp[i] = (PVFS_size) arr_addr[i]; + } + ret = PVFS_Request_hindexed(arr_int[0], &arr_int[1], + (int64_t *) & arr_addr[0], *old_pvfs_dtype, pvfs_dtype); + ADIOI_Free(pvfs_arr_disp); + break; + case MPI_COMBINER_DUP: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_contiguous(1, *old_pvfs_dtype, pvfs_dtype); + + break; + case MPI_COMBINER_INDEXED_BLOCK: + /* No native PVFS2 support for this operation currently */ + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "INDEXED_BLOCK is unsupported\n"); + break; + case MPI_COMBINER_HINDEXED_BLOCK: + /* No native PVFS2 support for this operation currently */ + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "HINDEXED_BLOCK is unsupported\n"); + break; + case MPI_COMBINER_HINDEXED_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "HINDEXED_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_STRUCT_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "STRUCT_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_SUBARRAY: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "SUBARRAY is unsupported\n"); + break; + case MPI_COMBINER_DARRAY: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "DARRAY is unsupported\n"); + break; + case MPI_COMBINER_F90_REAL: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "F90_REAL is unsupported\n"); + break; + case MPI_COMBINER_F90_COMPLEX: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "F90_COMPLEX is unsupported\n"); + break; + case MPI_COMBINER_F90_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "F90_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_RESIZED: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "RESIZED is unsupported\n"); + break; + default: + break; + } + + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_* " "for a derived datatype\n"); + +#ifdef DEBUG_DTYPE + print_dtype_info(combiner, num_int, num_addr, num_dtype, arr_int, arr_addr, arr_dtype); +#endif + + if (leaf != 1 && combiner != MPI_COMBINER_DUP) + MPI_Type_free(&arr_dtype[0]); + + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + ADIOI_Free(arr_dtype); + + PVFS_Request_free(old_pvfs_dtype); + ADIOI_Free(old_pvfs_dtype); + + return ret; + } else { /* MPI_COMBINER_STRUCT */ + + MPI_Aint mpi_lb = -1, mpi_extent = -1; + PVFS_offset pvfs_lb = -1; + PVFS_size pvfs_extent = -1; + int has_lb_ub = 0; + + /* When converting into a PVFS_Request_struct, we no longer + * can use MPI_LB and MPI_UB. Therfore, we have to do the + * following. + * We simply ignore all the MPI_LB and MPI_UB types and + * get the lb and extent and pass it on through a + * PVFS resized_req */ + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) { + if (arr_dtype[i] != MPI_LB && arr_dtype[i] != MPI_UB) { + arr_count++; + } + } + + if (arr_int[0] != arr_count) { + MPI_Type_get_extent(*mpi_dtype, &mpi_lb, &mpi_extent); + pvfs_lb = mpi_lb; + pvfs_extent = mpi_extent; + if ((pvfs_arr_len = ADIOI_Malloc(arr_count * sizeof(int))) + == NULL) { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "Failed to allocate pvfs_arr_len\n"); + } + has_lb_ub = 1; + } + + if ((old_pvfs_dtype_arr = ADIOI_Malloc(arr_count * sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "Failed to allocate PVFS_Requests\n"); + + if ((pvfs_arr_disp = ADIOI_Malloc(arr_count * sizeof(PVFS_size))) + == NULL) { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "Failed to allocate pvfs_arr_disp\n"); + } + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) { + if (arr_dtype[i] != MPI_LB && arr_dtype[i] != MPI_UB) { + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[i], &old_pvfs_dtype_arr[arr_count]); + if (leaf != 1) + MPI_Type_free(&arr_dtype[i]); + pvfs_arr_disp[arr_count] = (PVFS_size) arr_addr[i]; + if (has_lb_ub) { + pvfs_arr_len[arr_count] = arr_int[i + 1]; + } + arr_count++; + } + } + + /* If a MPI_UB or MPI_LB did exist, we have to + * resize the datatype */ + if (has_lb_ub) { + PVFS_Request *tmp_pvfs_dtype = NULL; + if ((tmp_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " "Failed to allocate PVFS_Request\n"); + + ret = PVFS_Request_struct(arr_count, pvfs_arr_len, + pvfs_arr_disp, old_pvfs_dtype_arr, tmp_pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_struct\n"); + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) { + if (arr_dtype[i] != MPI_LB && arr_dtype[i] != MPI_UB) { + PVFS_Request_free(&old_pvfs_dtype_arr[arr_count]); + arr_count++; + } + } + +#ifdef DEBUG_DTYPE + fprintf(stderr, "STRUCT(WITHOUT %d LB or UB)(%d,[", arr_int[0] - arr_count, arr_count); + for (i = 0; i < arr_count; i++) + fprintf(stderr, "(%d,%Ld) ", pvfs_arr_len[i], pvfs_arr_disp[i]); + fprintf(stderr, "]\n"); + fprintf(stderr, "RESIZED(LB = %Ld, EXTENT = %Ld)\n", pvfs_lb, pvfs_extent); +#endif + ret = PVFS_Request_resized(*tmp_pvfs_dtype, pvfs_lb, pvfs_extent, pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_resize\n"); + + PVFS_Request_free(tmp_pvfs_dtype); + ADIOI_Free(tmp_pvfs_dtype); + } else { /* No MPI_LB or MPI_UB datatypes */ + + ret = PVFS_Request_struct(arr_int[0], &arr_int[1], + pvfs_arr_disp, old_pvfs_dtype_arr, pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_struct\n"); + + for (i = 0; i < arr_int[0]; i++) { + if (arr_dtype[i] != MPI_LB && arr_dtype[i] != MPI_UB) + PVFS_Request_free(&old_pvfs_dtype_arr[i]); + } + +#ifdef DEBUG_DTYPE + print_dtype_info(combiner, num_int, num_addr, num_dtype, arr_int, arr_addr, arr_dtype); +#endif + } + + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + ADIOI_Free(arr_dtype); + + ADIOI_Free(old_pvfs_dtype_arr); + ADIOI_Free(pvfs_arr_disp); + ADIOI_Free(pvfs_arr_len); + + return ret; + } + + /* Shouldn't have gotten here */ + fprintf(stderr, "convert_mpi_pvfs2_dtype: SERIOUS ERROR\n"); + return -1; +} + +int convert_named(MPI_Datatype * mpi_dtype, PVFS_Request * pvfs_dtype, int combiner) +{ + int ret = -1; +#ifdef DEBUG_DTYPE + fprintf(stderr, "NAMED"); +#endif + + if (MPI_CHAR == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_CHAR, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_CHAR\n"); +#endif + } else if (MPI_BYTE == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_BYTE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_BYTE\n"); +#endif + } else if (MPI_SHORT == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_SHORT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_SHORT\n"); +#endif + } else if (MPI_INT == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_INT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_INT\n"); +#endif + } else if (MPI_LONG == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_LONG, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_LONG\n"); +#endif + } else if (MPI_FLOAT == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_FLOAT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_FLOAT\n"); +#endif + } else if (MPI_DOUBLE == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_DOUBLE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_DOUBLE\n"); +#endif + } else if (MPI_UNSIGNED_CHAR == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_CHAR, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_CHAR\n"); +#endif + } else if (MPI_UNSIGNED_SHORT == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_SHORT\n"); +#endif + } else if (MPI_UNSIGNED == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_SHORT\n"); +#endif + } else if (MPI_UNSIGNED_LONG == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_LONG, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_LONG\n"); +#endif + } else if (MPI_LONG_DOUBLE == *mpi_dtype) { + ret = PVFS_Request_contiguous(1, PVFS_LONG_DOUBLE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_LONG_DOUBLE\n"); +#endif + } else { + fprintf(stderr, "convert_named: predefined type not found"); + return -1; + } + if (ret != 0) + fprintf(stderr, "convert_named: Datatype creation failed\n"); + return ret; +} + +void print_dtype_info(int combiner, + int num_int, + int num_addr, + int num_dtype, int *arr_int, MPI_Aint * arr_addr, MPI_Datatype * arr_dtype) +{ + int i = -1; + switch (combiner) { + case MPI_COMBINER_CONTIGUOUS: + fprintf(stderr, "CONTIG(%d)\n", arr_int[0]); + break; + case MPI_COMBINER_VECTOR: + fprintf(stderr, "VECTOR(%d,%d,%d)\n", arr_int[0], arr_int[1], arr_int[2]); + break; + case MPI_COMBINER_HVECTOR: + fprintf(stderr, "HVECTOR(%d,%d,%ld)\n", arr_int[0], arr_int[1], arr_addr[0]); + break; + case MPI_COMBINER_INDEXED: + fprintf(stderr, "INDEXED(%d,[", arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%d) ", arr_int[1 + i], arr_int[arr_int[0] + 1 + i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_HINDEXED: + fprintf(stderr, "HINDEXED(%d,[", arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%lld) ", arr_int[1 + i], (long long) arr_addr[i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_STRUCT: + fprintf(stderr, "STRUCT(%d,[", arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%lld) ", arr_int[1 + i], (long long) arr_addr[i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_DUP: + fprintf(stderr, "DUP\n"); + break; + default: + fprintf(stderr, "no available information on this datatype"); + } +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_list.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_list.c new file mode 100644 index 0000000000000000000000000000000000000000..8030f2a917406622376f7012cb523a96b89e8dca --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_io_list.c @@ -0,0 +1,547 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include <assert.h> +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +#define COALESCE_REGIONS /* TODO: would we ever want to *not* coalesce? */ +#define MAX_OL_COUNT 64 +int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int *error_code, int rw_type) +{ + /* list I/O parameters */ + int i = -1, ret = -1; + int tmp_filetype_size = -1; + int64_t cur_io_size = 0, io_size = 0; + int etype_size = -1; + int num_etypes_in_filetype = -1, num_filetypes = -1; + int etypes_in_filetype = -1, size_in_filetype = -1; + int bytes_into_filetype = 0; + MPI_Offset total_bytes_accessed = 0; + + /* parameters for offset-length pairs arrays */ + int64_t buf_off_arr[MAX_OL_COUNT]; + int32_t buf_len_arr[MAX_OL_COUNT]; + int64_t file_off_arr[MAX_OL_COUNT]; + int32_t file_len_arr[MAX_OL_COUNT]; + int32_t buf_ol_count = 0; + int32_t file_ol_count = 0; + + /* parameters for flattened memory and file datatypes */ + int flat_buf_index = 0; + int flat_file_index = 0; + int64_t cur_flat_buf_reg_off = 0; + int64_t cur_flat_file_reg_off = 0; + ADIOI_Flatlist_node *flat_buf_p, *flat_file_p; + MPI_Count buftype_size = -1, filetype_size = -1; + MPI_Aint lb, filetype_extent = -1, buftype_extent = -1;; + int buftype_is_contig = -1, filetype_is_contig = -1; + + /* PVFS2 specific parameters */ + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs *pvfs_fs; + PVFS_sysresp_io resp_io; + static char myname[] = "ADIOI_PVFS2_STRIDED_LISTIO"; + + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "Atomic noncontiguous writes" + " are not supported by PVFS2", 0); + return -1; + } + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + io_size = buftype_size * count; + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + /* Flatten the memory datatype + * (file datatype has already been flattened in ADIO open + * unless it is contibuous, then we need to flatten it manually) + * and set the correct buffers for flat_buf and flat_file */ + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (buftype_is_contig == 0) { + flat_buf_p = ADIOI_Flatten_and_find(datatype); + } else { + /* flatten and add to the list */ + flat_buf_p = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); + flat_buf_p->blocklens = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_buf_p->indices = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + /* For the buffer, we can optimize the buftype, this is not + * possible with the filetype since it is tiled */ + buftype_size = buftype_size * count; + buftype_extent = buftype_size * count; + flat_buf_p->blocklens[0] = buftype_size; + flat_buf_p->indices[0] = 0; + flat_buf_p->count = 1; + } + if (filetype_is_contig == 0) { + /* TODO: why does avery say this should already have been + * flattened in Open, but also says contig types don't get + * flattened */ + flat_file_p = ADIOI_Flatten_and_find(fd->filetype); + } else { + /* flatten and add to the list */ + flat_file_p = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); + flat_file_p->blocklens = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_file_p->indices = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_file_p->blocklens[0] = filetype_size; + flat_file_p->indices[0] = 0; + flat_file_p->count = 1; + } + + /* Find out where we are in the flattened filetype (the block index, + * how far into the block, and how many bytes_into_filetype) + * If the file_ptr_type == ADIO_INDIVIDUAL we will use disp, fp_ind + * to figure this out (offset should always be zero) + * If file_ptr_type == ADIO_EXPLICIT, we will use disp and offset + * to figure this out. */ + + etype_size = fd->etype_size; + num_etypes_in_filetype = filetype_size / etype_size; + if (file_ptr_type == ADIO_INDIVIDUAL) { + int flag = 0; + /* Should have already been flattened in ADIO_Open */ + num_filetypes = -1; + while (!flag) { + num_filetypes++; + for (i = 0; i < flat_file_p->count; i++) { + /* Start on a non zero-length region */ + if (flat_file_p->blocklens[i]) { + if (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent) + + flat_file_p->blocklens[i] > fd->fp_ind && + fd->disp + flat_file_p->indices[i] <= fd->fp_ind) { + flat_file_index = i; + cur_flat_file_reg_off = fd->fp_ind - + (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent)); + flag = 1; + break; + } else + bytes_into_filetype += flat_file_p->blocklens[i]; + } + } + } + /* Impossible that we don't find it in this datatype */ + assert(i != flat_file_p->count); + } else { + num_filetypes = (int) (offset / num_etypes_in_filetype); + etypes_in_filetype = (int) (offset % num_etypes_in_filetype); + size_in_filetype = etypes_in_filetype * etype_size; + + tmp_filetype_size = 0; + for (i = 0; i < flat_file_p->count; i++) { + tmp_filetype_size += flat_file_p->blocklens[i]; + if (tmp_filetype_size > size_in_filetype) { + flat_file_index = i; + cur_flat_file_reg_off = flat_file_p->blocklens[i] - + (tmp_filetype_size - size_in_filetype); + bytes_into_filetype = offset * filetype_size - flat_file_p->blocklens[i]; + break; + } + } + } +#ifdef DEBUG_LIST + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: (fd->fp_ind=%Ld,fd->disp=%Ld," + " offset=%Ld)\n(flat_file_index=%d,cur_flat_file_reg_off=%Ld," + "bytes_into_filetype=%d)\n", + fd->fp_ind, fd->disp, offset, flat_file_index, + cur_flat_file_reg_off, bytes_into_filetype); +#endif +#ifdef DEBUG_LIST2 + fprintf(stderr, "flat_buf:\n"); + for (i = 0; i < flat_buf_p->count; i++) + fprintf(stderr, "(offset, length) = (%Ld, %d)\n", + flat_buf_p->indices[i], flat_buf_p->blocklens[i]); + fprintf(stderr, "flat_file:\n"); + for (i = 0; i < flat_file_p->count; i++) + fprintf(stderr, "(offset, length) = (%Ld, %d)\n", + flat_file_p->indices[i], flat_file_p->blocklens[i]); +#endif + + /* total data written */ + cur_io_size = 0; + while (cur_io_size != io_size) { + /* Initialize the temporarily unrolling lists and + * and associated variables */ + buf_ol_count = 0; + file_ol_count = 0; + for (i = 0; i < MAX_OL_COUNT; i++) { + buf_off_arr[i] = 0; + buf_len_arr[i] = 0; + file_off_arr[i] = 0; + file_len_arr[i] = 0; + } + + /* Generate the offset-length pairs for a + * list I/O operation */ + gen_listio_arr(flat_buf_p, + &flat_buf_index, + &cur_flat_buf_reg_off, + buftype_size, + buftype_extent, + flat_file_p, + &flat_file_index, + &cur_flat_file_reg_off, + filetype_size, + filetype_extent, + MAX_OL_COUNT, + fd->disp, + bytes_into_filetype, + &cur_io_size, + io_size, + buf_off_arr, + buf_len_arr, &buf_ol_count, file_off_arr, file_len_arr, &file_ol_count); + + assert(buf_ol_count <= MAX_OL_COUNT); + assert(file_ol_count <= MAX_OL_COUNT); +#ifdef DEBUG_LIST2 + print_buf_file_ol_pairs(buf_off_arr, + buf_len_arr, + buf_ol_count, + file_off_arr, file_len_arr, file_ol_count, buf, rw_type); +#endif +#ifdef DEBUG_LIST2 + do { + int y, z; + fprintf(stderr, "ad_pvfs2_io_list.c::\n"); + for (y = 0; y < buf_ol_count; y++) { + for (z = 0; z < buf_len_arr[y]; z++) { + fprintf(stderr, "buf[%d][%d]=%c\n", y, z, ((char *) buf + buf_off_arr[y])[z]); + } + } + } while (0); +#endif + + /* Run list I/O operation */ + ret = PVFS_Request_hindexed(buf_ol_count, buf_len_arr, buf_off_arr, PVFS_BYTE, &mem_req); + + ret = PVFS_Request_hindexed(file_ol_count, file_len_arr, + file_off_arr, PVFS_BYTE, &file_req); + if (rw_type == READ) { + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, + buf, mem_req, &(pvfs_fs->credentials), &resp_io); + } else { + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, + buf, mem_req, &(pvfs_fs->credentials), &resp_io); + } + if (ret != 0) { + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: Warning - PVFS_sys_" + "read/write returned %d and completed %lld bytes.\n", + ret, (long long) resp_io.total_completed); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_io \n", 0); + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + goto error_state; + } + total_bytes_accessed += resp_io.total_completed; + + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + +#ifdef DEBUG_LIST + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: " + "total_bytes_accessed=%Ld,ret=%d\n", total_bytes_accessed, ret); +#endif + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_accessed; + *error_code = MPI_SUCCESS; + + error_state: +#ifdef HAVE_STATUS_SET_BYTES + /* TODO: why the cast? */ + MPIR_Status_set_bytes(status, datatype, total_bytes_accessed); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + if (buftype_is_contig != 0) { + ADIOI_Free(flat_buf_p->blocklens); + ADIOI_Free(flat_buf_p->indices); + ADIOI_Free(flat_buf_p); + } + + if (filetype_is_contig != 0) { + ADIOI_Free(flat_file_p->blocklens); + ADIOI_Free(flat_file_p->indices); + ADIOI_Free(flat_file_p); + } + + return 0; +} + +/* To do: Fix the code to coalesce the offset-length pairs for memory + * and file. */ + +/* gen_listio_arr - fills in offset-length pairs for memory and file + * for list I/O */ +int gen_listio_arr(ADIOI_Flatlist_node * flat_buf_p, + int *flat_buf_index_p, + int64_t * cur_flat_buf_reg_off_p, + int flat_buf_size, + int flat_buf_extent, + ADIOI_Flatlist_node * flat_file_p, + int *flat_file_index_p, + int64_t * cur_flat_file_reg_off_p, + int flat_file_size, + int flat_file_extent, + int max_ol_count, + ADIO_Offset disp, + int bytes_into_filetype, + int64_t * bytes_completed, + int64_t total_io_size, + int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t * buf_ol_count_p, + int64_t file_off_arr[], int32_t file_len_arr[], int32_t * file_ol_count_p) +{ + int region_size = -1; + + /* parameters for flattened memory and file datatypes */ + int64_t cur_flat_buf_reg_left = 0; + int64_t cur_flat_file_reg_left = 0; + +#ifdef DEBUG_LIST2 + fprintf(stderr, "gen_list_arr:\n"); +#endif + + if ((*buf_ol_count_p) != 0 || (*file_ol_count_p) != 0) { + fprintf(stderr, "buf_ol_count != 0 || file_ol_count != 0\n"); + return -1; + } + + /* Start on a non-zero memory and file region + * Note this does not affect the bytes_completed + * since no data is in these regions. Initialize the + * first memory and file offsets. */ + while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) { + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % flat_buf_p->count; + } + buf_off_arr[*buf_ol_count_p] = + (*bytes_completed / flat_buf_size) * + flat_buf_extent + flat_buf_p->indices[*flat_buf_index_p] + *cur_flat_buf_reg_off_p; + buf_len_arr[*buf_ol_count_p] = 0; + + while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) { + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % flat_file_p->count; + } + file_off_arr[*file_ol_count_p] = disp + + (((bytes_into_filetype + *bytes_completed) / flat_file_size) * + flat_file_extent) + flat_file_p->indices[*flat_file_index_p] + *cur_flat_file_reg_off_p; + file_len_arr[*file_ol_count_p] = 0; + +#ifdef DEBUG_LIST2 + fprintf(stderr, "initial buf_off_arr[%d] = %Ld\n", *buf_ol_count_p, + buf_off_arr[*buf_ol_count_p]); + fprintf(stderr, "initial file_off_arr[%d] = %Ld\n", *file_ol_count_p, + file_off_arr[*file_ol_count_p]); +#endif + + while (*bytes_completed != total_io_size + && (*buf_ol_count_p) < max_ol_count && (*file_ol_count_p) < max_ol_count) { + /* How much data is left in the current piece in + * the flattened datatypes */ + cur_flat_buf_reg_left = flat_buf_p->blocklens[*flat_buf_index_p] + - *cur_flat_buf_reg_off_p; + cur_flat_file_reg_left = flat_file_p->blocklens[*flat_file_index_p] + - *cur_flat_file_reg_off_p; + +#ifdef DEBUG_LIST2 + fprintf(stderr, + "flat_buf_index=%d flat_buf->blocklens[%d]=%d\n" + "cur_flat_buf_reg_left=%Ld " + "*cur_flat_buf_reg_off_p=%Ld\n" + "flat_file_index=%d flat_file->blocklens[%d]=%d\n" + "cur_flat_file_reg_left=%Ld " + "*cur_flat_file_reg_off_p=%Ld\n" + "bytes_completed=%Ld\n" + "buf_ol_count=%d file_ol_count=%d\n" + "buf_len_arr[%d]=%d file_len_arr[%d]=%d\n\n", + *flat_buf_index_p, *flat_buf_index_p, + flat_buf_p->blocklens[*flat_buf_index_p], + cur_flat_buf_reg_left, + *cur_flat_buf_reg_off_p, + *flat_file_index_p, *flat_file_index_p, + flat_file_p->blocklens[*flat_file_index_p], + cur_flat_file_reg_left, + *cur_flat_file_reg_off_p, + *bytes_completed, + *buf_ol_count_p, *file_ol_count_p, + *buf_ol_count_p, + buf_len_arr[*buf_ol_count_p], *file_ol_count_p, file_len_arr[*file_ol_count_p]); +#endif + + /* What is the size of the next contiguous region agreed + * upon by both memory and file regions that does not + * surpass the file size */ + if (cur_flat_buf_reg_left > cur_flat_file_reg_left) + region_size = cur_flat_file_reg_left; + else + region_size = cur_flat_buf_reg_left; + + if (region_size > total_io_size - *bytes_completed) + region_size = total_io_size - *bytes_completed; + + /* Add this piece to both the mem and file arrays + * coalescing offset-length pairs if possible and advance + * the pointers through the flatten mem and file datatypes + * as well Note: no more than a single piece can be done + * since we take the smallest one possible */ + + if (cur_flat_buf_reg_left == region_size) { +#ifdef DEBUG_LIST2 + fprintf(stderr, "reached end of memory block...\n"); +#endif + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % flat_buf_p->count; + while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) { + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % flat_buf_p->count; + } + *cur_flat_buf_reg_off_p = 0; + +#ifdef COALESCE_REGIONS + if (*buf_ol_count_p != 0) { + if (buf_off_arr[(*buf_ol_count_p) - 1] + + buf_len_arr[(*buf_ol_count_p) - 1] == buf_off_arr[*buf_ol_count_p]) { + buf_len_arr[(*buf_ol_count_p) - 1] += region_size; + } else { + buf_len_arr[*buf_ol_count_p] += region_size; + (*buf_ol_count_p)++; + } + } else { +#endif + buf_len_arr[*buf_ol_count_p] += region_size; + (*buf_ol_count_p)++; +#ifdef COALESCE_REGIONS + } +#endif + + /* Don't prepare for the next piece if we have reached + * the limit or else it will segment fault. */ + if ((*buf_ol_count_p) != max_ol_count) { + buf_off_arr[*buf_ol_count_p] = + ((*bytes_completed + region_size) / flat_buf_size) * + flat_buf_extent + + flat_buf_p->indices[*flat_buf_index_p] + (*cur_flat_buf_reg_off_p); + buf_len_arr[*buf_ol_count_p] = 0; + } + } else if (cur_flat_buf_reg_left > region_size) { +#ifdef DEBUG_LIST2 + fprintf(stderr, "advanced %d in memory block...\n", region_size); +#endif + (*cur_flat_buf_reg_off_p) += region_size; + buf_len_arr[*buf_ol_count_p] += region_size; + } else { + fprintf(stderr, "gen_listio_arr: Error\n"); + } + + /* To calculate the absolute file offset we need to + * add the disp, how many filetypes we have gone through, + * the relative block offset in the filetype and how far + * into the block we have gone. */ + if (cur_flat_file_reg_left == region_size) { +#ifdef DEBUG_LIST2 + fprintf(stderr, "reached end of file block...\n"); +#endif + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % flat_file_p->count; + while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) { + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % flat_file_p->count; + } + (*cur_flat_file_reg_off_p) = 0; + +#ifdef COALESCE_REGIONS + if (*file_ol_count_p != 0) { + if (file_off_arr[(*file_ol_count_p) - 1] + + file_len_arr[(*file_ol_count_p) - 1] == file_off_arr[*file_ol_count_p]) { + file_len_arr[(*file_ol_count_p) - 1] += region_size; + } else { + file_len_arr[*file_ol_count_p] += region_size; + (*file_ol_count_p)++; + } + } else { +#endif + file_len_arr[*file_ol_count_p] += region_size; + (*file_ol_count_p)++; +#ifdef COALESCE_REGIONS + } +#endif + + /* Don't prepare for the next piece if we have reached + * the limit or else it will segment fault. */ + if ((*file_ol_count_p) != max_ol_count) { + file_off_arr[*file_ol_count_p] = disp + + (((bytes_into_filetype + *bytes_completed + region_size) + / flat_file_size) * + flat_file_extent) + + flat_file_p->indices[*flat_file_index_p] + (*cur_flat_file_reg_off_p); + file_len_arr[*file_ol_count_p] = 0; + } + } else if (cur_flat_file_reg_left > region_size) { +#ifdef DEBUG_LIST2 + fprintf(stderr, "advanced %d in file block...\n", region_size); +#endif + (*cur_flat_file_reg_off_p) += region_size; + file_len_arr[*file_ol_count_p] += region_size; + } else { + fprintf(stderr, "gen_listio_arr: Error\n"); + } +#ifdef DEBUG_LIST2 + fprintf(stderr, "------------------------------\n\n"); +#endif + *bytes_completed += region_size; + } + /* Increment the count if we stopped in the middle of a + * memory or file region */ + if (*cur_flat_buf_reg_off_p != 0) + (*buf_ol_count_p)++; + if (*cur_flat_file_reg_off_p != 0) + (*file_ol_count_p)++; + + return 0; +} + +void print_buf_file_ol_pairs(int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t buf_ol_count, + int64_t file_off_arr[], + int32_t file_len_arr[], int32_t file_ol_count, void *buf, int rw_type) +{ + int i = -1; + + fprintf(stderr, "buf_ol_pairs(offset,length) count = %d\n", buf_ol_count); + for (i = 0; i < buf_ol_count; i++) { + fprintf(stderr, "(%lld, %d) ", (long long) buf_off_arr[i], buf_len_arr[i]); + } + fprintf(stderr, "\n"); + + fprintf(stderr, "file_ol_pairs(offset,length) count = %d\n", file_ol_count); + for (i = 0; i < file_ol_count; i++) { + fprintf(stderr, "(%lld, %d) ", (long long) file_off_arr[i], file_len_arr[i]); + } + fprintf(stderr, "\n\n"); + +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_open.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_open.c new file mode 100644 index 0000000000000000000000000000000000000000..ea80f6b56586a007772e979a8200c42e82576f11 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_open.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" + +/* open_status is helpful for bcasting values around */ +struct open_status_s { + int error; + PVFS_object_ref object_ref; +}; +typedef struct open_status_s open_status; + + /* steps for getting a handle: (it gets a little convoluted, but at least + * it's deterministic) + * . lookup the file. + * . if lookup succeeds, but we were passed MPI_MODE_EXCL, that's an error + * . if lookup fails, the file might not exist. + * in that case, create the file if we were passed MPI_MODE_CREATE + * . if the create fails, that means someone else created the file between + * our call to lookup and our call to create (like if N processors all + * open the same file with MPI_COMM_SELF). Then we can just look up the + * file (which now exists). + * + * the good news is that only one processor does this and broadcasts the + * handle to everyone else in the communicator + */ +static void fake_an_open(PVFS_fs_id fs_id, char *pvfs_name, int access_mode, + int nr_datafiles, PVFS_size strip_size, + ADIOI_PVFS2_fs * pvfs2_fs, open_status * o_status) +{ + int ret; + PVFS_sysresp_lookup resp_lookup; + PVFS_sysresp_getparent resp_getparent; + PVFS_sysresp_create resp_create; + PVFS_sys_attr attribs; + PVFS_sys_dist *dist; + + ADIOI_PVFS2_makeattribs(&attribs); + if (nr_datafiles > 0) { + attribs.dfile_count = nr_datafiles; + attribs.mask |= PVFS_ATTR_SYS_DFILE_COUNT; + } + + dist = NULL; + + memset(&resp_lookup, 0, sizeof(resp_lookup)); + memset(&resp_getparent, 0, sizeof(resp_getparent)); + memset(&resp_create, 0, sizeof(resp_create)); + + + ret = PVFS_sys_lookup(fs_id, pvfs_name, + &(pvfs2_fs->credentials), &resp_lookup, PVFS2_LOOKUP_LINK_FOLLOW); + if (ret == (-PVFS_ENOENT)) { + if (access_mode & ADIO_CREATE) { + ret = PVFS_sys_getparent(fs_id, pvfs_name, &(pvfs2_fs->credentials), &resp_getparent); + if (ret < 0) { + FPRINTF(stderr, "pvfs_sys_getparent returns with %d\n", ret); + o_status->error = ret; + return; + } + + /* Set the distribution strip size if specified */ + if (0 < strip_size) { + /* Note that the distribution is hardcoded here */ + dist = PVFS_sys_dist_lookup("simple_stripe"); + ret = PVFS_sys_dist_setparam(dist, "strip_size", &strip_size); + if (ret < 0) { + FPRINTF(stderr, "pvfs_sys_dist_setparam returns with %d\n", ret); + o_status->error = ret; + } + } + + /* Perform file creation */ +#ifdef HAVE_PVFS2_CREATE_WITHOUT_LAYOUT + ret = PVFS_sys_create(resp_getparent.basename, + resp_getparent.parent_ref, attribs, + &(pvfs2_fs->credentials), dist, &resp_create); +#else + ret = PVFS_sys_create(resp_getparent.basename, + resp_getparent.parent_ref, attribs, + &(pvfs2_fs->credentials), dist, NULL, &resp_create); +#endif + + /* if many creates are happening in this directory, the earlier + * sys_lookup may have returned ENOENT, but the sys_create could + * return EEXISTS. That means the file has been created anyway, so + * less work for us and we can just open it up and return the + * handle */ + if (ret == (-PVFS_EEXIST)) { + ret = PVFS_sys_lookup(fs_id, pvfs_name, + &(pvfs2_fs->credentials), &resp_lookup, + PVFS2_LOOKUP_LINK_FOLLOW); + if (ret < 0) { + o_status->error = ret; + return; + } + o_status->error = ret; + o_status->object_ref = resp_lookup.ref; + return; + } + o_status->object_ref = resp_create.ref; + } else { + FPRINTF(stderr, "cannot create file without MPI_MODE_CREATE\n"); + o_status->error = ret; + return; + } + } else if (access_mode & ADIO_EXCL) { + /* lookup should not succeed if opened with EXCL */ + o_status->error = -PVFS_EEXIST; + return; + } else { + o_status->object_ref = resp_lookup.ref; + } + o_status->error = ret; + return; + +} + + +/* ADIOI_PVFS2_Open: + * one process opens (or creates) the file, then broadcasts the result to the + * remaining processors. + * + * ADIO_Open used to perform an optimization when MPI_MODE_CREATE (and before + * that, MPI_MODE_EXCL) was set. Because PVFS2 handles file lookup and + * creation more scalably than other file systems, ADIO_Open now skips any + * special handling when CREATE is set. */ +void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code) +{ + int rank, ret; + PVFS_fs_id cur_fs; + static char myname[] = "ADIOI_PVFS2_OPEN"; + char pvfs_path[PVFS_NAME_MAX] = { 0 }; + + ADIOI_PVFS2_fs *pvfs2_fs; + + /* since one process is doing the open, that means one process is also + * doing the error checking. define a struct for both the object reference + * and the error code to broadcast to all the processors */ + + open_status o_status = { 0, {0, 0} }; + MPI_Datatype open_status_type; + MPI_Datatype types[2] = { MPI_INT, MPI_BYTE }; + int lens[2] = { 1, sizeof(PVFS_object_ref) }; + MPI_Aint offsets[2]; + + pvfs2_fs = (ADIOI_PVFS2_fs *) ADIOI_Malloc(sizeof(ADIOI_PVFS2_fs)); + + /* --BEGIN ERROR HANDLING-- */ + if (pvfs2_fs == NULL) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNKNOWN, "Error allocating memory", 0); + return; + } + /* --END ERROR HANDLING-- */ + + MPI_Comm_rank(fd->comm, &rank); + + ADIOI_PVFS2_Init(error_code); + if (*error_code != MPI_SUCCESS) { + /* ADIOI_PVFS2_INIT handles creating error codes on its own */ + return; + } + + /* currently everyone gets their own credentials */ + ADIOI_PVFS2_makecredentials(&(pvfs2_fs->credentials)); + + /* one process resolves name and will later bcast to others */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); +#endif + if (rank == fd->hints->ranklist[0] && fd->fs_ptr == NULL) { + /* given the filename, figure out which pvfs filesystem it is on */ + ret = PVFS_util_resolve(fd->filename, &cur_fs, pvfs_path, PVFS_NAME_MAX); + if (ret < 0) { + PVFS_perror("PVFS_util_resolve", ret); + /* TODO: pick a good error for this */ + o_status.error = -1; + } else { + fake_an_open(cur_fs, pvfs_path, + fd->access_mode, fd->hints->striping_factor, + fd->hints->striping_unit, pvfs2_fs, &o_status); + } + + /* store credentials and object reference in fd */ + pvfs2_fs->object_ref = o_status.object_ref; + fd->fs_ptr = pvfs2_fs; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + + /* broadcast status and (possibly valid) object reference */ + MPI_Get_address(&o_status.error, &offsets[0]); + MPI_Get_address(&o_status.object_ref, &offsets[1]); + + MPI_Type_create_struct(2, lens, offsets, types, &open_status_type); + MPI_Type_commit(&open_status_type); + + /* Assertion: if we hit this Bcast, then all processes collectively + * called this open. + * + * That's because deferred open never happens with PVFS2. + */ + MPI_Bcast(MPI_BOTTOM, 1, open_status_type, fd->hints->ranklist[0], fd->comm); + MPI_Type_free(&open_status_type); + + /* --BEGIN ERROR HANDLING-- */ + if (o_status.error != 0) { + ADIOI_Free(pvfs2_fs); + fd->fs_ptr = NULL; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(o_status.error), + "Unknown error", 0); + /* TODO: FIX STRING */ + return; + } + /* --END ERROR HANDLING-- */ + + pvfs2_fs->object_ref = o_status.object_ref; + fd->fs_ptr = pvfs2_fs; + + *error_code = MPI_SUCCESS; + return; +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read.c new file mode 100644 index 0000000000000000000000000000000000000000..b6a01fcc0a61812714f94d892393753424dd1f2c --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read.c @@ -0,0 +1,163 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + int ret; + MPI_Count datatype_size, len; + PVFS_Request file_req, mem_req; + PVFS_sysresp_io resp_io; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_READCONTIG"; + + if (count == 0) { +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* copy individual file pointer into offset variable, continue */ + offset = fd->fp_ind; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, offset, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_read", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += (int) resp_io.total_completed; + /* TODO: WHY THE INT CAST? */ + } + fd->fp_sys_posn = offset + (int) resp_io.total_completed; + +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); +#endif + + *error_code = MPI_SUCCESS; + fn_exit: + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + return; +} + +static int ADIOI_PVFS2_ReadStridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + return ADIOI_PVFS2_StridedListIO(fd, buf, count, + datatype, file_ptr_type, offset, status, error_code, READ); +} + +static int ADIOI_PVFS2_ReadStridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + return ADIOI_PVFS2_StridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, offset, status, error_code, READ); +} + +void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + /* four ways (to date) that we can carry out strided i/o accesses: + * - naive posix + * - 'true' Datatype (from avery) + * - new List I/O (from avery) + * - classic List I/O (the one that's always been in ROMIO) + * I imagine we'll keep Datatype as an optional optimization, and afer a + * release or two promote it to the default + */ + int ret = -1; + + if (fd->hints->fs_hints.pvfs2.posix_read == ADIOI_HINT_ENABLE) { + ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + return; + } + if (fd->hints->fs_hints.pvfs2.dtype_read == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_ReadStridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, offset, status, error_code); + + /* Fall back to list I/O if datatype I/O didn't work */ + if (ret != 0) { + fprintf(stderr, "Falling back to list I/O since datatype I/O failed\n"); + ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + if (fd->hints->fs_hints.pvfs2.listio_read == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; + } + /* Use classic list I/O if no hints given base case */ + + ADIOI_PVFS2_OldReadStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + return; +} + + +/* + */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c new file mode 100644 index 0000000000000000000000000000000000000000..86212b19f08aa0d65171370cf5cb45a092b744dc --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c @@ -0,0 +1,872 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, brd_size, frd_size = 0, st_index = 0; + int sum, n_etypes_in_filetype, size_in_filetype; + MPI_Count bufsize; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_frd_size, st_n_filetypes; + + int mem_list_count, file_list_count; + PVFS_size *mem_offsets; + int64_t *file_offsets; + int *mem_lengths; + int32_t *file_lengths; + int total_blks_to_read; + + int max_mem_list, max_file_list; + + int b_blks_read; + int f_data_read; + int size_read = 0, n_read_lists, extra_blks; + + int end_brd_size, end_frd_size; + int start_k, start_j, new_file_read, new_buffer_read; + int start_mem_offset; + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs *pvfs_fs; + PVFS_sysresp_io resp_io; + int err_flag = 0; + MPI_Offset total_bytes_read = 0; + static char myname[] = "ADIOI_PVFS2_ReadStrided"; + +#define MAX_ARRAY_SIZE 64 + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + int64_t file_offset; + int32_t file_length; + + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : fd->disp + etype_size * offset; + + file_list_count = 1; + file_offset = off; + file_length = 0; + total_blks_to_read = count * flat_buf->count; + b_blks_read = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_read > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else + mem_list_count = total_blks_to_read; + mem_offsets = (PVFS_size *) ADIOI_Malloc(mem_list_count * sizeof(PVFS_size)); + mem_lengths = (int *) ADIOI_Malloc(mem_list_count * sizeof(int)); + + /* TODO: CHECK RESULTS OF MEMORY ALLOCATION */ + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_read < total_blks_to_read) { + for (i = 0; i < flat_buf->count; i++) { + mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = + /* TODO: fix this compiler warning */ + ((PVFS_size) buf + j * buftype_extent + flat_buf->indices[i]); + mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = flat_buf->blocklens[i]; + file_length += flat_buf->blocklens[i]; + b_blks_read++; + if (!(b_blks_read % MAX_ARRAY_SIZE) || (b_blks_read == total_blks_to_read)) { + + /* in the case of the last read list call, + * adjust mem_list_count */ + if (b_blks_read == total_blks_to_read) { + mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; + /* in case last read list call fills max arrays */ + if (!mem_list_count) + mem_list_count = MAX_ARRAY_SIZE; + } + err_flag = PVFS_Request_hindexed(mem_list_count, + mem_lengths, mem_offsets, PVFS_BYTE, &mem_req); + if (err_flag < 0) + break; + err_flag = PVFS_Request_contiguous(file_length, PVFS_BYTE, &file_req); + if (err_flag < 0) + break; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, + file_offset, PVFS_BOTTOM, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + /* --END ERROR HANDLING-- */ + + /* in the case of error or the last read list call, + * leave here */ + if (err_flag || b_blks_read == total_blks_to_read) + break; + + file_offset += file_length; + file_length = 0; + } + } /* for (i=0; i<flat_buf->count; i++) */ + j++; + } /* while (b_blks_read < total_blks_to_read) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_read; + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This isa temporary way of filling in status. The right way is to + * keep tracke of how much data was actually read adn placed in buf + * by ADIOI_BUFFERED_READ. */ +#endif + + return; + } + + + + + /* if (!buftype_is_contig && filetype_is_contig) */ + /* know file is noncontiguous from above */ + /* noncontiguous in file */ + /* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + disp = fd->disp; + initial_off = offset; + + + /* for each case - ADIO_Individual pointer or explicit, find the file + * offset in bytes (offset), n_filetypes (how many filetypes into + * file to start), frd_size (remaining amount of data in present + * file block), and st_index (start point in terms of blocks in + * starting filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + frd_size = (int) (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] - offset); + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = (int) (offset / n_etypes_in_filetype); + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + ((ADIO_Offset) n_filetypes) * filetype_extent + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + int mem_length = 0; + intptr_t mem_offset; + + i = 0; + j = st_index; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to read */ + f_data_read = MPL_MIN(st_frd_size, bufsize); + total_blks_to_read = 1; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_read < bufsize) { + f_data_read += flat_file->blocklens[j]; + total_blks_to_read++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_read_lists = total_blks_to_read / MAX_ARRAY_SIZE; + extra_blks = total_blks_to_read % MAX_ARRAY_SIZE; + + mem_offset = (intptr_t) buf; + mem_lengths = 0; + + /* if at least one full readlist, allocate file arrays + * at max array size and don't free until very end */ + if (n_read_lists) { + file_offsets = (int64_t *) ADIOI_Malloc(MAX_ARRAY_SIZE * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(MAX_ARRAY_SIZE * sizeof(int32_t)); + } + /* if there's no full readlist allocate file arrays according + * to needed size (extra_blks) */ + else { + file_offsets = (int64_t *) ADIOI_Malloc(extra_blks * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(extra_blks * sizeof(int32_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i = 0; i < n_read_lists; i++) { + file_list_count = MAX_ARRAY_SIZE; + if (!i) { + file_offsets[0] = offset; + file_lengths[0] = st_frd_size; + mem_length = st_frd_size; + } + for (k = 0; k < MAX_ARRAY_SIZE; k++) { + if (i || k) { + file_offsets[k] = disp + + ((ADIO_Offset) n_filetypes) * filetype_extent + flat_file->indices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_lengths += file_lengths[k]; + } + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ + err_flag = PVFS_Request_contiguous(mem_length, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (memory)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (file)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* PVFS_Request_hindexed already expresses the offsets into the + * file, so we should not pass in an offset if we are using + * hindexed for the file type */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, + (void *) mem_offset, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + /* --END ERROR HANDING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + + total_bytes_read += resp_io.total_completed; + + mem_offset += mem_length; + mem_lengths = 0; + } /* for (i=0; i<n_read_lists; i++) */ + + /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */ + if (extra_blks) { + file_list_count = extra_blks; + if (!i) { + file_offsets[0] = offset; + file_lengths[0] = MPL_MIN(st_frd_size, bufsize); + } + for (k = 0; k < extra_blks; k++) { + if (i || k) { + file_offsets[k] = disp + + ((ADIO_Offset) n_filetypes) * filetype_extent + flat_file->indices[j]; + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize - (int32_t) mem_lengths + - mem_offset + (int32_t) buf; + } else + file_lengths[k] = flat_file->blocklens[j]; + } /* if (i || k) */ + mem_lengths += file_lengths[k]; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; k<extra_blks; k++) */ + err_flag = PVFS_Request_contiguous(mem_length, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (memory)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (file)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* as above, use 0 for 'offset' when using hindexed file type */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, + (void *) mem_offset, mem_req, &(pvfs_fs->credentials), + &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + * can allocate the file and memory arrays less than MAX_ARRAY_SIZE + * if possible */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && (new_buffer_read < bufsize - size_read)) { + /* find mem_list_count and file_list_count such that both are + * less than MAX_ARRAY_SIZE, the sum of their lengths are + * equal, and the sum of all the data read and data to be + * read in the next immediate read list is less than + * bufsize */ + if (mem_list_count) { + if ((new_buffer_read + flat_buf->blocklens[k] + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } else + new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && (new_file_read < new_buffer_read)) { + if (file_list_count) { + if ((new_file_read + flat_file->blocklens[j]) > new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } else + new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if (mem_list_count) { + if ((new_buffer_read + flat_buf->blocklens[k]) > new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + * == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_read < bufsize-size_read)) */ + + /* fakes filling the readlist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i = 0; i < mem_list_count; i++) { + if (i) { + if (i == (mem_list_count - 1)) { + if (flat_buf->blocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k + 1) % flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1) % flat_buf->count; + } /* for (i=0; i<mem_list_count; i++) */ + for (i = 0; i < file_list_count; i++) { + if (i) { + if (i == (file_list_count - 1)) { + if (flat_file->blocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j + 1) % flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } + } + if (j < flat_file->count - 1) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; i<file_list_count; i++) */ + size_read += new_buffer_read; + start_k = k; + start_j = j; + if (max_mem_list < mem_list_count) + max_mem_list = mem_list_count; + if (max_file_list < file_list_count) + max_file_list = file_list_count; + } /* while (size_read < bufsize) */ + + /* one last check before we actually carry out the operation: + * this code has hard-to-fix bugs when a noncontiguous file type has + * such large pieces that the sum of the lengths of the memory type is + * not larger than one of those pieces (and vice versa for large memory + * types and many pices of file types. In these cases, give up and + * fall back to naive reads and writes. The testphdf5 test created a + * type with two very large memory regions and 600 very small file + * regions. The same test also created a type with one very large file + * region and many (700) very small memory regions. both cases caused + * problems for this code */ + + if (((file_list_count == 1) && + (new_file_read < flat_file->blocklens[0])) || + ((mem_list_count == 1) && + (new_buffer_read < flat_buf->blocklens[0])) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_read < flat_buf->blocklens[0])) || + ((mem_list_count == MAX_ARRAY_SIZE) && (new_buffer_read < flat_file->blocklens[0]))) { + + ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + mem_offsets = (PVFS_size *) ADIOI_Malloc(max_mem_list * sizeof(PVFS_size)); + mem_lengths = (int *) ADIOI_Malloc(max_mem_list * sizeof(int)); + file_offsets = (int64_t *) ADIOI_Malloc(max_file_list * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(max_file_list * sizeof(int32_t)); + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + * and also finds the possibly odd sized last array elements + * in new_frd_size and new_brd_size */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && (new_buffer_read < bufsize - size_read)) { + /* find mem_list_count and file_list_count such that both are + * less than MAX_ARRAY_SIZE, the sum of their lengths are + * equal, and the sum of all the data read and data to be + * read in the next immediate read list is less than + * bufsize */ + if (mem_list_count) { + if ((new_buffer_read + flat_buf->blocklens[k] + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } else + new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && (new_file_read < new_buffer_read)) { + if (file_list_count) { + if ((new_file_read + flat_file->blocklens[j]) > new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } else + new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if (mem_list_count) { + if ((new_buffer_read + flat_buf->blocklens[k]) > new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + * == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_read < bufsize-size_read)) */ + + /* fills the allocated readlist arrays */ + k = start_k; + j = start_j; + for (i = 0; i < mem_list_count; i++) { + mem_offsets[i] = ((PVFS_size) buf + buftype_extent * + (buf_count / flat_buf->count) + (int) flat_buf->indices[k]); + if (!i) { + mem_lengths[0] = brd_size; + mem_offsets[0] += flat_buf->blocklens[k] - brd_size; + } else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_brd_size; + if (flat_buf->blocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k + 1) % flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1) % flat_buf->count; + } /* for (i=0; i<mem_list_count; i++) */ + for (i = 0; i < file_list_count; i++) { + file_offsets[i] = disp + flat_file->indices[j] + + ((ADIO_Offset) n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = frd_size; + file_offsets[0] += flat_file->blocklens[j] - frd_size; + } else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_frd_size; + if (flat_file->blocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j + 1) % flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } else + file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; i<file_list_count; i++) */ + err_flag = PVFS_Request_hindexed(mem_list_count, mem_lengths, + mem_offsets, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (memory)", 0); + goto error_state; + } + /* -- END ERROR HANDLING-- */ + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (file)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* offset will be expressed in memory and file datatypes */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, + PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + } + /* --END ERROR HANDLING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + size_read += new_buffer_read; + start_k = k; + start_j = j; + } /* while (size_read < bufsize) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + } + /* Other ADIO routines will convert absolute bytes into counts of datatypes */ + /* when incrementing fp_ind, need to also take into account the file type: + * consider an N-element 1-d subarray with a lb and ub: (|---xxxxx-----| + * if we wrote N elements, offset needs to point at beginning of type, not + * at empty region at offset N+1) + * + * As we discussed on mpich-discuss in may/june 2009, the code below might + * look wierd, but by putting fp_ind at the last byte written, the next + * time we run through the strided code we'll update the fp_ind to the + * right location. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind = file_offsets[file_list_count - 1] + file_lengths[file_list_count - 1]; + } + + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + if (err_flag == 0) + *error_code = MPI_SUCCESS; + + error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually read and placed in buf + * by ADIOI_BUFFERED_READ. */ +#endif + +} diff --git a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_resize.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_resize.c similarity index 59% rename from 3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_resize.c rename to 3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_resize.c index db219db0fde1e9642d3c83843303db5e7ab89ae3..5dfe5101ce9dcd864f1fd20f3dfb8dbc2220df95 100644 --- a/3rd-party/romio321/adio/ad_pvfs2/ad_pvfs2_resize.c +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_resize.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_pvfs2.h" @@ -19,12 +17,12 @@ void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) *error_code = MPI_SUCCESS; - pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; MPI_Comm_rank(fd->comm, &rank); - /* We desginate one node in the communicator to be an 'io_worker' in - * ADIO_Open. This node can perform operations on files and then + /* We desginate one node in the communicator to be an 'io_worker' in + * ADIO_Open. This node can perform operations on files and then * inform the other nodes of the result */ /* MPI-IO semantics treat conflicting MPI_File_set_size requests the @@ -33,24 +31,19 @@ void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) * syncronization point is reached */ if (rank == fd->hints->ranklist[0]) { - ret = PVFS_sys_truncate(pvfs_fs->object_ref, - size, &(pvfs_fs->credentials)); - MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); - } else { - MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + ret = PVFS_sys_truncate(pvfs_fs->object_ref, size, &(pvfs_fs->credentials)); + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + } else { + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); } /* --BEGIN ERROR HANDLING-- */ if (ret != 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - ADIOI_PVFS2_error_convert(ret), - "Error in PVFS_sys_truncate", 0); - return; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_truncate", 0); + return; } /* --END ERROR HANDLING-- */ } - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write.c new file mode 100644 index 0000000000000000000000000000000000000000..7cac61d34789061d360fa16e03168a4b03c3904a --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write.c @@ -0,0 +1,177 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_pvfs2.h" +#include "adio_extern.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + int ret; + MPI_Count datatype_size, len; + PVFS_Request file_req, mem_req; + PVFS_sysresp_io resp_io; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_WRITECONTIG"; + + if (count == 0) { +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_Request_contiguous (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_Request_contiguous (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, offset, (void *) buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_write", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + (int) resp_io.total_completed; + } else { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, fd->fp_ind, (void *) buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_write", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + fd->fp_ind += (int) resp_io.total_completed; + fd->fp_sys_posn = fd->fp_ind; + } +#ifdef HAVE_STATUS_SET_BYTES + if (status) + MPIR_Status_set_bytes(status, datatype, resp_io.total_completed); +#endif + *error_code = MPI_SUCCESS; + fn_exit: + PVFS_Request_free(&file_req); + PVFS_Request_free(&mem_req); + return; +} + +int ADIOI_PVFS2_WriteStridedListIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + return ADIOI_PVFS2_StridedListIO(fd, (void *) buf, count, + datatype, file_ptr_type, offset, status, error_code, WRITE); +} + +int ADIOI_PVFS2_WriteStridedDtypeIO(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + return ADIOI_PVFS2_StridedDtypeIO(fd, (void *) buf, count, + datatype, file_ptr_type, offset, status, error_code, WRITE); +} + + +void ADIOI_PVFS2_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + /* four ways (to date) that we can carry out strided i/o accesses: + * - naive posix + * - 'true' Datatype (from avery) + * - new List I/O (from avery) + * - classic List I/O (the one that's always been in ROMIO) + * I imagine we'll keep Datatype as an optional optimization, and afer a + * release or two promote it to the default + */ + + /* a lot of near-duplication from ADIOI_PVFS2_ReadStrided: for + * debugging/testing it's helpful to be able to turn on and off these + * optimizations separately for the read and write cases */ + int ret = -1; + if (fd->hints->fs_hints.pvfs2.posix_write == ADIOI_HINT_ENABLE) { + ADIOI_GEN_WriteStrided_naive(fd, buf, count, + datatype, file_ptr_type, offset, status, error_code); + return; + } + if (fd->hints->fs_hints.pvfs2.dtype_write == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_WriteStridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, offset, status, error_code); + + /* Fall back to list I/O if datatype I/O didn't work */ + if (ret != 0) { + fprintf(stderr, "Falling back to list I/O since datatype I/O failed\n"); + ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + /* Use list I/O in the base case */ + if (fd->hints->fs_hints.pvfs2.listio_write == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; + } + + /* Use classic list I/O if no hints given base case */ + ADIOI_PVFS2_OldWriteStrided(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; +} diff --git a/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c new file mode 100644 index 0000000000000000000000000000000000000000..8fe5c1de6c3f5b514dcc2dab60c8c0c0d583d428 --- /dev/null +++ b/3rd-party/romio341/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c @@ -0,0 +1,919 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + /* as with all the other WriteStrided functions, offset is in units of + * etype relative to the filetype */ + + /* Since PVFS2 does not support file locking, can't do buffered writes + * as on Unix */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, bwr_size, fwr_size = 0, st_index = 0; + int sum, n_etypes_in_filetype, size_in_filetype; + MPI_Count bufsize; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_fwr_size, st_n_filetypes; + int err_flag = 0; + + int mem_list_count, file_list_count; + PVFS_size *mem_offsets; + int64_t *file_offsets; + int *mem_lengths; + int32_t *file_lengths; + int total_blks_to_write; + + int max_mem_list, max_file_list; + + int b_blks_wrote; + int f_data_wrote; + int size_wrote = 0, n_write_lists, extra_blks; + + int end_bwr_size, end_fwr_size; + int start_k, start_j, new_file_write, new_buffer_write; + int start_mem_offset; + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs *pvfs_fs; + PVFS_sysresp_io resp_io; + MPI_Offset total_bytes_written = 0; + static char myname[] = "ADIOI_PVFS2_WRITESTRIDED"; + + /* note: don't increase this: several parts of PVFS2 now + * assume this limit*/ +#define MAX_ARRAY_SIZE 64 + + /* --BEGIN ERROR HANDLING-- */ + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "Atomic noncontiguous writes are not supported by PVFS2", + 0); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + pvfs_fs = (ADIOI_PVFS2_fs *) fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + int64_t file_offset; + int32_t file_length; + + flat_buf = ADIOI_Flatten_and_find(datatype); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + etype_size * offset; + } else + off = fd->fp_ind; + + file_list_count = 1; + file_offset = off; + file_length = 0; + total_blks_to_write = count * flat_buf->count; + b_blks_wrote = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_write > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else + mem_list_count = total_blks_to_write; + mem_offsets = (PVFS_size *) ADIOI_Malloc(mem_list_count * sizeof(PVFS_size)); + mem_lengths = (int *) ADIOI_Malloc(mem_list_count * sizeof(int)); + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_wrote < total_blks_to_write) { + for (i = 0; i < flat_buf->count; i++) { + mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = + /* TODO: fix this warning by casting to an integer that's + * the same size as a char * and /then/ casting to + * PVFS_size */ + ((PVFS_size) buf + j * buftype_extent + flat_buf->indices[i]); + mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = flat_buf->blocklens[i]; + file_length += flat_buf->blocklens[i]; + b_blks_wrote++; + if (!(b_blks_wrote % MAX_ARRAY_SIZE) || (b_blks_wrote == total_blks_to_write)) { + + /* in the case of the last write list call, + * adjust mem_list_count */ + if (b_blks_wrote == total_blks_to_write) { + mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; + /* in case last write list call fills max arrays */ + if (!mem_list_count) + mem_list_count = MAX_ARRAY_SIZE; + } + err_flag = PVFS_Request_hindexed(mem_list_count, + mem_lengths, mem_offsets, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (memory)", + 0); + break; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_contiguous(file_length, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (file)", + 0); + break; + } + /* --END ERROR HANDLING-- */ + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, + file_offset, PVFS_BOTTOM, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + total_bytes_written += resp_io.total_completed; + + /* in the case of error or the last write list call, + * leave here */ + /* --BEGIN ERROR HANDLING-- */ + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + break; + } + /* --END ERROR HANDLING-- */ + if (b_blks_wrote == total_blks_to_write) + break; + + file_offset += file_length; + file_length = 0; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + } /* for (i=0; i<flat_buf->count; i++) */ + j++; + } /* while (b_blks_wrote < total_blks_to_write) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_written; + + if (!err_flag) + *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* clear this. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + return; + } + + + + + /* if (!buftype_is_contig && filetype_is_contig) */ + /* already know that file is noncontiguous from above */ + /* noncontiguous in file */ + /* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + disp = fd->disp; + initial_off = offset; + + /* for each case - ADIO_Individual pointer or explicit, find offset + * (file offset in bytes), n_filetypes (how many filetypes into file + * to start), fwr_size (remaining amount of data in present file + * block), and st_index (start point in terms of blocks in starting + * filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes) * filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = (int) (offset / n_etypes_in_filetype); + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + ((ADIO_Offset) n_filetypes) * filetype_extent + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + int mem_length; + intptr_t mem_offset; + + i = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to write */ + f_data_wrote = MPL_MIN(st_fwr_size, bufsize); + total_blks_to_write = 1; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_wrote < bufsize) { + f_data_wrote += flat_file->blocklens[j]; + total_blks_to_write++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_write_lists = total_blks_to_write / MAX_ARRAY_SIZE; + extra_blks = total_blks_to_write % MAX_ARRAY_SIZE; + + mem_offset = (intptr_t) buf; + mem_length = 0; + + /* if at least one full writelist, allocate file arrays + * at max array size and don't free until very end */ + if (n_write_lists) { + file_offsets = (int64_t *) ADIOI_Malloc(MAX_ARRAY_SIZE * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(MAX_ARRAY_SIZE * sizeof(int32_t)); + } + /* if there's no full writelist allocate file arrays according + * to needed size (extra_blks) */ + else { + file_offsets = (int64_t *) ADIOI_Malloc(extra_blks * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(extra_blks * sizeof(int32_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i = 0; i < n_write_lists; i++) { + file_list_count = MAX_ARRAY_SIZE; + if (!i) { + file_offsets[0] = offset; + file_lengths[0] = st_fwr_size; + mem_length = st_fwr_size; + } + for (k = 0; k < MAX_ARRAY_SIZE; k++) { + if (i || k) { + file_offsets[k] = disp + + ((ADIO_Offset) n_filetypes) * filetype_extent + flat_file->indices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_length += file_lengths[k]; + } + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */ + + err_flag = PVFS_Request_contiguous(mem_length, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (memory)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (file)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* PVFS_Request_hindexed already expresses the offsets into the + * file, so we should not pass in an offset if we are using + * hindexed for the file type */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, + (void *) mem_offset, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + total_bytes_written += resp_io.total_completed; + + mem_offset += mem_length; + mem_lengths = 0; + PVFS_Request_free(&file_req); + PVFS_Request_free(&mem_req); + + } /* for (i=0; i<n_write_lists; i++) */ + + /* for file arrays smaller than MAX_ARRAY_SIZE (last write_list call) */ + if (extra_blks) { + file_list_count = extra_blks; + if (!i) { + file_offsets[0] = offset; + file_lengths[0] = MPL_MIN(st_fwr_size, bufsize); + } + for (k = 0; k < extra_blks; k++) { + if (i || k) { + file_offsets[k] = disp + + ((ADIO_Offset) n_filetypes) * filetype_extent + flat_file->indices[j]; + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize - (int32_t) mem_length + - mem_offset + (int32_t) buf; + } else + file_lengths[k] = flat_file->blocklens[j]; + } /* if (i || k) */ + mem_length += file_lengths[k]; + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; k<extra_blks; k++) */ + + err_flag = PVFS_Request_contiguous(mem_length, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (memory)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed(file)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* as above, use 0 for 'offset' when using hindexed file type */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, + (void *) mem_offset, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + total_bytes_written += resp_io.total_completed; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + } else { + /* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + * can allocate the file and memory arrays less than MAX_ARRAY_SIZE + * if possible */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && (new_buffer_write < bufsize - size_wrote)) { + /* find mem_list_count and file_list_count such that both are + * less than MAX_ARRAY_SIZE, the sum of their lengths are + * equal, and the sum of all the data written and data to be + * written in the next immediate write list is less than + * bufsize */ + if (mem_list_count) { + if ((new_buffer_write + flat_buf->blocklens[k] + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } else + new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && (new_file_write < new_buffer_write)) { + if (file_list_count) { + if ((new_file_write + flat_file->blocklens[j]) > new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } else + new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if (mem_list_count) { + if ((new_buffer_write + flat_buf->blocklens[k]) > new_file_write) { + end_bwr_size = new_file_write - new_buffer_write; + new_buffer_write = new_file_write; + k--; + } else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + * (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_write < bufsize-size_wrote)) */ + + /* fakes filling the writelist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i = 0; i < mem_list_count; i++) { + if (i) { + if (i == (mem_list_count - 1)) { + if (flat_buf->blocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k + 1) % flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1) % flat_buf->count; + } /* for (i=0; i<mem_list_count; i++) */ + for (i = 0; i < file_list_count; i++) { + if (i) { + if (i == (file_list_count - 1)) { + if (flat_file->blocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j + 1) % flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } + } + if (j < flat_file->count - 1) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; i<file_list_count; i++) */ + size_wrote += new_buffer_write; + start_k = k; + start_j = j; + if (max_mem_list < mem_list_count) + max_mem_list = mem_list_count; + if (max_file_list < file_list_count) + max_file_list = file_list_count; + } /* while (size_wrote < bufsize) */ + + /* one last check before we actually carry out the operation: + * this code has hard-to-fix bugs when a noncontiguous file type has + * such large pieces that the sum of the lengths of the memory type is + * not larger than one of those pieces (and vice versa for large memory + * types and many pices of file types. In these cases, give up and + * fall back to naive reads and writes. The testphdf5 test created a + * type with two very large memory regions and 600 very small file + * regions. The same test also created a type with one very large file + * region and many (700) very small memory regions. both cases caused + * problems for this code */ + + if (((file_list_count == 1) && + (new_file_write < flat_file->blocklens[0])) || + ((mem_list_count == 1) && + (new_buffer_write < flat_buf->blocklens[0])) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_write < flat_buf->blocklens[0])) || + ((mem_list_count == MAX_ARRAY_SIZE) && (new_buffer_write < flat_file->blocklens[0]))) { + ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + + mem_offsets = (PVFS_size *) ADIOI_Malloc(max_mem_list * sizeof(PVFS_size)); + mem_lengths = (int *) ADIOI_Malloc(max_mem_list * sizeof(int)); + file_offsets = (int64_t *) ADIOI_Malloc(max_file_list * sizeof(int64_t)); + file_lengths = (int32_t *) ADIOI_Malloc(max_file_list * sizeof(int32_t)); + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + * and also finds the possibly odd sized last array elements + * in new_fwr_size and new_bwr_size */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && (new_buffer_write < bufsize - size_wrote)) { + /* find mem_list_count and file_list_count such that both are + * less than MAX_ARRAY_SIZE, the sum of their lengths are + * equal, and the sum of all the data written and data to be + * written in the next immediate write list is less than + * bufsize */ + if (mem_list_count) { + if ((new_buffer_write + flat_buf->blocklens[k] + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } else + new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && (new_file_write < new_buffer_write)) { + if (file_list_count) { + if ((new_file_write + flat_file->blocklens[j]) > new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } else + new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) + j++; + else + j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if (mem_list_count) { + if ((new_buffer_write + flat_buf->blocklens[k]) > new_file_write) { + end_bwr_size = new_file_write - new_buffer_write; + new_buffer_write = new_file_write; + k--; + } else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1) % flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + * (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + * (new_buffer_write < bufsize-size_wrote)) */ + + /* fills the allocated writelist arrays */ + k = start_k; + j = start_j; + for (i = 0; i < mem_list_count; i++) { + /* TODO: fix this warning by casting to an integer that's the + * same size as a char * and /then/ casting to PVFS_size */ + mem_offsets[i] = ((PVFS_size) buf + buftype_extent * + (buf_count / flat_buf->count) + (int) flat_buf->indices[k]); + + if (!i) { + mem_lengths[0] = bwr_size; + mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; + } else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_bwr_size; + if (flat_buf->blocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k + 1) % flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1) % flat_buf->count; + } /* for (i=0; i<mem_list_count; i++) */ + for (i = 0; i < file_list_count; i++) { + file_offsets[i] = disp + flat_file->indices[j] + + ((ADIO_Offset) n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = fwr_size; + file_offsets[0] += flat_file->blocklens[j] - fwr_size; + } else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_fwr_size; + if (flat_file->blocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j + 1) % flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } else + file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) + j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; i<file_list_count; i++) */ + + err_flag = PVFS_Request_hindexed(mem_list_count, mem_lengths, + mem_offsets, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (memory)", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, + file_offsets, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + /* offset will be expressed in memory and file datatypes */ + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, + PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + size_wrote += new_buffer_write; + total_bytes_written += resp_io.total_completed; + start_k = k; + start_j = j; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } /* while (size_wrote < bufsize) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + } + /* when incrementing fp_ind, need to also take into account the file type: + * consider an N-element 1-d subarray with a lb and ub: (|---xxxxx-----| + * if we wrote N elements, offset needs to point at beginning of type, not + * at empty region at offset N+1). + * + * As we discussed on mpich-discuss in may/june 2009, the code below might + * look wierd, but by putting fp_ind at the last byte written, the next + * time we run through the strided code we'll update the fp_ind to the + * right location. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind = file_offsets[file_list_count - 1] + file_lengths[file_list_count - 1]; + } + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + *error_code = MPI_SUCCESS; + + error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/Makefile.mk b/3rd-party/romio341/adio/ad_quobytefs/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..2916fd0bf6a87ccab258b09070ee9c550f245a0c --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/Makefile.mk @@ -0,0 +1,25 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +if BUILD_AD_QUOBYTEFS + +noinst_HEADERS += adio/ad_quobytefs/ad_quobytefs.h \ + adio/ad_quobytefs/ad_quobytefs_internal.h + +romio_other_sources += \ + adio/ad_quobytefs/ad_quobytefs.c \ + adio/ad_quobytefs/ad_quobytefs_open.c \ + adio/ad_quobytefs/ad_quobytefs_close.c \ + adio/ad_quobytefs/ad_quobytefs_write.c \ + adio/ad_quobytefs/ad_quobytefs_flush.c \ + adio/ad_quobytefs/ad_quobytefs_fcntl.c \ + adio/ad_quobytefs/ad_quobytefs_read.c \ + adio/ad_quobytefs/ad_quobytefs_resize.c \ + adio/ad_quobytefs/ad_quobytefs_delete.c \ + adio/ad_quobytefs/ad_quobytefs_aio.c \ + adio/ad_quobytefs/ad_quobytefs_setlock.c \ + adio/ad_quobytefs/ad_quobytefs_internal.c + +endif BUILD_AD_QUOBYTEFS diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.c new file mode 100644 index 0000000000000000000000000000000000000000..472cc53bd79a939a39c8d26dae9330a92669c77f --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.c @@ -0,0 +1,103 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "ad_quobytefs.h" + +#include "adioi.h" +#include <string.h> + +struct ADIOI_Fns_struct ADIO_QUOBYTEFS_operations = { + ADIOI_QUOBYTEFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_QUOBYTEFS_ReadContig, /* ReadContig */ + ADIOI_QUOBYTEFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_QUOBYTEFS_Fcntl, /* Fcntl */ + ADIOI_GEN_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_QUOBYTEFS_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_QUOBYTEFS_IreadContig, /* IreadContig */ + ADIOI_QUOBYTEFS_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_QUOBYTEFS_Flush, /* Flush */ + ADIOI_QUOBYTEFS_Resize, /* Resize */ + ADIOI_QUOBYTEFS_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ + "QUOBYTEFS:ROMIO driver for quobyte file system", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ + ADIOI_QUOBYTEFS_SetLock /* SetLock */ +}; + +static char *extract_registry(const char *filename, int *error_code) +{ + /* input: //registry.address/[volume/]path + * output: registry.address */ + static char myname[] = "extract_registry"; + const char *prefix = "//"; + int prefix_size = strlen(prefix); + if (!strncmp(filename, prefix, prefix_size)) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_NAME, "Invalid uri", 0); + } + char *extract_filename = (char *) filename + prefix_size; + char *tmp = strchr(extract_filename, '/'); + char *registry = NULL; + + if (tmp != NULL && tmp > extract_filename) { + size_t length = tmp - extract_filename; + registry = strndup(extract_filename, length); + *error_code = MPI_SUCCESS; + return registry; + } else { + *error_code = ADIOI_Err_create_code(myname, filename, EINVAL); + } + return NULL; +} + +void ADIOI_QUOBYTEFS_CreateAdapter(const char *filename, int *error_code) +{ + static char myname[] = "ADIOI_QUOBYTEFS_CreateAdapter"; + + char *registry = extract_registry(filename, error_code); + if (registry == NULL || *error_code != MPI_SUCCESS) { + return; + } + const char process_name[] = "adio_ffffffff"; + char name_buffer[strlen(process_name)]; + int rank; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + snprintf(name_buffer, strlen(process_name), "adio_%x", rank); + quobyte_set_process_name(name_buffer); + int create_status = quobyte_create_adapter(registry); + MPL_external_free(registry); + if (create_status != EISCONN && create_status != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_IO, + "Could not create quobyte adapter", 0); + return; + } + global_quobyte_io_context = -1; +} + +void ADIOI_QUOBYTEFS_DestroyAdapter() +{ + /* TODO(alexey): place holder adapter destruction, + * for when it works as expected */ +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.h b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.h new file mode 100644 index 0000000000000000000000000000000000000000..3efff45379a1057c8d2b62491dad1622e133f933 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs.h @@ -0,0 +1,69 @@ +/** + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + * + * The main purpose of implementing the ADIO interface for Quobyte is to + * avoid calling the kernel for I/O operations. Using default MPI, a user + * would mount a quobyte volume in userspace and then use regular unix file + * paths as input for MPI-IO. + * + * This results in the following calls: + * MPI-IO <-> UFS (kernel) <-> quobyte client (userspace) + * + * Using Quobyte ADIO interface we will call the quobyte client directly + * through our API library: + * MPI-IO <-> quobyte client (userspace) + * + * This enables Quobyte users to take full advantage of the Quobyte + * distributed filesystem. + * + * This implementation of the ADIO interface is based on the available UFS + * ADIO implementation, committing minimal changes necessary for the + * compatibility with the Quobyte filesystem. + */ + +#ifndef AD_QUOBYTEFS_H_INCLUDED +#define AD_QUOBYTEFS_H_INCLUDED + +#include "adio.h" +#include <unistd.h> +#include <sys/types.h> +#include <fcntl.h> + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + +extern int global_quobyte_io_context; + +void ADIOI_QUOBYTEFS_CreateAdapter(const char *registry, int *error_code); +void ADIOI_QUOBYTEFS_DestroyAdapter(void) __attribute__ ((destructor)); + +void ADIOI_QUOBYTEFS_Open(ADIO_File fd, int *error_code); +void ADIOI_QUOBYTEFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_QUOBYTEFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_QUOBYTEFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); +void ADIOI_QUOBYTEFS_Close(ADIO_File fd, int *error_code); +void ADIOI_QUOBYTEFS_Flush(ADIO_File fd, int *error_code); +void ADIOI_QUOBYTEFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_QUOBYTEFS_Delete(const char *path, int *error_code); +int ADIOI_QUOBYTEFS_SetLock(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len); +int ADIOI_QUOBYTEFS_aio(ADIO_File fd, void *buf, int count, MPI_Datatype type, + ADIO_Offset offset, int wr, MPI_Request * request); +int ADIOI_QUOBYTEFS_aio_free_fn(void *extra_state); +int ADIOI_QUOBYTEFS_aio_poll_fn(void *extra_state, MPI_Status * status); +int ADIOI_QUOBYTEFS_aio_wait_fn(int count, void **array_of_states, double timeout, + MPI_Status * status); +void ADIOI_QUOBYTEFS_IreadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, + int file_ptr_type, ADIO_Offset offset, MPI_Request * request, + int *error_code); +void ADIOI_QUOBYTEFS_IwriteContig(ADIO_File fd, const void *buf, int count, MPI_Datatype datatype, + int file_ptr_type, ADIO_Offset offset, ADIO_Request * request, + int *error_code); +#endif /* AD_QUOBYTEFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_aio.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_aio.c new file mode 100644 index 0000000000000000000000000000000000000000..ba31bc7220ba495ec3636df2e91592b4079f01bf --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_aio.c @@ -0,0 +1,248 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#define READ 0 +#define WRITE 1 +#define QUOBYTE_CONCURRENT_REQS 8 + +#include "ad_quobytefs.h" +#include "mpiu_greq.h" + +static int ADIOI_QUOBYTEFS_greq_class = 0; +int global_quobyte_io_context; + +int ADIOI_QUOBYTEFS_aio_free_fn(void *extra_state); +int ADIOI_QUOBYTEFS_aio_poll_fn(void *extra_state, MPI_Status * status); +int ADIOI_QUOBYTEFS_aio_wait_fn(int count, void **array_of_states, double timeout, + MPI_Status * status); + +static void quobyte_io_event_finished(void *event, int ret) +{ + struct quobyte_io_event *aio_event = (struct quobyte_io_event *) event; + aio_event->result = ret; + if (ret >= 0) { + aio_event->errorcode = 0; + } else { + aio_event->errorcode = EIO; + } +} + +int ADIOI_QUOBYTEFS_aio(ADIO_File fd, void *buf, int count, MPI_Datatype type, + ADIO_Offset offset, int wr, MPI_Request * request) +{ + + int err = -1; + static char myname[] = "ADIOI_QUOBYTEFS_aio"; + struct quobyte_iocb *aiocbp = NULL; + struct quobyte_io_event *quobyte_aio = NULL; + ADIOI_AIO_Request *aio_req = NULL; + MPI_Count len, typesize; + + MPI_Type_size_x(type, &typesize); + len = count * typesize; + if (global_quobyte_io_context == -1) { + global_quobyte_io_context = quobyte_aio_setup(QUOBYTE_CONCURRENT_REQS); + } + aio_req = (ADIOI_AIO_Request *) ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + aiocbp = (struct quobyte_iocb *) ADIOI_Calloc(sizeof(struct quobyte_iocb), 1); + quobyte_aio = (struct quobyte_io_event *) ADIOI_Calloc(sizeof(struct quobyte_io_event), 1); + if (wr == WRITE) { + aiocbp->op_code = QB_WRITE; + } else { + aiocbp->op_code = QB_READ; + } + aiocbp->io_context = global_quobyte_io_context; + aiocbp->file_handle = fd->file_handle; + aiocbp->buffer = buf; + aiocbp->offset = offset; + aiocbp->length = len; + quobyte_aio->iocb = aiocbp; + quobyte_aio->errorcode = EINPROGRESS; + quobyte_aio->result = -1; + aio_req->qaiocbp = quobyte_aio; + + err = + quobyte_aio_submit_with_callback(global_quobyte_io_context, aiocbp, + quobyte_io_event_finished, quobyte_aio); + if (err == -1) { + ADIOI_Free(aio_req); + ADIOI_Free(aiocbp); + return MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_IO, + "Quobyte failed to submit aio context", 0); + } + + if (ADIOI_QUOBYTEFS_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_QUOBYTEFS_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_QUOBYTEFS_aio_poll_fn, ADIOI_QUOBYTEFS_aio_wait_fn, + &ADIOI_QUOBYTEFS_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_QUOBYTEFS_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return 0; +} + +void ADIOI_QUOBYTEFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + MPI_Count len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_QUOBYTEFS_IREADCONTIG"; + + MPI_Type_size_x(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + aio_errno = ADIOI_QUOBYTEFS_aio(fd, buf, count, datatype, offset, READ, request); + + + /* --BEGIN ERROR HANDLING-- */ + if (aio_errno != 0) { + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + fd->fp_sys_posn = -1; + *error_code = MPI_SUCCESS; +} + +void ADIOI_QUOBYTEFS_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + MPI_Count len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_QUOBYTEFS_IWRITECONTIG"; + + MPI_Type_size_x(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + /* Cast away the const'ness of 'buf' as ADIOI_GEN_aio is used for + * both read and write calls */ + aio_errno = ADIOI_QUOBYTEFS_aio(fd, (char *) buf, count, datatype, offset, WRITE, request); + + /* --BEGIN ERROR HANDLING-- */ + if (aio_errno != 0) { + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + *error_code = MPI_SUCCESS; +} + + +int ADIOI_QUOBYTEFS_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + aio_req = (ADIOI_AIO_Request *) extra_state; + + if (aio_req != NULL && aio_req->qaiocbp != NULL && aio_req->qaiocbp->iocb != NULL) { + + ADIOI_Free(aio_req->qaiocbp->iocb); + ADIOI_Free(aio_req->qaiocbp); + ADIOI_Free(aio_req); + } else { + return MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + "ADIOI_QUOBYTEFS_aio_free_fn", + __LINE__, MPI_ERR_IO, "Quobyte aio destruction failed", 0); + } + + return MPI_SUCCESS; +} + +int ADIOI_QUOBYTEFS_aio_poll_fn(void *extra_state, MPI_Status * status) +{ + ADIOI_AIO_Request *aio_req; + int errcode = MPI_SUCCESS; + + aio_req = (ADIOI_AIO_Request *) extra_state; + + if (aio_req != NULL && aio_req->qaiocbp != NULL) { + if (aio_req->qaiocbp->errorcode == 0) { + aio_req->nbytes = aio_req->qaiocbp->result; + errcode = MPI_Grequest_complete(aio_req->req); + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_QUOYBTEFS_aio_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", 0); + } + } else { + if (aio_req->qaiocbp->errorcode == EIO) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_QUOYBTEFS_aio_poll_fn", __LINE__, + MPI_ERR_IO, "Quobyte aio failed", 0); + } + } + } + return errcode; +} + +/* wait for multiple requests to complete */ +int ADIOI_QUOBYTEFS_aio_wait_fn(int count, void **array_of_states, double timeout, + MPI_Status * status) +{ + ADIOI_AIO_Request **aio_reqlist; + struct quobyte_io_event **events = + (struct quobyte_io_event **) ADIOI_Calloc(sizeof(struct quobyte_io_event *), count); + int i = 0; + int errcode = MPI_SUCCESS; + int num_in_progress = 0; + aio_reqlist = (ADIOI_AIO_Request **) array_of_states; + + while (i < count && aio_reqlist[i] != NULL) { + struct quobyte_io_event *current_event = aio_reqlist[i]->qaiocbp; + if (current_event->errorcode == EINPROGRESS) { + events[i] = current_event; + num_in_progress++; + } else { + errcode = MPI_Grequest_complete(aio_reqlist[i]->req); + } + i++; + } + + i = 0; + + double start_time = MPI_Wtime(); + int no_timeout = timeout > 0 ? 0 : 1; /* when timeout is <= 0 the loop will run until all events are done */ + while (num_in_progress > 0 && (no_timeout || MPI_Wtime() - start_time < timeout)) { + if (events[i] != NULL && events[i]->errorcode != EINPROGRESS) { + errcode = MPI_Grequest_complete(aio_reqlist[i]->req); + events[i] = NULL; + num_in_progress--; + } + if (i >= count) { + i = 0; + } else { + i++; + } + } + ADIOI_Free(events); + + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_QUOBYTEFS_aio_wait_fn", + __LINE__, MPI_ERR_IO, "**mpi_grequest_complete", 0); + } + return errcode; +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_close.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_close.c new file mode 100644 index 0000000000000000000000000000000000000000..1e93a7dd8abc60b32e0bcb9826812dc6e0d1a83c --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_close.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" + +void ADIOI_QUOBYTEFS_Close(ADIO_File fd, int *error_code) +{ + static char myname[] = "ADIOI_QUOBYTEFS_CLOSE"; + struct quobyte_fh *file_handle = fd->file_handle; + if (file_handle != NULL) { + if (quobyte_close(file_handle)) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "Quobyte failed to close the file: %s", + strerror(errno)); + return; + } + *error_code = MPI_SUCCESS; + } else { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_IO, "Quobyte file header is null", 0); + return; + } +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_delete.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_delete.c new file mode 100644 index 0000000000000000000000000000000000000000..dfd2396400d5c23ca5e3b47176526ad2f0ecfb60 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_delete.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" +#include "ad_quobytefs_internal.h" + +void ADIOI_QUOBYTEFS_Delete(const char *path, int *error_code) +{ + ADIOI_QUOBYTEFS_CreateAdapter(path, error_code); + static char myname[] = "ADIOI_QUOBYTEFS_DELETE"; + + if (quobyte_unlink(ADIOI_QUOBYTEFSI_GetVolumeAndPath(path))) { + *error_code = ADIOI_Err_create_code(myname, path, errno); + return; + } + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_fcntl.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..325842a6bb01b7f23b1cc3fdc84e49479d298d5d --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_fcntl.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" +#include "ad_quobytefs_internal.h" + +void ADIOI_QUOBYTEFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + static char myname[] = "ADIOI_QUOBYTEFS_FCNTL"; + struct stat file_stat; + const char *filepath = ADIOI_QUOBYTEFSI_GetVolumeAndPath(fd->filename); + if (!(filepath > fd->filename)) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, EINVAL); + return; + } + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + if (quobyte_getattr(filepath, &file_stat)) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + return; + } + fcntl_struct->fsize = file_stat.st_size; + if (fcntl_struct->fsize == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + } else { + *error_code = MPI_SUCCESS; + } + break; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + } +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_flush.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_flush.c new file mode 100644 index 0000000000000000000000000000000000000000..feb2499b38399742dd154d87a0275fc5ff3d2777 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_flush.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" + +void ADIOI_QUOBYTEFS_Flush(ADIO_File fd, int *error_code) +{ + int err; + static char myname[] = "ADIOI_QUOBYTEFS_FLUSH"; + + /* the deferred-open optimization may mean that a file has not been opened + * on this processor */ + if (fd->is_open > 0) { + /* alexey: the original uses fsync although it is named flush */ + err = quobyte_fsync(fd->file_handle); + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + return; + } + } + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.c new file mode 100644 index 0000000000000000000000000000000000000000..655b4830fbd1bd8b4bd2d91a1a711d54f5e858ee --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.c @@ -0,0 +1,12 @@ +#include "ad_quobytefs_internal.h" + +const char *ADIOI_QUOBYTEFSI_GetVolumeAndPath(const char *filename) +{ + const char *path; + if (strlen(filename) > 1 && !strncmp(filename, "//", 2)) { + path = strchr(filename + 2, '/'); + } else { + path = filename; + } + return path; +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.h b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..580deeb4736ada726832bf87fb0ff556c17b5a17 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_internal.h @@ -0,0 +1,8 @@ +#ifndef AD_QUOBYTEFS_INTERNAL_H_INCLUDED +#define AD_QUOBYTEFS_INTERNAL_H_INCLUDED + +#include <string.h> + +const char *ADIOI_QUOBYTEFSI_GetVolumeAndPath(const char *filename); + +#endif /* AD_QUOBYTEFS_INTERNAL_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_open.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_open.c new file mode 100644 index 0000000000000000000000000000000000000000..c7dcbcb699175e62c31bc0ab9c18d1f30e6f4e27 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_open.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" +#include "ad_quobytefs_internal.h" + +void ADIOI_QUOBYTEFS_Open(ADIO_File fd, int *error_code) +{ + ADIOI_QUOBYTEFS_CreateAdapter(fd->filename, error_code); + int perm, old_mask, amode; + static char myname[] = "ADIOI_QUOBYTEFS_OPEN"; + /* shortest possible path "//A/B" */ + if (strlen(fd->filename) < 5) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, EINVAL); + return; + } + const char *filepath = ADIOI_QUOBYTEFSI_GetVolumeAndPath(fd->filename); + if (strlen(filepath) == 0) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, EINVAL); + return; + } + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + /* romio tests expect write then read without flush */ + amode = amode | O_DIRECT; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); +#endif + fd->file_handle = quobyte_open(filepath, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + fd->fd_direct = -1; + + if ((fd->file_handle != NULL) && (fd->access_mode & ADIO_APPEND)) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + struct stat file_stat; + if (quobyte_fstat(fd->file_handle, &file_stat)) { + *error_code = ADIOI_Err_create_code(myname, filepath, errno); + return; + } + fd->fp_ind = fd->fp_sys_posn = file_stat.st_size; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + } + if (fd->file_handle == NULL) { + *error_code = ADIOI_Err_create_code(myname, filepath, errno); + } else { + *error_code = MPI_SUCCESS; + } +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_read.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_read.c new file mode 100644 index 0000000000000000000000000000000000000000..ae03a35ce16d248fe5da433cedbbe952d6a86d44 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_read.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" + +void ADIOI_QUOBYTEFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + MPI_Count datatype_size; + ADIO_Offset bytes_transfered; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5034, 0, NULL); +#endif + MPI_Type_size_x(datatype, &datatype_size); + bytes_transfered = datatype_size * (ADIO_Offset) count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + int bytes_read = quobyte_read(fd->file_handle, buf, offset, bytes_transfered); + fd->fp_sys_posn = offset + bytes_read; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_read; + } +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bytes_transfered); +#endif + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5035, 0, NULL); +#endif +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_resize.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_resize.c new file mode 100644 index 0000000000000000000000000000000000000000..7e10b74a7cc9734ed903117a9a1f5a375531c7af --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_resize.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#include "ad_quobytefs.h" + +void ADIOI_QUOBYTEFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + static char myname[] = "ADIOI_QUOBYTEFS_RESIZE"; + struct quobyte_fh *file_handle = fd->file_handle; + int err, rank; + + if (file_handle != NULL) { + + MPI_Comm_rank(fd->comm, &rank); + /* first aggregator performs ftruncate() */ + if (rank == fd->hints->ranklist[0]) { + ADIOI_Assert(size == (off_t) size); + err = quobyte_ftruncate(fd->file_handle, (off_t) size); + } + + /* bcast return value */ + MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + if (err == -1) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + return; + } + *error_code = MPI_SUCCESS; + } else { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_IO, "Quobyte file header is null", 0); + return; + } +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_setlock.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_setlock.c new file mode 100644 index 0000000000000000000000000000000000000000..526c435f521be84a304ed91aee85de3e3d51abe3 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_setlock.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" +#include "lock_internal.h" + +#include "ad_quobytefs.h" + +int ADIOI_QUOBYTEFS_SetLock(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len) +{ + struct flock lock; + lock.l_type = type; + lock.l_whence = whence; + lock.l_start = offset; + lock.l_len = len; + + int err, save_errno, err_count; /* save previous errno in case we recover from retryable errors */ + errno = 0; + err_count = 0; + save_errno = errno; + + do { + err = quobyte_lock(fd->file_handle, cmd, &lock); + } while (err && ((errno == EINTR) || ((errno == EINPROGRESS) && (++err_count < 10000)))); + + if (!err) /* report fcntl failure errno's (EBADF), otherwise */ + errno = save_errno; /* restore previous errno in case we recovered from retryable errors */ + + if (err && (errno != EBADF)) { + FPRINTF(stderr, + "File locking failed in ADIOI_QUOBYTEFS_SetLock(fd %X,cmd %s/%X,type %s/%X,whence " + "%X) with return value %X and errno %X.\n", + fd->fd_sys, ADIOI_GEN_flock_cmd_to_string(cmd), cmd, + ADIOI_GEN_flock_type_to_string(type), type, whence, err, errno); + perror("ADIOI_QUOBYTEFS_SetLock:"); + FPRINTF(stderr, "ADIOI_QUOBYTEFS_SetLock:offset %llu, length %llu\n", + (unsigned long long) offset, (unsigned long long) len); + MPI_Abort(MPI_COMM_WORLD, 1); + return MPI_ERR_IO; + } + return MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_write.c b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_write.c new file mode 100644 index 0000000000000000000000000000000000000000..91ae755eb0da94ebf8ea3ed852420cea4a7682f8 --- /dev/null +++ b/3rd-party/romio341/adio/ad_quobytefs/ad_quobytefs_write.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +#include "ad_quobytefs.h" + +void ADIOI_QUOBYTEFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + MPI_Count datatype_size; + ADIO_Offset bytes_transfered; + char *buffer_pointer = (char *) buf; + static char myname[] = "ADIOI_QUOBYTEFS_WRITECONTIG"; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5036, 0, NULL); +#endif + MPI_Type_size_x(datatype, &datatype_size); + bytes_transfered = datatype_size * (ADIO_Offset) count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + if (quobyte_write(fd->file_handle, buffer_pointer, offset, bytes_transfered, + false /* sync write */) != bytes_transfered) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, + __LINE__, MPI_ERR_IO, "Quobyte failed to write", 0); + return; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + fd->fp_sys_posn = offset + bytes_transfered; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_transfered; + } +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bytes_transfered); +#endif + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5037, 0, NULL); +#endif +} diff --git a/3rd-party/romio321/adio/ad_testfs/Makefile.mk b/3rd-party/romio341/adio/ad_testfs/Makefile.mk similarity index 84% rename from 3rd-party/romio321/adio/ad_testfs/Makefile.mk rename to 3rd-party/romio341/adio/ad_testfs/Makefile.mk index 7f9c617217122b9be521f67a43ac5991a1f7c464..342fa56c256c1e61dba82ca73515eac5c8f98d71 100644 --- a/3rd-party/romio321/adio/ad_testfs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_testfs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_TESTFS @@ -29,4 +27,3 @@ romio_other_sources += \ adio/ad_testfs/ad_testfs.c endif BUILD_AD_TESTFS - diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs.c new file mode 100644 index 0000000000000000000000000000000000000000..5e6a5a1df143124b8a080e421ceebb583e65e7de --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_TESTFS_operations = { + ADIOI_TESTFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_TESTFS_ReadContig, /* ReadContig */ + ADIOI_TESTFS_WriteContig, /* WriteContig */ + ADIOI_TESTFS_ReadStridedColl, /* ReadStridedColl */ + ADIOI_TESTFS_WriteStridedColl, /* WriteStridedColl */ + ADIOI_TESTFS_SeekIndividual, /* SeekIndividual */ + ADIOI_TESTFS_Fcntl, /* Fcntl */ + ADIOI_TESTFS_SetInfo, /* SetInfo */ + ADIOI_TESTFS_ReadStrided, /* ReadStrided */ + ADIOI_TESTFS_WriteStrided, /* WriteStrided */ + ADIOI_TESTFS_Close, /* Close */ + ADIOI_TESTFS_IreadContig, /* IreadContig */ + ADIOI_TESTFS_IwriteContig, /* IwriteContig */ + ADIOI_TESTFS_ReadDone, /* ReadDone */ + ADIOI_TESTFS_WriteDone, /* WriteDone */ + ADIOI_TESTFS_ReadComplete, /* ReadComplete */ + ADIOI_TESTFS_WriteComplete, /* WriteComplete */ + ADIOI_TESTFS_IreadStrided, /* IreadStrided */ + ADIOI_TESTFS_IwriteStrided, /* IwriteStrided */ + ADIOI_TESTFS_Flush, /* Flush */ + ADIOI_TESTFS_Resize, /* Resize */ + ADIOI_TESTFS_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ + "TESTFS: the logging-only file system", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs.h b/3rd-party/romio341/adio/ad_testfs/ad_testfs.h new file mode 100644 index 0000000000000000000000000000000000000000..0777da52959fe608d2c5a8e652b2bf12f25b4b4e --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_TESTFS_H_INCLUDED +#define AD_TESTFS_H_INCLUDED + +#include "adio.h" +#include <unistd.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <fcntl.h> + +void ADIOI_TESTFS_Open(ADIO_File fd, int *error_code); +void ADIOI_TESTFS_Close(ADIO_File fd, int *error_code); +void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +int ADIOI_TESTFS_ReadDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +int ADIOI_TESTFS_WriteDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_ReadComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_WriteComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIOI_TESTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); +void ADIOI_TESTFS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_TESTFS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_TESTFS_Flush(ADIO_File fd, int *error_code); +void ADIOI_TESTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, + int whence, int *error_code); +void ADIOI_TESTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_TESTFS_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset * shared_fp, int *error_code); +void ADIOI_TESTFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); +void ADIOI_TESTFS_Delete(const char *filename, int *error_code); + +#endif /* AD_TESTFS_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_close.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_close.c similarity index 60% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_close.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_close.c index a1b85e600d033b955ed5dc6f5496af2c48915367..1ac4237ce357787931fd8c204979beaff5258d87 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_close.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_close.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -17,6 +15,5 @@ void ADIOI_TESTFS_Close(ADIO_File fd, int *error_code) MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Close called on %s\n", myrank, - nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Close called on %s\n", myrank, nprocs, fd->filename); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_delete.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_delete.c similarity index 61% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_delete.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_delete.c index 9a1b6f37e12d0bfdb6f4848e0d7228dd2eec5184..32259f49f1ffa32e4b80e5765812107d2eaf6b3e 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_delete.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_delete.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -16,6 +14,5 @@ void ADIOI_TESTFS_Delete(const char *filename, int *error_code) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Delete called on %s\n", - myrank, nprocs, filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Delete called on %s\n", myrank, nprocs, filename); } diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs_done.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_done.c new file mode 100644 index 0000000000000000000000000000000000000000..85ae2c1793a6c8e8bf57504fe2ed3fc421136ea0 --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_done.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" +#include "adioi.h" + +int ADIOI_TESTFS_ReadDone(ADIO_Request * request, ADIO_Status * status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadDone called on ADIO_REQUEST_NULL\n", myrank, nprocs); + return 1; +} + + +int ADIOI_TESTFS_WriteDone(ADIO_Request * request, ADIO_Status * status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteDone called on ADIO_REQUEST_NULL\n", myrank, nprocs); + return 1; +} diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs_fcntl.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..fcd41af077f1917f22dc5fc64da3025755123b0a --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_fcntl.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" +#include "adioi.h" +#include "adio_extern.h" + +void ADIOI_TESTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int myrank, nprocs; + static char myname[] = "ADIOI_TESTFS_FCNTL"; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Fcntl called on %s\n", myrank, nprocs, fd->filename); + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = 0; + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + return; + /* --END ERROR HANDLING-- */ + } +} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_flush.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_flush.c similarity index 59% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_flush.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_flush.c index 23d559787d3ee3de61267dd861c896f69188e4ca..94f07b3edbdd730f3897d8f4f8fa7eb1cc0b515f 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_flush.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_flush.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -16,6 +14,5 @@ void ADIOI_TESTFS_Flush(ADIO_File fd, int *error_code) MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Flush called on %s\n", - myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Flush called on %s\n", myrank, nprocs, fd->filename); } diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs_getsh.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_getsh.c new file mode 100644 index 0000000000000000000000000000000000000000..9516963dcb292894f5a20f3bb4d6278ef87d5d00 --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_getsh.c @@ -0,0 +1,19 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" +#include "adioi.h" + +void ADIOI_TESTFS_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset * shared_fp, int *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Get_shared_fp called on %s\n", + myrank, nprocs, fd->filename); +} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_hints.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_hints.c similarity index 59% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_hints.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_hints.c index a6c1be9e9fa81fce612fd365e851f498bc353274..71a0f8c879238c67ad0e96ea0a1d9fdd583b03db 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_hints.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_hints.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -18,10 +16,8 @@ void ADIOI_TESTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_SetInfo called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_SetInfo\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_SetInfo called on %s\n", myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_SetInfo\n", myrank, nprocs); ADIOI_GEN_SetInfo(fd, users_info, error_code); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_iread.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_iread.c similarity index 60% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_iread.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_iread.c index 77e862438c684c33b72eb05ee27a0c49578fb2e7..99404e9fb6b34ffa3a1fa2c4d74dec6f241d46b4 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_iread.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_iread.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -12,10 +10,10 @@ * * Implemented by immediately calling ReadContig() */ -void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code) +void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code) { ADIO_Status status; int myrank, nprocs; @@ -26,22 +24,20 @@ void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); MPI_Type_size_x(datatype, &typesize); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadContig called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadContig\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadContig called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadContig\n", myrank, nprocs); len = count * typesize; - ADIOI_TESTFS_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, - offset, &status, error_code); + ADIOI_TESTFS_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset, &status, error_code); MPIO_Completed_request_create(&fd, len, error_code, request); } void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code) { ADIO_Status status; int myrank, nprocs; @@ -50,13 +46,10 @@ void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); MPI_Type_size_x(datatype, &typesize); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadStrided called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadStrided\n", - myrank, nprocs); - - ADIOI_TESTFS_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - MPIO_Completed_request_create(&fd, count*typesize, error_code, request); -} + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadStrided called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadStrided\n", myrank, nprocs); + ADIOI_TESTFS_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + MPIO_Completed_request_create(&fd, count * typesize, error_code, request); +} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_iwrite.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_iwrite.c similarity index 62% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_iwrite.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_iwrite.c index e29c9f6ee03e1398267632430ad2eda8a617c968..f6b3a9f40d4deaabc99637907c8cc442c9630f29 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_iwrite.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_iwrite.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -16,9 +14,9 @@ * Implemented by immediately calling WriteContig() */ void ADIOI_TESTFS_IwriteContig(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code) { ADIO_Status status; int myrank, nprocs; @@ -29,22 +27,20 @@ void ADIOI_TESTFS_IwriteContig(ADIO_File fd, const void *buf, int count, MPI_Type_size_x(datatype, &typesize); MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteContig called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteContig\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteContig called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteContig\n", myrank, nprocs); len = count * typesize; - ADIOI_TESTFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, - offset, &status, error_code); + ADIOI_TESTFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset, &status, error_code); MPIO_Completed_request_create(&fd, len, error_code, request); } void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int - *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code) { ADIO_Status status; int myrank, nprocs; @@ -56,13 +52,11 @@ void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, const void *buf, int count, MPI_Comm_rank(fd->comm, &myrank); MPI_Type_size_x(datatype, &typesize); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteStrided called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteStrided\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteStrided called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteStrided\n", myrank, nprocs); - ADIOI_TESTFS_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - MPIO_Completed_request_create(&fd, count*typesize, error_code, request); + ADIOI_TESTFS_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + MPIO_Completed_request_create(&fd, count * typesize, error_code, request); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_open.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_open.c similarity index 62% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_open.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_open.c index 6b1595b99caf7c91362b8ad5cbe735423bbecf5b..fc2cbab81d4211c4a49f1e0e57be3a63ac54c3bc 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_open.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_open.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -18,6 +16,5 @@ void ADIOI_TESTFS_Open(ADIO_File fd, int *error_code) MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Open called on %s\n", myrank, - nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Open called on %s\n", myrank, nprocs, fd->filename); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_rdcoll.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_rdcoll.c similarity index 51% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_rdcoll.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_rdcoll.c index 5df94458fdd11361b1bb8efdd14914995646054a..6df8d2ad275d068a279d54bf5fa46f1b94e73b1b 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_rdcoll.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_rdcoll.c @@ -1,17 +1,14 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" #include "adioi.h" void ADIOI_TESTFS_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) { int myrank, nprocs; @@ -19,11 +16,9 @@ void ADIOI_TESTFS_ReadStridedColl(ADIO_File fd, void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadStridedColl called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStridedColl\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadStridedColl called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStridedColl\n", myrank, nprocs); - ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); + ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_read.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_read.c similarity index 51% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_read.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_read.c index f60a9920f761a198e64fa90d8066c3d5bca6a031..eea5d528a07ee2d046aa9fdda8a3dd14ca1ba8e8 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_read.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_read.c @@ -1,16 +1,15 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" #include "adioi.h" -void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) +void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) { int myrank, nprocs; MPI_Count datatype_size; @@ -20,21 +19,17 @@ void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); MPI_Type_size_x(datatype, &datatype_size); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadContig called on %s\n", myrank, - nprocs, fd->filename); - if (file_ptr_type != ADIO_EXPLICIT_OFFSET) - { - offset = fd->fp_ind; - fd->fp_ind += datatype_size * count; - fd->fp_sys_posn = fd->fp_ind; - } - else { - fd->fp_sys_posn = offset + datatype_size * count; + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadContig called on %s\n", myrank, nprocs, fd->filename); + if (file_ptr_type != ADIO_EXPLICIT_OFFSET) { + offset = fd->fp_ind; + fd->fp_ind += datatype_size * count; + fd->fp_sys_posn = fd->fp_ind; + } else { + fd->fp_sys_posn = offset + datatype_size * count; } FPRINTF(stdout, "[%d/%d] reading (buf = %p, loc = %lld, sz = %lld)\n", - myrank, nprocs, buf, (long long) offset, - (long long) datatype_size * count); + myrank, nprocs, buf, (long long) offset, (long long) datatype_size * count); #ifdef HAVE_STATUS_SET_BYTES MPIR_Status_set_bytes(status, datatype, datatype_size * count); @@ -42,9 +37,9 @@ void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, } void ADIOI_TESTFS_ReadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) { int myrank, nprocs; @@ -52,11 +47,9 @@ void ADIOI_TESTFS_ReadStrided(ADIO_File fd, void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadStrided called on %s\n", myrank, - nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStrided\n", myrank, - nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadStrided called on %s\n", myrank, + nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStrided\n", myrank, nprocs); - ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, - status, error_code); + ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_resize.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_resize.c similarity index 60% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_resize.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_resize.c index a4a37eb94bbe6edc2360bd15de851f982eba8d8c..d944c985a3d932ae0e0b40b33328bc6237074ff8 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_resize.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_resize.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" @@ -16,6 +14,5 @@ void ADIOI_TESTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Resize called on %s\n", - myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Resize called on %s\n", myrank, nprocs, fd->filename); } diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs_seek.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_seek.c new file mode 100644 index 0000000000000000000000000000000000000000..99a6f6bf21977f6f3407d63a8caaf341b27a9128 --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_seek.c @@ -0,0 +1,80 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" +#include "adioi.h" +#include "adio_extern.h" + +/* ADIOI_TESTFS_SeekIndividual() + * + * Implements SEEK_SET only (and doesn't test for whence type); all + * other types of whence must be converted before calling this. + * + * Returns an absolute offset in bytes. The offset passed into the call is in + * terms of the etype relative to the filetype, so some calculations are + * necessary. + */ +ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, + int whence, int *error_code) +{ + int myrank, nprocs; + + ADIO_Offset off; + ADIOI_Flatlist_node *flat_file; + int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0, sum; + int size_in_filetype; + int filetype_is_contig; + MPI_Count filetype_size; + MPI_Aint etype_size, lb, filetype_extent; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_SeekIndividual called on %s\n", + myrank, nprocs, fd->filename); + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + etype_size = fd->etype_size; + + if (filetype_is_contig) + off = fd->disp + etype_size * offset; + else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { + *error_code = MPI_SUCCESS; + return 0; + } + + n_etypes_in_filetype = filetype_size / etype_size; + ADIOI_Assert((offset / n_etypes_in_filetype) == (int) (offset / n_etypes_in_filetype)); + n_filetypes = (int) (offset / n_etypes_in_filetype); + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + + if (sum > size_in_filetype) { + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + off = fd->disp + (ADIO_Offset) n_filetypes *(ADIO_Offset) filetype_extent + + abs_off_in_filetype; + } + + fd->fp_ind = off; + + return off; +} diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_setsh.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_setsh.c similarity index 56% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_setsh.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_setsh.c index 6fc8a04be9fd59083b4e8c36c9cdedecc1a02b5d..019f168f5f98491be5133ca5f11b440aafbd5357 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_setsh.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_setsh.c @@ -1,15 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" #include "adioi.h" -void ADIOI_TESTFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, - int *error_code) +void ADIOI_TESTFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) { int myrank, nprocs; @@ -17,6 +14,6 @@ void ADIOI_TESTFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Set_shared_fp called on %s\n", - myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Set_shared_fp called on %s\n", + myrank, nprocs, fd->filename); } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_wait.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_wait.c similarity index 57% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_wait.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_wait.c index 6eef9ef70603426c39f11c2c3b03efde42034b09..907d895750859686b3a8a5f237f33db50e1891b7 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_wait.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_wait.c @@ -1,15 +1,13 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" #include "adioi.h" -void ADIOI_TESTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code) +void ADIOI_TESTFS_ReadComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code) { int myrank, nprocs; @@ -17,14 +15,13 @@ void ADIOI_TESTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadComplete called \n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadComplete called \n", myrank, nprocs); /* do something with status set bytes? */ } -void ADIOI_TESTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code) +void ADIOI_TESTFS_WriteComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code) { int myrank, nprocs; @@ -32,8 +29,7 @@ void ADIOI_TESTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteComplete called\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteComplete called\n", myrank, nprocs); /* do something with status_set_bytes? */ } diff --git a/3rd-party/romio321/adio/ad_testfs/ad_testfs_wrcoll.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_wrcoll.c similarity index 52% rename from 3rd-party/romio321/adio/ad_testfs/ad_testfs_wrcoll.c rename to 3rd-party/romio341/adio/ad_testfs/ad_testfs_wrcoll.c index ac11f5847f3f3ff65f6b07fe037282a8de2f6af7..bd4c7b8673e6e97eff936ac1c529d11ee140c263 100644 --- a/3rd-party/romio321/adio/ad_testfs/ad_testfs_wrcoll.c +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_wrcoll.c @@ -1,17 +1,14 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "ad_testfs.h" #include "adioi.h" void ADIOI_TESTFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, - int *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) { int myrank, nprocs; @@ -19,11 +16,9 @@ void ADIOI_TESTFS_WriteStridedColl(ADIO_File fd, const void *buf, int count, MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteStridedColl called on %s\n", - myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_WriteStridedColl\n", - myrank, nprocs); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteStridedColl called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_WriteStridedColl\n", myrank, nprocs); - ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); + ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); } diff --git a/3rd-party/romio341/adio/ad_testfs/ad_testfs_write.c b/3rd-party/romio341/adio/ad_testfs/ad_testfs_write.c new file mode 100644 index 0000000000000000000000000000000000000000..dbf8d7673c7d7c1d53683d32ad5da2ae3435ea53 --- /dev/null +++ b/3rd-party/romio341/adio/ad_testfs/ad_testfs_write.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_testfs.h" +#include "adioi.h" + +void ADIOI_TESTFS_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + int myrank, nprocs; + MPI_Count datatype_size; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + MPI_Type_size_x(datatype, &datatype_size); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteContig called on %s\n", myrank, + nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] writing (buf = %p, loc = %lld, sz = %lld)\n", + myrank, nprocs, buf, (long long) offset, (long long) datatype_size * (long long) count); + + if (file_ptr_type != ADIO_EXPLICIT_OFFSET) { + fd->fp_ind += datatype_size * count; + fd->fp_sys_posn = fd->fp_ind; + FPRINTF(stdout, "[%d/%d] new file position is %lld\n", myrank, + nprocs, (long long) fd->fp_ind); + } else { + fd->fp_sys_posn = offset + datatype_size * count; + } + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, datatype_size * count); +#endif +} + +void ADIOI_TESTFS_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteStrided called on %s\n", + myrank, nprocs, fd->filename); + FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_WriteStrided\n", myrank, nprocs); + + ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); +} diff --git a/3rd-party/romio321/adio/ad_ufs/Makefile.mk b/3rd-party/romio341/adio/ad_ufs/Makefile.mk similarity index 55% rename from 3rd-party/romio321/adio/ad_ufs/Makefile.mk rename to 3rd-party/romio341/adio/ad_ufs/Makefile.mk index 40ecdb4ae4e6dd446262b305410a79ce1ccf2ef2..1a7732c2c28899a343751a1cfa5ed1a5a1a9c70e 100644 --- a/3rd-party/romio321/adio/ad_ufs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_ufs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_UFS @@ -14,4 +12,3 @@ romio_other_sources += \ adio/ad_ufs/ad_ufs_open.c endif BUILD_AD_UFS - diff --git a/3rd-party/romio341/adio/ad_ufs/ad_ufs.c b/3rd-party/romio341/adio/ad_ufs/ad_ufs.c new file mode 100644 index 0000000000000000000000000000000000000000..aac86d0b41f8bc4558afeb7f465971da3965b6d8 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ufs/ad_ufs.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ufs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_UFS_operations = { + ADIOI_UFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_GEN_ReadContig, /* ReadContig */ + ADIOI_GEN_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ + ADIOI_GEN_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Flush, /* Flush */ + ADIOI_GEN_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ + "UFS: Generic ROMIO driver for all UNIX-like file systems", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_ufs/ad_ufs.h b/3rd-party/romio341/adio/ad_ufs/ad_ufs.h new file mode 100644 index 0000000000000000000000000000000000000000..bc58b3d399ffd0d261bf8d170ba4077dfaf51714 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ufs/ad_ufs.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_UFS_H_INCLUDED +#define AD_UFS_H_INCLUDED + +#include "adio.h" +#include <unistd.h> +#include <sys/types.h> +#include <fcntl.h> + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_AIO_LITE_H +#include <aio-lite.h> +#else +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif +#endif + +/* Workaround for incomplete set of definitions if __REDIRECT is not + defined and large file support is used in aio.h */ +#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) +#define aiocb aiocb64 +#endif + +int ADIOI_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, int wr, void *handle); + +void ADIOI_UFS_Open(ADIO_File fd, int *error_code); +void ADIOI_UFS_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_UFS_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +int ADIOI_UFS_ReadDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +int ADIOI_UFS_WriteDone(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_UFS_ReadComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIOI_UFS_WriteComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIOI_UFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); + +#endif /* AD_UFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_ufs/ad_ufs_open.c b/3rd-party/romio341/adio/ad_ufs/ad_ufs_open.c new file mode 100644 index 0000000000000000000000000000000000000000..218cc9e6d0c3f05f4e6c300366f078ceee351455 --- /dev/null +++ b/3rd-party/romio341/adio/ad_ufs/ad_ufs_open.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_ufs.h" + +void ADIOI_UFS_Open(ADIO_File fd, int *error_code) +{ + int perm, old_mask, amode; + static char myname[] = "ADIOI_UFS_OPEN"; + + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); +#endif + fd->fd_sys = open(fd->filename, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + fd->fd_direct = -1; + + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + } + + if (fd->fd_sys == -1) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/ad_xfs/Makefile.mk b/3rd-party/romio341/adio/ad_xfs/Makefile.mk similarity index 71% rename from 3rd-party/romio321/adio/ad_xfs/Makefile.mk rename to 3rd-party/romio341/adio/ad_xfs/Makefile.mk index 9a2d7078a3ef98d7f2163ed8a2d0aac8933a46a1..7bd4c48750e2cb14be437be1103f99c4ac8465fe 100644 --- a/3rd-party/romio321/adio/ad_xfs/Makefile.mk +++ b/3rd-party/romio341/adio/ad_xfs/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_AD_XFS @@ -19,4 +17,3 @@ romio_other_sources += \ adio/ad_xfs/ad_xfs_write.c endif BUILD_AD_XFS - diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs.c new file mode 100644 index 0000000000000000000000000000000000000000..746ad2e38435c572e732e3e909a8def994fcd2e5 --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_XFS_operations = { + ADIOI_XFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_XFS_ReadContig, /* ReadContig */ + ADIOI_XFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_XFS_Fcntl, /* Fcntl */ + ADIOI_XFS_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_GEN_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ +#if defined(ROMIO_HAVE_WORKING_AIO) + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif /* ROMIO_HAVE_WORKING_AIO */ + ADIOI_GEN_IODone, /* ReadDone */ + ADIOI_GEN_IODone, /* WriteDone */ + ADIOI_GEN_IOComplete, /* ReadComplete */ + ADIOI_GEN_IOComplete, /* WriteComplete */ + ADIOI_GEN_IreadStrided, /* IreadStrided */ + ADIOI_GEN_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Flush, /* Flush */ + ADIOI_XFS_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ + "XFS: SGI XFS", + ADIOI_GEN_IreadStridedColl, /* IreadStridedColl */ + ADIOI_GEN_IwriteStridedColl, /* IwriteStridedColl */ +#if defined(F_SETLKW64) + ADIOI_GEN_SetLock /* SetLock */ +#else + ADIOI_GEN_SetLock64 /* SetLock */ +#endif +}; diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs.h b/3rd-party/romio341/adio/ad_xfs/ad_xfs.h new file mode 100644 index 0000000000000000000000000000000000000000..f37028ea2cebc6a0f78f7e62b9cd6fe7bdfd693e --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef AD_XFS_H_INCLUDED +#define AD_XFS_H_INCLUDED + +#include "adio.h" +#include <unistd.h> +#include <sys/types.h> +#include <fcntl.h> + +#if defined(MPISGI) +#include "xfs/xfs_fs.h" +#ifndef __USE_LARGEFILE64 +#define __USE_LARGEFILE64 +#endif +typedef struct aiocb64 aiocb64_t; +#endif + +void ADIOI_XFS_Open(ADIO_File fd, int *error_code); +void ADIOI_XFS_Close(ADIO_File fd, int *error_code); +void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); +void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +#endif /* AD_XFS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_fcntl.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..91146a11d339b0f690dba1ec01ea341dd045c017 --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_fcntl.c @@ -0,0 +1,80 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" +#include "adio_extern.h" +#include <sys/ioctl.h> + +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + +void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + int i, err; +#if defined(LINUX) && defined(MPISGI) + struct xfs_flock64 fl; +#else + struct flock64 fl; +#endif + static char myname[] = "ADIOI_XFS_FCNTL"; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END); + if (fcntl_struct->fsize == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + i = 0; + fl.l_start = 0; + fl.l_whence = SEEK_SET; + fl.l_len = fcntl_struct->diskspace; + +#if defined(LINUX) && defined(MPISGI) + err = ioctl(fd->fd_sys, XFS_IOC_RESVSP64, &fl); +#else + err = fcntl(fd->fd_sys, F_RESVSP64, &fl); +#endif + + if (err) + i = 1; + if (fcntl_struct->diskspace > lseek64(fd->fd_sys, 0, SEEK_END)) { + /* also need to set the file size */ + err = ftruncate64(fd->fd_sys, fcntl_struct->diskspace); + if (err) + i = 1; + } + + if (i == 1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + return; + /* --END ERROR HANDLING-- */ + } +} diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_hints.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..a9ab6fedd678837e199bd0db2a3759fa5d06cfec --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_hints.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" +#include "adio_extern.h" + +static unsigned xfs_direct_read_chunk_size; +static unsigned xfs_direct_write_chunk_size; + +void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value, *c; + int flag; + static char xfs_initialized = 0; + + if (fd->info == MPI_INFO_NULL) + MPI_Info_create(&(fd->info)); + + ADIOI_Info_set(fd->info, "direct_read", "false"); + ADIOI_Info_set(fd->info, "direct_write", "false"); + fd->direct_read = fd->direct_write = 0; + + if (!xfs_initialized) { + xfs_initialized = 1; + c = getenv("MPIO_DIRECT_READ_CHUNK_SIZE"); + if (c) { + int io; + io = atoi(c); + if (io <= 0) { + fprintf(stderr, + "MPI: Ignoring an invalid setting for MPIO_DIRECT_READ_CHUNK_SIZE.\n" + " It must be set to a positive integer value.\n"); + } else { + xfs_direct_read_chunk_size = io; + } + } else { + xfs_direct_read_chunk_size = 0; + } + + c = getenv("MPIO_DIRECT_WRITE_CHUNK_SIZE"); + if (c) { + int io; + io = atoi(c); + if (io <= 0) { + fprintf(stderr, + "MPI: Ignoring an invalid setting for MPIO_DIRECT_WRITE_CHUNK_SIZE.\n" + " It must be set to a positive integer value.\n"); + } else { + xfs_direct_write_chunk_size = io; + } + } else { + xfs_direct_write_chunk_size = 0; + } + } + + if (!fd->hints->initialized) { + fd->hints->fs_hints.xfs.read_chunk_sz = xfs_direct_read_chunk_size; + fd->hints->fs_hints.xfs.write_chunk_sz = xfs_direct_write_chunk_size; + } + + /* has user specified values for keys "direct_read" and "direct write"? */ + if (users_info != MPI_INFO_NULL) { + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + + ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, value, &flag); + if (flag && !strcmp(value, "true")) { + ADIOI_Info_set(fd->info, "direct_read", "true"); + fd->direct_read = 1; + } + + ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, value, &flag); + if (flag && !strcmp(value, "true")) { + ADIOI_Info_set(fd->info, "direct_write", "true"); + fd->direct_write = 1; + } + + ADIOI_Free(value); + } + + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + /* Environment variables override MPI_Info hints */ + if (ADIOI_Direct_read) + fd->direct_read = 1; + if (ADIOI_Direct_write) + fd->direct_write = 1; + + /* environment variables checked in ADIO_Init */ + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_open.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_open.c new file mode 100644 index 0000000000000000000000000000000000000000..7862269e14d9278c1fb491c2f3bbdc1bc4a41ffb --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_open.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#define _GNU_SOURCE // for O_DIRECT + +#include "ad_xfs.h" +#include <sys/ioctl.h> +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + +void ADIOI_XFS_Open(ADIO_File fd, int *error_code) +{ + int perm, amode, amode_direct, factor; + unsigned int old_mask; + struct dioattr st; + static char myname[] = "ADIOI_XFS_OPEN"; + unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; + unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; + + if (fd->perm == ADIO_PERM_NULL) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } else + perm = fd->perm; + + amode = 0; + if (fd->access_mode & ADIO_CREATE) + amode = amode | O_CREAT; + if (fd->access_mode & ADIO_RDONLY) + amode = amode | O_RDONLY; + if (fd->access_mode & ADIO_WRONLY) + amode = amode | O_WRONLY; + if (fd->access_mode & ADIO_RDWR) + amode = amode | O_RDWR; + + amode_direct = amode | O_DIRECT; + + if (fd->access_mode & ADIO_EXCL) + amode = amode | O_EXCL; + + fd->fd_sys = open(fd->filename, amode, perm); + + fd->fd_direct = open(fd->filename, amode_direct, perm); + if (fd->fd_direct != -1) { + +#if defined(MPISGI) + ioctl(fd->fd_direct, XFS_IOC_DIOINFO, &st); +#else + fcntl(fd->fd_direct, F_DIOINFO, &st); +#endif + + fd->d_mem = st.d_mem; + fd->d_miniosz = st.d_miniosz; + + if (read_chunk_sz == 0) { + fd->hints->fs_hints.xfs.read_chunk_sz = st.d_maxiosz; + } else { + /* + * MPIO_DIRECT_READ_CHUNK_SIZE was set. + * Make read_chunk_sz a multiple of d_miniosz. + */ + factor = read_chunk_sz / fd->d_miniosz; + if (factor == 0 || read_chunk_sz != fd->d_miniosz * factor) { + fd->hints->fs_hints.xfs.read_chunk_sz = fd->d_miniosz * (factor + 1); + } + } + + if (write_chunk_sz == 0) { + fd->hints->fs_hints.xfs.write_chunk_sz = st.d_maxiosz; + } else { + /* + * MPIO_DIRECT_WRITE_CHUNK_SIZE was set. + * Make write_chunk_sz a multiple of d_miniosz. + */ + factor = write_chunk_sz / fd->d_miniosz; + if (factor == 0 || write_chunk_sz != fd->d_miniosz * factor) { + fd->hints->fs_hints.xfs.write_chunk_sz = fd->d_miniosz * (factor + 1); + } + } + + if (fd->d_mem > XFS_MEMALIGN) { + FPRINTF(stderr, + "MPI: Run-time Direct-IO memory alignment, %d, does not match compile-time value, %d.\n", + fd->d_mem, XFS_MEMALIGN); + FPRINTF(stderr, "MPI: Report this error and rerun with Direct-IO disabled.\n"); + close(fd->fd_direct); + fd->fd_direct = -1; + } + } + + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + fd->fp_ind = lseek64(fd->fd_sys, 0, SEEK_END); + + fd->fp_sys_posn = -1; /* set it to null because we use pread/pwrite */ + + if ((fd->fd_sys == -1) || (fd->fd_direct == -1)) { + *error_code = ADIOI_Err_create_code(mymame, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_read.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_read.c new file mode 100644 index 0000000000000000000000000000000000000000..efe5f38e98536941ad6f4b0a32eec0efbdf6a21f --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_read.c @@ -0,0 +1,157 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif + +/* style: allow:free:2 sig:0 */ + +static void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, + ADIO_Offset offset, int *err); + +void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + int diff, size, nbytes; + MPI_Count err = -1, datatype_size, len; + void *newbuf; + static char myname[] = "ADIOI_XFS_READCONTIG"; + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + fd->fp_sys_posn = -1; /* set it to null, since we are using pread */ + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + + if (!(fd->direct_read)) /* direct I/O not enabled */ + err = pread(fd->fd_sys, buf, len, offset); + else { /* direct I/O enabled */ + + /* (1) if mem_aligned && file_aligned + * use direct I/O to read up to correct io_size + * use buffered I/O for remaining */ + + if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) + ADIOI_XFS_Aligned_Mem_File_Read(fd, buf, len, offset, &err); + + /* (2) if !file_aligned + * use buffered I/O to read up to file_aligned + * At that point, if still mem_aligned, use (1) + * else copy into aligned buf and then use (1) */ + else if (offset % fd->d_miniosz) { + diff = fd->d_miniosz - (offset % fd->d_miniosz); + diff = MPL_MIN(diff, len); + nbytes = pread(fd->fd_sys, buf, diff, offset); + + buf = ((char *) buf) + diff; + offset += diff; + size = len - diff; + if (!(((long) buf) % fd->d_mem)) { + ADIOI_XFS_Aligned_Mem_File_Read(fd, buf, size, offset, &err); + nbytes += err; + } else { + newbuf = (void *) memalign(XFS_MEMALIGN, size); + if (newbuf) { + ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); + if (err > 0) + memcpy(buf, newbuf, err); + nbytes += err; + ADIOI_Free(newbuf); + } else + nbytes += pread(fd->fd_sys, buf, size, offset); + } + err = nbytes; + } + + /* (3) if !mem_aligned && file_aligned + * copy into aligned buf, then use (1) */ + else { + newbuf = (void *) memalign(XFS_MEMALIGN, len); + if (newbuf) { + ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, len, offset, &err); + if (err > 0) + memcpy(buf, newbuf, err); + ADIOI_Free(newbuf); + } else + err = pread(fd->fd_sys, buf, len, offset); + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += err; + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, err); +#endif + + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} + + +void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, ADIO_Offset offset, int *err) +{ + int ntimes, rem, newrem, i, size, nbytes; + unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; + + /* memory buffer is aligned, offset in file is aligned, + * io_size may or may not be of the right size. + * use direct I/O to read up to correct io_size, + * use buffered I/O for remaining. */ + + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz) && (len <= read_chunk_sz)) + *err = pread(fd->fd_direct, buf, len, offset); + else if (len < fd->d_miniosz) + *err = pread(fd->fd_sys, buf, len, offset); + else if (len > read_chunk_sz) { + ntimes = len / (read_chunk_sz); + rem = len - ntimes * read_chunk_sz; + nbytes = 0; + for (i = 0; i < ntimes; i++) { + nbytes += pread(fd->fd_direct, ((char *) buf) + i * read_chunk_sz, + read_chunk_sz, offset); + offset += read_chunk_sz; + } + if (rem) { + if (!(rem % fd->d_miniosz)) + nbytes += pread(fd->fd_direct, + ((char *) buf) + ntimes * read_chunk_sz, rem, offset); + else { + newrem = rem % fd->d_miniosz; + size = rem - newrem; + if (size) { + nbytes += pread(fd->fd_direct, + ((char *) buf) + ntimes * read_chunk_sz, size, offset); + offset += size; + } + nbytes += pread(fd->fd_sys, + ((char *) buf) + ntimes * read_chunk_sz + size, newrem, offset); + } + } + *err = nbytes; + } else { + rem = len % fd->d_miniosz; + size = len - rem; + nbytes = pread(fd->fd_direct, buf, size, offset); + nbytes += pread(fd->fd_sys, (char *) buf + size, rem, offset + size); + *err = nbytes; + } +} diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_resize.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_resize.c new file mode 100644 index 0000000000000000000000000000000000000000..7f674b532574ea50084b5e4f8d7b35c8ea7b35a0 --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_resize.c @@ -0,0 +1,20 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" + +void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int err; + static char myname[] = "ADIOI_XFS_RESIZE"; + + err = ftruncate64(fd->fd_sys, size); + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/ad_xfs/ad_xfs_write.c b/3rd-party/romio341/adio/ad_xfs/ad_xfs_write.c new file mode 100644 index 0000000000000000000000000000000000000000..9198c831a37169e0316f10573b50bee5e4078b7a --- /dev/null +++ b/3rd-party/romio341/adio/ad_xfs/ad_xfs_write.c @@ -0,0 +1,204 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "ad_xfs.h" + +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif + +/* style: allow:free:2 sig:0 */ + +static int ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, + ADIO_Offset len, ADIO_Offset offset); + +void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + int diff, size; + MPI_Count err = -1, datatype_size; + ssize_t len; + void *newbuf; + static char myname[] = "ADIOI_XFS_WRITECONTIG"; + + if (count == 0) { + err = 0; + len = 0; + goto leaving; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * count; + + fd->fp_sys_posn = -1; /* set it to null, since we are using pwrite */ + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + + if (!(fd->direct_write)) { /* direct I/O not enabled */ + err = pwrite(fd->fd_sys, buf, len, offset); + if (err < 0) { + goto leaving; + } + } else { /* direct I/O enabled */ + + /* (1) if mem_aligned && file_aligned + * use direct I/O to write up to correct io_size + * use buffered I/O for remaining */ + + if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) { + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, len, offset); + if (err < 0) { + goto leaving; + } + + /* (2) if !file_aligned + * use buffered I/O to write up to file_aligned + * At that point, if still mem_aligned, use (1) + * else copy into aligned buf and then use (1) */ + } else if (offset % fd->d_miniosz) { + diff = fd->d_miniosz - (offset % fd->d_miniosz); + diff = MPL_MIN(diff, len); + err = pwrite(fd->fd_sys, buf, diff, offset); + if (err < 0) { + goto leaving; + } + + buf = ((char *) buf) + diff; + offset += diff; + size = len - diff; + if (!(((long) buf) % fd->d_mem)) { + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, size, offset); + if (err < 0) { + goto leaving; + } + } else { + newbuf = (void *) memalign(XFS_MEMALIGN, size); + if (newbuf) { + memcpy(newbuf, buf, size); + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, size, offset); + ADIOI_Free(newbuf); + if (err < 0) { + goto leaving; + } + } else { + err = pwrite(fd->fd_sys, buf, size, offset); + if (err < 0) { + goto leaving; + } + } + } + } + + /* (3) if !mem_aligned && file_aligned + * copy into aligned buf, then use (1) */ + else { + newbuf = (void *) memalign(XFS_MEMALIGN, len); + if (newbuf) { + memcpy(newbuf, buf, len); + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, len, offset); + ADIOI_Free(newbuf); + } else { + err = pwrite(fd->fd_sys, buf, len, offset); + } + + if (err < 0) { + goto leaving; + } + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + leaving: +#ifdef HAVE_STATUS_SET_BYTES + if (status && err != -1) + MPIR_Status_set_bytes(status, datatype, len); +#endif + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; +} + + +static int +ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, ADIO_Offset len, ADIO_Offset offset) +{ + unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; + ADIO_Offset nbytes, rem, newrem, size; + int ntimes, i; + + /* memory buffer is aligned, offset in file is aligned, + * io_size may or may not be of the right size. + * use direct I/O to write up to correct io_size, + * use buffered I/O for remaining. */ + + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz) && (len <= write_chunk_sz)) { + nbytes = pwrite(fd->fd_direct, buf, len, offset); + if (nbytes < 0) { + return -1; + } + } else if (len < fd->d_miniosz) { + nbytes = pwrite(fd->fd_sys, buf, len, offset); + if (nbytes < 0) { + return -1; + } + } else if (len > write_chunk_sz) { + ntimes = len / (write_chunk_sz); + rem = len - ntimes * write_chunk_sz; + nbytes = 0; + for (i = 0; i < ntimes; i++) { + nbytes = pwrite(fd->fd_direct, ((char *) buf) + i * write_chunk_sz, + write_chunk_sz, offset); + offset += write_chunk_sz; + if (nbytes < 0) { + return -1; + } + } + if (rem) { + if (!(rem % fd->d_miniosz)) { + nbytes = pwrite(fd->fd_direct, + ((char *) buf) + ntimes * write_chunk_sz, rem, offset); + if (nbytes < 0) { + return -1; + } + } else { + newrem = rem % fd->d_miniosz; + size = rem - newrem; + if (size) { + nbytes = pwrite(fd->fd_direct, + ((char *) buf) + ntimes * write_chunk_sz, size, offset); + offset += size; + if (nbytes < 0) { + return -1; + } + } + nbytes = pwrite(fd->fd_sys, + ((char *) buf) + ntimes * write_chunk_sz + size, newrem, offset); + if (nbytes < 0) { + return -1; + } + } + } + } else { + rem = len % fd->d_miniosz; + size = len - rem; + nbytes = pwrite(fd->fd_direct, buf, size, offset); + if (nbytes < 0) { + return -1; + } + nbytes = pwrite(fd->fd_sys, (char *) buf + size, rem, offset + size); + if (nbytes < 0) { + return -1; + } + } + + return 0; +} diff --git a/3rd-party/romio321/adio/common/Makefile.mk b/3rd-party/romio341/adio/common/Makefile.mk similarity index 92% rename from 3rd-party/romio321/adio/common/Makefile.mk rename to 3rd-party/romio341/adio/common/Makefile.mk index 80194efe48364d83bb84af1feb7cc3bf33e385d8..47ee40dba04621a249ddc61f472a869586cf6966 100644 --- a/3rd-party/romio321/adio/common/Makefile.mk +++ b/3rd-party/romio341/adio/common/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## romio_other_sources += \ @@ -60,9 +58,10 @@ romio_other_sources += \ adio/common/flatten.c \ adio/common/get_fp_posn.c \ adio/common/greq_fns.c \ - adio/common/heap-sort.c \ + adio/common/heap_sort.c \ adio/common/iscontig.c \ adio/common/lock.c \ + adio/common/lock_internal.c \ adio/common/malloc.c \ adio/common/shfp_fname.c \ adio/common/status_setb.c \ @@ -72,5 +71,5 @@ romio_other_sources += \ adio/common/ad_threaded_io.c \ adio/common/p2p_aggregation.c \ adio/common/onesided_aggregation.c \ + adio/common/ad_tuning.c \ adio/common/utils.c - diff --git a/3rd-party/romio341/adio/common/ad_aggregate.c b/3rd-party/romio341/adio/common/ad_aggregate.c new file mode 100644 index 0000000000000000000000000000000000000000..a56200ec5fa664a0ad8ab907c557e0e1bb62b496 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_aggregate.c @@ -0,0 +1,657 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +#undef AGG_DEBUG + +/* This file contains four functions: + * + * ADIOI_Calc_aggregator() + * ADIOI_Calc_file_domains() + * ADIOI_Calc_my_req() + * ADIOI_Calc_others_req() + * + * The last three of these were originally in ad_read_coll.c, but they are + * also shared with ad_write_coll.c. I felt that they were better kept with + * the rest of the shared aggregation code. + */ + +/* Discussion of values available from above: + * + * ADIO_Offset st_offsets[0..nprocs-1] + * ADIO_Offset end_offsets[0..nprocs-1] + * These contain a list of start and end offsets for each process in + * the communicator. For example, an access at loc 10, size 10 would + * have a start offset of 10 and end offset of 19. + * int nprocs + * number of processors in the collective I/O communicator + * ADIO_Offset min_st_offset + * ADIO_Offset fd_start[0..nprocs_for_coll-1] + * starting location of "file domain"; region that a given process will + * perform aggregation for (i.e. actually do I/O) + * ADIO_Offset fd_end[0..nprocs_for_coll-1] + * start + size - 1 roughly, but it can be less, or 0, in the case of + * uneven distributions + */ + +/* ADIOI_Calc_aggregator() + * + * The intention here is to implement a function which provides basically + * the same functionality as in Rajeev's original version of + * ADIOI_Calc_my_req(). He used a ceiling division approach to assign the + * file domains, and we use the same approach here when calculating the + * location of an offset/len in a specific file domain. Further we assume + * this same distribution when calculating the rank_index, which is later + * used to map to a specific process rank in charge of the file domain. + * + * A better (i.e. more general) approach would be to use the list of file + * domains only. This would be slower in the case where the + * original ceiling division was used, but it would allow for arbitrary + * distributions of regions to aggregators. We'd need to know the + * nprocs_for_coll in that case though, which we don't have now. + * + * Note a significant difference between this function and Rajeev's old code: + * this code doesn't necessarily return a rank in the range + * 0..nprocs_for_coll; instead you get something in 0..nprocs. This is a + * result of the rank mapping; any set of ranks in the communicator could be + * used now. + * + * Returns an integer representing a rank in the collective I/O communicator. + * + * The "len" parameter is also modified to indicate the amount of data + * actually available in this file domain. + */ +int ADIOI_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset * len, + ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end) +{ + int rank_index, rank; + ADIO_Offset avail_bytes; + + MPL_UNREFERENCED_ARG(fd_start); + + /* get an index into our array of aggregators */ + rank_index = (int) ((off - min_off + fd_size) / fd_size - 1); + + if (fd->hints->striping_unit > 0) { + /* wkliao: implementation for file domain alignment + * fd_start[] and fd_end[] have been aligned with file lock + * boundaries when returned from ADIOI_Calc_file_domains() so cannot + * just use simple arithmatic as above */ + rank_index = 0; + while (off > fd_end[rank_index]) + rank_index++; + } + + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort */ + if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { + FPRINTF(stderr, + "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", + rank_index, fd->hints->cb_nodes, (long long) fd_size, (long long) off); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + /* remember here that even in Rajeev's original code it was the case that + * different aggregators could end up with different amounts of data to + * aggregate. here we use fd_end[] to make sure that we know how much + * data this aggregator is working with. + * + * the +1 is to take into account the end vs. length issue. + */ + avail_bytes = fd_end[rank_index] + 1 - off; + if (avail_bytes < *len) { + /* this file domain only has part of the requested contig. region */ + *len = avail_bytes; + } + + /* map our index to a rank */ + /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ + rank = fd->hints->ranklist[rank_index]; + + return rank; +} + +void ADIOI_Calc_file_domains(ADIO_Offset * st_offsets, ADIO_Offset + * end_offsets, int nprocs, int nprocs_for_coll, + ADIO_Offset * min_st_offset_ptr, + ADIO_Offset ** fd_start_ptr, ADIO_Offset + ** fd_end_ptr, int min_fd_size, + ADIO_Offset * fd_size_ptr, int striping_unit) +{ +/* Divide the I/O workload among "nprocs_for_coll" processes. This is + done by (logically) dividing the file into file domains (FDs); each + process may directly access only its own file domain. */ + + ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, fd_size; + int i; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5004, 0, NULL); +#endif + +#ifdef AGG_DEBUG + FPRINTF(stderr, "ADIOI_Calc_file_domains: %d aggregator(s)\n", nprocs_for_coll); +#endif + +/* find min of start offsets and max of end offsets of all processes */ + + min_st_offset = st_offsets[0]; + max_end_offset = end_offsets[0]; + + for (i = 1; i < nprocs; i++) { + min_st_offset = MPL_MIN(min_st_offset, st_offsets[i]); + max_end_offset = MPL_MAX(max_end_offset, end_offsets[i]); + } + +/* determine the "file domain (FD)" of each process, i.e., the portion of + the file that will be "owned" by each process */ + +/* partition the total file access range equally among nprocs_for_coll + processes */ + fd_size = ((max_end_offset - min_st_offset + 1) + nprocs_for_coll - 1) / nprocs_for_coll; + /* ceiling division as in HPF block distribution */ + + /* Tweak the file domains so that no fd is smaller than a threshold. We + * have to strike a balance between efficency and parallelism: somewhere + * between 10k processes sending 32-byte requests and one process sending a + * 320k request is a (system-dependent) sweet spot */ + + if (fd_size < min_fd_size) + fd_size = min_fd_size; + + *fd_start_ptr = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll * 2 * sizeof(ADIO_Offset)); + *fd_end_ptr = *fd_start_ptr + nprocs_for_coll; + + fd_start = *fd_start_ptr; + fd_end = *fd_end_ptr; + + /* Wei-keng Liao: implementation for fild domain alignment to nearest file + * lock boundary (as specified by striping_unit hint). Could also + * experiment with other alignment strategies here */ + if (striping_unit > 0) { + ADIO_Offset end_off; + int rem_front, rem_back; + + /* align fd_end[0] to the nearest file lock boundary */ + fd_start[0] = min_st_offset; + end_off = fd_start[0] + fd_size; + rem_front = end_off % striping_unit; + rem_back = striping_unit - rem_front; + if (rem_front < rem_back) + end_off -= rem_front; + else + end_off += rem_back; + fd_end[0] = end_off - 1; + + /* align fd_end[i] to the nearest file lock boundary */ + for (i = 1; i < nprocs_for_coll; i++) { + fd_start[i] = fd_end[i - 1] + 1; + end_off = min_st_offset + fd_size * (i + 1); + rem_front = end_off % striping_unit; + rem_back = striping_unit - rem_front; + if (rem_front < rem_back) + end_off -= rem_front; + else + end_off += rem_back; + fd_end[i] = end_off - 1; + } + fd_end[nprocs_for_coll - 1] = max_end_offset; + } else { /* no hints set: do things the 'old' way */ + fd_start[0] = min_st_offset; + fd_end[0] = min_st_offset + fd_size - 1; + + for (i = 1; i < nprocs_for_coll; i++) { + fd_start[i] = fd_end[i - 1] + 1; + fd_end[i] = fd_start[i] + fd_size - 1; + } + } + +/* take care of cases in which the total file access range is not + divisible by the number of processes. In such cases, the last + process, or the last few processes, may have unequal load (even 0). + For example, a range of 97 divided among 16 processes. + Note that the division is ceiling division. */ + + for (i = 0; i < nprocs_for_coll; i++) { + if (fd_start[i] > max_end_offset) + fd_start[i] = fd_end[i] = -1; + if (fd_end[i] > max_end_offset) + fd_end[i] = max_end_offset; + } + + *fd_size_ptr = fd_size; + *min_st_offset_ptr = min_st_offset; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5005, 0, NULL); +#endif +} + + +/* ADIOI_Calc_my_req() - calculate what portions of the access requests + * of this process are located in the file domains of various processes + * (including this one) + */ +void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, ADIO_Offset * len_list, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr) +/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets? + They are used as memory buffer indices so it seems like the 2G limit is in effect */ +{ + int *count_my_req_per_proc, count_my_req_procs; + MPI_Aint *buf_idx; + int i, l, proc; + size_t memLen; + ADIO_Offset fd_len, rem_len, curr_idx, off, *ptr; + ADIOI_Access *my_req; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5024, 0, NULL); +#endif + + *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + count_my_req_per_proc = *count_my_req_per_proc_ptr; +/* count_my_req_per_proc[i] gives the no. of contig. requests of this + process in process i's file domain. calloc initializes to zero. + I'm allocating memory of size nprocs, so that I can do an + MPI_Alltoall later on.*/ + + buf_idx = (MPI_Aint *) ADIOI_Malloc(nprocs * sizeof(MPI_Aint)); +/* buf_idx is relevant only if buftype_is_contig. + buf_idx[i] gives the index into user_buf where data received + from proc. i should be placed. This allows receives to be done + without extra buffer. This can't be done if buftype is not contig. */ + + /* initialize buf_idx to -1 */ + for (i = 0; i < nprocs; i++) + buf_idx[i] = -1; + + /* one pass just to calculate how much space to allocate for my_req; + * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() + */ + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + fd_len = len_list[i]; + /* note: we set fd_len to be the total size of the access. then + * ADIOI_Calc_aggregator() will modify the value to return the + * amount that was available from the file domain that holds the + * first part of the access. + */ + proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, fd_start, fd_end); + count_my_req_per_proc[proc]++; + + /* figure out how much data is remaining in the access (i.e. wasn't + * part of the file domain that had the starting byte); we'll take + * care of this data (if there is any) in the while loop below. + */ + rem_len = len_list[i] - fd_len; + + while (rem_len != 0) { + off += fd_len; /* point to first remaining byte */ + fd_len = rem_len; /* save remaining size, pass to calc */ + proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + count_my_req_per_proc[proc]++; + rem_len -= fd_len; /* reduce remaining length by amount from fd */ + } + } + +/* now allocate space for my_req, offset, and len */ + + *my_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + my_req = *my_req_ptr; + + /* combine offsets and lens into a single regions so we can make one + * exchange instead of two later on. Over-allocate the 'offsets' array and + * make 'lens' point to the over-allocated part + */ + memLen = 0; + for (i = 0; i < nprocs; i++) + memLen += count_my_req_per_proc[i]; + ptr = (ADIO_Offset *) ADIOI_Malloc(memLen * 2 * sizeof(ADIO_Offset)); + my_req[0].offsets = ptr; + + count_my_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i]) { + my_req[i].offsets = ptr; + ptr += count_my_req_per_proc[i]; + my_req[i].lens = ptr; + ptr += count_my_req_per_proc[i]; + count_my_req_procs++; + } + my_req[i].count = 0; /* will be incremented where needed + * later */ + } + +/* now fill in my_req */ + curr_idx = 0; + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + fd_len = len_list[i]; + proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, fd_start, fd_end); + + /* for each separate contiguous access from this process */ + if (buf_idx[proc] == -1) { + ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx); + buf_idx[proc] = (MPI_Aint) curr_idx; + } + + l = my_req[proc].count; + curr_idx += fd_len; + + rem_len = len_list[i] - fd_len; + + /* store the proc, offset, and len information in an array + * of structures, my_req. Each structure contains the + * offsets and lengths located in that process's FD, + * and the associated count. + */ + my_req[proc].offsets[l] = off; + my_req[proc].lens[l] = fd_len; + my_req[proc].count++; + + while (rem_len != 0) { + off += fd_len; + fd_len = rem_len; + proc = ADIOI_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + if (buf_idx[proc] == -1) { + ADIOI_Assert(curr_idx == (MPI_Aint) curr_idx); + buf_idx[proc] = (MPI_Aint) curr_idx; + } + + l = my_req[proc].count; + curr_idx += fd_len; + rem_len -= fd_len; + + my_req[proc].offsets[l] = off; + my_req[proc].lens[l] = fd_len; + my_req[proc].count++; + } + } + +#ifdef AGG_DEBUG + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i] > 0) { + FPRINTF(stdout, "data needed from %d (count = %d):\n", i, my_req[i].count); + for (l = 0; l < my_req[i].count; l++) { + FPRINTF(stdout, " off[%d] = %lld, len[%d] = %d\n", l, + (long long) my_req[i].offsets[l], l, (long long) my_req[i].lens[l]); + } + FPRINTF(stdout, "buf_idx[%d] = 0x%x\n", i, buf_idx[i]); + } + } +#endif + + *count_my_req_procs_ptr = count_my_req_procs; + *buf_idx_ptr = buf_idx; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5025, 0, NULL); +#endif +} + + + +void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access * my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, ADIOI_Access ** others_req_ptr) +{ +/* determine what requests of other processes lie in this process's + file domain */ + +/* count_others_req_procs = number of processes whose requests lie in + this process's file domain (including this process itself) + count_others_req_per_proc[i] indicates how many separate contiguous + requests of proc. i lie in this process's file domain. */ + + int *count_others_req_per_proc, count_others_req_procs; + int i, j; + MPI_Request *requests; + ADIOI_Access *others_req; + size_t memLen; + ADIO_Offset *ptr; + MPI_Aint *mem_ptrs; + +/* first find out how much to send/recv and from/to whom */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5026, 0, NULL); +#endif + count_others_req_per_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + + MPI_Alltoall(count_my_req_per_proc, 1, MPI_INT, + count_others_req_per_proc, 1, MPI_INT, fd->comm); + + *others_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + others_req = *others_req_ptr; + + memLen = 0; + for (i = 0; i < nprocs; i++) + memLen += count_others_req_per_proc[i]; + ptr = (ADIO_Offset *) ADIOI_Malloc(memLen * 2 * sizeof(ADIO_Offset)); + mem_ptrs = (MPI_Aint *) ADIOI_Malloc(memLen * sizeof(MPI_Aint)); + others_req[0].offsets = ptr; + others_req[0].mem_ptrs = mem_ptrs; + + count_others_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_others_req_per_proc[i]) { + others_req[i].count = count_others_req_per_proc[i]; + others_req[i].offsets = ptr; + ptr += count_others_req_per_proc[i]; + others_req[i].lens = ptr; + ptr += count_others_req_per_proc[i]; + others_req[i].mem_ptrs = mem_ptrs; + mem_ptrs += count_others_req_per_proc[i]; + count_others_req_procs++; + } else + others_req[i].count = 0; + } + ADIOI_Free(count_others_req_per_proc); + +/* now send the calculated offsets and lengths to respective processes */ + + requests = (MPI_Request *) + ADIOI_Malloc(1 + (count_my_req_procs + count_others_req_procs) * sizeof(MPI_Request)); +/* +1 to avoid a 0-size malloc */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + MPI_Irecv(others_req[i].offsets, 2 * others_req[i].count, + ADIO_OFFSET, i, i + myrank, fd->comm, &requests[j++]); + } + } + + for (i = 0; i < nprocs; i++) { + if (my_req[i].count) { + MPI_Isend(my_req[i].offsets, 2 * my_req[i].count, + ADIO_OFFSET, i, i + myrank, fd->comm, &requests[j++]); + } + } + + if (j) { +#ifdef MPI_STATUSES_IGNORE + MPI_Waitall(j, requests, MPI_STATUSES_IGNORE); +#else + MPI_Status *statuses = (MPI_Status *) ADIOI_Malloc(j * sizeof(MPI_Status)); + MPI_Waitall(j, requests, statuses); + ADIOI_Free(statuses); +#endif + } + + ADIOI_Free(requests); + + *count_others_req_procs_ptr = count_others_req_procs; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5027, 0, NULL); +#endif +} + + +/* Nonblocking version of ADIOI_Calc_others_req(). + It consists of three functions - ADIOI_Icalc_others_req(), + ADIOI_Icalc_others_req_main(), and ADIOI_Icalc_others_req_fini(). */ +void ADIOI_Icalc_others_req(ADIOI_NBC_Request * nbc_req, int *error_code) +{ + ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; + + /* count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i lie in this process's file domain. */ + + /* first find out how much to send/recv and from/to whom */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5026, 0, NULL); +#endif + vars->count_others_req_per_proc = (int *) ADIOI_Malloc(vars->nprocs * sizeof(int)); + + *error_code = MPI_Ialltoall(vars->count_my_req_per_proc, 1, MPI_INT, + vars->count_others_req_per_proc, 1, MPI_INT, vars->fd->comm, + &vars->req1); + + if (nbc_req->rdwr == ADIOI_READ) { + nbc_req->data.rd.state = ADIOI_IRC_STATE_ICALC_OTHERS_REQ; + } else { + ADIOI_Assert(nbc_req->rdwr == ADIOI_WRITE); + nbc_req->data.wr.state = ADIOI_IWC_STATE_ICALC_OTHERS_REQ; + } +} + +void ADIOI_Icalc_others_req_main(ADIOI_NBC_Request * nbc_req, int *error_code) +{ + ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; + ADIO_File fd = vars->fd; + int count_my_req_procs = vars->count_my_req_procs; + ADIOI_Access *my_req = vars->my_req; + int nprocs = vars->nprocs; + int myrank = vars->myrank; + ADIOI_Access **others_req_ptr = vars->others_req_ptr; + + /* determine what requests of other processes lie in this process's + * file domain */ + + /* count_others_req_procs = number of processes whose requests lie in + * this process's file domain (including this process itself) + * count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i lie in this process's file domain. */ + + int *count_others_req_per_proc = vars->count_others_req_per_proc; + int count_others_req_procs; + int i, j; + ADIOI_Access *others_req; + size_t memLen; + ADIO_Offset *ptr; + MPI_Aint *mem_ptrs; + + *others_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + others_req = *others_req_ptr; + + memLen = 0; + for (i = 0; i < nprocs; i++) + memLen += count_others_req_per_proc[i]; + ptr = (ADIO_Offset *) ADIOI_Malloc(memLen * 2 * sizeof(ADIO_Offset)); + mem_ptrs = (MPI_Aint *) ADIOI_Malloc(memLen * sizeof(MPI_Aint)); + others_req[0].offsets = ptr; + others_req[0].mem_ptrs = mem_ptrs; + + count_others_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_others_req_per_proc[i]) { + others_req[i].count = count_others_req_per_proc[i]; + others_req[i].offsets = ptr; + ptr += count_others_req_per_proc[i]; + others_req[i].lens = ptr; + ptr += count_others_req_per_proc[i]; + others_req[i].mem_ptrs = mem_ptrs; + mem_ptrs += count_others_req_per_proc[i]; + count_others_req_procs++; + } else + others_req[i].count = 0; + } + vars->count_others_req_procs = count_others_req_procs; + + /* now send the calculated offsets and lengths to respective processes */ + + vars->req2 = (MPI_Request *) + ADIOI_Malloc(1 + 2 * (count_my_req_procs + count_others_req_procs) + * sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + MPI_Irecv(others_req[i].offsets, 2 * others_req[i].count, + ADIO_OFFSET, i, i + myrank, fd->comm, &vars->req2[j++]); + } + } + + for (i = 0; i < nprocs; i++) { + if (my_req[i].count) { + MPI_Isend(my_req[i].offsets, 2 * my_req[i].count, + ADIO_OFFSET, i, i + myrank, fd->comm, &vars->req2[j++]); + } + } + + /* keep the number of requests */ + vars->num_req2 = j; + + if (nbc_req->rdwr == ADIOI_READ) { + nbc_req->data.rd.state = ADIOI_IRC_STATE_ICALC_OTHERS_REQ_MAIN; + } else { + ADIOI_Assert(nbc_req->rdwr == ADIOI_WRITE); + nbc_req->data.wr.state = ADIOI_IWC_STATE_ICALC_OTHERS_REQ_MAIN; + } +} + +void ADIOI_Icalc_others_req_fini(ADIOI_NBC_Request * nbc_req, int *error_code) +{ + ADIOI_Icalc_others_req_vars *vars = nbc_req->cor_vars; + void (*next_fn) (ADIOI_NBC_Request *, int *); + + ADIOI_Free(vars->req2); + ADIOI_Free(vars->count_others_req_per_proc); + + *vars->count_others_req_procs_ptr = vars->count_others_req_procs; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5027, 0, NULL); +#endif + /* end of the calculation */ + + next_fn = vars->next_fn; + + /* free the struct for parameters and variables */ + ADIOI_Free(vars); + nbc_req->cor_vars = NULL; + + /* move to the next function */ + next_fn(nbc_req, error_code); +} diff --git a/3rd-party/romio341/adio/common/ad_aggregate_new.c b/3rd-party/romio341/adio/common/ad_aggregate_new.c new file mode 100644 index 0000000000000000000000000000000000000000..351c3dc294c538f3235c42ce28108b7f042d512d --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_aggregate_new.c @@ -0,0 +1,255 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#include <assert.h> +/* #define DEBUG */ + +void ADIOI_Calc_file_realms_user_size(ADIO_File fd, int fr_size, + int nprocs_for_coll, + ADIO_Offset * file_realm_st_offs, + MPI_Datatype * file_realm_types); +void ADIOI_Calc_file_realms_aar(ADIO_File fd, int nprocs_for_coll, + int pfr_enabled, + ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset, + ADIO_Offset * file_realm_st_offs, MPI_Datatype * file_realm_types); +void ADIOI_Calc_file_realms_fsize(ADIO_File fd, + int nprocs_for_coll, + ADIO_Offset max_end_offset, + ADIO_Offset * file_realm_st_offs, + MPI_Datatype * file_realm_types); +void ADIOI_Create_fr_simpletype(int size, int nprocs_for_coll, MPI_Datatype * simpletype); +static void align_fr(int fr_size, ADIO_Offset fr_off, int alignment, + int *aligned_fr_size, ADIO_Offset * aligned_fr_off); +void ADIOI_Verify_fr(int nprocs_for_coll, ADIO_Offset * file_realm_st_offs, + MPI_Datatype * file_realm_types); + +void ADIOI_Calc_file_realms(ADIO_File fd, ADIO_Offset min_st_offset, ADIO_Offset max_end_offset) +{ + int nprocs_for_coll; + int file_realm_calc_type; + + MPI_Datatype *file_realm_types = NULL; + ADIO_Offset *file_realm_st_offs = NULL; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5004, 0, NULL); +#endif +#ifdef DEBUG + printf("ADIOI_Calc_file_realms\n"); +#endif + + nprocs_for_coll = fd->hints->cb_nodes; + file_realm_calc_type = fd->hints->cb_fr_type; + + /* If PFRs are disabled we know these pointers are not allocated */ + if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { + fd->file_realm_st_offs = NULL; + fd->file_realm_types = NULL; + } + + if (nprocs_for_coll == 1) { + /* if there's only one aggregator, we can reset the file + * realms every single time */ + if (fd->file_realm_st_offs == NULL) { + file_realm_st_offs = (ADIO_Offset *) + ADIOI_Malloc(sizeof(ADIO_Offset)); + file_realm_types = (MPI_Datatype *) + ADIOI_Malloc(sizeof(MPI_Datatype)); + } else { + file_realm_st_offs = fd->file_realm_st_offs; + file_realm_types = fd->file_realm_types; + } + *file_realm_st_offs = min_st_offset; + MPI_Type_contiguous((max_end_offset - min_st_offset + 1), MPI_BYTE, file_realm_types); + MPI_Type_commit(file_realm_types); + ADIOI_Flatten_datatype(*file_realm_types); + } else if (fd->file_realm_st_offs == NULL) { + file_realm_st_offs = (ADIO_Offset *) + ADIOI_Malloc(nprocs_for_coll * sizeof(ADIO_Offset)); + file_realm_types = (MPI_Datatype *) + ADIOI_Malloc(nprocs_for_coll * sizeof(MPI_Datatype)); + + if (file_realm_calc_type == ADIOI_FR_AAR) { + ADIOI_Calc_file_realms_aar(fd, nprocs_for_coll, + fd->hints->cb_pfr, + min_st_offset, max_end_offset, + file_realm_st_offs, file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same*/ + ADIOI_Flatten_datatype(file_realm_types[0]); + } else if (file_realm_calc_type == ADIOI_FR_FSZ) { + ADIOI_Calc_file_realms_fsize(fd, nprocs_for_coll, max_end_offset, + file_realm_st_offs, file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same*/ + ADIOI_Flatten_datatype(file_realm_types[0]); + } else if (file_realm_calc_type == ADIOI_FR_USR_REALMS) { + /* copy user provided realm datatypes and realm offsets in + * hints to file descriptor. may also want to verify that + * the provided file realms are covering (for pfr at + * least) and non-overlapping */ + } else if (file_realm_calc_type > 0) { + ADIOI_Calc_file_realms_user_size(fd, file_realm_calc_type, + nprocs_for_coll, file_realm_st_offs, file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same */ + ADIOI_Flatten_datatype(file_realm_types[0]); + } + } + fd->file_realm_st_offs = file_realm_st_offs; + fd->file_realm_types = file_realm_types; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5005, 0, NULL); +#endif +} + +void ADIOI_Calc_file_realms_user_size(ADIO_File fd, int fr_size, + int nprocs_for_coll, + ADIO_Offset * file_realm_st_offs, + MPI_Datatype * file_realm_types) +{ + int i; + int aligned_fr_size; + ADIO_Offset aligned_fr_off; + MPI_Datatype simpletype; + + align_fr(fr_size, 0, fd->hints->cb_fr_alignment, &aligned_fr_size, &aligned_fr_off); + fr_size = aligned_fr_size; + ADIOI_Create_fr_simpletype(fr_size, nprocs_for_coll, &simpletype); + + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) + file_realm_st_offs[0] = 0; + else + file_realm_st_offs[0] = aligned_fr_off; + file_realm_types[0] = simpletype; +#ifdef DEBUG + printf("file_realm[0] = (%lld, %d)\n", (long long) file_realm_st_offs[0], fr_size); +#endif + + for (i = 1; i < nprocs_for_coll; i++) { + file_realm_st_offs[i] = file_realm_st_offs[i - 1] + fr_size; + file_realm_types[i] = simpletype; +#ifdef DEBUG + printf("file_realm[%d] = (%lld, %d)\n", i, (long long) file_realm_st_offs[i], + aligned_fr_size); +#endif + } +} + +/* takes an extra romio_cb_pfr param to decide whether file realms + * should start at byte 0 of the file*/ +void ADIOI_Calc_file_realms_aar(ADIO_File fd, int nprocs_for_coll, int cb_pfr, + ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset, + ADIO_Offset * file_realm_st_offs, MPI_Datatype * file_realm_types) +{ + int fr_size, aligned_fr_size, i; + MPI_Datatype simpletype; + ADIO_Offset aligned_start_off; + char value[9]; + + fr_size = (max_end_offset - min_st_offset + nprocs_for_coll) / nprocs_for_coll; + align_fr(fr_size, min_st_offset, fd->hints->cb_fr_alignment, + &aligned_fr_size, &aligned_start_off); + fr_size = aligned_fr_size; + ADIOI_Create_fr_simpletype(fr_size, nprocs_for_coll, &simpletype); + if (cb_pfr == ADIOI_HINT_ENABLE) + file_realm_st_offs[0] = 0; + else + file_realm_st_offs[0] = aligned_start_off; + file_realm_types[0] = simpletype; + +#ifdef DEBUG + printf("file_realm[0] = (%lld, %d)\n", (long long) file_realm_st_offs[0], fr_size); +#endif + for (i = 1; i < nprocs_for_coll; i++) { + file_realm_st_offs[i] = file_realm_st_offs[i - 1] + fr_size; + file_realm_types[i] = simpletype; +#ifdef DEBUG + printf("file_realm[%d] = (%lld, %d)\n", i, (long long) file_realm_st_offs[i], fr_size); +#endif + } + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { + MPL_snprintf(value, sizeof(value), "%d", fr_size); + ADIOI_Info_set(fd->info, "romio_cb_fr_type", value); + } +} + +void ADIOI_Calc_file_realms_fsize(ADIO_File fd, int nprocs_for_coll, + ADIO_Offset max_end_offset, + ADIO_Offset * file_realm_st_offs, MPI_Datatype * file_realm_types) +{ + int fr_size, aligned_fr_size, error_code, i; + int fsize; + ADIO_Offset aligned_fr_off; + ADIO_Fcntl_t fcntl_struct; + MPI_Datatype simpletype; + + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); + + /* use impending file size since a write call may lengthen the file */ + fsize = MPL_MAX(fcntl_struct.fsize, max_end_offset + 1); + fr_size = (fsize + nprocs_for_coll - 1) / nprocs_for_coll; + align_fr(fr_size, 0, fd->hints->cb_fr_alignment, &aligned_fr_size, &aligned_fr_off); + ADIOI_Create_fr_simpletype(fr_size, nprocs_for_coll, &simpletype); + + for (i = 0; i < nprocs_for_coll; i++) { + file_realm_st_offs[i] = fr_size * i; + file_realm_types[i] = simpletype; + } +} + +/* creates a datatype with an empty trailing edge */ +void ADIOI_Create_fr_simpletype(int size, int nprocs_for_coll, MPI_Datatype * simpletype) +{ + MPI_Aint lb, ub; + MPI_Datatype type; + + lb = 0; + ub = size * nprocs_for_coll; + + MPI_Type_contiguous(size, MPI_BYTE, &type); + MPI_Type_create_resized(type, lb, ub, simpletype); + + MPI_Type_free(&type); + + MPI_Type_commit(simpletype); +} + +/* Verify that file realms are covering (PFRs) and non-overlapping */ +void ADIOI_Verify_fr(int nprocs_for_coll, ADIO_Offset * file_realm_st_offs, + MPI_Datatype * file_realm_types) +{ +} + +int ADIOI_Agg_idx(int rank, ADIO_File fd) +{ + int i, cb_nodes, *ranklist; + cb_nodes = fd->hints->cb_nodes; + ranklist = fd->hints->ranklist; + + for (i = 0; i < cb_nodes; i++) { + if (ranklist[i]) + return i; + } + return -1; +} + +static void align_fr(int fr_size, ADIO_Offset fr_off, int alignment, + int *aligned_fr_size, ADIO_Offset * aligned_fr_off) +{ + *aligned_fr_off = fr_off - (fr_off % alignment); + *aligned_fr_size = ((fr_off + fr_size) / alignment) * alignment - *aligned_fr_off; + if ((fr_off + fr_size) % alignment) + *aligned_fr_size += alignment; + + assert(!((*aligned_fr_off % alignment) || (*aligned_fr_size % alignment))); +} diff --git a/3rd-party/romio341/adio/common/ad_close.c b/3rd-party/romio341/adio/common/ad_close.c new file mode 100644 index 0000000000000000000000000000000000000000..cb74ecbdc2c3605c8f54c9082783cbac4a025172 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_close.c @@ -0,0 +1,114 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIO_Close(ADIO_File fd, int *error_code) +{ + int i, j, k, combiner, myrank, err; + static char myname[] = "ADIO_CLOSE"; + + if (fd->async_count) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + return; + } + + /* because of deferred open, this warants a bit of explaining. First, if + * we've done aggregation, + * then close the file. Then, if any process left has done independent + * i/o, close the file. Otherwise, we'll skip the fs-specific close and + * just say everything is a-ok. + * + * XXX: is it ok for those processes with a "real" communicator and those + * with "MPI_COMM_SELF" to both call ADIOI_xxx_Close at the same time ? + * everyone who ever opened the file will close it. Is order important? Is + * timing important? + */ + if (fd->hints->deferred_open && fd->is_agg) { + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); + } else { + if (fd->is_open) { + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); + } else { + *error_code = MPI_SUCCESS; + } + + } + + if (fd->access_mode & ADIO_DELETE_ON_CLOSE) { + /* if we are doing aggregation and deferred open, then it's possible + * that rank 0 does not have access to the file. make sure only an + * aggregator deletes the file.*/ + MPI_Comm_rank(fd->comm, &myrank); + if (myrank == fd->hints->ranklist[0]) { + ADIO_Delete(fd->filename, &err); + } + MPI_Barrier(fd->comm); + } + + if (fd->fortran_handle != -1) { + ADIOI_Ftable[fd->fortran_handle] = MPI_FILE_NULL; + } + + if (fd->hints) + ADIOI_Free(fd->hints->ranklist); + if (fd->hints && fd->hints->cb_config_list) + ADIOI_Free(fd->hints->cb_config_list); + + /* This BlueGene platform-specific free must be done in the common code + * because the malloc's for these hint data structures are done at the + * scope of ADIO_Open within the SetInfo call (ADIOI_GPFS_SetInfo which + * calls ADIOI_BG_gen_agg_ranklist). They cannot be done in the + * ADIOI_GPFS_Close because of the file creation case where the + * ADIOI_GPFS_Close and re-open via ADIOI_GPFS_Open are done which results + * in a double-free - ADIOI_GPFS_Open does not redo the SetInfo... */ +#ifdef BGQPLATFORM + if (fd->hints && fd->hints->fs_hints.bg.bridgelist) + ADIOI_Free(fd->hints->fs_hints.bg.bridgelist); + if (fd->hints && fd->hints->fs_hints.bg.bridgelistnum) + ADIOI_Free(fd->hints->fs_hints.bg.bridgelistnum); +#endif + + /* Persistent File Realms */ + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { + /* AAR, FSIZE, and User provided uniform File realms */ + if (1) { + MPI_Type_free(&fd->file_realm_types[0]); + } else { + for (i = 0; i < fd->hints->cb_nodes; i++) { + MPI_Type_free(&fd->file_realm_types[i]); + } + } + ADIOI_Free(fd->file_realm_st_offs); + ADIOI_Free(fd->file_realm_types); + } + ADIOI_Free(fd->hints); + + + + MPI_Comm_free(&(fd->comm)); + ADIOI_Free(fd->filename); + + MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner); + if (combiner != MPI_COMBINER_NAMED) + MPI_Type_free(&(fd->etype)); + + MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner); + if (combiner != MPI_COMBINER_NAMED) + MPI_Type_free(&(fd->filetype)); + + MPI_Info_free(&(fd->info)); + + ADIOI_Free(fd->io_buf); + ADIOI_OneSidedCleanup(fd); + + /* memory for fd is freed in MPI_File_close */ +} diff --git a/3rd-party/romio341/adio/common/ad_coll_build_req_new.c b/3rd-party/romio341/adio/common/ad_coll_build_req_new.c new file mode 100644 index 0000000000000000000000000000000000000000..79ed271ab08907d46e4544109e71b7524852e0a7 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_coll_build_req_new.c @@ -0,0 +1,1708 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#include "heap_sort.h" +#include <assert.h> + +/* +#define DEBUG1 +#define DEBUG2 +#define DEBUG3 +*/ +/* #define DEBUG_HEAP */ + +#define DTYPE_SKIP + +#ifdef DEBUG3 +static char *off_type_name[MAX_OFF_TYPE] = { "TEMP_OFFSETS", + "REAL_OFFSETS" +}; +#endif + +/* Simple function to return the size of the view_state. */ +static inline ADIO_Offset view_state_get_cur_sz(view_state * tmp_view_state_p, int op_type) +{ + flatten_state *tmp_state_p = NULL; + switch (op_type) { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + return tmp_state_p->cur_sz; +} + +/* Simple function to return the len of the next piece of the view_state. */ +static inline ADIO_Offset view_state_get_next_len(view_state * tmp_view_state_p, int op_type) +{ + flatten_state *tmp_state_p = NULL; + switch (op_type) { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + return (ADIO_Offset) + tmp_view_state_p->flat_type_p->blocklens[tmp_state_p->idx] - tmp_state_p->cur_reg_off; +} + +/* Add up to a region of a file view and no larger than a max size. + * The view_state is always consistent with the abs_off and where the + * index and cur_reg_off point to. The regions should be coalesced if + * possible later on. */ +static inline int view_state_add_region(ADIO_Offset max_sz, + view_state * tmp_view_state_p, + ADIO_Offset * st_reg_p, + ADIO_Offset * tmp_reg_sz_p, int op_type) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + flatten_state *tmp_state_p = NULL; + int64_t data_sz = 0; + +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5020, 0, NULL); */ +#endif + + switch (op_type) { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_flat_type_p = tmp_view_state_p->flat_type_p; + + *st_reg_p = tmp_state_p->abs_off; + + /* Should be looking at some data (or it's a zero len blocklens + * (i.e. placeholder). */ + assert(tmp_state_p->cur_reg_off != tmp_flat_type_p->blocklens[tmp_state_p->idx]); + /* Shouldn't have been called if the view_state is done. */ + assert(tmp_state_p->cur_sz != tmp_view_state_p->sz); + + /* Make sure we are not in a non-zero region in the flat_type */ + assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); + +#ifdef DEBUG3 + fprintf(stderr, "view_state:(blocklens[%Ld]=%d,cur_reg_off=%Ld," + "max_sz=%Ld)\n", tmp_state_p->idx, + tmp_flat_type_p->blocklens[tmp_state_p->idx], tmp_state_p->cur_reg_off, max_sz); +#endif + + /* Can it add the whole piece? */ + if (tmp_flat_type_p->blocklens[tmp_state_p->idx] - tmp_state_p->cur_reg_off <= max_sz) { + data_sz = tmp_flat_type_p->blocklens[tmp_state_p->idx] - tmp_state_p->cur_reg_off; + + tmp_state_p->cur_sz += data_sz; + + /* Advance the abs_off to the beginning of the next piece */ + if (tmp_flat_type_p->count == 1) { + assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); + tmp_state_p->abs_off += data_sz; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s contig type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - data_sz, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } else { + /* Is this the last region in the datatype? */ + if (tmp_state_p->idx == (tmp_flat_type_p->count - 1)) { + tmp_state_p->abs_off += data_sz - + tmp_flat_type_p->indices[tmp_flat_type_p->count - 1] - + tmp_flat_type_p->blocklens[tmp_flat_type_p->count - 1] + tmp_view_state_p->ext; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s last region for type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - data_sz, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } else { + tmp_state_p->abs_off += + tmp_flat_type_p->indices[tmp_state_p->idx + 1] - + (tmp_flat_type_p->indices[tmp_state_p->idx] + tmp_state_p->cur_reg_off); +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s inner region type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - + (tmp_flat_type_p->indices[tmp_state_p->idx + 1] - + (tmp_flat_type_p->indices[tmp_state_p->idx] + + tmp_state_p->cur_reg_off)), tmp_state_p->abs_off, + tmp_state_p->cur_sz, data_sz); +#endif + } + /* Increment idx to next non-zero region in the flat_type */ + do { + tmp_state_p->idx = (tmp_state_p->idx + 1) % tmp_flat_type_p->count; + } while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0); + } + tmp_state_p->cur_reg_off = 0; + } else { /* Add part of the piece */ + + data_sz = max_sz; + tmp_state_p->cur_reg_off += data_sz; + tmp_state_p->abs_off += data_sz; + tmp_state_p->cur_sz += data_sz; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s partial region type " + "(cur_reg_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld\n", + off_type_name[op_type], tmp_state_p->cur_reg_off, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } + + *tmp_reg_sz_p = data_sz; +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5021, 0, NULL); */ +#endif + return 0; +} + +/* Set up the abs_off, idx, and cur_reg_off of a view_state for the + * tmp_state or the cur_state. */ +int ADIOI_init_view_state(int file_ptr_type, int nprocs, view_state * view_state_arr, int op_type) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + ADIO_Offset tmp_off_used = 0, st_reg = 0, tmp_reg_sz = 0; + int i; + flatten_state *tmp_state_p = NULL; + view_state *tmp_view_p = NULL; + + for (i = 0; i < nprocs; i++) { + switch (op_type) { + case TEMP_OFF: + tmp_state_p = &(view_state_arr[i].tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(view_state_arr[i].cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_view_p = &(view_state_arr[i]); + tmp_flat_type_p = tmp_view_p->flat_type_p; + + if (file_ptr_type == ADIO_INDIVIDUAL) + tmp_state_p->abs_off = tmp_view_p->fp_ind; + else + tmp_state_p->abs_off = tmp_view_p->disp; + + tmp_off_used = 0; + + /* initialize tmp_state idx */ + while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0) + tmp_state_p->idx = (tmp_state_p->idx + 1) % tmp_flat_type_p->count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) + tmp_state_p->abs_off += tmp_flat_type_p->indices[tmp_state_p->idx]; + + /* Initialize the abs_off by moving into the datatype + * byte_off bytes. Since we only do this in the beginning, we + * make the assumption that pieces are added whole until the last + * piece which MAY be partial. */ + while (tmp_off_used != tmp_view_p->byte_off) { + view_state_add_region(tmp_view_p->byte_off - tmp_off_used, + &(view_state_arr[i]), &st_reg, &tmp_reg_sz, op_type); + } + + /* Re-initialize the cur_size so that the abs_off was set to + * the proper position while the actual size = 0.*/ + tmp_state_p->cur_sz = 0; +#ifdef DEBUG1 + fprintf(stderr, "init_view_state: %s (idx=%d,byte_off=%Ld," + "abs_off=%Ld,reg_off=%Ld,sz=%Ld)\n", off_type_name[op_type], + i, tmp_view_p->byte_off, tmp_state_p->abs_off, + tmp_state_p->cur_reg_off, tmp_view_p->sz); +#endif + + } + return 0; +} + +/* Return the next file realm offset and length for this datatype state + * within a particular file realm. */ +static inline int get_next_fr_off(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset fr_st_off, + MPI_Datatype * fr_type_p, + ADIO_Offset * fr_next_off_p, ADIO_Offset * fr_max_len_p) +{ + MPI_Aint lb, fr_extent = -1; + ADIO_Offset tmp_off, off_rem; + ADIOI_Flatlist_node *fr_node_p; + int i = -1, fr_dtype_ct = 0; + + /* Should have already been flattened in calc_file_realms() */ + fr_node_p = ADIOI_Flatten_and_find(*fr_type_p); + assert(fr_node_p != NULL); + + /* Did we get to the first region of the file realm? */ + if (off - fr_st_off < 0) { + *fr_next_off_p = fr_st_off + fr_node_p->indices[0]; + *fr_max_len_p = fr_node_p->blocklens[0]; + return 0; + } + + /* Calculate how many times to loop through the fr_type + * and where the next fr_off is. */ + MPI_Type_get_extent(*fr_type_p, &lb, &fr_extent); + tmp_off = off - fr_st_off; + fr_dtype_ct = tmp_off / fr_extent; + off_rem = tmp_off % fr_extent; + for (i = 0; i < fr_node_p->count; i++) { + if (off_rem < fr_node_p->indices[i]) { + *fr_next_off_p = fr_st_off + (fr_dtype_ct * fr_extent) + fr_node_p->indices[i]; + *fr_max_len_p = fr_node_p->blocklens[i]; + return 0; + } else if (off_rem < fr_node_p->indices[i] + fr_node_p->blocklens[i]) { + *fr_next_off_p = off; + *fr_max_len_p = fr_node_p->blocklens[i] - (off_rem - fr_node_p->indices[i]); + return off; + } + } + + /* Shouldn't get here. */ + fprintf(stderr, "get_next_fr_off: Couldn't find the correct " + "location of the next offset for this file realm.\n"); + return -1; +} + +/* Look in all the view states for the first offset within a given + * file realm. Report the end of a contiguous region within the file + * realm (possibly more than the actual view state may be able to + * process contiguously). */ +static inline int find_next_off(ADIO_File fd, + view_state * view_state_p, + ADIO_Offset fr_st_off, + MPI_Datatype * fr_type_p, + int op_type, + ADIO_Offset * cur_off_p, ADIO_Offset * cur_reg_max_len_p) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + ADIO_Offset tmp_off = -1, fr_next_off = -1, fr_max_len = -1, tmp_fr_max_len = -1; + int ret = 0; + flatten_state *tmp_state_p = NULL; + ADIO_Offset tmp_st_off = 0, tmp_reg_sz = 0; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5022, 0, NULL); */ +#endif + + switch (op_type) { + case TEMP_OFF: + tmp_state_p = &(view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_flat_type_p = view_state_p->flat_type_p; + + /* Can we use this proc? */ + if (tmp_state_p->cur_sz < view_state_p->sz) { + tmp_st_off = 0; + tmp_reg_sz = 0; + /* If the current region is not within the file realm, advance + * the state until it is and calculate the end of the next file + * realm in fr_max_len. */ + ret = get_next_fr_off(fd, + tmp_state_p->abs_off, + fr_st_off, fr_type_p, &fr_next_off, &fr_max_len); + + while ((tmp_state_p->abs_off < fr_next_off) && (tmp_state_p->cur_sz != view_state_p->sz)) { + + /* While this might appear to be erroneous at first, + * view_state_add_region can only add a single piece at a + * time. Therefore, it will never overshoot the beginning + * of the next file realm. When it finally does enter the + * next file realm it will not be able to go beyond its + * first piece. */ + +#ifdef DTYPE_SKIP + if (tmp_flat_type_p->count > 1) { + /* let's see if we can skip whole datatypes */ + skip_type_ct = (fr_next_off - tmp_state_p->abs_off) / view_state_p->ext; + if (skip_type_ct > 0) { + /* before we go on, let's check if we've actually + * finished up already */ + tmp_state_p->cur_sz += skip_type_ct * view_state_p->type_sz; + if (tmp_state_p->cur_sz >= view_state_p->sz) { + tmp_state_p->cur_sz = view_state_p->sz; + break; + } + tmp_state_p->abs_off += skip_type_ct * view_state_p->ext; + } + } +#endif + view_state_add_region(fr_next_off - tmp_state_p->abs_off, + view_state_p, &tmp_st_off, &tmp_reg_sz, op_type); + + ret = get_next_fr_off(fd, + tmp_state_p->abs_off, + fr_st_off, fr_type_p, &fr_next_off, &fr_max_len); + } + + if (tmp_state_p->cur_sz != view_state_p->sz) { + tmp_off = tmp_state_p->abs_off; + /* Calculate how much of the remaining file realm there is from the + * current offset */ + tmp_fr_max_len = fr_next_off + fr_max_len - tmp_off; + } + } + + *cur_off_p = tmp_off; + *cur_reg_max_len_p = tmp_fr_max_len; +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5023, 0, NULL); */ +#endif + return ret; +} + +/* Upon completion of a full collective buffer, end of a file realm + * region (data sieving), or the end of all I/O for an aggregator, we + * should return a list of MPI_Datatypes that correspond to client + * communication into a collective buffer, a list of corresponding + * sizes, and an aggregate MPI_Datatype which will be used as a + * filetype in MPI_File_write/read on the aggregator. */ +int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, + view_state * client_file_view_state_arr, + MPI_Datatype * client_comm_dtype_arr, + ADIO_Offset * client_comm_sz_arr, + ADIO_Offset * agg_dtype_offset_p, MPI_Datatype * agg_dtype_p) +{ + MPI_Aint **client_disp_arr = NULL, *agg_disp_arr = NULL; + int **client_blk_arr = NULL, *agg_blk_arr = NULL; + ADIO_Offset tmp_coll_buf_sz = 0, st_reg = 0, act_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset ds_fr_end = -1; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + int *client_ol_ct_arr = NULL; + int *client_ol_cur_ct_arr = NULL; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int cur_off_proc = -1; + int next_off_idx = -1; + int i = 0, j = 0, all_done = -1; + int agg_idx = fd->my_cb_nodes_index; + heap_t offset_heap; + ADIO_Offset next_off = -1, next_reg_max_len = -1; + + /* Used for coalescing ol pairs next to each other. */ + ADIO_Offset *client_comm_next_off_arr = NULL; + ADIO_Offset agg_next_off = -1; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5016, 0, NULL); +#endif + + memset(client_comm_sz_arr, 0, nprocs * sizeof(ADIO_Offset)); + + if ((client_comm_next_off_arr = (ADIO_Offset *) + ADIOI_Malloc(nprocs * sizeof(ADIO_Offset))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc client_next_off_arr " "failed\n"); + return -1; + } + + if ((client_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: " "malloc client_ol_ct_arr failed\n"); + return -1; + } + if ((client_ol_cur_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: " "malloc client_ol_cur_ct_arr failed\n"); + return -1; + } + + /* On the first pass see how many offset-length pairs are + * necessary for each client. Then allocate the correct amount of + * offset-length pairs for describing the collective buffer. All + * data is processed in order by the aggregator's file realm. On + * the second pass, set the offset-length pairs to the correct + * values. */ + for (i = 0; i < MAX_OFF_TYPE; i++) { + memset(client_comm_next_off_arr, -1, nprocs * sizeof(ADIO_Offset)); + tmp_coll_buf_sz = 0; + ds_fr_end = -1; + + /* initialize heap */ + ADIOI_Heap_create(&offset_heap, nprocs); + offset_heap.size = 0; + + for (j = 0; j < nprocs; j++) { + find_next_off(fd, + &client_file_view_state_arr[j], + fr_st_off_arr[agg_idx], + &(fr_type_arr[agg_idx]), i, &cur_off, &cur_reg_max_len); + if ((cur_off != -1) && (cur_reg_max_len > 0)) { + ADIOI_Heap_insert(&offset_heap, cur_off, j, cur_reg_max_len); +#ifdef DEBUG_HEAP + printf("initial: inserting offset %lld with " + "cur_reg_max_len = %lld for p%d\n", (long long) cur_off, + (long long) cur_reg_max_len, j); +#endif + } + + } + if (!offset_heap.size) + ADIOI_Heap_insert(&offset_heap, -1, -1, -1); + + while (tmp_coll_buf_sz < fd->hints->cb_buffer_size) { + /* Find the next process with the next region within the + * file realm and the maximum amount that can be added for + * this particular file realm as a contiguous region. */ + ADIOI_Heap_extract_min(&offset_heap, &cur_off, &cur_off_proc, &cur_reg_max_len); +#ifdef DEBUG_HEAP + printf("extracted cur_off %lld from proc %d\n", (long long) cur_off, cur_off_proc); +#endif + + if (cur_off == -1) + break; + +#ifdef DEBUG3 + fprintf(stderr, "ADIOI_Build_agg_reqs: %s proc %d start/add to" + " list (max_reg_fr=%Ld,tmp_coll_buf_sz=%Ld," + "cb_buffer_size=%d)\n", off_type_name[i], cur_off_proc, + cur_reg_max_len, tmp_coll_buf_sz, fd->hints->cb_buffer_size); +#endif + + /* We process only contiguous file realm regions if we are + * using data sieving. Note that we only do this for + * writes since reads can be data sieved across each other + * without consistency issues. */ + if ((fd->hints->ds_write == ADIOI_HINT_ENABLE || + fd->hints->ds_write == ADIOI_HINT_AUTO) && + rw_type == ADIOI_WRITE && fd->hints->cb_nodes > 1) { +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_agg_reqs: " "Warning - Data sieving writes on\n"); +#endif + if (ds_fr_end == -1) { + ds_fr_end = cur_off + cur_reg_max_len; +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "cur_off=%Ld, cur_reg_max_len=%Ld\n" + "Data sieving file realm end initialized to %Ld\n", + cur_off, cur_reg_max_len, ds_fr_end); +#endif + } else { + /* The next off switched file realms, so we will stop + * here. */ + if (ds_fr_end != cur_off + cur_reg_max_len) { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "Data sieving file realm end changed from " + "%Ld to %Ld\n", ds_fr_end, cur_off + cur_reg_max_len); +#endif + break; + } + } + } + + /* Add up to the end of the file realm or the collective + * buffer. */ + if (cur_reg_max_len > (fd->hints->cb_buffer_size - tmp_coll_buf_sz)) + cur_reg_max_len = fd->hints->cb_buffer_size - tmp_coll_buf_sz; + + view_state_add_region(cur_reg_max_len, + &(client_file_view_state_arr[cur_off_proc]), + &st_reg, &act_reg_sz, i); + + switch (i) { + case TEMP_OFF: + /* Increment the ol list count for each proc and + * the used part of the collective buffer if the + * next region is not adjacent to the previous + * region. */ + if (client_comm_next_off_arr[cur_off_proc] != tmp_coll_buf_sz) { + (client_ol_ct_arr[cur_off_proc])++; + } + client_comm_next_off_arr[cur_off_proc] = tmp_coll_buf_sz + act_reg_sz; + + if (agg_next_off != st_reg) + agg_ol_ct++; + agg_next_off = st_reg + act_reg_sz; + break; + case REAL_OFF: + /* Add this region to the proper client ol list if + * the next region is not adjacent to the previous + * region. */ + next_off_idx = client_ol_cur_ct_arr[cur_off_proc]; + if (client_comm_next_off_arr[cur_off_proc] != tmp_coll_buf_sz) { + client_disp_arr[cur_off_proc][next_off_idx] = tmp_coll_buf_sz; + client_blk_arr[cur_off_proc][next_off_idx] = act_reg_sz; + (client_ol_cur_ct_arr[cur_off_proc])++; + } else { + client_blk_arr[cur_off_proc][next_off_idx - 1] + += act_reg_sz; + } + client_comm_sz_arr[cur_off_proc] += act_reg_sz; + client_comm_next_off_arr[cur_off_proc] = tmp_coll_buf_sz + act_reg_sz; + + /* Add to the aggregator filetype if the next + * region is not adjacent to the previous + * region. */ + if (agg_next_off != st_reg) { + /* this will enable initial offsets much further into + * the file than an MPI_Aint */ + if (!agg_ol_cur_ct) + *agg_dtype_offset_p = st_reg; + agg_disp_arr[agg_ol_cur_ct] = st_reg - (MPI_Aint) * agg_dtype_offset_p; + agg_blk_arr[agg_ol_cur_ct] = act_reg_sz; + agg_ol_cur_ct++; + } else { + agg_blk_arr[agg_ol_cur_ct - 1] += act_reg_sz; + } + agg_next_off = st_reg + act_reg_sz; + + break; + default: + fprintf(stderr, "ADIOI_Build_agg_reqs: Impossible type\n"); + } + tmp_coll_buf_sz += act_reg_sz; + + find_next_off(fd, + &client_file_view_state_arr[cur_off_proc], + fr_st_off_arr[agg_idx], + &(fr_type_arr[agg_idx]), i, &next_off, &next_reg_max_len); + + if ((next_off != -1) || (!offset_heap.size)) { + ADIOI_Heap_insert(&offset_heap, next_off, cur_off_proc, next_reg_max_len); +#ifdef DEBUG_HEAP + printf("inserting offset %lld for p%d\n", (long long) next_off, cur_off_proc); +#endif + } + } + + if (i == TEMP_OFF) { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for both the client and the aggregator. */ + if ((client_disp_arr = (MPI_Aint **) + ADIOI_Malloc(nprocs * sizeof(MPI_Aint *))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " "client_disp_arr failed\n"); + return -1; + } + if ((client_blk_arr = (int **) ADIOI_Malloc(nprocs * sizeof(int *))) == NULL) { + ADIOI_Free(client_disp_arr); + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " "client_blk_arr failed\n"); + return -1; + } + for (j = 0; j < nprocs; j++) { + if ((client_disp_arr[j] = + (MPI_Aint *) ADIOI_Malloc(client_ol_ct_arr[j] * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " "client_disp_arr[%d] failed\n", + j); + return -1; + } + if ((client_blk_arr[j] = (int *) + ADIOI_Malloc(client_ol_ct_arr[j] * sizeof(int))) == NULL) { + ADIOI_Free(client_disp_arr[j]); + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " + "client_blk_arr[%d] failed\n", j); + return -1; + } + } + + if (agg_ol_ct > 0) { + if ((agg_disp_arr = + (MPI_Aint *) ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc disp_arr failed\n"); + return -1; + } + if ((agg_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc blk_arr failed\n"); + return -1; + } + } + } + ADIOI_Heap_free(&offset_heap); + } + + /* Let the clients know if this aggregator is totally finished + * with all possible client requests. */ + all_done = 1; + for (i = 0; i < nprocs; i++) { + if ((client_file_view_state_arr[i].cur_state.cur_sz != + client_file_view_state_arr[i].sz) || client_comm_sz_arr[i] != 0) { + all_done = 0; + break; + } + } + if (all_done == 1) { + for (i = 0; i < nprocs; i++) { + client_comm_sz_arr[i] = -1; + } + } + + /* Quick check to make sure we found all the ol pairs we thought + * we did */ + for (i = 0; i < nprocs; i++) { + if (client_ol_cur_ct_arr[i] != client_ol_ct_arr[i]) { + fprintf(stderr, "ADIOI_Build_agg_reqs: ERROR Process %d " + "processed only %d out of %d ol pairs\n", i, + client_ol_cur_ct_arr[i], client_ol_ct_arr[i]); + return -1; + } + } +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs:(client,ol_pairs,size_req)="); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "(%d,%d,%Ld)", i, client_ol_ct_arr[i], client_comm_sz_arr[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); +#endif +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: Generated %d of %d " + "aggregate offset-length pairs\n", agg_ol_cur_ct, agg_ol_ct); +#endif +#ifdef DEBUG2 + for (i = 0; i < nprocs; i++) { + if (client_ol_ct_arr[i] > 0) { + fprintf(stderr, "ADIOI_Build_agg_reqs: p %d (off,len) = ", i); + for (j = 0; j < client_ol_ct_arr[i]; j++) { + fprintf(stderr, "[%d](%d,%d) ", j, client_disp_arr[i][j], client_blk_arr[i][j]); + } + fprintf(stderr, "\n"); + } + } + if (agg_ol_ct) { + fprintf(stderr, "ADIOI_Build_agg_reqs:agg_type(off,len)="); + for (i = 0; i < agg_ol_ct; i++) { + fprintf(stderr, "[%d](%d,%d)", i, agg_disp_arr[i], agg_blk_arr[i]); + if (i != agg_ol_ct - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + } +#endif + + assert(agg_ol_cur_ct == agg_ol_ct); + + /* Create all the client and aggregate MPI_Datatypes */ + for (i = 0; i < nprocs; i++) { + if (client_comm_sz_arr[i] > 0) { + MPI_Type_create_hindexed(client_ol_ct_arr[i], client_blk_arr[i], + client_disp_arr[i], MPI_BYTE, &(client_comm_dtype_arr[i])); + MPI_Type_commit(&(client_comm_dtype_arr[i])); + } else { + client_comm_dtype_arr[i] = MPI_BYTE; + } + ADIOI_Free(client_blk_arr[i]); + ADIOI_Free(client_disp_arr[i]); + } + ADIOI_Free(client_blk_arr); + ADIOI_Free(client_disp_arr); + + if (agg_ol_ct > 0) { + if (agg_ol_ct == 1) + MPI_Type_contiguous(agg_blk_arr[0], MPI_BYTE, agg_dtype_p); + else if (agg_ol_ct > 1) + MPI_Type_create_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, agg_dtype_p); + + MPI_Type_commit(agg_dtype_p); + + ADIOI_Free(agg_disp_arr); + ADIOI_Free(agg_blk_arr); + } + ADIOI_Free(client_ol_ct_arr); + ADIOI_Free(client_ol_cur_ct_arr); + ADIOI_Free(client_comm_next_off_arr); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5017, 0, NULL); +#endif + return 0; +} + +/* All sizes from all aggregators are gathered on the clients, which + * then call this function, which will generate the comm datatypes for + * each aggregator (agg_comm_dtype_arr) in the upcoming + * MPI_Alltoallw() */ +int ADIOI_Build_client_reqs(ADIO_File fd, + int nprocs, + view_state * my_mem_view_state_arr, + view_state * agg_file_view_state_arr, + ADIO_Offset * agg_comm_sz_arr, MPI_Datatype * agg_comm_dtype_arr) +{ + MPI_Aint **agg_disp_arr = NULL; + int **agg_blk_arr = NULL; + view_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; + ADIO_Offset total_agg_comm_sz = 0, cur_total_agg_comm_sz = 0; + ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset tmp_cur_off = -1, tmp_cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + ADIO_Offset *agg_comm_cur_sz_arr = NULL; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + int *agg_ol_ct_arr = NULL; + int *agg_ol_cur_ct_arr = NULL; + int tmp_agg_fr_idx = -1; + int cur_off_proc = -1; + int i = 0, j = 0; + int agg_next_off_idx = -1; + /* Used for coalescing ol pairs next to each other. */ + ADIO_Offset *agg_mem_next_off_arr = NULL; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5018, 0, NULL); +#endif + +#ifdef DEBUG + fprintf(stderr, "ADIOI_Build_client_reqs:(agg,size_req)="); + for (i = 0; i < nprocs; i++) { + int tmp_agg_idx = ADIOI_Agg_idx(i, fd); + if (tmp_agg_idx >= 0) { + fprintf(stderr, "(%d,%Ld)", i, agg_comm_sz_arr[i]); + if (i != fd->hints->cb_nodes - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + } +#endif + + if ((agg_mem_next_off_arr = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_mem_next_off_arr" "failed\n"); + return -1; + } + + if ((agg_comm_cur_sz_arr = (ADIO_Offset *) + ADIOI_Malloc(nprocs * sizeof(ADIO_Offset))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_comm_cur_sz_arr" " failed\n"); + return -1; + } + if ((agg_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) + == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: " "malloc agg_ol_ct_arr failed\n"); + return -1; + } + if ((agg_ol_cur_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) + == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: " "malloc agg_ol_cur_ct_arr failed\n"); + return -1; + } + + for (i = 0; i < nprocs; i++) { + if (agg_comm_sz_arr[i] > 0) + total_agg_comm_sz += agg_comm_sz_arr[i]; + } + + /* On the first pass see how many offset-length pairs are + * necessary for each aggregator. Then allocate the correct + * amount of offset-length pairs for handling each aggregator's + * particular data size. On the last pass, we actually create the + * offset-length pairs. */ + for (i = 0; i < MAX_OFF_TYPE; i++) { + cur_total_agg_comm_sz = 0; + memset(agg_comm_cur_sz_arr, 0, nprocs * sizeof(ADIO_Offset)); + memset(agg_mem_next_off_arr, -1, nprocs * sizeof(ADIO_Offset)); + while (total_agg_comm_sz > cur_total_agg_comm_sz) { + /* Look for the next aggregator offset among all the + * aggregators and their respective file realms. */ + cur_off = -1; + for (j = 0; j < nprocs; j++) { + tmp_agg_fr_idx = ADIOI_Agg_idx(j, fd); + assert(tmp_agg_fr_idx < fd->hints->cb_nodes); + + /* If this process is not an aggregator or we have + * finished all the bytes for this aggregator, move + * along. */ + if (tmp_agg_fr_idx < 0 || agg_comm_cur_sz_arr[j] == agg_comm_sz_arr[j]) { + continue; + } + + find_next_off(fd, + &(agg_file_view_state_arr[j]), + fr_st_off_arr[tmp_agg_fr_idx], + &(fr_type_arr[tmp_agg_fr_idx]), + i, &tmp_cur_off, &tmp_cur_reg_max_len); + if (tmp_cur_off == -1) + continue; + + if ((cur_off == -1) || (cur_off > tmp_cur_off)) { + cur_off_proc = j; + cur_off = tmp_cur_off; + cur_reg_max_len = tmp_cur_reg_max_len; + } + } + + assert(cur_off_proc != -1); + + /* Add up to the end of the file realm or as many bytes + * are left for this particular aggregator in the client's + * filetype */ + if (cur_reg_max_len > agg_comm_sz_arr[cur_off_proc] - agg_comm_cur_sz_arr[cur_off_proc]) { + cur_reg_max_len = agg_comm_sz_arr[cur_off_proc] - agg_comm_cur_sz_arr[cur_off_proc]; + } + assert(cur_reg_max_len > 0); + + view_state_add_region(cur_reg_max_len, + &(agg_file_view_state_arr[cur_off_proc]), + &st_reg, &act_reg_sz, i); + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_reqs: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], cur_off_proc, cur_off, act_reg_sz); +#endif + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + tmp_file_state_p = &(agg_file_view_state_arr[cur_off_proc]); + tmp_mem_state_p = &(my_mem_view_state_arr[cur_off_proc]); + assert(view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz >= + view_state_get_cur_sz(tmp_mem_state_p, i)); + while (view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz != + view_state_get_cur_sz(tmp_mem_state_p, i)) { + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; + view_state_add_region(view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz - + view_state_get_cur_sz(tmp_mem_state_p, i), + tmp_mem_state_p, &fill_st_reg, &fill_reg_sz, i); + } + + /* Based on how large the act_reg_sz 1. Figure out how + * many memory offset-length pairs are necessary. 2. Set + * the offset-length pairs. */ + tmp_reg_sz = 0; + while (tmp_reg_sz != act_reg_sz) { + view_state_add_region(act_reg_sz - tmp_reg_sz, + tmp_mem_state_p, &agg_mem_st_reg, &agg_mem_act_reg_sz, i); + tmp_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_reqs: Mem region %s" + "(proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], cur_off_proc, agg_mem_st_reg, agg_mem_act_reg_sz); +#endif + agg_comm_cur_sz_arr[cur_off_proc] += agg_mem_act_reg_sz; + cur_total_agg_comm_sz += agg_mem_act_reg_sz; + switch (i) { + case TEMP_OFF: + /* Increment the ol list count a particular + * aggregator if next region is not adjacent + * to the previous region. */ + if (agg_mem_next_off_arr[cur_off_proc] != agg_mem_st_reg) { + agg_ol_ct_arr[cur_off_proc]++; + } + agg_mem_next_off_arr[cur_off_proc] = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtypes that will + * map to each aggregator, coaslescing if + * possible. */ + agg_next_off_idx = agg_ol_cur_ct_arr[cur_off_proc]; + if (agg_mem_next_off_arr[cur_off_proc] != agg_mem_st_reg) { + agg_disp_arr[cur_off_proc][agg_next_off_idx] = agg_mem_st_reg; + agg_blk_arr[cur_off_proc][agg_next_off_idx] = agg_mem_act_reg_sz; + (agg_ol_cur_ct_arr[cur_off_proc])++; + } else { + agg_blk_arr[cur_off_proc][agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off_arr[cur_off_proc] = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_reqs: " "Impossible type\n"); + } + } + } + + /* On the first pass, allocate the memory structures for + * creating the MPI_hindexed type. */ + if (i == TEMP_OFF) { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for each aggregator */ + if ((agg_disp_arr = (MPI_Aint **) + ADIOI_Malloc(nprocs * sizeof(MPI_Aint *))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_disp_arr failed\n"); + return -1; + } + if ((agg_blk_arr = (int **) ADIOI_Malloc(nprocs * sizeof(int *))) + == NULL) { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_blk_arr failed\n"); + return -1; + } + for (j = 0; j < nprocs; j++) { + if ((agg_disp_arr[j] = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct_arr[j] * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc " + "agg_disp_arr[%d] failed\n", j); + return -1; + } + if ((agg_blk_arr[j] = (int *) + ADIOI_Malloc(agg_ol_ct_arr[j] * sizeof(int))) == NULL) { + ADIOI_Free(agg_disp_arr[j]); + fprintf(stderr, "ADIOI_Build_client_reqs: malloc " + "agg_blk_arr[%d] failed\n", j); + return -1; + } + } + } + } + +#ifdef DEBUG + fprintf(stderr, "ADIOI_Build_client_reqs:(agg,cur_ol_count=ol_count)="); + for (i = 0; i < nprocs; i++) { + int tmp_agg_idx = ADIOI_Agg_idx(i, fd); + if (tmp_agg_idx >= 0) { + fprintf(stderr, "(%d,%d=%d)", i, agg_ol_cur_ct_arr[i], agg_ol_ct_arr[i]); + assert(agg_ol_ct_arr[i] == agg_ol_cur_ct_arr[i]); + if (tmp_agg_idx != fd->hints->cb_nodes - 1) + fprintf(stderr, ","); + } + } + fprintf(stderr, "\n"); +#endif + +#ifdef DEBUG2 + for (i = 0; i < nprocs; i++) { + if (agg_ol_ct_arr[i] > 0) { + fprintf(stderr, "ADIOI_Build_client_reqs: p %d (off,len) = ", i); + for (j = 0; j < agg_ol_ct_arr[i]; j++) { + fprintf(stderr, "[%d](%d,%d) ", j, agg_disp_arr[i][j], agg_blk_arr[i][j]); + } + fprintf(stderr, "\n"); + } + } +#endif + + /* Create all the aggregator MPI_Datatypes */ + for (i = 0; i < nprocs; i++) { + if (agg_comm_sz_arr[i] > 0) { + MPI_Type_create_hindexed(agg_ol_ct_arr[i], agg_blk_arr[i], + agg_disp_arr[i], MPI_BYTE, &(agg_comm_dtype_arr[i])); + MPI_Type_commit(&(agg_comm_dtype_arr[i])); + } else { + agg_comm_dtype_arr[i] = MPI_BYTE; + } + ADIOI_Free(agg_blk_arr[i]); + ADIOI_Free(agg_disp_arr[i]); + } + ADIOI_Free(agg_blk_arr); + ADIOI_Free(agg_disp_arr); + + ADIOI_Free(agg_mem_next_off_arr); + ADIOI_Free(agg_comm_cur_sz_arr); + ADIOI_Free(agg_ol_ct_arr); + ADIOI_Free(agg_ol_cur_ct_arr); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5019, 0, NULL); +#endif + return 0; +} + +/* ADIOI_Build_client_pre_req allows a client to calculate the memtype + * offset-length pairs up (up to a limit - max_pre_req_sz or max + * ol_ct). It basically allows ADIOI_Build_client_req to do less work. + * If it called and there already exist some preprocessed memtype + * offset-length pairs, it will exit immediately if a limit has been + * reached or if will add on the old limites to reach the new + * limits. */ + +int ADIOI_Build_client_pre_req(ADIO_File fd, + int agg_rank, int agg_idx, + view_state * my_mem_view_state_p, + view_state * agg_file_view_state_p, + ADIO_Offset max_pre_req_sz, int max_ol_ct) +{ + ADIO_Offset act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int i, agg_next_off_idx = -1; + + ADIO_Offset cur_sz = 0, max_sz = 0, agg_mem_next_off = -1; + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + MPI_Aint *tmp_disp_arr = NULL; + int *tmp_blk_arr = NULL, exit_loop = -1; + flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) { + fprintf(stderr, "ADIOI_Build_client_pre_req: Invalid agg_idx %d\n", agg_idx); + return -1; + } + + if (agg_file_view_state_p->cur_state.cur_sz == + agg_file_view_state_p->sz || max_pre_req_sz <= 0 || max_ol_ct <= 0) { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_pre_req: Nothing to preprocess\n"); +#endif + return 0; + } + + /* The new limits have already been surpassed by what already + * exists. Otherwise we will use the next restrictions */ + if ((my_mem_view_state_p->pre_sz >= max_pre_req_sz) || + (my_mem_view_state_p->pre_ol_ct >= max_ol_ct)) { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_pre_req: Old values surpass new " "pre_req values\n"); +#endif + return 0; + } + + /* General idea is to first advance the filetype to the file realm + * and then the memtype to the filetype. The memtype is advanced + * further by peeking at the filetype and then the filetype is + * advanced. */ + for (i = 0; i < MAX_OFF_TYPE; i++) { + switch (i) { + case TEMP_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); + tmp_file_state_p = &(agg_file_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->cur_state); + tmp_file_state_p = &(agg_file_view_state_p->cur_state); + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " "Invalid off type %d\n", i); + } + + if (i == TEMP_OFF && my_mem_view_state_p->pre_sz > 0) { + cur_sz = my_mem_view_state_p->pre_sz; + agg_ol_ct = my_mem_view_state_p->pre_ol_ct; + /* Save the old arrays */ + tmp_disp_arr = my_mem_view_state_p->pre_disp_arr; + tmp_blk_arr = my_mem_view_state_p->pre_blk_arr; + my_mem_view_state_p->pre_disp_arr = NULL; + my_mem_view_state_p->pre_blk_arr = NULL; + agg_mem_next_off = tmp_disp_arr[agg_ol_ct - 1] + tmp_blk_arr[agg_ol_ct - 1]; + } else if (i == REAL_OFF && my_mem_view_state_p->pre_sz > 0) { + cur_sz = my_mem_view_state_p->pre_sz; + agg_ol_cur_ct = my_mem_view_state_p->pre_ol_ct; + + /* Copy the old data to the new data, freeing the old + * arrays */ + memcpy(my_mem_view_state_p->pre_disp_arr, tmp_disp_arr, + my_mem_view_state_p->pre_ol_ct * sizeof(MPI_Aint)); + memcpy(my_mem_view_state_p->pre_blk_arr, tmp_blk_arr, + my_mem_view_state_p->pre_ol_ct * sizeof(int)); + + ADIOI_Free(tmp_disp_arr); + ADIOI_Free(tmp_blk_arr); + + agg_mem_next_off = + my_mem_view_state_p->pre_disp_arr[agg_ol_cur_ct - 1] + + my_mem_view_state_p->pre_blk_arr[agg_ol_cur_ct - 1]; + } else { + cur_sz = 0; + } + + /* Max_pre_req_sz may be larger than the amount of data left + * to preprocess */ + if (max_pre_req_sz - cur_sz > agg_file_view_state_p->sz - tmp_file_state_p->cur_sz) { + max_sz = cur_sz + agg_file_view_state_p->sz - tmp_file_state_p->cur_sz; + } else + max_sz = max_pre_req_sz; + + assert(cur_sz != max_sz); +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_pre_req: (cur_sz=%Ld,agg_ol_ct=%d," + "agg_mem_next_off=%Ld,max_sz=%Ld,max_ol_ct=%d)\n", + cur_sz, agg_ol_ct, agg_mem_next_off, max_sz, max_ol_ct); +#endif + while (cur_sz < max_sz) { + find_next_off(fd, agg_file_view_state_p, + fr_st_off_arr[agg_rank], + &(fr_type_arr[agg_rank]), i, &cur_off, &cur_reg_max_len); + + /* find_next_off may show that the file_view_state is done + * even if cur_sz != max_sz since find_next_off may + * advance the file_view_state to the end here and realize + * that it is done. */ + if (cur_off == -1) + break; + + assert(cur_off != -1); + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + while (tmp_file_state_p->cur_sz != tmp_mem_state_p->cur_sz) { +#ifdef DTYPE_SKIP + if (my_mem_view_state_p->flat_type_p->count > 1) { + /* let's see if we can skip whole memory datatypes */ + skip_type_ct = + (tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz) / + my_mem_view_state_p->type_sz; + if (skip_type_ct > 0) { + tmp_mem_state_p->cur_sz += skip_type_ct * my_mem_view_state_p->type_sz; + tmp_mem_state_p->abs_off += skip_type_ct * my_mem_view_state_p->ext; + if (tmp_mem_state_p->cur_sz == tmp_file_state_p->cur_sz) + break; + } + } +#endif + view_state_add_region(tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz, + my_mem_view_state_p, &fill_st_reg, &fill_reg_sz, i); + } + + /* Now that the filetype and memtype are advanced to the + * same position, add memtype ol-pairs while we have not + * overstepped the min(end of the current piece in the + * file view, end of the file realm, data left in + * max_sz) */ + + if (cur_reg_max_len > view_state_get_next_len(agg_file_view_state_p, i)) + cur_reg_max_len = view_state_get_next_len(agg_file_view_state_p, i); + + if (cur_reg_max_len > max_sz - cur_sz) + cur_reg_max_len = max_sz - cur_sz; + + assert(cur_reg_max_len > 0); + + /* Add memtype ol pairs while we have not passed + * cur_reg_max_len or the max number of ol pairs + * allowed */ + act_reg_sz = 0; + exit_loop = 0; + while ((act_reg_sz < cur_reg_max_len) && (exit_loop == 0)) { + view_state_add_region(cur_reg_max_len - act_reg_sz, + my_mem_view_state_p, &agg_mem_st_reg, &agg_mem_act_reg_sz, i); + act_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_pre_req: %s Mem region" + "(proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_rank, agg_mem_st_reg, agg_mem_act_reg_sz); +#endif + switch (i) { + case TEMP_OFF: + /* Increment the ol list count if the next + * region is not adjacent to the previous + * region. */ + if (agg_mem_next_off != agg_mem_st_reg) { + agg_ol_ct++; + if (agg_ol_ct == max_ol_ct) + exit_loop = 1; + } + agg_mem_next_off = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtype that + * will map to our aggregator, coaslescing + * if possible. */ + agg_next_off_idx = agg_ol_cur_ct; + if (agg_mem_next_off != agg_mem_st_reg) { + my_mem_view_state_p->pre_disp_arr[agg_next_off_idx] = agg_mem_st_reg; + my_mem_view_state_p->pre_blk_arr[agg_next_off_idx] = agg_mem_act_reg_sz; + agg_ol_cur_ct++; + if (agg_ol_cur_ct == agg_ol_ct) + exit_loop = 1; + } else { + my_mem_view_state_p->pre_blk_arr[agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " "Impossible type\n"); + } + } + + /* Advance the filetype flatten state appropriately to + * match the data advanced in the memtype flatten state. + * Should only take at most a single view_state_add_region + * call since the memtype cannot proceed beyond the end of + * a contig piece in the file type. */ + view_state_add_region(act_reg_sz - tmp_reg_sz, + agg_file_view_state_p, &fill_st_reg, &fill_reg_sz, i); +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_pre_req: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_rank, fill_st_reg, fill_reg_sz); +#endif + if (fill_reg_sz != act_reg_sz) { + fprintf(stderr, "ADIOI_Build_client_pre_req: " + "view_state_add_region failed to match the memtype\n"); + return -1; + } + + cur_sz += act_reg_sz; + } + + /* On the first pass, allocate the memory structures for + * storing the preprocessed information */ + if (i == TEMP_OFF) { + if ((my_mem_view_state_p->pre_disp_arr = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " + "pre_disp_arr of size %ld failed\n", + (long int) agg_ol_ct * sizeof(MPI_Aint)); + return -1; + } + if ((my_mem_view_state_p->pre_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) { + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " + "agg_blk_arr of size %ld failed\n", (long int) agg_ol_ct * sizeof(int)); + return -1; + } + } + } + + my_mem_view_state_p->pre_sz = cur_sz; + my_mem_view_state_p->pre_ol_ct = agg_ol_ct; + +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_pre_req:(agg=%d,cur_ol_count=%d" + "=ol_count=%d)\n", agg_rank, my_mem_view_state_p->pre_ol_ct, agg_ol_ct); +#endif + +#ifdef DEBUG2 + if (agg_ol_ct > 0) { + fprintf(stderr, "ADIOI_Build_client_pre_req: agg=%d,pre_sz=%Ld " + "(off,len) = \n", agg_rank, my_mem_view_state_p->pre_sz); + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) { + fprintf(stderr, "[%d](%d,%d) ", i, + my_mem_view_state_p->pre_disp_arr[i], my_mem_view_state_p->pre_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif + + return 0; +} + +/* process_pre_req() allows ADIOI_Build_client_req to use the pre_req + * information. */ + +static int process_pre_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state * my_mem_view_state_p, + view_state * agg_file_view_state_p, + ADIO_Offset agg_comm_sz, + int off_type, + MPI_Aint * agg_disp_arr, + int *agg_blk_arr, + ADIO_Offset * agg_comm_pre_sz_p, + ADIO_Offset * agg_comm_cur_sz_p, + ADIO_Offset * agg_comm_sz_p, + int *agg_ol_cur_ct_p, int *agg_ol_ct_p, ADIO_Offset * agg_mem_next_off_p) +{ + int i, has_partial = 0; + MPI_Aint partial_disp = 0; + int partial_len = 0; + ADIO_Offset tmp_agg_comm_pre_sz = 0; + + assert(my_mem_view_state_p->pre_sz > 0); + switch (off_type) { + case TEMP_OFF: + /* Use only some of the precalculated data */ + if (my_mem_view_state_p->pre_sz > *agg_comm_sz_p) { + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) { + if ((my_mem_view_state_p->pre_blk_arr[i] + *agg_comm_pre_sz_p) > *agg_comm_sz_p) { + has_partial = 1; + partial_len = *agg_comm_sz_p - *agg_comm_pre_sz_p; + *agg_comm_pre_sz_p = *agg_comm_sz_p; + i++; + break; + } else if ((my_mem_view_state_p->pre_blk_arr[i] + + *agg_comm_pre_sz_p) == *agg_comm_sz_p) { + *agg_comm_pre_sz_p += my_mem_view_state_p->pre_blk_arr[i]; + i++; + break; + } else + *agg_comm_pre_sz_p += my_mem_view_state_p->pre_blk_arr[i]; + } + + if (has_partial == 1) { + *agg_mem_next_off_p = my_mem_view_state_p->pre_disp_arr[i - 1] + partial_len; + } else { + *agg_mem_next_off_p = + my_mem_view_state_p->pre_disp_arr[i - 1] + + my_mem_view_state_p->pre_blk_arr[i - 1]; + } + + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + *agg_ol_ct_p = i; + + } else { /* Use all the precalculated data */ + + *agg_comm_pre_sz_p = my_mem_view_state_p->pre_sz; + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + *agg_ol_ct_p = my_mem_view_state_p->pre_ol_ct; + *agg_mem_next_off_p = + my_mem_view_state_p->pre_disp_arr[my_mem_view_state_p->pre_ol_ct - 1] + + my_mem_view_state_p->pre_blk_arr[my_mem_view_state_p->pre_ol_ct - 1]; + } +#ifdef DEBUG1 + fprintf(stderr, "process_pre_req: TEMP_OFF " + "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d\n", + *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p); +#endif + assert(*agg_comm_cur_sz_p <= *agg_comm_sz_p); + break; + case REAL_OFF: + /* Set the ol list for the memtype that will map to our + * aggregator, coaslescing if possible. */ + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) { + agg_disp_arr[i] = my_mem_view_state_p->pre_disp_arr[i]; + agg_blk_arr[i] = my_mem_view_state_p->pre_blk_arr[i]; + + if ((my_mem_view_state_p->pre_blk_arr[i] + + tmp_agg_comm_pre_sz) > *agg_comm_pre_sz_p) { + has_partial = 1; + agg_blk_arr[i] = *agg_comm_pre_sz_p - tmp_agg_comm_pre_sz; + tmp_agg_comm_pre_sz = *agg_comm_pre_sz_p; + partial_disp = my_mem_view_state_p->pre_disp_arr[i] + agg_blk_arr[i]; + partial_len = my_mem_view_state_p->pre_blk_arr[i] - agg_blk_arr[i]; + i++; + break; + } else if ((my_mem_view_state_p->pre_blk_arr[i] + + tmp_agg_comm_pre_sz) == *agg_comm_pre_sz_p) { + tmp_agg_comm_pre_sz += my_mem_view_state_p->pre_blk_arr[i]; + i++; + break; + } else + tmp_agg_comm_pre_sz += my_mem_view_state_p->pre_blk_arr[i]; + } + *agg_mem_next_off_p = agg_disp_arr[i - 1] + agg_blk_arr[i - 1]; + *agg_ol_cur_ct_p = i; + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + + /* Clean up the ol pairs we used */ + if ((i < my_mem_view_state_p->pre_ol_ct) || (has_partial == 1)) { + int remain_ol_ct = my_mem_view_state_p->pre_ol_ct - i + has_partial; + MPI_Aint *new_pre_disp_arr = NULL; + int *new_pre_blk_arr = NULL; + + if ((new_pre_disp_arr = (MPI_Aint *) + ADIOI_Malloc(remain_ol_ct * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "process_pre_req: malloc " "new_pre_disp_arr failed\n"); + return -1; + } + if ((new_pre_blk_arr = (int *) + ADIOI_Malloc(remain_ol_ct * sizeof(int))) == NULL) { + fprintf(stderr, "process_pre_req: malloc " "new_pre_blk_arr failed\n"); + return -1; + } + + memcpy(new_pre_disp_arr, + &(my_mem_view_state_p->pre_disp_arr[i - has_partial]), + remain_ol_ct * sizeof(MPI_Aint)); + memcpy(new_pre_blk_arr, + &(my_mem_view_state_p->pre_blk_arr[i - has_partial]), + remain_ol_ct * sizeof(int)); + + /* Set the partial len of the first piece */ + if (has_partial == 1) { + /* new_pre_disp_arr[remain_ol_ct - 1] = partial_disp; + * new_pre_blk_arr[remain_ol_ct - 1] = partial_len; */ + new_pre_disp_arr[0] = partial_disp; + new_pre_blk_arr[0] = partial_len; + } + + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + ADIOI_Free(my_mem_view_state_p->pre_blk_arr); + + my_mem_view_state_p->pre_disp_arr = new_pre_disp_arr; + my_mem_view_state_p->pre_blk_arr = new_pre_blk_arr; + my_mem_view_state_p->pre_ol_ct = remain_ol_ct; + my_mem_view_state_p->pre_sz -= *agg_comm_pre_sz_p; + } else { /* Used all the precalculated ol pairs */ + + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + ADIOI_Free(my_mem_view_state_p->pre_blk_arr); + + my_mem_view_state_p->pre_disp_arr = NULL; + my_mem_view_state_p->pre_blk_arr = NULL; + my_mem_view_state_p->pre_ol_ct = 0; + my_mem_view_state_p->pre_sz = 0; + } +#ifdef DEBUG1 + fprintf(stderr, "process_pre_req: REAL_OFF " + "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d," + "agg_ol_cur_ct=%d\n", + *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p, *agg_ol_cur_ct_p); +#endif + break; + default: + fprintf(stderr, "process_pre_req: Invalid off_type %d\n", off_type); + } + return 0; +} + +/* ADIOI_Build_client_req() creates a memory datatype to transfer data + * to/from a particular aggregator. */ + +int ADIOI_Build_client_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state * my_mem_view_state_p, + view_state * agg_file_view_state_p, + ADIO_Offset agg_comm_sz, MPI_Datatype * agg_comm_dtype_p) +{ + MPI_Aint *agg_disp_arr = NULL; + int *agg_blk_arr = NULL; + ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int i = 0, agg_next_off_idx = -1; + ADIO_Offset agg_mem_next_off = 0, agg_comm_cur_sz = 0, agg_comm_pre_sz = 0; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + + if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_req: agg_rank %d does not map " + "to a valid node in cb_node\n", agg_rank); +#endif + return 0; + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5018, 0, NULL); +#endif + +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_req:(agg=%d,size_req=%Ld)\n", agg_idx, agg_comm_sz); +#endif + + /* On the first pass see how many offset-length pairs are + * necessary for each aggregator. Then allocate the correct + * amount of offset-length pairs for handling each aggregator's + * particular data size. On the last pass, we actually create the + * offset-length pairs. */ + for (i = 0; i < MAX_OFF_TYPE; i++) { + switch (i) { + case TEMP_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); + tmp_file_state_p = &(agg_file_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->cur_state); + tmp_file_state_p = &(agg_file_view_state_p->cur_state); + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " "Invalid off type %d\n", i); + } + + agg_comm_cur_sz = 0; + agg_mem_next_off = -1; + + /* First try to preprocess anything we can */ + if (my_mem_view_state_p->pre_sz > 0) { + process_pre_req(fd, + agg_rank, + agg_idx, + my_mem_view_state_p, + agg_file_view_state_p, + agg_comm_sz, + i, + agg_disp_arr, + agg_blk_arr, + &agg_comm_pre_sz, + &agg_comm_cur_sz, + &agg_comm_sz, &agg_ol_cur_ct, &agg_ol_ct, &agg_mem_next_off); + } + + while (agg_comm_cur_sz < agg_comm_sz) { + find_next_off(fd, agg_file_view_state_p, + fr_st_off_arr[agg_idx], + &(fr_type_arr[agg_idx]), i, &cur_off, &cur_reg_max_len); + + assert(cur_off != -1); + + /* Add up to the end of the file realm or as many bytes + * are left for this particular aggregator in the client's + * filetype */ + if (cur_reg_max_len > (agg_comm_sz - agg_comm_cur_sz)) { + cur_reg_max_len = agg_comm_sz - agg_comm_cur_sz; + } + assert(cur_reg_max_len > 0); + + view_state_add_region(cur_reg_max_len, agg_file_view_state_p, &st_reg, &act_reg_sz, i); + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_req: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", off_type_name[i], agg_rank, cur_off, act_reg_sz); +#endif + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + + assert(tmp_file_state_p->cur_sz - act_reg_sz >= tmp_mem_state_p->cur_sz); + + while (tmp_file_state_p->cur_sz - act_reg_sz != tmp_mem_state_p->cur_sz) { + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; +#ifdef DTYPE_SKIP + if (my_mem_view_state_p->flat_type_p->count > 1) { + /* let's see if we can skip whole memory datatypes */ + skip_type_ct = + (tmp_file_state_p->cur_sz - act_reg_sz - + tmp_mem_state_p->cur_sz) / my_mem_view_state_p->type_sz; + if (skip_type_ct > 0) { + tmp_mem_state_p->cur_sz += skip_type_ct * my_mem_view_state_p->type_sz; + tmp_mem_state_p->abs_off += skip_type_ct * my_mem_view_state_p->ext; + if ((tmp_mem_state_p->cur_sz - act_reg_sz) == tmp_file_state_p->cur_sz) + break; + } + } +#endif + view_state_add_region(tmp_file_state_p->cur_sz - + act_reg_sz - tmp_mem_state_p->cur_sz, + my_mem_view_state_p, &fill_st_reg, &fill_reg_sz, i); + } + + /* Based on how large the act_reg_sz is, first figure + * out how many memory offset-length pairs are + * necessary and then set the offset-length pairs. */ + tmp_reg_sz = 0; + while (tmp_reg_sz != act_reg_sz) { + view_state_add_region(act_reg_sz - tmp_reg_sz, + my_mem_view_state_p, &agg_mem_st_reg, &agg_mem_act_reg_sz, i); + tmp_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_req: %s Mem region" + "(off=%Ld,sz=%Ld)\n", off_type_name[i], agg_mem_st_reg, agg_mem_act_reg_sz); +#endif + agg_comm_cur_sz += agg_mem_act_reg_sz; + switch (i) { + case TEMP_OFF: + /* Increment the ol list count if the next + * region is not adjacent to the previous + * region. */ + if (agg_mem_next_off != agg_mem_st_reg) { + agg_ol_ct++; + } + agg_mem_next_off = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtype that + * will map to our aggregator, coaslescing + * if possible. */ + agg_next_off_idx = agg_ol_cur_ct; + if (agg_mem_next_off != agg_mem_st_reg) { + agg_disp_arr[agg_next_off_idx] = agg_mem_st_reg; + agg_blk_arr[agg_next_off_idx] = agg_mem_act_reg_sz; + agg_ol_cur_ct++; + } else { + agg_blk_arr[agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off = agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_req: " "Impossible type\n"); + } + } + } + + /* On the first pass, allocate the memory structures for + * creating the MPI_hindexed type. */ + if (i == TEMP_OFF) { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for each aggregator */ + if ((agg_disp_arr = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) { + fprintf(stderr, "ADIOI_Build_client_req: malloc " + "agg_disp_arr of size %ld failed\n", + (long int) agg_ol_ct * sizeof(MPI_Aint)); + return -1; + } + if ((agg_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, "ADIOI_Build_client_req: malloc " + "agg_blk_arr of size %ld failed\n", (long int) agg_ol_ct * sizeof(int)); + return -1; + } + } + } + + assert(agg_ol_ct == agg_ol_cur_ct); +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_req:(agg=%d,cur_ol_count=%d=ol_count=%d)\n", + agg_rank, agg_ol_cur_ct, agg_ol_ct); +#endif + +#ifdef DEBUG2 + if (agg_ol_ct > 0) { + fprintf(stderr, "ADIOI_Build_client_req: p %d (off,len) = ", agg_rank); + for (i = 0; i < agg_ol_ct; i++) { + fprintf(stderr, "[%d](%d,%d) ", i, agg_disp_arr[i], agg_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_req:(agg=%d,pre_ol_count=%d)\n", + agg_idx, my_mem_view_state_p->pre_ol_ct); +#endif + +#ifdef DEBUG2 + if (my_mem_view_state_p->pre_sz > 0) { + fprintf(stderr, "ADIOI_Build_client_req: p %d pre(off,len) = ", agg_idx); + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) { + fprintf(stderr, "[%d](%d,%d) ", i, + my_mem_view_state_p->pre_disp_arr[i], my_mem_view_state_p->pre_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif + + /* Create the aggregator MPI_Datatype */ + if (agg_comm_sz > 0) { + MPI_Type_create_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, agg_comm_dtype_p); + MPI_Type_commit(agg_comm_dtype_p); + } else { + *agg_comm_dtype_p = MPI_BYTE; + } + + ADIOI_Free(agg_blk_arr); + ADIOI_Free(agg_disp_arr); + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5019, 0, NULL); +#endif + return 0; +} diff --git a/3rd-party/romio341/adio/common/ad_coll_exch_new.c b/3rd-party/romio341/adio/common/ad_coll_exch_new.c new file mode 100644 index 0000000000000000000000000000000000000000..7f5a3365e8ed65b289fd7fe31cb0ea51aff5c097 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_coll_exch_new.c @@ -0,0 +1,403 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#include <assert.h> + +/* +#define DEBUG +#define DEBUG2 +*/ + +#define COUNT_EXCH 0 +#define BLOCK_LENS 1 +#define INDICES 2 +#define FPIND_DISP_OFF_SZ 3 + + +typedef struct { + int count; + ADIO_Offset fp_ind; + ADIO_Offset disp; + ADIO_Offset byte_off; + ADIO_Offset sz; + ADIO_Offset ext; + ADIO_Offset type_sz; +} amount_and_extra_data_t; + +/* Debugging function to print out an ADIOI_Flatlist_node. */ +void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node * flatlist_node_p) +{ + int i; + if (flatlist_node_p == NULL) { + fprintf(stderr, "print flatlist node of NULL ptr\n"); + return; + } + fprintf(stderr, "print flatlist node count = %d (idx,blocklen)\n", + (int) flatlist_node_p->count); + for (i = 0; i < flatlist_node_p->count; i++) { + if (i % 5 == 0 && i != 0) { + fprintf(stderr, "%d=(%lld,%lld)\n", i, (long long) flatlist_node_p->indices[i], + (long long) flatlist_node_p->blocklens[i]); + } else + fprintf(stderr, "%d=(%lld,%lld) ", i, (long long) flatlist_node_p->indices[i], + (long long) flatlist_node_p->blocklens[i]); + } + fprintf(stderr, "\n"); +} + + +/* ADIOI_Exchange_file_views - Sends all the aggregators the file + * views and file view states of the clients. It fills in the + * client_file_view_state_arr for the aggregators and the + * my_mem_view_state for the client. It also initializes the + * agg_file_view_state for all clients, which is the view for each + * aggregator of a client's filetype. */ +void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, + ADIO_File fd, int count, + MPI_Datatype datatype, ADIO_Offset off, + view_state * my_mem_view_state_arr, + view_state * agg_file_view_state_arr, + view_state * client_file_view_state_arr) +{ + /* Convert my own fileview to an ADIOI_Flattened type and a + * disp. MPI_Alltoall the count of ADIOI_Flatlist nodes. + * MPI_Isend/Irecv the block_lens, indices of ADIOI_Flatlist node + * to/from each of the aggregators with the rest of the file view + * state. */ + + int i = -1, j = -1; + amount_and_extra_data_t *send_count_arr = NULL; + amount_and_extra_data_t *recv_count_arr = NULL; + int send_req_arr_sz = 0; + int recv_req_arr_sz = 0; + MPI_Request *send_req_arr = NULL, *recv_req_arr = NULL; + MPI_Status *statuses = NULL; + ADIO_Offset disp_off_sz_ext_typesz[6]; + MPI_Aint lb, memtype_extent, filetype_extent; + int ret = -1; + + /* parameters for datatypes */ + ADIOI_Flatlist_node *flat_mem_p = NULL, *flat_file_p = NULL; + MPI_Count memtype_sz = -1; + int memtype_is_contig = -1; + ADIO_Offset filetype_sz = -1; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5014, 0, NULL); +#endif + /* The memtype will be freed after the call. The filetype will be + * freed in the close and should have been flattened in the file + * view. */ + MPI_Type_size_x(datatype, &memtype_sz); + MPI_Type_get_extent(datatype, &lb, &memtype_extent); + if (memtype_sz == memtype_extent) { + memtype_is_contig = 1; + flat_mem_p = ADIOI_Flatten_and_find(datatype); + flat_mem_p->blocklens[0] = memtype_sz * count; + } else { + flat_mem_p = ADIOI_Flatten_and_find(datatype); + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(fd->filetype, &filetype_sz); + flat_file_p = ADIOI_Flatten_and_find(fd->filetype); + if (filetype_extent == filetype_sz) { + flat_file_p->blocklens[0] = memtype_sz * count; + filetype_extent = memtype_sz * count; + filetype_sz = filetype_extent; + } + + disp_off_sz_ext_typesz[0] = fd->fp_ind; + disp_off_sz_ext_typesz[1] = fd->disp; + disp_off_sz_ext_typesz[2] = off; + disp_off_sz_ext_typesz[3] = memtype_sz * count; + disp_off_sz_ext_typesz[4] = (ADIO_Offset) filetype_extent; + disp_off_sz_ext_typesz[5] = (ADIO_Offset) filetype_sz; + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + recv_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); + send_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); + } else { + send_count_arr = ADIOI_Calloc(fd->hints->cb_nodes, sizeof(amount_and_extra_data_t)); + + /* only aggregators receive data */ + if (fd->is_agg) { + recv_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); + recv_req_arr = ADIOI_Malloc(nprocs * sizeof(MPI_Request)); + for (i = 0; i < nprocs; i++) + MPI_Irecv(&recv_count_arr[i], sizeof(amount_and_extra_data_t), + MPI_BYTE, i, COUNT_EXCH, fd->comm, &recv_req_arr[i]); + } + + /* only send data to aggregators */ + send_req_arr = ADIOI_Calloc(fd->hints->cb_nodes, sizeof(MPI_Request)); + for (i = 0; i < fd->hints->cb_nodes; i++) { + send_count_arr[i].count = flat_file_p->count; + send_count_arr[i].fp_ind = disp_off_sz_ext_typesz[0]; + send_count_arr[i].disp = disp_off_sz_ext_typesz[1]; + send_count_arr[i].byte_off = disp_off_sz_ext_typesz[2]; + send_count_arr[i].sz = disp_off_sz_ext_typesz[3]; + send_count_arr[i].ext = disp_off_sz_ext_typesz[4]; + send_count_arr[i].type_sz = disp_off_sz_ext_typesz[5]; + MPI_Isend(&send_count_arr[i], sizeof(amount_and_extra_data_t), + MPI_BYTE, fd->hints->ranklist[i], COUNT_EXCH, fd->comm, &send_req_arr[i]); + } + } + + + /* Every client has to build mem and file view_states for each aggregator. + * We initialize their values here. and we also initialize + * send_count_arr */ + + if (memtype_is_contig) { + /* if memory is contigous, we now replace memtype_sz and + * memtype_extent with the full access size */ + memtype_sz *= count; + memtype_extent = memtype_sz; + } + + for (i = 0; i < fd->hints->cb_nodes; i++) { + int tmp_agg_idx = fd->hints->ranklist[i]; + memset(&(my_mem_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); + my_mem_view_state_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3]; + my_mem_view_state_arr[tmp_agg_idx].ext = (ADIO_Offset) memtype_extent; + my_mem_view_state_arr[tmp_agg_idx].type_sz = (ADIO_Offset) memtype_sz; + my_mem_view_state_arr[tmp_agg_idx].flat_type_p = flat_mem_p; + ADIOI_init_view_state(file_ptr_type, 1, &(my_mem_view_state_arr[tmp_agg_idx]), TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, 1, &(my_mem_view_state_arr[tmp_agg_idx]), REAL_OFF); + + memset(&(agg_file_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); + agg_file_view_state_arr[tmp_agg_idx].fp_ind = disp_off_sz_ext_typesz[0]; + agg_file_view_state_arr[tmp_agg_idx].disp = disp_off_sz_ext_typesz[1]; + agg_file_view_state_arr[tmp_agg_idx].byte_off = disp_off_sz_ext_typesz[2]; + agg_file_view_state_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3]; + agg_file_view_state_arr[tmp_agg_idx].ext = disp_off_sz_ext_typesz[4]; + agg_file_view_state_arr[tmp_agg_idx].type_sz = disp_off_sz_ext_typesz[5]; + agg_file_view_state_arr[tmp_agg_idx].flat_type_p = flat_file_p; + + ADIOI_init_view_state(file_ptr_type, 1, &(agg_file_view_state_arr[tmp_agg_idx]), TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, 1, &(agg_file_view_state_arr[tmp_agg_idx]), REAL_OFF); + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + send_count_arr[tmp_agg_idx].count = flat_file_p->count; + send_count_arr[tmp_agg_idx].fp_ind = disp_off_sz_ext_typesz[0]; + send_count_arr[tmp_agg_idx].disp = disp_off_sz_ext_typesz[1]; + send_count_arr[tmp_agg_idx].byte_off = disp_off_sz_ext_typesz[2]; + send_count_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3]; + send_count_arr[tmp_agg_idx].ext = disp_off_sz_ext_typesz[4]; + send_count_arr[tmp_agg_idx].type_sz = disp_off_sz_ext_typesz[5]; + } + } + +#ifdef DEBUG2 + fprintf(stderr, "my own flattened memtype: "); + ADIOI_Print_flatlist_node(flat_mem_p); + fprintf(stderr, "my own flattened filetype: "); + ADIOI_Print_flatlist_node(flat_file_p); +#endif + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + ret = MPI_Alltoall(send_count_arr, sizeof(amount_and_extra_data_t), + MPI_BYTE, + recv_count_arr, sizeof(amount_and_extra_data_t), MPI_BYTE, fd->comm); + if (ret != MPI_SUCCESS) { + fprintf(stderr, "ADIOI_Exchange_file_views: MPI_Alltoall failed " "with error %d", ret); + return; + } + } else { +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + statuses = (MPI_Status *) ADIOI_Malloc(1 + nprocs * sizeof(MPI_Status)); +#endif + if (fd->is_agg) { + MPI_Waitall(nprocs, recv_req_arr, statuses); + ADIOI_Free(recv_req_arr); + } + MPI_Waitall(fd->hints->cb_nodes, send_req_arr, statuses); +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + ADIOI_Free(send_req_arr); + } +#ifdef DEBUG2 + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + fprintf(stderr, "send_count_arr:"); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); + } + fprintf(stderr, "\n"); + fprintf(stderr, "recv_count_arr:"); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); + } + fprintf(stderr, "\n"); + } else { + fprintf(stderr, "send_count_arr:"); + for (i = 0; i < fd->hints->cb_nodes; i++) { + fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); + } + fprintf(stderr, "\n"); + if (fd->is_agg) { + fprintf(stderr, "recv_count_arr:"); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); + } + fprintf(stderr, "\n"); + } + } +#endif + + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + for (i = 0; i < fd->hints->cb_nodes; i++) + if (send_count_arr[i].count > 0) + send_req_arr_sz++; + } + /* Figure out how many counts to send/recv */ + for (i = 0; i < nprocs; i++) { + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + if (send_count_arr[i].count > 0) + send_req_arr_sz++; + } + /* Only aggregators should recv */ + if (fd->is_agg) { + if (recv_count_arr[i].count > 0) { + if ((client_file_view_state_arr[i].flat_type_p = + (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node))) == NULL) { + fprintf(stderr, "ADIOI_Exchange_file_views: malloc " "flat_type_p failed\n"); + } + client_file_view_state_arr[i].flat_type_p->count = recv_count_arr[i].count; + client_file_view_state_arr[i].flat_type_p->indices = + (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, sizeof(ADIO_Offset)); + client_file_view_state_arr[i].flat_type_p->blocklens = + (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, sizeof(ADIO_Offset)); + + /* Copy the extra data out of the stuff we Alltoall'd */ + memcpy(&client_file_view_state_arr[i].fp_ind, + &recv_count_arr[i].fp_ind, 6 * sizeof(ADIO_Offset)); + + recv_req_arr_sz++; + } + } + } + + /* Since ADIOI_Calloc may do other things we add the +1 + * to avoid a 0-size malloc */ + send_req_arr = (MPI_Request *) ADIOI_Calloc(2 * (send_req_arr_sz) + 1, sizeof(MPI_Request)); + + j = 0; + if (recv_req_arr_sz > 0) { + assert(fd->is_agg); + recv_req_arr = (MPI_Request *) ADIOI_Calloc(2 * (recv_req_arr_sz), sizeof(MPI_Request)); + for (i = 0; i < nprocs; i++) { + if (recv_count_arr[i].count > 0) { + MPI_Irecv(client_file_view_state_arr[i].flat_type_p->indices, + recv_count_arr[i].count, ADIO_OFFSET, i, + INDICES, fd->comm, &recv_req_arr[j]); + j++; + MPI_Irecv(client_file_view_state_arr[i].flat_type_p->blocklens, + recv_count_arr[i].count, ADIO_OFFSET, i, + BLOCK_LENS, fd->comm, &recv_req_arr[j]); + j++; + } + } + } + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + j = 0; + for (i = 0; i < nprocs; i++) { + if (send_count_arr[i].count > 0) { + MPI_Isend(flat_file_p->indices, + send_count_arr[i].count, ADIO_OFFSET, i, + INDICES, fd->comm, &send_req_arr[j]); + j++; + MPI_Isend(flat_file_p->blocklens, + send_count_arr[i].count, ADIO_OFFSET, i, + BLOCK_LENS, fd->comm, &send_req_arr[j]); + j++; + } + } + } else { + j = 0; + for (i = 0; i < fd->hints->cb_nodes; i++) { + if (send_count_arr[i].count > 0) { + MPI_Isend(flat_file_p->indices, + send_count_arr[i].count, ADIO_OFFSET, + fd->hints->ranklist[i], INDICES, fd->comm, &send_req_arr[j]); + j++; + MPI_Isend(flat_file_p->blocklens, + send_count_arr[i].count, ADIO_OFFSET, + fd->hints->ranklist[i], BLOCK_LENS, fd->comm, &send_req_arr[j]); + j++; + } + } + } + + /* Since ADIOI_Malloc may do other things we add the +1 + * to avoid a 0-size malloc */ +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + statuses = (MPI_Status *) + ADIOI_Malloc(1 + 2 * MPL_MAX(send_req_arr_sz, recv_req_arr_sz) + * sizeof(MPI_Status)); +#endif + + if (send_req_arr_sz > 0) { + MPI_Waitall(2 * send_req_arr_sz, send_req_arr, statuses); + ADIOI_Free(send_count_arr); + ADIOI_Free(send_req_arr); + } + if (recv_req_arr_sz > 0) { + MPI_Waitall(2 * recv_req_arr_sz, recv_req_arr, statuses); + ADIOI_Free(recv_count_arr); + ADIOI_Free(recv_req_arr); + } +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + + if (fd->is_agg == 1) { + ADIOI_init_view_state(file_ptr_type, nprocs, client_file_view_state_arr, TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, nprocs, client_file_view_state_arr, REAL_OFF); + } +#ifdef DEBUG + if (fd->is_agg == 1) { + ADIOI_Flatlist_node *fr_node_p; + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "client_file_view_state_arr[%d]=(fp_ind=%Ld," + "disp=%Ld,byte_off=%Ld,sz=%Ld,ext=%Ld\n", i, + client_file_view_state_arr[i].fp_ind, + client_file_view_state_arr[i].disp, + client_file_view_state_arr[i].byte_off, + client_file_view_state_arr[i].sz, client_file_view_state_arr[i].ext); + } + + fr_node_p = ADIOI_Flatten_and_find(fd->file_realm_types[fd->my_cb_nodes_index]); + assert(fr_node_p != NULL); + + fprintf(stderr, "my file realm (idx=%d,st_off=%Ld) ", + fd->my_cb_nodes_index, fd->file_realm_st_offs[fd->my_cb_nodes_index]); + ADIOI_Print_flatlist_node(fr_node_p); + } +#endif + +#ifdef DEBUG2 + if (fd->is_agg == 1) { + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "client_file_view_state_arr[%d]: ", i); + ADIOI_Print_flatlist_node(client_file_view_state_arr[i].flat_type_p); + } + } +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5015, 0, NULL); +#endif +} diff --git a/3rd-party/romio341/adio/common/ad_darray.c b/3rd-party/romio341/adio/common/ad_darray.c new file mode 100644 index 0000000000000000000000000000000000000000..6e0fc574d51926ef4fbdc8b0f0203625f4e44f5d --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_darray.c @@ -0,0 +1,310 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype * type_new, MPI_Aint * st_offset); +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype * type_new, MPI_Aint * st_offset); + + +int ADIO_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype) +{ + MPI_Datatype type_old, type_new = MPI_DATATYPE_NULL, types[1]; + int procs, tmp_rank, i, tmp_size, blklens[1], *coords; + MPI_Aint *st_offsets, lb, ub, orig_extent, disps[1]; + + MPI_Type_get_extent(oldtype, &lb, &orig_extent); + +/* calculate position in Cartesian grid as MPI would (row-major + ordering) */ + coords = (int *) ADIOI_Malloc(ndims * sizeof(int)); + procs = size; + tmp_rank = rank; + for (i = 0; i < ndims; i++) { + procs = procs / array_of_psizes[i]; + coords[i] = tmp_rank / procs; + tmp_rank = tmp_rank % procs; + } + + st_offsets = (MPI_Aint *) ADIOI_Malloc(ndims * sizeof(MPI_Aint)); + type_old = oldtype; + + if (order == MPI_ORDER_FORTRAN) { + /* dimension 0 changes fastest */ + for (i = 0; i < ndims; i++) { + switch (array_of_distribs[i]) { + case MPI_DISTRIBUTE_BLOCK: + MPIOI_Type_block(array_of_gsizes, i, ndims, + array_of_psizes[i], + coords[i], array_of_dargs[i], + order, orig_extent, type_old, &type_new, st_offsets + i); + break; + case MPI_DISTRIBUTE_CYCLIC: + MPIOI_Type_cyclic(array_of_gsizes, i, ndims, + array_of_psizes[i], coords[i], + array_of_dargs[i], order, + orig_extent, type_old, &type_new, st_offsets + i); + break; + case MPI_DISTRIBUTE_NONE: + /* treat it as a block distribution on 1 process */ + MPIOI_Type_block(array_of_gsizes, i, ndims, 1, 0, + MPI_DISTRIBUTE_DFLT_DARG, order, + orig_extent, type_old, &type_new, st_offsets + i); + break; + } + if (i) + MPI_Type_free(&type_old); + type_old = type_new; + } + + /* add displacement and UB */ + disps[0] = st_offsets[0]; + tmp_size = 1; + for (i = 1; i < ndims; i++) { + tmp_size *= array_of_gsizes[i - 1]; + disps[0] += (MPI_Aint) tmp_size *st_offsets[i]; + } + /* rest done below for both Fortran and C order */ + } + + else { /* order == MPI_ORDER_C */ + + /* dimension ndims-1 changes fastest */ + for (i = ndims - 1; i >= 0; i--) { + switch (array_of_distribs[i]) { + case MPI_DISTRIBUTE_BLOCK: + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], array_of_dargs[i], order, + orig_extent, type_old, &type_new, st_offsets + i); + break; + case MPI_DISTRIBUTE_CYCLIC: + MPIOI_Type_cyclic(array_of_gsizes, i, ndims, + array_of_psizes[i], coords[i], + array_of_dargs[i], order, + orig_extent, type_old, &type_new, st_offsets + i); + break; + case MPI_DISTRIBUTE_NONE: + /* treat it as a block distribution on 1 process */ + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, + type_old, &type_new, st_offsets + i); + break; + } + if (i != ndims - 1) + MPI_Type_free(&type_old); + type_old = type_new; + } + + /* add displacement and UB */ + disps[0] = st_offsets[ndims - 1]; + tmp_size = 1; + for (i = ndims - 2; i >= 0; i--) { + tmp_size *= array_of_gsizes[i + 1]; + disps[0] += (MPI_Aint) tmp_size *st_offsets[i]; + } + } + + disps[0] *= orig_extent; + + lb = 0; + ub = orig_extent; + for (i = 0; i < ndims; i++) + ub *= (MPI_Aint) array_of_gsizes[i]; + + blklens[0] = 1; + types[0] = type_new; + + MPI_Type_create_struct(1, blklens, disps, types, &type_old); + MPI_Type_create_resized(type_old, lb, ub, newtype); + + MPI_Type_free(&type_old); + MPI_Type_free(&type_new); + + ADIOI_Free(st_offsets); + ADIOI_Free(coords); + return MPI_SUCCESS; +} + + +/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above + * needs to call MPIO_Err_return_xxx. + */ +static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype * type_new, MPI_Aint * st_offset) +{ +/* nprocs = no. of processes in dimension dim of grid + rank = coordinate of this process in dimension dim */ + int blksize, global_size, mysize, i, j; + MPI_Aint stride; + + global_size = array_of_gsizes[dim]; + + if (darg == MPI_DISTRIBUTE_DFLT_DARG) + blksize = (global_size + nprocs - 1) / nprocs; + else { + blksize = darg; + + /* --BEGIN ERROR HANDLING-- */ + if (blksize <= 0) { + return MPI_ERR_ARG; + } + + if (blksize * nprocs < global_size) { + return MPI_ERR_ARG; + } + /* --END ERROR HANDLING-- */ + } + + j = global_size - blksize * rank; + mysize = MPL_MIN(blksize, j); + if (mysize < 0) + mysize = 0; + + stride = orig_extent; + if (order == MPI_ORDER_FORTRAN) { + if (dim == 0) + MPI_Type_contiguous(mysize, type_old, type_new); + else { + for (i = 0; i < dim; i++) + stride *= (MPI_Aint) array_of_gsizes[i]; + MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new); + } + } else { + if (dim == ndims - 1) + MPI_Type_contiguous(mysize, type_old, type_new); + else { + for (i = ndims - 1; i > dim; i--) + stride *= (MPI_Aint) array_of_gsizes[i]; + MPI_Type_create_hvector(mysize, 1, stride, type_old, type_new); + } + + } + + *st_offset = (MPI_Aint) blksize *(MPI_Aint) rank; + /* in terms of no. of elements of type oldtype in this dimension */ + if (mysize == 0) + *st_offset = 0; + + MPI_Aint lb, ex; + MPI_Type_get_extent(type_old, &lb, &ex); + MPI_Datatype type_tmp; + MPI_Type_create_resized(*type_new, 0, array_of_gsizes[dim] * ex, &type_tmp); + MPI_Type_free(type_new); + *type_new = type_tmp; + + return MPI_SUCCESS; +} + + +/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above + * needs to call MPIO_Err_return_xxx. + */ +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype * type_new, MPI_Aint * st_offset) +{ +/* nprocs = no. of processes in dimension dim of grid + rank = coordinate of this process in dimension dim */ + int blksize, i, blklens[3], st_index, end_index, local_size, rem, count; + MPI_Aint stride, disps[3]; + MPI_Datatype type_tmp, types[3]; + + if (darg == MPI_DISTRIBUTE_DFLT_DARG) + blksize = 1; + else + blksize = darg; + + /* --BEGIN ERROR HANDLING-- */ + if (blksize <= 0) { + return MPI_ERR_ARG; + } + /* --END ERROR HANDLING-- */ + + st_index = rank * blksize; + end_index = array_of_gsizes[dim] - 1; + + if (end_index < st_index) + local_size = 0; + else { + local_size = ((end_index - st_index + 1) / (nprocs * blksize)) * blksize; + rem = (end_index - st_index + 1) % (nprocs * blksize); + local_size += MPL_MIN(rem, blksize); + } + + count = local_size / blksize; + rem = local_size % blksize; + + stride = (MPI_Aint) nprocs *(MPI_Aint) blksize *orig_extent; + if (order == MPI_ORDER_FORTRAN) + for (i = 0; i < dim; i++) + stride *= (MPI_Aint) array_of_gsizes[i]; + else + for (i = ndims - 1; i > dim; i--) + stride *= (MPI_Aint) array_of_gsizes[i]; + + MPI_Type_create_hvector(count, blksize, stride, type_old, type_new); + + if (rem) { + /* if the last block is of size less than blksize, include + * it separately using MPI_Type_create_struct */ + + types[0] = *type_new; + types[1] = type_old; + disps[0] = 0; + disps[1] = (MPI_Aint) count *stride; + blklens[0] = 1; + blklens[1] = rem; + + MPI_Type_create_struct(2, blklens, disps, types, &type_tmp); + + MPI_Type_free(type_new); + *type_new = type_tmp; + } + + /* In the first iteration, we need to set the displacement in that + * dimension correctly. */ + if (((order == MPI_ORDER_FORTRAN) && (dim == 0)) || + ((order == MPI_ORDER_C) && (dim == ndims - 1))) { + MPI_Datatype tmp; + MPI_Aint lb, ub; + types[0] = *type_new; + disps[0] = (MPI_Aint) rank *(MPI_Aint) blksize *orig_extent; + lb = 0; + ub = orig_extent * (MPI_Aint) array_of_gsizes[dim]; + blklens[0] = 1; + MPI_Type_create_struct(1, blklens, disps, types, &tmp); + MPI_Type_create_resized(tmp, lb, ub, &type_tmp); + MPI_Type_free(&tmp); + MPI_Type_free(type_new); + *type_new = type_tmp; + + *st_offset = 0; /* set it to 0 because it is taken care of in + * the struct above */ + } else { + *st_offset = (MPI_Aint) rank *(MPI_Aint) blksize; + /* st_offset is in terms of no. of elements of type oldtype in + * this dimension */ + } + + if (local_size == 0) + *st_offset = 0; + + MPI_Aint lb, ex; + MPI_Type_get_extent(type_old, &lb, &ex); + MPI_Type_create_resized(*type_new, 0, array_of_gsizes[dim] * ex, &type_tmp); + MPI_Type_free(type_new); + *type_new = type_tmp; + + return MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_delete.c b/3rd-party/romio341/adio/common/ad_delete.c new file mode 100644 index 0000000000000000000000000000000000000000..89cf0acd4e58eb8927e72079d96fce71666c6cb2 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_delete.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_GEN_Delete(const char *filename, int *error_code) +{ + int err; + static char myname[] = "ADIOI_GEN_DELETE"; + + err = unlink(filename); + if (err == -1) { + *error_code = ADIOI_Err_create_code(myname, filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/common/ad_done.c b/3rd-party/romio341/adio/common/ad_done.c similarity index 68% rename from 3rd-party/romio321/adio/common/ad_done.c rename to 3rd-party/romio341/adio/common/ad_done.c index 50764b7bb5912786947eb397187ff54397b6d407..dba876b5d0ef618019092b0246dbefa896a5ad98 100644 --- a/3rd-party/romio321/adio/common/ad_done.c +++ b/3rd-party/romio341/adio/common/ad_done.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -20,15 +18,15 @@ #ifdef HAVE_AIO_LITE_H #include <aio-lite.h> #else - #ifdef HAVE_AIO_H - #include <aio.h> - #endif - #ifdef HAVE_SYS_AIO_H - #include <sys/aio.h> - #endif +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif #endif -/* Workaround for incomplete set of definitions if __REDIRECT is not +/* Workaround for incomplete set of definitions if __REDIRECT is not defined and large file support is used in aio.h */ #if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) #define aiocb aiocb64 @@ -44,9 +42,8 @@ * If ROMIO_HAVE_WORKING_AIO is defined, then we may need to wait for I/O * to complete. */ -int ADIOI_GEN_IODone(ADIO_Request *request, ADIO_Status *status, - int *error_code) +int ADIOI_GEN_IODone(ADIO_Request * request, ADIO_Status * status, int *error_code) { - return 0; + return 0; } diff --git a/3rd-party/romio341/adio/common/ad_done_fake.c b/3rd-party/romio341/adio/common/ad_done_fake.c new file mode 100644 index 0000000000000000000000000000000000000000..efd02c6c79256dc254c7dd75365439acd307f9ac --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_done_fake.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* Generic implementation of ReadDone/WriteDone simply sets the + * bytes field in the status structure and frees the request. + * + * Same function is used for both reads and writes. + */ +int ADIOI_FAKE_IODone(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + /* should not ever get called now */ + return 1; +} diff --git a/3rd-party/romio321/adio/common/ad_end.c b/3rd-party/romio341/adio/common/ad_end.c similarity index 62% rename from 3rd-party/romio321/adio/common/ad_end.c rename to 3rd-party/romio341/adio/common/ad_end.c index a4d186f9272a2c636a50c23d1eed10faeeede58a..a009297f61ed3e8064dcc5248b8bc3778be1db08 100644 --- a/3rd-party/romio321/adio/common/ad_end.c +++ b/3rd-party/romio341/adio/common/ad_end.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -9,9 +8,8 @@ void ADIO_End(int *error_code) { - ADIOI_Flatlist_node *curr, *next; ADIOI_Datarep *datarep, *datarep_next; - + /* FPRINTF(stderr, "reached end\n"); */ /* if a default errhandler was set on MPI_FILE_NULL then we need to ensure @@ -23,21 +21,12 @@ void ADIO_End(int *error_code) PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN); #endif -/* delete the flattened datatype list */ - curr = ADIOI_Flatlist; - while (curr) { - if (curr->blocklens) ADIOI_Free(curr->blocklens); - if (curr->indices) ADIOI_Free(curr->indices); - next = curr->next; - ADIOI_Free(curr); - curr = next; - } - ADIOI_Flatlist = NULL; - /* free file and info tables used for Fortran interface */ - if (ADIOI_Ftable) ADIOI_Free(ADIOI_Ftable); + if (ADIOI_Ftable) + ADIOI_Free(ADIOI_Ftable); #ifndef HAVE_MPI_INFO - if (MPIR_Infotable) ADIOI_Free(MPIR_Infotable); + if (MPIR_Infotable) + ADIOI_Free(MPIR_Infotable); #endif @@ -50,8 +39,8 @@ void ADIO_End(int *error_code) datarep = datarep_next; } - if( ADIOI_syshints != MPI_INFO_NULL) - MPI_Info_free(&ADIOI_syshints); + if (ADIOI_syshints != MPI_INFO_NULL) + MPI_Info_free(&ADIOI_syshints); MPI_Op_free(&ADIO_same_amode); @@ -59,26 +48,28 @@ void ADIO_End(int *error_code) } - /* This is the delete callback function associated with ADIO_Init_keyval when MPI_COMM_SELF is freed */ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void - *extra_state) + *extra_state) { int error_code; - ADIOI_UNREFERENCED_ARG(comm); - ADIOI_UNREFERENCED_ARG(attribute_val); - ADIOI_UNREFERENCED_ARG(extra_state); + MPL_UNREFERENCED_ARG(comm); + MPL_UNREFERENCED_ARG(attribute_val); + MPL_UNREFERENCED_ARG(extra_state); - MPI_Comm_free_keyval (&keyval); + MPI_Keyval_free(&keyval); /* The end call will be called after all possible uses of this keyval, even * if a file was opened with MPI_COMM_SELF. Note, this assumes LIFO * MPI_COMM_SELF attribute destruction behavior mandated by MPI-2.2. */ if (ADIOI_cb_config_list_keyval != MPI_KEYVAL_INVALID) - MPI_Comm_free_keyval (&ADIOI_cb_config_list_keyval); + MPI_Keyval_free(&ADIOI_cb_config_list_keyval); + + if (ADIOI_Flattened_type_keyval != MPI_KEYVAL_INVALID) + MPI_Type_free_keyval(&ADIOI_Flattened_type_keyval); ADIO_End(&error_code); return error_code; diff --git a/3rd-party/romio341/adio/common/ad_fcntl.c b/3rd-party/romio341/adio/common/ad_fcntl.c new file mode 100644 index 0000000000000000000000000000000000000000..7d6f5b7d3504de58c00d883e67846d09510ec99e --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_fcntl.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code) +{ + static char myname[] = "ADIOI_GEN_FCNTL"; + + switch (flag) { + case ADIO_FCNTL_GET_FSIZE: +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (fd->fp_sys_posn != -1) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + } + if (fcntl_struct->fsize == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + /* --BEGIN ERROR HANDLING-- */ + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**flag", "**flag %d", flag); + /* --END ERROR HANDLING-- */ + } +} diff --git a/3rd-party/romio341/adio/common/ad_features.c b/3rd-party/romio341/adio/common/ad_features.c new file mode 100644 index 0000000000000000000000000000000000000000..d95c70c1ef022735d803335d10ed8de759c68b28 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_features.c @@ -0,0 +1,25 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +int ADIOI_GEN_Feature(ADIO_File fd, int flag) +{ + switch (flag) { + case ADIO_LOCKS: + case ADIO_SHARED_FP: + case ADIO_ATOMIC_MODE: + case ADIO_DATA_SIEVING_WRITES: + case ADIO_UNLINK_AFTER_CLOSE: + case ADIO_TWO_PHASE: + case ADIO_SCALABLE_RESIZE: + return 1; + break; + case ADIO_SCALABLE_OPEN: + default: + return 0; + break; + } +} diff --git a/3rd-party/romio341/adio/common/ad_flush.c b/3rd-party/romio341/adio/common/ad_flush.c new file mode 100644 index 0000000000000000000000000000000000000000..276163e9ed82f1e1dd4e3c9ed18c9b70cc5f2704 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_flush.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_GEN_Flush(ADIO_File fd, int *error_code) +{ + int err; + static char myname[] = "ADIOI_GEN_FLUSH"; + + /* the deferred-open optimization may mean that a file has not been opened + * on this processor */ + if (fd->is_open > 0) { + err = fsync(fd->fd_sys); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", strerror(errno)); + return; + } + /* --END ERROR HANDLING-- */ + } + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_fstype.c b/3rd-party/romio341/adio/common/ad_fstype.c new file mode 100644 index 0000000000000000000000000000000000000000..1bbe18d618b95b74d9c22f9f6e672770001e08ce --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_fstype.c @@ -0,0 +1,759 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* This file is quickly becoming the single one, outside the ADIO + * implementations, which has "what ADIO components are built in" code in it. + */ + +#include "adio.h" + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#ifdef HAVE_PVFS_H +#include "pvfs.h" +#endif + +#ifdef HAVE_PVFS2_H +#include "pvfs2.h" +#endif + +#ifdef HAVE_ZOIDFS_H +#include "zoidfs.h" +#endif + +#ifdef HAVE_GPFS_H +#include "gpfs.h" +#endif + +/* Notes on detection process: + * + * There are three more "general" mechanisms that we use for detecting + * file system type: + * - struct statfs's f_type field + * - struct statvfs's f_basetype field + * - struct stat's st_fstype field + * + * Otherwise we'll fall back on some OS-specific approach. + */ + +#ifdef HAVE_STRUCT_STATFS +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif + /* On Linux platforms, linux/nfs_fs.h is all messed up and cannot be + * reliably included. + */ +#if defined(ROMIO_NFS) && !defined(NFS_SUPER_MAGIC) +#define NFS_SUPER_MAGIC 0x6969 +#endif + +#if defined(ROMIO_PANFS) && !defined(PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) +#define PAN_KERNEL_FS_CLIENT_SUPER_MAGIC 0xAAD7AAEA +#endif +#endif + +#if defined(ROMIO_XFS) && !defined(XFS_SUPER_MAGIC) +#define XFS_SUPER_MAGIC 0x58465342 +#endif + +#if defined(ROMIO_XFS) && !defined(EXFS_SUPER_MAGIC) +#define EXFS_SUPER_MAGIC 0x45584653 +#endif + +#if !defined(PVFS2_SUPER_MAGIC) +#define PVFS2_SUPER_MAGIC (0x20030528) +#endif + +#if defined(ROMIO_GPFS) && !defined(GPFS_SUPER_MAGIC) +#define GPFS_SUPER_MAGIC 0x47504653 +#endif + +#if !defined(DAOS_SUPER_MAGIC) +#define DAOS_SUPER_MAGIC (0xDA05AD10) +#endif + +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#endif + +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#endif + +/* ADIO_FileSysType_parentdir is only used if one of these is defined. + By including this test, we avoid warnings about unused static functions + from the compiler */ +#if defined(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || \ + defined(HAVE_STRUCT_STATFS) || \ + defined(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE) +#ifndef ROMIO_NTFS +#define ROMIO_NEEDS_ADIOPARENTDIR +static void ADIO_FileSysType_parentdir(const char *filename, char **dirnamep); +#endif +#endif +static void ADIO_FileSysType_prefix(const char *filename, int *fstype, + ADIOI_Fns ** ops, int *error_code); +static void ADIO_FileSysType_fncall(const char *filename, int *fstype, int *error_code); +struct ADIO_FSTypes { + ADIOI_Fns *fileops; /* function table */ + int fstype; /* ADIO_xxx constant */ + const char *prefix; /* file prefix */ +}; + +/* + * To add an ADIO + * - add to the table below + * - add a constant for your ADIO in include/adio.h + * - add a guarded include in include/adioi_fs_proto.h + */ +static struct ADIO_FSTypes fstypes[] = { +#ifdef ROMIO_UFS + {&ADIO_UFS_operations, ADIO_UFS, "ufs:"}, +#endif +#ifdef ROMIO_NFS + {&ADIO_NFS_operations, ADIO_NFS, "nfs:"}, +#endif +#ifdef ROMIO_XFS + {&ADIO_XFS_operations, ADIO_XFS, "xfs:"}, +#endif +#ifdef ROMIO_PVFS2 + {&ADIO_PVFS2_operations, ADIO_PVFS2, "pvfs2:"}, +#endif +#ifdef ROMIO_GPFS + {&ADIO_GPFS_operations, ADIO_GPFS, "gpfs:"}, +#endif +#ifdef ROMIO_PANFS + {&ADIO_PANFS_operations, ADIO_PANFS, "panfs:"}, +#endif +#ifdef ROMIO_LUSTRE + {&ADIO_LUSTRE_operations, ADIO_LUSTRE, "lustre:"}, +#endif +#ifdef ROMIO_DAOS + {&ADIO_DAOS_operations, ADIO_DAOS, "daos:"}, +#endif +#ifdef ROMIO_TESTFS + {&ADIO_TESTFS_operations, ADIO_TESTFS, "testfs:"}, +#endif +#ifdef ROMIO_IME + {&ADIO_IME_operations, ADIO_IME, "ime:"}, +#endif +#ifdef ROMIO_QUOBYTEFS + {&ADIO_QUOBYTEFS_operations, ADIO_QUOBYTEFS, "quobyte:"}, +#endif + {0, 0, 0} /* guard entry */ +}; + + +/* + ADIO_FileSysType_parentdir - determines a string pathname for the + parent directory of a given filename. + +Input Parameters: +. filename - pointer to file name character array + +Output Parameters: +. dirnamep - pointer to location in which to store a pointer to a string + + Note that the caller should free the memory located at the pointer returned + after the string is no longer needed. +*/ +#ifdef ROMIO_NEEDS_ADIOPARENTDIR + +/* In a strict ANSI environment, S_ISLNK may not be defined. Fix that + here. We assume that S_ISLNK is *always* defined as a macro. If + that is not universally true, then add a test to the romio + configure that trys to link a program that references S_ISLNK */ +#if !defined(S_ISLNK) +#if defined(S_IFLNK) + /* Check for the link bit */ +#define S_ISLNK(mode) ((mode) & S_IFLNK) +#else + /* no way to check if it is a link, so say false */ +#define S_ISLNK(mode) 0 +#endif +#endif /* !(S_ISLNK) */ + +/* ADIO_FileSysType_parentdir + * + * Returns pointer to string in dirnamep; that string is allocated with + * strdup and must be free()'d. + */ +static void ADIO_FileSysType_parentdir(const char *filename, char **dirnamep) +{ + int err; + char *dir = NULL, *slash; + struct stat statbuf; + + err = lstat(filename, &statbuf); + + if (err || (!S_ISLNK(statbuf.st_mode))) { + /* no such file, or file is not a link; these are the "normal" + * cases where we can just return the parent directory. + */ + dir = ADIOI_Strdup(filename); + } else { + /* filename is a symlink. we've presumably already tried + * to stat it and found it to be missing (dangling link), + * but this code doesn't care if the target is really there + * or not. + */ + ssize_t namelen; + char *linkbuf; + + linkbuf = ADIOI_Malloc(PATH_MAX + 1); + namelen = readlink(filename, linkbuf, PATH_MAX + 1); + if (namelen == -1) { + /* something strange has happened between the time that + * we determined that this was a link and the time that + * we attempted to read it; punt and use the old name. + */ + dir = ADIOI_Strdup(filename); + } else { + /* successfully read the link */ + linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */ + dir = ADIOI_Strdup(linkbuf); + } + ADIOI_Free(linkbuf); + } + + slash = strrchr(dir, '/'); + if (!slash) + ADIOI_Strncpy(dir, ".", 2); + else { + if (slash == dir) + *(dir + 1) = '\0'; + else + *slash = '\0'; + } + + *dirnamep = dir; + return; +} +#endif /* ROMIO_NTFS */ + +/* + ADIO_FileSysType_fncall - determines the file system type for a given file + using a system-dependent function call + +Input Parameters: +. filename - pointer to file name character array + +Output Parameters: +. fstype - location in which to store file system type (ADIO_XXX) +. error_code - location in which to store error code + + MPI_SUCCESS is stored in the location pointed to by error_code on success. + + This function is used by MPI_File_open() and MPI_File_delete() to determine + file system type. Most other functions use the type which is stored when the + file is opened. + */ +static void ADIO_FileSysType_fncall(const char *filename, int *fstype, int *error_code) +{ +#if defined (ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || defined (HAVE_STRUCT_STATFS) || defined (ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE) + int err; +#endif + +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE + struct statvfs vfsbuf; +#endif +#ifdef HAVE_STRUCT_STATFS + struct statfs fsbuf; +#endif +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE + struct stat sbuf; +#endif + static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL"; + +/* NFS can get stuck and end up returing ESTALE "forever" */ +#define MAX_ESTALE_RETRY 10000 + int retry_cnt; + + *error_code = MPI_SUCCESS; + +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE + /* rare: old solaris machines */ + retry_cnt = 0; + do { + err = statvfs(filename, &vfsbuf); + } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); + + if (err) { + /* ENOENT may be returned in two cases: + * 1) no directory entry for "filename" + * 2) "filename" is a dangling symbolic link + * + * ADIO_FileSysType_parentdir tries to deal with both cases. + */ + if (errno == ENOENT) { + char *dir; + ADIO_FileSysType_parentdir(filename, &dir); + err = statvfs(dir, &vfsbuf); + + ADIOI_Free(dir); + } else { + *error_code = ADIOI_Err_create_code(myname, filename, errno); + if (*error_code != MPI_SUCCESS) + return; + } + } + + /* --BEGIN ERROR HANDLING-- */ + if (err) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + return; + } + /* --END ERROR HANDLING-- */ + + /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */ + if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) { + *fstype = ADIO_NFS; + return; + } + if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) { + *fstype = ADIO_XFS; + return; + } +#ifdef ROMIO_UFS + /* if UFS support is enabled, default to that */ + *fstype = ADIO_UFS; + return; +#endif + + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ +#endif /* STATVFS APPROACH */ + +#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) + /* common automagic fs-detection logic for any modern POSX-compliant + * environment */ + retry_cnt = 0; + do { + err = statfs(filename, &fsbuf); + } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); + + if (err) { + if (errno == ENOENT) { + char *dir; + ADIO_FileSysType_parentdir(filename, &dir); + err = statfs(dir, &fsbuf); + ADIOI_Free(dir); + } else { + *error_code = ADIOI_Err_create_code(myname, filename, errno); + if (*error_code != MPI_SUCCESS) + return; + } + } + + /* --BEGIN ERROR HANDLING-- */ + if (err) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + return; + } + /* --END ERROR HANDLING-- */ + +#ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME + /* less common: Darwin and OpenBSD */ + if (!strncmp("nfs", fsbuf.f_fstypename, 3)) { + *fstype = ADIO_NFS; + return; + } +#endif + + +#ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE + +#ifdef ROMIO_GPFS + if (fsbuf.f_type == GPFS_SUPER_MAGIC) { + *fstype = ADIO_GPFS; + return; + } +#endif + + /* FPRINTF(stderr, "%d\n", fsbuf.f_type); */ +#ifdef NFS_SUPER_MAGIC + if (fsbuf.f_type == NFS_SUPER_MAGIC) { + *fstype = ADIO_NFS; + return; + } +#endif + +#ifdef ROMIO_LUSTRE +#ifndef LL_SUPER_MAGIC +#define LL_SUPER_MAGIC 0x0BD00BD0 +#endif + if (fsbuf.f_type == LL_SUPER_MAGIC) { + *fstype = ADIO_LUSTRE; + return; + } +#endif + +#ifdef DAOS_SUPER_MAGIC + if (fsbuf.f_type == DAOS_SUPER_MAGIC) { + *fstype = ADIO_DAOS; + return; + } +#endif + +#ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC + if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) { + *fstype = ADIO_PANFS; + return; + } +#endif + +#ifdef MOUNT_NFS + if (fsbuf.f_type == MOUNT_NFS) { + *fstype = ADIO_NFS; + return; + } +#endif + +#ifdef MOUNT_PFS + if (fsbuf.f_type == MOUNT_PFS) { + *fstype = ADIO_PFS; + return; + } +#endif + +#ifdef PVFS_SUPER_MAGIC + if (fsbuf.f_type == PVFS_SUPER_MAGIC) { + *fstype = ADIO_PVFS; + return; + } +#endif + +#ifdef PVFS2_SUPER_MAGIC + if (fsbuf.f_type == PVFS2_SUPER_MAGIC) { + *fstype = ADIO_PVFS2; + return; + } +#endif + +#ifdef XFS_SUPER_MAGIC + if (fsbuf.f_type == XFS_SUPER_MAGIC || fsbuf.f_type == EXFS_SUPER_MAGIC) { + *fstype = ADIO_XFS; + return; + } +#endif + +#endif /*ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE */ + +#ifdef ROMIO_UFS + /* if UFS support is enabled, default to that */ + *fstype = ADIO_UFS; + return; +#endif + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ +#endif /* STATFS APPROACH */ + +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE + /* rare: maybe old NEC SX or SGI IRIX machines */ + retry_cnt = 0; + do { + err = stat(filename, &sbuf); + } while (err && (errno == ESTALE) && retry_cnt++ < MAX_ESTALE_RETRY); + + if (err) { + if (errno == ENOENT) { + char *dir; + ADIO_FileSysType_parentdir(filename, &dir); + err = stat(dir, &sbuf); + ADIOI_Free(dir); + } else { + *error_code = ADIOI_Err_create_code(myname, filename, errno); + if (*error_code != MPI_SUCCESS) + return; + } + } + + if (err) { + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ + return; + } else { + if (!strcmp(sbuf.st_fstype, "nfs")) + *fstype = ADIO_NFS; + else + *fstype = ADIO_SFS; /* assuming SX4 for now */ + } +#endif /* STAT APPROACH */ + +#ifdef ROMIO_NTFS + MPL_UNREFERENCED_ARG(filename); + MPL_UNREFERENCED_ARG(error_code); + *fstype = ADIO_NTFS; /* only supported FS on Windows */ +#elif defined(ROMIO_NFS) + *fstype = ADIO_NFS; +#elif defined(ROMIO_UFS) + *fstype = ADIO_UFS; +#else + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ +#endif +} + +/* all proceeses opening, creating, or deleting a file end up invoking several + * stat system calls (unless a fs prefix is given). Cary out this file system + * detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes */ + +static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, const char *filename, int *file_system, + int *error_code) +{ + int rank; + int buf[2]; + MPI_Comm_rank(comm, &rank); + + if (rank == 0) { + ADIO_FileSysType_fncall(filename, file_system, error_code); + buf[0] = *file_system; + buf[1] = *error_code; + } + MPI_Bcast(buf, 2, MPI_INT, 0, comm); + *file_system = buf[0]; + *error_code = buf[1]; +} + + + +/* + ADIO_FileSysType_prefix - determines file system type for a file using + a prefix on the file name. upper layer should have already determined + that a prefix is present. + +Input Parameters: +. filename - path to file, including prefix (xxx:) + +Output Parameters: +. fstype - pointer to integer in which to store file system type (ADIO_XXX) +. error_code - pointer to integer in which to store error code + + Returns MPI_SUCCESS in error_code on success. Filename not having a prefix + is considered an error. Except for on Windows systems where the default is NTFS. + + */ +static void ADIO_FileSysType_prefix(const char *filename, int *fstype, + ADIOI_Fns ** ops, int *error_code) +{ + int i; + static char myname[] = "ADIO_FileSysType_prefix"; + + *error_code = MPI_SUCCESS; + *fstype = -1; + + /* search table for prefix */ + + i = 0; + while (fstypes[i].fileops) { + if (!strncasecmp(fstypes[i].prefix, filename, strlen(fstypes[i].prefix))) { + *fstype = fstypes[i].fstype; + *ops = fstypes[i].fileops; + break; + } + ++i; + } + + if (-1 == *fstype) { + *fstype = 0; + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", + "*iofstypeunsupported %s", filename); + /* --END ERROR HANDLING-- */ + } +} + +/*@ + ADIO_ResolveFileType - determines file system type and operations from + file name string; this is a collective call + +Input Parameters: +. comm - communicator across which collective open is performed +. filename - name of file (string) + +Output Parameters: +. fstype - (pointer to) int holding file system type +. ops - (address of) pointer to table of valid file operations +. error_code - (pointer to) int holding error code + +Notes: +This code used to be in MPI_File_open(), but it has been moved into here in +order to clean things up. The goal is to separate all this "did we compile +for this fs type" code from the MPI layer and also to introduce the ADIOI_Fns +tables in a reasonable way. -- Rob, 06/06/2001 +@*/ +void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype, + ADIOI_Fns ** ops, int *error_code) +{ + int myerrcode, file_system, min_code, max_code; + char *tmp; + int i; + static char myname[] = "ADIO_RESOLVEFILETYPE"; + char *p; + *ops = 0; + + file_system = -1; + if (filename == NULL) { + *error_code = ADIOI_Err_create_code(myname, filename, ENOENT); + return; + } + tmp = strchr(filename, ':'); + if (!tmp) { + int have_nfs_enabled = 0; + *error_code = MPI_SUCCESS; + /* no prefix; use system-dependent function call to determine type */ + /* Optimization: we can reduce the 'storm of stats' that result from + * thousands of mpi processes determinig file type this way. Let us + * have just one process stat the file and broadcast the result to + * everyone else. + * - Note that we will not catch cases like + * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html + * (edit: now http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) + * + * where file systems are not mounted or available on other processes, + * but we'll catch those a few functions later in ADIO_Open + * - Note that if we have NFS enabled, we might have a situation where, + * for example, /home/user/data.out is UFS on one process but NFS on + * others, so we won't perform this optimization if NFS is enabled. + * - Another point: error codes and file system types are broadcast to + * all members of the communicator, so we get to skip the allreduce + * steps*/ + +#ifdef ROMIO_NFS + have_nfs_enabled = 1; +#endif + if (!have_nfs_enabled) { + ADIO_FileSysType_fncall_scalable(comm, filename, &file_system, &myerrcode); + if (myerrcode != MPI_SUCCESS) { + *error_code = myerrcode; + return; + } + } else { + ADIO_FileSysType_fncall(filename, &file_system, &myerrcode); + + /* the check for file system type will hang if any process got + * an error in ADIO_FileSysType_fncall. Processes encountering + * an error will return early, before the collective file + * system type check below. This case could happen if a full + * path exists on one node but not on others, and no prefix + * like ufs: was provided. see discussion at + * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html + * (edit: now + * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) + */ + + MPI_Allreduce(&myerrcode, &max_code, 1, MPI_INT, MPI_MAX, comm); + if (max_code != MPI_SUCCESS) { + *error_code = max_code; + return; + } + /* ensure everyone came up with the same file system type */ + MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, MPI_MIN, comm); + if (min_code == ADIO_NFS) + file_system = ADIO_NFS; + } + } else { + /* prefix specified; just match via prefix and assume everyone got + * the same thing. + * + * perhaps we should have this code go through the allreduce as well? + */ + ADIO_FileSysType_prefix(filename, &file_system, ops, &myerrcode); + if (myerrcode != MPI_SUCCESS) { + *error_code = myerrcode; + return; + } + } + + /* lastly, there may be situations where one cannot override the file + * system detection with a prefix -- maybe the file name is passed to both + * posix and MPI-IO routines, or maybe the file name is hard-coded into an + * application. + * Assumes all processes set the same environment varialble. + * Values: the same prefix you would stick on a file path. e.g. pvfs2: -- + * including the colon! */ + p = getenv("ROMIO_FSTYPE_FORCE"); + if (p != NULL) { + ADIO_FileSysType_prefix(p, &file_system, ops, &myerrcode); + if (myerrcode != MPI_SUCCESS) { + *error_code = myerrcode; + return; + } + } + if (!(*ops)) { + for (i = 0; fstypes[i].fileops; i++) + if (file_system == fstypes[i].fstype) { + *ops = fstypes[i].fileops; + break; + } + } + if (!(*ops)) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; + } + + *error_code = MPI_SUCCESS; + *fstype = file_system; + return; +} diff --git a/3rd-party/romio341/adio/common/ad_get_sh_fp.c b/3rd-party/romio341/adio/common/ad_get_sh_fp.c new file mode 100644 index 0000000000000000000000000000000000000000..2e455fea8816f2939e942c6615953f3c95ffaa06 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_get_sh_fp.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* returns the current location of the shared_fp in terms of the + no. of etypes relative to the current view, and also increments the + shared_fp by the number of etypes to be accessed (incr) in the read + or write following this function. */ + +void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset * shared_fp, + int *error_code); + +void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset * shared_fp, int *error_code) +{ + ADIO_Status status; + ADIO_Offset new_fp; + MPI_Comm dupcommself; + + /* Set the shared_fp in case this comes from an uninitialized stack variable + * The read routines will not read into the address of this variable if the file + * size of a shared pointer is 0, and if incr is always zero, this value will remain + * uninitialized. Initialize it here to prevent incorrect values + */ + *shared_fp = 0; + +#ifdef ROMIO_NFS + if (fd->file_system == ADIO_NFS) { + ADIOI_NFS_Get_shared_fp(fd, incr, shared_fp, error_code); + return; + } +#endif + + if (fd->shared_fp_fd == ADIO_FILE_NULL) { + MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); + fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, + fd->shared_fp_fname, + fd->file_system, + fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, MPI_BYTE, MPI_BYTE, + MPI_INFO_NULL, ADIO_PERM_NULL, error_code); + if (*error_code != MPI_SUCCESS) + return; + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), + MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); + /* if the file is empty, the above function may return error + * (reading beyond end of file). In that case, shared_fp = 0, + * set above, is the correct value. */ + } else { + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + ADIO_ReadContig(fd->shared_fp_fd, shared_fp, sizeof(ADIO_Offset), + MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); + if (*error_code != MPI_SUCCESS) { + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + return; + } + } + + if (incr == 0) { + goto done; + } + + new_fp = *shared_fp + incr; + + ADIO_WriteContig(fd->shared_fp_fd, &new_fp, sizeof(ADIO_Offset), + MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); + done: + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); +} diff --git a/3rd-party/romio341/adio/common/ad_hints.c b/3rd-party/romio341/adio/common/ad_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..db71e72be17e7f1abb49ca56e2c0f1d4b541d713 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_hints.c @@ -0,0 +1,309 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "hint_fns.h" +#include "ad_tuning.h" + +void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ +/* if fd->info is null, create a new info object. + Initialize fd->info to default values. + Initialize fd->hints to default values. + Examine the info object passed by the user. If it contains values that + ROMIO understands, override the default. */ + + MPI_Info info; + char *value; + int flag, nprocs = 0, len; + int ok_to_override_cb_nodes = 0; + static char myname[] = "ADIOI_GEN_SETINFO"; + + + /* if we've already set up default hints and the user has not asked us to + * process any hints (MPI_INFO_NULL), then we can short-circuit hint + * processing */ + if (fd->hints->initialized && users_info == MPI_INFO_NULL) { + *error_code = MPI_SUCCESS; + return; + } + ad_get_env_vars(); + + if (fd->info == MPI_INFO_NULL) { + if (users_info == MPI_INFO_NULL) + MPI_Info_create(&(fd->info)); + else + /* duplicate users_info to preserve hints not used in ROMIO */ + MPI_Info_dup(users_info, &(fd->info)); + } + info = fd->info; + + MPI_Comm_size(fd->comm, &nprocs); + + /* Note that fd->hints is allocated at file open time; thus it is + * not necessary to allocate it, or check for allocation, here. + */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (value == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return; + } + + /* initialize info and hints to default values if they haven't been + * previously initialized + */ + if (!fd->hints->initialized) { + + /* buffer size for collective I/O */ + ADIOI_Info_set(info, "cb_buffer_size", ADIOI_CB_BUFFER_SIZE_DFLT); + fd->hints->cb_buffer_size = atoi(ADIOI_CB_BUFFER_SIZE_DFLT); + + /* default is to let romio automatically decide when to use + * collective buffering + */ + ADIOI_Info_set(info, "romio_cb_read", "automatic"); + fd->hints->cb_read = ADIOI_HINT_AUTO; + ADIOI_Info_set(info, "romio_cb_write", "automatic"); + fd->hints->cb_write = ADIOI_HINT_AUTO; + + fd->hints->cb_config_list = NULL; + + /* number of processes that perform I/O in collective I/O */ + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", nprocs); + ADIOI_Info_set(info, "cb_nodes", value); + fd->hints->cb_nodes = nprocs; + + /* hint indicating that no indep. I/O will be performed on this file */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + + /* hint instructing the use of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_pfr", "disable"); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + + /* hint guiding the assignment of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); + fd->hints->cb_fr_type = ADIOI_FR_AAR; + + /* hint to align file realms with a certain byte value */ + ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); + fd->hints->cb_fr_alignment = 1; + + /* hint to set a threshold percentage for a datatype's size/extent at + * which data sieving should be done in collective I/O */ + ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); + fd->hints->cb_ds_threshold = 0; + + /* hint to switch between point-to-point or all-to-all for two-phase */ + ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); + fd->hints->cb_alltoall = ADIOI_HINT_AUTO; + + /* deferred_open derived from no_indep_rw and cb_{read,write} */ + fd->hints->deferred_open = 0; + + /* buffer size for data sieving in independent reads */ + ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_IND_RD_BUFFER_SIZE_DFLT); + fd->hints->ind_rd_buffer_size = atoi(ADIOI_IND_RD_BUFFER_SIZE_DFLT); + + /* buffer size for data sieving in independent writes */ + ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_IND_WR_BUFFER_SIZE_DFLT); + fd->hints->ind_wr_buffer_size = atoi(ADIOI_IND_WR_BUFFER_SIZE_DFLT); + + /* default is to let romio automatically decide when to use data + * sieving + */ + ADIOI_Info_set(info, "romio_ds_read", "automatic"); + fd->hints->ds_read = ADIOI_HINT_AUTO; + ADIOI_Info_set(info, "romio_ds_write", "automatic"); + fd->hints->ds_write = ADIOI_HINT_AUTO; + + /* still to do: tune this a bit for a variety of file systems. there's + * no good default value so just leave it unset */ + fd->hints->min_fdomain_size = 0; + fd->hints->striping_unit = 0; + + fd->hints->initialized = 1; + + /* ADIO_Open sets up collective buffering arrays. If we are in this + * path from say set_file_view, then we've don't want to adjust the + * array: we'll get a segfault during collective i/o. We only want to + * look at the users cb_nodes if it's open time */ + ok_to_override_cb_nodes = 1; + + } + + /* add in user's info if supplied */ + if (users_info != MPI_INFO_NULL) { + ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", + &(fd->hints->cb_buffer_size), myname, error_code); + + /* aligning file realms to certain sizes (e.g. stripe sizes) + * may benefit I/O performance */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_alignment", + &(fd->hints->cb_fr_alignment), myname, error_code); + + /* for collective I/O, try to be smarter about when to do data sieving + * using a specific threshold for the datatype size/extent + * (percentage 0-100%) */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_ds_threshold", + &(fd->hints->cb_ds_threshold), myname, error_code); + + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_alltoall", + &(fd->hints->cb_alltoall), myname, error_code); + + /* new hints for enabling/disabling coll. buffering on + * reads/writes + */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read", + &(fd->hints->cb_read), myname, error_code); + if (fd->hints->cb_read == ADIOI_HINT_DISABLE) { + /* romio_cb_read overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write", + &(fd->hints->cb_write), myname, error_code); + if (fd->hints->cb_write == ADIOI_HINT_DISABLE) { + /* romio_cb_write overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + + /* enable/disable persistent file realms for collective I/O */ + /* may want to check for no_indep_rdwr hint as well */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_pfr", + &(fd->hints->cb_pfr), myname, error_code); + + + /* file realm assignment types ADIOI_FR_AAR(0), + * ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify + * a regular fr size in bytes. probably not the best way... */ + ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_type", + &(fd->hints->cb_fr_type), myname, error_code); + + /* Has the user indicated all I/O will be done collectively? */ + ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw", + &(fd->hints->no_indep_rw), myname, error_code); + if (fd->hints->no_indep_rw == 1) { + /* if 'no_indep_rw' set, also hint that we will do + * collective buffering: if we aren't doing independent io, + * then we have to do collective */ + ADIOI_Info_set(info, "romio_cb_write", "enable"); + ADIOI_Info_set(info, "romio_cb_read", "enable"); + fd->hints->cb_read = 1; + fd->hints->cb_write = 1; + } + /* new hints for enabling/disabling data sieving on + * reads/writes + */ + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read", + &(fd->hints->ds_read), myname, error_code); + ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write", + &(fd->hints->ds_write), myname, error_code); + + if (ok_to_override_cb_nodes) { + /* MPI_File_open path sets up some data structrues that don't + * get resized in the MPI_File_set_view path, so ignore + * cb_nodes in the set_view case */ + ADIOI_Info_check_and_install_int(fd, users_info, "cb_nodes", + &(fd->hints->cb_nodes), myname, error_code); + if ((fd->hints->cb_nodes <= 0) || (fd->hints->cb_nodes > nprocs)) { + /* can't ask for more aggregators than mpi processes, though it + * might be interesting to think what such oversubscription + * might mean... someday */ + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", nprocs); + ADIOI_Info_set(info, "cb_nodes", value); + fd->hints->cb_nodes = nprocs; + } + } + /* if (ok_to_override_cb_nodes) */ + ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size", + &(fd->hints->ind_wr_buffer_size), myname, error_code); + ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size", + &(fd->hints->ind_rd_buffer_size), myname, error_code); + + if (fd->hints->cb_config_list == NULL) { + /* only set cb_config_list if it isn't already set. Note that + * since we set it below, this ensures that the cb_config_list hint + * will be set at file open time either by the user or to the + * default */ + /* if it has been set already, we ignore it the second time. + * otherwise we would get an error if someone used the same info + * value with a cb_config_list value in it in a couple of calls, + * which would be irritating. */ + ADIOI_Info_check_and_install_str(fd, users_info, "cb_config_list", + &(fd->hints->cb_config_list), myname, error_code); + + } + ADIOI_Info_check_and_install_int(fd, users_info, "romio_min_fdomain_size", + &(fd->hints->min_fdomain_size), myname, error_code); + + /* Now we use striping unit in common code so we should + * process hints for it. */ + ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", + &(fd->hints->striping_unit), myname, error_code); + } + + /* Begin hint post-processig: some hints take precidence over or conflict + * with others, or aren't supported by some file systems */ + + /* handle cb_config_list default value here; avoids an extra + * free/alloc and insures it is always set + */ + if (fd->hints->cb_config_list == NULL) { + ADIOI_Info_set(info, "cb_config_list", ADIOI_CB_CONFIG_LIST_DFLT); + len = (strlen(ADIOI_CB_CONFIG_LIST_DFLT) + 1) * sizeof(char); + fd->hints->cb_config_list = ADIOI_Malloc(len); + if (fd->hints->cb_config_list == NULL) { + ADIOI_Free(value); + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return; + } + ADIOI_Strncpy(fd->hints->cb_config_list, ADIOI_CB_CONFIG_LIST_DFLT, len); + } + /* deferred_open won't be set by callers, but if the user doesn't + * explicitly disable collecitve buffering (two-phase) and does hint that + * io w/o independent io is going on, we'll set this internal hint as a + * convenience */ + if (((fd->hints->cb_read != ADIOI_HINT_DISABLE) + && (fd->hints->cb_write != ADIOI_HINT_DISABLE) + && fd->hints->no_indep_rw)) { + fd->hints->deferred_open = 1; + } else { + /* setting romio_no_indep_rw enable and romio_cb_{read,write} + * disable at the same time doesn't make sense. honor + * romio_cb_{read,write} and force the no_indep_rw hint to + * 'disable' */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + fd->hints->deferred_open = 0; + } + + if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { + /* disable data sieving for fs that do not + * support file locking */ + ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + /* get rid of this value if it is set */ + ADIOI_Info_delete(info, "ind_wr_buffer_size"); + } + /* note: leave ind_wr_buffer_size alone; used for other cases + * as well. -- Rob Ross, 04/22/2003 + */ + ADIOI_Info_set(info, "romio_ds_write", "disable"); + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + + ADIOI_Free(value); + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_init.c b/3rd-party/romio341/adio/common/ad_init.c new file mode 100644 index 0000000000000000000000000000000000000000..564f2f5b344b087ac7c03881a813d7558e5029fd --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_init.c @@ -0,0 +1,114 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +ADIOI_Datarep *ADIOI_Datarep_head = NULL; + /* list of datareps registered by the user */ + +/* for f2c and c2f conversion */ +ADIO_File *ADIOI_Ftable = NULL; +int ADIOI_Ftable_ptr = 0, ADIOI_Ftable_max = 0; +ADIO_Request *ADIOI_Reqtable = NULL; +int ADIOI_Reqtable_ptr = 0, ADIOI_Reqtable_max = 0; +#ifndef HAVE_MPI_INFO +MPI_Info *MPIR_Infotable = NULL; +int MPIR_Infotable_ptr = 0, MPIR_Infotable_max = 0; +#endif + +MPI_Info ADIOI_syshints = MPI_INFO_NULL; + +MPI_Op ADIO_same_amode = MPI_OP_NULL; + +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) +int ADIOI_Direct_read = 0, ADIOI_Direct_write = 0; +#endif + +int ADIO_Init_keyval = MPI_KEYVAL_INVALID; + +MPI_Errhandler ADIOI_DFLT_ERR_HANDLER = MPI_ERRORS_RETURN; + + +static void my_consensus(void *invec, void *inoutvec, int *len, MPI_Datatype * datatype) +{ + int i, *in, *inout; + in = (int *) invec; + inout = (int *) inoutvec; + + for (i = 0; i < *len; i++) { + if (in[i] != inout[i]) + inout[i] = ADIO_AMODE_NOMATCH; + } + return; +} + +void ADIO_Init(int *argc, char ***argv, int *error_code) +{ +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) + char *c; +#endif + + MPL_UNREFERENCED_ARG(argc); + MPL_UNREFERENCED_ARG(argv); + +#ifdef ROMIO_INSIDE_MPICH + MPIR_Ext_init(); +#endif + +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) + c = getenv("MPIO_DIRECT_READ"); + if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) + ADIOI_Direct_read = 1; + else + ADIOI_Direct_read = 0; + c = getenv("MPIO_DIRECT_WRITE"); + if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) + ADIOI_Direct_write = 1; + else + ADIOI_Direct_write = 0; +#endif + +#ifdef ADIOI_MPE_LOGGING + { + MPE_Log_get_state_eventIDs(&ADIOI_MPE_open_a, &ADIOI_MPE_open_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_read_a, &ADIOI_MPE_read_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_write_a, &ADIOI_MPE_write_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_lseek_a, &ADIOI_MPE_lseek_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_close_a, &ADIOI_MPE_close_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_writelock_a, &ADIOI_MPE_writelock_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_readlock_a, &ADIOI_MPE_readlock_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_unlock_a, &ADIOI_MPE_unlock_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_postwrite_a, &ADIOI_MPE_postwrite_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_openinternal_a, &ADIOI_MPE_openinternal_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_stat_a, &ADIOI_MPE_stat_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_iread_a, &ADIOI_MPE_iread_b); + MPE_Log_get_state_eventIDs(&ADIOI_MPE_iwrite_a, &ADIOI_MPE_iwrite_b); + + int comm_world_rank; + MPI_Comm_rank(MPI_COMM_WORLD, &comm_world_rank); + + if (comm_world_rank == 0) { + MPE_Describe_state(ADIOI_MPE_open_a, ADIOI_MPE_open_b, "open", "orange"); + MPE_Describe_state(ADIOI_MPE_read_a, ADIOI_MPE_read_b, "read", "green"); + MPE_Describe_state(ADIOI_MPE_write_a, ADIOI_MPE_write_b, "write", "blue"); + MPE_Describe_state(ADIOI_MPE_lseek_a, ADIOI_MPE_lseek_b, "lseek", "red"); + MPE_Describe_state(ADIOI_MPE_close_a, ADIOI_MPE_close_b, "close", "grey"); + MPE_Describe_state(ADIOI_MPE_writelock_a, ADIOI_MPE_writelock_b, "writelock", "plum"); + MPE_Describe_state(ADIOI_MPE_readlock_a, ADIOI_MPE_readlock_b, "readlock", "magenta"); + MPE_Describe_state(ADIOI_MPE_unlock_a, ADIOI_MPE_unlock_b, "unlock", "purple"); + MPE_Describe_state(ADIOI_MPE_postwrite_a, ADIOI_MPE_postwrite_b, "postwrite", "ivory"); + MPE_Describe_state(ADIOI_MPE_openinternal_a, ADIOI_MPE_openinternal_b, "open system", + "blue"); + MPE_Describe_state(ADIOI_MPE_stat_a, ADIOI_MPE_stat_b, "stat", "purple"); + MPE_Describe_state(ADIOI_MPE_iread_a, ADIOI_MPE_iread_b, "iread", "purple"); + MPE_Describe_state(ADIOI_MPE_iwrite_a, ADIOI_MPE_iwrite_b, "iwrite", "purple"); + } + } +#endif + + *error_code = MPI_SUCCESS; + MPI_Op_create(my_consensus, 1, &ADIO_same_amode); +} diff --git a/3rd-party/romio341/adio/common/ad_io_coll.c b/3rd-party/romio341/adio/common/ad_io_coll.c new file mode 100644 index 0000000000000000000000000000000000000000..a4fb4ac9a3e7c966fbc8408d578ddefbf9a90064 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_io_coll.c @@ -0,0 +1,1077 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* #define ALLTOALL */ + +/* #define DEBUG */ +/* #define DEBUG2 */ +/* print buffers */ + +#define USE_PRE_REQ + +static void Exch_data_amounts(ADIO_File fd, int nprocs, + ADIO_Offset * client_comm_sz_arr, + ADIO_Offset * agg_comm_sz_arr, + int *client_alltoallw_counts, + int *agg_alltoallw_counts, int *aggregators_done); +static void post_aggregator_comm(MPI_Comm comm, int rw_type, int nproc, + void *cb_buf, + MPI_Datatype * client_comm_dtype_arr, + ADIO_Offset * client_comm_sz_arr, + MPI_Request ** requests, int *aggregators_client_count_p); + +static void post_client_comm(ADIO_File fd, int rw_type, + int agg_rank, void *buf, + MPI_Datatype agg_comm_dtype, + int agg_alltoallw_count, MPI_Request * request); + +/* Avery Ching and Kenin Columa's reworked two-phase algorithm. Key features + * - persistent file domains + * - an option to use alltoall instead of point-to-point + */ +void ADIOI_IOStridedColl(ADIO_File fd, void *buf, int count, int rdwr, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ADIO_Offset min_st_offset = 0, max_end_offset = 0; + ADIO_Offset st_end_offset[2]; + ADIO_Offset *all_st_end_offsets = NULL; + int filetype_is_contig, buftype_is_contig, is_contig; + ADIO_Offset off; + int interleave_count = 0, i, nprocs, myrank, nprocs_for_coll; + int cb_enable; + ADIO_Offset bufsize; + MPI_Aint lb, extent; +#ifdef DEBUG2 + MPI_Aint bufextent; +#endif + MPI_Count size; + int agg_rank; + + ADIO_Offset agg_disp; /* aggregated file offset */ + MPI_Datatype agg_dtype; /* aggregated file datatype */ + + int aggregators_done = 0; + ADIO_Offset buffered_io_size = 0; + + int *alltoallw_disps; + + int *alltoallw_counts; + int *client_alltoallw_counts; + int *agg_alltoallw_counts; + + char *cb_buf = NULL; + + MPI_Datatype *client_comm_dtype_arr; /* aggregator perspective */ + MPI_Datatype *agg_comm_dtype_arr; /* client perspective */ + ADIO_Offset *client_comm_sz_arr; /* aggregator perspective */ + ADIO_Offset *agg_comm_sz_arr; /* client perspective */ + + /* file views for each client and aggregator */ + view_state *client_file_view_state_arr = NULL; + view_state *agg_file_view_state_arr = NULL; + /* mem views for local process */ + view_state *my_mem_view_state_arr = NULL; + + MPI_Status *agg_comm_statuses = NULL; + MPI_Request *agg_comm_requests = NULL; + MPI_Status *client_comm_statuses = NULL; + MPI_Request *client_comm_requests = NULL; + int aggs_client_count = 0; + int clients_agg_count = 0; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); +#ifdef DEBUG + fprintf(stderr, "p%d: entering ADIOI_IOStridedColl\n", myrank); +#endif +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event(5010, 0, NULL); + else + MPE_Log_event(5012, 0, NULL); +#endif + + /* I need to check if there are any outstanding nonblocking writes + * to the file, which could potentially interfere with the writes + * taking place in this collective write call. Since this is not + * likely to be common, let me do the simplest thing possible here: + * Each process completes all pending nonblocking operations before + * completing. */ + + nprocs_for_coll = fd->hints->cb_nodes; + + if (rdwr == ADIOI_READ) + cb_enable = fd->hints->cb_read; + else + cb_enable = fd->hints->cb_write; + + /* only check for interleaving if cb_read isn't disabled */ + if (cb_enable != ADIOI_HINT_DISABLE) { + /* find the starting and ending byte of my I/O access */ + ADIOI_Calc_bounds(fd, count, datatype, file_ptr_type, offset, + &st_end_offset[0], &st_end_offset[1]); + + /* allocate an array of start/end pairs */ + all_st_end_offsets = (ADIO_Offset *) + ADIOI_Malloc(2 * nprocs * sizeof(ADIO_Offset)); + MPI_Allgather(st_end_offset, 2, ADIO_OFFSET, all_st_end_offsets, 2, ADIO_OFFSET, fd->comm); + + min_st_offset = all_st_end_offsets[0]; + max_end_offset = all_st_end_offsets[1]; + + for (i = 1; i < nprocs; i++) { + /* are the accesses of different processes interleaved? */ + if ((all_st_end_offsets[i * 2] < all_st_end_offsets[i * 2 - 1]) && + (all_st_end_offsets[i * 2] <= all_st_end_offsets[i * 2 + 1])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should + * suffice for the moment. */ + + min_st_offset = MPL_MIN(all_st_end_offsets[i * 2], min_st_offset); + max_end_offset = MPL_MAX(all_st_end_offsets[i * 2 + 1], max_end_offset); + } + } + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if ((cb_enable == ADIOI_HINT_DISABLE || (!interleave_count && (cb_enable == ADIOI_HINT_AUTO))) + && (fd->hints->cb_pfr != ADIOI_HINT_ENABLE)) { + if (cb_enable != ADIOI_HINT_DISABLE) { + ADIOI_Free(all_st_end_offsets); + } + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (fd->etype_size) * offset; + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, error_code); + } else { + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + } + } else { + if (rdwr == ADIOI_READ) + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + + MPI_Type_get_extent(datatype, &lb, &extent); +#ifdef DEBUG2 + bufextent = extent * count; +#endif + MPI_Type_size_x(datatype, &size); + bufsize = size * (MPI_Count) count; + + /* Calculate file realms */ + if ((fd->hints->cb_pfr != ADIOI_HINT_ENABLE) || (fd->file_realm_types == NULL)) + ADIOI_Calc_file_realms(fd, min_st_offset, max_end_offset); + + my_mem_view_state_arr = (view_state *) + ADIOI_Calloc(1, nprocs * sizeof(view_state)); + agg_file_view_state_arr = (view_state *) + ADIOI_Calloc(1, nprocs * sizeof(view_state)); + client_comm_sz_arr = (ADIO_Offset *) + ADIOI_Calloc(1, nprocs * sizeof(ADIO_Offset)); + + if (fd->is_agg) { + client_file_view_state_arr = (view_state *) + ADIOI_Calloc(1, nprocs * sizeof(view_state)); + } else { + client_file_view_state_arr = NULL; + } + + /* Alltoallw doesn't like a null array even if the counts are + * zero. If you do not include this code, it will fail. */ + client_comm_dtype_arr = (MPI_Datatype *) + ADIOI_Calloc(1, nprocs * sizeof(MPI_Datatype)); + if (!fd->is_agg) + for (i = 0; i < nprocs; i++) + client_comm_dtype_arr[i] = MPI_BYTE; + + ADIOI_Exch_file_views(myrank, nprocs, file_ptr_type, fd, count, + datatype, offset, my_mem_view_state_arr, + agg_file_view_state_arr, client_file_view_state_arr); + + agg_comm_sz_arr = (ADIO_Offset *) + ADIOI_Calloc(1, nprocs * sizeof(ADIO_Offset)); + agg_comm_dtype_arr = (MPI_Datatype *) + ADIOI_Malloc(nprocs * sizeof(MPI_Datatype)); + if (fd->is_agg) { + ADIOI_Build_agg_reqs(fd, rdwr, nprocs, + client_file_view_state_arr, + client_comm_dtype_arr, client_comm_sz_arr, &agg_disp, &agg_dtype); + buffered_io_size = 0; + for (i = 0; i < nprocs; i++) { + if (client_comm_sz_arr[i] > 0) + buffered_io_size += client_comm_sz_arr[i]; + } + } +#ifdef USE_PRE_REQ + else { + /* Example use of ADIOI_Build_client_pre_req. to an + * appropriate section */ + + for (i = 0; i < fd->hints->cb_nodes; i++) { + agg_rank = fd->hints->ranklist[(i + myrank) % fd->hints->cb_nodes]; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5040, 0, NULL); +#endif + ADIOI_Build_client_pre_req(fd, agg_rank, (i + myrank) % fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + 2 * 1024 * 1024, 64 * 1024); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5041, 0, NULL); +#endif + } + } +#endif + + + if (fd->is_agg) + cb_buf = (char *) ADIOI_Malloc(fd->hints->cb_buffer_size); + alltoallw_disps = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + alltoallw_counts = client_alltoallw_counts = (int *) + ADIOI_Calloc(2 * nprocs, sizeof(int)); + agg_alltoallw_counts = &alltoallw_counts[nprocs]; + + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + /* aggregators pre-post all Irecv's for incoming data from clients */ + if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, &agg_comm_requests, &aggs_client_count); + } + /* Aggregators send amounts for data requested to clients */ + Exch_data_amounts(fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, + client_alltoallw_counts, agg_alltoallw_counts, &aggregators_done); + +#ifdef DEBUG + fprintf(stderr, "client_alltoallw_counts[ "); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "%d ", client_alltoallw_counts[i]); + } + fprintf(stderr, "]\n"); + fprintf(stderr, "agg_alltoallw_counts[ "); + for (i = 0; i < nprocs; i++) { + fprintf(stderr, "%d ", agg_alltoallw_counts[i]); + } + fprintf(stderr, "]\n"); +#endif + + /* keep looping while aggregators still have I/O to do */ + while (aggregators_done != nprocs_for_coll) { + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + /* clients should build datatypes for local memory locations + * for data communication with aggregators and post + * communication as the datatypes are built */ + + client_comm_requests = (MPI_Request *) + ADIOI_Calloc(fd->hints->cb_nodes, sizeof(MPI_Request)); + + for (i = 0; i < fd->hints->cb_nodes; i++) { + clients_agg_count = 0; + agg_rank = fd->hints->ranklist[(i + myrank) % fd->hints->cb_nodes]; + if (agg_comm_sz_arr[agg_rank] > 0) { + ADIOI_Build_client_req(fd, agg_rank, + (i + myrank) % fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + agg_comm_sz_arr[agg_rank], + &(agg_comm_dtype_arr[agg_rank])); + +#ifdef AGGREGATION_PROFILE + if (i == 0) + MPE_Log_event(5038, 0, NULL); +#endif + post_client_comm(fd, rdwr, agg_rank, buf, + agg_comm_dtype_arr[agg_rank], + agg_alltoallw_counts[agg_rank], + &client_comm_requests[clients_agg_count]); + clients_agg_count++; + } + } +#ifdef AGGREGATION_PROFILE + if (!clients_agg_count) + MPE_Log_event(5039, 0, NULL); +#endif + + if (rdwr == ADIOI_READ) { + if (fd->is_agg && buffered_io_size) { + ADIOI_IOFiletype(fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_READ, status, error_code); + if (*error_code != MPI_SUCCESS) + return; + MPI_Type_free(&agg_dtype); + } +#ifdef DEBUG + fprintf(stderr, "expecting from [agg](disp,size,cnt)="); + for (i = 0; i < nprocs; i++) { + MPI_Type_size_x(agg_comm_dtype_arr[i], &size); + fprintf(stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, agg_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "]\n"); + if (fd->is_agg) { + fprintf(stderr, "sending to [client](disp,size,cnt)="); + for (i = 0; i < nprocs; i++) { + if (fd->is_agg) + MPI_Type_size_x(client_comm_dtype_arr[i], &size); + else + size = -1; + + fprintf(stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, client_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + } + fflush(NULL); +#endif + /* aggregators post all Isends for outgoing data to clients */ + if (fd->is_agg) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_comm_requests, &aggs_client_count); + + if (fd->is_agg && aggs_client_count) { +#ifdef MPI_STATUSES_IGNORE + agg_comm_statuses = MPI_STATUSES_IGNORE; +#else + agg_comm_statuses = ADIOI_Malloc(aggs_client_count * sizeof(MPI_Status)); +#endif + MPI_Waitall(aggs_client_count, agg_comm_requests, agg_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif + ADIOI_Free(agg_comm_requests); +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(agg_comm_statuses); +#endif + } + + if (clients_agg_count) { +#ifdef MPI_STATUSES_IGNORE + client_comm_statuses = MPI_STATUSES_IGNORE; +#else + client_comm_statuses = ADIOI_Malloc(clients_agg_count * sizeof(MPI_Status)); +#endif + MPI_Waitall(clients_agg_count, client_comm_requests, client_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5039, 0, NULL); +#endif + ADIOI_Free(client_comm_requests); +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(client_comm_statuses); +#endif + } +#ifdef DEBUG2 + fprintf(stderr, "buffered_io_size = %lld\n", (long long) buffered_io_size); + if (fd->is_agg && buffered_io_size) { + fprintf(stderr, "buf = ["); + for (i = 0; i < bufextent; i++) + fprintf(stderr, "%c", ((char *) buf)[i]); + fprintf(stderr, "]\n"); + fprintf(stderr, "cb_buf = ["); + for (i = 0; i < buffered_io_size; i++) + fprintf(stderr, "%c", cb_buf[i]); + fprintf(stderr, "]\n"); + fflush(NULL); + } +#endif + } else { /* Write Case */ +#ifdef DEBUG + fprintf(stderr, "sending to [agg](disp,size,cnt)="); + for (i = 0; i < nprocs; i++) { + MPI_Type_size_x(agg_comm_dtype_arr[i], &size); + fprintf(stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, agg_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "]\n"); + fprintf(stderr, "expecting from [client](disp,size,cnt)="); + for (i = 0; i < nprocs; i++) { + if (fd->is_agg) + MPI_Type_size_x(client_comm_dtype_arr[i], &size); + else + size = -1; + + fprintf(stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, client_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + fflush(NULL); +#endif +#ifdef DEBUG + fprintf(stderr, "buffered_io_size = %lld\n", (long long) buffered_io_size); +#endif + + if (clients_agg_count) { +#ifdef MPI_STATUSES_IGNORE + client_comm_statuses = MPI_STATUSES_IGNORE; +#else + client_comm_statuses = ADIOI_Malloc(clients_agg_count * sizeof(MPI_Status)); +#endif + MPI_Waitall(clients_agg_count, client_comm_requests, client_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5039, 0, NULL); +#endif + ADIOI_Free(client_comm_requests); +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(client_comm_statuses); +#endif + } +#ifdef DEBUG2 + if (bufextent) { + fprintf(stderr, "buf = ["); + for (i = 0; i < bufextent; i++) + fprintf(stderr, "%c", ((char *) buf)[i]); + fprintf(stderr, "]\n"); + } +#endif + + if (fd->is_agg && buffered_io_size) { + ADIOI_Assert(aggs_client_count != 0); + /* make sure we actually have the data to write out */ +#ifdef MPI_STATUSES_IGNORE + agg_comm_statuses = MPI_STATUSES_IGNORE; +#else + agg_comm_statuses = (MPI_Status *) + ADIOI_Malloc(aggs_client_count * sizeof(MPI_Status)); +#endif + + MPI_Waitall(aggs_client_count, agg_comm_requests, agg_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif + ADIOI_Free(agg_comm_requests); +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(agg_comm_statuses); +#endif +#ifdef DEBUG2 + fprintf(stderr, "cb_buf = ["); + for (i = 0; i < buffered_io_size; i++) + fprintf(stderr, "%c", cb_buf[i]); + fprintf(stderr, "]\n"); + fflush(NULL); +#endif + ADIOI_IOFiletype(fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_WRITE, status, error_code); + if (*error_code != MPI_SUCCESS) + return; + MPI_Type_free(&agg_dtype); + } + + } + } else { + /* Alltoallw version of everything */ + ADIOI_Build_client_reqs(fd, nprocs, my_mem_view_state_arr, + agg_file_view_state_arr, agg_comm_sz_arr, agg_comm_dtype_arr); + + if (rdwr == ADIOI_READ) { + if (fd->is_agg && buffered_io_size) { + ADIOI_IOFiletype(fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_READ, status, error_code); + if (*error_code != MPI_SUCCESS) + return; + MPI_Type_free(&agg_dtype); + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + MPI_Alltoallw(cb_buf, client_alltoallw_counts, alltoallw_disps, + client_comm_dtype_arr, + buf, agg_alltoallw_counts, alltoallw_disps, + agg_comm_dtype_arr, fd->comm); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif + } else { /* Write Case */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + MPI_Alltoallw(buf, agg_alltoallw_counts, alltoallw_disps, + agg_comm_dtype_arr, + cb_buf, client_alltoallw_counts, alltoallw_disps, + client_comm_dtype_arr, fd->comm); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif + if (fd->is_agg && buffered_io_size) { + ADIOI_IOFiletype(fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_WRITE, status, error_code); + if (*error_code != MPI_SUCCESS) + return; + MPI_Type_free(&agg_dtype); + } + } + } + + /* Free (uncommit) datatypes for reuse */ + if (fd->is_agg) { + if (buffered_io_size > 0) { + for (i = 0; i < nprocs; i++) { + if (client_comm_sz_arr[i] > 0) + MPI_Type_free(&client_comm_dtype_arr[i]); + } + } + } + for (i = 0; i < nprocs; i++) { + if (agg_comm_sz_arr[i] > 0) + MPI_Type_free(&agg_comm_dtype_arr[i]); + } + + /* figure out next set up requests */ + if (fd->is_agg) { + ADIOI_Build_agg_reqs(fd, rdwr, nprocs, + client_file_view_state_arr, + client_comm_dtype_arr, client_comm_sz_arr, &agg_disp, &agg_dtype); + buffered_io_size = 0; + for (i = 0; i < nprocs; i++) { + if (client_comm_sz_arr[i] > 0) + buffered_io_size += client_comm_sz_arr[i]; + } + } +#ifdef USE_PRE_REQ + else { + /* Example use of ADIOI_Build_client_pre_req. to an + * appropriate section */ + for (i = 0; i < fd->hints->cb_nodes; i++) { + agg_rank = fd->hints->ranklist[(i + myrank) % fd->hints->cb_nodes]; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5040, 0, NULL); +#endif + ADIOI_Build_client_pre_req(fd, agg_rank, (i + myrank) % fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + 2 * 1024 * 1024, 64 * 1024); +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5041, 0, NULL); +#endif + } + } +#endif + + /* aggregators pre-post all Irecv's for incoming data from + * clients. if nothing is needed, agg_comm_requests is not + * allocated */ + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, &agg_comm_requests, &aggs_client_count); + } + + /* Aggregators send amounts for data requested to clients */ + Exch_data_amounts(fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, + client_alltoallw_counts, agg_alltoallw_counts, &aggregators_done); + + } + + /* Clean up */ + + if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { + /* AAR, FSIZE, and User provided uniform File realms */ + if (1) { + MPI_Type_free(&fd->file_realm_types[0]); + } else { + for (i = 0; i < fd->hints->cb_nodes; i++) { + ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig); + MPI_Type_free(&fd->file_realm_types[i]); + } + } + ADIOI_Free(fd->file_realm_types); + ADIOI_Free(fd->file_realm_st_offs); + } + + + if (fd->is_agg) { + if (buffered_io_size > 0) + MPI_Type_free(&agg_dtype); + for (i = 0; i < nprocs; i++) { + MPI_Type_free(&client_comm_dtype_arr[i]); + ADIOI_Free(client_file_view_state_arr[i].flat_type_p->indices); + ADIOI_Free(client_file_view_state_arr[i].flat_type_p->blocklens); + ADIOI_Free(client_file_view_state_arr[i].flat_type_p); + } + ADIOI_Free(client_file_view_state_arr); + ADIOI_Free(cb_buf); + } + for (i = 0; i < nprocs; i++) + if (agg_comm_sz_arr[i] > 0) + MPI_Type_free(&agg_comm_dtype_arr[i]); + + ADIOI_Free(client_comm_sz_arr); + ADIOI_Free(client_comm_dtype_arr); + ADIOI_Free(my_mem_view_state_arr); + ADIOI_Free(agg_file_view_state_arr); + ADIOI_Free(agg_comm_sz_arr); + ADIOI_Free(agg_comm_dtype_arr); + ADIOI_Free(alltoallw_disps); + ADIOI_Free(alltoallw_counts); + ADIOI_Free(all_st_end_offsets); + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This is a temporary way of filling in status. The right way is + * to keep track of how much data was actually read and placed in + * buf during collective I/O. */ +#endif + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event(5011, 0, NULL); + else + MPE_Log_event(5013, 0, NULL); +#endif +} + + +/* Some of this code is from the old Calc_my_off_len() function. + * It calculates the 1st and last byte accessed */ +void ADIOI_Calc_bounds(ADIO_File fd, int count, MPI_Datatype buftype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Offset * st_offset, ADIO_Offset * end_offset) +{ + MPI_Count filetype_size, buftype_size, etype_size; + int sum; + MPI_Aint lb, filetype_extent; + ADIO_Offset total_io; + int filetype_is_contig; + ADIO_Offset i, remainder; + ADIOI_Flatlist_node *flat_file; + + ADIO_Offset st_byte_off, end_byte_off; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5000, 0, NULL); +#endif + + if (!count) { + /* Max signed positive value for ADIO_Offset + * (arch. dependent?). is there a better way? */ + memset(st_offset, 8, sizeof(ADIO_Offset)); + *st_offset = *st_offset / 2; + *end_offset = -1; + return; + } + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + ADIOI_Assert(filetype_size != 0); + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(fd->etype, &etype_size); + MPI_Type_size_x(buftype, &buftype_size); + + total_io = buftype_size * count; + + if (filetype_is_contig) { + if (file_ptr_type == ADIO_INDIVIDUAL) + st_byte_off = fd->fp_ind; + else + st_byte_off = fd->disp + etype_size * offset; + + end_byte_off = st_byte_off + total_io - 1; + } else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + /* we need to take care of some weirdness since fd->fp_ind + * points at an accessible byte in file. the first accessible + * byte in the file is not necessarily the first byte, nor is + * it necessarily the first off/len pair in the filetype. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + st_byte_off = fd->fp_ind; + /* find end byte of I/O (may be in middle of an etype) */ + + /* calculate byte starting point of first filetype */ + end_byte_off = (ADIO_Offset) + ((fd->fp_ind - fd->disp - flat_file->indices[0]) / + filetype_extent) * filetype_extent + fd->disp + flat_file->indices[0]; + /* number of absolute bytes into first filetype */ + remainder = (fd->fp_ind - fd->disp - flat_file->indices[0]) % filetype_extent; + if (remainder) { + /* find how many file viewable bytes into first filetype */ + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if ((flat_file->indices[i] - flat_file->indices[0] + + flat_file->blocklens[i]) >= remainder) { + sum -= (flat_file->blocklens[i] - (sum - remainder)); + break; + } + } + total_io += sum; + } + /* byte starting point of last filetype */ + end_byte_off += (total_io - 1) / filetype_size * filetype_extent; + /* number of bytes into last filetype */ + remainder = total_io % filetype_size; + if (!remainder) { + for (i = flat_file->count - 1; i >= 0; i--) { + if (flat_file->blocklens[i]) + break; + } + ADIOI_Assert(i > -1); + end_byte_off += flat_file->indices[i] + flat_file->blocklens[i] - 1; + end_byte_off -= flat_file->indices[0]; + } else { + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + end_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder - 1; + break; + } + } + end_byte_off -= flat_file->indices[0]; + } + } else { + /* find starting byte of I/O (must be aligned with an etype) */ + /* byte starting point of starting filetype */ + st_byte_off = fd->disp + ((offset * etype_size) / filetype_size) * filetype_extent; + /* number of file viewable bytes into starting filetype */ + remainder = (etype_size * offset) % filetype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + if (sum == remainder) + st_byte_off += flat_file->indices[i + 1]; + else + st_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder; + break; + } + } + + /* find end byte of I/O (may be in middle of an etype) */ + /* byte starting point of last filetype */ + end_byte_off = fd->disp + (offset * etype_size + total_io) / + filetype_size * filetype_extent; + /* number of bytes into last filetype */ + remainder = (offset * etype_size + total_io) % filetype_size; + + if (!remainder) { + /* the last non-zero off/len pair */ + for (i = flat_file->count - 1; i >= 0; i--) { + if (flat_file->blocklens[i]) + break; + } + ADIOI_Assert(i >= 0); + /* back up a whole filetype, and put back up to the + * last byte of the last non-zero offlen pair */ + /* end_byte_off = (end_byte_off - filetype_extent) + + * flat_file->indices[i] + + * flat_file->blocklens[i] - 1; */ + /* equivalent of above commented out equation */ + end_byte_off -= filetype_extent - flat_file->indices[i] - + flat_file->blocklens[i] + 1; + } else { + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + end_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder - 1; + break; + } + } + } + } + } + + *st_offset = st_byte_off; + *end_offset = end_byte_off; +#ifdef DEBUG + printf("st_offset = %lld\nend_offset = %lld\n", (long long) st_byte_off, + (long long) end_byte_off); +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5001, 0, NULL); +#endif +} + +/* wrapper function for ADIO_WriteStrided and ADIO_ReadStrided. Used + * by new 2 phase code to pass an arbitrary file type directly to + * WriteStrided call without affecting existing code. For the new 2 + * phase code, we really only need to set a custom_ftype, and we can + * assume that this uses MPI_BYTE for the etype, and disp is 0 */ +void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Datatype custom_ftype, + int rdwr, ADIO_Status * status, int *error_code) +{ + MPI_Datatype user_filetype; + MPI_Datatype user_etype; + ADIO_Offset user_disp; + int user_ind_wr_buffer_size; + int user_ind_rd_buffer_size; + int f_is_contig, m_is_contig; + int user_ds_read, user_ds_write; + MPI_Aint lb, f_extent; + MPI_Count f_size; + int f_ds_percent; /* size/extent */ + +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event(5006, 0, NULL); + else + MPE_Log_event(5008, 0, NULL); +#endif + MPI_Type_get_extent(custom_ftype, &lb, &f_extent); + MPI_Type_size_x(custom_ftype, &f_size); + f_ds_percent = 100 * f_size / f_extent; + + /* temporarily store file view information */ + user_filetype = fd->filetype; + user_etype = fd->etype; + user_disp = fd->disp; + user_ds_read = fd->hints->ds_read; + user_ds_write = fd->hints->ds_write; + /* temporarily override the independent I/O datasieve buffer size */ + user_ind_wr_buffer_size = fd->hints->ind_wr_buffer_size; + user_ind_rd_buffer_size = fd->hints->ind_rd_buffer_size; + + /* set new values for temporary file view */ + fd->filetype = custom_ftype; + fd->etype = MPI_BYTE; + /* set new values for independent I/O datasieve buffer size */ + fd->hints->ind_wr_buffer_size = fd->hints->cb_buffer_size; + fd->hints->ind_rd_buffer_size = fd->hints->cb_buffer_size; + /* decide whether or not to do datasieving */ +#ifdef DEBUG + printf("f_ds_percent = %d cb_ds_threshold = %d\n", f_ds_percent, fd->hints->cb_ds_threshold); +#endif + if (f_ds_percent >= fd->hints->cb_ds_threshold) { + fd->hints->ds_read = ADIOI_HINT_ENABLE; + fd->hints->ds_write = ADIOI_HINT_ENABLE; + } else { + fd->hints->ds_read = ADIOI_HINT_DISABLE; + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + + /* flatten the new filetype since the strided calls expect it to + * have been flattened in set file view. in the two phase code, + * the datatype passed down should always be MPI_BYTE, and + * therefore contiguous, but just for completeness sake, we'll + * check the memory datatype anyway */ + ADIOI_Datatype_iscontig(custom_ftype, &f_is_contig); + ADIOI_Datatype_iscontig(datatype, &m_is_contig); + if (!f_is_contig) + ADIOI_Flatten_datatype(custom_ftype); + + /* make appropriate Read/Write calls. Let ROMIO figure out file + * system specific stuff. */ + if (f_is_contig && m_is_contig) { + fd->disp = 0; + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + } else { + fd->disp = offset; + if (rdwr == ADIOI_READ) + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, 0, status, error_code); + else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, 0, status, error_code); + } + + + /* restore the user specified file view to cover our tracks */ + fd->filetype = user_filetype; + fd->etype = user_etype; + fd->disp = user_disp; + fd->hints->ds_read = user_ds_read; + fd->hints->ds_write = user_ds_write; + fd->hints->ind_wr_buffer_size = user_ind_wr_buffer_size; + fd->hints->ind_rd_buffer_size = user_ind_rd_buffer_size; +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event(5007, 0, NULL); + else + MPE_Log_event(5009, 0, NULL); +#endif +} + +static void Exch_data_amounts(ADIO_File fd, int nprocs, + ADIO_Offset * client_comm_sz_arr, + ADIO_Offset * agg_comm_sz_arr, + int *client_alltoallw_counts, + int *agg_alltoallw_counts, int *aggregators_done) +{ + int i; + int recv_idx; + MPI_Request *recv_requests; + MPI_Request *send_requests; + MPI_Status status; + /* Aggregators send amounts for data requested to clients */ + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + MPI_Alltoall(client_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, + agg_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, fd->comm); + + if (fd->is_agg) { + for (i = 0; i < nprocs; i++) + if (client_comm_sz_arr[i] > 0) + client_alltoallw_counts[i] = 1; + else + client_alltoallw_counts[i] = 0; + } + *aggregators_done = 0; + for (i = 0; i < nprocs; i++) { + if (agg_comm_sz_arr[i] == -1) + *aggregators_done = *aggregators_done + 1; + else if (agg_comm_sz_arr[i] > 0) + agg_alltoallw_counts[i] = 1; + else + agg_alltoallw_counts[i] = 0; + } + } else { + /* let's see if we can't reduce some communication as well as + * overlap some communication and work */ + + recv_requests = ADIOI_Malloc(fd->hints->cb_nodes * sizeof(MPI_Request)); + /* post all receives - only receive from aggregators */ + for (i = 0; i < fd->hints->cb_nodes; i++) + MPI_Irecv(&agg_comm_sz_arr[fd->hints->ranklist[i]], + sizeof(ADIO_Offset), MPI_BYTE, fd->hints->ranklist[i], + AMT_TAG, fd->comm, &recv_requests[i]); + + /* Barrier is needed here if we're worried about unexpected + * messages being dropped */ + /* MPI_Barrier (fd->comm); */ + send_requests = NULL; + if (fd->is_agg) { + /* only aggregators send data */ + send_requests = ADIOI_Malloc(nprocs * sizeof(MPI_Request)); + + /* post all sends */ + for (i = 0; i < nprocs; i++) { + MPI_Isend(&client_comm_sz_arr[i], sizeof(ADIO_Offset), + MPI_BYTE, i, AMT_TAG, fd->comm, &send_requests[i]); + + if (client_comm_sz_arr[i] > 0) + client_alltoallw_counts[i] = 1; + else + client_alltoallw_counts[i] = 0; + } + } + + *aggregators_done = 0; + for (i = 0; i < fd->hints->cb_nodes; i++) { + MPI_Waitany(fd->hints->cb_nodes, recv_requests, &recv_idx, &status); + if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] == -1) + *aggregators_done = *aggregators_done + 1; + else if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] > 0) + agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 1; + else + agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 0; + } + + ADIOI_Free(recv_requests); + if (fd->is_agg) { + /* wait for all sends to complete */ +#ifdef MPI_STATUSES_IGNORE + MPI_Waitall(nprocs, send_requests, MPI_STATUSES_IGNORE); +#else + MPI_Status *send_statuses = ADIOI_Malloc(nprocs * sizeof(MPI_Status)); + MPI_Waitall(nprocs, send_requests, send_statuses); + ADIOI_Free(send_statuses); +#endif + ADIOI_Free(send_requests); + } + } +} + +static void post_aggregator_comm(MPI_Comm comm, int rw_type, + int nproc, void *cb_buf, + MPI_Datatype * client_comm_dtype_arr, + ADIO_Offset * client_comm_sz_arr, + MPI_Request ** requests_p, int *aggs_client_count_p) +{ + int aggs_client_count = 0; + MPI_Request *requests; + int i; + +#ifdef DEBUG + printf("posting aggregator communication\n"); +#endif + + for (i = 0; i < nproc; i++) + if (client_comm_sz_arr[i] > 0) + aggs_client_count++; +#ifdef DEBUG + printf("aggregator needs to talk to %d clients\n", aggs_client_count); +#endif + *aggs_client_count_p = aggs_client_count; + if (aggs_client_count) { + requests = (MPI_Request *) + ADIOI_Malloc(aggs_client_count * sizeof(MPI_Request)); + aggs_client_count = 0; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + for (i = 0; i < nproc; i++) { + if (client_comm_sz_arr[i] > 0) { + if (rw_type == ADIOI_WRITE) + MPI_Irecv(cb_buf, 1, client_comm_dtype_arr[i], i, + DATA_TAG, comm, &requests[aggs_client_count]); + else + MPI_Isend(cb_buf, 1, client_comm_dtype_arr[i], i, + DATA_TAG, comm, &requests[aggs_client_count]); + + aggs_client_count++; + } + } + *requests_p = requests; + } +} + +static void post_client_comm(ADIO_File fd, int rw_type, + int agg_rank, void *buf, + MPI_Datatype agg_comm_dtype, + int agg_alltoallw_count, MPI_Request * request) +{ + if (agg_alltoallw_count) { + if (rw_type == ADIOI_READ) + MPI_Irecv(buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, request); + else + MPI_Isend(buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, request); + } +} diff --git a/3rd-party/romio341/adio/common/ad_iopen.c b/3rd-party/romio341/adio/common/ad_iopen.c new file mode 100644 index 0000000000000000000000000000000000000000..0c0dd32b758a0eed0d6fa8486d3261aa477fee0a --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_iopen.c @@ -0,0 +1,19 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +void ADIO_ImmediateOpen(ADIO_File fd, int *error_code) +{ + MPI_Comm tmp_comm; + tmp_comm = fd->comm; + /* some file systems might try to be clever inside their open routine. + * e.g. Blue Gene does a stat-and-broadcast */ + fd->comm = MPI_COMM_SELF; + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + fd->is_open = 1; + fd->comm = tmp_comm; + +} diff --git a/3rd-party/romio321/adio/common/ad_iread.c b/3rd-party/romio341/adio/common/ad_iread.c similarity index 54% rename from 3rd-party/romio321/adio/common/ad_iread.c rename to 3rd-party/romio341/adio/common/ad_iread.c index 74c342ab939bcb909ea82fef1ff24cabac01b9cb..cd9c68a5df06afff5f782e8dd6ca726c9e539bd1 100644 --- a/3rd-party/romio321/adio/common/ad_iread.c +++ b/3rd-party/romio341/adio/common/ad_iread.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -30,37 +28,37 @@ * * This code handles two distinct cases. If ROMIO_HAVE_WORKING_AIO is not * defined, then I/O is performed in a blocking manner. Otherwise we post - * an asynchronous I/O operation using the appropriate aio routines. + * an asynchronous I/O operation using the appropriate aio routines. * * In the aio case we rely on ADIOI_GEN_aio(), which is implemented in * common/ad_iwrite.c. */ -void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) +void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) { MPI_Count len, typesize; int aio_errno = 0; static char myname[] = "ADIOI_GEN_IREADCONTIG"; MPI_Type_size_x(datatype, &typesize); - ADIOI_Assert((count * typesize) == ((ADIO_Offset)(unsigned)count * (ADIO_Offset)typesize)); len = count * typesize; - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - aio_errno = ADIOI_GEN_aio(fd, buf, len, offset, 0, request); - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + aio_errno = ADIOI_GEN_aio(fd, buf, count, datatype, offset, 0, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; fd->fp_sys_posn = -1; /* --BEGIN ERROR HANDLING-- */ if (aio_errno != 0) { - MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); - return; + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; } /* --END ERROR HANDLING-- */ - + *error_code = MPI_SUCCESS; } #endif @@ -68,24 +66,22 @@ void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, /* Generic implementation of IreadStrided calls the blocking ReadStrided * immediately. */ -void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, - int *error_code) +void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) { ADIO_Status status; MPI_Count typesize; - MPI_Offset nbytes=0; + MPI_Offset nbytes = 0; /* Call the blocking function. It will create an error code * if necessary. */ - ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); if (*error_code == MPI_SUCCESS) { - MPI_Type_size_x(datatype, &typesize); - nbytes = (MPI_Offset)count*(MPI_Offset)typesize; + MPI_Type_size_x(datatype, &typesize); + nbytes = (MPI_Offset) count *(MPI_Offset) typesize; } MPIO_Completed_request_create(&fd, nbytes, error_code, request); } diff --git a/3rd-party/romio321/adio/common/ad_iread_coll.c b/3rd-party/romio341/adio/common/ad_iread_coll.c similarity index 69% rename from 3rd-party/romio321/adio/common/ad_iread_coll.c rename to 3rd-party/romio341/adio/common/ad_iread_coll.c index 21c21e434f0adf50c6a0cd23bd0a9ba933879225..54f324318d409dbf0ad54bf1726aadb98eaf41ea 100644 --- a/3rd-party/romio321/adio/common/ad_iread_coll.c +++ b/3rd-party/romio341/adio/common/ad_iread_coll.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -9,8 +8,8 @@ #include "mpiu_greq.h" #include "mpioimpl.h" -#ifdef USE_DBG_LOGGING - #define RDCOLL_DEBUG 1 +#ifdef MPL_USE_DBG_LOGGING +#define RDCOLL_DEBUG 1 #endif #ifdef AGGREGATION_PROFILE #include "mpe.h" @@ -35,11 +34,11 @@ struct ADIOI_GEN_IreadStridedColl_vars { /* stack variables */ ADIOI_Access *my_req; /* array of nprocs structures, one for each other process in - whose file domain this process's request lies */ + * whose file domain this process's request lies */ ADIOI_Access *others_req; /* array of nprocs structures, one for each other process - whose request lies in this process's file domain. */ + * whose request lies in this process's file domain. */ int nprocs; int nprocs_for_coll; @@ -61,14 +60,14 @@ struct ADIOI_GEN_IreadStridedColl_vars { ADIO_Offset *fd_end; ADIO_Offset *end_offsets; ADIO_Offset *len_list; - int *buf_idx; + MPI_Aint *buf_idx; }; /* ADIOI_Iread_and_exch */ struct ADIOI_Iread_and_exch_vars { /* requests */ - MPI_Request req1; /* ADIOI_IRC_STATE_IREAD_AND_EXCH */ - MPI_Request req2; /* ADIOI_IRC_STATE_IREAD_AND_EXCH_L1_BEGIN */ + MPI_Request req1; /* ADIOI_IRC_STATE_IREAD_AND_EXCH */ + MPI_Request req2; /* ADIOI_IRC_STATE_IREAD_AND_EXCH_L1_BEGIN */ /* parameters */ ADIO_File fd; @@ -84,7 +83,7 @@ struct ADIOI_Iread_and_exch_vars { ADIO_Offset fd_size; ADIO_Offset *fd_start; ADIO_Offset *fd_end; - int *buf_idx; + MPI_Aint *buf_idx; /* stack variables */ int m; @@ -103,7 +102,7 @@ struct ADIOI_Iread_and_exch_vars { int *partial_send; int *recd_from_proc; int *start_pos; - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ ADIO_Offset size; ADIO_Offset real_size; ADIO_Offset for_curr_iter; @@ -113,14 +112,14 @@ struct ADIOI_Iread_and_exch_vars { int coll_bufsize; /* next function to be called */ - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); }; /* ADIOI_R_Iexchange_data */ struct ADIOI_R_Iexchange_data_vars { /* requests */ - MPI_Request req1; /* ADIOI_IRC_STATE_R_IEXCHANGE_DATA */ - MPI_Request *req2; /* ADIOI_IRC_STATE_R_IEXCHANGE_DATA_RECV & FILL */ + MPI_Request req1; /* ADIOI_IRC_STATE_R_IEXCHANGE_DATA */ + MPI_Request *req2; /* ADIOI_IRC_STATE_R_IEXCHANGE_DATA_RECV & FILL */ /* parameters */ ADIO_File fd; @@ -145,7 +144,7 @@ struct ADIOI_R_Iexchange_data_vars { ADIOI_Access *others_req; int iter; MPI_Aint buftype_extent; - int *buf_idx; + MPI_Aint *buf_idx; /* stack variables */ int nprocs_recv; @@ -153,21 +152,20 @@ struct ADIOI_R_Iexchange_data_vars { char **recv_buf; /* next function to be called */ - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); }; void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, - unsigned *recv_size, - MPI_Request *requests, MPI_Status *statuses, - int *recd_from_proc, int nprocs, - int contig_access_count, - ADIO_Offset min_st_offset, - ADIO_Offset fd_size, ADIO_Offset *fd_start, - ADIO_Offset *fd_end, - MPI_Aint buftype_extent); + * flat_buf, char **recv_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, + unsigned *recv_size, + MPI_Request * requests, MPI_Status * statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, MPI_Aint buftype_extent); /* prototypes of functions used for nonblocking collective reads only. */ static void ADIOI_GEN_IreadStridedColl_inter(ADIOI_NBC_Request *, int *); @@ -190,24 +188,23 @@ static void ADIOI_R_Iexchange_data_fill(ADIOI_NBC_Request *, int *); static void ADIOI_R_Iexchange_data_fini(ADIOI_NBC_Request *, int *); static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; -static int ADIOI_GEN_irc_query_fn(void *extra_state, MPI_Status *status); +static int ADIOI_GEN_irc_query_fn(void *extra_state, MPI_Status * status); static int ADIOI_GEN_irc_free_fn(void *extra_state); -static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status *status); +static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status * status); static int ADIOI_GEN_irc_wait_fn(int count, void **array_of_states, - double timeout, MPI_Status *status); + double timeout, MPI_Status * status); /* Nonblocking version of ADIOI_GEN_ReadStridedColl() */ void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) { /* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + * in "An Extended Two-Phase Method for Accessing Sections of + * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + * Scientific Programming, (5)4:301--317, Winter 1996. + * http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ ADIOI_NBC_Request *nbc_req = NULL; ADIOI_GEN_IreadStridedColl_vars *vars = NULL; @@ -217,30 +214,31 @@ void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, #endif /* FIXME: need an implementation of ADIOI_IOIstridedColl - if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { - ADIOI_IOIstridedColl(fd, buf, count, ADIOI_READ, datatype, - file_ptr_type, offset, request, error_code); - return; - } - */ + * if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + * ADIOI_IOIstridedColl(fd, buf, count, ADIOI_READ, datatype, + * file_ptr_type, offset, request, error_code); + * return; + * } + */ /* top-level struct keeping the status of function progress */ - nbc_req = (ADIOI_NBC_Request *)ADIOI_Calloc(1, sizeof(ADIOI_NBC_Request)); + nbc_req = (ADIOI_NBC_Request *) ADIOI_Calloc(1, sizeof(ADIOI_NBC_Request)); nbc_req->rdwr = ADIOI_READ; /* create a generalized request */ if (ADIOI_GEN_greq_class == 0) { MPIX_Grequest_class_create(ADIOI_GEN_irc_query_fn, - ADIOI_GEN_irc_free_fn, MPIU_Greq_cancel_fn, - ADIOI_GEN_irc_poll_fn, ADIOI_GEN_irc_wait_fn, - &ADIOI_GEN_greq_class); + ADIOI_GEN_irc_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_irc_poll_fn, ADIOI_GEN_irc_wait_fn, + &ADIOI_GEN_greq_class); } MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, nbc_req, request); memcpy(&nbc_req->req, request, sizeof(MPI_Request)); /* create a struct for parameters and variables */ - vars = (ADIOI_GEN_IreadStridedColl_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_GEN_IreadStridedColl_vars)); + vars = + (ADIOI_GEN_IreadStridedColl_vars *) ADIOI_Calloc(1, + sizeof(ADIOI_GEN_IreadStridedColl_vars)); nbc_req->data.rd.rsc_vars = vars; /* save the parameters */ @@ -263,34 +261,34 @@ void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, /* only check for interleaving if cb_read isn't disabled */ if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ + * lengths in the file and determine the start and end offsets. */ /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, &vars->offset_list, &vars->len_list, - &vars->start_offset, &vars->end_offset, - &vars->contig_access_count); + &vars->start_offset, &vars->end_offset, &vars->contig_access_count); #ifdef RDCOLL_DEBUG for (i = 0; i < vars->contig_access_count; i++) { DBG_FPRINTF(stderr, "rank %d off %lld len %lld\n", - myrank, vars->offset_list[i], vars->len_list[i]); + myrank, (long long) vars->offset_list[i], (long long) vars->len_list[i]); } #endif /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets - stored in order of process rank. */ + * processes. The result is an array each of start and end offsets + * stored in order of process rank. */ - vars->st_offsets = (ADIO_Offset *)ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - vars->end_offsets = (ADIO_Offset *)ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); + vars->st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + vars->end_offsets = vars->st_offsets + nprocs; *error_code = MPI_Iallgather(&vars->start_offset, 1, ADIO_OFFSET, vars->st_offsets, 1, ADIO_OFFSET, fd->comm, &vars->req_offset[0]); - if (*error_code != MPI_SUCCESS) return; + if (*error_code != MPI_SUCCESS) + return; *error_code = MPI_Iallgather(&vars->end_offset, 1, ADIO_OFFSET, vars->end_offsets, 1, ADIO_OFFSET, fd->comm, &vars->req_offset[1]); @@ -302,8 +300,7 @@ void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, ADIOI_GEN_IreadStridedColl_indio(nbc_req, error_code); } -static void ADIOI_GEN_IreadStridedColl_inter(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IreadStridedColl_inter(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars; int nprocs = vars->nprocs; @@ -313,19 +310,17 @@ static void ADIOI_GEN_IreadStridedColl_inter(ADIOI_NBC_Request *nbc_req, /* are the accesses of different processes interleaved? */ for (i = 1; i < nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) interleave_count++; /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ + * for the moment. */ vars->interleave_count = interleave_count; ADIOI_GEN_IreadStridedColl_indio(nbc_req, error_code); } -static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars; ADIOI_Icalc_others_req_vars *cor_vars = NULL; @@ -341,8 +336,7 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig); if (fd->hints->cb_read == ADIOI_HINT_DISABLE - || (!vars->interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) - { + || (!vars->interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) { buf = vars->buf; count = vars->count; file_ptr_type = vars->file_ptr_type; @@ -351,9 +345,7 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, /* don't do aggregation */ if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { ADIOI_Free(vars->offset_list); - ADIOI_Free(vars->len_list); ADIOI_Free(vars->st_offsets); - ADIOI_Free(vars->end_offsets); } fd->fp_ind = vars->orig_fp; @@ -370,13 +362,10 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, off = fd->disp + (fd->etype_size) * offset; ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, &status, error_code); - } - else ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &status, error_code); - } - else { - ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); + } else + ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, &status, error_code); + } else { + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); } ADIOI_GEN_IreadStridedColl_fini(nbc_req, error_code); #else @@ -385,11 +374,10 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, off = fd->disp + (fd->etype_size) * offset; ADIO_IreadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, &vars->req_ind_io, error_code); - } - else ADIO_IreadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &vars->req_ind_io, error_code); - } - else { + } else + ADIO_IreadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, &vars->req_ind_io, error_code); + } else { ADIO_IreadStrided(fd, buf, count, datatype, file_ptr_type, offset, &vars->req_ind_io, error_code); } @@ -418,10 +406,9 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, * */ ADIOI_Calc_file_domains(vars->st_offsets, vars->end_offsets, nprocs, - vars->nprocs_for_coll, &vars->min_st_offset, - &vars->fd_start, &vars->fd_end, - fd->hints->min_fdomain_size, &vars->fd_size, - fd->hints->striping_unit); + vars->nprocs_for_coll, &vars->min_st_offset, + &vars->fd_start, &vars->fd_end, + fd->hints->min_fdomain_size, &vars->fd_size, fd->hints->striping_unit); /* calculate where the portions of the access requests of this process * are located in terms of the file domains. this could be on the same @@ -436,11 +423,10 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, * this is only valid for contiguous buffer case */ ADIOI_Calc_my_req(fd, vars->offset_list, vars->len_list, - vars->contig_access_count, vars->min_st_offset, - vars->fd_start, vars->fd_end, vars->fd_size, - nprocs, &vars->count_my_req_procs, - &vars->count_my_req_per_proc, &vars->my_req, - &vars->buf_idx); + vars->contig_access_count, vars->min_st_offset, + vars->fd_start, vars->fd_end, vars->fd_size, + nprocs, &vars->count_my_req_procs, + &vars->count_my_req_per_proc, &vars->my_req, &vars->buf_idx); /* perform a collective communication in order to distribute the * data calculated above. fills in the following: @@ -450,8 +436,7 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, * requests from proc i lie in this process's file domain. */ - cor_vars = (ADIOI_Icalc_others_req_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_Icalc_others_req_vars)); + cor_vars = (ADIOI_Icalc_others_req_vars *) ADIOI_Calloc(1, sizeof(ADIOI_Icalc_others_req_vars)); nbc_req->cor_vars = cor_vars; cor_vars->fd = vars->fd; cor_vars->count_my_req_procs = vars->count_my_req_procs; @@ -466,32 +451,23 @@ static void ADIOI_GEN_IreadStridedColl_indio(ADIOI_NBC_Request *nbc_req, ADIOI_Icalc_others_req(nbc_req, error_code); } -static void ADIOI_GEN_IreadStridedColl_read(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IreadStridedColl_read(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars; ADIOI_Iread_and_exch_vars *rae_vars = NULL; ADIOI_Access *my_req = vars->my_req; - int nprocs = vars->nprocs; - int i; /* my_req[] and count_my_req_per_proc aren't needed at this point, so * let's free the memory */ ADIOI_Free(vars->count_my_req_per_proc); - for (i = 0; i < nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } + ADIOI_Free(my_req[0].offsets); ADIOI_Free(my_req); /* read data in sizes of no more than ADIOI_Coll_bufsize, * communicate, and fill user buf. */ - rae_vars = (ADIOI_Iread_and_exch_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_Iread_and_exch_vars)); + rae_vars = (ADIOI_Iread_and_exch_vars *) ADIOI_Calloc(1, sizeof(ADIOI_Iread_and_exch_vars)); nbc_req->data.rd.rae_vars = rae_vars; rae_vars->fd = vars->fd; rae_vars->buf = vars->buf; @@ -512,50 +488,36 @@ static void ADIOI_GEN_IreadStridedColl_read(ADIOI_NBC_Request *nbc_req, ADIOI_Iread_and_exch(nbc_req, error_code); } -static void ADIOI_GEN_IreadStridedColl_free(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IreadStridedColl_free(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars; ADIO_File fd = vars->fd; - MPI_Datatype datatype = vars->datatype; ADIOI_Access *others_req = vars->others_req; - int nprocs = vars->nprocs; - int i; - if (!vars->buftype_is_contig) ADIOI_Delete_flattened(datatype); /* free all memory allocated for collective I/O */ - for (i = 0; i < nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } + ADIOI_Free(others_req[0].offsets); + ADIOI_Free(others_req[0].mem_ptrs); ADIOI_Free(others_req); ADIOI_Free(vars->buf_idx); ADIOI_Free(vars->offset_list); - ADIOI_Free(vars->len_list); ADIOI_Free(vars->st_offsets); - ADIOI_Free(vars->end_offsets); ADIOI_Free(vars->fd_start); - ADIOI_Free(vars->fd_end); - fd->fp_sys_posn = -1; /* set it to null. */ + fd->fp_sys_posn = -1; /* set it to null. */ ADIOI_GEN_IreadStridedColl_fini(nbc_req, error_code); } -static void ADIOI_GEN_IreadStridedColl_fini(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IreadStridedColl_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IreadStridedColl_vars *vars = nbc_req->data.rd.rsc_vars; MPI_Count size; /* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually read and placed in buf - during collective I/O. */ + * keep track of how much data was actually read and placed in buf + * during collective I/O. */ MPI_Type_size_x(vars->datatype, &size); nbc_req->nbytes = size * vars->count; @@ -571,24 +533,24 @@ static void ADIOI_GEN_IreadStridedColl_fini(ADIOI_NBC_Request *nbc_req, } -static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_Iread_and_exch(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; ADIO_File fd = vars->fd; MPI_Datatype datatype = vars->datatype; int nprocs = vars->nprocs; - MPI_Aint lb; ADIOI_Access *others_req = vars->others_req; + MPI_Aint lb; /* Read in sizes of no more than coll_bufsize, an info parameter. - Send data to appropriate processes. - Place recd. data in user buf. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were read all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to read a distributed - array from a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ + * Send data to appropriate processes. + * Place recd. data in user buf. + * The idea is to reduce the amount of extra memory required for + * collective I/O. If all data were read all at once, which is much + * easier, it would require temp space more than the size of user_buf, + * which is often unacceptable. For example, to read a distributed + * array from a file, where each local array is 8Mbytes, requiring + * at least another 8Mbytes of temp space is unacceptable. */ int i, j; ADIO_Offset st_loc = -1, end_loc = -1; @@ -598,9 +560,9 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code) /* only I/O errors are currently reported */ /* calculate the number of reads of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. - coll_bufsize is obtained from the hints object. */ + * to be done by each process and the max among all processes. + * That gives the no. of communication phases as well. + * coll_bufsize is obtained from the hints object. */ coll_bufsize = fd->hints->cb_buffer_size; vars->coll_bufsize = coll_bufsize; @@ -617,9 +579,9 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code) /* now find the real values */ for (i = 0; i < nprocs; i++) for (j = 0; j < others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); } vars->st_loc = st_loc; @@ -633,47 +595,46 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code) if ((st_loc == -1) && (end_loc == -1)) { /* this process does no I/O. */ vars->ntimes = 0; - } - else { - /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ - vars->ntimes = (int)((end_loc - st_loc + coll_bufsize) / coll_bufsize); + } else { + /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize) */ + vars->ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); } *error_code = MPI_Iallreduce(&vars->ntimes, &vars->max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm, &vars->req1); - vars->read_buf = fd->io_buf; /* Allocated at open time */ + vars->read_buf = fd->io_buf; /* Allocated at open time */ - vars->curr_offlen_ptr = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* its use is explained below. calloc initializes to 0. */ - vars->count = (int *)ADIOI_Malloc(nprocs * sizeof(int)); + vars->count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ + * in an iteration. */ - vars->partial_send = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* if only a portion of the last off-len pair is sent to a process - in a particular iteration, the length sent is stored here. - calloc initializes to 0. */ + * in a particular iteration, the length sent is stored here. + * calloc initializes to 0. */ - vars->send_size = (int *)ADIOI_Malloc(nprocs * sizeof(int)); + vars->send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* total size of data to be sent to each proc. in an iteration */ - vars->recv_size = (int *)ADIOI_Malloc(nprocs * sizeof(int)); + vars->recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* total size of data to be recd. from each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ + * Of size nprocs so that I can use MPI_Alltoall later. */ - vars->recd_from_proc = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* amount of data recd. so far from each proc. Used in - ADIOI_Fill_user_buffer. initialized to 0 here. */ + * ADIOI_Fill_user_buffer. initialized to 0 here. */ - vars->start_pos = (int *)ADIOI_Malloc(nprocs*sizeof(int)); + vars->start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ + * this iteration */ ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig); if (!vars->buftype_is_contig) { - vars->flat_buf = ADIOI_Flatten_and_find(datatype); + vars->flat_buf = ADIOI_Flatten_and_find(datatype); } MPI_Type_get_extent(datatype, &lb, &vars->buftype_extent); @@ -685,8 +646,7 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code) nbc_req->data.rd.state = ADIOI_IRC_STATE_IREAD_AND_EXCH; } -static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; ADIO_File fd; @@ -722,50 +682,50 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, /* read buf of size coll_bufsize (or less) */ /* go through all others_req and check if any are satisfied - by the current read */ + * by the current read */ /* since MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order, I can maintain a pointer - (curr_offlen_ptr) to - current off-len pair for each process in others_req and scan - further only from there. There is still a problem of filetypes - such as: (1, 2, 3 are not process nos. They are just numbers for - three chunks of data, specified by a filetype.) - - 1 -------!-- - 2 -----!---- - 3 --!----- - - where ! indicates where the current read_size limitation cuts - through the filetype. I resolve this by reading up to !, but - filling the communication buffer only for 1. I copy the portion - left over for 2 into a tmp_buf for use in the next - iteration. i.e., 2 and 3 will be satisfied in the next - iteration. This simplifies filling in the user's buf at the - other end, as only one off-len pair with incomplete data - will be sent. I also don't need to send the individual - offsets and lens along with the data, as the data is being - sent in a particular order. */ + * monotonically nondecreasing order, I can maintain a pointer + * (curr_offlen_ptr) to + * current off-len pair for each process in others_req and scan + * further only from there. There is still a problem of filetypes + * such as: (1, 2, 3 are not process nos. They are just numbers for + * three chunks of data, specified by a filetype.) + * + * 1 -------!-- + * 2 -----!---- + * 3 --!----- + * + * where ! indicates where the current read_size limitation cuts + * through the filetype. I resolve this by reading up to !, but + * filling the communication buffer only for 1. I copy the portion + * left over for 2 into a tmp_buf for use in the next + * iteration. i.e., 2 and 3 will be satisfied in the next + * iteration. This simplifies filling in the user's buf at the + * other end, as only one off-len pair with incomplete data + * will be sent. I also don't need to send the individual + * offsets and lens along with the data, as the data is being + * sent in a particular order. */ /* off = start offset in the file for the data actually read in - this iteration - size = size of data read corresponding to off - real_off = off minus whatever data was retained in memory from - previous iteration for cases like 2, 3 illustrated above - real_size = size plus the extra corresponding to real_off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ - - size = ADIOI_MIN((unsigned)vars->coll_bufsize, - vars->end_loc - vars->st_loc + 1 - vars->done); + * this iteration + * size = size of data read corresponding to off + * real_off = off minus whatever data was retained in memory from + * previous iteration for cases like 2, 3 illustrated above + * real_size = size plus the extra corresponding to real_off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ + + size = MPL_MIN((unsigned) vars->coll_bufsize, vars->end_loc - vars->st_loc + 1 - vars->done); real_off = vars->off - vars->for_curr_iter; real_size = size + vars->for_curr_iter; vars->size = size; vars->real_size = real_size; - for (i = 0; i < nprocs; i++) count[i] = send_size[i] = 0; + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; for_next_iter = 0; for (i = 0; i < nprocs; i++) { @@ -778,42 +738,44 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { if (partial_send[i]) { /* this request may have been partially - satisfied in the previous iteration. */ + * satisfied in the previous iteration. */ req_off = others_req[i].offsets[j] + partial_send[i]; req_len = others_req[i].lens[j] - partial_send[i]; partial_send[i] = 0; /* modify the off-len pair to reflect this change */ others_req[i].offsets[j] = req_off; others_req[i].lens[j] = req_len; - } - else { + } else { req_off = others_req[i].offsets[j]; req_len = others_req[i].lens[j]; } if (req_off < real_off + real_size) { count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf) + req_off - real_off) == (ADIO_Offset)(MPIU_Upint)(read_buf + req_off - real_off)); - MPI_Get_address(read_buf + req_off - real_off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off)); - send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off, - (ADIO_Offset)(unsigned)req_len)); - - if (real_off + real_size - req_off < (ADIO_Offset)(unsigned)req_len) { - partial_send[i] = (int)(real_off + real_size - req_off); - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < real_off + real_size)) { + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + req_off - real_off) == + (ADIO_Offset) (uintptr_t) (read_buf + req_off - real_off)); + MPI_Get_address(read_buf + req_off - real_off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((real_off + real_size - req_off) == + (int) (real_off + real_size - req_off)); + send_size[i] += + (int) (MPL_MIN + (real_off + real_size - req_off, (ADIO_Offset) (unsigned) req_len)); + + if (real_off + real_size - req_off < (ADIO_Offset) (unsigned) req_len) { + partial_send[i] = (int) (real_off + real_size - req_off); + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < real_off + real_size)) { /* this is the case illustrated in the - figure above. */ - for_next_iter = ADIOI_MAX(for_next_iter, - real_off + real_size - others_req[i].offsets[j+1]); + * figure above. */ + for_next_iter = MPL_MAX(for_next_iter, + real_off + real_size - others_req[i].offsets[j + + 1]); /* max because it must cover requests - from different processes */ + * from different processes */ } break; } - } - else break; + } else + break; } curr_offlen_ptr[i] = j; } @@ -822,11 +784,11 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, flag = 0; for (i = 0; i < nprocs; i++) - if (count[i]) flag = 1; + if (count[i]) + flag = 1; /* create a struct for ADIOI_R_Iexchange_data() */ - red_vars = (ADIOI_R_Iexchange_data_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_R_Iexchange_data_vars)); + red_vars = (ADIOI_R_Iexchange_data_vars *) ADIOI_Calloc(1, sizeof(ADIOI_R_Iexchange_data_vars)); nbc_req->data.rd.red_vars = red_vars; red_vars->fd = vars->fd; red_vars->buf = vars->buf; @@ -854,16 +816,14 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, red_vars->next_fn = ADIOI_Iread_and_exch_l1_end; if (flag) { - ADIOI_Assert(size == (int)size); + ADIOI_Assert(size == (int) size); #if defined(ROMIO_RUN_ON_LINUX) && !defined(HAVE_AIO_LITE_H) MPI_Status status; - ADIO_ReadContig(fd, read_buf+vars->for_curr_iter, (int)size, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, vars->off, - &status, error_code); + ADIO_ReadContig(fd, read_buf + vars->for_curr_iter, (int) size, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, vars->off, &status, error_code); #else - ADIO_IreadContig(fd, read_buf+vars->for_curr_iter, (int)size, - MPI_BYTE, ADIO_EXPLICIT_OFFSET, vars->off, - &vars->req2, error_code); + ADIO_IreadContig(fd, read_buf + vars->for_curr_iter, (int) size, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, vars->off, &vars->req2, error_code); nbc_req->data.rd.state = ADIOI_IRC_STATE_IREAD_AND_EXCH_L1_BEGIN; return; @@ -873,8 +833,7 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req, ADIOI_R_Iexchange_data(nbc_req, error_code); } -static void ADIOI_Iread_and_exch_l1_end(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iread_and_exch_l1_end(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; ADIO_File fd = vars->fd; @@ -887,12 +846,14 @@ static void ADIOI_Iread_and_exch_l1_end(ADIOI_NBC_Request *nbc_req, vars->for_curr_iter = for_next_iter; if (for_next_iter) { - tmp_buf = (char *)ADIOI_Malloc(for_next_iter); - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)read_buf)+real_size-for_next_iter) == (ADIO_Offset)(MPIU_Upint)(read_buf+real_size-for_next_iter)); - ADIOI_Assert((for_next_iter+vars->coll_bufsize) == (size_t)(for_next_iter+vars->coll_bufsize)); - memcpy(tmp_buf, read_buf+real_size-for_next_iter, for_next_iter); + tmp_buf = (char *) ADIOI_Malloc(for_next_iter); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + real_size - for_next_iter) == + (ADIO_Offset) (uintptr_t) (read_buf + real_size - for_next_iter)); + ADIOI_Assert((for_next_iter + vars->coll_bufsize) == + (size_t) (for_next_iter + vars->coll_bufsize)); + memcpy(tmp_buf, read_buf + real_size - for_next_iter, for_next_iter); ADIOI_Free(fd->io_buf); - fd->io_buf = (char *)ADIOI_Malloc(for_next_iter+vars->coll_bufsize); + fd->io_buf = (char *) ADIOI_Malloc(for_next_iter + vars->coll_bufsize); memcpy(fd->io_buf, tmp_buf, for_next_iter); vars->read_buf = fd->io_buf; ADIOI_Free(tmp_buf); @@ -906,8 +867,7 @@ static void ADIOI_Iread_and_exch_l1_end(ADIOI_NBC_Request *nbc_req, ADIOI_Iread_and_exch_l1_begin(nbc_req, error_code); } -static void ADIOI_Iread_and_exch_reset(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iread_and_exch_reset(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; int nprocs = vars->nprocs; @@ -915,14 +875,14 @@ static void ADIOI_Iread_and_exch_reset(ADIOI_NBC_Request *nbc_req, int *send_size = vars->send_size; int i; - for (i = 0; i < nprocs; i++) count[i] = send_size[i] = 0; + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; vars->m = vars->ntimes; ADIOI_Iread_and_exch_l2_begin(nbc_req, error_code); } -static void ADIOI_Iread_and_exch_l2_begin(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iread_and_exch_l2_begin(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; ADIOI_R_Iexchange_data_vars *red_vars = NULL; @@ -934,8 +894,7 @@ static void ADIOI_Iread_and_exch_l2_begin(ADIOI_NBC_Request *nbc_req, } /* create a struct for ADIOI_R_Iexchange_data() */ - red_vars = (ADIOI_R_Iexchange_data_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_R_Iexchange_data_vars)); + red_vars = (ADIOI_R_Iexchange_data_vars *) ADIOI_Calloc(1, sizeof(ADIOI_R_Iexchange_data_vars)); nbc_req->data.rd.red_vars = red_vars; red_vars->fd = vars->fd; red_vars->buf = vars->buf; @@ -965,8 +924,7 @@ static void ADIOI_Iread_and_exch_l2_begin(ADIOI_NBC_Request *nbc_req, ADIOI_R_Iexchange_data(nbc_req, error_code); } -static void ADIOI_Iread_and_exch_l2_end(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iread_and_exch_l2_end(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; @@ -974,10 +932,10 @@ static void ADIOI_Iread_and_exch_l2_end(ADIOI_NBC_Request *nbc_req, ADIOI_Iread_and_exch_l2_begin(nbc_req, error_code); } -static void ADIOI_Iread_and_exch_fini(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_Iread_and_exch_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iread_and_exch_vars *vars = nbc_req->data.rd.rae_vars; - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); ADIOI_Free(vars->curr_offlen_ptr); ADIOI_Free(vars->count); @@ -998,20 +956,19 @@ static void ADIOI_Iread_and_exch_fini(ADIOI_NBC_Request *nbc_req, int *error_cod } -static void ADIOI_R_Iexchange_data(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_R_Iexchange_data(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_R_Iexchange_data_vars *vars = nbc_req->data.rd.red_vars; /* exchange send_size info so that each process knows how much to - receive from whom and how much memory to allocate. */ + * receive from whom and how much memory to allocate. */ *error_code = MPI_Ialltoall(vars->send_size, 1, MPI_INT, vars->recv_size, 1, MPI_INT, vars->fd->comm, &vars->req1); nbc_req->data.rd.state = ADIOI_IRC_STATE_R_IEXCHANGE_DATA; } -static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_R_Iexchange_data_vars *vars = nbc_req->data.rd.red_vars; ADIO_File fd = vars->fd; @@ -1024,59 +981,61 @@ static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request *nbc_req, int myrank = vars->myrank; ADIOI_Access *others_req = vars->others_req; int iter = vars->iter; - int *buf_idx = vars->buf_idx; + MPI_Aint *buf_idx = vars->buf_idx; int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send; char **recv_buf = NULL; MPI_Datatype send_type; nprocs_recv = 0; - for (i = 0; i < nprocs; i++) if (recv_size[i]) nprocs_recv++; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + nprocs_recv++; vars->nprocs_recv = nprocs_recv; nprocs_send = 0; - for (i = 0; i < nprocs; i++) if (send_size[i]) nprocs_send++; + for (i = 0; i < nprocs; i++) + if (send_size[i]) + nprocs_send++; vars->nprocs_send = nprocs_send; vars->req2 = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); /* +1 to avoid a 0-size malloc */ /* post recvs. if buftype_is_contig, data can be directly recd. into - user buf at location given by buf_idx. else use recv_buf. */ + * user buf at location given by buf_idx. else use recv_buf. */ #ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); + MPE_Log_event(5032, 0, NULL); #endif if (vars->buftype_is_contig) { j = 0; for (i = 0; i < nprocs; i++) if (recv_size[i]) { - MPI_Irecv(((char *)vars->buf) + buf_idx[i], recv_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, - vars->req2 + j); + MPI_Irecv(((char *) vars->buf) + buf_idx[i], recv_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, vars->req2 + j); j++; buf_idx[i] += recv_size[i]; } - } - else { + } else { /* allocate memory for recv_buf and post receives */ - recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char*)); + recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); vars->recv_buf = recv_buf; for (i = 0; i < nprocs; i++) - if (recv_size[i]) recv_buf[i] = (char *)ADIOI_Malloc(recv_size[i]); + if (recv_size[i]) + recv_buf[i] = (char *) ADIOI_Malloc(recv_size[i]); j = 0; for (i = 0; i < nprocs; i++) if (recv_size[i]) { MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, - myrank+i+100*iter, fd->comm, - vars->req2 + j); + myrank + i + 100 * iter, fd->comm, vars->req2 + j); j++; #ifdef RDCOLL_DEBUG DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", - myrank, recv_size[i], myrank+i+100*iter); + myrank, recv_size[i], myrank + i + 100 * iter); #endif } } @@ -1093,15 +1052,16 @@ static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request *nbc_req, others_req[i].lens[k] = partial_send[i]; } ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, &send_type); + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, &send_type); /* absolute displacement; use MPI_BOTTOM in send */ MPI_Type_commit(&send_type); - MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank+i+100*iter, + MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank + i + 100 * iter, fd->comm, vars->req2 + nprocs_recv + j); MPI_Type_free(&send_type); - if (partial_send[i]) others_req[i].lens[k] = tmp; + if (partial_send[i]) + others_req[i].lens[k] = tmp; j++; } } @@ -1115,8 +1075,7 @@ static void ADIOI_R_Iexchange_data_recv(ADIOI_NBC_Request *nbc_req, ADIOI_R_Iexchange_data_fill(nbc_req, error_code); } -static void ADIOI_R_Iexchange_data_fill(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_R_Iexchange_data_fill(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_R_Iexchange_data_vars *vars = nbc_req->data.rd.red_vars; @@ -1124,32 +1083,33 @@ static void ADIOI_R_Iexchange_data_fill(ADIOI_NBC_Request *nbc_req, /* if noncontiguous, to the copies from the recv buffers */ if (!vars->buftype_is_contig) ADIOI_Fill_user_buffer(vars->fd, vars->buf, vars->flat_buf, - vars->recv_buf, vars->offset_list, vars->len_list, - (unsigned*)vars->recv_size, - vars->req2, NULL, vars->recd_from_proc, - vars->nprocs, vars->contig_access_count, - vars->min_st_offset, vars->fd_size, vars->fd_start, - vars->fd_end, vars->buftype_extent); + vars->recv_buf, vars->offset_list, vars->len_list, + (unsigned *) vars->recv_size, + vars->req2, NULL, vars->recd_from_proc, + vars->nprocs, vars->contig_access_count, + vars->min_st_offset, vars->fd_size, vars->fd_start, + vars->fd_end, vars->buftype_extent); } nbc_req->data.rd.state = ADIOI_IRC_STATE_R_IEXCHANGE_DATA_FILL; } -static void ADIOI_R_Iexchange_data_fini(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_R_Iexchange_data_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_R_Iexchange_data_vars *vars = nbc_req->data.rd.red_vars; - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); int i; ADIOI_Free(vars->req2); if (!vars->buftype_is_contig) { for (i = 0; i < vars->nprocs; i++) - if (vars->recv_size[i]) ADIOI_Free(vars->recv_buf[i]); + if (vars->recv_size[i]) + ADIOI_Free(vars->recv_buf[i]); ADIOI_Free(vars->recv_buf); } #ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); + MPE_Log_event(5033, 0, NULL); #endif next_fn = vars->next_fn; @@ -1163,11 +1123,11 @@ static void ADIOI_R_Iexchange_data_fini(ADIOI_NBC_Request *nbc_req, int *error_c } -static int ADIOI_GEN_irc_query_fn(void *extra_state, MPI_Status *status) +static int ADIOI_GEN_irc_query_fn(void *extra_state, MPI_Status * status) { ADIOI_NBC_Request *nbc_req; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; MPI_Status_set_elements_x(status, MPI_BYTE, nbc_req->nbytes); @@ -1187,29 +1147,28 @@ static int ADIOI_GEN_irc_free_fn(void *extra_state) { ADIOI_NBC_Request *nbc_req; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; ADIOI_Free(nbc_req); return MPI_SUCCESS; } -static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status *status) +static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status * status) { ADIOI_NBC_Request *nbc_req; ADIOI_GEN_IreadStridedColl_vars *rsc_vars = NULL; - ADIOI_Icalc_others_req_vars *cor_vars = NULL; - ADIOI_Iread_and_exch_vars *rae_vars = NULL; - ADIOI_R_Iexchange_data_vars *red_vars = NULL; + ADIOI_Icalc_others_req_vars *cor_vars = NULL; + ADIOI_Iread_and_exch_vars *rae_vars = NULL; + ADIOI_R_Iexchange_data_vars *red_vars = NULL; int errcode = MPI_SUCCESS; int flag; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; switch (nbc_req->data.rd.state) { case ADIOI_IRC_STATE_GEN_IREADSTRIDEDCOLL: rsc_vars = nbc_req->data.rd.rsc_vars; - errcode = MPI_Testall(2, rsc_vars->req_offset, &flag, - MPI_STATUSES_IGNORE); + errcode = MPI_Testall(2, rsc_vars->req_offset, &flag, MPI_STATUSES_IGNORE); if (errcode == MPI_SUCCESS && flag) { ADIOI_GEN_IreadStridedColl_inter(nbc_req, &errcode); } @@ -1296,10 +1255,9 @@ static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status *status) /* --BEGIN ERROR HANDLING-- */ if (errcode != MPI_SUCCESS) { errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_irc_poll_fn", __LINE__, - MPI_ERR_IO, "**mpi_grequest_complete", - 0); + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_irc_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", 0); } /* --END ERROR HANDLING-- */ @@ -1308,25 +1266,24 @@ static int ADIOI_GEN_irc_poll_fn(void *extra_state, MPI_Status *status) /* wait for multiple requests to complete */ static int ADIOI_GEN_irc_wait_fn(int count, void **array_of_states, - double timeout, MPI_Status *status) + double timeout, MPI_Status * status) { int i, errcode = MPI_SUCCESS; double starttime; ADIOI_NBC_Request **nbc_reqlist; - nbc_reqlist = (ADIOI_NBC_Request **)array_of_states; + nbc_reqlist = (ADIOI_NBC_Request **) array_of_states; starttime = MPI_Wtime(); - for (i = 0; i < count ; i++) { + for (i = 0; i < count; i++) { while (nbc_reqlist[i]->data.rd.state != ADIOI_IRC_STATE_COMPLETE) { errcode = ADIOI_GEN_irc_poll_fn(nbc_reqlist[i], MPI_STATUS_IGNORE); /* --BEGIN ERROR HANDLING-- */ if (errcode != MPI_SUCCESS) { errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_irc_wait_fn", - __LINE__, MPI_ERR_IO, - "**mpi_grequest_complete", 0); + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_irc_wait_fn", + __LINE__, MPI_ERR_IO, "**mpi_grequest_complete", 0); } /* --END ERROR HANDLING-- */ @@ -1335,7 +1292,9 @@ static int ADIOI_GEN_irc_wait_fn(int count, void **array_of_states, /* If the progress engine is blocked, we have to yield for another * thread to be able to unblock the progress engine. */ - MPIR_Ext_cs_yield(); + /* NOTE: we're outside a critical section (safety ensured by standard), + * we only need yield in case of user threads */ + ROMIO_THREAD_CS_YIELD(); } } diff --git a/3rd-party/romio321/adio/common/ad_iread_coll.pdf b/3rd-party/romio341/adio/common/ad_iread_coll.pdf similarity index 100% rename from 3rd-party/romio321/adio/common/ad_iread_coll.pdf rename to 3rd-party/romio341/adio/common/ad_iread_coll.pdf diff --git a/3rd-party/romio341/adio/common/ad_iread_fake.c b/3rd-party/romio341/adio/common/ad_iread_fake.c new file mode 100644 index 0000000000000000000000000000000000000000..167c7e0d235b1c17a4e1e8cd632d3620bf5873fc --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_iread_fake.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "mpiu_greq.h" + +/* Generic implementation of IreadContig calls the blocking ReadContig + * immediately. + */ +void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + ADIO_Status status; + MPI_Count typesize; + int read_count; + MPI_Offset nbytes; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_ReadContig(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size_x(datatype, &typesize); + MPI_Get_count(&status, datatype, &read_count); + nbytes = read_count * typesize; + } else { + nbytes = 0; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} + + +/* Generic implementation of IreadStrided calls the blocking ReadStrided + * immediately. + */ +void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + ADIO_Status status; + MPI_Count typesize; + int read_count; + MPI_Offset nbytes; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size_x(datatype, &typesize); + MPI_Get_count(&status, datatype, &read_count); + nbytes = read_count * typesize; + } else { + nbytes = 0; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} diff --git a/3rd-party/romio341/adio/common/ad_iwrite.c b/3rd-party/romio341/adio/common/ad_iwrite.c new file mode 100644 index 0000000000000000000000000000000000000000..505e3d049a1a5cf1399466248d0e5f7ef8d85b8b --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_iwrite.c @@ -0,0 +1,345 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_AIO_H +#include <aio.h> +#endif +#ifdef HAVE_SYS_AIO_H +#include <sys/aio.h> +#endif +#include <time.h> + +#include "../../mpi-io/mpioimpl.h" +#ifdef MPIO_BUILD_PROFILING +#include "../../mpi-io/mpioprof.h" +#endif +#include "mpiu_greq.h" +/* Workaround for incomplete set of definitions if __REDIRECT is not + defined and large file support is used in aio.h */ +#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) +#define aiocb aiocb64 +#endif + +#ifdef ROMIO_HAVE_WORKING_AIO + +static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; + +/* ADIOI_GEN_IwriteContig + * + * This code handles only the case where ROMIO_HAVE_WORKING_AIO is + * defined. We post an asynchronous I/O operations using the appropriate aio + * routines. Otherwise, the ADIOI_Fns_struct will point to the FAKE + * version. + */ +void ADIOI_GEN_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + MPI_Count len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_GEN_IWRITECONTIG"; + + MPI_Type_size_x(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + offset = fd->fp_ind; + /* Cast away the const'ness of 'buf' as ADIOI_GEN_aio is used for + * both read and write calls */ + aio_errno = ADIOI_GEN_aio(fd, (char *) buf, count, datatype, offset, 1, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + /* --BEGIN ERROR HANDLING-- */ + if (aio_errno != 0) { + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + +/* This function is for implementation convenience. + * It takes care of the differences in the interface for nonblocking I/O + * on various Unix machines! If wr==1 write, wr==0 read. + * + * Returns 0 on success, -errno on failure. + */ +int ADIOI_GEN_aio(ADIO_File fd, void *buf, int count, MPI_Datatype type, + ADIO_Offset offset, int wr, MPI_Request * request) +{ + int err = -1, fd_sys; + + int error_code; + struct aiocb *aiocbp = NULL; + ADIOI_AIO_Request *aio_req = NULL; + MPI_Status status; + MPI_Count len, typesize; + + MPI_Type_size_x(type, &typesize); + len = count * typesize; + +#if defined(ROMIO_XFS) + unsigned maxiosz = wr ? fd->hints->fs_hints.xfs.write_chunk_sz : + fd->hints->fs_hints.xfs.read_chunk_sz; +#endif /* ROMIO_XFS */ + + fd_sys = fd->fd_sys; + +#if defined(ROMIO_XFS) + /* Use Direct I/O if desired and properly aligned */ + if (fd->fns == &ADIO_XFS_operations && + ((wr && fd->direct_write) || (!wr && fd->direct_read)) && + !(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz) && + !(len % fd->d_miniosz) && (len >= fd->d_miniosz) && (len <= maxiosz)) { + fd_sys = fd->fd_direct; + } +#endif /* ROMIO_XFS */ + + aio_req = (ADIOI_AIO_Request *) ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); + aiocbp->aio_offset = offset; + aiocbp->aio_buf = buf; + aiocbp->aio_nbytes = len; + +#ifdef HAVE_STRUCT_AIOCB_AIO_WHENCE + aiocbp->aio_whence = SEEK_SET; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_FILDES + aiocbp->aio_fildes = fd_sys; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_SIGEVENT +#ifdef AIO_SIGNOTIFY_NONE + aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; +#endif + aiocbp->aio_sigevent.sigev_signo = 0; +#endif +#ifdef HAVE_STRUCT_AIOCB_AIO_REQPRIO +#ifdef AIO_PRIO_DFL + aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */ +#else + aiocbp->aio_reqprio = 0; +#endif +#endif + +#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES +#ifndef HAVE_STRUCT_AIOCB_AIO_FILDES +#error 'No fildes set for aio structure' +#endif + if (wr) + err = aio_write(aiocbp); + else + err = aio_read(aiocbp); +#else + /* Broken IBM interface */ + if (wr) + err = aio_write(fd_sys, aiocbp); + else + err = aio_read(fd_sys, aiocbp); +#endif + + if (err == -1) { + if (errno == EAGAIN || errno == ENOSYS) { + /* exceeded the max. no. of outstanding requests. + * or, aio routines are not actually implemented + * treat this as a blocking request and return. */ + if (wr) + ADIO_WriteContig(fd, buf, count, type, + ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); + else + ADIO_ReadContig(fd, buf, count, type, + ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); + + MPIO_Completed_request_create(&fd, len, &error_code, request); + if (aiocbp != NULL) + ADIOI_Free(aiocbp); + if (aio_req != NULL) + ADIOI_Free(aio_req); + return 0; + } else { + ADIOI_Free(aio_req); + ADIOI_Free(aiocbp); + return errno; + } + } + aio_req->aiocbp = aiocbp; + if (ADIOI_GEN_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, + &ADIOI_GEN_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return 0; +} +#endif + + +/* Generic implementation of IwriteStrided calls the blocking WriteStrided + * immediately. + */ +void ADIOI_GEN_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) +{ + ADIO_Status status; + MPI_Count typesize; + MPI_Offset nbytes = 0; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + + if (*error_code == MPI_SUCCESS) { + MPI_Type_size_x(datatype, &typesize); + nbytes = (MPI_Offset) count *(MPI_Offset) typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} + +#ifdef ROMIO_HAVE_WORKING_AIO +/* generic POSIX aio completion test routine */ +int ADIOI_GEN_aio_poll_fn(void *extra_state, MPI_Status * status) +{ + ADIOI_AIO_Request *aio_req; + int errcode = MPI_SUCCESS; + + aio_req = (ADIOI_AIO_Request *) extra_state; + + /* aio_error returns an ERRNO value */ + errno = aio_error(aio_req->aiocbp); + if (errno == EINPROGRESS) { + /* TODO: need to diddle with status somehow */ + } else if (errno == ECANCELED) { + /* TODO: unsure how to handle this */ + } else if (errno == 0) { + ssize_t n = aio_return(aio_req->aiocbp); + aio_req->nbytes = n; + errcode = MPI_Grequest_complete(aio_req->req); + /* --BEGIN ERROR HANDLING-- */ + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_aio_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", 0); + } + /* --END ERROR HANDLING-- */ + } + return errcode; +} + +/* wait for multiple requests to complete */ +int ADIOI_GEN_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status) +{ + const struct aiocb **cblist; + int err, errcode = MPI_SUCCESS; + int nr_complete = 0; + double starttime; + struct timespec aio_timer; + struct timespec *aio_timer_p = NULL; + + ADIOI_AIO_Request **aio_reqlist; + int i; + + aio_reqlist = (ADIOI_AIO_Request **) array_of_states; + + cblist = (const struct aiocb **) ADIOI_Calloc(count, sizeof(struct aiocb *)); + + starttime = MPI_Wtime(); + if (timeout > 0) { + aio_timer.tv_sec = (time_t) timeout; + aio_timer.tv_nsec = timeout - aio_timer.tv_sec; + aio_timer_p = &aio_timer; + } + for (i = 0; i < count; i++) { + cblist[i] = aio_reqlist[i]->aiocbp; + } + + while (nr_complete < count) { + do { + err = aio_suspend(cblist, count, aio_timer_p); + } while (err < 0 && errno == EINTR); + if (err == 0) { /* run through the list of requests, and mark all the completed + * ones as done */ + for (i = 0; i < count; i++) { + /* aio_error returns an ERRNO value */ + if (aio_reqlist[i]->aiocbp == NULL) + continue; + errno = aio_error(aio_reqlist[i]->aiocbp); + if (errno == 0) { + ssize_t n = aio_return(aio_reqlist[i]->aiocbp); + aio_reqlist[i]->nbytes = n; + errcode = MPI_Grequest_complete(aio_reqlist[i]->req); + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_aio_wait_fn", + __LINE__, MPI_ERR_IO, + "**mpi_grequest_complete", 0); + } + ADIOI_Free(aio_reqlist[i]->aiocbp); + aio_reqlist[i]->aiocbp = NULL; + cblist[i] = NULL; + nr_complete++; + } + /* TODO: need to handle error conditions somehow */ + } + } /* TODO: also need to handle errors here */ + if ((timeout > 0) && (timeout < (MPI_Wtime() - starttime))) + break; + } + + if (cblist != NULL) + ADIOI_Free(cblist); + return errcode; +} + +int ADIOI_GEN_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + aio_req = (ADIOI_AIO_Request *) extra_state; + + if (aio_req->aiocbp != NULL) + ADIOI_Free(aio_req->aiocbp); + ADIOI_Free(aio_req); + + return MPI_SUCCESS; +} +#endif /* working AIO */ + +int ADIOI_GEN_aio_query_fn(void *extra_state, MPI_Status * status) +{ + ADIOI_AIO_Request *aio_req; + + aio_req = (ADIOI_AIO_Request *) extra_state; + + MPI_Status_set_elements_x(status, MPI_BYTE, aio_req->nbytes); + + /* can never cancel so always true */ + MPI_Status_set_cancelled(status, 0); + + /* choose not to return a value for this */ + status->MPI_SOURCE = MPI_UNDEFINED; + /* tag has no meaning for this generalized request */ + status->MPI_TAG = MPI_UNDEFINED; + /* this generalized request never fails */ + return MPI_SUCCESS; +} diff --git a/3rd-party/romio321/adio/common/ad_iwrite_coll.c b/3rd-party/romio341/adio/common/ad_iwrite_coll.c similarity index 68% rename from 3rd-party/romio321/adio/common/ad_iwrite_coll.c rename to 3rd-party/romio341/adio/common/ad_iwrite_coll.c index d3167fe203926361685add0623f44f6ef5ae1ad1..a282dd21bc9187d203f17ca41425ee9c0f5de4da 100644 --- a/3rd-party/romio321/adio/common/ad_iwrite_coll.c +++ b/3rd-party/romio341/adio/common/ad_iwrite_coll.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -18,9 +17,9 @@ /* ADIOI_GEN_IwriteStridedColl */ struct ADIOI_GEN_IwriteStridedColl_vars { /* requests */ - MPI_Request req_offset[2]; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL */ - MPI_Request req_ind_io; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_INDIO */ - MPI_Request req_err; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_BCAST */ + MPI_Request req_offset[2]; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL */ + MPI_Request req_ind_io; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_INDIO */ + MPI_Request req_err; /* ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_BCAST */ /* parameters */ ADIO_File fd; @@ -33,11 +32,11 @@ struct ADIOI_GEN_IwriteStridedColl_vars { /* stack variables */ ADIOI_Access *my_req; /* array of nprocs access structures, one for each other process in - whose file domain this process's request lies */ + * whose file domain this process's request lies */ ADIOI_Access *others_req; /* array of nprocs access structures, one for each other process - whose request lies in this process's file domain. */ + * whose request lies in this process's file domain. */ int nprocs; int nprocs_for_coll; @@ -58,7 +57,7 @@ struct ADIOI_GEN_IwriteStridedColl_vars { ADIO_Offset *fd_start; ADIO_Offset *fd_end; ADIO_Offset *end_offsets; - int *buf_idx; + MPI_Aint *buf_idx; ADIO_Offset *len_list; int old_error; int tmp_error; @@ -68,8 +67,8 @@ struct ADIOI_GEN_IwriteStridedColl_vars { /* ADIOI_Iexch_and_write */ struct ADIOI_Iexch_and_write_vars { /* requests */ - MPI_Request req1; /* ADIOI_IWC_STATE_IEXCH_AND_WRITE */ - MPI_Request req3; /* ADIOI_IWC_STATE_IEXCH_AND_WRITE_L1_BODY */ + MPI_Request req1; /* ADIOI_IWC_STATE_IEXCH_AND_WRITE */ + MPI_Request req3; /* ADIOI_IWC_STATE_IEXCH_AND_WRITE_L1_BODY */ /* parameters */ ADIO_File fd; @@ -85,10 +84,10 @@ struct ADIOI_Iexch_and_write_vars { ADIO_Offset fd_size; ADIO_Offset *fd_start; ADIO_Offset *fd_end; - int *buf_idx; + MPI_Aint *buf_idx; /* stack variables */ - /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ ADIO_Offset size; int hole; int m; @@ -115,15 +114,15 @@ struct ADIOI_Iexch_and_write_vars { int coll_bufsize; /* next function to be called */ - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); }; /* ADIOI_W_Iexchange_data */ struct ADIOI_W_Iexchange_data_vars { /* requests */ - MPI_Request req1; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA */ - MPI_Request req2; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA_HOLE */ - MPI_Request *req3; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA_SEND */ + MPI_Request req1; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA */ + MPI_Request req2; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA_HOLE */ + MPI_Request *req3; /* ADIOI_IWC_STATE_W_IEXCHANGE_DATA_SEND */ /* parameters */ ADIO_File fd; @@ -155,7 +154,7 @@ struct ADIOI_W_Iexchange_data_vars { int *hole; int iter; MPI_Aint buftype_extent; - int *buf_idx; + MPI_Aint *buf_idx; /* stack variables */ int nprocs_recv; @@ -169,23 +168,22 @@ struct ADIOI_W_Iexchange_data_vars { ADIO_Offset *srt_off; /* next function to be called */ - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); }; void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, char **send_buf, ADIO_Offset - *offset_list, ADIO_Offset *len_list, int *send_size, - MPI_Request *requests, int *sent_to_proc, - int nprocs, int myrank, - int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *send_buf_idx, int *curr_to_proc, - int *done_to_proc, int iter, - MPI_Aint buftype_extent); -void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, - ADIO_Offset *srt_off, int *srt_len, int *start_pos, + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent); +void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, int nprocs, int nprocs_recv, int total_elements); @@ -213,24 +211,23 @@ static void ADIOI_W_Iexchange_data_wait(ADIOI_NBC_Request *, int *); static void ADIOI_W_Iexchange_data_fini(ADIOI_NBC_Request *, int *); static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; -static int ADIOI_GEN_iwc_query_fn(void *extra_state, MPI_Status *status); +static int ADIOI_GEN_iwc_query_fn(void *extra_state, MPI_Status * status); static int ADIOI_GEN_iwc_free_fn(void *extra_state); -static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status); +static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status * status); static int ADIOI_GEN_iwc_wait_fn(int count, void **array_of_states, - double timeout, MPI_Status *status); + double timeout, MPI_Status * status); /* Non-blocking version of ADIOI_GEN_WriteStridedColl() */ void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code) + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code) { /* Uses a generalized version of the extended two-phase method described - in "An Extended Two-Phase Method for Accessing Sections of - Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, - Scientific Programming, (5)4:301--317, Winter 1996. - http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + * in "An Extended Two-Phase Method for Accessing Sections of + * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + * Scientific Programming, (5)4:301--317, Winter 1996. + * http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ ADIOI_NBC_Request *nbc_req = NULL; ADIOI_GEN_IwriteStridedColl_vars *vars = NULL; @@ -248,22 +245,23 @@ void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, #endif /* top-level struct keeping the status of function progress */ - nbc_req = (ADIOI_NBC_Request *)ADIOI_Calloc(1, sizeof(ADIOI_NBC_Request)); + nbc_req = (ADIOI_NBC_Request *) ADIOI_Calloc(1, sizeof(ADIOI_NBC_Request)); nbc_req->rdwr = ADIOI_WRITE; /* create a generalized request */ if (ADIOI_GEN_greq_class == 0) { MPIX_Grequest_class_create(ADIOI_GEN_iwc_query_fn, - ADIOI_GEN_iwc_free_fn, MPIU_Greq_cancel_fn, - ADIOI_GEN_iwc_poll_fn, ADIOI_GEN_iwc_wait_fn, - &ADIOI_GEN_greq_class); + ADIOI_GEN_iwc_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_iwc_poll_fn, ADIOI_GEN_iwc_wait_fn, + &ADIOI_GEN_greq_class); } MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, nbc_req, request); memcpy(&nbc_req->req, request, sizeof(MPI_Request)); /* create a struct for parameters and variables */ - vars = (ADIOI_GEN_IwriteStridedColl_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_GEN_IwriteStridedColl_vars)); + vars = + (ADIOI_GEN_IwriteStridedColl_vars *) ADIOI_Calloc(1, + sizeof(ADIOI_GEN_IwriteStridedColl_vars)); nbc_req->data.wr.wsc_vars = vars; /* save the parameters */ @@ -288,27 +286,27 @@ void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, /* only check for interleaving if cb_write isn't disabled */ if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { /* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ + * lengths in the file and determine the start and end offsets. */ /* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, &vars->offset_list, &vars->len_list, - &vars->start_offset, &vars->end_offset, - &vars->contig_access_count); + &vars->start_offset, &vars->end_offset, &vars->contig_access_count); /* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets - stored in order of process rank. */ + * processes. The result is an array each of start and end offsets + * stored in order of process rank. */ - vars->st_offsets = (ADIO_Offset *)ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - vars->end_offsets = (ADIO_Offset *)ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); + vars->st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + vars->end_offsets = vars->st_offsets + nprocs; *error_code = MPI_Iallgather(&vars->start_offset, 1, ADIO_OFFSET, vars->st_offsets, 1, ADIO_OFFSET, fd->comm, &vars->req_offset[0]); - if (*error_code != MPI_SUCCESS) return; + if (*error_code != MPI_SUCCESS) + return; *error_code = MPI_Iallgather(&vars->end_offset, 1, ADIO_OFFSET, vars->end_offsets, 1, ADIO_OFFSET, fd->comm, &vars->req_offset[1]); @@ -320,8 +318,7 @@ void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, ADIOI_GEN_IwriteStridedColl_indio(nbc_req, error_code); } -static void ADIOI_GEN_IwriteStridedColl_inter(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_inter(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; int nprocs = vars->nprocs; @@ -331,19 +328,17 @@ static void ADIOI_GEN_IwriteStridedColl_inter(ADIOI_NBC_Request *nbc_req, /* are the accesses of different processes interleaved? */ for (i = 1; i < nprocs; i++) - if ((st_offsets[i] < end_offsets[i-1]) && - (st_offsets[i] <= end_offsets[i])) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) interleave_count++; /* This is a rudimentary check for interleaving, but should suffice - for the moment. */ + * for the moment. */ vars->interleave_count = interleave_count; ADIOI_GEN_IwriteStridedColl_indio(nbc_req, error_code); } -static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; ADIOI_Icalc_others_req_vars *cor_vars = NULL; @@ -359,8 +354,7 @@ static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig); if (fd->hints->cb_write == ADIOI_HINT_DISABLE || - (!vars->interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) - { + (!vars->interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) { buf = vars->buf; count = vars->count; file_ptr_type = vars->file_ptr_type; @@ -369,9 +363,7 @@ static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, /* use independent accesses */ if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { ADIOI_Free(vars->offset_list); - ADIOI_Free(vars->len_list); ADIOI_Free(vars->st_offsets); - ADIOI_Free(vars->end_offsets); } fd->fp_ind = vars->orig_fp; @@ -385,31 +377,25 @@ static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, MPI_Status status; if (vars->buftype_is_contig && filetype_is_contig) { if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; ADIO_WriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, - off, &status, error_code); - } - else ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &status, error_code); - } - else { - ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); + ADIO_EXPLICIT_OFFSET, off, &status, error_code); + } else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, &status, error_code); + } else { + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); } ADIOI_GEN_IwriteStridedColl_fini(nbc_req, error_code); #else if (vars->buftype_is_contig && filetype_is_contig) { if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; ADIO_IwriteContig(fd, buf, count, datatype, - ADIO_EXPLICIT_OFFSET, - off, &vars->req_ind_io, error_code); - } - else ADIO_IwriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &vars->req_ind_io, error_code); - } - else { + ADIO_EXPLICIT_OFFSET, off, &vars->req_ind_io, error_code); + } else + ADIO_IwriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, &vars->req_ind_io, error_code); + } else { ADIO_IwriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &vars->req_ind_io, error_code); } @@ -422,34 +408,31 @@ static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, nprocs = vars->nprocs; /* Divide the I/O workload among "nprocs_for_coll" processes. This is - done by (logically) dividing the file into file domains (FDs); each - process may directly access only its own file domain. */ + * done by (logically) dividing the file into file domains (FDs); each + * process may directly access only its own file domain. */ ADIOI_Calc_file_domains(vars->st_offsets, vars->end_offsets, nprocs, - vars->nprocs_for_coll, &vars->min_st_offset, - &vars->fd_start, &vars->fd_end, - fd->hints->min_fdomain_size, &vars->fd_size, - fd->hints->striping_unit); + vars->nprocs_for_coll, &vars->min_st_offset, + &vars->fd_start, &vars->fd_end, + fd->hints->min_fdomain_size, &vars->fd_size, fd->hints->striping_unit); /* calculate what portions of the access requests of this process are - located in what file domains */ + * located in what file domains */ ADIOI_Calc_my_req(fd, vars->offset_list, vars->len_list, - vars->contig_access_count, vars->min_st_offset, - vars->fd_start, vars->fd_end, vars->fd_size, - nprocs, &vars->count_my_req_procs, - &vars->count_my_req_per_proc, &vars->my_req, - &vars->buf_idx); + vars->contig_access_count, vars->min_st_offset, + vars->fd_start, vars->fd_end, vars->fd_size, + nprocs, &vars->count_my_req_procs, + &vars->count_my_req_per_proc, &vars->my_req, &vars->buf_idx); /* based on everyone's my_req, calculate what requests of other - processes lie in this process's file domain. - count_others_req_procs = number of processes whose requests lie in - this process's file domain (including this process itself) - count_others_req_per_proc[i] indicates how many separate contiguous - requests of proc. i lie in this process's file domain. */ - - cor_vars = (ADIOI_Icalc_others_req_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_Icalc_others_req_vars)); + * processes lie in this process's file domain. + * count_others_req_procs = number of processes whose requests lie in + * this process's file domain (including this process itself) + * count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i lie in this process's file domain. */ + + cor_vars = (ADIOI_Icalc_others_req_vars *) ADIOI_Calloc(1, sizeof(ADIOI_Icalc_others_req_vars)); nbc_req->cor_vars = cor_vars; cor_vars->fd = vars->fd; cor_vars->count_my_req_procs = vars->count_my_req_procs; @@ -464,31 +447,22 @@ static void ADIOI_GEN_IwriteStridedColl_indio(ADIOI_NBC_Request *nbc_req, ADIOI_Icalc_others_req(nbc_req, error_code); } -static void ADIOI_GEN_IwriteStridedColl_exch(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_exch(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; ADIOI_Iexch_and_write_vars *eaw_vars = NULL; ADIOI_Access *my_req = vars->my_req; - int nprocs = vars->nprocs; - int i; ADIOI_Free(vars->count_my_req_per_proc); - for (i = 0; i < nprocs; i++) { - if (my_req[i].count) { - ADIOI_Free(my_req[i].offsets); - ADIOI_Free(my_req[i].lens); - } - } + ADIOI_Free(my_req[0].offsets); ADIOI_Free(my_req); /* exchange data and write in sizes of no more than coll_bufsize. */ /* Cast away const'ness for the below function */ - eaw_vars = (ADIOI_Iexch_and_write_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_Iexch_and_write_vars)); + eaw_vars = (ADIOI_Iexch_and_write_vars *) ADIOI_Calloc(1, sizeof(ADIOI_Iexch_and_write_vars)); nbc_req->data.wr.eaw_vars = eaw_vars; eaw_vars->fd = vars->fd; - eaw_vars->buf = (char *)vars->buf; + eaw_vars->buf = (char *) vars->buf; eaw_vars->datatype = vars->datatype; eaw_vars->nprocs = vars->nprocs; eaw_vars->myrank = vars->myrank; @@ -506,8 +480,7 @@ static void ADIOI_GEN_IwriteStridedColl_exch(ADIOI_NBC_Request *nbc_req, ADIOI_Iexch_and_write(nbc_req, error_code); } -static void ADIOI_GEN_IwriteStridedColl_bcast(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_bcast(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; ADIO_File fd = vars->fd; @@ -524,86 +497,69 @@ static void ADIOI_GEN_IwriteStridedColl_bcast(ADIOI_NBC_Request *nbc_req, * additional information */ vars->old_error = *error_code; - if (*error_code != MPI_SUCCESS) *error_code = MPI_ERR_IO; + if (*error_code != MPI_SUCCESS) + *error_code = MPI_ERR_IO; /* optimization: if only one process performing i/o, we can perform * a less-expensive Bcast */ #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_postwrite_a, 0, NULL ); + MPE_Log_event(ADIOI_MPE_postwrite_a, 0, NULL); #endif vars->error_code = *error_code; if (fd->hints->cb_nodes == 1) { *error_code = MPI_Ibcast(&vars->error_code, 1, MPI_INT, - fd->hints->ranklist[0], fd->comm, - &vars->req_err); + fd->hints->ranklist[0], fd->comm, &vars->req_err); } else { vars->tmp_error = *error_code; - *error_code = MPI_Iallreduce(&vars->tmp_error, &vars->error_code, 1, - MPI_INT, MPI_MAX, fd->comm, - &vars->req_err); + *error_code = MPI_Iallreduce(&vars->tmp_error, &vars->error_code, 1, + MPI_INT, MPI_MAX, fd->comm, &vars->req_err); } nbc_req->data.wr.state = ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_BCAST; } -static void ADIOI_GEN_IwriteStridedColl_free(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_free(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; ADIO_File fd = vars->fd; - MPI_Datatype datatype = vars->datatype; ADIOI_Access *others_req = vars->others_req; - int nprocs = vars->nprocs; int old_error = vars->old_error; - int i; #ifdef ADIOI_MPE_LOGGING - MPE_Log_event( ADIOI_MPE_postwrite_b, 0, NULL ); + MPE_Log_event(ADIOI_MPE_postwrite_b, 0, NULL); #endif #ifdef AGGREGATION_PROFILE MPE_Log_event(5012, 0, NULL); #endif - if ( (old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO) ) + if ((old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO)) *error_code = old_error; - - if (!vars->buftype_is_contig) ADIOI_Delete_flattened(datatype); - /* free all memory allocated for collective I/O */ - for (i = 0; i < nprocs; i++) { - if (others_req[i].count) { - ADIOI_Free(others_req[i].offsets); - ADIOI_Free(others_req[i].lens); - ADIOI_Free(others_req[i].mem_ptrs); - } - } + ADIOI_Free(others_req[0].offsets); + ADIOI_Free(others_req[0].mem_ptrs); ADIOI_Free(others_req); ADIOI_Free(vars->buf_idx); ADIOI_Free(vars->offset_list); - ADIOI_Free(vars->len_list); ADIOI_Free(vars->st_offsets); - ADIOI_Free(vars->end_offsets); ADIOI_Free(vars->fd_start); - ADIOI_Free(vars->fd_end); - fd->fp_sys_posn = -1; /* set it to null. */ + fd->fp_sys_posn = -1; /* set it to null. */ #ifdef AGGREGATION_PROFILE - MPE_Log_event (5013, 0, NULL); + MPE_Log_event(5013, 0, NULL); #endif ADIOI_GEN_IwriteStridedColl_fini(nbc_req, error_code); } -static void ADIOI_GEN_IwriteStridedColl_fini(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_GEN_IwriteStridedColl_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_GEN_IwriteStridedColl_vars *vars = nbc_req->data.wr.wsc_vars; MPI_Count size; /* This is a temporary way of filling in status. The right way is to - keep track of how much data was actually written during collective I/O. */ + * keep track of how much data was actually written during collective I/O. */ MPI_Type_size_x(vars->datatype, &size); nbc_req->nbytes = size * vars->count; @@ -619,7 +575,7 @@ static void ADIOI_GEN_IwriteStridedColl_fini(ADIOI_NBC_Request *nbc_req, } -static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_Iexch_and_write(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; ADIO_File fd = vars->fd; @@ -629,13 +585,13 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) MPI_Aint lb; /* Send data to appropriate processes and write in sizes of no more - than coll_bufsize. - The idea is to reduce the amount of extra memory required for - collective I/O. If all data were written all at once, which is much - easier, it would require temp space more than the size of user_buf, - which is often unacceptable. For example, to write a distributed - array to a file, where each local array is 8Mbytes, requiring - at least another 8Mbytes of temp space is unacceptable. */ + * than coll_bufsize. + * The idea is to reduce the amount of extra memory required for + * collective I/O. If all data were written all at once, which is much + * easier, it would require temp space more than the size of user_buf, + * which is often unacceptable. For example, to write a distributed + * array to a file, where each local array is 8Mbytes, requiring + * at least another 8Mbytes of temp space is unacceptable. */ int i, j; ADIO_Offset st_loc = -1, end_loc = -1; @@ -646,12 +602,11 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) /* only I/O errors are currently reported */ /* calculate the number of writes of size coll_bufsize - to be done by each process and the max among all processes. - That gives the no. of communication phases as well. */ + * to be done by each process and the max among all processes. + * That gives the no. of communication phases as well. */ - value = (char *)ADIOI_Malloc((MPI_MAX_INFO_VAL+1) * sizeof(char)); - ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); coll_bufsize = atoi(value); vars->coll_bufsize = coll_bufsize; ADIOI_Free(value); @@ -666,20 +621,20 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) for (i = 0; i < nprocs; i++) for (j = 0; j < others_req[i].count; j++) { - st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); - end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] - + others_req[i].lens[j] - 1)); + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); } vars->st_loc = st_loc; vars->end_loc = end_loc; - /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ + /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize) */ - vars->ntimes = (int)((end_loc - st_loc + coll_bufsize) / coll_bufsize); + vars->ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); - if ((st_loc==-1) && (end_loc==-1)) { - vars->ntimes = 0; /* this process does no writing. */ + if ((st_loc == -1) && (end_loc == -1)) { + vars->ntimes = 0; /* this process does no writing. */ } *error_code = MPI_Iallreduce(&vars->ntimes, &vars->max_ntimes, 1, MPI_INT, @@ -687,54 +642,54 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) vars->write_buf = fd->io_buf; - vars->curr_offlen_ptr = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* its use is explained below. calloc initializes to 0. */ - vars->count = (int *)ADIOI_Malloc(nprocs*sizeof(int)); + vars->count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* to store count of how many off-len pairs per proc are satisfied - in an iteration. */ + * in an iteration. */ - vars->partial_recv = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->partial_recv = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* if only a portion of the last off-len pair is recd. from a process - in a particular iteration, the length recd. is stored here. - calloc initializes to 0. */ + * in a particular iteration, the length recd. is stored here. + * calloc initializes to 0. */ - vars->send_size = (int *)ADIOI_Malloc(nprocs*sizeof(int)); + vars->send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* total size of data to be sent to each proc. in an iteration. - Of size nprocs so that I can use MPI_Alltoall later. */ + * Of size nprocs so that I can use MPI_Alltoall later. */ - vars->recv_size = (int *)ADIOI_Malloc(nprocs*sizeof(int)); - /* total size of data to be recd. from each proc. in an iteration.*/ + vars->recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration. */ - vars->sent_to_proc = (int *)ADIOI_Calloc(nprocs, sizeof(int)); + vars->sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); /* amount of data sent to each proc so far. Used in - ADIOI_Fill_send_buffer. initialized to 0 here. */ + * ADIOI_Fill_send_buffer. initialized to 0 here. */ - vars->send_buf_idx = (int *)ADIOI_Malloc(nprocs*sizeof(int)); - vars->curr_to_proc = (int *)ADIOI_Malloc(nprocs*sizeof(int)); - vars->done_to_proc = (int *)ADIOI_Malloc(nprocs*sizeof(int)); - /* Above three are used in ADIOI_Fill_send_buffer*/ + vars->send_buf_idx = (int *) ADIOI_Malloc(nprocs * 3 * sizeof(int)); + vars->curr_to_proc = vars->send_buf_idx + nprocs; + vars->done_to_proc = vars->curr_to_proc + nprocs; + /* Above three are used in ADIOI_Fill_send_buffer */ - vars->start_pos = (int *)ADIOI_Malloc(nprocs*sizeof(int)); + vars->start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); /* used to store the starting value of curr_offlen_ptr[i] in - this iteration */ + * this iteration */ ADIOI_Datatype_iscontig(datatype, &vars->buftype_is_contig); if (!vars->buftype_is_contig) { - vars->flat_buf = ADIOI_Flatten_and_find(datatype); + vars->flat_buf = ADIOI_Flatten_and_find(datatype); } MPI_Type_get_extent(datatype, &lb, &vars->buftype_extent); /* I need to check if there are any outstanding nonblocking writes to - the file, which could potentially interfere with the writes taking - place in this collective write call. Since this is not likely to be - common, let me do the simplest thing possible here: Each process - completes all pending nonblocking operations before completing. */ + * the file, which could potentially interfere with the writes taking + * place in this collective write call. Since this is not likely to be + * common, let me do the simplest thing possible here: Each process + * completes all pending nonblocking operations before completing. */ /*ADIOI_Complete_async(error_code); - if (*error_code != MPI_SUCCESS) return; - MPI_Barrier(fd->comm); + * if (*error_code != MPI_SUCCESS) return; + * MPI_Barrier(fd->comm); */ vars->done = 0; @@ -744,8 +699,7 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code) nbc_req->data.wr.state = ADIOI_IWC_STATE_IEXCH_AND_WRITE; } -static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; int nprocs; @@ -779,26 +733,26 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req, start_pos = vars->start_pos; /* go through all others_req and check which will be satisfied - by the current write */ + * by the current write */ /* Note that MPI guarantees that displacements in filetypes are in - monotonically nondecreasing order and that, for writes, the - filetypes cannot specify overlapping regions in the file. This - simplifies implementation a bit compared to reads. */ + * monotonically nondecreasing order and that, for writes, the + * filetypes cannot specify overlapping regions in the file. This + * simplifies implementation a bit compared to reads. */ /* off = start offset in the file for the data to be written in - this iteration - size = size of data written (bytes) corresponding to off - req_off = off in file for a particular contiguous request - minus what was satisfied in previous iteration - req_size = size corresponding to req_off */ + * this iteration + * size = size of data written (bytes) corresponding to off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ /* first calculate what should be communicated */ - for (i = 0; i < nprocs; i++) count[i] = recv_size[i] = 0; + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; - size = ADIOI_MIN((unsigned)vars->coll_bufsize, - vars->end_loc - vars->st_loc + 1 - vars->done); + size = MPL_MIN((unsigned) vars->coll_bufsize, vars->end_loc - vars->st_loc + 1 - vars->done); vars->size = size; for (i = 0; i < nprocs; i++) { @@ -807,43 +761,38 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req, for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { if (partial_recv[i]) { /* this request may have been partially - satisfied in the previous iteration. */ - req_off = others_req[i].offsets[j] + - partial_recv[i]; - req_len = others_req[i].lens[j] - - partial_recv[i]; + * satisfied in the previous iteration. */ + req_off = others_req[i].offsets[j] + partial_recv[i]; + req_len = others_req[i].lens[j] - partial_recv[i]; partial_recv[i] = 0; /* modify the off-len pair to reflect this change */ others_req[i].offsets[j] = req_off; others_req[i].lens[j] = req_len; - } - else { + } else { req_off = others_req[i].offsets[j]; req_len = others_req[i].lens[j]; } if (req_off < off + size) { count[i]++; - ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIU_Upint)(write_buf+req_off-off)); - MPI_Get_address(write_buf + req_off - off, - &(others_req[i].mem_ptrs[j])); - ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off)); - recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, - (unsigned)req_len)); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) write_buf) + req_off - off) == + (ADIO_Offset) (uintptr_t) (write_buf + req_off - off)); + MPI_Get_address(write_buf + req_off - off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((off + size - req_off) == (int) (off + size - req_off)); + recv_size[i] += (int) (MPL_MIN(off + size - req_off, (unsigned) req_len)); - if (off+size-req_off < (unsigned)req_len) - { - partial_recv[i] = (int)(off + size - req_off); + if (off + size - req_off < (unsigned) req_len) { + partial_recv[i] = (int) (off + size - req_off); /* --BEGIN ERROR HANDLING-- */ - if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < off+size)) - { + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < off + size)) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_ARG, - "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", 0); + MPIR_ERR_RECOVERABLE, + myname, + __LINE__, + MPI_ERR_ARG, + "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", + 0); /* allow to continue since additional * communication might have to occur */ @@ -851,16 +800,15 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req, /* --END ERROR HANDLING-- */ break; } - } - else break; + } else + break; } curr_offlen_ptr[i] = j; } } /* create a struct for ADIOI_W_Iexchange_data() */ - wed_vars = (ADIOI_W_Iexchange_data_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_W_Iexchange_data_vars)); + wed_vars = (ADIOI_W_Iexchange_data_vars *) ADIOI_Calloc(1, sizeof(ADIOI_W_Iexchange_data_vars)); nbc_req->data.wr.wed_vars = wed_vars; wed_vars->fd = vars->fd; @@ -898,8 +846,7 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req, ADIOI_W_Iexchange_data(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_l1_body(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_l1_body(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; ADIO_File fd = vars->fd; @@ -911,19 +858,18 @@ static void ADIOI_Iexch_and_write_l1_body(ADIOI_NBC_Request *nbc_req, flag = 0; for (i = 0; i < nprocs; i++) - if (count[i]) flag = 1; + if (count[i]) + flag = 1; if (flag) { - ADIOI_Assert(size == (int)size); + ADIOI_Assert(size == (int) size); #if defined(ROMIO_RUN_ON_LINUX) && !defined(HAVE_AIO_LITE_H) MPI_Status status; - ADIO_WriteContig(fd, write_buf, (int)size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, vars->off, &status, - error_code); + ADIO_WriteContig(fd, write_buf, (int) size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, vars->off, &status, error_code); #else - ADIO_IwriteContig(fd, write_buf, (int)size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, vars->off, &vars->req3, - error_code); + ADIO_IwriteContig(fd, write_buf, (int) size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, vars->off, &vars->req3, error_code); nbc_req->data.wr.state = ADIOI_IWC_STATE_IEXCH_AND_WRITE_L1_BODY; return; @@ -933,8 +879,7 @@ static void ADIOI_Iexch_and_write_l1_body(ADIOI_NBC_Request *nbc_req, ADIOI_Iexch_and_write_l1_end(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_l1_end(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_l1_end(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; ADIO_Offset size = vars->size; @@ -947,8 +892,7 @@ static void ADIOI_Iexch_and_write_l1_end(ADIOI_NBC_Request *nbc_req, ADIOI_Iexch_and_write_l1_begin(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_reset(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_reset(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; int nprocs = vars->nprocs; @@ -956,17 +900,16 @@ static void ADIOI_Iexch_and_write_reset(ADIOI_NBC_Request *nbc_req, int *recv_size = vars->recv_size; int i; - for (i = 0; i < nprocs; i++) count[i] = recv_size[i] = 0; + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; vars->m = vars->ntimes; ADIOI_Iexch_and_write_l2_begin(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_l2_begin(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_l2_begin(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; - ADIO_Offset size = vars->size; ADIOI_W_Iexchange_data_vars *wed_vars = NULL; /* loop exit condition */ @@ -975,11 +918,10 @@ static void ADIOI_Iexch_and_write_l2_begin(ADIOI_NBC_Request *nbc_req, return; } - ADIOI_Assert(size == (int)size); + ADIOI_Assert(vars->size == (int) vars->size); /* create a struct for ADIOI_W_Iexchange_data() */ - wed_vars = (ADIOI_W_Iexchange_data_vars *)ADIOI_Calloc( - 1, sizeof(ADIOI_W_Iexchange_data_vars)); + wed_vars = (ADIOI_W_Iexchange_data_vars *) ADIOI_Calloc(1, sizeof(ADIOI_W_Iexchange_data_vars)); nbc_req->data.wr.wed_vars = wed_vars; wed_vars->fd = vars->fd; @@ -991,7 +933,7 @@ static void ADIOI_Iexch_and_write_l2_begin(ADIOI_NBC_Request *nbc_req, wed_vars->send_size = vars->send_size; wed_vars->recv_size = vars->recv_size; wed_vars->off = vars->off; - wed_vars->size = (int)vars->size; + wed_vars->size = (int) vars->size; wed_vars->count = vars->count; wed_vars->start_pos = vars->start_pos; wed_vars->partial_recv = vars->partial_recv; @@ -1018,8 +960,7 @@ static void ADIOI_Iexch_and_write_l2_begin(ADIOI_NBC_Request *nbc_req, ADIOI_W_Iexchange_data(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_l2_end(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_Iexch_and_write_l2_end(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; @@ -1027,10 +968,10 @@ static void ADIOI_Iexch_and_write_l2_end(ADIOI_NBC_Request *nbc_req, ADIOI_Iexch_and_write_l2_begin(nbc_req, error_code); } -static void ADIOI_Iexch_and_write_fini(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_Iexch_and_write_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_Iexch_and_write_vars *vars = nbc_req->data.wr.eaw_vars; - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); ADIOI_Free(vars->curr_offlen_ptr); ADIOI_Free(vars->count); @@ -1040,8 +981,6 @@ static void ADIOI_Iexch_and_write_fini(ADIOI_NBC_Request *nbc_req, int *error_co ADIOI_Free(vars->sent_to_proc); ADIOI_Free(vars->start_pos); ADIOI_Free(vars->send_buf_idx); - ADIOI_Free(vars->curr_to_proc); - ADIOI_Free(vars->done_to_proc); next_fn = vars->next_fn; @@ -1054,12 +993,12 @@ static void ADIOI_Iexch_and_write_fini(ADIOI_NBC_Request *nbc_req, int *error_co } -static void ADIOI_W_Iexchange_data(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_W_Iexchange_data(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_W_Iexchange_data_vars *vars = nbc_req->data.wr.wed_vars; /* exchange recv_size info so that each process knows how much to - send to whom. */ + * send to whom. */ *error_code = MPI_Ialltoall(vars->recv_size, 1, MPI_INT, vars->send_size, 1, MPI_INT, vars->fd->comm, &vars->req1); @@ -1067,8 +1006,7 @@ static void ADIOI_W_Iexchange_data(ADIOI_NBC_Request *nbc_req, int *error_code) nbc_req->data.wr.state = ADIOI_IWC_STATE_W_IEXCHANGE_DATA; } -static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_W_Iexchange_data_vars *vars = nbc_req->data.wr.wed_vars; ADIO_File fd = vars->fd; @@ -1090,15 +1028,17 @@ static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, /* create derived datatypes for recv */ nprocs_recv = 0; - for (i = 0; i < nprocs; i++) if (recv_size[i]) nprocs_recv++; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + nprocs_recv++; vars->nprocs_recv = nprocs_recv; recv_types = (MPI_Datatype *) - ADIOI_Malloc((nprocs_recv+1)*sizeof(MPI_Datatype)); + ADIOI_Malloc((nprocs_recv + 1) * sizeof(MPI_Datatype)); vars->recv_types = recv_types; /* +1 to avoid a 0-size malloc */ - tmp_len = (int *)ADIOI_Malloc(nprocs*sizeof(int)); + tmp_len = (int *) ADIOI_Malloc(nprocs * sizeof(int)); j = 0; for (i = 0; i < nprocs; i++) { if (recv_size[i]) { @@ -1109,29 +1049,29 @@ static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, others_req[i].lens[k] = partial_recv[i]; } ADIOI_Type_create_hindexed_x(count[i], - &(others_req[i].lens[start_pos[i]]), - &(others_req[i].mem_ptrs[start_pos[i]]), - MPI_BYTE, recv_types+j); + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, recv_types + j); /* absolute displacements; use MPI_BOTTOM in recv */ - MPI_Type_commit(recv_types+j); + MPI_Type_commit(recv_types + j); j++; } } /* To avoid a read-modify-write, check if there are holes in the - data to be written. For this, merge the (sorted) offset lists - others_req using a heap-merge. */ + * data to be written. For this, merge the (sorted) offset lists + * others_req using a heap-merge. */ sum = 0; - for (i = 0; i < nprocs; i++) sum += count[i]; + for (i = 0; i < nprocs; i++) + sum += count[i]; /* valgrind-detcted optimization: if there is no work on this process we do * not need to search for holes */ if (sum) { - srt_off = (ADIO_Offset *)ADIOI_Malloc(sum*sizeof(ADIO_Offset)); - srt_len = (int *)ADIOI_Malloc(sum*sizeof(int)); + srt_off = (ADIO_Offset *) ADIOI_Malloc(sum * sizeof(ADIO_Offset)); + srt_len = (int *) ADIOI_Malloc(sum * sizeof(int)); - ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, - nprocs, nprocs_recv, sum); + ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, nprocs, nprocs_recv, sum); } /* for partial recvs, restore original lengths */ @@ -1151,19 +1091,19 @@ static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, *hole = 0; if (sum) { - if (off != srt_off[0]) /* hole at the front */ + if (off != srt_off[0]) /* hole at the front */ *hole = 1; - else { /* coalesce the sorted offset-length pairs */ + else { /* coalesce the sorted offset-length pairs */ for (i = 1; i < sum; i++) { if (srt_off[i] <= srt_off[0] + srt_len[0]) { /* ok to cast: operating on cb_buffer_size chunks */ - int new_len = (int)srt_off[i] + srt_len[i] - (int)srt_off[0]; - if (new_len > srt_len[0]) srt_len[0] = new_len; - } - else + int new_len = (int) srt_off[i] + srt_len[i] - (int) srt_off[0]; + if (new_len > srt_len[0]) + srt_len[0] = new_len; + } else break; } - if (i < sum || size != srt_len[0]) /* hole in middle or end */ + if (i < sum || size != srt_len[0]) /* hole in middle or end */ *hole = 1; } @@ -1174,8 +1114,7 @@ static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, if (nprocs_recv) { if (*hole) { ADIO_IreadContig(fd, vars->write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &vars->req2, - &vars->err); + ADIO_EXPLICIT_OFFSET, off, &vars->req2, &vars->err); nbc_req->data.wr.state = ADIOI_IWC_STATE_W_IEXCHANGE_DATA_HOLE; return; } @@ -1184,8 +1123,7 @@ static void ADIOI_W_Iexchange_data_hole(ADIOI_NBC_Request *nbc_req, ADIOI_W_Iexchange_data_send(nbc_req, error_code); } -static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_W_Iexchange_data_vars *vars = nbc_req->data.wr.wed_vars; ADIO_File fd = vars->fd; @@ -1195,7 +1133,7 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, int nprocs = vars->nprocs; int myrank = vars->myrank; int iter = vars->iter; - int *buf_idx = vars->buf_idx; + MPI_Aint *buf_idx = vars->buf_idx; int nprocs_recv = vars->nprocs_recv; MPI_Datatype *recv_types = vars->recv_types; @@ -1205,26 +1143,27 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, char **send_buf = NULL; nprocs_send = 0; - for (i = 0; i < nprocs; i++) if (send_size[i]) nprocs_send++; + for (i = 0; i < nprocs; i++) + if (send_size[i]) + nprocs_send++; vars->nprocs_send = nprocs_send; if (fd->atomicity) { /* bug fix from Wei-keng Liao and Kenin Coloma */ vars->requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+1)*sizeof(MPI_Request)); + ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Request)); vars->send_req = vars->requests; - } - else { + } else { vars->requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); /* +1 to avoid a 0-size malloc */ /* post receives */ j = 0; for (i = 0; i < nprocs; i++) { if (recv_size[i]) { - MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, vars->requests+j); + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, vars->requests + j); j++; } } @@ -1232,29 +1171,30 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, } /* post sends. if buftype_is_contig, data can be directly sent from - user buf at location given by buf_idx. else use send_buf. */ + * user buf at location given by buf_idx. else use send_buf. */ #ifdef AGGREGATION_PROFILE - MPE_Log_event (5032, 0, NULL); + MPE_Log_event(5032, 0, NULL); #endif if (vars->buftype_is_contig) { j = 0; for (i = 0; i < nprocs; i++) if (send_size[i]) { MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], - MPI_BYTE, i, myrank+i+100*iter, fd->comm, - vars->send_req+j); + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, vars->send_req + j); j++; buf_idx[i] += send_size[i]; } - } - else if (nprocs_send) { + } else if (nprocs_send) { /* buftype is not contig */ - send_buf = (char **)ADIOI_Malloc(nprocs*sizeof(char*)); - vars->send_buf = send_buf; + size_t msgLen = 0; for (i = 0; i < nprocs; i++) - if (send_size[i]) - send_buf[i] = (char *)ADIOI_Malloc(send_size[i]); + msgLen += send_size[i]; + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + send_buf[0] = (char *) ADIOI_Malloc(msgLen * sizeof(char)); + for (i = 1; i < nprocs; i++) + send_buf[i] = send_buf[i - 1] + send_size[i - 1]; + vars->send_buf = send_buf; ADIOI_Fill_send_buffer(fd, buf, vars->flat_buf, send_buf, vars->offset_list, vars->len_list, send_size, @@ -1264,22 +1204,21 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, vars->min_st_offset, vars->fd_size, vars->fd_start, vars->fd_end, vars->send_buf_idx, vars->curr_to_proc, - vars->done_to_proc, iter, - vars->buftype_extent); + vars->done_to_proc, iter, vars->buftype_extent); /* the send is done in ADIOI_Fill_send_buffer */ } if (fd->atomicity) { vars->req3 = (MPI_Request *) - ADIOI_Malloc((nprocs_recv+1)*sizeof(MPI_Request)); + ADIOI_Malloc((nprocs_recv + 1) * sizeof(MPI_Request)); /* +1 to avoid a 0-size malloc */ /* bug fix from Wei-keng Liao and Kenin Coloma */ j = 0; for (i = 0; i < nprocs; i++) { if (recv_size[i]) { - MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank+i+100*iter, - fd->comm, vars->req3+j); + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, vars->req3 + j); j++; } } @@ -1291,8 +1230,7 @@ static void ADIOI_W_Iexchange_data_send(ADIOI_NBC_Request *nbc_req, ADIOI_W_Iexchange_data_wait(nbc_req, error_code); } -static void ADIOI_W_Iexchange_data_wait(ADIOI_NBC_Request *nbc_req, - int *error_code) +static void ADIOI_W_Iexchange_data_wait(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_W_Iexchange_data_vars *vars = nbc_req->data.wr.wed_vars; ADIO_File fd = vars->fd; @@ -1301,17 +1239,16 @@ static void ADIOI_W_Iexchange_data_wait(ADIOI_NBC_Request *nbc_req, MPI_Datatype *recv_types = vars->recv_types; int i; - for (i = 0; i < nprocs_recv; i++) MPI_Type_free(recv_types+i); + for (i = 0; i < nprocs_recv; i++) + MPI_Type_free(recv_types + i); ADIOI_Free(recv_types); - i= 0; + i = 0; if (fd->atomicity) { /* bug fix from Wei-keng Liao and Kenin Coloma */ MPI_Testall(nprocs_send, vars->send_req, &i, MPI_STATUSES_IGNORE); - } - else { - MPI_Testall(nprocs_send+nprocs_recv, vars->requests, &i, - MPI_STATUSES_IGNORE); + } else { + MPI_Testall(nprocs_send + nprocs_recv, vars->requests, &i, MPI_STATUSES_IGNORE); } if (i) { @@ -1321,25 +1258,22 @@ static void ADIOI_W_Iexchange_data_wait(ADIOI_NBC_Request *nbc_req, } } -static void ADIOI_W_Iexchange_data_fini(ADIOI_NBC_Request *nbc_req, int *error_code) +static void ADIOI_W_Iexchange_data_fini(ADIOI_NBC_Request * nbc_req, int *error_code) { ADIOI_W_Iexchange_data_vars *vars = nbc_req->data.wr.wed_vars; - void (*next_fn)(ADIOI_NBC_Request *, int *); + void (*next_fn) (ADIOI_NBC_Request *, int *); ADIO_File fd = vars->fd; - int *send_size = vars->send_size; - int nprocs = vars->nprocs; char **send_buf = vars->send_buf; - int i; - if (fd->atomicity) ADIOI_Free(vars->req3); + if (fd->atomicity) + ADIOI_Free(vars->req3); #ifdef AGGREGATION_PROFILE - MPE_Log_event (5033, 0, NULL); + MPE_Log_event(5033, 0, NULL); #endif ADIOI_Free(vars->requests); if (!vars->buftype_is_contig && vars->nprocs_send) { - for (i = 0; i < nprocs; i++) - if (send_size[i]) ADIOI_Free(send_buf[i]); + ADIOI_Free(send_buf[0]); ADIOI_Free(send_buf); } @@ -1354,11 +1288,11 @@ static void ADIOI_W_Iexchange_data_fini(ADIOI_NBC_Request *nbc_req, int *error_c } -static int ADIOI_GEN_iwc_query_fn(void *extra_state, MPI_Status *status) +static int ADIOI_GEN_iwc_query_fn(void *extra_state, MPI_Status * status) { ADIOI_NBC_Request *nbc_req; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; MPI_Status_set_elements_x(status, MPI_BYTE, nbc_req->nbytes); @@ -1378,29 +1312,28 @@ static int ADIOI_GEN_iwc_free_fn(void *extra_state) { ADIOI_NBC_Request *nbc_req; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; ADIOI_Free(nbc_req); return MPI_SUCCESS; } -static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status) +static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status * status) { ADIOI_NBC_Request *nbc_req; ADIOI_GEN_IwriteStridedColl_vars *wsc_vars = NULL; - ADIOI_Icalc_others_req_vars *cor_vars = NULL; - ADIOI_Iexch_and_write_vars *eaw_vars = NULL; - ADIOI_W_Iexchange_data_vars *wed_vars = NULL; + ADIOI_Icalc_others_req_vars *cor_vars = NULL; + ADIOI_Iexch_and_write_vars *eaw_vars = NULL; + ADIOI_W_Iexchange_data_vars *wed_vars = NULL; int errcode = MPI_SUCCESS; int flag; - nbc_req = (ADIOI_NBC_Request *)extra_state; + nbc_req = (ADIOI_NBC_Request *) extra_state; switch (nbc_req->data.wr.state) { case ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL: wsc_vars = nbc_req->data.wr.wsc_vars; - errcode = MPI_Testall(2, wsc_vars->req_offset, &flag, - MPI_STATUSES_IGNORE); + errcode = MPI_Testall(2, wsc_vars->req_offset, &flag, MPI_STATUSES_IGNORE); if (errcode == MPI_SUCCESS && flag) { ADIOI_GEN_IwriteStridedColl_inter(nbc_req, &errcode); } @@ -1477,10 +1410,9 @@ static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status) /* --BEGIN ERROR HANDLING-- */ if (wed_vars->err != MPI_SUCCESS) { errcode = MPIO_Err_create_code(wed_vars->err, - MPIR_ERR_RECOVERABLE, - "ADIOI_W_EXCHANGE_DATA", - __LINE__, MPI_ERR_IO, - "**ioRMWrdwr", 0); + MPIR_ERR_RECOVERABLE, + "ADIOI_W_EXCHANGE_DATA", + __LINE__, MPI_ERR_IO, "**ioRMWrdwr", 0); break;; } /* --END ERROR HANDLING-- */ @@ -1506,8 +1438,7 @@ static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status) } else { errcode = MPI_Testall(wed_vars->nprocs_send + wed_vars->nprocs_recv, - wed_vars->requests, - &flag, MPI_STATUSES_IGNORE); + wed_vars->requests, &flag, MPI_STATUSES_IGNORE); } if (errcode == MPI_SUCCESS && flag) { ADIOI_W_Iexchange_data_fini(nbc_req, &errcode); @@ -1521,10 +1452,9 @@ static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status) /* --BEGIN ERROR HANDLING-- */ if (errcode != MPI_SUCCESS) { errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_iwc_poll_fn", __LINE__, - MPI_ERR_IO, "**mpi_grequest_complete", - 0); + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_iwc_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", 0); } /* --END ERROR HANDLING-- */ @@ -1533,25 +1463,24 @@ static int ADIOI_GEN_iwc_poll_fn(void *extra_state, MPI_Status *status) /* wait for multiple requests to complete */ static int ADIOI_GEN_iwc_wait_fn(int count, void **array_of_states, - double timeout, MPI_Status *status) + double timeout, MPI_Status * status) { int i, errcode = MPI_SUCCESS; double starttime; ADIOI_NBC_Request **nbc_reqlist; - nbc_reqlist = (ADIOI_NBC_Request **)array_of_states; + nbc_reqlist = (ADIOI_NBC_Request **) array_of_states; starttime = MPI_Wtime(); - for (i = 0; i < count ; i++) { + for (i = 0; i < count; i++) { while (nbc_reqlist[i]->data.wr.state != ADIOI_IWC_STATE_COMPLETE) { errcode = ADIOI_GEN_iwc_poll_fn(nbc_reqlist[i], MPI_STATUS_IGNORE); /* --BEGIN ERROR HANDLING-- */ if (errcode != MPI_SUCCESS) { errcode = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - "ADIOI_GEN_iwc_wait_fn", - __LINE__, MPI_ERR_IO, - "**mpi_grequest_complete", 0); + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_iwc_wait_fn", + __LINE__, MPI_ERR_IO, "**mpi_grequest_complete", 0); } /* --END ERROR HANDLING-- */ @@ -1560,7 +1489,9 @@ static int ADIOI_GEN_iwc_wait_fn(int count, void **array_of_states, /* If the progress engine is blocked, we have to yield for another * thread to be able to unblock the progress engine. */ - MPIR_Ext_cs_yield(); + /* NOTE: we're outside a critical section (safety ensured by standard), + * we only need yield in case of user threads */ + ROMIO_THREAD_CS_YIELD(); } } diff --git a/3rd-party/romio321/adio/common/ad_iwrite_coll.pdf b/3rd-party/romio341/adio/common/ad_iwrite_coll.pdf similarity index 100% rename from 3rd-party/romio321/adio/common/ad_iwrite_coll.pdf rename to 3rd-party/romio341/adio/common/ad_iwrite_coll.pdf diff --git a/3rd-party/romio341/adio/common/ad_iwrite_fake.c b/3rd-party/romio341/adio/common/ad_iwrite_fake.c new file mode 100644 index 0000000000000000000000000000000000000000..c48405a8e1ae527a81b84ca929f601d466c71663 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_iwrite_fake.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#include "mpiu_greq.h" + +/* Generic implementation of IwriteContig calls the blocking WriteContig + * immediately. + */ +void ADIOI_FAKE_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + ADIO_Status status; + MPI_Count typesize; + int write_count; + MPI_Offset nbytes; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_WriteContig(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size_x(datatype, &typesize); + MPI_Get_count(&status, datatype, &write_count); + nbytes = write_count * typesize; + } else { + nbytes = 0; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); + +} + + +/* Generic implementation of IwriteStrided calls the blocking WriteStrided + * immediately. + */ +void ADIOI_FAKE_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code) +{ + ADIO_Status status; + MPI_Count typesize; + int write_count; + MPI_Offset nbytes; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size_x(datatype, &typesize); + MPI_Get_count(&status, datatype, &write_count); + nbytes = write_count * typesize; + } else { + nbytes = 0; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} diff --git a/3rd-party/romio321/adio/common/ad_open.c b/3rd-party/romio341/adio/common/ad_open.c similarity index 55% rename from 3rd-party/romio321/adio/common/ad_open.c rename to 3rd-party/romio341/adio/common/ad_open.c index ced256d3494c0f4cd65ff35eeb66ee6f1f3d4048..42c9d6cac40b3ed1b4e538f312b6f4f3646adc95 100644 --- a/3rd-party/romio321/adio/common/ad_open.c +++ b/3rd-party/romio341/adio/common/ad_open.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -13,22 +11,21 @@ static int is_aggregator(int rank, ADIO_File fd); static int uses_generic_read(ADIO_File fd); static int uses_generic_write(ADIO_File fd); -static int build_cb_config_list(ADIO_File fd, - MPI_Comm orig_comm, MPI_Comm comm, - int rank, int procs, int *error_code); +static int build_cb_config_list(ADIO_File fd, + MPI_Comm orig_comm, MPI_Comm comm, + int rank, int procs, int *error_code); MPI_File ADIO_Open(MPI_Comm orig_comm, - MPI_Comm comm, const char *filename, int file_system, - ADIOI_Fns *ops, - int access_mode, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, - MPI_Info info, int perm, int *error_code) + MPI_Comm comm, const char *filename, int file_system, + ADIOI_Fns * ops, + int access_mode, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, MPI_Info info, int perm, int *error_code) { MPI_File mpi_fh; ADIO_File fd; int err, rank, procs; static char myname[] = "ADIO_OPEN"; - int max_error_code; + int max_error_code; MPI_Info dupinfo; int syshints_processed, can_skip; char *p; @@ -38,14 +35,11 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, /* obtain MPI_File handle */ mpi_fh = MPIO_File_create(sizeof(struct ADIOI_FileD)); if (mpi_fh == MPI_FILE_NULL) { - fd = MPI_FILE_NULL; - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - goto fn_exit; + fd = MPI_FILE_NULL; + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + goto fn_exit; } fd = MPIO_File_resolve(mpi_fh); @@ -53,7 +47,7 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, fd->cookie = ADIOI_FILE_COOKIE; fd->fp_ind = disp; fd->fp_sys_posn = 0; - fd->comm = comm; /* dup'ed in MPI_File_open */ + fd->comm = comm; /* dup'ed in MPI_File_open */ fd->filename = ADIOI_Strdup(filename); fd->file_system = file_system; fd->fs_ptr = NULL; @@ -64,9 +58,9 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, fd->split_coll_count = 0; fd->shared_fp_fd = ADIO_FILE_NULL; fd->atomicity = 0; - fd->etype = etype; /* MPI_BYTE by default */ + fd->etype = etype; /* MPI_BYTE by default */ fd->filetype = filetype; /* MPI_BYTE by default */ - fd->etype_size = 1; /* default etype is MPI_BYTE */ + fd->etype_size = 1; /* default etype is MPI_BYTE */ fd->file_realm_st_offs = NULL; fd->file_realm_types = NULL; @@ -85,15 +79,12 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &procs); /* create and initialize info object */ - fd->hints = (ADIOI_Hints *)ADIOI_Calloc(1, sizeof(struct ADIOI_Hints_struct)); + fd->hints = (ADIOI_Hints *) ADIOI_Calloc(1, sizeof(struct ADIOI_Hints_struct)); if (fd->hints == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - goto fn_exit; + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + goto fn_exit; } fd->hints->cb_config_list = NULL; fd->hints->ranklist = NULL; @@ -112,23 +103,23 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, * a code might do an "initialize from 0", so we can only skip hint * processing once everyone has particpiated in hint processing */ if (ADIOI_syshints == MPI_INFO_NULL) - syshints_processed = 0; + syshints_processed = 0; else - syshints_processed = 1; + syshints_processed = 1; MPI_Allreduce(&syshints_processed, &can_skip, 1, MPI_INT, MPI_MIN, fd->comm); if (!can_skip) { - if (ADIOI_syshints == MPI_INFO_NULL) - MPI_Info_create(&ADIOI_syshints); - ADIOI_process_system_hints(fd, ADIOI_syshints); + if (ADIOI_syshints == MPI_INFO_NULL) + MPI_Info_create(&ADIOI_syshints); + ADIOI_process_system_hints(fd, ADIOI_syshints); } ADIOI_incorporate_system_hints(info, ADIOI_syshints, &dupinfo); ADIO_SetInfo(fd, dupinfo, &err); if (dupinfo != MPI_INFO_NULL) { - *error_code = MPI_Info_free(&dupinfo); - if (*error_code != MPI_SUCCESS) - goto fn_exit; + *error_code = MPI_Info_free(&dupinfo); + if (*error_code != MPI_SUCCESS) + goto fn_exit; } ADIOI_Info_set(fd->info, "romio_filesystem_type", fd->fns->fsname); @@ -137,29 +128,28 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, * (e.g. Blue Gene) more efficent */ fd->io_buf = ADIOI_Malloc(fd->hints->cb_buffer_size); - /* deferred open: + /* deferred open: * we can only do this optimization if 'fd->hints->deferred_open' is set * (which means the user hinted 'no_indep_rw' and collective buffering). * Furthermore, we only do this if our collective read/write routines use * our generic function, and not an fs-specific routine (we can defer opens * only if we use our aggreagation code). */ - if (fd->hints->deferred_open && - !(uses_generic_read(fd) \ - && uses_generic_write(fd))) { - fd->hints->deferred_open = 0; + if (fd->hints->deferred_open && !(uses_generic_read(fd) + && uses_generic_write(fd))) { + fd->hints->deferred_open = 0; } if (ADIO_Feature(fd, ADIO_SCALABLE_OPEN)) - /* disable deferred open on these fs so that scalable broadcast - * will always use the propper communicator */ - fd->hints->deferred_open = 0; + /* disable deferred open on these fs so that scalable broadcast + * will always use the propper communicator */ + fd->hints->deferred_open = 0; /* on BlueGene, the cb_config_list is built when hints are processed. No * one else does that right now */ if (fd->hints->ranklist == NULL) { - build_cb_config_list(fd, orig_comm, comm, rank, procs, error_code); - if (*error_code != MPI_SUCCESS) - goto fn_exit; + build_cb_config_list(fd, orig_comm, comm, rank, procs, error_code); + if (*error_code != MPI_SUCCESS) + goto fn_exit; } fd->is_open = 0; fd->my_cb_nodes_index = -2; @@ -183,78 +173,78 @@ MPI_File ADIO_Open(MPI_Comm orig_comm, * the deferred open case is going to fail and surprise the user. Turn off * the excl amode bit. Save user's ammode for MPI_FILE_GET_AMODE */ fd->orig_access_mode = access_mode; - if (fd->access_mode & ADIO_EXCL) fd->access_mode ^= ADIO_EXCL; + if (fd->access_mode & ADIO_EXCL) + fd->access_mode ^= ADIO_EXCL; /* for debugging, it can be helpful to see the hints selected. Some file * systes set up the hints in the open call (e.g. lustre) */ p = getenv("ROMIO_PRINT_HINTS"); - if (rank == 0 && p != NULL ) { - ADIOI_Info_print_keyvals(fd->info); + if (rank == 0 && p != NULL) { + ADIOI_Info_print_keyvals(fd->info); } - fn_exit: + fn_exit: MPI_Allreduce(error_code, &max_error_code, 1, MPI_INT, MPI_MAX, comm); if (max_error_code != MPI_SUCCESS) { /* If the file was successfully opened, close it */ if (*error_code == MPI_SUCCESS) { - + /* in the deferred open case, only those who have actually - opened the file should close it */ - if (fd->hints->deferred_open) { + * opened the file should close it */ + if (fd->hints->deferred_open) { if (fd->is_agg) { - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); } - } - else { - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } else { + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); } } - ADIOI_Free(fd->filename); - ADIOI_Free(fd->hints->ranklist); - if ( fd->hints->cb_config_list != NULL ) ADIOI_Free(fd->hints->cb_config_list); - ADIOI_Free(fd->hints); - if (fd->info != MPI_INFO_NULL) MPI_Info_free(&(fd->info)); - ADIOI_Free(fd->io_buf); - ADIOI_Free(fd); + ADIOI_Free(fd->filename); + ADIOI_Free(fd->hints->ranklist); + if (fd->hints->cb_config_list != NULL) + ADIOI_Free(fd->hints->cb_config_list); + ADIOI_Free(fd->hints); + if (fd->info != MPI_INFO_NULL) + MPI_Info_free(&(fd->info)); + ADIOI_Free(fd->io_buf); + ADIOI_Free(fd); fd = ADIO_FILE_NULL; - if (*error_code == MPI_SUCCESS) - { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, myname, - __LINE__, MPI_ERR_IO, - "**oremote_fail", 0); - } + if (*error_code == MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**oremote_fail", 0); + } } return fd; } /* a simple linear search. possible enancement: add a my_cb_nodes_index member - * ( index into cb_nodes, else -1 if not aggregator ) for faster lookups + * (index into cb_nodes, else -1 if not aggregator) for faster lookups * * fd->hints->cb_nodes is the number of aggregators * fd->hints->ranklist[] is an array of the ranks of aggregators * - * might want to move this to adio/common/cb_config_list.c + * might want to move this to adio/common/cb_config_list.c */ -int is_aggregator(int rank, ADIO_File fd ) { - int i; - - if (fd->my_cb_nodes_index == -2) { - for (i=0; i< fd->hints->cb_nodes; i++ ) { - if ( rank == fd->hints->ranklist[i] ) { - fd->my_cb_nodes_index = i; - return 1; - } - } - fd->my_cb_nodes_index = -1; +int is_aggregator(int rank, ADIO_File fd) +{ + int i; + + if (fd->my_cb_nodes_index == -2) { + for (i = 0; i < fd->hints->cb_nodes; i++) { + if (rank == fd->hints->ranklist[i]) { + fd->my_cb_nodes_index = i; + return 1; + } } - else if (fd->my_cb_nodes_index != -1) - return 1; + fd->my_cb_nodes_index = -1; + } else if (fd->my_cb_nodes_index != -1) + return 1; - return 0; + return 0; } /* @@ -275,9 +265,9 @@ static int uses_generic_write(ADIO_File fd) return 0; } -static int build_cb_config_list(ADIO_File fd, - MPI_Comm orig_comm, MPI_Comm comm, - int rank, int procs, int *error_code) +static int build_cb_config_list(ADIO_File fd, + MPI_Comm orig_comm, MPI_Comm comm, + int rank, int procs, int *error_code) { ADIO_cb_name_array array; int *tmp_ranklist; @@ -293,45 +283,36 @@ static int build_cb_config_list(ADIO_File fd, /* parse the cb_config_list and create a rank map on rank 0 */ if (rank == 0) { - tmp_ranklist = (int *) ADIOI_Malloc(sizeof(int) * procs); - if (tmp_ranklist == NULL) { - *error_code = MPIO_Err_create_code(*error_code, - MPIR_ERR_RECOVERABLE, - myname, - __LINE__, - MPI_ERR_OTHER, - "**nomem2",0); - return 0; - } - - rank_ct = ADIOI_cb_config_list_parse(fd->hints->cb_config_list, - array, tmp_ranklist, - fd->hints->cb_nodes); - - /* store the ranklist using the minimum amount of memory */ - if (rank_ct > 0) { - fd->hints->ranklist = (int *) ADIOI_Malloc(sizeof(int) * rank_ct); - memcpy(fd->hints->ranklist, tmp_ranklist, sizeof(int) * rank_ct); - } - ADIOI_Free(tmp_ranklist); - fd->hints->cb_nodes = rank_ct; - /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR FS-INDEP. */ - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", rank_ct); - ADIOI_Info_set(fd->info, "cb_nodes", value); - ADIOI_Free(value); + tmp_ranklist = (int *) ADIOI_Malloc(sizeof(int) * procs); + if (tmp_ranklist == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return 0; + } + + rank_ct = ADIOI_cb_config_list_parse(fd->hints->cb_config_list, + array, tmp_ranklist, fd->hints->cb_nodes); + + /* store the ranklist using the minimum amount of memory */ + if (rank_ct > 0) { + fd->hints->ranklist = (int *) ADIOI_Malloc(sizeof(int) * rank_ct); + memcpy(fd->hints->ranklist, tmp_ranklist, sizeof(int) * rank_ct); + } + ADIOI_Free(tmp_ranklist); + fd->hints->cb_nodes = rank_ct; + /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR FS-INDEP. */ + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", rank_ct); + ADIOI_Info_set(fd->info, "cb_nodes", value); + ADIOI_Free(value); } ADIOI_cb_bcast_rank_map(fd); if (fd->hints->cb_nodes <= 0) { - *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**ioagnomatch", 0); - fd = ADIO_FILE_NULL; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**ioagnomatch", 0); + fd = ADIO_FILE_NULL; } return 0; } - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio341/adio/common/ad_opencoll.c b/3rd-party/romio341/adio/common/ad_opencoll.c new file mode 100644 index 0000000000000000000000000000000000000000..4d05773e66ff97e164c35f2b516bc5842a3879f2 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_opencoll.c @@ -0,0 +1,182 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* Generic version of a "collective open". Assumes a "real" underlying + * file system (meaning no wonky consistency semantics like NFS). + * + * optimization: by having just one process create a file, close it, + * then have all N processes open it, we can possibly avoid contention + * for write locks on a directory for some file systems. + * + * Happy side-effect: exclusive create (error if file already exists) + * just falls out + * + * Note: this is not a "scalable open" (c.f. "The impact of file systems + * on MPI-IO scalability"). + */ + +enum { + BLOCKSIZE = 0, + STRIPE_SIZE, + STRIPE_FACTOR, + START_IODEVICE, + STAT_ITEMS +} file_stats; + + +/* generate an MPI datatype describing the members of the ADIO_File struct that + * we want to ensure all processes have. In deferred open, aggregators will + * open the file and possibly read layout and other information. + * non-aggregators will skip the open, but still need to know how the file is + * being treated and what optimizations to apply */ + +static MPI_Datatype make_stats_type(ADIO_File fd) +{ + int lens[STAT_ITEMS]; + MPI_Aint offsets[STAT_ITEMS]; + MPI_Datatype types[STAT_ITEMS]; + MPI_Datatype newtype; + + lens[BLOCKSIZE] = 1; + MPI_Get_address(&fd->blksize, &offsets[BLOCKSIZE]); + types[BLOCKSIZE] = MPI_LONG; + + lens[STRIPE_SIZE] = lens[STRIPE_FACTOR] = lens[START_IODEVICE] = 1; + types[STRIPE_SIZE] = types[STRIPE_FACTOR] = types[START_IODEVICE] = MPI_INT; + MPI_Get_address(&fd->hints->striping_unit, &offsets[STRIPE_SIZE]); + MPI_Get_address(&fd->hints->striping_factor, &offsets[STRIPE_FACTOR]); + MPI_Get_address(&fd->hints->start_iodevice, &offsets[START_IODEVICE]); + + + MPI_Type_create_struct(STAT_ITEMS, lens, offsets, types, &newtype); + MPI_Type_commit(&newtype); + return newtype; + +} + +void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code) +{ + int orig_amode_excl, orig_amode_wronly; + MPI_Comm tmp_comm; + MPI_Datatype stats_type; /* deferred open: some processes might not + * open the file, so we'll exchange some + * information with those non-aggregators */ + + orig_amode_excl = access_mode; + + if (access_mode & ADIO_CREATE) { + if (rank == fd->hints->ranklist[0]) { + /* remove delete_on_close flag if set */ + if (access_mode & ADIO_DELETE_ON_CLOSE) + fd->access_mode = access_mode ^ ADIO_DELETE_ON_CLOSE; + else + fd->access_mode = access_mode; + + tmp_comm = fd->comm; + fd->comm = MPI_COMM_SELF; + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + fd->comm = tmp_comm; + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + /* if no error, close the file and reopen normally below */ + if (*error_code == MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); + + fd->access_mode = access_mode; /* back to original */ + } else + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + if (*error_code != MPI_SUCCESS) { + return; + } else { + /* turn off CREAT (and EXCL if set) for real multi-processor open */ + access_mode ^= ADIO_CREATE; + if (access_mode & ADIO_EXCL) + access_mode ^= ADIO_EXCL; + } + } + fd->blksize = 1024 * 1024 * 4; /* this large default value should be good for + * most file systems. any ROMIO driver is free + * to stat the file and find an optimial value */ + + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open) { + if (!(fd->is_agg)) { + char value[MPI_MAX_INFO_VAL + 1]; + /* we might have turned off EXCL for the aggregators. + * restore access_mode that non-aggregators get the right + * value from get_amode */ + fd->access_mode = orig_amode_excl; + /* In file-system specific open, a driver might collect some + * information via stat(). Deferred open means not every process + * participates in fs-specific open, but they all participate in + * this open call. Broadcast a bit of information in case + * lower-level file system driver (e.g. 'bluegene') collected it + * (not all do)*/ + stats_type = make_stats_type(fd); + MPI_Bcast(MPI_BOTTOM, 1, stats_type, fd->hints->ranklist[0], fd->comm); + ADIOI_Assert(fd->blksize > 0); + /* some file systems (e.g. lustre) will inform the user via the + * info object about the file configuration. deferred open, + * though, skips that step for non-aggregators. we do the + * info-setting here */ + MPL_snprintf(value, sizeof(value), "%d", fd->hints->striping_unit); + ADIOI_Info_set(fd->info, "striping_unit", value); + + MPL_snprintf(value, sizeof(value), "%d", fd->hints->striping_factor); + ADIOI_Info_set(fd->info, "striping_factor", value); + + MPL_snprintf(value, sizeof(value), "%d", fd->hints->start_iodevice); + ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); + + *error_code = MPI_SUCCESS; + MPI_Type_free(&stats_type); + return; + } + } + +/* For writing with data sieving, a read-modify-write is needed. If + the file is opened for write_only, the read will fail. Therefore, + if write_only, open the file as read_write, but record it as write_only + in fd, so that get_amode returns the right answer. */ + + /* observation from David Knaak: file systems that do not support data + * sieving do not need to change the mode */ + + orig_amode_wronly = access_mode; + if ((access_mode & ADIO_WRONLY) && ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES)) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + /* if error, may be it was due to the change in amode above. + * therefore, reopen with access mode provided by the user. */ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + /* if we turned off EXCL earlier, then we should turn it back on */ + if (fd->access_mode != orig_amode_excl) + fd->access_mode = orig_amode_excl; + + /* broadcast information to all proceses in + * communicator, not just those who participated in open */ + + stats_type = make_stats_type(fd); + MPI_Bcast(MPI_BOTTOM, 1, stats_type, fd->hints->ranklist[0], fd->comm); + MPI_Type_free(&stats_type); + /* file domain code will get terribly confused in a hard-to-debug way if + * gpfs blocksize not sensible */ + ADIOI_Assert(fd->blksize > 0); + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; + +} diff --git a/3rd-party/romio341/adio/common/ad_opencoll_failsafe.c b/3rd-party/romio341/adio/common/ad_opencoll_failsafe.c new file mode 100644 index 0000000000000000000000000000000000000000..06541582f8db48e9a6f9e11a3654ec28f0f353aa --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_opencoll_failsafe.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + + +/* this "collective" open is useful for frankly broken file systems such + * as NFS where a create from one client might not be immediately + * visible on another */ + +void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code) +{ + MPI_Comm tmp_comm; + int orig_amode_excl, orig_amode_wronly; + + orig_amode_excl = access_mode; + if ((access_mode & ADIO_CREATE) && (access_mode & ADIO_EXCL)) { + /* the open should fail if the file exists. Only *1* process + * should check this. Otherwise, if all processes try to check + * and the file does not exist, one process will create the file + * and others who reach later will return error. */ + if (rank == fd->hints->ranklist[0]) { + fd->access_mode = access_mode; + + /* if the lower-level file system tries to communicate, COMM_SELF + * will ensure it doesn't get stuck waiting for non-existant + * participants */ + tmp_comm = fd->comm; + fd->comm = MPI_COMM_SELF; + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], tmp_comm); + /* if no error, close the file and reopen normally below */ + if (*error_code == MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Close)) (fd, error_code); + /* and put it all back the way we found it for subsequent code */ + fd->comm = tmp_comm; + } else + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + if (*error_code != MPI_SUCCESS) { + return; + } else { + /* turn off EXCL for real open */ + access_mode = access_mode ^ ADIO_EXCL; + } + } + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open && !(fd->is_agg)) { + /* we might have turned off EXCL for the aggregators. + * restore access_mode that non-aggregators get the right + * value from get_amode */ + fd->access_mode = orig_amode_excl; + *error_code = MPI_SUCCESS; + return; + } + +/* For writing with data sieving, a read-modify-write is needed. If + the file is opened for write_only, the read will fail. Therefore, + if write_only, open the file as read_write, but record it as write_only + in fd, so that get_amode returns the right answer. */ + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + /* if error, may be it was due to the change in amode above. + * therefore, reopen with access mode provided by the user. */ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + if (*error_code != MPI_SUCCESS) + return; + /* if we turned off EXCL earlier, then we should turn it back on */ + if (fd->access_mode != orig_amode_excl) + fd->access_mode = orig_amode_excl; + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; +} diff --git a/3rd-party/romio341/adio/common/ad_opencoll_scalable.c b/3rd-party/romio341/adio/common/ad_opencoll_scalable.c new file mode 100644 index 0000000000000000000000000000000000000000..a9f13bf2eb6ce8a753376b07a6171d8fce66e82d --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_opencoll_scalable.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* + * Scalable open: for file systems capable of having one process + * create/open a file and broadcast the result to everyone else. + * - Does not need one process to create the file + * - Does not need special handling for CREATE|EXCL + */ +void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code) +{ + int orig_amode_wronly; + + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open && !(fd->is_agg)) { + *error_code = MPI_SUCCESS; + return; + } + + /* For writing with data sieving, a read-modify-write is needed. If + * the file is opened for write_only, the read will fail. Therefore, + * if write_only, open the file as read_write, but record it as + * write_only in fd, so that get_amode returns the right answer. */ + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + /* if error, may be it was due to the change in amode above. + * therefore, reopen with access mode provided by the user. */ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open)) (fd, error_code); + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; + +} diff --git a/3rd-party/romio341/adio/common/ad_prealloc.c b/3rd-party/romio341/adio/common/ad_prealloc.c new file mode 100644 index 0000000000000000000000000000000000000000..8fdf43ad5b0b787d8cbf602393be4e019f60f681 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_prealloc.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +/* this used to be implemented in every file system as an fcntl, but the code + * is identical for all file systems without a real "preallocate" system call. + * This naive approach will get the job done, but not in a terribly efficient + * manner. + */ +void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code) +{ + ADIO_Offset curr_fsize, alloc_size, size, len, done, ntimes; + ADIO_Status status; + int i; + char *buf; + ADIO_Fcntl_t *fcntl_struct; + static char myname[] = "ADIOI_GEN_PREALLOC"; + + /* will be called by one process only */ + /* On file systems with no preallocation function, we have to + * explicitly write + * to allocate space. Since there could be holes in the file, + * we need to read up to the current file size, write it back, + * and then write beyond that depending on how much + * preallocation is needed. + * read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */ + + /*curr_fsize = fd->fp_ind; */ + fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, error_code); + + curr_fsize = fcntl_struct->fsize; /* don't rely on fd->fp_ind: might be + * working on a pre-existing file */ + alloc_size = diskspace; + + size = MPL_MIN(curr_fsize, alloc_size); + + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1) / ADIOI_PREALLOC_BUFSZ; + buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); + done = 0; + + for (i = 0; i < ntimes; i++) { + len = MPL_MIN(size - done, ADIOI_PREALLOC_BUFSZ); + ADIO_ReadContig(fd, buf, (int) len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), + * so it fits in an int parameter */ + MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, &status, error_code); + if (*error_code != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iopreallocrdwr", 0); + return; + } + ADIO_WriteContig(fd, buf, (int) len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), + * so it fits in an int parameter */ + MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + done += len; + } + + if (alloc_size > curr_fsize) { + memset(buf, 0, ADIOI_PREALLOC_BUFSZ); + size = alloc_size - curr_fsize; + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1) / ADIOI_PREALLOC_BUFSZ; + for (i = 0; i < ntimes; i++) { + len = MPL_MIN(alloc_size - done, ADIOI_PREALLOC_BUFSZ); + ADIO_WriteContig(fd, buf, (int) len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M), + * so it fits in an int parameter */ + MPI_BYTE, ADIO_EXPLICIT_OFFSET, done, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + done += len; + } + } + ADIOI_Free(fcntl_struct); + ADIOI_Free(buf); + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_read.c b/3rd-party/romio341/adio/common/ad_read.c new file mode 100644 index 0000000000000000000000000000000000000000..2149b64ea9cf9d376107fbbdd9d806e8d039ad95 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_read.c @@ -0,0 +1,120 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" +#include <unistd.h> + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#ifdef ROMIO_GPFS +#include "adio/ad_gpfs/ad_gpfs_tuning.h" +#endif + +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + +void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ssize_t err = -1; + MPI_Count datatype_size; + ADIO_Offset len, bytes_xfered = 0; + size_t rd_count; + static char myname[] = "ADIOI_GEN_READCONTIG"; +#ifdef ROMIO_GPFS + double io_time = 0; +#endif + char *p; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5034, 0, NULL); +#endif + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = datatype_size * (ADIO_Offset) count; + +#ifdef ROMIO_GPFS + io_time = MPI_Wtime(); + if (gpfsmpio_timing) { + gpfsmpio_prof_cr[GPFSMPIO_CIO_DATA_SIZE] += len; + } +#endif + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + p = buf; + while (bytes_xfered < len) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + rd_count = len - bytes_xfered; + /* stupid FreeBSD and Darwin do not like a count larger than a signed + * int, even though size_t is eight bytes... */ + if (rd_count > INT_MAX) + rd_count = INT_MAX; +#ifdef ROMIO_GPFS + if (gpfsmpio_devnullio) + err = pread(fd->null_fd, p, rd_count, offset + bytes_xfered); + else +#endif + err = pread(fd->fd_sys, p, rd_count, offset + bytes_xfered); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + if (err == 0) { + /* end of file */ + break; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + bytes_xfered += err; + p += err; + } +#ifdef ROMIO_GPFS + if (gpfsmpio_timing) + gpfsmpio_prof_cr[GPFSMPIO_CIO_T_POSI_RW] += (MPI_Wtime() - io_time); +#endif + fd->fp_sys_posn = offset + bytes_xfered; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_xfered; + } + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + /* what if we only read half a datatype? */ + /* bytes_xfered could be larger than int */ + if (err != -1) + MPIR_Status_set_bytes(status, datatype, bytes_xfered); +#endif + + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5035, 0, NULL); +#endif +#ifdef ROMIO_GPFS + if (gpfsmpio_timing) + gpfsmpio_prof_cr[GPFSMPIO_CIO_T_MPIO_RW] += (MPI_Wtime() - io_time); +#endif +} diff --git a/3rd-party/romio341/adio/common/ad_read_coll.c b/3rd-party/romio341/adio/common/ad_read_coll.c new file mode 100644 index 0000000000000000000000000000000000000000..350fd63a3fd6a60a5d83c6855a2c04d732e25ced --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_read_coll.c @@ -0,0 +1,1046 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#ifdef MPL_USE_DBG_LOGGING +#define RDCOLL_DEBUG 1 +#endif +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* prototypes of functions used for collective reads only. */ +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code); +static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, + int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx); +void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **recv_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, + unsigned *recv_size, + MPI_Request * requests, MPI_Status * statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, MPI_Aint buftype_extent); + +#ifdef LUSTRE_RD_LOCK_AHEAD +/* There is no ad_lustre_rdcoll.c, so stub in some basic common code here + If it's called for over non-lustre file systems, it will turn itself off + when the ioctl fails. */ +void ADIOI_LUSTRE_lock_ahead_ioctl(ADIO_File fd, int avail_cb_nodes, ADIO_Offset next_offset, int *error_code); /* ad_lustre_lock.c */ +/* Handle lock ahead. If this read is outside our locked region, lock it now */ +/* The generic collective read code isn't reading the stripes quite how this lustre code (ad_lustre_lock.c) expects it. */ +/* There are some comments in the debug code in ad_lustre_lock.c. */ +#define ADIOI_LUSTRE_RD_LOCK_AHEAD(fd,cb_nodes,offset,error_code) \ +if ((fd->file_system == ADIO_LUSTRE) && (fd->hints->fs_hints.lustre.lock_ahead_read)) { \ + if (offset > fd->hints->fs_hints.lustre.lock_ahead_end_extent) { \ + ADIOI_LUSTRE_lock_ahead_ioctl(fd,cb_nodes,offset,error_code); \ + } \ + else if (offset < fd->hints->fs_hints.lustre.lock_ahead_start_extent) { \ + ADIOI_LUSTRE_lock_ahead_ioctl(fd,cb_nodes,offset,error_code); \ + } \ +} +#else +#define ADIOI_LUSTRE_RD_LOCK_AHEAD(fd,cb_nodes,offset,error_code) +#endif + +void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs structures, one for each other process in + * whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs structures, one for each other process + * whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count = 0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *len_list = NULL; + MPI_Aint *buf_idx = NULL; + +#ifdef HAVE_STATUS_SET_BYTES + MPI_Count bufsize, size; +#endif + + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl(fd, buf, count, ADIOI_READ, datatype, + file_ptr_type, offset, status, error_code); + return; + } + + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* number of aggregators, cb_nodes, is stored in the hints */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + + /* only check for interleaving if cb_read isn't disabled */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + * lengths in the file and determine the start and end offsets. */ + + /* Note: end_offset points to the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ + + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + +#ifdef RDCOLL_DEBUG + for (i = 0; i < contig_access_count; i++) { + DBG_FPRINTF(stderr, "rank %d off %lld len %lld\n", + myrank, (long long) offset_list[i], (long long) len_list[i]); + } +#endif + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets + * stored in order of process rank. */ + + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + end_offsets = st_offsets + nprocs; + + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm); + + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + * for the moment. */ + } + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + if (fd->hints->cb_read == ADIOI_HINT_DISABLE + || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) { + /* don't do aggregation */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (fd->etype_size) * offset; + ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, status, error_code); + } else + ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code); + } else + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + + return; + } + + /* We're going to perform aggregation of I/O. Here we call + * ADIOI_Calc_file_domains() to determine what processes will handle I/O + * to what regions. We pass nprocs_for_coll into this function; it is + * used to determine how many processes will perform I/O, which is also + * the number of regions into which the range of bytes must be divided. + * These regions are called "file domains", or FDs. + * + * When this function returns, fd_start, fd_end, fd_size, and + * min_st_offset will be filled in. fd_start holds the starting byte + * location for each file domain. fd_end holds the ending byte location. + * min_st_offset holds the minimum byte location that will be accessed. + * + * Both fd_start[] and fd_end[] are indexed by an aggregator number; this + * needs to be mapped to an actual rank in the communicator later. + * + */ + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, fd->hints->striping_unit); + + /* calculate where the portions of the access requests of this process + * are located in terms of the file domains. this could be on the same + * process or on other processes. this function fills in: + * count_my_req_procs - number of processes (including this one) for which + * this process has requests in their file domain + * count_my_req_per_proc - count of requests for each process, indexed + * by rank of the process + * my_req[] - array of data structures describing the requests to be + * performed by each process (including self). indexed by rank. + * buf_idx[] - array of locations into which data can be directly moved; + * this is only valid for contiguous buffer case + */ + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, &count_my_req_per_proc, &my_req, &buf_idx); + + /* perform a collective communication in order to distribute the + * data calculated above. fills in the following: + * count_others_req_procs - number of processes (including this + * one) which have requests in this process's file domain. + * count_others_req_per_proc[] - number of separate contiguous + * requests from proc i lie in this process's file domain. + */ + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + + /* my_req[] and count_my_req_per_proc aren't needed at this point, so + * let's free the memory + */ + ADIOI_Free(count_my_req_per_proc); + ADIOI_Free(my_req[0].offsets); + ADIOI_Free(my_req); + + /* read data in sizes of no more than ADIOI_Coll_bufsize, + * communicate, and fill user buf. + */ + ADIOI_Read_and_exch(fd, buf, datatype, nprocs, myrank, + others_req, offset_list, + len_list, contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, buf_idx, error_code); + + + /* free all memory allocated for collective I/O */ + ADIOI_Free(others_req[0].offsets); + ADIOI_Free(others_req[0].mem_ptrs); + ADIOI_Free(others_req); + + ADIOI_Free(buf_idx); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + +#ifdef HAVE_STATUS_SET_BYTES + MPI_Type_size_x(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + during collective I/O. */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +} + +void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype + datatype, int file_ptr_type, ADIO_Offset + offset, ADIO_Offset ** offset_list_ptr, ADIO_Offset + ** len_list_ptr, ADIO_Offset * start_offset_ptr, + ADIO_Offset * end_offset_ptr, int + *contig_access_count_ptr) +{ + MPI_Count filetype_size, etype_size; + MPI_Count buftype_size; + int i, j, k; + ADIO_Offset i_offset; + ADIO_Offset frd_size = 0, old_frd_size = 0; + int st_index = 0; + ADIO_Offset n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + ADIO_Offset bufsize; + ADIO_Offset sum, n_etypes_in_filetype, size_in_filetype; + int contig_access_count, filetype_is_contig; + ADIO_Offset *len_list; + MPI_Aint filetype_extent, filetype_lb; + ADIOI_Flatlist_node *flat_file; + ADIO_Offset *offset_list, off, end_offset = 0, disp; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5028, 0, NULL); +#endif + +/* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + MPI_Type_get_extent(fd->filetype, &filetype_lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + etype_size = fd->etype_size; + + if (!filetype_size) { + *contig_access_count_ptr = 0; + *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(4 * sizeof(ADIO_Offset)); + *len_list_ptr = *offset_list_ptr + 2; + /* 2 is for consistency. everywhere I malloc one more than needed */ + + offset_list = *offset_list_ptr; + len_list = *len_list_ptr; + offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + len_list[0] = 0; + *start_offset_ptr = offset_list[0]; + *end_offset_ptr = offset_list[0] + len_list[0] - 1; + + return; + } + + if (filetype_is_contig) { + *contig_access_count_ptr = 1; + *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(4 * sizeof(ADIO_Offset)); + *len_list_ptr = *offset_list_ptr + 2; + /* 2 is for consistency. everywhere I malloc one more than needed */ + + offset_list = *offset_list_ptr; + len_list = *len_list_ptr; + offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + len_list[0] = (ADIO_Offset) bufcount *(ADIO_Offset) buftype_size; + *start_offset_ptr = offset_list[0]; + *end_offset_ptr = offset_list[0] + len_list[0] - 1; + + /* update file pointer */ + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = *end_offset_ptr + 1; + } + + else { + + /* First calculate what size of offset_list and len_list to allocate */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + +#ifdef RDCOLL_DEBUG + { + int ii; + DBG_FPRINTF(stderr, "flattened %3lld : ", flat_file->count); + for (ii = 0; ii < flat_file->count; ii++) { + DBG_FPRINTF(stderr, "%16lld:%-16lld", flat_file->indices[ii], + flat_file->blocklens[ii]); + } + DBG_FPRINTF(stderr, "\n"); + } +#endif + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + frd_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + n_filetypes * (ADIO_Offset) filetype_extent + abs_off_in_filetype; + } + + /* calculate how much space to allocate for offset_list, len_list */ + + old_frd_size = frd_size; + contig_access_count = i_offset = 0; + j = st_index; + bufsize = (ADIO_Offset) buftype_size *(ADIO_Offset) bufcount; + frd_size = MPL_MIN(frd_size, bufsize); + while (i_offset < bufsize) { + if (frd_size) + contig_access_count++; + i_offset += frd_size; + j = (j + 1) % flat_file->count; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + + /* allocate space for offset_list and len_list */ + + *offset_list_ptr = + (ADIO_Offset *) ADIOI_Malloc((contig_access_count + 1) * 2 * sizeof(ADIO_Offset)); + *len_list_ptr = *offset_list_ptr + (contig_access_count + 1); + /* +1 to avoid a 0-size malloc */ + + offset_list = *offset_list_ptr; + len_list = *len_list_ptr; + + /* find start offset, end offset, and fill in offset_list and len_list */ + + *start_offset_ptr = offset; /* calculated above */ + + i_offset = k = 0; + j = st_index; + off = offset; + frd_size = MPL_MIN(old_frd_size, bufsize); + while (i_offset < bufsize) { + if (frd_size) { + offset_list[k] = off; + len_list[k] = frd_size; + k++; + } + i_offset += frd_size; + end_offset = off + frd_size - 1; + + /* Note: end_offset points to the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ + + if (off + frd_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) { + off += frd_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by frd_size. + */ + } else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + /* hit end of flattened filetype; start at beginning + * again */ + } + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + + /* update file pointer */ + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + *contig_access_count_ptr = contig_access_count; + *end_offset_ptr = end_offset; + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5029, 0, NULL); +#endif +} + +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code) +{ +/* Read in sizes of no more than coll_bufsize, an info parameter. + Send data to appropriate processes. + Place recd. data in user buf. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were read all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to read a distributed + array from a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + int i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, off, done, real_off, req_off; + char *read_buf = NULL, *tmp_buf; + int *curr_offlen_ptr, *count, *send_size, *recv_size; + int *partial_send, *recd_from_proc, *start_pos; + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ + ADIO_Offset real_size, size, for_curr_iter, for_next_iter; + int req_len, flag, rank; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint lb, buftype_extent; + int coll_bufsize; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of reads of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. + coll_bufsize is obtained from the hints object. */ + + coll_bufsize = fd->hints->cb_buffer_size; + + /* grab some initial values for st_loc and end_loc */ + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + /* now find the real values */ + for (i = 0; i < nprocs; i++) + for (j = 0; j < others_req[i].count; j++) { + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + + /* calculate ntimes, the number of times this process must perform I/O + * operations in order to complete all the requests it has received. + * the need for multiple I/O operations comes from the restriction that + * we only use coll_bufsize bytes of memory for internal buffering. + */ + if ((st_loc == -1) && (end_loc == -1)) { + /* this process does no I/O. */ + ntimes = 0; + } else { + /* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize) */ + ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); + } + + MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); + + read_buf = fd->io_buf; /* Allocated at open time */ + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs * 7, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = curr_offlen_ptr + nprocs; + /* to store count of how many off-len pairs per proc are satisfied + * in an iteration. */ + + partial_send = count + nprocs; + /* if only a portion of the last off-len pair is sent to a process + * in a particular iteration, the length sent is stored here. + * calloc initializes to 0. */ + + send_size = partial_send + nprocs; + /* total size of data to be sent to each proc. in an iteration */ + + recv_size = send_size + nprocs; + /* total size of data to be recd. from each proc. in an iteration. + * Of size nprocs so that I can use MPI_Alltoall later. */ + + recd_from_proc = recv_size + nprocs; + /* amount of data recd. so far from each proc. Used in + * ADIOI_Fill_user_buffer. initialized to 0 here. */ + + start_pos = recd_from_proc + nprocs; + /* used to store the starting value of curr_offlen_ptr[i] in + * this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + } + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + + done = 0; + off = st_loc; + for_curr_iter = for_next_iter = 0; + + MPI_Comm_rank(fd->comm, &rank); + + for (m = 0; m < ntimes; m++) { + /* read buf of size coll_bufsize (or less) */ + /* go through all others_req and check if any are satisfied + * by the current read */ + + /* since MPI guarantees that displacements in filetypes are in + * monotonically nondecreasing order, I can maintain a pointer + * (curr_offlen_ptr) to + * current off-len pair for each process in others_req and scan + * further only from there. There is still a problem of filetypes + * such as: (1, 2, 3 are not process nos. They are just numbers for + * three chunks of data, specified by a filetype.) + * + * 1 -------!-- + * 2 -----!---- + * 3 --!----- + * + * where ! indicates where the current read_size limitation cuts + * through the filetype. I resolve this by reading up to !, but + * filling the communication buffer only for 1. I copy the portion + * left over for 2 into a tmp_buf for use in the next + * iteration. i.e., 2 and 3 will be satisfied in the next + * iteration. This simplifies filling in the user's buf at the + * other end, as only one off-len pair with incomplete data + * will be sent. I also don't need to send the individual + * offsets and lens along with the data, as the data is being + * sent in a particular order. */ + + /* off = start offset in the file for the data actually read in + * this iteration + * size = size of data read corresponding to off + * real_off = off minus whatever data was retained in memory from + * previous iteration for cases like 2, 3 illustrated above + * real_size = size plus the extra corresponding to real_off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ + + size = MPL_MIN((unsigned) coll_bufsize, end_loc - st_loc + 1 - done); + real_off = off - for_curr_iter; + real_size = size + for_curr_iter; + + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; + for_next_iter = 0; + + for (i = 0; i < nprocs; i++) { +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "rank %d, i %d, others_count %d\n", rank, i, others_req[i].count); +#endif + if (others_req[i].count) { + start_pos[i] = curr_offlen_ptr[i]; + for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { + if (partial_send[i]) { + /* this request may have been partially + * satisfied in the previous iteration. */ + req_off = others_req[i].offsets[j] + partial_send[i]; + req_len = others_req[i].lens[j] - partial_send[i]; + partial_send[i] = 0; + /* modify the off-len pair to reflect this change */ + others_req[i].offsets[j] = req_off; + others_req[i].lens[j] = req_len; + } else { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + } + if (req_off < real_off + real_size) { + count[i]++; + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + req_off - real_off) == + (ADIO_Offset) (uintptr_t) (read_buf + req_off - real_off)); + MPI_Get_address(read_buf + req_off - real_off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((real_off + real_size - req_off) == + (int) (real_off + real_size - req_off)); + send_size[i] += + (int) (MPL_MIN + (real_off + real_size - req_off, + (ADIO_Offset) (unsigned) req_len)); + + if (real_off + real_size - req_off < (ADIO_Offset) (unsigned) req_len) { + partial_send[i] = (int) (real_off + real_size - req_off); + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < real_off + real_size)) { + /* this is the case illustrated in the + * figure above. */ + for_next_iter = MPL_MAX(for_next_iter, + real_off + real_size - + others_req[i].offsets[j + 1]); + /* max because it must cover requests + * from different processes */ + } + break; + } + } else + break; + } + curr_offlen_ptr[i] = j; + } + } + + flag = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) + flag = 1; + + if (flag) { + ADIOI_Assert(size == (int) size); + ADIOI_LUSTRE_RD_LOCK_AHEAD(fd, fd->hints->cb_nodes, off, error_code); + ADIO_ReadContig(fd, read_buf + for_curr_iter, (int) size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + + for_curr_iter = for_next_iter; + + ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + + + if (for_next_iter) { + tmp_buf = (char *) ADIOI_Malloc(for_next_iter); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) read_buf) + real_size - for_next_iter) == + (ADIO_Offset) (uintptr_t) (read_buf + real_size - for_next_iter)); + ADIOI_Assert((for_next_iter + coll_bufsize) == (size_t) (for_next_iter + coll_bufsize)); + memcpy(tmp_buf, read_buf + real_size - for_next_iter, for_next_iter); + ADIOI_Free(fd->io_buf); + fd->io_buf = (char *) ADIOI_Malloc(for_next_iter + coll_bufsize); + memcpy(fd->io_buf, tmp_buf, for_next_iter); + read_buf = fd->io_buf; + ADIOI_Free(tmp_buf); + } + + off += size; + done += size; + } + + for (i = 0; i < nprocs; i++) + count[i] = send_size[i] = 0; + for (m = ntimes; m < max_ntimes; m++) +/* nothing to send, but check for recv. */ + ADIOI_R_Exchange_data(fd, buf, flat_buf, offset_list, len_list, + send_size, recv_size, count, + start_pos, partial_send, recd_from_proc, nprocs, + myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, m, buftype_extent, buf_idx); + + ADIOI_Free(curr_offlen_ptr); +} + +static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, ADIO_Offset * offset_list, ADIO_Offset + * len_list, int *send_size, int *recv_size, + int *count, int *start_pos, int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int iter, MPI_Aint buftype_extent, MPI_Aint * buf_idx) +{ + int i, j, k = 0, tmp = 0, nprocs_recv, nprocs_send; + char **recv_buf = NULL; + size_t memLen; + MPI_Request *requests; + MPI_Datatype send_type; + MPI_Status *statuses; + +/* exchange send_size info so that each process knows how much to + receive from whom and how much memory to allocate. */ + + MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); + + nprocs_recv = 0; + nprocs_send = 0; + memLen = 0; + for (i = 0; i < nprocs; i++) { + memLen += recv_size[i]; + if (recv_size[i]) + nprocs_recv++; + if (send_size[i]) + nprocs_send++; + } + + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); +/* +1 to avoid a 0-size malloc */ + +/* post recvs. if buftype_is_contig, data can be directly recd. into + user buf at location given by buf_idx. else use recv_buf. */ + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(((char *) buf) + buf_idx[i], recv_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, requests + j); + j++; + buf_idx[i] += recv_size[i]; + } + } + } else { + /* allocate memory for recv_buf and post receives */ + recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + recv_buf[0] = (char *) ADIOI_Malloc(memLen); + for (i = 1; i < nprocs; i++) + recv_buf[i] = recv_buf[i - 1] + recv_size[i - 1]; + + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, + myrank + i + 100 * iter, fd->comm, requests + j); + j++; +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", + myrank, recv_size[i], myrank + i + 100 * iter); +#endif + } + } + } + +/* create derived datatypes and send data */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (send_size[i]) { +/* take care if the last off-len pair is a partial send */ + if (partial_send[i]) { + k = start_pos[i] + count[i] - 1; + tmp = others_req[i].lens[k]; + others_req[i].lens[k] = partial_send[i]; + } + ADIOI_Type_create_hindexed_x(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, &send_type); + /* absolute displacement; use MPI_BOTTOM in send */ + MPI_Type_commit(&send_type); + MPI_Isend(MPI_BOTTOM, 1, send_type, i, myrank + i + 100 * iter, + fd->comm, requests + nprocs_recv + j); + MPI_Type_free(&send_type); + if (partial_send[i]) + others_req[i].lens[k] = tmp; + j++; + } + } + +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ +#endif + + /* wait on the receives */ + if (nprocs_recv) { +#ifdef NEEDS_MPI_TEST + j = 0; + while (!j) + MPI_Testall(nprocs_recv, requests, &j, statuses); +#else + MPI_Waitall(nprocs_recv, requests, statuses); +#endif + + /* if noncontiguous, to the copies from the recv buffers */ + if (!buftype_is_contig) + ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, + offset_list, len_list, (unsigned *) recv_size, + requests, statuses, recd_from_proc, + nprocs, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, buftype_extent); + } + + /* wait on the sends */ +#ifdef MPI_STATUSES_IGNORE + MPI_Waitall(nprocs_send, requests + nprocs_recv, MPI_STATUSES_IGNORE); +#else + MPI_Waitall(nprocs_send, requests + nprocs_recv, statuses + nprocs_recv); + + ADIOI_Free(statuses); +#endif + ADIOI_Free(requests); + + if (!buftype_is_contig) { + ADIOI_Free(recv_buf[0]); + ADIOI_Free(recv_buf); + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif +} + +#define ADIOI_BUF_INCR \ + { \ + while (buf_incr) { \ + size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ + } + + +#define ADIOI_BUF_COPY \ + { \ + while (size) { \ + size_in_buf = MPL_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(uintptr_t)buf) + user_buf_idx) == (ADIO_Offset)(uintptr_t)((uintptr_t)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(((char *) buf) + user_buf_idx, \ + &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ + recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ + } + +void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **recv_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, + unsigned *recv_size, + MPI_Request * requests, MPI_Status * statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, MPI_Aint buftype_extent) +{ + +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + /* Not sure unsigned is necessary, but it makes the math safer */ + unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; + + MPL_UNREFERENCED_ARG(requests); + MPL_UNREFERENCED_ARG(statuses); + +/* curr_from_proc[p] = amount of data recd from proc. p that has already + been accounted for so far + done_from_proc[p] = amount of data already recd from proc. p and + filled into user buffer in previous iterations + user_buf_idx = current location in user buffer + recv_buf_idx[p] = current location in recv_buf of proc. p */ + curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * 3 * sizeof(unsigned)); + done_from_proc = curr_from_proc + nprocs; + recv_buf_idx = done_from_proc + nprocs; + + for (i = 0; i < nprocs; i++) { + recv_buf_idx[i] = curr_from_proc[i] = 0; + done_from_proc[i] = recd_from_proc[i]; + } + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in + * flattened buf */ + + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = len_list[i]; + + /* this request may span the file domains of more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_Calc_aggregator(fd, off, min_st_offset, &len, fd_size, fd_start, fd_end); + + if (recv_buf_idx[p] < recv_size[p]) { + if (curr_from_proc[p] + len > done_from_proc[p]) { + if (done_from_proc[p] > curr_from_proc[p]) { + size = MPL_MIN(curr_from_proc[p] + len - + done_from_proc[p], recv_size[p] - recv_buf_idx[p]); + buf_incr = done_from_proc[p] - curr_from_proc[p]; + ADIOI_BUF_INCR buf_incr = curr_from_proc[p] + len - done_from_proc[p]; + ADIOI_Assert((done_from_proc[p] + size) == + (unsigned) ((ADIO_Offset) done_from_proc[p] + size)); + curr_from_proc[p] = done_from_proc[p] + size; + ADIOI_BUF_COPY} else { + size = MPL_MIN(len, recv_size[p] - recv_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_from_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_from_proc[p] + size)); + curr_from_proc[p] += (unsigned) size; + ADIOI_BUF_COPY} + } else { + ADIOI_Assert((curr_from_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_from_proc[p] + len)); + curr_from_proc[p] += (unsigned) len; + buf_incr = len; + ADIOI_BUF_INCR} + } else { + buf_incr = len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + recd_from_proc[i] = curr_from_proc[i]; + + ADIOI_Free(curr_from_proc); +} diff --git a/3rd-party/romio341/adio/common/ad_read_str.c b/3rd-party/romio341/adio/common/ad_read_str.c new file mode 100644 index 0000000000000000000000000000000000000000..5753f3951190b4501fe60f4bacda9c5fd7708ecd --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_read_str.c @@ -0,0 +1,403 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#define ADIOI_BUFFERED_READ \ + { \ + if (req_off >= readbuf_off + readbuf_len) { \ + readbuf_off = req_off; \ + readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1)); \ + ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iorsrc", 0); \ + return; \ + } \ + } \ + while (req_len > readbuf_off + readbuf_len - req_off) { \ + ADIOI_Assert((readbuf_off + readbuf_len - req_off) == (int) (readbuf_off + readbuf_len - req_off)); \ + partial_read = (int) (readbuf_off + readbuf_len - req_off); \ + tmp_buf = (char *) ADIOI_Malloc(partial_read); \ + memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ + ADIOI_Free(readbuf); \ + readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ + memcpy(readbuf, tmp_buf, partial_read); \ + ADIOI_Free(tmp_buf); \ + readbuf_off += readbuf_len-partial_read; \ + readbuf_len = (unsigned) (partial_read + MPL_MIN(max_bufsize, \ + end_offset-readbuf_off+1)); \ + ADIO_ReadContig(fd, readbuf+partial_read, readbuf_len-partial_read, \ + MPI_BYTE, ADIO_EXPLICIT_OFFSET, readbuf_off+partial_read, \ + &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iorsrc", 0); \ + return; \ + } \ + } \ + ADIOI_Assert(req_len == (size_t)req_len); \ + memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ + } + + +void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + + +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, new_brd_size, brd_size, size; + int i, j, k, st_index = 0; + MPI_Count num, bufsize; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype; + ADIO_Offset abs_off_in_filetype = 0, new_frd_size, frd_size = 0, st_frd_size; + MPI_Count filetype_size, etype_size, buftype_size, partial_read; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off, req_len, sum; + ADIO_Offset off, req_off, disp, end_offset = 0, readbuf_off, start_off; + char *readbuf, *tmp_buf, *value; + int info_flag; + unsigned max_bufsize, readbuf_len; + ADIO_Status status1; + static char myname[] = "ADIOI_GEN_ReadStrided"; + + if (fd->hints->ds_read == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on reads, use naive + * approach instead. + */ + ADIOI_GEN_ReadStrided_naive(fd, + buf, + count, datatype, file_ptr_type, offset, status, error_code); + return; + } + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == + ((ADIO_Offset) (MPI_Count) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); + max_bufsize = atoi(value); + ADIOI_Free(value); + + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + + start_off = off; + end_offset = off + bufsize - 1; + readbuf_off = off; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset - readbuf_off + 1)); + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + + for (j = 0; j < count; j++) { + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = (ADIO_Offset) j *(ADIO_Offset) buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_READ off += flat_buf->blocklens[i]; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + ADIOI_Free(readbuf); + } + + else { /* noncontiguous in file */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + frd_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao: read request is within a single flat_file contig + * block e.g. with subarray types that actually describe the whole + * array */ + if (buftype_is_contig && bufsize <= frd_size) { + /* a count of bytes can overflow. operate on original type instead */ + ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte that + * can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == frd_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + n_filetypes * filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ + + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + frd_size = MPL_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + i_offset += frd_size; + end_offset = off + frd_size - 1; + + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + readbuf_off = 0; + readbuf_len = 0; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = MPL_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + if (frd_size) { + /* TYPE_UB and TYPE_LB can result in + * frd_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = read(fd->fd_sys, ((char *) buf) + i, frd_size); */ + + req_off = off; + req_len = frd_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ} + i_offset += frd_size; + + if (off + frd_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += frd_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by frd_size. */ + else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(frd_size, brd_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = read(fd->fd_sys, ((char *) buf) + i, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ} + + new_frd_size = frd_size; + new_brd_size = brd_size; + + if (size == frd_size) { +/* reached end of contiguous block in file */ + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_frd_size = flat_file->blocklens[j]; + if (size != brd_size) { + i_offset += size; + new_brd_size -= size; + } + } + + if (size == brd_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + i_offset = + ((ADIO_Offset) buftype_extent * + (ADIO_Offset) (buf_count / flat_buf->count) + flat_buf->indices[k]); + new_brd_size = flat_buf->blocklens[k]; + if (size != frd_size) { + off += size; + new_frd_size -= size; + } + } + ADIOI_Assert(((ADIO_Offset) num + size) == (unsigned) (num + size)); + num += size; + frd_size = new_frd_size; + brd_size = new_brd_size; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + by ADIOI_BUFFERED_READ. */ +#endif +} diff --git a/3rd-party/romio341/adio/common/ad_read_str_naive.c b/3rd-party/romio341/adio/common/ad_read_str_naive.c new file mode 100644 index 0000000000000000000000000000000000000000..b0cdb1244d3993a18a1077e0c2eed219f11e86f1 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_read_str_naive.c @@ -0,0 +1,362 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, + MPI_Datatype buftype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset size, brd_size, frd_size = 0, req_len, sum; + int b_index; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + MPI_Count bufsize, filetype_size, buftype_size, size_in_filetype; + ADIO_Offset etype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset = 0, start_off; + ADIO_Status status1; + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, buftype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(buftype, &buftype_size); + MPI_Type_get_extent(buftype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + + /* contiguous in buftype and filetype is handled elsewhere */ + + if (!buftype_is_contig && filetype_is_contig) { + int b_count; + /* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(buftype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : fd->disp + etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + /* for each region in the buffer, grab the data and put it in + * place + */ + for (b_count = 0; b_count < count; b_count++) { + for (b_index = 0; b_index < flat_buf->count; b_index++) { + userbuf_off = (ADIO_Offset) b_count *(ADIO_Offset) buftype_extent + + flat_buf->indices[b_index]; + req_off = off; + req_len = flat_buf->blocklens[b_index]; + + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); + ADIO_ReadContig(fd, + (char *) buf + userbuf_off, + req_len, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + + /* off is (potentially) used to save the final offset later */ + off += flat_buf->blocklens[b_index]; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + } + + else { /* noncontiguous in file */ + int f_index, st_index = 0; + ADIO_Offset st_n_filetypes; + ADIO_Offset st_frd_size; + int flag; + + /* First we're going to calculate a set of values for use in all + * the noncontiguous in file cases: + * start_off - starting byte position of data in file + * end_offset - last byte offset to be acessed in the file + * st_n_filetypes - how far into the file we start in terms of + * whole filetypes + * st_index - index of block in first filetype that we will be + * starting in (?) + * st_frd_size - size of the data in the first filetype block + * that we will read (accounts for being part-way + * into reading this block of the filetype + * + */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + start_off = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (f_index = 0; f_index < flat_file->count; f_index++) { + if (disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent + + flat_file->blocklens[f_index] >= start_off) { + /* this block contains our starting position */ + + st_index = f_index; + frd_size = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent + + flat_file->blocklens[f_index] - start_off; + flag = 1; + break; + } + } + } + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = (int) (offset % n_etypes_in_filetype); + size_in_filetype = (unsigned) etype_in_filetype *(unsigned) etype_size; + + sum = 0; + for (f_index = 0; f_index < flat_file->count; f_index++) { + sum += flat_file->blocklens[f_index]; + if (sum > size_in_filetype) { + st_index = f_index; + frd_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[f_index] + + size_in_filetype - (sum - flat_file->blocklens[f_index]); + break; + } + } + + /* abs. offset in bytes in the file */ + start_off = disp + n_filetypes * (ADIO_Offset) filetype_extent + abs_off_in_filetype; + } + + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + + /* start_off, st_n_filetypes, st_index, and st_frd_size are + * all calculated at this point + */ + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_off=0 and 100 bytes to be read, end_offset=99 + */ + userbuf_off = 0; + f_index = st_index; + off = start_off; + frd_size = MPL_MIN(st_frd_size, bufsize); + while (userbuf_off < bufsize) { + userbuf_off += frd_size; + end_offset = off + frd_size - 1; + + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[f_index], bufsize - (unsigned) userbuf_off); + } + + /* End of calculations. At this point the following values have + * been calculated and are ready for use: + * - start_off + * - end_offset + * - st_n_filetypes + * - st_index + * - st_frd_size + */ + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (buftype_is_contig && !filetype_is_contig) { + /* contiguous in memory, noncontiguous in file. should be the + * most common case. + */ + + userbuf_off = 0; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + frd_size = MPL_MIN(st_frd_size, bufsize); + + /* while there is still space in the buffer, read more data */ + while (userbuf_off < bufsize) { + if (frd_size) { + /* TYPE_UB and TYPE_LB can result in + * frd_size = 0. save system call in such cases */ + req_off = off; + req_len = frd_size; + + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); + ADIO_ReadContig(fd, + (char *) buf + userbuf_off, + req_len, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + userbuf_off += frd_size; + + if (off + frd_size < disp + flat_file->indices[f_index] + + flat_file->blocklens[f_index] + n_filetypes * (ADIO_Offset) filetype_extent) { + /* important that this value be correct, as it is + * used to set the offset in the fd near the end of + * this function. + */ + off += frd_size; + } + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by frd_size. + */ + else { + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + off = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent; + frd_size = MPL_MIN(flat_file->blocklens[f_index], + bufsize - (unsigned) userbuf_off); + } + } + } else { + ADIO_Offset i_offset, tmp_bufsize = 0; + /* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(buftype); + + b_index = buf_count = 0; + i_offset = flat_buf->indices[0]; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + + /* while we haven't read size * count bytes, keep going */ + while (tmp_bufsize < bufsize) { + ADIO_Offset new_brd_size = brd_size, new_frd_size = frd_size; + + size = MPL_MIN(frd_size, brd_size); + /* keep max of a single read amount <= INT_MAX */ + size = MPL_MIN(size, INT_MAX); + + if (size) { + req_off = off; + req_len = size; + userbuf_off = i_offset; + + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); + ADIO_ReadContig(fd, + (char *) buf + userbuf_off, + req_len, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + + if (size == frd_size) { + /* reached end of contiguous block in file */ + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_frd_size = flat_file->blocklens[f_index]; + if (size != brd_size) { + i_offset += size; + new_brd_size -= size; + } + } + + if (size == brd_size) { + /* reached end of contiguous block in memory */ + + b_index = (b_index + 1) % flat_buf->count; + buf_count++; + i_offset = buftype_extent * (buf_count / flat_buf->count) + + flat_buf->indices[b_index]; + new_brd_size = flat_buf->blocklens[b_index]; + if (size != frd_size) { + off += size; + new_frd_size -= size; + } + } + tmp_bufsize += size; + frd_size = new_frd_size; + brd_size = new_brd_size; + } + } + + /* unlock the file region if we locked it */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } /* end of (else noncontiguous in file) */ + + fd->fp_sys_posn = -1; /* mark it as invalid. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, buftype, bufsize); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually read and placed in buf + */ +#endif + +} diff --git a/3rd-party/romio341/adio/common/ad_resize.c b/3rd-party/romio341/adio/common/ad_resize.c new file mode 100644 index 0000000000000000000000000000000000000000..4b84bbdad013d2641463685765d86478c97e0ff0 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_resize.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int err, rank; + static char myname[] = "ADIOI_GEN_RESIZE"; + + MPI_Comm_rank(fd->comm, &rank); + + /* first aggregator performs ftruncate() */ + if (rank == fd->hints->ranklist[0]) { + ADIOI_Assert(size == (off_t) size); + err = ftruncate(fd->fd_sys, (off_t) size); + if (err == -1) { + /* detected an error, capture value of errno */ + err = errno; + } + } + + /* bcast success/errno value */ + MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + /* --BEGIN ERROR HANDLING-- */ + if (err != 0) { + /* when err is not 0, it contains the errno value from ftruncate */ + *error_code = ADIOI_Err_create_code(myname, fd->filename, err); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_seek.c b/3rd-party/romio341/adio/common/ad_seek.c new file mode 100644 index 0000000000000000000000000000000000000000..524f488bbc432faed8ec38300356dcce42b714af --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_seek.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, int whence, int *error_code) +{ +/* implemented for whence=SEEK_SET only. SEEK_CUR and SEEK_END must + be converted to the equivalent with SEEK_SET before calling this + routine. */ +/* offset is in units of etype relative to the filetype */ + + ADIO_Offset off; + ADIOI_Flatlist_node *flat_file; + + int i; + ADIO_Offset n_etypes_in_filetype, n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0; + ADIO_Offset size_in_filetype, sum; + MPI_Count filetype_size, etype_size; + int filetype_is_contig; + MPI_Aint lb, filetype_extent; + + MPL_UNREFERENCED_ARG(whence); + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + etype_size = fd->etype_size; + + if (filetype_is_contig) + off = fd->disp + etype_size * offset; + else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { + /* Since offset relative to the filetype size, we can't + * do compute the offset when that result is zero. + * Return zero for the offset for now */ + *error_code = MPI_SUCCESS; + return 0; + } + + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + off = fd->disp + n_filetypes * filetype_extent + abs_off_in_filetype; + } + +/* + * we used to call lseek here and update both fp_ind and fp_sys_posn, but now + * we don't seek and only update fp_ind (ROMIO's idea of where we are in the + * file). We leave the system file descriptor and fp_sys_posn alone. + * The fs-specifc ReadContig and WriteContig will seek to the correct place in + * the file before reading/writing if the 'offset' parameter doesn't match + * fp_sys_posn + */ + fd->fp_ind = off; + + *error_code = MPI_SUCCESS; + + return off; +} diff --git a/3rd-party/romio341/adio/common/ad_set_sh_fp.c b/3rd-party/romio341/adio/common/ad_set_sh_fp.c new file mode 100644 index 0000000000000000000000000000000000000000..069b9a050909989a1f00ffd5584bcd1a3c5237ad --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_set_sh_fp.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* set the shared file pointer to "offset" etypes relative to the current + view */ + +void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); + +void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) +{ + ADIO_Status status; + MPI_Comm dupcommself; + +#ifdef ROMIO_NFS + if (fd->file_system == ADIO_NFS) { + ADIOI_NFS_Set_shared_fp(fd, offset, error_code); + return; + } +#endif + + if (fd->shared_fp_fd == ADIO_FILE_NULL) { + MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); + fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, + fd->shared_fp_fname, + fd->file_system, + fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, MPI_BYTE, MPI_BYTE, + MPI_INFO_NULL, ADIO_PERM_NULL, error_code); + } + + if (*error_code != MPI_SUCCESS) + return; + + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset), + MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); +} diff --git a/3rd-party/romio341/adio/common/ad_set_view.c b/3rd-party/romio341/adio/common/ad_set_view.c new file mode 100644 index 0000000000000000000000000000000000000000..8e15462d2f193309cd9f891d1c6b7040452aa24b --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_set_view.c @@ -0,0 +1,124 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +static +int check_type(ADIOI_Flatlist_node * flat_type, + int access_mode, const char *caller, const char *type_kind, int *error_code) +{ + char err_msg[128]; + + err_msg[0] = '\0'; + + /* MPI standard requires the displacements of etype and filetype be + * non-negative */ + if (flat_type->flag & ADIOI_TYPE_NEGATIVE) { + sprintf(err_msg, "displacements of %s must be non-negative", type_kind); + goto err_check; + } + + /* MPI standard requires the displacements of etype and filetype be in a + * monotonically nondecreasing order */ + if (flat_type->flag & ADIOI_TYPE_DECREASE) { + sprintf(err_msg, "displacements of %s must be in a monotonically nondecreasing order", + type_kind); + goto err_check; + } + + /* If the file is opened for writing, neither the etype nor the + * filetype is permitted to contain overlapping regions. + */ + if (((access_mode & ADIO_WRONLY) || (access_mode & ADIO_RDWR)) && + (flat_type->flag & ADIOI_TYPE_OVERLAP)) { + sprintf(err_msg, "%s is not permitted to contain overlapping regions", type_kind); + goto err_check; + } + + return 1; + + err_check: + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, caller, + __LINE__, MPI_ERR_IO, "**iobadoverlap", " **iobadoverlap %s", + err_msg); + return 0; +} + +/* this used to be implemented in every file system as an fcntl. It makes + * deferred open easier if we know ADIO_Fcntl will always need a file to really + * be open. set_view doesn't modify anything related to the open files. + */ +void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, MPI_Info info, int *error_code) +{ + static char myname[] = "ADIO_Set_view"; + int combiner, i, j, k, err, etype_is_contig, filetype_is_contig; + MPI_Datatype copy_etype, copy_filetype; + ADIOI_Flatlist_node *flat_file, *flat_etype; + /* free copies of old etypes and filetypes and delete flattened + * version of filetype if necessary */ + + MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner); + if (combiner != MPI_COMBINER_NAMED) + MPI_Type_free(&(fd->etype)); + + MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner); + if (combiner != MPI_COMBINER_NAMED) + MPI_Type_free(&(fd->filetype)); + + /* set new info */ + ADIO_SetInfo(fd, info, &err); + + /* set new etypes and filetypes */ + + MPI_Type_get_envelope(etype, &i, &j, &k, &combiner); + if (combiner == MPI_COMBINER_NAMED) { + fd->etype = etype; + etype_is_contig = 1; + } else { + MPI_Type_contiguous(1, etype, ©_etype); + MPI_Type_commit(©_etype); + fd->etype = copy_etype; + ADIOI_Datatype_iscontig(fd->etype, &etype_is_contig); + } + flat_etype = ADIOI_Flatten_and_find(fd->etype); + if (0 == check_type(flat_etype, fd->orig_access_mode, myname, "etype", error_code)) + return; + + MPI_Type_get_envelope(filetype, &i, &j, &k, &combiner); + if (combiner == MPI_COMBINER_NAMED) { + fd->filetype = filetype; + filetype_is_contig = 1; + } else { + MPI_Type_contiguous(1, filetype, ©_filetype); + MPI_Type_commit(©_filetype); + fd->filetype = copy_filetype; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + } + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + if (0 == check_type(flat_file, fd->orig_access_mode, myname, "filetype", error_code)) + return; + + MPI_Type_size_x(fd->etype, &(fd->etype_size)); + fd->disp = disp; + + /* reset MPI-IO file pointer to point to the first byte that can + * be accessed in this view. */ + + if (filetype_is_contig) + fd->fp_ind = disp; + else { + for (i = 0; i < flat_file->count; i++) { + if (flat_file->blocklens[i]) { + fd->fp_ind = disp + flat_file->indices[i]; + break; + } + } + } + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_subarray.c b/3rd-party/romio341/adio/common/ad_subarray.c new file mode 100644 index 0000000000000000000000000000000000000000..827911fc54204d21537a45b967e0e164f7bd48d6 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_subarray.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +int ADIO_Type_create_subarray(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype) +{ + MPI_Aint lb, ub, extent, disps[1], size; + int i, blklens[3]; + MPI_Datatype tmp1, tmp2, types[3]; + + MPI_Type_get_extent(oldtype, &lb, &extent); + + if (order == MPI_ORDER_FORTRAN) { + /* dimension 0 changes fastest */ + if (ndims == 1) { + MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); + } else { + MPI_Type_vector(array_of_subsizes[1], + array_of_subsizes[0], array_of_sizes[0], oldtype, &tmp1); + + size = (MPI_Aint) array_of_sizes[0] * extent; + for (i = 2; i < ndims; i++) { + size *= (MPI_Aint) array_of_sizes[i - 1]; + MPI_Type_create_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); + MPI_Type_free(&tmp1); + tmp1 = tmp2; + } + } + + /* add displacement and UB */ + disps[0] = array_of_starts[0]; + size = 1; + for (i = 1; i < ndims; i++) { + size *= (MPI_Aint) array_of_sizes[i - 1]; + disps[0] += size * (MPI_Aint) array_of_starts[i]; + } + /* rest done below for both Fortran and C order */ + } + + else { /* order == MPI_ORDER_C */ + + /* dimension ndims-1 changes fastest */ + if (ndims == 1) { + MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); + } else { + MPI_Type_vector(array_of_subsizes[ndims - 2], + array_of_subsizes[ndims - 1], + array_of_sizes[ndims - 1], oldtype, &tmp1); + + size = (MPI_Aint) array_of_sizes[ndims - 1] * extent; + for (i = ndims - 3; i >= 0; i--) { + size *= (MPI_Aint) array_of_sizes[i + 1]; + MPI_Type_create_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); + MPI_Type_free(&tmp1); + tmp1 = tmp2; + } + } + + /* add displacement and UB */ + disps[0] = array_of_starts[ndims - 1]; + size = 1; + for (i = ndims - 2; i >= 0; i--) { + size *= (MPI_Aint) array_of_sizes[i + 1]; + disps[0] += size * (MPI_Aint) array_of_starts[i]; + } + } + + disps[0] *= extent; + + ub = extent; + for (i = 0; i < ndims; i++) + ub *= (MPI_Aint) array_of_sizes[i]; + + lb = 0; + blklens[0] = 1; + types[0] = tmp1; + + MPI_Type_create_struct(1, blklens, disps, types, &tmp2); + MPI_Type_create_resized(tmp2, lb, ub, newtype); + + MPI_Type_free(&tmp1); + MPI_Type_free(&tmp2); + + return MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/ad_threaded_io.c b/3rd-party/romio341/adio/common/ad_threaded_io.c new file mode 100644 index 0000000000000000000000000000000000000000..4384534c0bcacae7858839fb89a840f010ccfc5e --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_threaded_io.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#include <pthread.h> +/* Function for running in another thread for doing the file reading while the + * main thread is doing data aggregation - useful only when multiple rounds are + * needed due to file size relative to the read buffer size and number of + * aggregators */ + +void *ADIOI_IO_Thread_Func(void *vptr_args) +{ + ADIOI_IO_ThreadFuncData *args = (ADIOI_IO_ThreadFuncData *) vptr_args; + + ADIOI_Assert(args->size == (int) (args->size)); + + if (args->io_kind == ADIOI_READ) { + ADIO_ReadContig(args->fd, args->buf, args->size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, args->offset, args->status, &(args->error_code)); + } else { + ADIO_WriteContig(args->fd, args->buf, args->size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, args->offset, args->status, &(args->error_code)); + } + pthread_exit(&(args->error_code)); + return NULL; +} diff --git a/3rd-party/romio341/adio/common/ad_tuning.c b/3rd-party/romio341/adio/common/ad_tuning.c new file mode 100644 index 0000000000000000000000000000000000000000..5c38232b353bc58348979cd7e575ffbce68a926b --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_tuning.c @@ -0,0 +1,114 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_tuning.c + * \brief Defines common performance tuning env var options + */ + +/*--------------------------------------------------------------------- + * ad_tuning.c + * + * defines common global variables and functions for performance tuning + * and functional debugging. + *---------------------------------------------------------------------*/ + +#include "ad_tuning.h" + +int romio_write_aggmethod; +int romio_read_aggmethod; +int romio_onesided_no_rmw; +int romio_onesided_always_rmw; +int romio_onesided_inform_rmw; +int romio_tunegather; + +/* set internal variables for tuning environment variables */ +/** \page mpiio_vars MPIIO Configuration + \section env_sec Environment Variables + * + * - ROMIO_WRITE_AGGMETHOD/ROMIO_READ_AGGMETHOD - Replaces the two-phase + * collective IO aggregation + * with a one-sided algorithm, significantly reducing communication and + * memory overhead. Fully + * supports all datasets and datatypes, the only caveat is that any holes in the data + * when writing to a pre-existing file are ignored -- there is no read-modify-write + * support to maintain the correctness of regions of pre-existing data so every byte + * must be explicitly written to maintain correctness. Users must beware of middle-ware + * libraries like PNETCDF which may count on read-modify-write functionality for certain + * features (like fill values). Possible values: + * - 0 - Normal two-phase collective IO is used. + * - 1 - A separate one-sided MPI_Put or MPI_Get is used for each contigous chunk of data + * for a compute to write to or read from the collective buffer on the aggregator. + * - 2 - An MPI derived datatype is created using all the contigous chunks and just one + * call to MPI_Put or MPI_Get is done with the derived datatype. On Blue Gene /Q + * optimal performance for this is achieved when paired with PAMID_TYPED_ONESIDED=1. + * - Default is 0 + * + * - ROMIO_ONESIDED_NO_RMW - For one-sided write aggregation (ROMIO_WRITE_AGGMETHOD = 1 or 2) + * disable the detection of holes in the data when writing to a pre-existing + * file requiring a read-modify-write, thereby avoiding the communication + * overhead for this detection. + * - 0 (hole detection enabled) or 1 (hole detection disabled) + * - Default is 0 + * + * - ROMIO_ONESIDED_ALWAYS_RMW - For one-sided write aggregation (ROMIO_WRITE_AGGMETHOD = 1 or 2) + * always pre-read the offset range being written to a pre-existing file thereby filling + * any holes that may exist in the data before being written. + * - 0 (do not pre-read file offset range) or 1 (pre-read file offset range) + * - Default is 0 + * + * - ROMIO_ONESIDED_INFORM_RMW - For one-sided aggregation + * (ROMIO_WRITE_AGGMETHOD = 1 or 2) generate an informational message informing + * the user whether holes exist in the data when writing to a pre-existing + * file requiring a read-modify-write, thereby educating the user to set + * ROMIO_ONESIDED_NO_RMW=1 on a future run to avoid the communication + * overhead for this detection. + * - 0 (disabled) or 1 (enabled) + * - Default is 0 + * + * - ROMIO_TUNEGATHER - Tune how starting and ending offsets are communicated + * for aggregator collective i/o. Possible values: + * - 0 - Use two or three MPI_Allgather's to collect starting and ending offsets. + * - 1 - Use MPI_Allreduce(MPI_MAX) to collect starting and ending offsets. + * - Default is 1. + * + */ + +void ad_get_env_vars() +{ + char *x; + + romio_write_aggmethod = 0; + x = getenv("ROMIO_WRITE_AGGMETHOD"); + if (x) + romio_write_aggmethod = atoi(x); + + romio_read_aggmethod = 0; + x = getenv("ROMIO_READ_AGGMETHOD"); + if (x) + romio_read_aggmethod = atoi(x); + + romio_onesided_no_rmw = 0; + x = getenv("ROMIO_ONESIDED_NO_RMW"); + if (x) + romio_onesided_no_rmw = atoi(x); + + romio_onesided_always_rmw = 0; + x = getenv("ROMIO_ONESIDED_ALWAYS_RMW"); + if (x) + romio_onesided_always_rmw = atoi(x); + if (romio_onesided_always_rmw) + romio_onesided_no_rmw = 1; + + romio_onesided_inform_rmw = 0; + x = getenv("ROMIO_ONESIDED_INFORM_RMW"); + if (x) + romio_onesided_inform_rmw = atoi(x); + + romio_tunegather = 1; + x = getenv("ROMIO_TUNEGATHER"); + if (x) + romio_tunegather = atoi(x); +} diff --git a/3rd-party/romio321/adio/common/ad_wait.c b/3rd-party/romio341/adio/common/ad_wait.c similarity index 75% rename from 3rd-party/romio321/adio/common/ad_wait.c rename to 3rd-party/romio341/adio/common/ad_wait.c index 2112ee8fb667d22e45de6023ed5d06bb94b71f7b..7c422f87d9a80e20f028a6e7ddd7a7bb736ce27b 100644 --- a/3rd-party/romio321/adio/common/ad_wait.c +++ b/3rd-party/romio341/adio/common/ad_wait.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -23,7 +21,7 @@ #include <sys/aio.h> #endif -/* Workaround for incomplete set of definitions if __REDIRECT is not +/* Workaround for incomplete set of definitions if __REDIRECT is not defined and large file support is used in aio.h */ #if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64) #define aiocb aiocb64 @@ -39,9 +37,8 @@ * If ROMIO_HAVE_WORKING_AIO is defined, then we may need to wait for I/O * to complete. */ -void ADIOI_GEN_IOComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code) +void ADIOI_GEN_IOComplete(ADIO_Request * request, ADIO_Status * status, int *error_code) { - return; - + return; + } diff --git a/3rd-party/romio341/adio/common/ad_wait_fake.c b/3rd-party/romio341/adio/common/ad_wait_fake.c new file mode 100644 index 0000000000000000000000000000000000000000..50cf5c71182ab9b66318311df7394d0ad0ed0f12 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_wait_fake.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* Generic implementation of ReadComplete/WriteComplete simply sets the + * bytes field in the status structure and frees the request. + * + * Same function is used for both reads and writes. + */ +void ADIOI_FAKE_IOComplete(ADIO_Request * request, ADIO_Status * status, int *error_code) +{ + *error_code = MPI_SUCCESS; + return; +} diff --git a/3rd-party/romio341/adio/common/ad_write.c b/3rd-party/romio341/adio/common/ad_write.c new file mode 100644 index 0000000000000000000000000000000000000000..cad116e075f6fee950204a4f855df870e9339d66 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_write.c @@ -0,0 +1,118 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" +#include <unistd.h> + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +#ifdef ROMIO_GPFS +#include "adio/ad_gpfs/ad_gpfs_tuning.h" +#endif + +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + + +void ADIOI_GEN_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code) +{ + ssize_t err = -1; + MPI_Count datatype_size; + ADIO_Offset len, bytes_xfered = 0; + size_t wr_count; + static char myname[] = "ADIOI_GEN_WRITECONTIG"; +#ifdef ROMIO_GPFS + double io_time = 0; +#endif + char *p; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5036, 0, NULL); +#endif + + if (count == 0) { + err = 0; + goto fn_exit; + } + + MPI_Type_size_x(datatype, &datatype_size); + len = (ADIO_Offset) datatype_size *(ADIO_Offset) count; + +#ifdef ROMIO_GPFS + io_time = MPI_Wtime(); + if (gpfsmpio_timing) { + gpfsmpio_prof_cw[GPFSMPIO_CIO_DATA_SIZE] += len; + } +#endif + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + p = (char *) buf; + while (bytes_xfered < len) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + wr_count = len - bytes_xfered; + /* Frustrating! FreeBSD and OS X do not like a count larger than 2^31 */ + if (wr_count > INT_MAX) + wr_count = INT_MAX; + +#ifdef ROMIO_GPFS + if (gpfsmpio_devnullio) + err = pwrite(fd->null_fd, p, wr_count, offset + bytes_xfered); + else +#endif + err = pwrite(fd->fd_sys, p, wr_count, offset + bytes_xfered); + /* --BEGIN ERROR HANDLING-- */ + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", strerror(errno)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + bytes_xfered += err; + p += err; + } + +#ifdef ROMIO_GPFS + if (gpfsmpio_timing) + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_POSI_RW] += (MPI_Wtime() - io_time); +#endif + fd->fp_sys_posn = offset + bytes_xfered; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += bytes_xfered; + } +#ifdef ROMIO_GPFS + if (gpfsmpio_timing) + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_MPIO_RW] += (MPI_Wtime() - io_time); +#endif + + fn_exit: +#ifdef HAVE_STATUS_SET_BYTES + /* bytes_xfered could be larger than int */ + if (err != -1 && status) + MPIR_Status_set_bytes(status, datatype, bytes_xfered); +#endif + + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5037, 0, NULL); +#endif +} diff --git a/3rd-party/romio341/adio/common/ad_write_coll.c b/3rd-party/romio341/adio/common/ad_write_coll.c new file mode 100644 index 0000000000000000000000000000000000000000..fece6230a4d0c3befd598adba794cb543a27cf90 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_write_coll.c @@ -0,0 +1,1033 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* prototypes of functions used for collective writes only. */ +static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, int myrank, + ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code); +static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, + ADIOI_Flatlist_node * flat_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, int size, + int *count, int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int *hole, int iter, + MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code); +void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent); +void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements); + + +void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs access structures, one for each other process in + * whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs access structures, one for each other process + * whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count = 0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + MPI_Aint *buf_idx = NULL; + ADIO_Offset *len_list = NULL; + int old_error, tmp_error; + + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + /* Cast away const'ness as the below function is used for read + * and write */ + ADIOI_IOStridedColl(fd, (char *) buf, count, ADIOI_WRITE, datatype, + file_ptr_type, offset, status, error_code); + return; + } + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + +/* the number of processes that actually perform I/O, nprocs_for_coll, + * is stored in the hints off the ADIO_File structure + */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + + /* only check for interleaving if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + * lengths in the file and determine the start and end offsets. */ + + /* Note: end_offset points to the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */ + + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets stored + * in order of process rank. */ + + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset)); + end_offsets = st_offsets + nprocs; + + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm); + + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + * for the moment. */ + } + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + if (fd->hints->cb_write == ADIOI_HINT_DISABLE || + (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) { + /* use independent accesses */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, error_code); + } else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code); + } else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code); + + return; + } + +/* Divide the I/O workload among "nprocs_for_coll" processes. This is + done by (logically) dividing the file into file domains (FDs); each + process may directly access only its own file domain. */ + + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, fd->hints->striping_unit); + + +/* calculate what portions of the access requests of this process are + located in what file domains */ + + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, &count_my_req_per_proc, &my_req, &buf_idx); + +/* based on everyone's my_req, calculate what requests of other + processes lie in this process's file domain. + count_others_req_procs = number of processes whose requests lie in + this process's file domain (including this process itself) + count_others_req_per_proc[i] indicates how many separate contiguous + requests of proc. i lie in this process's file domain. */ + + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, &others_req); + + ADIOI_Free(count_my_req_per_proc); + ADIOI_Free(my_req[0].offsets); + ADIOI_Free(my_req); + +/* exchange data and write in sizes of no more than coll_bufsize. */ + /* Cast away const'ness for the below function */ + ADIOI_Exch_and_write(fd, (char *) buf, datatype, nprocs, myrank, + others_req, offset_list, + len_list, contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, buf_idx, error_code); + + /* If this collective write is followed by an independent write, + * it's possible to have those subsequent writes on other processes + * race ahead and sneak in before the read-modify-write completes. + * We carry out a collective communication at the end here so no one + * can start independent i/o before collective I/O completes. + * + * need to do some gymnastics with the error codes so that if something + * went wrong, all processes report error, but if a process has a more + * specific error code, we can still have that process report the + * additional information */ + + old_error = *error_code; + if (*error_code != MPI_SUCCESS) + *error_code = MPI_ERR_IO; + + /* optimization: if only one process performing i/o, we can perform + * a less-expensive Bcast */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_a, 0, NULL); +#endif + if (fd->hints->cb_nodes == 1) + MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + else { + tmp_error = *error_code; + MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, MPI_MAX, fd->comm); + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_b, 0, NULL); +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5012, 0, NULL); +#endif + + if ((old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO)) + *error_code = old_error; + + /* free all memory allocated for collective I/O */ + ADIOI_Free(others_req[0].offsets); + ADIOI_Free(others_req[0].mem_ptrs); + ADIOI_Free(others_req); + + ADIOI_Free(buf_idx); + ADIOI_Free(offset_list); + ADIOI_Free(st_offsets); + ADIOI_Free(fd_start); + +#ifdef HAVE_STATUS_SET_BYTES + if (status) { + MPI_Count bufsize, size; + /* Don't set status if it isn't needed */ + MPI_Type_size_x(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); + } +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written during collective I/O. */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5013, 0, NULL); +#endif +} + + + +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ +static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, + ADIOI_Access + * others_req, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + MPI_Aint * buf_idx, int *error_code) +{ +/* Send data to appropriate processes and write in sizes of no more + than coll_bufsize. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were written all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to write a distributed + array to a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets */ + ADIO_Offset size = 0; + int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, off, done, req_off; + char *write_buf = NULL; + int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; + int *partial_recv, *sent_to_proc, *start_pos, flag; + int *send_buf_idx, *curr_to_proc, *done_to_proc; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint lb, buftype_extent; + int info_flag, coll_bufsize; + char *value; + static char myname[] = "ADIOI_EXCH_AND_WRITE"; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of writes of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); + coll_bufsize = atoi(value); + ADIOI_Free(value); + + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + for (i = 0; i < nprocs; i++) + for (j = 0; j < others_req[i].count; j++) { + st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]); + end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + +/* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ + + ntimes = (int) ((end_loc - st_loc + coll_bufsize) / coll_bufsize); + + if ((st_loc == -1) && (end_loc == -1)) { + ntimes = 0; /* this process does no writing. */ + } + + MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); + + write_buf = fd->io_buf; + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs * 10, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = curr_offlen_ptr + nprocs; + /* to store count of how many off-len pairs per proc are satisfied + * in an iteration. */ + + partial_recv = count + nprocs; + /* if only a portion of the last off-len pair is recd. from a process + * in a particular iteration, the length recd. is stored here. + * calloc initializes to 0. */ + + send_size = partial_recv + nprocs; + /* total size of data to be sent to each proc. in an iteration. + * Of size nprocs so that I can use MPI_Alltoall later. */ + + recv_size = send_size + nprocs; + /* total size of data to be recd. from each proc. in an iteration. */ + + sent_to_proc = recv_size + nprocs; + /* amount of data sent to each proc so far. Used in + * ADIOI_Fill_send_buffer. initialized to 0 here. */ + + send_buf_idx = sent_to_proc + nprocs; + curr_to_proc = send_buf_idx + nprocs; + done_to_proc = curr_to_proc + nprocs; + /* Above three are used in ADIOI_Fill_send_buffer */ + + start_pos = done_to_proc + nprocs; + /* used to store the starting value of curr_offlen_ptr[i] in + * this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + flat_buf = ADIOI_Flatten_and_find(datatype); + } + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + + +/* I need to check if there are any outstanding nonblocking writes to + the file, which could potentially interfere with the writes taking + place in this collective write call. Since this is not likely to be + common, let me do the simplest thing possible here: Each process + completes all pending nonblocking operations before completing. */ + + /*ADIOI_Complete_async(error_code); + * if (*error_code != MPI_SUCCESS) return; + * MPI_Barrier(fd->comm); + */ + + done = 0; + off = st_loc; + + for (m = 0; m < ntimes; m++) { + /* go through all others_req and check which will be satisfied + * by the current write */ + + /* Note that MPI guarantees that displacements in filetypes are in + * monotonically nondecreasing order and that, for writes, the + * filetypes cannot specify overlapping regions in the file. This + * simplifies implementation a bit compared to reads. */ + + /* off = start offset in the file for the data to be written in + * this iteration + * size = size of data written (bytes) corresponding to off + * req_off = off in file for a particular contiguous request + * minus what was satisfied in previous iteration + * req_size = size corresponding to req_off */ + + /* first calculate what should be communicated */ + + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; + + size = MPL_MIN((unsigned) coll_bufsize, end_loc - st_loc + 1 - done); + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + start_pos[i] = curr_offlen_ptr[i]; + for (j = curr_offlen_ptr[i]; j < others_req[i].count; j++) { + if (partial_recv[i]) { + /* this request may have been partially + * satisfied in the previous iteration. */ + req_off = others_req[i].offsets[j] + partial_recv[i]; + req_len = others_req[i].lens[j] - partial_recv[i]; + partial_recv[i] = 0; + /* modify the off-len pair to reflect this change */ + others_req[i].offsets[j] = req_off; + others_req[i].lens[j] = req_len; + } else { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + } + if (req_off < off + size) { + count[i]++; + ADIOI_Assert((((ADIO_Offset) (uintptr_t) write_buf) + req_off - off) == + (ADIO_Offset) (uintptr_t) (write_buf + req_off - off)); + MPI_Get_address(write_buf + req_off - off, &(others_req[i].mem_ptrs[j])); + ADIOI_Assert((off + size - req_off) == (int) (off + size - req_off)); + recv_size[i] += (int) (MPL_MIN(off + size - req_off, (unsigned) req_len)); + + if (off + size - req_off < (unsigned) req_len) { + partial_recv[i] = (int) (off + size - req_off); + + /* --BEGIN ERROR HANDLING-- */ + if ((j + 1 < others_req[i].count) && + (others_req[i].offsets[j + 1] < off + size)) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, + __LINE__, + MPI_ERR_ARG, + "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", + 0); + /* allow to continue since additional + * communication might have to occur + */ + } + /* --END ERROR HANDLING-- */ + break; + } + } else + break; + } + curr_offlen_ptr[i] = j; + } + } + + ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, curr_to_proc, + done_to_proc, &hole, m, buftype_extent, buf_idx, error_code); + if (*error_code != MPI_SUCCESS) + return; + + flag = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) + flag = 1; + + if (flag) { + ADIOI_Assert(size == (int) size); + ADIO_WriteContig(fd, write_buf, (int) size, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + off, &status, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + + off += size; + done += size; + } + + for (i = 0; i < nprocs; i++) + count[i] = recv_size[i] = 0; + for (m = ntimes; m < max_ntimes; m++) { + ADIOI_Assert(size == (int) size); + /* nothing to recv, but check for send. */ + ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, (int) size, count, + start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + others_req, send_buf_idx, + curr_to_proc, done_to_proc, &hole, m, + buftype_extent, buf_idx, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + + ADIOI_Free(curr_offlen_ptr); +} + + +/* Sets error_code to MPI_SUCCESS if successful, or creates an error code + * in the case of error. + */ +static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, + ADIOI_Flatlist_node * flat_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + int *recv_size, ADIO_Offset off, int size, + int *count, int *start_pos, + int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + ADIOI_Access * others_req, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int *hole, int iter, + MPI_Aint buftype_extent, MPI_Aint * buf_idx, int *error_code) +{ + int i, j, k, *tmp_len, nprocs_recv, nprocs_send, err; + char **send_buf = NULL; + MPI_Request *requests, *send_req; + MPI_Datatype *recv_types; + MPI_Status *statuses, status; + int *srt_len = NULL, sum; + ADIO_Offset *srt_off = NULL; + static char myname[] = "ADIOI_W_EXCHANGE_DATA"; + +/* exchange recv_size info so that each process knows how much to + send to whom. */ + + MPI_Alltoall(recv_size, 1, MPI_INT, send_size, 1, MPI_INT, fd->comm); + + /* create derived datatypes for recv */ + + nprocs_send = 0; + nprocs_recv = 0; + sum = 0; + for (i = 0; i < nprocs; i++) { + sum += count[i]; + if (recv_size[i]) + nprocs_recv++; + if (send_size[i]) + nprocs_send++; + } + + recv_types = (MPI_Datatype *) + ADIOI_Malloc((nprocs_recv + 1) * sizeof(MPI_Datatype)); +/* +1 to avoid a 0-size malloc */ + + tmp_len = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { +/* take care if the last off-len pair is a partial recv */ + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + tmp_len[i] = others_req[i].lens[k]; + others_req[i].lens[k] = partial_recv[i]; + } + ADIOI_Type_create_hindexed_x(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, recv_types + j); + /* absolute displacements; use MPI_BOTTOM in recv */ + MPI_Type_commit(recv_types + j); + j++; + } + } + + /* To avoid a read-modify-write, check if there are holes in the + * data to be written. For this, merge the (sorted) offset lists + * others_req using a heap-merge. */ + + /* valgrind-detcted optimization: if there is no work on this process we do + * not need to search for holes */ + if (sum) { + srt_off = (ADIO_Offset *) ADIOI_Malloc(sum * sizeof(ADIO_Offset)); + srt_len = (int *) ADIOI_Malloc(sum * sizeof(int)); + + ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, nprocs, nprocs_recv, sum); + } + + /* for partial recvs, restore original lengths */ + for (i = 0; i < nprocs; i++) + if (partial_recv[i]) { + k = start_pos[i] + count[i] - 1; + others_req[i].lens[k] = tmp_len[i]; + } + ADIOI_Free(tmp_len); + + /* check if there are any holes. If yes, must do read-modify-write. + * holes can be in three places. 'middle' is what you'd expect: the + * processes are operating on noncontigous data. But holes can also show + * up at the beginning or end of the file domain (see John Bent ROMIO REQ + * #835). Missing these holes would result in us writing more data than + * recieved by everyone else. */ + + *hole = 0; + if (sum) { + if (off != srt_off[0]) /* hole at the front */ + *hole = 1; + else { /* coalesce the sorted offset-length pairs */ + for (i = 1; i < sum; i++) { + if (srt_off[i] <= srt_off[0] + srt_len[0]) { + /* ok to cast: operating on cb_buffer_size chunks */ + int new_len = (int) srt_off[i] + srt_len[i] - (int) srt_off[0]; + if (new_len > srt_len[0]) + srt_len[0] = new_len; + } else + break; + } + if (i < sum || size != srt_len[0]) /* hole in middle or end */ + *hole = 1; + } + + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + } + + if (nprocs_recv) { + if (*hole) { + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, &err); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**ioRMWrdwr", 0); + return; + } + /* --END ERROR HANDLING-- */ + } + } + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Request)); + send_req = requests; + } else { + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, requests + j); + j++; + } + } + send_req = requests + nprocs_recv; + } + +/* post sends. if buftype_is_contig, data can be directly sent from + user buf at location given by buf_idx. else use send_buf. */ + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5032, 0, NULL); +#endif + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, send_req + j); + j++; + buf_idx[i] += send_size[i]; + } + } else if (nprocs_send) { + /* buftype is not contig */ + size_t msgLen = 0; + for (i = 0; i < nprocs; i++) + msgLen += send_size[i]; + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + send_buf[0] = (char *) ADIOI_Malloc(msgLen * sizeof(char)); + for (i = 1; i < nprocs; i++) + send_buf[i] = send_buf[i - 1] + send_size[i - 1]; + + ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, + offset_list, len_list, send_size, + send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + send_buf_idx, curr_to_proc, done_to_proc, iter, buftype_extent); + /* the send is done in ADIOI_Fill_send_buffer */ + } + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + j = 0; + for (i = 0; i < nprocs; i++) { + MPI_Status wkl_status; + if (recv_size[i]) { + MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, myrank + i + 100 * iter, + fd->comm, &wkl_status); + j++; + } + } + } + + for (i = 0; i < nprocs_recv; i++) + MPI_Type_free(recv_types + i); + ADIOI_Free(recv_types); + +#ifdef MPI_STATUSES_IGNORE + statuses = MPI_STATUSES_IGNORE; +#else + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + 1) * sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } +#endif + +#ifdef NEEDS_MPI_TEST + i = 0; + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) + MPI_Testall(nprocs_send, send_req, &i, statuses); + } else { + while (!i) + MPI_Testall(nprocs_send + nprocs_recv, requests, &i, statuses); + } +#else + if (fd->atomicity) + /* bug fix from Wei-keng Liao and Kenin Coloma */ + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send + nprocs_recv, requests, statuses); +#endif + +#ifdef AGGREGATION_PROFILE + MPE_Log_event(5033, 0, NULL); +#endif +#ifndef MPI_STATUSES_IGNORE + ADIOI_Free(statuses); +#endif + ADIOI_Free(requests); + if (!buftype_is_contig && nprocs_send) { + ADIOI_Free(send_buf[0]); + ADIOI_Free(send_buf); + } +} + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = MPL_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(uintptr_t)buf) + user_buf_idx) == (ADIO_Offset)(uintptr_t)((uintptr_t)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(&(send_buf[p][send_buf_idx[p]]), \ + ((char *) buf) + user_buf_idx, size_in_buf); \ + send_buf_idx[p] += size_in_buf; \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + + + + + +void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + * flat_buf, char **send_buf, ADIO_Offset + * offset_list, ADIO_Offset * len_list, int *send_size, + MPI_Request * requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset * fd_start, ADIO_Offset * fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, MPI_Aint buftype_extent) +{ +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + +/* curr_to_proc[p] = amount of data sent to proc. p that has already + been accounted for so far + done_to_proc[p] = amount of data already sent to proc. p in + previous iterations + user_buf_idx = current location in user buffer + send_buf_idx[p] = current location in send_buf of proc. p */ + + for (i = 0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in + * flattened buf */ + + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = len_list[i]; + + /*this request may span the file domains of more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_Calc_aggregator(fd, off, min_st_offset, &len, fd_size, fd_start, fd_end); + + if (send_buf_idx[p] < send_size[p]) { + if (curr_to_proc[p] + len > done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = MPL_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p] - send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == + (unsigned) (curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == + (unsigned) (done_to_proc[p] + size)); + /* ok to cast: bounded by cb buffer size */ + curr_to_proc[p] = done_to_proc[p] + (int) size; + ADIOI_BUF_COPY} else { + size = MPL_MIN(len, send_size[p] - send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY} + if (send_buf_idx[p] == send_size[p]) { + MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank + p + 100 * iter, fd->comm, requests + jj); + jj++; + } + } else { + ADIOI_Assert((curr_to_proc[p] + len) == + (unsigned) ((ADIO_Offset) curr_to_proc[p] + len)); + curr_to_proc[p] += len; + buf_incr = len; + ADIOI_BUF_INCR} + } else { + buf_incr = len; + ADIOI_BUF_INCR} + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (send_size[i]) + sent_to_proc[i] = curr_to_proc[i]; +} + + + +void ADIOI_Heap_merge(ADIOI_Access * others_req, int *count, + ADIO_Offset * srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements) +{ + typedef struct { + ADIO_Offset *off_list; + ADIO_Offset *len_list; + int nelem; + } heap_struct; + + heap_struct *a, tmp; + int i, j, heapsize, l, r, k, smallest; + + a = (heap_struct *) ADIOI_Malloc((nprocs_recv + 1) * sizeof(heap_struct)); + + j = 0; + for (i = 0; i < nprocs; i++) + if (count[i]) { + a[j].off_list = &(others_req[i].offsets[start_pos[i]]); + a[j].len_list = &(others_req[i].lens[start_pos[i]]); + a[j].nelem = count[i]; + j++; + } + + /* build a heap out of the first element from each list, with + * the smallest element of the heap at the root */ + + heapsize = nprocs_recv; + for (i = heapsize / 2 - 1; i >= 0; i--) { + /* Heapify(a, i, heapsize); Algorithm from Cormen et al. pg. 143 + * modified for a heap with smallest element at root. I have + * removed the recursion so that there are no function calls. + * Function calls are too expensive. */ + k = i; + for (;;) { + l = 2 * (k + 1) - 1; + r = 2 * (k + 1); + + if ((l < heapsize) && (*(a[l].off_list) < *(a[k].off_list))) + smallest = l; + else + smallest = k; + + if ((r < heapsize) && (*(a[r].off_list) < *(a[smallest].off_list))) + smallest = r; + + if (smallest != k) { + tmp.off_list = a[k].off_list; + tmp.len_list = a[k].len_list; + tmp.nelem = a[k].nelem; + + a[k].off_list = a[smallest].off_list; + a[k].len_list = a[smallest].len_list; + a[k].nelem = a[smallest].nelem; + + a[smallest].off_list = tmp.off_list; + a[smallest].len_list = tmp.len_list; + a[smallest].nelem = tmp.nelem; + + k = smallest; + } else + break; + } + } + + for (i = 0; i < total_elements; i++) { + /* extract smallest element from heap, i.e. the root */ + srt_off[i] = *(a[0].off_list); + srt_len[i] = *(a[0].len_list); + (a[0].nelem)--; + + if (!a[0].nelem) { + a[0].off_list = a[heapsize - 1].off_list; + a[0].len_list = a[heapsize - 1].len_list; + a[0].nelem = a[heapsize - 1].nelem; + heapsize--; + } else { + (a[0].off_list)++; + (a[0].len_list)++; + } + + /* Heapify(a, 0, heapsize); */ + k = 0; + for (;;) { + l = 2 * (k + 1) - 1; + r = 2 * (k + 1); + + if ((l < heapsize) && (*(a[l].off_list) < *(a[k].off_list))) + smallest = l; + else + smallest = k; + + if ((r < heapsize) && (*(a[r].off_list) < *(a[smallest].off_list))) + smallest = r; + + if (smallest != k) { + tmp.off_list = a[k].off_list; + tmp.len_list = a[k].len_list; + tmp.nelem = a[k].nelem; + + a[k].off_list = a[smallest].off_list; + a[k].len_list = a[smallest].len_list; + a[k].nelem = a[smallest].nelem; + + a[smallest].off_list = tmp.off_list; + a[smallest].len_list = tmp.len_list; + a[smallest].nelem = tmp.nelem; + + k = smallest; + } else + break; + } + } + ADIOI_Free(a); +} diff --git a/3rd-party/romio341/adio/common/ad_write_nolock.c b/3rd-party/romio341/adio/common/ad_write_nolock.c new file mode 100644 index 0000000000000000000000000000000000000000..77ef9fefa9d0ccc8bab553ef27dc63c1f3475883 --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_write_nolock.c @@ -0,0 +1,407 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#include "adio.h" +#include "adio_extern.h" +#include <unistd.h> + + +/* #define IO_DEBUG 1 */ +void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ +/* borrowed from old-school PVFS (v1) code. A driver for file systems that + * cannot or do not support client-side buffering + * Does not do data sieving optimization + * Does contain write-combining optimization for noncontig in memory, contig in + * file + */ + +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int j, k, st_index = 0; + off_t err_lseek = -1; + ssize_t err = -1; + ADIO_Offset fwr_size = 0, bwr_size, new_bwr_size, new_fwr_size, i_offset, num; + ADIO_Offset bufsize, n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, size, sum; + ADIO_Offset abs_off_in_filetype = 0, size_in_filetype; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent, indx; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp; + int flag, err_flag = 0; + static char myname[] = "ADIOI_NOLOCK_WRITESTRIDED"; +#ifdef IO_DEBUG + int rank, nprocs; +#endif + + /* --BEGIN ERROR HANDLING-- */ + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, "Atomic mode set in I/O function", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } +#ifdef IO_DEBUG + MPI_Comm_rank(fd->comm, &rank); + MPI_Comm_size(fd->comm, &nprocs); +#endif + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == + ((ADIO_Offset) (unsigned) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + + if (!buftype_is_contig && filetype_is_contig) { + char *combine_buf, *combine_buf_ptr; + ADIO_Offset combine_buf_remain; +/* noncontiguous in memory, contiguous in file. use writev */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + /* allocate our "combine buffer" to pack data into before writing */ + combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size); + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + + /* seek to the right spot in the file */ + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + etype_size * offset; + lseek(fd->fd_sys, off, SEEK_SET); + } else + off = lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + + /* loop through all the flattened pieces. combine into buffer until + * no more will fit, then write. + * + * special case of a given piece being bigger than the combine buffer + * is also handled. + */ + for (j = 0; j < count; j++) { + int i; + for (i = 0; i < flat_buf->count; i++) { + if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) { + /* there is data in the buffer; write out the buffer so far */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (0) writing loc = %Ld sz = %Ld\n", + rank, nprocs, off, fd->hints->ind_wr_buffer_size - combine_buf_remain); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, + combine_buf, fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; + + /* reset our buffer info */ + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + } + + /* TODO: heuristic for when to not bother to use combine buffer? */ + if (flat_buf->blocklens[i] >= combine_buf_remain) { + /* special case: blocklen is as big as or bigger than the combine buf; + * write directly + */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (1) writing loc = %Ld sz = %d\n", + rank, nprocs, off, flat_buf->blocklens[i]); +#endif + ADIOI_Assert(flat_buf->blocklens[i] == (unsigned) flat_buf->blocklens[i]); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + + (ADIO_Offset) j * (ADIO_Offset) buftype_extent + + flat_buf->indices[i]) == + (ADIO_Offset) ((uintptr_t) buf + + (ADIO_Offset) j * (ADIO_Offset) buftype_extent + + flat_buf->indices[i])); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, + ((char *) buf) + (ADIO_Offset) j * (ADIO_Offset) buftype_extent + + flat_buf->indices[i], (unsigned) flat_buf->blocklens[i]); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ + } else { + /* copy more data into combine buffer */ + memcpy(combine_buf_ptr, + ((char *) buf) + j * buftype_extent + flat_buf->indices[i], + flat_buf->blocklens[i]); + combine_buf_ptr += flat_buf->blocklens[i]; + combine_buf_remain -= flat_buf->blocklens[i]; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ + } + } + } + + if (combine_buf_ptr != combine_buf) { + /* data left in buffer to write */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (2) writing loc = %Ld sz = %Ld\n", + rank, nprocs, off, fd->hints->ind_wr_buffer_size - combine_buf_remain); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, + combine_buf, fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + ADIOI_Free(combine_buf); + + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + /* if (!buftype_is_contig && filetype_is_contig) ... */ + else { /* noncontiguous in file */ + +/* split up into several contiguous writes */ + +/* find starting location in the file */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + int i; + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + if (disp + flat_file->indices[i] + + n_filetypes * (ADIO_Offset) filetype_extent + flat_file->blocklens[i] + >= offset) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + n_filetypes * (ADIO_Offset) filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } + } else { + int i; + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + n_filetypes * (ADIO_Offset) filetype_extent + abs_off_in_filetype; + } + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + fwr_size = MPL_MIN(fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + * fwr_size = 0. save system call in such cases */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif +#ifdef IO_DEBUG + printf("[%d/%d] c mem nc file writing loc = %Ld sz = %d\n", + rank, nprocs, off, fwr_size); +#endif + err_lseek = lseek(fd->fd_sys, off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (err_lseek == -1) + err_flag = 1; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. */ + else { + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + indx = flat_buf->indices[0]; + j = st_index; + off = offset; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(fwr_size, bwr_size); + if (size) { +#ifdef IO_DEBUG + printf("[%d/%d] nc mem nc file writing loc = %Ld sz = %d\n", + rank, nprocs, off, size); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif + lseek(fd->fd_sys, off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + ADIOI_Assert(size == (size_t) size); + ADIOI_Assert(off == (off_t) off); + err = write(fd->fd_sys, ((char *) buf) + indx, size); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) + err_flag = 1; + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + if (j < (flat_file->count - 1)) + j++; + else { + j = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + indx += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + indx = buftype_extent * (buf_count / flat_buf->count) + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + } else + *error_code = MPI_SUCCESS; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + +} diff --git a/3rd-party/romio341/adio/common/ad_write_str.c b/3rd-party/romio341/adio/common/ad_write_str.c new file mode 100644 index 0000000000000000000000000000000000000000..67bd87811beb71dab459c42ea1b580a99a9f8f3f --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_write_str.c @@ -0,0 +1,486 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#define ADIOI_BUFFERED_WRITE \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + if (writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + goto fn_exit; \ + } \ + } \ + writebuf_off = req_off; \ + writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + goto fn_exit; \ + } \ + } \ + write_sz = (unsigned) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + goto fn_exit; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + goto fn_exit; \ + } \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } + + +/* this macro is used when filetype is contig and buftype is not contig. + it does not do a read-modify-write and does not lock*/ +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ + { \ + if (req_off >= writebuf_off + writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + goto fn_exit; \ + } \ + writebuf_off = req_off; \ + writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + } \ + write_sz = (unsigned) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + goto fn_exit; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1)); \ + write_sz = MPL_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ + } +void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, sum, size_in_filetype; + int i, j, k, st_index = 0; + ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; + ADIO_Offset n_etypes_in_filetype, abs_off_in_filetype = 0; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset = 0, writebuf_off, start_off; + char *writebuf = NULL; + unsigned writebuf_len, max_bufsize, write_sz; + MPI_Aint bufsize; + ADIO_Status status1; + ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size = 0, bwr_size, req_len; + static char myname[] = "ADIOI_GEN_WriteStrided"; + + if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on reads, use naive + * approach instead. + */ + + ADIOI_GEN_WriteStrided_naive(fd, + buf, + count, datatype, file_ptr_type, offset, status, error_code); + return; + } + + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(datatype, &buftype_size); + MPI_Type_get_extent(datatype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((MPI_Count) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + max_bufsize = fd->hints->ind_wr_buffer_size; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + + start_off = off; + end_offset = off + bufsize - 1; + writebuf_off = off; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + writebuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset - writebuf_off + 1)); + + /* if atomicity is true or data sieving is not disable, lock the region + * to be accessed */ + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + for (j = 0; j < count; j++) { + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = (ADIO_Offset) j *(ADIO_Offset) buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ; + off += flat_buf->blocklens[i]; + } + } + + /* write the buffer out finally */ + if (writebuf_len) { + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + writebuf_off, &status1, error_code); + } + + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (*error_code != MPI_SUCCESS) + goto fn_exit; + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } + + else { /* noncontiguous in file */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset) n_filetypes *filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i = 0; i < flat_file->count; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) + continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset) n_filetypes *filetype_extent; + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao:write request is within single flat_file contig block */ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + /* though MPI api has an integer 'count' parameter, derived + * datatypes might describe more bytes than can fit into an integer. + * if we've made it this far, we can pass a count of original + * datatypes, instead of a count of bytes (which might overflow) + * Other WriteContig calls in this path are operating on data + * sieving buffer */ + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, bufsize); + ADIO_WriteContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + ADIOI_UNLOCK(fd, offset, SEEK_SET, bufsize); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset) n_filetypes *filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + goto fn_exit; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be write, end_offset=99 */ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + i_offset += fwr_size; + end_offset = off + fwr_size - 1; + + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + + /* if atomicity is true or data sieving is not disable, lock the region + * to be accessed */ + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + writebuf_off = 0; + writebuf_len = 0; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + memset(writebuf, -1, max_bufsize); + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + * fwr_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size); */ + + req_off = off; + req_len = fwr_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes * (ADIO_Offset) filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. */ + else { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize - i_offset); + } + } + } else { +/* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(datatype); + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = MPL_MIN(fwr_size, bwr_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + * err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE; + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j] == 0) { + j = (j + 1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1) % flat_buf->count; + buf_count++; + i_offset = + (ADIO_Offset) buftype_extent *(ADIO_Offset) (buf_count / flat_buf->count) + + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* write the buffer out finally */ + if (writebuf_len) { + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + writebuf_off, &status1, error_code); + if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + if (*error_code != MPI_SUCCESS) + goto fn_exit; + } + if (fd->atomicity || fd->hints->ds_write != ADIOI_HINT_DISABLE) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + /* datatypes returning negagive values, probably related to tt 1893 */ + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + fn_exit: + if (writebuf != NULL) + ADIOI_Free(writebuf); +} diff --git a/3rd-party/romio341/adio/common/ad_write_str_naive.c b/3rd-party/romio341/adio/common/ad_write_str_naive.c new file mode 100644 index 0000000000000000000000000000000000000000..3439cd616035f9a625e4aaefcf88be9fbe23f52b --- /dev/null +++ b/3rd-party/romio341/adio/common/ad_write_str_naive.c @@ -0,0 +1,359 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count, + MPI_Datatype buftype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + /* bwr == buffer write; fwr == file write */ + ADIO_Offset bwr_size, fwr_size = 0, sum, size_in_filetype; + int b_index; + MPI_Count bufsize; + ADIO_Offset n_etypes_in_filetype; + ADIO_Offset size, n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype = 0, req_len; + MPI_Count filetype_size, etype_size, buftype_size; + MPI_Aint lb, filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset = 0, start_off; + ADIO_Status status1; + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size_x(fd->filetype, &filetype_size); + if (!filetype_size) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, buftype, 0); +#endif + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + MPI_Type_size_x(buftype, &buftype_size); + MPI_Type_get_extent(buftype, &lb, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == + ((ADIO_Offset) (unsigned) buftype_size * (ADIO_Offset) count)); + bufsize = buftype_size * count; + + /* contiguous in buftype and filetype is handled elsewhere */ + + if (!buftype_is_contig && filetype_is_contig) { + int b_count; + /* noncontiguous in memory, contiguous in file. */ + + flat_buf = ADIOI_Flatten_and_find(buftype); + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset) etype_size *offset; + + start_off = off; + end_offset = off + bufsize - 1; + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + /* for each region in the buffer, grab the data and put it in + * place + */ + for (b_count = 0; b_count < count; b_count++) { + for (b_index = 0; b_index < flat_buf->count; b_index++) { + userbuf_off = (ADIO_Offset) b_count *(ADIO_Offset) buftype_extent + + flat_buf->indices[b_index]; + req_off = off; + req_len = flat_buf->blocklens[b_index]; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIO_WriteContig(fd, (char *) buf + userbuf_off, (int) req_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + + /* off is (potentially) used to save the final offset later */ + off += flat_buf->blocklens[b_index]; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + + } + + else { /* noncontiguous in file */ + int f_index, st_index = 0; + ADIO_Offset st_fwr_size, st_n_filetypes; + int flag; + + /* First we're going to calculate a set of values for use in all + * the noncontiguous in file cases: + * start_off - starting byte position of data in file + * end_offset - last byte offset to be acessed in the file + * st_n_filetypes - how far into the file we start in terms of + * whole filetypes + * st_index - index of block in first filetype that we will be + * starting in (?) + * st_fwr_size - size of the data in the first filetype block + * that we will write (accounts for being part-way + * into writing this block of the filetype + * + */ + + flat_file = ADIOI_Flatten_and_find(fd->filetype); + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + start_off = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (f_index = 0; f_index < flat_file->count; f_index++) { + if (disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent + + flat_file->blocklens[f_index] >= start_off) { + /* this block contains our starting position */ + + st_index = f_index; + fwr_size = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent + + flat_file->blocklens[f_index] - start_off; + flag = 1; + break; + } + } + } + } else { + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (f_index = 0; f_index < flat_file->count; f_index++) { + sum += flat_file->blocklens[f_index]; + if (sum > size_in_filetype) { + st_index = f_index; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[f_index] + + size_in_filetype - (sum - flat_file->blocklens[f_index]); + break; + } + } + + /* abs. offset in bytes in the file */ + start_off = disp + n_filetypes * (ADIO_Offset) filetype_extent + abs_off_in_filetype; + } + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + /* start_off, st_n_filetypes, st_index, and st_fwr_size are + * all calculated at this point + */ + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_off=0 and 100 bytes to be written, end_offset=99 + */ + userbuf_off = 0; + f_index = st_index; + off = start_off; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + while (userbuf_off < bufsize) { + userbuf_off += fwr_size; + end_offset = off + fwr_size - 1; + + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[f_index], bufsize - (unsigned) userbuf_off); + } + + /* End of calculations. At this point the following values have + * been calculated and are ready for use: + * - start_off + * - end_offset + * - st_n_filetypes + * - st_index + * - st_fwr_size + */ + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (buftype_is_contig && !filetype_is_contig) { + /* contiguous in memory, noncontiguous in file. should be the + * most common case. + */ + + userbuf_off = 0; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + fwr_size = MPL_MIN(st_fwr_size, bufsize); + + /* while there is still space in the buffer, write more data */ + while (userbuf_off < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + * fwr_size = 0. save system call in such cases */ + req_off = off; + req_len = fwr_size; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIO_WriteContig(fd, (char *) buf + userbuf_off, (int) req_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + userbuf_off += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[f_index] + + flat_file->blocklens[f_index] + n_filetypes * (ADIO_Offset) filetype_extent) { + /* important that this value be correct, as it is + * used to set the offset in the fd near the end of + * this function. + */ + off += fwr_size; + } + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. + */ + else { + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + off = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent; + fwr_size = MPL_MIN(flat_file->blocklens[f_index], + bufsize - (unsigned) userbuf_off); + } + } + } else { + ADIO_Offset i_offset, tmp_bufsize = 0; + /* noncontiguous in memory as well as in file */ + + flat_buf = ADIOI_Flatten_and_find(buftype); + + b_index = buf_count = 0; + i_offset = flat_buf->indices[0]; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + /* while we haven't read size * count bytes, keep going */ + while (tmp_bufsize < bufsize) { + ADIO_Offset new_bwr_size = bwr_size, new_fwr_size = fwr_size; + + size = MPL_MIN(fwr_size, bwr_size); + /* keep max of a single read amount <= INT_MAX */ + size = MPL_MIN(size, INT_MAX); + + if (size) { + req_off = off; + req_len = size; + userbuf_off = i_offset; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset) (uintptr_t) buf) + userbuf_off) == + (ADIO_Offset) (uintptr_t) ((uintptr_t) buf + userbuf_off)); + ADIO_WriteContig(fd, (char *) buf + userbuf_off, (int) req_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, req_off, &status1, error_code); + if (*error_code != MPI_SUCCESS) + return; + } + + if (size == fwr_size) { + /* reached end of contiguous block in file */ + if (f_index < (flat_file->count - 1)) + f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + + n_filetypes * (ADIO_Offset) filetype_extent; + + new_fwr_size = flat_file->blocklens[f_index]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { + /* reached end of contiguous block in memory */ + + b_index = (b_index + 1) % flat_buf->count; + buf_count++; + i_offset = + (ADIO_Offset) buftype_extent *(ADIO_Offset) (buf_count / flat_buf->count) + + flat_buf->indices[b_index]; + new_bwr_size = flat_buf->blocklens[b_index]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + tmp_bufsize += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* unlock the file region if we locked it */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } /* end of (else noncontiguous in file) */ + + fd->fp_sys_posn = -1; /* mark it as invalid. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, buftype, bufsize); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually written and placed in buf + */ +#endif + +} diff --git a/3rd-party/romio341/adio/common/adi_close.c b/3rd-party/romio341/adio/common/adi_close.c new file mode 100644 index 0000000000000000000000000000000000000000..d914b2c02592b2591edaf573d5d37762e179595c --- /dev/null +++ b/3rd-party/romio341/adio/common/adi_close.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + + + +void ADIOI_GEN_Close(ADIO_File fd, int *error_code) +{ + int err, derr = 0; + static char myname[] = "ADIOI_GEN_CLOSE"; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_close_a, 0, NULL); +#endif + err = close(fd->fd_sys); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_close_b, 0, NULL); +#endif + if (fd->fd_direct >= 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_close_a, 0, NULL); +#endif + derr = close(fd->fd_direct); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_close_b, 0, NULL); +#endif + } + + fd->fd_sys = -1; + fd->fd_direct = -1; + + if (err == -1 || derr == -1) { + *error_code = ADIOI_Err_create_code(myname, fd->filename, errno); + } else + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/adio/common/async_list.c b/3rd-party/romio341/adio/common/async_list.c new file mode 100644 index 0000000000000000000000000000000000000000..c1ffde71b5205f4af811c452dd4921cf13b0ccde --- /dev/null +++ b/3rd-party/romio341/adio/common/async_list.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +ADIOI_Async_node *ADIOI_Malloc_async_node(void) +{ +/* returns a pointer to a new node that can be added to ADIOI_Async_list. + To reduce the number of system calls, mallocs NUM nodes at a time + and maintains list of available nodes. Supplies a node from this + list if available, else mallocs a new set of NUM and provides one + from that set. Is NUM=100 a good number? */ + +#define NUM 100 + + ADIOI_Async_node *curr, *ptr; + int i; + + if (!ADIOI_Async_avail_head) { + ADIOI_Async_avail_head = (ADIOI_Async_node *) + ADIOI_Malloc(NUM * sizeof(ADIOI_Async_node)); + curr = ADIOI_Async_avail_head; + for (i = 1; i < NUM; i++) { + curr->next = ADIOI_Async_avail_head + i; + curr = curr->next; + } + curr->next = NULL; + ADIOI_Async_avail_tail = curr; + + /* keep track of malloced area that needs to be freed later */ + if (!ADIOI_Malloc_async_tail) { + ADIOI_Malloc_async_tail = (ADIOI_Malloc_async *) + ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); + ADIOI_Malloc_async_head = ADIOI_Malloc_async_tail; + ADIOI_Malloc_async_head->ptr = ADIOI_Async_avail_head; + ADIOI_Malloc_async_head->next = NULL; + } else { + ADIOI_Malloc_async_tail->next = (ADIOI_Malloc_async *) + ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); + ADIOI_Malloc_async_tail = ADIOI_Malloc_async_tail->next; + ADIOI_Malloc_async_tail->ptr = ADIOI_Async_avail_head; + ADIOI_Malloc_async_tail->next = NULL; + } + } + + ptr = ADIOI_Async_avail_head; + ADIOI_Async_avail_head = ADIOI_Async_avail_head->next; + if (!ADIOI_Async_avail_head) + ADIOI_Async_avail_tail = NULL; + + return ptr; +} + + +void ADIOI_Free_async_node(ADIOI_Async_node * node) +{ +/* moves this node to available pool. does not actually free it. */ + + if (!ADIOI_Async_avail_tail) + ADIOI_Async_avail_head = ADIOI_Async_avail_tail = node; + else { + ADIOI_Async_avail_tail->next = node; + ADIOI_Async_avail_tail = node; + } + node->next = NULL; +} + + +void ADIOI_Add_req_to_list(ADIO_Request * request) +{ +/* add request to list of outstanding requests */ + + ADIOI_Async_node *curr; + + if (!ADIOI_Async_list_head) { + ADIOI_Async_list_head = ADIOI_Malloc_async_node(); + ADIOI_Async_list_head->request = request; + ADIOI_Async_list_head->prev = ADIOI_Async_list_head->next = NULL; + ADIOI_Async_list_tail = ADIOI_Async_list_head; + (*request)->ptr_in_async_list = ADIOI_Async_list_head; + } else { + curr = ADIOI_Async_list_tail; + curr->next = ADIOI_Malloc_async_node(); + ADIOI_Async_list_tail = curr->next; + ADIOI_Async_list_tail->request = request; + ADIOI_Async_list_tail->prev = curr; + ADIOI_Async_list_tail->next = NULL; + (*request)->ptr_in_async_list = ADIOI_Async_list_tail; + } +} + +/* Sets error_code to MPI_SUCCESS on success, creates an error code on + * failure. + */ +void ADIOI_Complete_async(int *error_code) +{ +/* complete all outstanding async I/O operations so that new ones can be + initiated. Remove them all from async_list. */ + + ADIO_Status status; + ADIO_Request *request; + ADIOI_Async_node *tmp; + static char myname[] = "ADIOI_Complete_async"; + + *error_code = MPI_SUCCESS; + + while (ADIOI_Async_list_head) { + request = ADIOI_Async_list_head->request; + (*request)->queued = -1; /* ugly internal hack that prevents + * ADIOI_xxxComplete from freeing the request object. + * This is required, because the user will call MPI_Wait + * later, which would require status to be filled. */ + switch ((*request)->optype) { + case ADIOI_READ: +/* (*((*request)->fd->fns->ADIOI_xxx_ReadComplete))(request, + &status,error_code);*/ + ADIO_ReadComplete(request, &status, error_code); + break; + case ADIOI_WRITE: +/* (*((*request)->fd->fns->ADIOI_xxx_WriteComplete))(request, + &status, error_code);*/ + ADIO_WriteComplete(request, &status, error_code); + break; + default: + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, "Unknown request optype", 0); + return; + /* --END ERROR HANDLING-- */ + } + (*request)->queued = 0; /* dequeued, but request object not + * freed */ + + tmp = ADIOI_Async_list_head; + ADIOI_Async_list_head = ADIOI_Async_list_head->next; + ADIOI_Free_async_node(tmp); + } + ADIOI_Async_list_tail = NULL; +} + + +void ADIOI_Del_req_from_list(ADIO_Request * request) +{ +/* Delete a request that has already been completed from the async + list and move it to the list of available nodes. Typically called + from within an ADIO_Test/ADIO_Wait. */ + + ADIOI_Async_node *curr, *prev, *next; + + curr = (*request)->ptr_in_async_list; + prev = curr->prev; + + if (prev) + prev->next = curr->next; + else + ADIOI_Async_list_head = curr->next; + + next = curr->next; + if (next) + next->prev = prev; + else + ADIOI_Async_list_tail = prev; + + ADIOI_Free_async_node(curr); +} diff --git a/3rd-party/romio341/adio/common/byte_offset.c b/3rd-party/romio341/adio/common/byte_offset.c new file mode 100644 index 0000000000000000000000000000000000000000..9946bc002283fd510ea8d92c4425e43bb2071629 --- /dev/null +++ b/3rd-party/romio341/adio/common/byte_offset.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +/* Returns the absolute byte position in the file corresponding to + "offset" etypes relative to the current view. */ + +void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset * disp) +{ + ADIOI_Flatlist_node *flat_file; + int i; + ADIO_Offset n_filetypes, etype_in_filetype, sum, abs_off_in_filetype = 0, size_in_filetype; + MPI_Count n_etypes_in_filetype, filetype_size, etype_size; + int filetype_is_contig; + MPI_Aint lb, filetype_extent; + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + etype_size = fd->etype_size; + + if (filetype_is_contig) + *disp = fd->disp + etype_size * offset; + else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + MPI_Type_size_x(fd->filetype, &filetype_size); + n_etypes_in_filetype = filetype_size / etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + abs_off_in_filetype = flat_file->indices[i] + + size_in_filetype - (sum - flat_file->blocklens[i]); + break; + } + } + + /* abs. offset in bytes in the file */ + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + *disp = + fd->disp + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + abs_off_in_filetype; + } +} diff --git a/3rd-party/romio341/adio/common/cb_config_list.c b/3rd-party/romio341/adio/common/cb_config_list.c new file mode 100644 index 0000000000000000000000000000000000000000..a9ff57899f2e7b880c31db6cd00b5e058adb8062 --- /dev/null +++ b/3rd-party/romio341/adio/common/cb_config_list.c @@ -0,0 +1,727 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* cb_config_list.c + * + * The important, externally used functions from this file are: + * ADIOI_cb_bcast_rank_map() + * ADIOI_cb_gather_name_array() + * ADIOI_cb_config_list_parse() + * ADIOI_cb_copy_name_array() + * ADIOI_cb_delete_name_array() + * + * Prototypes for these are in adio/include/adio_cb_config_list.h + */ + +#include "adio.h" +#include "mpi.h" +#include "adio_cb_config_list.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* token types */ +#define AGG_WILDCARD 1 +#define AGG_STRING 2 +#define AGG_COMMA 3 +#define AGG_COLON 4 +#define AGG_ERROR -1 +#define AGG_EOS 0 + +#undef CB_CONFIG_LIST_DEBUG + +/* a couple of globals keep things simple */ +int ADIOI_cb_config_list_keyval = MPI_KEYVAL_INVALID; +static char *yylval; +static char *token_ptr; + +/* internal stuff */ +static int get_max_procs(int cb_nodes); +static int match_procs(char *name, int max_per_proc, char *procnames[], + char used_procnames[], + int nr_procnames, int ranks[], int nr_ranks, int *nr_ranks_allocated); +static int match_this_proc(char *name, int cur_proc, int max_matches, + char *procnames[], char used_procnames[], + int nr_procnames, int ranks[], int nr_ranks, int nr_ranks_allocated); +static int find_name(char *name, char *procnames[], char used_procnames[], + int nr_procnames, int start_ind); +static int cb_config_list_lex(void); + + +/* ADIOI_cb_bcast_rank_map() - broadcast the rank array + * + * Parameters: + * fd - ADIO_File for which update is occurring. cb_nodes and ranklist + * parameters must be up-to-date on rank 0 of the fd->comm. + * + * should probably be a void fn. + */ +int ADIOI_cb_bcast_rank_map(ADIO_File fd) +{ + int my_rank; + char *value; + int error_code = MPI_SUCCESS; + static char myname[] = "ADIOI_cb_bcast_rank_map"; + char *p; + int i; + + MPI_Bcast(&(fd->hints->cb_nodes), 1, MPI_INT, 0, fd->comm); + if (fd->hints->cb_nodes > 0) { + MPI_Comm_rank(fd->comm, &my_rank); + if (my_rank != 0) { + fd->hints->ranklist = ADIOI_Malloc(fd->hints->cb_nodes * sizeof(int)); + if (fd->hints->ranklist == NULL) { + error_code = MPIO_Err_create_code(error_code, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return error_code; + } + } + MPI_Bcast(fd->hints->ranklist, fd->hints->cb_nodes, MPI_INT, 0, fd->comm); + } + /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR + * FS-INDEP. */ + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + MPL_snprintf(value, MPI_MAX_INFO_VAL + 1, "%d", fd->hints->cb_nodes); + ADIOI_Info_set(fd->info, "cb_nodes", value); + p = value; + /* the (by MPI rank) list of aggregators can be larger than + * MPI_MAX_INFO_VAL, so we will simply truncate when we reach capacity. I + * wasn't clever enough to figure out how to rewind and put '...' at the + * end in the truncate case */ + for (i = 0; i < fd->hints->cb_nodes; i++) { + int incr, remain = (MPI_MAX_INFO_VAL) - (p - value); + incr = MPL_snprintf(p, remain, "%d ", fd->hints->ranklist[i]); + if (incr >= remain) + break; + p += incr; + } + ADIOI_Info_set(fd->info, "romio_aggregator_list", value); + ADIOI_Free(value); + + return 0; +} + +/* ADIOI_cb_gather_name_array() - gather a list of processor names from all processes + * in a communicator and store them on rank 0. + * + * This is a collective call on the communicator(s) passed in. + * + * Obtains a rank-ordered list of processor names from the processes in + * "dupcomm". + * + * Returns 0 on success, -1 on failure. + * + * NOTE: Needs some work to cleanly handle out of memory cases! + */ +int ADIOI_cb_gather_name_array(MPI_Comm comm, MPI_Comm dupcomm, ADIO_cb_name_array * arrayp) +{ + char my_procname[MPI_MAX_PROCESSOR_NAME], **procname = 0; + int *procname_len = NULL, my_procname_len, *disp = NULL, i; + int commsize, commrank, found; + ADIO_cb_name_array array = NULL; + int alloc_size; + + if (ADIOI_cb_config_list_keyval == MPI_KEYVAL_INVALID) { + /* cleaned up by ADIOI_End_call */ + MPI_Keyval_create((MPI_Copy_function *) ADIOI_cb_copy_name_array, + (MPI_Delete_function *) ADIOI_cb_delete_name_array, + &ADIOI_cb_config_list_keyval, NULL); + } else { + MPI_Attr_get(comm, ADIOI_cb_config_list_keyval, (void *) &array, &found); + if (found) { + ADIOI_Assert(array != NULL); + *arrayp = array; + return 0; + } + } + + MPI_Comm_size(dupcomm, &commsize); + MPI_Comm_rank(dupcomm, &commrank); + + MPI_Get_processor_name(my_procname, &my_procname_len); + + /* allocate space for everything */ + array = (ADIO_cb_name_array) ADIOI_Malloc(sizeof(*array)); + if (array == NULL) { + return -1; + } + array->refct = 2; /* we're going to associate this with two comms */ + + if (commrank == 0) { + /* process 0 keeps the real list */ + array->namect = commsize; + + array->names = (char **) ADIOI_Malloc(sizeof(char *) * commsize); + if (array->names == NULL) { + return -1; + } + procname = array->names; /* simpler to read */ + + procname_len = (int *) ADIOI_Malloc(commsize * sizeof(int)); + if (procname_len == NULL) { + return -1; + } + } else { + /* everyone else just keeps an empty list as a placeholder */ + array->namect = 0; + array->names = NULL; + } + /* gather lengths first */ + MPI_Gather(&my_procname_len, 1, MPI_INT, procname_len, 1, MPI_INT, 0, dupcomm); + + if (commrank == 0) { +#ifdef CB_CONFIG_LIST_DEBUG + for (i = 0; i < commsize; i++) { + FPRINTF(stderr, "len[%d] = %d\n", i, procname_len[i]); + } +#endif + + alloc_size = 0; + for (i = 0; i < commsize; i++) { + /* add one to the lengths because we need to count the + * terminator, and we are going to use this list of lengths + * again in the gatherv. + */ + alloc_size += ++procname_len[i]; + } + + procname[0] = ADIOI_Malloc(alloc_size); + if (procname[0] == NULL) { + ADIOI_Free(array); + return -1; + } + + for (i = 1; i < commsize; i++) { + procname[i] = procname[i - 1] + procname_len[i - 1]; + } + + /* create our list of displacements for the gatherv. we're going + * to do everything relative to the start of the region allocated + * for procname[0] + */ + disp = ADIOI_Malloc(commsize * sizeof(int)); + disp[0] = 0; + for (i = 1; i < commsize; i++) { + disp[i] = (int) (procname[i] - procname[0]); + } + + } + + /* now gather strings */ + if (commrank == 0) { + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + procname[0], procname_len, disp, MPI_CHAR, 0, dupcomm); + } else { + /* if we didn't do this, we would need to allocate procname[] + * on all processes...which seems a little silly. + */ + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + NULL, NULL, NULL, MPI_CHAR, 0, dupcomm); + } + + if (commrank == 0) { + /* no longer need the displacements or lengths */ + ADIOI_Free(disp); + ADIOI_Free(procname_len); + +#ifdef CB_CONFIG_LIST_DEBUG + for (i = 0; i < commsize; i++) { + FPRINTF(stderr, "name[%d] = %s\n", i, procname[i]); + } +#endif + } + + /* store the attribute; we want to store SOMETHING on all processes + * so that they can all tell if we have gone through this procedure + * or not for the given communicator. + * + * specifically we put it on both the original comm, so we can find + * it next time an open is performed on this same comm, and on the + * dupcomm, so we can use it in I/O operations. + */ + MPI_Attr_put(comm, ADIOI_cb_config_list_keyval, array); + MPI_Attr_put(dupcomm, ADIOI_cb_config_list_keyval, array); + *arrayp = array; + return 0; +} + + +/* ADIOI_cb_config_list_parse() - parse the cb_config_list and build the + * ranklist + * + * Parameters: + * (pretty self explanatory) + * + * Returns number of ranks allocated in parsing, -1 on error. + */ +int ADIOI_cb_config_list_parse(char *config_list, + ADIO_cb_name_array array, int ranklist[], int cb_nodes) +{ + int token, max_procs, cur_rank = 0, nr_procnames; + char *cur_procname, *cur_procname_p, **procnames; + char *used_procnames; + + nr_procnames = array->namect; + procnames = array->names; + + /* nothing big goes on the stack */ + /* we use info val here and for yylval because we know the string + * cannot be any bigger than this. + */ + cur_procname = ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (cur_procname == NULL) { + return -1; + } + + yylval = ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (yylval == NULL) { + ADIOI_Free(cur_procname); + return -1; + } + + token_ptr = config_list; + + /* right away let's make sure cb_nodes isn't too big */ + if (cb_nodes > nr_procnames) + cb_nodes = nr_procnames; + + /* used_procnames is used as a mask so that we don't have to destroy + * our procnames array + */ + used_procnames = ADIOI_Malloc(array->namect * sizeof(char)); + if (used_procnames == NULL) { + ADIOI_Free(cur_procname); + ADIOI_Free(yylval); + yylval = NULL; + return -1; + } + memset(used_procnames, 0, array->namect); + + /* optimization for "*:*"; arguably this could be done before we + * build the list of processor names...but that would make things + * messy. + */ + if (strcmp(config_list, "*:*") == 0) { + for (cur_rank = 0; cur_rank < cb_nodes; cur_rank++) { + ranklist[cur_rank] = cur_rank; + } + ADIOI_Free(cur_procname); + ADIOI_Free(yylval); + yylval = NULL; + ADIOI_Free(used_procnames); + return cb_nodes; + } + + while (cur_rank < cb_nodes) { + token = cb_config_list_lex(); + + if (token == AGG_EOS) { + ADIOI_Free(cur_procname); + ADIOI_Free(yylval); + yylval = NULL; + ADIOI_Free(used_procnames); + return cur_rank; + } + + if (token != AGG_WILDCARD && token != AGG_STRING) { + /* maybe ignore and try to keep going? */ + FPRINTF(stderr, "error parsing config list\n"); + ADIOI_Free(cur_procname); + ADIOI_Free(yylval); + yylval = NULL; + ADIOI_Free(used_procnames); + return cur_rank; + } + + if (token == AGG_WILDCARD) { + cur_procname_p = NULL; + } else { + /* AGG_STRING is the only remaining case */ + /* save procname (for now) */ + ADIOI_Strncpy(cur_procname, yylval, MPI_MAX_INFO_VAL + 1); + cur_procname_p = cur_procname; + } + + /* after we have saved the current procname, we can grab max_procs */ + max_procs = get_max_procs(cb_nodes); + +#ifdef CB_CONFIG_LIST_DEBUG + if (token == AGG_WILDCARD) { + FPRINTF(stderr, "looking for *:%d\n", max_procs); + } else { + FPRINTF(stderr, "looking for %s:%d\n", cur_procname, max_procs); + } +#endif + + /* do the matching for this piece of the cb_config_list */ + match_procs(cur_procname_p, max_procs, procnames, used_procnames, + nr_procnames, ranklist, cb_nodes, &cur_rank); + } + ADIOI_Free(cur_procname); + ADIOI_Free(yylval); + yylval = NULL; + ADIOI_Free(used_procnames); + return cur_rank; +} + +/* ADIOI_cb_copy_name_array() - attribute copy routine + */ +int ADIOI_cb_copy_name_array(MPI_Comm comm, + int keyval, void *extra, void *attr_in, void **attr_out, int *flag) +{ + ADIO_cb_name_array array; + + MPL_UNREFERENCED_ARG(comm); + MPL_UNREFERENCED_ARG(keyval); + MPL_UNREFERENCED_ARG(extra); + + array = (ADIO_cb_name_array) attr_in; + if (array != NULL) + array->refct++; + + *attr_out = attr_in; + *flag = 1; /* make a copy in the new communicator */ + + return MPI_SUCCESS; +} + +/* ADIOI_cb_delete_name_array() - attribute destructor + */ +int ADIOI_cb_delete_name_array(MPI_Comm comm, int keyval, void *attr_val, void *extra) +{ + ADIO_cb_name_array array; + + MPL_UNREFERENCED_ARG(comm); + MPL_UNREFERENCED_ARG(extra); + + array = (ADIO_cb_name_array) attr_val; + ADIOI_Assert(array != NULL); + array->refct--; + + if (array->refct <= 0) { + /* time to free the structures (names, array of ptrs to names, struct) + */ + if (array->namect) { + /* Note that array->names[i], where i > 0, + * are just pointers into the allocated region array->names[0] + */ + ADIOI_Free(array->names[0]); + } + if (array->names != NULL) + ADIOI_Free(array->names); + ADIOI_Free(array); + } + return MPI_SUCCESS; +} + +/* match_procs() - given a name (or NULL for wildcard) and a max. number + * of aggregator processes (per processor name), this + * matches in the procnames[] array and puts appropriate + * ranks in the ranks array. + * + * Parameters: + * name - processor name (or NULL for wildcard) + * max_per_proc - maximum # of processes to use for aggregation from a + * single processor + * procnames - array of processor names + * nr_procnames - length of procnames array + * ranks - array of process ranks + * nr_ranks - length of process ranks array (also max. # of aggregators) + * nr_ranks_allocated - # of array entries which have been filled in, + * which is also the index to the first empty entry + * + * Returns number of matches. + */ +static int match_procs(char *name, + int max_per_proc, + char *procnames[], + char used_procnames[], + int nr_procnames, int ranks[], int nr_ranks, int *nr_ranks_allocated) +{ + int wildcard_proc, cur_proc, old_nr_allocated, ret; + + /* save this so we can report on progress */ + old_nr_allocated = *nr_ranks_allocated; + + if (name == NULL) { + /* wildcard case */ + + /* optimize for *:0 case */ + if (max_per_proc == 0) { + /* loop through procnames and mark them all as used */ + for (cur_proc = 0; cur_proc < nr_procnames; cur_proc++) { + used_procnames[cur_proc] = 1; + } + return 0; + } + + /* the plan here is to start at the beginning of the procnames + * array looking for processor names to apply the wildcard to. + * + * we set wildcard_proc to 0 here but do the search inside the + * while loop so that we aren't starting our search from the + * beginning of the procnames array each time. + */ + wildcard_proc = 0; + + while (nr_ranks - *nr_ranks_allocated > 0) { + /* find a name */ + while ((wildcard_proc < nr_procnames) && (used_procnames[wildcard_proc] != 0)) { + wildcard_proc++; + } + + if (wildcard_proc == nr_procnames) { + /* we have used up the entire procnames list */ + return *nr_ranks_allocated - old_nr_allocated; + } +#ifdef CB_CONFIG_LIST_DEBUG + FPRINTF(stderr, "performing wildcard match (*:%d) starting with %s (%d)\n", + max_per_proc, procnames[wildcard_proc], wildcard_proc); +#endif + + cur_proc = wildcard_proc; + +#ifdef CB_CONFIG_LIST_DEBUG + FPRINTF(stderr, " assigning name %s (%d) to rank %d in mapping\n", + procnames[cur_proc], cur_proc, *nr_ranks_allocated); +#endif + + /* alloc max_per_proc from this host; cur_proc points to + * the first one. We want to save this name for use in + * our while loop. + */ + ranks[*nr_ranks_allocated] = cur_proc; + *nr_ranks_allocated = *nr_ranks_allocated + 1; + cur_proc++; + + /* so, to accomplish this we use the match_this_proc() to + * alloc max_per_proc-1. we increment cur_proc so that the + * procnames[] entry doesn't get trashed. then AFTER the call + * we clean up the first instance of the name. + */ + ret = match_this_proc(procnames[wildcard_proc], cur_proc, + max_per_proc - 1, procnames, used_procnames, + nr_procnames, ranks, nr_ranks, *nr_ranks_allocated); + if (ret > 0) + *nr_ranks_allocated = *nr_ranks_allocated + ret; + + /* clean up and point wildcard_proc to the next entry, since + * we know that this one is NULL now. + */ + used_procnames[wildcard_proc] = 1; + wildcard_proc++; + } + } else { + /* specific host was specified; this one is easy */ +#ifdef CB_CONFIG_LIST_DEBUG + FPRINTF(stderr, "performing name match (%s:%d)\n", name, max_per_proc); +#endif + + ret = match_this_proc(name, 0, max_per_proc, procnames, used_procnames, + nr_procnames, ranks, nr_ranks, *nr_ranks_allocated); + if (ret > 0) + *nr_ranks_allocated = *nr_ranks_allocated + ret; + } + return *nr_ranks_allocated - old_nr_allocated; +} + +/* match_this_proc() - find each instance of processor name "name" in + * the "procnames" array, starting with index "cur_proc" + * and add the first "max_matches" into the "ranks" + * array. remove all instances of "name" from + * "procnames". + * + * Parameters: + * name - processor name to match + * cur_proc - index into procnames[] at which to start matching + * procnames - array of processor names + * used_procnames - array of values indicating if a given procname has + * been allocated or removed already + * nr_procnames - length of procnames array + * ranks - array of processor ranks + * nr_ranks - length of ranks array + * nr_ranks_allocated - number of ranks already filled in, or the next + * entry to fill in (equivalent) + * + * Returns number of ranks filled in (allocated). + */ +static int match_this_proc(char *name, + int cur_proc, + int max_matches, + char *procnames[], + char used_procnames[], + int nr_procnames, int ranks[], int nr_ranks, int nr_ranks_allocated) +{ + int ranks_remaining, nr_to_alloc, old_nr_allocated; + + old_nr_allocated = nr_ranks_allocated; + + /* calculate how many ranks we want to allocate */ + ranks_remaining = nr_ranks - nr_ranks_allocated; + nr_to_alloc = (max_matches < ranks_remaining) ? max_matches : ranks_remaining; + + while (nr_to_alloc > 0) { + cur_proc = find_name(name, procnames, used_procnames, nr_procnames, cur_proc); + if (cur_proc < 0) { + /* didn't find it */ + return nr_ranks_allocated - old_nr_allocated; + } + + /* need bounds checking on ranks */ +#ifdef CB_CONFIG_LIST_DEBUG + FPRINTF(stderr, " assigning name %s (%d) to rank %d in mapping\n", + procnames[cur_proc], cur_proc, nr_ranks_allocated); +#endif + + ranks[nr_ranks_allocated] = cur_proc; + nr_ranks_allocated++; + used_procnames[cur_proc] = 1; + + cur_proc++; + nr_to_alloc--; + } + + /* take all other instances of this host out of the list */ + while (cur_proc >= 0) { + cur_proc = find_name(name, procnames, used_procnames, nr_procnames, cur_proc); + if (cur_proc >= 0) { +#ifdef CB_CONFIG_LIST_DEBUG + FPRINTF(stderr, " taking name %s (%d) out of procnames\n", + procnames[cur_proc], cur_proc); +#endif + used_procnames[cur_proc] = 1; + cur_proc++; + } + } + return nr_ranks_allocated - old_nr_allocated; +} + + +/* find_name() - finds the first entry in procnames[] which matches name, + * starting at index start_ind + * + * Returns an index [0..nr_procnames-1] on success, -1 if not found. + */ +static int find_name(char *name, + char *procnames[], char used_procnames[], int nr_procnames, int start_ind) +{ + int i; + + for (i = start_ind; i < nr_procnames; i++) { + if (!used_procnames[i] && !strcmp(name, procnames[i])) + break; + } + + if (i < nr_procnames) + return i; + else + return -1; +} + +/* get_max_procs() - grab the maximum number of processes to use out of + * the cb_config_list string + * + * Parameters: + * cb_nodes - cb_nodes value. this is returned when a "*" is encountered + * as the max_procs value. + * + * Returns # of processes, or -1 on error. + */ +static int get_max_procs(int cb_nodes) +{ + int token, max_procs = -1; + char *errptr; + + token = cb_config_list_lex(); + + switch (token) { + case AGG_EOS: + case AGG_COMMA: + return 1; + case AGG_COLON: + token = cb_config_list_lex(); + if (token != AGG_WILDCARD && token != AGG_STRING) + return -1; + if (token == AGG_WILDCARD) + max_procs = cb_nodes; + else if (token == AGG_STRING) { + max_procs = (int) strtol(yylval, &errptr, 10); + if (*errptr != '\0') { + /* some garbage value; default to 1 */ + max_procs = 1; + } + } + /* strip off next comma (if there is one) */ + token = cb_config_list_lex(); + if (token != AGG_COMMA && token != AGG_EOS) + return -1; + + /* return max_procs */ + if (max_procs < 0) + return -1; + else + return max_procs; + } + return -1; +} + + +/* cb_config_list_lex() - lexical analyzer for cb_config_list language + * + * Returns a token of types defined at top of this file. + */ +#if defined(BGQPLATFORM) +/* On BlueGene, the ',' character shows up in get_processor_name, so we have to + * use a different delimiter */ +#define COLON ':' +#define COMMA ';' +#define DELIMS ":;" +#else +/* these tokens work for every other platform */ +#define COLON ':' +#define COMMA ',' +#define DELIMS ":," +#endif + +static int cb_config_list_lex(void) +{ + int slen; + + if (*token_ptr == '\0') + return AGG_EOS; + + slen = (int) strcspn(token_ptr, DELIMS); + + if (*token_ptr == COLON) { + token_ptr++; + return AGG_COLON; + } + if (*token_ptr == COMMA) { + token_ptr++; + return AGG_COMMA; + } + + if (*token_ptr == '*') { + /* make sure that we don't have characters after the '*' */ + if (slen == 1) { + token_ptr++; + return AGG_WILDCARD; + } else + return AGG_ERROR; + } + + /* last case: some kind of string. for now we copy the string. */ + + /* it would be a good idea to look at the string and make sure that + * it doesn't have any illegal characters in it. in particular we + * should ensure that no one tries to use wildcards with strings + * (e.g. "ccn*"). + */ + ADIOI_Strncpy(yylval, token_ptr, slen); + yylval[slen] = '\0'; + token_ptr += slen; + return AGG_STRING; +} diff --git a/3rd-party/romio341/adio/common/eof_offset.c b/3rd-party/romio341/adio/common/eof_offset.c new file mode 100644 index 0000000000000000000000000000000000000000..e2ace70a5d16f1b0b153c0718c4da8064d08ac73 --- /dev/null +++ b/3rd-party/romio341/adio/common/eof_offset.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +/* return the current end of file in etype units relative to the + current view */ + +void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset * eof_offset) +{ + MPI_Count filetype_size; + int error_code, filetype_is_contig; + ADIO_Offset fsize, disp, sum = 0, size_in_file, n_filetypes, rem, etype_size; + int flag, i; + ADIO_Fcntl_t *fcntl_struct; + MPI_Aint lb, filetype_extent; + ADIOI_Flatlist_node *flat_file; + + /* find the eof in bytes */ + fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code); + fsize = fcntl_struct->fsize; + ADIOI_Free(fcntl_struct); + + /* Find the offset in etype units corresponding to eof. + * The eof could lie in a hole in the current view, or in the + * middle of an etype. In that case the offset will be the offset + * corresponding to the start of the next etype in the current view. */ + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + etype_size = fd->etype_size; + + if (filetype_is_contig) + *eof_offset = (fsize - fd->disp + etype_size - 1) / etype_size; + /* ceiling division in case fsize is not a multiple of etype_size; */ + else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + MPI_Type_size_x(fd->filetype, &filetype_size); + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + + disp = fd->disp; + n_filetypes = -1; + flag = 0; + while (!flag) { + sum = 0; + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + flat_file->blocklens[i] >= fsize) { + if (disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent >= fsize) + sum -= flat_file->blocklens[i]; + else { + rem = (disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + flat_file->blocklens[i] - fsize); + sum -= rem; + } + flag = 1; + break; + } + } + } + size_in_file = n_filetypes * (ADIO_Offset) filetype_size + sum; + *eof_offset = (size_in_file + etype_size - 1) / etype_size; /* ceiling division */ + } +} diff --git a/3rd-party/romio341/adio/common/error.c b/3rd-party/romio341/adio/common/error.c new file mode 100644 index 0000000000000000000000000000000000000000..35f555d25737a0b71fa9c8854fe36528c12aafb4 --- /dev/null +++ b/3rd-party/romio341/adio/common/error.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +/* Check for special error codes for those MPI error + classes that relate to particular problems. + Returns an MPI error code corresponding to "my_errno", for function "myname" + * and the given file, "filename". */ +int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno) +{ + int error_code = MPI_SUCCESS; + if (!my_errno) + return MPI_SUCCESS; + + /* --BEGIN ERROR HANDLING-- */ + switch (my_errno) { + case EACCES: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ACCESS, + "**fileaccess", "**fileaccess %s", filename); + break; + case ENAMETOOLONG: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_BAD_FILE, + "**filenamelong", + "**filenamelong %s %d", filename, strlen(filename)); + break; + case ENOENT: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filenoexist", "**filenoexist %s", filename); + break; + case EISDIR: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_BAD_FILE, + "**filenamedir", "**filenamedir %s", filename); + break; + case EROFS: + /* Read only file or file system and write access requested */ + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_READ_ONLY, "**ioneedrd", 0); + break; + case EEXIST: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_FILE_EXISTS, "**fileexist", 0); + break; + case ENOTDIR: + case ELOOP: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_BAD_FILE, + "**filenamedir", "**filenamedir %s", filename); + break; + case ENOSPC: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_NO_SPACE, "**filenospace", 0); + break; + case EDQUOT: + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_QUOTA, "**filequota", 0); + break; + default: + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(my_errno)); + break; + } + /* --END ERROR HANDLING-- */ + + return error_code; +} diff --git a/3rd-party/romio341/adio/common/flatten.c b/3rd-party/romio341/adio/common/flatten.c new file mode 100644 index 0000000000000000000000000000000000000000..99225d80fde2fdcee5dcb79b7e4957c3c0f2ae55 --- /dev/null +++ b/3rd-party/romio341/adio/common/flatten.c @@ -0,0 +1,1275 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +#ifdef MPL_USE_DBG_LOGGING +#define FLATTEN_DEBUG 1 +#endif + +static ADIOI_Flatlist_node *flatlist_node_new(MPI_Datatype datatype, MPI_Count count) +{ + ADIOI_Flatlist_node *flat; + flat = ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); + + flat->type = datatype; + flat->blocklens = NULL; + flat->indices = NULL; + flat->lb_idx = flat->ub_idx = -1; + flat->refct = 1; + flat->count = count; + flat->flag = 0; + + flat->blocklens = (ADIO_Offset *) ADIOI_Calloc(flat->count * 2, sizeof(ADIO_Offset)); + flat->indices = flat->blocklens + flat->count; + return flat; +} + +/* + * I don't really expect this to ever trigger, but without the below safety + * valve, the design relies on the Count function coming out >= whatever + * the Flatten function comes up with. There are enough differences between + * the two that it's hard to be positive this will always be true. So every + * time something's added to flat's arrays, let's make sure they're big enough + * and re-alloc if not. + */ +static void flatlist_node_grow(ADIOI_Flatlist_node * flat, int idx) +{ + if (idx >= flat->count) { + ADIO_Offset *new_blocklens; + ADIO_Offset *new_indices; + int new_count = (flat->count * 1.25 + 4); + new_blocklens = (ADIO_Offset *) ADIOI_Calloc(new_count * 2, sizeof(ADIO_Offset)); + new_indices = new_blocklens + new_count; + if (flat->count) { + memcpy(new_blocklens, flat->blocklens, flat->count * sizeof(ADIO_Offset)); + memcpy(new_indices, flat->indices, flat->count * sizeof(ADIO_Offset)); + ADIOI_Free(flat->blocklens); + } + flat->blocklens = new_blocklens; + flat->indices = new_indices; + flat->count = new_count; + } +} + +void ADIOI_Optimize_flattened(ADIOI_Flatlist_node * flat_type); +/* flatten datatype and add it to Flatlist */ +ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype datatype) +{ + MPI_Count flat_count, curr_index = 0; + int is_contig, flag; + ADIOI_Flatlist_node *flat; + + if (ADIOI_Flattened_type_keyval == MPI_KEYVAL_INVALID) { + /* ADIOI_End_call will take care of cleanup */ + MPI_Type_create_keyval(ADIOI_Flattened_type_copy, + ADIOI_Flattened_type_delete, &ADIOI_Flattened_type_keyval, NULL); + } + + /* check if necessary to flatten. */ + + /* has it already been flattened? */ + MPI_Type_get_attr(datatype, ADIOI_Flattened_type_keyval, &flat, &flag); + if (flag) { +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten_datatype:: found datatype %#X\n", datatype); +#endif + return flat; + } + + /* is it entirely contiguous? */ + ADIOI_Datatype_iscontig(datatype, &is_contig); + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten_datatype:: is_contig %#X\n", is_contig); +#endif + /* it would be great if ADIOI_Count_contiguous_blocks and the rest of the + * flattening code operated on the built-in named types, but + * it recursively processes types, stopping when it hits a named type. So + * we will do the little bit of work that named types require right here, + * and avoid touching the scary flattening code. */ + + if (is_contig) + flat_count = 1; + else { + flat_count = ADIOI_Count_contiguous_blocks(datatype, &curr_index); + } + /* flatten and add to datatype */ + flat = flatlist_node_new(datatype, flat_count); + if (is_contig) { + MPI_Type_size_x(datatype, &(flat->blocklens[0])); + flat->indices[0] = 0; + } else { + + curr_index = 0; + ADIOI_Flatten(datatype, flat, 0, &curr_index); +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten_datatype:: ADIOI_Flatten\n"); +#endif + +/* + * Setting flat->count to curr_index, since curr_index is the most fundamentally + * correct updated value that represents what's in the indices/blocklens arrays. + * It would be nice if the counter function and the flatten function were in sync, + * but the numerous cases that decrement flat->count in the flatten function show + * that syncing them is a hack, and as long as the counter doesn't under-count + * it's good enough. + */ + flat->count = curr_index; + + ADIOI_Optimize_flattened(flat); +/* debug */ +#ifdef FLATTEN_DEBUG + { + int i; + for (i = 0; i < flat->count; i++) + DBG_FPRINTF(stderr, + "ADIOI_Flatten_datatype:: i %#X, blocklens %#llX, indices %#llX\n", i, + flat->blocklens[i], flat->indices[i] +); + } +#endif + } + MPI_Type_set_attr(datatype, ADIOI_Flattened_type_keyval, flat); + return flat; + +} + +/* ADIOI_Flatten() + * + * Assumption: input datatype is not a basic!!!! + */ +void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node * flat, + ADIO_Offset st_offset, MPI_Count * curr_index) +{ + int k, m, n, is_hindexed_block = 0; + int lb_updated = 0; + int combiner, old_combiner, old_is_contig; + int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset top_count; + MPI_Count i, j, old_size, prev_index, basic_num, num, nonzeroth; + MPI_Aint lb, old_extent; /* Assume extents are non-negative */ + int *ints; + MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ + MPI_Datatype *types; + MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); + ints = (int *) ADIOI_Malloc((nints + 1) * sizeof(int)); + adds = (MPI_Aint *) ADIOI_Malloc((nadds + 1) * sizeof(MPI_Aint)); + types = (MPI_Datatype *) ADIOI_Malloc((ntypes + 1) * sizeof(MPI_Datatype)); + MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: st_offset %#llX, curr_index %#llX\n", st_offset, + *curr_index); + DBG_FPRINTF(stderr, "ADIOI_Flatten:: nints %#X, nadds %#X, ntypes %#X\n", nints, nadds, ntypes); + for (i = 0; i < nints; ++i) { + DBG_FPRINTF(stderr, "ADIOI_Flatten:: ints[%lld]=%#X\n", (long long) i, ints[i]); + } + for (i = 0; i < nadds; ++i) { + DBG_FPRINTF(stderr, "ADIOI_Flatten:: adds[%lld]=" MPI_AINT_FMT_HEX_SPEC "\n", + (long long) i, adds[i]); + } + for (i = 0; i < ntypes; ++i) { + DBG_FPRINTF(stderr, "ADIOI_Flatten:: types[%lld]=%#llX\n", (long long) i, + (unsigned long long) (unsigned long) types[i]); + } +#endif + /* Chapter 4, page 83: when processing datatypes, note this item from the + * standard: + Most datatype constructors have replication count or block length + arguments. Allowed values are non-negative integers. If the value is + zero, no elements are generated in the type map and there is no effect + on datatype bounds or extent. */ + + switch (combiner) { +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP + case MPI_COMBINER_DUP: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_DUP\n"); +#endif + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + ADIOI_Flatten(types[0], flat, st_offset, curr_index); + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY + case MPI_COMBINER_SUBARRAY: + { + int dims = ints[0]; + MPI_Datatype stype; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_SUBARRAY\n"); +#endif + + ADIO_Type_create_subarray(dims, &ints[1], /* sizes */ + &ints[dims + 1], /* subsizes */ + &ints[2 * dims + 1], /* starts */ + ints[3 * dims + 1], /* order */ + types[0], /* type */ + &stype); + ADIOI_Flatten(stype, flat, st_offset, curr_index); + MPI_Type_free(&stype); + } + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY + case MPI_COMBINER_DARRAY: + { + int dims = ints[2]; + MPI_Datatype dtype; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_DARRAY\n"); +#endif + + ADIO_Type_create_darray(ints[0], /* size */ + ints[1], /* rank */ + dims, &ints[3], /* gsizes */ + &ints[dims + 3], /* distribs */ + &ints[2 * dims + 3], /* dargs */ + &ints[3 * dims + 3], /* psizes */ + ints[4 * dims + 3], /* order */ + types[0], &dtype); +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: MPI_COMBINER_DARRAY <ADIOI_Flatten(dtype, flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#llX);\n", + 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); +#endif + ADIOI_Flatten(dtype, flat, st_offset, curr_index); +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: MPI_COMBINER_DARRAY >ADIOI_Flatten(dtype, flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#llX);\n", + 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); +#endif + MPI_Type_free(&dtype); + } + break; +#endif + case MPI_COMBINER_CONTIGUOUS: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_CONTIGUOUS\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + ADIOI_Flatten(types[0], flat, st_offset, curr_index); + + if (prev_index == *curr_index) { +/* simplest case, made up of basic or contiguous types */ + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset; + MPI_Type_size_x(types[0], &old_size); + flat->blocklens[j] = top_count * old_size; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", + j, flat->indices[j], j, flat->blocklens[j]); +#endif + (*curr_index)++; + } else { +/* made up of noncontiguous derived types */ + j = *curr_index; + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated count times */ + MPI_Type_get_extent(types[0], &lb, &old_extent); + for (m = 1; m < top_count; m++) { + for (i = 0; i < num; i++) { + flat->indices[j] = + flat->indices[j - num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: derived flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", + j, flat->indices[j], j, flat->blocklens[j]); +#endif + j++; + } + } + *curr_index = j; + } + break; + + case MPI_COMBINER_VECTOR: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_VECTOR\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + ADIOI_Flatten(types[0], flat, st_offset, curr_index); + + if (prev_index == *curr_index) { +/* simplest case, vector of basic or contiguous types */ + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1], stride = ints[2]; + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset; + MPI_Type_size_x(types[0], &old_size); + flat->blocklens[j] = blocklength * old_size; + for (i = j + 1; i < j + top_count; i++) { + flatlist_node_grow(flat, i); + flat->indices[i] = flat->indices[i - 1] + stride * old_size; + flat->blocklens[i] = flat->blocklens[j]; + } + *curr_index = i; + } else { +/* vector of noncontiguous derived types */ + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1], stride = ints[2]; + + j = *curr_index; + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklen times + and then strided. Replicate the first one. */ + MPI_Type_get_extent(types[0], &lb, &old_extent); + for (m = 1; m < blocklength; m++) { + for (i = 0; i < num; i++) { + flat->indices[j] = + flat->indices[j - num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + +/* Now repeat with strides. */ + num = *curr_index - prev_index; + for (i = 1; i < top_count; i++) { + for (m = 0; m < num; m++) { + flat->indices[j] = + flat->indices[j - num] + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + } + break; + + case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_HVECTOR_INTEGER\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + ADIOI_Flatten(types[0], flat, st_offset, curr_index); + + if (prev_index == *curr_index) { +/* simplest case, vector of basic or contiguous types */ + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1]; + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset; + MPI_Type_size_x(types[0], &old_size); + flat->blocklens[j] = blocklength * old_size; + for (i = j + 1; i < j + top_count; i++) { + flatlist_node_grow(flat, i); + flat->indices[i] = flat->indices[i - 1] + adds[0]; + flat->blocklens[i] = flat->blocklens[j]; + } + *curr_index = i; + } else { +/* vector of noncontiguous derived types */ + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1]; + + j = *curr_index; + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklen times + and then strided. Replicate the first one. */ + MPI_Type_get_extent(types[0], &lb, &old_extent); + for (m = 1; m < blocklength; m++) { + for (i = 0; i < num; i++) { + flat->indices[j] = + flat->indices[j - num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + +/* Now repeat with strides. */ + num = *curr_index - prev_index; + for (i = 1; i < top_count; i++) { + for (m = 0; m < num; m++) { + flatlist_node_grow(flat, j); + flat->indices[j] = flat->indices[j - num] + adds[0]; + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + } + break; + + case MPI_COMBINER_INDEXED: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_INDEXED\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + MPI_Type_get_extent(types[0], &lb, &old_extent); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[top_count + 1]; + ADIOI_Flatten(types[0], flat, + st_offset + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent, + curr_index); + } + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + j = *curr_index; + for (i = j, nonzeroth = i; i < j + top_count; i++) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1 + i - j], stride = ints[top_count + 1 + i - j]; + if (blocklength > 0) { + flat->indices[nonzeroth] = + st_offset + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = + blocklength * ADIOI_AINT_CAST_TO_OFFSET old_extent; + nonzeroth++; + } + } + *curr_index = nonzeroth; + } else { +/* indexed type made up of noncontiguous derived types */ + + j = *curr_index; + num = *curr_index - prev_index; + basic_num = num; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. Replicate the first one. */ + for (m = 1; m < ints[1]; m++) { + for (i = 0, nonzeroth = j; i < num; i++) { + if (flat->blocklens[j - num] > 0) { + flat->indices[nonzeroth] = + flat->indices[nonzeroth - num] + + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = flat->blocklens[nonzeroth - num]; + j++; + nonzeroth++; + } + } + } + *curr_index = j; + +/* Now repeat with strides. */ + for (i = 1; i < top_count; i++) { + num = *curr_index - prev_index; + prev_index = *curr_index; + for (m = 0, nonzeroth = j; m < basic_num; m++) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[top_count + 1 + i] - ints[top_count + i]; + if (flat->blocklens[j - num] > 0) { + flat->indices[nonzeroth] = + flat->indices[j - num] + + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = flat->blocklens[j - num]; + j++; + nonzeroth++; + } + } + *curr_index = j; + for (m = 1; m < ints[1 + i]; m++) { + for (k = 0, nonzeroth = j; k < basic_num; k++) { + if (flat->blocklens[j - basic_num] > 0) { + flat->indices[nonzeroth] = + flat->indices[j - basic_num] + + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = flat->blocklens[j - basic_num]; + j++; + nonzeroth++; + } + } + } + *curr_index = j; + } + } + break; + +#if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK + case MPI_COMBINER_HINDEXED_BLOCK: + is_hindexed_block = 1; + /* deliberate fall-through */ + MPL_FALLTHROUGH; +#endif + case MPI_COMBINER_INDEXED_BLOCK: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_INDEXED_BLOCK\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + MPI_Type_get_extent(types[0], &lb, &old_extent); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[1 + 1]; + if (is_hindexed_block) { + ADIOI_Flatten(types[0], flat, st_offset + adds[0], curr_index); + } else { + ADIOI_Flatten(types[0], flat, + st_offset + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent, + curr_index); + } + } + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + j = *curr_index; + for (i = j; i < j + top_count; i++) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1]; + if (is_hindexed_block) { + flatlist_node_grow(flat, i); + flat->indices[i] = st_offset + adds[i - j]; + } else { + ADIO_Offset stride = ints[1 + 1 + i - j]; + flatlist_node_grow(flat, i); + flat->indices[i] = st_offset + + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; + } + flat->blocklens[i] = blocklength * ADIOI_AINT_CAST_TO_OFFSET old_extent; + } + *curr_index = i; + } else { +/* vector of noncontiguous derived types */ + + j = *curr_index; + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. Replicate the first one. */ + for (m = 1; m < ints[1]; m++) { + for (i = 0; i < num; i++) { + if (is_hindexed_block) { + /* this is the one place the hindexed case uses the + * extent of a type */ + MPI_Type_get_extent(types[0], &lb, &old_extent); + } + flatlist_node_grow(flat, j); + flat->indices[j] = flat->indices[j - num] + + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + +/* Now repeat with strides. */ + num = *curr_index - prev_index; + for (i = 1; i < top_count; i++) { + for (m = 0; m < num; m++) { + if (is_hindexed_block) { + flatlist_node_grow(flat, j); + flat->indices[j] = flat->indices[j - num] + adds[i] - adds[i - 1]; + } else { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[2 + i] - ints[1 + i]; + flatlist_node_grow(flat, j); + flat->indices[j] = flat->indices[j - num] + + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; + } + flat->blocklens[j] = flat->blocklens[j - num]; + j++; + } + } + *curr_index = j; + } + break; + + case MPI_COMBINER_HINDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_HINDEXED_INTEGER\n"); +#endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + ADIOI_Flatten(types[0], flat, st_offset + adds[0], curr_index); + } + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + j = *curr_index; + MPI_Type_size_x(types[0], &old_size); + for (i = j, nonzeroth = j; i < j + top_count; i++) { + if (ints[1 + i - j] > 0) { + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1 + i - j]; + flatlist_node_grow(flat, nonzeroth); + flat->indices[nonzeroth] = st_offset + adds[i - j]; + flat->blocklens[nonzeroth] = blocklength * old_size; + nonzeroth++; + } + } + *curr_index = nonzeroth; + } else { +/* indexed type made up of noncontiguous derived types */ + + j = *curr_index; + num = *curr_index - prev_index; + basic_num = num; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. Replicate the first one. */ + MPI_Type_get_extent(types[0], &lb, &old_extent); + for (m = 1; m < ints[1]; m++) { + for (i = 0, nonzeroth = j; i < num; i++) { + if (flat->blocklens[j - num] > 0) { + flat->indices[nonzeroth] = + flat->indices[j - num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = flat->blocklens[j - num]; + j++; + nonzeroth++; + } + } + } + *curr_index = j; + +/* Now repeat with strides. */ + for (i = 1; i < top_count; i++) { + num = *curr_index - prev_index; + prev_index = *curr_index; + for (m = 0, nonzeroth = j; m < basic_num; m++) { + if (flat->blocklens[j - num] > 0) { + flat->indices[nonzeroth] = + flat->indices[j - num] + adds[i] - adds[i - 1]; + flat->blocklens[nonzeroth] = flat->blocklens[j - num]; + j++; + nonzeroth++; + } + } + *curr_index = j; + for (m = 1; m < ints[1 + i]; m++) { + for (k = 0, nonzeroth = j; k < basic_num; k++) { + if (flat->blocklens[j - basic_num] > 0) { + flat->indices[nonzeroth] = + flat->indices[j - basic_num] + + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[nonzeroth] = flat->blocklens[j - basic_num]; + j++; + nonzeroth++; + } + } + } + *curr_index = j; + } + } + break; + + case MPI_COMBINER_STRUCT: + case MPI_COMBINER_STRUCT_INTEGER: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_STRUCT_INTEGER\n"); +#endif + top_count = ints[0]; + for (n = 0; n < top_count; n++) { + MPI_Type_get_envelope(types[n], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[n], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + ADIOI_Flatten(types[n], flat, st_offset + adds[n], curr_index); + + if (prev_index == *curr_index) { +/* simplest case, current type is basic or contiguous types */ + /* By using ADIO_Offset we preserve +/- sign and + * avoid >2G integer arithmetic problems */ + if (ints[1 + n] > 0 || types[n] == MPI_LB || types[n] == MPI_UB) { + ADIO_Offset blocklength = ints[1 + n]; + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset + adds[n]; + MPI_Type_size_x(types[n], &old_size); + flat->blocklens[j] = blocklength * old_size; + if (types[n] == MPI_LB) + flat->lb_idx = j; + if (types[n] == MPI_UB) + flat->ub_idx = j; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple adds[%#X] " MPI_AINT_FMT_HEX_SPEC + ", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", + n, adds[n], j, flat->indices[j], j, flat->blocklens[j]); +#endif + (*curr_index)++; + } + } else { +/* current type made up of noncontiguous derived types */ + + j = *curr_index; + num = *curr_index - prev_index; + +/* The current type has to be replicated blocklens[n] times */ + MPI_Type_get_extent(types[n], &lb, &old_extent); + for (m = 1; m < ints[1 + n]; m++) { + for (i = 0; i < num; i++) { + flat->indices[j] = + flat->indices[j - num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j - num]; +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple old_extent " MPI_AINT_FMT_HEX_SPEC + ", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", + old_extent, j, flat->indices[j], j, flat->blocklens[j]); +#endif + j++; + } + } + *curr_index = j; + } + } + break; + + case MPI_COMBINER_RESIZED: +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: MPI_COMBINER_RESIZED\n"); +#endif + + /* This is done similar to a type_struct with an lb, datatype, ub */ + + /* handle the Lb */ + j = *curr_index; + /* when we process resized types, we (recursively) process the lower + * bound, the type being resized, then the upper bound. In the + * resized-of-resized case, we might find ourselves updating the upper + * bound based on the inner type, but the lower bound based on the + * upper type. check both lb and ub to prevent mixing updates */ + if (flat->lb_idx == -1 && flat->ub_idx == -1) { + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset + adds[0]; + /* this zero-length blocklens[] element, unlike elsewhere in the + * flattening code, is correct and is used to indicate a lower bound + * marker */ + flat->blocklens[j] = 0; + flat->lb_idx = *curr_index; + lb_updated = 1; + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple adds[%#X] " MPI_AINT_FMT_HEX_SPEC + ", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", 0, + adds[0], j, flat->indices[j], j, flat->blocklens[j]); +#endif + + (*curr_index)++; + } else { + /* skipped over this chunk because something else higher-up in the + * type construction set this for us already */ + st_offset -= adds[0]; + } + + /* handle the datatype */ + + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + ADIOI_Flatten(types[0], flat, st_offset + adds[0], curr_index); + } else { + /* current type is basic or contiguous */ + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset; + MPI_Type_size_x(types[0], &old_size); + flat->blocklens[j] = old_size; + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple adds[%#X] " MPI_AINT_FMT_HEX_SPEC + ", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", 0, + adds[0], j, flat->indices[j], j, flat->blocklens[j]); +#endif + + (*curr_index)++; + } + + /* take care of the extent as a UB */ + /* see note above about mixing updates for why we check lb and ub */ + if ((flat->lb_idx == -1 && flat->ub_idx == -1) || lb_updated) { + j = *curr_index; + flatlist_node_grow(flat, j); + flat->indices[j] = st_offset + adds[0] + adds[1]; + /* again, zero-element ok: an upper-bound marker explicitly set by the + * constructor of this resized type */ + flat->blocklens[j] = 0; + flat->ub_idx = *curr_index; + } else { + /* skipped over this chunk because something else higher-up in the + * type construction set this for us already */ + (*curr_index)--; + } + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, + "ADIOI_Flatten:: simple adds[%#X] " MPI_AINT_FMT_HEX_SPEC + ", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n", 1, adds[1], + j, flat->indices[j], j, flat->blocklens[j]); +#endif + + (*curr_index)++; + + break; + + default: + /* TODO: FIXME (requires changing prototypes to return errors...) */ + DBG_FPRINTF(stderr, "Error: Unsupported datatype passed to ADIOI_Flatten\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + for (i = 0; i < ntypes; i++) { + MPI_Type_get_envelope(types[i], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + if (old_combiner != MPI_COMBINER_NAMED) + MPI_Type_free(types + i); + } + + ADIOI_Free(ints); + ADIOI_Free(adds); + ADIOI_Free(types); + +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr, "ADIOI_Flatten:: return st_offset %#llX, curr_index %#llX\n", st_offset, + *curr_index); +#endif + +} + +/********************************************************/ + +/* ADIOI_Count_contiguous_blocks + * + * Returns number of contiguous blocks in type, and also updates + * curr_index to reflect the space for the additional blocks. + * + * ASSUMES THAT TYPE IS NOT A BASIC!!! + */ +MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, MPI_Count * curr_index) +{ + int i, n; + MPI_Count count = 0, prev_index, num, basic_num; + int top_count, combiner, old_combiner, old_is_contig; + int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; + int *ints; + MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ + MPI_Datatype *types; + + MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); + ints = (int *) ADIOI_Malloc((nints + 1) * sizeof(int)); + adds = (MPI_Aint *) ADIOI_Malloc((nadds + 1) * sizeof(MPI_Aint)); + types = (MPI_Datatype *) ADIOI_Malloc((ntypes + 1) * sizeof(MPI_Datatype)); + MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); + + switch (combiner) { +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP + case MPI_COMBINER_DUP: + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else { + count = 1; + (*curr_index)++; + } + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY + case MPI_COMBINER_SUBARRAY: + { + int dims = ints[0]; + MPI_Datatype stype; + + ADIO_Type_create_subarray(dims, &ints[1], /* sizes */ + &ints[dims + 1], /* subsizes */ + &ints[2 * dims + 1], /* starts */ + ints[3 * dims + 1], /* order */ + types[0], /* type */ + &stype); + count = ADIOI_Count_contiguous_blocks(stype, curr_index); + /* curr_index will have already been updated; just pass + * count back up. + */ + MPI_Type_free(&stype); + + } + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY + case MPI_COMBINER_DARRAY: + { + int dims = ints[2]; + MPI_Datatype dtype; + + ADIO_Type_create_darray(ints[0], /* size */ + ints[1], /* rank */ + dims, &ints[3], /* gsizes */ + &ints[dims + 3], /* distribs */ + &ints[2 * dims + 3], /* dargs */ + &ints[3 * dims + 3], /* psizes */ + ints[4 * dims + 3], /* order */ + types[0], &dtype); + count = ADIOI_Count_contiguous_blocks(dtype, curr_index); + /* curr_index will have already been updated; just pass + * count back up. + */ + MPI_Type_free(&dtype); + } + break; +#endif + case MPI_COMBINER_CONTIGUOUS: + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else + count = 1; + + if (prev_index == *curr_index) +/* simplest case, made up of basic or contiguous types */ + (*curr_index)++; + else { +/* made up of noncontiguous derived types */ + num = *curr_index - prev_index; + count *= top_count; + *curr_index += (top_count - 1) * num; + } + break; + + case MPI_COMBINER_VECTOR: + case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else + count = 1; + + if (prev_index == *curr_index) { +/* simplest case, vector of basic or contiguous types */ + count = top_count; + *curr_index += count; + } else { +/* vector of noncontiguous derived types */ + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklen times + and then strided. */ + count *= ints[1] * top_count; + +/* First one */ + *curr_index += (ints[1] - 1) * num; + +/* Now repeat with strides. */ + num = *curr_index - prev_index; + *curr_index += (top_count - 1) * num; + } + break; + + case MPI_COMBINER_INDEXED: + case MPI_COMBINER_HINDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else + count = 1; + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + count = top_count; + *curr_index += count; + } else { +/* indexed type made up of noncontiguous derived types */ + basic_num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. */ + *curr_index += (ints[1] - 1) * basic_num; + count *= ints[1]; + +/* Now repeat with strides. */ + for (i = 1; i < top_count; i++) { + count += ints[1 + i] * basic_num; + *curr_index += ints[1 + i] * basic_num; + } + } + break; + +#if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK + case MPI_COMBINER_HINDEXED_BLOCK: +#endif + case MPI_COMBINER_INDEXED_BLOCK: + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else + count = 1; + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + count = top_count; + *curr_index += count; + } else { +/* indexed type made up of noncontiguous derived types */ + basic_num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. */ + *curr_index += (ints[1] - 1) * basic_num; + count *= ints[1]; + +/* Now repeat with strides. */ + *curr_index += (top_count - 1) * count; + count *= top_count; + } + break; + + case MPI_COMBINER_STRUCT: + case MPI_COMBINER_STRUCT_INTEGER: + top_count = ints[0]; + count = 0; + for (n = 0; n < top_count; n++) { + MPI_Type_get_envelope(types[n], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[n], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count += ADIOI_Count_contiguous_blocks(types[n], curr_index); + + if (prev_index == *curr_index) { +/* simplest case, current type is basic or contiguous types */ + count++; + (*curr_index)++; + } else { +/* current type made up of noncontiguous derived types */ +/* The current type has to be replicated blocklens[n] times */ + + num = *curr_index - prev_index; + count += (ints[1 + n] - 1) * num; + (*curr_index) += (ints[1 + n] - 1) * num; + } + } + break; + + case MPI_COMBINER_RESIZED: + /* treat it as a struct with lb, type, ub */ + + /* add 2 for lb and ub */ + (*curr_index) += 2; + count += 2; + + /* add for datatype */ + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + count += ADIOI_Count_contiguous_blocks(types[0], curr_index); + } else { + /* basic or contiguous type */ + count++; + (*curr_index)++; + } + break; + + default: + /* TODO: FIXME */ + DBG_FPRINTF(stderr, + "Error: Unsupported datatype passed to ADIOI_Count_contiguous_blocks, combiner = %d\n", + combiner); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + for (i = 0; i < ntypes; i++) { + MPI_Type_get_envelope(types[i], &old_nints, &old_nadds, &old_ntypes, &old_combiner); + if (old_combiner != MPI_COMBINER_NAMED) + MPI_Type_free(types + i); + } + + ADIOI_Free(ints); + ADIOI_Free(adds); + ADIOI_Free(types); + return count; +} + + +/****************************************************************/ + +/* ADIOI_Optimize_flattened() + * + * Scans the blocks of a flattened type and merges adjacent blocks + * together, resulting in a shorter blocklist (and thus fewer + * contiguous operations). + * + * NOTE: a further optimization would be to remove zero length blocks. However, + * the first and last blocks must remain as zero length first or last block + * indicates UB and LB. Furthermore, once the "zero length blocklen" fix + * went in, the flattened representation should no longer have zero-length + * blocks except for UB and LB markers. + */ +void ADIOI_Optimize_flattened(ADIOI_Flatlist_node * flat_type) +{ + int i, j, opt_blocks; + ADIO_Offset *opt_blocklens; + ADIO_Offset *opt_indices; + + opt_blocks = 1; + + for (j = -1, i = 0; i < flat_type->count; i++) { + /* save number of noncontiguous blocks in opt_blocks */ + if (i < flat_type->count - 1 && + (flat_type->indices[i] + flat_type->blocklens[i] != flat_type->indices[i + 1])) + opt_blocks++; + + /* Check if any of the displacements is negative */ + if (flat_type->blocklens[i] > 0 && flat_type->indices[i] < 0) + flat_type->flag |= ADIOI_TYPE_NEGATIVE; + + if (flat_type->blocklens[i] == 0) /* skip zero-length block */ + continue; + else if (j == -1) { + j = i; /* set j the first non-zero-length block index */ + continue; + } + + /* Check if displacements are in a monotonic nondecreasing order */ + if (flat_type->indices[j] > flat_type->indices[i]) + flat_type->flag |= ADIOI_TYPE_DECREASE; + + /* Check for overlapping regions */ + if (flat_type->indices[j] + flat_type->blocklens[j] > flat_type->indices[i]) + flat_type->flag |= ADIOI_TYPE_OVERLAP; + + j = i; /* j is the previous non-zero-length block index */ + } + + /* if we can't reduce the number of blocks, quit now */ + if (opt_blocks == flat_type->count) + return; + + opt_blocklens = (ADIO_Offset *) ADIOI_Calloc(opt_blocks * 2, sizeof(ADIO_Offset)); + opt_indices = opt_blocklens + opt_blocks; + + /* fill in new blocklists */ + opt_blocklens[0] = flat_type->blocklens[0]; + opt_indices[0] = flat_type->indices[0]; + j = 0; + for (i = 0; i < (flat_type->count - 1); i++) { + if ((flat_type->indices[i] + flat_type->blocklens[i] == flat_type->indices[i + 1])) + opt_blocklens[j] += flat_type->blocklens[i + 1]; + else { + j++; + opt_indices[j] = flat_type->indices[i + 1]; + opt_blocklens[j] = flat_type->blocklens[i + 1]; + } + } + flat_type->count = opt_blocks; + ADIOI_Free(flat_type->blocklens); + flat_type->blocklens = opt_blocklens; + flat_type->indices = opt_indices; + return; +} + +int ADIOI_Flattened_type_keyval = MPI_KEYVAL_INVALID; + +int ADIOI_Flattened_type_copy(MPI_Datatype oldtype, + int type_keyval, void *extra_state, void *attribute_val_in, + void *attribute_val_out, int *flag) +{ + ADIOI_Flatlist_node *node = (ADIOI_Flatlist_node *) attribute_val_in; + if (node != NULL) + node->refct++; + *(ADIOI_Flatlist_node **) attribute_val_out = node; + *flag = 1; /* attribute copied to new communicator */ + return MPI_SUCCESS; +} + +int ADIOI_Flattened_type_delete(MPI_Datatype datatype, + int type_keyval, void *attribute_val, void *extra_state) +{ + ADIOI_Flatlist_node *node = (ADIOI_Flatlist_node *) attribute_val; + ADIOI_Assert(node != NULL); + node->refct--; + + if (node->refct <= 0) { + ADIOI_Free(node->blocklens); + ADIOI_Free(node); + } + + return MPI_SUCCESS; +} + +ADIOI_Flatlist_node *ADIOI_Flatten_and_find(MPI_Datatype datatype) +{ + ADIOI_Flatlist_node *node; + int flag = 0; + + if (ADIOI_Flattened_type_keyval == MPI_KEYVAL_INVALID) { + /* ADIOI_End_call will take care of cleanup */ + MPI_Type_create_keyval(ADIOI_Flattened_type_copy, + ADIOI_Flattened_type_delete, &ADIOI_Flattened_type_keyval, NULL); + } + + MPI_Type_get_attr(datatype, ADIOI_Flattened_type_keyval, &node, &flag); + if (flag == 0) { + node = ADIOI_Flatten_datatype(datatype); + } + + return node; +} diff --git a/3rd-party/romio341/adio/common/get_fp_posn.c b/3rd-party/romio341/adio/common/get_fp_posn.c new file mode 100644 index 0000000000000000000000000000000000000000..5d728dd157fb1f53cd1e860c460c980e3f1bfea1 --- /dev/null +++ b/3rd-party/romio341/adio/common/get_fp_posn.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "adioi.h" + +/* returns the current position of the individual file pointer + in etype units relative to the current view. */ + +void ADIOI_Get_position(ADIO_File fd, ADIO_Offset * offset) +{ + ADIOI_Flatlist_node *flat_file; + int i, flag; + MPI_Count filetype_size, etype_size; + int filetype_is_contig; + MPI_Aint lb, filetype_extent; + ADIO_Offset disp, byte_offset, sum = 0, size_in_file, n_filetypes, frd_size; + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + etype_size = fd->etype_size; + + if (filetype_is_contig) + *offset = (fd->fp_ind - fd->disp) / etype_size; + else { + flat_file = ADIOI_Flatten_and_find(fd->filetype); + + MPI_Type_size_x(fd->filetype, &filetype_size); + MPI_Type_get_extent(fd->filetype, &lb, &filetype_extent); + + disp = fd->disp; + byte_offset = fd->fp_ind; + n_filetypes = -1; + flag = 0; + while (!flag) { + sum = 0; + n_filetypes++; + for (i = 0; i < flat_file->count; i++) { + sum += flat_file->blocklens[i]; + if (disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + flat_file->blocklens[i] + >= byte_offset) { + frd_size = disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + flat_file->blocklens[i] - byte_offset; + sum -= frd_size; + flag = 1; + break; + } + } + } + size_in_file = n_filetypes * (ADIO_Offset) filetype_size + sum; + *offset = size_in_file / etype_size; + } +} diff --git a/3rd-party/romio341/adio/common/greq_fns.c b/3rd-party/romio341/adio/common/greq_fns.c new file mode 100644 index 0000000000000000000000000000000000000000..f3c8c56ae159255f109e09239a650a03df0f497f --- /dev/null +++ b/3rd-party/romio341/adio/common/greq_fns.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "mpiu_greq.h" + +/* In cases where nonblocking operation will carry out blocking version, + * instantiate and complete a generalized request */ + +void MPIO_Completed_request_create(MPI_File * fh, MPI_Offset bytes, + int *error_code, MPI_Request * request) +{ + MPI_Status *status; + status = (MPI_Status *) ADIOI_Malloc(sizeof(MPI_Status)); + + status->MPI_ERROR = *error_code; +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, MPI_BYTE, bytes); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (*error_code != MPI_SUCCESS) + *error_code = MPIO_Err_return_file(*fh, *error_code); + /* --END ERROR HANDLING-- */ + MPI_Grequest_start(MPIU_Greq_query_fn, MPIU_Greq_free_fn, MPIU_Greq_cancel_fn, status, request); + MPI_Grequest_complete(*request); +} diff --git a/3rd-party/romio341/adio/common/heap_sort.c b/3rd-party/romio341/adio/common/heap_sort.c new file mode 100644 index 0000000000000000000000000000000000000000..11274514911b7a2e7deb718fb4fb80e28204bea7 --- /dev/null +++ b/3rd-party/romio341/adio/common/heap_sort.c @@ -0,0 +1,138 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "heap_sort.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#define NOEXP2 + +static void heapify(heap_t * heap, int i); + +/* From Introduction To Algorithms by Cormen, Leiserson, and Rivest */ + +static inline int parent(int i) +{ + return (i / 2); +} + +static inline int left(int i) +{ + return (2 * i); +} + +static inline int right(int i) +{ + return (2 * i + 1); +} + +int ADIOI_Heap_create(heap_t * heap, int size) +{ + heap->size = size; + heap->nodes = (heap_node_t *) ADIOI_Calloc(size, sizeof(heap_node_t)); + if (heap->nodes == NULL) + return 1; + else + return 0; +} + +void ADIOI_Heap_free(heap_t * heap) +{ + ADIOI_Free(heap->nodes); +} + +/* should suppress unused warnings on GCC */ +static void build_heap(heap_t * heap) ATTRIBUTE((unused, used)); + +static void build_heap(heap_t * heap) +{ + int i; + for (i = (heap->size / 2 - 1); i >= 0; i--) + heapify(heap, i); +} + +static void heapify(heap_t * heap, int i) +{ + int l, r, smallest; + heap_node_t *nodes; + heap_node_t tmp_node; + + nodes = heap->nodes; + + l = left(i); + r = right(i); + + if ((l <= heap->size) && (nodes[l].offset < nodes[i].offset)) + smallest = l; + else + smallest = i; + + if ((r <= heap->size) && (nodes[r].offset < nodes[smallest].offset)) + smallest = r; + + if (smallest != i) { + tmp_node = nodes[i]; + nodes[i] = nodes[smallest]; + nodes[smallest] = tmp_node; + heapify(heap, smallest); + } +} + +void ADIOI_Heap_insert(heap_t * heap, ADIO_Offset offset, int proc, ADIO_Offset reg_max_len) +{ + heap_node_t *nodes; + int i; + nodes = heap->nodes; + i = ++heap->size - 1; + while ((i > 0) && (nodes[parent(i)].offset > offset)) { + nodes[i] = nodes[parent(i)]; + i = parent(i); + } + nodes[i].offset = offset; + nodes[i].proc = proc; + nodes[i].reg_max_len = reg_max_len; +} + +void ADIOI_Heap_extract_min(heap_t * heap, ADIO_Offset * offset, int *proc, + ADIO_Offset * reg_max_len) +{ + heap_node_t *nodes; + nodes = heap->nodes; + + assert(heap->size > 0); + *offset = nodes[0].offset; + *proc = nodes[0].proc; + *reg_max_len = nodes[0].reg_max_len; + nodes[0] = nodes[heap->size - 1]; + heap->size--; + heapify(heap, 0); +} + +/* should suppress unused warnings on GCC */ +static void print_heap(heap_t * heap) ATTRIBUTE((unused, used)); + +static void print_heap(heap_t * heap) +{ +#ifndef NOEXP2 + int i; + double level = 0; + int next_level_idx = 1; + + printf("heap->size = %d\n", heap->size); + printf("offsets:\n"); + for (i = 0; i < heap->size; i++) { + printf("%lld ", (long long) heap->nodes[i].offset); + + if ((i + 1) == next_level_idx) { + printf("\n"); + next_level_idx += (int) exp2(level + 1); + level++; + } + } + printf("\n"); +#endif +} diff --git a/3rd-party/romio341/adio/common/hint_fns.c b/3rd-party/romio341/adio/common/hint_fns.c new file mode 100644 index 0000000000000000000000000000000000000000..714a4ce5fa76ccb343d4c46a38ec7f83de82f883 --- /dev/null +++ b/3rd-party/romio341/adio/common/hint_fns.c @@ -0,0 +1,166 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "hint_fns.h" + + +int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code) +{ + int intval, tmp_val, flag, ret = 0; + char *value; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (value == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + funcname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return -1; + } + + ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + intval = atoi(value); + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, key, error_code); + ret = -1; + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(fd->info, key, value); + /* some file systems do not cache hints in the fd struct */ + if (local_cache != NULL) + *local_cache = intval; + } + fn_exit: + ADIOI_Free(value); + return ret; +} + +int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code) +{ + int tmp_val, flag, ret = 0; + char *value; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (value == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + funcname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return -1; + } + + ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(fd->info, key, value); + *local_cache = ADIOI_HINT_ENABLE; + } else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(fd->info, key, value); + *local_cache = ADIOI_HINT_DISABLE; + } else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) { + ADIOI_Info_set(fd->info, key, value); + *local_cache = ADIOI_HINT_AUTO; + } + + tmp_val = *local_cache; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != *local_cache) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, key, error_code); + ret = -1; + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + } + fn_exit: + ADIOI_Free(value); + return ret; +} + +int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code) +{ + int flag, tmp_val, ret = 0; + char *value; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (value == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + funcname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return -1; + } + + ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if (!strcmp(value, "true") || !strcmp(value, "TRUE")) { + ADIOI_Info_set(fd->info, key, value); + *local_cache = 1; + } else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) { + ADIOI_Info_set(fd->info, key, value); + *local_cache = 0; + } + tmp_val = *local_cache; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != *local_cache) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname, key, error_code); + ret = -1; + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + } + fn_exit: + ADIOI_Free(value); + return ret; +} + +int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key, + char **local_cache, char *funcname, int *error_code) +{ + int flag, ret = 0; + size_t len; + char *value; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char)); + if (value == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + funcname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + return -1; + } + + ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + ADIOI_Info_set(fd->info, key, value); + len = (strlen(value) + 1) * sizeof(char); + *local_cache = ADIOI_Malloc(len); + if (*local_cache == NULL) { + *error_code = MPIO_Err_create_code(*error_code, + MPIR_ERR_RECOVERABLE, + funcname, __LINE__, MPI_ERR_OTHER, "**nomem2", 0); + ret = -1; + goto fn_exit; + } + ADIOI_Strncpy(*local_cache, value, len); + } + /* if it has been set already, we ignore it the second time. + * otherwise we would get an error if someone used the same + * info value with a cb_config_list value in it in a couple + * of calls, which would be irritating. */ + fn_exit: + ADIOI_Free(value); + return ret; +} diff --git a/3rd-party/romio321/adio/common/iscontig.c b/3rd-party/romio341/adio/common/iscontig.c similarity index 62% rename from 3rd-party/romio321/adio/common/iscontig.c rename to 3rd-party/romio341/adio/common/iscontig.c index 3c8aa712f4e0f4b6770723b148df0a41c929b34c..241a9cfdb17e0aa04d5dd3b05d3dc9b793dfa8e0 100644 --- a/3rd-party/romio321/adio/common/iscontig.c +++ b/3rd-party/romio341/adio/common/iscontig.c @@ -1,13 +1,9 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" -/* #ifdef MPISGI -#include "mpisgi2.h" -#endif */ #if defined(MPICH) /* MPICH also provides this routine */ @@ -45,8 +41,8 @@ int MPI_SGI_type_is_contig(MPI_Datatype datatype); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) { - MPI_Aint displacement; - MPI_Type_lb(datatype, &distplacement); + MPI_Aint displacement, extent; + MPI_Type_get_extent(datatype, &distplacement, &extent); /* SGI's MPI_SGI_type_is_contig() returns true for indexed * datatypes with holes at the beginning, which causes @@ -72,34 +68,30 @@ void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); switch (combiner) { - case MPI_COMBINER_NAMED: - *flag = 1; - break; - case MPI_COMBINER_CONTIGUOUS: - ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int)); - adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint)); - types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype)); - MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, - adds, types); - ADIOI_Datatype_iscontig(types[0], flag); - -#ifndef MPISGI -/* There is a bug in SGI's impl. of MPI_Type_get_contents. It doesn't - return new datatypes. Therefore no need to free. */ - MPI_Type_get_envelope(types[0], &ni, &na, &nt, &cb); - if (cb != MPI_COMBINER_NAMED) MPI_Type_free(types); -#endif - - ADIOI_Free(ints); - ADIOI_Free(adds); - ADIOI_Free(types); - break; - default: - *flag = 0; - break; + case MPI_COMBINER_NAMED: + *flag = 1; + break; + case MPI_COMBINER_CONTIGUOUS: + ints = (int *) ADIOI_Malloc((nints + 1) * sizeof(int)); + adds = (MPI_Aint *) ADIOI_Malloc((nadds + 1) * sizeof(MPI_Aint)); + types = (MPI_Datatype *) ADIOI_Malloc((ntypes + 1) * sizeof(MPI_Datatype)); + MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); + ADIOI_Datatype_iscontig(types[0], flag); + + MPI_Type_get_envelope(types[0], &ni, &na, &nt, &cb); + if (cb != MPI_COMBINER_NAMED) + MPI_Type_free(types); + + ADIOI_Free(ints); + ADIOI_Free(adds); + ADIOI_Free(types); + break; + default: + *flag = 0; + break; } - /* This function needs more work. It should check for contiguity - in other cases as well.*/ + /* This function needs more work. It should check for contiguity + * in other cases as well. */ } #endif diff --git a/3rd-party/romio341/adio/common/lock.c b/3rd-party/romio341/adio/common/lock.c new file mode 100644 index 0000000000000000000000000000000000000000..46213e161debd1c88b32663bda78d4a77eaf4ff9 --- /dev/null +++ b/3rd-party/romio341/adio/common/lock.c @@ -0,0 +1,198 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "lock_internal.h" + +#ifdef ROMIO_NTFS +/* This assumes that lock will always remain in the common directory and + * that the ntfs directory will always be called ad_ntfs. */ +#include "..\ad_ntfs\ad_ntfs.h" +int ADIOI_GEN_SetLock(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len) +{ + static char myname[] = "ADIOI_GEN_SetLock"; + FDTYPE fd_sys = fd->fd_sys; + int ret_val, error_code = MPI_SUCCESS; + OVERLAPPED Overlapped; + DWORD dwFlags; + + MPL_UNREFERENCED_ARG(whence); + + if (len == 0) + return MPI_SUCCESS; + + dwFlags = type; + + Overlapped.hEvent = /*0; */ CreateEvent(NULL, TRUE, FALSE, NULL); +#ifdef HAVE_INT64 + Overlapped.Offset = ((DWORD) (offset & (__int64) 0xFFFFFFFF)); + Overlapped.OffsetHigh = ((DWORD) ((offset >> 32) & (__int64) 0xFFFFFFFF)); + + if (cmd == ADIOI_LOCK_CMD) { + /*printf("locking %d\n", (int)fd);fflush(stdout); */ + ret_val = LockFileEx(fd_sys, dwFlags, 0, + ((DWORD) (len & (__int64) 0xFFFFFFFF)), + ((DWORD) ((len >> 32) & (__int64) 0xFFFFFFFF)), &Overlapped); + } else { + /*printf("unlocking %d\n", (int)fd);fflush(stdout); */ + ret_val = UnlockFileEx(fd_sys, 0, + ((DWORD) (len & (__int64) 0xFFFFFFFF)), + ((DWORD) ((len >> 32) & (__int64) 0xFFFFFFFF)), &Overlapped); + } +#else + Overlapped.Offset = offset; + Overlapped.OffsetHigh = 0; + + if (cmd == ADIOI_LOCK_CMD) { + /*printf("locking %d\n", (int)fd);fflush(stdout); */ + ret_val = LockFileEx(fd_sys, dwFlags, 0, len, 0, &Overlapped); + } else { + /*printf("unlocking %d\n", (int)fd);fflush(stdout); */ + ret_val = UnlockFileEx(fd_sys, 0, len, 0, &Overlapped); + } +#endif + + if (!ret_val) { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + /* + * FPRINTF(stderr, "File locking failed in ADIOI_GEN_SetLock.\n"); + * MPI_Abort(MPI_COMM_WORLD, 1); + */ + ret_val = GetLastError(); + if (ret_val == ERROR_IO_PENDING) { + DWORD dummy; + ret_val = GetOverlappedResult(fd_sys, &Overlapped, &dummy, TRUE); + if (ret_val) { + CloseHandle(Overlapped.hEvent); + return MPI_SUCCESS; + } + ret_val = GetLastError(); + } + ADIOI_NTFS_Strerror(ret_val, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", errMsg); + } + CloseHandle(Overlapped.hEvent); + + return error_code; +} +#else +int ADIOI_GEN_SetLock(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len) +{ + FDTYPE fd_sys = fd->fd_sys; + int err, error_code, err_count = 0, sav_errno; + struct flock lock; + + if (len == 0) + return MPI_SUCCESS; + + + /* Depending on the compiler flags and options, struct flock + * may not be defined with types that are the same size as + * ADIO_Offsets. */ +/* FIXME: This is a temporary hack until we use flock64 where + available. It also doesn't fix the broken Solaris header sys/types.h + header file, which declars off_t as a UNION ! Configure tests to + see if the off64_t is a union if large file support is requested; + if so, it does not select large file support. +*/ +#ifdef NEEDS_INT_CAST_WITH_FLOCK + lock.l_type = type; + lock.l_start = (int) offset; + lock.l_whence = whence; + lock.l_len = (int) len; +#else + lock.l_type = type; + lock.l_whence = whence; + lock.l_start = offset; + lock.l_len = len; +#endif + + sav_errno = errno; /* save previous errno in case we recover from retryable errors */ + errno = 0; + do { + err = fcntl(fd_sys, cmd, &lock); +#ifdef MPL_USE_DBG_LOGGING +/* if (MPL_DBG_SELECTED(ROMIO,TERSE)) */ + { + if (err && ((errno == EINTR) || (errno == EINPROGRESS))) { + if ((err_count < 5) || (err_count > 9995)) { + fprintf(stderr, + "File locking failed in ADIOI_GEN_SetLock(fd %#X,cmd %s/%#X,type %s/%#X,whence %#X) with return value %#X and errno %#X. Retry (%d).\n", + fd_sys, ADIOI_GEN_flock_cmd_to_string(cmd), cmd, + ADIOI_GEN_flock_type_to_string(type), type, whence, err, errno, + err_count); + perror("ADIOI_GEN_SetLock:"); + fprintf(stderr, "ADIOI_GEN_SetLock:offset %#llx, length %#llx\n", + (unsigned long long) offset, (unsigned long long) len); + } + } + } +#endif + } while (err && ((errno == EINTR) || ((errno == EINPROGRESS) && (++err_count < 10000)))); + + if (err && (errno != EBADF)) { + /* FIXME: This should use the error message system, + * especially for MPICH */ + FPRINTF(stderr, + "This requires fcntl(2) to be implemented. As of 8/25/2011 it is not. Generic MPICH Message: File locking failed in ADIOI_GEN_SetLock(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" + "- If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n" + "- If the file system is LUSTRE, ensure that the directory is mounted with the 'flock' option.\n", + fd_sys, ADIOI_GEN_flock_cmd_to_string(cmd), cmd, + ADIOI_GEN_flock_type_to_string(type), type, whence, err, errno); + perror("ADIOI_GEN_SetLock:"); + FPRINTF(stderr, "ADIOI_GEN_SetLock:offset %llu, length %llu\n", (unsigned long long) offset, + (unsigned long long) len); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + if (!err) /* report fcntl failure errno's (EBADF), otherwise */ + errno = sav_errno; /* restore previous errno in case we recovered from retryable errors */ + + error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; + return error_code; +} +#endif + +int ADIOI_GEN_SetLock64(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len) +{ + FDTYPE fd_sys = fd->fd_sys; + int err, error_code; +#ifdef _LARGEFILE64_SOURCE + struct flock64 lock; +#else + struct flock lock; +#endif + + if (len == 0) + return MPI_SUCCESS; + + lock.l_type = type; + lock.l_start = offset; + lock.l_whence = whence; + lock.l_len = len; + + do { + err = fcntl(fd_sys, cmd, &lock); + } while (err && (errno == EINTR)); + + if (err && (errno != EBADF)) { + FPRINTF(stderr, + "File locking failed in ADIOI_GEN_SetLock64(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" + "If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n", + fd_sys, ADIOI_GEN_flock_cmd_to_string(cmd), cmd, + ADIOI_GEN_flock_type_to_string(type), type, whence, err, errno); + perror("ADIOI_GEN_SetLock64:"); + FPRINTF(stderr, "ADIOI_GEN_SetLock:offset %llu, length %llu\n", (unsigned long long) offset, + (unsigned long long) len); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; + return error_code; +} diff --git a/3rd-party/romio341/adio/common/lock_internal.c b/3rd-party/romio341/adio/common/lock_internal.c new file mode 100644 index 0000000000000000000000000000000000000000..f0e229cfb015f3c084c09520489ec35af838eac4 --- /dev/null +++ b/3rd-party/romio341/adio/common/lock_internal.c @@ -0,0 +1,44 @@ +#include "lock_internal.h" + +const char *ADIOI_GEN_flock_cmd_to_string(int cmd) +{ + switch (cmd) { +#ifdef F_GETLK64 + case F_GETLK64: + return "F_GETLK64"; +#else + case F_GETLK: + return "F_GETLK"; +#endif +#ifdef F_SETLK64 + case F_SETLK64: + return "F_SETLK64"; +#else + case F_SETLK: + return "F_SETLK"; +#endif +#ifdef F_SETLKW64 + case F_SETLKW64: + return "F_SETLKW64"; +#else + case F_SETLKW: + return "F_SETLKW"; +#endif + default: + return "UNEXPECTED"; + } +} + +const char *ADIOI_GEN_flock_type_to_string(int type) +{ + switch (type) { + case F_RDLCK: + return "F_RDLCK"; + case F_WRLCK: + return "F_WRLCK"; + case F_UNLCK: + return "F_UNLOCK"; + default: + return "UNEXPECTED"; + } +} diff --git a/3rd-party/romio321/adio/common/malloc.c b/3rd-party/romio341/adio/common/malloc.c similarity index 55% rename from 3rd-party/romio321/adio/common/malloc.c rename to 3rd-party/romio341/adio/common/malloc.c index 73c5a707050c139994af13198d8bb8e7687fa737..c56731f46891014eafbfe429df0c50fb312f81a2 100644 --- a/3rd-party/romio321/adio/common/malloc.c +++ b/3rd-party/romio341/adio/common/malloc.c @@ -1,17 +1,15 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ /* These are routines for allocating and deallocating memory. They should be called as ADIOI_Malloc(size) and - ADIOI_Free(ptr). In adio.h, they are macro-replaced to - ADIOI_Malloc(size,__LINE__,__FILE__) and + ADIOI_Free(ptr). In adio.h, they are macro-replaced to + ADIOI_Malloc(size,__LINE__,__FILE__) and ADIOI_Free(ptr,__LINE__,__FILE__). - Later on, add some tracing and error checking, similar to + Later on, add some tracing and error checking, similar to MPID_trmalloc. */ #include "adio.h" @@ -20,10 +18,6 @@ #include <stdio.h> #include "mpipr.h" -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - /* for the style checker */ /* style: allow:malloc:1 sig:0 */ /* style: allow:free:1 sig:0 */ @@ -44,16 +38,13 @@ void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname) #ifdef ROMIO_XFS new = (void *) memalign(XFS_MEMALIGN, size); #else -#ifdef HAVE_MPIU_FUNCS - new = (void *) MPIU_trmalloc(size, lineno, fname); -#else - new = (void *) malloc(size); -#endif + new = (void *) MPL_malloc(size, MPL_MEM_IO); #endif if (!new && size) { - FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); + MPI_Abort(MPI_COMM_WORLD, 1); } + MPL_VG_MEM_INIT(new, size); DBG_FPRINTF(stderr, "ADIOI_Malloc %s:<%d> %p (%#zX)\n", fname, lineno, new, size); return new; } @@ -63,14 +54,10 @@ void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname { void *new; -#ifdef HAVE_MPIU_FUNCS - new = (void *) MPIU_trcalloc(nelem, elsize, lineno, fname); -#else - new = (void *) calloc(nelem, elsize); -#endif + new = (void *) MPL_calloc(nelem, elsize, MPL_MEM_IO); if (!new && nelem) { - FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); + MPI_Abort(MPI_COMM_WORLD, 1); } DBG_FPRINTF(stderr, "ADIOI_Calloc %s:<%d> %p\n", fname, lineno, new); return new; @@ -81,14 +68,10 @@ void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname) { void *new; -#ifdef HAVE_MPIU_FUNCS - new = (void *) MPIU_trrealloc(ptr, size, lineno, fname); -#else - new = (void *) realloc(ptr, size); -#endif + new = (void *) MPL_realloc(ptr, size, MPL_MEM_IO); if (!new && size) { - FPRINTF(stderr, "realloc failed in file %s, line %d\n", fname, lineno); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "realloc failed in file %s, line %d\n", fname, lineno); + MPI_Abort(MPI_COMM_WORLD, 1); } DBG_FPRINTF(stderr, "ADIOI_Realloc %s:<%d> %p\n", fname, lineno, new); return new; @@ -99,15 +82,9 @@ void ADIOI_Free_fn(void *ptr, int lineno, const char *fname) { DBG_FPRINTF(stderr, "ADIOI_Free %s:<%d> %p\n", fname, lineno, ptr); if (!ptr) { - FPRINTF(stderr, "Attempt to free null pointer in file %s, line %d\n", fname, lineno); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "Attempt to free null pointer in file %s, line %d\n", fname, lineno); + MPI_Abort(MPI_COMM_WORLD, 1); } -#ifdef HAVE_MPIU_FUNCS - MPIU_trfree(ptr, lineno, fname); -#else - free(ptr); -#endif + MPL_free(ptr); } - - diff --git a/3rd-party/romio341/adio/common/onesided_aggregation.c b/3rd-party/romio341/adio/common/onesided_aggregation.c new file mode 100644 index 0000000000000000000000000000000000000000..e2fb5a413d5d2aab6be7d28b7bf91f7dc5092e80 --- /dev/null +++ b/3rd-party/romio341/adio/common/onesided_aggregation.c @@ -0,0 +1,2683 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_tuning.h" +#ifdef ROMIO_GPFS +#include "../ad_gpfs/ad_gpfs_tuning.h" +#endif + + +#include <pthread.h> + +// #define onesidedtrace 1 + +/* This data structure holds the access state of the source buffer for target + * file domains within aggregators corresponding to the target data blocks. It + * is designed to be initialized with a starting point for a given file domain + * with an aggregator, after which the data access for data written to a given + * file domain from this compute is linear and uninterupted, and this serves as + * a key optimization for feeding the target aggs. For contigous source data + * the starting point is a single-value offset, for non-contiguous data it is + * the number of extents, the index into the flattened buffer and the remnant + * length beyond the flattened buffer index. The validity of the usage of this + * structure relies on the requirement that only 1 aggregator can write to a + * given file domain. */ +typedef struct FDSourceBufferState { + + ADIO_Offset indiceOffset; + MPI_Aint bufTypeExtent; + ADIO_Offset dataTypeExtent; + int flatBufIndice; + + ADIO_Offset sourceBufferOffset; + +} FDSourceBufferState; + +static int ADIOI_OneSidedSetup(ADIO_File fd, int procs) +{ + int ret = MPI_SUCCESS; + + ret = MPI_Win_create(fd->io_buf, fd->hints->cb_buffer_size, 1, + MPI_INFO_NULL, fd->comm, &fd->io_buf_window); + if (ret != MPI_SUCCESS) + goto fn_exit; + fd->io_buf_put_amounts = 0; + ret = MPI_Win_create(&(fd->io_buf_put_amounts), sizeof(int), sizeof(int), + MPI_INFO_NULL, fd->comm, &fd->io_buf_put_amounts_window); + + fn_exit: + return ret; +} + +int ADIOI_OneSidedCleanup(ADIO_File fd) +{ + int ret = MPI_SUCCESS; + if (fd->io_buf_window != MPI_WIN_NULL) + ret = MPI_Win_free(&fd->io_buf_window); + if (fd->io_buf_put_amounts_window != MPI_WIN_NULL) + ret = MPI_Win_free(&fd->io_buf_put_amounts_window); + + return ret; +} + +/* This funtion packs a contigous buffer of data from the non-contgious source + * buffer for a specified chunk of data and advances the FDSourceBufferState + * machinery, so subsequent calls with the FDSourceBufferState will return the + * next linear chunk. + * Parameters: + * in: sourceDataBuffer - pointer to source data buffer. + * in: flatBuf - pointer to flattened source data buffer + * in: targetNumBytes - number of bytes to return and advance. + * in: packing - whether data is being packed from the source buffer to the + * packed buffer (1) or unpacked from the packed buffer to the source + * buffer (0) + * in/out: currentFDSourceBufferState - pointer to FDSourceBufferState structure, current + * data used as starting point, will be updated with + * the new state after targetNumBytes advance. + * out: packedDataBufer - pointer to the output packed data buffer. If the + * value is NULL then no data will be written. + * + */ +inline static void nonContigSourceDataBufferAdvance(char *sourceDataBuffer, + ADIOI_Flatlist_node * flatBuf, + int targetNumBytes, int packing, + FDSourceBufferState * + currentFDSourceBufferState, + char *packedDataBufer) +{ + // make currentDataTypeExtent and bufTypeExtent ADIO_Offset since they are + // used in offset calculations + ADIO_Offset currentIndiceOffset = currentFDSourceBufferState->indiceOffset; + ADIO_Offset bufTypeExtent = (ADIO_Offset) currentFDSourceBufferState->bufTypeExtent; + ADIO_Offset currentDataTypeExtent = currentFDSourceBufferState->dataTypeExtent; + int currentFlatBufIndice = currentFDSourceBufferState->flatBufIndice; + + int targetSendDataIndex = 0; + +#ifdef onesidedtrace + printf + ("nonContigSourceDataBufferAdvance: currentFlatBufIndice is %d currentDataTypeExtent is %ld currentIndiceOffset is %ld\n", + currentFlatBufIndice, currentDataTypeExtent, currentIndiceOffset); +#endif + + int remainingBytesToLoad = targetNumBytes; + while (remainingBytesToLoad > 0) { + if ((flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset) >= remainingBytesToLoad) { // we can get the rest of our data from this indice + ADIO_Offset physicalSourceBufferOffset = + (currentDataTypeExtent * bufTypeExtent) + flatBuf->indices[currentFlatBufIndice] + + currentIndiceOffset; + +#ifdef onesidedtrace + printf + ("loading remainingBytesToLoad %d from src buffer offset %ld to targetSendDataIndex %d\n", + remainingBytesToLoad, physicalSourceBufferOffset, targetSendDataIndex); +#endif + + if (packedDataBufer != NULL) { + if (packing) + memcpy(&(packedDataBufer[targetSendDataIndex]), + &(sourceDataBuffer[physicalSourceBufferOffset]), remainingBytesToLoad); + else + memcpy(&(sourceDataBuffer[physicalSourceBufferOffset]), + &(packedDataBufer[targetSendDataIndex]), remainingBytesToLoad); + } + + targetSendDataIndex += remainingBytesToLoad; + currentIndiceOffset += (ADIO_Offset) remainingBytesToLoad; + if (currentIndiceOffset >= flatBuf->blocklens[currentFlatBufIndice]) { + currentIndiceOffset = (ADIO_Offset) 0; + currentFlatBufIndice++; + if (currentFlatBufIndice == flatBuf->count) { + currentFlatBufIndice = 0; + currentDataTypeExtent++; + } + } + remainingBytesToLoad = 0; + + } else { // we can only get part of our data from this indice + int amountDataToLoad = (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); + ADIO_Offset physicalSourceBufferOffset = + (currentDataTypeExtent * bufTypeExtent) + flatBuf->indices[currentFlatBufIndice] + + currentIndiceOffset; + +#ifdef onesidedtrace + printf + ("loading amountDataToLoad %d from src buffer offset %ld to targetSendDataIndex %d\n", + amountDataToLoad, physicalSourceBufferOffset, targetSendDataIndex); +#endif + if (packedDataBufer != NULL) { + if (packing) + memcpy(&(packedDataBufer[targetSendDataIndex]), + &(sourceDataBuffer[physicalSourceBufferOffset]), amountDataToLoad); + else + memcpy(&(sourceDataBuffer[physicalSourceBufferOffset]), + &(packedDataBufer[targetSendDataIndex]), amountDataToLoad); + } + + targetSendDataIndex += amountDataToLoad; + currentIndiceOffset = (ADIO_Offset) 0; + currentFlatBufIndice++; + if (currentFlatBufIndice == flatBuf->count) { + currentFlatBufIndice = 0; + currentDataTypeExtent++; + } + remainingBytesToLoad -= amountDataToLoad; + } + } // while + + /* update machinery with new flatbuf position + */ + currentFDSourceBufferState->indiceOffset = currentIndiceOffset; + currentFDSourceBufferState->dataTypeExtent = currentDataTypeExtent; + currentFDSourceBufferState->flatBufIndice = currentFlatBufIndice; +#ifdef onesidedtrace + printf + ("source buf advanced to currentFlatBufIndice %d currentDataTypeExtent %ld currentIndiceOffset %ld\n", + currentFlatBufIndice, currentDataTypeExtent, currentIndiceOffset); +#endif +} + +/* The ADIOI_OneSidedWriteAggregation algorithm is called once + * for each segment of data, a segment being defined as a contiguous region of the file which + * is the size of one striping unit times the number of aggregators. For lustre the striping unit + * corresponds with the actual file stripe, in the case of gpfs these are file domains. + * Each call effectively packs one striping unit of data into the collective buffer on each agg, + * with additional parameters which govern when to flush the collective buffer to the file. + * Therefore in practice the collective write call for a file system such as + * lustre on a dataset composed of multiple segments would call the algorithm several times without a + * flush parameter to fill the collective buffers with multiple stripes of data, before calling it again to flush + * the collective buffer to the file system. In this fashion the synchronization can be minimized as that + * only needs to occur during the actual read from or write to the file system. In the case of gpfs + * this function is called just once. The ADIOI_OneSidedStripeParms parameter is used to save the + * state and re-use variables thru repetative calls to help in the case of lustre to avoid costly + * recomputation, for consistency gpfs utilizes it as well but doesn't use some aspects of it. This + * function was originally first written for gpfs only and then modified to support lustre. + */ +void ADIOI_OneSidedWriteAggregation(ADIO_File fd, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + const void *buf, + MPI_Datatype datatype, + int *error_code, + ADIO_Offset firstFileOffset, + ADIO_Offset lastFileOffset, + int numNonZeroDataOffsets, + ADIO_Offset * fd_start, + ADIO_Offset * fd_end, + int *hole_found, ADIOI_OneSidedStripeParms * stripe_parms) +{ + int i, j; /* generic iterators */ + +/* make local copy of certain ADIOI_OneSidedStripeParms elements for faster access - + pay for pointer dereference only once. */ + int stripeSize = stripe_parms->stripeSize; + int segmentIter = stripe_parms->segmentIter; + MPI_Aint bufTypeExtent = stripe_parms->bufTypeExtent; + ADIOI_Flatlist_node *flatBuf = stripe_parms->flatBuf; + + if ((stripeSize > 0) && stripe_parms->firstStripedWriteCall) + stripe_parms->iWasUsedStripingAgg = 0; +#ifdef onesidedtrace + if (buf == NULL) { + printf("ADIOI_OneSidedWriteAggregation - buf is NULL contig_access_count is %d\n", + contig_access_count); + for (i = 0; i < contig_access_count; i++) + printf("offset_list[%d] is %ld len_list[%d] is %ld\n", + i, offset_list[i], i, len_list[i]); + } + if (contig_access_count < 0) + printf("ADIOI_OneSidedWriteAggregation - contig_access_count " + "of %d is less than 0\n", contig_access_count); +#endif + + int lenListOverZero = 0; + for (i = 0; ((i < contig_access_count) && (!lenListOverZero)); i++) + if (len_list[i] > 0) + lenListOverZero = 1; + + + *error_code = MPI_SUCCESS; /* initialize to success */ + +#ifdef ROMIO_GPFS + double startTimeBase, endTimeBase; + startTimeBase = MPI_Wtime(); +#endif + + MPI_Status status; + pthread_t io_thread; + void *thread_ret; + ADIOI_IO_ThreadFuncData io_thread_args; + + int nprocs, myrank; + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); +#ifdef onesidedtrace + printf("ADIOI_OneSidedWriteAggregation started on rank %d\n", myrank); +#endif + + /* Initialize to self here to avoid uninitialized warnings. */ + io_thread = pthread_self(); + + if (fd->io_buf_window == MPI_WIN_NULL || fd->io_buf_put_amounts_window == MPI_WIN_NULL) { + ADIOI_OneSidedSetup(fd, nprocs); + } + + /* This flag denotes whether the source datatype is contiguous, which is referenced throughout the algorithm + * and defines how the source buffer offsets and data chunks are determined. If the value is 1 (true - contiguous data) + * things are profoundly simpler in that the source buffer offset for a given target offset simply linearly increases + * by the chunk sizes being written. If the value is 0 (non-contiguous) then these values are based on calculations + * from the flattened source datatype. + */ + int bufTypeIsContig; + + ADIOI_Datatype_iscontig(datatype, &bufTypeIsContig); + + if (!bufTypeIsContig) { + /* Flatten the non-contiguous source datatype and set the extent. */ + if ((stripeSize == 0) || stripe_parms->firstStripedWriteCall) { + MPI_Aint lb; + stripe_parms->flatBuf = ADIOI_Flatten_and_find(datatype); + flatBuf = stripe_parms->flatBuf; + MPI_Type_get_extent(datatype, &lb, &(stripe_parms->bufTypeExtent)); + bufTypeExtent = stripe_parms->bufTypeExtent; + } +#ifdef onesidedtrace + printf("flatBuf->count is %d bufTypeExtent is %ld\n", flatBuf->count, bufTypeExtent); + for (i = 0; i < flatBuf->count; i++) + printf("flatBuf->blocklens[%d] is %d flatBuf->indices[%d] is %ld\n", i, + flatBuf->blocklens[i], i, flatBuf->indices[i]); +#endif + } + + int naggs = fd->hints->cb_nodes; + + /* Track the state of the source buffer for feeding the target data blocks. + * For GPFS the number of file domains per agg is always 1 so we just need 1 agg + * dimension to track the data, in the case of lustre we will need 2 dimensions + * agg and file domain since aggs write to multiple file domains in the case of lustre. + * This structure will be modified as the data is written to reflect the current state + * of the offset. + */ + +#ifdef onesidedtrace + printf("sizeof(FDSourceBufferState) is %d - make sure is 32 for 32-byte memalign optimal\n", + sizeof(FDSourceBufferState)); +#endif + + FDSourceBufferState *currentFDSourceBufferState = + (FDSourceBufferState *) ADIOI_Malloc(naggs * sizeof(FDSourceBufferState)); + + for (i = 0; i < naggs; i++) { + /* initialize based on the bufType to indicate that it is unset. + */ + if (bufTypeIsContig) { + currentFDSourceBufferState[i].sourceBufferOffset = -1; + } else { + currentFDSourceBufferState[i].indiceOffset = -1; + } + } + +#ifdef onesidedtrace + printf(" ADIOI_OneSidedWriteAggregation bufTypeIsContig is %d contig_access_count is %d\n", + bufTypeIsContig, contig_access_count); +#endif + + /* maxNumContigOperations keeps track of how many different chunks we will need to send + * for the purpose of pre-allocating the data structures to hold them. + */ + int maxNumContigOperations = contig_access_count; + + int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ + int iAmUsedAgg = 0; /* whether or not this rank is used as an aggregator. */ + + /* Make coll_bufsize an ADIO_Offset since it is used in calculations with offsets. + */ + ADIO_Offset coll_bufsize = 0; + if (stripeSize == 0) + coll_bufsize = (ADIO_Offset) (fd->hints->cb_buffer_size); + else + coll_bufsize = stripeSize; + +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio == 1) { + /* split buffer in half for a kind of double buffering with the threads */ + coll_bufsize = (ADIO_Offset) (fd->hints->cb_buffer_size / 2); + } +#endif + + /* This logic defines values that are used later to determine what offsets define the portion + * of the file domain the agg is writing this round. + */ + int greatestFileDomainAggRank = -1, smallestFileDomainAggRank = -1; + ADIO_Offset greatestFileDomainOffset = 0; + ADIO_Offset smallestFileDomainOffset = lastFileOffset; + for (j = 0; j < naggs; j++) { + if (fd_end[j] > greatestFileDomainOffset) { + greatestFileDomainOffset = fd_end[j]; + greatestFileDomainAggRank = j; + } + if (fd_start[j] < smallestFileDomainOffset) { + smallestFileDomainOffset = fd_start[j]; + smallestFileDomainAggRank = j; + } + if (fd->hints->ranklist[j] == myrank) { + myAggRank = j; + if (fd_end[j] > fd_start[j]) { + iAmUsedAgg = 1; + stripe_parms->iWasUsedStripingAgg = 1; + } + } + } + +#ifdef onesidedtrace + printf("contig_access_count is %d lastFileOffset is %ld firstFileOffset is %ld\n", + contig_access_count, lastFileOffset, firstFileOffset); + for (j = 0; j < contig_access_count; j++) { + printf("offset_list[%d]: %ld , len_list[%d]: %ld\n", j, offset_list[j], j, len_list[j]); + + } +#endif + + /* Compute number of rounds. + */ + int numberOfRounds = 0; + for (j = 0; j < naggs; j++) { + int currentNumberOfRounds = + (int) (((fd_end[j] - fd_start[j]) + (ADIO_Offset) 1) / coll_bufsize); + if (((ADIO_Offset) currentNumberOfRounds * coll_bufsize) < + ((fd_end[j] - fd_start[j]) + (ADIO_Offset) 1)) + currentNumberOfRounds++; + if (currentNumberOfRounds > numberOfRounds) + numberOfRounds = currentNumberOfRounds; + } + + /* Data structures to track what data this compute needs to send to whom. + * For lustre they will all need another dimension for the file domain. + */ + int *targetAggsForMyData = (int *) ADIOI_Malloc(naggs * sizeof(int)); + ADIO_Offset *targetAggsForMyDataFDStart = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + ADIO_Offset *targetAggsForMyDataFDEnd = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + int numTargetAggs = 0; + + /* This data structure holds the beginning offset and len list index for the range to be written + * coresponding to the round and target agg. Initialize to -1 to denote being unset. + */ + int **targetAggsForMyDataFirstOffLenIndex = + (int **) ADIOI_Malloc(numberOfRounds * sizeof(int *)); + for (i = 0; i < numberOfRounds; i++) { + targetAggsForMyDataFirstOffLenIndex[i] = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (j = 0; j < naggs; j++) + targetAggsForMyDataFirstOffLenIndex[i][j] = -1; + } + + /* This data structure holds the ending offset and len list index for the range to be written + * coresponding to the round and target agg. + */ + int **targetAggsForMyDataLastOffLenIndex = + (int **) ADIOI_Malloc(numberOfRounds * sizeof(int *)); + for (i = 0; i < numberOfRounds; i++) + targetAggsForMyDataLastOffLenIndex[i] = (int *) ADIOI_Malloc(naggs * sizeof(int)); + +#ifdef onesidedtrace + printf("NumberOfRounds is %d\n", numberOfRounds); + for (i = 0; i < naggs; i++) + printf("fd->hints->ranklist[%d]is %d fd_start is %ld fd_end is %ld\n", i, + fd->hints->ranklist[i], fd_start[i], fd_end[i]); + for (j = 0; j < contig_access_count; j++) + printf("offset_list[%d] is %ld len_list is %ld\n", j, offset_list[j], len_list[j]); +#endif + + int currentAggRankListIndex = 0; + int maxNumNonContigSourceChunks = 0; + + ADIO_Offset currentSourceBufferOffset = 0; + ADIO_Offset currentDataTypeExtent = 0; + int currentFlatBufIndice = 0; + ADIO_Offset currentIndiceOffset = 0; + + /* Remember where we left off in the source buffer when packing stripes. */ + if ((stripeSize > 0) && !(stripe_parms->firstStripedWriteCall)) { + currentDataTypeExtent = stripe_parms->lastDataTypeExtent; + currentFlatBufIndice = stripe_parms->lastFlatBufIndice; + currentIndiceOffset = stripe_parms->lastIndiceOffset; +#ifdef onesidedtrace + printf + ("using stripe_parms->lastDataTypeExtent %ld stripe_parms->lastFlatBufIndice %d stripe_parms->lastIndiceOffset %ld\n", + stripe_parms->lastDataTypeExtent, stripe_parms->lastFlatBufIndice, + stripe_parms->lastIndiceOffset); +#endif + } + + /* This denotes the coll_bufsize boundaries within the source buffer for writing for the same round. + */ + ADIO_Offset intraRoundCollBufsizeOffset = 0; + + /* This data structure tracks what target aggs need to be written to on what rounds. + */ + int *targetAggsForMyDataCurrentRoundIter = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (i = 0; i < naggs; i++) + targetAggsForMyDataCurrentRoundIter[i] = 0; + + /* This is the first of the two main loops in this algorithm. The purpose of this loop is essentially to populate + * the data structures defined above for what source data blocks needs to go where (target agg and file domain) and when + * (round iter). For lustre essentially an additional layer of nesting will be required for the multiple file domains + * within the target agg. + */ + if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { + int blockIter; + for (blockIter = 0; blockIter < contig_access_count; blockIter++) { + + /* Determine the starting source buffer offset for this block - for iter 0 skip it since that value is 0. + */ + if (blockIter > 0) { + if (bufTypeIsContig) { + currentSourceBufferOffset += len_list[blockIter - 1]; + } else { + + /* Non-contiguous source datatype, count up the extents and indices to this point + * in the blocks for use in computing the source starting buffer offset for target aggs + * and file domains. + */ + ADIO_Offset sourceBlockTotal = 0; + int lastIndiceUsed = currentFlatBufIndice; + int numNonContigSourceChunks = 0; + + while (sourceBlockTotal < len_list[blockIter - 1]) { + numNonContigSourceChunks++; + sourceBlockTotal += + (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); + lastIndiceUsed = currentFlatBufIndice; + currentFlatBufIndice++; + if (currentFlatBufIndice == flatBuf->count) { + currentFlatBufIndice = 0; + currentDataTypeExtent++; + } + currentIndiceOffset = (ADIO_Offset) 0; + } + if (sourceBlockTotal > len_list[blockIter - 1]) { + currentFlatBufIndice--; + if (currentFlatBufIndice < 0) { + currentDataTypeExtent--; + currentFlatBufIndice = flatBuf->count - 1; + } + currentIndiceOffset = + len_list[blockIter - 1] - (sourceBlockTotal - + flatBuf->blocklens[lastIndiceUsed]); + // ADIOI_Assert((currentIndiceOffset >= 0) && (currentIndiceOffset < flatBuf->blocklens[currentFlatBufIndice])); + } else + currentIndiceOffset = (ADIO_Offset) 0; + maxNumContigOperations += (numNonContigSourceChunks + 2); + if (numNonContigSourceChunks > maxNumNonContigSourceChunks) + maxNumNonContigSourceChunks = numNonContigSourceChunks; + +#ifdef onesidedtrace + printf + ("blockiter %d currentFlatBufIndice is now %d currentDataTypeExtent is now %ld currentIndiceOffset is now %ld maxNumContigOperations is now %d\n", + blockIter, currentFlatBufIndice, currentDataTypeExtent, + currentIndiceOffset, maxNumContigOperations); +#endif + } // !bufTypeIsContig + } // blockIter > 0 + + /* For the last iteration we need to include these maxNumContigOperations and maxNumNonContigSourceChunks + * for non-contig case even though we did not need to compute the next starting offset. + */ + if ((blockIter == (contig_access_count - 1)) && (!bufTypeIsContig)) { + ADIO_Offset sourceBlockTotal = 0; + int tmpCurrentFlatBufIndice = currentFlatBufIndice; + int lastNumNonContigSourceChunks = 0; + while (sourceBlockTotal < len_list[blockIter]) { + lastNumNonContigSourceChunks++; + sourceBlockTotal += flatBuf->blocklens[tmpCurrentFlatBufIndice]; + tmpCurrentFlatBufIndice++; + if (tmpCurrentFlatBufIndice == flatBuf->count) { + tmpCurrentFlatBufIndice = 0; + } + } + maxNumContigOperations += (lastNumNonContigSourceChunks + 2); + if (lastNumNonContigSourceChunks > maxNumNonContigSourceChunks) + maxNumNonContigSourceChunks = lastNumNonContigSourceChunks; + + } + + ADIO_Offset blockStart = offset_list[blockIter], blockEnd = + offset_list[blockIter] + len_list[blockIter] - (ADIO_Offset) 1; + + /* Find the starting target agg for this block - normally it will be the current agg so guard the expensive + * while loop with a cheap if-check which for large numbers of small blocks will usually be false. + */ + if (! + ((blockStart >= fd_start[currentAggRankListIndex]) && + (blockStart <= fd_end[currentAggRankListIndex]))) { + while (! + ((blockStart >= fd_start[currentAggRankListIndex]) && + (blockStart <= fd_end[currentAggRankListIndex]))) + currentAggRankListIndex++; + }; + +#ifdef onesidedtrace + printf + ("currentAggRankListIndex is %d blockStart %ld blockEnd %ld fd_start[currentAggRankListIndex] %ld fd_end[currentAggRankListIndex] %ld\n", + currentAggRankListIndex, blockStart, blockEnd, fd_start[currentAggRankListIndex], + fd_end[currentAggRankListIndex]); +#endif + + /* Determine if this is a new target agg. + */ + if (blockIter > 0) { + if ((offset_list[blockIter - 1] + len_list[blockIter - 1] - (ADIO_Offset) 1) < + fd_start[currentAggRankListIndex]) { + numTargetAggs++; + } + } + + /* Determine which round to start writing - data is written coll_bufsize per round from the aggregator + * so if our starting offset in the file domain is multiple coll_bufsize that will correspond to the round. + */ + if ((blockStart - fd_start[currentAggRankListIndex]) >= coll_bufsize) { + ADIO_Offset currentRoundBlockStart = fd_start[currentAggRankListIndex]; + int startingRound = 0; + while (blockStart > (currentRoundBlockStart + coll_bufsize - (ADIO_Offset) 1)) { + currentRoundBlockStart += coll_bufsize; + startingRound++; + } + targetAggsForMyDataCurrentRoundIter[numTargetAggs] = startingRound; + } + + /* Initialize the data structures if this is the first offset in the round/target agg. + */ + if (targetAggsForMyDataFirstOffLenIndex + [targetAggsForMyDataCurrentRoundIter[numTargetAggs]][numTargetAggs] == -1) { + targetAggsForMyData[numTargetAggs] = fd->hints->ranklist[currentAggRankListIndex]; + targetAggsForMyDataFDStart[numTargetAggs] = fd_start[currentAggRankListIndex]; + /* Round up file domain to the first actual offset used if this is the first file domain. + */ + if (currentAggRankListIndex == smallestFileDomainAggRank) { + if (targetAggsForMyDataFDStart[numTargetAggs] < firstFileOffset) + targetAggsForMyDataFDStart[numTargetAggs] = firstFileOffset; + } + targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[currentAggRankListIndex]; + /* Round down file domain to the last actual offset used if this is the last file domain. + */ + if (currentAggRankListIndex == greatestFileDomainAggRank) { + if (targetAggsForMyDataFDEnd[numTargetAggs] > lastFileOffset) + targetAggsForMyDataFDEnd[numTargetAggs] = lastFileOffset; + } + targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = blockIter; + /* Set the source buffer state starting point for data access for this + * agg and file domain. */ + + if (bufTypeIsContig) { + if (currentFDSourceBufferState[numTargetAggs].sourceBufferOffset == -1) { + + currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = + currentSourceBufferOffset; +#ifdef onesidedtrace + printf("For agg %d sourceBufferOffset initialized to %ld\n", + currentAggRankListIndex, currentSourceBufferOffset); +#endif + } + } else { + if (currentFDSourceBufferState[numTargetAggs].indiceOffset == -1) { + currentFDSourceBufferState[numTargetAggs].indiceOffset = + currentIndiceOffset; + currentFDSourceBufferState[numTargetAggs].bufTypeExtent = bufTypeExtent; + currentFDSourceBufferState[numTargetAggs].dataTypeExtent = + currentDataTypeExtent; + currentFDSourceBufferState[numTargetAggs].flatBufIndice = + currentFlatBufIndice; +#ifdef onesidedtrace + printf + ("For agg %d dataTypeExtent initialized to %ld flatBufIndice to %d indiceOffset to %ld\n", + numTargetAggs, currentDataTypeExtent, currentFlatBufIndice, + currentIndiceOffset); +#endif + } + } + + intraRoundCollBufsizeOffset = + fd_start[currentAggRankListIndex] + + ((ADIO_Offset) (targetAggsForMyDataCurrentRoundIter[numTargetAggs] + 1) * + coll_bufsize); + +#ifdef onesidedtrace + printf + ("Initial settings numTargetAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld currentSourceBufferOffset set to %ld intraRoundCollBufsizeOffset set to %ld\n", + numTargetAggs, blockIter, offset_list[blockIter], + fd_start[currentAggRankListIndex], len_list[blockIter], + currentSourceBufferOffset, intraRoundCollBufsizeOffset); +#endif + } + + /* Replace the last offset block iter with this one. + */ + targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter[numTargetAggs]] + [numTargetAggs] = blockIter; + + /* If this blocks extends into the next file domain advance to the next target aggs and source buffer states. + */ + if (blockEnd > fd_end[currentAggRankListIndex]) { +#ifdef onesidedtrace + printf + ("block extends past current fd, blockEnd %ld >= fd_end[currentAggRankListIndex] %ld total block size is %ld blockStart was %ld\n", + blockEnd, fd_end[currentAggRankListIndex], len_list[blockIter], blockStart); +#endif + ADIO_Offset amountToAdvanceSBOffsetForFD = 0; + int additionalFDCounter = 0; + + while (blockEnd > fd_end[currentAggRankListIndex]) { + ADIO_Offset thisAggBlockEnd = fd_end[currentAggRankListIndex]; + if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { + while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { + targetAggsForMyDataCurrentRoundIter[numTargetAggs]++; + intraRoundCollBufsizeOffset += coll_bufsize; + targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = + blockIter; + targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = + blockIter; +#ifdef onesidedtrace + printf + ("targetAggsForMyDataCurrentRoundI%d] is now %d intraRoundCollBufsizeOffset is now %ld\n", + numTargetAggs, targetAggsForMyDataCurrentRoundIter[numTargetAggs], + intraRoundCollBufsizeOffset); +#endif + } // while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) + } // if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) + + int prevAggRankListIndex = currentAggRankListIndex; + currentAggRankListIndex++; + + /* Skip over unused aggs. + */ + if (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) { + while (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) + currentAggRankListIndex++; + + } // (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) + + /* Start new target agg. + */ + if (blockEnd >= fd_start[currentAggRankListIndex]) { + numTargetAggs++; + targetAggsForMyData[numTargetAggs] = + fd->hints->ranklist[currentAggRankListIndex]; + targetAggsForMyDataFDStart[numTargetAggs] = + fd_start[currentAggRankListIndex]; + /* Round up file domain to the first actual offset used if this is the first file domain. + */ + if (currentAggRankListIndex == smallestFileDomainAggRank) { + if (targetAggsForMyDataFDStart[numTargetAggs] < firstFileOffset) + targetAggsForMyDataFDStart[numTargetAggs] = firstFileOffset; + } + targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[currentAggRankListIndex]; + /* Round down file domain to the last actual offset used if this is the last file domain. + */ + if (currentAggRankListIndex == greatestFileDomainAggRank) { + if (targetAggsForMyDataFDEnd[numTargetAggs] > lastFileOffset) + targetAggsForMyDataFDEnd[numTargetAggs] = lastFileOffset; + } + targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = + blockIter; + /* For the first additonal file domain the source buffer offset + * will be incremented relative to the state of this first main + * loop but for subsequent full file domains the offset will be + * incremented by the size + * of the file domain. + */ + if (additionalFDCounter == 0) + amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex] + - blockStart) + (ADIO_Offset) 1; + else + amountToAdvanceSBOffsetForFD = (fd_end[prevAggRankListIndex] + - fd_start[prevAggRankListIndex]) + + (ADIO_Offset) 1; + + if (bufTypeIsContig) { + ADIOI_Assert(numTargetAggs > 0); + if (currentFDSourceBufferState[numTargetAggs].sourceBufferOffset == -1) { + if (additionalFDCounter == 0) { // first file domain, still use the current data counter + currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = + currentSourceBufferOffset + amountToAdvanceSBOffsetForFD; + } else { // 2nd file domain, advance full file domain from last source buffer state + currentFDSourceBufferState[numTargetAggs].sourceBufferOffset = + currentFDSourceBufferState[numTargetAggs - + 1].sourceBufferOffset + + amountToAdvanceSBOffsetForFD; + } + +#ifdef onesidedtrace + printf + ("Crossed into new FD - for agg %d sourceBufferOffset initialized to %ld amountToAdvanceSBOffsetForFD is %ld\n", + numTargetAggs, + currentFDSourceBufferState[numTargetAggs].sourceBufferOffset, + amountToAdvanceSBOffsetForFD); +#endif + } + } else if (currentFDSourceBufferState[numTargetAggs].indiceOffset == -1) { + // non-contiguos source buffer + ADIOI_Assert(numTargetAggs > 0); + + /* Initialize the source buffer state appropriately and then + * advance it with the + * nonContigSourceDataBufferAdvance function. + */ + if (additionalFDCounter == 0) { + // first file domain, still use the current data counter + currentFDSourceBufferState[numTargetAggs].indiceOffset = + currentIndiceOffset; + currentFDSourceBufferState[numTargetAggs].bufTypeExtent = + bufTypeExtent; + currentFDSourceBufferState[numTargetAggs].dataTypeExtent = + currentDataTypeExtent; + currentFDSourceBufferState[numTargetAggs].flatBufIndice = + currentFlatBufIndice; + } else { + // 2nd file domain, advance full file domain from last source buffer state + currentFDSourceBufferState[numTargetAggs].indiceOffset = + currentFDSourceBufferState[numTargetAggs - 1].indiceOffset; + currentFDSourceBufferState[numTargetAggs].bufTypeExtent = + currentFDSourceBufferState[numTargetAggs - 1].bufTypeExtent; + currentFDSourceBufferState[numTargetAggs].dataTypeExtent = + currentFDSourceBufferState[numTargetAggs - 1].dataTypeExtent; + currentFDSourceBufferState[numTargetAggs].flatBufIndice = + currentFDSourceBufferState[numTargetAggs - 1].flatBufIndice; + } + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + (int) amountToAdvanceSBOffsetForFD, 1, + ¤tFDSourceBufferState + [numTargetAggs], NULL); +#ifdef onesidedtrace + printf + ("Crossed into new FD - for agg %d dataTypeExtent initialized to %ld flatBufIndice to %d indiceOffset to %ld amountToAdvanceSBOffsetForFD is %d\n", + numTargetAggs, + currentFDSourceBufferState[numTargetAggs].dataTypeExtent, + currentFDSourceBufferState[numTargetAggs].flatBufIndice, + currentFDSourceBufferState[numTargetAggs].indiceOffset, + amountToAdvanceSBOffsetForFD); +#endif + } + additionalFDCounter++; + +#ifdef onesidedtrace + printf + ("block extended beyond fd init settings numTargetAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld\n", + numTargetAggs, blockIter, offset_list[blockIter], + fd_start[currentAggRankListIndex], len_list[blockIter]); +#endif + intraRoundCollBufsizeOffset = + fd_start[currentAggRankListIndex] + coll_bufsize; + targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = + blockIter; + + } // if (blockEnd >= fd_start[currentAggRankListIndex]) + } // while (blockEnd > fd_end[currentAggRankListIndex]) + } // if (blockEnd > fd_end[currentAggRankListIndex]) + + /* If we are still in the same file domain / target agg but have gone + * past the coll_bufsize and need to advance to the next round - + * initialize tracking data appropriately. + */ + if (blockEnd >= intraRoundCollBufsizeOffset) { + ADIO_Offset currentBlockEnd = blockEnd; + while (currentBlockEnd >= intraRoundCollBufsizeOffset) { + targetAggsForMyDataCurrentRoundIter[numTargetAggs]++; + intraRoundCollBufsizeOffset += coll_bufsize; + targetAggsForMyDataFirstOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = blockIter; + targetAggsForMyDataLastOffLenIndex[targetAggsForMyDataCurrentRoundIter + [numTargetAggs]][numTargetAggs] = blockIter; +#ifdef onesidedtrace + printf + ("smaller than fd currentBlockEnd is now %ld intraRoundCollBufsizeOffset is now %ld targetAggsForMyDataCurrentRoundIter[%d] is now %d\n", + currentBlockEnd, intraRoundCollBufsizeOffset, numTargetAggs, + targetAggsForMyDataCurrentRoundIter[numTargetAggs]); +#endif + } // while (currentBlockEnd >= intraRoundCollBufsizeOffset) + } // if (blockEnd >= intraRoundCollBufsizeOffset) + + /* Need to advance numTargetAggs if this is the last target offset to + * include this one. + */ + if (blockIter == (contig_access_count - 1)) + numTargetAggs++; + } + +#ifdef onesidedtrace + printf("numTargetAggs is %d\n", numTargetAggs); + for (i = 0; i < numTargetAggs; i++) { + for (j = 0; j <= targetAggsForMyDataCurrentRoundIter[i]; j++) + printf + ("targetAggsForMyData[%d] is %d targetAggsForMyDataFDStart[%d] is %ld targetAggsForMyDataFDEnd is %ld targetAggsForMyDataFirstOffLenIndex is %d with value %ld targetAggsForMyDataLastOffLenIndex is %d with value %ld\n", + i, targetAggsForMyData[i], i, targetAggsForMyDataFDStart[i], + targetAggsForMyDataFDEnd[i], targetAggsForMyDataFirstOffLenIndex[j][i], + offset_list[targetAggsForMyDataFirstOffLenIndex[j][i]], + targetAggsForMyDataLastOffLenIndex[j][i], + offset_list[targetAggsForMyDataLastOffLenIndex[j][i]]); + + } +#endif + + } // if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) + + ADIOI_Free(targetAggsForMyDataCurrentRoundIter); + + int currentWriteBuf = 0; + int useIOBuffer = 0; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio && (numberOfRounds > 1)) { + useIOBuffer = 1; + } +#endif + + /* use the write buffer allocated in the file_open */ + char *write_buf0 = fd->io_buf; + char *write_buf1 = fd->io_buf + coll_bufsize; + + /* start off pointing to the first buffer. If we use the 2nd buffer (threaded + * case) we'll swap later */ + char *write_buf = write_buf0; + MPI_Win write_buf_window = fd->io_buf_window; + + if (!romio_onesided_no_rmw) { + *hole_found = 0; + } + + /* Counters to track the offset range being written by the used aggs. + */ + ADIO_Offset currentRoundFDStart = 0; + ADIO_Offset currentRoundFDEnd = 0; + + if (iAmUsedAgg) { + currentRoundFDStart = fd_start[myAggRank]; + currentRoundFDEnd = fd_end[myAggRank]; + if (myAggRank == smallestFileDomainAggRank) { + if (currentRoundFDStart < firstFileOffset) + currentRoundFDStart = firstFileOffset; + } else if (myAggRank == greatestFileDomainAggRank) { + if (currentRoundFDEnd > lastFileOffset) + currentRoundFDEnd = lastFileOffset; + } +#ifdef onesidedtrace + printf("iAmUsedAgg - currentRoundFDStart initialized to %ld currentRoundFDEnd to %ld\n", + currentRoundFDStart, currentRoundFDEnd); +#endif + + if ((stripeSize > 0) && (segmentIter == 0)) { + stripe_parms->numStripesUsed = 0; + stripe_parms->stripeWriteOffsets = + (ADIO_Offset *) ADIOI_Malloc(stripe_parms->stripesPerAgg * sizeof(ADIO_Offset)); + stripe_parms->stripeWriteLens = + (ADIO_Offset *) ADIOI_Malloc(stripe_parms->stripesPerAgg * sizeof(ADIO_Offset)); + stripe_parms->amountOfStripedDataExpected = 0; + int stripeIter = 0; + for (stripeIter = 0; stripeIter < stripe_parms->stripesPerAgg; stripeIter++) { + if (stripeIter == 0) { + stripe_parms->stripeWriteOffsets[stripeIter] = currentRoundFDStart; + stripe_parms->stripeWriteLens[stripeIter] = + (int) (currentRoundFDEnd - currentRoundFDStart) + 1; + stripe_parms->amountOfStripedDataExpected += + (int) (currentRoundFDEnd - currentRoundFDStart) + 1; + stripe_parms->numStripesUsed++; + } else { + if (((currentRoundFDEnd + (ADIO_Offset) 1 + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen))) > + stripe_parms->stripedLastFileOffset) { + if (((currentRoundFDEnd + (ADIO_Offset) 1 - + (ADIO_Offset) (stripeSize) + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen))) <= + stripe_parms->stripedLastFileOffset) { + stripe_parms->stripeWriteOffsets[stripeIter] = + (currentRoundFDEnd + (ADIO_Offset) 1) - + (ADIO_Offset) (stripeSize) + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen); + stripe_parms->stripeWriteLens[stripeIter] = + (int) (stripe_parms->stripedLastFileOffset - + (currentRoundFDEnd + (ADIO_Offset) 1 - + (ADIO_Offset) (stripeSize) + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen)) + + (ADIO_Offset) 1); + stripe_parms->amountOfStripedDataExpected += + (int) (stripe_parms->stripedLastFileOffset - + (currentRoundFDEnd + (ADIO_Offset) 1 - + (ADIO_Offset) (stripeSize) + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen)) + + (ADIO_Offset) 1); + stripe_parms->numStripesUsed++; + } + } else { + stripe_parms->stripeWriteOffsets[stripeIter] = + (currentRoundFDEnd + (ADIO_Offset) 1) - + (ADIO_Offset) (stripeSize) + + ((ADIO_Offset) stripeIter * stripe_parms->segmentLen); + stripe_parms->stripeWriteLens[stripeIter] = stripeSize; + stripe_parms->amountOfStripedDataExpected += stripeSize; + stripe_parms->numStripesUsed++; + } + } + } // for-loop + +#ifdef onesidedtrace + printf + ("stripe_parms->amountOfStripedDataExpected is %d stripe_parms->numStripesUsed is %d offsets and lengths are ", + stripe_parms->amountOfStripedDataExpected, stripe_parms->numStripesUsed); + for (i = 0; i < stripe_parms->numStripesUsed; i++) { + printf("%ld %ld --", stripe_parms->stripeWriteOffsets[i], + stripe_parms->stripeWriteLens[i]); + } + printf("\n"); +#endif + } // if ((stripeSize>0) && (segmentIter==0)) + + + if (romio_onesided_always_rmw && ((stripeSize == 0) || (segmentIter == 0))) { // read in the first buffer + ADIO_Offset tmpCurrentRoundFDEnd = 0; + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + if (myAggRank == greatestFileDomainAggRank) { + if (fd_end[myAggRank] > lastFileOffset) + tmpCurrentRoundFDEnd = lastFileOffset; + else + tmpCurrentRoundFDEnd = fd_end[myAggRank]; + } else + tmpCurrentRoundFDEnd = fd_end[myAggRank]; + } else + tmpCurrentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset) 1; +#ifdef onesidedtrace + printf + ("romio_onesided_always_rmw - first buffer pre-read for file offsets %ld to %ld total is %d\n", + currentRoundFDStart, tmpCurrentRoundFDEnd, + (int) (tmpCurrentRoundFDEnd - currentRoundFDStart) + 1); +#endif + + if (stripeSize == 0) { + ADIO_ReadContig(fd, write_buf, + (int) (tmpCurrentRoundFDEnd - currentRoundFDStart) + 1, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, currentRoundFDStart, &status, error_code); + } else { + // pre-read the entire batch of stripes we will do before writing + int stripeIter = 0; + for (stripeIter = 0; stripeIter < stripe_parms->numStripesUsed; stripeIter++) + ADIO_ReadContig(fd, + (char *) write_buf + + ((ADIO_Offset) stripeIter * + (ADIO_Offset) stripeSize), + stripe_parms->stripeWriteLens[stripeIter], MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + stripe_parms->stripeWriteOffsets[stripeIter], &status, + error_code); + } + } + } // if iAmUsedAgg + if (romio_onesided_always_rmw && ((stripeSize == 0) || (segmentIter == 0))) // wait until the first buffer is read + MPI_Barrier(fd->comm); + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase - startTimeBase); + startTimeBase = MPI_Wtime(); +#endif + + + /* This is the second main loop of the algorithm, actually nested loop of target aggs within rounds. There are 2 flavors of this. + * For romio_write_aggmethod of 1 each nested iteration for the target + * agg does an mpi_put on a contiguous chunk using a primative datatype + * determined using the data structures from the first main loop. For + * romio_write_aggmethod of 2 each nested iteration for the target agg + * builds up data to use in created a derived data type for 1 mpi_put that is done for the target agg for each round. + * To support lustre there will need to be an additional layer of nesting + * for the multiple file domains within target aggs. + */ + int roundIter; + + for (roundIter = 0; roundIter < numberOfRounds; roundIter++) { + if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { + + + int aggIter; + for (aggIter = 0; aggIter < numTargetAggs; aggIter++) { + + int numBytesPutThisAggRound = 0; + /* If we have data for the round/agg process it. + */ + if (targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter] != -1) { + ADIO_Offset currentRoundFDStartForMyTargetAgg = + (ADIO_Offset) ((ADIO_Offset) targetAggsForMyDataFDStart[aggIter] + + (ADIO_Offset) ((ADIO_Offset) roundIter * coll_bufsize)); + ADIO_Offset currentRoundFDEndForMyTargetAgg = + (ADIO_Offset) ((ADIO_Offset) targetAggsForMyDataFDStart[aggIter] + + (ADIO_Offset) ((ADIO_Offset) (roundIter + 1) * + coll_bufsize) - (ADIO_Offset) 1); + + int targetAggContigAccessCount = 0; + + /* These data structures are used for the derived datatype mpi_put + * in the romio_write_aggmethod of 2 case. + */ + int *targetAggBlockLengths = NULL; + MPI_Aint *targetAggDisplacements = NULL, *sourceBufferDisplacements = NULL; + MPI_Datatype *targetAggDataTypes = NULL; + + char *derivedTypePackedSourceBuffer = NULL; + int derivedTypePackedSourceBufferOffset = 0; + int allocatedDerivedTypeArrays = 0; + ADIO_Offset amountOfDataWrittenThisRoundAgg = 0; + +#ifdef onesidedtrace + printf("roundIter %d processing targetAggsForMyData %d \n", roundIter, + targetAggsForMyData[aggIter]); +#endif + + /* Process the range of offsets for this target agg. + */ + int offsetIter; + int startingOffLenIndex = + targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter], endingOffLenIndex = + targetAggsForMyDataLastOffLenIndex[roundIter][aggIter]; + for (offsetIter = startingOffLenIndex; offsetIter <= endingOffLenIndex; + offsetIter++) { + if (currentRoundFDEndForMyTargetAgg > targetAggsForMyDataFDEnd[aggIter]) + currentRoundFDEndForMyTargetAgg = targetAggsForMyDataFDEnd[aggIter]; + + ADIO_Offset offsetStart = offset_list[offsetIter], offsetEnd = + (offset_list[offsetIter] + len_list[offsetIter] - (ADIO_Offset) 1); + +#ifdef onesidedtrace + printf + ("roundIter %d target iter %d targetAggsForMyData is %d offset_list[%d] is %ld len_list[%d] is %ld targetAggsForMyDataFDStart is %ld targetAggsForMyDataFDEnd is %ld currentRoundFDStartForMyTargetAgg is %ld currentRoundFDEndForMyTargetAgg is %ld targetAggsForMyDataFirstOffLenIndex is %ld\n", + roundIter, aggIter, targetAggsForMyData[aggIter], offsetIter, + offset_list[offsetIter], offsetIter, len_list[offsetIter], + targetAggsForMyDataFDStart[aggIter], targetAggsForMyDataFDEnd[aggIter], + currentRoundFDStartForMyTargetAgg, currentRoundFDEndForMyTargetAgg, + targetAggsForMyDataFirstOffLenIndex[roundIter][aggIter]); +#endif + + /* Determine the amount of data and exact source buffer offsets to use. + */ + int bufferAmountToSend = 0; + + if ((offsetStart >= currentRoundFDStartForMyTargetAgg) && + (offsetStart <= currentRoundFDEndForMyTargetAgg)) { + if (offsetEnd > currentRoundFDEndForMyTargetAgg) + bufferAmountToSend = + (currentRoundFDEndForMyTargetAgg - offsetStart) + 1; + else + bufferAmountToSend = (offsetEnd - offsetStart) + 1; + } else if ((offsetEnd >= currentRoundFDStartForMyTargetAgg) && + (offsetEnd <= currentRoundFDEndForMyTargetAgg)) { + if (offsetEnd > currentRoundFDEndForMyTargetAgg) + bufferAmountToSend = + (currentRoundFDEndForMyTargetAgg - + currentRoundFDStartForMyTargetAgg) + 1; + else + bufferAmountToSend = + (offsetEnd - currentRoundFDStartForMyTargetAgg) + 1; + if (offsetStart < currentRoundFDStartForMyTargetAgg) { + offsetStart = currentRoundFDStartForMyTargetAgg; + } + } else if ((offsetStart <= currentRoundFDStartForMyTargetAgg) && + (offsetEnd >= currentRoundFDEndForMyTargetAgg)) { + bufferAmountToSend = + (currentRoundFDEndForMyTargetAgg - + currentRoundFDStartForMyTargetAgg) + 1; + offsetStart = currentRoundFDStartForMyTargetAgg; + } + + numBytesPutThisAggRound += bufferAmountToSend; +#ifdef onesidedtrace + printf("bufferAmountToSend is %d\n", bufferAmountToSend); +#endif + if (bufferAmountToSend > 0) { /* we have data to send this round */ + if (romio_write_aggmethod == 2) { + /* Only allocate these arrays if we are using method 2 and only do it once for this round/target agg. + */ + if (!allocatedDerivedTypeArrays) { + targetAggBlockLengths = + (int *) ADIOI_Malloc(maxNumContigOperations * sizeof(int)); + targetAggDisplacements = + (MPI_Aint *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Aint)); + sourceBufferDisplacements = + (MPI_Aint *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Aint)); + targetAggDataTypes = + (MPI_Datatype *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Datatype)); + if (!bufTypeIsContig) { + int k; + for (k = targetAggsForMyDataFirstOffLenIndex[roundIter] + [aggIter]; + k <= + targetAggsForMyDataLastOffLenIndex[roundIter][aggIter]; + k++) + amountOfDataWrittenThisRoundAgg += len_list[k]; + +#ifdef onesidedtrace + printf("derivedTypePackedSourceBuffer mallocing %ld\n", + amountOfDataWrittenThisRoundAgg); +#endif + if (amountOfDataWrittenThisRoundAgg > 0) + derivedTypePackedSourceBuffer = (char *) + ADIOI_Malloc(amountOfDataWrittenThisRoundAgg * + sizeof(char)); + else + derivedTypePackedSourceBuffer = NULL; + } + allocatedDerivedTypeArrays = 1; + } + } + + /* Determine the offset into the target window. + */ + MPI_Aint targetDisplacementToUseThisRound = + (MPI_Aint) (offsetStart - currentRoundFDStartForMyTargetAgg) + + ((MPI_Aint) (segmentIter) * (MPI_Aint) (stripeSize)); + + /* If using the thread writer select the appropriate side of the split window. + */ + if (useIOBuffer && (write_buf == write_buf1)) { + targetDisplacementToUseThisRound += (MPI_Aint) coll_bufsize; + } + + /* For romio_write_aggmethod of 1 do the mpi_put using the primitive MPI_BYTE type for each contiguous + * chunk in the target, of source data is non-contiguous then pack the data first. + */ + + if (romio_write_aggmethod == 1) { + MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, + write_buf_window); + char *putSourceData = NULL; + if (bufTypeIsContig) { + MPI_Put(((char *) buf) + + currentFDSourceBufferState[aggIter].sourceBufferOffset, + bufferAmountToSend, MPI_BYTE, + targetAggsForMyData[aggIter], + targetDisplacementToUseThisRound, bufferAmountToSend, + MPI_BYTE, write_buf_window); + currentFDSourceBufferState[aggIter].sourceBufferOffset += + (ADIO_Offset) bufferAmountToSend; + } else { + putSourceData = + (char *) ADIOI_Malloc(bufferAmountToSend * sizeof(char)); + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + bufferAmountToSend, 1, + ¤tFDSourceBufferState + [aggIter], putSourceData); + MPI_Put(putSourceData, bufferAmountToSend, MPI_BYTE, + targetAggsForMyData[aggIter], + targetDisplacementToUseThisRound, bufferAmountToSend, + MPI_BYTE, write_buf_window); + + } + MPI_Win_unlock(targetAggsForMyData[aggIter], write_buf_window); + if (!bufTypeIsContig) + ADIOI_Free(putSourceData); + } + + /* For romio_write_aggmethod of 2 populate the data structures for this round/agg for this offset iter + * to be used subsequently when building the derived type for 1 mpi_put for all the data for this + * round/agg. + */ + else if (romio_write_aggmethod == 2) { + + if (bufTypeIsContig) { + targetAggBlockLengths[targetAggContigAccessCount] = + bufferAmountToSend; + targetAggDataTypes[targetAggContigAccessCount] = MPI_BYTE; + targetAggDisplacements[targetAggContigAccessCount] = + targetDisplacementToUseThisRound; + sourceBufferDisplacements[targetAggContigAccessCount] = + (MPI_Aint) + currentFDSourceBufferState[aggIter].sourceBufferOffset; + currentFDSourceBufferState[aggIter].sourceBufferOffset += + (ADIO_Offset) bufferAmountToSend; + targetAggContigAccessCount++; + } else { + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + bufferAmountToSend, 1, + ¤tFDSourceBufferState + [aggIter], + &derivedTypePackedSourceBuffer + [derivedTypePackedSourceBufferOffset]); + targetAggBlockLengths[targetAggContigAccessCount] = + bufferAmountToSend; + targetAggDataTypes[targetAggContigAccessCount] = MPI_BYTE; + targetAggDisplacements[targetAggContigAccessCount] = + targetDisplacementToUseThisRound; + sourceBufferDisplacements[targetAggContigAccessCount] = + (MPI_Aint) derivedTypePackedSourceBufferOffset; + targetAggContigAccessCount++; + derivedTypePackedSourceBufferOffset += + (ADIO_Offset) bufferAmountToSend; + } + } +#ifdef onesidedtrace + printf + ("roundIter %d bufferAmountToSend is %d offsetStart is %ld currentRoundFDStartForMyTargetAgg is %ld currentRoundFDEndForMyTargetAgg is %ld targetDisplacementToUseThisRound is %ld targetAggsForMyDataFDStart[aggIter] is %ld\n", + roundIter, bufferAmountToSend, offsetStart, + currentRoundFDStartForMyTargetAgg, currentRoundFDEndForMyTargetAgg, + targetDisplacementToUseThisRound, + targetAggsForMyDataFDStart[aggIter]); +#endif + + } // bufferAmountToSend > 0 + } // contig list + + /* For romio_write_aggmethod of 2 now build the derived type using the data from this round/agg and do 1 single mpi_put. + */ + if (romio_write_aggmethod == 2) { + + MPI_Datatype sourceBufferDerivedDataType, targetBufferDerivedDataType; + MPI_Type_create_struct(targetAggContigAccessCount, targetAggBlockLengths, + sourceBufferDisplacements, targetAggDataTypes, + &sourceBufferDerivedDataType); + MPI_Type_commit(&sourceBufferDerivedDataType); + MPI_Type_create_struct(targetAggContigAccessCount, targetAggBlockLengths, + targetAggDisplacements, targetAggDataTypes, + &targetBufferDerivedDataType); + MPI_Type_commit(&targetBufferDerivedDataType); + +#ifdef onesidedtrace + printf + ("mpi_put of derived type to agg %d targetAggContigAccessCount is %d\n", + targetAggsForMyData[aggIter], targetAggContigAccessCount); +#endif + if (targetAggContigAccessCount > 0) { + MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, + write_buf_window); + if (bufTypeIsContig) { + MPI_Put(((char *) buf), 1, sourceBufferDerivedDataType, + targetAggsForMyData[aggIter], 0, 1, + targetBufferDerivedDataType, write_buf_window); + } else { + MPI_Put(derivedTypePackedSourceBuffer, 1, + sourceBufferDerivedDataType, targetAggsForMyData[aggIter], + 0, 1, targetBufferDerivedDataType, write_buf_window); + } + + + MPI_Win_unlock(targetAggsForMyData[aggIter], write_buf_window); + } + + if (allocatedDerivedTypeArrays) { + ADIOI_Free(targetAggBlockLengths); + ADIOI_Free(targetAggDisplacements); + ADIOI_Free(targetAggDataTypes); + ADIOI_Free(sourceBufferDisplacements); + if (!bufTypeIsContig) + if (derivedTypePackedSourceBuffer != NULL) + ADIOI_Free(derivedTypePackedSourceBuffer); + } + if (targetAggContigAccessCount > 0) { + MPI_Type_free(&sourceBufferDerivedDataType); + MPI_Type_free(&targetBufferDerivedDataType); + } + } + if (!romio_onesided_no_rmw) { + MPI_Win_lock(MPI_LOCK_SHARED, targetAggsForMyData[aggIter], 0, + fd->io_buf_put_amounts_window); + MPI_Accumulate(&numBytesPutThisAggRound, 1, MPI_INT, + targetAggsForMyData[aggIter], 0, 1, MPI_INT, MPI_SUM, + fd->io_buf_put_amounts_window); + MPI_Win_unlock(targetAggsForMyData[aggIter], fd->io_buf_put_amounts_window); + } + } // baseoffset != -1 + } // target aggs + + if (stripeSize > 0) { + stripe_parms->lastDataTypeExtent = + currentFDSourceBufferState[numTargetAggs - 1].dataTypeExtent; + stripe_parms->lastFlatBufIndice = + currentFDSourceBufferState[numTargetAggs - 1].flatBufIndice; + stripe_parms->lastIndiceOffset = + currentFDSourceBufferState[numTargetAggs - 1].indiceOffset; + +#ifdef onesidedtrace + printf + ("setting stripe_parms->lastDataTypeExtent %ld stripe_parms->lastFlatBufIndice %d stripe_parms->lastIndiceOffset %ld\n", + stripe_parms->lastDataTypeExtent, stripe_parms->lastFlatBufIndice, + stripe_parms->lastIndiceOffset); +#endif + + } + + } /// contig_access_count > 0 + + /* Synchronize all procs before the file write */ + if ((stripeSize == 0) || (stripe_parms->flushCB)) { +#ifdef onesidedtrace + printf("first barrier roundIter %d\n", roundIter); +#endif + MPI_Barrier(fd->comm); + } + + if ((iAmUsedAgg || stripe_parms->iWasUsedStripingAgg) && + ((stripeSize == 0) || (stripe_parms->flushCB))) { + stripe_parms->iWasUsedStripingAgg = 0; + /* Determine what offsets define the portion of the file domain the agg is writing this round. + */ + if (iAmUsedAgg) { + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + if (myAggRank == greatestFileDomainAggRank) { + if (fd_end[myAggRank] > lastFileOffset) + currentRoundFDEnd = lastFileOffset; + else + currentRoundFDEnd = fd_end[myAggRank]; + } else + currentRoundFDEnd = fd_end[myAggRank]; + } else + currentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset) 1; + +#ifdef onesidedtrace + printf + ("current used agg about to writecontig - currentRoundFDStart is %ld currentRoundFDEnd is %ld within file domeain %ld to %ld\n", + currentRoundFDStart, currentRoundFDEnd, fd_start[myAggRank], + fd_end[myAggRank]); +#endif + } +#ifdef onesidedtrace + else { + printf("former used agg about to writecontig\n"); + } +#endif + int doWriteContig = 1; + if (!romio_onesided_no_rmw) { + if (stripeSize == 0) { + if (fd->io_buf_put_amounts != + ((int) (currentRoundFDEnd - currentRoundFDStart) + 1)) { + doWriteContig = 0; + *hole_found = 1; +#ifdef onesidedtrace + printf + ("hole found --- fd->io_buf_put_amounts is %d currentRoundFDEnd is %ld currentRoundFDStart is %ld on roundIter %d\n", + fd->io_buf_put_amounts, currentRoundFDEnd, currentRoundFDStart, + roundIter); +#endif + } + } else { // file striping + if (fd->io_buf_put_amounts != stripe_parms->amountOfStripedDataExpected) { + doWriteContig = 0; + *hole_found = 1; +#ifdef onesidedtrace + printf + ("striping hole found --- fd->io_buf_put_amounts is %d stripe_parms->amountOfStripedDataExpected is %d on roundIter %d\n", + fd->io_buf_put_amounts, stripe_parms->amountOfStripedDataExpected, + roundIter); +#endif + } + } + fd->io_buf_put_amounts = 0; + } + + if (!useIOBuffer) { + if (doWriteContig) { + if (stripeSize > 0) { +#ifdef onesidedtrace + printf("about to write out %d stripes\n", stripe_parms->numStripesUsed); +#endif + int stripeIter = 0; + for (stripeIter = 0; stripeIter < stripe_parms->numStripesUsed; + stripeIter++) { +#ifdef onesidedtrace + printf("writing write_buf offset %ld len %ld file offset %ld\n", + ((ADIO_Offset) stripeIter * + (ADIO_Offset) (stripeSize)), + stripe_parms->stripeWriteLens[stripeIter], + stripe_parms->stripeWriteOffsets[stripeIter]); +#endif + ADIO_WriteContig(fd, + (char *) write_buf + + ((ADIO_Offset) stripeIter * + (ADIO_Offset) (stripeSize)), + stripe_parms->stripeWriteLens[stripeIter], MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + stripe_parms->stripeWriteOffsets[stripeIter], &status, + error_code); + } + ADIOI_Free(stripe_parms->stripeWriteLens); + ADIOI_Free(stripe_parms->stripeWriteOffsets); + } else { + ADIO_WriteContig(fd, write_buf, + (int) (currentRoundFDEnd - currentRoundFDStart) + 1, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, currentRoundFDStart, + &status, error_code); + } + } + } else { /* use the thread writer */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + io_thread_args.fd = fd; + /* do a little pointer shuffling: background I/O works from one + * buffer while two-phase machinery fills up another */ + + if (currentWriteBuf == 0) { + io_thread_args.buf = write_buf0; + currentWriteBuf = 1; + write_buf = write_buf1; + } else { + io_thread_args.buf = write_buf1; + currentWriteBuf = 0; + write_buf = write_buf0; + } + if (doWriteContig) { + io_thread_args.io_kind = ADIOI_WRITE; + io_thread_args.size = (currentRoundFDEnd - currentRoundFDStart) + 1; + io_thread_args.offset = currentRoundFDStart; + ADIO_Status adio_status; + io_thread_args.status = &adio_status; + io_thread_args.error_code = *error_code; + + if ((pthread_create(&io_thread, NULL, + ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) + io_thread = pthread_self(); + } + } // useIOBuffer + + } // iAmUsedAgg + + if (!iAmUsedAgg && useIOBuffer && ((stripeSize == 0) || (stripe_parms->flushCB))) { + if (currentWriteBuf == 0) { + currentWriteBuf = 1; + write_buf = write_buf1; + } else { + currentWriteBuf = 0; + write_buf = write_buf0; + } + } + + if (iAmUsedAgg && stripeSize == 0) { + currentRoundFDStart += coll_bufsize; + + if (romio_onesided_always_rmw && (roundIter < (numberOfRounds - 1))) { // read in the buffer for the next round unless this is the last round + ADIO_Offset tmpCurrentRoundFDEnd = 0; + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + if (myAggRank == greatestFileDomainAggRank) { + if (fd_end[myAggRank] > lastFileOffset) + tmpCurrentRoundFDEnd = lastFileOffset; + else + tmpCurrentRoundFDEnd = fd_end[myAggRank]; + } else + tmpCurrentRoundFDEnd = fd_end[myAggRank]; + } else + tmpCurrentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset) 1; +#ifdef onesidedtrace + printf + ("romio_onesided_always_rmw - round %d buffer pre-read for file offsets %ld to %ld total is %d\n", + roundIter, currentRoundFDStart, tmpCurrentRoundFDEnd, + (int) (tmpCurrentRoundFDEnd - currentRoundFDStart) + 1); +#endif + ADIO_ReadContig(fd, write_buf, + (int) (tmpCurrentRoundFDEnd - currentRoundFDStart) + 1, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, currentRoundFDStart, &status, error_code); + + } + } + + if (roundIter < (numberOfRounds - 1)) { +#ifdef onesidedtrace + printf("second barrier roundIter %d --- waiting in loop this time\n", roundIter); +#endif + MPI_Barrier(fd->comm); + } + + } /* for-loop roundIter */ + + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase - startTimeBase); +#endif + + if (useIOBuffer) { /* thread writer cleanup */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + } + + } +#ifdef onesidedtrace + printf("freeing datastructures\n"); +#endif + ADIOI_Free(targetAggsForMyData); + ADIOI_Free(targetAggsForMyDataFDStart); + ADIOI_Free(targetAggsForMyDataFDEnd); + + for (i = 0; i < numberOfRounds; i++) { + ADIOI_Free(targetAggsForMyDataFirstOffLenIndex[i]); + ADIOI_Free(targetAggsForMyDataLastOffLenIndex[i]); + } + ADIOI_Free(targetAggsForMyDataFirstOffLenIndex); + ADIOI_Free(targetAggsForMyDataLastOffLenIndex); + + ADIOI_Free(currentFDSourceBufferState); + + return; +} + + +void ADIOI_OneSidedReadAggregation(ADIO_File fd, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + const void *buf, + MPI_Datatype datatype, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + int numNonZeroDataOffsets, + ADIO_Offset * fd_start, ADIO_Offset * fd_end) +{ + int i, j; /* generic iterators */ + +#ifdef onesidedtrace + if (buf == NULL) { + printf("ADIOI_OneSidedWriteAggregation - buf is NULL contig_access_count is %d\n", + contig_access_count); + for (i = 0; i < contig_access_count; i++) + printf("offset_list[%d] is %ld len_list[%d] is %ld\n", i, offset_list[i], i, + len_list[i]); + } + if (contig_access_count < 0) + printf("ADIOI_OneSidedWriteAggregation - contig_access_count of %d is less than 0\n", + contig_access_count); +#endif + + int lenListOverZero = 0; + for (i = 0; ((i < contig_access_count) && (!lenListOverZero)); i++) + if (len_list[i] > 0) + lenListOverZero = 1; + + *error_code = MPI_SUCCESS; /* initialize to success */ + +#ifdef ROMIO_GPFS + double startTimeBase, endTimeBase; + startTimeBase = MPI_Wtime(); +#endif + + MPI_Status status; + pthread_t io_thread; + void *thread_ret; + ADIOI_IO_ThreadFuncData io_thread_args; + + int nprocs, myrank; + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* Initialize to self here to avoid uninitialized warnings. */ + io_thread = pthread_self(); + +#ifdef onesidedtrace + printf("ADIOI_OneSidedReadAggregation started on rank %d\n", myrank); +#endif + + if (fd->io_buf_window == MPI_WIN_NULL || fd->io_buf_put_amounts_window == MPI_WIN_NULL) { + ADIOI_OneSidedSetup(fd, nprocs); + } + /* This flag denotes whether the source datatype is contiguus, which is referenced throughout the algorithm + * and defines how the source buffer offsets and data chunks are determined. If the value is 1 (true - contiguous data) + * things are profoundly simpler in that the source buffer offset for a given source offset simply linearly increases + * by the chunk sizes being read. If the value is 0 (non-contiguous) then these values are based on calculations + * from the flattened source datatype. + */ + int bufTypeIsContig; + + MPI_Aint lb, bufTypeExtent; + ADIOI_Flatlist_node *flatBuf = NULL; + ADIOI_Datatype_iscontig(datatype, &bufTypeIsContig); + + if (!bufTypeIsContig) { + /* Flatten the non-contiguous source datatype. + */ + flatBuf = ADIOI_Flatten_and_find(datatype); + MPI_Type_get_extent(datatype, &lb, &bufTypeExtent); +#ifdef onesidedtrace + printf("flatBuf->count is %d bufTypeExtent is %d\n", flatBuf->count, bufTypeExtent); + for (i = 0; i < flatBuf->count; i++) + printf("flatBuf->blocklens[%d] is %d flatBuf->indices[%d] is %ld\n", i, + flatBuf->blocklens[i], i, flatBuf->indices[i]); +#endif + } +#ifdef onesidedtrace + printf("ADIOI_OneSidedReadAggregation bufTypeIsContig is %d contig_access_count is %d\n", + bufTypeIsContig, contig_access_count); +#endif + + int naggs = fd->hints->cb_nodes; + + /* Track the state of the source buffer for feeding the target data blocks. + * For GPFS the number of file domains per agg is always 1 so we just need 1 agg + * dimension to track the data, in the case of lustre we will need 2 dimensions + * agg and file domain since aggs write to multiple file domains in the + * case of lustre. + * This structure will be modified as the data is written to reflect the + * current state of the offset. + */ + +#ifdef onesidedtrace + printf("sizeof(FDSourceBufferState) is %d - make sure is 32 for 32-byte memalign optimal\n", + sizeof(FDSourceBufferState)); +#endif + FDSourceBufferState *currentFDSourceBufferState; + + currentFDSourceBufferState = + (FDSourceBufferState *) ADIOI_Malloc(naggs * sizeof(FDSourceBufferState)); + for (i = 0; i < naggs; i++) { + /* initialize based on the bufType to indicate that it is unset. + */ + if (bufTypeIsContig) { + currentFDSourceBufferState[i].sourceBufferOffset = -1; + } else { + currentFDSourceBufferState[i].indiceOffset = -1; + } + } + +#ifdef onesidedtrace + printf(" ADIOI_OneSidedReadAggregation bufTypeIsContig is %d contig_access_count is %d\n", + bufTypeIsContig, contig_access_count); +#endif + + /* maxNumContigOperations keeps track of how many different chunks we will + * need to recv for the purpose of pre-allocating the data structures to + * hold them. + */ + int maxNumContigOperations = contig_access_count; + + + ADIO_Offset lastFileOffset = 0, firstFileOffset = -1; + + /* Get the total range being read. + */ + for (j = 0; j < numNonZeroDataOffsets; j++) { +#ifdef onesidedtrace + printf("end_offsets[%d] is %ld st_offsets[%d] is %ld\n", j, end_offsets[j], j, + st_offsets[j]); +#endif + lastFileOffset = MPL_MAX(lastFileOffset, end_offsets[j]); + if (firstFileOffset == -1) + firstFileOffset = st_offsets[j]; + else + firstFileOffset = MPL_MIN(firstFileOffset, st_offsets[j]); + } + + int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ + int iAmUsedAgg = 0; /* whether or not this rank is used as an aggregator. */ + + int coll_bufsize = fd->hints->cb_buffer_size; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio == 1) { + /* split buffer in half for a kind of double buffering with the threads */ + coll_bufsize = fd->hints->cb_buffer_size / 2; + } +#endif + + /* This logic defines values that are used later to determine what offsets define the portion + * of the file domain the agg is reading this round. + */ + int greatestFileDomainAggRank = -1, smallestFileDomainAggRank = -1; + ADIO_Offset greatestFileDomainOffset = 0; + ADIO_Offset smallestFileDomainOffset = lastFileOffset; + for (j = 0; j < naggs; j++) { + if (fd_end[j] > greatestFileDomainOffset) { + greatestFileDomainOffset = fd_end[j]; + greatestFileDomainAggRank = j; + } + if (fd_start[j] < smallestFileDomainOffset) { + smallestFileDomainOffset = fd_start[j]; + smallestFileDomainAggRank = j; + } + if (fd->hints->ranklist[j] == myrank) { + myAggRank = j; + if (fd_end[j] > fd_start[j]) { + iAmUsedAgg = 1; + } + } + } + +#ifdef onesidedtrace + printf("contig_access_count is %d lastFileOffset is %ld firstFileOffset is %ld\n", + contig_access_count, lastFileOffset, firstFileOffset); + for (j = 0; j < contig_access_count; j++) { + printf("offset_list[%d]: %ld , len_list[%d]: %ld\n", j, offset_list[j], j, len_list[j]); + } +#endif + + /* Compute number of rounds. + */ + int numberOfRounds = 0; + for (j = 0; j < naggs; j++) { + int currentNumberOfRounds = + (int) (((fd_end[j] - fd_start[j]) + (ADIO_Offset) 1) / coll_bufsize); + if (((ADIO_Offset) currentNumberOfRounds * coll_bufsize) < + ((fd_end[j] - fd_start[j]) + (ADIO_Offset) 1)) + currentNumberOfRounds++; + if (currentNumberOfRounds > numberOfRounds) + numberOfRounds = currentNumberOfRounds; + } + + /* Data structures to track what data this compute needs to receive from whom. + * For lustre they will all need another dimension for the file domain. + */ int *sourceAggsForMyData = (int *) ADIOI_Malloc(naggs * sizeof(int)); + ADIO_Offset *sourceAggsForMyDataFDStart = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + ADIO_Offset *sourceAggsForMyDataFDEnd = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + int numSourceAggs = 0; + + /* This data structure holds the beginning offset and len list index for the range to be read + * coresponding to the round and source agg. Initialize to -1 to denote being unset. + */ + int **sourceAggsForMyDataFirstOffLenIndex = + (int **) ADIOI_Malloc(numberOfRounds * sizeof(int *)); + for (i = 0; i < numberOfRounds; i++) { + sourceAggsForMyDataFirstOffLenIndex[i] = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (j = 0; j < naggs; j++) + sourceAggsForMyDataFirstOffLenIndex[i][j] = -1; + } + + /* This data structure holds the ending offset and len list index for the range to be read + * coresponding to the round and source agg. + */ + int **sourceAggsForMyDataLastOffLenIndex = + (int **) ADIOI_Malloc(numberOfRounds * sizeof(int *)); + for (i = 0; i < numberOfRounds; i++) + sourceAggsForMyDataLastOffLenIndex[i] = (int *) ADIOI_Malloc(naggs * sizeof(int)); + +#ifdef onesidedtrace + printf("NumberOfRounds is %d\n", numberOfRounds); + for (i = 0; i < naggs; i++) + printf("fd->hints->ranklist[%d]is %d fd_start is %ld fd_end is %ld\n", i, + fd->hints->ranklist[i], fd_start[i], fd_end[i]); + for (j = 0; j < contig_access_count; j++) + printf("offset_list[%d] is %ld len_list is %ld\n", j, offset_list[j], len_list[j]); +#endif + + int currentAggRankListIndex = 0; + int maxNumNonContigSourceChunks = 0; + + ADIO_Offset currentRecvBufferOffset = 0; + ADIO_Offset currentDataTypeExtent = 0; + int currentFlatBufIndice = 0; + ADIO_Offset currentIndiceOffset = 0; + + /* This denotes the coll_bufsize boundaries within the source buffer for reading for 1 round. + */ + ADIO_Offset intraRoundCollBufsizeOffset = 0; + + /* This data structure tracks what source aggs need to be read to on what rounds. + */ + int *sourceAggsForMyDataCurrentRoundIter = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (i = 0; i < naggs; i++) + sourceAggsForMyDataCurrentRoundIter[i] = 0; + + /* This is the first of the two main loops in this algorithm. The purpose of this loop is essentially to populate + * the data structures defined above for what read data blocks needs to go where (source agg and file domain) and when + * (round iter). For lustre essentially an additional layer of nesting will be required for the multiple file domains + * within the source agg. + */ + if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { + int blockIter; + for (blockIter = 0; blockIter < contig_access_count; blockIter++) { + + /* Determine the starting source buffer offset for this block - for iter 0 skip it since that value is 0. + */ + if (blockIter > 0) { + if (bufTypeIsContig) { + currentRecvBufferOffset += len_list[blockIter - 1]; + } else { + /* Non-contiguous source datatype, count up the extents and indices to this point + * in the blocks. + */ + ADIO_Offset sourceBlockTotal = 0; + int lastIndiceUsed = currentFlatBufIndice; + int numNonContigSourceChunks = 0; + while (sourceBlockTotal < len_list[blockIter - 1]) { + numNonContigSourceChunks++; + sourceBlockTotal += + (flatBuf->blocklens[currentFlatBufIndice] - currentIndiceOffset); + lastIndiceUsed = currentFlatBufIndice; + currentFlatBufIndice++; + if (currentFlatBufIndice == flatBuf->count) { + currentFlatBufIndice = 0; + currentDataTypeExtent++; + } + currentIndiceOffset = (ADIO_Offset) 0; + } + if (sourceBlockTotal > len_list[blockIter - 1]) { + currentFlatBufIndice--; + if (currentFlatBufIndice < 0) { + currentDataTypeExtent--; + currentFlatBufIndice = flatBuf->count - 1; + } + currentIndiceOffset = + len_list[blockIter - 1] - (sourceBlockTotal - + flatBuf->blocklens[lastIndiceUsed]); + // ADIOI_Assert((currentIndiceOffset >= 0) && (currentIndiceOffset < flatBuf->blocklens[currentFlatBufIndice])); + } else + currentIndiceOffset = 0; + maxNumContigOperations += (numNonContigSourceChunks + 2); + if (numNonContigSourceChunks > maxNumNonContigSourceChunks) + maxNumNonContigSourceChunks = numNonContigSourceChunks; + +#ifdef onesidedtrace + printf + ("block iter %d currentFlatBufIndice is now %d currentDataTypeExtent is now %ld currentIndiceOffset is now %ld maxNumContigOperations is now %d\n", + blockIter, currentFlatBufIndice, currentDataTypeExtent, + currentIndiceOffset, maxNumContigOperations); +#endif + } // !bufTypeIsContig + } // blockIter > 0 + + /* For the last iteration we need to include these maxNumContigOperations and maxNumNonContigSourceChunks + * for non-contig case even though we did not need to compute the next starting offset. + */ + if ((blockIter == (contig_access_count - 1)) && (!bufTypeIsContig)) { + ADIO_Offset sourceBlockTotal = 0; + int tmpCurrentFlatBufIndice = currentFlatBufIndice; + int lastNumNonContigSourceChunks = 0; + while (sourceBlockTotal < len_list[blockIter]) { + lastNumNonContigSourceChunks++; + sourceBlockTotal += flatBuf->blocklens[tmpCurrentFlatBufIndice]; + tmpCurrentFlatBufIndice++; + if (tmpCurrentFlatBufIndice == flatBuf->count) { + tmpCurrentFlatBufIndice = 0; + } + } + maxNumContigOperations += (lastNumNonContigSourceChunks + 2); + if (lastNumNonContigSourceChunks > maxNumNonContigSourceChunks) + maxNumNonContigSourceChunks = lastNumNonContigSourceChunks; + + } + + ADIO_Offset blockStart = offset_list[blockIter], blockEnd = + offset_list[blockIter] + len_list[blockIter] - (ADIO_Offset) 1; + + /* Find the starting source agg for this block - normally it will be the current agg so guard the expensive + * while loop with a cheap if-check which for large numbers of small blocks will usually be false. + */ + if (! + ((blockStart >= fd_start[currentAggRankListIndex]) && + (blockStart <= fd_end[currentAggRankListIndex]))) { + while (! + ((blockStart >= fd_start[currentAggRankListIndex]) && + (blockStart <= fd_end[currentAggRankListIndex]))) + currentAggRankListIndex++; + }; + + /* Determine if this is a new source agg. + */ + if (blockIter > 0) { + if ((offset_list[blockIter - 1] + len_list[blockIter - 1] - (ADIO_Offset) 1) < + fd_start[currentAggRankListIndex]) + numSourceAggs++; + } + + /* Determine which round to start reading. + */ + if ((blockStart - fd_start[currentAggRankListIndex]) >= coll_bufsize) { + ADIO_Offset currentRoundBlockStart = fd_start[currentAggRankListIndex]; + int startingRound = 0; + while (blockStart > (currentRoundBlockStart + coll_bufsize - (ADIO_Offset) 1)) { + currentRoundBlockStart += coll_bufsize; + startingRound++; + } + sourceAggsForMyDataCurrentRoundIter[numSourceAggs] = startingRound; + } + + /* Initialize the data structures if this is the first offset in the round/source agg. + */ + if (sourceAggsForMyDataFirstOffLenIndex + [sourceAggsForMyDataCurrentRoundIter[numSourceAggs]][numSourceAggs] == -1) { + sourceAggsForMyData[numSourceAggs] = fd->hints->ranklist[currentAggRankListIndex]; + sourceAggsForMyDataFDStart[numSourceAggs] = fd_start[currentAggRankListIndex]; + /* Round up file domain to the first actual offset used if this is the first file domain. + */ + if (currentAggRankListIndex == smallestFileDomainAggRank) { + if (sourceAggsForMyDataFDStart[numSourceAggs] < firstFileOffset) + sourceAggsForMyDataFDStart[numSourceAggs] = firstFileOffset; + } + sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[currentAggRankListIndex]; + /* Round down file domain to the last actual offset used if this is the last file domain. + */ + if (currentAggRankListIndex == greatestFileDomainAggRank) { + if (sourceAggsForMyDataFDEnd[numSourceAggs] > lastFileOffset) + sourceAggsForMyDataFDEnd[numSourceAggs] = lastFileOffset; + } + sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = blockIter; + + /* Set the source buffer state starting point for data access for this agg and file domain. + */ + if (bufTypeIsContig) { + if (currentFDSourceBufferState[numSourceAggs].sourceBufferOffset == -1) { + + currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = + currentRecvBufferOffset; +#ifdef onesidedtrace + printf("For agg %d sourceBufferOffset initialized to %ld\n", + currentAggRankListIndex, currentRecvBufferOffset); +#endif + } + } else { + if (currentFDSourceBufferState[numSourceAggs].indiceOffset == -1) { + currentFDSourceBufferState[numSourceAggs].indiceOffset = + currentIndiceOffset; + currentFDSourceBufferState[numSourceAggs].bufTypeExtent = bufTypeExtent; + currentFDSourceBufferState[numSourceAggs].dataTypeExtent = + currentDataTypeExtent; + currentFDSourceBufferState[numSourceAggs].flatBufIndice = + currentFlatBufIndice; +#ifdef onesidedtrace + printf + ("For agg %d dataTypeExtent initialized to %ld flatBufIndice to %d indiceOffset to %ld\n", + numSourceAggs, currentDataTypeExtent, currentFlatBufIndice, + currentIndiceOffset); +#endif + } + } + intraRoundCollBufsizeOffset = + fd_start[currentAggRankListIndex] + + ((ADIO_Offset) (sourceAggsForMyDataCurrentRoundIter[numSourceAggs] + 1) * + coll_bufsize); +#ifdef onesidedtrace + printf + ("init settings numSourceAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld currentRecvBufferOffset set to %ld intraRoundCollBufsizeOffset set to %ld\n", + numSourceAggs, blockIter, offset_list[blockIter], + fd_start[currentAggRankListIndex], len_list[blockIter], + currentRecvBufferOffset, intraRoundCollBufsizeOffset); +#endif + + } + + /* Replace the last offset block iter with this one. + */ + sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter[numSourceAggs]] + [numSourceAggs] = blockIter; + + /* If this blocks extends into the next file domain advance to the next source aggs and source buffer states. + */ + if (blockEnd > fd_end[currentAggRankListIndex]) { +#ifdef onesidedtrace + printf + ("block extends past current fd, blockEnd %ld >= fd_end[currentAggRankListIndex] %ld total block size is %ld blockStart was %ld\n", + blockEnd, fd_end[currentAggRankListIndex], len_list[blockIter], blockStart); +#endif + ADIO_Offset amountToAdvanceSBOffsetForFD = 0; + int additionalFDCounter = 0; + while (blockEnd > fd_end[currentAggRankListIndex]) { +#ifdef onesidedtrace + printf("currentAggRankListIndex is now %d blockEnd %ld > fd_end[%d] %ld\n", + currentAggRankListIndex, blockEnd, currentAggRankListIndex, + fd_end[currentAggRankListIndex]); +#endif + ADIO_Offset thisAggBlockEnd = fd_end[currentAggRankListIndex]; + if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { + while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) { + sourceAggsForMyDataCurrentRoundIter[numSourceAggs]++; + intraRoundCollBufsizeOffset += coll_bufsize; + sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = + blockIter; + sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = + blockIter; +#ifdef onesidedtrace + printf + ("sourceAggsForMyDataCurrentRoundI%d] is now %d intraRoundCollBufsizeOffset is now %ld\n", + numSourceAggs, sourceAggsForMyDataCurrentRoundIter[numSourceAggs], + intraRoundCollBufsizeOffset); +#endif + } // while (thisAggBlockEnd >= intraRoundCollBufsizeOffset) + } // if (thisAggBlockEnd >= intraRoundCollBufsizeOffset) + + int prevAggRankListIndex = currentAggRankListIndex; + currentAggRankListIndex++; + + /* Skip over unused aggs. + */ + if (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) { + while (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) + currentAggRankListIndex++; + + } // (fd_start[currentAggRankListIndex] > fd_end[currentAggRankListIndex]) + + /* Start new source agg. + */ + if (blockEnd >= fd_start[currentAggRankListIndex]) { + numSourceAggs++; + sourceAggsForMyData[numSourceAggs] = + fd->hints->ranklist[currentAggRankListIndex]; + sourceAggsForMyDataFDStart[numSourceAggs] = + fd_start[currentAggRankListIndex]; + /* Round up file domain to the first actual offset used if this is the first file domain. + */ + if (currentAggRankListIndex == smallestFileDomainAggRank) { + if (sourceAggsForMyDataFDStart[numSourceAggs] < firstFileOffset) + sourceAggsForMyDataFDStart[numSourceAggs] = firstFileOffset; + } + sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[currentAggRankListIndex]; + /* Round down file domain to the last actual offset used if this is the last file domain. + */ + if (currentAggRankListIndex == greatestFileDomainAggRank) { + if (sourceAggsForMyDataFDEnd[numSourceAggs] > lastFileOffset) + sourceAggsForMyDataFDEnd[numSourceAggs] = lastFileOffset; + } + sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = + blockIter; + + + /* For the first additonal file domain the source buffer offset + * will be incremented relative to the state of this first main + * loop but for subsequent full file domains the offset will be + * incremented by the size of the file domain. + */ + if (additionalFDCounter == 0) + amountToAdvanceSBOffsetForFD = + (fd_end[prevAggRankListIndex] - blockStart) + (ADIO_Offset) 1; + else + amountToAdvanceSBOffsetForFD = + (fd_end[prevAggRankListIndex] - fd_start[prevAggRankListIndex]) + + (ADIO_Offset) 1; + + if (bufTypeIsContig) { + ADIOI_Assert(numSourceAggs > 0); + if (currentFDSourceBufferState[numSourceAggs].sourceBufferOffset == -1) { + if (additionalFDCounter == 0) { // first file domain, still use the current data counter + currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = + currentRecvBufferOffset + amountToAdvanceSBOffsetForFD; + } else { // 2nd file domain, advance full file domain from last source buffer state + currentFDSourceBufferState[numSourceAggs].sourceBufferOffset = + currentFDSourceBufferState[numSourceAggs - + 1].sourceBufferOffset + + amountToAdvanceSBOffsetForFD; + } + +#ifdef onesidedtrace + printf + ("Crossed into new FD - for agg %d sourceBufferOffset initialized to %ld amountToAdvanceSBOffsetForFD is %ld\n", + numSourceAggs, + currentFDSourceBufferState[numSourceAggs].sourceBufferOffset, + amountToAdvanceSBOffsetForFD); +#endif + } + } else if (currentFDSourceBufferState[numSourceAggs].indiceOffset == -1) { + // non-contiguos source buffer + ADIOI_Assert(numSourceAggs > 0); + + /* Initialize the source buffer state appropriately and then + * advance it with the nonContigSourceDataBufferAdvance function. + */ + if (additionalFDCounter == 0) { + // first file domain, still use the current data counter + currentFDSourceBufferState[numSourceAggs].indiceOffset = + currentIndiceOffset; + currentFDSourceBufferState[numSourceAggs].bufTypeExtent = + bufTypeExtent; + currentFDSourceBufferState[numSourceAggs].dataTypeExtent = + currentDataTypeExtent; + currentFDSourceBufferState[numSourceAggs].flatBufIndice = + currentFlatBufIndice; + } else { + // 2nd file domain, advance full file domain from last source + // buffer state + currentFDSourceBufferState[numSourceAggs].indiceOffset = + currentFDSourceBufferState[numSourceAggs - 1].indiceOffset; + currentFDSourceBufferState[numSourceAggs].bufTypeExtent = + currentFDSourceBufferState[numSourceAggs - 1].bufTypeExtent; + currentFDSourceBufferState[numSourceAggs].dataTypeExtent = + currentFDSourceBufferState[numSourceAggs - 1].dataTypeExtent; + currentFDSourceBufferState[numSourceAggs].flatBufIndice = + currentFDSourceBufferState[numSourceAggs - 1].flatBufIndice; + } + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + (int) amountToAdvanceSBOffsetForFD, 0, + ¤tFDSourceBufferState + [numSourceAggs], NULL); +#ifdef onesidedtrace + printf + ("Crossed into new FD - for agg %d dataTypeExtent initialized to %ld flatBufIndice to %d indiceOffset to %ld amountToAdvanceSBOffsetForFD is %d\n", + numSourceAggs, + currentFDSourceBufferState[numSourceAggs].dataTypeExtent, + currentFDSourceBufferState[numSourceAggs].flatBufIndice, + currentFDSourceBufferState[numSourceAggs].indiceOffset, + amountToAdvanceSBOffsetForFD); +#endif + } + + additionalFDCounter++; + + +#ifdef onesidedtrace + printf + ("block extended beyond fd init settings numSourceAggs %d offset_list[%d] with value %ld past fd border %ld with len %ld\n", + numSourceAggs, blockIter, offset_list[blockIter], + fd_start[currentAggRankListIndex], len_list[blockIter]); +#endif + intraRoundCollBufsizeOffset = + fd_start[currentAggRankListIndex] + coll_bufsize; + sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = + blockIter; + } // if (blockEnd >= fd_start[currentAggRankListIndex]) + } // while (blockEnd > fd_end[currentAggRankListIndex]) + } // if (blockEnd > fd_end[currentAggRankListIndex]) + + /* If we are still in the same file domain / source agg but have gone past the coll_bufsize and need + * to advance to the next round handle this situation. + */ + if (blockEnd >= intraRoundCollBufsizeOffset) { + ADIO_Offset currentBlockEnd = blockEnd; + while (currentBlockEnd >= intraRoundCollBufsizeOffset) { + sourceAggsForMyDataCurrentRoundIter[numSourceAggs]++; + intraRoundCollBufsizeOffset += coll_bufsize; + sourceAggsForMyDataFirstOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = blockIter; + sourceAggsForMyDataLastOffLenIndex[sourceAggsForMyDataCurrentRoundIter + [numSourceAggs]][numSourceAggs] = blockIter; +#ifdef onesidedtrace + printf + ("block less than fd currentBlockEnd is now %ld intraRoundCollBufsizeOffset is now %ld sourceAggsForMyDataCurrentRoundIter[%d] is now %d\n", + currentBlockEnd, intraRoundCollBufsizeOffset, numSourceAggs, + sourceAggsForMyDataCurrentRoundIter[numSourceAggs]); +#endif + } // while (currentBlockEnd >= intraRoundCollBufsizeOffset) + } // if (blockEnd >= intraRoundCollBufsizeOffset) + + /* Need to advance numSourceAggs if this is the last source offset to + * include this one. + */ + if (blockIter == (contig_access_count - 1)) + numSourceAggs++; + } + +#ifdef onesidedtrace + printf("numSourceAggs is %d\n", numSourceAggs); + for (i = 0; i < numSourceAggs; i++) { + for (j = 0; j <= sourceAggsForMyDataCurrentRoundIter[i]; j++) + printf + ("sourceAggsForMyData[%d] is %d sourceAggsForMyDataFDStart[%d] is %ld sourceAggsForMyDataFDEnd is %ld sourceAggsForMyDataFirstOffLenIndex is %d with value %ld sourceAggsForMyDataLastOffLenIndex is %d with value %ld\n", + i, sourceAggsForMyData[i], i, sourceAggsForMyDataFDStart[i], + sourceAggsForMyDataFDEnd[i], sourceAggsForMyDataFirstOffLenIndex[j][i], + offset_list[sourceAggsForMyDataFirstOffLenIndex[j][i]], + sourceAggsForMyDataLastOffLenIndex[j][i], + offset_list[sourceAggsForMyDataLastOffLenIndex[j][i]]); + + } +#endif + + } // if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) + + ADIOI_Free(sourceAggsForMyDataCurrentRoundIter); + + /* use the two-phase buffer allocated in the file_open - no app should ever + * be both reading and reading at the same time */ + char *read_buf0 = fd->io_buf; + char *read_buf1 = fd->io_buf + coll_bufsize; + /* if threaded i/o selected, we'll do a kind of double buffering */ + char *read_buf = read_buf0; + + int currentReadBuf = 0; + int useIOBuffer = 0; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio && (numberOfRounds > 1)) { + useIOBuffer = 1; + } +#endif + + MPI_Win read_buf_window = fd->io_buf_window; + + ADIO_Offset currentRoundFDStart = 0, nextRoundFDStart = 0; + ADIO_Offset currentRoundFDEnd = 0, nextRoundFDEnd = 0; + + if (iAmUsedAgg) { + currentRoundFDStart = fd_start[myAggRank]; + nextRoundFDStart = fd_start[myAggRank]; + if (myAggRank == smallestFileDomainAggRank) { + if (currentRoundFDStart < firstFileOffset) + currentRoundFDStart = firstFileOffset; + if (nextRoundFDStart < firstFileOffset) + nextRoundFDStart = firstFileOffset; + } else if (myAggRank == greatestFileDomainAggRank) { + if (currentRoundFDEnd > lastFileOffset) + currentRoundFDEnd = lastFileOffset; + if (nextRoundFDEnd > lastFileOffset) + nextRoundFDEnd = lastFileOffset; + } +#ifdef onesidedtrace + printf("iAmUsedAgg - currentRoundFDStart initialized " + "to %ld currentRoundFDEnd to %ld\n", currentRoundFDStart, currentRoundFDEnd); +#endif + + + } +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase - startTimeBase); + startTimeBase = MPI_Wtime(); +#endif + + + /* This is the second main loop of the algorithm, actually nested loop of target aggs within rounds. There are 2 flavors of this. + * For romio_read_aggmethod of 1 each nested iteration for the source agg does an mpi_put on a contiguous chunk using a primative datatype + * determined using the data structures from the first main loop. For romio_read_aggmethod of 2 each nested iteration for the source agg + * builds up data to use in created a derived data type for 1 mpi_put that is done for the target agg for each round. + * To support lustre there will need to be an additional layer of nesting for the multiple file domains + * within target aggs. + */ + int roundIter; + for (roundIter = 0; roundIter < numberOfRounds; roundIter++) { + + if ((contig_access_count > 0) && (buf != NULL) && lenListOverZero) { + /* determine what offsets define the portion of the file domain the agg is reading this round */ + if (iAmUsedAgg) { + + currentRoundFDStart = nextRoundFDStart; + + if (!useIOBuffer || (roundIter == 0)) { + int amountDataToReadThisRound; + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + currentRoundFDEnd = fd_end[myAggRank]; + amountDataToReadThisRound = ((currentRoundFDEnd - currentRoundFDStart) + 1); + } else { + currentRoundFDEnd = currentRoundFDStart + coll_bufsize - (ADIO_Offset) 1; + amountDataToReadThisRound = coll_bufsize; + } + + /* read currentRoundFDEnd bytes */ + ADIO_ReadContig(fd, read_buf, amountDataToReadThisRound, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, currentRoundFDStart, + &status, error_code); + currentReadBuf = 1; + + } + if (useIOBuffer) { /* use the thread reader for the next round */ + /* switch back and forth between the read buffers so that the data aggregation code is diseminating 1 buffer while the thread is reading into the other */ + + if (roundIter > 0) + currentRoundFDEnd = nextRoundFDEnd; + + if (roundIter < (numberOfRounds - 1)) { + nextRoundFDStart += coll_bufsize; + int amountDataToReadNextRound; + if ((fd_end[myAggRank] - nextRoundFDStart) < coll_bufsize) { + nextRoundFDEnd = fd_end[myAggRank]; + amountDataToReadNextRound = ((nextRoundFDEnd - nextRoundFDStart) + 1); + } else { + nextRoundFDEnd = nextRoundFDStart + coll_bufsize - (ADIO_Offset) 1; + amountDataToReadNextRound = coll_bufsize; + } + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + io_thread_args.fd = fd; + /* do a little pointer shuffling: background I/O works from one + * buffer while two-phase machinery fills up another */ + + if (currentReadBuf == 0) { + io_thread_args.buf = read_buf0; + currentReadBuf = 1; + read_buf = read_buf1; + } else { + io_thread_args.buf = read_buf1; + currentReadBuf = 0; + read_buf = read_buf0; + } + io_thread_args.io_kind = ADIOI_READ; + io_thread_args.size = amountDataToReadNextRound; + io_thread_args.offset = nextRoundFDStart; + io_thread_args.status = &status; + io_thread_args.error_code = *error_code; + if ((pthread_create(&io_thread, NULL, + ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) + io_thread = pthread_self(); + + } else { /* last round */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + if (currentReadBuf == 0) { + read_buf = read_buf0; + } else { + read_buf = read_buf1; + } + + } + } /* useIOBuffer */ + } /* IAmUsedAgg */ + else if (useIOBuffer) { + if (roundIter < (numberOfRounds - 1)) { + if (currentReadBuf == 0) { + currentReadBuf = 1; + read_buf = read_buf1; + } else { + currentReadBuf = 0; + read_buf = read_buf0; + } + } else { + if (currentReadBuf == 0) { + read_buf = read_buf0; + } else { + read_buf = read_buf1; + } + } + + } + // wait until the read buffers are full before we start pulling from the source procs + MPI_Barrier(fd->comm); + + int aggIter; + for (aggIter = 0; aggIter < numSourceAggs; aggIter++) { + + /* If we have data for the round/agg process it. + */ + if (sourceAggsForMyDataFirstOffLenIndex[roundIter][aggIter] != -1) { + + ADIO_Offset currentRoundFDStartForMySourceAgg = + (ADIO_Offset) ((ADIO_Offset) sourceAggsForMyDataFDStart[aggIter] + + (ADIO_Offset) ((ADIO_Offset) roundIter * coll_bufsize)); + ADIO_Offset currentRoundFDEndForMySourceAgg = + (ADIO_Offset) ((ADIO_Offset) sourceAggsForMyDataFDStart[aggIter] + + (ADIO_Offset) ((ADIO_Offset) (roundIter + 1) * + coll_bufsize) - (ADIO_Offset) 1); + + int sourceAggContigAccessCount = 0; + + /* These data structures are used for the derived datatype mpi_get + * in the romio_read_aggmethod of 2 case. + */ + int *sourceAggBlockLengths = NULL; + MPI_Aint *sourceAggDisplacements = NULL, *recvBufferDisplacements = NULL; + MPI_Datatype *sourceAggDataTypes = NULL; + char *derivedTypePackedSourceBuffer = NULL; + int derivedTypePackedSourceBufferOffset = 0; + int allocatedDerivedTypeArrays = 0; + ADIO_Offset amountOfDataReadThisRoundAgg = 0; + + /* Process the range of offsets for this source agg. + */ + int offsetIter; + int startingOffLenIndex = + sourceAggsForMyDataFirstOffLenIndex[roundIter][aggIter], endingOffLenIndex = + sourceAggsForMyDataLastOffLenIndex[roundIter][aggIter]; + for (offsetIter = startingOffLenIndex; offsetIter <= endingOffLenIndex; + offsetIter++) { + if (currentRoundFDEndForMySourceAgg > sourceAggsForMyDataFDEnd[aggIter]) + currentRoundFDEndForMySourceAgg = sourceAggsForMyDataFDEnd[aggIter]; + + ADIO_Offset offsetStart = offset_list[offsetIter], offsetEnd = + (offset_list[offsetIter] + len_list[offsetIter] - (ADIO_Offset) 1); + + /* Determine the amount of data and exact source buffer offsets to use. + */ + int bufferAmountToRecv = 0; + + if ((offsetStart >= currentRoundFDStartForMySourceAgg) && + (offsetStart <= currentRoundFDEndForMySourceAgg)) { + if (offsetEnd > currentRoundFDEndForMySourceAgg) + bufferAmountToRecv = + (currentRoundFDEndForMySourceAgg - offsetStart) + 1; + else + bufferAmountToRecv = (offsetEnd - offsetStart) + 1; + } else if ((offsetEnd >= currentRoundFDStartForMySourceAgg) && + (offsetEnd <= currentRoundFDEndForMySourceAgg)) { + if (offsetEnd > currentRoundFDEndForMySourceAgg) + bufferAmountToRecv = + (currentRoundFDEndForMySourceAgg - + currentRoundFDStartForMySourceAgg) + 1; + else + bufferAmountToRecv = + (offsetEnd - currentRoundFDStartForMySourceAgg) + 1; + if (offsetStart < currentRoundFDStartForMySourceAgg) { + offsetStart = currentRoundFDStartForMySourceAgg; + } + } else if ((offsetStart <= currentRoundFDStartForMySourceAgg) && + (offsetEnd >= currentRoundFDEndForMySourceAgg)) { + bufferAmountToRecv = + (currentRoundFDEndForMySourceAgg - + currentRoundFDStartForMySourceAgg) + 1; + offsetStart = currentRoundFDStartForMySourceAgg; + } + + if (bufferAmountToRecv > 0) { /* we have data to recv this round */ + if (romio_read_aggmethod == 2) { + /* Only allocate these arrays if we are using method 2 and only do it once for this round/source agg. + */ + if (!allocatedDerivedTypeArrays) { + sourceAggBlockLengths = + (int *) ADIOI_Malloc(maxNumContigOperations * sizeof(int)); + sourceAggDisplacements = + (MPI_Aint *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Aint)); + recvBufferDisplacements = + (MPI_Aint *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Aint)); + sourceAggDataTypes = + (MPI_Datatype *) ADIOI_Malloc(maxNumContigOperations * + sizeof(MPI_Datatype)); + if (!bufTypeIsContig) { + int k; + for (k = sourceAggsForMyDataFirstOffLenIndex[roundIter] + [aggIter]; + k <= + sourceAggsForMyDataLastOffLenIndex[roundIter][aggIter]; + k++) + amountOfDataReadThisRoundAgg += len_list[k]; + +#ifdef onesidedtrace + printf("derivedTypePackedSourceBuffer mallocing %ld\n", + amountOfDataReadThisRoundAgg); +#endif + if (amountOfDataReadThisRoundAgg > 0) + derivedTypePackedSourceBuffer = + (char *) ADIOI_Malloc(amountOfDataReadThisRoundAgg * + sizeof(char)); + else + derivedTypePackedSourceBuffer = NULL; + } + allocatedDerivedTypeArrays = 1; + } + } + + /* Determine the offset into the source window. + */ + MPI_Aint sourceDisplacementToUseThisRound = + (MPI_Aint) (offsetStart - currentRoundFDStartForMySourceAgg); + + /* If using the thread reader select the appropriate side of the split window. + */ + if (useIOBuffer && (read_buf == read_buf1)) { + sourceDisplacementToUseThisRound += (MPI_Aint) coll_bufsize; + } + + /* For romio_read_aggmethod of 1 do the mpi_get using the primitive MPI_BYTE type from each + * contiguous chunk from the target, if the source is non-contiguous then unpack the data after + * the MPI_Win_unlock is done to make sure the data has arrived first. + */ + if (romio_read_aggmethod == 1) { + MPI_Win_lock(MPI_LOCK_SHARED, sourceAggsForMyData[aggIter], 0, + read_buf_window); + char *getSourceData = NULL; + if (bufTypeIsContig) { + MPI_Get(((char *) buf) + + currentFDSourceBufferState[aggIter].sourceBufferOffset, + bufferAmountToRecv, MPI_BYTE, + sourceAggsForMyData[aggIter], + sourceDisplacementToUseThisRound, bufferAmountToRecv, + MPI_BYTE, read_buf_window); + currentFDSourceBufferState[aggIter].sourceBufferOffset += + (ADIO_Offset) bufferAmountToRecv; + + } else { + getSourceData = + (char *) ADIOI_Malloc(bufferAmountToRecv * sizeof(char)); + MPI_Get(getSourceData, bufferAmountToRecv, MPI_BYTE, + sourceAggsForMyData[aggIter], + sourceDisplacementToUseThisRound, bufferAmountToRecv, + MPI_BYTE, read_buf_window); + + } + MPI_Win_unlock(sourceAggsForMyData[aggIter], read_buf_window); + if (!bufTypeIsContig) { + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + bufferAmountToRecv, 0, + ¤tFDSourceBufferState + [aggIter], getSourceData); + ADIOI_Free(getSourceData); + } + } + + /* For romio_read_aggmethod of 2 populate the data structures for this round/agg for this offset iter + * to be used subsequently when building the derived type for 1 mpi_put for all the data for this + * round/agg. + */ + else if (romio_read_aggmethod == 2) { + if (bufTypeIsContig) { + sourceAggBlockLengths[sourceAggContigAccessCount] = + bufferAmountToRecv; + sourceAggDataTypes[sourceAggContigAccessCount] = MPI_BYTE; + sourceAggDisplacements[sourceAggContigAccessCount] = + sourceDisplacementToUseThisRound; + recvBufferDisplacements[sourceAggContigAccessCount] = (MPI_Aint) + currentFDSourceBufferState[aggIter].sourceBufferOffset; + currentFDSourceBufferState[aggIter].sourceBufferOffset += + (ADIO_Offset) bufferAmountToRecv; + sourceAggContigAccessCount++; + } else { + sourceAggBlockLengths[sourceAggContigAccessCount] = + bufferAmountToRecv; + sourceAggDataTypes[sourceAggContigAccessCount] = MPI_BYTE; + sourceAggDisplacements[sourceAggContigAccessCount] = + sourceDisplacementToUseThisRound; + recvBufferDisplacements[sourceAggContigAccessCount] = + (MPI_Aint) derivedTypePackedSourceBufferOffset; + derivedTypePackedSourceBufferOffset += + (ADIO_Offset) bufferAmountToRecv; + sourceAggContigAccessCount++; + } + } + } // bufferAmountToRecv > 0 + } // contig list + + /* For romio_read_aggmethod of 2 now build the derived type using the data from this round/agg and do 1 single mpi_put. + */ + if (romio_read_aggmethod == 2) { + MPI_Datatype recvBufferDerivedDataType, sourceBufferDerivedDataType; + + MPI_Type_create_struct(sourceAggContigAccessCount, sourceAggBlockLengths, + recvBufferDisplacements, sourceAggDataTypes, + &recvBufferDerivedDataType); + MPI_Type_commit(&recvBufferDerivedDataType); + MPI_Type_create_struct(sourceAggContigAccessCount, sourceAggBlockLengths, + sourceAggDisplacements, sourceAggDataTypes, + &sourceBufferDerivedDataType); + MPI_Type_commit(&sourceBufferDerivedDataType); + + if (sourceAggContigAccessCount > 0) { + + MPI_Win_lock(MPI_LOCK_SHARED, sourceAggsForMyData[aggIter], 0, + read_buf_window); + if (bufTypeIsContig) { + MPI_Get(((char *) buf), 1, recvBufferDerivedDataType, + sourceAggsForMyData[aggIter], 0, 1, + sourceBufferDerivedDataType, read_buf_window); + } else { + MPI_Get(derivedTypePackedSourceBuffer, 1, recvBufferDerivedDataType, + sourceAggsForMyData[aggIter], 0, 1, + sourceBufferDerivedDataType, read_buf_window); + } + + MPI_Win_unlock(sourceAggsForMyData[aggIter], read_buf_window); + if (!bufTypeIsContig) { + nonContigSourceDataBufferAdvance(((char *) buf), flatBuf, + derivedTypePackedSourceBufferOffset, + 0, + ¤tFDSourceBufferState + [aggIter], + derivedTypePackedSourceBuffer); + } + } + + if (allocatedDerivedTypeArrays) { + ADIOI_Free(sourceAggBlockLengths); + ADIOI_Free(sourceAggDisplacements); + ADIOI_Free(sourceAggDataTypes); + ADIOI_Free(recvBufferDisplacements); + if (!bufTypeIsContig) + if (derivedTypePackedSourceBuffer != NULL) + ADIOI_Free(derivedTypePackedSourceBuffer); + } + if (sourceAggContigAccessCount > 0) { + MPI_Type_free(&recvBufferDerivedDataType); + MPI_Type_free(&sourceBufferDerivedDataType); + } + } + } // baseoffset != -1 + } // source aggs + } // contig_access_count > 0 + /* the source procs recv the requested data to the aggs */ + + MPI_Barrier(fd->comm); + + nextRoundFDStart = currentRoundFDStart + coll_bufsize; + + } /* for-loop roundIter */ + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase - startTimeBase); +#endif + + if (useIOBuffer) { /* thread readr cleanup */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + } + + } + + ADIOI_Free(sourceAggsForMyData); + ADIOI_Free(sourceAggsForMyDataFDStart); + ADIOI_Free(sourceAggsForMyDataFDEnd); + + for (i = 0; i < numberOfRounds; i++) { + ADIOI_Free(sourceAggsForMyDataFirstOffLenIndex[i]); + ADIOI_Free(sourceAggsForMyDataLastOffLenIndex[i]); + } + ADIOI_Free(sourceAggsForMyDataFirstOffLenIndex); + ADIOI_Free(sourceAggsForMyDataLastOffLenIndex); + + ADIOI_Free(currentFDSourceBufferState); + + return; +} diff --git a/3rd-party/romio341/adio/common/p2p_aggregation.c b/3rd-party/romio341/adio/common/p2p_aggregation.c new file mode 100644 index 0000000000000000000000000000000000000000..11043e86e1a54c6462f1dd7017939cd13d5db90b --- /dev/null +++ b/3rd-party/romio341/adio/common/p2p_aggregation.c @@ -0,0 +1,990 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_tuning.h" +#include "../ad_gpfs/ad_gpfs_tuning.h" + +#include <pthread.h> + +/* #define p2pcontigtrace 1 */ + +void ADIOI_P2PContigWriteAggregation(ADIO_File fd, + const void *buf, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + ADIO_Offset * fd_start, ADIO_Offset * fd_end) +{ + + *error_code = MPI_SUCCESS; /* initialize to success */ + +#ifdef ROMIO_GPFS + double startTimeBase, endTimeBase; +#endif + + MPI_Status status; + pthread_t io_thread; + void *thread_ret; + ADIOI_IO_ThreadFuncData io_thread_args; + + int nprocs, myrank; + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* Initialize to self here to avoid uninitialized warnings. */ + io_thread = pthread_self(); + + ADIO_Offset myOffsetStart = st_offsets[myrank], myOffsetEnd = end_offsets[myrank]; + + int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ + int iAmUsedAgg = 0; + +#ifdef ROMIO_GPFS + startTimeBase = MPI_Wtime(); +#endif + + int naggs = fd->hints->cb_nodes; + int coll_bufsize = fd->hints->cb_buffer_size; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio == 1) { + /* split buffer in half for a kind of double buffering with the threads */ + coll_bufsize = fd->hints->cb_buffer_size / 2; + } +#endif + + int j; + for (j = 0; j < naggs; j++) { + if (fd->hints->ranklist[j] == myrank) { + myAggRank = j; + if (fd_end[j] > fd_start[j]) { + iAmUsedAgg = 1; + } + } + } + + /* Determine how much data and to whom I need to send. For source proc + * targets, also determine the target file domain offsets locally to + * reduce communication overhead */ + int *targetAggsForMyData = (int *) ADIOI_Malloc(naggs * sizeof(int)); + ADIO_Offset *targetAggsForMyDataFDStart = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + ADIO_Offset *targetAggsForMyDataFDEnd = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + int numTargetAggs = 0; + int i; + for (i = 0; i < naggs; i++) { + if (((myOffsetStart >= fd_start[i]) && (myOffsetStart <= fd_end[i])) || + ((myOffsetEnd >= fd_start[i]) && (myOffsetEnd <= fd_end[i]))) { + targetAggsForMyData[numTargetAggs] = fd->hints->ranklist[i]; + targetAggsForMyDataFDStart[numTargetAggs] = fd_start[i]; + targetAggsForMyDataFDEnd[numTargetAggs] = fd_end[i]; + numTargetAggs++; + } + } + + /* these 3 arrays track info on the procs that feed an aggregtor */ + int *sourceProcsForMyData = NULL; + int *remainingDataAmountToGetPerProc = NULL; + ADIO_Offset *remainingDataOffsetToGetPerProc = NULL; + + int numSourceProcs = 0; + + if (iAmUsedAgg) { /* for the used aggregators figure out how much data I + * need from what procs */ + + /* count numSourceProcs so we know how large to make the arrays */ + for (i = 0; i < nprocs; i++) + if (((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || + ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) + numSourceProcs++; + + sourceProcsForMyData = (int *) ADIOI_Malloc(numSourceProcs * sizeof(int)); + remainingDataAmountToGetPerProc = (int *) ADIOI_Malloc(numSourceProcs * sizeof(int)); + remainingDataOffsetToGetPerProc = + (ADIO_Offset *) ADIOI_Malloc(numSourceProcs * sizeof(ADIO_Offset)); + + /* everybody has the st_offsets and end_offsets for all ranks so if I am a + * used aggregator go thru them and figure out which ranks have data that + * falls into my file domain assigned to me */ + numSourceProcs = 0; + for (i = 0; i < nprocs; i++) { + if (((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || + ((end_offsets[i] >= fd_start[myAggRank]) && + (end_offsets[i] <= fd_end[myAggRank]))) { + sourceProcsForMyData[numSourceProcs] = i; + if (((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) + && ((end_offsets[i] >= fd_start[myAggRank]) && + (end_offsets[i] <= fd_end[myAggRank]))) { + remainingDataAmountToGetPerProc[numSourceProcs] = + (end_offsets[i] - st_offsets[i]) + 1; + remainingDataOffsetToGetPerProc[numSourceProcs] = st_offsets[i]; + } else if ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) { /* starts in this fd and goes past it */ + remainingDataAmountToGetPerProc[numSourceProcs] = + (fd_end[myAggRank] - st_offsets[i]) + 1; + remainingDataOffsetToGetPerProc[numSourceProcs] = st_offsets[i]; + } else { /* starts in fd before this and ends in it */ + remainingDataAmountToGetPerProc[numSourceProcs] = + (end_offsets[i] - fd_start[myAggRank]) + 1; + remainingDataOffsetToGetPerProc[numSourceProcs] = fd_start[myAggRank]; + } +#ifdef p2pcontigtrace + printf + ("getting %ld bytes from source proc %d in fd rank %d with borders %ld to %ld\n", + remainingDataAmountToGetPerProc[numSourceProcs], i, + fd->hints->ranklist[myAggRank], fd_start[myAggRank], fd_end[myAggRank]); +#endif + numSourceProcs++; + } + } + } + + int *amountOfDataReqestedByTargetAgg = (int *) ADIOI_Malloc(naggs * sizeof(int)); + for (i = 0; i < numTargetAggs; i++) { + amountOfDataReqestedByTargetAgg[i] = 0; + } + + int totalAmountDataReceived = 0; + MPI_Request *mpiSizeToSendRequest = + (MPI_Request *) ADIOI_Malloc(numTargetAggs * sizeof(MPI_Request)); + MPI_Request *mpiRecvDataRequest = + (MPI_Request *) ADIOI_Malloc(numSourceProcs * sizeof(MPI_Request)); + MPI_Request *mpiSendDataSizeRequest = + (MPI_Request *) ADIOI_Malloc(numSourceProcs * sizeof(MPI_Request)); + + MPI_Request *mpiSendDataToTargetAggRequest = + (MPI_Request *) ADIOI_Malloc(numTargetAggs * sizeof(MPI_Request)); + MPI_Status mpiWaitAnyStatusFromTargetAggs, mpiWaitAnyStatusFromSourceProcs; + MPI_Status mpiIsendStatusForSize, mpiIsendStatusForData; + + /* use the write buffer allocated in the file_open */ + char *write_buf0 = fd->io_buf; + char *write_buf1 = fd->io_buf + coll_bufsize; + + /* start off pointing to the first buffer. If we use the 2nd buffer (threaded + * case) we'll swap later */ + char *write_buf = write_buf0; + + /* compute number of rounds */ + ADIO_Offset numberOfRounds = + (ADIO_Offset) ((((ADIO_Offset) (end_offsets[nprocs - 1] - st_offsets[0])) / + ((ADIO_Offset) ((ADIO_Offset) coll_bufsize * (ADIO_Offset) naggs)))) + 1; + + int currentWriteBuf = 0; + int useIOBuffer = 0; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio && (numberOfRounds > 1)) { + useIOBuffer = 1; + } +#endif + + ADIO_Offset currentRoundFDStart = 0; + ADIO_Offset currentRoundFDEnd = 0; + + if (iAmUsedAgg) { + currentRoundFDStart = fd_start[myAggRank]; + } + + int *dataSizeGottenThisRoundPerProc = (int *) ADIOI_Malloc(numSourceProcs * sizeof(int)); + int *mpiRequestMapPerProc = (int *) ADIOI_Malloc(numSourceProcs * sizeof(int)); + int *targetAggIndexesForMyDataThisRound = (int *) ADIOI_Malloc(numTargetAggs * sizeof(int)); + int *sendBufferOffsetsThisRound = (int *) ADIOI_Malloc(numTargetAggs * sizeof(int)); + int *bufferAmountsToSendThisRound = (int *) ADIOI_Malloc(numTargetAggs * sizeof(int)); + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_MYREQ] += (endTimeBase - startTimeBase); + startTimeBase = MPI_Wtime(); +#endif + + /* each iteration of this loop writes a coll_bufsize portion of the file + * domain */ + int roundIter; + for (roundIter = 0; roundIter < numberOfRounds; roundIter++) { + + /* determine what target aggs I need to send data to this round */ + int numTargetAggsThisRound = 0; + for (i = 0; i < numTargetAggs; i++) { + if (((myOffsetStart >= targetAggsForMyDataFDStart[i]) && + (myOffsetStart <= targetAggsForMyDataFDEnd[i])) || + ((myOffsetEnd >= targetAggsForMyDataFDStart[i]) && + (myOffsetEnd <= targetAggsForMyDataFDEnd[i]))) { + /* we know that we need to send data to this target agg at some point, now need to figure out how much this round */ + + /* here are the offsets currently being collected by the aggregator during this round */ + ADIO_Offset currentRoundFDStartForMyTargetAgg = + (ADIO_Offset) ((ADIO_Offset) targetAggsForMyDataFDStart[i] + + (ADIO_Offset) ((ADIO_Offset) roundIter * + (ADIO_Offset) coll_bufsize)); + ADIO_Offset currentRoundFDEndForMyTargetAgg = + (ADIO_Offset) ((ADIO_Offset) targetAggsForMyDataFDStart[i] + + (ADIO_Offset) ((ADIO_Offset) (roundIter + 1) * + (ADIO_Offset) coll_bufsize) - (ADIO_Offset) 1); + if (currentRoundFDEndForMyTargetAgg > targetAggsForMyDataFDEnd[i]) + currentRoundFDEndForMyTargetAgg = targetAggsForMyDataFDEnd[i]; + +#ifdef p2pcontigtrace + printf + ("roundIter %d target iter %d targetAggsForMyData is %d myOffsetStart is %ld myOffsetEnd is %ld targetAggsForMyDataFDStart is %ld targetAggsForMyDataFDEnd is %ld currentRoundFDStartForMyTargetAgg is %ld currentRoundFDEndForMyTargetAgg is %ld\n", + roundIter, i, targetAggsForMyData[i], myOffsetStart, myOffsetEnd, + targetAggsForMyDataFDStart[i], targetAggsForMyDataFDEnd[i], + currentRoundFDStartForMyTargetAgg, currentRoundFDEndForMyTargetAgg); +#endif + + /* send the portion of my data that is within + * currentRoundFDStartForMyTargetAgg to + * currentRoundFDEndForMyTargetAgg */ + /* find the offset into the send buffer and the amount + * of data to send */ + int sendBufferOffset = 0; + int bufferAmountToSend = 0; + + if ((myOffsetStart >= currentRoundFDStartForMyTargetAgg) && + (myOffsetStart <= currentRoundFDEndForMyTargetAgg)) { + if (myOffsetEnd > currentRoundFDEndForMyTargetAgg) + bufferAmountToSend = (currentRoundFDEndForMyTargetAgg - myOffsetStart) + 1; + else + bufferAmountToSend = (myOffsetEnd - myOffsetStart) + 1; + } else if ((myOffsetEnd >= currentRoundFDStartForMyTargetAgg) && + (myOffsetEnd <= currentRoundFDEndForMyTargetAgg)) { + sendBufferOffset = (int) (currentRoundFDStartForMyTargetAgg - myOffsetStart); + if (myOffsetEnd > currentRoundFDEndForMyTargetAgg) + bufferAmountToSend = + (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) + + 1; + else + bufferAmountToSend = (myOffsetEnd - currentRoundFDStartForMyTargetAgg) + 1; + } else if ((myOffsetStart <= currentRoundFDStartForMyTargetAgg) && + (myOffsetEnd >= currentRoundFDEndForMyTargetAgg)) { + sendBufferOffset = (int) (currentRoundFDStartForMyTargetAgg - myOffsetStart); + bufferAmountToSend = + (currentRoundFDEndForMyTargetAgg - currentRoundFDStartForMyTargetAgg) + 1; + } + + if (bufferAmountToSend > 0) { /* we have data to send this round */ + targetAggIndexesForMyDataThisRound[numTargetAggsThisRound] = i; + sendBufferOffsetsThisRound[numTargetAggsThisRound] = sendBufferOffset; + bufferAmountsToSendThisRound[numTargetAggsThisRound] = bufferAmountToSend; +#ifdef p2pcontigtrace + printf("bufferAmountToSend is %d sendBufferOffset is %d\n", bufferAmountToSend, + sendBufferOffset); +#endif + /* only need to be pinged by the agg for rounds after the first one - for the first one just + * send the data without being pinged */ + if (roundIter > 0) + MPI_Irecv(&amountOfDataReqestedByTargetAgg[numTargetAggsThisRound], 1, + MPI_INT, targetAggsForMyData[i], 0, + fd->comm, &mpiSizeToSendRequest[numTargetAggsThisRound]); + numTargetAggsThisRound++; + + } + } + } + + /* determine what offsets define the portion of the file domain the agg is writing this round */ + if (iAmUsedAgg) { + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + currentRoundFDEnd = fd_end[myAggRank]; + } else + currentRoundFDEnd = currentRoundFDStart + coll_bufsize - 1; +#ifdef p2pcontigtrace + printf + ("currentRoundFDStart is %ld currentRoundFDEnd is %ld within file domeain %ld to %ld\n", + currentRoundFDStart, currentRoundFDEnd, fd_start[myAggRank], fd_end[myAggRank]); +#endif + } + + int irecv, isend; + int numSourceProcsSentData = 0; + + /* the aggs send the amount of data they need to their source procs */ + for (i = 0; i < numSourceProcs; i++) { + if ((remainingDataOffsetToGetPerProc[i] >= currentRoundFDStart) && + (remainingDataOffsetToGetPerProc[i] <= currentRoundFDEnd)) { + if ((remainingDataOffsetToGetPerProc[i] + remainingDataAmountToGetPerProc[i]) <= + currentRoundFDEnd) + dataSizeGottenThisRoundPerProc[i] = remainingDataAmountToGetPerProc[i]; + else + dataSizeGottenThisRoundPerProc[i] = + (currentRoundFDEnd - remainingDataOffsetToGetPerProc[i]) + 1; + } else + if (((remainingDataOffsetToGetPerProc[i] + remainingDataAmountToGetPerProc[i]) >= + currentRoundFDStart) && + ((remainingDataOffsetToGetPerProc[i] + remainingDataAmountToGetPerProc[i]) <= + currentRoundFDEnd)) { + if ((remainingDataOffsetToGetPerProc[i]) >= currentRoundFDStart) + dataSizeGottenThisRoundPerProc[i] = remainingDataAmountToGetPerProc[i]; + else + dataSizeGottenThisRoundPerProc[i] = + (remainingDataOffsetToGetPerProc[i] - currentRoundFDStart) + 1; + } else + dataSizeGottenThisRoundPerProc[i] = 0; + +#ifdef p2pcontigtrace + printf + ("dataSizeGottenThisRoundPerProc[%d] set to %d - remainingDataOffsetToGetPerProc is %d remainingDataAmountToGetPerProc is %d currentRoundFDStart is %d currentRoundFDEnd is %d\n", + i, dataSizeGottenThisRoundPerProc[i], remainingDataOffsetToGetPerProc[i], + remainingDataAmountToGetPerProc[i], currentRoundFDStart, currentRoundFDEnd); +#endif + if (dataSizeGottenThisRoundPerProc[i] > 0) { + if (roundIter > 0) { + MPI_Isend(&dataSizeGottenThisRoundPerProc[i], 1, MPI_INT, + sourceProcsForMyData[i], 0, fd->comm, + &mpiSendDataSizeRequest[numSourceProcsSentData]); + numSourceProcsSentData++; + } + } + } + + int numDataSendToWaitFor = 0; + /* the source procs send the requested data to the aggs */ + for (i = 0; i < numTargetAggsThisRound; i++) { + + /* the source procs aren't pinged by the target aggs on the first round */ + if (roundIter > 0) { + + MPI_Waitany(numTargetAggsThisRound, mpiSizeToSendRequest, + &irecv, &mpiWaitAnyStatusFromTargetAggs); + +#ifdef p2pcontigtrace + printf + ("irecv is %d amountOfDataReqestedByTargetAgg is %d bufferAmountsToSendThisRound is %d sendBufferOffsetsThisRound is %d targetAggsForMyData is %d\n", + irecv, amountOfDataReqestedByTargetAgg[irecv], + bufferAmountsToSendThisRound[irecv], sendBufferOffsetsThisRound[irecv], + targetAggsForMyData[targetAggIndexesForMyDataThisRound[irecv]]); +#endif + ADIOI_Assert(amountOfDataReqestedByTargetAgg[irecv] == + bufferAmountsToSendThisRound[irecv]); + MPI_Isend(&((char *) buf)[sendBufferOffsetsThisRound[irecv]], + bufferAmountsToSendThisRound[irecv], MPI_BYTE, + targetAggsForMyData[targetAggIndexesForMyDataThisRound[irecv]], 0, + fd->comm, &mpiSendDataToTargetAggRequest[irecv]); + + } else { +#ifdef p2pcontigtrace + printf + ("i is %d bufferAmountsToSendThisRound is %d sendBufferOffsetsThisRound is %d targetAggsForMyData is %d\n", + i, bufferAmountsToSendThisRound[i], sendBufferOffsetsThisRound[i], + targetAggsForMyData[targetAggIndexesForMyDataThisRound[i]]); +#endif + MPI_Isend(&((char *) buf)[sendBufferOffsetsThisRound[i]], + bufferAmountsToSendThisRound[i], MPI_BYTE, + targetAggsForMyData[targetAggIndexesForMyDataThisRound[i]], 0, fd->comm, + &mpiSendDataToTargetAggRequest[i]); + } + numDataSendToWaitFor++; + } + +#ifdef ROMIO_GPFS + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_SETUP] += (endTimeBase - startTimeBase); + startTimeBase = MPI_Wtime(); +#endif + + /* the aggs receive the data from the source procs */ + int numDataRecvToWaitFor = 0; + for (i = 0; i < numSourceProcs; i++) { + + int currentWBOffset = 0; + for (j = 0; j < i; j++) + currentWBOffset += dataSizeGottenThisRoundPerProc[j]; + + /* only receive from source procs that will send > 0 count data */ + if (dataSizeGottenThisRoundPerProc[i] > 0) { +#ifdef p2pcontigtrace + printf + ("receiving data from rank %d dataSizeGottenThisRoundPerProc is %d currentWBOffset is %d\n", + sourceProcsForMyData[i], dataSizeGottenThisRoundPerProc[i], currentWBOffset); +#endif + MPI_Irecv(&((char *) write_buf)[currentWBOffset], dataSizeGottenThisRoundPerProc[i], + MPI_BYTE, sourceProcsForMyData[i], 0, + fd->comm, &mpiRecvDataRequest[numDataRecvToWaitFor]); + mpiRequestMapPerProc[numDataRecvToWaitFor] = i; + numDataRecvToWaitFor++; + } +#ifdef p2pcontigtrace + printf("MPI_Irecv from rank %d\n", targetAggsForMyData[i]); +#endif + } + + int totalDataReceivedThisRound = 0; + for (i = 0; i < numDataRecvToWaitFor; i++) { + MPI_Waitany(numDataRecvToWaitFor, mpiRecvDataRequest, + &irecv, &mpiWaitAnyStatusFromSourceProcs); + totalDataReceivedThisRound += + dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; + totalAmountDataReceived += dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; + +#ifdef p2pcontigtrace + printf + ("numDataRecvToWaitFor is %d was sent %d bytes data for %d remaining bytes from rank %d irecv index %d\n", + numDataRecvToWaitFor, dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]], + remainingDataAmountToGetPerProc[mpiRequestMapPerProc[irecv]], + sourceProcsForMyData[mpiRequestMapPerProc[irecv]], irecv); +#endif + remainingDataAmountToGetPerProc[mpiRequestMapPerProc[irecv]] -= + dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; + remainingDataOffsetToGetPerProc[mpiRequestMapPerProc[irecv]] += + dataSizeGottenThisRoundPerProc[mpiRequestMapPerProc[irecv]]; + + } + + /* clean up the MPI_Request object for the MPI_Isend which told the + * source procs how much data to send */ + for (i = 0; i < numSourceProcsSentData; i++) { + MPI_Waitany(numSourceProcsSentData, mpiSendDataSizeRequest, + &isend, &mpiIsendStatusForSize); + } + + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_NET] += (endTimeBase - startTimeBase); +#endif + /* the aggs now write the data */ + if (numDataRecvToWaitFor > 0) { + +#ifdef p2pcontigtrace + printf("totalDataReceivedThisRound is %d\n", totalDataReceivedThisRound); +#endif + if (!useIOBuffer) { + + ADIO_WriteContig(fd, write_buf, (int) totalDataReceivedThisRound, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, + currentRoundFDStart, &status, error_code); + } else { /* use the thread writer */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + io_thread_args.fd = fd; + /* do a little pointer shuffling: background I/O works from one + * buffer while two-phase machinery fills up another */ + + if (currentWriteBuf == 0) { + io_thread_args.buf = write_buf0; + currentWriteBuf = 1; + write_buf = write_buf1; + } else { + io_thread_args.buf = write_buf1; + currentWriteBuf = 0; + write_buf = write_buf0; + } + io_thread_args.io_kind = ADIOI_WRITE; + io_thread_args.size = totalDataReceivedThisRound; + io_thread_args.offset = currentRoundFDStart; + io_thread_args.status = &status; + io_thread_args.error_code = *error_code; + if ((pthread_create(&io_thread, NULL, + ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) + io_thread = pthread_self(); + + } + + } + /* numDataRecvToWaitFor > 0 */ + if (iAmUsedAgg) + currentRoundFDStart += coll_bufsize; + for (i = 0; i < numDataSendToWaitFor; i++) { + MPI_Wait(&mpiSendDataToTargetAggRequest[i], &mpiIsendStatusForData); + } + + } /* for-loop roundIter */ + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH] += (endTimeBase - startTimeBase); +#endif + + if (useIOBuffer) { /* thread writer cleanup */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + } + + } + + + + if (iAmUsedAgg) { + ADIOI_Free(sourceProcsForMyData); + ADIOI_Free(remainingDataAmountToGetPerProc); + ADIOI_Free(remainingDataOffsetToGetPerProc); + } + + ADIOI_Free(targetAggsForMyData); + ADIOI_Free(targetAggsForMyDataFDStart); + ADIOI_Free(targetAggsForMyDataFDEnd); + ADIOI_Free(targetAggIndexesForMyDataThisRound); + ADIOI_Free(sendBufferOffsetsThisRound); + ADIOI_Free(bufferAmountsToSendThisRound); + ADIOI_Free(amountOfDataReqestedByTargetAgg); + ADIOI_Free(mpiSizeToSendRequest); + ADIOI_Free(mpiRecvDataRequest); + ADIOI_Free(mpiSendDataSizeRequest); + ADIOI_Free(mpiSendDataToTargetAggRequest); + ADIOI_Free(dataSizeGottenThisRoundPerProc); + ADIOI_Free(mpiRequestMapPerProc); + + /* TODO: still need a barrier here? */ + MPI_Barrier(fd->comm); + return; +} + +void ADIOI_P2PContigReadAggregation(ADIO_File fd, + const void *buf, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + ADIO_Offset * fd_start, ADIO_Offset * fd_end) +{ + + *error_code = MPI_SUCCESS; /* initialize to success */ + +#ifdef ROMIO_GPFS + double startTimeBase, endTimeBase; +#endif + + MPI_Status status; + pthread_t io_thread; + void *thread_ret; + ADIOI_IO_ThreadFuncData io_thread_args; + +#ifdef ROMIO_GPFS + startTimeBase = MPI_Wtime(); +#endif + + int nprocs, myrank; + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* Initialize to self here to avoid uninitialized warnings. */ + io_thread = pthread_self(); + + ADIO_Offset myOffsetStart = st_offsets[myrank], myOffsetEnd = end_offsets[myrank]; + + int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */ + int iAmUsedAgg = 0; + + int naggs = fd->hints->cb_nodes; + int coll_bufsize = fd->hints->cb_buffer_size; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio == 1) + /* share buffer between working threads */ + coll_bufsize = coll_bufsize / 2; +#endif + + int j; + for (j = 0; j < naggs; j++) { + if (fd->hints->ranklist[j] == myrank) { + myAggRank = j; + if (fd_end[j] > fd_start[j]) { + iAmUsedAgg = 1; + } + } + } + + /* for my offset range determine how much data and from whom I need to get + * it. For source ag targets, also determine the source file domain + * offsets locally to reduce communication overhead */ + int *sourceAggsForMyData = (int *) ADIOI_Malloc(naggs * sizeof(int)); + ADIO_Offset *sourceAggsForMyDataFDStart = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + ADIO_Offset *sourceAggsForMyDataFDEnd = + (ADIO_Offset *) ADIOI_Malloc(naggs * sizeof(ADIO_Offset)); + int numSourceAggs = 0; + int i; + for (i = 0; i < naggs; i++) { + if (((myOffsetStart >= fd_start[i]) && (myOffsetStart <= fd_end[i])) || + ((myOffsetEnd >= fd_start[i]) && (myOffsetEnd <= fd_end[i]))) { + sourceAggsForMyData[numSourceAggs] = fd->hints->ranklist[i]; + sourceAggsForMyDataFDStart[numSourceAggs] = fd_start[i]; + sourceAggsForMyDataFDEnd[numSourceAggs] = fd_end[i]; + numSourceAggs++; + } + } + + /* these 3 arrays track info on the procs that are fed from an aggregtor - + * to sacrifice some performance at setup to save on memory instead of + * using max size of nprocs for the arrays could determine exact size first + * and then allocate that size */ + int *targetProcsForMyData = NULL; + int *remainingDataAmountToSendPerProc = NULL; + ADIO_Offset *remainingDataOffsetToSendPerProc = NULL; + + int numTargetProcs = 0; + + if (iAmUsedAgg) { + /* for the used aggregators figure out how much data I need from what procs */ + + /* count numTargetProcs so we know how large to make the arrays */ + for (i = 0; i < nprocs; i++) + if (((st_offsets[i] >= fd_start[myAggRank]) && + (st_offsets[i] <= fd_end[myAggRank])) || + ((end_offsets[i] >= fd_start[myAggRank]) && (end_offsets[i] <= fd_end[myAggRank]))) + numTargetProcs++; + + targetProcsForMyData = (int *) ADIOI_Malloc(numTargetProcs * sizeof(int)); + remainingDataAmountToSendPerProc = (int *) ADIOI_Malloc(numTargetProcs * sizeof(int)); + remainingDataOffsetToSendPerProc = + (ADIO_Offset *) ADIOI_Malloc(numTargetProcs * sizeof(ADIO_Offset)); + + /* everybody has the st_offsets and end_offsets for all ranks so if I am a + * used aggregator go thru them and figure out which ranks have data that + * falls into my file domain assigned to me */ + numTargetProcs = 0; + for (i = 0; i < nprocs; i++) { + if (((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) || + ((end_offsets[i] >= fd_start[myAggRank]) && + (end_offsets[i] <= fd_end[myAggRank]))) { + targetProcsForMyData[numTargetProcs] = i; + if (((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) + && ((end_offsets[i] >= fd_start[myAggRank]) && + (end_offsets[i] <= fd_end[myAggRank]))) { + remainingDataAmountToSendPerProc[numTargetProcs] = + (end_offsets[i] - st_offsets[i]) + 1; + remainingDataOffsetToSendPerProc[numTargetProcs] = st_offsets[i]; + } else if ((st_offsets[i] >= fd_start[myAggRank]) && (st_offsets[i] <= fd_end[myAggRank])) { /* starts in this fd and goes past it */ + remainingDataAmountToSendPerProc[numTargetProcs] = + (fd_end[myAggRank] - st_offsets[i]) + 1; + remainingDataOffsetToSendPerProc[numTargetProcs] = st_offsets[i]; + } else { /* starts in fd before this and ends in it */ + remainingDataAmountToSendPerProc[numTargetProcs] = + (end_offsets[i] - fd_start[myAggRank]) + 1; + remainingDataOffsetToSendPerProc[numTargetProcs] = fd_start[myAggRank]; + } + numTargetProcs++; + } + } + } + + + MPI_Request *mpiRecvDataFromSourceAggsRequest = + (MPI_Request *) ADIOI_Malloc(numSourceAggs * sizeof(MPI_Request)); + MPI_Request *mpiSendDataToTargetProcRequest = + (MPI_Request *) ADIOI_Malloc(numTargetProcs * sizeof(MPI_Request)); + MPI_Status mpiWaitAnyStatusFromSourceProcs, mpiIsendStatusForData; + + /* use the two-phase buffer allocated in the file_open - no app should ever + * be both reading and writing at the same time */ + char *read_buf0 = fd->io_buf; + char *read_buf1 = fd->io_buf + coll_bufsize; + /* if threaded i/o selected, we'll do a kind of double buffering */ + char *read_buf = read_buf0; + + /* compute number of rounds */ + ADIO_Offset numberOfRounds = + (ADIO_Offset) ((((ADIO_Offset) (end_offsets[nprocs - 1] - st_offsets[0])) / + ((ADIO_Offset) ((ADIO_Offset) coll_bufsize * (ADIO_Offset) naggs)))) + 1; + + ADIO_Offset currentRoundFDStart = 0, nextRoundFDStart = 0; + ADIO_Offset currentRoundFDEnd = 0, nextRoundFDEnd = 0; + + if (iAmUsedAgg) { + currentRoundFDStart = fd_start[myAggRank]; + nextRoundFDStart = fd_start[myAggRank]; + } + + int *dataSizeSentThisRoundPerProc = (int *) ADIOI_Malloc(numTargetProcs * sizeof(int)); + int *sourceAggIndexesForMyDataThisRound = (int *) ADIOI_Malloc(numSourceAggs * sizeof(int)); + int *recvBufferOffsetsThisRound = (int *) ADIOI_Malloc(numSourceAggs * sizeof(int)); + int *bufferAmountsToGetThisRound = (int *) ADIOI_Malloc(numSourceAggs * sizeof(int)); + *error_code = MPI_SUCCESS; + + int currentReadBuf = 0; + int useIOBuffer = 0; +#ifdef ROMIO_GPFS + if (gpfsmpio_pthreadio && (numberOfRounds > 1)) { + useIOBuffer = 1; + } +#endif + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); + gpfsmpio_prof_cw[GPFSMPIO_CIO_T_MYREQ] += (endTimeBase - startTimeBase); +#endif + + + /* each iteration of this loop reads a coll_bufsize portion of the file domain */ + int roundIter; + for (roundIter = 0; roundIter < numberOfRounds; roundIter++) { + + int irecv, isend; + /* determine what offsets define the portion of the file domain the agg is reading this round */ + if (iAmUsedAgg) { + + currentRoundFDStart = nextRoundFDStart; + + if (!useIOBuffer || (roundIter == 0)) { + int amountDataToReadThisRound; + if ((fd_end[myAggRank] - currentRoundFDStart) < coll_bufsize) { + currentRoundFDEnd = fd_end[myAggRank]; + amountDataToReadThisRound = ((currentRoundFDEnd - currentRoundFDStart) + 1); + } else { + currentRoundFDEnd = currentRoundFDStart + coll_bufsize - 1; + amountDataToReadThisRound = coll_bufsize; + } + + /* read currentRoundFDEnd bytes */ + ADIO_ReadContig(fd, read_buf, amountDataToReadThisRound, + MPI_BYTE, ADIO_EXPLICIT_OFFSET, currentRoundFDStart, + &status, error_code); + currentReadBuf = 1; + +#ifdef ROMIO_GPFS + endTimeBase = MPI_Wtime(); +#endif + } + + if (useIOBuffer) { /* use the thread reader for the next round */ + /* switch back and forth between the read buffers so that the data aggregation code is diseminating 1 buffer while the thread is reading into the other */ + + if (roundIter > 0) + currentRoundFDEnd = nextRoundFDEnd; + + if (roundIter < (numberOfRounds - 1)) { + nextRoundFDStart += coll_bufsize; + int amountDataToReadNextRound; + if ((fd_end[myAggRank] - nextRoundFDStart) < coll_bufsize) { + nextRoundFDEnd = fd_end[myAggRank]; + amountDataToReadNextRound = ((nextRoundFDEnd - nextRoundFDStart) + 1); + } else { + nextRoundFDEnd = nextRoundFDStart + coll_bufsize - 1; + amountDataToReadNextRound = coll_bufsize; + } + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + io_thread_args.fd = fd; + /* do a little pointer shuffling: background I/O works from one + * buffer while two-phase machinery fills up another */ + + if (currentReadBuf == 0) { + io_thread_args.buf = read_buf0; + currentReadBuf = 1; + read_buf = read_buf1; + } else { + io_thread_args.buf = read_buf1; + currentReadBuf = 0; + read_buf = read_buf0; + } + io_thread_args.io_kind = ADIOI_READ; + io_thread_args.size = amountDataToReadNextRound; + io_thread_args.offset = nextRoundFDStart; + io_thread_args.status = &status; + io_thread_args.error_code = *error_code; + if ((pthread_create(&io_thread, NULL, + ADIOI_IO_Thread_Func, &(io_thread_args))) != 0) + io_thread = pthread_self(); + + } else { /* last round */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + if (*error_code != MPI_SUCCESS) + return; + io_thread = pthread_self(); + + } + if (currentReadBuf == 0) { + read_buf = read_buf1; + } else { + read_buf = read_buf0; + } + + } + } /* useIOBuffer */ + } + + /* IAmUsedAgg */ + /* determine what source aggs I need to get data from this round and + * recv only from them */ + int numSourceAggsThisRound = 0; + for (i = 0; i < numSourceAggs; i++) { + if (((myOffsetStart >= sourceAggsForMyDataFDStart[i]) && + (myOffsetStart <= sourceAggsForMyDataFDEnd[i])) + || ((myOffsetEnd >= sourceAggsForMyDataFDStart[i]) && + (myOffsetEnd <= sourceAggsForMyDataFDEnd[i]))) { + /* we know that we need to get data from this source agg at + * some point, now need to figure out how much this round */ + + /* here are the offsets currently being sent by the aggregator + * during this round */ + ADIO_Offset currentRoundFDStartForMySourceAgg = + (ADIO_Offset) ((ADIO_Offset) sourceAggsForMyDataFDStart[i] + + (ADIO_Offset) ((ADIO_Offset) roundIter * + (ADIO_Offset) coll_bufsize)); + ADIO_Offset currentRoundFDEndForMySourceAgg = + (ADIO_Offset) ((ADIO_Offset) sourceAggsForMyDataFDStart[i] + + (ADIO_Offset) ((ADIO_Offset) (roundIter + 1) * + (ADIO_Offset) coll_bufsize) - (ADIO_Offset) 1); + if (currentRoundFDEndForMySourceAgg > sourceAggsForMyDataFDEnd[i]) + currentRoundFDEndForMySourceAgg = sourceAggsForMyDataFDEnd[i]; + +#ifdef p2pcontigtrace + printf + ("roundIter %d source iter %d sourceAggsForMyData is %d myOffsetStart is %ld myOffsetEnd is %ld sourceAggsForMyDataFDStart is %ld sourceAggsForMyDataFDEnd is %ld currentRoundFDStartForMySourceAgg is %ld currentRoundFDEndForMySourceAgg is %ld\n", + roundIter, i, sourceAggsForMyData[i], myOffsetStart, myOffsetEnd, + sourceAggsForMyDataFDStart[i], sourceAggsForMyDataFDEnd[i], + currentRoundFDStartForMySourceAgg, currentRoundFDEndForMySourceAgg); +#endif + + /* get the portion of my data that is within currentRoundFDStartForMySourceAgg to currentRoundFDEndForMySourceAgg */ + /* find the offset into the recv buffer and the amount of data to get */ + int recvBufferOffset = 0; + int bufferAmountToGet = 0; + + if ((myOffsetStart >= currentRoundFDStartForMySourceAgg) && + (myOffsetStart <= currentRoundFDEndForMySourceAgg)) { + if (myOffsetEnd > currentRoundFDEndForMySourceAgg) + bufferAmountToGet = (currentRoundFDEndForMySourceAgg - myOffsetStart) + 1; + else + bufferAmountToGet = (myOffsetEnd - myOffsetStart) + 1; + } else if ((myOffsetEnd >= currentRoundFDStartForMySourceAgg) && + (myOffsetEnd <= currentRoundFDEndForMySourceAgg)) { + recvBufferOffset = (int) (currentRoundFDStartForMySourceAgg - myOffsetStart); + if (myOffsetEnd > currentRoundFDEndForMySourceAgg) + bufferAmountToGet = + (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) + + 1; + else + bufferAmountToGet = (myOffsetEnd - currentRoundFDStartForMySourceAgg) + 1; + } else if ((myOffsetStart <= currentRoundFDStartForMySourceAgg) && + (myOffsetEnd >= currentRoundFDEndForMySourceAgg)) { + recvBufferOffset = (int) (currentRoundFDStartForMySourceAgg - myOffsetStart); + bufferAmountToGet = + (currentRoundFDEndForMySourceAgg - currentRoundFDStartForMySourceAgg) + 1; + } + + + if (bufferAmountToGet > 0) { /* we have data to get this round */ + sourceAggIndexesForMyDataThisRound[numSourceAggsThisRound] = i; + recvBufferOffsetsThisRound[numSourceAggsThisRound] = recvBufferOffset; + bufferAmountsToGetThisRound[numSourceAggsThisRound] = bufferAmountToGet; +#ifdef p2pcontigtrace + printf("bufferAmountToGet is %d recvBufferOffset is %d\n", bufferAmountToGet, + recvBufferOffset); +#endif + numSourceAggsThisRound++; + } + } + } + + /* the aggs determine the amount of data they will be sending to their + * source procs */ + for (i = 0; i < numTargetProcs; i++) { + if ((remainingDataOffsetToSendPerProc[i] >= currentRoundFDStart) && + (remainingDataOffsetToSendPerProc[i] <= currentRoundFDEnd)) { + if ((remainingDataOffsetToSendPerProc[i] + + remainingDataAmountToSendPerProc[i]) <= currentRoundFDEnd) + dataSizeSentThisRoundPerProc[i] = remainingDataAmountToSendPerProc[i]; + else + dataSizeSentThisRoundPerProc[i] = + (currentRoundFDEnd - remainingDataOffsetToSendPerProc[i]) + 1; + } else if (((remainingDataOffsetToSendPerProc[i] + + remainingDataAmountToSendPerProc[i]) >= + currentRoundFDStart) && + ((remainingDataOffsetToSendPerProc[i] + + remainingDataAmountToSendPerProc[i]) <= currentRoundFDEnd)) { + if ((remainingDataOffsetToSendPerProc[i]) >= currentRoundFDStart) + dataSizeSentThisRoundPerProc[i] = remainingDataAmountToSendPerProc[i]; + else + dataSizeSentThisRoundPerProc[i] = + (remainingDataOffsetToSendPerProc[i] - currentRoundFDStart) + 1; + } else + dataSizeSentThisRoundPerProc[i] = 0; + + } + + /* the target procs get the data from the source aggs */ + for (i = 0; i < numSourceAggsThisRound; i++) { + MPI_Irecv(&((char *) buf)[recvBufferOffsetsThisRound[i]], + bufferAmountsToGetThisRound[i], MPI_BYTE, + sourceAggsForMyData[sourceAggIndexesForMyDataThisRound[i]], 0, fd->comm, + &mpiRecvDataFromSourceAggsRequest[i]); + } + + /* the source aggs send the data to the target procs */ + int numTargetProcsSentThisRound = 0; + for (i = 0; i < numTargetProcs; i++) { + + int currentWBOffset = 0; + for (j = 0; j < i; j++) + currentWBOffset += dataSizeSentThisRoundPerProc[j]; + + /* only send to target procs that will recv > 0 count data */ + if (dataSizeSentThisRoundPerProc[i] > 0) { + MPI_Isend(&((char *) read_buf)[currentWBOffset], + dataSizeSentThisRoundPerProc[i], + MPI_BYTE, targetProcsForMyData[i], 0, + fd->comm, &mpiSendDataToTargetProcRequest[numTargetProcsSentThisRound]); + numTargetProcsSentThisRound++; + remainingDataAmountToSendPerProc[i] -= dataSizeSentThisRoundPerProc[i]; + remainingDataOffsetToSendPerProc[i] += dataSizeSentThisRoundPerProc[i]; + } + } + + /* wait for the target procs to get their data */ + for (i = 0; i < numSourceAggsThisRound; i++) { + MPI_Waitany(numSourceAggsThisRound, mpiRecvDataFromSourceAggsRequest, + &irecv, &mpiWaitAnyStatusFromSourceProcs); + } + + nextRoundFDStart = currentRoundFDStart + coll_bufsize; + + /* clean up the MPI_Isend MPI_Requests */ + for (i = 0; i < numTargetProcsSentThisRound; i++) { + MPI_Waitany(numTargetProcsSentThisRound, mpiSendDataToTargetProcRequest, + &isend, &mpiIsendStatusForData); + } + + MPI_Barrier(fd->comm); /* need to sync up the source aggs which did the isend with the target procs which did the irecvs to give the target procs time to get the data before overwriting with next round readcontig */ + + } /* for-loop roundIter */ + + if (useIOBuffer) { /* thread reader cleanup */ + + if (!pthread_equal(io_thread, pthread_self())) { + pthread_join(io_thread, &thread_ret); + *error_code = *(int *) thread_ret; + } + } + + if (iAmUsedAgg) { + ADIOI_Free(targetProcsForMyData); + ADIOI_Free(remainingDataAmountToSendPerProc); + ADIOI_Free(remainingDataOffsetToSendPerProc); + } + + ADIOI_Free(sourceAggsForMyData); + ADIOI_Free(sourceAggsForMyDataFDStart); + ADIOI_Free(sourceAggsForMyDataFDEnd); + + ADIOI_Free(mpiRecvDataFromSourceAggsRequest); + ADIOI_Free(mpiSendDataToTargetProcRequest); + ADIOI_Free(dataSizeSentThisRoundPerProc); + ADIOI_Free(sourceAggIndexesForMyDataThisRound); + ADIOI_Free(recvBufferOffsetsThisRound); + ADIOI_Free(bufferAmountsToGetThisRound); + + /* TODO: is Barrier here needed? */ + MPI_Barrier(fd->comm); + + return; + +} diff --git a/3rd-party/romio341/adio/common/req_malloc.c b/3rd-party/romio341/adio/common/req_malloc.c new file mode 100644 index 0000000000000000000000000000000000000000..595ca84398e9f185236e7b07e6fa8b604134e8be --- /dev/null +++ b/3rd-party/romio341/adio/common/req_malloc.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "adio_extern.h" + +struct ADIOI_RequestD *ADIOI_Malloc_request(void) +{ +/* returns a pointer to a new request object. + To reduce the number of system calls, mallocs NUM requests at a time + and maintains list of available requests. Supplies an object from this + list if available, else mallocs a new set of NUM and provides one + from that set. Is NUM=100 a good number? */ + +#define NUM 100 + + ADIOI_Req_node *curr, *ptr; + int i; + + if (!ADIOI_Req_avail_head) { + ADIOI_Req_avail_head = (ADIOI_Req_node *) + ADIOI_Malloc(NUM * sizeof(ADIOI_Req_node)); + if (ADIOI_Req_avail_head == NULL) { + /* FIXME: Insert error here */ + return NULL; + } + curr = ADIOI_Req_avail_head; + for (i = 1; i < NUM; i++) { + curr->next = ADIOI_Req_avail_head + i; + curr = curr->next; + } + curr->next = NULL; + ADIOI_Req_avail_tail = curr; + + /* keep track of malloced area that needs to be freed later */ + if (!ADIOI_Malloc_req_tail) { + ADIOI_Malloc_req_tail = (ADIOI_Malloc_req *) + ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); + ADIOI_Malloc_req_head = ADIOI_Malloc_req_tail; + ADIOI_Malloc_req_head->ptr = ADIOI_Req_avail_head; + ADIOI_Malloc_req_head->next = NULL; + } else { + ADIOI_Malloc_req_tail->next = (ADIOI_Malloc_req *) + ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); + ADIOI_Malloc_req_tail = ADIOI_Malloc_req_tail->next; + ADIOI_Malloc_req_tail->ptr = ADIOI_Req_avail_head; + ADIOI_Malloc_req_tail->next = NULL; + } + } + + ptr = ADIOI_Req_avail_head; + ADIOI_Req_avail_head = ADIOI_Req_avail_head->next; + if (!ADIOI_Req_avail_head) + ADIOI_Req_avail_tail = NULL; + + (ptr->reqd).cookie = ADIOI_REQ_COOKIE; + return &(ptr->reqd); +} + + +void ADIOI_Free_request(ADIOI_Req_node * node) +{ +/* This function could be called as ADIOI_Free_request(ADIO_Request request), + because request would be a pointer to the first element of ADIOI_Req_node.*/ + +/* moves this node to available pool. does not actually free it. */ + + (node->reqd).cookie = 0; + + if (!ADIOI_Req_avail_tail) + ADIOI_Req_avail_head = ADIOI_Req_avail_tail = node; + else { + ADIOI_Req_avail_tail->next = node; + ADIOI_Req_avail_tail = node; + } + node->next = NULL; +} diff --git a/3rd-party/romio341/adio/common/shfp_fname.c b/3rd-party/romio341/adio/common/shfp_fname.c new file mode 100644 index 0000000000000000000000000000000000000000..518e87671d516628d49f8385a487a540d5ea128b --- /dev/null +++ b/3rd-party/romio341/adio/common/shfp_fname.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* The following function selects the name of the file to be used to + store the shared file pointer. The shared-file-pointer file is a + hidden file in the same directory as the real file being accessed. + If the real file is /tmp/thakur/testfile, the shared-file-pointer + file will be /tmp/thakur/.testfile.shfp.yyy.xxxx, where yyy + is rank 0's process id and xxxx is a random number. If the + underlying file system supports shared file pointers + (PVFS does not, for example), the file name is always + constructed. This file is created only if the shared + file pointer functions are used and is deleted when the real + file is closed. */ + +void ADIOI_Shfp_fname(ADIO_File fd, int rank, int *error_code) +{ + int len; + char *slash, *ptr, tmp[PATH_MAX]; + + fd->shared_fp_fname = (char *) ADIOI_Malloc(PATH_MAX); + + if (!rank) { + MPL_create_pathname(tmp, NULL, ".shfp", 0); + + if (ADIOI_Strncpy(fd->shared_fp_fname, fd->filename, PATH_MAX)) { + *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", fd->filename, ENAMETOOLONG); + return; + } +#ifdef ROMIO_NTFS + slash = strrchr(fd->filename, '\\'); +#else + slash = strrchr(fd->filename, '/'); +#endif + if (!slash) { + if (ADIOI_Strncpy(fd->shared_fp_fname, ".", 2)) { + *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", fd->filename, ENAMETOOLONG); + return; + } + if (ADIOI_Strncpy(fd->shared_fp_fname + 1, fd->filename, PATH_MAX - 1)) { + *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", fd->filename, ENAMETOOLONG); + return; + } + } else { + ptr = slash; +#ifdef ROMIO_NTFS + slash = strrchr(fd->shared_fp_fname, '\\'); +#else + slash = strrchr(fd->shared_fp_fname, '/'); +#endif + if (ADIOI_Strncpy(slash + 1, ".", 2)) { + *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", fd->filename, ENAMETOOLONG); + return; + } + /* ok to cast: file names bounded by PATH_MAX and NAME_MAX */ + len = (int) (PATH_MAX - (slash + 2 - fd->shared_fp_fname)); + if (ADIOI_Strncpy(slash + 2, ptr + 1, len)) { + *error_code = ADIOI_Err_create_code("ADIOI_Shfp_fname", ptr + 1, ENAMETOOLONG); + return; + } + } + + /* MPL_strnapp will return non-zero if truncated. That's ok */ + MPL_strnapp(fd->shared_fp_fname, tmp, PATH_MAX); + + len = (int) strlen(fd->shared_fp_fname); + MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm); + MPI_Bcast(fd->shared_fp_fname, len + 1, MPI_CHAR, 0, fd->comm); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm); + MPI_Bcast(fd->shared_fp_fname, len + 1, MPI_CHAR, 0, fd->comm); + } +} diff --git a/3rd-party/romio341/adio/common/status_setb.c b/3rd-party/romio341/adio/common/status_setb.c new file mode 100644 index 0000000000000000000000000000000000000000..f3edccef31b712eda845c0d375668f6dc506f5ec --- /dev/null +++ b/3rd-party/romio341/adio/common/status_setb.c @@ -0,0 +1,23 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "mpi.h" + +#if defined(HAVE_MPI_STATUS_SET_ELEMENTS_X) +/* Not quite correct, but much closer for MPI2 */ +/* TODO: still needs to handle partial datatypes and situations where the mpi + * implementation fills status with something other than bytes (globus2 might + * do this) */ +int MPIR_Status_set_bytes(MPI_Status * status, MPI_Datatype datatype, MPI_Count nbytes) +{ + MPL_UNREFERENCED_ARG(datatype); + /* it's ok that ROMIO stores number-of-bytes in status, not + * count-of-copies, as long as MPI_GET_COUNT knows what to do */ + if (status != MPI_STATUS_IGNORE) + MPI_Status_set_elements_x(status, MPI_BYTE, nbytes); + return MPI_SUCCESS; +} +#endif diff --git a/3rd-party/romio341/adio/common/strfns.c b/3rd-party/romio341/adio/common/strfns.c new file mode 100644 index 0000000000000000000000000000000000000000..9799007c77c9d02978cc9c1c20ec99045864caa3 --- /dev/null +++ b/3rd-party/romio341/adio/common/strfns.c @@ -0,0 +1,102 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" + +/* + * Below are the "safe" versions of the various string and printf + * operations. They are directly taken from MPICH, with MPIU replaced by ADIOI. + */ + +/* + * ADIOI_Strncpy - Copy at most n character. Stop once a null is reached. + * + * This is different from strncpy, which null pads so that exactly + * n characters are copied. The strncpy behavior is correct for many + * applications because it guarantees that the string has no uninitialized + * data. + * + * If n characters are copied without reaching a null, return an error. + * Otherwise, return 0. + * + */ +/*@ ADIOI_Strncpy - Copy a string with a maximum length + +Input Parameters: ++ instr - String to copy +- maxlen - Maximum total length of 'outstr' + +Output Parameters: +. outstr - String to copy into + + Notes: + This routine is the routine that you wish 'strncpy' was. In copying + 'instr' to 'outstr', it stops when either the end of 'outstr' (the + null character) is seen or the maximum length 'maxlen' is reached. + Unlike 'strncpy', it does not add enough nulls to 'outstr' after + copying 'instr' in order to move precisely 'maxlen' characters. + Thus, this routine may be used anywhere 'strcpy' is used, without any + performance cost related to large values of 'maxlen'. + + Module: + Utility + @*/ +int ADIOI_Strncpy(char *dest, const char *src, size_t n) +{ + char *restrict d_ptr = dest; + const char *restrict s_ptr = src; + register int i; + + i = (int) n; + while (*s_ptr && i-- > 0) { + *d_ptr++ = *s_ptr++; + } + + if (i > 0) { + *d_ptr = 0; + return 0; + } else + /* We may want to force an error message here, at least in the + * debugging version */ + return 1; +} + +/*@ + ADIOI_Strdup - Duplicate a string + + Synopsis: +.vb + char *ADIOI_Strdup(const char *str) +.ve + +Input Parameters: +. str - null-terminated string to duplicate + + Return value: + A pointer to a copy of the string, including the terminating null. A + null pointer is returned on error, such as out-of-memory. + + Notes: + Like 'ADIOI_Malloc' and 'ADIOI_Free', this will often be implemented as a + macro but may use 'ADIOI_trstrdup' to provide a tracing version. + + Module: + Utility + @*/ +char *ADIOI_Strdup(const char *str) +{ + char *p = ADIOI_Malloc(strlen(str) + 1); + char *in_p = (char *) str; + char *save_p; + + save_p = p; + if (p) { + while (*in_p) { + *p++ = *in_p++; + } + *p = '\0'; + } + return save_p; +} diff --git a/3rd-party/romio341/adio/common/system_hints.c b/3rd-party/romio341/adio/common/system_hints.c new file mode 100644 index 0000000000000000000000000000000000000000..1a2addc44288eab831ac5e48eab34046fb57781f --- /dev/null +++ b/3rd-party/romio341/adio/common/system_hints.c @@ -0,0 +1,198 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <adio.h> + +#include <stdio.h> + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_IO_H +#include <io.h> +#endif + +/*#define SYSHINT_DEBUG 1 */ + +#define ROMIO_HINT_DEFAULT_CFG "/etc/romio-hints" +#define ROMIO_HINT_ENV_VAR "ROMIO_HINTS" + +/* debug function: a routine I want in the library to make my life easier when + * using a source debugger. Now optionally used in ADIO_Open. */ +void ADIOI_Info_print_keyvals(MPI_Info info) +{ + int i, nkeys, flag; + char key[MPI_MAX_INFO_KEY + 1]; + char value[MPI_MAX_INFO_VAL + 1]; + + if (info == MPI_INFO_NULL) + return; + + MPI_Info_get_nkeys(info, &nkeys); + + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info, i, key); + ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + printf("key = %-25s value = %-10s\n", key, value); + } + return; +} + +/* if user set the environment variable, use its value to find the + * file-of-hints. Otherwise, we'll look for the default config file. i.e. let + * the user override systemwide hint processing */ + +static int find_file(void) +{ + int fd = -1; + char *hintfile; + + hintfile = getenv(ROMIO_HINT_ENV_VAR); + if (hintfile) + fd = open(hintfile, O_RDONLY); + if (fd < 0) + fd = open(ROMIO_HINT_DEFAULT_CFG, O_RDONLY); + + return fd; +} + +/* parse the file-of-hints. Format is zero or more lines of "<key> <value>\n". + * A # in collumn zero is a comment and the line will be ignored. Do our best + * to ignore badly formed lines too. + * + * The caller provides an 'info' object. Each key-value pair found by the + * parser will get added to the info object. any keys already set will be left + * alone on the assumption that the caller knows best. + * + * because MPI-IO hints are optional, we can get away with limited error + * reporting. + * + * for better scalability, the config file will be read on one processor and + * broadcast to all others */ +static int file_to_info_all(int fd, MPI_Info info, int rank, MPI_Comm comm) +{ + char *buffer, *token, *key, *val, *garbage; + char *pos1 = NULL, *pos2 = NULL; + int flag; + ssize_t ret; + int valuelen; + + /* assumption: config files will be small */ +#define HINTFILE_MAX_SIZE 1024*4 + buffer = (char *) ADIOI_Calloc(HINTFILE_MAX_SIZE, sizeof(char)); + + if (rank == 0) { + ret = (fd >= 0) ? read(fd, buffer, HINTFILE_MAX_SIZE) : -1; + /* any error: bad/nonexistent fd, no perms, anything: set up a null + * buffer and the subsequent string parsing will quit immediately */ + if (ret == -1) + buffer[0] = '\0'; + } + MPI_Bcast(buffer, HINTFILE_MAX_SIZE, MPI_BYTE, 0, comm); + + token = strtok_r(buffer, "\n", &pos1); + if (token == NULL) + goto fn_exit; + do { + if ((key = strtok_r(token, " \t", &pos2)) == NULL) + /* malformed line: found no items */ + continue; + if (token[0] == '#') + /* ignore '#'-delimited comments */ + continue; + if ((val = strtok_r(NULL, " \t", &pos2)) == NULL) + /* malformed line: found key without value */ + continue; + if ((garbage = strtok_r(NULL, " \t", &pos2)) != NULL) + /* malformed line: more than two items */ + continue; + +#ifdef SYSHINT_DEBUG + printf("found: key=%s val=%s\n", key, val); +#endif + /* don't actually care what the value is. only want to know if key + * exists: we leave it alone if so*/ + ADIOI_Info_get_valuelen(info, key, &valuelen, &flag); + if (flag == 1) + continue; + ADIOI_Info_set(info, key, val); + } while ((token = strtok_r(NULL, "\n", &pos1)) != NULL); + + fn_exit: + ADIOI_Free(buffer); + return 0; +} + +void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info) +{ + int hintfd = -1, rank; + + MPI_Comm_rank(fd->comm, &rank); + if (rank == 0) { + hintfd = find_file(); + } + /* hintfd only significant on rank 0. -1 (on rank 0) means no hintfile found */ + file_to_info_all(hintfd, info, rank, fd->comm); + + if (hintfd != -1) + close(hintfd); +} + +/* given 'info', incorporate any hints in 'sysinfo' that are not already set + * into 'new_info'. Caller must free 'new_info' later. */ +void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo, MPI_Info * new_info) +{ + int i, nkeys_sysinfo, nkeys_info = 0, flag = 0; /* must initialize flag to 0 */ + int valuelen; + + char val[MPI_MAX_INFO_VAL + 1], key[MPI_MAX_INFO_KEY + 1]; + + if (sysinfo == MPI_INFO_NULL) + nkeys_sysinfo = 0; + else + MPI_Info_get_nkeys(sysinfo, &nkeys_sysinfo); + + /* short-circuit: return immediately if no hints to process */ + if (info == MPI_INFO_NULL && nkeys_sysinfo == 0) { + *new_info = MPI_INFO_NULL; + return; + } + + if (info == MPI_INFO_NULL) + MPI_Info_create(new_info); + else { + /* tiny optimization: if 'info' has no keys, we can skip the check if a + * hint is set: no keys means nothing has been set, and there's nothing + * we might step on */ + MPI_Info_get_nkeys(info, &nkeys_info); + MPI_Info_dup(info, new_info); + } + + for (i = 0; i < nkeys_sysinfo; i++) { + MPI_Info_get_nthkey(sysinfo, i, key); + /* don't care about the value, just want to know if hint set already */ + if (info != MPI_INFO_NULL && nkeys_info) + ADIOI_Info_get_valuelen(info, key, &valuelen, &flag); + if (flag == 1) + continue; /* skip any hints already set by user */ + ADIOI_Info_get(sysinfo, key, MPI_MAX_INFO_VAL, val, &flag); + ADIOI_Info_set(*new_info, key, val); + flag = 0; + } + + return; +} diff --git a/3rd-party/romio321/adio/common/utils.c b/3rd-party/romio341/adio/common/utils.c similarity index 62% rename from 3rd-party/romio321/adio/common/utils.c rename to 3rd-party/romio341/adio/common/utils.c index 16f7dc60e2c3f04b617e20c86c4b75f036d89f7e..d81656b3305cd959d05f5616424e751a40450343 100644 --- a/3rd-party/romio321/adio/common/utils.c +++ b/3rd-party/romio341/adio/common/utils.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * - * Copyright (C) 2014 UChicgo/Argonne, LLC. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include <adio.h> @@ -12,8 +10,7 @@ /* utility function for creating large contiguous types: algorithim from BigMPI * https://github.com/jeffhammond/BigMPI */ -static int type_create_contiguous_x(MPI_Count count, - MPI_Datatype oldtype, MPI_Datatype *newtype) +static int type_create_contiguous_x(MPI_Count count, MPI_Datatype oldtype, MPI_Datatype * newtype) { /* to make 'count' fit MPI-3 type processing routines (which take integer * counts), we construct a type consisting of N INT_MAX chunks followed by @@ -28,18 +25,21 @@ static int type_create_contiguous_x(MPI_Count count, /* truly stupendously large counts will overflow an integer with this math, * but that is a problem for a few decades from now. Sorry, few decades * from now! */ - ADIOI_Assert(count/INT_MAX == (int)(count/INT_MAX)); - int c = (int)(count/INT_MAX); /* OK to cast until 'count' is 256 bits */ - int r = count%INT_MAX; + ADIOI_Assert(count / INT_MAX == (int) (count / INT_MAX)); + int c = (int) (count / INT_MAX); /* OK to cast until 'count' is 256 bits */ + int r = count % INT_MAX; MPI_Type_vector(c, INT_MAX, INT_MAX, oldtype, &chunks); MPI_Type_contiguous(r, oldtype, &remainder); MPI_Type_get_extent(oldtype, &lb, &extent); - blocklens[0] = 1; blocklens[1] = 1; - disps[0] = 0; disps[1] = c*extent*INT_MAX; - types[0] = chunks; types[1] = remainder; + blocklens[0] = 1; + blocklens[1] = 1; + disps[0] = 0; + disps[1] = c * extent * INT_MAX; + types[0] = chunks; + types[1] = remainder; MPI_Type_create_struct(2, blocklens, disps, types, newtype); @@ -48,6 +48,7 @@ static int type_create_contiguous_x(MPI_Count count, return MPI_SUCCESS; } + /* like MPI_Type_create_hindexed, except array_of_lengths can be a larger datatype. * * Hindexed provides 'count' pairs of (displacement, length), but what if @@ -55,18 +56,17 @@ static int type_create_contiguous_x(MPI_Count count, * contig if length is small enough, or something more complex if not */ int ADIOI_Type_create_hindexed_x(int count, - const MPI_Count array_of_blocklengths[], - const MPI_Aint array_of_displacements[], - MPI_Datatype oldtype, - MPI_Datatype *newtype) + const MPI_Count array_of_blocklengths[], + const MPI_Aint array_of_displacements[], + MPI_Datatype oldtype, MPI_Datatype * newtype) { int i, ret; MPI_Datatype *types; int *blocklens; - int is_big=0; + int is_big = 0; - types = ADIOI_Malloc(count*sizeof(MPI_Datatype)); - blocklens = ADIOI_Malloc(count*sizeof(int)); + types = ADIOI_Malloc(count * sizeof(MPI_Datatype)); + blocklens = ADIOI_Malloc(count * sizeof(int)); /* squashing two loops into one. * - Look in the array_of_blocklengths for any large values @@ -78,27 +78,26 @@ int ADIOI_Type_create_hindexed_x(int count, * which I have not yet precicesly nailed down, but appears to have * something to do with struct-of-chunks when the chunks are small */ - for(i=0; i<count; i++) { - if (array_of_blocklengths[i] > INT_MAX) { - blocklens[i] = 1; - is_big=1; - type_create_contiguous_x(array_of_blocklengths[i], oldtype, &(types[i])); - } else { - /* OK to cast: checked for "bigness" above */ - blocklens[i] = (int)array_of_blocklengths[i]; - MPI_Type_contiguous(blocklens[i], oldtype, &(types[i])); - } + for (i = 0; i < count; i++) { + if (array_of_blocklengths[i] > INT_MAX) { + blocklens[i] = 1; + is_big = 1; + type_create_contiguous_x(array_of_blocklengths[i], oldtype, &(types[i])); + } else { + /* OK to cast: checked for "bigness" above */ + blocklens[i] = (int) array_of_blocklengths[i]; + types[i] = oldtype; + } } if (is_big) { - ret = MPI_Type_create_struct(count, blocklens, array_of_displacements, - types, newtype); + ret = MPI_Type_create_struct(count, blocklens, array_of_displacements, types, newtype); + for (i = 0; i < count; i++) + if (types[i] != oldtype) + MPI_Type_free(&(types[i])); } else { - ret = MPI_Type_create_hindexed(count, blocklens, - array_of_displacements, oldtype, newtype); + ret = MPI_Type_create_hindexed(count, blocklens, array_of_displacements, oldtype, newtype); } - for (i=0; i< count; i++) - MPI_Type_free(&(types[i])); ADIOI_Free(types); ADIOI_Free(blocklens); @@ -115,7 +114,8 @@ int ADIOI_Type_create_hindexed_x(int count, ssize_t pread(int fd, void *buf, size_t count, off_t offset); ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); -ssize_t pread(int fd, void *buf, size_t count, off_t offset) { +ssize_t pread(int fd, void *buf, size_t count, off_t offset) +{ off_t lseek_ret; off_t old_offset; ssize_t read_ret; @@ -123,18 +123,19 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset) { old_offset = lseek(fd, 0, SEEK_CUR); lseek_ret = lseek(fd, offset, SEEK_SET); if (lseek_ret == -1) - return lseek_ret; + return lseek_ret; read_ret = read(fd, buf, count); if (read_ret < 0) - return read_ret; + return read_ret; /* man page says "file offset is not changed" */ - if ( (lseek_ret = lseek(fd, old_offset, SEEK_SET)) < 0) - return lseek_ret; + if ((lseek_ret = lseek(fd, old_offset, SEEK_SET)) < 0) + return lseek_ret; return read_ret; } -ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) { +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) +{ off_t lseek_ret; off_t old_offset; ssize_t write_ret; @@ -142,18 +143,14 @@ ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) { old_offset = lseek(fd, 0, SEEK_CUR); lseek_ret = lseek(fd, offset, SEEK_SET); if (lseek_ret == -1) - return lseek_ret; + return lseek_ret; write_ret = write(fd, buf, count); if (write_ret < 0) - return write_ret; + return write_ret; /* man page says "file offset is not changed" */ - if ( (lseek_ret = lseek(fd, old_offset, SEEK_SET)) < 0) - return lseek_ret; + if ((lseek_ret = lseek(fd, old_offset, SEEK_SET)) < 0) + return lseek_ret; return write_ret; } #endif - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio341/adio/include/ad_tuning.h b/3rd-party/romio341/adio/include/ad_tuning.h new file mode 100644 index 0000000000000000000000000000000000000000..9ad8c94b461e369fd423b682e371f97088317948 --- /dev/null +++ b/3rd-party/romio341/adio/include/ad_tuning.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** + * \file ad_tuning.h + * \brief Defines common performance tuning env var options + */ + +/*--------------------------------------------------------------------- + * ad_tuning.h + * + * declares common global variables and functions for performance tuning + *---------------------------------------------------------------------*/ + +#ifndef AD_TUNING_H_INCLUDED +#define AD_TUNING_H_INCLUDED + +#include "adio.h" + + +/*----------------------------------------- + * Global variables for the control of performance tuning. + *-----------------------------------------*/ + +/* corresponds to environment variables to select optimizations */ +extern int romio_write_aggmethod; +extern int romio_read_aggmethod; +extern int romio_onesided_no_rmw; +extern int romio_onesided_always_rmw; +extern int romio_onesided_inform_rmw; +extern int romio_tunegather; + +/* set internal variables for tuning environment variables */ +void ad_get_env_vars(void); + +#endif /* AD_TUNING_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/adio.h b/3rd-party/romio341/adio/include/adio.h new file mode 100644 index 0000000000000000000000000000000000000000..cefb1785702e84702e44e1ef5d709713613b0eea --- /dev/null +++ b/3rd-party/romio341/adio/include/adio.h @@ -0,0 +1,444 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* main include file for ADIO. + contains general definitions, declarations, and macros independent + of the underlying file system */ + +/* Functions and datataypes that are "internal" to the ADIO implementation + prefixed ADIOI_. Functions and datatypes that are part of the + "externally visible" (documented) ADIO interface are prefixed ADIO_. + + An implementation of MPI-IO, or any other high-level interface, should + not need to use any of the ADIOI_ functions/datatypes. + Only someone implementing ADIO on a new file system, or modifying + an existing ADIO implementation, would need to use the ADIOI_ + functions/datatypes. */ + +#ifndef ADIO_H_INCLUDED +#define ADIO_H_INCLUDED + +#ifdef SPPUX +#define _POSIX_SOURCE +#endif + +#ifdef USE_FORT_STDCALL +#define FORT_CALL __stdcall +#elif defined (USE_FORT_CDECL) +#define FORT_CALL __cdecl +#else +#define FORT_CALL +#endif + +#ifdef USE_FORT_MIXED_STR_LEN +#define FORT_MIXED_LEN_DECL , int +#define FORT_END_LEN_DECL +#define FORT_MIXED_LEN(a) , int a +#define FORT_END_LEN(a) +#else +#define FORT_MIXED_LEN_DECL +#define FORT_END_LEN_DECL , int +#define FORT_MIXED_LEN(a) +#define FORT_END_LEN(a) , int a +#endif + + +#ifdef HAVE_FORTRAN_API +#ifdef FORTRAN_EXPORTS +#define FORTRAN_API __declspec(dllexport) +#else +#define FORTRAN_API __declspec(dllimport) +#endif +#else +#define FORTRAN_API +#endif + +/* Include romioconf.h if we haven't already (some include files may + need to include romioconf before some system includes) */ +#ifndef ROMIOCONF_H_INCLUDED +#include "romioconf.h" +#define ROMIOCONF_H_INCLUDED +#endif + +#include "mpi.h" +#include "mpio.h" +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#include <sys/stat.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#ifdef SPPUX +#include <sys/cnx_fcntl.h> +#endif + +#ifdef ROMIO_NTFS +#include <winsock2.h> +#include <windows.h> +#define FDTYPE HANDLE +#else +#define FDTYPE int +#ifdef ROMIO_QUOBYTEFS +#include "quobyte.h" +#endif +#endif + +typedef MPI_Offset ADIO_Offset; +#ifdef MPI_OFFSET_IS_INT +#define ADIO_OFFSET MPI_INT +#elif defined(HAVE_LONG_LONG_64) +#ifdef HAVE_MPI_LONG_LONG_INT +#define ADIO_OFFSET MPI_LONG_LONG_INT +#else +#define ADIO_OFFSET MPI_DOUBLE +#endif +#elif defined(HAVE_INT64) +#define ADIO_OFFSET MPI_DOUBLE +#else +#define ADIO_OFFSET MPI_LONG +#endif + +#define ADIO_Status MPI_Status + +#ifndef MPIO_INCLUDE +#ifdef NEEDS_MPI_FINT +typedef int MPI_Fint; +#endif +#endif + +#if (!defined(HAVE_MPI_INFO) && !defined(MPIO_INCLUDE)) +typedef struct MPIR_Info *MPI_Info; +#define MPI_INFO_NULL 0 +#define MPI_MAX_INFO_VAL 1024 + +int MPI_Info_create(MPI_Info * info); +int MPI_Info_set(MPI_Info info, char *key, char *value); +int MPI_Info_delete(MPI_Info info, char *key); +int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag); +int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag); +int MPI_Info_get_nkeys(MPI_Info info, int *nkeys); +int MPI_Info_get_nthkey(MPI_Info info, int n, char *key); +int MPI_Info_dup(MPI_Info info, MPI_Info * newinfo); +int MPI_Info_free(MPI_Info * info); + +#ifdef MPI_Info_f2c +#undef MPI_Info_f2c +#endif +#ifdef MPI_Info_c2f +#undef MPI_Info_c2f +#endif +/* above needed for some versions of mpi.h in MPICH!! */ +MPI_Fint MPI_Info_c2f(MPI_Info info); +MPI_Info MPI_Info_f2c(MPI_Fint info); + +int PMPI_Info_create(MPI_Info * info); +int PMPI_Info_set(MPI_Info info, char *key, char *value); +int PMPI_Info_delete(MPI_Info info, char *key); +int PMPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag); +int PMPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag); +int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys); +int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key); +int PMPI_Info_dup(MPI_Info info, MPI_Info * newinfo); +int PMPI_Info_free(MPI_Info * info); + +MPI_Fint PMPI_Info_c2f(MPI_Info info); +MPI_Info PMPI_Info_f2c(MPI_Fint info); + +#endif + +/* style: allow:strdup:1 sig:0 */ + +#if defined(HAVE_STRDUP) && defined(NEEDS_STRDUP_DECL) && !defined(strdup) +char *strdup(const char *s); +#endif +#if defined(HAVE_READLINK) && defined(NEEDS_READLINK_DECL) && !defined(readlink) +ssize_t readlink(const char *path, char *buf, size_t bufsiz); +#endif +#if defined(HAVE_LSTAT) && defined(NEEDS_LSTAT_DECL) && !defined(lstat) +int lstat(const char *file_name, struct stat *buf); +#endif +#if defined(HAVE_FSYNC) && defined(NEEDS_FSYNC_DECL) && !defined(fsync) +int fsync(int fd); +#endif +#if defined(HAVE_FTRUNCATE) && defined(NEEDS_FTRUNCATE_DECL) && !defined(ftruncate) +int ftruncate(int fd, off_t length); +#endif + + +typedef struct ADIOI_Fns_struct ADIOI_Fns; +typedef struct ADIOI_Hints_struct ADIOI_Hints; + +typedef struct ADIOI_FileD { + int cookie; /* for error checking */ + FDTYPE fd_sys; /* system file descriptor */ + FDTYPE null_fd; /* the null-device file descriptor: debug only (obviously) */ + int fd_direct; /* On XFS, this is used for direct I/O; + * fd_sys is used for buffered I/O */ + int direct_read; /* flag; 1 means use direct read */ + int direct_write; /* flag; 1 means use direct write */ + /* direct I/O attributes */ + unsigned d_mem; /* data buffer memory alignment */ + unsigned d_miniosz; /* min xfer size, xfer size multiple, + * and file seek offset alignment */ + long blksize; /* some optimizations benefit from knowing + * underlying block size */ + ADIO_Offset fp_ind; /* individual file pointer in MPI-IO (in bytes) */ + ADIO_Offset fp_sys_posn; /* current location of the system file-pointer + * in bytes */ + ADIOI_Fns *fns; /* struct of I/O functions to use */ + MPI_Comm comm; /* communicator indicating who called open */ + int is_open; /* deferred open: 0: not open yet 1: is open */ + int is_agg; /* bool: if I am an aggregator */ + char *filename; + int file_system; /* type of file system */ + int access_mode; /* Access mode (sequential, append, etc.), + * possibly modified to deal with + * data sieving or deferred open */ + int orig_access_mode; /* Access mode provided by user: unmodified */ + ADIO_Offset disp; /* reqd. for MPI-IO */ + MPI_Datatype etype; /* reqd. for MPI-IO */ + MPI_Datatype filetype; /* reqd. for MPI-IO */ + MPI_Count etype_size; /* in bytes */ + ADIOI_Hints *hints; /* structure containing fs-indep. info values */ + MPI_Info info; + + /* The following support the split collective operations */ + int split_coll_count; /* count of outstanding split coll. ops. */ + MPI_Status split_status; /* status used for split collectives */ + MPI_Datatype split_datatype; /* datatype used for split collectives */ + + /* The following support the shared file operations */ + char *shared_fp_fname; /* name of file containing shared file pointer */ + struct ADIOI_FileD *shared_fp_fd; /* file handle of file + * containing shared fp */ + int async_count; /* count of outstanding nonblocking operations */ + int perm; + int atomicity; /* true=atomic, false=nonatomic */ + int fortran_handle; /* handle for Fortran interface if needed */ + MPI_Errhandler err_handler; + void *fs_ptr; /* file-system specific information */ + + /* Two phase collective I/O support */ + ADIO_Offset *file_realm_st_offs; /* file realm starting offsets */ + MPI_Datatype *file_realm_types; /* file realm datatypes */ + int my_cb_nodes_index; /* my index into cb_config_list. -1 if N/A */ + char *io_buf; /* two-phase buffer allocated out of i/o path */ + MPI_Win io_buf_window; /* Window over the io_buf to support one-sided aggregation */ + int io_buf_put_amounts; /* the amount of data mpi_put into the io_buf + * during the same round of one-sided write aggregation */ + MPI_Win io_buf_put_amounts_window; /* Window over the io_buf_put_amounts */ + /* External32 */ + int is_external32; /* bool: 0 means native view */ +#ifdef ROMIO_QUOBYTEFS + struct quobyte_fh *file_handle; /* file handle for quobytefs */ +#endif +} ADIOI_FileD; + +typedef struct ADIOI_FileD *ADIO_File; + +typedef MPI_Request ADIO_Request; + +/* fcntl structure */ +typedef struct { + ADIO_Offset disp; + MPI_Datatype etype; + MPI_Datatype filetype; + MPI_Info info; + int atomicity; + ADIO_Offset fsize; /* for get_fsize only */ + ADIO_Offset diskspace; /* for file preallocation */ +} ADIO_Fcntl_t; /* should contain more stuff */ + + +/* access modes */ +#define ADIO_CREATE 1 +#define ADIO_RDONLY 2 +#define ADIO_WRONLY 4 +#define ADIO_RDWR 8 +#define ADIO_DELETE_ON_CLOSE 16 +#define ADIO_UNIQUE_OPEN 32 +#define ADIO_EXCL 64 +#define ADIO_APPEND 128 +#define ADIO_SEQUENTIAL 256 + +#define ADIO_AMODE_NOMATCH ~(ADIO_CREATE|ADIO_RDONLY|ADIO_WRONLY|ADIO_RDWR|ADIO_DELETE_ON_CLOSE|ADIO_UNIQUE_OPEN|ADIO_EXCL|ADIO_APPEND|ADIO_SEQUENTIAL) + +/* file-pointer types */ +#define ADIO_EXPLICIT_OFFSET 100 +#define ADIO_INDIVIDUAL 101 +#define ADIO_SHARED 102 + +#define ADIO_REQUEST_NULL ((ADIO_Request) 0) +#define ADIO_FILE_NULL ((ADIO_File) 0) + +/* file systems: + * the numbering is slightly strange because we have deleted file + * systems over time */ +#define ADIO_NFS 150 +#define ADIO_UFS 152 /* Unix file system */ +#define ADIO_XFS 154 /* SGI */ +#define ADIO_TESTFS 159 /* fake file system for testing */ +#define ADIO_PVFS2 160 /* PVFS2: 2nd generation PVFS */ +#define ADIO_PANFS 161 /* Panasas FS */ +#define ADIO_LUSTRE 163 /* Lustre */ +#define ADIO_GPFS 168 +#define ADIO_IME 169 /* IME burst buffer */ +#define ADIO_DAOS 170 +#define ADIO_QUOBYTEFS 171 /* Quobyte FS */ + +#define ADIO_SEEK_SET SEEK_SET +#define ADIO_SEEK_CUR SEEK_CUR +#define ADIO_SEEK_END SEEK_END + +#define ADIO_FCNTL_SET_ATOMICITY 180 +#define ADIO_FCNTL_SET_DISKSPACE 188 +#define ADIO_FCNTL_GET_FSIZE 200 + +/* file system feature tests */ +#define ADIO_LOCKS 300 /* file system supports fcntl()-style locking */ +#define ADIO_SHARED_FP 301 /* file system supports shared file pointers */ +#define ADIO_ATOMIC_MODE 302 /* file system supports atomic mode */ +#define ADIO_DATA_SIEVING_WRITES 303 /* file system supports data sieving for writes */ +#define ADIO_SCALABLE_OPEN 304 /* one process can open the file and + * broadcast result to all other + * processors */ +#define ADIO_UNLINK_AFTER_CLOSE 305 /* supports posix semantic of keeping a + * deleted file around until all + * processors have closed it */ +#define ADIO_TWO_PHASE 306 /* file system implements some version of + * two-phase collective buffering with + * aggregation */ +#define ADIO_SCALABLE_RESIZE 307 /* file system supports resizing from one + * processor (nfs, e.g. does not) */ + +/* for default file permissions */ +#define ADIO_PERM_NULL -1 + +#define ADIOI_FILE_COOKIE 2487376 +#define ADIOI_REQ_COOKIE 3493740 + +/* ADIO function prototypes */ +/* all these may not be necessary, as many of them are macro replaced to + function pointers that point to the appropriate functions for each + different file system (in adioi.h), but anyway... */ + +void ADIO_Init(int *argc, char ***argv, int *error_code); +void ADIO_End(int *error_code); +MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, const char *filename, + int file_system, ADIOI_Fns * ops, + int access_mode, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, MPI_Info info, int perm, int *error_code); +void ADIOI_OpenColl(ADIO_File fd, int rank, int acces_mode, int *error_code); +void ADIO_ImmediateOpen(ADIO_File fd, int *error_code); +void ADIO_Close(ADIO_File fd, int *error_code); +void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, + int file_ptr_type, ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIO_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, int *bytes_written, int + *error_code); +void ADIO_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIO_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +int ADIO_ReadDone(ADIO_Request * request, ADIO_Status * status, int *error_code); +int ADIO_WriteDone(ADIO_Request * request, ADIO_Status * status, int *error_code); +int ADIO_ReadIcomplete(ADIO_Request * request, ADIO_Status * status, int + *error_code); +int ADIO_WriteIcomplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIO_ReadComplete(ADIO_Request * request, ADIO_Status * status, int + *error_code); +void ADIO_WriteComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIO_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int + *error_code); +void ADIO_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIO_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIO_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIO_WriteStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIO_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIO_IwriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIO_IreadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIO_IwriteStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +ADIO_Offset ADIO_SeekIndividual(ADIO_File fd, ADIO_Offset offset, int whence, int *error_code); +void ADIO_Delete(char *filename, int *error_code); +void ADIO_Flush(ADIO_File fd, int *error_code); +void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype, + ADIOI_Fns ** ops, int *error_code); +void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset * shared_fp, int *error_code); +void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); +void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, MPI_Info info, int *error_code); +int ADIO_Feature(ADIO_File fd, int flag); + +/* functions to help deal with the array datatypes */ +int ADIO_Type_create_subarray(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype); +int ADIO_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype); + +/* MPI_File management functions (in mpio_file.c) */ +MPI_File MPIO_File_create(int size); +ADIO_File MPIO_File_resolve(MPI_File mpi_fh); +void MPIO_File_free(MPI_File * mpi_fh); +MPI_File MPIO_File_f2c(MPI_Fint fh); +MPI_Fint MPIO_File_c2f(MPI_File fh); +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ...); +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code); +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code); + +/* request managment helper functions */ +void MPIO_Completed_request_create(MPI_File * fh, MPI_Offset nbytes, + int *error_code, MPI_Request * request); + +#include "adioi.h" +#include "adioi_fs_proto.h" +#include "mpio_error.h" +#include "mpipr.h" + +/* these two defines don't appear to be in any other header file */ +#define MPIR_ERR_FATAL 1 +#define MPIR_ERR_RECOVERABLE 0 + +#endif /* ADIO_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/adio_cb_config_list.h b/3rd-party/romio341/adio/include/adio_cb_config_list.h new file mode 100644 index 0000000000000000000000000000000000000000..f72f3eb05024ded81e0cac97e0881f33924901ec --- /dev/null +++ b/3rd-party/romio341/adio/include/adio_cb_config_list.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef ADIO_CB_CONFIG_LIST_H_INCLUDED +#define ADIO_CB_CONFIG_LIST_H_INCLUDED + +/* I have no idea what the "D" stands for; it's how things are done in adio.h + */ +struct ADIO_cb_name_arrayD { + int refct; + int namect; + char **names; +}; + +typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; + +int ADIOI_cb_gather_name_array(MPI_Comm comm, MPI_Comm dupcomm, ADIO_cb_name_array * arrayp); +int ADIOI_cb_copy_name_array(MPI_Comm comm, int keyval, void *extra, + void *attr_in, void **attr_out, int *flag); +int ADIOI_cb_delete_name_array(MPI_Comm comm, int keyval, void *attr_val, void *extra); +int ADIOI_cb_config_list_parse(char *config_list, ADIO_cb_name_array array, + int ranklist[], int cb_nodes); +int ADIOI_cb_bcast_rank_map(ADIO_File fd); + +#endif /* ADIO_CB_CONFIG_LIST_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/include/adio_extern.h b/3rd-party/romio341/adio/include/adio_extern.h similarity index 72% rename from 3rd-party/romio321/adio/include/adio_extern.h rename to 3rd-party/romio341/adio/include/adio_extern.h index 9a7f2e59b04446b4898512c54ef898d2a91b7e41..a1a9c7d50c313b51fddfcdd7241abad7bf0418da 100644 --- a/3rd-party/romio321/adio/include/adio_extern.h +++ b/3rd-party/romio341/adio/include/adio_extern.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ -extern ADIOI_Flatlist_node *ADIOI_Flatlist; +#ifndef ADIO_EXTERN_H_INCLUDED +#define ADIO_EXTERN_H_INCLUDED extern ADIOI_Datarep *ADIOI_Datarep_head; @@ -29,3 +28,6 @@ extern MPI_Info ADIOI_syshints; extern MPI_Op ADIO_same_amode; extern int ADIOI_cb_config_list_keyval; +extern int ADIOI_Flattened_type_keyval; + +#endif /* ADIO_EXTERN_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/adioi.h b/3rd-party/romio341/adio/include/adioi.h new file mode 100644 index 0000000000000000000000000000000000000000..662c009f38eef021c804828c2143b62ec4ea0e66 --- /dev/null +++ b/3rd-party/romio341/adio/include/adioi.h @@ -0,0 +1,1046 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +/* contains general definitions, declarations, and macros internal to + the ADIO implementation, though independent of the underlying file + system. This file is included in adio.h */ + +/* Functions and datataypes that are "internal" to the ADIO implementation + prefixed ADIOI_. Functions and datatypes that are part of the + "externally visible" (documented) ADIO interface are prefixed ADIO_. + + An implementation of MPI-IO, or any other high-level interface, should + not need to use any of the ADIOI_ functions/datatypes. + Only someone implementing ADIO on a new file system, or modifying + an existing ADIO implementation, would need to use the ADIOI_ + functions/datatypes. */ + + +#ifndef ADIOI_H_INCLUDED +#define ADIOI_H_INCLUDED +/* used to keep track of hint/info values. + * Note that there are a lot of int-sized values in here...they are + * used as int-sized entities other places as well. This would be a + * problem on 32-bit systems using > 2GB files in some cases... + */ +struct ADIOI_Hints_struct { + int initialized; + int striping_factor; + int striping_unit; + int cb_read; + int cb_write; + int cb_nodes; + int cb_buffer_size; + int cb_pfr; + int cb_fr_type; + int cb_fr_alignment; + int cb_ds_threshold; + int cb_alltoall; + int ds_read; + int ds_write; + int no_indep_rw; + int ind_rd_buffer_size; + int ind_wr_buffer_size; + int deferred_open; + int start_iodevice; + int min_fdomain_size; + char *cb_config_list; + int *ranklist; + union { + struct { + int chunk_size; + int obj_class; + } daos; + struct { + int listio_read; + int listio_write; + } pvfs; + struct { + int debugmask; + int posix_read; + int posix_write; + int listio_read; + int listio_write; + int dtype_read; + int dtype_write; + } pvfs2; + struct { + int co_ratio; + int coll_threshold; + int ds_in_coll; + int lock_ahead_read; + int lock_ahead_write; + int lock_ahead_num_extents; + int lock_ahead_flags; + ADIO_Offset lock_ahead_start_extent; + ADIO_Offset lock_ahead_end_extent; + } lustre; + struct { + unsigned read_chunk_sz; /* chunk size for direct reads */ + unsigned write_chunk_sz; /* chunk size for direct writes */ + } xfs; + struct { + int *bridgelist; /* list of all bride ranks */ + int *bridgelistnum; /* each entry here is the number of aggregators + * associated with the bridge rank of the same + * index in bridgelist */ + int numbridges; /* total number of bridges */ + } bg; + } fs_hints; +}; + +typedef struct ADIOI_Datarep { + char *name; + void *state; + MPI_Datarep_extent_function *extent_fn; + MPI_Datarep_conversion_function *read_conv_fn; + MPI_Datarep_conversion_function *write_conv_fn; + struct ADIOI_Datarep *next; /* pointer to next datarep */ +} ADIOI_Datarep; + +/* Values for use with cb_read, cb_write, ds_read, and ds_write + * and some fs-specific hints + (IBM xlc, Compaq Tru64 compilers object to a comma after the last item) + (that's just wrong) + */ +enum { + ADIOI_HINT_AUTO = 0, + ADIOI_HINT_ENABLE = 1, + ADIOI_HINT_DISABLE = 2 +}; + +/* flattened datatypes. Each datatype is stored as a node of a + globally accessible linked list. Once attribute caching on a + datatype is available (in MPI-2), that should be used instead. */ + +#define ADIOI_TYPE_DECREASE 0x00000001 /* if not monotonic nondecreasing */ +#define ADIOI_TYPE_OVERLAP 0x00000002 /* if contains overlapping regions */ +#define ADIOI_TYPE_NEGATIVE 0x00000004 /* if one of displacements is negative */ + +typedef struct ADIOI_Fl_node { + MPI_Datatype type; + MPI_Count count; /* no. of contiguous blocks */ + ADIO_Offset *blocklens; /* array of contiguous block lengths (bytes) */ + ADIO_Offset *indices; /* array of byte offsets of each block */ + /* the type processing code in ROMIO loops through the flattened + * representation to tile file views. so, we cannot simply indicate a + * lower bound and upper bound with entries here -- those are instead + * indicated by offset-length pairs with zero length. In order to deal + * with repeatedly resetting the LB and UB though (as in resized of + * resized, or struct of resized, perhaps?), indicate where in the + * tuple-stream the lb and ub parts are kept + * (-1 indicates "not explicitly set") */ + ADIO_Offset lb_idx; + ADIO_Offset ub_idx; + int refct; /* when storing flattened representation on a + * type, attribute copy and delete routines + * will manage refct */ + int flag; /* ADIOI_TYPE_XXX */ +} ADIOI_Flatlist_node; + +#ifdef ROMIO_PVFS2 +#include <pvfs2.h> +#endif +#ifdef ROMIO_QUOBYTEFS +#include "quobyte.h" +#endif +#ifdef ROMIO_DAOS +#include <daos_types.h> +#endif + +typedef struct ADIOI_AIO_req_str { + /* very weird: if this MPI_Request is a pointer, some C++ compilers + * will clobber it when the MPICH C++ bindings are used */ + MPI_Request req; + MPI_Offset nbytes; + /* should probably make this a union */ +#ifdef ROMIO_HAVE_WORKING_AIO + struct aiocb *aiocbp; +#endif +#ifdef ROMIO_QUOBYTEFS + struct quobyte_io_event *qaiocbp; +#endif +#ifdef ROMIO_PVFS2 + PVFS_sys_op_id op_id; + PVFS_sysresp_io resp_io; + PVFS_Request file_req; + PVFS_Request mem_req; +#endif +#ifdef ROMIO_DAOS + daos_event_t daos_event; +#endif +} ADIOI_AIO_Request; + +struct ADIOI_Fns_struct { + void (*ADIOI_xxx_Open) (ADIO_File fd, int *error_code); + void (*ADIOI_xxx_OpenColl) (ADIO_File fd, int rank, int access_mode, int *error_code); + void (*ADIOI_xxx_ReadContig) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_WriteContig) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_ReadStridedColl) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_WriteStridedColl) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + ADIO_Offset(*ADIOI_xxx_SeekIndividual) (ADIO_File fd, ADIO_Offset offset, + int whence, int *error_code); + void (*ADIOI_xxx_Fcntl) (ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); + void (*ADIOI_xxx_SetInfo) (ADIO_File fd, MPI_Info users_info, int *error_code); + void (*ADIOI_xxx_ReadStrided) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_WriteStrided) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_Close) (ADIO_File fd, int *error_code); + void (*ADIOI_xxx_IreadContig) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); + void (*ADIOI_xxx_IwriteContig) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); + int (*ADIOI_xxx_ReadDone) (ADIO_Request * request, ADIO_Status * status, int *error_code); + int (*ADIOI_xxx_WriteDone) (ADIO_Request * request, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_ReadComplete) (ADIO_Request * request, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_WriteComplete) (ADIO_Request * request, ADIO_Status * status, int *error_code); + void (*ADIOI_xxx_IreadStrided) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); + void (*ADIOI_xxx_IwriteStrided) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); + void (*ADIOI_xxx_Flush) (ADIO_File fd, int *error_code); + void (*ADIOI_xxx_Resize) (ADIO_File fd, ADIO_Offset size, int *error_code); + void (*ADIOI_xxx_Delete) (const char *filename, int *error_code); + int (*ADIOI_xxx_Feature) (ADIO_File fd, int flag); + const char *fsname; + void (*ADIOI_xxx_IreadStridedColl) (ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, + int *error_code); + void (*ADIOI_xxx_IwriteStridedColl) (ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, + int *error_code); + int (*ADIOI_xxx_SetLock) (ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len); +}; + +/* optypes for ADIO_RequestD */ +#define ADIOI_READ 26 +#define ADIOI_WRITE 27 + +#define ADIOI_PREALLOC_BUFSZ 16777216 /* buffer size used to + * preallocate disk space */ + + +/* default values for some hints */ + /* buffer size for collective I/O = 16 MB */ +#define ADIOI_CB_BUFFER_SIZE_DFLT "16777216" + /* buffer size for data sieving in independent reads = 4MB */ +#define ADIOI_IND_RD_BUFFER_SIZE_DFLT "4194304" + /* buffer size for data sieving in independent writes = 512KB. default is + * smaller than for reads, because write requires read-modify-write + * with file locking. If buffer size is large there is more contention + * for locks. */ +#define ADIOI_IND_WR_BUFFER_SIZE_DFLT "524288" + /* use one process per processor name by default */ +#define ADIOI_CB_CONFIG_LIST_DFLT "*:1" + + +/* some of the ADIO functions are macro-replaced */ + +#define ADIOI_OpenColl(fd, rank, access_mode, error_code) \ + (*(fd->fns->ADIOI_xxx_OpenColl))(fd, rank, access_mode, error_code) + +#define ADIO_ReadContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_ReadContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_WriteContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_WriteContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_SeekIndividual(fd,offset,whence,error_code) \ + (*(fd->fns->ADIOI_xxx_SeekIndividual))(fd,offset,whence,error_code) + +#define ADIO_Fcntl(fd,flag,fcntl_struct,error_code) \ + (*(fd->fns->ADIOI_xxx_Fcntl))(fd,flag,fcntl_struct,error_code) + +#define ADIO_IreadContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IreadContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +#define ADIO_IwriteContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IwriteContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +/* in these routines a pointer to request is passed */ +#define ADIO_ReadDone(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_ReadDone))(request,status,error_code) + +#define ADIO_WriteDone(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_WriteDone))(request,status,error_code) + +#define ADIO_ReadIcomplete(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_ReadIcomplete))(request,status,error_code) + +#define ADIO_WriteIcomplete(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_WriteIcomplete))(request,status,error_code) + +#define ADIO_ReadComplete(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_ReadComplete))(request,status,error_code) + +#define ADIO_WriteComplete(request,status,error_code) \ + (*((*(request))->fd->fns->ADIOI_xxx_WriteComplete))(request,status,error_code) + +#define ADIO_ReadStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_ReadStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_WriteStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_WriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_ReadStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_ReadStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_WriteStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ + (*(fd->fns->ADIOI_xxx_WriteStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) + +#define ADIO_IreadStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IreadStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +#define ADIO_IwriteStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IwriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +#define ADIO_IreadStridedColl(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IreadStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +#define ADIO_IwriteStridedColl(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \ + (*(fd->fns->ADIOI_xxx_IwriteStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) + +#define ADIO_Flush(fd,error_code) (*(fd->fns->ADIOI_xxx_Flush))(fd,error_code) + +#define ADIO_Resize(fd,size,error_code) \ + (*(fd->fns->ADIOI_xxx_Resize))(fd,size,error_code) + +#define ADIO_Delete(filename,error_code) \ + (*(fd->fns->ADIOI_xxx_Delete))(filename,error_code) + +#define ADIO_SetInfo(fd, users_info, error_code) \ + (*(fd->fns->ADIOI_xxx_SetInfo))(fd, users_info, error_code) + +#define ADIO_Feature(fd, flag) \ + (*(fd->fns->ADIOI_xxx_Feature))(fd, flag) + + +/* structure for storing access info of this process's request + from the file domain of other processes, and vice-versa. used + as array of structures indexed by process number. */ +typedef struct { + ADIO_Offset *offsets; /* array of offsets */ + ADIO_Offset *lens; /* array of lengths */ + MPI_Aint *mem_ptrs; /* array of pointers. used in the read/write + * phase to indicate where the data + * is stored in memory */ + int count; /* size of above arrays */ +} ADIOI_Access; + +/* structure for storing generic offset/length pairs. used to describe + file realms among other things */ +typedef struct { + ADIO_Offset *offsets; /* array of offsets */ + ADIO_Offset *lens; /* array of lengths */ + int count; /* size of above arrays */ +} ADIOI_Offlen; + +/* prototypes for ADIO internal functions */ + +void ADIOI_SetFunctions(ADIO_File fd); +ADIOI_Flatlist_node *ADIOI_Flatten_datatype(MPI_Datatype type); +void ADIOI_Flatten(MPI_Datatype type, ADIOI_Flatlist_node * flat, + ADIO_Offset st_offset, MPI_Count * curr_index); +/* callbakcs for attribute-style flattened tracking */ +int ADIOI_Flattened_type_copy(MPI_Datatype oldtype, + int type_keyval, void *extra_state, void *attribute_val_in, + void *attribute_val_out, int *flag); +int ADIOI_Flattened_type_delete(MPI_Datatype datatype, + int type_keyval, void *attribute_val, void *extra_state); +ADIOI_Flatlist_node *ADIOI_Flatten_and_find(MPI_Datatype); +MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype type, MPI_Count * curr_index); +void ADIOI_Complete_async(int *error_code); +void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname); +void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname); +void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname); +void ADIOI_Free_fn(void *ptr, int lineno, const char *fname); +void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); +void ADIOI_Get_position(ADIO_File fd, ADIO_Offset * offset); +void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset * eof_offset); +void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset * disp); +void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info); +void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo, MPI_Info * new_info); +void ADIOI_Info_print_keyvals(MPI_Info info); + + +void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code); +void ADIOI_GEN_Flush(ADIO_File fd, int *error_code); +void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code); +void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code); +void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code); +void ADIOI_GEN_Delete(const char *filename, int *error_code); +void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +int ADIOI_GEN_aio(ADIO_File fd, void *buf, int count, MPI_Datatype type, + ADIO_Offset offset, int wr, MPI_Request * request); +void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_GEN_WriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int *error_code); +void ADIOI_GEN_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +void ADIOI_GEN_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int + *error_code); +int ADIOI_GEN_IODone(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIOI_GEN_IOComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); +int ADIOI_GEN_aio_poll_fn(void *extra_state, ADIO_Status * status); +int ADIOI_GEN_aio_wait_fn(int count, void **array_of_states, double timeout, ADIO_Status * status); +int ADIOI_GEN_aio_query_fn(void *extra_state, ADIO_Status * status); +int ADIOI_GEN_aio_free_fn(void *extra_state); +int ADIOI_GEN_Feature(ADIO_File fd, int feature); + +void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, + MPI_Datatype buftype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +#ifdef HAVE_MPI_GREQUEST_EXTENSIONS +void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +#else +#define ADIOI_GEN_IreadStridedColl NULL +#endif +void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +#ifdef HAVE_MPI_GREQUEST_EXTENSIONS +void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request * request, int *error_code); +#else +#define ADIOI_GEN_IwriteStridedColl NULL +#endif +void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype + datatype, int file_ptr_type, ADIO_Offset + offset, ADIO_Offset ** offset_list_ptr, ADIO_Offset + ** len_list_ptr, ADIO_Offset * start_offset_ptr, + ADIO_Offset * end_offset_ptr, int + *contig_access_count_ptr); +void ADIOI_Calc_file_domains(ADIO_Offset * st_offsets, ADIO_Offset + * end_offsets, int nprocs, int nprocs_for_coll, + ADIO_Offset * min_st_offset_ptr, + ADIO_Offset ** fd_start_ptr, ADIO_Offset + ** fd_end_ptr, int min_fd_size, + ADIO_Offset * fd_size_ptr, int striping_unit); +int ADIOI_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset * len, + ADIO_Offset fd_size, ADIO_Offset * fd_start, ADIO_Offset * fd_end); +void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset * offset_list, + ADIO_Offset * len_list, int + contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset * fd_start, + ADIO_Offset * fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access ** my_req_ptr, MPI_Aint ** buf_idx_ptr); +void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access * my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, ADIOI_Access ** others_req_ptr); + + +/* Nonblocking Collective I/O internals */ +typedef enum { + ADIOI_IRC_STATE_GEN_IREADSTRIDEDCOLL, + ADIOI_IRC_STATE_GEN_IREADSTRIDEDCOLL_INDIO, + ADIOI_IRC_STATE_ICALC_OTHERS_REQ, + ADIOI_IRC_STATE_ICALC_OTHERS_REQ_MAIN, + ADIOI_IRC_STATE_IREAD_AND_EXCH, + ADIOI_IRC_STATE_IREAD_AND_EXCH_L1_BEGIN, + ADIOI_IRC_STATE_R_IEXCHANGE_DATA, + ADIOI_IRC_STATE_R_IEXCHANGE_DATA_RECV, + ADIOI_IRC_STATE_R_IEXCHANGE_DATA_FILL, + ADIOI_IRC_STATE_COMPLETE +} ADIOI_IRC_State; + +typedef enum { + ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL, + ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_INDIO, + ADIOI_IWC_STATE_GEN_IWRITESTRIDEDCOLL_BCAST, + ADIOI_IWC_STATE_ICALC_OTHERS_REQ, + ADIOI_IWC_STATE_ICALC_OTHERS_REQ_MAIN, + ADIOI_IWC_STATE_IEXCH_AND_WRITE, + ADIOI_IWC_STATE_IEXCH_AND_WRITE_L1_BODY, + ADIOI_IWC_STATE_W_IEXCHANGE_DATA, + ADIOI_IWC_STATE_W_IEXCHANGE_DATA_HOLE, + ADIOI_IWC_STATE_W_IEXCHANGE_DATA_SEND, + ADIOI_IWC_STATE_W_IEXCHANGE_DATA_WAIT, + ADIOI_IWC_STATE_COMPLETE +} ADIOI_IWC_State; + +typedef struct ADIOI_NBC_Request ADIOI_NBC_Request; + +typedef struct ADIOI_GEN_IreadStridedColl_vars ADIOI_GEN_IreadStridedColl_vars; +typedef struct ADIOI_Iread_and_exch_vars ADIOI_Iread_and_exch_vars; +typedef struct ADIOI_R_Iexchange_data_vars ADIOI_R_Iexchange_data_vars; + +typedef struct ADIOI_GEN_IwriteStridedColl_vars ADIOI_GEN_IwriteStridedColl_vars; +typedef struct ADIOI_Iexch_and_write_vars ADIOI_Iexch_and_write_vars; +typedef struct ADIOI_W_Iexchange_data_vars ADIOI_W_Iexchange_data_vars; + +typedef struct ADIOI_Icalc_others_req_vars { + /* requests */ + MPI_Request req1; + MPI_Request *req2; + int num_req2; + + /* parameters */ + ADIO_File fd; + int count_my_req_procs; + int *count_my_req_per_proc; + ADIOI_Access *my_req; + int nprocs; + int myrank; + int *count_others_req_procs_ptr; + ADIOI_Access **others_req_ptr; + + /* stack variables */ + int *count_others_req_per_proc; + int count_others_req_procs; + ADIOI_Access *others_req; + + /* next function to be called */ + void (*next_fn) (ADIOI_NBC_Request *, int *); +} ADIOI_Icalc_others_req_vars; + +struct ADIOI_NBC_Request { + int rdwr; /* ADIOI_READ or ADIOI_WRITE */ + MPI_Request req; /* MPIX_Grequest */ + MPI_Count nbytes; /* data read or written */ + + union { + struct { + ADIOI_IRC_State state; /* progress state */ + ADIOI_GEN_IreadStridedColl_vars *rsc_vars; + ADIOI_Iread_and_exch_vars *rae_vars; + ADIOI_R_Iexchange_data_vars *red_vars; + } rd; + struct { + ADIOI_IWC_State state; /* progress state */ + ADIOI_GEN_IwriteStridedColl_vars *wsc_vars; + ADIOI_Iexch_and_write_vars *eaw_vars; + ADIOI_W_Iexchange_data_vars *wed_vars; + } wr; + } data; + ADIOI_Icalc_others_req_vars *cor_vars; +}; + +void ADIOI_Icalc_others_req(ADIOI_NBC_Request * nbc_req, int *error_code); +void ADIOI_Icalc_others_req_main(ADIOI_NBC_Request * nbc_req, int *error_code); +void ADIOI_Icalc_others_req_fini(ADIOI_NBC_Request * nbc_req, int *error_code); + + +/* KC && AC - New Collective I/O internals*/ + +#define TEMP_OFF 0 +#define REAL_OFF 1 +#define MAX_OFF_TYPE 2 + +/* Communication Tags */ +#define DATA_TAG 30 +#define AMT_TAG 31 + +/* cb_fr_type user size is non-zero */ +#define ADIOI_FR_AAR 0 +#define ADIOI_FR_FSZ -1 +#define ADIOI_FR_USR_REALMS -2 + +typedef struct flatten_state { + ADIO_Offset abs_off; + ADIO_Offset cur_sz; + ADIO_Offset idx; + ADIO_Offset cur_reg_off; +} flatten_state; + +typedef struct view_state { + ADIO_Offset fp_ind; /* file view params */ + ADIO_Offset disp; /* file view params */ + ADIO_Offset byte_off; + ADIO_Offset sz; + ADIO_Offset ext; /* preserved extent from MPI_Type_get_extent */ + ADIO_Offset type_sz; + + /* Current state */ + flatten_state cur_state; + /* Scratch state for counting up ol pairs */ + flatten_state tmp_state; + + /* Preprocessed data amount and ol pairs */ + ADIO_Offset pre_sz; + int pre_ol_ct; + MPI_Aint *pre_disp_arr; + int *pre_blk_arr; + + ADIOI_Flatlist_node *flat_type_p; +} view_state; + +void ADIOI_Calc_bounds(ADIO_File fd, int count, MPI_Datatype buftype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Offset * st_offset, ADIO_Offset * end_offset); +int ADIOI_Agg_idx(int rank, ADIO_File fd); +void ADIOI_Calc_file_realms(ADIO_File fd, ADIO_Offset min_st_offset, ADIO_Offset max_end_offset); +void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Datatype custom_ftype, + int rdwr, ADIO_Status * status, int + *error_code); +void ADIOI_IOStridedColl(ADIO_File fd, void *buf, int count, int rdwr, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, int + *error_code); +void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node * flatlist_node_p); +ADIOI_Flatlist_node *ADIOI_Add_contig_flattened(MPI_Datatype contig_type); +void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, + ADIO_File fd, int count, + MPI_Datatype datatype, ADIO_Offset off, + view_state * my_mem_view_state_arr, + view_state * agg_file_view_state_arr, + view_state * client_file_view_state_arr); +int ADIOI_init_view_state(int file_ptr_type, int nprocs, view_state * view_state_arr, int op_type); +int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, + view_state * client_file_view_state_arr, + MPI_Datatype * client_comm_dtype_arr, + ADIO_Offset * client_comm_sz_arr, + ADIO_Offset * agg_dtype_offset_p, MPI_Datatype * agg_dtype_p); +int ADIOI_Build_client_reqs(ADIO_File fd, + int nprocs, + view_state * my_mem_view_state_arr, + view_state * agg_file_view_state_arr, + ADIO_Offset * agg_comm_sz_arr, MPI_Datatype * agg_comm_dtype_arr); +int ADIOI_Build_client_pre_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state * my_mem_view_state_p, + view_state * agg_file_view_state_p, + ADIO_Offset max_pre_req_sz, int max_ol_ct); +int ADIOI_Build_client_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state * my_mem_view_state_p, + view_state * agg_file_view_state_p, + ADIO_Offset agg_comm_sz, MPI_Datatype * agg_comm_dtype_p); + +void ADIOI_P2PContigWriteAggregation(ADIO_File fd, + const void *buf, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offset, + ADIO_Offset * fd_start, ADIO_Offset * fd_end); + +void ADIOI_P2PContigReadAggregation(ADIO_File fd, + const void *buf, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offset, + ADIO_Offset * fd_start, ADIO_Offset * fd_end); + +/* This data structure holds parameters related to regulating */ +/* the one-sided aggregation algorithm. */ +typedef struct ADIOI_OneSidedStripeParms { + int stripeSize; /* size in bytes of the striping unit - a size of 0 indicates to the */ + /* onesided algorithm that we are a non-striping file system */ + ADIO_Offset segmentLen; /* size in bytes of the segment (stripeSize*number of aggs) */ + /* up to the size of the file) */ + int stripesPerAgg; /* the number of stripes to be packed into an agg cb for this segment */ + int segmentIter; /* segment number for the group of stripes currently being packed into */ + /* the agg cb - resets to 0 for each cb flush to the file system */ + int flushCB; /* once we have fully packed the cb on an agg this flags */ + /* tells us to now write to the file */ + ADIO_Offset stripedLastFileOffset; /* since we are now just calling the onesided algorithm */ + /* with the offset range of segment, we still need to */ + /* know the actual last offset of the file. */ + int firstStripedWriteCall; /* whether this is the first call in the first segment of the */ + /* onesided algorithm. */ + int lastStripedWriteCall; /* whether this is the last call in the last segment of the */ + /* onesided algorithm. */ + int iWasUsedStripingAgg; /* whether this rank was ever a used agg for this striping segement */ + int numStripesUsed; /* the number of stripes packed into an aggregator */ + /* These 2 elements are the offset and lengths in the file corresponding to the actual stripes */ + ADIO_Offset *stripeWriteOffsets; + ADIO_Offset *stripeWriteLens; + int amountOfStripedDataExpected; /* used to determine holes in this segment thereby requiring a rmw */ + /* These 2 elements enable ADIOI_OneSidedWriteAggregation to be called multiple times but only */ + /* perform the potientially computationally costly flattening of the source buffer just once */ + MPI_Aint bufTypeExtent; + ADIOI_Flatlist_node *flatBuf; + /* These three elements track the state of the source buffer advancement through multiple calls */ + /* to ADIOI_OneSidedWriteAggregation */ + ADIO_Offset lastDataTypeExtent; + int lastFlatBufIndice; + ADIO_Offset lastIndiceOffset; +} ADIOI_OneSidedStripeParms; + +int ADIOI_OneSidedCleanup(ADIO_File fd); +void ADIOI_OneSidedWriteAggregation(ADIO_File fd, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + const void *buf, + MPI_Datatype datatype, + int *error_code, + ADIO_Offset firstFileOffset, + ADIO_Offset lastFileOffset, + int numNonZeroDataOffsets, + ADIO_Offset * fd_start, + ADIO_Offset * fd_end, + int *hole_found, ADIOI_OneSidedStripeParms * stripe_parms); +void ADIOI_OneSidedReadAggregation(ADIO_File fd, + ADIO_Offset * offset_list, + ADIO_Offset * len_list, + int contig_access_count, + const void *buf, + MPI_Datatype datatype, + int *error_code, + ADIO_Offset * st_offsets, + ADIO_Offset * end_offsets, + int numNonZeroDataOffsets, + ADIO_Offset * fd_start, ADIO_Offset * fd_end); +ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, int whence, int *error_code); +void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_GEN_Close(ADIO_File fd, int *error_code); +void ADIOI_Shfp_fname(ADIO_File fd, int rank, int *error_code); +void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset size, int *error_code); +int MPIR_Err_setmsg(int, int, const char *, const char *, const char *, ...); +int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); +int MPIR_Status_set_bytes(MPI_Status * status, MPI_Datatype datatype, MPI_Count nbytes); +int ADIOI_Uses_generic_read(ADIO_File fd); +int ADIOI_Uses_generic_write(ADIO_File fd); +int ADIOI_Err_create_code(const char *myname, const char *filename, int my_errno); +int ADIOI_Type_create_hindexed_x(int count, + const MPI_Count array_of_blocklengths[], + const MPI_Aint array_of_displacements[], + MPI_Datatype oldtype, MPI_Datatype * newtype); + + +int ADIOI_FAKE_IODone(ADIO_Request * request, ADIO_Status * status, int *error_code); +void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_FAKE_IwriteContig(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_FAKE_IwriteStrided(ADIO_File fd, const void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request * request, int *error_code); +void ADIOI_FAKE_IOComplete(ADIO_Request * request, ADIO_Status * status, int *error_code); + + +/* File I/O common functionality */ +int MPIOI_File_read(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, int count, MPI_Datatype datatype, char *myname, MPI_Status * status); +int MPIOI_File_write(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status); +int MPIOI_File_read_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status); +int MPIOI_File_write_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status); +int MPIOI_File_read_all_begin(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, int count, MPI_Datatype datatype, char *myname); +int MPIOI_File_write_all_begin(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + const void *buf, int count, MPI_Datatype datatype, char *myname); +int MPIOI_File_read_all_end(MPI_File fh, void *buf, char *myname, MPI_Status * status); +int MPIOI_File_write_all_end(MPI_File fh, const void *buf, char *myname, MPI_Status * status); +int MPIOI_File_iwrite(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request); +int MPIOI_File_iread(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request); +int MPIOI_File_iwrite_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request); +int MPIOI_File_iread_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request); + + + +/* Unix-style file locking */ + +#if defined(F_SETLKW64) + +#define ADIOI_WRITE_LOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLKW64, F_WRLCK, offset, whence, len) +#define ADIOI_READ_LOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLKW64, F_RDLCK, offset, whence, len) +#define ADIOI_UNLOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLK64, F_UNLCK, offset, whence, len) + +#else + +#define ADIOI_WRITE_LOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLKW, F_WRLCK, offset, whence, len) +#define ADIOI_READ_LOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLKW, F_RDLCK, offset, whence, len) +#define ADIOI_UNLOCK_FUNC(fd, offset, whence, len) \ + (*(fd->fns->ADIOI_xxx_SetLock))(fd, F_SETLK, F_UNLCK, offset, whence, len) + +#endif + + +#ifdef ADIOI_MPE_LOGGING +#define ADIOI_WRITE_LOCK(fd, offset, whence, len) do { \ + MPE_Log_event(ADIOI_MPE_writelock_a, 0, NULL); \ + ADIOI_WRITE_LOCK_FUNC(fd, offset, whence, len); \ + MPE_Log_event(ADIOI_MPE_writelock_b, 0, NULL); } while (0) +#define ADIOI_READ_LOCK(fd, offset, whence, len) \ + MPE_Log_event(ADIOI_MPE_readlock_a, 0, NULL); do { \ + ADIOI_READ_LOCK_FUNC(fd, offset, whence, len); \ + MPE_Log_event(ADIOI_MPE_readlock_b, 0, NULL); } while (0) +#define ADIOI_UNLOCK(fd, offset, whence, len) do { \ + MPE_Log_event(ADIOI_MPE_unlock_a, 0, NULL); \ + ADIOI_UNLOCK_FUNC(fd, offset, whence, len); \ + MPE_Log_event(ADIOI_MPE_unlock_b, 0, NULL); } while (0) +#else +#define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ + ADIOI_WRITE_LOCK_FUNC(fd, offset, whence, len) +#define ADIOI_READ_LOCK(fd, offset, whence, len) \ + ADIOI_READ_LOCK_FUNC(fd, offset, whence, len) +#define ADIOI_UNLOCK(fd, offset, whence, len) \ + ADIOI_UNLOCK_FUNC(fd, offset, whence, len) +#endif + +int ADIOI_GEN_SetLock(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len); +int ADIOI_GEN_SetLock64(ADIO_File fd, int cmd, int type, ADIO_Offset offset, int whence, + ADIO_Offset len); + +#define ADIOI_Malloc(a) ADIOI_Malloc_fn(a,__LINE__,__FILE__) +#define ADIOI_Calloc(a,b) ADIOI_Calloc_fn(a,b,__LINE__,__FILE__) +#define ADIOI_Realloc(a,b) ADIOI_Realloc_fn(a,b,__LINE__,__FILE__) +#define ADIOI_Free(a) ADIOI_Free_fn(a,__LINE__,__FILE__) + +int ADIOI_Strncpy(char *outstr, const char *instr, size_t maxlen); +char *ADIOI_Strdup(const char *); + +/* the current MPI standard is not const-correct, and modern compilers warn + * about the following sort of code: + * + * MPI_Info_set(info, "key", "val"); + * + * reminding us that "key" and "val" are const. We use the following macros to + * cast away the const and suppress the warning. */ +#define ADIOI_Info_set(info_,key_str_,val_) \ + MPI_Info_set((info_),((char*)key_str_),(char*)(val_)) +#define ADIOI_Info_get(info_,key_str_,val_len_,val_,flag_) \ + MPI_Info_get((info_),((char*)key_str_),(val_len_),(val_),(flag_)) +#define ADIOI_Info_get_valuelen(info_,key_str_,val_len_,flag_) \ + MPI_Info_get_valuelen((info_),((char*)key_str_),(val_len_),(flag_)) +#define ADIOI_Info_delete(info_,key_str_) \ + MPI_Info_delete((info_),((char*)key_str_)) + +#ifdef ROMIO_INSIDE_MPICH +/* the I/O related support for MPI_Comm_split_type */ +int MPIR_Comm_split_filesystem(MPI_Comm comm, int key, const char *dirname, MPI_Comm * newcomm); +#endif + +/* Define attribute as empty if it has no definition */ +#ifndef ATTRIBUTE +#ifdef HAVE_GCC_ATTRIBUTE +#define ATTRIBUTE(a) __attribute__(a) +#else +#define ATTRIBUTE(a) +#endif +#endif + +#define FPRINTF fprintf + +#ifndef HAVE_STRERROR +#ifdef HAVE_SYSERRLIST +extern char *sys_errlist[]; +#define strerror(n) sys_errlist[n] +#else +#define PRINT_ERR_MSG +#endif +#endif + +#include "adioi_error.h" + +/* MPE logging variables */ + +#ifdef ADIOI_MPE_LOGGING +#include "mpe.h" + +int ADIOI_MPE_open_a; +int ADIOI_MPE_open_b; +int ADIOI_MPE_read_a; +int ADIOI_MPE_read_b; +int ADIOI_MPE_write_a; +int ADIOI_MPE_write_b; +int ADIOI_MPE_lseek_a; +int ADIOI_MPE_lseek_b; +int ADIOI_MPE_close_a; +int ADIOI_MPE_close_b; +int ADIOI_MPE_writelock_a; +int ADIOI_MPE_writelock_b; +int ADIOI_MPE_readlock_a; +int ADIOI_MPE_readlock_b; +int ADIOI_MPE_unlock_a; +int ADIOI_MPE_unlock_b; +int ADIOI_MPE_postwrite_a; +int ADIOI_MPE_postwrite_b; +int ADIOI_MPE_openinternal_a; +int ADIOI_MPE_openinternal_b; +int ADIOI_MPE_stat_a; +int ADIOI_MPE_stat_b; +int ADIOI_MPE_iread_a; +int ADIOI_MPE_iread_b; +int ADIOI_MPE_iwrite_a; +int ADIOI_MPE_iwrite_b; +#endif + +#ifdef ROMIO_INSIDE_MPICH +/* Assert that this MPI_Aint value can be cast to a ptr value without problem.*/ +/* Basic idea is the value should be unchanged after casting + (no loss of (meaningful) high order bytes in 8 byte MPI_Aint + to (possible) 4 byte ptr cast) */ +/* Should work even on 64bit or old 32bit configs */ +#include "mpir_ext.h" + +#define ADIOI_AINT_CAST_TO_VOID_PTR (void*)(intptr_t) + /* The next two casts are only used when you don't want sign extension + * when casting a (possible 4 byte) aint to a (8 byte) long long or offset */ +#define ADIOI_AINT_CAST_TO_LONG_LONG (long long) +#define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG +#define ADIOI_Assert MPIR_Ext_assert +#else +#include <assert.h> +#define ADIOI_AINT_CAST_TO_VOID_PTR (void*) +#define ADIOI_AINT_CAST_TO_LONG_LONG (long long) +#define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG +#define ADIOI_Assert assert +#endif + +#ifdef MPL_USE_DBG_LOGGING /*todo fix dependency on mpich? */ +/* DBGT_FPRINTF terse level printing */ +#define DBGT_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ +if (MPIR_Ext_dbg_romio_terse_enabled) fprintf +/* DBG_FPRINTF default (typical level) printing */ +#define DBG_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ +if (MPIR_Ext_dbg_romio_typical_enabled) fprintf +/* DBGV_FPRINTF verbose level printing */ +#define DBGV_FPRINTF if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ + if (MPIR_Ext_dbg_romio_verbose_enabled) fprintf +#else /* compile it out */ +#define DBGT_FPRINTF if (0) fprintf +#define DBG_FPRINTF if (0) fprintf +#define DBGV_FPRINTF if (0) fprintf +#endif + +/* declarations for threaded I/O */ +/* i/o thread data structure (bgmpio_pthreadwc) */ +typedef struct wcThreadFuncData { + ADIO_File fd; + int io_kind; + char *buf; + int size; + ADIO_Offset offset; + ADIO_Status *status; + int error_code; +} ADIOI_IO_ThreadFuncData; + +void *ADIOI_IO_Thread_Func(void *vptr_args); + + +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + +#ifndef PATH_MAX +#define PATH_MAX 65535 +#endif + +#if (HAVE_DECL_PWRITE == 0) +#include <sys/types.h> +#include <unistd.h> +ssize_t pread(int fd, void *buf, size_t count, off_t offset); +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); + +#endif + +#include "mpl.h" + +#endif /* ADIOI_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/include/adioi_errmsg.h b/3rd-party/romio341/adio/include/adioi_errmsg.h similarity index 82% rename from 3rd-party/romio321/adio/include/adioi_errmsg.h rename to 3rd-party/romio341/adio/include/adioi_errmsg.h index b1cdb4577a2457a56422ee33474abd8309ea8e79..b8b51a891a63a0cf43cdc0cbbd0aa0d3c3eede6c 100644 --- a/3rd-party/romio321/adio/include/adioi_errmsg.h +++ b/3rd-party/romio341/adio/include/adioi_errmsg.h @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ MPI_ERR_FILE @@ -32,10 +31,10 @@ MPI_ERR_TYPE MPIR_ERR_TYPE_NULL (null datatype. from MPICH) MPI_ERR_UNSUPPORTED_OPERATION - MPIR_ERR_NO_SHARED_FP "Shared file pointer not supported on PIOFS and PVFS" + MPIR_ERR_NO_SHARED_FP "Shared file pointer not supported on this fs" MPIR_ERR_AMODE_SEQ "Cannot use this function when file is opened with amode MPI_MODE_SEQUENTIAL" MPIR_ERR_MODE_WRONLY "Cannot read from a file opened with amode MPI_MODE_WRONLY" - MPIR_ERR_NO_MODE_SEQ "MPI_MODE_SEQUENTIAL not supported on PIOFS and PVFS" + MPIR_ERR_NO_MODE_SEQ "MPI_MODE_SEQUENTIAL not supported on this fs" MPI_ERR_REQUEST MPIR_ERR_REQUEST_NULL (null request. from MPICH) @@ -43,14 +42,10 @@ MPI_ERR_REQUEST MPI_ERR_IO MPIR_ERR_ETYPE_FRACTIONAL "Only an integral number of etypes can be accessed" MPIR_ERR_NO_FSTYPE "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:, panfs: ftp: gsiftp:)" - MPIR_ERR_NO_PFS "ROMIO has not been configured to use the PFS file system" - MPIR_ERR_NO_PIOFS "ROMIO has not been configured to use the PIOFS file system" MPIR_ERR_NO_UFS "ROMIO has not been configured to use the UFS file system" MPIR_ERR_NO_NFS "ROMIO has not been configured to use the NFS file system" - MPIR_ERR_NO_HFS "ROMIO has not been configured to use the HFS file system" MPIR_ERR_NO_XFS "ROMIO has not been configured to use the XFS file system" - MPIR_ERR_NO_SFS "ROMIO has not been configured to use the SFS file system" - MPIR_ERR_NO_PVFS "ROMIO has not been configured to use the PVFS file system" + MPIR_ERR_NO_PVFS2 "ROMIO has not been configured to use the PVFS2 file system" MPIR_ERR_NO_PANFS "ROMIO has not been configured to use the PANFS file system" MPIR_ERR_MULTIPLE_SPLIT_COLL "Only one active split collective I/O operation allowed per file handle" MPIR_ERR_NO_SPLIT_COLL "No previous split collective begin" @@ -61,7 +56,8 @@ MPI_ERR_IO MPIR_ERR_FILETYPE "Filetype must be constructed out of one or more etypes" MPIR_ERR_NO_TESTFS "ROMIO has not been configured to use the TESTFS file system" MPIR_ERR_DEFERRED "independent IO attempted even though no_indep_rw hint given" - MPIR_ERR_NO_BGL "ROMIO has not been configured to use the BGL file system" + MPIR_ERR_NO_GPFS "ROMIO has not been configured to use the GPFS file system" + MPIR_ERR_NO_IME "ROMIO has not been configured to use the IME burst buffer" MPI_ERR_COMM MPIR_ERR_COMM_NULL (null communicator. from MPICH) diff --git a/3rd-party/romio341/adio/include/adioi_error.h b/3rd-party/romio341/adio/include/adioi_error.h new file mode 100644 index 0000000000000000000000000000000000000000..133ce663404ba1ed2b750f42ac240ecf7d4976f4 --- /dev/null +++ b/3rd-party/romio341/adio/include/adioi_error.h @@ -0,0 +1,188 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef ADIOI_ERROR_H_INCLUDED +#define ADIOI_ERROR_H_INCLUDED + +#include <string.h> /* for strerror() */ + +/* MPIO_CHECK_XXX macros are used to clean up error checking and + * handling in many of the romio/mpi-io/ source files. + */ +#define MPIO_CHECK_FILE_HANDLE(fh, myname, error_code) \ + if ((fh <= (ADIO_File) 0) || \ + ((fh)->cookie != ADIOI_FILE_COOKIE)) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_FILE, \ + "**iobadfh", 0); \ + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); \ + goto fn_exit; \ + } + +/* TODO could add more glue code to help check for handle validity, or perhaps + * do some sort of always-safe attribute/info call to check for handle validity */ +#define MPIO_CHECK_COMM(comm_, myname_, error_code_) \ + do { \ + if ((comm_) == MPI_COMM_NULL) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + (myname_), __LINE__, \ + MPI_ERR_COMM, \ + "**commnull", 0); \ + error_code_ = MPIO_Err_return_file(MPI_FILE_NULL, (error_code_)); \ + goto fn_exit; \ + } \ + } while (0) + +#define MPIO_CHECK_COUNT(fh, count, myname, error_code) \ + if (count < 0) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_COUNT, \ + "**iobadcount", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code) \ + if (count*datatype_size != (ADIO_Offset)(unsigned)count*(ADIO_Offset)datatype_size) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ARG, \ + "**iobadcount", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code) \ + do { \ + if (datatype == MPI_DATATYPE_NULL) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_TYPE, \ + "**dtypenull", 0); \ + } \ + else { \ + error_code = MPI_SUCCESS; \ + MPIO_DATATYPE_ISCOMMITTED(datatype, error_code); \ + } \ + if (error_code != MPI_SUCCESS) { \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } \ + } while (0) + +#define MPIO_CHECK_READABLE(fh, myname, error_code) \ + if (fh->access_mode & ADIO_WRONLY) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ACCESS, \ + "**iowronly", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_WRITABLE(fh, myname, error_code) \ + if (fh->access_mode & ADIO_RDONLY) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_READ_ONLY, \ + "**iordonly", \ + 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code) \ + if (fh->access_mode & ADIO_SEQUENTIAL) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_UNSUPPORTED_OPERATION, \ + "**ioamodeseq", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_INTEGRAL_ETYPE(fh, count, dtype_size, myname, error_code) \ + if ((count*dtype_size) % fh->etype_size != 0) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, MPI_ERR_IO, \ + "**ioetype", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +#define MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code) \ + if (!ADIO_Feature(fh, ADIO_SHARED_FP)) \ + { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_UNSUPPORTED_OPERATION, \ + "**iosharedunsupported", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ + } + +/* MPIO_ERR_CREATE_CODE_XXX macros are used to clean up creation of + * error codes for common cases in romio/adio/ + */ +#define MPIO_ERR_CREATE_CODE_ERRNO(myname, myerrno, error_code_p) \ + *(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_IO, \ + "System call I/O error", \ + "Syscall error from %s: %s", \ + myname, \ + strerror(myerrno)); + +#define MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, key, error_code_p) \ + *(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_NOT_SAME, \ + "Value for info key not same across processes", \ + "Value for info key %s not same across processes", \ + key); + + +/* TODO: handle the independent io case more gracefully */ +#define ADIOI_TEST_DEFERRED(fh, myname, error_code) \ + if (! (fh)->is_open) { \ + ADIO_ImmediateOpen((fh), (error_code)); } + +/* Check MPI_Info object by calling MPI_Info_dup, if the info object is valid +then the dup operation will succeed */ +/* a collective check for error makes this macro collective */ +#define MPIO_CHECK_INFO_ALL(info, error_code, comm) { \ + MPI_Info dupinfo; \ + int tmp_err = MPI_SUCCESS; \ + if (info == MPI_INFO_NULL) { \ + dupinfo = MPI_INFO_NULL; \ + error_code = MPI_SUCCESS; \ + } else { \ + error_code = MPI_Info_dup(info, &dupinfo); \ + } \ + MPI_Allreduce(&error_code, &tmp_err, 1, MPI_INT, MPI_MAX, comm); \ + if (tmp_err != MPI_SUCCESS) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, MPI_ERR_OTHER, "**info", 0); \ + goto fn_fail; \ + } \ + if (dupinfo != MPI_INFO_NULL) { \ + MPI_Info_free(&dupinfo); \ + } \ + } + +#endif /* ADIOI_ERROR_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/adioi_fs_proto.h b/3rd-party/romio341/adio/include/adioi_fs_proto.h new file mode 100644 index 0000000000000000000000000000000000000000..d701a1b646caa8ad397182ffaf74871d4b408b1d --- /dev/null +++ b/3rd-party/romio341/adio/include/adioi_fs_proto.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#ifndef ADIOI_FS_PROTO_H_INCLUDED +#define ADIOI_FS_PROTO_H_INCLUDED + +#ifdef ROMIO_NFS +extern struct ADIOI_Fns_struct ADIO_NFS_operations; +/* prototypes are in adio/ad_nfs/ad_nfs.h */ +#endif + +#ifdef ROMIO_PANFS +extern struct ADIOI_Fns_struct ADIO_PANFS_operations; +/* prototypes are in adio/ad_panfs/ad_panfs.h */ +#endif + +#ifdef ROMIO_UFS +extern struct ADIOI_Fns_struct ADIO_UFS_operations; +/* prototypes are in adio/ad_ufs/ad_ufs.h */ +#endif + +#ifdef ROMIO_XFS +extern struct ADIOI_Fns_struct ADIO_XFS_operations; +/* prototypes are in adio/ad_xfs/ad_xfs.h */ +#endif + +#ifdef ROMIO_LUSTRE +extern struct ADIOI_Fns_struct ADIO_LUSTRE_operations; +/* prototypes are in adio/ad_lustre/ad_lustre.h */ +#endif + +#ifdef ROMIO_PVFS2 +extern struct ADIOI_Fns_struct ADIO_PVFS2_operations; +/* prototypes are in adio/ad_pvfs2/ad_pvfs2.h */ +#endif + +#ifdef ROMIO_TESTFS +extern struct ADIOI_Fns_struct ADIO_TESTFS_operations; +/* prototypes are in adio/ad_testfs/ad_testfs.h */ +#endif + +#ifdef ROMIO_GPFS +extern struct ADIOI_Fns_struct ADIO_GPFS_operations; +/* prototypes are in adio/ad_gpfs/ad_gpfs.h */ +#endif + +#ifdef ROMIO_IME +/* prototypes are in adio/ad_im/ad_im.h */ +extern struct ADIOI_Fns_struct ADIO_IME_operations; +#endif + +#ifdef ROMIO_DAOS +/* prototypes are in adio/ad_daos/ad_daos.h */ +extern struct ADIOI_Fns_struct ADIO_DAOS_operations; +#endif + +#ifdef ROMIO_QUOBYTEFS +/* prototypes are in adio/ad_quobytefs/ad_quobytefs.h */ +extern struct ADIOI_Fns_struct ADIO_QUOBYTEFS_operations; +extern void ADIOI_QUOBYTEFS_CreateAdapter(const char *, int *); +#endif + +#endif /* ADIOI_FS_PROTO_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/heap_sort.h b/3rd-party/romio341/adio/include/heap_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..166b09b9de1f9d721a73235eefd2a49ab3f69a26 --- /dev/null +++ b/3rd-party/romio341/adio/include/heap_sort.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef HEAP_SORT_H_INCLUDED +#define HEAP_SORT_H_INCLUDED + +#include "adio.h" + +typedef struct { + ADIO_Offset offset; + int proc; + ADIO_Offset reg_max_len; +} heap_node_t; + +typedef struct { + heap_node_t *nodes; + int size; +} heap_t; + +/*static inline int parent(heap_t *heap, int i); +static inline int left(heap_t *heap, int i); +static inline int right(heap_t *heap, int i); */ +void ADIOI_Heap_free(heap_t * heap); +int ADIOI_Heap_create(heap_t * heap, int size); +void ADIOI_Heap_insert(heap_t * heap, ADIO_Offset offset, int proc, ADIO_Offset reg_max_len); +void ADIOI_Heap_extract_min(heap_t * heap, ADIO_Offset * key, int *proc, ADIO_Offset * reg_max_len); + +#endif /* HEAP_SORT_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/hint_fns.h b/3rd-party/romio341/adio/include/hint_fns.h new file mode 100644 index 0000000000000000000000000000000000000000..409c4fb0c89e1f05a07d6818d5e6a0aa57f8e6d7 --- /dev/null +++ b/3rd-party/romio341/adio/include/hint_fns.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef HINT_FNS_H_INCLUDED +#define HINT_FNS_H_INCLUDED + +int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code); + +int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code); + +int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key, + int *local_cache, char *funcname, int *error_code); + +int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key, + char **local_cache, char *funcname, int *error_code); + +#endif /* HINT_FNS_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/lock_internal.h b/3rd-party/romio341/adio/include/lock_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..70f7db1f0cb1e22c38387445c335bde319393b42 --- /dev/null +++ b/3rd-party/romio341/adio/include/lock_internal.h @@ -0,0 +1,9 @@ +#ifndef LOCK_INTERNAL_H_INCLUDED +#define LOCK_INTERNAL_H_INCLUDED + +#include <fcntl.h> + +const char *ADIOI_GEN_flock_cmd_to_string(int cmd); +const char *ADIOI_GEN_flock_type_to_string(int type); + +#endif /* LOCK_INTERNAL_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/include/mpio_error.h b/3rd-party/romio341/adio/include/mpio_error.h similarity index 76% rename from 3rd-party/romio321/adio/include/mpio_error.h rename to 3rd-party/romio341/adio/include/mpio_error.h index f9d22b17219f82a24589ad87df4ad0b0ea44a06c..796f5ba5298f6456949c73fa3f6556d972969714 100644 --- a/3rd-party/romio321/adio/include/mpio_error.h +++ b/3rd-party/romio341/adio/include/mpio_error.h @@ -1,8 +1,11 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + +#ifndef MPIO_ERROR_H_INCLUDED +#define MPIO_ERROR_H_INCLUDED + /* MPI_ERR_FILE */ #define MPIR_ERR_FILE_NULL 3 #define MPIR_ERR_FILE_CORRUPT 5 @@ -42,35 +45,32 @@ #endif /* MPI_ERR_IO */ -#define MPIR_ADIO_ERROR 1 /* used for strerror(errno) */ +#define MPIR_ADIO_ERROR 1 /* used for strerror(errno) */ #define MPIR_ERR_ETYPE_FRACTIONAL 3 #define MPIR_ERR_NO_FSTYPE 5 -#define MPIR_ERR_NO_PFS 7 -#define MPIR_ERR_NO_PIOFS 9 #define MPIR_ERR_NO_UFS 11 #define MPIR_ERR_NO_NFS 13 -#define MPIR_ERR_NO_HFS 15 #define MPIR_ERR_NO_XFS 17 -#define MPIR_ERR_NO_SFS 19 -#define MPIR_ERR_NO_PVFS 21 +#define MPIR_ERR_NO_PVFS2 21 #define MPIR_ERR_NO_PANFS 22 #define MPIR_ERR_MULTIPLE_SPLIT_COLL 23 #define MPIR_ERR_NO_SPLIT_COLL 25 #define MPIR_ERR_ASYNC_OUTSTANDING 27 #define MPIR_READ_PERM 29 #define MPIR_PREALLOC_PERM 31 -#define MPIR_ERR_FILETYPE 33 -#define MPIR_ERR_NO_NTFS 35 +#define MPIR_ERR_FILETYPE 33 #define MPIR_ERR_NO_TESTFS 36 #define MPIR_ERR_NO_LUSTRE 37 -#define MPIR_ERR_NO_BGL 38 +#define MPIR_ERR_NO_GPFS 38 +#define MPIR_ERR_NO_IM 39 /* MPI_ERR_COMM */ #ifndef MPIR_ERR_COMM_NULL #define MPIR_ERR_COMM_NULL 3 -#define MPIR_ERR_COMM_INTER 5 +#define MPIR_ERR_COMM_INTER 5 #endif /* MPI_ERR_UNSUPPORTED_DATAREP */ #define MPIR_ERR_NOT_NATIVE_DATAREP 3 +#endif /* MPIO_ERROR_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/include/mpipr.h b/3rd-party/romio341/adio/include/mpipr.h similarity index 92% rename from 3rd-party/romio321/adio/include/mpipr.h rename to 3rd-party/romio341/adio/include/mpipr.h index 8b86c4cfe13d3fe928f8647003794ea037b89b92..173a812afd882aa020e91f372922e9d9fc12b972 100644 --- a/3rd-party/romio321/adio/include/mpipr.h +++ b/3rd-party/romio341/adio/include/mpipr.h @@ -1,11 +1,14 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + +#ifndef MPIPR_H_INCLUDED +#define MPIPR_H_INCLUDED + /* This file replaces all MPI function names with their PMPI equivalents. - PMPI versions are used by default so that the user can profile - application code without interference from MPI functions used by + PMPI versions are used by default so that the user can profile + application code without interference from MPI functions used by MPI-IO. */ #ifndef USE_MPI_VERSIONS @@ -28,6 +31,8 @@ #define MPI_Attr_delete PMPI_Attr_delete #undef MPI_Attr_get #define MPI_Attr_get PMPI_Attr_get +#undef MPI_Attr_put +#define MPI_Attr_put PMPI_Attr_put #undef MPI_Barrier #define MPI_Barrier PMPI_Barrier #undef MPI_Bcast @@ -64,14 +69,12 @@ #define MPI_Comm_compare PMPI_Comm_compare #undef MPI_Comm_create #define MPI_Comm_create PMPI_Comm_create -#undef MPI_Comm_create_keyval -#define MPI_Comm_create_keyval PMPI_Comm_create_keyval +#undef MPI_Comm_create_errhandler +#define MPI_Comm_create_errhandler PMPI_Comm_create_errhandler #undef MPI_Comm_dup #define MPI_Comm_dup PMPI_Comm_dup #undef MPI_Comm_free #define MPI_Comm_free PMPI_Comm_free -#undef MPI_Comm_free_keyval -#define MPI_Comm_free_keyval PMPI_Comm_free_keyval #undef MPI_Comm_group #define MPI_Comm_group PMPI_Comm_group #undef MPI_Comm_rank @@ -80,8 +83,6 @@ #define MPI_Comm_remote_group PMPI_Comm_remote_group #undef MPI_Comm_remote_size #define MPI_Comm_remote_size PMPI_Comm_remote_size -#undef MPI_Comm_set_attr -#define MPI_Comm_set_attr PMPI_Comm_set_attr #undef MPI_Comm_size #define MPI_Comm_size PMPI_Comm_size #undef MPI_Comm_split @@ -90,14 +91,12 @@ #define MPI_Comm_test_inter PMPI_Comm_test_inter #undef MPI_Dims_create #define MPI_Dims_create PMPI_Dims_create -#undef MPI_Errhandler_create -#define MPI_Errhandler_create PMPI_Errhandler_create #undef MPI_Errhandler_free #define MPI_Errhandler_free PMPI_Errhandler_free -#undef MPI_Errhandler_get -#define MPI_Errhandler_get PMPI_Errhandler_get -#undef MPI_Errhandler_set -#define MPI_Errhandler_set PMPI_Errhandler_set +#undef MPI_Comm_get_errhandler +#define MPI_Comm_get_errhandler PMPI_Comm_get_errhandler +#undef MPI_Comm_set_errhandler +#define MPI_Comm_set_errhandler PMPI_Comm_set_errhandler #undef MPI_Error_class #define MPI_Error_class PMPI_Error_class #undef MPI_Error_string @@ -174,6 +173,10 @@ #define MPI_Isend PMPI_Isend #undef MPI_Issend #define MPI_Issend PMPI_Issend +#undef MPI_Keyval_create +#define MPI_Keyval_create PMPI_Keyval_create +#undef MPI_Keyval_free +#define MPI_Keyval_free PMPI_Keyval_free #undef MPI_Name_get #define MPI_Name_get PMPI_Name_get #undef MPI_Name_put @@ -248,10 +251,6 @@ #define MPI_Type_contiguous PMPI_Type_contiguous #undef MPI_Type_count #define MPI_Type_count PMPI_Type_count -#undef MPI_Type_create_struct -#define MPI_Type_create_struct PMPI_Type_create_struct -#undef MPI_Type_create_resized -#define MPI_Type_create_resized PMPI_Type_create_resized /* #define MPI_Type_create_darray PMPI_Type_create_darray */ #undef MPI_Type_create_indexed_block #define MPI_Type_create_indexed_block PMPI_Type_create_indexed_block @@ -259,6 +258,8 @@ #define MPI_Type_create_hindexed PMPI_Type_create_hindexed #undef MPI_Type_create_hindexed_block #define MPI_Type_create_hindexed_block PMPI_Type_create_hindexed_block +#undef MPI_Type_create_struct +#define MPI_Type_create_struct PMPI_Type_create_struct #undef MPI_Type_create_hvector #define MPI_Type_create_hvector PMPI_Type_create_hvector /* #define MPI_Type_create_subarray PMPI_Type_create_subarray */ @@ -276,6 +277,8 @@ #define MPI_Type_indexed PMPI_Type_indexed #undef MPI_Type_size #define MPI_Type_size PMPI_Type_size +#undef MPI_Type_size_x +#define MPI_Type_size_x PMPI_Type_size_x #undef MPI_Type_vector #define MPI_Type_vector PMPI_Type_vector #undef MPI_Unpack @@ -293,7 +296,7 @@ #undef MPI_Wtime #define MPI_Wtime PMPI_Wtime -/* commented out because these could be macros themselves, as in MPICH +/* commented out because these could be macros themselves, as in MPICH #undef MPI_Type_c2f #define MPI_Type_c2f PMPI_Type_c2f #undef MPI_Type_f2c @@ -326,8 +329,10 @@ #undef MPI_Status_set_elements #define MPI_Status_set_elements PMPI_Status_set_elements +#undef MPI_Status_set_elements_x +#define MPI_Status_set_elements_x PMPI_Status_set_elements_x -#ifndef HAVE_MPI_INFO_SRC /* everywhere except in info source directory */ +#ifndef HAVE_MPI_INFO_SRC /* everywhere except in info source directory */ #undef MPI_Info_create #define MPI_Info_create PMPI_Info_create #undef MPI_Info_set @@ -364,7 +369,7 @@ #undef MPIX_Grequest_class_allocate #define MPIX_Grequest_class_allocate PMPIX_Grequest_class_allocate -#ifdef MPIO_FORTRAN_SRC /* only in MPI-IO Fortran source directory */ +#ifdef MPIO_FORTRAN_SRC /* only in MPI-IO Fortran source directory */ #undef MPI_File_c2f #define MPI_File_c2f PMPI_File_c2f #undef MPI_File_f2c @@ -381,3 +386,5 @@ #define MPI_Type_create_keyval PMPI_Type_create_keyval #endif + +#endif /* MPIPR_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/mpiu_external32.h b/3rd-party/romio341/adio/include/mpiu_external32.h new file mode 100644 index 0000000000000000000000000000000000000000..04e48675bcf499805bdcdd79fff72d920ef93808 --- /dev/null +++ b/3rd-party/romio341/adio/include/mpiu_external32.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPIU_EXTERNAL32_H_INCLUDED +#define MPIU_EXTERNAL32_H_INCLUDED + +int MPIU_write_external32_conversion_fn(const void *userbuf, MPI_Datatype datatype, + int count, void *filebuf); +int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype, + int count, void *filebuf); +int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint * size); + +/* given a buffer, count, and datatype, return an apropriately sized and + * * external32-formatted buffer, suitable for handing off to a subsequent write + * * routine */ +int MPIU_external32_buffer_setup(const void *buf, int count, MPI_Datatype type, void **newbuf); + +#endif /* MPIU_EXTERNAL32_H_INCLUDED */ diff --git a/3rd-party/romio341/adio/include/mpiu_greq.h b/3rd-party/romio341/adio/include/mpiu_greq.h new file mode 100644 index 0000000000000000000000000000000000000000..09a617dcfe70b490532f69b7d14d02c8d62c2903 --- /dev/null +++ b/3rd-party/romio341/adio/include/mpiu_greq.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPIU_GREQ_H_INCLUDED +#define MPIU_GREQ_H_INCLUDED + +int MPIU_Greq_query_fn(void *extra_state, MPI_Status * status); +int MPIU_Greq_free_fn(void *extra_state); +int MPIU_Greq_cancel_fn(void *extra_state, int complete); + +#endif /* MPIU_GREQ_H_INCLUDED */ diff --git a/3rd-party/romio321/adio/include/nopackage.h b/3rd-party/romio341/adio/include/nopackage.h similarity index 78% rename from 3rd-party/romio321/adio/include/nopackage.h rename to 3rd-party/romio341/adio/include/nopackage.h index 184e4b4ac84385616f5b5139ca4058e3551480f8..bab327e2610f0b80995ffc1c3689870c4e6e7aae 100644 --- a/3rd-party/romio321/adio/include/nopackage.h +++ b/3rd-party/romio341/adio/include/nopackage.h @@ -1,7 +1,8 @@ /* - * (C) 2011 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + /* See comments in MPICH's configure.ac for an explanation of what this file is * and why it exists. */ @@ -13,4 +14,3 @@ #undef PACKAGE_TARNAME #undef PACKAGE_URL #undef PACKAGE_VERSION - diff --git a/3rd-party/romio321/adio/include/romioconf-undefs.h b/3rd-party/romio341/adio/include/romioconf-undefs.h similarity index 100% rename from 3rd-party/romio321/adio/include/romioconf-undefs.h rename to 3rd-party/romio341/adio/include/romioconf-undefs.h diff --git a/3rd-party/romio341/autogen.sh b/3rd-party/romio341/autogen.sh new file mode 100755 index 0000000000000000000000000000000000000000..ef71472ed02cc9d3133015bc54c7ddddad09ed8e --- /dev/null +++ b/3rd-party/romio341/autogen.sh @@ -0,0 +1,10 @@ +#! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +${AUTORECONF:-autoreconf} ${autoreconf_args:-"-vif"} -I confdb + +echo "=== running autoreconf in 'mpl' ===" +(cd mpl && ${AUTORECONF:-autoreconf} ${autoreconf_args:-"-vif"}) || exit 1 diff --git a/3rd-party/romio321/confdb/aclocal_am.m4 b/3rd-party/romio341/confdb/aclocal_am.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_am.m4 rename to 3rd-party/romio341/confdb/aclocal_am.m4 diff --git a/3rd-party/romio321/confdb/aclocal_attr_alias.m4 b/3rd-party/romio341/confdb/aclocal_attr_alias.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_attr_alias.m4 rename to 3rd-party/romio341/confdb/aclocal_attr_alias.m4 diff --git a/3rd-party/romio321/confdb/aclocal_bugfix.m4 b/3rd-party/romio341/confdb/aclocal_bugfix.m4 similarity index 97% rename from 3rd-party/romio321/confdb/aclocal_bugfix.m4 rename to 3rd-party/romio341/confdb/aclocal_bugfix.m4 index f580d3919adde2b48c8a8b11522c5169eb713caf..ef320dec57839484c18091e2b8b47fbed1dbd161 100644 --- a/3rd-party/romio321/confdb/aclocal_bugfix.m4 +++ b/3rd-party/romio341/confdb/aclocal_bugfix.m4 @@ -50,7 +50,7 @@ else # come up with (see tt#1007) [goodell@] AS_CASE(["$INSTALL"], [/*],[:], - [*install-sh*],[INSTALL="$master_top_srcdir/$INSTALL"]) + [*install-sh*],[INSTALL="$main_top_srcdir/$INSTALL"]) # Check that this install really works rm -f conftest diff --git a/3rd-party/romio321/confdb/aclocal_cache.m4 b/3rd-party/romio341/confdb/aclocal_cache.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_cache.m4 rename to 3rd-party/romio341/confdb/aclocal_cache.m4 diff --git a/3rd-party/romio321/confdb/aclocal_cc.m4 b/3rd-party/romio341/confdb/aclocal_cc.m4 similarity index 88% rename from 3rd-party/romio321/confdb/aclocal_cc.m4 rename to 3rd-party/romio341/confdb/aclocal_cc.m4 index 666d0a4c262512ee53f0f204324dc8f1b61b214c..207f7ca4040e14a258416fba3a258d7cc13d645a 100644 --- a/3rd-party/romio321/confdb/aclocal_cc.m4 +++ b/3rd-party/romio341/confdb/aclocal_cc.m4 @@ -1,19 +1,6 @@ dnl AC_PROG_CC_GNU ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)]) -dnl PAC_PROG_CC - reprioritize the C compiler search order -AC_DEFUN([PAC_PROG_CC],[ - dnl Many standard autoconf/automake/libtool macros, such as LT_INIT, - dnl perform an AC_REQUIRE([AC_PROG_CC]). If this macro (PAC_PROG_CC) - dnl comes after LT_INIT (or similar) then the default compiler search - dnl path will be used instead. This AC_BEFORE macro ensures that a - dnl warning will be emitted at autoconf-time (autogen.sh-time) to help - dnl developers notice this case. - AC_BEFORE([$0],[AC_PROG_CC]) - PAC_PUSH_FLAG([CFLAGS]) - AC_PROG_CC([icc pgcc xlc xlC pathcc gcc clang cc]) - PAC_POP_FLAG([CFLAGS]) -]) dnl dnl/*D dnl PAC_C_CHECK_COMPILER_OPTION - Check that a compiler option is accepted @@ -68,36 +55,6 @@ AC_MSG_RESULT([$pac_result]) dnl Delete the conftest created by AC_LANG_CONFTEST. rm -f conftest.$ac_ext -# gcc 4.2.4 on 32-bit does not complain about the -Wno-type-limits option -# even though it doesn't support it. However, when another warning is -# triggered, it gives an error that the option is not recognized. So we -# need to test with a conftest file that will generate warnings. -# -# add an extra switch, pac_c_check_compiler_option_prototest, to -# disable this test just in case some new compiler does not like it. -# -# Linking with a program with an invalid prototype to ensure a compiler warning. - -if test "$pac_result" = "yes" \ - -a "$pac_c_check_compiler_option_prototest" != "no" ; then - AC_MSG_CHECKING([whether C compiler option $1 works with an invalid prototype program]) - AC_LINK_IFELSE([ - dnl We want a warning, but we don't want to inadvertently disable - dnl special warnings like -Werror-implicit-function-declaration (e.g., - dnl in PAC_CC_STRICT) by compiling something that might actually be - dnl treated as an error by the compiler. So we try to elicit an - dnl "unused variable" warning and/or an "uninitialized" warning with the - dnl test program below. - dnl - dnl The old sanity program was: - dnl void main() {return 0;} - dnl which clang (but not GCC) would treat as an *error*, invalidating - dnl the test for any given parameter. - AC_LANG_SOURCE([int main(int argc, char **argv){ int foo, bar = 0; foo += 1; return foo; }]) - ],[pac_result=yes],[pac_result=no]) - AC_MSG_RESULT([$pac_result]) -fi -# if test "$pac_result" = "yes" ; then AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) pac_result=unknown @@ -459,6 +416,8 @@ dnl (-D __STRICT_ANSI__-trigraphs) AC_DEFUN([PAC_CC_STRICT],[ export enable_strict_done if test "$enable_strict_done" != "yes" ; then + # make sure we don't add the below flags multiple times + enable_strict_done=yes # Some comments on strict warning options. # These were added to improve portability @@ -481,8 +440,6 @@ if test "$enable_strict_done" != "yes" ; then # -Wno-sign-compare -- read() and write() return bytes read/written # as a signed value, but we often compare this to size_t (or # msg_sz_t) variables. - # -Wno-format-zero-length -- this warning is irritating and useless, since - # a zero-length format string is very well defined # These were removed to reduce warnings: # -Wcast-qual -- Sometimes we need to cast "volatile char*" to # "char*", e.g., for memcpy. @@ -521,7 +478,7 @@ if test "$enable_strict_done" != "yes" ; then # compiler. # -Wno-type-limits -- There are places where we compare an unsigned to # a constant that happens to be zero e.g., if x is unsigned and - # MIN_VAL is zero, we'd like to do "MPIU_Assert(x >= MIN_VAL);". + # MIN_VAL is zero, we'd like to do "MPIR_Assert(x >= MIN_VAL);". # Note this option is not supported by gcc 4.2. This needs to be added # after most other warning flags, so that we catch a gcc bug on 32-bit # that doesn't give a warning that this is unsupported, unless another @@ -550,67 +507,68 @@ if test "$enable_strict_done" != "yes" ; then -Wold-style-definition -Wno-multichar -Wno-deprecated-declarations - -Wpacked -Wnested-externs -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros - -Wno-format-zero-length -Wtype-limits -Werror-implicit-function-declaration -Wstack-usage=262144 + -diag-disable=all " - enable_c89=no - enable_c99=yes - enable_posix=2001 + if test -z "$1"; then + flags=no + else + flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`" + fi + add_cflags=yes + c_std=c99 + posix_std=2001 enable_opt=yes - flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`" + pac_cc_strict_werror=no for flag in ${flags}; do case "$flag" in - c89) - enable_strict_done="yes" - enable_c89=yes - enable_c99=no + error) + # note: we can't enable -Werror early as it will break many config tests + # Need apply to CFLAGS at the end of configure. + pac_cc_strict_werror=yes + ;; + stdc89) + c_std=c89 ;; - c99) - enable_strict_done="yes" - enable_c89=no - enable_c99=yes + stdc99) + c_std=c99 + ;; + stdgnu99) + c_std=gnu99 + ;; + nostdc) + c_std=none ;; posix1995) - enable_strict_done="yes" - enable_posix=1995 + posix_std=1995 ;; - posix|posix2001) - enable_strict_done="yes" - enable_posix=2001 + posix2001) + posix_std=2001 ;; posix2008) - enable_strict_done="yes" - enable_posix=2008 + posix_std=2008 ;; noposix) - enable_strict_done="yes" - enable_posix=no + posix_std=none ;; opt) - enable_strict_done="yes" enable_opt=yes ;; noopt) - enable_strict_done="yes" enable_opt=no ;; all|yes) - enable_strict_done="yes" - enable_c99=yes - enable_posix=2001 - enable_opt=yes + # leave the defaults ;; - no) - # Accept and ignore this value - : + no|none) + add_cflags=no ;; *) if test -n "$flag" ; then @@ -621,33 +579,50 @@ if test "$enable_strict_done" != "yes" ; then done pac_cc_strict_flags="" - if test "${enable_strict_done}" = "yes" ; then - if test "${enable_opt}" = "yes" ; then - pac_cc_strict_flags="-O2" - fi + if test "${add_cflags}" = "yes" ; then + # common flags pac_cc_strict_flags="$pac_cc_strict_flags $pac_common_strict_flags" - # We only allow one of strict-C99 or strict-C89 to be - # enabled. If C99 is enabled, we automatically disable C89. - if test "${enable_c99}" = "yes" ; then - PAC_APPEND_FLAG([-std=c99],[pac_cc_strict_flags]) - # Use -D_STDC_C99= for Solaris compilers. See - # http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html - # for discussion on why not to use -xc99 - PAC_APPEND_FLAG([-D_STDC_C99=],[pac_cc_strict_flags]) - elif test "${enable_c89}" = "yes" ; then - PAC_APPEND_FLAG([-std=c89],[pac_cc_strict_flags]) - PAC_APPEND_FLAG([-Wdeclaration-after-statement],[pac_cc_strict_flags]) + + # optimization flags + if test "${enable_opt}" = "yes" ; then + PAC_APPEND_FLAG([-O2],[pac_cc_strict_flags]) fi - # POSIX 2001 should be used with C99. But the default standard for some - # compilers are not C99. We must test the support of POSIX 2001 after - # testing C99. - case "$enable_posix" in - no) : ;; + + # stdc flags + case "${c_std}" in + none) + : + ;; + c89) + PAC_APPEND_FLAG([-std=c89],[pac_cc_strict_flags]) + PAC_APPEND_FLAG([-Wdeclaration-after-statement],[pac_cc_strict_flags]) + ;; + c99) + PAC_APPEND_FLAG([-std=c99],[pac_cc_strict_flags]) + # Use -D_STDC_C99= for Solaris compilers. See + # http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html + # for discussion on why not to use -xc99 + PAC_APPEND_FLAG([-D_STDC_C99=],[pac_cc_strict_flags]) + ;; + gnu99) + PAC_APPEND_FLAG([-std=gnu99],[pac_cc_strict_flags]) + ;; + *) + AC_MSG_ERROR([internal error, unexpected C std version: '$c_std']) + ;; + esac + + # posix flags + case "${posix_std}" in + none) : ;; 1995) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=199506L],[pac_cc_strict_flags]) ;; 2001) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200112L],[pac_cc_strict_flags]) ;; 2008) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200809L],[pac_cc_strict_flags]) ;; - *) AC_MSG_ERROR([internal error, unexpected POSIX version: '$enable_posix']) ;; + *) AC_MSG_ERROR([internal error, unexpected POSIX version: '$posix_std']) ;; esac + if test "${posix_std}" != "none" ; then + AS_CASE([$host],[*-*-darwin*], [PAC_APPEND_FLAG([-D_DARWIN_C_SOURCE],[pac_cc_strict_flags])]) + fi fi # See if the above options work with the compiler @@ -674,7 +649,7 @@ dnl dnl D*/ AC_DEFUN([PAC_ARG_STRICT],[ AC_ARG_ENABLE(strict, - AC_HELP_STRING([--enable-strict], [Turn on strict compilation testing])) + AC_HELP_STRING([--enable-strict], [Turn on strict compilation testing]),,enable_strict=no) PAC_CC_STRICT($enable_strict) CFLAGS="$CFLAGS $pac_cc_strict_flags" export CFLAGS @@ -1114,11 +1089,7 @@ int main( int argc, char *argv[] ) if (extent1 < extent2) extent1 = extent2; if ((sizeof(double) == 8) && (extent1 % 8) != 0) { if (extent1 % 4 == 0) { -#ifdef HAVE_MAX_FP_ALIGNMENT - if (HAVE_MAX_FP_ALIGNMENT >= 8) align_4 = 1; -#else align_4 = 1; -#endif } } @@ -1293,75 +1264,6 @@ pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)]) fi fi ]) -dnl -dnl Check for a broken install (fails to preserve file modification times, -dnl thus breaking libraries. -dnl -dnl Create a library, install it, and then try to link against it. -AC_DEFUN([PAC_PROG_INSTALL_BREAKS_LIBS],[ -AC_CACHE_CHECK([whether install breaks libraries], -ac_cv_prog_install_breaks_libs,[ -AC_REQUIRE([AC_PROG_RANLIB]) -AC_REQUIRE([AC_PROG_INSTALL]) -AC_REQUIRE([AC_PROG_CC]) -ac_cv_prog_install_breaks_libs=yes - -AC_COMPILE_IFELSE([ - AC_LANG_SOURCE([ int foo(int); int foo(int a){return a;} ]) -],[ - if ${AR-ar} ${AR_FLAGS-cr} libconftest.a conftest.$OBJEXT >/dev/null 2>&1 ; then - if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then - # Anything less than sleep 10, and Mac OS/X (Darwin) - # will claim that install works because ranlib won't complain - sleep 10 - libinstall="$INSTALL_DATA" - eval "libinstall=\"$libinstall\"" - if ${libinstall} libconftest.a libconftest1.a >/dev/null 2>&1 ; then - saved_LIBS="$LIBS" - LIBS="libconftest1.a" - AC_LINK_IFELSE([ - AC_LANG_SOURCE([ -extern int foo(int); -int main(int argc, char **argv){ return foo(0); } - ]) - ],[ - # Success! Install works - ac_cv_prog_install_breaks_libs=no - ],[ - # Failure! Does install -p work? - rm -f libconftest1.a - if ${libinstall} -p libconftest.a libconftest1.a >/dev/null 2>&1 ; then - AC_LINK_IFELSE([],[ - # Success! Install works - ac_cv_prog_install_breaks_libs="no, with -p" - ]) - fi - ]) - LIBS="$saved_LIBS" - fi - fi - fi -]) -rm -f libconftest*.a -]) dnl Endof ac_cache_check - -if test -z "$RANLIB_AFTER_INSTALL" ; then - RANLIB_AFTER_INSTALL=no -fi -case "$ac_cv_prog_install_breaks_libs" in - yes) - RANLIB_AFTER_INSTALL=yes - ;; - "no, with -p") - INSTALL_DATA="$INSTALL_DATA -p" - ;; - *) - # Do nothing - : - ;; -esac -AC_SUBST(RANLIB_AFTER_INSTALL) -]) # # determine if the compiler defines a symbol containing the function name @@ -1693,3 +1595,89 @@ if test x$have_builtin_expect = xyes ; then AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.]) fi ]) + +dnl +dnl PAC_C_STATIC_ASSERT - Test whether C11 _Static_assert is supported +dnl +dnl will AC_DEFINE([HAVE_C11__STATIC_ASSERT]) if C11 _Static_assert is supported. +dnl +AC_DEFUN([PAC_C_STATIC_ASSERT], [ + AC_MSG_CHECKING([for C11 _Static_assert functionality]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ + int main(){ + _Static_assert(1, "The impossible happened!"); + return 0; + } + ])],[ + AC_DEFINE([HAVE_C11__STATIC_ASSERT],[1],[Define if C11 _Static_assert is supported.]) + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + +dnl +dnl PAC_CC_CHECK_TLS - Test for thread local storage support +dnl +dnl will AC_DEFINE([TLS]) to a compiler supported TLS keyword +dnl +AC_DEFUN([PAC_CC_CHECK_TLS], [ + AC_CACHE_CHECK([for thread local storage], [pac_cv_tls], [ + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE([AC_LANG_PROGRAM([_Thread_local int foo=0;],[foo=1])], + [pac_cv_tls=_Thread_local]) + fi + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE( [AC_LANG_PROGRAM([__thread int foo=0;],[foo=1])], + [pac_cv_tls=__thread]) + fi + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE( [AC_LANG_PROGRAM([__declspec(thread) int foo=0;],[foo=1])], + [pac_cv_tls="__declspec(thread)"]) + fi]) + if test -z $pac_cv_tls ; then + AC_MSG_WARN([Compiler does not support thread local storage]) + else + AC_DEFINE_UNQUOTED([COMPILER_TLS], [$pac_cv_tls], [Defined the keyword for thread-local storage.]) + fi +]) + +dnl Test whether pointers can be aligned on a int boundary or require +dnl a pointer boundary. +AC_DEFUN([PAC_CHECK_PTR_ALIGN]), [ + AC_MSG_CHECKING([for alignment restrictions on pointers]) + AC_TRY_RUN( + changequote(<<,>>) + struct foo { int a; void *b; }; + int main() { + int buf[10]; + struct foo *p1; + p1=(struct foo*)&buf[0]; + p1->b = (void *)0; + p1=(struct foo*)&buf[1]; + p1->b = (void *)0; + return 0; + changequote([,]) + },pac_cv_pointers_have_int_alignment=yes,pac_cv_pointers_have_int_alignment=no,pac_cv_pointers_have_int_alignment=unknown) + + if test "$pac_cv_pointers_have_int_alignment" != "yes" ; then + AC_DEFINE(NEEDS_POINTER_ALIGNMENT_ADJUST,1,[define if pointers must be aligned on pointer boundaries]) + AC_MSG_RESULT([pointer]) + else + AC_MSG_RESULT([int or better]) + fi +]) + +dnl PAC_ARG_ATOMIC_PRIMITIVES +dnl - Provide configure option to select atomic primitives. Defaults to auto. +AC_DEFUN([PAC_ARG_ATOMIC_PRIMITIVES], [ + AC_ARG_WITH([mpl-atomic-primitives], + [ --with-mpl-atomic-primitives=package Atomic primitives to use. The following is include: + auto - Automatically choose the best one (default) + c11 - C11 atomics + gcc_atomic - GCC atomic builtins + gcc_sync - GCC sync builtins + win - Windows builtins + lock - Mutex-based synchronization + no|none - atomic operations are performed without synchronization + ],,with_mpl_atomic_primitives=auto)]) diff --git a/3rd-party/romio341/confdb/aclocal_check_visibility.m4 b/3rd-party/romio341/confdb/aclocal_check_visibility.m4 new file mode 100644 index 0000000000000000000000000000000000000000..1ea85bae1140adff990f4b689ad3ea40705ec723 --- /dev/null +++ b/3rd-party/romio341/confdb/aclocal_check_visibility.m4 @@ -0,0 +1,123 @@ +# This macro set originally copied from hwloc. +# MPICH modifications: +# - renamed macro to PAC_CHECK_VISIBILITY +# - removed C compiler vendor check +# - sed -e 's/HWLOC/MPICH/gI' +# +# Copyright © 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright © 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright © 2004-2007 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright © 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright © 2006-2007 Cisco Systems, Inc. All rights reserved. +# and renamed/modified for hwloc: +# Copyright © 2009 Inria. All rights reserved. +# Copyright © 2009-2010 Université Bordeaux +# Copyright © 2010-2012 Cisco Systems, Inc. All rights reserved. +# See COPYING in top-level directory. +# +# 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 listed +# in this license in the documentation and/or other materials +# provided with the distribution. +# +# - Neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# The copyright holders provide no reassurances that the source code +# provided does not infringe any patent, copyright, or any other +# intellectual property rights of third parties. The copyright holders +# disclaim any liability to any recipient for claims brought against +# recipient by any third party for infringement of that parties +# intellectual property rights. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT +# OWNER 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. +# + +# PAC_CHECK_VISIBILITY +# -------------------------------------------------------- +AC_DEFUN([PAC_CHECK_VISIBILITY],[ + # Be safe for systems that have ancient Autoconf's (e.g., RHEL5) + m4_ifdef([AC_PROG_GREP], + [AC_REQUIRE([AC_PROG_GREP])], + [GREP=grep]) + + # Check if the compiler has support for visibility, like some + # versions of gcc, icc, Sun Studio cc. + AC_ARG_ENABLE(visibility, + AC_HELP_STRING([--enable-visibility], + [enable visibility feature of certain compilers/linkers (default: enabled on platforms that support it)])) + + case ${target} in + *-*-aix*|*-*-mingw*|*-*-cygwin*|*-*-hpux*) + enable_visibility=no + ;; + esac + + mpich_visibility_define=0 + mpich_msg="whether to enable symbol visibility" + if test "$enable_visibility" = "no"; then + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([no (disabled)]) + else + CFLAGS_orig=$CFLAGS + mpich_add=-fvisibility=hidden + CFLAGS="$CFLAGS_orig $mpich_add -Werror" + + AC_MSG_CHECKING([if $CC supports $mpich_add]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include <stdio.h> + __attribute__((visibility("default"))) int foo; + ]],[[fprintf(stderr, "Hello, world\n");]])], + [AS_IF([test -s conftest.err], + [$GREP -iq visibility conftest.err + # If we find "visibility" in the stderr, then + # assume it doesn't work + AS_IF([test "$?" = "0"], [mpich_add=])]) + ], [mpich_add=]) + AS_IF([test "$mpich_add" = ""], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes])]) + + CFLAGS=$CFLAGS_orig + VISIBILITY_CFLAGS=$mpich_add + + if test "$mpich_add" != "" ; then + mpich_visibility_define=1 + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([yes (via $mpich_add)]) + elif test "$enable_visibility" = "yes"; then + AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting]) + else + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([no (unsupported)]) + fi + unset mpich_add + fi + + AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$mpich_visibility_define], + [Whether C compiler supports symbol visibility or not]) +]) diff --git a/3rd-party/romio321/confdb/aclocal_coverage.m4 b/3rd-party/romio341/confdb/aclocal_coverage.m4 similarity index 99% rename from 3rd-party/romio321/confdb/aclocal_coverage.m4 rename to 3rd-party/romio341/confdb/aclocal_coverage.m4 index ce949d40a6528d4247b27385ca4955a196228965..844beb5098f92976a644dbdd7d08e59435fa6d18 100644 --- a/3rd-party/romio321/confdb/aclocal_coverage.m4 +++ b/3rd-party/romio341/confdb/aclocal_coverage.m4 @@ -87,4 +87,3 @@ if test "$enable_coverage" = "yes" ; then fi AM_CONDITIONAL([BUILD_COVERAGE],[test "X$pac_cv_use_coverage" = "Xyes"]) ]) - diff --git a/3rd-party/romio321/confdb/aclocal_cxx.m4 b/3rd-party/romio341/confdb/aclocal_cxx.m4 similarity index 83% rename from 3rd-party/romio321/confdb/aclocal_cxx.m4 rename to 3rd-party/romio341/confdb/aclocal_cxx.m4 index 72febd8ab9d9ecdf3662af1858188c0209ca4608..6c902af2c5316bdea33f5dbab3d8508e0fab97ba 100644 --- a/3rd-party/romio321/confdb/aclocal_cxx.m4 +++ b/3rd-party/romio341/confdb/aclocal_cxx.m4 @@ -1,22 +1,3 @@ -dnl PAC_CXX_SEARCH_LIST - expands to a whitespace separated list of C++ -dnl compilers for use with AC_PROG_CXX that is more suitable for HPC software -dnl packages -AC_DEFUN([PAC_CXX_SEARCH_LIST],[$CCC icpc pgCC xlC pathCC g++ clang++ c++ cc++ cxx CC cl]) -dnl PAC_PROG_CXX - reprioritize the C++ compiler search order -dnl NOTE: this macro suffers from a basically intractable "expanded before it -dnl was required" problem when libtool is also used -AC_DEFUN([PAC_PROG_CXX],[ - PAC_PUSH_FLAG([CXXFLAGS]) - # This test uses the list from a recent PROG_CXX, but with the - # addition of the Portland group, IBM, and Intel C++ compilers - # (While the Intel icc compiler will compile C++ programs, it will - # not *link* C++ object files unless there is at least one C++ source - # file present on the command that performs the linking. icpc is the - # Intel C++ compiler that both compiles and links C++ programs) - AC_PROG_CXX([PAC_CXX_SEARCH_LIST]) - PAC_POP_FLAG([CXXFLAGS]) -]) - dnl This is from crypt.to/autoconf-archive, slightly modified. dnl It defines bool as int if it is not availalbe dnl diff --git a/3rd-party/romio321/confdb/aclocal_f77.m4 b/3rd-party/romio341/confdb/aclocal_f77.m4 similarity index 98% rename from 3rd-party/romio321/confdb/aclocal_f77.m4 rename to 3rd-party/romio341/confdb/aclocal_f77.m4 index 92d310b0f21cb1b04b137b43ccb4dc8cbee35ada..f44151074604be3855b741ca1e0eb173be7bcd1e 100644 --- a/3rd-party/romio321/confdb/aclocal_f77.m4 +++ b/3rd-party/romio341/confdb/aclocal_f77.m4 @@ -1,15 +1,3 @@ -dnl PAC_F77_SEARCH_LIST - expands to a whitespace separated list of fortran 77 -dnl compilers for use with AC_PROG_F77 that is more suitable for HPC software -dnl packages -AC_DEFUN([PAC_F77_SEARCH_LIST],[ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn gfortran f77 g77]) -dnl PAC_PROG_F77 - reprioritize the F77 compiler search order -dnl NOTE: this macro suffers from a basically intractable "expanded before it -dnl was required" problem when libtool is also used -AC_DEFUN([PAC_PROG_F77],[ -PAC_PUSH_FLAG([FFLAGS]) -AC_PROG_F77([PAC_F77_SEARCH_LIST]) -PAC_POP_FLAG([FFLAGS]) -]) dnl dnl/*D dnl PAC_PROG_F77_NAME_MANGLE - Determine how the Fortran compiler mangles @@ -1453,7 +1441,7 @@ if test "X$pac_cv_prog_f77_mismatched_args" = X ; then # The best solution is to turn off errors on particular routines # if that isn't possible (e.g., too many of them), then # just try arguments that turn off all checking - for flags in ifelse($2,yes,,"-wmismatch=foo1") "-mismatch" ; do + for flags in ifelse($2,yes,,"-wmismatch=foo1") "-mismatch" "-fallow-argument-mismatch" ; do testok=no FFLAGS="$FFLAGS $flags" AC_COMPILE_IFELSE([ diff --git a/3rd-party/romio321/confdb/aclocal_f77old.m4 b/3rd-party/romio341/confdb/aclocal_f77old.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_f77old.m4 rename to 3rd-party/romio341/confdb/aclocal_f77old.m4 diff --git a/3rd-party/romio321/confdb/aclocal_fc.m4 b/3rd-party/romio341/confdb/aclocal_fc.m4 similarity index 94% rename from 3rd-party/romio321/confdb/aclocal_fc.m4 rename to 3rd-party/romio341/confdb/aclocal_fc.m4 index c5e2d1fb0fba3ca7fbe551a6846950d00398e960..93465edaa6bd364de449f3dc8c5a77eb5f0000d2 100644 --- a/3rd-party/romio321/confdb/aclocal_fc.m4 +++ b/3rd-party/romio341/confdb/aclocal_fc.m4 @@ -1,48 +1,3 @@ -dnl PAC_FC_SEARCH_LIST - expands to a whitespace separated list of modern -dnl fortran compilers for use with AC_PROG_FC that is more suitable for HPC -dnl software packages -AC_DEFUN([PAC_FC_SEARCH_LIST], - [ifort pgf90 pathf90 pathf95 xlf90 xlf95 xlf2003 gfortran f90 epcf90 f95 fort lf95 g95 ifc efc gfc]) -dnl /*D -dnl PAC_PROG_FC([COMPILERS]) -dnl -dnl COMPILERS is a space separated list of Fortran 77 compilers to search -dnl for. Fortran 95 isn't strictly backwards-compatible with Fortran 77, -dnl but `f95' is worth trying. -dnl -dnl Compilers are ordered by -dnl 1. F77, F90, F95 -dnl 2. Good/tested native compilers, bad/untested native compilers -dnl 3. Wrappers around f2c go last. -dnl -dnl `fort77' is a wrapper around `f2c'. -dnl It is believed that under HP-UX `fort77' is the name of the native -dnl compiler. On some Cray systems, fort77 is a native compiler. -dnl frt is the Fujitsu F77 compiler. -dnl pgf77 and pgf90 are the Portland Group F77 and F90 compilers. -dnl xlf/xlf90/xlf95/xlf2003 are IBM (AIX) F77/F90/F95/F2003 compilers. -dnl lf95 is the Lahey-Fujitsu compiler. -dnl fl32 is the Microsoft Fortran "PowerStation" compiler. -dnl af77 is the Apogee F77 compiler for Intergraph hardware running CLIX. -dnl epcf90 is the "Edinburgh Portable Compiler" F90. -dnl fort is the Compaq Fortran 90 (now 95) compiler for Tru64 and Linux/Alpha. -dnl pathf90 is the Pathscale Fortran 90 compiler -dnl ifort is another name for the Intel f90 compiler -dnl efc - An older Intel compiler (?) -dnl ifc - An older Intel compiler -dnl fc - A compiler on some unknown system. This has been removed because -dnl it may also be the name of a command for something other than -dnl the Fortran compiler (e.g., fc=file system check!) -dnl gfortran - The GNU Fortran compiler (not the same as g95) -dnl gfc - An alias for gfortran recommended in cygwin installations -dnl NOTE: this macro suffers from a basically intractable "expanded before it -dnl was required" problem when libtool is also used -dnl D*/ -AC_DEFUN([PAC_PROG_FC],[ -PAC_PUSH_FLAG([FCFLAGS]) -AC_PROG_FC([m4_default([$1],[PAC_FC_SEARCH_LIST])]) -PAC_POP_FLAG([FCFLAGS]) -]) dnl dnl PAC_FC_EXT checks for the default Fortran 90 program extension, f90 then f. dnl This could be replaced by AC_FC_SRCEXT but since AC_FC_SRCEXT @@ -1137,6 +1092,11 @@ int foo_c(CFI_cdesc_t * a_desc, CFI_cdesc_t * b_desc) if (a_desc->dim[1].extent != b_desc->dim[0].extent) { return 3; } return 0; } + +void test_assumed_rank_async_impl_c(CFI_cdesc_t * a_desc) +{ + return; +} ]])],[mv conftest.$OBJEXT conftest1.$OBJEXT],[f08_works=no]) AC_LANG_POP([C]) @@ -1171,9 +1131,11 @@ INTERFACE END FUNCTION FOO END INTERFACE + ! Test assumed-rank + asynchronous INTERFACE TEST_ASSUMED_RANK_ASYNC - SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) + SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) & + BIND(C,name="test_assumed_rank_async_impl_c") IMPLICIT NONE TYPE(*), DIMENSION(..), ASYNCHRONOUS :: BUF END SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL diff --git a/3rd-party/romio321/confdb/aclocal_libs.m4 b/3rd-party/romio341/confdb/aclocal_libs.m4 similarity index 86% rename from 3rd-party/romio321/confdb/aclocal_libs.m4 rename to 3rd-party/romio341/confdb/aclocal_libs.m4 index 8868e994cba192d9a1dab4698953906d566f82d3..50d6a8b4cbce540d671440c05d47265fc911dc74 100644 --- a/3rd-party/romio321/confdb/aclocal_libs.m4 +++ b/3rd-party/romio341/confdb/aclocal_libs.m4 @@ -8,13 +8,8 @@ dnl characters in it. Use AS_TR_SH (and possibly AS_VAR_* macros) to handle dnl this case if it ever arises. AC_DEFUN([PAC_SET_HEADER_LIB_PATH],[ AC_ARG_WITH([$1], - [AC_HELP_STRING([--with-$1=PATH], - [specify path where $1 include directory and lib directory can be found])], - - [AS_CASE(["$withval"], - [yes|no|''], - [AC_MSG_WARN([--with[out]-$1=PATH expects a valid PATH]) - with_$1=""])], + [AC_HELP_STRING([--with-$1=[[PATH]]], + [specify path where $1 include directory and lib directory can be found])],, [with_$1=$2]) AC_ARG_WITH([$1-include], [AC_HELP_STRING([--with-$1-include=PATH], @@ -76,6 +71,7 @@ AC_DEFUN([PAC_CHECK_HEADER_LIB],[ dnl PAC_CHECK_HEADER_LIB_FATAL(with_option, header.h, libname, function) dnl Similar to PAC_CHECK_HEADER_LIB, but errors out on failure AC_DEFUN([PAC_CHECK_HEADER_LIB_FATAL],[ + PAC_SET_HEADER_LIB_PATH($1) PAC_CHECK_HEADER_LIB($2,$3,$4,success=yes,success=no) if test "$success" = "no" ; then AC_MSG_ERROR(['$2 or lib$3 library not found. Did you specify --with-$1= or --with-$1-include= or --with-$1-lib=?']) @@ -94,6 +90,8 @@ AC_DEFUN([PAC_CHECK_PREFIX],[ : elif test "$withval" = "embedded" ; then : + elif test "$withval" = "no" ; then + : else PAC_APPEND_FLAG([-I${with_$1_prefix}/include],[CPPFLAGS]) if test -d "${with_$1_prefix}/lib64" ; then @@ -105,3 +103,17 @@ AC_DEFUN([PAC_CHECK_PREFIX],[ [with_$1_prefix="embedded"]) ] ) + +dnl PAC_LIB_DEPS(library_name, library_pc_path) +dnl library_pc_path is the path to the library pkg-config directory +AC_DEFUN([PAC_LIB_DEPS],[ +if test "x$2" != "x"; then + ac_lib$1_deps=`pkg-config --static --libs $2/lib$1.pc 2>/dev/null` + # remove the library itself in case it is embedded + ac_lib$1_deps=`echo $ac_lib$1_deps | sed 's/-l$1//'` +else + # use system default + ac_lib$1_deps=`pkg-config --static --libs lib$1 2>/dev/null` +fi +]) + diff --git a/3rd-party/romio321/confdb/aclocal_make.m4 b/3rd-party/romio341/confdb/aclocal_make.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_make.m4 rename to 3rd-party/romio341/confdb/aclocal_make.m4 diff --git a/3rd-party/romio341/confdb/aclocal_mpi.m4 b/3rd-party/romio341/confdb/aclocal_mpi.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f4d98d57aa06dc0aca12411c5b6d3d537b52ae7c --- /dev/null +++ b/3rd-party/romio341/confdb/aclocal_mpi.m4 @@ -0,0 +1,11 @@ +dnl +dnl/*D +dnl PAC_HAVE_ROMIO - make mpi.h include mpio.h if romio enabled +dnl +dnl Output Effect: +dnl expands @HAVE_ROMIO@ in mpi.h into #include "mpio.h" +dnl D*/ +AC_DEFUN([PAC_HAVE_ROMIO],[ +if test "$enable_romio" = "yes" ; then HAVE_ROMIO='#include "mpio.h"'; fi +AC_SUBST(HAVE_ROMIO) +]) diff --git a/3rd-party/romio321/confdb/aclocal_romio.m4 b/3rd-party/romio341/confdb/aclocal_romio.m4 similarity index 97% rename from 3rd-party/romio321/confdb/aclocal_romio.m4 rename to 3rd-party/romio341/confdb/aclocal_romio.m4 index af80d3c102463813f3541129ed4dc3e36d3ae877..802e2855eea806e226433335f7ce2980fe5f8281 100644 --- a/3rd-party/romio321/confdb/aclocal_romio.m4 +++ b/3rd-party/romio341/confdb/aclocal_romio.m4 @@ -579,7 +579,7 @@ if test -z "$FC" ; then FC=f90 fi KINDVAL="" -if $FC -o conftest$EXEEXT conftest.$ac_f90ext >/dev/null 2>&1 ; then +if $FC -o conftest$EXEEXT conftest.$ac_f90ext $FCFLAGS >/dev/null 2>&1 ; then ./conftest$EXEEXT >/dev/null 2>&1 if test -s conftest.out ; then KINDVAL=`cat conftest.out` @@ -702,7 +702,7 @@ if test -z "$FC" ; then FC=f90 fi KINDVAL="" -if $FC -o kind$EXEEXT kind.f >/dev/null 2>&1 ; then +if $FC -o kind$EXEEXT kind.f $FCFLAGS >/dev/null 2>&1 ; then ./kind >/dev/null 2>&1 if test -s k.out ; then KINDVAL=`cat k.out` @@ -786,28 +786,6 @@ EOF fi rm -f conftest$EXEEXT mpitest.c ])dnl -define(PAC_TEST_MPIU_FUNCS,[ - AC_MSG_CHECKING(support for MPICH memory macros) - rm -f mpitest.c - cat > mpitest.c <<EOF -#include "mpi.h" -#include "stdio.h" - main(Int argc, char **argv) - { - MPIU_Free(NULL); - } -EOF - rm -f conftest$EXEEXT - $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 - if test -x conftest$EXEEXT ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH memory tracing macros defined]) - else - AC_MSG_RESULT(no) - fi - rm -f conftest$EXEEXT mpitest.c -])dnl -dnl define(PAC_TEST_MPI_GREQUEST,[ AC_MSG_CHECKING(support for generalized requests) rm -f mpitest.c diff --git a/3rd-party/romio321/confdb/aclocal_runlog.m4 b/3rd-party/romio341/confdb/aclocal_runlog.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_runlog.m4 rename to 3rd-party/romio341/confdb/aclocal_runlog.m4 diff --git a/3rd-party/romio321/confdb/aclocal_shl.m4 b/3rd-party/romio341/confdb/aclocal_shl.m4 similarity index 98% rename from 3rd-party/romio321/confdb/aclocal_shl.m4 rename to 3rd-party/romio341/confdb/aclocal_shl.m4 index f974bfa22612a2be5872cc8bc36846997af81698..9997fe54a1b61a8061414596b265d95c90bbe07f 100644 --- a/3rd-party/romio321/confdb/aclocal_shl.m4 +++ b/3rd-party/romio341/confdb/aclocal_shl.m4 @@ -378,11 +378,11 @@ AC_DEFUN([PAC_CC_SUBDIR_SHLIBS],[ if test -z "$LIBTOOL" ; then AC_MSG_WARN([libtool selected for shared library support but LIBTOOL is not defined]) fi - # Libtool needs master_top_builddir - if test "X$master_top_builddir" = "X" ; then - AC_MSG_ERROR([Libtool requires master_top_builddir - check configure.ac sources]) + # Libtool needs main_top_builddir + if test "X$main_top_builddir" = "X" ; then + AC_MSG_ERROR([Libtool requires main_top_builddir - check configure.ac sources]) fi - AC_SUBST(master_top_builddir) + AC_SUBST(main_top_builddir) fi ]) @@ -497,4 +497,3 @@ PAC_POP_FLAG([CC]) AC_MSG_RESULT([done (results in $2)]) ]) - diff --git a/3rd-party/romio321/confdb/aclocal_shm.m4 b/3rd-party/romio341/confdb/aclocal_shm.m4 similarity index 85% rename from 3rd-party/romio321/confdb/aclocal_shm.m4 rename to 3rd-party/romio341/confdb/aclocal_shm.m4 index d2cbaade434a7bdc8d68a3c844b15771fb0fbe6b..8560b4efcd0eab53a09e28b37a6ba65fd14a0d5b 100644 --- a/3rd-party/romio321/confdb/aclocal_shm.m4 +++ b/3rd-party/romio341/confdb/aclocal_shm.m4 @@ -46,4 +46,11 @@ if test "$with_shared_memory" = auto -o "$with_shared_memory" = sysv; then AC_MSG_ERROR([cannot support shared memory: sysv shared memory functions functions not found]) fi fi +if test "$with_shared_memory" = nt ; then + AC_DEFINE(USE_NT_SHM,1,[Define if use Windows shared memory]) +fi + +if test "$with_shared_memory" = "auto" ; then + AC_MSG_ERROR([cannot support shared memory: need either sysv shared memory functions or mmap in order to support shared memory]) +fi ]) diff --git a/3rd-party/romio321/confdb/aclocal_subcfg.m4 b/3rd-party/romio341/confdb/aclocal_subcfg.m4 similarity index 99% rename from 3rd-party/romio321/confdb/aclocal_subcfg.m4 rename to 3rd-party/romio341/confdb/aclocal_subcfg.m4 index 53fb78e3d9ebf7ada803f359795b1363e0fa492b..fbd1899f4ddcfff8ae074818cf0996a46042f649 100644 --- a/3rd-party/romio321/confdb/aclocal_subcfg.m4 +++ b/3rd-party/romio341/confdb/aclocal_subcfg.m4 @@ -258,4 +258,3 @@ dnl dnl This is useful for reducing copy-paste errors when defining PREREQ and BODY dnl macros. If you tinker with this macro, watch the quoting carefully. AC_DEFUN([PAC_SUBCFG_AUTO_SUFFIX],[m4_translit(m4_bpatsubst(m4_dquote(__file__),[/[^/]+.m4],[]),[/],[_])]) - diff --git a/3rd-party/romio341/confdb/aclocal_threads.m4 b/3rd-party/romio341/confdb/aclocal_threads.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a506dc18e5080d0d20a625d44c6a5ed836c7b583 --- /dev/null +++ b/3rd-party/romio341/confdb/aclocal_threads.m4 @@ -0,0 +1,22 @@ +dnl PAC_ARG_THREAD_PACKAGE +dnl - Provide configure option to select a thread package. Defaults to posix. +AC_DEFUN([PAC_ARG_THREAD_PACKAGE], [ + AC_ARG_WITH([thread-package], + [ --with-thread-package=package Thread package to use. Supported thread packages include: + posix or pthreads - POSIX threads (default, if required) + solaris - Solaris threads (Solaris OS only) + abt or argobots - Argobots threads + win - windows threads + uti - POSIX threads plus Utility Thread Offloading library + none - no threads + ],,with_thread_package=posix)]) + +dnl PAC_ARG_POSIX_MUTEX +dnl - Provide configure option to select alternate mutex when posix thread package used. Defaults is to use +dnl pthread mutex. +AC_DEFUN([PAC_ARG_POSIX_MUTEX], [ + AC_ARG_WITH([posix-mutex], + [ --with-posix-mutex=option Posix thread mutex to use. Supported options include: + native - pthread mutex (default) + ticketlock - use ticketlock, a fair lock based on atomics and busyloop + ],,with_posix_mutex=native)]) diff --git a/3rd-party/romio321/confdb/aclocal_util.m4 b/3rd-party/romio341/confdb/aclocal_util.m4 similarity index 100% rename from 3rd-party/romio321/confdb/aclocal_util.m4 rename to 3rd-party/romio341/confdb/aclocal_util.m4 diff --git a/3rd-party/romio341/confdb/ax_check_posix_regcomp.m4 b/3rd-party/romio341/confdb/ax_check_posix_regcomp.m4 new file mode 100644 index 0000000000000000000000000000000000000000..e5ba61ce2d928f8bc7f90f009b8356b030a89f96 --- /dev/null +++ b/3rd-party/romio341/confdb/ax_check_posix_regcomp.m4 @@ -0,0 +1,48 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_posix_regcomp.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_POSIX_REGCOMP +# +# DESCRIPTION +# +# Check that the POSIX compliant regular expression compiler is available +# in the POSIX specified manner, and it works. If it fails, we have a +# backup -- use gnu-regex. +# +# LICENSE +# +# Copyright (c) 2008 Bruce Korb <bkorb@gnu.org> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AG_CHECK_POSIX_REGCOMP], [AX_CHECK_POSIX_REGCOMP]) +AC_DEFUN([AX_CHECK_POSIX_REGCOMP],[ + AC_MSG_CHECKING([whether POSIX compliant regcomp()/regexec()]) + AC_CACHE_VAL([ax_cv_posix_regcomp],[ + AC_TRY_RUN([ +#include <sys/types.h> +#include <regex.h> +int main() { + int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE; + regex_t re; + if (regcomp( &re, "^.*$", flags ) != 0) + return 1; + return regcomp( &re, "yes.*|no.*", flags ); +}], + [ax_cv_posix_regcomp=yes],[ax_cv_posix_regcomp=no],[ax_cv_posix_regcomp=no] + ) # end of TRY_RUN]) # end of CACHE_VAL + + AC_MSG_RESULT([$ax_cv_posix_regcomp]) + if test "$ax_cv_posix_regcomp" = "yes"; then + AC_DEFINE(HAVE_POSIX_REGCOMP, 1, + [Define this if POSIX compliant regcomp()/regexec()]) + fi +]) # end of AC_DEFUN of AX_CHECK_POSIX_REGCOMP diff --git a/3rd-party/romio341/confdb/ax_execinfo.m4 b/3rd-party/romio341/confdb/ax_execinfo.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0ff5fc0ee9b0b7e8a088cb933a87ec19f224ac19 --- /dev/null +++ b/3rd-party/romio341/confdb/ax_execinfo.m4 @@ -0,0 +1,67 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_execinfo.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_EXECINFO([ACTION-IF-EXECINFO-H-IS-FOUND], [ACTION-IF-EXECINFO-H-IS-NOT-FOUND], [ADDITIONAL-TYPES-LIST]) +# +# DESCRIPTION +# +# Checks for execinfo.h header and if the len parameter/return type can be +# found from a list, also define backtrace_size_t to that type. +# +# By default the list of types to try contains int and size_t, but should +# some yet undiscovered system use e.g. unsigned, the 3rd argument can be +# used for extensions. I'd like to hear of further suggestions. +# +# Executes ACTION-IF-EXECINFO-H-IS-FOUND when present and the execinfo.h +# header is found or ACTION-IF-EXECINFO-H-IS-NOT-FOUND in case the header +# seems unavailable. +# +# Also adds -lexecinfo to LIBS on BSD if needed. +# +# LICENSE +# +# Copyright (c) 2014 Thomas Jahns <jahns@dkrz.de> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_EXECINFO], + [AC_CHECK_HEADERS([execinfo.h]) + AS_IF([test x"$ac_cv_header_execinfo_h" = xyes], + [AC_CACHE_CHECK([size parameter type for backtrace()], + [ax_cv_proto_backtrace_type], + [AC_LANG_PUSH([C]) + for ax_cv_proto_backtrace_type in size_t int m4_ifnblank([$3],[$3 ])none; do + AS_IF([test "${ax_cv_proto_backtrace_type}" = none], + [ax_cv_proto_backtrace_type= ; break]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +#include <execinfo.h> +extern +${ax_cv_proto_backtrace_type} backtrace(void **addrlist, ${ax_cv_proto_backtrace_type} len); +char **backtrace_symbols(void *const *buffer, ${ax_cv_proto_backtrace_type} size); +])], + [break]) + done + AC_LANG_POP([C])])]) + AS_IF([test x${ax_cv_proto_backtrace_type} != x], + [AC_DEFINE_UNQUOTED([backtrace_size_t], [$ax_cv_proto_backtrace_type], + [Defined to return type of backtrace().])]) + AC_SEARCH_LIBS([backtrace],[execinfo]) + AS_IF([test x"${ax_cv_proto_backtrace_type}" != x -a x"$ac_cv_header_execinfo_h" = xyes -a x"$ac_cv_search_backtrace" != xno], + [AC_DEFINE([HAVE_BACKTRACE],[1], + [Defined if backtrace() could be fully identified.]) + ]m4_ifnblank([$1],[$1 +]),m4_ifnblank([$2],[$2 +]))]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: +dnl diff --git a/3rd-party/romio341/confdb/ax_gcc_func_attribute.m4 b/3rd-party/romio341/confdb/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000000000000000000000000000000000000..098c9aadff6c9733249015bec3449f9b24616663 --- /dev/null +++ b/3rd-party/romio341/confdb/ax_gcc_func_attribute.m4 @@ -0,0 +1,238 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>. +# +# The macro caches its result in the ax_cv_have_func_attribute_<attribute> +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/3rd-party/romio341/confdb/ax_gcc_var_attribute.m4 b/3rd-party/romio341/confdb/ax_gcc_var_attribute.m4 new file mode 100644 index 0000000000000000000000000000000000000000..47635d467e8171f6b75af1aa61562763d96969fe --- /dev/null +++ b/3rd-party/romio341/confdb/ax_gcc_var_attribute.m4 @@ -0,0 +1,141 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_var_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_VAR_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's variable +# attributes; many other compilers also provide variable attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_VAR_ATTRIBUTE_<ATTRIBUTE>. +# +# The macro caches its result in the ax_cv_have_var_attribute_<attribute> +# variable. +# +# The macro currently supports the following variable attributes: +# +# aligned +# cleanup +# common +# nocommon +# deprecated +# mode +# packed +# tls_model +# unused +# used +# vector_size +# weak +# dllimport +# dllexport +# init_priority +# +# Unsupported variable attributes will be tested against a global integer +# variable and without any arguments given to the attribute itself; the +# result of this check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AC_DEFUN([AX_GCC_VAR_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_var_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [aligned], [ + int foo __attribute__(($1(32))); + ], + [cleanup], [ + int bar(int *t) { return *t; }; + ], + [common], [ + int foo __attribute__(($1)); + ], + [nocommon], [ + int foo __attribute__(($1)); + ], + [deprecated], [ + int foo __attribute__(($1)) = 0; + ], + [mode], [ + long foo __attribute__(($1(word))); + ], + [packed], [ + struct bar { + int baz __attribute__(($1)); + }; + ], + [tls_model], [ + __thread int bar1 __attribute__(($1("global-dynamic"))); + __thread int bar2 __attribute__(($1("local-dynamic"))); + __thread int bar3 __attribute__(($1("initial-exec"))); + __thread int bar4 __attribute__(($1("local-exec"))); + ], + [unused], [ + int foo __attribute__(($1)); + ], + [used], [ + int foo __attribute__(($1)); + ], + [vector_size], [ + int foo __attribute__(($1(16))); + ], + [weak], [ + int foo __attribute__(($1)); + ], + [dllimport], [ + int foo __attribute__(($1)); + ], + [dllexport], [ + int foo __attribute__(($1)); + ], + [init_priority], [ + struct bar { bar() {} ~bar() {} }; + bar b __attribute__(($1(65535/2))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo __attribute__(($1)); + ] + )], [ + m4_case([$1], + [cleanup], [ + int foo __attribute__(($1(bar))) = 0; + foo = foo + 1; + ], + [] + )]) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_VAR_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' variable attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/3rd-party/romio341/confdb/ax_lib_socket_nsl.m4 b/3rd-party/romio341/confdb/ax_lib_socket_nsl.m4 new file mode 100644 index 0000000000000000000000000000000000000000..54cad68b4c8cd8faec8f672c5b801225a5558509 --- /dev/null +++ b/3rd-party/romio341/confdb/ax_lib_socket_nsl.m4 @@ -0,0 +1,40 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_SOCKET_NSL +# +# DESCRIPTION +# +# This macro figures out what libraries are required on this platform to +# link sockets programs. +# +# The common cases are not to need any extra libraries, or to need +# -lsocket and -lnsl. We need to avoid linking with libnsl unless we need +# it, though, since on some OSes where it isn't necessary it will totally +# break networking. Unisys also includes gethostbyname() in libsocket but +# needs libnsl for socket(). +# +# LICENSE +# +# Copyright (c) 2008 Russ Allbery <rra@stanford.edu> +# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz> +# Copyright (c) 2008 Warren Young <warren@etr-usa.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL]) +AC_DEFUN([AX_LIB_SOCKET_NSL], +[ + AC_SEARCH_LIBS([gethostbyname], [nsl]) + AC_SEARCH_LIBS([socket], [socket], [], [ + AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], + [], [-lnsl])]) +]) diff --git a/3rd-party/romio341/confdb/cmd_prefix_config_h.pl b/3rd-party/romio341/confdb/cmd_prefix_config_h.pl new file mode 100644 index 0000000000000000000000000000000000000000..a7368b396ed5b55362b95627a80b43209f6ce1db --- /dev/null +++ b/3rd-party/romio341/confdb/cmd_prefix_config_h.pl @@ -0,0 +1,72 @@ +#! /usr/bin/env perl +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +use strict; + +# This script is to be run by AC_CONFIG_COMMANDS in configure.ac. +# USAGE: +# AC_CONFIG_COMMANDS([prefix-config],[perl cmd_prefix_config_h.pl PREFIX input_config.h output_config.h]) +# +# The script will read "input_config.h", and write "output_config.h", adding prefix to every defined macros. This script is a replacement to AX_PREFIX_CONFIG_H. + +sub add_prefix { + my ($name, $prefix) = @_; + if($name=~/^(inline|const|restrict)/){ + # leave c99 keywords alone + } + elsif($name=~/^_/){ + # leave underscore keywords alone, e.g _MINIX + } + elsif($name=~/^$prefix\_/i){ + # avoid double prefix + } + elsif($name=~/^[A-Z0-9_]+$/){ + $name = uc($prefix)."_$name"; + } + else{ + $name = "_".lc($prefix)."_$name"; + } + return $name; +} + +my ($prefix, $config_in, $config_out)=@ARGV; +if(!$prefix){ + die "missing prefix!\n"; +} +if(!$config_in){ + $config_in = "config.h"; +} +if(!$config_out){ + $config_out = $config_in; +} +my @lines; +open In, "$config_in" or die "Can't open $config_in.\n"; +while(<In>){ + if(/^#define\s+(\w+)\s*(.+)/){ + my $name = add_prefix($1, $prefix); + push @lines, "#ifndef $name\n"; + push @lines, "#define $name $2\n"; + push @lines, "#endif\n"; + next; + } + elsif(/^\/\*\s*#undef (\w+)/){ + my $name = add_prefix($1, $prefix); + push @lines, "/* #undef $name */\n"; + next; + } + push @lines, $_; +} +close In; +my $DEFH=uc($config_out); +$DEFH=~s/\W/_/g; +open Out, ">$config_out" or die "Can't write $config_out.\n"; +print Out "#ifndef $DEFH\n"; +print Out "#define $DEFH 1\n\n"; +print Out "\x2f* $config_out. Generated automatically at end of configure. *\x2f\n"; +print Out @lines; +print Out "\x2f* once: $DEFH *\x2f\n"; +print Out "#endif\n"; +close Out; diff --git a/3rd-party/romio341/confdb/config.rpath b/3rd-party/romio341/confdb/config.rpath new file mode 100755 index 0000000000000000000000000000000000000000..1effeeecc2aaa6a6a5ae27757318e0e64e0bef44 --- /dev/null +++ b/3rd-party/romio341/confdb/config.rpath @@ -0,0 +1,719 @@ +#! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +# +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2011 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl* | *bgq-linux-xl* ) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-4]]*) + wl= + ;; + *Sun\ F* | *Sun*Fortran* | *Studio*Fortran*) + wl='-Qoption ld ' + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +enable_dtags_flag= +disable_dtags_flag= + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + # use --enable-new-dtags for RUNPATH support, which is required for + # switching between ABI compatible libraries at runtime. + if test "$GCC" = yes; then + enable_dtags_flag="${wl}--enable-new-dtags" + disable_dtags_flag="${wl}--disable-new-dtags" + else + case $cc_basename in ifort*) + enable_dtags_flag="${wl}--enable-new-dtags" + disable_dtags_flag="${wl}--disable-new-dtags" + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +# MPICH modification: we don't prefix with acl_cv_ by default. This +# is causing problems in the stock version of config.rpath as well. +# LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/\1=/' <<EOF + +# How to pass a linker flag through the compiler. +wl="$escaped_wl" + +# Static library suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally "so"). +shlibext="$shlibext" + +# Format of library name prefix. +libname_spec="$escaped_libname_spec" + +# Library names that the linker finds when passed -lNAME. +library_names_spec="$escaped_library_names_spec" + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" + +# Flag to add dtags to allow using runpath instead of rpath +enable_dtags_flag="$enable_dtags_flag" +disable_dtags_flag="$disable_dtags_flag" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="$hardcode_libdir_separator" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct="$hardcode_direct" + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L="$hardcode_minus_L" + +EOF diff --git a/3rd-party/romio341/confdb/random_r.m4 b/3rd-party/romio341/confdb/random_r.m4 new file mode 100644 index 0000000000000000000000000000000000000000..8d04a27fc37d9cf1a0a415306edf6d4bf52f9391 --- /dev/null +++ b/3rd-party/romio341/confdb/random_r.m4 @@ -0,0 +1,43 @@ +# serial 5 +dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_RANDOM_R], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) + if test $ac_cv_header_random_h = no; then + HAVE_RANDOM_H=0 + fi + + AC_CHECK_TYPES([struct random_data], + [], [HAVE_STRUCT_RANDOM_DATA=0], + [[#include <stdlib.h> + #if HAVE_RANDOM_H + # include <random.h> + #endif + ]]) + + dnl On AIX and OSF/1, these functions exist, but with different declarations. + dnl Override them all. + case "$host_os" in + aix* | osf*) + REPLACE_RANDOM_R=1 + ;; + *) + AC_CHECK_FUNCS([random_r]) + if test $ac_cv_func_random_r = no; then + HAVE_RANDOM_R=0 + fi + ;; + esac +]) + +# Prerequisites of lib/random_r.c. +AC_DEFUN([gl_PREREQ_RANDOM_R], [ + : +]) diff --git a/3rd-party/romio341/confdb/stdlib_h.m4 b/3rd-party/romio341/confdb/stdlib_h.m4 new file mode 100644 index 0000000000000000000000000000000000000000..19107c4199631631d193f34b5d69eff5548360a6 --- /dev/null +++ b/3rd-party/romio341/confdb/stdlib_h.m4 @@ -0,0 +1,119 @@ +# stdlib_h.m4 serial 42 +dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDLIB_H], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_NEXT_HEADERS([stdlib.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> +#if HAVE_SYS_LOADAVG_H +# include <sys/loadavg.h> +#endif +#if HAVE_RANDOM_H +# include <random.h> +#endif + ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt + initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps + posix_openpt ptsname ptsname_r random random_r realpath rpmatch + secure_getenv setenv setstate setstate_r srandom srandom_r + strtod strtoll strtoull unlockpt unsetenv]) +]) + +AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_STDLIB_H_DEFAULTS], +[ + GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) + GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) + GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) + GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) + GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) + GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) + GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) + GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) + GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) + GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) + GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) + GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) + GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) + GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) + HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) + HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) + HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) + HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) + HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) + HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) + HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) + HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) + HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) + HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) + HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) + HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) + HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) + HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) + HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) + HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) + HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) + HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) + HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) + REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) + REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) + REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) + REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) + REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) + REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) + REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) + REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) + REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) + REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) +]) diff --git a/3rd-party/romio321/configure.ac b/3rd-party/romio341/configure.ac similarity index 86% rename from 3rd-party/romio321/configure.ac rename to 3rd-party/romio341/configure.ac index 20298739d8a79e0f8025ddf211879fa1885ea35e..b0dad8f5a062c434b33a3b1d25d8e42364a08208 100644 --- a/3rd-party/romio321/configure.ac +++ b/3rd-party/romio341/configure.ac @@ -1,4 +1,8 @@ -# -*- Mode: shell-script -*- +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + # build with # autoconf --localdir=../confdb configure.ac # (or wherever the confdb is) @@ -35,8 +39,13 @@ AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability-recursive foreign 1.12 silent-r AM_MAINTAINER_MODE([enable]) dnl must come before LT_INIT, which AC_REQUIREs AC_PROG_CC -PAC_PROG_CC +AC_PROG_CC +AC_PROG_CC_C99 AM_PROG_CC_C_O +PAC_CHECK_VISIBILITY +AC_SUBST(VISIBILITY_CFLAGS) + +AC_USE_SYSTEM_EXTENSIONS AM_PROG_AR @@ -48,17 +57,18 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # AC_MSG_RESULT([Configuring ROMIO Version $VERSION]) CONFIGURE_ARGS="$*" if test -n "$CONFIGURE_ARGS" ; then - echo "Configuring with args $CONFIGURE_ARGS" + AC_MSG_NOTICE([Configuring with args $CONFIGURE_ARGS]) fi AC_CONFIG_HEADER(adio/include/romioconf.h) # Open MPI: modified AH_TOP AH_TOP([/* - * (C) 2011 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #ifndef ROMIOCONF_H_INCLUDED #define ROMIOCONF_H_INCLUDED +#include <mplconfig.h> #include "romioconf-undefs.h" ]) @@ -135,6 +145,50 @@ AC_ARG_VAR([FROM_OMPI],[set to "yes" if building ROMIO inside of Open MPI]) FROM_OMPI=${FROM_OMPI:-no} if test "$FROM_OMPI" = 1 ; then FROM_OMPI=yes ; fi +# MPL +AC_ARG_VAR([MPLLIBNAME],[can be used to override the name of the MPL library (default: "mpl")]) +MPLLIBNAME=${MPLLIBNAME:-"mpl"} +export MPLLIBNAME +AC_SUBST(MPLLIBNAME) +AC_ARG_WITH([mpl-prefix], + [AS_HELP_STRING([[--with-mpl-prefix[=DIR]]], + [use the MPL library installed in DIR. Pass + "embedded" to force usage of the MPL source + distributed with Hydra.])], + [],dnl action-if-given + [with_mpl_prefix=embedded]) dnl action-if-not-given +mpl_srcdir="" +AC_SUBST([mpl_srcdir]) +# Controls whether we recurse into the MPL dir when running "dist" rules like +# "make distclean". Technically we are cheating whenever DIST_SUBDIRS is not a +# superset of SUBDIRS, but we don't want to double-distclean and similar. +mpl_dist_srcdir="" +AC_SUBST(mpl_dist_srcdir) +mpl_includedir="" +AC_SUBST([mpl_includedir]) +mpl_libdir="" +AC_SUBST([mpl_libdir]) +mpl_lib="" +AC_SUBST([mpl_lib]) +if test "$FROM_MPICH" = "no" ; then +if test "$with_mpl_prefix" = "embedded" ; then + mpl_srcdir="mpl" + mpl_dist_srcdir="mpl" + mpl_subdir_args="--disable-versioning --enable-embedded" + PAC_CONFIG_SUBDIR_ARGS([mpl],[$mpl_subdir_args],[],[AC_MSG_ERROR(MPL configure failed)]) + mpl_includedir='-I$(top_builddir)/mpl/include -I$(top_srcdir)/mpl/include' + mpl_lib="mpl/lib${MPLLIBNAME}.la" +else + # The user specified an already-installed MPL; just sanity check, don't + # subconfigure it + AS_IF([test -s "${with_mpl_prefix}/include/mplconfig.h"], + [:],[AC_MSG_ERROR([the MPL installation in "${with_mpl_prefix}" appears broken])]) + mpl_includedir="-I${with_mpl_prefix}/include" + mpl_libdir="-L${with_mpl_prefix}/lib" + mpl_lib="-l${MPLLIBNAME}" +fi +fi + AC_ARG_VAR([FROM_OMPI],[set to "yes" if building ROMIO inside of Open MPI]) FROM_OMPI=${FROM_OMPI:-no} if test "$FROM_OMPI" = 1 ; then FROM_OMPI=yes ; fi @@ -170,7 +224,6 @@ FORTRAN_TEST="" F77GETARG="call getarg(i,str)" F77IARGC="iargc()" F77MPIOINC="" -FTESTDEFINE="" FORTRAN_MPI_OFFSET="" MPIOF_H_INCLUDED=0 MPI_OFFSET_KIND1="!" @@ -196,7 +249,7 @@ dnl An m4 macro for use with m4_foreach_w and friends. You should modify this dnl list if you want to add a known file system. The list is just whitespace dnl separated, so you can use newlines and tabs as well. m4_define([known_filesystems_m4_w], - [nfs ufs pfs pvfs pvfs2 testfs xfs panfs gridftp lustre gpfs zoidfs hfs piofs sfs])dnl + [daos nfs ufs pvfs2 testfs xfs panfs lustre gpfs ime quobytefs])dnl dnl dnl An m4 macro for use with m4_foreach and friends. Expands to a quoted list of dnl quoted elements. A bit easier to use without unintended expansion than the @@ -212,14 +265,14 @@ known_filesystems="m4_join([ ],known_filesystems_m4)" # Defaults AC_ARG_ENABLE(aio,[ --enable-aio - Request use of asynchronous I/O routines (default)], -[ +[ if test "x$enableval" = "xno" ; then disable_aio=yes else disable_aio=no fi ], disable_aio=no) -AC_ARG_ENABLE(echo, +AC_ARG_ENABLE(echo, [--enable-echo - Turn on strong echoing. The default is enable=no.] ,set -x) AC_ARG_ENABLE(f77, [--enable-f77 - Turn on support for Fortran 77 (default)],,enable_f77=yes) @@ -273,9 +326,9 @@ if test -z "$ARCH" -a -x $srcdir/util/tarch ; then ARCH=`$srcdir/util/tarch | sed s/-/_/g` if test -z "$ARCH" ; then AC_MSG_RESULT([Unknown!]) - AC_MSG_ERROR([Error: Could not guess target architecture, you must -set an architecture type with the environment variable ARCH]) - fi + AC_MSG_ERROR([Error: Could not guess target architecture, you must +set an architecture type with the environment variable ARCH]) + fi eval "arch_$ARCH=1" AC_MSG_RESULT($ARCH) fi @@ -290,7 +343,7 @@ fi # # # Find the home directory if not specified -if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then +if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then ROMIO_HOME_TRIAL=$srcdir else # Take advantage of autoconf2 features @@ -326,7 +379,7 @@ AC_SUBST(mandir) if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi AC_SUBST(docdir) if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi -AC_SUBST(htmldir) +AC_SUBST(htmldir) # If we are building within a known MPI implementation, we must avoid the @@ -374,7 +427,7 @@ if test $WITHIN_KNOWN_MPI_IMPL = no ; then # compile command. Some compilers complain if it's only -I MPI_INCLUDE_DIR=. fi -else +else MPI_INCLUDE_DIR=. fi # @@ -396,22 +449,22 @@ else USER_FFLAGS="$FFLAGS -O" fi # -# Here begin the architecture-specific tests. +# Here begin the architecture-specific tests. # -------------------------------------------------------------------------- -# We must first select the C and Fortran compilers. Because of the +# We must first select the C and Fortran compilers. Because of the # way that the PROG_CC autoconf macro works (and all of the macros that # require it, including CHECK_HEADERS), that macro must occur exactly -# once in the configure.ac file, at least as of autoconf 2.57 . +# once in the configure.ac file, at least as of autoconf 2.57 . # Unfortunately, this requirement is not enforced. To handle this, # we first case on the architecture; then use PROG_CC, then case on the # architecture again for any arch-specific features. We also set the # C_DEBUG_FLAG and F77_DEBUG_FLAG in case debugging is selected. -# +# # For the MPICH and MPICH configures, the compilers will already be # selected, so most of the compiler-selection code will be bypassed. # -------------------------------------------------------------------------- # For historical reasons -if test -z "$FC" ; then +if test -z "$FC" ; then FC=$F77 fi # @@ -466,11 +519,11 @@ PAC_GET_SPECIAL_SYSTEM_INFO AC_HAVE_FUNCS(memalign) # -# Question: Should ROMIO under MPICH ignore the Fortran tests, since +# Question: Should ROMIO under MPICH ignore the Fortran tests, since # MPICH provides all of the Fortran interface routines? # if test $NOF77 = 0 ; then - echo "checking Fortran external names" + AC_MSG_NOTICE([checking Fortran external names]) PAC_GET_FORTNAMES if test -n "$WDEF" ; then CFLAGS="$CFLAGS $WDEF" @@ -482,7 +535,7 @@ if test $NOF77 = 0 ; then if test ! -d test ; then mkdir test ; fi ln -s $MPI_INCLUDE_DIR/mpif.h test fi -else +else F77=":" fi # @@ -496,7 +549,7 @@ AC_TYPE_OFF_T # Header files # Find the CPP before the header check AC_PROG_CPP -AC_CHECK_HEADERS([unistd.h fcntl.h malloc.h stddef.h sys/types.h limits.h time.h]) +AC_CHECK_HEADERS([unistd.h fcntl.h malloc.h stddef.h sys/types.h limits.h time.h dirent.h]) AC_CHECK_HEADERS(mpix.h,,,[#include <mpi.h>]) # @@ -556,7 +609,7 @@ if test "$ac_cv_sizeof_long_long" != 0 ; then MPI_OFFSET_KIND1="!" MPI_OFFSET_KIND2="!" else - echo "defining MPI_Offset as long in C and integer in Fortran" + AC_MSG_NOTICE([defining MPI_Offset as long in C and integer in Fortran]) MPI_OFFSET_TYPE="long" DEFINE_MPI_OFFSET="typedef long MPI_Offset;" FORTRAN_MPI_OFFSET="integer" @@ -565,7 +618,7 @@ if test "$ac_cv_sizeof_long_long" != 0 ; then MPI_OFFSET_KIND2="!" fi else - echo "defining MPI_Offset as long in C and integer in Fortran" + AC_MSG_NOTICE([defining MPI_Offset as long in C and integer in Fortran]) MPI_OFFSET_TYPE="long" DEFINE_MPI_OFFSET="typedef long MPI_Offset;" FORTRAN_MPI_OFFSET="integer" @@ -584,7 +637,7 @@ if test -n "$ac_cv_sizeof_long_long"; then fi fi # -if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then +if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)" MPI_OFFSET_KIND_VAL=$OFFSET_KIND @@ -649,7 +702,7 @@ else MPI_FINFO2="!" MPI_FINFO3="!" MPI_FINFO4="!" -fi +fi # if test -n "$mpi_sgi"; then dnl if test -z "$HAVE_MPI_INFO" ; then @@ -660,8 +713,8 @@ dnl fi PAC_TEST_MPI_HAVE_OFFSET_KIND fi # -# check if darray and subarray constructors are defined in the MPI -# implementation +# check if darray and subarray constructors are defined in the MPI +# implementation if test $WITHIN_KNOWN_MPI_IMPL = no ; then PAC_MPI_DARRAY_SUBARRAY fi @@ -679,7 +732,7 @@ if test $FROM_MPICH = yes ; then MPI_FARRAY5="!" MPI_FARRAY6="!" MPI_FARRAY7="!" -fi +fi # Check to see if weak symbols work correctly if test "$enable_weak_symbols" = "yes" ; then @@ -713,6 +766,11 @@ AM_CONDITIONAL([BUILD_MPIO_ERRHAN],[false]) # Open MPI: Disable the profile library #AM_CONDITIONAL([BUILD_PROFILING_LIB],[test "x$HAVE_WEAK_SYMBOLS" = "x0"]) AM_CONDITIONAL([BUILD_PROFILING_LIB],[false]) +# disable visibility if building profiling library +if test "x$HAVE_WEAK_SYMBOLS" = "x0" ; then + VISIBILITY_CFLAGS="" +fi + # weird: we have conflated "buid ROMIO's versions of the fortran bindings" and # "build ROMIO"s fortran I/O tests". Of course the common situaiton is that we @@ -728,18 +786,18 @@ AC_MSG_CHECKING([whether struct flock compatible with MPI_Offset]) AC_TRY_COMPILE([#include <fcntl.h>], [struct flock l; $MPI_OFFSET_TYPE a=1; - l.l_start = a; + l.l_start = a; l.l_len = a; ],pac_cv_struct_flock_and_mpi_offset=yes,pac_cv_struct_flock_and_mpi_offset=no) AC_MSG_RESULT($pac_cv_struct_flock_and_mpi_offset) # FIXME: We should look for struct flock64 and the F_SETLK64/F_GETLK64 -# ADIOI_Set_lock could use these instead. +# ADIOI_GEN_SetLock. could use these instead. if test "$pac_cv_struct_flock_and_mpi_offset" = no ; then AC_MSG_CHECKING([whether struct flock compatible with int]) AC_TRY_COMPILE([#include <fcntl.h>], [struct flock l; int a=1; - l.l_start = a; + l.l_start = a; l.l_len = a; ],pac_cv_struct_flock_and_int=yes,pac_cv_struct_flock_and_int=no) AC_MSG_RESULT($pac_cv_struct_flock_and_int) @@ -765,15 +823,15 @@ if test -n "$FILE_SYSTEM" ; then # if multiple filesystems are passed in, they are '+'-delimited # we could set the IFS to tokenize FILE_SYSTEM, but the FILE_SYSTEM env var # is used in multiple places in the build system: get rid of the '+'s so we - # can use the 'for x in $FILE_SYSTEM ...' idiom - FILE_SYSTEM=`echo $FILE_SYSTEM|sed -e 's/\+/ /g'` + # can use the 'for x in $FILE_SYSTEM ...' idiom + FILE_SYSTEM=`echo $FILE_SYSTEM|tr '+' ' '` for x in $FILE_SYSTEM do found=no # We could also do test -d "ad_$y" to test for known file systems - # based on having access to the adio code. Then adding a file + # based on having access to the adio code. Then adding a file # system would not require changing configure to change known_filesystems - for y in $known_filesystems ; do + for y in $known_filesystems ; do if test $x = $y ; then found=yes eval "file_system_`echo $x`=1" @@ -786,6 +844,44 @@ if test -n "$FILE_SYSTEM" ; then done fi +AC_ARG_WITH([cart], + [AS_HELP_STRING([--with-cart], + [Build DAOS ROMIO driver[default=no]])],, + [with_cart=no]) + +AS_IF([test "x$with_cart" != xno], [ + CART="yes" + PAC_SET_HEADER_LIB_PATH(cart) + AC_CHECK_HEADERS(gurt/hash.h,, [unset CART]) + AC_CHECK_LIB([gurt], [d_hash_table_create],, [unset CART]) +]) + +AC_ARG_WITH([daos], + [AS_HELP_STRING([--with-daos], + [Build DAOS ROMIO driver[default=no]])],, + [with_daos=no]) + +AS_IF([test "x$with_daos" != xno], [ + DAOS="yes" + PAC_SET_HEADER_LIB_PATH(daos) + AC_CHECK_HEADERS(daos_types.h,, [unset DAOS]) + AC_CHECK_LIB([uuid], [uuid_generate],, [unset DAOS]) + AC_CHECK_LIB([daos_common], [daos_sgl_init],, [unset DAOS]) + AC_CHECK_LIB([daos], [daos_init],, [unset DAOS]) + AC_CHECK_LIB([dfs], [dfs_mount],, [unset DAOS]) + AC_CHECK_LIB([duns], [duns_resolve_path],, [unset DAOS]) +]) + +AS_IF([test "x$CART" != xyes], [unset DAOS]) + +if test -n "$file_system_daos" ; then + if test "x$DAOS" == xyes ; then + AC_DEFINE(ROMIO_DAOS,1,[Define for ROMIO with DAOS]) + else + AC_MSG_ERROR([DAOS support requested but not found (--with-daos, --with-cart)]) + fi +fi + ############################################# # This PVFS2 logic is special because it's hard to get it right if it comes # before the known_filesystems check loop above. So we handle it down here, @@ -887,16 +983,6 @@ fi # echo "with_file_system is :"$with_file_system": file_system_args is :"$file_system_args": FILE_SYSTEM is :"$FILE_SYSTEM":" -if test -n "$file_system_hfs"; then - AC_DEFINE(ROMIO_HFS,1,[Define for ROMIO with HFS]) -fi -if test -n "$file_system_sfs"; then - AC_DEFINE(ROMIO_SFS,1,[Define for ROMIO with SFS]) -fi - -if test -n "$file_system_pfs"; then - AC_DEFINE(ROMIO_PFS,1,[Define for ROMIO with PFS]) -fi if test -n "$file_system_testfs"; then AC_DEFINE(ROMIO_TESTFS,1,[Define for ROMIO with TESTFS]) @@ -904,13 +990,32 @@ fi # # Verify presence of lustre/lustre_user.h # +lustre_lockahead="no" if test -n "$file_system_lustre"; then - AC_CHECK_HEADERS(lustre/lustre_user.h, - AC_DEFINE(ROMIO_LUSTRE,1,[Define for ROMIO with LUSTRE]), - AC_MSG_ERROR([LUSTRE support requested but cannot find lustre/lustre_user.h header file]) - ) + AC_CHECK_HEADERS([linux/lustre/lustre_user.h lustre/lustre_user.h], + break) + if test x"$ac_cv_header_linux_lustre_lustre_user_h" = "xyes" -o x"$ac_cv_header_lustre_lustre_user_h" = "xyes" ; then + AC_DEFINE(ROMIO_LUSTRE, 1, [Define for ROMIO with LUSTRE]) + else + AC_MSG_ERROR([LUSTRE support requested but cannot find lustre/lustre_user.h header file]) + fi + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#include <lustre/lustre_user.h> +#include <sys/ioctl.h> + int main(int argc, char **argv) { + int fd=100; + struct ladvise_hdr *ladvise_hdr; + ioctl(fd, LL_IOC_LADVISE, &ladvise_hdr); + return 0; } + ])], + lustre_lockahead="yes" + AC_DEFINE(HAVE_LUSTRE_LOCKAHEAD, 1, [Define if LUSTRE_LOCKAHEAD is enabled.]) ) fi +# Add conditional compilation of Lustre lockahead sources +AM_CONDITIONAL([LUSTRE_LOCKAHEAD],[test "$lustre_lockahead" = "yes"]) + if test -n "$file_system_xfs"; then AC_DEFINE(ROMIO_XFS,1,[Define for ROMIO with XFS]) # Check for memalign value @@ -924,7 +1029,7 @@ if test -n "$file_system_xfs"; then #include <unistd.h> #include <fcntl.h> #include <stdio.h> -int main(int argc, char **argv) { +int main(int argc, char **argv) { struct dioattr st; int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); FILE *f=fopen("confmemalignval","w"); @@ -950,54 +1055,16 @@ int main(int argc, char **argv) { fi fi -# -# Verify presence of pvfs.h, issue with int64 -# -if test -n "$file_system_pvfs"; then - CPPFLAGS="$CPPFLAGS $CFLAGS" - AC_CHECK_HEADERS(pvfs.h, - AC_DEFINE(ROMIO_PVFS,1,[Define for ROMIO with PVFS]), - AC_MSG_ERROR([PVFS support requested but cannot find pvfs.h header file]) - ) - # Check for missing int64_t (intel version 8 compiler and -no-gcc - # selected) - AC_MSG_CHECKING([that pvfs.h can be compiled]) - AC_TRY_COMPILE([ -#include <pvfs.h> - ],[ - ],pvfs_header_ok=yes,pvfs_header_ok=no - ) - AC_MSG_RESULT($pvfs_header_ok) - if test "$pvfs_header_ok" = no -a "$ac_cv_sizeof_long_long" = 8 ; then - AC_MSG_CHECKING([if pvfs.h can be compiled if we define int64_t]) - # Try again, but with int64_t - AC_TRY_COMPILE([ - typedef long long int int64_t; -#include <pvfs.h> - ],[ - ], - pvfs_header_ok="yes with int64 definition" +if test -n "$file_system_ime"; then + AC_CHECK_HEADERS(ime_native.h, + AC_DEFINE(ROMIO_IME,1,[Define for ROMIO with IME]), + AC_MSG_ERROR([IME support requested but cannot find ime_native.h header file]) ) - AC_MSG_RESULT($pvfs_header_ok) - fi - if test "$pvfs_header_ok" = "yes with int64 definition" ; then - AC_DEFINE(ROMIO_PVFS_NEEDS_INT64_DEFINITION,1,[Define if int64_t must be defined for PVFS]) - fi - if test "$pvfs_header_ok" != "no" ; then - AC_DEFINE(ROMIO_PVFS,1,[Define for ROMIO with PVFS]) - AC_DEFINE(HAVE_PVFS_SUPER_MAGIC, 1, [Define if PVFS_SUPER_MAGIC defined.]) - else - AC_MSG_WARN(missing or broken pvfs.h header file; disabling ROMIO PVFS support) - fi fi - - -if test -n "$file_system_zoidfs"; then - AC_CHECK_HEADERS(zoidfs.h, - AC_DEFINE(ROMIO_ZOIDFS,1,[Define for ROMIO with ZoidFD]), - AC_MSG_ERROR([ZoidFS support requested but cannot find zoidfs.h header file]) - ) +if test -n "$file_system_quobytefs" ; then + AC_DEFINE(ROMIO_QUOBYTEFS,1,[Define for ROMIO with QUOBYTEFS]) + PAC_APPEND_FLAG([-lquobyte],[LIBS]) fi # @@ -1008,7 +1075,7 @@ if test -n "$file_system_pvfs2"; then AC_CHECK_HEADERS(pvfs2.h, AC_DEFINE(ROMIO_PVFS2,1,[Define for ROMIO with PVFS2]) AC_DEFINE(HAVE_PVFS2_SUPER_MAGIC, 1, [Define if PVFS2_SUPER_MAGIC defined.]), - AC_MSG_ERROR([PVFS2 support requested but cannot find pvfs2.h header file]) + AC_MSG_ERROR([PVFS2 support requested but cannot find pvfs2.h header file]) ) fi @@ -1018,22 +1085,17 @@ if test -n "$file_system_pvfs2"; then AC_LANG_SOURCE([ #include <stdlib.h> #include "pvfs2.h" - int main(int argc, char **argv) { + int main(int argc, char **argv) { PVFS_object_ref ref; PVFS_sys_attr attr; - PVFS_sys_create(NULL, ref, attr, NULL, NULL, NULL, NULL); + PVFS_sys_create(NULL, ref, attr, NULL, NULL, NULL, NULL); return 0; } ])], - , AC_DEFINE(HAVE_PVFS2_CREATE_WITHOUT_LAYOUT, 1, + , AC_DEFINE(HAVE_PVFS2_CREATE_WITHOUT_LAYOUT, 1, [Define if PVFS_sys_create does not have layout parameter]) ) fi - -if test -n "$file_system_gridftp"; then - AC_DEFINE(ROMIO_GRIDFTP, 1, [Define for ROMIO with gridftp]) -fi - AS_IF([test -n "$file_system_gpfs"], [SYSDEP_INC=-I${prefix}/include], [SYSDEP_INC=]) @@ -1077,14 +1139,14 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x # Check that aio is available (many systems appear to have aio # either installed improperly or turned off). - # The test is the following: if not cross compiling, try to run a + # The test is the following: if not cross compiling, try to run a # program that includes a *reference* to aio_write but does not call it # If the libraries are not set up correctly, then this will fail. AC_MSG_CHECKING([whether aio routines can be used]) - # Include aio.h and the aiocb struct (since we'll need these to - # actually use the aio_write interface). Note that this will - # fail for some pre-POSIX implementations of the aio interface + # Include aio.h and the aiocb struct (since we'll need these to + # actually use the aio_write interface). Note that this will + # fail for some pre-POSIX implementations of the aio interface # (an old IBM interface needs an fd argument as well) AC_TRY_RUN([ #include <sys/types.h> @@ -1114,7 +1176,7 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x if test "$aio_runs" != "no" ; then AC_DEFINE(ROMIO_HAVE_WORKING_AIO, 1, Define if AIO calls seem to work) fi - + # now about that old IBM interface... # modern AIO interfaces have the file descriptor in the aiocb structure, # and will set ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES. Old IBM @@ -1147,7 +1209,7 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x ], aio_two_arg_write=yes AC_MSG_RESULT(yes), - aio_two_arg_write=no + aio_two_arg_write=no AC_MSG_RESULT(no), aio_two_arg_write=no AC_MSG_RESULT(no: cannot test when cross-compiling) @@ -1179,7 +1241,7 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x ], aio_two_arg_suspend=yes AC_MSG_RESULT(yes), - aio_two_arg_suspend=no + aio_two_arg_suspend=no AC_MSG_RESULT(no), aio_two_arg_suspend=no AC_MSG_RESULT(no: cannot test when cross compiling) @@ -1259,19 +1321,61 @@ AC_TRY_COMPILE([ pac_cv_have_statfs=yes,pac_cv_have_statfs=no ) AC_MSG_RESULT($pac_cv_have_statfs) -# At this point, we could check for whether defining +# At this point, we could check for whether defining # __SWORD_TYPE as sizet_t or int/long (size of pointer) # would help. FIXME if test "$pac_cv_have_statfs" = yes ; then AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if struct statfs can be compiled]) fi - +AC_MSG_CHECKING([for f_type member of statfs structure]) +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + ],[ + struct statfs f; + memset(&f, 0, sizeof(f)); + f.f_type = 0; + ], + pac_cv_have_statfs_f_type=yes, + pac_cv_have_statfs_f_type=no +) +AC_MSG_RESULT($pac_cv_have_statfs_f_type) +if test $pac_cv_have_statfs_f_type = yes ; then + AC_DEFINE(ROMIO_HAVE_STRUCT_STATFS_WITH_F_TYPE, 1,[Define if statfs has f_type]) +fi + + AC_MSG_CHECKING([for f_fstypename member of statfs structure]) AC_TRY_COMPILE([ +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif ],[ struct statfs f; memset(&f, 0, sizeof(f)); @@ -1387,10 +1491,6 @@ if test -n "$mpi_sgi"; then AC_DEFINE(MPISGI,1,[Define if SGI MPI]) fi -if test -n "$mpi_lam"; then - AC_DEFINE(MPILAM,1,[Define if using LAM/MPI]) -fi - if test -n "$mpi_hp"; then AC_DEFINE(MPIHP,1,[Define if using HP MPI]) if test "$NOF77" = 0; then @@ -1403,36 +1503,34 @@ if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi AC_SUBST(srcdir) # preserve these values across a config.status --recheck -AC_ARG_VAR([master_top_srcdir],[set by the MPICH configure to indicate the MPICH source root]) -AC_ARG_VAR([master_top_builddir],[set by the MPICH configure to indicate the MPICH build root]) +AC_ARG_VAR([main_top_srcdir],[set by the MPICH configure to indicate the MPICH source root]) +AC_ARG_VAR([main_top_builddir],[set by the MPICH configure to indicate the MPICH build root]) -# The master_top_srcdir is the location of the source for the building +# The main_top_srcdir is the location of the source for the building # package. This is used only as part of the MPICH build, including # the documentation targets mandoc, htmldoc, and latexdoc -if test -z "$master_top_srcdir" ; then +if test -z "$main_top_srcdir" ; then if test "$FROM_MPICH" = yes ; then - AC_MSG_WARN([Could not determine master_top_srcdir]) + AC_MSG_WARN([Could not determine main_top_srcdir]) fi fi # -# Get the master builddir (which may be imported from above) -if test -z "$master_top_builddir" ; then +# Get the main builddir (which may be imported from above) +if test -z "$main_top_builddir" ; then if test "$FROM_MPICH" = yes ; then # this variable is essential to proper build operation - AC_MSG_ERROR([Could not determine master_top_srcdir]) + AC_MSG_ERROR([Could not determine main_top_srcdir]) fi - master_top_builddir=`pwd` + main_top_builddir=`pwd` fi # Make sure the alternate spelling is used until we clean up all of the code -master_topbuild_dir=$master_top_builddir -export master_topbuild_dir -AC_SUBST(master_topbuild_dir) +main_topbuild_dir=$main_top_builddir +export main_topbuild_dir +AC_SUBST(main_topbuild_dir) # The following definitions are needed within adio/common/status_setb.c if test "$FROM_MPICH" = yes ; then AC_DEFINE(ROMIO_INSIDE_MPICH,1,[Define if compiling within MPICH]) -elif test "$FROM_MPILAM" = yes ; then - AC_DEFINE(MPILAM,1,[Define if compiling within LAM/MPI]) fi if test "$FROM_MPICH" = no ; then @@ -1440,14 +1538,14 @@ if test "$FROM_MPICH" = no ; then LIBNAME="$top_build_dir/lib/libmpio.a" fi # - if test ! -d $top_build_dir/lib ; then + if test ! -d $top_build_dir/lib ; then mkdir $top_build_dir/lib fi else MPILIBNAME=${MPILIBNAME:-mpich} if test -z "$LIBNAME" ; then - if test -d "$master_top_builddir/lib" ; then - LIBNAME=$master_top_builddir/lib/lib${MPILIBNAME}.a + if test -d "$main_top_builddir/lib" ; then + LIBNAME=$main_top_builddir/lib/lib${MPILIBNAME}.a else LIBNAME="$ROMIO_HOME/lib${MPILIBNAME}.a" fi @@ -1472,7 +1570,7 @@ AC_SUBST(DOCTEXT) if test $NOF77 = 1 ; then F77=":" else - FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" + FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" fi # if test $WITHIN_KNOWN_MPI_IMPL = no ; then @@ -1484,7 +1582,7 @@ fi # if test "$MPI_INCLUDE_DIR" = "." ; then ROMIO_INCLUDE="-I../include" -else +else ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" fi # @@ -1494,6 +1592,7 @@ if test $FROM_OMPI = yes ; then # Open MPI does have the status set bytes functionality AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes]) + AC_DEFINE(HAVE_MPI_STATUS_SET_ELEMENTS_X, 1, [Define if MPI library provides MPI_STATUS_SET_ELEMENTS_X]) # Used in the tests/ subdirectory for after ROMIO is built @@ -1511,29 +1610,9 @@ if test $FROM_OMPI = yes ; then # Open MPI: see comments in mpi-io/mpioprof.h AC_DEFINE(MPIO_BUILD_PROFILING, 1, [hack to make ROMIO build without profiling]) DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" - AC_ARG_ENABLE([grequest-extensions], - [AC_HELP_STRING([--enable-grequest-extensions], - [Enable support for Grequest extensions (default: disabled)])]) - AS_IF([test "x$enable_grequest_extensions" = "xyes"], - [DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#include \"ompi_grequestx.h\""], - [DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#undef HAVE_MPI_GREQUEST_EXTENSIONS"]) - + DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#undef HAVE_MPI_GREQUEST_EXTENSIONS" AC_DEFINE(HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK, 1, [Define if MPI library provides HINDEXED_BLOCK datatype]) AC_DEFINE(HAVE_MPIIO_CONST, 1, Set if MPI-IO prototypes use const qualifier) -elif test $FROM_LAM = yes ; then - # LAM does have the status set bytes functionality - AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes]) - - # Used in the tests/ subdirectory for after ROMIO is built - TEST_CC=mpicc - TEST_F77=mpifort - MPIRUN=mpirun - MPI_LIB= - ROMIO_INCLUDE= - USER_CFLAGS= - USER_FFLAGS= - TEST_LIBNAME= - EXTRA_DIRS="mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran" elif test $FROM_MPICH = yes ; then # For now, separate the mpich from mpich cases MPICH_HOME=`dirname $ROMIO_HOME` @@ -1545,16 +1624,16 @@ elif test $FROM_MPICH = yes ; then # CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include" # TEST_CC="$CC" # MPI_LIB="$LIBNAME" - # To allow ROMIO to work with the LIBTOOL scripts, we want to + # To allow ROMIO to work with the LIBTOOL scripts, we want to # work directly with the CC, not the mpicc, compiler. # Note that in the "FROM_MPICH" case, the CPPFLAGS and INCLUDES are already # properly set #CC=${top_build_dir}/bin/mpicc # - # set the compilers to the ones in MPICH bin directory (master_top_builddir/bin) + # set the compilers to the ones in MPICH bin directory (main_top_builddir/bin) TEST_CC='$(bindir)/mpicc' TEST_F77='$(bindir)/mpifort' - MPI_H_INCLUDE="-I${master_top_builddir}/src/include" + MPI_H_INCLUDE="-I${main_top_builddir}/src/include" ROMIO_INCLUDE="" USER_CFLAGS="" USER_FFLAGS="" @@ -1566,7 +1645,6 @@ elif test $FROM_MPICH = yes ; then AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if status_set_bytes available]) DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#define HAVE_MPI_GREQUEST_EXTENSIONS 1" - AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH memory tracing macros defined]) AC_DEFINE(HAVE_MPIX_H, 1, []) AC_DEFINE(HAVE_MPIIO_CONST, 1, Set if MPI-IO prototypes use const qualifier) AC_DEFINE(HAVE_MPI_TYPE_SIZE_X, 1, [Define if MPI library provides MPI_TYPE_SIZE_X]) @@ -1581,10 +1659,11 @@ fi if test $WITHIN_KNOWN_MPI_IMPL = no ; then PAC_TEST_MPIR_STATUS_SET_BYTES PAC_TEST_MPI_GREQUEST - PAC_TEST_MPIU_FUNCS AC_DEFINE(PRINT_ERR_MSG,1,[Define for printing error messages]) - AC_CHECK_TYPE([MPI_Count],[],[AC_DEFINE_UNQUOTED([MPI_Count],[MPI_Aint],[Define to "MPI_Aint" if MPI does not provide MPI_Count]) ], [[#include <mpi.h>]]) - PAC_TEST_NEEDS_CONST + AC_CHECK_TYPE([MPI_Count],[], + [AC_DEFINE_UNQUOTED([MPI_Count],[MPI_Aint], + [Define to "MPI_Aint" if MPI does not provide MPI_Count])], + [[#include <mpi.h>]]) AC_CHECK_DECLS([MPI_COMBINER_HINDEXED_BLOCK], [], [], [[#include <mpi.h>]]) AC_CHECK_FUNCS(MPI_Type_size_x MPI_Status_set_elements_x) fi @@ -1601,11 +1680,6 @@ if test "$ac_cv_func_strdup" = "yes" ; then # Do we need to declare strdup? PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup) fi -AC_CHECK_FUNCS(snprintf) -if test "$ac_cv_func_snprintf" = "yes" ; then - # Do we need to declare snprintf? - PAC_FUNC_NEEDS_DECL([#include <stdio.h>],snprintf) -fi AC_CHECK_FUNCS(lstat) if test "$ac_cv_func_lstat" = "yes" ; then # Do we need to declare lstat? @@ -1684,11 +1758,11 @@ CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" if test -n "$MPIOF_H_INCLUDED"; then F77MPIOINC="" -else +else F77MPIOINC="include 'mpiof.h'" fi -echo "setting SYSDEP_INC to $SYSDEP_INC" +AC_MSG_NOTICE([setting SYSDEP_INC to $SYSDEP_INC]) AC_SUBST(SYSDEP_INC) # Open MPI: use the exact same restrict test that we use in the @@ -1710,13 +1784,13 @@ AM_PROG_LIBTOOL # support gcov test coverage information PAC_ENABLE_COVERAGE -echo "setting CC to $CC" -echo "setting F77 to $F77" -echo "setting TEST_CC to $TEST_CC" -echo "setting TEST_F77 to $TEST_F77" -echo "setting CFLAGS to $CFLAGS" -echo "setting USER_CFLAGS to $USER_CFLAGS" -echo "setting USER_FFLAGS to $USER_FFLAGS" +AC_MSG_NOTICE([setting CC to $CC]) +AC_MSG_NOTICE([setting F77 to $F77]) +AC_MSG_NOTICE([setting TEST_CC to $TEST_CC]) +AC_MSG_NOTICE([setting TEST_F77 to $TEST_F77]) +AC_MSG_NOTICE([setting CFLAGS to $CFLAGS]) +AC_MSG_NOTICE([setting USER_CFLAGS to $USER_CFLAGS]) +AC_MSG_NOTICE([setting USER_FFLAGS to $USER_FFLAGS]) # Open MPI: Add on CFLAGS that we figured out up top. They have # makefile macros in them, so we couldn't substitute them until now. @@ -1749,7 +1823,6 @@ AC_SUBST(LL) AC_SUBST(F77GETARG) AC_SUBST(F77IARGC) AC_SUBST(F77MPIOINC) -AC_SUBST(FTESTDEFINE) AC_SUBST(FORTRAN_MPI_OFFSET) AC_SUBST(FROM_MPICH) AC_SUBST(FROM_LAM) @@ -1805,7 +1878,7 @@ AC_SUBST(FORTRAN_TEST) #if test ! -d mpi-io ; then mkdir mpi-io ; fi #if test ! -d mpi-io/glue ; then mkdir mpi-io/glue ; fi -# Create makefiles for all of the adio devices. Only the ones that +# Create makefiles for all of the adio devices. Only the ones that # are active will be called by the top level ROMIO make AC_OUTPUT_COMMANDS([chmod 755 util/romioinstall test/runtests]) AC_CONFIG_FILES([ diff --git a/3rd-party/romio321/doc/README b/3rd-party/romio341/doc/README similarity index 100% rename from 3rd-party/romio321/doc/README rename to 3rd-party/romio341/doc/README diff --git a/3rd-party/romio321/doc/makepubpage.sh b/3rd-party/romio341/doc/makepubpage.sh similarity index 91% rename from 3rd-party/romio321/doc/makepubpage.sh rename to 3rd-party/romio341/doc/makepubpage.sh index 390519e580c89a51c0a388b0a1e9924c5a3e2048..4af8f02d7ff49c9a6561243d2565433d3c62fa75 100755 --- a/3rd-party/romio321/doc/makepubpage.sh +++ b/3rd-party/romio341/doc/makepubpage.sh @@ -1,4 +1,8 @@ -#!/bin/sh +#! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## # if you have bibtext2html installed (http://www.lri.fr/~filliatr/bibtex2html/ # but I know there are other packages by that name), then you can re-generate diff --git a/3rd-party/romio321/doc/pubs.bib b/3rd-party/romio341/doc/pubs.bib similarity index 100% rename from 3rd-party/romio321/doc/pubs.bib rename to 3rd-party/romio341/doc/pubs.bib diff --git a/3rd-party/romio321/doc/romio.bib b/3rd-party/romio341/doc/romio.bib similarity index 52% rename from 3rd-party/romio321/doc/romio.bib rename to 3rd-party/romio341/doc/romio.bib index bb94a2d2ea197bc173cb3116d0b17a8e02a11b5e..6c023bf72ecd0c1f74212a71557ab209f807497a 100644 --- a/3rd-party/romio321/doc/romio.bib +++ b/3rd-party/romio341/doc/romio.bib @@ -90,3 +90,97 @@ delrosario:two-phase, bordawekar:primitives, bordawekar:delta-fs.} } + +@inbook{95c0bc197da7464f82b1acb73d7bcbd6, + title = "Orthrus: A framework for implementing high-performance collective I/O in the multicore clusters", + keywords = "collective I/O, parallel file systems, parallel I/O", + author = "Xuechen Zhang and Jianqiang Ou and Kei Davis and Song Jiang", + year = "2013", + doi = "10.1145/2462902.2462924", + pages = "113--114", + booktitle = "HPDC 2013 - Proceedings of the 22nd ACM International Symposium on High-Performance Parallel and Distributed Computing", + +} + + +@Inbook{zhang:orthrus, + author="Zhang, Xuechen + and Ou, Jianqiang + and Davis, Kei + and Jiang, Song", + editor="Kunkel, Julian Martin + and Ludwig, Thomas + and Meuer, Hans Werner", + title="Orthrus: A Framework for Implementing Efficient Collective I/O in Multi-core Clusters", + bookTitle="Supercomputing: 29th International Conference, ISC 2014, Leipzig, Germany, June 22-26, 2014. Proceedings", + year="2014", + publisher="Springer International Publishing", + address="Cham", + pages="348--364", + isbn="978-3-319-07518-1", + doi="10.1007/978-3-319-07518-1_22", + url="http://dx.doi.org/10.1007/978-3-319-07518-1_22" +} + +@Inbook{tsujita:striping-aware-lustre, + author="Tsujita, Yuichi + and Hori, Atsushi + and Ishikawa, Yutaka", + editor="Kunkel, M. Julian + and Ludwig, Thomas", + title="Striping Layout Aware Data Aggregation for High Performance I/O on a Lustre File System", + bookTitle="High Performance Computing: 30th International Conference, ISC High Performance 2015, Frankfurt, Germany, July 12-16, 2015, Proceedings", + year="2015", + publisher="Springer International Publishing", + address="Cham", + pages="282--290", + isbn="978-3-319-20119-1", + doi="10.1007/978-3-319-20119-1_21", + url="http://dx.doi.org/10.1007/978-3-319-20119-1_21" +} + +@inproceedings{Hammond:2014:IBE:2690883.2690884, + author = {Hammond, Jeff R. and Sch\"{a}fer, Andreas and Latham, Rob}, + title = {To INT_MAX... And Beyond!: Exploring Large-count Support in MPI}, + booktitle = {Proceedings of the 2014 Workshop on Exascale MPI}, + series = {ExaMPI '14}, + year = {2014}, + isbn = {978-1-4799-7032-2}, + location = {New Orleans, Louisiana}, + pages = {1--8}, + numpages = {8}, + url = {http://dx.doi.org/10.1109/ExaMPI.2014.5}, + doi = {10.1109/ExaMPI.2014.5}, + acmid = {2690884}, + publisher = {IEEE Press}, + address = {Piscataway, NJ, USA}, +} + +@techreport{dorier:hal-01149941, + TITLE = {{On the Use of Formal Grammars to Predict HPC I/O Behaviors}}, + AUTHOR = {Dorier, Matthieu and Ibrahim, Shadi and Antoniu, Gabriel and Ross, Rob}, + URL = {https://hal.inria.fr/hal-01149941}, + TYPE = {Research Report}, + NUMBER = {RR-8725}, + INSTITUTION = {{ENS Rennes ; Inria Rennes Bretagne Atlantique ; Argonne National Laboratory ; INRIA}}, + YEAR = {2015}, + MONTH = Aug, + KEYWORDS = {HPC ; Storage ; I/O ; Prediction ; Grammar ; Omnisc'IO}, + PDF = {https://hal.inria.fr/hal-01149941/file/RR-8725-v2.pdf}, + HAL_ID = {hal-01149941}, + HAL_VERSION = {v2}, +} + +@ARTICLE{dorier:omniscio, + author={M. Dorier and S. Ibrahim and G. Antoniu and R. Ross}, + journal={IEEE Transactions on Parallel and Distributed Systems}, + title={Using Formal Grammars to Predict I/O Behaviors in HPC: The Omnisc #x0027;IO Approach}, + year={2016}, + volume={27}, + number={8}, + pages={2435-2449}, + keywords={input-output programs;message passing;parallel processing;HPC applications;I/O behavior prediction;I/O subsystem;MPI I/O stacks;Nevill-Manning Sequitur algorithm;Omnisc'IO approach;POSIX stacks;StarSequitur algorithm;computation performance;computation time;data access;formal grammars;memory footprint;performance analysis;postpetascale machines;Context;Grammar;Hidden Markov models;Libraries;Prediction algorithms;Predictive models;Prefetching;HPC;I/O;Omnisc'IO;grammar;prediction;storage}, + doi={10.1109/TPDS.2015.2485980}, + ISSN={1045-9219}, + month={Aug} +} diff --git a/3rd-party/romio321/doc/source-guide.tex b/3rd-party/romio341/doc/source-guide.tex similarity index 100% rename from 3rd-party/romio321/doc/source-guide.tex rename to 3rd-party/romio341/doc/source-guide.tex diff --git a/3rd-party/romio341/doc/users-guide.pdf b/3rd-party/romio341/doc/users-guide.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b4e1800fda871feb9439e41ef443f7ba753dca3a Binary files /dev/null and b/3rd-party/romio341/doc/users-guide.pdf differ diff --git a/3rd-party/romio341/doc/users-guide.ps b/3rd-party/romio341/doc/users-guide.ps new file mode 100644 index 0000000000000000000000000000000000000000..e428067c2fc14ee3911798e4479d1d7cfb3e7d57 --- /dev/null +++ b/3rd-party/romio341/doc/users-guide.ps @@ -0,0 +1,7047 @@ +%!PS-Adobe-2.0 +%%Creator: dvips(k) 5.993 Copyright 2013 Radical Eye Software +%%Title: users-guide.dvi +%%CreationDate: Fri Jan 22 14:26:25 2021 +%%Pages: 19 +%%PageOrder: Ascend +%%BoundingBox: 0 0 596 842 +%%DocumentFonts: CMR10 CMBX12 CMTI12 CMBX10 CMTT10 CMTI10 CMR8 CMSY10 +%%+ CMR6 CMTT9 CMR9 CMTT12 +%%DocumentPaperSizes: a4 +%%EndComments +%DVIPSWebPage: (www.radicaleye.com) +%DVIPSCommandLine: dvips users-guide +%DVIPSParameters: dpi=600 +%DVIPSSource: TeX output 2021.01.22:1426 +%%BeginProcSet: tex.pro 0 0 +%! +/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S +N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 +mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 +0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ +landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize +mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ +matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round +exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ +statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] +N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin +/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array +/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 +array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N +df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A +definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get +}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} +B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr +1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S +/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy +setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask +restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn +/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put +}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ +bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A +mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ +SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ +userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X +1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 +index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N +/dir 0 def/dyy{/dir 0 def}B/dyt{/dir 1 def}B/dty{/dir 2 def}B/dtt{/dir 3 +def}B/p{dir 2 eq{-90 rotate show 90 rotate}{dir 3 eq{-90 rotate show 90 +rotate}{show}ifelse}ifelse}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 +N/Ry 0 N/V{}B/RV/v{/Ry X/Rx X V}B statusdict begin/product where{pop +false[(Display)(NeXT)(LaserWriter 16/600)]{A length product length le{A +length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse} +forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{ +BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat +{BDot}imagemask grestore}}ifelse B/QV{gsave newpath transform round exch +round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 +rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B +/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M} +B/g{0 M}B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p +-3 w}B/n{p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{ +0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end + +%%EndProcSet +%%BeginProcSet: texps.pro 0 0 +%! +TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 +index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll +exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0 +ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{ +pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get +div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type +/nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end +definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup +sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll +mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[ +exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if} +forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def +end + +%%EndProcSet +%%BeginFont: CMTT12 +%!PS-AdobeFont-1.0: CMTT12 003.002 +%%Title: CMTT12 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMTT12. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMTT12 known{/CMTT12 findfont dup/UniqueID known{dup +/UniqueID get 5000833 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMTT12 def +/FontBBox {-1 -234 524 695 }readonly def +/UniqueID 5000833 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMTT12.) readonly def +/FullName (CMTT12) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch true def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 67 /C put +dup 69 /E put +dup 70 /F put +dup 73 /I put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 80 /P put +dup 83 /S put +dup 84 /T put +dup 89 /Y put +dup 90 /Z put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE32340DC6F28AF40857E4451976E7 +5182433CF9F333A38BD841C0D4E68BF9E012EB32A8FFB76B5816306B5EDF7C99 +8B3A16D9B4BC056662E32C7CD0123DFAEB734C7532E64BBFBF5A60336E646716 +EFB852C877F440D329172C71F1E5D59CE9473C26B8AEF7AD68EF0727B6EC2E0C +02CE8D8B07183838330C0284BD419CBDAE42B141D3D4BE492473F240CEED931D +46E9F999C5CB3235E2C6DAAA2C0169E1991BEAEA0D704BF49CEA3E98E8C2361A +4B60D020D325E4C2450F3BCF59223103D20DB6943DE1B57D05DA0555DF933BB0 +7B42D264831116C06C79335D519461E7B0E870A6715E3D74A08D1BCF86E3BCC3 +A43FC6BAD1C68BD9D4AFCC06D845FD1F1E70D7A47F0BBCAECE8396E04591E5E3 +4797F646AFEEB7DB548183F0B74C9BB6BA2AA04E7F5950EC8AE97C741D4B2C5C +A8E7A8DF5A36A30B5A7592D95E1DBC63EF33C92FE459792CED29E2B8B6919251 +75EF62089BD7D44A6E1F9B62EC802FBE62B821DA1C3B2DDED45D27964AD29ED0 +9FB7868F3A8FEADA87A8E42D52C1EB7229D7C79B60BDA263F2BDB025AE14A507 +098FA274206BACFB4A0A7257D5998EE8F0FDCA79CB61DD1FC59DADD11E16BF02 +ECDFD706CDA1E72054D4EB55AF7BA9F19955886BC0BD6E0E3FE3769C94AF3581 +DFB2BCD67FE2892AF07E858A01280194D8DD7332B3D0A585C87FAB056C2EAA9B +5AD48D1C9F00CEF8EF0D1408DBE1C03D04B231D7B8D5D998FE0CD7EE19828EF2 +F988EBF6DDBFEE00F04A4A1F4E1A55DED7EF3AACEAB5005F1962C724A017C914 +2936E2E0DF26A55ACD7DD836C6035CBF07981C1BCE3615064F0540A1034C69B4 +E3908E76EF8925D486DF0B4A8E1F02D8AA99585A7C31847AB9382F83880C1C21 +C496AB2DF8E7BD4643B28B704B5F6B53429D3EE940A79135F5BF0396E5B46F23 +42AF406C26D12BEA7A41F332AEB75DF43C15334CF4651A99F602036946B1B91D +4BB0D2E51C20216D892C8173241AC8FD15A37C3CDD8AB4FB67D8565AFA61C068 +95E3D6E46D7C09BBD09428207D506AD43C693F3C3D787F6A5C39084AE45E81C9 +830900DB50DAD10A17E118FB5E9680B5194716A788FF7514A1167DD1A305FE62 +C7DBA30E569DD3565AC9C80B112E221E3878624A015F6224597D02C9A07B368C +F9FDC817988D12CB00ABFAB288C20A59AE40E7A75C235938C47F77261BED14BB +6574F633BC4DE9E8AEABC46E0965AD69748C315B6DB5F264D5E7635BE37E23FB +873E2488086BA27275142C774A4A241F92E8ACFF0F25E81E2565642D88F77DE7 +03B9B3572DB260AA7C2BD4C26A77BD8CF2C8E64411908BBD7BBD2C5C59E4B99D +27A83093730BC19E891A7CB77BF0E547D548758561D33361D5D6CB27BD6B92EE +94964C244364EF29209FD310DB102768AE57CFDF4B7DBBFD3B9D1DA5DF412D49 +A1BFBF792D454260EA78E4DF0C645CAD717312D782C634131B685F40B0017AA6 +CD442B7C50944D5C87DF53A069309CFCE3166F9324FA4B83C32B9CAED85DF1B9 +BA71485B7F7ADC8320DBF902E3CCACA6EDA582582ED6521276D7301078B9F352 +93D6B3EA2B335AA79CA0404BDB0D5BAB5DBE7D1F503A26A53B5F20FE2247ABFE +5D08DC7A6D842B4AC35B5DE1ABD51FD2CF3D3ACDBD832662BED82A3FBE442BD3 +91006D9A1DEEFDB9DDEC9A9CFE058AAA811740542D2EA49EB2629B7C901A5702 +292D4D213385FAFEF8CED7042F25DFA8502ADFB352A7C10CF3CFE9B741E80F1A +48EA98FAC5E7B3EAD3E164010E769A068B92A45C002AF525C72B586435F59DA0 +A7C3D78680986879D6314EC56DCB8330675F1F0FE9E62A8E7F2EBCCF61AA6F71 +9033D1FA3F14D6A39AF03232C722629AACF1466EBF7A6B730F258C711915C78B +1155E139FEA50F37F93F645F6DCFF6B7DE45B211497E7BF92063C9F5234E2870 +F8887D8708B7B82F2C8ACC0242B2FF1DA88750A28AF92CEBEF4F07A5DBE85575 +5341054ACBCD29331EFF64EF4695DB26171F769D8B275A8154EBF42AB7EF205B +8767859F78996CFA21C5DB429B618D3CAB415693C9BBA42B60921DEF6B4160C3 +FFBE2B592360EC6AEFA80E34FCF6D878A36D74EACBFF3395DF35EE331523A9A8 +02A0E73BA7F2CD28158CE2E3D6C7873DC521CD6B9EB4D05AB9F38F17E3877053 +1A83A8D11C5504A5A10AE72EE0799AC5256672B0FCC99044889B57E6CAFEFA47 +2C5F3332318B57D4FB93226E97E0902B8E606ACF5FF6E6818B0A743A1F561F11 +74E1A974D8201C99FCC5A71A7839A7FEDFAA661103BB922A76A4AFBFBFA315B8 +0901A1E3C42C3D557ED2F6F284CB581D9975A2ED1261A8B7756DAEA34E451246 +00C5140FA69B34AC2C264E7D7F75CD204E0FCB6A54401880615CF442A370416F +DE8C6618D22AF7CAF9F1E47CD0A38938957222017AC9780C04A38FB93A26F885 +BA129553C94D3A9A3413479E626F343A515B548637FEA3025098A57803F84F64 +630E3D4561D1B71C127D10EAAE7458305007CE9768518BE97823D35223A16604 +222F903AC201529D38448C1C66D7BB0153DA81FFB425F9988D5F10F49DF39EFB +84C57E9BE74B301CD6249F76C1AC1581FC56B4600AAD4B0D0E00DA0F654ADB14 +4DCBB5432D06AD7EC1C9B5BFBD533DF63E77C8840EE88C9C93994E5036C8EF78 +6C480C87F1065CBE0615D034B6A926D237A92F4474AA5710A4BD16256DC4D636 +3BFEDAB0B550184F9D3568BA238A10A975F7D533D57DE547F1E8BB3A662970A8 +4506863DBEABE03D29F63907C3C73C1A034F8EA94EE286837786CD4E5FF74D4A +3088ADB8FCCB57932BA4C9DB0F1556705CB1822711AB6ADFF93FDFF51839323D +58C7ED4FC10F6CCEDF38DBD6CA7403138B70C5803F5D78CD1CA62D78752F1354 +7FB47DAD534E4660A43C4E2EE6090F140AC8A9DED202FB15E5DCBFFFF0116ABF +68E7AF18DBD23BC6DBC52781D637C79A7A2C1ABCB73066A7F569D964836B4485 +44FB003F179D5CF38CE3AD2431D3AD119D79C0371B813E282FEC9B2F5A2B7845 +CD6CB4D6B0E9147198F6EC815E8DE63E18D280960EB57A8F1D0B3C5673129864 +B27DB690A1F8A9F2EAD6B5A81E6815E68B0870027CC283D0C60232F9E287E3CF +2285382D76B7659F1508078FEA8267434E42408522D87654BC04FFB6BC6CF733 +6B3B8AFC6A7FF6F0C1504A6C2E8685A16B4B833713FD10F1F33CC6C3A1B3E322 +B3202739D95C90BAACFB623148EA3D18FB1E5B8F332F4A481A3794466FF81297 +E3AC49E6A5B8BBCE93FECC772B77EA42792F6A424492C7C69075A13EB094CD36 +DA8FEA50F4AB93A0D576A5F38BC9376C471326FFE4CD0FAF1E399700465AAD73 +F4AA92CA17661DFDF174020E8A8916B55EB0F53C434DF5B34FE417482524D940 +800A2AB996E44338B161FE9CC9898E719F74F024F323B3DF2F636891F9CC0A17 +0B44787F2179968F75DC250C39548050D6F972E560F9749A624FEFA6C2E69407 +9ABE51F42B619B4C9FDD560A79362AD89A0868F2035D80A0E56B2F981E664CE5 +1CC928338DFE37DCF2B8926234964BECB3D55BB24828F4F91E747990204D8F45 +DDD436C2DEF55A8883850930E906E6B08845B4EE0A9D00B5012112CD07CAC829 +C358B47258F9535705236EB04643753553A4DC81B42DD6C6C9DE039497621EE9 +0C94432E81557F0B19592FEE805A1AD1876AEC8EDC9F67DCB16758950A4139E8 +F2074C9CD228041C806A247CB06783892B8EEAD2801F9F7000B03C9241F571F0 +702F42F5ACE69DE337A0A19344406A69F2D1332FBD1EF135A98A8F83C24D500A +05D947E047AD0DAA2A2B18D92E10487C7523B4B704C10914D7529A215434C256 +E54BAC41625B4459C7B78C3EE2582DAA7C264E3513D715E08771840D35F8C189 +7CE38BED286AAE60FD92D2829FB5DAC556BB8A4B86F5D24A075C0A0EE4BD1C01 +52840707 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMR9 +%!PS-AdobeFont-1.0: CMR9 003.002 +%%Title: CMR9 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMR9. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMR9 known{/CMR9 findfont dup/UniqueID known{dup +/UniqueID get 5000792 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMR9 def +/FontBBox {-39 -250 1036 750 }readonly def +/UniqueID 5000792 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMR9.) readonly def +/FullName (CMR9) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 46 /period put +dup 59 /semicolon put +dup 67 /C put +dup 72 /H put +dup 73 /I put +dup 77 /M put +dup 80 /P put +dup 84 /T put +dup 97 /a put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 104 /h put +dup 105 /i put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 113 /q put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 119 /w put +dup 121 /y put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2DB9AF72336CC4AD340 +15A449513D5F74BFB9A68ABC471020464E3E6E33008238B123DEDE18557D712E +ED5223722892A4DAC477120B8C9F3FE3FD334EACD3E8AABDC3C967C61FF003B4 +B10C56D6A490CE9594D57A2D431B9E5E10FE3D8832E227A7087611431ABCD029 +85F4865E17E17F8CFBD2CADC97E0A8820E3ACEC873F31464466A9545E967E53C +DBDDB8478E69063FBB891566BAF88B7660A4405B16834761F041CCF7650AF955 +F9E853AA9F5F4382E1FE7D0C5BB4023818A2383F91249D48CE021250EC9EEB1D +2835E18FB73026250B32A8849067D5E2258797C917F998F2D4121D96560C5FB5 +B5D3471216639A8671B6DFAC5E3554EC36D9A72518525A795590C74DD70DA3A7 +78BFC43E51D6F2BA52F17D4DD00D389D3983EC54912AFF73684A8A7E345537B7 +E62361C04A47859DA084BC72EA53512DC54132EB2EE671793603015652EAFDE3 +41C4B6B679BD60AEC5153EA0D2200CB1D097DAD770F5F31E6FC475A225995277 +B867B731D5401E2D02B85BA85158C80FF7E2BBCC42B98AC867E67D25DB656072 +55A0D32AB7AA483A5A9686CEA4E2B3031D90D84DB3E2DEE7706C91BA81CB8DAA +700E5F61E07D6998C9552C81B66FD10A10033D49EF3BCB0FF22ED0A3737523C9 +8F851C61C4BF8A213BF6EC70C956AE48B5BD276CC0437C72BF6515B10739919A +F00F6ADD2798CB211668842349171A5AEB0664D2C44397E55A4A9EBDF54A3EF4 +FBBCDAD9DAEF4B0CAEF7112FA828F2F8D9F633D37E5516AB5ECEA87342EF8DC4 +3A50548490F5BC9A8A1F98AC7AEAD9D913BFA10CA86D73AEB5BACC1FEEFDCC15 +B3655522CCA2C772E902FAB2A6FC153597D52763EB44AB7489FF061F7F58E8F2 +AEAAF4D17F36CBFC00D3C653F335D14240C87DB4339DA9D30A5BD1F502BC9013 +461B9DB2FBEEC01BB18990439A0E9CA6576BC9CF6B1A3DB9386C4A5D4AA6A5DC +CFA45FB75F22E10ECB72565DB441A194902C91427B4F676E531C661F7A2C3C85 +CD534D1C89B6779B2EDC8E44667B992C20C70B663BFBF680A6CF4383EB7CA26C +4D1F06B5EF4025BBE65795F1EDB5CCB97050872D6C07BC2974F905ACDB7A765F +291365D6C8152153E7F017A25FB4476C60FD9EAF9A121633DBEAC32F62850223 +D6418566AB350F90F4B35F19598478F76B63E347D4C61E203D4DB8ECB9889181 +C387F4B663A502C638761D2782BB96EAC81A0108D7BD6938F67FEBB69218D115 +D8E89CFABCE15C6ACC7FEB983332A51A6A73CF4E341574F366713D7FB29956D9 +9BF238A87483D37E526A2EA2F101EDD34E34CB92730DCA7235AA0027189BE405 +2DAB4AA021A30C28B26C50808E1E965C02F6212EC7C72F5683339425A7739380 +A422E6191ED8453AF0CAAA424AE44DFA7CC5C2F6EAA8D73A5101D8E9517DBCFB +2858D0E8ECB7DC430EF23A9E4428CB7DED8D035D6050251AC101A2D0E884721E +2F21E573F948048BB8FF888911C508CC198BD750083B339500C426AFCD5634A6 +AAAC1C7E91249667B231BBFC64B4317192FE07FE9DA0DDB5E517D097AAE46577 +9555F29D45C67CDE9812CAD03F220B20519F2FF32DCA56A554D4296FE2D1F3FB +B209B5270E0E695EA5A0EF1144957CE045881AEB8D05D72CE57F4D34617AED67 +0D3AF0472CD8D60933651626550366E300E72A9C89ACD475C2E2ED9BD44B472D +9DAFE943F8E02A6DC38E447EED964624C37C3130E48211CA279BB6A0BD59466B +42F3D89B5746F29E084E22CF58395AF0F29E55113F3A3F2F52CB3A6DF3D026D0 +C81754B8E2E4A15F6943BE9D0087D5166060734FD07C4C57D7C7D90E8C9C1F35 +623CEEE3ABAE75E1A18A1E3B50B7266BD2D8E812CFEB4A46B856885B185640D6 +B9C22179551002B94282F57FB433B7FF157D2F0D240836B72AF4A331668AE5D4 +E6B85415F4E8B9D2F9AF90FAFAA0A3866DF417CA5A31348CF9B41B8F5F4D2F97 +CCF7ADE851B5E2E2F6E319AAF5792EBB9DA2C6AA8B73D889F3CDAA42932CDA7D +07A7E59183CD89520DDFC36E5D513BFD8AD0886046585F29B4D7F42CC0C27AA7 +53915AB1167D292FE91957E94A57FEE2D49C20C9070ECD736BDEE0F046E60350 +EA539DC298156A4E0D019E7D481FDDA6861E20678516AB80ABEC1F09B126BCB9 +52E8272A06BB6DD87ACFC423B4A4FC9A3DC8DCAEBB807C5F748F1FF8B17B8B88 +F426206BF1B7B7D239D26BC3CF0776C467A98CFBBCA5FB6145D5900137ED19DC +D002F10704AA680EC753C22E29AAB15712EF22AF73D80820A1EEE953463D4EA3 +81FAF99518D4FD0F862A324FC44C4B9542A92C5B60CC983CC8F647CE5BDB4D6D +B92B380E0E5F7208A9CD91FA9A469548162C761C1BA05AC9D60B766764D821B6 +B4E17F56CE455F06EA1EE2D38FE47581746C4C5FBA63AEE2B58E877D1A8FA83A +31C972D53B64E92EEEA147426A92CFBF76FC614119C6E9C6476FD6A069C803BF +E949FBE50B5AB1F1463F9747E8D353F7BBD991C4F90F920BC9407D8E24720293 +846D052214E60390C3CB926D38C83AF697425D80C2B4FC4706615B905516B733 +46ACA325CEA68FB21B2D17CF0B68BA4DF249368625CF83441EDBF2B86C957C1E +44CD722BD2537CE84FBA07EC7AE15C840041B9F7F3040072E6084CD55B301C08 +A64A53BD4D3DC30DCAC6C152F316ABC59B8EE978793EBD568849DCC2A75A495A +BC83470D503F8E389F54B4A4A31624E83C601B43AC1E52CB811FAA7CA6B644A5 +1AE0BFD4FC774C9C9DFC2769ABFA9C83F900BE2DD4010416053A1D4874E6ECF4 +D86E44B4CAB15D53E5630C144B0C15B58DAAD785BA298B1893D1B09BA5D40344 +6678FD2D17FF6674433C976D6DAC659175CED26139967C9B2B9CFFD78FC2570A +E5142141C2888DBF2DC8503F9137CE7CB21A1EBC2D65BF33FCEFBC85C9CB736E +24E8595CE934AB032CC70BD6A3B0F3BDBFBBE185512FDB7BE3D4A6620478453E +75D044BF770B44C9741E31985E6DAF5A318D7BED12B02A4BCFE60D25EF12843D +EFC9BAE2A3F2EFAD66D7858E83EB46BB09D2FF8AE9C43844A7001C86ED97AF51 +C511E3A89A1BE349FF5215D1A57843EF51456B9838133846F19BE79AAA5C1AB0 +5F400E5E8E7B0BF96EFCA3B8F0894BE589F2C9FB6C97BD16D38F0A237CD4F034 +099C41F85C7E2C7BEC8E02C4F327306A53B4B48B26A8926670CEEF96F6DF2281 +7C2DAD99EF8B81BBB777227C2475AE7400DC393D9C0445E925DB1E955950F7AE +53E9AC4306794239346A419F7B5DF4168382EF5956B81F83BD4BB7635B3BCC84 +7D84D05AEDC02D14675D777CD19B08124001A4F4EA96990D96000C082A12F00F +7FEF793A7FA69D56D3A38D012168C5458B667190AFE80E02C816CAFF0A71953C +D80B085CD286027E2FDBB05452AA762FD7C813B2E19A79C74190E04E746C4933 +CE1E300CAF5DD53B08110509BDA404EF07FA1BC5224BF1205DE8E0C3276A13DD +866675103B960C5F36644F96B4FAC16F5D6E91F74629B318FCCC8E8CB13EB76B +B0B7B90718D913A52A04732EA3667674994A325A7973C601A7DDD50F658E0826 +ACB8E53D4914B0274AED98D7BC3B2B7F9D48A7ECC2F8ABEE05CF2C4F2B90360B +B7DF779EAF3E103D1D83EDBE32DDA873768D8C37DC10A5354A94B4153049AD64 +FF3E0BB51AB91D7C0B4134D8731CD0270DAAF19BED9EAD800A14B65B68EEE89B +40DD624111670DDC7C030DEFE0D1B96420E249332445C155BA96231C88E70643 +D526BDF3CA1E05FEE72CE2B881CFC01ED780C10E89F0828AD55FE29043BC56E8 +2750A6DD15AADD54492F6092618F4CC6A31766B17FC60766D18C307EFC9BB787 +39047DAD6B38419EFBA46B4E2C932F97451FE78AD75FA90DE409FC6DD46585D2 +1941F5ED47A8FBAEF5A917A240959E8D9F9917DEA3247D9CAE6BF7A88DB4C4A4 +F9F5A6DCE542420A032FF3392FE0F3357B51F884D6181583A554F75B1DF192E9 +253CC828FF06B0D992D5316435980B044BB191508C7C45CD90F797F88856424B +14A5707459C50EDCF3E3D8D1667AAA83015405354CE744C66D9A5728F29E0085 +6DBF740717FA0799E3BCC4ED7841588B496A5E549B953A7FD288B4A045DB611E +E3B2F35963FF18ACCB1C968BEEA2CBF52B3999AAF89A05320BB2E97F52CFE06B +9F10E3A79865A3059A957F97972D80ADF678A36E2B586C101FC6AFA4D137C13E +EE7102C9B8EF78CB057F8B7476F146E8FF5C897FD5503DD198128CFF7B5FB339 +FAD0AF0EA967F77B07B367A4AC9F668F8BED99B98E87FAC750EE045602D76C3F +289FC9D97694C96AAC0AD1BD3FA94DF2CBCEA24B40F47B9B59E54EECEE7AC4C3 +A3F5D19160E4C1EA830D57FBE10D8D46AC5CA0260F22FAA45236F0F542BEA9C5 +5A88F878F68B36114E0573900C65E305462B22A3429A17C7A567694414DDDA46 +5F30542B8FD4F00F6C295B2E8D3A986B953D96822DB2ECD48E8BB1763434E652 +152EF3717F5E7FA10FF0B01D9F64E22C5DBD7254629658887BACEC0ABDE972EE +67299FB84A05B3EFE22B6976DB4CCA384232DDAE38C31623A4E39EA2E82C1EA3 +BBB68F1A7DBF405DEC37CB7203A895C36A44BD2D63F45B3888AF91D37B510A59 +3C921BB44DA620892AD87B665F69F6FA510B071ECC403CB2BE2F54B3969C9E88 +713244BC97C1466DA8216DA7600C221E7E7EF5C789D2E12B36422023A03E11BF +2790FD6062FE6BF62F5010A92F0A104B76E255A0975E04F6F20F760881BDA7F5 +D834D1D328B6EC19AA7D5E5678A84C74C82553DBE8BB5765E84F5A8789032143 +6020940B4B8D45FC3433D356E28C25F42D0C19F911213D85951B2B00D01B77BB +A4C72E964F9D95422BEDE582A05CD52E03D28A996E6CC8FCD910CBAB728073F9 +F9FAEED5470FFA55930447C5BA816F826F983D53EC9941EC8364B3060FD74C95 +26D4F5CA753B574FD2FA4D1D333785241D8741B79E628BC852FDC35478C5ED9A +C1BE88C5EE7302816E65C12B58EA16FEDD4672EB3E24B6EDAD5DCE263BA8A970 +350B651E5A9F3C281D85BC3F44EADD0D93402E36489BA5185E7D388974B0B700 +70575188BB610CCA20F081E2CBDA13DCC6F72567962ADB342E02C1E763B673C5 +F7384E24C6E1730A3A790D690A2103AEF88E0C1D4480DC9B25E5C8C9E1919C95 +F83320179B4C7C4A26D559BFB24D7D596FB73758C9990C451E77FCDDD17763B8 +9C30A9534E3CB6680D3D419D4B70B0B0A0D160FCCDE169714E373F65B7144CC2 +DB9A44E041211E1517D3148E65A2486CBE5E74E625261CCF65392FB4F3091473 +F9E8DF327D59A58558E5C9F7190DB577D5DC658F5E36258291C708B3D224653D +064BB6079F91293FC733710893AD1C96169B30CBFE4E9D52E7EFAE4AFEE68FEF +1AFD5E7E9DFCE8DE332B0FDC0514F9B3090AC85BBFB527FD8034DD33E9576325 +A8769AE09AF1BA792447DDD932B98FC9486B39E0B04DDB3EFB7A30DA0940B33E +E27490E0E841E87B1C90E5248A91742ABEDC10F43A8AF0F9C5B4A4930B1AADAF +01874B9AC3B8D0DBECCDA6CD7E96471FAA15CB7F8A599C5746327CE392224C3C +40BD60AF97BCA6FF6FCAB2FEA114D7300B89E91C3BC92D5B3E2C83BB37992D8C +72F661EFD0AA034C738C019DFB79BF40651A1A34BC1EB9F5AAF58F8B3DA32645 +24AFF8636486F08BC21533B5FF7391B0679A78DFDCB03DAF6BB7475A1D51DAC1 +EE4BE9B986655D1FDB6936445EF99B58B303FE79F11275EEA96A9F6808EA8775 +D873D1052FAC93769789C700F20EB2ED6D15676F6E563A769CA9298E463FC311 +83281483B1C953370D196727A6A0E66D32D9480AB1B6DCA77868C1A2D5DB6483 +5F31EB6B18EEFEF1CDC31533E69B0AFC6B30FC9912DC89BAAEEADC30BE14F448 +1A6B70D36A5D9B01799BEEA686066114910842D022EB464A9A1E8F0A5628BA69 +AA9A1925CCADD44703BC67A89F3B48E4680726DC4360274185CF3C8AB747A8FC +4B928AD62B092EFE48B01E33ED756DB696171FDB775396BBA138E056F71EDAE3 +7A1E4CC272B8418114B0E81DE0BC43DB3C133167344488820A92DF10FFA26FB9 +65FCA2C87D302E956DE6B4FE145145440C83DB43A68F8B29A592B127BDF49063 +B7F11E155CD4CAE305525BEA56B7C412A6260426407BD892A3F2B444AC3421E6 +FB6E6425EB5C3053C5644666B80405530FA0012B54557327C98E0F4F064099A6 +4ACAAFC1870359C1B6FBE7606BB8A26026AE20C212210449905E628AF1B20490 +8CE908B7EF3E3DB551C85AEB0F7FEB6A8D215B97998E5DD9C7CCFB2A9402B8B6 +1770D4023777D4B45A73F471355353412C51D4CE71FAD1E0AFBD87B5F86307F3 +10D0B94F1194EFFB64AD5DA54A4200490F609CA8B912E149F8217ABB1E9EBB3B +C4470E7365CF5E1E761AA1945044B225BD53D142F6588C50E0644740F7DD55E4 +8F73201E5354A8BC78339211AFC4935F44701FBA043AAC4BA4698E9D7700029A +C79F992F62627C91EB855F64C4B251718FDA71EDAF082A0C7B00550949D617A0 +7071FB14F05620CCF2180941341D8E60FC88823438FD728A4042AFA8B853107F +852F631518B61B234565291B5D5B89DA818DEE3AE3B68A2869DFA63255CC882C +3B16BBA08FCE3632E57FF7A07F857A1F0FDCADAB39D77960BD827CCC8661A997 +648BF5BEBC0FD2286C2A112A8DEB9CCB6330A049170D5D68EEEEA011D3EF3EBD +855236B9380087CBBB6BE24191F728B7EAC5B50F7A547AA0989B7C7D3437DBCE +1669341264E290646F2C8C5A3ACAAC7CB63DC692FAAE13E9B40E8BD39FE16A0C +1660CE66872D061056C04DDDC265C024BEF8B7E3C3AEE76FE5C9702002C28BE0 +B180295EE00E567FA2E5CD1638226D24A7C732E1BD8103B476EF5702768689C7 +D4FCD47F2AB94A2B1FBAE6ABF87B09E7713C773FB65CA83F7318035B332B9F99 +24A2C8897527021321D003AAD7C273E4BFA2710B9BB26C2CFD3D9A5D7ED1096C +552D50028AE2476FCD6D12A5D0A897521313ED1A3A8456A70C16EAA50A3E6733 +6DC89FEC56AB54A579EF264377A103939D5EE00A90B4F2206D0023AF9491FBE0 +800C6540FC945199E20E945F46CEEA2E885F6800B9DF042BCEF4291A4B1A62C8 +6A7ACFF872B25FA3AE69E0093F3D0FF13A3313430C06F1AF94D500431566F659 +E8C859A5F80F5BD2E85C8E32603D3745628E8FE6FBC50FA68F9C3811A2BEFEA4 +5852CAE2AE5AAD3230ED050593BAD0A9581EB7B327C6916B8FC348F4C23E6FA2 +00FA28AAACCB3091C1D83F7BB88672A53A2EA3B8C7C24374E400C57F0F01019F +E52D5C47F389D4C9AF126F4080F9AB8D1C8F470932BBECCEC72A9796F6E965A4 +82057DDB43D68298A00880D4C2E2496F26F015FD83C5549215753459310339B7 +6B2961EEEE74DA31FEC8E2BDDA42D4080A32372AC372524BDDA580EF6634ACE3 +128C69D04D890DCA337212B109585C665AA83EFE47D5BABC2627A86EAD11BF7D +744176652C7F9497785A7A06A994ED8414BBE8B26E74D48CB83FA24AAFBDD507 +84A90195EA3D77BCE8C2BEDDD1DC52E8164DF15D65B916EBDF3A8A76849653DF +AE3CAF9561AF3B705F75B9E5DFD6758DB65A2FD54683759912E0D0035CFBCD86 +5D239CDECAAD9AE5D95377E0D3F61C2AB7EC99ED28D2B4A7B6004A566B43CECF +7E35419EBC2A47CC76393F4778DA801EA75B4C1FC38062AA77CC4EF0E6CB0C81 +9A797C01F89BB58A957D3DAE33E4256B1F5A7D66C8989C512DA066D6DC771548 +F2DA3B490834E7B4CECD9293A5DD581A3171DB1C41F348377A602A2DDB80C0CD +7B960942967BF3983FCE91203F8C465362CA8E91B3C759943797C24CC83176CE +2D044CC07FCD6CF9DD7FCE413A0B2CF777529685866C7855509CD57489F07108 +D995887AEA9D20B3CDA77BCA95B6F655020E2964AD82AD77382DFF4903C68680 +2E49EDA9528B7D8F8724EADAB1EA2DE9F4DFDF29B22F885988C306058ED73421 +F9D738DBD7B92C3D31DE5E0367B7006F757508FCB5D653DAD14A8108292723E9 +740CEBBBBE4A72103663FE29397D8ADC9634CDB5E5E32533B70D1E617E255A4A +7A43966ED1B4286A4364A8CE71574F2DEA72E061762B22C960240AB5E7A530B8 +D23B99D098F7160C4C3C275A1F76EFF27D853689A023B80251004C69E46C9C22 +0B8A6645E492931996E6DEFAD9D535B58A149AA49FE620EF6A1B044111D83197 +1C4BA33E9FD206A7B97E69443C94B33B7844AA6061EF7555A6B9B15BFD37418C +A33E352E0FBA35589BACDEAAFEC6E0F31862296F17D9EB26257FCB0D067F0588 +09C206D19C54BC03C10FA55CD7B401C131720FEE80C43A6B22A55ECD147F2055 +02DC5F70D8D7A6DF940E23FDF870E2858CDBC2A330398275848E8C0FB114A5EF +5F29051B43DAA627DC0F82C0B510FEBFB2CAFF3EEE454AB8DB86BA2DBBE3551F +D75890D82B97F4E301E708AAC708CD1A121ADA6EF5A42E25D30D7D156363DCEF +D2F3B2510B57E77BFBCBF2B25ADF3D65CB26FB9078866AC4AC771A7D3C768886 +3BBEFC23C72C059694F342BADE4B4D44AF5DA32408DBA3FDE5447C987605106C +C743110373DC44C01A0943857B65649F842B3DF760298E06FF8C3B2BE9BF5AE0 +710FE262EDA172A99BDB52A72D6B97F77AEB83A29274A3A95A5267C76571E558 +45D6A333202E477F8C9D8D83343C2A4ED6F129B57E1C863719C78E93AEE0C3E3 +FD02867BCEBA37EBCDD9ED0E51410D1A7C631E41645ABB00DB7D8E1A7DB1E8EB +70DFFC60A122E75A3ECDAB8C35D3D7335B7BB6173763C2E6DABE6BFE61D89472 +54747CF9848901DD600662AA12441AB54292612529D4FE44D231A37C2B30EDB1 +5F6F26B07F49FE808092CCC3FEE0F077B54F9F4D4E3C74F6EA7D31A9607237EC +501BA49A25E227C13948A2CF353E06F07403A54AAA87272F02BA93AB25210B29 +969DCA901D341F32979E264B6DE0CEF2F4B3460DE636BF55E7669038BC928E7D +5BD178F38A7E12BF24C72F0459B715DD5462BA30DC94FF8DDE5F8D2B1B99B73F +FE4CC390E43D5D6EECF37CBF3618289C127530F18DF16ACA8A9FB59247A09592 +61F9098B705A620A1BC5F1D7555ED659E4BCCC5C9FC2850256D81DD966CAA090 +0CA009674D3973F49EF25B8AAB6BB4B94A8DB36BDFD9D4819A99C277EC2FAB34 +A27419BD71FA85AE08E368090C564C137154925E0997A8B1939437FC30A98B88 +135FEFC62A909B17BAB7EF4498694C0884FB66E05A789C7D02D6A7BFE3A1BAB6 +40B6E975BF8F27A17CC6DD0810A5BDEE22D46F9CEC8C9C314B9385B38796A11E +75988FF39EE14747AA1F2F0E516C5383632142E04AD651074A7F3802ECF1F83B +08390B1EAA4A855810E092ABAAA607148A575AD8D2AF4ED82E1BF056123ED813 +1724F0C8DF5E83AF8960B17260850FB1E3077451FD4A24570EA79346E291099E +F8CEB0036F32181F4A5475392B4B1F92B24D6DCFABE8DF63BF39D4B882FFE5D7 +E305A01C62012C74D05E250335E05CDD95E3BEFC41E38347AED4C28361B71099 +8E5EAE433D8A82CFB15547B339AF3763F80FFF9D966F224AA72C22207BCA2267 +52B21D219F4CA4073C22A09282A6548E39F81A1B9CE7B0C9B5084AD602C6D09F +64366DCD82EB357200FE6F7730D33F2434D3723E9062B80F9C42F94BE912BEE7 +DB29536FF3D44AD8BE18F768339FFF0B30D8837A7EC784289AAC88802D8A6676 +18E8EAF7A478B619BEC01F0F02BA88B641A70783EBF783503D10DF7E0496D555 +85857F83C7DCDD5063A973A1FD2E01CB1197193FF0BAB0ACAD5878D9BCBABDE5 +06E7C34B973ABEE28BFA1EE08169463B0ACC89FE1CE7674A16C12EC507852186 +21D6ACC2A5F5AF93BD71CFCDBB3E4C181949483D3BE38D9FB4119A2D85470B23 +530A3C8909EA116C408A6259DD5AAF149E7BCE785226D22E602C26A92D461E02 +44E94C1715FBB5E7858D751D678CDB0E126B29FE43F4E386F59741C8AA6C8514 +657257F3B2E6E1D93E3D0F425574B950C39FC891A11ADF59C4919F63087C8565 +540A13B1B222B7470C226ED0EA21719FD7F2FCCEBDB45452017B062F1A13123B +5F93555AE17909F1E6D0F354F69BCDDCAE66B94C4E8784313816CB845D60C41A +F2BAAA6328B638940AEFB136BDD45A63D826C9A7AF4B7CD42FB977B9C5AC5DCD +7B55814F388D53DEE781748911384F00CCF257E1D9C8D96EB1F0D7D130F97B84 +B724673F9F987F7F265666D7579B74A89BF7E10DFE0D83C2EF51C1591D52FEB2 +03B9D8B8CF17D4D4FE32588DD6081DD2A9A070AC2C4804FD5CF684091C9FB6AF +D08BF4AB51E0BA80940F032586E914D99974C0F253EFD5EDFADE0DE5C3A9CF9E +31A5957E58E0548FDA6BFE1884D3912E31F29268F3D39AC1DF97045842B3A766 +97E971167EEEBF6FA5FC5EB71BFB3BD711DDFFB86985E39FF37A4825EF86A360 +E4B226B8B7A6A8C33F0098E463C13CA7DC51343CED3D97E217175E4B090CCFEC +66B8FB90A3F08132EABB301087D3827FE4BE3E8DF9BF36A13C849871818F22E9 +EA2B4A7F9E36FAA769DA6F8208B93E281262B1B3007BE02098C2C1B4D6BB9659 +65340D601B5216F8376A3D4B66C6F3486086528F1797A71D958105794D5C02DF +D699C022576F3BEE0274AF096E6AA5FA0CB9D0F9531AD4DBFA09DF6028BC9E59 +75F9EDA5436145BF8491764D648400317F24EF161726D7B795E5A38ADF6BE64D +DCF4F21DDDADD10338F312598589458562225B821D495A7D142E84D845E20919 +BC4B213B9B1EC049A456713B75167152A1224398D9367A5A1C887049176A9927 +6C063552BCC124EE59E13BEE4C32CBD4459D6DACA1D9B7F40A300CA5EE262910 +AEF9BFBC35641653126DDB2383B335EE7C2D831CC0A06AFABA0531912151C159 +8E60B0F5488864A3665B80CF23FABAC0975AC9DD362F942D83D88D14073B6A68 +E2E7CC9833CEB8ED770066CEFC186D394878528C6309C02093E17D8FB4087A26 +559CB15DD770FB96259B8DB3162E8B212218CFF86E824640728C30BAA8F2CD14 +65858399B3196B7015B3DE566B2371332DBEE99F96A9357402A8F6E364E7DEB4 +78D0AF55B39FEF4FA60E24333DFDFC944CA814EF22886EE6CC549287BC2B7984 +AD28E3548D78CCC7CDC3B9FC053CC7EB1E20FDB037A49B6BB074FFD88A35A9F4 +EFAE6DF9FC51EA6842E90776546B4951045D2DA32B7D45D697B885947D5B483C +B71C442D6AB9AC4DC30C704DB5F73DF9C52D5B5B81D5A79129393BB96D0850FA +9A24B8AC04EDAE551CBE6850256432D76637366CE840F40C74BFF8EDEDE55A0E +07B4FA95DC5A5EAE303BCE03ADD82AE07D002658A0DA8CFA1F70D868D8512E28 +6650F9D324A1A1A64FA7712713793A30052F6E6DBBCB7F3008A7F1758ABAD3F5 +2A7374D8A30C44F79074D8415951A2CA2233C2DD6AA52AB5712244574C686E40 +9A276006A940369EA05DC567BCA5A85041460716AC5639564B52C3643143688A +EB2406164B8D3786C4A99BF55D0E2BE2041FCA042FA7629C60C3FE3395C95AB3 +FFB73CA52C105A9D1FBE3C6479895957EA1A3DBD9E4A3116AB050AAE9227D246 +B6104C8ED7C8A693E0A7E32F497C174DF9BE91E27568EDAAFE2C4E04BD3A7D2C +66DFF0C5C949E3727067B75412BBA5F4C43069CA82FE1C548CA122C68495658F +70B6AA82FC277B8C8778C3489674F4FC34F26EAE910639382A3C7935961348E0 +019098514081ECF5801F707118399A97B13E80AFA37DF1E1B1466434BA54C12E +C4376F52102C5D168DCAB4D2BA85C15D3DF633124911B7268A43A4998DB26AC3 +FB63CEE9BCA15C3E79BA0BAD29C80A5217DB264B507ADCA8EA3A46DD4B8C279E +79683CAD33AE57AE01AE6F6B88827E10091717EADDF63837F9B78EC6AE9D27D0 +CDA044635271DB42BA1DED5819737680932235381285E9D5704C4974326D938C +8083AC3CBED2CD94B6D773D43B188B1B0463891284605ECC3F69C5B70EADC1AD +2BD1C98E1984D0A36C21A544EA21794C5C8B91DF35E8B139335A5EA1C2762CE5 +67BC30C8F7B8367C83E40DAE20AFCCC814693B2B1610B7BA611473A61AFE20C3 +082BF0AB3CFF49CC1894D1E720912B5141CD5ADC34F389195A6998F4A695C857 +DA917E5ADDEDFE17B3E56C7D546C08C1F13D63956A3EED9FCC7110CCAF707F5F +96413EFABC517A28B5A405444331283F4709A3715D133CD0A304CF4B01D1C90B +BA5E1E790C0C2F79F7B82914EFED54AA099902C44C0B3AA11CC95854D43C06D3 +A8ADA3253E9BE7B79FB0353AE4F4350D66D8186845E4D8BA3842A470E51CD408 +3DCF8DA296BFF0B68467A8A91B21E7481D1F9A4FFF39D7069756AC018A4EFB3C +EA645D6F27E36112A112711C80E7A4D2D6FBF547350199017B180CBA993AE8A4 +1334EA4974D644065DCCC984DCDF0762B8FA187880ADF6A3E270A056AB127383 +6EF745C224DE155F5DE2BABDEF4E266D08EAC680062C7BE3F0429433B952FF4A +473F1A3C89DD490C26B20D4655756207C014E19F829AB6C3EBCEBC503589A5C3 +B296EA02555D0E7BF81FE43DF1DE0B326023E499DC7B3C9C3193A9DEA9AADC76 +78A9EBA6F80969CFB88BFBAB5BBC075935FDA2426132691E10A22AAE4650EA96 +5E6E945DC97213D5D2326E1BF40E7FE71B749132C52616AFBEBFFDD14AFB562B +B02870F0402F90D77A5059F8CA111F3EA231BDA487A058C2195BDEF139B66AB1 +CDE981109406006F997B0A3AC8D078ECEA4D776ED6BA1FCDD8C65413C632BBEF +E91FE13EE07474424233B18BFCCA1E1B96DBA6654C52D162A245325E8CE7463C +28B666F7D0CAE7210991641792C02A29DB2EE7491152BC4168EE75D17348E145 +54411F254F476B24B4854B724673088F46A76E30FACC61BB9C4E087808A33658 +56F29A7F3AEA8B4E0F4B64048723163C213CF1FE485A22A62A90DF3FEBFA5ACD +691B257E14EDC09A40CDBC61AFE611F79687C96F11EB86ABFF1D0ED0E66C97ED +CDF2EAAFB6D21B88A490F9D9D8B2A1515E59B2D84556E012C4A0C48494DA3208 +21B11E6D0EF557E8A4694693C3B88E6D1B6236F494FC8E3EB0D1FA5F17CD5BD4 +C1DD33E3E620B3DD54EBDCB938BFEEF29972BA261D51EB7B12E77728CFB4CE6C +DDB4BAA9EB667C68CF7CDBBC762DCFABB138F65ACB9C78A0BD8BA5982693EF7F +3B00C5DAE781B9E6989154C2A3E4BF4771DCF0336B7D3C5B31FE67E04AFD7BAC +8EFD4E0B2F9BCC296985DB5A815E65C4988F5E22BB066C0072EBE3165AF0F1ED +AD9E696ADA95C71AB98E3F7D68F2894DBA4765258F3B4A661783319388D25677 +A734F2E4721E7B00F61A28A899EEADBB42EE23F66FE4BC7A1A1EDA66036063A5 +165F6E83566500EAA816CEFA552576A0BE65B8B54FEAC2DA08351FA299880DEB +5CF8A4293092289A35FEC9461EB1C085225269F0F0983FF7C88CC36C062EE403 +2688680A2F2F67FB912232CB0CB9E4FA1E8FE0EE6A8E814323BF5CF06EE7EA2E +8EAE238B2A4F9FE5E3DEF0C00204CE6DAF2DE57007DED66EDB4AE1CA0B70351A +C276CE621787C5E44512E113D964FB902226843B491217D19A8FFE1A0A7948B3 +CFC484E2E55BB05E47963998036D6ABD689242ECB6A69A2949E1CE38FD313603 +0B04803D9E40357D4C34DAC66B3C3288E26D4F4D2219975326D1C6BF7946E6AD +9E5FDAC496056D688E88B0244300F8AD3BB16CB35FF8913C1D6B43811F4F02F4 +0BAF0C374299531EF6CE83521DC86F4EEB2E7AE33B656660A352D2845AA24744 +59629DC694593114B3BCB523FB664A0E733A415521D5A2900515B0F9D6772103 +72C31867B2719043CEE0164DCCF5535482E7D69906BFCCB14A925283002F57FB +67B057C576FD2A1652ED9130D35000EA53EA390CC69E4676E07FC27032E69A65 +5829149B046EB420DECFA5D79A9AE142FE597536844D9168931A4B7D54FBE12A +9F31BA3B06039E2D401129E1BBA99ECD2EA450B7682B16D22A6A81C6B9B19498 +03066A38B226FB7E3285CB1DB3B382D446D213258D7AC3AF013F57D635E7A194 +D83F7B1C70495F5F7578DF11C20F1824889CEFC4299DBCD3D2746F38406BDEC3 +B3E861CE4585B0C253437E34772CF87526FC7E9D337D50795BD5A39D5CD9D9B2 +35EF1988D542D6AE8A0FE71CC525F5E1ED60C55496F786D3AF3099C627D55368 +5EA60B47A111CF65FA91B0A9B27B9B609B77BDD8D1959D8FD7543DF5A28827ED +04213C80A8246075F9CFE10CD91CA87014A2C697A1A3579DA76B21E91BE892DE +12D8238DD55255382B2FED9EF9FAD03E43B5E7B0406F524F09D1B64A14FF68B2 +F49182BD10A02FDD74AC118E967B6A5734B87D3C5A9EBCE230EAC963AA4CA566 +54109F0C0497B4A122CA635632D4CF9CB9086D116D56B7AB4C1BF073B3B11B6B +4FB0E908516986FA19159165321637D3D6E51DB8411B6A2A6DC77510855EFFEE +AAE53EB8D900556CB83DCE11544D92C06A9CFEE6A2BFF28388C1334CBA61F17A +69C287854820A3F18E57DE29D88BF3A789E26C805D8D133D3ACD3D3698C937AF +D36FC3C23A20D51FFD18EF4EBBC494D33DC06CEB87F51D44567F7B7F726F6F57 +28FA0CD9DE455E90CAFDA054B493159863BE13D374CDFD058C72947CDAA0169B +6A38F6E8D6FB118B470FF17570EA12CB82AEAA3E0561B361C7156BC8DB734B80 +ADFCA2F515FE63A9389264C96B446261DDACDE915C807C3F10F87511F489EED3 +29B251D4D1D94E3F0A9F2FF875E67D33CF5CC7AC65781CA521AC90F70A9AE8AB +23197123FA543894A4C8D9CFFC0891C6B9190E9AFDC3C325E69FB384BB8145D7 +F6538C6D8BD58873935B7A1F86DB97ED76C452DA5D102DAA7AC196F9BF08B7AF +CFEE6443F3483165FF58DAEA7D6118685B1D4AF52095EBD880D22E22C9808DAA +7132563E8E0C98F575C713233ECE9400B0FEC4762939200ACE9E062E09C4B4D7 +9A8A1F73A7F34A49D193D0D7AC6F8DED574F41D031477886218C7AAE33035DE1 +F245B484E33B60C6526571E4C00C6DD4594523FC00C4678B4DE0C4C404C42643 +3090ED4D957DFE9D16C0F62812E2649742A781C6FC0394041B1F969BA7028EE7 +63A566B0A918B970F0D7557BD333B9C2160119B11DEECB6822BBFEE2AF6865E7 +1C7F68571DD961B1FF5CD6090C8A6B017DA5F28CF6190B82EA274A40CA5049BF +DFB31E343D66A654FD6C303D5AB0DF27BD69136935A796B7B9E0DB920F98F863 +4AFC87C91A92657B954A2EB32E48F42E25735D06E7BD18B2A6179D0AEC51D744 +F5716E7F511B4D1211FA5A4835191B90284CB266AEA535BC08C7407A971BF4CC +118FF03E155057C7F103F98661FD24A8DF4CFE3D7FD2EE742000CD208ABF3CD0 +6C338692BE626F15DEC6EF47B3EE5B5FD0A9E3CC204282C1418C66C90D4A7E76 +DAEF4C18B94B97FBAB2CED03C9515EC59DBAF996001D98ABA2A883C359070DF8 +4F14DD7B14EA8ED93D2A4AA3A08D5316C27C5142C3D5AFDEC78C19D34FB4E575 +E03FC2E2598A025A9CA12CDC3AC8E10A04702D59BEFA03252A86CC98001B381F +F0A187EBB5B689CD28CBB3EDA69247EA11212BEEF8EFC4D9F3DCFA7F8360119F +C472020CE0CE88850780FC6282B165419A50AAC89A7B1BF752501E3577BB1532 +B540D086B93B8485E9D91A084E57E01E517A1A3B293D83980EC627B658183E68 +D1889C33E30708C97FDE3CDBCD9ED005AE8549CD2F27921A304239E2E3F2C855 +DD1A2E400C260D73397185AF27E4233D096E02B42CDE4BEB9898C3BDEC370CCA +A5601C79207D4504AFAD95333EEF160A4F7911B03C1A7DA24331DDB505AF9239 +1ABA7A58350D40245D1480E434995228E472B61FAC1FE4B15C21EB95E6338FF5 +D417EA42F2B792F38BB8298218EC385A6B07D07F27A5FC146EFF01132012DE2E +4B351C890B51202FBEBF9B4A1074B23DAA01EE03C0883A1C619EA11C9983C031 +C8ED533D5628FEC4DED67CABF6622FEBF78C0D8A381197200314854CCE5B53A1 +53D32423EE5E608F4D8158AD4BF859FBA5A1019E60C80D6C092B61C0CB0B56F6 +B49934846760A994CA10F12ED6C21A4B818167561241E219423DD4E9EC93299F +DC85F0469B6C51EBDACDCFC7AA3C15EECF68C06A4C4E53CDE9F8D9BE365604E5 +C58BF736E17B8C982B8395B16C92DAF3341F2925BBCDA738724682212186BA3E +48C9A72A403F06A88FFF84C46C1142BA6AB012FD04EE1A337184F879B54BDE11 +9372344A8883EBEB6651C93F530534947F3E7DBEE7D02B86B8C44D9F748D1063 +C9BB49F5AB56C549D596DA6374B7F67C32B98AA1418B4D7B3913F4DE025D45CC +18F1C2B3088B7EBC6E057334EEA2210BA967E3251132304B839F038663996DC8 +7E92D86A865060622A95772B779F6B2251FB9D565866B13F2B9D345D8BA78E14 +872FEBCBC52CDFDEFEE2F9A6E7C391DD5E213BD9FB28E49050542E5104B241A8 +04524F3FDDBBDE4084878008775BE9A7FABAA974053E13E3851DE2BB293A0A6D +6386E062E4567DAD1E9672C1791085D15A0A6B5A0B03594DB0C82BC7893B3F38 +E5826B36D9FF014331D743D5DE872C09059EAC084DDE601432ACDFC88B8624A4 +8C1E9A7FBCAF1D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMBX12 +%!PS-AdobeFont-1.0: CMBX12 003.002 +%%Title: CMBX12 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMBX12. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMBX12 known{/CMBX12 findfont dup/UniqueID known{dup +/UniqueID get 5000769 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMBX12 def +/FontBBox {-53 -251 1139 750 }readonly def +/UniqueID 5000769 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMBX12.) readonly def +/FullName (CMBX12) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Bold) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 12 /fi put +dup 44 /comma put +dup 45 /hyphen put +dup 46 /period put +dup 48 /zero put +dup 49 /one put +dup 50 /two put +dup 51 /three put +dup 52 /four put +dup 53 /five put +dup 54 /six put +dup 55 /seven put +dup 56 /eight put +dup 57 /nine put +dup 58 /colon put +dup 65 /A put +dup 66 /B put +dup 67 /C put +dup 70 /F put +dup 71 /G put +dup 72 /H put +dup 73 /I put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 79 /O put +dup 80 /P put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 86 /V put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 120 /x put +dup 122 /z put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2D43A151FEE81296FBE +0CF37DF6A338C826464BA5198991445EC4BE80971DB687336AE8F74B516E333D +2D8AB74D362C559AAE6ACFAE49AEEF4F52E28C869222C1301D041E7A0BC1B608 +1BF728EF9E98F3A12EB2714E7F16B14E055FE1FA0EEFB058860ACADEDA9D0E4C +42E3C6F1E4869471BFAA3760175F3FBD842755A9D7847EBF605F18293B42F557 +FBE2715002669091BB033E1AAD657532F34F7C66E4F04D63ABB07E6CB9D9AEAE +78EDE8B79DD9BC87A1FF445EAA05B5572BB880E69F4DE1F82D7F0E9980AB0C18 +22C448B0B1722D3CC33C56FF287CECB80658B3AF5E7675BE82CEFF3DAD5942EE +A03C955FF979E41E54BCFB5316A9AB8945C403A73180D0961416EC9C92F49811 +4B91BC4C788392994587517718521E416D469F69952149FF7F9224377EBA1065 +4A727BF806A112A7B45B0A1BA1D5A23683960575368D9EAC8C04753BF7465AF7 +95F25C258C63E4FDFFD0B412FD381946AA38C0B961652BCEC30322C47BF4755D +9F91880688AF066E32FFB22E1A52DE741307AD3ED830D6BAA1D1F562919666DC +5E8FD9862AC8600B0AE0BC7FC779252AAC57248744ACC8A8AAFA836BCF09B0DF +9253DFBB1CB77EA8A59D42D1B18FF25E9AED72FA62FEC3F126F030F5D7DED9C3 +CF60FE890BA4A48E39E687BFFAEAB96AE542A6387F6624486037C8924002A511 +BEE5FBFD780AC1D4BEC3FBC47A930BAD0280D444259528B6C565DE11DE36BB65 +9BADC55C1EDA1A80458E98896D782DFB5C137897419602809F9BF8CA39F00C68 +EFB9E076FB324C2963F23CBFED28B9EF70EAA4E4B903225D1F199A7162AB239A +D92D71C18B1B682D04C6A48926275BCB16D413B2A0E953E1257E0B12D8B717CE +2EC84CFBC046A4338A69F454A469B12118E562B4F56C5FFB3CA5D357513E6FFE +947A564B229C7FD873057D5C7CDF03E958294A1003B37D8DF565A70A00A3734B +0138AE5277D383D10C2BD853EF806D3CCDC47739F0E374A3DF3B63638B949ED6 +4EC25869DC1C0B1F4DBDFFCC97382841D8F10F3635C792139A1EC462FDBA379C +BE0990CA2E70FE73137AFBBF30CA54954D7E7377CC50BDD780DDD4C7FDC77AD2 +F3EB1169F14A0041F18160F43C24FAF556DB5D621709FBC544CE55424F7446D4 +6AC07A51C8CD5161AB0AD5084A96FB35D77F1CA155147DEF8D7A590EA6939514 +D4A226588295CE0007BA8A550895511C8D80BBE5CDFB8A50D249C3BDCA974415 +F5557914A9B805782F399E4078DDB6264F1A49A9A5BA45E284A5196E9828EBA8 +481D357B8D9E6ECA631A6204439FDFACE7D7E6A2392726107CB7D2517CD19A24 +FBE592C119626DB221BBB635B6EB84845C16A9585282E34958B961F4A543AF9D +419B6A9105BF185FC767712D923437BE08A9C0EB92AB6792DBDC671029B6FCA6 +7F717FCE379C0F3B51C6CF042A762ED04898FBB4B0105C3C4ADDDC18C51BAA3B +70A93666669547081D9246732CFF74C83EE90DA17F5B4F8BAF47FE4D81590988 +2858C9B96071341FA0A0D23BDD4947FC9BC2297913CFBD4FD6CA4303AB3179AE +0203F1BD502065F90CE9BEA3B52DAFE4A29446082EA0E6B1D7AF1F31D0AD02CC +9A7FACE2CA86E5FE0F6A425B28A5940ECA306891CECDB3CFC7A5BBC76B5D9E8A +C754379ADE80B4D72CE493010317BF21A0CF4A0A55C1246218839DCA3F4D626D +1F4161D38F54AD5142C1CEE95C61D8BB10FAD4B772F4955777AFDE8AE5A837C2 +A2BBB11D0BF5DA2E63D0B75ED421DBA9C789B281B01846B65DC572BA69591969 +21265DB722AE86BD8CAA3D887C975A617ACEDDFB7AAB341F47532AC0F354A530 +7662C089DA3939588774FFA16FC4A52555DED6D6F51DE718BF5F345C23C90198 +17B77CB8B5D53A5CE7A79F3E286B6A59F3F6178AC8BF15C0A15C1A8A95D03B60 +30EBE53DE328CE085CD9A1D49C69AA299C5B58B24334A546F6E274C1B534DC8F +3289553F560C2F81E413ADB92FA0E7DD1C2F39D5FD268EBA97AB7335ECF28257 +96B4EADB7D0778706CB41C7E9C882760E7670936774A1088FFB2011115FDADB3 +B69EBD5108760762521C25C968C3E282DC3400001AC8FB1EA27FF643E3025950 +1D617BB8BB321281708E496277E11DD3AE0023DA9F25AD06B39C7CF527FED27B +57397E88D3DF70EE4FCCEFC8A0927D6B05517E571B3E70ECC99F3CBA32CCD4DE +B8BF22626B6C94FE65598A88AB90D238461EBD9A098DADEA4091AF1CDD7560EC +8E1B9BC2321686E1759E6B8A270C8CB4A254F7368039602EAEAB86ED21CDED91 +8F2DB9889F46981C494C7EAF5E819B91C129F0740B8002B510014985E5791F59 +B16879CC6521D8E9F1C4C1890AC85A78022BE614BEFF318AB2616F0C3F02405E +BB425D1555472A2642BA7686E431DC3FB8A1688B76660D9957C3FDE8D58109AC +21B1234C9DDF3F0FAF93BCF7B2F88A001F23162E1A13E5E9118D51B485B70A91 +D0CBC39CF44413FD8686D9030782DAB58064F5B987E0402AF5B264B17BD31BD4 +FDF63951BECD73ACA6138854EF35B062D01F33073850D9C09A818828C581241F +A625AB3638081DD0F00F946BE5450D38489CECEA4E66B4D85CC8AE0157E2AEE4 +A22A9313829F24D573101D84CC1784D1CED7DFAD5DD966601370C6CCBB723082 +A86BBAF0A5D867D0D2E3CA16E14E5109A29EF02649C47E12E88B3B397D65CACA +DEB9940B92100744D686066F8250FF30E5F13D81428EE238A2E4E07ACE0F5C38 +7D79D4A336D0D26AF9C2B84088ED8ECDF94A1E3FADB45AFDAB46CAD6FF950B0F +07AA2CDF82374DA76C56D29C80138841EB13F0D02ADD32F88B23E282ECC845F9 +BB9AAECE9CDC644AC2D49577A92307A83A99434F6493156DF25DBF0FCF2EC21E +8C50A312C3D19E0609C0038554CF4FEF3ACEB7A833FD54B06EF0D617C2971C89 +E4C06075B09B84A4F78A82152B9A9C540B1D881313C2C74F20ED064A9606EC2C +B56D7BB4797F1EEF4A9B13579CCF311FA4A4DFA62D80FDB7F535CC6526D1AAE5 +45C008EAF024B48C377522F74D939A475970533E645B1BFA81997549AFF26F67 +2AAE6C2EFA357DB3B525276EF330905688777057F4E4CBF584520A534A8587E5 +5A8360891E75A15205E8ADAC4A4E5A6E27D0C4A7D492216E4BC023AB027F37AF +A8DC7579BA50204D5F45A51460C5BD8A5A7F87668CA6451137F2F59E117BBE28 +5C40820882A5546FA76F0CF49F8A6EC445F0647CC3227C400F56E7E9B84A6975 +E85E243CC1666DBAFF4E07EEAF3AF71BDACB30DAEA792F2B8504CAB071544F01 +5D66243D529C479D276FE22F7E275D9E7FA9C6EECA18716B2F213916E32C1D94 +6E32397B41AC6779543218E506569E3544803BBF9B404A983EBA62A494187B30 +8D3DFA4E1237A2E5E08224A60492C09ADAD8775B7CDB830520829BA164209ACB +BCDEB2D574CEBFB7AE4BE72DF4EB1945FEF2458761AD8DCC0D378AEB7DA002C6 +9C14A665DAAA532B0ABA98D7BFB5A6151FF6703385AF7AE8FD315A492FCCDBCB +B825707F9566B3B4943A3C61C3DEFDC31A843A2D67AB06891F3E110DD8C73D3B +B5E4151B51D9F13905D7D94DB9ABBFCAF35F43B6EEE256B1A80ED6D1739D8D5E +8C767F6F0E8704C5345D028A2A6DAFD9BB7AA048B8B895FE9423A7ACE858BADD +595CB074A128DAFE08FDFFD6BDAC0114159A702FDCBF8013804B0CAEAD7AF38E +FAF086A3248AD4FCA1401A85AE2F72E3E6956DC0996FE8ADB18F89B14A208A15 +13F81AF73D0DB72F78C4DA634ADE3C73756CAE6AF2E149C26316DFD93370BE1A +FB4A79F77A67C07CB0A53C78367F21661D4AFE9E27328E077B522B50FD9AE2E3 +DA087BE481515B5DD7BF894A96A84A6C78874100505B7DDE1D22EFCE8D58B3AB +313AB5495F72E2CA4E6AE22C0CB854302B9990372F1661D9F0A517F90686F248 +C5643008B3D29F7296E5C8FD4049886662EFDD4106E17C879F5D41CE84F87E89 +F6A3117C968B95A35940CC29C43E1E0DEF51C1E46B676301F40D59615C3F73DD +DE37B72FF7105DB84227DA5241583272AB1C3CD97AE11C1EE98FFDB5E5F44844 +8FC41BEA5C54B26341AFF6830D9D0A5A2901B0653D8BD0746838194D240FF753 +E99750D3383373F453723D86BE97B571B8B84D8696089B5CFDD53E6C562A2197 +A8C4FB0CC690C27761A816B441029D3D306245052E0C41B53025D8CB7267CFE3 +C17FDFE348E765326F91AEB700CC49162DF748171214252CBC821493DD01AA20 +417D66DF47EBEFFF3E9BB2B0A2BE7D9B8C68BD570FC2EB0FA54CECC318F04C43 +19598BDE93F2F13DC7847354C99059AB20593EE51E94F9D4E9241869D605AAF4 +9D9B5FD88C3798A039A67993C5EC68B6326B132E647F67EACCA7F7AE7F718D85 +12666E90D7C73EF210E344964A38228B236679A2B18F5E081234CAA2458F8D83 +3F0CA308D19663CB12EB904076EF88E556407C33C9380A6A3D68A9EFE65387C1 +A1BCD2D26DFD2AC0881EC30E81C0A4E76C244A2BD822EE88C4A60B480D107E68 +90E419A1F512E865BA922A7830909BC2611A80931CB2E9344529586726614D94 +3AC5200FB9FF68AD9686506C5EFA8788C0AD0251AFE7F95E84683380CDB421C5 +B1A783B6D5F3A6BD1BC1C14B363DB01C87C0796DCDD5BECF41A1A9F43183CF6B +82C2AE49F0BFDC5DEF7729F2E638EE6EA9E4D059EB9BB1B992AD8C82D501A550 +1BF73CBBFE740179B54E193E84A55DCD61B343C1852780FFB44248FC9426AC94 +AA2B3FE20FBA30F6C4D1E0FF3EDCDD8C0F57CCB50CDB0EFE2E04A8927E239C1D +9B026C7929BB48461D4D695FFC766C8A0E545B1BCC2AA068D1865333108E7985 +2D93F9B00EA0A90939D0D3840D59B6CC0CE2C147B2E1A9A4F14270FE3ACF51D5 +99F7349106165AD627CBBB0ABA01ECC6D3A14C1DC1ED23A9DB9865BB4396C51A +31ECD001EAC94B33C34E29C5611148EF3E55DD61813470B8F3CE32564C749414 +3C93C77EA5A3538A0B5AE3FC4DA32813B06772E0E48E25BB39F3F6FDCC077E86 +F86FA50E18FD19EB2F37311CE87F18F3BC85CE7FD71CA92D5C3264E34E04A2E5 +70C79D99F54D6C6D9D527AE45EBB48411221134587D2253E7C8ED7658EDCA34E +5E768DD14E0200470F73C44D006CE8CB35DE1CA3EC10ADC668B0662A7774C891 +84EC95A31DD872F0728D9F65CA80940080E04630BE4DEC77A2C49E3913C39978 +BF145F8832AF2C4385EBCDB15F9D32C22CBA0CF950877717D6F1591D7C0B8047 +8C9BFCB16AF7124ED83137695F3D69228DB633053208C29E0ABA1B06A7FB3EE7 +5625CB44927E2DA6E038A6E62DEBDA2D96A03177982D8FA33BAAF4426E05F4B7 +9C1748B3FF7691F9888E7FF864A10B9DF761A41E6B5CFAD2BDD7E1C4924AC97B +F4B352705316DD1A58637CC12D71C18A5CA691AB2AA8F171590EC24582B1123E +94D4DC587D8F99E18A711776BF4013C96446BFECFEE4C809EA94B169088024DE +0CBD20199A915AA406F0BD5F3D63D1467C49B4691AEBBB35ED6624F2D7BB74BC +E80FD92B9FD04DD9C2BE9B6FD29EC7EC07FAB447511C61DD299C783BC09AE2A4 +7B3CBCA6A20C6631D06D0B2E2482A50612BB7C29B7E7D0A205EB0E8436702581 +596BC996ABD58CD8D5BAAE4B1478195CAFF98FE0141287296C4EFB8D2E7A8442 +F0A3AA9F9264329982532295A176BA1867EF732BBAC49AF485D9D0F7130F617E +7F7DEEF935874D55A22240F8EDE4F247D5F73481373A392D40A8076BD91079E1 +1CE5998BA13D48D56B49A92B4A18430E316405D2E2E391B496A1934671FF1785 +AF42BA3B2D14B8E04014437FD194455C50289DFBA61B5C377BCBDADA48E82DEE +4E70EF5E9DC03064907BCB8BE4D59DE069FB0C0CB140DA54708E630767313F9F +744594AD8A499CFEF733E640A11FD74E46A749F9C7D18D49251BF85C6EB4668D +67598C31A8F90922FEAEAD4B83B6E7184567DC798E4BA1C4C9B3461A478D63CA +054F13B502DACB674EB49D6BB935E5EC82BF99FDA7D47C581AD7F940DF4FC6FA +6C6D25D647033AC69505F0CAC58DE99087F365531A6283CB89CB644688963C3B +8B2203A94294E58739EF23C7803630A1F9121D62BE1977DE2F41687C8CAF87FE +CBD7AD3B98E0D95C8C6E1A7CCB0E09465AA874DC90A0F5DB2C5E7C130297FD39 +EFE63B0350B5139D09E6864D22C3F1150B29196E40EEF9723E71158B7ECFB8E4 +C426FEDCD439420B7F1C251FADA347C9A2C49738B5A17922E1EA93CA7B125B76 +57449EAA9C1D591CAD327D0E98EF2D44D614EE9ED49DD31ACAC0B956620B6BA5 +5BF6D08CA7541059D5ED2EF00AE2EE95488F5645BF6837D9241C0D3959B7580F +C9ECB2BCF3E65C07D52EC9CFB21C11CD4C883E44C173214C900C44D2E1E43DD1 +CE8DFE3DA93C38B548BC4EC46FF91F30CFB97525E1FD4E77686433B20BABF8D2 +848C1CDF1BCF185CFD7A81D2D4BB826E837E2AF35CFC4F419F698DB0C43E9F9C +B0FB628AC9A3CBE9B1FF4A067016E70333E78B32AB2D89C483834B31F5808FDB +77492E099F1504DABCA5722C7860CDCEDB2DDEB512FFCC7D287F4945FD711F28 +87BC3D36173566B81FC2C1290C717A09697DAC6072408E20926D39270121CE58 +3EF97CE12EDD7F87F2C8CFE36C3C0400869C0D813B71C425343EE0CDF717BDD8 +409D5297D0F8F7FDEB0257C0A391F5635E0DB1116058942FF3E7C94D5F2873A7 +A3B0ADAFC3835AF2BE474E6741319BC6695FB37F59AEE388F81F6E66F910000B +72E6BA7531B4378CEFEEDC79CCF4947BA1703823B5AB4F4AD73D9615C66C489D +99D68E49C9BF765B7FC547BAB9640D51D5A7A2396507AB5A4DFF3D14F52422CD +8FCFEAA06A56C6C7FFCD29C9A7A59DDD2A909A9363FE5F1E9629616D25ED38CB +E754C059E4379318CC491C3B1A90128693AC53F80F8210FAEA7EE638902A7D3C +82B95B3F5AE340EC1B648DBB9FB679D6E80B7F426D8671FE7136D97F51E2D2F3 +C9CE9183E4061CA40091A2A70DBB9ECBB19CE3F65ADD0FB346B54BAB182E2CD0 +EAF4C0F402C25573FB344EA771B297BEB615FCD0595172E84ED2A62FF8962634 +23C19076C2A9ECEED5135994EB397303A9619C76DC55E032DA83FBA441BD484A +59F70A5110A8927F6239A14D4E223E189A5462E4A92EAEFFA4B961A2A32B320F +C2B4E8C1821FA67A655B5042C15E4DE1FB3652B55078DB123573C4E986B19DB0 +1C5131F3DFAB271C30A5476B4A19D8FC922E31879C34BAED94C07A4841B8209C +403369FB8E842610D1EB4662B6171A4465FD0E819964F62EC5B0ADC92F08CF90 +1DE0B410FFBAD16F6D355E8AD72CCF67961EDB6CDA82398021007C2D0462E893 +75EB0710AE4A6CDD15077C9DEFC5774EF4A657734D703CE42174259B58E5277E +0DF26BF59AF8D1A3E7DC12E3C12AA4B67CF35B19962F6950C2020B698D971B35 +82FF84E72F72FBB0C54A112BADBAE6C4CAA358BDE6A705AB59332C3850CA3D25 +C7564499BC1319121CE0D93218210C68080AFF33420E3CB3A48BF9EB66BC07C8 +A79D8CD8E78C200FF7CFA3DAED0B9E87E6141C88B436D8FCBA50AC195FCBB9BC +9512B95FE3A37FFAAB39850FCEBD4D50A243EA416E73F53B4B00F3B6EAE0CA06 +0693AFFEF215D00BFCAD02E45496D7C8F5E99EB9096FC4300D038C1AFD31EC4C +5ACA6B72C1BE7204E37A4CBBCB1EC26AB87F2FF82DE20601025169A5FBD2D060 +62B5B2DBC288C79C33B596832AA18D730AD572C6EDFABCBD36DEA87C0F323C3D +6E537AD3B43C6F3A905597570A8C6B0B4A5E08C08EAFF9731E745F2BA8ED0C0E +1ADF7821CFCD4E38F3F4C243CAD31D9F8FC68B9043740852B4CCBDD37BF728E5 +648215961FA82A0C847ADCC5187331D0863A4573BE520C02CAE14AED4F06B3F1 +FB4A318AB54CD86DEC824707B29F858FD726A167F2333855C0575EAF4EBEA0B6 +754B1775F967140641FC06F82B191244186FF347A351FBD8FA62E8C978B21F6A +E124929876488AFA97FAD262BE3D172E2F03F564F1325C9F1E050C83C12E0CE3 +C7F58270B5C40B46B3F592FB41FFB7F59EBD69B2F489441E398FEF7F84C85055 +531D95FD21629B0E509C2FCEE995D025BAD5D3F28CDBA5CD414405ACBD936C3F +AA4CB2620D7426002161F983AE95E542EB8553AFF7E57B82E05FDD5FC433E1DB +BBCFFB1ED92299DB0291CAB10A84529B7FE279C62628A24A2FC36B01976E13A9 +C528A198B8EC8654AD69CCB5C209964A2B25D6DA9BA0FFB366D19D8C69701D7E +8ECBEA88569601C80ACCC2D5487DDBDC27DC463A53A8E59F9EC17D0ECB7D2188 +B6CEC6BBCEE631DBB9959A9855B997481B5D88B8BA29995053CF42C5518A3E8C +AD21553A0F6BC3483624B013D3537F7C85D7C558A9C772554CFC1C3FE7A70633 +318A9B36CD66A852C97D66F868404CF523DFD349415173DECE3244FB63960982 +1BD121F361A03B2A4D85B0A185FA04CDA4E763616A23B151E8D4F7D855C44821 +464268156055F9D5A2E5C1D7FC0D3F6AC5B356C8DFFE5D44D471C85030239E37 +A678AA0B9A0E3FF2A13531E702385903FAE6884F4308C43A24A010184ED5EE00 +D2A0DBC05FF886D1E8006E879386F5C2D6FDA1F5E92697AB96555A9BE7A8B7E5 +5E7B3AAE6BD5AC783A9F6D07900AF3A0D9B105742B570AAD09626B489E9A72AC +E3E657C95BD54BFD7A3256E816CC6E918927C0C87D7D15AC4F1C8520C6D74262 +F2A4A6EE6999CBDD0013A68ADD14379CD52B0FE9445DE53E2C712E30D1B3629C +B2BCD776E3D66A28E07559DC5E24998CD56A8BADA036685FBCD665C6CAE8CD12 +01A0F543FD9B42A8D53BC3972D2A2A52B08F7B619F156B51349300B0101FD048 +099DF8E4DE595E48252861996D61AEDC2CD422F930A8122E254785853B410BD3 +C4A204BFE283956455C903763298A225F848E8EF8646B9B94A8121B59EB5BF7E +5CF1C6CDFE4C694558B289FFC958E1D077DED5AD4F4E3D70EE1CDB067C4D66D2 +92B1DEED1D01D27AFD8A600F088414D899FA732104CDFAD164DE6128C23983A5 +B5A067D9A005A5A9FBE73D93A6B569505AFD9F86253ADB37FA3BA20ECE3BDA42 +8BDB9E93586D4C686DAA6AD4A25A957B96E433393B2DFB40C45362941189028D +84F7231AB0A771C92A2176123030B2834DB77313301589AAAF9E5C901FF3481F +BFAC467D153A669474368D9814A4B2C3F1AE55395E32F026EDA822393AB76AC8 +93C3FEC444D884979ABE626D9B3B8256CA6B87EECF7B98941154422AE3366CD1 +6105E69C0D3665F7A393C0C84D36A37318EAF70042D327E7D6756E1C5F35BA25 +9AE3815211D78B1FD6AF63CA9A06E4BD6EB20BA56FB1DDCAA3C53BF7C182B741 +26ECEA5D812E9F2A8BCB737367D8E2170AD12741E5355A4AFF29745AE13CDC01 +3D738B15E7A4587A15AA367C3423AFF9AD93A863D72BD9F80C977023293D7A77 +168E8977CDA91902B86C72169517A055322EAB08C1C73EE63F92F0301C136C64 +A762E8DA284DB0BC3AF5010FE623B63C0BE3820C4948CEA9B49E6BC18A51A6B6 +D26B3B059C81E6C315727AB5C678F2B4A150C75BA472C5F29A744C457B1162C1 +80FC098B9648EB1C83FD02EB2F7CEE4043CD41D1D55424E93767B2B601F94872 +EA15694B1A9267724DA64C9D4F6682CB82E25DCEADE2A042E079D8D11FB10DC1 +68A7B5C968431C68D58E3C32620FF1CD06B2D4709F911C64AE938E3ED20EBC0B +F317CC54ACC87A30F86DB296145BCD6719F4D0A8AEF6671A20FBE4BF8BB8BF01 +AD93F28484A79BC1B3CC41CA2939ECFB39C9B540B43A28BFD3B625C2C061B698 +9B645B2BAFCC16B5F31089BBFBE10420F2264318200255447B4A5FBD2DC38322 +24FF292769FE69E418854619A6F146E0F85CB4AD18D3185234A08D56B5EE6A49 +511D4725810BD741418E8219B1D43DD5A6AC9FCEA82E8C45C751790B4DDD8B14 +F9A7BBE4D9438994B719795E8C1BB916492B823F051FA56D61D49611BCD55DB1 +4EE2F2BC06FD029D68048FA8DB9414B6CB48D13F0DC480D6F805AA973CD34F13 +26C45D8C5B6C04F23D2E85264BD8F7473B7DBF9F73E94CF958D023E313806285 +ED8C7F456D5DA5659BA312E3C2A899BCCF75CBD945AC177D9C223BE296B726BD +6C3BBDD9E032E9EF7F2748F1308343EFDFCD3484CAC59FE7782CE4216718A51C +FA5334D97CC5DDC1DD2BF42D88F0CCB82C27716E1782B0178DF05329BF507BF9 +B367B3D0B5F225C2B3EE11FE6323D21C79E2A3D694C398354F39216DAD62F2D7 +CA4B798DF4812F5F58AF07F19392D1C6C61194F6E3163459260EE9841A5B1991 +91E6536D4F9F0A1DC3719FB52EB8AC377EF6CFDB54D106CB08332FC411E78DC8 +4CB5E68DA0AF2B551E829F8AF3230FA3512BA719375E16648CEA7B9EC7C6505F +4AC0F46B4E731338EA855251827EAA41AB17316EF7DA418F14192D8ACA80286C +639DB843731F02DCA072E22D26861DDF64BDCCA0DDD4C40F233ACF1AA3EE593F +C09D29A15B25EDD35A75F94F7BE6626EB47B95DA24D9EE9233981DF0CB263DE4 +0B724F44E9A9ECEB28595B7B4405B6EC45BD3E55EAB33ABDD4E12C6DD843157B +B4463AE6E74929B970959A2BFEEF3683B385576FBCE90A874135025DD1EE9AC3 +8B2CD71B126C6C7256DF0A57C5EB05D21C67883BADBA373C59F86370DEBB8502 +608132B336DF48D2A0C5489848C5FCEEA7A8D041D2A4051505336D12040B347C +9B93C3B7F64F6CA4D10120972C49BC27472BBAA8D278D03086B78D2E219517EC +9492E32A490A5550EF57382A1AD0D9EEDBF4FD287A49964119009A904C9FFCF2 +FDE79C8DC9B8C6C47150634EDECB814A1A569AF0D6DE0DBCB6DA9F3661D6455C +4A94491668467234B2CF345A86ED00336483177C8D67EC8416D9689C94CA612B +AFF2245373E6567D006ACC30F292DDC7ED39033FF8F9B1AA9CB55685F9A89D57 +05AA9C8918D10F925C9B1BF90A446D4B8E74F3915D6DFEBDE3089021EE953C01 +3CE7352572DA757AADCEC11962E287D2BFBA221B274EE3418D3C794200F54C5F +58EB478A2EE068C72E7FE115E401DE94970BE15CC98F6C61F11839B1D42914BA +100DA1E55D5087DF1A06BF8F9DBA76186DF305BBC67ABD0709023BEE9C40FC65 +DB61D8DBF5E8138AF1E8DFB8AD46427CA3DB47A876CE8B5D1691B9FBDE42DA65 +75C837968712FFF4D5E4145A10040E6104792C69BC4FDC51DF1A48E36565AA63 +3B2D778D784ECFDF1C24ED4D013052F2C3CC1D5834BB827CBF95A4D326F57F19 +D70098BE4BA80C620D6D4B9B8ED17F9DC612FF4127E5779E19CD1E1A5145A5B7 +2F88DB1F4A32601A70BB9F8234A5F27DD02FB973D551F1FEF582642EB7E3C899 +C06E05F9BEF1443C04B911D65A9EA890942790A3D97AE9780478F668B39CD709 +95A8AABF4923D001EC7D7E718453AF7E8CDD807B3CE00CC0E6EB1F6B3B7E13BE +3F1C87FE1A0EE488C6F9DEE6D3B198A0EC1E285D1AC46687EDA7CE86FFFA3A4B +84051F74A29AFCD1A7156FC3CC7B00096309145FA835649173CF9534CA68C0BF +BA9FE59CC8922F0889A8E301AB1042F05394129F6CEEF20AA4B58B92EFDE084B +11036D5E07BDD97A6B23DA487298A46C9788D3A30DDD8C86602C78C03D47E883 +911F442B032C208BBA748E1D70C055CC24594D07724A696441F68BC40F4775C1 +EDF4C298C1C7F8D3BF14B0CF09B397554ADC939B129DE95751AA26305917D8EF +3B073343A1A402F9F25F7E804248841688ADDE37E62298B25EF5FE29543DBEC6 +97653D6902F29EE43B27997C4FE949FDA5EC88069DF8CB3142F89D89CAD4844B +6844B24E22B6BDBBC2351E5D322D9E22D553021677DCA9B9CCB851106B13CAD3 +D4036FB896B2CA1C95C2795421E0ECD7491993DB964F9FA151F58E796F9FB985 +D770E367E3DD5CE003DF1E6B33854AD1FF2C33B1C5EC90FE2172C6FEAC6FCB05 +2129C58B233494F14B59215014E82281AFB3A29F4406CB16442ACAA2E95EE5EE +8E700BCB9E7B30121FDE5756B5B3AC98C3504DDDAEDC1AA01124532392D2DC9A +E4C4A8FBD12D1FE59A53B8A969FD8809EDE306A946812ED6C360D1891CB3FA16 +060B9FD4E76ADC5A9049CFE21C0798F28BAC57D1B8105AD95BB2008B4CA6FD3E +53546BEBCEF14EECF19C2FA2F1445681B3B83A15AEE7ABEA5FC37D43B5EE0027 +4A4B9CBB1C13A001FB2DA3D239E3370F258FA4C0FD4D72A674278B11AADDBBF3 +0EA166C490F544F917A2DDC132B7727DAB1790E099EBE239DD356D276D8C0742 +41726105BFC8B669D54555F94074F2AAB10247629FF8A27E30B0353D04562D7F +8BB23E97A6F7BFBA2F75FBE63D3F3288724A9EF2D3F14916F4462913FDCDED3F +245EDC07EF1553396BBB577404EB6277A1F2676225A22959623AF06B8A780F93 +C378613DE55B0854AF0F61C1B2124A4FD10ED7620532E859D7BC1C1DFE043630 +A906921034D93488E9CBC5DD0BF15A921D0B55A87B774855173417FB329F2EF1 +E5ACCB2C15D3A19A4ABB63AF18BF6E1203E71ED980D4B91620DB4479E5E84E59 +1010C3356ACC86FAE8EAC77D66F7CABF47098552970D9110405DB17DF99EE31A +99000D1873AAEAE99403D3E28A049EE58F37F2F39E46FAEDF47FC3A6C75E9748 +6B54AD8681D1FECE691B6CA63967BAC34D86C7D1D13E90126921140F97C45679 +5771F2299A72114481E44273A069BA7B348532C91F1B3121FBC903B190A89982 +A8EB144420DA17EB7A9B6E9E81F6B847D0D0342D8F81D01F7B7E050E5A1B6CE5 +D948FA9C2DCB38AAC0772E3520A8282B4537C877565C5D5030ACD675C8BE9E56 +9376AE2346C284E8F5652189E53BC412DA878C30F54714C2CBFA6EE3A060A8D1 +2159FAFB01633234399292EDF139A6701DC9FC51AD9C0F33D7F87E0FD4976461 +CFB5ECD53A1B5503DEE42D927D3DA58DE6A76E077454CE5F6A6FC82D2C59CB6A +51CC55536D19E4912EF4BC0C44BC98DC7CBEBB8030B9575F38E69A17A3CCC6F8 +C37CC3D699E0BAAB179E014D48AA712A27996C27462E34851F9325D1AB98DD14 +C67C5D5DE0696523FFAE5BEF5671C850FB97708A6A32C747B9E89AB48C306E7D +12C33B7889994F8A0ECB222165A2DBA497832252A94441ACCF4C8F8E14B7D885 +B391F8183222FBE18B68C5FA82048A015DA9B5049CD5E5A5ABA4ACCEC3BE6DC5 +4750D8E7D028D955DE0B19869E539029BF7E89E6759FFD1D02F7DCC440EC91AF +66A572CCA63CDF885303329DC0E1B36847C89A2B27B45C5E1DF0DA787A2FA53C +E2D74B341617CFAB4E2F75DEE97A6DE2E85842A41A931F05F9552998DCCC5AC7 +3FABD447B58186D7F391CD91B698687F338C43DA4894BEC48E6832345A1CB209 +EA4F5C0421D2544504BBF5B82336B6865D9015FEF30402A1A2D2FF5B2403FABF +D063B81E55DE9F97183801FD2B624B68DFAE149DECBCA59606736FB287ABD6BE +106A60DEA136CA64C80E67A8948E917F9F5E06A4F9D3A33FB044D79F8A010905 +E062516F27093BCE8DD31501EBE303AD1F353085F936D44B468AEDA22E06F3E4 +37970BD11D6D26EBA90AA52A3B3FEB176DD38222F1AFC3CD60FCC0045D64C089 +04985EE9AED27FE1B45B8C8A7E680A082F1A7700B1D02621FC94DE7EEE8EC3AA +CD0570576A8209FE8210FF958A32B3D1DA924DE10DA230AF3E80C13F27E8DE00 +FFF0A008260A732F7D9E28B1A3901855A374A5F82A2DD013724E61025740C4AA +E65ABF2526579409A6BB6A681F839E92B5C0778F0EF7DDF35B625BC69084EBCD +AB0046E2B301CAC644911CA34D304780A2EEC6EADD73121AA39A6BE87F198CC9 +39108255433A32D5082AD89DB4500C681A46CCB2604DE369262794DA9ECC4A83 +AF764A5A91108A885C2F6D6DDEA0EEC37662393A67EAF22380A8CE746D595313 +DE52A032409038C8BD11CCD37BB760C8AD5AEA6FD7ED296CB3C094E22F562B09 +F2E0FC9EBDE6C62E69CFDA0A22D3EF43423C62FF9829441B41402FFD1374BA0A +D8E6B22DB1AEEF54CF93C7620514F41C8F2AB2D3B72EFA99B47C901C48622194 +99842474F7A60F8E4A0455FFA600D9DD47A4F4D71791FECFC95C6B871947FC2D +5C9340CE34B817F65412086BE12B7DFF89AEAC19221EF9BB03A79DB05E9C3063 +4E786D24B5016C362CDBBA3C7B7D0F632F2B222475EFC2213B7DF57120BA24C1 +3AE8925709EB5B2E92CC896A11E05F0E12EF9AAA10A7D1590F67AE33199B45C2 +FE997A65F254751FC1153719D17DF8EAB2020880A3B2C2339DA0F3B1C728E122 +FD4E7DAB00F95B7A5A5ADAB661B4314A63059EFE6FE9F7B93657E87405AE0DC3 +325D45326D2BBC1EB3CD2997DFC0EFD3E20AC009AFD42FE6E166E025766F21EC +7665048336E9FF811C37537409DB98FCC015AE6DF01EE44661676D0EBDB73BAF +A6D5D3A50623BEE6174C92FDB9F0F078D6D7CB139A0D7625BC3A3B4CE4BBB456 +2A669D2624D80BCA277AA11314BC6024BA53C19338EA5458123E6FDDFD4B45D3 +5AA9A49F20B56AEB925200AF1555CA76B206A61977499AD1C07BB4D24C9258E1 +652AFF715077FCCC03E5564010597B41CC754A4F8CC2F49695C383EF92C4A696 +E434235D3E7C1D84B790DC9F6B43A1777C8ED527A2D98F0FB702CEA5C02F8565 +349F6502EE454DE460071309194CF6EAF5F93AC514E293450A45DFD6925D7830 +C14CA31CA0C7E918777F841BDFFC3C7F0DC0C15C6620D4384731E6443D00A677 +4ACC33954D9A55E648D566404C88251CC885A85064CA299E12EA59CA7B59BC4B +C4958E212F8001156332BAA49AD0B9088A8E995641B8E0E6F1A8247D7648BBA6 +CA1F2474E5615D3BB94EF67D6E3F0F3013F274A666198225FA09DD088C8BAF06 +5BA8043E1E5A430F7076F24E2B755F15AFD072613636B7231105CAEAF2DEE78A +F7651938D12CE3377603EF3CE60FB97E9B4C0A2D92102DB554C77F8685A3CA5F +BAA3A5EA2A2E0160240F93315E3D6E60BFA7A1D83DC1AE9D5E41C6428B9AAAED +96079A0F8621D68B2F501D00B87D42703D877D25B6B488C7040DED9E28C4FCD1 +43A3C386C52E0C325EC61636C5A4A6E3520FD381476B365A0E972E58E3385CB1 +C756DBE8DAEAEFE8A3DA19F21D38E02A33D1E6DF8678EA0BD25508F6712CEF17 +2BDEB70CC4BAACBA0EC8E93001C9F2205AB41437DF79632C67E5F45FA7454E3C +437BDF9FA5C523DF73BCA3A10770FD14585997DFBC51174560DF6C072EF47015 +14A6C5427173F1CD89BC9CB7C497907413DE4C346647680818C2F553439B3ADD +D9C39DCEE46332A01FF7B6CB1190F435123B7141553F49FE10A53ED11AC12ED2 +F36DCF68B7FFC3ADAA399C1197099BB3BE66201C32BB829C49511356A97C6C99 +8D8DA019308B1816294F2A3224C08BE6F5559F48845E7C309E5C9A73E2C4C2A6 +821BFDF2DA7DF4316420415ADA5C34097B22A734A7DE4571B86B3109E4225025 +B958E724BDF1FCD9B6FEDAF850B3C989A13A7824A3BA4533CEBFC27C8913CCD1 +4A51371CB9E0837DA8C81F480550E1A0046DE33D6B69B678883D170149C70545 +4A6882061BF687D00736C322FC99922127C1F75D5565C8D94BFDA0F956A68423 +78F8A0E724DC198EF67C48C5D68CF8FB4511BB21D2C6C689E91EEF9DEDB15FCA +6E07CDBD0520F01222E353834C7345849555A35E8885126CC0CD13D17A8529A0 +E13E66B66DA1F2448B05C47E1EC401C1FA836B4FFB252E497591EB281588AEF7 +7F09668E6D627766D120C64DE808A9CC7A8F6684E85A77030FC23F6765FB5DD7 +C86CFCC11803E954FB7BE7C9396AF0FB13BD15934159DD3F6002424E3F4622FE +DD42BAAEEFF43E2F92434B136F7F3B7505A5BED33B73B8A742C844AC7EFAA3C5 +79FF21DC3FF0C6411A456501163CF4F5BB8AFDFB0820F9F53A4F37B8C4E386FB +5D000EC484B50C244ED90F642C49059A3A965A88B525496DB7E7671B41D7BD62 +0C147E0B49E418F84058B3CA94B2EF718CD76EA0468D5C98B4E9C9394047390D +7E6AD8F8F5211F31472B81C4C84B1DFA565CA4E70B1E48D5257A24340CFF6255 +4BCB0EB3B4131F0B18582B3F8B51244BCBB17389F9746183EB39D5AB99CFFB6D +70CDF84EB127B509BDA70C0335A6AC60B286E8A758CA956395950F0CB55B854D +80D70361047A0E3934BE3776255D50E3E85DD714CFE29C7FA472E44BCF0A75BA +6F40B567314DDF6570CF202E509007B2D4176C6F2B1CB3462FCE346B1059B73D +132DA259885ACC2F9948D9B8C77D494651609CD557A35B221BC22D76DEC6FB10 +B9BB140E0D08E6CA85DCBEECCFC6213EA309B02DD87608D3E9DDFACDDCB5C563 +C36D9AA81F2D17C20A5D830D37F304FEDE68F8807827E0D7BE98F8A8B3BB75F0 +2F0929E4F4306C907DE20B861C8D4B8F6AB785D8771343CD1CFBDF5CFCD3D3E9 +172BDB5009D671C9347462D1F8A5FE042EAE7E5415A0536110148247E800073E +CD6D6DA88E1EA35A2E22E1449D434B91F59D17B635352D7D0908E366FD60C16B +6C236158F772F2780B6FF8DD5BC883E67B07EB3A167F80111879D054968458CF +C32DCBACC14101AB20A61DD6F059C5316AA65032DC2820CD743FBE201236BB39 +EA1F26FFF286E04ABE3DAFC87C003867AAF141C9FD9959F903A46055B73BEA50 +384EEF14029670A5DDA34664DE73D91EEBBA0739C39B0F86B9DF426CC0EA629A +949534E818D790CA485F92A1AAB47A4ADA5C51861AC7664C377FE1E62FDBEA3B +813155D19DEBD10DFAC75CFDD1926E893C47BFBFB48A32F85959B79D7CC48A39 +F1E77268E2E1A5DA6C0CE95A14F16E722BD3A8342FC66C6F7741A5424877321F +7FE498CDEF036448B99902060271E11BA17F2FACC88DE3C3CDAF9FF5404F2113 +96E043E83D7DCACFD40EEBB35085765B1670451872E7FC194284DB35E2C5EB35 +2918DE265EBDE5899C26EB3687EBEC74764C893D93767BA3EE76EEAF63742775 +5094CF7350B6102C3F96F2F643B9780AC1BCA3B5CFA996F149B55082D8F31F38 +4F90F1B47DB49E8CE7E3586E8A82E9346C63C852F4A28D2066F1BDB7734906A5 +4F3150F9B5D0F210E98B0BB0D70D2BA1F7EDB377260DF0177D2EF0608EFB46D8 +42A0B1FE05B8111CD534E3828D623E5C2579C965BD488FD2302CD6F695FD2B15 +5D272DA3B1922A1B144361757EB1011AFFF49EADEF37D9B3720DF1AA88AD8668 +8333BDE54D98527577EC1CCDEBD9FAC3B1332BC95704F67373E6C3FC48F8E51A +F17E801AF5F3061346C35B40ED7E5BE4DE34A935D9048FBB9604AF3E72BD5663 +E690A6C447E405D8EF1ACDF16F0497432A5F1DBF8C83B2E4115DE18712411930 +1ECE571DB47EA6AF4D4ED50927E6308846A8701D8889EA8E738AB437977CFF51 +2045BC0FE6FC033F58C7F5E9E8C66F6192B70DC375D1DD9E9AB17624620F927A +B026862266BA675B32C6D8878DB9A5F2FCC84A10A9E83741B531A1E57EAAE7FF +51330C77A14EDE1A17CCE0A39C48A7BB7D55F653BEA42258076B0EF81E9BFB85 +AF1F83659FAE1FC5014C4AB9334EA1BE4F6935F6F642FD72251E76B0995DE35D +7AC4BB4E1DA10E0F24B6D6FDB97A9ABE0CED4A90953FC9689DB0E859752FB576 +1518DBB698E61A737FBFE443E9CCBDFF5A53C8EB474010D6B1146EDECDA71DB9 +BBCE0C20BA6B9D8D8F72084E71F316CD32DE115821CEB3BB4D54DFC796ED06BD +42203E550B0C3D126621C13DCEBA97533044F49830B9B58EF83CA630403D3C30 +9A2909BF2B12A74D9FFDB7D6B35600C0E7571291DB9AC2523D4B862B8BEDAA55 +43B0A66881EC680C3184C10C0D4DBB90B53749AC41D4CF951208F5F2D763A0CF +D641EEE72C35460991CF2CF81EF77C35C3679DE514BF26850F80A448063E84A1 +A0A3B43E1574FC22CEDBDF32E3452F36C74A7A140CA1F72A995AE58CD9693841 +FF3300134408D5D7ED154298C2FE8A8536D8E9044A436365B5F09392D264B83D +87AC1EE6D9D2E4B68863F2E162D7F2F874368F704BF199C9037F5EAE2D2D3A98 +B1D307AC7C139CA5387E97F1537D3D87E598E6EA3127DBD1D2FB25AB574D256E +230B96C79E4C533FC16B0648184969E1B81E0B5D270AD4077BF609C5451D2F70 +CB79CF3DEB975CB982E5A9D082B5CBD8F5FCBA410A4A1A36DEF63DFB16044D89 +BA0C58FF00F7ACAA23C940E9639529829EF9F1DCA59A96723A3AC57FB542A72F +C81B4A274F95E006FA3B4114891D5AF736E039FAC645D4DAD7865C81D90F1BC9 +C5BF9A02FCA48B660A4480F7CCA68370F207792BD6645140EB7680D8DA1EE3FB +6D4D72058AE7179878D88A44EB00EC544A2B742165F30BCCD561ECC77AD26E33 +A0946A74EEFCD64EDE1F40D5316414405A5DE34E6D258DD16242D94704CB8DCE +85EE060E1A93F7453C1BAC0FD044DC2F550D3A272DDBA2F9BAD22BED0ED50198 +384D1861CABC4FA07A7AB43BF7AE6B81D96DA6D9E1AF2B9BF6AC8043CAEECAFC +554B550EA807ECA77F2F3E288357F87990644DB4DB95942BDA07CAA50CDA1A88 +D84B30ECDEC12B14CDFB66D30D89096DAE0F11ADC73AD2E91F3E7BE0E1F555F7 +8110A518C7590538C967B81D6F975C9AD66FAFC3B5FDDA2E8CD7BE62E7D29341 +3D29D975A024F64853C239F3825F4FFA77FF70D70BE36CEF4F7CB8048D3CD03B +B3094D54B6A9144592C5492C32753C1D1B776E8DF4A23E29416325AAF8A3C19F +1E029C8ACA6E167963E624BC2288BD15566A93C5FB3176946739E7DB93C1642F +8715220AA79A82EDBA192F6EC417D3B8117CEDAE5FBF190CBF7B51E1465F337B +DB5B9FDE49E4E985C0E5DAB5C82A99CB6A20E818B4B3319FBF1E88495B666C24 +348C235E87378048A620948FCF113068B6E52CB35C5705AC01E336FC1673FB13 +042559EE81E3A66C754D6C5956120059D83023FA16A8BA28C931E230A529B4B6 +972579CE596E056CA90DC41C0FFF6D53B04F2669C3C1E5F7057761214C6FCD9B +0AFECBA0D2AF4CE2BE874A9C2D51195075D535AB33E72B5C750332F0612FC2B4 +5B4CE1F29029A6682C88D4557623551E8D7943E23FC88AFF970DCF0C2CF4565A +355067A3BE89008F6DEF9A6B9E0F8EAA3F3F8815AB27EE149A32D90BD5E3AA93 +5EEE528542D9711E752F143FC4C9040A2A5C4AF4C024CF3ACDCC534EC5D456BD +458D9A47BDAD0F61B4921D3608C16D64CFFBB3360B35232DAC7E61166092B7C7 +AFDD82BEA475CAE542EB41CB2CC8F620F9F23FB67F3D6EBB0E1E66686B7AB06B +F706E580C30F37E48CFA0577242D6EB7A6358E9A7DA86BF7236ADBBB156DD391 +82C227C197323364DCEA3C4C8C2B6044E20E99D8F9378CDFA40FCDFB3BE333F3 +35174DFCE381A649B1711831307C79C96A3FFC62F497DCF6235C9F2E208830E0 +79653DA4F44A2AFA06B7416032C3200AAD046719EEC246ACCBFB7D0C4B6DCB63 +FE351DD61CFE60B5D7B7DB8E7C3EAF0E07F9D853D1C270971492CBA4BC99D24E +2B3DB839824D5BF4F6B82625FB175DAC5641864EDFF35CB91E0501100612DA59 +F16D5AFC18A02B00D431DFBCAB4B981C1DC017D7FC3A60E2BFB16ADC9256BA98 +3E54241311AFE0A60A9597AA29559D97A85853B7611FC97AD41D2D5D84BA7EEB +7F5107A4339F245CF74F7DEF223A178C06EBBB793A0B71577B6EB4388ECAE3E8 +9B27AA54B84D6DB31DFA203CC007C9A1D49948F89F0B86BC5B337611D5B7FFF5 +17E605D0FE4D0D9BD1B2BA6D48876982692F245FDBBB535746A77F1AAA665CDC +B8DDF341ACB0A6A1349C23FE9245B5A49F8438B722BD7A30A877449421C37667 +4EAEC2CAF049C53DCC68E1C92EFEA1E24E51BEF3803C1A47DA9A425D6EE8F6F8 +0DFDEDF589961349D721CCB4680EF221110104953B6598B8FF3EE2F52B1992BB +EFDB13CA26443951CC667129E0943BBF527560C0F89FB4EEC7FEEFA841B22745 +DB01A838E46D6DDFB7E9986D4D8E87019A539FC3A6BBB0FBA0993591759F849A +B48CDEC6FF2294E20413D8D615C816003D1AC56288B29DDBF09E391623D9C6B6 +8791EE2038817BDC9166F6A3445887E0028B1038CCF8B771D665DBF3B383D33D +3F49A3703159E588B959FCA0BECA665509776B051145EB00C6C9963CDD6C196D +E73BAE3228DFAFB8AB29C6D7136666A0A83A0B453A0E064DEF26A5EF3798DBD8 +59EF458BF89372D13BFB6FBDF957EF9252123BE5ED5391D20C82361B89B43F3E +9E23EF956C6171AA14CBA1D27167F4136DE68EB8460F0A9D65045A0502291C59 +A991DFF3B334747F2B966F279C74F2C77CC6E91E1B0DD41DA1856FFA51158A71 +EBA79F3C022427860CE4FD1EC80F55D6F922321A2D11DAFFA119D1CEF2E4A78F +D54F801C7514941674DFE550488F1BF6781E0BDE582A71D83C13BA8C317E2685 +771E7D5A46A262EEEA7277813EC856F116EF6E548AE24B9F92EA1F4FF330B946 +056FD5028004D771C0AD5DBB528B69C8ECFFF26FFE924FFE0D18BC0F48FF2BBB +3C155A869038CCCDC8A77458758E175ACDE279919B8DAE69E9160FD2424F564B +BC399EBD4C311A6E1D31A89D529B8B3C529B36E3265DF51B2D1BE1F45218BECA +B4C8EFBAC1A7C04BFED2F11A8E8768D8BA77570C379550FD4535247C19CF82DD +CB0B4746B2BA4248BA4E0C0AE004DAE0BDAF9D1FBF8224545CD4960F31C043A5 +8FCD323E8C744D9015CA1AB8B900C3B2BD25239E286AC3076F6BF54188B9C81C +D4A10CF1730DA566AA5A20C23AFE65678A3A177D7756F87DEB3BC6BAF795A351 +8C413821F4030F6E2488EC0A122C054C52BB6C27B08CEE212C60918AFA2B69D1 +E5EFD146E8445E7EB0EB89E6B6463703DE0226B512D9F6C630AB770CA884FF0E +1B6CB77D85C97D90743DCE97C374607B7521CE76C003C1BAE1087CDACBDD7A73 +014302BCC0C790EE695A39C2D3BED03D8E5FF496E51991008C0351EA09CAE607 +8386B90DE0D065C75A5C66005FA8E4A613D6DFC725598CA053B3ADFB095B511D +F824BDA8C65D4867BC4F3A6484A71FDC9A1D9D206022DF728007CFE3731132F8 +9CC65D3FE8FE4BAFAD6D288477601F537E78C3605948D3D5E2E482D359C548D9 +CB63A8812A035E39EDB8B5206FD043CA7C5B20A9ABDC12A7E5C41929B79D161A +B5F57D11FA32CDA1D38EF50E65B3214F6F4B338508F5C3DA215DCC95576B38F0 +7F967F94070C840E586BBFC21528BDF35A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMTT9 +%!PS-AdobeFont-1.0: CMTT9 003.002 +%%Title: CMTT9 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMTT9. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMTT9 known{/CMTT9 findfont dup/UniqueID known{dup +/UniqueID get 5000831 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMTT9 def +/FontBBox {-6 -233 542 698 }readonly def +/UniqueID 5000831 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMTT9.) readonly def +/FullName (CMTT9) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch true def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 46 /period put +dup 47 /slash put +dup 58 /colon put +dup 97 /a put +dup 99 /c put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 118 /v put +dup 119 /w put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794DDF2E6BABDA4215500A0 +42D1A3D0D02C0C98BB1D6ED0B7791274C38B038FC7921FF1FB8FAE7258C09259 +4B8E1BD9EDCEDE9ADAD9BD9598EEA9691589649A9A21539161E374075BEE3457 +689F308A4A7AC9F2FE4B301A6C36B0442FB92E3B002623493DC087800B5A0521 +0DB96A23175AC584DE166F59142779F26FEE9783E28DE49FC3A8D6583EE63FBA +610DA773CA18ACE6F64A4867A1A7817120ABF9DE4D17782866E6CB6B65A9F6D8 +3667C8D3E61E5356E35343FDD4C6436DF73934470916CB5F0ECEA6BFF092E735 +C7C355B56189D1DD5715EC97E50145FFC17BB1497315A9585D713A7A6DFC7933 +995468EFD0F59E3C15865B87925A3F2930E20D5A35970E2C44F1629FA16E00EE +EE21EFC50D49F5BC02300D0A7BB85E649CB4E2E828C8B1C5469463013E71D723 +2CB11BCBAC191AC751A2AF7FC228395CE9472DC1809052012AEC2CD66695DAF0 +4CA04234F0187F4116C93F59A7F1F8123DE87F111853B785A20CA8B49B3B0CEC +B11AD345E1A11578D2EFEB0536D125237086CC8CD9F34A5137AC5DDFD8746014 +D74AAE8239B81ACF65F379CF2153B06A238A2D767F294CAE0D79228F0B7D45CE +510AC9657A1776202FEF42F96D476E7DF407786AEA12DEA0013D3B4C5D0640F5 +BC5BB72C34066270399CE595827175B23B25072723BD24E07F6BCD9EF0175DEF +93714BAA53960F81103CFB731CED4A267B53727BCA3C97B0BA5004055D4EF0EC +F725658E53AC86E4061B489AD4154915C3981B3B703E1E2A8D390CCECCA99385 +45EBE35441B062D7D12DAB2B31569387187D74A4043FD71F1C6D352EAE0F6757 +4345FBFB6DB15CAE47CAC4BAE47AECAE5FF5EC19057DCEFA1B23F47364ABDF47 +088A7C6A2AE26B10459B6D41CB69182FD1472F326CE3A15B59255D1DE3B616D8 +9D1F12561038839781E657C896B8C58A32DF5AEA23732A0966D96C68C988ED7A +09B7E2C8F9F3D0D56879764781566299A4EDD3588BDF70E3D924D25074F30988 +E35BDD827AE4D0B4A06F55A9976BF0DB3C0B1D09CD08E8CB168B50617691638C +0EC1A791C228177D4FFB021EC3DF5082CA3487AD2EFC8DE9466A690ADDB4C52A +FE2A6DB4CC275CD33D9136E735279FBB2008D59E667905EBB04326EC33C98B2C +94744B7F540D86E90DED64572ECF1EAD3A58EC101642B245A9C7232DC8FB8741 +03F97883BB32FB955C22F878FA0FD114451A3B3859B0B5537AFAB73AEC7DB2BF +409E1FB41D473714F6BEA73CB085139879FA31710E01915C2938C37BAD6D7D71 +45B897E00857D3931A489EAC7B42BCE4E65F73F67FE027CE482DC47598ABCB95 +39E98DA8ECA3E23F0799D5963ABA6E2984DEACBE7B46B40ADC6213E0F4D08971 +58F68C946C748E4B4217CBA2391BE2086C9758F4E32C9B6413E48D84D33A6E85 +84747029C0A9C9B92841D217A902BA8EB333999D62FDA9F82BFC8ED11F67988A +0CAE42182E414A9766AFFF4B046A09D476F8E3F15A8C7829BEE982D8350BDF5F +F215F2BBBF68D4B567BAB798B9604C79306C475926E9FEC0F07A99F43473C6FD +B15AC29C3D07FEBAD1BAFF75AAF2FBE94F104F1DBF838044FAD94B661B06AECD +D9AEBD02B60CA4546DD6B5B5C1A3833ED07845671CEFCA8955CE0DE5DB8FC93B +3306683CBFB8E5B79A863DE78D455DE9D592043C2686F88A43140F8B9F3B553B +7047420E93E753829F8D47AC7621CFE3626F271E31F0019CC02D0B57F67BB47D +8CFB63E902EA3231C00EC66EEC0D30FE8394558BD3535C888C4CEFC6EB72E737 +712ADC6300162D5D79BEE0CA1F6E4127A0BC90656C01692F6D82C85550AFC97E +C2693E379160FDB9636FA41AE9C75B7F6643B05971C6D67CE30971D590FC07B3 +E0B36B4D1C7F25110B5DA2130D574FA292B47322975A2BADBDB39AAE69BDDBDA +A880F9AAB580117708C79204DFFDC08BF4A48919B5C22228845CE8C3109E93AC +2479E523B8A1C12A6E541118F121DC6B4EAED83491A03192D5C3A2A45D1A2467 +757E7B377C635CF5CAE11A7CB49D49F3A1BB2286090B5F0E4F89869D1771D50C +54B5C5E091E3048A2C194F0ED00DD64FB95BAC6FA9D61ECD093ED416DA3A4981 +DB07CFF17C4F55C62DF628EBFF06FAC3F3D3F91C30EBB34052BE1A08F5EDA4B9 +08977197950A282B84E21D43C64BE3AE4BCE22C70E7D392DE09D89B7F23351AD +6AD37225C12BA79EC9951F5DA1E505DB26200190ADE0E549305B7530CB86EFD2 +A896F13A97E51754F70B609CB4511CEFC38BA579C071E9510A49982389980DC5 +336D6C4A2DB100DFEC4055C7AA9C55880F94FBEA9EB280BEF66CB8E1E38A359D +E5AFB12B540CD599085ADDA7FC2C72E7C873015773FFEECA2C596B75BC39A3EB +3C43FA2E53C0D7993042F3D652BCC483E48B7F6C94C3FF6D38E276086A6AE67A +E5A571B9C72E0D7824E0BC2ADF51A393B9E334649F786EC1923C854382B89627 +1B9E701AE5A6C42E672B2C6A33C8BBCA8F69B9061E787D6B92183F20CF4C3903 +FF5417427B84798C82BE28D2C81624E3920CA61EC9EADB364B5A6E50E49A1A72 +A9A090A1FCD84814B8B2708AD787D2B5015DA1305874F58C5EB62F843685FCB6 +465FCA80176CAB2B2FE65E0A270BCE1E3DB97564BEDFAE5CA44395A8DF4505C0 +3E103CC3B914359B2870DA6CD30382EAE8949131CFE31E9E75C3E47A3834BB32 +CF183D4A8B9001710D0A11390C9DAD116196568591D38C2AF4ADD852F31494EF +573462759A35415900360882739789D6B89ACEFA251C5ED90ED704DD7C3C80CA +9F6CDED69537D201D520C99E69EEAD5D3C0EB84C166660B3C190166D93EDFE6D +15BCB6DC5CDCA825E48D33845CC2FB15291AAB823F25CF8BB0A1EAED8BEC524D +D9CA016027141FAC9D35B64FB9C224552F29EF6B32497254E319090E698FD8A5 +15491CDFE1B988C79A0E3B9D01E12FF084E9FA86CCAE02A3EE6F2917B61A2CC1 +64B8CAF309D1AB48A34227A7729DFF99CB6EC282E3FAEDD2673779AA7E4C1789 +D93FDC37FE95F087C5F88F53D30A2DA9C913BF205FC6BDD060A40184F4AAEB3C +D080D63B89CA3DEFF310D09EF0A83F3914BD5B7932980ECE139EF0313C20B4C8 +576EE0FE3F28FAF4D3CE7CD0890BC824A85B8EF4636BDF1EF1BB519F93D36540 +ED09FAF93FD71992CA2CE2E83F5355162ECEB32AD218092F45D5A61A44E67135 +EF0453589CECDC6962D0E8DA7E7567603BAF50B2C8F1CA65EA5320984E7D69AC +9A7D3D7F92565D79E8C9DD2D92CCA7DE9CD058545E9F98AA47904D70E1897099 +3C4C852B3BA131DDD348433C336BDF5FBDFB62120DDEAEB3255E3207B0C84A0A +1ECF9EC869DB9BFA3693B03FCB27C5A5D3CDD62630DEDE91B4DD5B9784BF0BDD +FC6EEC3FA7ACA9E15FAE47CDD9B7FCD2BF0EFA10716F08C0AF25FF67CB6F9598 +C607D2FCA452417D2C69DC808A9441A66492394C3450BD30632AE739EAD654BA +4343459CA36B6D5B2C12C39495952F2EF93D82C73E33236785A79609E260C4E0 +CF3A3C950DE71DDC3939D42DB1CB1CA917CEAD56979A70F8F3B207C805319FA7 +3C000AE2B21D711A6D78C7BFB901334DC06F59EAB6D94B507734C27971F8458D +D00193645AB92FB8FE163D5C51AE4F40BDB4F2C51691E76EE0636F071F37AAA9 +BA78BD12459CA499210EB0CE2F8BD317387797C33F5933AE7A6264DA06B4A6A6 +1188326147A16B205D1F965872DED7D8EDB3294FAD2FCDF0D423329E9CCF879D +4E0B966D509F45527F7609DD09694D286F6FF7535EF8971B7DFBAF608A19D442 +C133207EB1152ABBD11C455D0977F66A9B73E51381D1CA4B66E87C0C7175A63D +80C699A052F00C41DAEF42E7A40E07B1B14107AB0787E24E17C1462960E3C54C +AE73BE4924464FB177EC62F116B2822842541543EFF7ABDDEE197D6BD8F8D4E6 +59175D8C5957550B70BE775AD52FFF6E7C00DA7CDC16E1DF7446BB5D8FD82647 +3E9F87D5EA365C82A2D991321ECB14A9E3AEADC5A56665DF7072D6DAE402BCB6 +14D92B17F9E063E4E9D8D239C91F5C7C0BCD2FBD936C9D4A0B57659420343B59 +B395BBD1AB5B6003F653699D57E7581F9813CC98D4F072FB78899D6DECC42D34 +F2787EDEA64058B46C4BFAA2BB96E9BE5CACE8D91E4C080ADFC0FA0D4A29C6B8 +54FEA9E11DBCF53D9CA40A21AE5076451EDAB3593E56B6D453DC8EAB8C78B588 +34D4C4F36861B5649BC1E9F3091E704BDA7613ED45C911DFECA74EEA05165191 +825F95A947CAF382FBAF01F3B8B041ACCDF39718D7DC5BA6CA12BB20EEE96439 +BF2E2628AA3BD2C91998E6247A690FCB0CC95F286F427345CC4F1115BA3A6E54 +4743355F2CC991CBDFF5725902C1F5A6DEFDC8638A26EA456C33C27773D6214F +66536CD2E44FD253531732D5A8C44B336B1BB47B0477350EB8CF74889B93402E +2356A9CAAFCA562315D8E0B3F42F08932CB87BA2499A875AFA08D11DA73B38AF +F46D03B7F639A8D7BF88CF07FFF4E91716DCCE6E2CCAB60A64D5E40EFD8B336A +1BFCC4CB04F49DE1FBDE7AA5B2092A6EDBD913D161A3271AB6411622D0E14416 +37F81E0102F5B0F2F9A2B27819E4BACD7C50E29D6291AE5B0973C657761545A6 +741729620EF2BF1046B3913399C10982EE5F4142CF461EA31042E432CC79A1A1 +39C607D22E45A6DEC008CB4BF6007CDE9DD5802B49A62C8E02A6D448B64177CC +887AD71D171B99E7ABE2085B37D90B3BD8513995D9A57F53184DA474F6DB5E49 +B73E04CC214EA5398DF7D7541F94E623E8687B511640457A48A68E9D9D6584CD +15B57CC044D8091C771D175F2EEDD411099BC8F7B4317DC503BB5E405AEEB526 +5E6E1B1F2705275D274E012A98F66075CEB90AFC648B964DDC0E9C4AE7B24CE1 +80B051022E5781A533A21DCFB97893847D685137EAD85BA708A7E118C72FA839 +A9E460B5D17365A0AF1F53A98319FB64A5819B087F554BC056C4BE44113A5404 +BEF759F890C1CA5E7AE156F4F8106FDB4F8DFCCC640976983EADB30976344048 +2A86D7B2AF4A01CA736B98D52ACE392AD4BECE7E61C710B08B66F01857CA460B +B8376E257113E10F6DEDF14CE2A4E6A99ECBCD302C36CADB713D849EAE9EB598 +F29DC98531D793B79F83091F9B136809E006F34E423D528CC4309AFFB3EEB47B +9A9DE4D5B25CE953345C326BCBE2B4912641780637783084D3D12693F8135483 +CBB0AC4EE0B5610D7CEB7DF205830BDB9BB404DC1B28FB0824CC187B26C19A91 +DA0025EC739BF3993700101D042DED86D67F5FB87912CFC51AA7DF53F2162D62 +6314A2CE13810D0B8D81F45771391A236422CFA0F35F7A0CDF14ACB2724AA57B +7C2C28D53029B1146558610E0CFBBF72A85AB9BA308F846228F299F13F68E8F7 +D963B2EE9EF7D4C21690632B640BDDAD0556EFA4EFBF035F13377ABB5CBC280B +9E0C12AACB153C93351E5BA95A7D149010E204950A59C7FC6581D9703468C1E9 +EFAE37E7E6ACB892B3F8D1248D9A4A72F642FECC5E0B25C15EEB921EDDE84D12 +0E524FE6133C4921FF4921242392C12FBE69744D53739F7E849C1B96C4020AB2 +1FF10DEA608F111749E2FBD8DBCB17F353DCB3075B4F4B8186963EFE95A76A10 +85AA5BB6DB4095291974221829A8E436680F4860E01C3843BE5BB3101D0869C0 +EFCE08D187BC04F58C7A450A59093680A0F09E8E3F12DF5223E7EAFEFA01978F +D8354753A68022CC92C71F2CA732DADAA8A466D4AAE5999B0DC077715671F518 +E6277741F44AE798EE50DF44CCF71FCF8BC71F76374005FEBC4883C6EDA854B0 +88C0C2B476709AA809ECE41AE786DB1A32B3FBBCC14921673578D3514C8CA842 +E1FF90BE33F7B93ADF6BFB8B1AFBBD080783BEF056A6BFAEF676F7BF9F2DFCC8 +01D255A9F0391951210D60D4D4DCA93AA858B38C0D7B8FD740D5FC6F277C2A68 +54CC2DE1F40B6347201FCA2A0A91822708D820CE645C3E4E5A09FE25721AB33A +97871ED448F38FC5A349D81F402B34461D840D5768BFC6849439AB6115104F78 +B87115B1DAE12542EA898F86ACE247709817850B067F537E6137196101D46DD2 +D842EA03EF4501E34074E8458E638ACC4EB349A7430AB035BEF2DD4CE00554F9 +18F9FE32A55AC1E7E50D64AAFDA278D77A7149C59DC5B1E3064A4B281A54C9CE +A5EA94ABEAE4C6D5674C208ABC72563976487136AF2E21F835BEFD232D7F0D13 +1D19932367F51D5379934DA7F1635AC51EE5CEBFA63D4D32F018DEF13624EE62 +31DAE68A08DBE3B4FDAAFC75291C8C6CC7A657E3C7453C7D1461A36E88E633D5 +408253B673AD87A9FB2D0F56DF1305916D14D5DD62051E27BCE09CEE9A1F14AF +1D7164BA5FB6E6EC8D38750F7E28BE330909F303ECDEE692E347DE13C8C2F82E +29C8BE6EFD76546F362A12A1C2DC12389EA95ACB4DCBE95620F0C193EAD91B33 +BAAC5801AE827B9AB3FCE5D11D1D7854F8FA8A31670119CC0CA98628F801838B +AAC7EF90AC5466BE69CE3E3CD9951A5EB9AC08014285422F6DA6F6E221BB30F8 +0042A11F2E4B765BB0D142AD52F4D85785EA71B2E1CE20728B9E9306CE93268D +99B822A5AB5232EC7E26EE1160850AD3905864A01357F22722B6A54D4EBE58CE +480EAD9FBF068EE965AC4B5FD2FA8CCB91ECFC6E90B9C49268CA0B0FDAD23ADC +D5A74B41149BB08454054C451AD0DA4CCF8B60F2EBD061AA03A011D548B6B481 +FAB00AF9225BB5463F27FD67333FB51F8664536267E95CFAA0BE3BC1B8F889CB +587A3A4FA2B45864F07E11372C9507A625C0030EF7030A0B4D931BCC48F6DD51 +A4D1F63FDC4B59C1CB18E6242E9F4B4B8AD9755B870FE60D640181FB7EB8120C +C56F51DC8C47FCC6318C2145EDCBEFA7BC4253315BA67FD2B3D4AF6A9F3F229C +AB75B592EADE15B1FB5FDBA1C0F786BD21A51506B7A2E42C2D086BA6F84D1B3D +AC7531545F0B01346831FF36A52CAC1E390F99AEDC265B44B0FC9C581BBA6BE4 +48B723811EBCAEA5FEFAEA7E5B987F2C7B3E9A65D2D14A7B74F099401C57E367 +385352D0776D2A908F7A5A2E4D4160946C5591397877025C8C387CA413EFED56 +8B142E8341E349DB4DBA422A4FEE56A573972A0C66590175158E48850A9F7F38 +4B95726787B8F969FDBC97491CC81CABC976CD00A27D1DFCA7CF467A956C1C6C +839817AEF8794B6151FAE9261119DD5DB787DC9D3B420FD325ED6599FACADE0C +320D54C2E0D296537E22C1783670A9D9BECAEC63853EC2F05A990260DC189D63 +7CCC0BDDF2CF7585071ABAC14630666737041194D0777EA4292AE60BD7F7100E +DB568C90F0D899EA006CA423CFFD6EC70A5D3D8AC43C747DBAD3B02219E47D8D +DE030631F4678C357A58ECC52782B31B50CFD44EC33F41585E51B27E3997D33F +461BEF897220AEC80007F13C5A1EE3A0430CA899047DF944831F8B010A7DE74A +BFD26001472DC00CDC9F17CC435F61ADAD4E9AE062ED477FC621FDDF9242C449 +1BB3F77FDD1519A251B663A693D84B42BF0962F537757F38CE5C5D56B98AB10A +3B70C8AE8D52DCAFCEC22E7B09D3C4EFDA1841C74CA975E4F8294F7BDC796500 +0ABE197ED3737A65F7BAE601C91DB3983EAE11DA3EA18ABBBA3650DC361C2E77 +EF9F97618B0C337A906FF39926D2B0B7883ABBA650816C4C6B34EEA836994EEA +AFEDDE56E0099D0E09EB88EB093544B9BF4871200746A0409C475FC4232A38D8 +F3105B0FF44E4F132378DD12D9E796412FD0F9478322215E9F59E69396C35AC4 +097C4995B60BF4D8B3AFD0A002B3A6E4FA114131410D5658999B86DFDD3005F3 +AED1FA8F077AD1F27EA249221585703F20FB70E37A26C6C3F2E101693C94612B +65BF89F37AA3C10A40EE8E49915F1A1B95D2193D8003DECEF9D76FDAA33B1AA9 +CEDCB21C2A3B05747FB3ABDBD904B66EEC60CED2867442F5FE445587EB8C6D14 +87A6B1B4871A8371A7ECA6A159EAB295B167CC35ADEB8512FD0C237421773BE8 +A081FB687F9C5D676F2944DE6E6B639C37E8E49BD4A6F0903E0C31EAFC4B58E6 +CD01B59C73A14DBFB287B7017F6AE0F6F4F85551429A85CD87315FB812FDA28C +BAC26B5E7CCC3A650565F8239A2A5EFA3D9FF922465298B05A57E2F26C9730BE +F421A0AE453EC19BB507F0979674BA75B9B20D4C0ED4CC348A59DEAA0FE68374 +F5A64B15334595D97D9B2559361341E6AFBEF03BEBA20B5E04E274301ED43549 +1366A802424556D638158B09A6B06724E0E67DF7FD61DDEC1020214029D42D84 +1A67E6F12EDE52536722514763C2074F60080A4C7FC4641A34EA4024B78A9494 +AADD41D7DC6E238AD0C4B521074FE208F5277DBB982060AE2D89D2681FCADC8E +04D507AA3F99FCCD61B4875763CF82979E0413F88DF6F3ABC7CA6048F9166630 +699CC536BB14A988113B1B40DCABE442A115DEBA4D83EE648E7E25DF052E0A4A +E27B57834B13D47CD9ECA2D522EF5054A24CC597B395DF735E5850BDA604606F +FF7A16F0A33A1B1A8C65569BFA0213FD959CF02E2BA6BCB6D4ED19283A48CE2C +C86360DF3B3C743492899F5D7D46FD7841BD1BC0F11B27D85356976CFE374863 +752742D7CB56DA6DDD4B216783B027CEDE18E649C0452424335850D6B5F27929 +783567FCCF58722A08A938ADA90C50E8365855E8E7F6D47A9BA543AE9F781B21 +D486C4E8913C8435972133F893712866F65A5F8F274FBEE4A9F53497C16DD3B0 +2BC8B60461D7FC9526CAE9AD5BA56FDA317F340FC17CAED342A562DE3A57B664 +9F18C0E59D96CF699AFC55E2A802D89A3CE5ECCC1F588725CD761B4B645B77FC +9125C2CC19D6E4ACC8D507F3220D9D5845EEE18C292508847B5B7EF94C79DFEC +2038FD5CFA88A2F0D3BBBFDAE2D8793070CACAADA181B1202288EAFDBA47A386 +037B0E7C7573FEB8C568F5B33A26E8CA7A69F89D2C77057D065CB219C926D451 +C001421CD883D1FB1F09BE6CC496C9BAFE896C9BBF507B13032EB0984198934C +3065ABDF9E1229DB36922F5CD3850698955E30F6CE2ADF67FA1EB097CB3D1F9F +2BA9321AB1998CBFC4E3F21309726F07D1A628C26256B99AF3F81FD0B0AD8A18 +C81E42AC60281516D8493A22010928D6FD01540EB560D3A5C1D8059FCA0E4BCA +940BDA5795AE9DD28DBB1CDD9C1B1073D37DADCC555937705252464061EAD6F0 +B38805DB145C25B8A1F49642FD61DF5CD2C0448A450B6E8736CA03AC7742B3DE +DA75A1B0B72145D469741108C9F909BCD85918B028516D457AC6768268D4AC9B +918DAF5D278183620052A07AD74B5E4EF480988A3B7C7B60749CEFF369AD834D +17CF7BE46C07A056D392B47C51E60819990F7866053D4669AF779B284EAE88AC +ADDD53071E56AF67D5E8FE94D40DF80642CECA4574BFB784B4A71783764860B2 +3FE0B9715EE5E8EEACAD25D7467018EE9A24050154F8A884605F91D855C709A4 +6DD003F4F8A8338C831E6A63C9910057CF64AA41B657599CC542DD43FA067828 +B38FE844140161A5BA285A63475A5E7D4613342979AE294B22DE48C44F5D2522 +10A2401201E6CC1E37F6C2EBA64DF3609EA4A6AD9BD70A17974BD62A44B43E34 +161807AB996AB4F7269DF4EE32CC5A960ECF1D96E86C06B0FC6289E786386B04 +E792F6383791D95C619D748C8C23E5A620F4FD80B10418819B177AF63CFB8551 +4EF99B4983226660AF71545CC038BEB4E28C4E89EEC9D060FDA005024BA552C1 +7CE25388D4D90A30EE903FFC0BFEA882C7E36BE2F459C58FC61E6E1563119EB6 +02D95B79ABF0F11DFDE0AE74936FB0B13B183F38A6701CF607EB6C9CBD2DF181 +0977F83D304387E885BE958DCE76B9DA5622CE7947A6513DC4C1709316062542 +203DDFD4A6CC4F30D5D7BC8F5094E5DA6A536AF6B48CEDA846B9C9752169874F +EC0D67A4E42700DB4EC2AC1DA24AF775264F410B66B73943FC3A2DDF6C3FD88F +6DB3E8B84BE775FE986139881FBB725197362B0CFAFE7F225553333E6CCDBF48 +97155511FB0A6F22A4F2DA2BFBBF668E647236867D1E6679FDBBD7180362FFB0 +3A1E10DAB77D38ED6D3EDE9EDF028C0019740B1C5A208F7122CE215C1C44BA8F +9E13AD91987DFD98AC9DA9D6EA226391FEE415D5691A31822195892760691ADD +06E7A2797A827055C8EBEA9D4BBFF4D450BC713AD6B2755150690304EEDAC372 +9D7CAD88C7FDE00887A85299CD76743FCC2AE3E399EB00F3EEB281E87CC8D0F8 +F14D1F8D8D09E7675E275BCFF9234ED5FE5842A03305CC2FD421B8CCE84F57DE +B5F09DD1523876124BAF09BF1A421C297C25028D181B87DA8C136176E4D6000F +1C39BD9A89AA1E39878B55A2389C26E0396CFEC84CC8E9A697E2320D3C3929C3 +ABB055A68713308FF7CB41B3C57DD37CABB7E29D7FF5DD776253FBA5A81AD20E +8FCD663217883F75266AD578B34F9E9E6E2E4B205258A71391BE51F7D8D105B6 +6B044B318CD713D120001CB51A57EB48D789F6F54CBBE0F23ADE7558E2CFE105 +7D8E0D380BCCABD895AE1B6E8555AC50A2776251D185022DE3F4BB08DD23289E +8A3151B39524D9DA4AC4396579E8B23D0390D488D8DAD4731B340FA4B2D0F95F +7F5D8BA3FA244CCC37BE5CDA727337C19B02CD59C4D289B7AEC80F3A9A7D359B +E9EA0DF3260A7E50585CD92191FDB83DAA5E5F44DF9643D738F38582E1D1D4AC +76CB9A05BD184EE1B0B3EA680FF1128A511CFA75A3278600F0044DE75DFA3A00 +2A1AFAF42E8447505CFC74795F1E4AC721FF15FF41C68A1B93FA5D0614953268 +40671FF68C47583065753B19D131827E50451BCE71B7EE2677B25643249DADBB +1C3457DE084B18539B3ACEDABAA9F0410CDB6089FB77D32927AA8707295CFD52 +9AA5E2AE7F355D00C6CA35317028EBB80856A518DB81029FB6F5590FD3BD3481 +F404DDECF6B64AB940E3609FBB0245A4F615BCBE016B19F052D2F627243AE772 +6CD93D7D485FF96DC10F741021A06EB06F283820B5C0E62DE4671F72985444AE +2C17AC2232E6E49B9BA13E2DFAB0EB4B2B24EFF70A777E892F5B7B7C44153BA6 +C7AA19FC1315A857F1E56493990DDDC452691ACC8A681EB658AC0B7C823B7D3A +8CB995B30CA3C44C352D0DC4E253B3B694EBB74568E08479B87FDFC05F239297 +733C494FF8C3BB84558666316BB7B1969B523A58AB2FF029F806A05B72F6CE07 +083F9555D982058E10DA3DED21DA3E431CD6D6E38D9CD69BDDB4707FD3164F6F +7BA22497CDF56CD36422AF0B666D52B2D8217CC9AD8B7DFE5157758CE9F9DD3E +4B697B46CA1528B22CC2C1FF8DD176A9E09BAFFE5ADA3E05F2B4E059F7E3349F +5668ACE29E19EC8AACFA92401EADDA412E8CBAD5A8EC5093555DFC25F4CEA494 +9D8C2535CF986F5C61EB1EA5C2D66ACBE5096E4F245AFA721EA81DD82087AACC +B3424153B77FF42C3E6CB150B29025F505DD2F8EA6B609BA9EB833D4E0976ADA +0216AB5F84C374767739EEBF95099FF8786390AAD7475202B3167B0A6087FFF1 +23CA1BF971119F80352C9B4C0F88376E9EAE7C5A27734F23DDC81D72FF181469 +79B707D5E74021A6D5A6EC8E327CEA46B6C94A7F81F974B342668AD0ECC85D53 +0ECE11A504FF73991F40FB42B3E8F002A1C9CA4C9B366B617AC0A790EB4937EA +D55524AC3ACB6FF019FFD5424E4593C3723A1B51C0C41935F5E4154A62ACEC54 +C5330D0B9235F6B63A814F6BE8AD1F4CC272A479C23CE2E55D641CC7E8E5BD04 +B28C3FAEE26F4BBCB04BBBAB9E414E68666F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMR6 +%!PS-AdobeFont-1.0: CMR6 003.002 +%%Title: CMR6 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMR6. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMR6 known{/CMR6 findfont dup/UniqueID known{dup +/UniqueID get 5000789 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMR6 def +/FontBBox {-20 -250 1193 750 }readonly def +/UniqueID 5000789 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMR6.) readonly def +/FullName (CMR6) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 49 /one put +dup 50 /two put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2DAE339BA29C1C6F656 +1DEF13780383DAE38A868377CC7D396B2A05F341AEE0F8BD0A0191F51AD11A4D +2E927B848A1EF2BA15CFBE57A51E3AF07598275195C9613041F71C1AF39E61F9 +EFD5F6512FBDA76E29DE6B508F62F5CF9F73F5288DF1C7B0B82C92D3B6358BAD +EC3CA20BDE55DAA7CC58004AA86B6CBF8C410D8287E88BF20588A39309C2B703 +CED322F030AA6069869064486CA651DA054FF3F5E56534CA358B0829A6B954D8 +9103436E6B06DAD1658BD4A95AB41343B01F5866FC87C4EDFC71F1477C98F8E1 +1DCF27EF743FF90BF918AB8C4E5AC35841E2F745480E5EDE1C1DEAFAD8D0018D +2C1F1CFCAD9F6609859DEDFD1648A6CD23D8ABB80747F94899F17C8F3E6CA55A +E176F19CDFDAA0D7C920B3A72051A4745560AC81978C92459EEE5AFE85AB247A +32981139CBE352B248F4BE5F73503A084A3E91F05328EE521D9669E44E202584 +5407E7846F9FEE3D54EA18FFB144BF2D6803BF65AE402034B3CDBB40DD24217A +3CE0E95E2717CACD603A958187C42B3558AA38D6B6390EEEDD396F96E6041FCF +6F8888221AFA87EAD79F46E0E32CAED91E6C8500879AB6E580C581E8C8CE9B68 +2BB5EFE2604E8DCB2432D39D75EE556969F1B2FBDF6A4BC72D106AA7CF22C268 +464027898B311613E06E1584707F262F71D9F49D2149306A88E02BC60BBD6BDB +EF41D90F19197BA9AEF32B5E63D5B9FF41B5602F9F786E76621DA54D574981AB +87A72081EA05D6C6BA940EFEBD0904EA4E77BBCE17E20B42E1722617E0F6EF32 +F1ACDE9D758594E9C81049CCC10605A27C2A06872FBA9F159CB155609B496ADA +4886F478E44029B5E620DE8319E257697E93E1CDFD27D560E2E4D34507020E2C +D9FF06BFA14E056D81DF701FAC3ACE4BE6C098AE116E079F0044391EC1661F6E +7A93B9320BD7F91E8FD2E8EB3F5CAE997D5CDD35107A1D35302260D1499B8B65 +39625B7925F97D917B66BAFEEA992873F07220714F192839948CEA080BDB9A03 +77B9DD032273DDB5629CB28B5D8797EDEFDBC601823E038384C90C79012A7D96 +8F27784DA15BACE21501C26E3AFA5DCCE81B52B0ABAF71A35D33103EA86F2415 +A39A830D559C5C6CA7423945BD3DFA942B20A06D7A8D8671F9831DBB52907AB4 +4E54776D29C6085CD9970B6DD21DD3EA8EB09C49CBEC6CDCEEB0BBB1B8827109 +3BDE64DDA024D67F098D6C1998506DDFF7907ABAADA1C39C759C850E0C6F8E89 +A392D1C9329ACFFA92D361218D75E115F70A47C53B73B356D703E9C499AAD098 +AA9C8119EE9E9708A9EA3049E976FA19AD04210D5F6092C7903FD155113F3A3F +269B746560F70970AC9F8D09956E0E84DACE4112C4E7C7F6B3F0B63D26EFF95E +2B2E9699D16BC8AFC4AD9113AA3A974C9E82E877288CF71E9169D2DCC61AAAA6 +C536E5604EF0716F6487292BBB677518504B52C63822BED3BD5FD14EB41EE6A8 +AD4B6CF90D39F98E12A765B645CBA3E8552FB9A986390212CE119E7C3DD675AC +17BD006144BEC534DA2A860188619F17589008409C5A309CB83FBA70F6446B6E +2B56991B6A03B1DE10C621591CEE45BECA27C54BC8B4F1754A9E8F660812710E +117850E1BB6FD89BB13F8CE391C43DA89EA67E9C3E7A4697790EA26B0E4E2E80 +DCA508873A7AFFC11B8C02EF86C2316E8D8B6BCEA37F81A3A87546705F070C3B +9D4D28C366CEBC1EE485B8E2357DBE46E86C87B9939DADA60888AA9F1B92FECC +CC1C198DDB594BB70A8FE690ECAC21A414BAC89BF019F34D2A130F485EAE35B7 +2A10C67EA3A48A4D9734759CC93AD85C6A570500AE5AC9973FC76EFA06BF5DDC +26E20E28D16B50957EE01AF2653F8D860817967AA5A9BF9BF7ABCDA710E9F34F +4F0EBCC32B3C9C2971F6225D2DAA6A451366B83F32B2ACB83E746D365B2DE38D +C1AB7447FE7B37F9630E410E5D8F0ECE74DF46C538947B3A167AD9F3E4A7EB3D +60F5425AE75AC3A27D39311DA35696C3DC7282AF1532E7AECE63D13DDA0296A2 +01487185FDF1875AEF55A36C17D6A8DD329279D229259463A2F05CB7A874374B +E2320E1F6CFECB9C1CE62FF468C29751ACD9754AF1EABE8E7696C2888914416E +235B6766F20FFBEFF285277B639A51EA2F2E30D207BC891B00F0436008F980E0 +9EEE7FB375BB069B9E0BA11DA951A99D8E60B4F920A0495C247FA7DE904765AB +DB5C3B2D634757E43EDD6FAA4DB3C67F82D6853E1170F0B2D8CE496DD4E72B0D +28277BEF172F1402959F64527F9B640619F04416DDB9D05FB2ACD019CB9C119E +E544D24EA6DAC5C69785394EA50E6EC9AAA9E14B904EAF29A733C6D7942B63F4 +85729686742F26DEF78DF0DA1CA7CEFBB684F4CAD99021A3B3D1FE03B9C5A4B1 +BD04CAC89BB91B11952A2B17A61789BEE0C54B46C03FE9A1AE73D17CF94BA30A +237C29D414C3BCE8E3E2DDF83C0BD59DCB66C4D2C3DE73DA8378F3C6C8035D28 +7464399857E57651A53E9C4AA68DFCA91B2376CF98AC5290FDB9BDAD9EF1604E +9B0A70EDDA1E564B6D2456E7BC722454ACA8C4950FDD44B6EB9AD01169A9F845 +B06A0DDB7897C847A5B1F42258AECF3807AE936C8F52C3A7A0A85D68160AE442 +FE81543DA6702D76AB6E8701F80DFC1D87C961E350D0E52AB2A298B9E5908600 +7E14D2A87309043CBF13F69AEAAB1BC239DEA88EB5176624F6046664B1D2691F +FBB2071D3706F97DCCA355A6DCC4D09FD35DC078FBAAF672FFDECEC61050A120 +10B5A96629041303FD01ACCC7686165DED6AA712FF8E5E85DE33C4E7D877C49C +6C469A90410BAF60BE65ECD91CDC2EE7AC0CA8BA7B53865F26092BFCAA0BCA77 +B80DC51DAD09C93C8DD8E43502B4B68F3D5918C3492196292447732BA90F5AB4 +9F5E1D634ADE1CCAAD028DE5EBA9535F6FC5908DBD2D643E0A7E059C8C386FDC +E72659C0033F535C0D7F6B98D0335552D0BF3C6E302B672A5EAADFCEF81912E3 +8F54E6FB7EC2B325125159713D0AC50DEE3673B9B148643727E94C80971A2E73 +5E1E13237BE69C84FC039DCE02ECE2668AFD047F21A61BB94A9F498C9FE5CDEA +B274B40728B6F6CA9B6C15BAAF92F465B0D7311B46545CBA90D874839443CCB9 +3110F052EB247B24B45A3D2FA6FBC7EB2A4BEC2A5892914B3C5EA3F4F9B9DCBF +6F932D95700E045B49E4B1F2C9D2A42CF39CA2F5A2654E6E8E6E92473D28AACD +5E35C6705EA728F704F5996D286BED433F976AB7E018621A577AED7C0AC0A84E +A032FE1869F603E6F20386E3A190A30A21EA886249ECF8CDDE2C33D73BA8647A +3DCA7A8DD9E8EC8D9A415D126BA38B6771C489DFC419303EE9C1B83FBFB3A0B8 +97D64F30E4BCBEC24DF603FF3BF541E00D5804B6B6543D3D2B661CC551D497A9 +9DFFF535AF424B2F3150BB39AAE8CDB306AAD37767BA10BADB031DC2FAB16955 +EE78342CCC0E8B5976BF98F215461A8C6F63EBE6E2F1A1104662DDE53388CB51 +8B44F3534853B8095F3B746A2459C2EF800FB1EF7F235EBAA9731E3AB3BE4369 +1D3636E3ADD5BDF0C34FA80E90D8A1DDE770943FD196E0A7C5F1FAF6970B34C6 +4673AACA6B2B5C12B9608521AE736C1F4B97209B063D991300ED5AF3D7F27E76 +68E0B858FD8BFF86581E2B9548C691E3E5D9EC4D39C9715CDE86C7D22223CCEB +8A38C776A30AF14912390A7546DBECECD7A687D4F08646E57A12C80DCA022B7A +33399761A50B8E0ABEFA1163EDEC3DFB5DA3248792EEEDD894872D4E6814B4C3 +548BAFCDE0CABBCDB97EC6D1BA47F2E77CC1389BF19D73661749AC33F46A618E +A665A85776545BF9662F2179D7BFD604FA8EF4700591AF3AEC647E27B24B76F3 +133F9198DC15C1AED830E737909E43EB91C334C44BA35810007A3888E33F5DA5 +B3B2C35481C648AFE630CC3E08F77744E401B2934E407D1EC17ECE737606B076 +F8DE8EF3344F57495EF49D11580D6FB28AE0B1422521B320843B13467501CAE2 +3DB93D7BB779F73B6AA30050DA74BDBC3F8DBB30F32EAFD07734A151BB2BAED5 +C9B1F790059339B64BB4146470F30928C9A49AE88906BD6FDB7431A4B50809CE +0F67ABA01CDCC2320B0B097187B9299E3D80CDD7BB5DD5BFA7B28D924C5633C5 +45A23CCEE097C41C3759C1FA8DBA0DD95034BCA89BD23FAC18C70093F40FF2F8 +0FAC5DD4835F2DFD40540E9A9E9FD951A8AF2CB766597DE00147B163BACFB7E6 +EFDA4DED594F1C746D8B46A1145E0E4058F5917B3F21E9BEBDE745EE72CDCA64 +FB31EF7A2E55265F32559480E2B6726D3DE26FFC97EB4E3160F117E890C4B2E5 +8DF310E6A728ABA85540F571C024F8DD58E1D7827FE97CED5EB31547EBC36415 +02B8C0E10B7E37D816F01D56A364B8552CBFAAA95BC4BDDCFDE91CE0EF005B4B +7AB56FFB47A093AEDF0DE1EA48FC8103CA3CA1470864D2693E360006D05668A8 +AA422CCCED20DCEEBEA5CE0DA1EFB00FB93E922B18124FA11A88D0F6E0F719DA +57603DD5DA42E1C56C2FD9E5415AA199D4F334C151C1157E75C107FBBFCEB706 +5F4EA47A29B54ED8CAEB8DDA2F53D2A703B95487619780A52DA1270011648A28 +AA64338E04AA5B92C1EDF3D8DA34FA6D227A0325EA6F22E9B38B6338C657BB21 +CD4C582DC04010330F62923F817E4EDC6E5C0E6500F2A975A8A95BAA30C4A134 +BB31B5AC45A2E7F6E9CDFC810D41344C4F606049445F8E93D74271C1E29DF7CB +5459593BA28AECF64D903D3E4D77CF5C04B06DE44A41EE4D9FC769854503AC85 +69E4A5106E84016DE3D59865D4AB30BD6C9E45C45DCB5408421CC50CD6179C85 +34E55CC70FBD8FEFE9F1D5160664981716E3BC7F24B6F54E0323D9BC4B692971 +24419EE62D8B0BA726E2B4294A9A76F328B8101DA29E78BD5C4AC383350FE196 +4D42DB1653637D19530124858950C22F1E9CF5BC07D46B7A58CDE19CC88DCD2E +7FE4EEFD8AA6047E919823C8CAB2EF5274F45E861E6508CC11A8AA90AED2403A +B2BF1315C2157B3B50A3685205D93E40906EEE9DE5985405974BCE0B84BB37DB +080A45C5237B269B93C0A7CF294A18B45464A41F604C494CBEF829A381155CFD +71CEEA54CC39EEDB6DF58A9896246B09F95DC6BC40BA6916AAB5ED3D24F66154 +3662F8978FC63DA9280FF7ADB09EA5BA79D3B66E0C88BEC1EDD78DA93839073A +A4D7B0E627000C4ABA76C47CCFEE92E319315333A5584A951E34C55412049C4A +A5569FE65A006F77B416E0530AB6A8E7AD6C72340AD4CE25937158FABB2153EA +281E1D840206F5DA38E00815E9081F81DAB9FAA8F4DAB305867AC84735DB4F52 +A36129929BD2084A8EA37BB6889695204BF7290B68D5E722540BF8A276F8BB6D +451D582EE59D2FF03F6B97DDE05FA00C3D375D2D0AAC8FE298F85CC067B15481 +48D70B6A0354C705715B891915FE8EA45244677B9FCE81E72D66177E309F3F83 +F744B9EA9E55C3B30DEC6E5E03B3988FD526A82A5E8E1DC79127FC62B2FA7949 +B3AD3148868DE22BD4B5708E32CEAAE6ADEED1F463EAB9692411E18F8D6BF391 +126B2700B4CF3B59D02E3F8795130C96285A63FCD1E0F647ACB1D35E9C58BD01 +1DD06BABA00CA4343BEBEDBE677E053E9732B33A7495DF51782A07DA07F5646C +770C957AD915CC70BA8E08BE7A1F4E6BA5BB9C603E38F6FB0A2578471C4D02F4 +283069856D926B9076EC73AA39CEB0A061AFF1575C7093FDAC9F89C3DC06EA45 +06F3C2A3BC9FF21128B10CB758DF0F099B459A5264A8C24C098110D2BA1A8532 +8FAE146A91BA7D033F591AB1A94B8A6FE0FFB610F698D216D58B4EF6C87B1524 +8037CBB7E23D8550A620341C6625A1A2ECE7CEE2598D66277F857231A36155E3 +984F147783E9B93975AC38A29F2FBCF704C8A04AD84C3E04A12D2321FA56811A +5B6744813CCC187968C5C26BB8D3E6615A912FA5369C01CCF8C0DB790593B190 +1A90CFB5339B8771F325C5FC448D36C7312B11A15A8635BAB59CF3CAD176131E +026F6E141B2619EF7F3048750CC9291397F141591EEC8B612D6656DD34DB54D6 +DBDD303CED74BE76664E7DC86FCFEEF2001C9DBA56418FB61F589566A47AF36E +C94671C5E8939AF9F4D53C0DE7142B7B63C86AAFA65877EBBB48C64589AFB2CB +1280AC099FC48058855CBDEB6C2D2A0D092267996591DC3B5EC8252984E9B27D +2E9EDE8CD8303F0905DBFCAE497DE1B755B924452CDE11CF4F20893DD6FF7251 +427F520FE00580DAF1703FD968E0F8ECCDE618E1EA5820EE6CFED97C78864EF6 +26FAFEEE194A268F24249D44829AA360D731C34DC285501E966A959180718F72 +6330E4CC060588A2F65AE64A720DCAA818D49D4440F5D0B6C1F6C3A107E12445 +F1BED2D3FCBB87A9597F01C7332AA79143564056219BF87D4B907A04F77621AD +054935E883B2B137D3D1C4BC792E8335CA08B6D83227F35736C41312A0BB077A +60FC6488C5E02FD51A10AC113D4EF70038C649C1677B2204A77F2ECBE9B3C341 +F4126BECBCA61E3F3801F9188A3775924A62D30FB096B440286FA655EBA00A74 +9A4162904BEA07CE68EE76018346DEEE20839C9A2FF71179B58E1D4AB30856B5 +F5D97295A097174467010B15D733AAC5813CAA633746B430B1AAF9F997FDAAFD +436844D1A56B8E25A89D2CC4BA6EE7ABD167818FD4F6C747E07B262C99EE2C35 +323F0B471586CA50F54C6381B052B15B0C58C19DEA82C0CA29F00400B727419B +2379979CDCBFA966AD513FA903160C571C3BF1BA239540B11EF2371A3880837C +6D6CA2F374280CFA1586427AE975A2AEC34244874E4D441DBAC6CD1828841C91 +069AA87FAE849C5DC7C9EC1B9876E59F3CCDF8BB23D939F5348D7486934BFB02 +CC5A22541ED352616830A510DE7732E5D8F7E785BBD31C2BC9D348CE5632654D +2C1740F89D57FB2AA1FD8FA3304EA03F757BB8F498ED98E48485722E78D97B12 +A05F3A28438084D1CF90AC4C3FFCD7B3365941C45E1E02CB13CA1E99F7FA1D00 +1C9D489D5C95F019AB4CE89FA3B6604473DBD2CE8E278969E0A0FCBCE68C23F6 +9381882443D3FC16966555FC222F3FC4B1207522201AB7A15A7A6F22CDC9D392 +360BF4C95DAD35770E0AC7E5EFF015F2C74ED7391F40EC94B8D1C163B5DEE5B3 +911A20C2625AD3B24BD94D2A42405E655DA47D3F94F882CA2F479437B4E0BE71 +8AFA4482C6FB270F8D05B4599A01403DAAA90C01DF3AA7C2BC7E66AB6AA833AD +FB6E5EE13E45CC7CE7E200FBFE639F9CFFF5D08512C02764997FD28368969BFB +0876F236EF6189BE73AD827332DF1B2EADEAC0ED3B939CE5BC3CEC78975FC636 +44FCBC2CCF4396AC7343EC62E0E4F3DFFA2B880BF31D93ADFE201BE9CCEC8BA5 +0B9B919E05B851E0909968DA259EECC6AA0743F25247978CC09C28C4F878E29A +5070E4023BCE95FE0ACCCC01D0EE219FA8344E8F6D7D4347563BF8AC030B9097 +41F24D4BC9494915A82EE9FD37FBB6A46BF077B728FB569B1258CEA5F51F36BE +4F4D0F890D782E44748CA3FE8C8A515998371D9C7D2311F192B4B7E7C68FC6EE +3F7136714C282A2570FE591F247A08319CE9EF1E43274E4E57166E31A2ECA506 +85350DA31AA4C33C9687F5210BA225EA1007C444FBFA2126769767E47A967884 +9F68589E4BAA9ED32A7A466DE35554C132810C68ABDAE536D9D884352F28EA02 +8A555D2CE11F30598F44A65E2D86B43ECCBDEED9E4E5B5B7DCDA20EAA09D9FF7 +422FC91F2201431A9E8FC624FF44D26C0100183D77BC7E6B1A6CFBD3FA8BABC1 +AE4CB0FD382E26BE0A83169B46D91429DCB746A0326243E212F802AF6A56C709 +6E70C6C7CBC54F807956DE75D7C0E689B2684E95F1E619B02E026111A02A8BE2 +7C22515F25EEDEB353948E35E582F8DCA2C44BED3F3B18642ECDFE919299665A +FDFEA129D42686CA54D497D94C696B040884D24220D76E44941BF1A18B33CA5D +EA6D560CBE38CE01088DC057E29FEF0AEA4B4168A952D0B5A7FF2C1B3B478090 +24C36CD8DC2487F21901056FC8BEBCA67AA96790F83C446733340E98F9E80E02 +F055F4B45F2470F4C21972CADA01A47250C143BFEFAFABF8D46632A48F594986 +C30DCAB51168B2D9682C427F67D420B63A7D252B5DFB45D0627C6CCABD8D5F09 +040C3EC3C3752A781CB248F39924F3B445B3C12DF049C08849B6EEC7FDFD368A +EE32F0FE6EA767B16D88697F182E52F05CB1CA210CB696069E73E6135847EA89 +8C07EF5AF449BF57CF1FE36AF62EF5ABA4A973266955A1C43A8619EC79C02391 +776AC8EE11E2EEC3443FCAF16A8FE034D25B8DE1155C6E93634D0D83D7EE1374 +9F95AD2C92C390BE93CF536DA43D742FE6777D1D60D0677C1DA704ADD82B4F76 +2EF0039A3813773C4B6848ABB9E96055F432C32AFEBAF21EF58E1DD3DD6378A2 +08D816F3BE7E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMSY10 +%!PS-AdobeFont-1.0: CMSY10 003.002 +%%Title: CMSY10 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMSY10. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMSY10 known{/CMSY10 findfont dup/UniqueID known{dup +/UniqueID get 5096651 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMSY10 def +/FontBBox {-29 -960 1116 775 }readonly def +/UniqueID 5096651 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMSY10.) readonly def +/FullName (CMSY10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle -14.04 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 15 /bullet put +dup 120 /section put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CD06DFE1BE899059C588357426D7A0 +7B684C079A47D271426064AD18CB9750D8A986D1D67C1B2AEEF8CE785CC19C81 +DE96489F740045C5E342F02DA1C9F9F3C167651E646F1A67CF379789E311EF91 +511D0F605B045B279357D6FC8537C233E7AEE6A4FDBE73E75A39EB206D20A6F6 +1021961B748D419EBEEB028B592124E174CA595C108E12725B9875544955CFFD +028B698EF742BC8C19F979E35B8E99CADDDDC89CC6C59733F2A24BC3AF36AD86 +1319147A4A219ECB92D0D9F6228B51A97C29547000FCC8A581BE543D73F1FED4 +3D08C53693138003C01E1D216B185179E1856E2A05AA6C66AABB68B7E4409021 +91AA9D8E4C5FBBDA55F1BB6BC679EABA06BE9795DB920A6343CE934B04D75DF2 +E0C30B8FD2E475FE0D66D4AA65821864C7DD6AC9939A04094EEA832EAD33DB7A +11EE8D595FB0E543D0E80D31D584B97879B3C7B4A85CC6358A41342D70AD0B97 +C14123421FE8A7D131FB0D03900B392FDA0ABAFC25E946D2251F150EC595E857 +D17AE424DB76B431366086F377B2A0EEFD3909E3FA35E51886FC318989C1EF20 +B6F5990F1D39C22127F0A47BC8461F3AFDF87D9BDA4B6C1D1CFD7513F1E3C3D3 +93BEF764AA832316343F9FE869A720E4AA87AE76FA87A833BBC5892DE05B867F +10FA225E233BCFA9BB51F46A6DF22ADCEACC01C3CD1F54C9AEFA25E92EFAC00D +7E2BA427C25483BA42A199F4D2E43DFCE79A7156F7417ACF78E41FCA91E6C9EF +B933450D851B73A6AB6AEA7EE4C710CB5C14270D1674FA334686653793FCB31B +491E870D3C2BC654D2C1DE463EC9BA29D7371AA1078800EF93D3F66263A2EBBB +F5723697BF7448BD0D2E301544BECF497FD475B85DFEF52AF4F8F8BE445CABE6 +019318806D10C5952157FF8F8286C1EE701545C8F60EFA854EAE66835A2046A6 +915D395F1E0366EFE0C0391583FE001FF16D82A2E2DA5F57754A2C6F69306E36 +356ECF8EFC3F1188AD6FCD2427E0580C97A5B69B4E0E09B85EEDE142F5ADD2F0 +5DE51D6DB72B127412A0D57106C19CA493048A4F815129ABE767D51715B1515D +9C21067CB5BC88741B7298C83EAE36A866DFA87D8981F179B1C31292F56BBB64 +3C430779468AAF07C8A8B4934E1E775FE3F35186BD1FA6EE3689C1C750678AF1 +FBF9B23195A124C5C991FE670AC0C86FD39D2B07B9A319E74EFD498B45820252 +720ECDF7294F7B0B137CEB86D33BFCEB8606985A3260FD669E461C8BE94216C5 +D434FD8854F44EE66E5A289A9F9E32BC36AF645D53F96652602BAED418C8D726 +BD04A1B4617551FE4DEF54083D414F7DCE004E6BB2DC9C2EF7CE232B254BA2C5 +7DCBD36C2072ED46FF711F121A701E2284BF1B718B3164382B8F453D68FA0377 +DFE106503B8401D4DB87F5402A3AC9A442FA060B0610A9524D530C7157C26B56 +AC970FCC1D5655FFFFA39246E6420CF97D08ADFB7B05822679BD40C638DDF0E7 +A97BFE8918B611A145AC965C203F1428812F9D340AF499B3A915B22BE798594E +0F520109FC81E452180AE45B170FF999C5FC2761C6CECD8742A5A6FC97F16743 +AD4EFCC6572A6D3F3E4E330C5CB2FF6FEA48A5B64DD3DBE943BD9918D4A18E18 +CBCF598AEFBB6AB3CD2CBC9BFD6099272F6543F3E532E0E21E614BD2880B1023 +0AC234CB705827BF016DB84E00E8C255FDEFA0101A842929540B7B4AA8A089BD +5EFF05B72356B6BC3727817823B5CDBB1B963103000D7F2A4E2A1472FC3E614B +5CBCB6D6D784023173DEFEBFA8F9ED87EC1A0A9EE98CA59CFC964CF943DC683F +E9E00DA718C4425A705A69D99988EC6F152525C790912C2E46A2381A569424AB +54DF4798BC2D7E7A361E7991641D4B756CE2A7FF4A2848927092C59C2C4B8809 +E13AB84FB6B111E680D7FB9F2FFC2C5C66B0B501E4447C2E46C10E2F6124476F +A140C404CFE2DC9E0199BF61E035CEB481D438139A9630934E541D261FFD2906 +4CAD99E20655FA746AFB81EDBB5601F5FD6B1D6832A01D585E2C55053F6A7378 +4DAACCAC7608DBDADAAE732D66B3E7F87E79756337C1A961E53A4651BE7C77F4 +038B89C87F650C54A2A90EB7F1D525BB353F33318551EE8D84A6A83C718EA5A4 +B2AC0F7306B1E095819B87015A90CA3ED739B09061782C28CDB36BA4BD5E5308 +5CBB70414E4112193DAC4A1FA30996327230D1E021F3CD8115E12D239D93FFDC +B645910EB29E40D830E7BAF2DB255FD7C4E776557BB38157917D993EAC245837 +A3B515147043574157B8342D829C7228CCEA843ABC89D1785A9672A5923FC4CD +2F3FF27E6FCACF84E2D3136CA2C0FD3EF1EE7354CD04C38B5FB874553646ED2D +CEDF7E362EADD04B18051F20A8FB0DE18E152385B9D05F98A3A7EF177824E246 +455ABE69E2F700EB78185CCFC07E3B4C6FA301112528D977367D30D0D5D59EDE +FAEB706DDC970A9E296236C725B2B55B09B9C336B8E23CBA5FB8692D56F33B03 +16294E5FC7FAA42E96395A57CE51CA8DDD77442F142E2E576B778373FB31C81C +16840BB422CA827E30A81829648BDF1CA36700EA32AD888D097C1FE0A05B2D9F +483AEE40269DF09AF0D1AD3DF80C45DDC59C2A03FBB661C79B87853737C6D352 +67626B657321B16198DBD6DB98A092F17878AE4698121E1006E53D6F9B0A3BE2 +3FB68828EF854A0CDBAA68B37ABCA6AD4A3D809AAF0BAB1697A81FE59C98C472 +1E33CD70A75A22C249DD11D76C2575ED3370A25892A16D2FD569CDA70C130770 +93F493C7D47D6F9A5424A7A542BAD726BFC3AB225DCEBBE6AC4BE006F8C7C0EA +051424B08305BF2D951AB2986AAFEA04E078CA79B399585BFF0F1ADCED02E15B +8765EB6BF6A8E4D0901EFF2C3AA104924EAD9637A35D877E0C51A3C37DA78CD4 +8643C8CE6DCDDE3F116A6C2390F948E5371BEB5AD2E87B41C5F01FB5C196C436 +6E256A88D082E3F46E4EFFBF605B2EFF1E9D9AD5EE4DDC323A137CD9451EDEE0 +06F7D82898D71FAF2362C0FCF1F726F97F820305B7CE20728CA08C63575083A7 +84BA28B7DE2B916432475510E274C12FFD1660A717F51DACFDF0A102D85224E0 +D6DB607BB72569ABB8A7BC6A10354CBBC01732EFE35B72062DF269CB25EA3DE6 +DC603B04C90C5912D2C38D7A5ACDCDD3F6F116D884F0D8C528F69D5D47BA20DB +0A9E585C7D8CC3C324FE8A1DF150279F7E8FB43BDB720E624E5E9918032C02CD +8020636AE5C38DA2484B7F4B34163E0D0A561B43B80E97746DC05C871AB620EC +C5D47101ECED4A7E25F291184BEF8B80024AA7BB456C1B83A907652B331DEA34 +754226C39C6889EBEEFDAD081E01EF8FE47751987667836FDE4C8BB8A3FD4406 +1E643B4EA37BD370734D1A2DB17C2F4B74B4ED75098B433601F75A88C9A37A05 +CCB157EF6E32023BFA33973F3E655A4D58289136996FCFA61EEABD70791B6523 +1FF5DE71AB8A17038923118A5EED8D59C4C58D246FFA9BB26472346B40C8741F +153D19CAFF20DD2A86C6DB89154A630FB1761929FC3F0448EE2F089C1C953E02 +905BA8DE75D101A982A611056C4B237596C10951DD98BAB838B742D3CF7DE718 +617DB72E5268583223E37E029D1C8FD3F1D21690151F76B76C52C725CA135CA2 +8666553E863CE188BFC9B99AF56AC2DB5BFEBEB12FB563D00244EB89E478657A +98AF2E1223C1ABC25A4500E8119B86EB3C26B8A2F3505A3E5610F89B7C34E278 +53FA0A54A7F46D84A35EFEC36AE660A9E3C37EE3864106702DE5AF6C45ABF64B +888A4A51323138CE77DB935576FE6B4824B6942DF80625098CE1B5B32B234F1D +052A9D6039697118A9D793793775D8729D8574A2E74D7109C7B7E23BC5E2E87A +CA8E019203952A4892544E1AD3D4EDD22971611358AB230E9A2ABDF00A288501 +A01B67C42B33F6B78C39562DB50F4663B922D9BE0D8A150311AE44B83C1F129F +07337323E9A23211EE58E16043E127C6F9574019179F5635648A011266677B56 +B5D0201A4E1470B952A1579B57AB2329CD4C615395023C653F784D36B5EE3672 +10D191F29EA508CE84763CA4CE7C2C5229E38E241255A5CABCD6C7CBAED901A2 +CA53B5E24111921CDDF83578D33D463D70EDACA0E470D8F592303FB6BFD68B4D +3F3BE2D7C5EC8BBF10C90111A33E205F2649B56E8443F6FAA6C721C66575AE12 +D4C40F1F46CF9E9DA675AB5D5840D938780CD9E4AD6736ECBEB6A4397613586F +849B51048AC5F9405E03E14540A5E5582F61CDCDB57EDDF95A8C6705F433EE16 +648F098C03DED8A2AD94AE3DE202D629B9422ABB031318D48F2C85F9DBFA17BE +84708AA3B6C9F81F4508F7A5CB7B6646AB8722ECF817877B77D473F577556DAA +2BA0ABACFCF5DEA7498C47328E873019A956FBB250FD9D8885D21D368FA70CBD +2709D2DA44EE7A9869963EAB48789541906DE49FAE785ECE1F18A22C7E7ED204 +9768896B78E9EB7A2BD6EEC1B26083940656ECD689D92942CC8AF05CBF82AED0 +B45A7DF4DD7AA6526FB597322560B9ED3087A65B5EEF1371C328A021411BFE3B +D9B5088B2F1AAE381FFED52D2D1E02CD0DA78683E3B06171CBE94BE9760005D7 +135893D7CC2DB097F6AC664D9594CF1C650F84DA80D2EDE04802DBA33CE3DAFE +EB7A37E8AEFA4FDA6252FF21E8673DD98E67124D5DBC7BACF361E57077B71939 +C1D1FB923E4E35C075CD1BCBE0E80DAEA1320D55B43EAB45D9B26C366B278782 +7519FDC482D98839BF0DF2E7C3A56A1C1A3FC0E57A75CA414F6536C1FE8EB7A0 +4ADFEE3BEDA0F53BE8CF5F64230784A797133E8CD46BCCB3BF38BCE38A73CCE2 +9E073ADE792F7128231DDD1F63E6156ADB2609C200837C2E8A2D93D2A7BC9171 +050C709A71E44E32B1B03C92EB5CF1D3BAB1C38E027DC4ED9AED633D98CD7486 +3F773ACF8AE332631CF2ABE6D606607593FE862ADE31803964E3F4DC3CE3A271 +C76BDD95C87CDB3B87BC26FC7A16D567EEC62E6FF0D471B4853DB8A94D4CACF8 +843824F818083F10E88D52FC4253E8203292CB40F1414AE7E51DD7347007C342 +CD70E8E9F2D2A13D71213B841DDEAAB208AD9EA644591C15DEB084165F9DF24B +B91D3BBEEC2E34E38EF16A0C3F00700A7BDCBBFED2EC0D09601AD6538288DB50 +3478B051B5E16B604A0341FE621A58718D960D699D3FAD284310DCF54EB13175 +19A75A539EE98E804AEA24689D3540F0F12951A3C01FACCE9A7BAF4D0DAFA946 +FF65A4D2A4C39969607272C6886F44E90ABE27CA3A1F12A29D9B32E60E8E34F0 +17C5FE43D0E69A99A922D98909B2BBCD145E59A5E7F5426B3988F73B09A525F6 +8BD4915663C1301323180E760BE81CB874B020FDA3AE63340E4261E4F3E4949B +CC0966BDC4426190BE9F5D77F76A72AD925662E5FE1CEF9CCAB68F0BD33DA003 +F11EB91AC4502FBD6AE48DA0F9D07C35B96B103E379B8A83A05FE728F1716194 +1F650F75BEBADB2E3810388F3E2DC7B19F1BA9E32925F2FD9F19F4E8701F3E4E +4069125D7C401144740691E7A460021A47B1E27997FC1DDABEC5BD0EE0B20194 +2D579C7D6727AA124083242BDA46D8E116E2751C5F298851A62B60AEBE82A929 +9B9F2492BA35690D1EFD16215B8EF14E7A3803B93C28FA41D971B05B6AF3B593 +E74AD1E68A5FCE12A86E63B78BFEA87D3949FD164F12277A4688BE96356791CB +8671C49365608F3EDECC109321AF92B4C29CAF073DA3A7D73E913D0D83FAC5EB +BD884D4C686056404DAAAD6F82F94F803FA1FB0DD8908D1DF08FB87A8BB83027 +04DE0CBB1C6FEB6B517FBD7CF065120079E608CE41893C2BC96A347826CCDFD5 +C69E161217F2127A59F1A6F22037641613F191F22D5B4CDCBCC2EE5615623404 +ABA7BE6C5FE475481615B2AC1A2412E54688DD21E44CC9AF5F16E634AFCA389C +4D740B7B51BB141BFAD1080E7C726C1606A28ED492E6BDE9F800EFACD1513909 +84E98CEB6A0B7A2A6F3E1D1DCC3B2552795E0932673E59ECC56DDD37A1D52BA6 +C3F0E905978AB568941A163F4CE3AAB5C5B16F86016EC47BA6F3F7AAAA77C3B6 +09C8C3ABDB6D514A76ECD37C37AA88B5860630B3406B494F7725975596F84777 +D9CF48686EC9C5DBCC1D78513F591C7C10AB9D153B3D41426B7BF668B0D04503 +56BCB686258462C1DC61095724B9F3312316262FD7C1AEC6E54DE7E5A7BD8EFF +035299B8FD8A4A7B0F51404F4A760F4D8B4C0FB7A32FA4B2383AB6E9C78FDEDB +FE6A5788D38A6701B123630C2A6D820A684166FBBC83DB17069494FBD411B333 +CB37E2491C5BD035A33867A6D3A3D420CC31ACF43AA07182CAAE67E40EC63663 +B678F71D4C6E0EC3A0AAF904CD3AA66E0DE5E3CDE049E94249B39A1C06E3CE9A +F974B2484BB2CDA14282B9511E505B3C89F9C802218AE40D1A7541335C5736DD +CD565D4B9F4CC78F3A393737EDB4FBD0DA299E21CCFEBA5478EEF013F0552A8B +0BB11FF46CCDB784E8BDCF730A16363E66572049E42C695886EAB42A9AD9094C +B635DF4B5B9BD9B9AE8455DFA3EEFC77653190F9A8B1E93B7281C2A21EA7DDA9 +33484745BDF7E3DD63C7AC66C286C9A5A698A5E4D7A91710B7FF943FB23609B6 +4B442F83CB795788FAB5E9CF3F75D5487DA26170E4561C7941C910B088C3B86D +F844B0F340CF82786A3FCF347048463EBD2006281A816627065DDA6CD4D3AC5E +2024BC96C7D896381BBB567951E7A1F29D4E95351298B000D29E5F3D0448CB5A +CFDAE1BADE9403B90371C3A07D208948AFA022A69C519434B6813086ADF518D5 +88E0B92072A44BA1B3EBB630A13B7AB90992E85B6D67361C8D96F3E0D826FF37 +17B67E4B1EB7BADFD98D7F4FD17BECE740ADF13C141EBF0A91CB105DABB32FE0 +55086D56A0D358841D15FD349E6B95512E4EDF4C430216FF85C2ABE995E4B40A +A6044CC8820AD885C07E052B3F91C2E9A1D163BFFD210F7BE95B923E2500DB50 +2075106DB541C267BD450B25B670CE80BCD068D4DBFF2D82634175B61FBD3BC3 +406131F44C7D6F18D375D1F2270829DDF29DC14DBB58A30AC193245D18DE91F8 +AB88AB548D8138605BB5A50073295534E314366E26665AE70482B890E4101D6B +60E4F3B37ABCA1346DAAE8FDB8DD9C832EFF3E73BA470E2BACE7B8515CB43388 +C27AF99FF9322175CF8D4947E6B3846AFF5163E972156847F58A66660EC8A3A6 +5FB47C9F637B4CBB4C73B6A080B0CF6FD1E9665E92032540570FFCC747C67C50 +822811AADC404BC7ECD1673E8AA6C3A2F1D82F39430B58C29145E2F1B679C46E +94EDC711883F1E4EA84117A54757E8895A40401A26E1437B39A2F65CAADD6E02 +D71FA8AF7453668DC613F326A3344F74AD7AC67569AF399385500ABDA5EDD3BA +343CC5EDD4B558467626850E752B9959FEF1454E53E7A3DCBC2255AD8F6AB4FE +894455118A61C58840CB68A925ACCAD75CEACE863D806916228F0614191A1CD5 +DC9BAE256018615AA3725834519449B0A88B4F396654E74099C007930ADB1327 +DD119BF799FE3B0B223E1EDA04FE2DA7A1C879143E1C33B6C6344F4BA033AD6F +8E88C33DEF1977796B454BAB2494C930F492A518E8198C708A75FFEF8C49C324 +A718AB59B889DED521229E741FFE53F98EBE88B0405AD523254FD3FA4BBE96DA +DA1C27C1C979A0DD4E61C3B1F4C4DE01E42F1C4435EECFC02D97994BC8AF5270 +E7CB1458D76ED0229C5FFB4A23B8716018F9050970895D51722CDE8F2EA3D947 +DFF374D84915D5C5D16463A6FFCD079D1ED416C4347BF831FF0C4ADFB61295DC +4D5785BB0852BF472CFC97EC174491CAF961AB90629F055E75DAA6D9898E8653 +5BCF379816CAE46FEA62E7BE8E9B953466E51828172C4DBD0E1BBAD1CE28B5B1 +02B3E36403BE80B49A47446A6677FCED438F01D60EB10F478C89528FA337D0D8 +88D3FC123C076507ACDAF783A9A6E24ED73BF24B6E0F11C13E532DE5F70B15A0 +657F5ED27D204449A841ED19E01432CFFE928E921321113780D036D34F2797DE +D4459CFD15BB117B5C9745EF3CD2B296D91FAD48C80B136D94476967E255F808 +AD2B5D522ADEC64176833756510391815A1D4A8DA1D0AEE7CAD36A1D161889F2 +3347D5B6BC503300FDDD48F594F391D5FB42C42113C538E707C16EE24A3F375E +7C506E8F49CE50FF9DEF3B4A4C1BEB3848EAA3477349833BA22D2A9012287D8B +A8C4CB4307A1188ACC0E6E9338E1559BE5FAFF381BD82A6C71C267409468B3C0 +2C1A29F4281D565836EAE57F680490FEA4A952FF64C8CD11C377C294DCD1EC25 +CEFB2B6DCE959D0208F85B6E32E9B44FD455F9B134A5306D95EA29F37BB8B86D +9E592159338E1293F449380E13C21AE42E6861DBBF4AE99A7469F871A3940835 +FFBE7F316FA9BB834EAB18625F0960352C75105A92F175850289B1AE177E0C19 +69E527D3838D245FA634F5428046581A5672558C2AE610E9506694EA56E78393 +DEA0173975DF161F6D0BAC40030CB033BF83B3E5BC60D6F8D2701298CC9F01AE +2D1D54FA71CE08A21E95CD921AB30FC4F115AACF1C16F289E3E5BDEC74A706F6 +F7AAB1BF83C060BEBC4E4467010F4EE96849518A8E331ABD98B13B90C021E431 +A154C006AFB4330E89C8B93B4412A1098CE9F6E3163DCC3793C40D9C3CEC9EC9 +C946D0580A1CB7FDBE6983A303F744018913DDDB0B8B735A147ABE242B084DC6 +090BAC1FD413E5BB13530D38DD71822E24E62A057E07DA4AAFD538CDAEE84F4B +875DD67C2BF8C231DF400F35D67AEE54B4BE3D9155D7A01F9A3EF3BE2D23DFFD +A5C94E4B92A8CE5DEE847BABA3937D8C06F99372346015634EAA8459180F9F56 +98B22F2481678453FD2F184948E009B85C132A6EF3ADFD2BDF6E0FF6C72BA58A +F7F972F0DBCE967F5691F4E4339B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMR8 +%!PS-AdobeFont-1.0: CMR8 003.002 +%%Title: CMR8 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMR8. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMR8 known{/CMR8 findfont dup/UniqueID known{dup +/UniqueID get 5000791 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMR8 def +/FontBBox {-36 -250 1070 750 }readonly def +/UniqueID 5000791 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMR8.) readonly def +/FullName (CMR8) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 49 /one put +dup 50 /two put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2DB9928A7C95D3A6E9B +8E92F84CA0AA44461D2F4FA0F8B81C6F5B7BE98C9712BE166610465CF689DFAF +27C875C029C0116DE61C21DA0092D029E7DBEDFDDEE3D67E6936623AB53FA2AF +18BEDDD7AC19A19CADB6ED6CA7A26E6044BE414FFF59C0B98D5819A6B881F9AB +7AD0D03BDD5CD309C67811D5CF0B93F6FDC9AE64F74ED4E81F2E18D880BD842A +DAFD0BDF06300201C6946087FC0B999447BC370200BFB8CA420B668B32EBC242 +6DB1546A7164CF55B332FE9D239B65F532B69EF9F4F93828A44C8F5C526126F8 +B7A369114CA68D4F98638121F4E17F351723D9F1A902FCF087F94AFD23876517 +2D15B482AF2D68C3F31FFA864E031596E597882578AC7FB0DAE2A713B065B374 +3E2E72519ED6D50CBCA40A7275A7109A4F3ED8A4566AD8832890D3D1F4899850 +9B757442B7EA355175CD5D6D8B4152ED2D7EEB4CE30F174FF672140354046A45 +7098EC45B9DF3DF5CF7B417E201DA88308CEF4CED8E8903AF24FB8DD0187352D +25738519ECBC70304F8F620CC45D2586619205DA3955696FAFFE2082402B3502 +CB682F410DE5FFE80A4DA3D3BCF02E35BD577D0DE55E7B8A33B7A2FD5136B5DD +A0BCB61F8E7F4363C21F890CF287304DDB8FCE7FE207C0D160B81E7EA662BED2 +DFF8C444E19C91E72254257CD87240A70F1A964FA54ED9ECF27E27A57DACC3DE +EABB92C085030870C6CF5C40B6E47F5C0AEB30E84A73ECDABB2D754EF6EA28BB +16EBD6636BC288E62F4A38BFB55F5F4DD20FDD77D767F6CB52F9513E8EB75413 +07F1877B2C01278675177499E4E8EB09F2657821613F5C7643FC064293EC6E9E +B519FFAEEA36B19C9D1302CF91FCBF87FCB57C5F995CB6712BB3D8681EB6F05B +B2A4195A3C73CB4ABCCFB958EAC533BD89560D2790CDE1444C0F2E4EF27A529C +F01052964E56F6D76A190E5FF45934BB711A3406284AF130D4DC0D8112BB3752 +762CA0200CA262359D4F54C0CCFA9A50DE18C7DB14419E2990ADDC4A54B94978 +D9174CA39434022FA77FB30179EF805E2189C35919F5EBE215EE2A00B4407826 +CE56329C5586D8B414770BA5D45513C3AF1931D632FCE69B4CA504944E03362C +74A1177C6398A61A12DAA0F156543E2A8E9969C4308B7ACC21A5ECAC8F172541 +1B1316A88C0C163E574FFD3CD22FF08488662FCF2F9344BC25D02146F36CA6F9 +E2D0130C654B7485EEA9A110A33AA0C769121F81821E9A2BD062FAC158359D44 +3F9D9947200EF1EDDD5860F10438B162A69683957300C75AF7546C70C97AB2EE +37EAAF0089E2623F787F252569B06C665FDB45EC9681C0774ACFBA76B98C4E89 +7EB12AA5F8798FFC110B49C25E3A483ABE83B0BCC6DF0578403ADC369E013762 +C9D08FC94D949BAE636ACA9F36F4E3F02296775A062077B011A705B6F1784D36 +A926622CB3847533D7ACB24A4EBABB14593B5D8E1DAE2BFEF8A51835C8D4E76D +7543C126A4271C59A5881A5AF89331694F84489CA66725995DC3070F306EA447 +CF30F63CD476A46D528EC1FFBFB8EACFA2BEEDCF54C92CE2BD26DEA5827186BD +3A4D1709415CEE7D51D671357B4A5D11E835F63521B9824EE5282E58F05A8ACC +FD249461181A38C2F47BAC4E79BE368D64F886AA493C61CBCB2ED401C8AFBA61 +59CA6F6216D941A92AC52ACB3D7ECC28D6A58EF4CC70BA6DE23E80937AB38E89 +6F05FDD15B954C0826636267EDAF9F2BB466BF79D2E10EED9B04297E6BC93069 +79581ADD1A9D9FAE9306F46AC95B98C60A2E53D60CF1AA4069BE301E17E25070 +F98DD67BD8642B1D07571A32766072E48BF27E1576FFEED300D7313A358A823B +49C8F135961B7E259095C9BB67F996CE0B90E95344F203922F47E11753F70D38 +2ECB615403490310CEE6C03AFA97DA2F47ED47125D110FA69725BA0018F6A40B +29A307FDB3E52322A77A0102E6F57654CF1E96A134D13860D83AFA0A41112D3F +2247A09ACF7D06713BE443FA27C7E7220E875965D53030FE7D2D62EFD2F1DB87 +5FB091FEAF599BA8C5167525899E578AB341BFE2BC4E53A047093168AE189237 +EA55F055514EFA939DAE9E859CB5FBCF37D99484F44FE5AA5FA386B28BB642F5 +5DBAF059A50FE96C7C6D834531D64F1F2E99AB2E96EE74D149178B1C0618495E +293973D9A03E1790654B67C0882376ABEC17D74785B3737D81644F28B3BC6FFF +F92FE29126995A07E0BC5EF3A4B93789A103C428943E045B8D1A5063AE71E806 +568D48072E53DEA85253B01DF0BB7367A6BE4DD7BE514AD74E3F77C825ABA405 +64DAFA25EAFF8F63344B5F6B523629776CEB090B546469F6A6008DE43072DD3C +DEF51F62731037D1FBD0C038A1E9B669849EB3BEBA281624F13D20B61917A109 +A0A7871A73F7BAA18077360B38A4625C5DB9AB9E43BDEEB856FD0E2D3AA2E075 +267B978B9EB47F2369302E87DBD5D5B422830BEC32411FE75D584C58650EFB1D +136FEB92B94BF8939FD63AFB7349C7511E5E46AA7324F8B1FFCA9C2A9E9720C0 +A720918E8E860F137567D386AC29870FD990BD69465B3A3D2A0ECF2753578AD7 +80DC87EBB319EB5AFE0B6F6FF8616EA30C51425FE3ECBC5F8D0B0BEFDEF32FA7 +D168B4E85C804B7326A0942CFDE732B1171C643452B7099B31649CA2C38B62FB +46EBDF7180004C549B53F88021D029452C2B37D8C565BCDB0B11541039A13C0A +E45D4B68C7907B8BF08C6F41F564B62BB554235D50330E78DD02795516D969C9 +66119D718798120442CB7EB9877FF84EC69DAE25F8559DCE3BD8042959F695F8 +2F99845B1B5680DDCF181D806CC4903E077D1FF5E60918EB34C0B1E028422B71 +CA63EFBF3F4F3CD813CE831EB54265A555BDD35AD7D723F9CFBDAB29C54F8AFF +2D35C6A3299E0A2DB470C7B141B1E3E10DABB7873AE302926BA8743278FAA8C0 +DC6174501D6A289CF980A3F55F2DD5C3A514E7E7F13133C35D2697D64C25130C +DB78FC997968D6B3BC929E8A31B6D212C5128E4412632BC52B3A1049F7F2F61B +C74AE9A6AD19B9E2E240617E2882F7D29ED3A4279439107AF9AEBEE47CE85DE5 +CE9595A96A118ACF1EB1F5929930321AF7732E351E18C6AD378508E37B4C327B +0E06AAE21278AFA9255AFE5C022034DA2968D260879B4B38E7EE2E11A593DC3F +CE71ABA050C004473324CAB6F3C50E85DEDA3E9A27388D8FD3A8F6E42A79670E +F7549CFAD4CCB337A6E0BAA4846ABCA059F1E1933CF11DC0FFBFF550CC4A1B47 +CF7BCE0875FA747AA854534960F757884505A5AEE0330179A9547A4AE3E68479 +7A457DE83326DC30B67F27CFD4AB697601CEE352F72F0966B3CEE3EA24683BEF +6D23AD51B8432C3F0DD0D0F80791E1091F38988B7A54E466A9AC7810DE8B7893 +6B0AA6356597891D56190A7660BC7F657BC559E0525D41EC228078F2FBF89C6C +72D666DAD838CBF0861FBF0A1D4ECC069AA49DFBAE5C56B781A1D5D79DAAC256 +13E3F9B928A2394FC71691E4355642764459714412D6F8EF803FC5F7353822DE +6CCBB8FBE5AA1F2C7F4D384039D85E7728527DF9FE0239E2CF8BCB7411C000B7 +1FE660AE6A2A19229E5E8776CC83EFF3C27403935756463EB4721C51FE0B1197 +86C2F17842A0FB639F28083DFD4F1E86D7D3BEFA922514ABF489C5CCE93D6F72 +D2EAAE14F6CBA2BE4BBE7D7EA8EA19DB3A87350D4A52064137C3D15A5B05B03B +70B1DA7328D10713B83974C390C3270AF5A9A47C0BFBFABB9F31063B0CCFBB10 +0F236C74446688198EFF039110F6FF42FA9F82D463AD3958B5FD205BDF85DE20 +FE3F0C7AEEF350AEE6DBC1DE2E2DA4F4599956F59D6F121F7086DC120416E180 +52DBBC4E56C09746938698860F30007091E1CC0351B43990E47208ED495310F5 +7BA9C6AB3CA10A3F1B318FD47C1CE3B9FF1304321F9623E32D315AA9CE64B35B +F841E6C62B5B2488A311C94937879E5E0E170FA77AF0AC75C5E6E9F3E8F825AA +09C1702682E14FDFA72D27901C5BDE009B1E52E8C4511C6F6336251BD45261F7 +401CA3DAE7C4B0CAEB91B9954BF4A97C48ECE7FAD401351D59DDAE9DA94E2335 +74A2B880E4749D3D7026CB5299F16C204B6E00A20A6619C34922C7D3FB50F127 +3157CFC08DCC5164C8023CD1B6C3556C73CB8E4ADA845339CA9BABA1457ECEE6 +ECB9849DF1F0FEBC89E5F97C92978A500196520839CEBA6C0FD2E3D27BB4B4F0 +93CB2BB565F4627C6DB62DD0E084E627D69B5DEF42EF094381B62C0D67EFD197 +301B132420F51A41561E6106870147E0D597078435BE3819ACF0DE28AD779847 +F3D2CF667DA06955D53E0204CEA2935E9E984E76963D3079EC092031E2A10E61 +1227E5EE6770DD4D745A52655369EBA06A19BD7D95BBA271E488241199D1008E +36EA99F8DFD2A9F87B06B070158B466AA4C6EA3BA77DB0F853F0BF9A304EA291 +34069714368E0B94DFCBA3BE5EDB6C8204DFA7EAF5C3406F60A7056407D1BF6C +CB85C1F432F97D821F5518BBA79AF8453A568FB2C2D025A70CEC75F46C545011 +ACE3A99B2582793BA1DC655230AE2EFD24DE20A01D4A441AFFAB7771F223FA6B +9169849E727E494247F67D6E1EA9DCA06A082FE2094BD548AD7F08B565145634 +E7ED832FEC1378306DDC796303392ADB0CBA130B63B38ED57B7828B47732853A +893E8836FE19CCF27002AE92C2B2CACFDF8A42F1B8066E033B965D2E9157FDF8 +E1264B40813C1A4CE424274AA3528A4F09B3B53DD4D23789A68B3D17BC1398AE +0ADA2C2168427A49846DE0216908C2FFFEF4F13C1ECA12AD341E238EE46E6DC2 +B71B54C52659632911F901660261E493AE2483D64E119D9924489779B62BC9FB +A052E822FD8D83178E09ADC825DF0DA07FCE7AD68EEB29FAA275A13691B4A5A5 +B0BC0499CD6307610CD6209583C1152C559A2760823F8DC0B9B990BFFE7B7E9F +3969B968AFEAADB9FC0F1410EBBAA0DB979CF153F0B8C978405F8E6F2B6406D7 +AAFBF4A655A15DD6D1E9A7EAE10EF89264659B09283F50B734236885FC09FBE5 +98D780012FA77FCB19F15BDC522CC7312546C0730EF5225DEA8C22A3BC6554EF +4FE73B9AEB5C2F7DBD474221760E5F539A064AC450591BCF3499E3968F2CBD6B +F15BA2B37080A4129B66D4C2188524F025414F14DB3F96049A8B0E5EB2BBE7A1 +AD64A988FE875FE4FE5186BB4F5DDA16983CB052D474B7D72F3E8965663EB50E +015C72407C3437142D3D7DBC055FA627139488DBC5A0F98D805C2143D99F491A +167E07AF60EC9F17C36289368D740B632CB919A0E74C412B76CE7A5906D5200F +9E79CEB9C65ADA3A0F23E8947E834AE7A329A9F0AA7A6BF545B1D7B4666C6522 +CFF268634EA06DB3A82D91A4C0A9B227E79961212881A54A6762C335DE7E0831 +130C45D94394D21C049B9D189ED955438C2151514F17BFC67E431DD9A8349202 +2F616AEC1C7B19F63D5000EB4771370924BD4B9053FE78B5E4A244B9A149D66D +A8BF3B398396D2233E92E4A5FDC70FAADEADAFD255193D688842DBA865CF6154 +C9348D590F3FEB135D4B7BD4D76A52CB140888247CAFAB25ED51F4D187041CA0 +ABD956F83A5661CEC171B52AF92F9ADE27973B560C802E1E0FF51C4003D1289A +CDD09F8EDA8AFDFF666D35418CEADF3B0BE298F0D1E5C8E024D6A2017A7E71F3 +3A9FEC9930F1118101E040339F9D41379170928DDF5B5875212B271DC843F612 +E0C21C67263186E3D6929160464D4D5C8928E14D0845762C36FFBDE548188E20 +3B6BAFE5EECA0385142F01216FB8A90C43A472C1D4447FE5C7C78CC088FC72E7 +3FAFA062C338BDE8A430FDF1951B107D8D73FF9376FACDE5900BA362C66F8C1D +947F9545C5C13A53E4479B1C1A50472C05E8F8C266C6D4F4EB08E97B3B1BA972 +26973B844545089C5732322BCC9A5A8FC972FA0D7DB8BD85D2F515ADE65DA479 +0224F7EA2276CFED0B75B2C23AE7377F86F1F6F205D6FE19377D87E782143697 +984E731F83CA888199CEB425643C259D4FB8B58DD69A96085198306494BB497E +FE7C9954EF35B679BBE3847A9C73507874F71FC97665E2A58BA41407A1745247 +44A79B588D969D11CE4B863CDA655DAA53CEA5C3C263B345E782006CE9831D49 +603D2D95DE9E370D617F5928BA416C362BB2B4DEF16A5D44BD24B34257765F3B +6223B3F9B54DAED69A90C7050AB97B06693D253C6894CBD7B497DA449F1D9B7C +D91B421891EC0724F59C82B9CB288DC42F2D2D7A7F22EE3D910E15953D7766AE +276DABED3820390BAF2700C4653E1C77FE63DB71A66D93ED293E25B8412A1EFF +809554BF04ED0DE83F7F190883ED793803CAD2C34A66524D3A580ACDF3C13B22 +08F18905E7A4A16DA9ED2A112462FB9FFE481EC2069E484E8BBFC19D594153B7 +3DED4C11762223B7586483B06BC164D824D1A6FCAE80A35DE0DB8B33396771DF +76DC5C05578EF1BE00A70BAF3D951A01C87328DB2B0DAD6E1B4C21F37D1BC0C5 +A929BDE5EADF20DA60C4DE2E3C151005814F24824D33B95F700E09A0207EB602 +3EF60DEB1622B91DB99A855A8F1DA96358F05CFCEDBDDDFC8446AE3391BEEC41 +966E594E28D052DD5ADA49DFF65E79540EBE5329DFD86C23CC800F95221B9C18 +CBBF941D2FA47EF1EF59A89DB5DD188E75EE94AD2A79E2221107E5992C00D531 +2E00B544895A9204656867E3DE9D4CDB64B920B5CCA9A73E6514B36CABAE01BF +94C15603B86780190595560F792E5EF01650074EA4A9BBC6ED284B9AC2020641 +DCBCEE0ED27FE58171DFE104EEE4202759E594159DF45113C00236127A46FB35 +9EC705F21C0E456C1F0F924594C09AC64D4377C5FEEF764BA4A09ABA8D09DEB1 +FC13B0CD202B2F04CF5D73DEAB65C36C2FA7C0DC236BEEF6D23BFFC9C493DC8E +1831F19EEF81EEDD976E43BAC6B5CED13F901DE59835FC75490EA528A72CEB77 +24C38B258EC38B9E6B97F85CA8C10D8809BBE55A6FAA12456FCAC786942E123C +06D1E55F7ED04400088BEC968BC5081DC7A1B1B65166E7821679F76694F235FC +6854C8776AF855B83445D9FF919B1D80E98DE0741D06D6C5EEDB3E3EA6392530 +F1BA817737D8162F7B3A36AC2A03190CDEC654383E31934C3E0A012B639532C6 +26FEBE9B412F1C92D1943B7C18CEF510729D501349644C97F087F2F840074AE6 +D8CD0FB2E620FFC908BFCD938B675A0A4A687F7FBE8F3DD06A62D7B6DE7DF3E2 +49D367D60B10061EA86CD512F5A1BE8950D83C62695E130128E0037B62552D17 +064319BBB9B1FAB9D79705E5D68AAE9B36EA14BF1A59A863BDB8DAD9AB5D7B8A +E30E2B499F952D65877C8E38EDD7DB29F9579D09E629AC188DB6A6403AB4BA3A +D358B3770D727A2B77D84B6C9EC17E29D88E3421F9B7D2D822EB78BB8BB50692 +8C46DD6F9BBEF2E848A2B5669B200019802AD19661537A84D3514AEC5AA47445 +2C791E01DCEDF18D9506367241255FFADEEA6183F51A9F42448A7DE413C08359 +52DAD2A60FD606AFE14702BD3B0EC448720FE63438D020DEDFCDE3582FC31DF1 +17B25FC152789D2F17FD60B8209D292D2152DCF8D28B5ADC04F6659BBB746CDF +145163361823CA343763AA951C640B5D4A99B7787105A1609EDD6A596EFC3F6F +2FC33D0D499DBE56C6668E137715D435D6B683E0113647B2765AB0F3D98AC717 +5B33C3EDDE18506E73B4E392B022F30480BD30F59B2E3A59D93017296C3156B4 +B5722E1955777716388AA987B2665669716F866FE6BDAD5E74A523CC03915F26 +9B7B231F5D9B1F61DF7CB01ED3F27070E36547B263855DF5B2E3ABD2ACC440B9 +0826E1DEB8CF0BE87C59313978F28295C0E3A01D2B5682DA86A38F390982A8FE +C3E81B8D3532C92C4A4A4BCB421D248F634447613101BA5B301431F192BC6962 +E6F9E2542F1B0D3AE7560888A9344A7EB7ACED0D46351ABA0DC93EEB47CDF0AF +28B602579EE7E3CEFE0C6F5332EB843348D80B020E7A127C634BF2A3A55B6C94 +1896769C33D5BEFA8F144D6DD702380447904C92197B8C7CB55679A6AB8FB7D6 +2E3087D2CC3CB9BC10C0CC485AE395D036339862CF98337FEEE3394157B9862A +120162EE40ADD32C55B39E4BED180B4E4F51C28377589B982F13DC6D44E758B3 +022813BABDF45231A712C97D06658FC2AAB9F59BEEF9FDBE186B7CF64ABDB9E9 +CAAB0BC223880A2DD496BC166B6C88552D2B1B23965FAB5BC51D2EE90B8E1322 +5688DEB8C76E0E9C2FC7EF7AEB6E7DAE821F73A43A5CA6814FC018337C234636 +4D61A7EE4CAD90722EF68E825686812D5A20AC3874A33E3202C32E60B44FFAFC +8D517C3A5B86ED309A0DFBC06EFA9BA510DD6C8E6292544F0EB765371C64CAC1 +F04F96546838C6E7423116B4FB72F7C81C47C55138A3819E121884A0A5E87BE8 +DE4D02 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMBX10 +%!PS-AdobeFont-1.0: CMBX10 003.002 +%%Title: CMBX10 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMBX10. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMBX10 known{/CMBX10 findfont dup/UniqueID known{dup +/UniqueID get 5000768 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMBX10 def +/FontBBox {-56 -250 1164 750 }readonly def +/UniqueID 5000768 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMBX10.) readonly def +/FullName (CMBX10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Bold) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 40 /parenleft put +dup 41 /parenright put +dup 44 /comma put +dup 45 /hyphen put +dup 46 /period put +dup 48 /zero put +dup 49 /one put +dup 50 /two put +dup 51 /three put +dup 52 /four put +dup 53 /five put +dup 54 /six put +dup 55 /seven put +dup 56 /eight put +dup 57 /nine put +dup 58 /colon put +dup 65 /A put +dup 66 /B put +dup 67 /C put +dup 70 /F put +dup 71 /G put +dup 72 /H put +dup 73 /I put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 79 /O put +dup 80 /P put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 86 /V put +dup 88 /X put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +dup 121 /y put +dup 122 /z put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2D43B233BABF23DF8DB +B6C2BD2F04672F9A3B7FE430263E962F16A948319C51B8ADE6E8A80D3D88023A +6DEA4D271676C2C8615C4A0EA7DC8F6601610F398673A4D4B905F49EA868FEF6 +39BE073001A36DEA6C08ED51452F062B971740019692E221F4455EDE46AF24B8 +407A98B791F6AD525C72C09776247E194043281D04FE1CD1D8AD8DCEEC3045B4 +F95B3B41CD3300768D8A049815348BD7AC1004F5500817E3A267D694AE108BAF +285B288FC5F28A03E9D34FE5D9B2F9A9BB26ADE66B1CF8EB5BE606E83D213C33 +DE083C20D636EF780E761944FCE3B8A950B1E6E7568F33B557C6D59E0CEAF185 +53E609A4F58AC4D5269116F958C4D115C44B5A6DABAB79D3BB6E60BDFCECE108 +74CFBE258779F32C80CD7D9A7CEBA50A0966BD9961F71560119668C4A0C30A5D +ED91ACB30940502B24F33906D6E0F16F81DA87EB6D7FC8B7853BE388C40D75C2 +2CA8F94713AAA1561F5321CE97997CB4AF0E37F44E25B0F73CF4986422B1CD89 +8F861CA623004ADB1C28268D7F8C484AA10C9519B6AEADC95AFAA3304D60E85D +718B2F67D2B734095E5A92C90785252C98067DC05137BE735220BBCB7C341D61 +C4B98BFB1EAF883D38D7A93195A059EF82B42027F23B6CD633231D704B891A9B +03D11A646F13898F20321D7BC150C63FD6DC6BF9CAFD8DA759E95384B729A0B2 +767B9F3E55C682F7A248BC1184F7D294CFFAE0B246DFCC8F215625DDD4F49F09 +FA8D41CBF4A06152FEB152C61539ADF7E70A4D23AF8267D25CE3B12D39D62377 +547E2528D18DC4134FA3BE0437EE0B3509223D71F06D44C6227D62BD01AC0A2A +3EDA975E894371C07CA1027B102549A7D552FFD25ED2DCC68E29E71BBAB43C62 +57B0BFC6A953ABC2EF703F35D112F6B5460018CDCEAD17F149DBE5B52C2B9E10 +9818EA6D97C8AC884F6841C9B600A7D868F59C1D80E98DE0741D06D69858EC84 +1B33C6C9938B7E8A6FF6C12AD456EECBD3EBAF0D7331536B9F6422019FAFFFA4 +822E79D6D89D6366DA636CB708894FEF904F366E295F1CB808E78E883913C4FB +1631248ED6A7CF1095C0C61C4F05E4B9DFC47533A5FD24540AD71A0E2907B98B +28085EB88ABFC3478C9644594C7DC4244ED5A7C1CA8D960B65497D56D174645A +B88F12C2CF0A807DA314017984CF3C4FB7F47392A651EB9CFA961B28E2989893 +9FC4D97171BD5338673F5D1CE2C3C08D48A1B77769F01D5058236C655FFD864B +80E28F900191D4EB349AA5E400A7B0A0FCA0F3E79D7A7C69775BF754329397B7 +D18B20B2683CBC4A19729BA878B3C17EBA0A7E9EE297A5B67E915CAD92C8F356 +582B8299DE6A58E73408F525F7EA895C48A8F0D626A06A96A50348DFBE479D89 +4272576FBB0CD332193D28A8F11503BAE98F8E1D73CF5BCADF23DCD4E6586ABB +323568F5A34E359661074D50CD8D9DF27191FCE24F10225A5D721EFDE2547E1D +CA998077D2340B1A4ADFFF570AA677CDF3305D5E3A394BB1626EB35074D4EEAC +2F037CA2EA389F7683FD17A8E07C12B4CB3BA8C249C9B12D297C618009F76717 +0EBF5F2DD39A6BDA10A2E5A811D4E190660F5FDDBA29201B6F8042620397AB2C +E59267A7247B0463891831A6F40582BC3F614E5167B646A8F53D8A31717DD9A1 +9034034E705BA7884F0E0738307AF69D3517147C282747F2788462FDC4336A4F +9CD222908401A25F0A1F7B13B8DAE622DC965AD0BE62497420B70C04AF432237 +E0FDD043456187658ED93B0F9822A3998511DF05E59CC85B7B9992CA0CE3B814 +9723BAE70D2631F32B4BF93511F67179FFAD2075E1591CA5907A4C67701B56CF +A5E5B02EB4A842BA1F18D6864E5677359C2FB4AF5BCBABAFB053F230CC129B45 +8D15413F736EB07C571521C7DE2A13F2AC1C133D491B0A607197BE9AA1231D96 +BED7968788246B2E4D2BD330F802810F5BDA3760FEA5210CFC6F54748FB1D921 +5CC3624BBA5B8962AA7D94159651589540B17CF7A785F297264F9C1006D36928 +6E2756D3B623A6087E4B106FBA76255903C624C07E18A1AF4E185A533C640711 +86BB477A906ADD36EB6C8F4A12BC2F01B2B98412E4E105977640930CD998D990 +0254A1E5E9843B7A8ADE0AF6D5871E6D3D666465AE69813A2E26333213FF6713 +6F08D55A90C079A56E1B9AC655F720FC22B5AD8550FFF26DA7B0C5A0B60DDB05 +64E8FAF684F3A455BA9BC9278043D79537D201D520E38750335A4C8FEA887377 +879331B68DAD6B253F4FF9981D0F9B9550ED5179B15EEEB00E560A3DB6E5973B +63403E4E2F40A3D0B937246E9652000B917B1369741E0F913C14C2D2D6D1FCBE +2CEC4422177C58523715BD070002EC2E13D383A1DC8C84228862B6C5D3B65667 +9FA97E175239BB7FE7E37E14B96DD7960A8AD49DF428CFC13B5D3CC22E245317 +47B5244DA97F1DF954CED2D552477237CB23D037C0DE728E26C82738954EEA1F +F34FE497DA005AF03746DD2ACF77F6E6F2C224862A1D18AF6F7A5DAF34564387 +9E01DBFF49F8621C058C04C2B3F4F3033FF3E8A977B2CD6B2A3CA4A6C569B19F +C5AC457AE9AF334DA66A730960C7565E93A2D373C0E3DE14646FFDA05DF4C6EB +6D4CA8ACCA3C3115764F77B842581760BFB9E5C0EBE55308B0577A8F4D968CE2 +BA3361D79378D451DD150C34D7E901397AC63B33BD7DB13C50D678F5DE999238 +4B4EA15BD449C46F262D931478F5685CDEEC4C4201FC3EFA607AFB8F27AF6751 +125DE42D2FE2D31DE769B7E7FD8CC8C5D91343B537139A822A5BC4160BB5314E +37501F65B4FC35475FE9E03E34CBF6795AE86CE409500BD0799DE39FA69978B6 +EC74D2197C03632D3F59B85F404DB31240968FA75059B2581B101E028CDECC2E +7E5E25DFA106E9B8ADB81E82BE9ED3BAA9D03EEB22B7B67AB1262DF6AF5F5EFD +A5627EFEB84F3A5F92EF2557EDA2843D7D18C592635623CEAB14CC3620F33986 +410D6DBAEF9F86E4E6682054540E2B01D8FF2161F10E66851A188BC15BD6666E +8D3F21709F196A31EE676D28A2D12639CC2E7020A52910F052E61A0710DF09B0 +064171D05611451BD24FAD64716F141E1C41D3218A8115A3D73CA041D02B46D9 +28C3D07DF0FB668E8E91409C8D0A26A65CD737C075E026AC0A974C9BE658199B +3B9D82ED95E4646977D8F60717DA4C68767DBD7E8320D5AA1D5DEB2E6B009759 +8282F27D64F1F904830AAB501CDA4D9233FC2F12F77F0FBCC46E6B729C71F6D5 +E6F3EA02EC35D1048394F4EF2177FC5EB726DE5EF2DE7997166B8BE5B5105D08 +EAAC3481FC612665CA112D3F889A0E5B7843EFFCEFACA24A01B6AC2B7DDE02F4 +A9295AA2409A3756BAAB44608DACBB56840060037869455BEBA46F10AFC68DD0 +0563843DF111C6D34911CF13AA6023E5E899060B5EC60D0F78FDEF3E981151A9 +24903EB13ED1A67EA1977449716D1A5A7EDE1A2E9465C9C2B20A58AF02D9F373 +73E627CBF296B3A6A4670C39F3B5EA30D76F0362C81020A1777F0ADDBC6B52F7 +213FEE1718214087837049CF2AF00407639657428B9E8B532F68B631611A3501 +3D9DCA38090E227BD0D6D0FB4130EE866DB6B195C873AFD18DDB3B1E40F740C6 +B3B375ADCBBF628A07A5FACED539FEDA3379D3B60216C2EA6629BE2F65199D82 +FE3AE627D7C67270F3497AE75F7A9514968B5950E2D63C38DA240AF4E6CAE88E +E25167D179108679876E7C80C85FE1D2BCC2EC9B88BE76A8F5736E8E6B3A9CF9 +42E58A4ECB7914865E67C1468CF66D658206830B9380FE346DC2DC4BB56A92CE +4B5E4EA9036C177869315A2D9E6CFE97E3BFD7CBE0747D40CE5E8A3A0988576B +8AD2B1E4314C0D8A0CBCA08844A49F7E054D31BA7543730C0A7390BC4A288D10 +CE29E389A4791305D3AC1BB6F77C805F1032787306F78FF76A20A9E629899F6D +13356768D33D7B9E294E8CD50CBFB9CA02A193922BD9B4372C912D1689B6644D +52CAA30F7421E8114D077288119AD9514EF21E5B9989CCE2ABA0C12549FDF493 +FFB39736AC9EB72DAF45E4EA6057527FA9F5AA0A1A3F03C12F7482E465C766D3 +760DA7714D56C91BDAED507A5572BEB51A895F8DD3BD5AAB042650154FC7E4E5 +5EEA6194DF73AC5EE2CBD4EE26E29B1D2D0C458B4850BFE842DDF2EBB4E2A25D +C6A11CA2D8F346E2B736DF88A3D57BC0380B52396A6C039212699F5D3342EB58 +0C3DD5D01D5078479BD9FD10C07925556C0AB0F03606F33796BA72074549EDA6 +E33644F62CA35207D7421D2727AD8419AD1772789D33405FCDDC9286BC34C974 +A52297F5BBD2E541E8BB473F733AE5097BBC9D5FACF18DE4173B4711E28B23ED +16E0A6746A60F6FF903026A3900169EDA87D98396E762C2EC963D89197B8CD0C +25244806BE7CBF46BE60A8F9171731EADFC969C28679B025371E5572E52A0EF8 +B3FD9B4638D03E20BFDEC9345E70B8166D38846DCA68E0D0B4B53629C7E7620B +45E0A610BCD07FEF8814CF915CFB11119F42407D1C6DC1E6353451D40A382C2E +C74DF2A4889ED5A3495C3E973565F7178CA190D22C9693C10EB12C1E7A8679CE +4AFECFC964CC98111BA4ED2BA9B10292A71D5B11870EB08EB483922CE8628A06 +05E7CF6DF93E112B60EF888AA8DB52994EC33DC7277D7B7A4F913AD30257261A +D6EE80476A9A8D316D190BE6CE0046CBBCED365AB305495284FA921BE0638E00 +63DB2AA4C5F163340BCCD1061B469504DEE350B82FBE1689C1B65D095405614B +35997D6F0DACA7190D64ABA351705B17B23FE2EE5996FCD607F49F54392463EC +DD5B944A4B82FA2BE3E75E2946D483060DF99277340B0AB65A2042AD088E2B75 +BBDAB869D1940F64B50D25078519D18748AD64AC5615EFAAF4F3105B0111AD40 +70EE173ABE6A4ACE486B4E5999158A4377FDA6922FAA6E9305F48570D14BC81F +BFF4C663E1EA9D1E050534F9315A663C4C5DA52CB02EA6408AA473C32CB0CD71 +169BB43C0508A842F400240F0063243B4C459A1FCB3312C41C32ED0EE87F591A +BCB6D5D3830AE4645CB4D40336DB4AB6540B52E70E1EA415CC6D886827EBC5B3 +EC35CC5C136243B0C20B3C603B648B132B99D05F9B48263ACFA59A856BE74441 +FECF5C6D1FE9D1F4F9942F460961901E16017144C37E83C6822177B2A6C47ECC +6C47A1104460665E5BCFCF08874008302750EB991CD98D0D8D22B921F90B99B9 +05EE7C39F2BC2A7798157503743C9F2F267BDBE2E8A4CDA7317F81DBF8962E1C +EC02822CC7F770FD4D08D335904375BF0C6DAA0510771627ECB9EE69C0F47D30 +69A87052989DF80D9F4F19F75B070C3689AB3BE0966453F9D56CED6C1745B50D +813AE6D7E44B73423AB3778ABE4CD2C4DF40E14C5A426043F7057E2DFA2DAA70 +EA6723F1C7967FECB1E7C1C0CA283334163FBE31C32254490170C3513580A552 +19A5DD75E6C4ADCB12D33517A03318A6BBC7E4214266E125140D8C40F78A0340 +1F95D9FBEC4DCC55B71E89375AA94B0D55646F6C069561480407D0A3AC127024 +D7D1E9ED6B599A2A8766B8792F46D35508B66F302D289405B101A3C6BADA680D +8C56E2A00B766A4CB155446F862FCF17537A2BE85418E20CD77C4F1F69F70BC6 +17BB5DA8FAA876D0E8BABE273A19C04A8697B3E3CF4725E2C77C8761A9243F24 +96F8AE96399996001A57FD75106745AB4646FB9C6421F1D4EBF3BE533BD11AE8 +14BFBD6D308376B26E08E4ADA490DDCCA94BE8240403D5EB0FE3549061DFB668 +4105B4FE77189546619B6BCF3F9723E278E98D50A17DB8A4C46744FA21760635 +5B332689316BD17C966D466AE737FE3ED7ABC443ADD88D4823A10BC9747ABDEE +027515AC353A420523F85298029475D8BFD83A2CD00C02CA07974BAA581D2215 +A850E6E4C0A5E17E0EDF91C63FAC18C70093F40FEEAF0350B403E2806F4EAE96 +BF616A805616EE55C4657418C26CAF54187A6684821B86A76F15088AC4D5B551 +66C3CA8DC61E9810858D1204F899C7E3A1754F483134609F6EEE6364B1CC04FD +92C86EF194FA3249601AD722D75D1D395CD15A93C768EC60A486AE885683364F +93DA00A865C1035F913FDA69E7D9A0422880FB81EC23C00427F07A5EA3CCB613 +83C859958AC53FAEA26A6BB39ABA068863CCE3D447720BC31A5136E08EE58963 +093AF587A72112D55853A1048A2B1695DB2D7F13CC924F2F0902071260C33ED6 +30893A04577C0ACF0681C0FEC23E5404F844A83BB5A2F8DE1F0792196139993C +1152094BC36A6AE5BAB4B8281E506F485F0BAEEBBE71E174B7CED1E52A8242F9 +DBDF3E0FBA296538D964EB5B7A4E23B1BB0F59872C9D4FE8498203E3AC08B71E +D2B965AA6CD5D20DA6C83FDC86F4A5D68A58A72C5BB9BFE9BC755C56B24025CE +6F24443D3CF32CD711D3D94C7C1DC275DDAE3341D840090F97CB6CAEF274C94F +9F3BD3AAB3F98BA8A7B5CE5E48D1462DAAB37BEB1C10B410E8D33FA42D898183 +BD4F807112D78AA94509E33C179BF7C9E82E55AA7D09E128A0DA06A330CF4AF8 +5DC861498CE029CE8C1BD15C923A708F2E7AF98E4F7B34212A0CB417553C86EB +6DD46B0466F1A21D29FC5111226794ECFCA5DD4240C0B8D106CCD7EA6F03E133 +BB7733F055D6FFA04EF5C6F872B4FDA3E42F0F036C4825543D75682ACF71B548 +DED160ACD05625274799D0AE201305DA526E01A3D2A719B1B15C05CC09467F3A +5627860C0F36C503EE392E1786620F3F2287AFE56634E03566B9B1F537FD92A2 +913166228791871A8F8CBA1A1DA634E8224058052A10FE1E67CBD3FD21A6C07E +243CBF58BDC78577847664EEA5225EB8D6679AB17C563848A9D4D58995EA3609 +51C1443B752A070D9872FE1643F0677019235AC25DC2B29169D38308F2170A1A +A0FDCC59E6602197D2815B914041FFC7106DAAAF30CD97400C6D0826A40385A4 +C8520119A065CF32CF2FC5FBD8DFD29222528A7F96FDA533145846B3428F8239 +E50277C366418D713F84B12A5FD4F904DC13DB1844A391FDAEB97643A6FD2945 +942FD4FC5A4A35E184F23304B8B4D93D0C37EFCC4E106D4FCD0DA3E5D2117589 +3FFC2BD1D121026562C55C455C3585050B9460891B006F62D9D9B66695C3D348 +A467C14C0256FA9621CB056E7CD389505194FF463BCC4010897F9A690EA87D9D +BB3ED4C174FBADB8A4744C6E4A44D773967FD703EC37672F9993DC48BCC8A060 +6CEFE8E6B8F10886E15BA0466AF410B90DF0020FAB88BE493606B6A734EA85BB +926950EB10D2F2CFDBD182B0F133809612CCF6ACCAD049C8005A42FAF78368B9 +E7684F98DE421BE0A3BC0FAEE024A7BE67E15C8394F17FE84DFD8156C2A3E94D +08259E15CC657E8CE3088395BF6B5F825764E141AE15EBD186DC049261623D26 +8636705E06C6E4A1F8ACAEA59F91B042DF5DB9C2AB986A784384706A43E5F18E +42C29CC1CA86D4F247B3BBBC89F3633EE074DCA4AC15B1E33EE4822812A62E88 +C32B0AA57249980EE17AFC1346074800FA529445D18649A0475246A25CF325A0 +BDA06AAF392FD455218B13D9ED577D51A9500B9FB7860716A8E2FB3A8C4BE3B3 +6656C6A5653AEF00184020ACA0BCCBF48BE3BF91E11C8658686C89848E714E6D +DC158DCD1C1BC03B83FF94C60B1DC71CE8A86B46DBE661C9F8F4677F8A2C7CF1 +E41A91EBDA2304735147BE66CDFF2673F09D408297302124C127F0B35690CAE9 +CE1679120CC4D582FB69550AD34A047DDFCD9D411724554CCED753DB52D6AA7B +22B0C55EB698ADDBB0F8ED15C971AEF113C74B9E25DA29199237B98DA4023665 +C2A63A837E4CAB38F8DF37DBAB5DC80C0C3FA72C8A70DC76B5B36B2EEADDCE74 +23CF794B66E4DD3B35BF99893789063BF7B01D5F186B2FDE518B2CF2EDE51F81 +38244BC64548AC3433A80B86D6A0CA26D77F403C06D65B7394BF1FC7D06D37A5 +E70ACD844E3367DE4DB71312CBB85ADD21D5A1F99BB8427F252D90ABB66D7154 +EA5AF4A165DF6415A0880AE784071E6B3E2101F0B663DE14DB1ABF8B7CE0E6D9 +D24F9CDD9F80028D37C9CB4067A28D41E879AEFECDA71F649EB3C250BFF809D8 +1E427E3BF24E85C75F080D93E0314883988B3A4A2B72A1B4A3D2189AB6ECFFBB +C58151AF05AE335200711ED945E18B4BBCE24A8A162BD9BB26137253BA8B5819 +41E759A7CA7CBA129BAAD438E87189F2F6AE7C86F4EA099DEB23705A500332A7 +4F141D8778EAF3910486B2EA25AAD16B60DD804D0E5BAB0FEBB77BC95EDED08D +B8941E040D99E8F44E70FF842306ACCF65C0AC9673859DB9C3A724238CB8CE62 +255BAF0145692EE3B52643A0DE3E667AD03EEF6C753F57E34AECAB0CFEC7B07A +150D7151E57BB47A4AB8B9C17DCEF9C78F5AE432612D291A0679A422A9DFC0DC +E7108A7B305B6D177A3E42525D2A3297BEBC9AEAF42BD39A752407F12E54DE8D +6E043CD726074410F7B2FF557552B5507E6530F1AE598339D02ADED4DAECA436 +BD4D0F30DB14546CECB44BF33E0A52855673E33C43AEAE3BFFBF278BD50C2852 +5036F1696259F10FEAFA56A3B7A1A0C0985244A42B8C4DA6E52753EE917C1B89 +170B7F90AE6F1298DD7C6EFBE6B769B1FCB0D5946A460833D4B59F8C8A49FB43 +5D400A4C278E7F6B8C3381BF49032CDA8DD2A2C66E1D36D6891DB8457F00B3B4 +BBA6EB85CBCA21ECE806B2B0538F96B28F83A89FDD526D9F2407B7A0D1C090DC +DF808694BFD18907C98F97F3F3CB27BE51DB34DB9B17671D5328D6D205F19A65 +B7E16D569DA22A5A9F0AF66BCF145202A872186AB23654B84393454FE4DB6B74 +D5BF9BA5B1DD1C1218921FD978D545C3F79CAEB47E4C81BA6C9E6F517D1EAD02 +3C3E03B163D4C2C29BB8A1CDA5E14FEDA66F6004FBB666710C206B78D6B9EBE1 +E55EA6ED39B1D73F213DDF7C16C479DF658AC6B29DFE3E22E33A74F1B38562E9 +68F1625DF4C9AD9AA2FD50D40902264E6EB14259E3F1124D5A914D19647E93E5 +B3AFBDD4AE2BAB4381CC9C4498EAD3B5AD20BF141E4C2CB590D3F42B57A69CB3 +BCE709A3FA802F854089E406B507D64CFF454C5CC59F58953261D63A41A2D6CE +300AAF6E6B603C0CD57FDB790547FF23C860C2CFDCABB5E6428AD036B3CC5CAD +227A5EEAD3076353157A3B3947CF3FCB3A7032ECDA85428419DC74E5342FB54C +048336BD21D97F81F30696D7EA238A39BCAB3E4F74E31F649B3D50182C8823FC +BE7C4750D7693E51E88F1AE53B00A20CE3CE312FFAE07D32B62AEA32B58B8D12 +7C00F3B953C039B0DF61363543F04DE5B6F691226BE7751A293E66D54C19045B +4EA80D0FCDEC99692BA6EBCCFBC26B35BA3CD8F78C0A186733A85239924BE35E +316BE3C6928DA02DE9650F622F6D5E20C917563FD11EFC363DB28AE0E0BBC569 +73B67E1EDE40002A250FE51CF2FB72435A98FC6E5B94906E83B6E9FDA505C745 +4B82F991CDAE01AA690CC33064E82B283AA4E608185137E670FA74DB3FAC4FAD +17B79A752B6C4487EB05297392A1360A1C7447849B0C4B472AF45E4A389F224A +0FABD49D502CA92F7E446330605DDEEE9A11BDF8C04C66986C2EE9A510A4C433 +944734B7ACFF3C578C63E87BA86D8D8B2C3C66D8D31455A1DB4BD808302086D6 +1062165D617923B5F4DD67DD7D05E876DCA0C5489848C5FCEEEE9300AE5ACCE3 +C887215C65998830B28980AA04D5FE473798CCF49D9B881181642CB1F648708F +48E281FFD462F6499411D1B997E4EB52EC153DCD5C880D0846736F0649DCA8FC +CCB124E1FADDFAF3D595E7938A70378C087FAE52480AD00934680A5C213BBA3B +87AE81EC898FD5AA059294EEB69E3F9B0858B7C69E70116387CAFD2C8DCC2A7A +A4C235EDB1DCC2D867FBCAC35E1346BBE8940C2F9B6A01E83915D114F69C0FAD +EF6B1D2641109E020B398430A4D99EA8B47F00CD956978F1B38562E968F16256 +B4C3DC8DEAD3F745BB8F688339163D20025C5AF724C30B17AB03262A01887722 +1C641D45DA8F0F3F69D5FCA194A07E92F455BAA407676E20253BBF9244200C5C +77B675F10EF342153F08E075C6005B59B995C31D2EBF8C30418D0428DB6B5F36 +DC9B0689C376C949B1C5B1B6CDE7CEF52F5DE8340A19A1BBE5F56FC10A920E67 +E3B69CFF0F6CA6AA405833298F0E93E1534621CAAD682B251DF566D6F24F58C2 +5A96919B0623C444EA6AFAB4FB1FC05A04943E0F3A9AAF7545FA0FAE88FC9E4E +97EA29F5AE662D19514D98A464AD9819CA7072FC73478017173BB66B5411937E +18DEAFD38C531C59147ACF558D80431E5184AAD4E80B65440CE4C15BB47E0D6E +591ABD90B651C7DD63C786D8A8A719646479432BF3213DCFDAD036FA15EAEA60 +A4106D826C9576EF9D067115741913CD743FCE0E7ECACA91AD16B95366E26B70 +59BBB61BC9469BF5CB4347685181CDCAF3CD7B8A36F8E120CCFF712E6CAF2643 +C9DA349D05EF2DE5A51A814A040839172D0CB3AE68E4BC3EF4F26630E0481866 +D1F3BF49E98F717567CDE3B1E70ADAC9F5AE4C1E037041529F9D80FF5AE7BA60 +B9974A0A2CF42A16EF883A16D58665CA2AC80DBBC93BE1409E1D619082247D5E +B409ECF0E391F7E13FF8928C4AA20FE1648B68AD4F623373D7FC05CE89BDB7C9 +1F2459A4155637A9CDA2CC2784599D929D79BE24A6A444D0F701668A15B28DCF +7A59FB8A2764B570AEDE5B94C59304876FAEF63632D533D2752C9A5F0C21F1EE +91AA39BF627127F624C5A432442B0E22B6B51822E9C6092E9274326019595A46 +DA8FDDB208E93DD044ED2DD6F49996B3020C35D4B7C4EE90BF3C9361C2B4BAAC +060048FD39B4D1E26CC3DCBCC1BC5D5181DF696B026998F900976190A0D6E5D0 +4268DC55111B25F62DC4A7E06A2D1A985F7377BEAA49275B5E62BC871BCFAE9A +B64178289510D008B8DF64C3DA9E1191B06F159BBBE9A50DD42F3B0B29ABD81E +289B5840D60A08D3586A2C716E6FB0C49614EDC8F966C5A5312C2FC5CAD58A08 +6828FF39B59D88927C7D660E78AE5516EA613544AC6897E34984A612A5D63166 +ADDB5CB4E32A9A498A5C88DA8147804BDE52DDF44159D139DDC4382698198BCC +2EC680C49B5AFA3A1221A11E003A12AD74A67914E33E8529002B83C4CE55A7BE +7755449272387869490FF5994EBCD9C754769FDEB9633D330ECB99E44491ABE4 +B8129C3BC44797D052CDABD9D54EA413DE4A24E668BA626B87CF0AF02110BBDD +2D94011C6456C7B6B3E8389A6E3EB4CEED02EBA65E3D0C361AEEBE8A4703D4D8 +4D1B7B4499E585B500D54F9D08BACAE365F6E262500B0209CCA5CAD7328D8654 +B76786D56BC23A51C484380208166601DAE25016B9256825407711823E9C7374 +1D76FF615356F5D141376D0446860141BD88B45473C03AE056557BB62AC3885A +FE63DD1BC2135A426FE53E7CC40E6DDBC51086EC4D7E02795AFFDC52AA59B994 +26E5EE16B5B00E8C40D951CB8F683E9F7375F08D75DD6621AC17302A7BC7194A +B6C631FE1537E43F22804BF0BCC35BDCD7CEC3D4955769205CCD5F6016F63EEE +86F902D22174D2D4D9CDCED3562417CA384D95810DA0A805C3D7EC826CC0D616 +F6D9A0E37705C506C8DE89D0F22DFF102419B95B629C1C199691D0FDB50517AF +6EF45A0D8269E97BAC3B8BB13E56252CCA5DA18A0F9447DEAC39141E4A8C8584 +A38E57490263A53996AFE9580C5338EC127B9D910ED59D59A31D6AA17324BB0D +AA770498537CEBB4C4E4E52E9108F01F591763F16FE1D894B8A6B47C1782CEFF +81A78A8A42BD1C36397A2A2401907214AF894B558561839D83EBB4BE82125CED +177A01DF26D99C3D0A4EDD0044237CCAC9E3E4B6F40EC0F1828BEB842DA02593 +0DEAA21EFC8DD35816E5D5B7E1788F2D2F107A23E5CB996F3669A4708189A7BD +EAB2531C8E1177814D8AD968897C6F33ADF5A3BC9A39D887657C98548A8EC0CC +147E2216C91E057C1BD8347415B29151AE70B853616775F72B8548B331CCC7C2 +3DD43AB356AFFCA423AAEE6676349998820CC974BFB04B3BBDF8F405B8D4F0B9 +D66E740029E25A72C258A50E86F91570ECA749B192D3753EAE27C97D88D0F7C6 +14FE1C128B076B91CE200E5A52875399DCC94177DE3E11E0CB72B595DDE2C439 +CAD5B2E83C049D67C99B5CE8E651EA3750B7A3844259FAD79310BB46FACA943A +DB0062E6B67284AECCAF2A15D4C8FB2DBF46C419A83D28F568761B4B2EC5A433 +F02A5017986E0F5674AA56BA1DAEB1AD85FB21DF79AB7A12F44E2778B8424376 +D5FBBF340741046021D1C46B0B8DFA888A1CC65731ECC8F6D59DB6EC98CAAFB7 +993BA71BB1EFE4371CC60C233873DC932295E97BBBD932AE53BD12AAE64F0E88 +052AA689BFA0CE7121476FDE64FE9EA2C51D49549DF38ED4971B328EACE3156B +814407476A4E1617F17C167B505370A2E632D36C86B9EEA672A7FF7B0F9CE40F +ACE634BB6EF381332569FB5784EC039D9B8E9AF1095D0393D78FD99C5784B2B7 +1014717E22D7ADBB0B2302248C2469CDF613E8FC4E36BD2FBA792BBC4AF1A0B7 +E7A25F06EE17DFDD400629A2BD39D8695ADEC8A80CCF77239E44E36D5F9DF53C +4F4D59819265C5CEB03287E521DA534CD5F1306B44AF2C77D35C64D9DFD1D6E9 +02AB991EFC7381E51A777175D8CDB8AFE0F6FED56C101319FD462225E1A5D8BA +EA9A45F3D5E93CA8F8ABAA81431D2538CFF1285905A67C305B12E2EF5AD0BD6F +19946EB96E5C9757683C0AD8EA8B2A01CFDD79CBA2C85C15D372F268D42829B5 +66607EF439969E8F8CEB99CA6A88903F9496DE210F92A6067FA3D2F65B2F4719 +F2441FDBFF21F240B4A128B569128B3E2603D51CF49CB70D0661EC7B158DB2C2 +9BB0E993678325F666FB05734561813BA4986F0C80C312864156662CC43AC6FA +7BB3200C30E4BAE6FCD04AEBD93ABC09D7E74606BD96D7A485AFDE50CC4304FB +729A7DF84E780C25ECE4AEF782A3A58180728A1EAA3140C11F2E717390826DCB +A89EB917AEA0B10AEEA57635F8DB6709DBFD50CE6BE7AD10CAFE7D4B0853D8A9 +0CF4E383CBFBF93397187B5A9D52E97058E07ED3B5126AC22099683E910F4DC6 +3C1E53DFBE5DD02A67F9B766583048BE27CD73C5BC7FFA12876B2FABC58E3A91 +D3C72E5B5CDA0B9D6415FB070BEF532EACB157DAAC1CFA0391333ECE47186B3F +23CF1B57F1C9643091AB18FE4F31E393D74AF0D3264999314D81ED7469D0B375 +0EBA1C19FB2D8B8C6E2AE8CC46CA2864FB67A1414635A10EF4BD15D1366C6486 +0A54C3B71956C4F263D3FCD73177D2E13ED73AC8B304CB399DC2A4A2616269DB +0E2B63CCB95243C1263B0B8113D23DC8145CFE0FA051980F9E71CF32A65D056B +BB178396947D983157CE922D44926FFFF951C01C93ED0305CD5B1D40A984E6E7 +5ABA8F494918ED918D5F2DE29DAFEB65CD7CAD43BA092307EA699D4A571C348A +DE6C78AD0EE3FAA733D2402F78355E59680E33CEBA8E5AE66494177A7C4FE456 +660C6716E17A0253C535D01AA3965D238C963F3B30A1FAC5D22D70C4F976279E +6C74AC9693C3ACBDF823770F53AAA41795969A7C28E5359206AA9A4972A2AA1C +55E2211704E805DE8243D4FF4D937B9798D5EE9A7DB22D5880B8C1763C03B205 +4E828FBA0E6A0815542F755A71387DF0DAF54C315921627B07A5042AA1E57A88 +82CC45C2043769FD2B8E2B82216404E1B263C0824ADE21E7BA310286483B513E +49CBC3B9329E7012FD339C6B368F17EBAAB3BB3BFA27847A5A95F5C861627320 +CF968DA1353E4B0BA8C555D92FF3E87C8CBB116B3984777AB45CE4B2087A8D70 +672864CD45346707FA2E3B736DB739950772EAE96F5D5A0F86D5AE4EE46EF58A +F7C59AE97C252D233534F4C507F59484B781D7E6BED5968019FD163456F6E4F0 +DE16E27EB4EC4C2DD30A1C5F7D23984998418A31E8BAE024797E27F17D4530E3 +28C2D3B77B878F6A02E6C39FB6A388A13F736D79317B65C7EFD0BD71EDA084B0 +215D02335441FDE7C0E8FB01CE11396BCD7C68D0999D8770CA8B05AEF8EDC4BA +47770DBAC2A8E5F6F1ABA1A8A250629BF491DFB28EA75C8946A444BDC9B2B89E +2215E0B962EBB3FBCB34EEA424D6A82F29DE32FA01F3FA27ABD8EFD23ED5386E +D3FA39F06CE3819B211EFA9B7A0242BFD7175476E5FA68B5C7D27821755CB24E +E72201AA0C37F23C77FDF1F430F439FBFB8FC00768507C13388DB8B818794CF1 +C06692491B244BCC885AF852F0734B962A8AE2C5BC52FB47BA24A97F6F0F1913 +B9FC7AA61AD9A975A30118BB640265A9BD39702EB7A807172475F1EFD3E56467 +D3598FDF2B66A76E8D7A72C8BF71D6E5DEC50ECC89ED5437AB6900A39986231C +B235320BA538B040D6172B70627962A899DF0BB26177ABFF9CFBB85E290A69B2 +915D5E30E7B3BB0539F2443C54BD0B9EBFD25BD763E8B62278E5ECFAC3DD094F +4315D5E0F40C47B8B5AF0F698D295C7DA68E557ACFD2FAFD192F5572B308FE71 +485C4D463A5B774AAD4FB4B8598672402AD435DBE68071D0568B06905DF915CE +34C19CCFB1687BF3EF96E1A41CEF637C31CEA1ED08EB61440B39FF11EAFB324C +5172827C3AE3005065047E5C6CF03967E1F2910D0AB03310450D093E9740DE36 +5FCA55DEFD89D72C36053E5FA0B994DF1694F2EF6BA4469EA1835A1C8EA667DF +80ABE839299C54CF92F27842CC4122B853A12CEB1D63AFAD03AA6F4CA7AB3A25 +84EA53EA390CCBA93655C7C3EC1E3D309AC650FEAF3B0A20FA931BAA2DDB8D8E +4B70AB633CDD0D5B373FCC1CD8476A7725CE791E42C422EE411A5F3F31129717 +4C8AE0AB347995C67F5CC4617CE2CE868C85B546B1100A7129FB2735526375CE +286F21BF70A602A7B859DC8B8BC65CD7402638B9A3F1E6A691C05FC8E2D11C01 +1FDDFC7A6FD1E6898489901126F925DCC0B7865266F9340624ADBF1CA170B527 +DD50D265704A82E73913AC0882505B6A868999E25702698EA1D3FCBE9556DB00 +E20B3265BD08C1D26C757AE35F3C1EC93B2D0C1085B7372047F8255008239E4B +80CAABA78C05780FA447B188D9845EEC08B699204F59B2D475F7849A4915B6A0 +F9CE222360ECAFF4026E07C24DABC397D8A4A106E081B8C875082316388504AB +B2BB1E5FD06B6143BACCE23949C7B3150CCBEC97BEA0A2DD14536BC1AFBCD3E9 +7A02A53DBF9397EE8F0679E51861455B8668754C891F3C1E940E880D3C7C2702 +53AE30C72DEF5BD85FF78CC044B41396162869A0A7BB223B4C64748A128EDDEC +80E55F23554C565F2B2BFA483EA7976D7CD61FE32F9391BCC5796E53006801C0 +1DB694A5096E9D3F6757C5B936CA9ED8101A8FC96C7FC76C5187371FC63D2E20 +09EF408CFC9B2A1CC3980F2663A942359E36D0413D24FD9F307965B51EDF8DDF +FF2B356C11B592385CD7F6387A476AA126353472665055672B2309CD7B18AB9C +B1C2D84B75B5399DE374344F21918E9585AAEC2C4D0E58E24ECDC39A58885F7F +FAFBE06E56F2DDEBC08DCEAFC9C24E7F5DD8304C5B4301CBFA66C1E5AF7EB28C +E97C9CAFAC45504F7670C6951B7FA59AF685186D00E8D2FB06457B377F330FAB +1D659EFBC6F8C3C2660A0976492FF5008321FD2E64971C5DE8DA4B0C1B709929 +10F175E46E2279B2B422A5F3AD57D7B0E69F19DD0AE219DDF229E12AB085830E +0DC1810A1FE6D0BB0081340382BA947EBD299D54F348E8ED1E0CD60F7486CE8D +F609A7C0BD812B7993A145B40FCB5D512A250EABC464D6165CCE1AC29E754EDD +3F3DC1599A2B89336CBE9615B988D45D0EB5662F9AFA4A05283EA00B5EE50BCD +A6134E379D47753DA5F7155541EC86E22AAD22D923B0D9415BD06FE827CC3BC0 +360C81F25CEA3E8047610F31EE4984F69AE8E1626BE171143D5A3F7146E0120B +B77342C41C01B1C6EDB62434BFCAD9EF8C1F1E4C5B08AAD7EAA5E4AABF11B02C +D6B16DC013D69194BA86326DF0B206C4CCC6876B8E1142854A5654167F1FECAF +72EE9E29CDD13BFA1057070CBAF8BBE9090E1056F049018285D1F6D0CC22827E +DDD2312A8016ADAEB68D5DB2828E3927F6EC3A31E7096CFCF8DE748CA5385466 +AC97F5F8F48FC11AA2194AFA33844273D3D766E56A949BA5358166D69664208A +C6A9FC30EDC2C709217777F4C11E93CD1B7BB5D0CE9A059C0435EB8FC781E295 +44D17F8FD4D68EB0ED96836DC1124A62350BBFB3FBECF7E8F708DCAB7125B714 +B6E7DD68228CD026B2E5D4407A39CF511165925FA4483CC44558D30834F893BB +9DA4162E7F2F7D804D46242439B7B07B3E2C6F6C65466C11A6BCB5DB9516D167 +25DFD919BE3537500E6C780091EA65740EA5C9C61D31EE1785C87592574B7B7B +0CFCD6C84D99B1C0AE23C63ADF233943A245F4B680F126753D7DF65D5827992A +1DDEECAA0411DDF252939D2139A16D95A87E5C383584EFEE8F33EE36CD222CBE +D923D9151671392F366F613981D439750264215083D251808336FF0C73EDFDD2 +A3D209E48A0FB439E9DC5A4018705EBBEA9EA30B90794CD4F6358435AFD2999C +A0ADB60E74F4894B0D87D1B4B911353BBB73F02F0ED467C531BA80A53D64D89E +AAD366ACC39562CFA1598278EAC9DA3BB35E04914EB9C97CAF578F520EFDAE5C +74C7DA31AA8F694CB2E5B10FB2E19448FD48C3A6B1C1DA8424863229E015B9A0 +F087B134326B88506DB9BE5FDBBF8E6DE290D3C0C76EFBCD06C329A1ED57CB36 +EC875380C87C4813A832FED590719E29D00610B219E1FD1B556BC16193C3BF86 +227D4C9A28ECC19F5E28277CCE9E81B0575719544151D75D28FFB5565A331DE7 +602DADEDF6AE4A4BBF6A36D564302ACB4441C5F7E12224DDA25D2D85467BE8EF +514544C4C31CB41C92CD446252BCE0BDC11937BFAAEDFF10EE9DD161C67D2DDF +B54514E9915C0D59F6BB16FD5C4CE8EB8F3051DB3C3C4BC92C686E8F64838947 +9A91A4097C0EC7F9F71A5CF1850A742D4356C9F5D1176208C8617021A2FE1960 +7C484C5B7CA3169E5C7B1BF74DA6FBC4A5B5AA6A8531814B0DD97B5921D2D411 +F6CD385E5A987E925B3B27B0C72188046C0E95535637CB322C4294E19C2741AD +C4F15D989BA91641E72060D994DDDAB6D5CF0822FF504F77D143EB4E1FE083BD +E18930B8E7E2D3BC4C9EC7DF9DB61352AFBD007BC5E77E313304C462EE8EDEC6 +8634FD75FE4291A681F9B76B69D0FB019DB31CCB1F01A30D895FCB3A6D8AE6E4 +8DAEAB855E17012F1F731259BC3A80835FF0777661064B65F5BBE6D10EF49349 +387E1B1D180BAE3D14F0AD1949DAB8DFAF94AE53E0C33F77DEB4D312C1B4C0F5 +58090A6A4F65F3C71610DF514A85B29FE08A1A97D4F0BCA820F443FEA78BD55B +DB22F1D7F0A968A8B5A3CC53675BE726BBC3CD5C7FA1B38EAD62D1D1354894A6 +9C78CBC776C5AC17FCC4950EC1A7FEC82820308E2D861F9D2A14CE01248C2B5D +B281039C18DDB1240777E20706F8A240EB4C6CAFB05F631CA9DCDCB8190CB2EC +2EFF9951E7BFD68A08533FEA526A08AA50CD9A05F07DDD63387E9F93D284E3A9 +3C01B835862B0676033F4F9C820AC596B39BFB9B7BCF5A2E5B2F86A65B2FA10A +066FFFA9345D5799B0FF169EFB17BC58D0820DD5D8423A4B836B015677856975 +AF966D5D8BBB2C0BD32FB17779455490289E478715190D70738F08D338E6060F +65301F71535D496B70EFF476887F12E58A1A66486E9E4CCA9D802D59EB39149C +AF35CC6A44FF0337C5662685965BBF263C08AE41773BD38E28DFC4645C07E4D7 +1FC708C6C5CA6FA4B033E85166F9EB5B0C0152AC4C30BC4C46F4A7AFBF62C022 +A3E2442D2E487C9425C52758CDEF635FFDC96AC26B6DA05F1492D5106A9B87A8 +91E5EAB7A7CFACEDEF241360B9F27CBDE1F4A7CE9436CC8F1D89F2DF4AF9929E +F9A75352B7BCD4F13123548FA3EE7467F67710997FAC3C3E417FC0A859FE52CA +BA96D36FDE61FE9B9849B7B18C5B6584DF58BC2AE0311A29970216C1D2C0D42B +43E4482DA7609919F32E7F307E52F3CBA91C70F9057E296FC8E3BF891ACC1265 +46C00D10E0F50AFA773ED0FF8DE11F69018012D3FC645492F93B968FE599393F +018BBFEFCADAA79FB4874E49CCBCA145C05EA9B3B676B0214B08CE4AF2752C7B +E542CCC19678F8C88442BBBBD2175F741D6E93C77726A00B8F30ED84074D9D4B +6C6F425EDF8E1DDF72EDA17EC42F6729155B6817DC0D2FCD44BF66597F689C24 +C6CF3997A19E31DA30BE8F2527DB88ECC5B854D19D6EE6907ECBF3B437A76C16 +E0C89F75DD18701ECE2EC2B8560F1E829D701C16826460902E54D008C82E755B +754664FCDE92F3BA58C7846EBC41E546E5E2EC6DE4A860A99F929A95E8C2831B +D005C7294B421F3CE33A4AFDE78BF2B69889197F366CD386883701F04A6FB896 +2EEC55DE2001BFD7CAD0280E3758FA6278CD669B3E3BFBDC458E1AB7E9DD405F +B2D9D4BED0F8B9E5CC7324DC99E15BAABF70CBEF605FADEBCCE149431F0D3883 +C9E0ED1AC36898B35F54495AB9375878155C8A80C95AE74845562AF8DFB93678 +0AD04D072B4DDDA0CF2ED9A0A31E071C36EB8DD3C3378D6E01F74B8D09FBABCE +BED5E2BEC1F53BF30D2077695A77B83D0672E452F3E2DC91170F1BC8EDE006F2 +9E9E1C815616EA9E34A9EA03A677774990BE3E47A6D147C0D53A85137A269AED +FE762E217B9395C12C33745C482F8E3638A2BA001B335C14B090AC445481B188 +099F847346B681A3B1312561D1F8B6EE555B3DC46373BE1AFF57E53B026D2B4F +31ED29DB88BBE8FAC6E32DCD5E6D1AFDF717C7E258ED76F8AB412E7561F3F5F0 +82E902D52C7BE657E4B85D86FD9E6E763227DC82FE6340D8417D27A83DB9405D +B24E288552414B9FC4A6DAFC9EDBCC59377511B0DE80632CA8BE2D1347B07B0C +EA93D860DB522C5BEFA740CA9B3E9F3742C3A0172E08CE07DB0D2D5A00F1899D +EEE9D922CDF82B0061E7A4E857F4F8D97C4E0FBDE482954900305418DDE03EA6 +B9DE82242A78A9E57B0E5A5F5476237FDBD82BC3AF22AC9B94E59AE7C92BAE51 +CA12436BF62A541B9EC45A1EE879A03F2C493A16DF32201E9A0AB90F12E02441 +64921D3E7814DF5391430FD772509988D014DE1944FB504961051AC136F4877F +14ECCEF5DA4243D361BBE99164174D2BA36FBFEA11E76136A8BEE3413EC20F46 +DEA984949B03C52FA638F0B36C5905B75E4ADF11883CA7430B33ABC8E1931EB2 +D1EA980E2CBBAE938CA61F43F67A6D85AE2D4B47624FF22063EB5F719D4B4848 +464B33A1570F648C23F16EEBCC765C1FECDFC0DAB1A09CF1D0264D651F2C20B4 +A751BD36E6EC8313B57429A14426DC55CD0BC9EF7D5B163ABC6E3865D845A7FC +F078E193FB5F887A322D2E86FEC032EB14D500DC46F8A416EADC75F75B02D7A5 +138ABA1E87557A3F5CB9FB3E6EC613DBE70DA7CECD476631501211D1A4B1E4EA +D35968F08DEA99A33474394831BC2B502AC1C61A24709A18C5C2C4AE82EE1E7C +7E91AE8DC4879FE5246F813E87E5B5ABFE5B34337CBFF5B5C09B2D17378C5561 +40E9C08AA53E18AD72A9CE1D3F194AA91B350F9CB4EAF2D93C3E3A7E79CD7F13 +4D3627FBD2415596CB6742CE8F194DAF26C073A210B9DCC4E066085A52D84CEB +F8C1A6490754C46A2D4499EF31A9B4801F76639F40ADD99DF2F71F38DCDCA8B5 +6B4C80F8AAC637D75B66E4311DB7B474F13DA7704E86BF55FD9E8DF3C11FD7B3 +D5F23A897669B8683CBB699C04155CEF0E42B422C9344823C00B357555F1EA12 +72057259DE05A179BA553EF193CFF850BEEBE3E68C9C2ED1ED2393B6155CA65E +70E922A31AA5A0CF798F48E48D085BE896E6D44CD1DBF236625D080427B901CD +13251B8F7AB5611A8B6EC365BF2F70612BB06CC59F86F561077F62D02FEBB205 +236B544F608F7C1E91033937FC5B5A302248E5A1B79088F99B3FEF01813A5575 +88232011D5E551755A937D5BEC0888670E52218F2B827EF818BDF16F176B99E3 +B01099CFC5A8D693A01C9ED8028F5BF98240853538D288E74011D4720080BA73 +FE71FD52925C74DFD8D6A80F8EAD196F5F5C99A5E34C8F62EA771F401E2E7E79 +220AD3172ADD57764EDAF9AFE0C3203DD216D82F132C20A532FFFB0159F95462 +E412CA2AE3686F7D41129979263850B5466455DFAA6A2940FD2873484F9C921C +6942CFB9D087CE18C3C428ECF1BDF73D06D675F19F684FF21127F2B0594D20E6 +D55B5841DEC08C233946C29F6B2D62E2393C055BCA5163B781A1832FFB37C447 +27D30ACC10DCA3E56D34C238493DF89790CF274ABC676D792E6A50F3CF2217DD +8DAEC29AD4C97685981E242917503BB64F0D8D8819E3C21B58D6060B1BBE4A8A +A16EBC58F0C784A5483022B5E9B4BF4A7E7871595B22B064B05BC54257122609 +A4104E4A104046CFB7F154DBC07F0D3F4C2A92515B65C20095EA662AB3F089D3 +D1076D94367D1F1286F98579EAF82D8A0BD84CD6F66A261E9D44E05893B98EB1 +37CE020441849EACF6F6F9C003CA161B77A56A00810D5F0A75449DF6D91D8F52 +ECB7BC248CB225F11660027786AE92ED0173D9CD5C65331C4DC55175CA58B897 +0EFCC275C4C31AA968354229BBDD2524A49F97CED00E6D9D763E4AA091549AD4 +B06D4C5288D81774BFBE43E4DC97890BD2A5DD0A86134FF260686F391D67AC94 +065FF121803C2F2C451BB50EC7D925DFAAC92B25E543C012E20AF100E7CB71ED +5E1F6FC45B6CBF42448AD15858F4AC2E3218FE64DCF4465A1250B7F4700ECE87 +227DBCDE252FE10F466223B1379237F42108AC9DF6EF07B44380993ABC03B2EB +D897C1F40B6EEB0818AC7F7322C7A5B581D082F0CDB2913288BC39529AB5F7F0 +9DF2CC8C8D66522EB002ECA0C0A5C96D443A2E5717C40D8F20409C3FA734449C +3B8A7A8EBD967EB8771C288228F68BEE67BBAF5DF2A691676303981CE1704FDE +6C33BBB32D7A8C6947C551D8427F87E32EDCDDDEB733F0C87B17C888D9D1A3BF +4A068CB9650B70F17B26E2B826D91C5074722A6BEB3B573449D0AB390B49B6A9 +472AD395CAD80AAAE32CBE26E0B9BBA8F6D7CFE23A61AD3BDE598B0AB238B904 +689FE134160E4762EAA3DA043DAF30645BFE36299F1D2992C05B5B815EDA4D95 +BF116C42EE70AFCA1B86627D7A59A61B1CC26C3BB74E2179F2E8B622C18AE276 +754A15195DE4D9BDCB54CC6C1FE771705EBE4C2A0B8AFA878BB02904FDCFC87C +5C8809D827DD8517A0EE8DA430E66AA839F9815601649B65B1EAD977FF897E21 +E36BE2E852446A7DAA27AFEA76FC60DB5B87BDFA640BB8A718069277D699CB8D +330B262E08AD43D3B9DE7BC320A30E8FFA144E043A94D85AF92A36BBA4996F05 +904EA64F4A345AF8AC45F0DAF2B3E058D42D79CCD18AA13AF447BF64786AEDD7 +EA95E097DEC7395DC8B10AC0FF7C67632A910ADABD312E838ED3DB07BE72CA4D +71A021512A4A1BE98A8EFCC84F58309DD6EDA450B750A9C8AECA82BBEB33B80C +719D6B81DDCBB42E4BBD760BAD1CBA7284094883A7F29A4AB69A315E90108540 +C257BF452F47BB5D2CD18C1B7358FF0986ED6CE270DC57C80A14D9FAC1C924E2 +2CD870DB1BEED778D9AAA2F45D82669799E7A12308D07BB704B3A896BFF6A017 +C2E06000F9ED22954A405F605A10FC9A700B545AE51F6E53DC508E3153809700 +0292A1EF44B17984F3D2F81574AB6D6259C047EB994A0B30E155FBDD8A81DEFE +867977038F3525EA96FDCAB19E90FD6AD32DFBD459C33E9E624FDF28D35CC5D7 +AE6D44BEDBE4CEEEF37BA5B27A818AA918DF2CEEA4F70B9533E76452BA15E84C +21EB1F2CC4A830201266D552DC691C78BA5B1FCB6061CB604613588B3C198E13 +158A67D8373188B37DB5823A08AA5C993C6AD56E09E971CC0ACDE25BEFBDFB24 +8A434D43FACBBA53A4747C56A70BC3425B550263DD563F0A82AE8D3A83AE8B74 +E90C569ADF8A4A4FBC348EF19524AC3337142EA5EA2C464EB783832F046F0BAF +EFC3FF08FB2622BA064B9D4A78B2AB5551828A814856217DEC34F716A3E6AAB2 +179F15B87C7240A755557407E17655D7D45975C83CBCA89DFF79C6D1B3A6ECA2 +06D89DE0244A70E4EB3F7A4CD82EA5F9A8D34E9838CE3D1692CF1093B316AC0C +1CFC04BD36B68BDF621DFF3F0681F27703E74FF637E10E5AF480145DF030A4E8 +8353C7F51902472CDF79814631211742EF7CB8661396078F1D293F701624EDD2 +044C1EA141F4A20EA10E127A600A93BF3E7C0F50F5F34ACFBC39251B95FE357B +F672715FA5090241506EDEB3642CF6B489794E8CC6BF373077EE810190CA7D6A +5023086F967894DD4DEFDC6F8078A3AF18F9AADB49E71647258BFF517D5026E2 +8C9E1EB91AFC994D755864E7900DAE76A093DAB86F6D5399FC5C7FBA2624A568 +FE552C273CF0599B1E4A6AD4E071FA1FA251296A4CDEA75294BC51C7E5013D75 +B6E881BB8184D209AE4E5D5C80024290798BCD9E0D96CD7C2676F6FA8E938C31 +46AD165C4CBD85A3BE1AEF4BC3D689BA3F3681DF87B4CF66D65856C63E8D7889 +BBE602861A81186109AA9C9D5CE559915E4573E43266165989D14A3B83A8223D +7D4DAC9502EC03C2977DDA46882D99A0AE5F4065850B9DAA7578C89ED1BB1980 +C050A3F1B0B04EB0D8D884E2F5C579F4F8B8464BF15C004C5A922CDDBF733EFE +275FC453211C30F9B3A93C6C52B4EF97D5F04FB320F8CC6BF404A4D1A52D449C +E2F37C7A3FB87C9A84F141AE18D5592DB4D788C27A3CA24220AED1821A442A68 +7D67A62607DD07FB58DC2309503C5ADD3301F4C4EB5F7AF5BD43A52CDF04E1D2 +0EF5DF0EAAB71926389957F296D98533D14BFFF59FEA8EDF396A6663FF407D79 +4B59685E335B2397C231E62F0031FED23C232A1597467BE08DDEC5618F36EA3B +3228B828CA4ABBF0A01DD9D07F33A0CF79D9194B549717336D222E165B0465A0 +B81D37724BDEB1EE1A7BF5564B997F6A8F2D54EDB1ADA0D423442451CC2E87FA +8DF2264AD95613AA2F9CB5549A2063BE7342693816E987713C84DD7BEC9E8A7C +B442CFD863B64F83A07764C5B701DA8C422E5294310737EC85A6BAEE014B1740 +085C16FC231B33940A1C6393391DEF42A6F27EF1E984948728EC007FCDEBF841 +14D081461EAAEE6B3482D4E5FEFAF07D5CE284824F570D65E39A418F062984CA +690F4F473EE3D5B8F410A7112E1ACE459EEF900F3825F83CD49B5EF8B7D4A3D4 +B249CEDAC4F91313A1B0D4A10820080E3665F3242F14E65BAD52C29273F53D46 +AF41E8FE1863B3D88D20C0369339CBA8EE02063A25CD3816AC6AE691BA57A796 +9F1A47DD8D833D41BD1DFBACB8C54FA0AFA3CBD7895D95CF08EAE6E9D2B74177 +E81CCD21ADB705B4674279F7753117B02DC977B735C3807EF11EFFD51AEA5F36 +3797AB2E48975FFB4EADF68BEB1B72444BDF8B21D73C0C20624DD255439556B0 +D5C4D042F37E017C3A788DBE446216FE3023CDF8F2E39B87AEF0B34D96BF7A5E +C5DC36A2DC887C94E83A89CC17DD80C449A6E86AB5E3EE76FD432E1DB2D2C807 +C08965F64B56205493C5A440F6888019C82A9143EA568B701DFBA89A385A5B5E +64BF4C29B952CDC3DEA53D7EC80B4A882F7DA158EE4C38F48DCB818E8C34DCF1 +F876401BCC922D293551CE98B8A6FDFA38B483970628ED1F4D27A1B01CA8D0EA +E09A8D3DFE74FB173CDFDA5084F25B2C55F69E8AB0F8BEE36FE44D7F87C379B5 +C216CBC58FB073136C136DAC9237B1F79F89DEB87CEB95913F72941911B72F83 +71D363EE2C219AA79219D13A5F16C7ED1245AABEE6C5EB49556C8A42C0B4DD9E +F387B4255E153B59346EAB875EA76BB732FE8BC7A6A4E15EDF894782200E19A7 +629DA6119B92C74F6458706CF91A2BCDDB971F87079F7F9F3F3D8C61DBD830A8 +142C2C797488B9D935BB13476B17F9E814BDC4F2663B727C76D2FF064464A3E5 +DF65F790B7D68CFD9AC59ED1925B36740E7B67017BBB2199BC427C461A214D87 +910F46F65C0FAD64D73AE0C75EAE7C6CBC657E8AFD3F235817870A8FC407675B +4B031DC45E357BE20D58346ECFA7538A1E6F36AAC6906D1CD8D3E2864545977D +50E215398CF620966AE78EE1254B836DFF2383028AA902946CF473841971DCDB +7DA78363EAB4486075D74B33365F380EB1B162ABAB3C121324A2F84D50FD05A8 +560D8B7CFF5FAC4096C0E79F6B0E39683FF814BC96B1EDD4714F1F9210211665 +64B3FC50AE28FA35764DC4610BC1C8B82B6C0109D3550F7E990FEE449FDBF9C6 +DEBBF84CB90D42A497074BDB3F4AE27EAC754586E4D3983E3529EDD22D7A4EBF +A602B1256C1983123E1B9BC95111DC6FA390111B3830E94C435B4E4E75A3DAD1 +9E3143831CA344A791C211752ADA005720C683EA446D5727F0851DFF216257BD +9145C35DD9F14928D32147C7FFBD308598F917550FB3A83A2B8799AEB0C1CE8B +2EBC3287D9ED45860B1C7FAF531C2B766C1FC2BA48FDBA4A4474C85269A265BE +CEF32EDD0F21E8325773C2FB5EF2E2C080BDDCFC13DDEAE5CF11BDAEF7D4DFD9 +35632BB6CD954F457CB7B60382FEF81E9DDD15D463B860B26733B801789DE162 +2275EF2F3A30D7661AD1FB4FA1595244B14F1CE68BC56F16156C71FD2E679FEA +7FBAC2565B8DF4502EF695EA2696442093D21B0E5DAA0B889CC42829BD36911C +0DD363C99EEE0FC44033A4649AD08C7F01E908CD19DC217FC4F4DB54825C3E0A +411E2AF84CB08210458DE0E9011668157B9A4F33E86B638C467A95876F3FE089 +356641C9A928C5034CC6900684137A037AFDD22D954A79F21224B2B83EE5031B +ED8A134C8CA5037264F5E6E67CDE2CC0CB05D793DB5A615D30E49677447EDB7C +907231BA4EAFFCC83CC3D3D54515694BB72B329E8954F0A900C2C2C605FA14C5 +A28AB8A2B9000EE484675DDAC0EC2AACD3D12BC9660A1C8D66BC509EF2769A9D +C16688862216EAE937F17524CC1DE7F4B0681BB7156BC913A6927C355E1B83A2 +A635C86ED921CBDF35A45C6D0411D4409FEEFF33371FB54A5BB475253DF50A0C +DAC3BF53D70C578A0B73AC978A2A3BF663BA6A50C8925AEF7573107E927EAD7E +9A0DFA52307B648F35B8336F9845EF4C23095CA7BA7F768F1CBB0D48A6E84E3B +11441B8F21AFC233A15B5E29D5869E5CC53669BD30C790FC71A725CE20B1A597 +D204D4911F451C2A6123D392D52C672B88C0DCABAD57327197470E928A342956 +E0B20F41B614C43FFA6B8AFC9D9EB675914940579D798644CF52508C18B84A40 +E4904CB33B19063C37851CF5B737CA884E2D29B048E79AC9DC276CFB3648FCB7 +0DFBDE987B1C1D14E61658773580BF614BE32047EF256C1F374DE47051E3A04B +519BFBDC5B445641FB242EE92DA8BD61FCD4440DD4ACC0271BA52ACD226E83D3 +26824D28AD2CE6841C4E6F23BE7D057C80246FAA0E9AD29819F21E2FB1429CCC +C836D87CC198BAF10720C6321CF07977797187982CFDD890066B2AA59C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMTI10 +%!PS-AdobeFont-1.0: CMTI10 003.002 +%%Title: CMTI10 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMTI10. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMTI10 known{/CMTI10 findfont dup/UniqueID known{dup +/UniqueID get 5000828 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMTI10 def +/FontBBox {-35 -250 1124 750 }readonly def +/UniqueID 5000828 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMTI10.) readonly def +/FullName (CMTI10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle -14.04 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 39 /quoteright put +dup 44 /comma put +dup 45 /hyphen put +dup 47 /slash put +dup 50 /two put +dup 51 /three put +dup 54 /six put +dup 57 /nine put +dup 58 /colon put +dup 65 /A put +dup 67 /C put +dup 68 /D put +dup 69 /E put +dup 70 /F put +dup 71 /G put +dup 73 /I put +dup 76 /L put +dup 77 /M put +dup 79 /O put +dup 80 /P put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 87 /W put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +dup 121 /y put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE32340DC6F28AF40857E4451976E7 +5182433CF9F333A38BD841C0D4E68BF9E012EB32A8FFB76B5816306B5EDF7C99 +8B3A16D9B4BC056662E32C7CD0123DFAEB734C7532E64BBFBF5A60336E646716 +EFB852C877F440D329172C71F1E5D59CE9473C26B8AEF7AD68EF0727B6EC2E0C +02CE8D8B07183838330C0284BD419CBDAE42B141D3D4BE492473F240CEED931D +46E9F999C5CB3235E2C6DAAA2C0169E1991BEAEA0D704BF49CEA3E98E8C2361A +4B60D020D325E4C2450F3BCF59223103D20DB6943DE1B57C5FD29DA32D34C95E +2AB2ADB3F60EEB0600C8ADE15A2380DE10AC5AAD585FBD13097B1A7E8E210D4A +EE96785449E07F0C8EBC2EC5EFBFD0897DFDC15E5BFAC9584D8DE95C5AB288CD +8AD8B9BEF0B8E5F887B3B0B331542FC8184DCCB753DB6ACEEF98B85756B988DF +CAF1AE0DBE7D37D5F44A2E760AAE3A5197C27B15E32275A64946C3E4D0476FD2 +7FDE148C788DD2106F7C825E270588AC05B57E625AB17BDD02306F9E5FC851DC +32A5A6EDC43C770A71419B2C0C8074EF3F222C8A2097CD81A91F333A521B3A09 +482A4FE1CB231CE344AD126AA284C3280AAC3AD162CF0EE241BFB4C8F20502FF +118507F5D1B5FD898571015E73E5CF2281085072E00D401F6F59761EEC3E8381 +1F26F75DB66C504AB6BABA87D121B1E7040A07AA2FE01F80DBC246CC03C4B2DC +C2A715980C52B7F96BC1A78FCC7F4F52EEED5F705E08FC1E5BBFCAD121FA88AA +8EBE58172C162AF409DBB0728F14923ED02A65EA24E5D52B6AD07777455A70A4 +61833D3789C719BA92E901232599767E423D5AD9C807670BE0E7B5CFF8256A20 +C7BF7214FFE0342809570F5966A2C43E784F35015D9040BA34FEAB6A6F089504 +3A40A9E9D711A2721D3F4998371430FB3C94BFC619559B97D49627BB630F4B70 +9D0A8FE4E916235335C3962F3CFDB04C4A3CF714DB5E260F4E66FFF2F27CEF2A +D4AA26BBCAED23B8BDC98F8F453BA27AD7758537561E766B82DC3032E92A9EB0 +125D98A22C5466AF069BF72A9BFA052A8628FEC6A6AD0B711DFFEDE3AA2D7CE8 +34EA487038EF50F953B8B4471CBA6FC3C53877EC1BC94582B1123EDF44B4056A +30F49394BDE22CDAD7F01951C7013D26979277D18EFA594E8F4F2B5E615187D9 +39E842EC28461B9ABA52020A127D2CB9002A673A435B13C10602EEFDBBA6BD49 +9DDEAB9E68D655443A5C2492BA061C1391A51592BA8C353A6F6A0708E8860184 +2B5D031D2CAB87D618E9F6F7A0BF3F66B3FD5A25BB91F7F1F5F99CFF56EFF4FF +0A35C55658001ED2E97B26C869292F6274D433A5443179DBB8EE987196306348 +3F9E87C6422AFFDD30080C9AC4EE7FE5E2DCBFEE4974331F4AAE479FD8806D4D +9C2B85FC69EB0453AD827A1E767E5C484BDFBF5C8D6E2B3C96298B390F22D757 +802643A79D5E29CF3AEDF0E12CFBECA4663444FC87F2027571DBA9ECF688BF28 +FF0DDB3AEDBA0FB28447CB4B5D5205F40C1E7A525FD7373392EEFFD910AC82D0 +98E71660A1B3227C4A2592F3E853CA4CDF64DF19A52582E167234F4036FAAAB9 +5446BE102DE2BF43E82F0112C2A20F15A3F92C6571AC761665A905362C4F8BDF +AC8705519C99862CD9C0D75113C4AB5FBB83C880E46B82715B5628890D9103AD +A2329638B95D93C4DECDC5E6C588C9D5183EE6FC28FAF9825F02DCA567306D93 +5440987A81B51EE7291107A08F201C609FEF91A8F0587E8B13D4BAF74A5A6815 +DE9E4441F46AF8E1DDDFA2D611C889614040B144A5EC064DEE4638C04EAB2E37 +4CA8F50FB8C4D65BB296DCCCD39F1F554CFBED96670A91F515CA10EF896874BC +8EF48C6447752C70FF5A06F928DB55586354076773BFF7E94C4C3A7A1C1F421B +A9B4E3936EC26E0C19BBBFC90F021E877F54B62108F6DD1C7F6D5B8E64FC9362 +E173F01BF2904B7E5A08B3543611562C2714099DE7D4FA330DB148B560A9601F +42A84452811CE213DCE782A0D7809CFD954D6BC1EBF2BA4D1B18F50FA8174C96 +3E0120E266AD5DDB40B3F6798AC28CDC5C3C4BC34583528F5B5DC8A222B80B59 +A3A93DC715D061EC6915E6E6E21A25425C25E8747C60F170D61047108826F96F +7830E220C108B441B6EA3198E33C49BAD8D43086E49F5A2BC7958A1A8CD011C4 +49045193394696EC3DDD0BE084E8F2E9F0B9496F035C0DEC1CE11409DF566428 +D50043CFF5CDD1092F6E0807E660B68163BCA738E8D98FC6EE3F713164CD204C +0BA84FFF4F33F47BC31750B448603D7ADB9AE92FA91AEBBBEC0DCD66980E6955 +CEB425ED07115B24E40F53B29B9D840842EAC691B4F591F866DF27556474B485 +1C6F53DD72499847109B16C7093984A6B8487D4F3870DD517945CD90E648C1BB +8A6861E540FCF9D75B984B5009B5CC760CBE297042C240DD624111670B703388 +6FE6FC0E89C6B4C88F51DFF3913D0CC1FB4770C8CBEADD4B86393605C0B6C468 +83CA5594754411B6FC331EF56D7CD6D247FAE42E966583C29239A8F862348D29 +60B177984B6B957E733DB4D275015691D91443BBB13C2DA96097A29733CDB284 +42F89C85A7A743338C9DD3BBC4EE53F695E5163E6E1ABE5791ABF100B198B9B2 +1C21E2FA2FB4AFE7F9BB2D381260CDD3A2CC05BF513AA1E80ED69FA27BC5ED5A +21445BF00BC2F997B356D94AF13736C6D3B0613EB6F4CD96A685FEB672661DCA +206105EDC3CA07900676EB2FAB37F48D2E8207BDE1463894DA3C5B1488AC1EE9 +D39DAF691648048F5D7A384B8927F8DA2BE3602669F71D80686E427F395134E7 +7ADCC611BA91AD4B7A0237213C60CF2C905359C90795230344FC3C50A22BD44B +55B2044792509F50F5C21F53D9F9E9F063ADBED3AB99E2613B23334FE8DF70B4 +6120F2EDF69F50BE793EE145B9FF9C73179DE640FC2ACEB5C6617F918CEEB762 +4CD81E665B2E544864D13230B058717B207D3CC5D6647D5343DB4D0356082392 +871EFFA896631A7E0D6477942B632074A9A4EF7B09D4701B1639BAAB4E03A40E +9B54A7A4F845CD63F88831EBFA4FB847847CB98F3455CB5957F2E0A0F5623645 +DBB5C5564C7F8B117D6E27E65C0F3EA81AE67B4AE4B201E7C4FB0A8364FE53F5 +41A7CE8F834C2C4B322809B353A5E63BBA7BF3B7DC1A85EA700BD287C2BD3FC8 +2832B0BB4695FC937FF5EF06FCD87DCE6DE793C2B1EE10E6450352C17726155F +220D550B1759E15AB2C1D5968E52C8080CD280E99D3CCC0E80C2EF8BBFD96001 +A226FEED7311EFB4B67F424B557A877379A15BCA54780F0CD2CCA00400B9B39D +981C6B552AFD2506D1B23618FA9AE6D8143CD7198A8482CB416CCE62B992347F +337D505A4078713BBD91E5535BD58EF0351EBDCD749CC24D4AD39F8CECD7D6C8 +139756680A4C03A58B3374CEC658D30160AE4863A3938A891BB59CBE02BB451B +1BA4B2B6E68AB61DEB85F95E3C909B8B66E220B9F18280161C279F10F7093CDC +100A53D542F071CC0A5AF834DC1D18738F5DD62A5573E884E1FFD22BD810828A +1EA47F8218C15A2E97CBC609927DA3CC2B802EA4A0D7EB57627C135E3B065905 +F97597D818A2C5CC6F328AD25AD11FA50F1E4FE637980B7474D6F85A521892FB +72989AABEBE02A2D0EFE88A6F67AC29F5D8DDFEDAAF465C439983C6B84389FF7 +A6434462BEB7B07DBE4BBA61ACD4A60C55B5C0AAE527DE381DFECA2E6BAFDC8D +310364ECB42CAFF72BA93C067B2F02D1CA7C34AE7CDC46787A0E234C8BE8A928 +7A6F3DDE0338FAD532A9886E8E3525B85DD39364AB03EC4C0DD25DC179CC1989 +1BE232E387E857C78332D834679195E10F1E7B87B7966DA3B2238F53D1E13FE2 +8F55ED6A92A750C7250C9B91E29796621E7E9520373214D7DA81B2875A986D33 +80382AFF6DE1F829F048E57664D9C4ACE91E4684A51023943A4964AB5657D610 +3A5405EFD4CFD1EBA684243E15093C9667797BB47617B66054EE02C41FFEC45C +C1BAE8AD56B00D323FCB1D2744F061FA16E161988741A319B1564E04BA210996 +4F9F02A3268CABE450D166A763F5284954564A1C86B76544C5F5ACDFE0D758DB +865A1CFCF9FE8CD5F9C3B2998C56468FD52DF8EE60C6935A3D221EAEC7714E3B +301371C7DDA0B03A2416238F2B47BAD3A2C5021C886DF51C695AF9C87A864B48 +3BB3FE0B355EED5454B59B25A0D8A1B8CBD356C24F64D9B55E16C30C011365C9 +1E0380753BA3EDC0868788D5F50B9353D0227BCEE1BE36998B2622C0759BD66B +E4444250589F9CEDE766D8B940770CB6B89503E925B35C00CBEC2873D2DC4A29 +0823FB7A3717B69A7DEDBAAECC067949932728E89BEECAA91DE3AF9BF070B9C0 +30EEFA8C0A55C8388CAA2F0515915C98E67FA095BB98967D14B0DCAFA9622E4E +2E0EBFC768D80585ACDF28D8A5C2B6EE2FE7AAF62FFB90F569F84A0903996DF0 +C1D5723366C436E4088F3E2BB9B47F9789052A71CF5C49908CDC1DDA194BFB89 +14D7E3D7D4D72A150FD6FFD8303E9DE5A97A71B808B8BDF2AE466F31BF5D7A4A +44F81230BBE2B456A221E2F72A8B59F8FEA8D31F8A005A5BD93B9F49CFDC3DCC +CE2B67090460F632271C7157BDC2F05BC2749FD562FC28682A616A52D1B67654 +DF78B7843A9EC26A7DE2EB168F874904C2915B97534B2D4D9F74A9573A771D34 +9F7BC855E8F794621BF6AD471BCC347E2DF5F620F5C209E33A4CBF1EA85AEA87 +4492A77342DD33EF615FF34037D660B713C908786D9022051B825226545827A3 +2AD1B05D654DB6E6D261B4E8AF0933AD1F0FCFC7201E1A7C1B4199F160C38676 +21ABA2DDF1CEB655B3EC3226E0B122976EEA998F7A5241F062E54AD1DFD6ED26 +47C99A439E0AE95415059179867CDD3F0FF751F3141309F40E00A6C7C28433E4 +F649BCD5DAA64177580E05C495EE7BCBCC5FBF104DAF360CC2711386655B26F9 +D349D887EEB32ADE595241560FD5924A1745A22E6A01DB9C285EF14596EBFF0F +03F36EB2E0A7C3864F819EF7B0855121292D49482F046A55CD7271FE03F02EA5 +886864D9D8EC22A68C23089EAEFFF03DED6484D8C341861EF8B6FD3C5BDF5AC8 +352DA4E13A1E30D0CB71E090E9CFB9AB2CAFD0CA7C34AE7D8E3B2EB4666834BD +9CCD1AC2108348AFEF6071796F4BB2FFA4A67ED917E76A109FA2DC2A30D744A0 +9AE653A748C1D18FB52595D84E87F1C1FB6B2F32667FE203262C66627AEFFED3 +92B23861E5EB238BB4EDCE09DAE1C65BAFC198CDD1B45D42CDF93E16BB82D35F +821E9E49067E966AFAB2AB52928F8DD6359984071FC37AA652FB834A09E5BD93 +3AFAE161140E74C6531E413E8FBBFC42BFE8A464B71EB1D8CAA93B33D7BCC3B0 +47C7EEFCD3E9FCF26FF9441DD9BDE68D77AD7251C06BBB9A2103049E8827CAF0 +F26BEF33F656A690235DEEC623CC519AFA82DE2AE16FB99F780FD7D8290DA40B +9B604AEF36B529FD184239E7D50561A07428D28E51B55546590A1AEAD4B7F2B1 +AB8C5B9022C1FA03E33F8F409B24911AB8BFCF6EF4A8E415263C789F89063E71 +C0910DC20347469380B7FC1EEB87D4CED7F4A361E58B61C91AFCABA35C03F978 +B9FB5257C31657EE48504C355CE893FE3C553274C641DBC4004F5D5B879CC5ED +D3F21F867F6DF054127067DE86189F0B59A1B90FDABCDFEE61423609D888EEFD +F4A1367129962110C651D9481CEDDB8C5C2576A59AED64E95F7ED042AEAE2F7E +81AC0C408E593DC30DCAC334EDE9EE27D932B98F040DDCD195D6155607DD2038 +970EB78221A94C52BD4F0EAC65F1FC10E5DAA93C17266F351669CAE56F42B68C +6D01E1EA03AE554D63CE76D800FDD9CFD89F80A241EAEFF7EDFA41794EA25CE7 +97BD5028464D2CD45B53834B4AEF8BF0B9E7C6ECDEACEC887E8790A47A93F668 +A9095E5FA1116A122C0E5B74E2226C654D3187C6CFD8807917820423DA3EC1DE +AA020EEEF2280C44A15209EE2F3FC1776875308CEAD38571E7BF889F287E4594 +971A83605E0B4169D4A23EE790515223DF8724054EDAD905F57918FC0BC64F96 +514B4BF7DC9BA79E763C22C977FB6146B10D26FEA1BAA7BAF21312F78D1625A7 +8E242D743471DB5821408AB786E4A7EA9D35E30E85533C617689F95758FB2C7C +392E759C299DCCE36689686DE0C4DCE32649493650BA194A6208C5EAB670B170 +3F2C70BF0EF0E3BE2FB0A79224FF4ECECD6BB3388C6D06867A0E5E3DB93C1B2F +464C23E44D3132E7D4086E3B59B1D13F49EB4772DEDF8EDC4F603217233FB7BE +C13C28648E9AA51D53F11FB896839F97AEDD8834BCA53CB0021AE91FD8E95E2E +F8A094093AF556B9639F508A401542B06821FF9DE1A745FE9AC5CACD5E8E1053 +911442FC15CA5333751ABFE2C617D38FA1DC332BFEF44AE569DC631C93EC54D6 +261583A695F5A392867A57F59B741EFCD2DCFECBC55D1EA5F2317601C9DFE9ED +D1EA466210FFA905A8F85BD58B98991BEA58DFD1CDED5C9B086D42CCE632DADA +147941917B879139E016B0DDEB8446BA017FC8EE5A354533D667B0835F5D027D +C2D580C16B80B3D05CC92C0465CAE077729F0A15B2DAFC89DCD349B3F81D0516 +C65526EB5C10E45A8A85D716EE35FB9AB201FD7C89ADE5AD925A174169DA20FB +61E96C73A143DF964C20589EF24A0FCFE6195317F2FA0D2249C0D8E649C3D9AD +FF13332EA2E4C9CD36D8443EC8F027B61CEF92C6A6B72DD4ACBACC16E429A9A3 +F5F29C1631360E32F8C1C93ACB22F810B86D2969A7480F486F62F8488BEEC74C +2C1AF13BB92BC578E8CD30BEA6BC8CB68ED730F54CED0167605FA76AD7B7E88C +7AE7688E598F91C471BD65A542E96D64B1EAF19FB4F1234308C48C2DC86E2193 +11ABDB4C6189C6F201627C693691A86DD07FF55C30FDB3F72381E09C6080FD7C +9182762E5001E30F52A216E0B71E4D2D4E2F3B20F95DF3A11FDB2D2B5B5FAA66 +C46226D5E0C77066349770514E5675550FAC9394FB27CD2C2F974F1FD58C04A3 +1EF53A8AB3B2202CCA1CEFA66228E1480A0709436C44BD3319C40CF888AE4692 +5DBBB52B15CF3A518F627F672135A24D5DB9B2EBEF04C860AECF231EBB5A3BF5 +6DCCD5E72FE4B6DD29E896691868A7DE4120AD06AC573F5608B8449B38E71CA0 +EB5CDA3F942482EA7973661170F81DC88D54DD5B92323F46F833DFA757107E9E +F62A47CC50FAA1B68ED535C3E0E1073532A05ED339C8D70B3B9864808ABACD23 +AA95E9FDA43D54C66A675FA074E0A5B8777D3C07850A09087F36852B5351F35D +8BC4DDFCA35CF29CD5E3DE118A741FAC4DED36847F2E2C6CFE08669301722D94 +376F540982958074E7F1383C409652F6C99DA39FE90B38221E75BC1ECB93ABF6 +B00F410A0C5651DB418566AB350FDA1789AFD88286AF3BCB42B98386F7BC144B +02DEB8940D20A6B3062F0C4244EABC50923390064F1D027A8BACC3DE45156E56 +4A942D1B87F1C4A76B0D4D6801AE792CCAE3009BF25368B31B6AD5476FBD3BFF +9759EF463EF5E78E10B7BF64005B2ABE0E8813950A08A1808587A98E0021D0DD +751AD515E8278F1A0759E85D8A084490BBB0F8206484AA36388B1013643D3198 +3509078847BDAE08E76FA5BF3E3A73C323CE093DCC148E3C02C2DE1E26C94D5A +40EC8308ECB02FF7DD04EC1005A2A0DC74D4E587F10A3EF349E828F69FD38962 +2F0C74D5DAB3ED6CC9F97008ACCE74C086A503948DEF1AAF58FC8BEC703CD360 +D32098A56AC776B1BD08442052A2A4EF6C8798F7CDC102AF1A2009657254762A +0793F79A39DCD6ADBAA5EC84A7ED6018BBE727E5D477893D84F157074B24C13E +8D4881C7DF8ADC13EBA0D89745EF93B7616EC5355600BB0D2B630AABA3CF2946 +AFFD0B2B724EF0F28393F2034B2E69DA5061426805353EB4D80E20739BC4C510 +6C45275B8261DCBA10DE1D104B12F46ACD230977EE7D7D1D35D2814139E38C4B +CA6937CCFA653349B1EF64A98457F7B4B5D8F2978F16ECCEF7054905863AA46E +DD524CB33459220C71E9EFA7845A3A760A507B3D3ABC525B35930B613710A13D +098832C58EBBC8B0CA6AD516E6385792C59220331D0922A1F6F838A8DE13C337 +900462F952EABBDC2EB1FBF94A66186C177501453CD3FE3582073DD86F04406B +41B6AEB440DA475E13240445D46726A6D45185D56BAB8807CEC8A8F7CE1AD149 +7CE2E1BB5DE4E5B9592241DD136479A65905FD0062C91DFF7349874BFEA5D9EA +2F610ADB9AE7757B2307A1BB9D6797D9F9C4844A59841C7C7682105E23A374BC +A91885E7410F56F1126D6062165B9EE0BAFF28C2B54AB563630AFE4B69FF032E +7EAFC808A831EB41785EE4E3C12C9811617774408CD94DB0AA8DD8DA1FAEBC92 +63DBB3C52FCF345D7BC202236296A90523F67CDB5A61E1ACED53BD1516DCEF3B +551577E7F11E3827F465279870CA80EA5D9FBF65DBA894F62D4F97FDD32FA210 +7822C03144E0A07554DD1E3A2908129D592215A0832A9406021F0B0AD971DDAA +B6F2BA7A29B3CD95F342FCE1032955669B0469E3561D038C6FC92E4D81CB7723 +A14C83E11A4E961F1FC986C55B7155B85EDE07CFAC982102B9CC9B91EFE137C2 +AF41206F504F14DD921D63C229C8B7CE8F110BC23ADB5DFCE07CD6B383450430 +CF867408666C11C1BF88C463998811CE2124971A52A5FF779385EB4DA75B2372 +84C99F5B28FF8772D7252FAFA6739687225705994813636710D9ED94A70C0FB7 +BE007E12DBE00E91A5AAB4B2CFD7E622EC22111C2438849F220A096D9891279F +0DDCC564D440B4FF85F92448D42014DF2B231BD755943368A9554B60AA09E892 +F91A4B3291F21C9266C9CE3D5F6EB1C5D7524C125C86A63F7AF293C9195D2CD0 +AB55040AE154F6CA8B234FE0178E51D2EC007B9D4E483227880E1DA76448326A +47FCD6200A498E1163F1DC4A62013C0F6DD8A3E8E1A6CC6E553741DCC6D89F86 +419D4CE4AA05D132DE2C8C89D0EE918A4F36FD3E700E84B5F4E57BFFFE30007D +304874BCD800EEF2627BAF6BF458D18E9FCA04999F179ADB56240CBBB59EE098 +1B0F6A9FAE71AEC1AF60D163801D299874BD7F4CDF7B8B417748F8EC9D91CCC1 +A24CDB65E06C257CDE0DBF034538E97511324A8C312CBD69A44CBBCB3FD208C9 +568DF8617F833C28404031BB7CD198E97C75921C58DD7848E70EB7A5CED3C960 +C9D5E6F1BF20701D53C5A6D3E3A3FFF48FA93E7D9402419FC877204286302C8E +5767D6881C64BEFAFD6E23B65360A152F6C645821D85867A01278F81AED807AF +9D543ECCB76C61582F341E57FDA0D280CB5074F858EC7167B5F19B09B0DEA98A +49BAFA7F61659DE55298253B0C166F2400C5BA6C35FB669F3F3293A4C1CBE5C4 +1C701D93908190462489388466FB25A891951F2E8C36C1F380E16C50DAA186DD +0C099E0A67D2DE97BFB61CA8C83EBD5C41A74908FF880D15E38554B37C972849 +40D0BE165A186F44475375C49819FC946697116EA80C0010DB3420DA829B7403 +5BDF9F27A94708F9CFA0F45AADAFE0D99E2B47F3381EF256C0017F2C0ABA4C22 +4AC694919EBD2CD065FC9D3E0F543E3E58AF4444718A3573EFED6B76BF9E9393 +DA2CAFE45B322AA75C72E938E5693ABEFC2EA2EEE014BBB815A682DDE180594C +BC581869A7A999C52C6C3C354877EC108D71AB1ADD2A11A465EEA5F424F413E1 +923BF4CD9BC288595D080F661A7C791C7AE61633F366F7930FEC736567F936E0 +FB881D65F8CB127FF9AD3E611CEC0345DC6D1DD83642C0424CEFE2A267CD14EA +F435149C67E3AE4AD961FD1B27530993A8B4B17E79CA3469D45D7ED4423084A9 +7931FA1D7A9A011A3B67D4C5C5E11FB350E60803C760B297A29A6162F1B3323C +04D27278A5113EE841DF0FE9DAC5BBF737446AB41B9FC3C1D48AB9E0C7A590D6 +C817424F940B9E3222121B24B97DB7866E8CE52B81CF44DA5536818506220706 +DC806409EFF5ABAD9A61D7F07232A8A9E4D90475E6847F464DCF86B75BF0D899 +935D8C5DB4435D7F930DA8A4F12CFE575608A1E5D5FE87CB61CD6B1DE194DB09 +E6DE511216E18CFBA395D9F53FFEEAE09915C54FDF8B6BA45B019E3B2DAA37CA +F9C3FA5496418AFA0F1E7278DD79561255AAD3348D4AF4D106DC582AEBFCD0C9 +105BF3425F613B9E6CA03E2FABAFDFDAABE33BE9A9E7474087954BB3F59F73C8 +C88CF9C47DE886A1E1F78EE686ED9064C776E7AACAC393875CA651C334D8AB6C +B8B971A3DC90B224C8E624648ADB38F9BD5A6CA0873B2E3682F2F6B0E45E4BE3 +E27CECE324917C5A99F4A3205E49B1860F032E844EAC0E22D4B4002ACD8A06F2 +989CA23A7FE4C1FF02C1A7A700B3FB132C03AC16812586FD71A1A6FAF1980AF5 +AACE08CDC26944791C3FEEE5FEC5F2A7F355A641FAACAD58EC9A01013EB00EC1 +8EB94828E45F272239AAA80437DE0B2558B5DDB8C7CB3933EDB522BCD162CF82 +1B77B61AAF7BD620B5E0FB47C26C7CBF509EC79A07EAE7ED0BAB636582D10302 +2C7845957B0FE4A9472D1AC01D136CC4935823A387D70DAF7877F9B2740C2AAE +7B18500BB506FFFE2BA75DF7FAA12283D0C7C6794DD14A9A2387BA2538098BD3 +0B3B2B35D5414E7CB1404A7B01225953A9194C4E0FE2CEDC05FC0F953AC0ACD7 +E8280FBE68A69CDCE9EC4545DD5B1B96C648796838764BA7ABDEA03CE63E9BB5 +5286DBD1D64044A723E0D314187ADE197CA4A114D09F0F8CC82E83787F3AD11C +0188A620C4DD043FA9082FB83EFB09D1E24115177BA09D8BCF3EF7B3069EF25E +591E592A446FEFBA01640AAA52658BC12F15DEB9FC2DD452EAF34B2B73FEF9BF +AF54150AC75349BC027EE15D935886B5E400B01E26F1489153E8BEDA0C1DF620 +A12EB4B46AABC23AE85666D33928290BE84B679A4B2D3B0E911C7B19CBBA3F2E +723D93597939AD09337DA5EC35F0E501220127EC1FCD29D7DDEEDF786B24028B +E24AF85A37AFA6D4D6396A643D1FBA7772AF3ACE65FADF5907990CBB548BB86F +AC56EFDBED8E8EBF86C9E48698A1C47A0AC665C5C5111EC0812F9585E65F2BFF +A08891DE06902647FCD200984F3156FE88B059140397B7764A5A8F7523618875 +D33E1929961CD8DEF4179E33F06BC1DBD89D44407373B0221F598FB43AC352E1 +9DABE44E5543138293B174C4771CA7A53253C4D8BC373BACDA4C816564F3409F +12F9C4C6EF19D3BE61E1CD19720627FA96D1830D088C143E7AB462590591EA22 +96FC1153C8459067224717FBA49A14BD980E03AC9DFFE9EF6110D1751425CD77 +5DA34C8CFEB368B99F0E79E00B2F9E3D55521F3BCED22FBDDF4BC9E345A9DA00 +7C380C837C6E99B6CF5F6C3A4DA7DED53D69E6A7808CE6B1821625FC44289875 +5112A8AC49088F2D9870AD878E4D1CB58E6D9C6FE05982C0E021A21651C6F0BD +C01D598E3C867EAB3DD5CB2A900ABF961D011FB83FF16F3431A29FD48E27F2EF +2CAA0AEB273058F9A0074F2E8051B6C5B146D8E3F413DDC07A2C8C2C5FD32926 +69CF0213A5B82FFF26CBD46DB57B136388DCB09E20485FCBA93DB63546F138B6 +7E43E583D180C5437A8AEA607874227F8DC8ECEF9EEBA08D32D291FA8559890F +9957E6688A39DF0429D2E8003A4AFF649ED7BD2111268433A0FD3F108FD759E3 +86C80BE35E5E23793B0AFD0352708ED2E4FC568325760BCF1ACF0CD3640C2536 +95807104927D103DF216BB93FF56CAA4AEEE5B890AA28446D6F2279BE427609E +62FC24DFD04A174DBD14F10E19AD16C92AAF73B6D66DB2DB787EDF80C67CF9B4 +22D094ED770E8F6FB8838C2EEAD115FA4B688F500109FF4169176ECBD5D3DC32 +A37C5BD00D282AA10824EBBA3EC98C5F5888173BB9B1DFFB3B3B9033040BCCB6 +8C3937073B60824F28C27F4D882AE682CDDD5850F3635D07A3D43ADCA16F3AA9 +A00C8884F6BDBF9922F37AE696B6FF970DF89671A5296611DD6C4BD2A9935DEF +56D9A18B74B1D58F743E17AB5E12A401A4C155028F12E5828A1C4F73010E8A3D +AE0FC4ABBFF2DC95510091A412A679E64188860E4B0375703485916D630CC665 +2D8B83784BF451232570DF576331EC2FF1B646DBB6334233C58E0E9480F5A54A +7103169C2DCB9A03B6A0361D5D745DA48DE0916BDAFCC450309B2A4768DA40C6 +17C92580679ECE6D273DCA6C7B8D3467C626D0D11344F1479506F4E24DE8260C +D21115686625FDB6EAAF338CBE2AA4938BF9E471E30E9DA7ADC25F2534E68054 +633C3FF1B083F71F13FFFC469BD33E2BD05724B86F589DF0609C19AE5E1C99B8 +62830289921084EF1BFC5B5FB8FC04C5FCC9059E7A807A4A89793FB857179EBE +1082879DCAD72479272E7B158DFBCBBE21E6540E03EA08CFC062FEB38849AA0C +6CB95389029137CA526E2E7544BFEB7C2848423F5CA380BCD5F20413CD917CB2 +246183C0B5806ADAF632FD1119BE352315E00363FC90422E5F5820B66152A998 +363767903F16B6769FDB410604D1BAEF96E0364C3158BD0E75F70B0F06F5BDD4 +4E1AFB95E18A23742A9A79603E03ABC184D8D276A4CD2EEE5E0C68D3F1EFB50A +3FC4B0F81AD43793DB22C6472A9624704DA97F60CC08071C0E3504D1148F3AC9 +FBBB9BEE7FC5DC309B7D72D7B5ACFEFB29C5942C5B1BA95231151E39E930F34B +11F5D295F65BFF94480B4E2C69266DD829DB341953D8AA74327D77F478D95CF0 +14FD565BF730E2436B24B827901A77A4E42862B246987560C3711FCAAEA9A5EF +C2D923E2B4DFA32490F5634EE65D968ECDE3BD0E6C5212B1A0F2DA6F8681C3AD +1E9BB703D3C19D8C6E67A364ECCE48718B10B594FD1C256871115B0943FFAEB1 +D3324915C9FFD3C4751A5D7BC7C380F6C0C7F5E71D6C1E8CC51CBE41FA00BD85 +C6A9A0A545AE2DA42FAFAB8FC0ADBBAB544392DB9FCEB7A604468EB696C19054 +97FCE14090C18E5D14B0A4833AB0EF27D01B920635CF224D62D706A4C2E9A859 +3130023B4108FD46157DDAEAA63F7BDDC3688FAE2F6B7911033BFD1BA1069B05 +8FFDFB8A342E7D3EBC91D9B5EE0DC9EC71FFDD9F991F285329E320E6A9DDBE80 +E092D35626C9404AFAD73413C0A16219F3C4175587074B7CE8918596FAF5BCAA +4A012743457C05BBE26E6FC028F5A49CECFAB8B2B5E5CB0DFC9F03783369A92E +2975F4F12585E17461BCB8155C0203ADC2B39F966C57E0E64F29E92BB8FA3B08 +68BF9368B80F46E4DC14BECC04EA96654A6F47AF7F30EEA007F9E689B167E83E +2A5B6DC4363887539684102CCA0415965F8A9416F05E13436DAAF07A9B9342E5 +B97571905C9FF51D6E0CD16880ED55EB5A622E9D90C12CC9C838003D020713EA +5FD23A79BCB8A6BB31E60DE296F6074F81208263A911359FE7B76CFB3662D98D +02A96470120B63B667F5E7A58C6834C558C19783D417CE3F7F18D9E8E7F7D3CD +3C94585CC7AA3B5BA430DDC99337223266C476EB10154E62B9FA65483E1D8555 +9CB32FF29F185D7408688BB887CD3F85518917F32F233D6008BF2122188411C5 +8F9EC4332DDCFAF1F51FAF393AA820655AF7618F1009E4000FB2002B01C14D25 +224BCE4D02DE31D8C8D4FEC7E2BA9ED800F6D592CC5C483E3F9979D155912744 +2217AE46D7A6C052A8109B5993D8A71144F8D9E9173CD6CB252871A5C9FE8967 +3B111C7AB44A7DC96759D493BE9167CA054313E81F264FB3BCC58911117A7ABE +ADF0D490A3927769E7636AC0754BAD59DF45582E356D3770B04C494C536C5456 +6413267168C01F06383A3641BA3125DFB713FDA27E1D58687C4FBB01865D9A92 +12803FC0DCE2C60859CA2CD7760849A4CDAC2A2871077F243A5FD38465F6067D +86C6599B60C357A8D1B3C860F1CBFF3E6C1984FB63BBD74B2F17D8EE5A0BD9C8 +281E1BC31D271C3DBEDE84A4ED1E8C8E7BAE535BD05B44ACE8D5D3B7DB24419A +AADAF3AF9A1250B754BE1516A9F444FF5AEBE21075307EDC57990C4AE0CB3397 +986DFD2DA9F4F7C1E5724E7793C61E853D5AB93FC092A3B444B125D49C36BCEF +F1304592873A6C6F1E7FAFD0B7475F37690CD7EC2FA5ECE2C201425EFF16BA81 +FC5B3262859C4E8C129E8158BAE10DF85AD8DFC3B4EFEA7D5F90056AE238AEA7 +3280698696E8C366AC3F42F56E4F18492F377EC2456E147AC9E7FBFDB01C47D4 +7C29548D71F78C3D070AE09F655D27AF10E67C706B05DD12F5B517A654FDF51E +651BE49125F23D5EED637B4DB31C8518BEE058C0C3FD67E0E2D869EBA81C5326 +361CEC0AE4B44E9C99B468E1E76C9C1D72F86A00261D23A9E71AED920212FD8A +F24B6CE006823D03E3EB723ABDB9786FBECE726F9730B3A971C903BE9F670FF3 +624D9DCDC2F5841825AE16987A24B17CB234BAC1AF391A8560AAB5E3A3A84FF4 +489EB9202660B3E5D40D321BEE01DA1A65D57ECFCA6F2853D22999EC3BE63FA7 +423648863D8EBF8D7CAC9E4301183CB4B6DDA1C44411CB54592B1EE3C88FEE4A +D8D4CA79FF534D4A03FDE2A215EE3D7494ED6702EF45527A6398D6EE4D5B0356 +90FF408D07C6D37AD9E2BD7BF22D7BE4351E2DA853B546B1554D71FE9885B61A +B31FAB7ECB990BCF5BE2187AA62ABF69F06455C8EB2549188B2B0B7C3797F51C +AAD14906029FDAB42A6DBB64C3BBE7B5C9C122E00A475E6DFC893F3BD57CF95A +1258FDC5EB10270FF9DBB394D4FE4DCD3D047B99E5E1FD10C7BE1D5563DD4762 +F98E65594DD590C77630EDF0E2F96C4439D95A46576589E3E139E29D908E11B2 +D531C25C1B902B06F5A34A060E9702EE3FA9D76F816D83CD139314563BDD6E67 +A49FB713C96941453089639484B2B45EE91757B99975A2E477F9BC46A7718CE2 +8D01C65ED0F7BED3E935517777FFEA07606FAB87911070A1278E3A1B8B6F588A +08BD54E8B4377270D9BDAA8DAE98CC0EBF03FB876EFD2B67F25B752B96A45036 +6F949966805FBD7A5606955B92B535B9E695BB4B91750EE582899C4104ABF2CF +76D9CA6D42BF7C4917E1198BF674EE617966477760E769F84B465FA88DBFB3FE +E2B15E115034CA77E9867E3DFE62F0840965C5626160D8CFD67D7FC09DC2A992 +B47FFA452BB38FDB0A0714715789BE7B177EAE8CF33CEA1F4ECE89BA16BAD2E4 +8CDE5A5AC82B4DAFAA51CA85CA84814AD540B427A1E5D547A55BE014645949DB +4EA63B1121D7326288E80DC4000BFD8FA401E1495C4B335620BC3F18E1C82B5C +C51FD12D7722A19B36E82D1F8B3F6B6509B49F9FD9410CA70FAA0E50060366AF +4BA05A8CBB95E35D9DD48C3C52C2F4ACFC781A381FF672442A66676AFBC7EC5D +21DD918EC032AC60834E543675CE87D7F8440C9DEAC3720376F39B613E2FA577 +EA6AF49C659CA6E097294A0E70EE8E1743074FFAD3D23E3FCB653A4575399BCE +15ECFFEA22C54958606B1A3E0E7F8A127608A8ECE720B09E7F5962CC781CFD22 +FAAF6ADBE33D77901E51383072729BCF04125FB8495F00166F10DB01EEF96178 +6214844DAB08E8694C1CB1C4C20169143535948368C55ACB00F0ACFE63A9EE06 +6A9C36C482B2AE69711902D62DAF43588F21B58ABF74B24FD1A2C7903C82D020 +9B37CDC5D074804808C980CFC16C6E038144E011856162E62700D85C818187AE +175E71F07034F86CA8719BE87089A854834BB4E713E555E0197BB91C3DB16D72 +2C8A6CD1B88B10145C3EFB10C0CEE108312588D34A304C97C2DC2A96A18637B6 +DE321DFAE776C5A44D9E223DC2925B63C532EAF8DFFC4503B28C7BE811607D86 +C1A9E4E27B00046CABEABB0129262E2005D1C08E8039A6AB99DA707A5BB5CC56 +8EC0BD933CCA055632D8DAA826788F0317C81E5F56EA7777599F93C8F1F0ED5A +86D5EB220E6F4EA3838C84BA8CE3BACF94B9C9DD6447092E7AACBC9AFB234B9E +F0340F528D16DEE03920445D64330A8E5BC77E5A58CBDC8B652AA150767352C6 +9D528E7C9A94B225F14306C73CC190F750E241A019C1D237D45353EEF3A616E5 +AD896FBF7DE2857A0A8AF8921A85B7B22509F06B678EE10A09C5F4DC8AC2B03E +F73F00C9FA009D00C74A01C45D3EEC15D97B892884A80EE3FFFE2E434C270E88 +D7093EA3FBAD000D96922C5E9EBCF4A12CB6CF034A322495AD34DD008A25E1A1 +6FA20C01405E566957F56A52DFE0AE16785E005C57FF70B9305FEE8699A40D73 +F2C2A9C54EF891698040E5A6390390965925755E6B429A328C3675DD14EE8F4E +E1C56486707F976A94F33E360DACB204AB2406DCF2B5BBBA854C5B1378F50913 +40B9240429F1217E0E27DB95D1F791BA30B5ABF517DAB074CFE3C9996FD2B8AF +1252A0FA3AD6380231B9046D7DA8A0F5088CC91084C4906BE8D3033386902E21 +752E4B768C85D9B964F31D59BB305AE4CA1C359295C7D2968DACEA45CFDE9E0F +EE5F41E4866DAB02C876F7E2BE49FFE663D66A30913FA67F441DC8FCF8616137 +27D10E8F77D2D75D613AB9C6953229AC3A811B6603EB0BA812102990C6ED73AA +5D4C0DB3DC3E64921061AE77FC26324C544AD239D0CAF61B67A6542AB3924752 +5EEFB382942EE6D5A3B165E9DF6CABFF118876AA20E01FDC1F5621AE4D2EF83A +3AF67224CD53FDC82554C5657CA6AA4EFC3482FB338B75B7445D7D371D7D3DF3 +B0BF3BE4593BEC2EBF4D02C69F7543B4E3039E1710411291AE873EC3D42EECB1 +B2B84B8AA5C64CA557C876DDBC9F38C0DFEF45CA3C26E22E71BAB1849E0E3AAD +7520E1387A23536129338F5573EEE0FEBD2B7695693E0AB39599BD4BE29E699D +9E444B89EAE61C21464F769342B40381E5B5E3FCD8A7F2099C2DCAC6D884B4FD +198E1D2E6AB0EA7F0C2ED0766ABBFA0A59256C1123316FC80C285D0A006E5D90 +D8012912E2B1DDFA385694C182DD0461A5BC31083A17345EBA2BC20972858C85 +9C07A3926FBCDC715D4BC0A2393C170FC94A1242E40131B83718D607CDE9B8F9 +D8B592A9F3A6FC357BFD8FBB960BD326EADB37D4C1973BB41EBDE0A3930513AD +8C205F8846AB4DF2FDEDC3C0515FA534EC966782F336B5CFA23457DF08AC0FF0 +3461D778AD329B152D84C52FEACFAE98508CB9935D8C5F3C8DE00B43A6B9FD97 +BE34B1ED4483254E51007FED0B09014F3AEA4CFE57E8CBF3DAA21422D9051D0B +D4094C9887FD76E6303E40B3299823EBF76E2DADEDF507E38F2CEE00E03B4498 +4255E92459F255D0CCD91EF2FECAB45A6FC6D65CD45E3BD5193B99396317BE5B +E62300B829DB8574F8ACDB704FD86709E732920A1E4CA01904A15234BABD6405 +B16C11B25A21B886F56B1E46183DC6A0BAA6768F00528F69F07B87E2F6C095FB +773BE94ACCEFDCDAE7013085370057456612A8583D10563A14420C6DB012CF38 +1AB7F526B5F9499684A6251DFAB52255293131C2515223310347ADD292C5E794 +D8F32B80F90B9689F1356AFBE5A88F5DBE707E6282A2F2DB432F2ED4B626C7DC +01458E9F22353AEB9A0AD6B1BDA91154DB5E2F69CF83091F2BDE02E1231FF4B7 +8F430AAAC8D3FB6C025CA6DD6C795EAE32225E5D484C03DFC52B1FCD977B9BAC +789B5BC12F060E2924450763EA924F40090A673D4BB98849CCE88F3E4C28AB17 +6767FEE84456A17846750CBC892E38904BC5C61D03BBDF549A8269EF4209F9A3 +1455DC7C13A6EF6FA9B2DF335E6CE199FE43E5DC858AAB70CCD3EC029FA4B291 +A0064B5C6C823FF3D7A17F490BBB6FB077F4C58FD524385FE4E185130BED1230 +875E67864F1689B8F51741703BB9512F2D4DB8EAF70A6B580F83120CC0095020 +6504470A4BDEC85457C481114BB4CC73E2A400CF04C836D11AF37A8688C96EC5 +C2E9881FD5A0D07714F516C4C7532F356A7B5048A6DE610D30E4892458786CD6 +903EBC006616A8E06A43D96456B2A312D7CBA2B830E962B61FDC81532C3C1648 +51DE21C00607664FD1288738CE81E193CD5E42769D1F7A8CDEF61BAD040EDF8A +D2FCC5AEA57F259BF88D2168172D3F3C7677B82FDBDFA9EF27DC56758FAC7681 +F9F243A117787B1D10041840A938F73125426D4CBC63FB0C9DD6154CF5B627E6 +1CA70C223AF7D98E6B2680AC4D3786912AC494297F9D649108F8DA36C2A8FD68 +60A9EC0955D7D004D55B9084FB04FDC6523E6DA81DD9D2DE54CE1A480DE29C44 +37C7F890BA5294910969F175DD6C39FB96508C8AA4A9ADD62EC61724F9D19B32 +3743BA90D625C2850EA487E5611A1E096A70C1F1D6B589DB174602D7EA07E14D +AD051F2353C3479A84827442FC3ED64DDB5C5EF5B1453A8F0F51205766FBE67C +FAEA0E449AAA51175953C5300DA01FBE138240A52E83DDFE973325538B9EC466 +A722824BC0F7B969AF787F896312951AF936245BD0D8A5567F8ED07583A6738E +A6C08FC5DC9BE2D543CC69D08BF3605D078CD036B267FF1968BF7AB684093E3B +4C5F6EAE740DF953B2EDD5F8D80A016B14610C1C5136E8FF2DFDD35639424789 +688B3CE7BB00C6F916D98DFD642BB8BD1DD3B0786F3C41AE0F082B575FC96404 +A161FCCCA4648D25EA502AA71B2AFF48935B4903C470437499059E39ADF0E38A +3A34F979B489BED4BE3D32AC4FA43B30DF83ED3B0D101C01562FE5F29183DB23 +408DB64174841D2B3DF019A74E14DAFE00AAE2EEDA2CC7FCC21878EF04F9D2E1 +3EC034F2618EBCA323CC1B8FF72C5713E513BC601BEB2E7126F2E71226CB492A +103878C580807B87E5720AE9660DAD15CD90E03B0D2690FD1590612D8F20B041 +BFC35DDBDB938BBF0ED67CAA72D921E339E52776428C7E6B00B9A6DD07B75ED9 +D6056FF44F2BB926B91EA1F16B38B67A02E74D49EFF7D115B6F4D4964C9574B3 +27B07EC511585A0CEDB459A564EC4E7B47ECE15B86533F76C8D12F06EE202BEF +3481875EEA2B97069A5CDADA106B3104A51FB8647E2C51715106C1F7A6A50429 +42A04E1F4CCF1F6CDF0C4CF0C63938363D9DBFEC38DAB92E8E471F61320D6C8C +951BAE8FE1CC0BD94F5A971B17CB8E64F484B3B544BE05F4EE897062DD64FE61 +C39A61F6C2B88E2F4239771A61AFD767921BA791C6F0A001F169303770F605B4 +72B3B4598EE48A9519E21F3A75A58C709C58785F19F421295A297BB4198F1B61 +103B072CA3CA6CD75853E83886C9B9BE9B70C0831ADB61A9E7DF2C75AEDDA73C +7313C57C30BFA13F4637E4CA1C8549E32FF3331C0D244622887A19BBE2C1F612 +7F277BF46050B22E01543A69413A4CC4098A1BFDC6682479549EC575F167CAEC +AA88ABADA7B85152CB44D854EA27269FE0AB384F1D558A61D845C499D4451512 +BC743A0ED9C683330C4B1CF539B39AE0DB9D3EB939277BDF576C88C83109D2C6 +4023A2A08E111EBFF60CBBD686BE96C96F41A0D50C43671DC056BBF1008465A9 +A64B66541E071A09F81D9F6E461509FDAA67515AA6AD8C42D3C518624B27E0F7 +8FC919A7539E560905CB206B8F8DFB6B4D4A3E2ED09D2D8F7821BCBCAFEFD1D4 +B68FB376524546FDC0A97E87129DE4FFDD6F819FBB461740F89CF7F345FFC677 +31D2B94D6877CF0221367CDAE9CC894F48229741299DA6C97CFB18C072C1E8C3 +74CF8553798D6D76BD7FF94CA9AABD099E5C36DE9F5551AB228945E2DADB6B16 +89CC1940D107CFA8D851B263A3CA8A21C0462297C11CB64BB01B698A2281A7FF +D60EF261B899D5607D8CBAF641A4E628FBC72D60C04A4F576C7D738E835FCEF2 +4892D4C814CFC0DBAA027C9DB8862B0D490928F8F4E5837D30ADDF62776268D3 +3E9B8F4EB5B2FB36EF0DF7A70CEBF5CFB697F3142269C39B1BF2241E66D610BB +A7694BCDA251CBF4B78F3EE8713C62E4EC410F7E4C6668C8B2DB766A5635D746 +4008C8F1ABB2EFA999FBB6B525B932D171D056C2E2C3A50CA27F00976F249CD0 +9734997A9E5607F397D541E527240B0D7F10ECF8B914EA6E68741BE50B8EFD23 +AE3DD074A1F9B954DC54C7261075BFA17732A6609912CF1B1D772093B57F9F2A +A40CFA1D5E5FED062D3117578047F391FD5BBCC4706354BCF8A71B74374672AE +C55DAE676FA162AE5CFF0CDDA4AB89054EE4574A7D92EAE47CAE88BDE8023568 +1999A8BDF4D39A85F5B80181997C12B7CB694FD4A88C9EB5F53DAFA3A9A9C809 +2B231FCC16FAB85EADEC318B425968A7C54F7EBA066547AD3231F03032123FC6 +507D007E68E9D40DA39F3491F629871568CF7121EA9708B3191E9FCF490A1DD0 +49294E271C5233C620085B0E17B299FA74391C925267FAA3C843484C6D128391 +C61EDBB041B68E12046AD3FC84893BB7986FD11A8724013DE8804A991236DE8F +05D5F5AABE8969053439DB617EDA10039A4ACE392B74AABC30BBC88C964A515F +E45EA4514C6596BA652D2AC24C344FAB9AB60AF06DD67D206A9EC6D2086D448B +F2912632A0683737FA9C3D8EE41F481EC45E38A69A62BD3406653A9865DD5BBF +092CA273B00FCEAF637EF91F2EAC8FC3F918374BF37D6DA7D9B672079CDB14B1 +FDF5FD2A1A9D2CEEA05352CC9BA0E15C36FE276FCA8B3321398B52ED481218F8 +2D4C0970839958ECCFD5272CC24FB89F7C6939BAD890479B968F31304A9A9CFF +397575FB17E659CF96D97518893E8A8BB4A0C5FFEBA868E934BDBD950D220EC6 +D544ED894C46DBC94ECC23868D9032C34BE24C001941D3C0F7D9A45EBC484461 +33EBF1169000A216CF681C3D063F059C3B96BDF40AB2DCB05E8E00E60AF48005 +4A67F68B12B05008DF91B0DD20179F7B952442829C61C26BE83F5EB197BC2E12 +7D709B1846892F62228FC95BB4C1E74A2DBF46F5236CF366BE4B33FB3523277B +C54C4DD8802B76E91CDEA43337528BD330404ED7EBD7621FBAFD98914C594685 +582CB00E723C7A11C46BC40B12F60A3E87AA1C446D12B30E96E3534B01689402 +826390C77F8EAC409EC862729229176669DF5F0CA76211D488D8F4BB640DC688 +4CDDBF5F70343EC761C3BBEE6D2118FC70BAE47CF96BC3EC2B8696BFDB623DB0 +3C70A0871D154E66D442691CFABC82A7F7FF60FB4F59034B0A7C861BD1D1AFE8 +2AEAE299629EF9E8F49187600398A754A438A90766C59FBE6783A7FE49E91159 +74B0A13D39A33749E6DAB8BA984625EDC2EFD706FD11E045734060A12F3CB062 +3CE9E75E27DFB86DD0F079AC466B30A7E341FEFFC1063FAAD0BFF7E0282469DF +510E91A3D10F302BE1BC528A61978DE2302991984062B0425ACB57E4E58D630A +4323EDC9EF3638CC2ABCE45AF8ECBC345F4B42597A195AE44CE4C8EB5783742A +A85420DC9D705D9448C06462999ACCBEDB14A38ADD830EA114D3BDED2A330168 +8990C5B3C9927AD20421C73EBE625C3A0878356C1932EAAFB5E3C33C552EF85E +E7183B6A4A10F4723BC8EA575E06997A5EBD9118C1F7FC09358FD5F67320F41F +5E59B643702C9CE225B1DFC1560D43AFE97EE05473F01F1712BC4F231D5F9411 +D8DB9DCF8F7FFF162EDCB0B527B95E65CEC8E543A58E630B42066C50350B6478 +B2B3690939FAC219C728DC74AC225C0362BEE0BFC363B4533A8E49EEFF039A0F +4A7DCAA66E713815565D09E56307D4F90DAB6A4A1D2F1A4E2D2E0EE972B2CB2A +D4521464C92D5D4233217D7E88E29DB58DB14D2A0A0B3A6ED4F12580B99BA448 +D5C334EF3DD9F967F557EC4C563EF5E62E3335BE12BE6E2DB25FD4B6C987E7AE +D90F1225181BC85175678B460A6874DA2339E18560895EA3767C735556FABC78 +FD23C5880852BF73E4F3255CC39570A5E78B5868520351A190FBC665F5DA52A8 +683EF95DE112BE589C83D4F1F110E95CAC89237CE1C60E85784B47A5A1DB8AB6 +DA499278F84F30886F02C3CF96ECC2972E324FAB8142D8B125DECCC5FE60EDE2 +9932CB5312A7AA1784A95F823201C019BDFCCDA89C9E371B4ED90D47090328AD +2AF77C8D0ECA90EDCA3C0660DF163D505039D8EE93F94929797E718C5EA0EA4D +0029B3523EAD5E265B57D7FD6890DC5FFCFC778891FB5CE7EEF81D92F65AD922 +C3C7C104E7B70B2248751A41B011A02D14FA3071A1867253F740F64D30CF8AA2 +59F36C0D9A13760769457C4CD3280C69AC3C1C8F91FDE59155CA414B1D361A5B +AF5974D3D9BF7C0A4DFC9B26DA570D6DC320A0903F68C235D8B48D2657634F39 +C61D1AA61F8B440282A595D92CAECA93514C95C4766FA0F9438EA4CC74DFF726 +A469C4CD12C7E0C4839273F07CC40E68BECA3E9A1F7BADC2EC2715E245381FF8 +2059BDE75E2B24D75078F02F5EB3B3715976377F93EFA2926F0221E40ACCC9A7 +E6F02D7F941BA60530D288CF90C08824A4A9F2615DC2FCA83EBA1A053BC791EE +79CD8D190D8049C7008FD0344E71593F8E4FF5EC18C06F9E4E5AB0CE37BC2106 +21851001B64989C0F3025B8F54FD552CB0C8A0734E017CF5E7A386EE49FCF784 +9069EBC5C0F2E194C128C8C68DC61404B6DE8C00AEDB5B73B63DCDE4D3CA3C91 +07A0A70A989513A69987FAF3081F685B531D1CE696F30BA358C930DDD1F1A9CA +CA644B4049E8D48681A28BF94AEC4C614D491198D546491B5CF98878FFCA6EB4 +5CDA4587E4F4A29EA4ED218877205047E02CE56308F30998D4C5AABC407D870B +CCD82CA6213C0C8C33F05188FC889B5E2D9177DA2786FCA47814EB8972F327AD +10A6BD705A5FD2410ADB1141AB915D983375D98855158BFB30B12268B369C713 +995B6171C57787B77DF3B68403BBB01238982AB96F5A234DC03A28A583150141 +E350B88BE1AB3F6FD527F77A81902EAD8CA16036E58E71AE0D4B6807FFF82138 +514797E0660DB085FB7B5D2800D810E02C52E1EED3BDAA68FD762DECBA97621D +48DD3695FA30F43A522C8454D11C10A14C6BC087BB89CF01AA90E488B15D6CAB +BE0F03D392773B6989CBA54B96C650A19480CD258796133D391DDEBA5154FA29 +9076A0CCC2DB735D76AC16ECF5342066E0888FF0CB331E8A7163E61BB7614695 +D7A158E75B4C615CB479B8891CE74FB85020971398CE090592D77BFF366E2061 +43016BD3AA25C430E82CAE51805E7104E763F3384E5E5524EAAB713A716F2864 +F75850940D5B0DD0FF762A67B9FD01F764E37373FC8B93F9F8F3113CCA8192E4 +E7784594C332A45E59D1D51E5A94F4D30F8C98AF1809ED80BE3E41E43763CA4E +EF29D958DF81A23242C0EE2D2D33728EC9607D3B1FD9AC2F6C4765842F096C96 +0DE02BB223C1E08B1B59B89F910C733DA201EE25278042932AF5A84213C65D96 +DB688642E372DBBEECADC2B35ECD1D100532F75FD289AB03C69C2861593647D8 +211F8003F6D8CF68B93AF8DCE22DC41A0B713975E5A3C7EB3F5BCC192D049EC3 +3F567ED47F4BFF21FEB47210E8208802CD3821DF88DE91A039986BA01BBAB2F1 +8B130543481B5D80885906DF90554446993C971F8F4C4C915A09A34D4308196D +C4130E2410E08036439D90FA09B68AD5C1534138516AF20E5BECA10644AE194F +A8606A596ED64778F1495267916A934943B1FAA889AD41F607DC3F913C8D7478 +24FEE870818C89494C12D643CD0789E0E15A5363BB51DD3F707FA16638890471 +3BB8A5D5B977812A2274B509EB420B65FF65EEBA0032B44DE47EE14F4E2211A0 +263355B4838471848AF71F2C3105CC45B7923F2957F3BD0379E807A641ECBBA7 +16096E63F2F19706CBF2C524E37A3D160AA480C65F88EC87EB223C6F9CB2F2FD +963641AA9E7A4C386273770E0EA24EE199BDF9E18B1EAEF9F78894CB3F111355 +004F40DD08242774CE4F8D9C33391D7E40DD0BBF8FCE9BF9750D9F575D5F2793 +98BE9EAA359FA73C5F21512D49E61831EF07219DBB670AC6F1CC8CC238713F5E +17CBFB8D03B475A7FCA0554DDAC44827F7EF8370CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMTT10 +%!PS-AdobeFont-1.0: CMTT10 003.002 +%%Title: CMTT10 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMTT10. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMTT10 known{/CMTT10 findfont dup/UniqueID known{dup +/UniqueID get 5000832 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMTT10 def +/FontBBox {-4 -233 537 696 }readonly def +/UniqueID 5000832 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMTT10.) readonly def +/FullName (CMTT10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch true def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 34 /quotedbl put +dup 35 /numbersign put +dup 36 /dollar put +dup 37 /percent put +dup 39 /quoteright put +dup 40 /parenleft put +dup 41 /parenright put +dup 42 /asterisk put +dup 43 /plus put +dup 44 /comma put +dup 45 /hyphen put +dup 46 /period put +dup 47 /slash put +dup 48 /zero put +dup 49 /one put +dup 50 /two put +dup 51 /three put +dup 52 /four put +dup 53 /five put +dup 54 /six put +dup 55 /seven put +dup 56 /eight put +dup 57 /nine put +dup 58 /colon put +dup 60 /less put +dup 61 /equal put +dup 62 /greater put +dup 64 /at put +dup 65 /A put +dup 66 /B put +dup 67 /C put +dup 68 /D put +dup 69 /E put +dup 70 /F put +dup 71 /G put +dup 72 /H put +dup 73 /I put +dup 75 /K put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 79 /O put +dup 80 /P put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 87 /W put +dup 88 /X put +dup 89 /Y put +dup 90 /Z put +dup 91 /bracketleft put +dup 93 /bracketright put +dup 95 /underscore put +dup 96 /quoteleft put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 113 /q put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +dup 120 /x put +dup 121 /y put +dup 122 /z put +dup 124 /bar put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794DDF2E5ECEBA191DB82B3 +7A69521B0C4D40495B5D9CE7A3AF33D17EE69979B82B715BAD8A5904C5DE0260 +6C15950CCF6E188A0CDF841EB68E5A2F88253E382140F87C87E55C9EA93B8C89 +14A36CDF630D6BE7CD36DBDCE22B21778E8648B97B7EC6742EB5114BDF0454B0 +0EA7B1FE236C84C0E5308C871F67B973892890557AA12E00B2C20C71F516C397 +3F3BBD14A1D0149CA064391056E45E9470FC7F6F556ABC82653B3C8049AB5CF4 +BA83C8F2158C236B2FFD4208846013BAF4165E8BB8D334C8FF2E8D74AF5DAB2F +D44788869B08399421AAA900ECC6A2D594641C121660D4B5F512938994C18DD0 +FCD9B008F68F0351D21ED735B2740CB1E0C1CCD25EB548C35B844601D98828DB +556F71D07E081A593FF12DAF83676492A0FFE16E95717A07082B43A966C1EE8F +8A59E1255E1705C43A23CF29A5E4A6547C93F1680A870EE7BAD8CF74D838CD5E +F806911D8FE4262ED8E7F5BC58B92C9C6D74F8AD45FBB021EC7E97393018B9DB +B1B84E7B243ADB05ADD3F1DB3692ADC5D47FEC7DF93080669E63281F1576B673 +125EDF08016664BE73364F65389F7C3B66623AD1754ECBEF9E5CE6948D933787 +A5674279ACB2EBECD3B4E6361419AB32028A27670C9F3E18B746A10B00AF6D77 +4EC00E3BE521C02A99AE5BAA98F793EB1228952BE67934B91472E01AF7B816BC +56D7F19F631A1927846D800C107B1E9CBFF9D2DD513B4A8CE2E0DFD77B1ED178 +E43FA7052765E9FAF89989D490D8FEF6C536EC0D4AE27A74F474B98DA9E6B92F +15E063DB260571979A5DE2423920CE1F59F56EB11E00E3BB9D466A8263E1E385 +2014BEFDA8D1EA3EDA04BE32AEE6CD15C5C010A1DF7F705A2C0C18E87C8DCCE9 +05D9163181CBA56C0FAC8C06A2990554C8E759D076B01BBEADE3B5FB8B551390 +6C8E4A2A1C6E7D9C708614626F3770C0AB7DD2027469C77975C27576065862AD +04E5E50CEBE907E3E991FA0C627302C0E207B4D5992BEBAB5853AD1C0D271728 +C76F40A79392ACCA7358F948AC65DC823CFDA59E1FF69CEBB6B7EC3CF21669E4 +70D999508F9C49E2D9F8818CA53C977D93E15FBBBAF75B1E84F0BA62BCC4BAFA +4EEC82D804C8A8C0210F3E5E258BB1F6921AF02BA9861BAD5C3D5FC8CEFABA8A +A607E547B802096F7AEB09FBA99C83C9A494B94408DD607CA6561A6E6660C473 +62CF8D35F31D052F6C6C8138A8E1430CBA7EA6973D6D510C1A06B3FBD79D9364 +240C1A00272DA44B89A9FE8D5BF36DC1B5EBB4A78ADBE9C5EDB485F093D9517D +69E1AC9A8E6C9D7C324E3797CFEAD9A18E82E03F69B2CED7D5DDCD1A218BF2E2 +ED2293AE999FE2A4B5213A10083EE0407BCF8007670B8C737EAB30311C868D84 +121149ACB4A27F3ED6C0C181C98AAAF51B105F264B5672D7F745131ABAB5BEA4 +0C9B43C0DD9116D6DC61F90BE72018F290D26D5E9D341055CAF09C9F45333CDB +D45B7954271767F638EEC499F7B53C2CC5774EA7A7F024C4CABFB93D9CB1856A +0C671A4ECA7C62EA5242648A84E7F3AFB9547A0AFC29593CFCE6D8B873A78157 +D337CABD291431C0A2CE1F37E0CD7340567AC206FF98E4B5A6410F70F750451C +550EFB54AA259A1B236CA9CB730D2CEF125EC65D959441F7CC9768F777B44844 +CC9842A307C72B740680ACBBF6AA35FA7A94825069BF7696ED81A371A9E5475A +9D997F2DFAD339AADF797F7E03E654234455AC3D17702A420EE0A597BA31BDE4 +FEB8DBA7C61D311CC90441A620164DC22DC2D373973EF84CC553453AB1B3337F +7B39983B8DFFB3A9425F119B45C1CD37A76F905777B3154CA6200792F1759D06 +E017890F4041A385F2238E3C48B6C8EE6F5258463FDBFF7AC762F6C4363926D6 +50F004D473B7B7F73CA686B559C2885F1AA761653C727A77D73431E9D110E76A +2E55C68CD50F43997C9B2FC4710F8C8540909829E215678E63BB8363C4B8AF05 +9986102BB36580D9CA95CD216B7C321822CB41B2E0422CD077F3B55E0246FDB2 +44D5976F67296B5B0BE4B06F6E43535C21164E6C5089C3E9BA2D6B30888C57DE +49DC8D9D46C0D5EDC47ACF2C03B72DE3B69512508539019B759280BABEA12BC9 +385308A0395C4CD33182A10A5A229743379C2075D82D8BFCE4A66E1AA087A091 +8F5372684FA5037D1B92D50CD9CB4F50AD4F8EE7D51F1C9E63C721CB5B9BD011 +6F0A8DD4FDCD2B008F223A1036D90F0F3B252487DE7898F9AFBB3A9D9CD49E0C +EF4ADAD5155A98D2125ED5A3D3907F67301649519419F33CD942E8DDEAC1BDA0 +E90C431B198F646766A8FA9F8D1561B57E126EF604838C0C1966655CF31FB7EB +C8CCC434FC1C96046D38203E1791EC824A3D7AED85C029288D4608CA7668A2BE +484C99639F121845B22EEFCE0A3B808261921AA042AE19E641769E91277BEC29 +4594082CCB3058F90FAC4A700A8A827ACA00FCF574ABC8EB7DBCECD97F2B22C0 +0AA19E8739B81AF8C6F621D69B8E6F29BAE233FBA655A0AF5BDFD7F5C6B9167C +6BC7AB693D45EF2AD999F5DA3CEFA39BA48A17EE6D9F2C4DAB91AE3F0044DC3F +5D5506CE4675AA928B0092D6F173644F91295216D8BBB14CDDE0AD524A4D545C +1B5E284A3BF0396664081CFB4F186A84A0D24D61E82F4767C1E55A0642720CF3 +909FA1AB8EAB78030B59BEA067DEDBD2F1D0340E790AB2777DB18248521934A8 +BB38A58B7F633DEA4291B0D5D13E9A882C974697CC6D3B49E030C94EA29B5506 +CC29C44D01B4751B453A46A9F6BF3BF135AE87A4CE232AF57B66578310DE41E0 +2A6AC422117F1963C4D7CC306BD25A6E724E51921779F22F029733122E23E2F0 +CB340008813ABB104380C80A492B3FC6D0BB07CB8D8409E9576891EF6E5C9D08 +EB8320DFA31BAFFBD336D0C2BBC3D3B2D30368B9860768FC080D30569C7F7811 +0EBEDA2962476113625EEB555490B8CE4C5F99D74ED10F738C61854CFF8B41C6 +9402E56BE8856144A1A05D0B05F4CB7EF728B2F4F5A439F18C3B68CEFA41E59A +D8308ADC92EC1289DC84CF48D2CDEFF509A145BF945E1E00D552D329EBD2A7C4 +21D58082CC8FA790E981F4AC8EAB99950678FD3A7DA3DF13778681B208DD71A0 +7C3CBD0664B37C9EDC6B601D79A2C51FB54DAEE849F93209793849104E722D3F +52DFAF7047EEEDDFE744787A5801E4AC2C3D58EC5DDC15FCEE03990C53B0C57A +FC54F125A04C8E4A0ADAA725808C587E7DAFB9F784FA2875689979D316DC22BD +AA36B306A1ABCF907B63C6476737B746099973CAEA8C1E2C5C41F27E0F7DE8D7 +F0D942E34E92F43FE902653D4D2EBB6F3B9F7928B1550A82AF234D45D028F429 +067652BD3D391BF423AE72B9CB1E8D91E898161BE3A7849D456A861A2046711E +E934DC59442AE7D81661CE8EF727D8D7DDC0270E937E40F896AEAE6171661431 +C1025C53172F9D366834BA0054FBFD84503FBAE328B6FDEA180F8EA35B1DA937 +5CC3B8F00C206908C2FFFFA6A7AC6915D15EA44BDCF29E2BFCFD4A849535F19B +0D307C696BE8205C7D84B9C77F02EF27D911056EDBB4080E4D3ED72788666CAD +CD91B0ECE27A177DB23320A7FA9C31408B4D02D2A4B1CC6DDE1A6CAC3D8EC1EC +2226EC98E51046D1EC26FA20EE62D24747D83CF4941DCE5CCEEC0DBE387149CD +E05B19FFCAFC0D117F9A3E60DCD4C815228D98EF95EB559AD0ACC0D50FFDF714 +56C3C812EA5ADBB013BBD956A7C4CC0ED7D3E25D5C9AF5E626F18297F75D4957 +F5B0B33379114B903FE98BCF35C3FF76FEE1D9AEB711F2962276531F7380EE3F +E368720E0292A170A15C5539B1FC7BB954EE2624B504CB8C805B8D31AC38307F +0513606F09211AE64DAC447693B2A0AD15E9A64C34F5A911ECD0ABCA90E9791D +67C6BD202B0858EF96E7722305B8AC02B01AB1706CC6AE875A8DDD15EE349046 +EAA65005E7866B506EDFB7A5A2AFD5C9E9DCC821A79EE9C1EA2C7BBA32A40BC7 +CEC26DB1AC473C8C3960ACEC581B37D6569E8C8C42950BAB7930B65E1570E3F8 +9A7FA719F1DCFDA45A3BF2AAB32C9A93BA3552608A61C623DE59BCB346E87EF5 +9CF025A87803161221C5C1C6F6B3403712C76E9D755C7BD68D7F2DC03C14CDF0 +C1BBED1D648B905B4B17037B7263C1EA7A7F06FAAC4E09E08483A8D714C19861 +327CD9C32DDF850302DD6DDE24912D00C22ECDF3CDFB18FA831A41A7488EC203 +F564CFE30D506F0829A96D35A7E09C3DCD107D589B627A15B55C5D6649126BEC +60B88C55ECCBB4E680265D9EAB4CE22965D3B1AF759B01ACB0D0E6C92B6B4EFD +A81E6A648708979487FC591CF09631310D46891423F4EC159A73E30D8DD147A4 +B0EACF6D45D18CD16CEB8176F03ABCB41F2234747B9733C8FAF34AE5D43D3BA5 +0CE0FACFC9B087F84FB6C68678BC6E76022B1526D6E5B3A48EC1A110BD75F45F +1C4DC6D39F254976453F57DF873B7D635C80C42026DE020E5BAFE0DA0D54D1E1 +DC634D2621BA184347E5252F645A6A1DB7657C48124186F0E4C644077457C24D +55753C651A9A7B6349867641464B515B821349C795A645420508673B93750D0C +7A3B33EB1F09782033742AE8F3A23FC02284E6C03818FADD1731361542E3FA3E +75B8D52B668C3E18A4AE967D0FC3157083D952AFB8144D549E69EAAC51C279C5 +E5D88A0D9D53013DFFB4352A1598FF84DCDE6FA32FC377306B9B92C0F96EE149 +8CD55E7B2445B86CCA7A547FA732D52D59025129FD8C6333AC0DF4F0CFF6287E +F2036D5DBBB3B91B92F12FEBE0B61A313A4DB5A9CF0BB3DDB781A56FEBFFACCB +8CB9D1D3DBDBC4CB6AAE6769E470582403CB920630221B68BCB625CD4605FA8F +D3D5B7A1A28D15E44B38E92E906C138E72C15B86F64C38E23BF0440052A8C914 +54397F49DBED99D0AF7CEA3B0A05FF37C2D7EAE1412567E6776333237C31E3C0 +49949EC8BFD6E0F6446CE2D4DCD2C1524A288818CC5D159BF8463A847AE4A2B9 +CC8C58F822804B81B13BF4F2DEB6229C4F51F093075581791D02C36A13B855A0 +34900AA7CD4F1A797652656FE3A8425A38F421C4CC0ACA1CDD44FA6B31219276 +1CDE1CD63D6A58CE705CB56CCA1260F9B86E989019071563A9B4C274A87558CA +6EF1660D574EDA276801F0057740E2C3B80D253D697736484D892CE1AB128B8A +DECD69712F5E70E895FBAA927E8194D792A04AB6CE205E04E38A433BBB793FB4 +E8BBC4279D58A223C6673D909D6AFECD246E66A52F4CB35E5931D24C828489BD +4ECAF621A220D8ECF702BEB01C4FC7510197D3F6D15321EC87175ADBA6434ECD +2B5A306E91375CAD22CD94301763E4A8B981472890422C5488FCD523C9CB17DC +ED22FBF12D5F7525D0D6BCFE8CE85B0DFB1D6F989C267FFBA0A996D309E4A934 +3DB54A9D29C88B9D55D7300DA3D46419256C5A07A2A529A8DE8BD1727281F5FE +97033D861E0531B14E811378EC1AF1CC7EE9BA2B07D935843D3053F673979F8C +FAFD59D555B56CE338F606747238B22BD62C42BB7238FEA335678D474A643570 +A9E7B4970E8C541CE9DBC7BF70ED7BA33639D6744A18379455029E934C95E2EF +639C4848CE9A0879B51649FAB023A71782444B451F92A34CB8A124270CCF86D4 +D18EEF5C1D2B2A29012613851C49F50702D63BACF95EE2AB4D72B375E0A62615 +E0991E130A67ECBA9E05329B740708F1CB148724C3A6E5E3AEC1F88EBCA398D2 +1CA8827C977D72734310233176D1AE26C55CF2CEACA62223315C28FCF6305C7E +A22414D4739A059F552F1F9372CCCA5FED4F9AC987942848EB498900269511F3 +F408CBEA0659B954F5F1B18AE4FB270213646F9B28AE4439D2BA2D3E0AAAA780 +5E530E4EFC8A060EB979E12191044509DA0C14397AFF949E12DC970658D5EAF5 +4EA963F5BC1407A32F3837CA6A24B7F3D60EB8E6222B702E25ED903F9D21AE50 +664A095009BDEAF4B78DAF94E5A55D48366CABF07791A1684B2F54EA69070844 +4F031AF8DF416C2D3679F8BA038B0DC9DD0400CA6B34667BCBBC07E62C1668A8 +35A8C57C9048A7227E672E89681B54D662079A189A9E96A3CA96D8DD10189B04 +1DA49BA2729F1CA585B1BD5C467295285D52E47CA904235A1A3E48EFAE9EB6F6 +01374125CE89D53C276858668CF45D2F092DDCAA52418E0BB94C2B8266B4D88A +5D911507BB1DDA3D8F6E7C14A91CA11AE799EC42E993098E18CADA70BD2A1D82 +2C39326C6E3F9E84CD9758B9AE43D79BF99E6A0CD713E95B3D9B7DB90D127DE0 +DAFEBF850CAAACBD860B5DEF2082F1ADA64B44B193C4A1417BE221FDCA36456C +BE5934C8CE3ED55AE3A11697C2D682B7D0F72D48976451D205783BE25DBD2507 +39C14FFB4BB828DFD187104F38A7F11D5F0698C11E8C1D4F107CACE573FDC4B1 +C56FDAE47024D6FD16A2FEABB434CA320300FC4B6C1B6CA08F76C60B7C08A665 +99F404DBA8A2A1EB18EF6750E4EC186E31561A3F080BA6562967546715859481 +7BA782940F5C5D06626D6F6A412CA7C13820EC7C1DF23E15E5829F698CF617BE +D940523E4EE4ADECEC48C24297DBAD528BA1DCE7AC335A1D15D55415B108EFC8 +6D45030D27B3EA63B2B4CD771DBE66AE0218ABB1153D4B7482289D1313CEF184 +5C960B1E3C3C953912CC6F4521D1E15636C1545EEE457EFB87B88C9E43CC2F38 +6BC4BC96969F4FF28ABB06F4454C01CEF1B6DC538F1E832FC1666D977E5A881B +F72F1B4C7DD4BE167A5535F1163A0706F9A0B26400178DF8A128FB5EBE6A7B81 +E478AD183EC06622B591337B9F1872AAEA356F4FC67EE767B34CB5A4D90702D9 +39FB846947F4096FB3DCF16EC81455164783BA0B5D723060DAFF411B68307E81 +7BEA1D9A47A5AA3D648E618C83C60F060029E6EC4D46B045FA7415BAB2AD0AA5 +ED9C729C24136F6AF61E6409C0B5CA760B16225641E268A68CFB8260BBEAFC77 +6626EBD97195E77CAB425CFB0096D805D9EE699E41680D095AE9FA10122A7882 +2F00F495C9EB2102DF0D3E61833BC0A2E468C5CF7AB430FDB7C0BE3DF2C0D230 +1580BAA25D65F599378D873165482A1FBB224AEA89C6BCCFBDBA42AE1C5DCF41 +06969F585CD3B737D1388D6359F5468D88FCD2279BDB270F6A858FB7D2ABDEFE +5EE8FB79FA437F8F50237B92C307B73B0DCB808D07A9C3255CB9B3B17039CE5A +288103D05D132863FB522A02CEE3839EF9AF7F07D99732F0B8B384745369FB3E +7901166478F4A16076A1504C5E98D17408494E270BBF4470ED12B4332422679F +759F1D93984D7E506D16950DB6C2682FE1379EFFA6F6C95DD71F6E55BE3EF6AF +E0CB25388EEB436E6527806FC75484133F6E561DEB979D5C1FFEFDAF2A6D964E +03BAE0BD593C2992AD84569C81050F7A793C5263E50C2F50B98C4CC703EAE17A +6AEDAACE312DAFAF5278D125B6EFC5587484F61DAFF46B87B7C9B1EEDECA4859 +314A9A9E2248467DE1E54D90DD671660B9040B3E0DD982260822177EFD757266 +74A16C83A7FB168016A320D3DF3BD7726F1F4EC90EE5DFE810C96B099FD4368D +906AE4699049EFD37E8EF058D4B97BF71106445AADD4FC6E90615A0066823A36 +673B8DE32322BBE861AE251226B4385AB28702831270DBD25D666FBB0AD7B96E +A44E891EA1EAF0F87013AFC982E33D67A28E96E0C9CB99B9E4192536830D9901 +931A8CAFA41289633B20BA3BD7AA3414B6DA8D57CCF2FBE39920CC06361F075B +CC40335DB9A0071CFF77F6B7BB47F3100DBDC9C4A58C2B81EC99E8E966AF3390 +E3FBCC28BA1D79961C8A1584266454DF772FBA99664D74D4A89FC82FFEDFCFE1 +4C9E4A04291E803D142E37E7ACA66AB279378F2F192FFB2B5BBAD18B95F03136 +2CB594A3D6D3F8576B90A6C4DAD6D6C8EE07AF682F925F01D0B26CBA347C03BE +F3B0585CF4539FDC66915E22117078CC94D621F31DCB3E021998A5D6EE94CA4B +E214D07517283D56973D8E4367392BF6C1150DEBF459D141AE0941C1C8C5CFBE +E735D796E365A1B0F60BB4CF2801EAFE4889EE5F338D3C4885368281B3C95CCE +251C28A90D318A8A0384439B38D63B94757252062EA44E88509FDD2E75FAAB71 +7329622828B2785C1A8B26351BC74237A6BF99216652ACBD4CCF54CFC8AC72A6 +46342F1E32D4318E7E27C7B2DAC943B3E72C472FC6F1DDA8684AA922516A672C +E969C047E318B5E3B1270C1BEB1C4071A15BC81B29B268C679B41FC5E381BE33 +DD95F0D68118CBB60C521E5CB2BA46A10E50E9238163713290DF6DD8A27D3813 +F871C07E725D4518013D9A84CEC96782541E5580E33C2EBCDB18F08EB4655A46 +507A8526DB26C854928B81FD502B0CCE4A68943C12078F57C10F4E85FBEE1025 +46D925B8B3B447D4920410FEEB9844FABE985F9228FDD9F58392F2F3BD650E49 +2E3AD5A14984874DF4572816931885CE8A448EC95BBF40DDF4F85653AD90A88C +C4A879C0C7596E61997B972E8A55E57B17F802C738E5C7A8FBF6424F8B131B23 +CEE3EA3747DB066246C250EAD335A76FA166ABF75120CECB59076AB31A51F176 +57176CBE8C802A97B0542A5CFD6D5E6D7EC848B923012E45D9F065BFFA0D03E6 +788B68BA4DE51DA37994948F859D41C28BA939C3A82BFDB44DA585AE80B8CD7B +A6EEA79B70BFB4864E06F06A9751BD2D2A209D150D7135E0A25D67263EDD2A7C +C63B5B76ADB05D44BD5BC0BB3EBCE2E74E1AE5F7DE07A59D90C932DAA2553505 +27F2AFC05F7CEB39E1C7E54F69FB0BBB069959F2FBD11709F8E81F6E7CA06DBA +1CBDD8E7A78487462596DA288B50B295E46F4C3D9BA862688C68859734B232A7 +4B371D2BD786924F186524765E789EEAA30B20C069322D42C893A30BF1BD2C46 +F8F3732DDFE80B8FC1789239345944D8B457824FD80D11184E73FBA30EB80A9F +2FD466826D4E666E3A835B98A1D4AE5D17053A6A648E26E77BD08F9A3E02956A +AE82C4929E9666F539079846527D0E326FE7CBBF86E3722BA3E53F8A5121080B +ACF8D3C67A2A1DF624B9DB92105D3C833F5A6ECEC108E799E71AEE8C115164BD +9BF92B1A79C9C70903BFF007CC14BCD053321843A4D058E2997B621F6D78BE4E +2682767FE6AD453E8ECC7BB9128F40DFF158579F19F59A963E9F90F4A8468537 +7B43F208A3F331903E4BDBDB55B109F616080F5B72839133DD440ED164014190 +3EA0A2D9E4025F3673F451FC750AAE00426378A087703DE8A0E2FBE65E92CE53 +46A620A86D567625828869A313F460F2E492F43AC008D10AF2F16800C9F1CBB3 +722F9B09D7ACB46721B595A0300114C181668B6A52D6B793134CFDF4212FB8E2 +A9BA73827B455306723580D78094F93E5F296D142117EEE0C10678108F4F201D +73950AE7712630C5BB9BA339A01EE6FE3D10904389F167F40EED0DF7959BF59B +948CFCF59A38CE6C5A7E6D491CE524EA4DD55089935E739FF03071940B30F2DB +B3874138C7E049944756032C37929FA9FFCB6006ED7AF9A8C96E60D29CD6DAFD +9B6F938D17831150AF6D6D3A40713EC3DDD0DC4557F8CFE64D26745BCAFBD0C0 +F9B3F1DC61A8CC3FBCBA67499ABF7E95F1001371EEB6651E9F45968877E634A6 +9E2B4C05B2CA456F20DD647958F52B9B406E2567A1D3A0AF7BCC25BF3D33FC3F +C7BEC229B2E699C20376B5296C96C5E194DBB1E00F77A0253298FDEA99D4352D +E559933C8B4ED15B273993890FF3DB8C80AA5F6007F183998A578C4859B55B03 +65B017BB3E6B594FEA136F2ED0C8DD4EB6E2597094ED95BA1308E9DE0647F24B +0F0A87E0F22F9EEC3DEACB74E93BF7EAF14ED4DE5B88CF2EFA478EA7CA1847CF +497E30DFCE442FA25A3A674D43404E33F99839FFECEC5B7AD60F1A573995A4CF +218F57FF4AC6601ABBDAF4707BF49397EF9C301A8ED2DB8CAE6D0DBB24CC5D31 +2E8E0B4078AC0085957A5F57F992A6073460C5355C998F53F2A4D4593C535621 +4C59D7E977F91D61A3392B13C2BA2A28A23141A31141F5E1FE73400DF0CAFE3A +EB04A693DE5A28210BA19F0DEDF5E8957945A8BE6A436751B69886F139FC1828 +D74E086DE213D49CFA852B7D0B0AAD7AAC498D74594AE3ACB0EC78FCCFC4357B +CA2054BA1990BB8A95AAACC7B0179AB6FCF66FF8F4B560485BCC17D48545747C +63BB45E069C587FA522B7405C50031799FD9C1D86BA33951E3AD80EDDA7B0A93 +01DCF2CA8CEC95864961669C3B1CC47CA8EDB586F8C5DD092FA0584834FF5913 +302D8ED2AD60CB6E88D97422650FBDC39FE0CA0772310DB9B2DD514EEDC7E235 +C3DD55C62FA36A90BF4015CCEA5FE4C0CF761E921D7D2992EB24625547D23BCC +A0DA11EA6E1A14EBB1BB30F36D56D948E3FB6C1D1FF75D3E3CF3595D95F0A44A +A3747B7A4C965C165EB05C81BE2AD99D3E58E89EE14AC26D52841057DFD6FB1A +35F283AAB29CCA2414C2B1A6AFD6F7301B381FA9B54CC419DC57912E4D27C343 +7A0DDFF3B037CC8796FB9DBBA8CDF199084C895B984EBB5645D17550DAE95FE4 +5E549750B3C821BABDB24AAD669BB39A194929273A670EC44A26C32A540E5722 +FAEF86223FAFEB151DCD5254465FD8F4D8AD1B2FEB5648089AEAB6571FB372D5 +5A5B940DE41773D7D4EBEBAD23AC30CF20D85873906EE60DD2BA25DC16C3377A +4DAE8348ADA3E2B926D585A021718C7C723CF5B9CFABBCB2EEF5936C97F8E385 +04F42864A28D9360412D0CDC28C619649FAF3BC7D37097EE1C0FC0EF8E45BE65 +9B4A4A6CCD7D87EFC1E935772C95266A07DF0CB05C0AAC0D6FD8C6BEE3D78020 +3136B379786FDA4E0AFFE56A55E18E0B8D3BA0A6F277009F6952BC47860BE798 +E821B0F5C040FACBFAB084E61F6157B02EFE0D82006C0F178E5840C74F31670E +47568AE1071CCA58660CE3DC79F49A0726D78C6E2E6F172BF654FC41B14FA90C +34D2B74537CA958FCEDFA4310F73E63E16CE1A8D75C3A85CAB5CBB66B4656EB9 +A0770C242394CD61F371B3FAE0E757B49F463D16AE2FAAB168FF8DD6EC74958A +5A0B4916B28308AD5AFA651359E253BA9D986A996D52A1564D831DC3162DFBA7 +395913C4322A80D31B46471F2E852AAAAC41F4942C3D571ED736544886B06FED +227A1E2FE3B898C4D33378ACB8ED7DE1B2B4E9424B9B9B156B1E15A51DA98B08 +113218FE22F8F800496E3CF64DB58F1224A3AFF3B32337BEBE551683600FB812 +6CD9C5BEDB81E06F077F1F30A2A335C957B22C17EACCECA256F6E83B7C624BB8 +B2DEADDD475CAF795663765031E331E89418AA83B56B99949ECB190D3C1747A6 +19CC51EE8DF03A30F6717B655E63B314A7E978ED7D3E2B4768034D147202B233 +E3C4634AEA50366D6F6B5F29F9CFEA2C3E3EC8D8BABAD5A79DC1726F848A5091 +038C16D5686027466C2FCC910A77101C59F62AEB10B1B6ECF924FC6E077DC85C +01A554C85D523D3A9FB1ACA0EC3F0D0EC12FAACB45CD55B46A180EF473DF109C +6F558AD2B4F9BD9B819D846330B9FD93FBBDDF215D648EA6757D9A16E8818625 +8E820518C7A93A33292AA8EB7A2D20E3F2D3EF075DF53BFBEEB2EEB9B0839753 +E41BDD52A8C7379CAFC3650BFA2C6B470701C381E3C1DCD553857E99E01913AE +B2F604100E661710575854E6ADBA1EBAF6F43CE0296684D085AF413679D11F87 +61EE702F6EA2412A40F4BA7CDB3C5A87390B74A53925639BEF4B041A72D72034 +630C6EF706F76654D15514149DDED52A5739F2FD1D391E43EEBDB9165741F37D +0086ED284F5BA9A35A956C42A91B892540BA5E7D1EBB5DAE8D637E9AFD84A6D0 +B02562D31213A88DAF27A226845DA6DCF3C2CEB5DAD4E1C070A02F9A0BD9CC4C +3BCBB95035F359764DD3F3EE7AD19B7596A6052549DEEB43FDD45B126F63D7D9 +01425C1B2F29BCBE8C4C38735473D24A9130DC72F01D2E0D1B6FE557B366BC9D +27036A0AA9AE19D788FDC3B881E8D9E394B77D8A78E53CE3578549E543259A7E +6179D3B01FB628A989A9AA2D81145A363678005D70532852C47336ED4BF55DFB +5A8F1095C41EBC7312B22701D077EE871EEBEF6887C6010A80A0FF26206E3C53 +9A605C5D477581D55988A024A26839AD10549B3BB7D7D4D90EA386F3742EEBD3 +B833095C9C2C4D08ADB06703E2A55D2FD5283C16AF4B707450A0E972B78EC852 +CA2C81A83134380D705BAB53E1B1820C8C910EADC5B34B979A71F4B8305FB448 +5EA4C7E597B28CB25BA410DCA82B204C1FD2638ADBDEE8383720541869CEA61D +0AD84E3911594ED6E13A3B77DA3644870E8D74FECB21C136671E774C0C8666ED +59B782AA6617711050112F851F21B7A3BE83F6D86151E99FD388D8CF9C6990BC +F913FF8056EEAD9712D215416383B76F99028669D0A3CA6520A470DC659CAF13 +59A9543EBB50DB5AB42994B1D99EF3BCC745BF8D5EA32B9FEE02E756C36E99EB +9A5ECF07113B4D00253CDF8113F7CECC3933D1AF4B012E93FB8232F205B8EC44 +B1EE76C430774F4C534348537A608057A25BE6D308F1A56EBEDCFFEE2475187D +84B8CC318643F21230EBC751A5FDE624D108B8416523C3483A623D0C5B7FAE90 +7F4BE4E7725BA4FAD400A7B6CCCDA64AA8FB2537E30EA714B955D2135D1D7158 +25702E47BC189EDBE013B9EC8443B623F1E99326087886F0F0EC2E96D9F3DF2C +51E4CBC28B09D6A16503152E86CB74E816741754BF05DB7FD0843D0A55359E23 +D74624057AC393F09AA028AAA6FCBB7B997C4288AA1C8CDAA21757FAB963EFF9 +BD9CA73F2AC784AC05485D96CA5B9B2CD91ADCBCE70776ABAFDE2E6773C2C3A9 +53264DD8B2B9D7432A1C49E40374611FF00AD15A6354090326C7292316AB21EB +54B877201BC8B6AE43C6E6422C5C5EB2B6750954489A2CDF287AA906280C9096 +C595FFF3DA9644FF0DC15D8B8BD6BA71B85DDAE5B2DF9B334B608D765F60C86B +69B8FC144965C93735FAD3715F50DB7509D29BBA904F3AE26AB537FDCCA69BFD +FD08CB7DD033A8730EBA7B4BC4AC71A93E3CE16A885D07B25B7B1EBF67C040CF +5179E2D01D6984F8B2F380539DC364476FF93844078AEB61E01063025253C2DF +FDD72E3DFCC5B9A5557B1E023D55BBF238E22090A51F67B58CC1266A98B0FC14 +414F61D414F0980CA049B7BC10FADCC452B42E0FCD00EB85F17349842DD0635B +4A35B69D8CB6B6B0327822A17BC97169B030F1FF79CE6FC78F990C05D55B3903 +A613D57399B3A3D21FC2798E520BF7CA4DE6104A1A4D3E36A252CBC1146259C3 +B0F72198CB0F71D358DDC84DEEAA841BA66BA90FDB08AE0F50749E629C8254A3 +56B61A40D07906F44A36225FA99B2832F8EB8F7503A26DDE3719727AF026C26C +E95756FD4B39F7C76AFC12B809DCB19B855A974257F07649A7F0258639480609 +A902A44FB03B76DFC52CE483D29021B78486ED6CB67C5F377AB3746CF83168EC +80AFBD375553A4C961DBB3C5EE2364926C0B1D80A0D48BE5C3635E2D6F86DEC6 +B1FFFA6F31F9C709F414A2A651F0B4C33E5F7D5966143418D938AFAEA39E0396 +556C7B98C7186D5E72670D87247C399F46C737710EC2246C2678DF15A9DCACAE +EA4A9B3677A140F61BAF86BE97F8129ADE24645C7392AEFB2982FFC2D42D01A8 +951254831ADD179B406407C8BD4BEA9F3ABAAE3472D6E8D941141E4DFDC94508 +B5A2F9717A06C6E31638FED467387BDFAC6DB468CE69ED6DB61D25C9DB2FDCA3 +BDED1F3141718A830213395A2C137DE4C0BA4D7BB4F09384D29B5F195D8D53D7 +88B37D3DB950349036DC16C14DC9F17C43828C916B983712D0A580D4E32A2B74 +56D4AF6EAF36EA21829391AE330631885DB8D0B72A0251430D9C120EA1D0FAFF +6200ED8CBAC416EB1E2CBE8B1B3A293F5E162A723EF096EECC961C22E4632784 +9FD4883EAB53385BC485149AA5D86F1F4C3E92FC9E9F56DEA46961654B17CB78 +C4360DB743A47BDB14BBE347AF46085405C754AD49BB1147C4D12BD0DDDFB684 +C574A7DC07BFB9D2BEEE2B18CA243CC3E8AB71DA492C7BECC2678ABB972C108F +892C852E61A724883A97D00E46454F171F7EFC4E6A4EB8DB3097C3BF1E4A1DEB +D7A5C006FEA293E055991451EB9EBFBFC143EC7F77DD064411D8F3A0B71AF39A +60F4742610B6403982BE2A553D70B02DA2F4982778591E6DFA1DA550B8E6EA58 +9D03784FCEAC3B7C5B2341FC09676827909B4907866CD40FA5E8EC7AC4C7EA03 +6A64D1311105112AE10C41671EC160DF27F2800EBDCDC76729DB05763FE422AF +3C60CF401EAEA1EAB523542F923DB744DC30DD989030E92BD7D4D057077C9093 +0CB2005ABA938882F64CC87332CF5E29C24E89CF720E6852C77C5B76B03E578A +BE923B6537DC733CCC157B8E9AEF575A185C54A9C5F3233F9AE277233CEE6674 +E9CC65A71A1AE5A9243D731D09097479B1DB0F76CDA9EBA4F8FA41E8270E6D19 +5BEA94BE0872408E6DD461AAE62BB630EB329F9CFC05D77C0D1D0F013678CA1D +4A3B6343F07E5DA453EECE7208EE6F20865276D545D21ED3795248A3E7763959 +15E96AF19750B6E46F335AD1AA0C8A25EEFE4227FA0D6A862708169A66BF8B60 +093707E572276AAE0A4B270E83269638D85011BEDB42E1C84AB5A059B17414BD +91A7C9991DEED9F2B966293AD345B2EEE43D2BAC0DE6C506BB16D033915C8409 +D1FBFCB24563807639FCBB98FEA16B1389393A028F793888DD5E328E92BF06E9 +D19632115FE0378EE2A5A6051DA47081C16F14BCFD4C156CBE2845A2D7F970EB +6F09DF06CA8160A280C7D4618CE46A7B74A0C7B974CF03CB78D61BCDFB43D293 +4C9A130C5D019A871EF1BC1FCFE8BF74C1AD74B35DD901096C21298A1B8035A9 +9FEECE727BE4DAAFB1ED148E1B489FBCD7ADB3F09A54ED7B1B5648017503DD1D +5F85ACF9AD6DABD53F72995FAFBC16AF1CA1AA4C755C1DC64082088BDC35E975 +EDB86D7B380B42B37327E6A0F13A87D5797B553238AB82D2FB78898062F8D9FA +24AFA6516894E0C358037742830D43D777E6E70657D9C4AF09D4670D22B67ED1 +77A5402F41D41F504B738AF2410E7FFF42942B72D283AD1C73132AE54F941DF0 +053BCB8A0BE0F154266517AF88A3B27F1250D1A89A9CCDE7A0A9226756A46A42 +C903A0B6CD6AD54065B7832AD9405C3F63E073C21AE702D0836EB448C5CB2B8E +5FF61573EFD0AB44A98A1BB774C94DCCD28125B486A0615038D738F165E4A0EC +FE68CA300A4E0A60ACDAF9CEC258194C3E4EF1AE84EEBB5189C7EFC93E6CD52D +89FD9DF13B12D63A9F4B7199E845B809F2ED78ADED66B0901FC0FE41DE7B121F +FFE81CF02E2D6C9427F60E6610A9254C4273997C4E03B4C8C79BABDAA037C321 +45260C6E302F5E07A926D93ACA5765853C80063553C04F026BCC0C2693B6C397 +EDEF3E44B316BED779E87564FF0B1C08CE709196CD532611245E4BB1DBBBADED +7F7CDB800DA1C4306AC7FC6A272B2A68C52F9CE903F9FF94998ACE0E17E49621 +5AAA85BBCD7CAB507AFEEEE714BBDB8DCE627A708D521BCDEEB51086A7FAB01A +346233863166B41180D9A1A2EA6060E8C43740126B84565B99832D8FA2A7C8FF +8472E555268D36641DEE11D56C7E28B76E66458CA9E1477C76A3C1D7678399C8 +FD3BC9A57413423E4A120DE5EDEF7F6A91A1028E461C70E5FE2AB582D2877CA4 +33141945D12E9A56C83639EC8095F0C4C3DE5B092FC3C1DC14D7DCB4265D6332 +477F40B046E0497B16FF63EAD1CB182A65630FE68494A978DD7D035EAF1EBACA +790EBA434E902B5F750783065D838F0DDFDD675E9313FC3C1D01F325DE96EA65 +BB340E621CCF997DED0F9AFBF55F79301756262BD67525640E89F2B2114E3082 +B03BBD94AF9D3DB8F8A11884BE81B0001D0DE5936E270E3B2D4EF17B46BD9614 +6B4A31FE6AF9B86C83E52F719EE21251D9A23C91B9255F66642F310CA9C7875D +1991573AF6CED04F3A8C0B3B60445C90307605B455FDBEF0AA8ACBE47AFFB02B +B5FC3049E13997D4EE486941D98BAF27E0C6FAD0D653970EAF1BCFD1682BA70B +E4BFB30E441DDA779F22FD158EB4232F2E26B1A3EC4E2DEBFE6D0B70D54700AF +ECCDBC7606AC3F74194517A4C703AAE078B385A2222275102ECADE52C0FFEA46 +5487913FF91971B4073C3E889692661CC17B9B45B01E9BD8429B46349A0F819E +781FC4D43F165395E86DF551586DCFD5546A189443B3D7A4C81FDC62863DEACB +4F663EA1DAEDD9B20790FC279435C60875F064D5A0C5FB4820157814A292A244 +6986F05998F6C21E840533C618EF9DFD9B6E5EDAF4CE7CE892423CA613428894 +6133BA0A2FA1A5478E5F79C05A4B27A718B1950493CE7AED578414EFF1231169 +73F145A5393FD5E1102C0948BEAE6481922DB71C2C359CA1B52327752118988F +7B2FFB41C4992C8C1F0697BD304689C76E75C0ED0022FAD9C2D01A1E76F9D93C +858926BEF9EE3BAE42815C74C9D499651E11601E531586717ABF4B0B78C594B7 +BFA90E23C7B02DE297C6E93BFBED86507DA3B4EC53B9C8A5168FEEC4829B8465 +23CD69D11E298BEAFC061A8E8F57B97971F162FC98E01E7F16DD99CFC7D15567 +78C6AB502D86FA309CAB9C0CA44BA29D993A43E3987FBA1720DBEA68DA047363 +7D6371BF6EE2AD36E969876533ECE6C9A7CEA474FA91FC7FFD555C02F7113320 +A1614D6348E1DCAD3D9A75E0D21CDA9754F6DE9216D82A9918AE05BD0625A40E +2358DE45673287BA6C0E24A3B5B89FDAB961ABE89A50D852AEEB0623A9EDB32E +0D19BE36A3A90FF90113CCFAF3C972C320891B10EBAFDC7448FBCDDBCF2E230C +2F8E2426EDCB07E7D218E9E5A4A854816614F11AF346B2A8DAB6AD8C5A7A849F +7A940271A976F0AF6125EF8305A3EEE2D6F2739D4551945C0860F5FDE94A1E46 +26A6F6AA6FB05C816BF605ECB0FEDDA636EBA95E5F344757182C8D5ACFF4204B +2F7D7D0CE8635F739C85C410942D50CDD3C9CD1030396C912636B70E3BA39062 +14F6C9E5FEFDBBA73DE2A21C85DB82EE90E122184F22D1F3A81774ED2EFCB0E1 +72F9EC922DB5902D461372987CEEB3875928C3250C5F104FE13C0832CF67B259 +F0896D97FEE2111C16ADA1F622B8D1A8755EC290DE5DB5F1BE55636D25FF8523 +29B4DA88FFB239A3BB92BFB3ABA7ADFF01B96295968877CBCEE6BEE6B355BB8F +5299F58D8B8195B14C83049EA20F2159D440F76FF16243899FB69211F134479F +57857F7A37BBADA63B05B538099B169EFCA1C24A2D28804069F1EB43ECEFA53F +6F3A646754C41B4A44D7FB9269E56DCA46AB8D833D8BB304A0ABAFE243A2E0D3 +27FD8F7D11A6CB2FA606E64A97619FFB70FBBCCE49F6FCE1345D92D4FBE21407 +23898445CFABF0BA9C17CB2D5923B8B108CD85C5CC1B01E08E860D336D536F7C +3A6DE5B8266A775A675FBF7987E0A0903489ABB6B2EB9F39ADA946E608CD716D +A35A4DB4280E12381F096DB8084E67C219A1F41261A3D8F55893CA71464B0C5E +11352E6DE02B664DC30C9D1D61B9DD1F18CB18E61B5D6D3C68654E73C1BB498C +F92780F1BAEFBADF83CD2A91087CA9FBF6F0E44F31F591104710D97FC73B7267 +8A9F985568BC21FDF2D4F2D57A0B7C5B853E433ABE825A8E00C67CB0F0D7F17F +9CB1AECA96FCDDE3E2F0B97AE0FA250977603BF38AF592EF8B16BB8290837DB6 +946B54DEC349770E002E3ED37C44788FAEE6CA39BD9F92705D877839D9D439F7 +D562A46B6E4734169C54176EF3739905134B5D9750B282B761FC078D88F15F44 +3C53032FF57F7E138D9BFE259EF385B3316230D5B5633DD6C86E6499B1D8407A +E515624186DE334BD2CEC1C59427F532D40EB0EB6973E8BAE1F9EF281D560EBB +ED94C2299915C9D44CB4B96345FD76FB5949D92C523EB661EF864A69A75B901C +C181BF63DB5D9FAAC0DE34D591940B910F30ED16765C615BA38C0541FF14BDBC +4F45802A546622763F907B14C6D4DA15FD57260A31644FA09C3F5F7472F81BFB +2E28C3AE2B2376E121B628450765F5BC503ABC13FE9AE7D51AE2E4DF3FA9BC65 +A820E9C157B4DD3CD03B442E26EF760E90885214BE5B82B85F3F15F919B6826A +1A62243D2B80908C219E8B909B242B0D13AAC8CAB165AF71D08053D3F21F90A4 +6E1E4B205481D7855F5D795FC92585BE40B8ACA0413F8E8C3023D538159D717A +93D5578AFACD5DF58CF3B774C01FE2B34F54A5859E21623CCA18D148503D9CBF +43CE0C6BF2755E00D2CCC9C0A26CFA90D062AF370A4B38D15F41504511EE85E3 +05BB5CD0D625A9516A315F3C9EC7305A64F6FEE415C3924006B6C8DC51E8360F +C050E99639B55E0BCCE07CCF4C82B3C93AEBA793E3425035BBA5FDBEBAA0D1D3 +BEB37D764A36F0CC0FFC1D95971178DCDA291D51E38B8D9BD6B4CE07CCBFC89B +6F01AA5705A0DB8C8DFB090E72A4AD1D6809E5E5A3A3D5D1025569B067BCD9BF +E771635D08C7ADB9F79F7A2D6678C5048808436AC71FFB7B56A53B744EB51334 +C629C17CC49B84791CA976E4A341F528D9E1F1873429B6FF068648297ABD7D61 +0515D504868C582D465FE606B3E23E1D7E3B5D7612A8D62B62B1BDBB2FA2C97E +49DA1918E4D3ABCABB3A7AF1A146BF75C6E15B170948F1120040D7BF42ED7F66 +F46B01D2E2234C6E94FDA904428AAE9DF2BCD90EDEF271DCC2013F85383E8F6F +F0710EE9F041FD75125971EC7A9B2CAD4ADCFBC2D6E3FBE028D514C87AC809AE +CC2AF28C17D6663F8A3D1987B969652CADE245368F45480F3874304CA6BBD1CE +D270C7769C6045AF9670547C6C50B42DAC773686C516CBDB7590C36C8D9120B8 +4A746BDD11207D785A37E89C2664F508397A55D569D53207715A3B5B4F61C561 +2E02CBE86A393BB350CADC225BE8AEB878DB615E1C952A464D476FA980B0930A +0FE713042CE23D51BE26B59038BDB9DA316C575D1EBAF114225B935327325FFC +3E2400439EBDC816D70DFEBC114C6E3E301169279247344E9C9A9F25146A2B1B +97A3C77BD42C1FE4A3354E60B07DF71AFCC4176D784FBFD0080FF3B72BFAC219 +49877ABB2A42AEAAE3E800048C011B3EAA52A40A03FDA3D2B733CD1D856DDBFC +3A75ED563230D78F1AEAEF4BA28B6FAB15D23BFA3952B57E332E01B4CA5EFF1F +69CE8B1D9976F05F00F52B3921E48CBD1046054600250558D2F0E29554FBCAE0 +AA4C7D111A4D0C91562F9FA9C2BEDC81B19921A51A58D9C0B2E396592E6DF41B +AE8878552AE5291DDF655F68F83FED79169C7AB8493FE37E65F4AC20B70E02E4 +9C1517A1BE6D18ED2FD4D89464E8905CA668E4A46AEFABCA9D740D9FDD40EA0E +42F61057E4BED660DF567335DE89AFF1EA8E26B579FA047D48011125339D30BB +E3E8D221925BEFBA4B6A3CBE711647B9E782B41AC39AB898893777C7661BA269 +A28DF5AE4014CE550625FFCBC7F0E5F41B096AC4208DCB288E6214E381EA7173 +45EC0408CE52B9464274415774DBA549B59C472E7E9F853973CC3274F35AC5C6 +048D5F517C60C66E628A9B0EA9AF81B6619CAF9FAD608BC13733A48F8F61153F +56311459144F43F753CD7FD97F97AC4F6D0C07CC4EA11B5AF1973A5909FA59B0 +2EFE434751222D9ADED186301FEECBE8CB768E36042D595897341A646DE2FE7A +F3814D7F57E7CD02C34D1C701C038598BA3E6C298A67CFEA5851DC4D9D8717B0 +E6CE64D025A0FA9505D9A09C8F7C1BBCA0C2D41C6C27B99C062B4C0F956468AE +3399054FC1D16317082D8FD4F81AAE0A67AD1E83F82820A8B472981AE085E8DF +1654030EDEC3BEAE56BA4893E251D1930A065815517491A13773A6052C167FFA +A56EA98B18A8B34B56142E12D22C529BE7C05FD40366FCF664FD1EE63274E890 +1BB5CE671C5814D4EC6AB5482019ED0F1FD2569ABD0EA7A3BA04C000A3C2844D +F8543EBD799152EC375EF37B5D9A724B0FC9CC8BBFF30B57CBEBE1DE7419A73E +19A4A7E61F818A1B4F4878959F410721EDE075BB8E3EDA4556247FC148F27863 +E9B5543A12BAD1A8738A5B86AC7881E7EFC880E5D3D82D471AC114E29FD97B1A +9AC82C5DAE2DDB65BDA6A6F3CEB87DC0E9F1BF7FE486D695A677B5F6BB90F606 +73EA674487F466AE16823DCC9336373D4A938839F86ADD5F3F78622D2BE5B788 +F79D20F4161738A8B9CE1BFD592DF857BDBB049DC089B220F5F8769158692246 +F16E2F21262402D4F902FDBDA70A62031FB20546889B88254B5504022E002316 +1824C9F3D6882E3E909D2E9F261F542B164CCF16C556C958757E6D963C1765F3 +31B9E020634B1037730BDDA7D1B9860D4A942FD4891917514FD5C7D0C8E1545B +837B3A806A8EF1243D479C737A771CD92532B6A65C944EACE25E2512E3661752 +77F3C3E41ADC8F37A62785F5706EFA4E969E536CB04A04D82D12673BDD42F2E6 +6AAA8E40FBCB25AB6905244DC429F6AD8989B7DA61440728177BFEA7FCBB0FA1 +5CB2398A937CB5E7E6FED132AC239FA42447BB7F3CE9C717452155E13EF1EB8E +537AF27EB811F82BB4B2C9108EA26F89DEAC0F814F3DB10C7142327154FEC4E8 +D2F24B2BC7915E911CD64D902FFC96C399392E895E41820E380236D21649EEE1 +10229CF719F73CB88EF92E285D892CBA16EF9A1A719B84D6487C5B8DD79B8ED4 +13212DC011A52BF68363E0A18687395D608078A1D93D9B7A924A5D4F69C7A82D +8230A924B995567080F8B071CB4CAD1CDE1C5BACF0F601D0D8EEEB0D9A3CBDDC +AFD2C3133387B85C3FD66C88017F98364286E40DA0031703C831F950FAC419C0 +05014CE85272F4451B1C12BF914497F7A6CC627339D20459BFDCBA424A818DE3 +F208B830B3E3845FA1B853F697FCD35367B0565108857250067EB5FB1F2CDA20 +32031754760C01A3F0B7FA898E26BD89BB93B5B6616AD42826C183E05717F824 +D2F440717E2DE1382C22247CD9372793956D39C5C8A97749E9CBC7828C9A0BBD +D387B2D16984D9E7BE93D8C583B17C4CE76A2014573EC04E11AC15EE2F194A5E +7D9F9F42C7FCCD904608060AFB3F05AFB9F8980A40241C7ACCD0FDE7F6163C56 +0BE674B8F745D14E92DF5E62DA378F435FBD15038056C844598B612A6110057F +12D5F0BE180C52D99D9BE85644027B50DF95864E944D85DFCD736AF24D9F4744 +A891548A49360BA969DB175021C248FB3B75B39B93FC2A2367FE341F1229C74F +8A5D3465DA49468E7995D4E7A38159376F49E993589C07CEB3B26A0F1A55E639 +6838AFDB8A1CF5486E7529064BE8F019909909560FB97B7A3299433FEBBB7D35 +3F2941562100A7B138992F5FB5A2CDEA494074D3846A38BCB61B03E6DE12D302 +FEA8ED57D4E6C961C364C293BF6E817DC4327CAC9AFC8E393686DFCB5E7967A2 +B87ABC86F0DD252F519B7C2B191D7A676224BE8A8EBAA99F25A957F934FAC796 +D9354EE47E5538BAC06097C15A6A43B03FE2ADDBFB1825866461601C2379DF18 +8923571E3A2B4ABD12189B5F10A6B717273F87752F2DA384D04CF32E3CA37C0A +3C690750CE8569647E59129EA370520530F635C971411B9007AB97E5203B88EF +4F5CCF8361B8F29AF81D3A2A21E3881E71B74E6222C1993CF13B38F9316CA8A0 +D550B0DDA76139B11C7C5B0CD821803B7C4EC8AA215F6871762CB58143266F22 +00428E93DB8C793644192CFA033CCA010841DD1B4A60F59147A94822528B780E +7B9BB9D81249DE03171F1156DD6ED1D5A9083F24BC566D722290789EEE14B3B3 +65111CA594B0F9A5924926D2AF8D3447CDE13EC349DFF3ADFDE37CC5A877ADE1 +36D98F98CCDABDC3A2ADD0DE6746CA36B00A4C6DDF72BFAE666F3F5F6B50FC69 +4F3C9CE40724AE4FBB5151AD0997672044859F898AAE72824728E600F573FE8D +2A70E7D7EDA97415B118083DA4C5AE214F11152F6AE7D125F3E49C0FA81D831D +F522B3E87528033757875663CF7824B4A733A331F1AE191ADFF9F5DB0F3E916F +70D98B17B1CC5F69CA515D5BBA0BBE2CCB628A8F291C36998C660E6E0A127F02 +09A33F46A492CFCCED2A16E36D08416F7C921311F5B5858EFC70C9BEF9888741 +1949681DB75300B52F1ED0FBA8A7389A7DBC45F05762B1611B2588F6CB1CDFDD +332BDF82576C2B79C968BD7EE623DD7CA10F29A92CA3FE477B8AC29A45D36D14 +705CC055373423037B5F09EFF22A9267275A2310D8567B58BFF4AABBE7F7A936 +EA4053D3102B3DBA08C9D40AA0F343A0988102F5F0D63817962AE461547E453C +C7C27C6601C7456F5DC36F50A590631265EF717F5CF208EF8AE295BE7FD4647F +AB248F379B5AC116581F2F2E403CA4BEEC375EFCF55E4F163ACF767221157F3D +05EE9FD48B62896345FDF6F73B7272D8CF5D838F519739BE3029B53074DB52E1 +EDF2AB8DBDC57E8BFDAD5BE05D71BC9A549E9F6B709C0B600DC067A46B4E4B9F +2B469F7F02B076543ABB62B3C3FFA17C2B9BAC3DDDB6518CC09573ABB44F75C1 +C47E1B2CEF147BB6C53E1BFB0D81E640D7B273A6F7EEB94A7F9D1A7C4F6B4230 +CC4F32EEFA01158B38EC9F0B780C2988ADD958DD4A09FA464B504E6D695014E5 +40AA0B229CA181CF85F5D359E975D9F70532435E78249A53DEEF3162452E365E +A67F28CD8CF43773ED565C602D4BFE68781CB64F259C1F050ED4782FF177CECF +2E468687FB5D24BA20B45EE0A039E7ADC6C817A9817231B7B07566E7E8BF7590 +9EE7CFF8A01B79E20278D3784E88A532F591C5B695C2CBA7B984A90F6899DF9E +F156BAF11801078E8D0AB507B4377A6FBF17F39FD799C28D248FD501E1A752C6 +343B6C5ECB196639E04EF7874BE87F7683CF5334D8450BA6AB29A951624D341B +39B3560749C162669320AF38FD7BBA155BB3CD25F371737405DC3A41440AFF96 +CD47351BA7055FCAADB5A7A66796AC5B92E5C04A85557D739481458ED41FB117 +8FDC878097AA53AF9930B2808A3D781F7D73CF319A964E93B01B74AD845B71E6 +99453B8776C52AFC1A4150D05C9D3AFE6E1691D205E6353E87834F87069CC0AB +777B6A4B998214197E705BBB7528B75F47AC21F1FD2B957B43AE6DE375B54122 +1E92F5641B9CC1A1324A3F4202E9DD47C2151196E3422408601C31DDE39C9F89 +525C88BFAC73B04010D1EB1E23F59BB3714ACEE442DF02375C2A353BE8EC0538 +94185D1D265828C77AA7C65B0A6FAFCD18EB18BBB1C148C249268D23DAEDCC33 +1933ECB0F94F73008C977E808AA90028996DE250FF90674D710F4784BC4940C2 +FA8F749089D19332E42FF972CCF94AAA534DF2A727D42B20A0D7263990A36257 +420EBA7E5390268DAC93662BFB3ED7C797C43AC3520356247148B7975072E0C7 +EF801E8E0062BF4E2CF3B18E1D1601EA0F7B0ADADDDA7E4E44067B5631D41CAD +1FFF6C6C2354DB21B67102860F86047B42C02D9804982772AD73FA003B262F31 +D6B0CF47D36E0DA51E21579534344CFF9807BD0B1651C750D0316C81344AD18B +F28343F25945686A82C437FB48769708E90F8119E07453A267CAC1F7430A5877 +6D235C99C5B11A7A2041826EEA0D4067626A01EDE2D3BE4CCF0DD4DA8F571116 +975A729C4682C0408E98389C6F03E856DDE6B1024C124A41989FBC0EA7C041BD +C4152E1E1254A792B005F48B9033A6CBB421D470955C2747327518142136A127 +7E2596B2C761B90ADDC8512A64973F36438731CB50AA5962693CB40F1A59C3D1 +12F06462C90F206C9482B875BCDD5F8B9DE765275304A93C6F0B1B8D23BCCA78 +F3A177D9216FCDBE9F813EED8F487736378B97CB14AB007AAB5467166B757B0C +E8C35210D232815F7C78D24034AA48AB28CCBC7E3B6336BB6A2C002215A4FF6D +948188757F10567DE5BD219E89929B36D068D4DE6B08A26DD3E1C0C67F989850 +1DC3665A2F8BBCAED83FB7CD598F06167D69A2B2E42E566E8BE9783088F16CD7 +66FE9BCF51BFA00C1F22233A15FCB9CB7FBA2AEC899DAEA48F40FD9C7B913263 +9D438B03BECA7AA98B654489C4C38F6C8E36B43570D2B3329F812F56D5C73936 +D9006851428C2CC2AB48E1F1AD1EEC76CA8765597A4DCD996CAB5C32BA85F72A +6717717F9AD0EF314A42BEB6D94861DEFD497BC5DA36C6A9267EACF1F8590749 +78C9C9520DD446780775BBAE06FF26BBF2502ADD52A04831A54339F3FCEA0387 +0D69751B741DB97A032D0A06D25B154A34111B0BD8CB4075BC469EE2240B8D4F +7FC06A0920F331A4EC12848E969B6F495DD92262349B9E46F92A99C99F13881B +FB59B1D448057F943CDCAFE112A7CE39C256876910D56FC7EC456DA6DA7ACB43 +51D5B7BFDB2EB359A7DAF58048ABB438658BB41C43420E5C5B53715067EB80EB +4CDF8131566DCA04123C130B0F09A759A9561801F6BDC36A90B0BDFF0AE38530 +9B03A8D5B7EA24C6061D844718863ED4B9EE0F522BAA3DFFA039CF5663716F52 +02EDFAD86A85394A1CE8E4014066000A009B75D51660BE7AF73725CCAE8CA02A +5395AD2FD201E2C08325E78F07757A375126BE1B3E5659B873FAC3AEEE7911D4 +314B0F6A656A1DC11AD92CED1CFE2F14CB7CDE5184C463B9F904405E68BDB55C +9BEF2A9683A8F31DFC62D4BEE64A1885350EFE2961AD4565D85D9DA6B53F5915 +4B0EE63ACE78B6E293E498CD80E571009C0F6108BA9EBECB8FD874D53D9C6CCD +D34EC4C2C3C122CFAC87D8B9651FAFB2497B835CE41B65FC873FA6B05EA026DA +938B88C59A1BF6556FE7441195CA9607D6AE92C95B43FA34EA9434E9043CFADA +CDEF9C289941572FBBFEA9D145650375D70D2A60FB86A16C8FEAF5A787E0761C +8B78594C5C126C506FEAFC6025F6D5507CD98A0502215DE6C8982A2D58702D4F +E42522842BD598AC4525871350937C074CABF5F6F82C371BE878F2FEF8041C83 +57BFC5D07F71E11C9F5BD33B22135F312989D8C7398C475C8249A618DA13F1EB +0D8C9BB2B3A787290E420C624D370718DDE64B043019B9213178554A75CA0491 +158BBAD5A5CD88F5D310576B1446448E9E597510044C229B374FF6C9C2A17115 +99617135B761FC2D3C2CBD7B2CB9ED91670628C47A4BA501EC9C126B382D4BA3 +0C2DA10F18F2BA688F21AE393E78719C9C894B659B3FF7637F2FB685D95A88B5 +6F278BDD2396C63B9C2045FB5DFAF84B606C6A8C504DCCAE574DD1ACDB6001E9 +A4304AF37483B24BEB0DC35946D5A7FAAC2DF2AAF7E0DF3F171A5E5D46B298CC +40931EBA79C3B51BF555B66C3051F35C2F1991CB2901894B2EFBDA49E0A94C7C +573F0711EF5FE981D1555B5EB193EFD8C5EF3CE76786EB7E9D1E487F2A00822F +6F9B41C946B26600718FF9A3EB90AFC762B4A7DE432DFFEF8B7A193974FA6D9F +D9BBFA4487E095F1D11265422E1B63E48382401C38F028A47BF68D9378289D94 +7DA82679A38F816AD66C0EE44E60497084B524B11DD5D1D9499FAF6B3A7E8528 +C5580D6BE206E1C6B4D6FB1B49F140908979F18A188B0F33953F1BEC51848369 +89C20CF64415BD65C86A45E0A21110E24E78A18E28FEA836648AE1017301079E +77487D63231BF7F545DD95BF0C3962D20BA4F04D6E433252812A06922C679C28 +D7DD5BF4655D94487247DAB695F157F351BC481BAE77E5458013ECD73CCF349F +D138D42B092077A1120C60CDAD16FB292122CF10EE8C5C5BC2DBC11DF57323CE +906C900F2099261C3C85EE8300B909A434F417B41CFF1DE13599CCB110AE5196 +21F90D6B83BA9E5860E3C3FFCB29147DA58C31D81A2546B946A55B11343747AD +F3CEDB49320A754F20A1113D7F7640D686163667F7839216FC274F6CD6713254 +E3E9B2B9606820BE4627C325FB1871D7F5221F5B023CC821013FFEFF8880EC21 +39FBBEA3FACB235A1C39A8EFE5D3B1034D0314F44164CE204DD9E89F459CD08D +164ABA064EB842BB7A24D856B3D2A6DE1CF73A037D36FA32FCBC979F92A996F2 +50DC53F13BD9A77950F38A46C7CCF18462E61BEBF129D90F5748624D489F80BD +DF9F165FAF7E902A07C903DDDE15B96D84A886E9E24D90FE68B225BAC4AEF101 +7C1D997137B200BBCB79E7AA6D35E67B78BD0F5EF98734F51CA266F77358406F +CE4C9B7997D746F5FD56667877E3AD16D92199D940E81AF57B944832FBD72E17 +809FB2B9F94F9CFF9C6F7B00215193A6BFA82B3975784A67DAC3DFF74667B027 +A98DCD19200E2A3D98AD8E8B2A27705427087A6CAF8F72BD76A663E954A4614A +931820874125BFAE3BACDE9E4320DCE431273768C652721B4E9D88B09A054D2B +2A91F97414E9B71009437CA877438E39593D0C62A57848BC34BA758961308908 +DEFB3CE2A36D9ED09C29BEF311BC3AD62D71571E1B6E8D60E20CFFC7CC76CBD2 +DD81994677DCE7909BDBA3B3933F771034076AF4EC6354C291B45E1F3D8690C4 +AC7B92F10F869F5DBB0A70D5B397B0A75DB1FC425F66B91622C24911B8FFB0D8 +E73CF5B5E8AB7AD7ACF2F420A78E2B36EA117CE149464B0C5710A0A5A8D27BF4 +E317C4B4508B4A0160643B5CCAA1CB18DEA5532D3B2EAD054AED3303E740EB56 +F9E7CAD30E9075DCD7B225ECC6514500A9437EC0F15CF22B9E7D53939B83D05F +8D927D47A4E5DE88B1783C4BE6684C57ABC180F33B7B56C87EB9CE97FD451854 +FF43D12328F33DED3349BD3ECB23C5B9136D4997934767C714AC5B8741970653 +4EB318E40325EF3139E8EBDB63C7B9C1399009C630C37DD4D10DC935C2C0B366 +6F1B3723053B911C5A17B553DBB87FCE40FE9A10B0AA8785CCE75CEE76744C3D +F429BDD2A97F203DE61E747981ACB0FEF3F2D796DCFA0E85C15451EBF292BDEA +2B7CBB3AAF90E51E80087BDEA50B45F663A03B048AFB7B1C69A84E23F26A0BF4 +A5BC61142703D56EBF3E9F0CC43FD2BA28DA807367409E1C7A7B96143D1EC4B3 +783961AF7219BBA4FF301286C27444E8DC5318E7812BA7D3D2A3C7DDDA7DC0C7 +1E90E6E8923ECD7A126CDA17F490B9AE44EBF8335E4EFDDE0F7BBB3FAE44E45D +6CA887B58AB6C18B5436C8989096B14E8CB7D5300D000A55C89C1F3BF280CFAA +428E543B622ADB3C679DD0549F67744637A46C524C4B96B25F5E8C60531A74C8 +5A46A2098E8B29BA9DA4F19A7594C0B73A8D7C2EC7A18533EFEB97CFB2DA5F57 +7C2B8B5F6ECCC82F76941B38414093A80B35D3FAA66A467011396B000395BDBB +BEECBB332C0E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMR10 +%!PS-AdobeFont-1.0: CMR10 003.002 +%%Title: CMR10 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMR10. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup +/UniqueID get 5000793 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMR10 def +/FontBBox {-40 -250 1009 750 }readonly def +/UniqueID 5000793 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMR10.) readonly def +/FullName (CMR10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle 0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 11 /ff put +dup 12 /fi put +dup 13 /fl put +dup 14 /ffi put +dup 34 /quotedblright put +dup 35 /numbersign put +dup 38 /ampersand put +dup 39 /quoteright put +dup 40 /parenleft put +dup 41 /parenright put +dup 42 /asterisk put +dup 43 /plus put +dup 44 /comma put +dup 45 /hyphen put +dup 46 /period put +dup 47 /slash put +dup 48 /zero put +dup 49 /one put +dup 50 /two put +dup 51 /three put +dup 52 /four put +dup 53 /five put +dup 54 /six put +dup 55 /seven put +dup 56 /eight put +dup 57 /nine put +dup 58 /colon put +dup 59 /semicolon put +dup 61 /equal put +dup 65 /A put +dup 66 /B put +dup 67 /C put +dup 68 /D put +dup 69 /E put +dup 70 /F put +dup 71 /G put +dup 72 /H put +dup 73 /I put +dup 74 /J put +dup 75 /K put +dup 76 /L put +dup 77 /M put +dup 78 /N put +dup 79 /O put +dup 80 /P put +dup 82 /R put +dup 83 /S put +dup 84 /T put +dup 85 /U put +dup 86 /V put +dup 87 /W put +dup 88 /X put +dup 89 /Y put +dup 91 /bracketleft put +dup 92 /quotedblleft put +dup 93 /bracketright put +dup 96 /quoteleft put +dup 97 /a put +dup 98 /b put +dup 99 /c put +dup 100 /d put +dup 101 /e put +dup 102 /f put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 113 /q put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +dup 120 /x put +dup 121 /y put +dup 122 /z put +dup 123 /endash put +dup 124 /emdash put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE3DD325E55798292D7BD972BD75FA +0E079529AF9C82DF72F64195C9C210DCE34528F540DA1FFD7BEBB9B40787BA93 +51BBFB7CFC5F9152D1E5BB0AD8D016C6CFA4EB41B3C51D091C2D5440E67CFD71 +7C56816B03B901BF4A25A07175380E50A213F877C44778B3C5AADBCC86D6E551 +E6AF364B0BFCAAD22D8D558C5C81A7D425A1629DD5182206742D1D082A12F078 +0FD4F5F6D3129FCFFF1F4A912B0A7DEC8D33A57B5AE0328EF9D57ADDAC543273 +C01924195A181D03F5054A93B71E5065F8D92FE23794D2DB9B8591E5F01442D8 +569672CF86B91C3F79C5DDC97C190EE0082814A5B5A2A5E77C790F087E729079 +24A5AC880DDED58334DD5E8DC6A0B2BD4F04B17334A74BF8FF5D88B7B678A04A +2255C050CB39A389106B0C672A1912AFA86A49EFD02E61E6509E50EE35E67944 +8FC63D91C3D2794B49A0C2993832BC4CDC8F7BD7575AD61BCDF42E2E421AA93E +3FF9E4FAD980256D8B377043A07FC75D6169338028692CCA8CD1FE92FD60AD26 +D57B7519B80A8F8DCE9CEE5CDF720AF268D3C14099498A843D76E3B6C0328F24 +D36EFE7F5C4E5B5C612786200C8DE3A41EE5F1FFAF4097653CFCDC8F4FD32E0B +03EDB3E413283B9EFB0AC33B055617005BC9B0057FD68C52D1B0E67F0C571685 +767F2AA85ADE4E0104A1C777733D5E318A22A9944336E5B98D965E50D31F357A +8B6EA5A0EA98E1B027CE68C2EDB149EDDD04ED74A1B3D206D471A0C11C11449B +DE190BBFEBC08C9E1B7513B43DA3134D6B11A2516E6E86B67F68C970A320D05E +94FEC57FB347606DF89989C33482BD09D011C55AA920319E7B26A205D3D0F004 +22466F09C0482A164CFB27EF6ED2B040ECCC3DCAF345B5A73676F193D43123B7 +72FD6CFC5E37930E61EBD5A6307E4DE70194E6384EC0D79DB6AD86D3B319A31C +8B0589D0FE28241D8ACE280D0530EE99C80723E560BB72AE9D53F4713181F491 +344B06D3027BA4E9E94D4305BE1D817197C54C8FF56CD6964165F6448ECC8A8A +64B48B4F0FD69299A137589E2491A283509B21A3A5772F75B7602A9F60AE559B +07A58436D04222C73EAEA72DE9A5A441F88D27C11F4F91255EFE280E91A4ACAC +1E98A4E5E6C57B9AE86FD218C3CD8F24A4104156A80F13821384E529783C52C8 +78B94AB3A0096090867ED32E8A30980E737922037F75F062BD83BF4F5929BC51 +CC22AEE2DBBAAA001CFFBFF41D258424FAD888FFF1BEAB796A44E3126159E120 +7E4025C676CF94888A1971AEF8B6764B3AF4A92D36FAF6FC56FD049710EE3782 +BC2CD84FE2473F133BE03C1346B875463F126DCAB15C7A9BCC9A727D23611462 +4E8D2BFD2466600285D79518712B8681ABCD69608E6AA9578F7BD771EC36E01A +5A17BC17E375020ECA59B43790ABEB9DF5F4FBBEF807E5699EFEAC563E1ACC5D +EFA336E75DE6D8248E9381BB110884FDC89C2F9A41EBBC9A8A1F98E6A41F68BE +EE30E25CA148C1EFF42DFF8C214A6537AB11F260B8C329A4947B5FC8DC9C5622 +4DF7BF4FBFB00380D47BABB03BC30627AA74103E553F55278F538EDD8C1E64CE +0F1398CA0AB5A86630139B4A7E8FC02804CAFF3830114640AE50D2FDA3B561B5 +C63AD7EE3347804CBB40FB1E77A6C89735DD870351C3A1811591AB493251B904 +314F65791963C0412377C1D02362C5E9655F1C3D4803CD379A8EF24C48218C2E +DF1165840462BF37DDE1B8D5FF09FA2C3B261E2F1A65ECFBE5D4EAD43B52C029 +EEB3948CB8A252CBAF545C8FA1C31E920E23A12DD7222CEF2D2A513BD758EA13 +DA33BF5FBF1D734653EB83DA2D374A5B9A0CE316F24EE375D6DF6BDA49954C2E +DB25A88821193636119D469BA66E5DAA9C92520FD4F84426A4E54273FA469084 +7517817A6EE3E21176D333825E88046F50B3CF6938AF9BA79A2F51398239EB91 +1A2D07F7FCD948427FF62F40FF95E39FE1A1AA8451411563FD5388472251C155 +69BDE9283B41900B21EB1190D06E6B13B7794FED020D2C1BDD205AE77B084BCE +EF628249398B496DE85B406FC2E1939EF00DFC84C07E26CF72EC401BAAE756E5 +7F6673216E7560D1C2A723CB405EE5CA474A07F61B81F8836482F73DC9516D67 +CE0CB770EAD755B6B356198B4B97EBB29C63456953270CCC8D5650C1D006E69D +38DE2DFEAB27DAD50A817F0D645D30AF5B75A7B53CBD3D2B8D87BD0A7E525AF3 +22F7ADDFCE31716914C2318260C2E2B4664893921B68C5A93334A361D94A759C +0D7B146D6FD94F0442D672BDA0F6432E18F3C5DFA37ADA378D95B75F413C9ED1 +BB5C606A3EC7DFB3F796F59B0478C13FD1900381EFE0BB5242D5B5D34D03AF1D +4BDC93EAF8020E26CA23C8B0E7DDEBBC6762A557067A4CE05A524188A8F02E2F +3625DA38DFCF381727887F5646A3995A8A38A5FB1E5D5EBB395FDD0B7C8E71AD +B48EEDB62AB2CE99D121435EFBBFCEEA69AE9ED8238B60CC7288DE33C766CDFE +15B767B4AE2E6CE0965E77272AC9F86023DA620548CFAC85BC751C44218A29C9 +849F1C2DCBDFAD895B54E51A569952ED50F82DC8A19F367E7E44643854EFD6B3 +FCAEB04E55E4661C82D31E2932611748480EF61FB2FBFB0CFB940BEA81AFCD84 +4C6A6332D7A600170E38A8EAFCD4F93DC153C43175434C86BC747348FAC61B76 +1FEC9027C1A193E55C80F1F20B5317AA0A05AAA36AE235F6E49F06E570FEE798 +84857D7552EA92EF3EFAD52DE39C2F8F43C59E3A957B7B926FC95FC4B60186DF +7F3523EE2AB74E294C8C4BCD8B4975E84849E0FBDA6C0B0F24A636DFA578B122 +CF97BC5089E21E9F5298D1C9F30CB8BAFF6A3A11BB4D9A0A5CF2B18D055C44CA +4FD4D8FE1AF3630907DE7E585AA811F9CD11FB2C8FC791851D651009FA5DF20B +3C33FD2FF848A9E3F5652BD294965A332DD3F246C91B0ADA34017FF2451D1394 +F9C3C95AAC6EC8062BE98E8914D51DA6A164AD13938693D446044859D03A949D +F9AC5DF4A000CDA98BB516D762CB9F6D44B5268FD0C26E88BC4A760C0F75A140 +DEBDECA4F511128B7D2805872160C55236F0A0FA7637FF0D4E94AC079CD3C8A7 +D03A5A56F26B0438B577C46011A10532FEBCAD14FBD6032E224F45691A726886 +56F305231EB2FCDF59C8BBFCB5DBD2D093A0E84D62AC93A2312CA69295E937C4 +8DBA1802B85F54B5E7E6D6216A918F911FF705D3B5CF055F1D873B96283A0B53 +59344D910CD396D883F6F7836BA65FAB4393A773A8F6BC298069E5BA38210EED +49C9D920F718E3FCE692527DC7CCE6963BF744F2C91BC5952564196D60574E86 +87A0FAB21F2DB2BD5A51D7FBD8FC19946D24E5A228462C4772F978E650ADCE3B +8D66B9C21279C531CA1C3A8ECE3420BB65837287A7222CC3673A2A5F8BBFDB60 +C719CD073EF9A23675198462C7C87B24CC92D6AEE5C25AC63855CC3281494342 +D28F3D2FDE0C183486769A4FD5B0143193D31FCB2C2A14E487BBD96D0BADBB64 +D1B56021C363A795BF10E2DB448261C363A54A4AC1182B470C457AA82DF3F5D1 +F4B329806141EBD53CAE309319B94133D7EBDC2D0453A905ADD207364371E178 +0A95C2686E3B34C4A978BFC0EE968C39ABA00889BC5149162C2B54483D44FD3B +5CFF41F611C7E03B94945F414560E874D7CF27FFD0630890D7D7EA66CBD15448 +229059E1C436BB33D69552B5367AB5D53591C4678D0C704DD3EA23F5D9E8A7AC +17D003C19E333E726FFFA2961F33C70F429085F7BFE3E2510F59B78F58B19CB4 +01B48E184BAD9020FECCE3AF52048A056981DAEA02AE78197E65855DDB170616 +F54278395D9EA50DC83761AE759F9CDEF9E1948E7002414FC05286ED793E6662 +3347F2A9AF8917493D7305B92CF93E8E9185F70015F5594084298A6C2F9FD3C0 +689F262AC9FEDC9B89577ECDE92F08D3142209FBCE7B5C0A840CC767BCA56C20 +4E4E545E2BE4D21C53855CEE4CD0AB35D1A604C0FFFF77DBAE4289752276559F +A05FEE65F45ECAF44E95E23FAB6052195C7948AF0B1126482D4E02D72BF8AB03 +DE0F1A632F7672AD9DDE70EDC82AA993678A82BEAD0BC2649C4707FD8509810D +364B5C6FE0E10772E95288C622C2F06C634F4DF8C7FD1432BC9310D5F24FEE3F +7AB324863D6DABAA1576E70643CA79EF4D7DF4105093D66CEE0F3B87D2164A7F +26EA05F5C4645B22D3E1BFD2219657712C168FD90DE801FB0F32759E80DEC1E1 +43CEEB19FED12D757205043FC98FEC62D6A8D8B97BC083B4A0E985AF7850D6FD +8716B9957C1C35A0675BC53DF672C425C79F43FDABAEE7D63F092CF271C9A9D7 +C41F40C4189510987887942E60A412B3EEC84C9A6E1AC7D54D528F5604B72C08 +94B7882621A5BF1F325B92FF96B80878CC550D1AE4D8196E41CB1251856609A5 +C4D3BD05A922D0D45E039D9450DEF8490A3E924E41434194910BF60BA1B08BE1 +B41824345627745541A4F1703E956328F6227D11C74946B38CFB096139979E56 +4E723B889B44C6D78673868C89912F8B4F0B4B485F1587A637B630F92E6072D5 +7F3B44EA6FD96BBD4FC28A6C1D90805E3BE3E42A7BC9C880762966C55BC04E01 +204D083AE976FAE6F37C94F27E68F8C0F28D52B17F6C0FD7C9150701FD78F8CE +B8E8DC9260E3974005EB5CA728171F482D765016C94D4ADFE4A42EF42212BC56 +7E4EEEE8B0D2A7856CD4E44F55C0BAB762F92CB8D64C17022D4BF3A47C12F5E6 +279FC23101FEE93753653CE8CEDC3B75C9CCB29BF1D4554C6120DE8EE750FCBB +E38B5D915206974962E320362E59B3F21B3AB1875703191043D03284D4467346 +CFF2F98CEB4845B73ED8E003E0DC94251B73E13A9B51A3F1430BCF6A21EB9B7A +65E17FA411F53BE6432F1506232B8159E008FA257F884A4A01AC53BE91754D78 +BF14A5B0FBFB9C31BF4908355F8A762052968DF526D118708CCB0B7CB5BEE285 +6DAB6CD2E3934178E60BECB11AAB5478623CF6C50C92F8BB5D1A583609028FA7 +B8A53B791BDC9EF76A124F3F7641857E4BEA0837CB36176EC9A522EA7F41B8D3 +63C37D1145367BD300F17B54522A834BBB74DE12BF9EB26ACE6F24A046D58F89 +4D4B7DF74875F1A0C1C9D97BE0849593D7B398EB4B00BEBC8C8D1497B6EF831A +A35380FFB7F1AFA4D888AA52C9482E8B1755CC209905F98F40D95B44D4DCBCB6 +67423D1BC2F3560FF0A8B4F0CAC352A4EE2C1D946E45AAEC8A6AD40303F3382C +DF0756BFA3B1ED64C169E56ED1C760F2FF0E24DC5C9F41306EF8D2628153D30A +5DCB0791126BEFD4947D7EF08301FE015F2B0008DFFCBF9F2D4D859FD43EC7D9 +C5BE237E9BF6665B7B1BEBB362F0C0C3A8D86010B9C97FA741C97C2E0513386C +9C26C235B14DD2A58BFDAC7B5F63DB4DA6D5D37D0098175A9071590E1DF66A3D +B8173A047C29D7D35557F06132CC920B5460B8AFC11D23D09A4E45D089F5EB51 +963FA1A6256E359D485107FD143B2BF21FDE9DA5744BC2615E86C31C89470CF0 +D06C6397D9FCCB316EA9989430240759D2C4945D941F159FC02327F34B042BAB +B5C3A47C78E8C1A6FBCD396B1A51CC4B020B8AD401841EDABACECDB482D6EC5B +72D2BFEB4556720FADD49D07307C8B22ACB7E310CA4151A85C71EEF70E8D15DE +B3B00F26E0E166C14647A65ADA228A3D1C89025BE059306565DB1B1EFC37D358 +8C1EB024254AFD049BA977BD4C2C605050E17940A89D0D4C5D963E792320F5DB +3706682E03D25D9E02487247819551465092CC22B6B56E93F3AB528038FEC3F0 +668F866707A19B0463BE706EC729D2EE1653AAC7E29BD25BFB3241D4792F5152 +ED415B4E7FA92C2EE5A22E27E8B75542C492E56D811C192E95542A6FE0BFE5A5 +69273C2ABED4300D491B92D2AECDD278404CB84B1BB1BD7AFEC858215837D118 +C0E928BE7E07CFEEB51A6D21375B772B8248C994564014015232A0DA4BEA1754 +3274F407FED0837A236371F1A32056240F2015B1E7F4B2CA72C6B58610A66F13 +407CFFBA5E0A2893C1F572D50F51286E9133B5A84239C9493B0574E77D281D01 +11D00683354A000C9700EAFBC1FD104EA19DFCB87470190E7E2CE26E3A6FD0FF +2620B87B82AC8686B6206B530F17E9348BC7D04B948348802CE53A312443DB87 +4DBBA5313A6A2A8DAB8A1CC9A594FF8C299281C0A261C8CB2226B732FBEEDE40 +2C6ACC74A1A61379E2E1CD5548CD908268A32FA83D8504C442EA0E183ADBF7FF +9FD09C037AB03516ECCA93FF048235BD11A25DB07F164512A079C5392AC7F889 +CE96AE5C8D9580BCAFCC087C35E76EED1A671E87C12E3045E15A687134736DF8 +DA984772AFD189D68571A2ED7256F1E204230E41D3D9DD876F938951714A3973 +0CA9310489F8E807C1C7A4E51AEA5BC030610A5D7263FF7E0F9FDE3E5E37A362 +5B919000BD94D978583B942EB79CF2BEAC33FEBC9A67272EB10865BA8FB75FD7 +9D280AB59F91B96C16C982DE848D76D8FA8620DFD7C80B7DEAE7264350D6FB3A +EF04794DA3305844A7CF718F6D1A4A3AFF6826173A076A1372ABFC54ED3AC6C2 +09C9287FC830556CA694E21CA5342ECA7B10C90AFC4783D841D7B1E34FA3DB7A +2B706F3E21B0FBAB23E7257962FC3BC309CEA2C7239A9D6B44CC96825115ABD2 +AF9A2566D2F3382C01569FBDB94C8D664A5DA0F7DC3DD140CA77C743D7BC1420 +324ECF9E4780280EB119885E96A6C619CE3C0C8E1E264E2DEB137E5DC8149786 +486D65667ECF47B1A1E20E9E6E4FC8323E0BC8E61BDD3BCDFC6575C69C03E31A +EFFC290472CBBD049DE3F840AEE37A2486034240F80E75D8A79E0762377DF660 +52B12EAA16D678990B11A9BFBC03C1D4FCDA9FD4FFBB3E88352438102F10B7C5 +9F04C013B6575B5E948FAB58EA691984A0E54E6B9F3F505FFFEF74D06FA1CDF3 +4B8A95904C8A2763AA8AF5B71D00F5DE09DC1CDF87A08B6D181453063E14C12D +B7BB3775A6E2A901636273D9EEB833EA8CF20FD83AE899E28DADE10EEEC20BD7 +BD93085A4B1AC80AC1AE8280C14767F1A487BD066007A0D050317BD081131A14 +6EA0898ED59E46DA7B6254BDCCBC660686E2EDA0E77A705A653733BB5C5497D0 +B130359F866CF293FB6EF0C2AC5BAA2DB0DED045E2DED3A2612D078333260359 +16CF0CCB272D34767EA069E0F0B0D42327A18529D72E890EDA6195C2688438ED +E9ACDBEED41E81CA8EB5E43C2B09CE266EFCA03F2D7FF57F12B06F9E54FCC6A6 +546676F6FFC5B8B7D3F0982B6FF0D21D949309F0C0B175CC1D0976F8C55C6AED +6E821C39041E22D91AB30922F2B2EC2746BC7DAB484991542FBC82D87B487507 +559AB466F73EE23C2D3194DC5CE4C9AE66D3164613AC5CBB3DB501B64DA7C91B +C7ED2EE9027FC0906820B35D4F2CF66C4F9CE4A884B7C07155BCA884ECA5EB3A +ABB83F84DB1F5639599DC7D3F51241AB5D95C3BCB7AB1EC90B4BC989F74FB354 +04B2D7366A34D335A47B8C00C05CB423482BF6C7970A95545424A08AFF9A035B +7F83F52B65A9799CE76E303B85664B624C65E9CA58184C7BE2BB9D9C86A4DE5A +8165EE3DA2E652B5022EE7893896BABD88931DE1D538F615787645DF5ACBBA0B +A8E5B899A37321AA7D4B283AC9234978C2DD81813A1EE5DB6EC170DAC1B6EF02 +94892635B498765C07A38D2E9DB0B7581B11056C28278F89B0E60998379C07EB +C0EAEDC32AA69B8B836F92A61AFD35688315B2C3F860632FC13E4BDFB63214BC +41CC6859EAB3AC3034449213CAB99FA1D216563419CD6D6CE4E1B56F33E6C654 +7AA9DCB5B05FC068DF02AC32408C8010AD004F6CCA9887830927F8CBCD49CDB5 +18CAC1EAFF815FF2F6F527F936948201565003022C6C7390B4E3C2B219FB4F76 +9F12BD25CA7B3B61D1A2F8DFEE795D04D5428B42FB66E0C254AF7B7A10CEF7FD +E5ADA5E217BE24851180E9A1700FBA66C7D2B0D7BFDE4F4EED1D24B821A40947 +5620363657F6D048E651A689822CF815E72FC8AE9D835BE31D1DD8B54C9A717F +4DC319B4B59AE073936EA40B070524C7E71D5A7B64436DA107749746B516E29F +E3BBCB8F8C473E706670E11E5B221716F315FF097CD1841D0069FA69EA1898FF +9F9EC2518C77806A19730C97F54BEAD604548D553D4A6EDB247853225E24E7E9 +89D71F6BC94DB986467E755CCC99069B313F5745B02B4BB608A39F0A0A732B87 +7EA2DED68219754BF1FBCA350327572D769C962EF9242132D93A5C8E9725D8D3 +AAAEC15ED0F362471AA58488620156F3474FA59CA080EA96FE995D2B3DEEADF3 +3141D157481C66507725ACA5953CBBE1ACEE7E3F02C72C6552D15EB3D612730E +61A06A43575568DC3CF3844BABF04CA767E2995196097015E0C4F622C4356B6B +F41DBAFD797A4B9D7AC22332C552043EF98913D0D9B50CA6B7CDAF903BC5C04F +D20A952BA5CC35B646ACD0A287C956B98C450051AF6AAF79DF37F8954473F8F6 +652BF03AE2AE82B99D820CF93F5FC0BA17EBD7AF90313E70594EB5C354023BFA +07912408F1757319C7288E99872B907D5AB583B082EEED8AB079C63E38B07D11 +6744856E689A479CB3A8BC081F33CB06755926204981DC0A45B3ACC18F6865BB +EE2C50DB43B62E3630FC1D9B1FFB3BFFAA6D0A20C0381ADF48E4D916BEE85BA2 +BB40F538F55C11D50F882B73913840B45161262BC8B0012694C3EF26452F9B77 +2CD7C7AD6BFEEAFE31C8A721C2D46AA00C10681BA9970D09F1E10DDB693AFE84 +246AB18279A2B24E5B50A2FF6337B7B1039FFDD4B00ED3667B5F2F7BC2786D2F +525A0E82234B30711AA835EAEAC2E404915FC7EC0081B194765032708B5E11CE +EF6868298CD26E5B9EF345BFA3EC2911E2B96A0B40AEAB95BDCCEE38F5EC170D +3BFB792D2DDA7E57BD2FB7669484EF9322A1BEE009594901095DE2BA9A15A0EE +4DD77404CEF16EA6C31FC04A8FBDEF27B9FC1AD3264388B650C641D6051E47EB +E7EE41B946B5A54D2990748AAA64237BD4ADA31C10843E1C235AFB36BF1DBB47 +A3FC8AC6F98C72AB9F84F3C354A44EE0530145D80BA7810314D977917A4DC4BA +2CC4AB63CD3E87DD7D040E8FBE63D94C9BCB476AD94BA7E4C0AF953BF4821182 +D723D9BCC92F2B14A8769B9EFCA8FED9DBF2A836BDC23E27AE1BC097FB3D2297 +DD32DFDD7E7BA91C05B33583D92EF193248C70B9B0A260A7959045DE6AB129F9 +05F7F25D087EA8024C9F63852A12B46114C581719B4723810DCCC8183D7E6F10 +450511BFDF8CD29A57EE9653F2651D54A62141A8142C8B857B0D3E2B9FC5DA3C +38D79A7AFE0B565A57A7C4F52DE6933437EE03D0DC1D286880896392B5C513BD +D76497FD980320FB10E6CE08C3953F99A3618675B04C8EFA2E2DEF4511B4300F +2E5C733D69737C7428840FEA2A1D89133341DE4BD065034F7316B5922CDA4D83 +D8804D8DED8CD4409859CB18F45C838D6F18CE8DF82B78C79AD664A57F705D8D +9CF82E48176AB5869BC634B2BC053A299600E1F9CBC66EE5715E9C70D86E6909 +ACC25A0858B10DC043CE7A5AEFE9E3F8C28EC36BA0E34F850CAF6C0AF664A142 +AC30D3EF7D61C7E85AF9963BC58143F92B5D64DA3F8C8F131B190E8333769BF9 +0186F3840565E7C3CDF85409DF3E0134C97837AC17E7F988B62D82E068EFB478 +5D8BDEA6D3A49A83886DCCEA341E9B4012EEA7944F69564B5F0EBB5360C067FC +70DE0B05B117732530099ABEC6F1FF955C9F269CB29422AD7A3F2BADFD97CCD6 +3624B8E757ABCCEBE5B1F2620B814FA2A3DE2698BF0B06CE3AF4C560DF372AB1 +A79B06195FEC5EC862560D6767FD20EC17481FF64AEE679B05EBAB7AC520F240 +E2EF71614A3A93D4697747A6BAC42DF8DD4F2AE3CF46F1DA8F0A1A0372C6F83E +5857A31F725B28DE3AD77F1DDF563C4B3E8AA4CF5A1BE4B4D0C672D68ADA4FAB +5DD7F618B1222BE7727547825EFBCA21408C5F84E3E7781B5ECEB19CDA8EC4D2 +120A75F8FBE6B0D64D79096233696BFA2AC17072EA6C9F52E42816C85AF34C21 +215E72CB2993DD2C3848D655AAE8601E71562993AA3BB06D0D6E6C20648F9677 +A2701944FEE0E51FD5BEB50156B58F72DFD40638251FE20A5C0E3DFF19D7B499 +8CAB7917CDCE0770F1AA19B2C5F82408AE2CFDC4758409B2B67142BFA35136D3 +B2A1D91C2B38BD4E110708B21F7939A250840A099A7DF39912C78154401CDFEB +7C0ED881E74EA9E1D08324FF687EE87EE03B91E2ABB6C33E43FC047E17BBA4F8 +F1D8BF6C717B029B872A79EBF74D7A16D0ED3CFBB55E95EBAF4FDE106C6A4753 +73979424F01F43190921BA6B908524F6641BED93D36321CDB3736B9BE9A242A8 +FA584BE4C3919962B0139409A522A20207D87997A1B6DE54F47BA654BBD9ED3E +8E8FB95D271F8D5D8876A2AF48EFD0EB462DA12B4CE919E076E25C4799D60C2C +C73610B087F668AEBDEF6C73D69A2B62BF68EF83C6986E442D5150434EF294DD +41060C3A4FCE7A438E91298A59C993BEC013BAAC07F02A332620ADEA74272E46 +8B2A4194A89B0BE1A6F07F8B45EA1EF8F55C6F152328E995B30BB0B5352E4812 +0673C3C2BB9B99785CBBA8A8311AE18D06226B49D7050D44AF0679CEB58CCF22 +E61904C92A4FB381BDE9DB7217C2ED14D35E765FA4DEC618A6BD6E4674AE97BA +FAE968C7465E6DCD933A822C6422BDEE5B990FD9B85F207E6480D7B112A801A3 +6957858D2A519288ECDB56336D012BCABE3BB8B52CC89936031867BA1190FEEB +A80AD1FC9B93CB69B107A7DAE5609F7B98B8D14FB260E31023265EB13FC896A9 +73CF94B15A4395E0AD3EB2A91973821152E127D01368807BC9C2A57259E74AD4 +F09061B443C53CACE953538D07F7FFC3F28F4C3FF421E2A62EF5268513AC9665 +14FE9FE7121D9D4B4F105C8F95567B73A03A011AE1826675A5F7CCDE515066EB +A27FFAD11AEF93BE1F99C8A5E74D6E45E2F3DE6DCB0F5E259053C58C8DE2A516 +8AC6AC36D35161B3EB6C40B568746E24177DD0F3242C04BF79BFB529A9C44F84 +AB4DF31358F02595B3598AEC8A205638E2727D8F92230C0219EAD992870AB126 +356945064662080400E25D70A165C352B8E83A84AEDE652572DEE17155B7F883 +1E55F19514C03C4F839ACAB60057E41BF7BDA5157CBAACE7A2F055E23197600C +24AD4B233DD5A755910B3FDF14824CEBB7ECE481695A34E951165BE6CB131F51 +E0D22A548AAB3DB4B6D11404373FDBE4AE06F05C31D1FE0A1E274F9815A30E9D +59FF37C4F4E6E04527ABB62C980C4A2C304804B400E2ACF05CA5ED1143B30073 +ED3C91DAC5C0A7CFF6F63E1B427EAC21C2A3696C8571B6512A8DF29CDC77F366 +550591BB71944DAE17935C50554EFBD1B46D08D75394C5DA17CEA8284B31CCA1 +93CCEFB8D5D9A3520051380C49AE5987459094F6785064B39CB56007BF7CC276 +DD3BEBD291A0DBA52EDFD35236E3279F95509B41E2A583475B74DCB3078040B4 +EAB31DC4B1F294F342BADE4B4D44AA6D46B88179CAB93ABE0574746140C46C25 +0FE3AECAB5E16780E2EA7B64793A51F59431923E2AD093B00AF011F20B230807 +71F86CE98994E19311BFFDE2CCBCC597CE57E285B8E5EA49974DB240B67A3878 +F10143B6F90585C75CD51E5B563A820ECEB9268A00AB80FA02DD97BA1FDCA43D +FE85D9EB7088FAA2359122F3E9F7096E9E97E2EC101785EC60E129386A992747 +8032D4A715E29D6BBED6E020CA50ECC0500EBC86FDB44E9C724CE6883C0E18E0 +D500B67CB72B9C1E13F1C3E2ED16AE038C0D021B9AFFDB32CBB2D3665ABBA645 +6FE76D34AD5DCDD286735B0220D6F6B14366772479996D22BA049DAFE3EFBDA7 +DDE1632D2C6ECD37DDAC21C503FECBDAFE2CEB46EE6D98C78249880C1C749855 +A66D646D83D4055FEBDDBDB1FC3AA8DF0F3D58864BEE80D9C2E96B79040CA626 +12FB54F26DEDB1C48ABA276B73C02A36D3BFED9D1DB31CB98669977AFEE7C746 +817827F565DB22463CFDF7470E0CCFC8A9C9FB29C9CF4D1A5F32B6E600C3748D +3A963528CA73854AFA9304D1E4EB27BFC9A596472C721DCBBD0929693FA5F7EB +D0A7DEDA6330050150531FA9C17C0DCCD08A5DFC42DDC20A1C3058ABF1106797 +C46C851657846B76616532B76C48053DAFE0313AE89E4F275286ECF869738E18 +294062582DFB8EBBB7F192360AFD3858A5D2AB8162DBFCDF7ABD8A4694B8CA17 +2F4BDBDAC4CF08CD3760AAE7D688541A224922521BDED74C9BEF3D0120F66CB0 +C17E99AD23E052019F17A9B2739D42973FA53DA50EF33DAF193B3E6C9DA14348 +37D7807E39C757A4C4B7C183FCC8ACAA8338AC2D98DE543176EFCC40EDD5F062 +8C95961A8A2F4F85BEFF215EEDCD6512194EB26588CD0FDD9D151FA1050AF365 +2A62358DBE53EC4D861D2BBAC5A25D3E69616E40C42CA3624CDFDDF1175E327F +77F66DB069C4A71F63B6B2C63D7506EF0146AB47C5876B1B04BCA05273476B11 +F3538E8BA42214CB17050A9B73E2CE4464E0B334190510370A272E0138DEDA70 +519FC2E69ED8A26749B2A5C1CDE2B37C804F50577B6D1308DD9C414C5049B08D +AF0AC3CB19AB4DFFF36612F0D85CB659618B195F27A3A1E1CB60B53AE345671C +F9595F18839DCD3C2FAD5D2C4A7089FC963C0478D72B6211EA55B69E974F2D0A +93D2E65250DD325C630D509EF6018008FB3A745FB9EB6522B3CA4E563D95167D +597653F6781965B64BBEB2771D9E828B42B8B09E9393DA2CAFE45B326B6B0971 +4E6EA93430D281C1FA4EEA731260F562DA258ACAD023BEF34C3C5A0CF816FECB +1F268A739A5FCA67B46E0FFB4A023282140B4AE37672DC85563DC02D21E2C823 +9F8010C7B95751649009B86F080BDA7BEA3F542D813C360E9E1A513F63AE7855 +0D36BD48E5AF8DCA65226517458AD7ADAA5F28DDC3A7B618E7EC1B74999072CC +7A008E104CB354A9C51FC33F37F849E62D3E32719381936CB07FF904852B9606 +E8E074B6742A1847C136340CD545EF290E46D0A1E0810B01C554FD187DF50D87 +5CDB5AFF8D1B4288424E11D66CDEBDF32FAF44B95165076E6C225C7F42887E4C +92240A17C421389EB382BA0A0741D26F1BFAEA6E9E517B2C52813DCE99A08311 +4F16B589ED8E79588045EC3DED5F301F805E688B87D03ADE1CCE60DE4D2D2E23 +54A1111FFCBE6538892DCEE6C815FF99555E34634B52F0B8B83EEF5CCA51B264 +0953E222ECA9292428B936828423F48F8096D06CC66CA1B36B4B2F2784D244E7 +96F68495C350138EECD08CC965172586E3DCC71630066221ECCBAEC472C301BC +59D933D495F46D82EE04A8F6014016853BF583702BDF1A5ED5AE25E624A4350A +72F0503F0C1AD4C182A8F0D6A9A658BC15646A8C0A71AAEADB1F46A72EA7397E +C4C72BFC63F5B90A929BE427B7C4DDE2802407189926D25201332BC06AB5A699 +973D9C471522C92A709F8B37ECC98C3DCDB4D6216EFA80F1F1D372EA69AE5C2B +AB8FDA81FA9C141FDC9ABD1F862BD5DA5D7E709EC529928BB4BE24DEFEE5CE14 +DEE1FB0EA689372CA8760E49F082016A9CC7F948FAC4502866B0558EC294FD71 +5BE7FF20844B8FFE0A508B768111D17611F14969F8ACF8359F8A4FEA3E7571E0 +70720A1EA8B6BC55A25413D6E03EA500744EB12BEAAEC69E44AE4FA8A4CD6526 +5668B3BEAE9A0F421FAE0DF6978CA37DAEF0CA5F0D371DD4B326634C72639840 +49205FF4EC345FEA5435803C1B2C30141A0D8DCDD2F8D50EF1BA59EAD0642614 +F6563630B736E6496B36D8EDC9C63E68109D5B904230F732C0DA7475523840C3 +EC4C8FBE7908D77453CFA51F0E22B2C25E2D2347A583E792978289FA57FB04BC +7BB1917591A601715BD120853AFC9354B9800E7F8239458D99AF06A8E35C8077 +3482130273C29C8839DDEA51573B13F636C08909737C74489E6FBEF0B9972E22 +6E1E5A92F8DD2A39CF2CC73F89825E8D2E8BB2AE1F88C7E27122287464BD52B2 +45423516A60A7175677AA315B1D8746D2BD5DE7009184D96A3B59614FBA2BE1A +BD927FEA3F2B8A00A48816E1B2B2C7EFC5E7B427D1A8C1A5DA2DB92244D716A8 +FBE8FB4D7800B84A8EB0357A8408779357713CCE40AE8756576FC36646959D38 +33C313142BB38EC37E98C03780647CF869EDBCE284ED54F4C874F720287377B7 +97C3E683B95F15DE4EAF89EA6629D20FC8FC213330C78ECB9292A0D1D25A38B5 +40BA661A3809C357981B8754A7FB466B99363EB7988E2204605A2B05AF88D21B +A000184B8EAEF91F951F36B67BDE2A3A22C6A16E6486FB5E66996FBD5F0709FE +DD26D0E9B5C5AD46A1BBC3CD07D15A793660A22D5A2CE6D409BE4E85650F40B2 +002EDE4DC4781D0C92E2715839E7F73967C7F47E43B57624E041A5990F5F71E4 +3A0FBD7E4AB6522C66DE0E33EC7EBAD08626485E7A891DE668DFFD246E16E207 +780503270F30E40883D9C86FD37BA890F63B63B7B792AD8390A8DA38B4F9EF69 +99F208E079AF94FF22B9306647C60E25C1201958CB64E98AC0AD1C336A9825DB +46FDD1A3D405ABFB4BE25AEF754F50194F115EED9D9CEF87155CE003DF1E4ED7 +1D8E4973576EE90D0ADD34551970056045EB62ED5AE58A469F1A6C2D06725687 +06644F6AE2F64E1D824A71C9486592776B819EA72C2A12838F02931493E2E9BF +7DD983F38366AD899B45675EE8E9D2CD5F906EF0B5DFE0350C05D09CEA4D7FDB +63EA24BE89B610F6A30B4D979BF5F6EAB1D9C380F9C549E202532CCA4C27EF7D +7AA364B32C57810067C26AE82B2387E7E230D87383545028DE35508E5FC1BD84 +5650A2841A9BA91FDFD8A7DB82C1745A10F72F3615F121AE293C4A93E4E76521 +8E203338F7D886725B9FF5C15D53BB5D811FE74D02EFF1815B02F48185D52317 +5964EA8A110AF975F0B8D9598AB947D24951EE4AA522454040FD5753AFAC0489 +4D45A6EDA2C2C6C73F35847976C959B0FF303CCC6545F19364B23D3C63395DBB +3362516BBF0B92517B5D085627A18C9826AEA8469EC3C4256AD1292F18D81C0F +1E59F5A8F86026FDAF2491B3BBD03636B3D6E19C288789D26F8D00F20141E050 +873E5654CA843DCDA132416F00BC919B7030E52C4778ABD230CF148457FAB14F +0EB4F664F087FF8B2F5B01468C7672BB96C9AC3548B8264E3C5D41D1A7A5550B +C51EAA1A1A5FA83270898C3709E513BCA535F98430BD4637D9D08826C60B4EB9 +1EE0C57D211FC4CD57A530CB78111BB1870C8D5977387247863325AB9781BA74 +AF03EB0707BA0CB0D9E9D9AA669A9FD02909C6FFFF408CF0FF81F225102260CB +737838A7C83E47618BDE15BEDCA3A751463283717D14A6165E6777937AE49068 +7717E884DF7D2D3F9427221BCBE05F1D2AE62812E39D1A646FBB6A3432026C3C +657297E5BFAC79E9D8DA97FBEB5A2C9E0858D3E3F67B97AA566855198BB648D9 +E854AACB032137918B8F4D4FC5C99B525BB5A88C4BDEF3D4ECFCBC75E40F6123 +E7BEA95F0B97677CBF7FE85D7339CC9E1B7DA2B933228DFA0294727C3AE42DAB +53854AF9B1FD7110CCEBF6F466DD59B2A2E8330D83FC6631DCE67635D7808C24 +D87EAE685E7A55D7543B92588F907ABD6DF29DB5F627AFA84953924C66439028 +B17AC24A34BB4E34AD301688CF12C5A10CCFEB99799D343A6CB52A9874A0D210 +AD5AA8DC0A035B47EE9DF00AE307AAD64754B150B91D06D445200C97F5CC6601 +E8E47E12757F57EF61AC2361F8CD10C188E0947264324F68E72A8A2D97B9F015 +118444D9E858B1D4DB8E130BCA95586D2F3AB90D90E072724FFC84F895C87FD0 +C3DB5A9E4D7F858ECA95EB94892E9F400420CEBA0ED8C6F4946A95EC1A1EAF52 +1CB7BF03A584C83C65C3B4BE90C818F9ECAD77FFB030C0C2C76EC73855F08648 +698A8874682F925876622BB57B3C519A59F3E24711226AA219F3734D41204289 +40A62EA0C78773B70B0940121E20F202321AE86980CEDACDD3584E641BA6E3CB +8BA3ECE430B32A1B7A602497377107A93764675346050BF63E41824B16C73D58 +6FBCBC35F05EB9AA91217E2DAEEDB616DC6A8B62E41F12202E5A3CBDE9C76658 +6159BB9D3DC206304AD8300B4E40D6CF4FB681D1FD98977804B9C917193B9DC7 +6FDF9585E296EBE58551E6016DDED6EAA109B8F386E961CE6E3C0D4B0E8217E1 +B5F324C0A61C540ECFA0772F26FA26CBC2D0019D024B1D4E67DF3C21F1D09E74 +2776AD2D06E5F5024E55E100EB613C796EC52558D244001D57E5220CB4349A4B +A4B5FAFC00EC3323D084834CEAE3730A077256E8D7BFD5DCBEBA6EFFB1B50F10 +25681A6856194B5E42693C29763DD6CE71E995FD78794690036A05F429439505 +FF27E0EDB070D54AFD8F99003FEE7754C5A51FB0253C4D08382BD6D99E2BC5EB +AF09200D98BC3C0D5795BEF6DBCBA2BC31AFB675E67502E80BDA76BF7C520559 +FF774FFB9802746D8B7F932CF22952D0DBAF52AAB80DD228D5AECDF01EB4AA81 +8D35C4C87DE01766AAC0B94FF017D1FB98B5E8B92DD39A4F0D8C179B8A570FF1 +26D5B82AB73018CBFC741582CC8640ED5620F44A7F92330A4B0EAFD26E266D78 +0BE06D39CAE86D0F6F5957050C1C9F3CFA3F6DFB0FAB83C4919911D13A06DE67 +2037231FCE95979E0D6135CE0BD22F0A312E367F97E242808D1B540CDB0957E0 +C9E9EC8BF977E5F9EF0D780491F4CF6D918154C0198A993A337F7C705C7202C8 +14E9C6400023B1B9E5DE711E62A2EA33745410F909433680317A9527F7A49558 +BF2EC13D41A6B62507738CF5D96ED0D019BCE8CC8C1B915003C885E577E9E322 +8FC33C243D3E2E53B2723D824056A0A3D391842EE02F4183EB13D9DB0AF30477 +A7149997C3703B54DB3BC461B8757FCE6E6DDA0A3095BC480C533240F2195BCE +A11A391D658208DDB43DD2150B23B308B14BBF10E66264FD8376A676A2131F68 +47C23E71BBBD94F40D2E9C02B97DA9539B2899E12EA8D31475D5FBEDCC438932 +91BD246BA8A04B6EF2DE0B9D1EEC70EE56F6A1523D1338916127737F3A823F43 +73691772A120BE2F2B50F03A630F294A5D2F901CE9E606CF60D25013733FEF97 +9E07105704A43A6BB57C5310991867CAA153CE5DAE7F5BE5F4060048C84D0F08 +0FF06F8E2A836E6271A47FDCC5CB28C134C31C226CCDEB7984D2AC4CCF96CF28 +75C056754DE2C31024680011CD417F8C4BCEBBDD476F799EC075D8A0B79BC94A +23B818735BB27D6F9A5703894DDDBDA028B640CCF8440FDF77FBE9C40C7340BE +9C87E5DB5D4197AB50E27B5D51318A7FB005A4A5CAC18070582B11B6BB5D3A71 +6CEF1ECEC42460592AD42F0A23BABD48285751F8B8D0B6389520891CC3FF07E1 +D7C56540A2DED026F61FB8DC04913278BC9FD625E213A4E49691D02FB419CDEA +A892A2274BD5D5BD4804384D11FF795296250EB51520C394C676FB6258F2A39C +15A9395EBCCC915E3CB41BA1F966C40E0F52AD07CC1D16E1CDBDBF85E25AC2C6 +1C0905EA4CE5B6B0A78243B93CA132BA6AEFF9337A6036E7D0B3CC0020B9F8AA +F6FF770FDCEC7CA593FAC52F0EE1D5CA7013913D675F38FAEA6788CC1C20F5F8 +3B4EB5D4796E424DA8F84466CBEF9BE944622769432DAEABA8EBC965EC0839B6 +B25EEFC3DDAF61412EB3D19B0A49AF323D76F6F346B0A88E0408A23C6FCD367B +DB6C0C765FD3880FAB128A8E493D422769F270D5B1E6A98EA7FE6ED772AD1D46 +A31AB1AD3665170FF472A33DB0206118B933E50BA4D5B18AF821CB107F973A5F +4A3ED72B4551D7439AF92E3A81C8BE23BE5A76DF85E3DCD10BE963E0FFCC68A7 +3C1EBD8440D7CF559F43A0AA17FC4BB5446DEE3B620D55226E0D354A720FFEEF +A7D8E95E9ABDAC0E7989774506459831D69D1458F5AFB8BD4A125DB319019186 +1B4FF221CCC6A11E3FEB6638F76DC070B273841A6D5973087CAD6ECF957952EA +6B9763C126D3B7BA6CB9BA9F842142F09B184722D88B40C1E6898987BB89A207 +2A996043AA7D0F32F9C4B75CB11111FD24921F7499B682FE52EE1275B05D194A +E3D2FB6E1E4E7F3EAB47035D9FDD8642DED15EB1AE1F4875017372684E2821D8 +5BFFE7AD35A168ADB5F328F6F6031B95095A24497383A44CAF6C489D155F19ED +81A660DBA08D80CF8A5920308342E1574C22155C278093F9DEEFBBA182539C8A +506C5D559C8E20AF3E2707B71D9FCDC072B979E862A309819098085B3ABEA821 +28019488060529D826B0B4C872C67D2860351FE0B61DE54384E7504D9DA73F89 +C9740ACCAED87AE6CEBA4389F45BAD24B21B64E375E2FBF4585025744A9CE1D1 +22E9D86D64FB50668E10F63C9251DC00D1FD242CAF20572F2491E574616020B5 +0D21246E5F6547ED37FE82017B4F3F8DDE9EF3D7F005B82255B29F63874FF60F +A5CA6151C5923FFF6D836FED2A5ABE6913CE66B016DC33945FDC810193E8F7C6 +2CAD3F30AF61B6A0CA11F7D32DF64ABAD54FF27B868591F73CF6605CE42EDDF1 +3E5E5418512C93EA7DB4EECD7C8AD635C15843569CCAC9CC379FE10A0E27F605 +C0BE8DDBFFE366F2FB39670D3F85B07BAF32B5FFD11D23425993ED1473B5D222 +4A30C6B3EB38168003E1B19EF245F42EF700F46549EDA4097D769FCBDF6D9E26 +6E40DDF98F68C59880C25D002CE1D348CE9D467B768352A47019F0533A7E5B83 +0F124F85A83E425DAD998A2A40FB7B0FEB2F5DC48190EFAB58F094017B117690 +339306949AAB33A22A1712EB774DDA2E29E8AD67A3674CA69689A497B1CA0BB9 +2B0F5D9DC9D0A91B5B7C21673610EBD552414C6D8F2726F6CF76C0A188A6CC98 +1DD34A7D9B6AE0992270664DE0F6269BE49050A8935DCBBFB33751AA7A77D812 +FB472EB9762CC08E41E786CF69D7ED7FA8DA05E6422D62B31E4EE7E2C1C91C0B +7BB9B59BC678BDEE58EF5A8EE923A71E277FD0C5DBFA6BB746DDDFD809CC1D77 +A2CA7F71FE651429F67FF5F1FD452546DA90B9CA2DD1374561BCAC90AE94CD62 +A3F5C216DD6B0B3DA9B8B256E584460173745124D80E721DB0DC6F3E153E5165 +C58B246BFDD5452DE898113A5EC1D4784DF900D6F33354A533E8AAEDEEBE5924 +F62FC0D2833F99646EEB0F065338D9D0AF4FC72D0889ED33A24D2BE0869E766E +CB72B92CA8F7AF62BBBD0F6E70570EDEEA2C516869B4511AC5C8886FB9F3E715 +E3C7D2864AEA4DECE4EA88FDA367B4BCECA600D7FECA82D5EE4A9D51C3989000 +1EDA7F0792C788E007E8FEE3E84AB24F00DDB0FFB6F7B7D944FE7350177D2B44 +019E02706A9D04C7E50AC798A2DF352A20F32C698B40378F8F8CF83F48034883 +ED2C0296001B8663B18C1F388B7B7268CECE311915BD825BD87979B56FDD395F +4B4FC13E392A7770826C77C9AADE1A4BCB5C0590A97026FA407BEF5B8C7F2EF7 +C311D322E7FC130479EA0A4132CE5935A7E85199C717C8C05CC4601EB72D8D8F +9B0E92C904F225810AFB5299732BF30416E598021574B175D680CD3C619547F0 +AA5E3A854E5AB8E1B0DC311FD7976F9A7318CF52C838BDC485B4F12A2B40D349 +0F23D242B500DDA1DABCA5E4E3D066F9B80286D766A5BB1FC3CA0057CDEEB7CA +0ABE3CBB4E7AC15FAFB0DBEB235DBEAEB87AFAE6FE20AFDFEA6FC41E29923FA1 +1A4B8427235CC16C7ADA4B3A93265AC1016701D6B24DBC00D328F103E089BBAF +0928BA9809B8A698ADB893CBA78F9D50E34BA954775C78C37EE771FC62CCE1EA +F9AAFECB685B0C2FAEE4733732B0B720EEBDF221C8607A95D664A86BBBF3CB15 +62A700CFB53BF7212E29337D275753A1BC2AF6DA563CACD3259036EED578ACC4 +6110C110B9E9BAB541931098CB4D17F836A0C8FD2401E8EEDBBE4EF07777CB16 +88B0BE46DEB2F1FCE5600880E1A3231CA680F2F4C8FDFB4A51EC09DBD50068BF +BEBB664FBE3D6E132260E1B37A2B2BB7627FB64D82FED23686FF5657DE2ED1B1 +6AC52563F42C7E517C8FE63375C8E5B44CE55EC528F43066AA8BEABC4B098600 +6CD2E169C82F1ADDE63A0BB8F691D58D4B55817F8DE9009B6C7327E12DC93295 +614AAF78F75313029F7F2F9AFF5D9CC7E1FDED9AFDDBC0DF135E20A91C8FF43F +2C32A8F08C5EDE73C5486C9EA6C3C32AE32AA6D767DC1B75190F4F11BA9A8507 +F361002225242E831BDDB323DACB1DDFAA5A0ABD64FFEC911B046D284610538C +160F833C51BBA95893F2FB6E98E92B7CC1EA1CF6F3A0DEA5E415A08B60B8C202 +D7ACEA0F435C7EB59BF60D06FAC6877BD5311E59B4B3428641FA08D498DC9852 +735BDE1115C9D819890C73EB0F3B82BAB0325343C6AAB7520FD896069DA96899 +90A3B69CA905B437EC2FAAECFF8FFE87DFFF47FA6BE7B12048FAB3134654E0C5 +E86C8C799D05DED178CE4D4283A6F33F9D07FBAFA4FCAA0600281C5737A1EE8D +D3833AB3C59241AA0F160B75124992C2A50753AD334D01A640C02C78D62567B4 +31E6BAA6AE0AA193BD9BD698B4F36C5EB10C140F52BFB532F8FFA93EC9345866 +C0F730F298EFCF03915C147AA635574C9431B209F882FE6710671F30722DC521 +B57507D10B3FCB4A7235B3245F41603B06FBA3201206ED492F733EA3DD37A819 +6D451EDB89449D5C2C7D2B38EF224B96A74DE35B2E7752032054AB5E01B14E2C +C5FFBDE3D95161ABDCF4372D560A88365923020D6BEB26F46672FBC2382DA394 +79691205600AD10D18649F1C1EB753F02BD22279998C0D2FB9F583AAACFD693D +D84E05298E0E84242B6818EA43680FEAF2BC209EBA676B0891A2547EE2DAAD08 +ECD637C8F30BC8393CDA8D2370D67CF80E3E4F0CAF268E47A7257622F8549EE4 +A2304D4426F968DAD9BB365A9CC334B103025686B1973A4A9BF039CE8AC0D376 +4CCE0D862E947BCACDC915EA5FF846F57A5C3B18E101977B182F888BD7607A91 +673A3DF6292FA9EFAB5AE009AF63B5370FDA54C0C1F7DCC209DB467580B725BD +4FE8E9F825D651022FE1463D5DFCC14E401CBDCCC6EF244924BA0D36E3E11C7C +F4D104E4703B396BC27235CF06F551232E3A6C698B67F270B851925BA4B540AB +DAD8D0F1558D2DB090A4B1585F97BAD7276A500AE71727EDA361CDB811EC940F +539D11D1E727A7B8EA60C8051551BAE9A1CC57E745DAE602F5309A4710213517 +BD9B9F54AE2F4DA818F201E769320688672BCCCDB670BCC2D4728D563CA6C2FD +2DFDF9B137CDF93757256E9A2A0B7BCD3F70BB5C776C70EEAEE80E416E7C618D +9A9B8BA1099CAFC274FDA35CC012D5AAD3C01809BE0AFD825BAD4DC2F734F115 +4C1F2FCB69AEF702B1FF75A73C0719A52B3330ADA43EBAE15392CF818CC5810D +9DAF7E4D56FCF3B82185AEEA3C5CBD01583B21B99DDCE0B63914325D8CF20ACB +1A4041E18506C22124CF2581D58558BEC745190BC8529B1225D16887104CE75F +724879DA4B6D1CF5835700EAC21A90B068387AB3E705C35FC2385A4C993290AE +8C063922187BFA95BE99BB81E9A9DA21106186D4B78EBE6FF7A56759AB3D2400 +BDA921AE38B7F0F22FB58F53E4200B901A6C926C2945BBAC541E9D7855A2B825 +59D4BDF8AD1E12CF1A5146805CFB1A71E0F1DC295F84F62462C332942DB6AD92 +F4F0FB373305B69A3737FBF8B62086B10B76E3C9CBD6B7E0EFAAF1348A128014 +9A38B149AC4125DA88EDBF955879B2764AE0452003E8029E39064966EFAD8497 +904AB7C1A4EC2AA8CB71C2741083C4B08A76EA6F19AAA58DA71BFEA9F1251488 +EEF12D35975DBFFF8DEA39B5049BC6093E0BA8211ABF9369E2AB76DE50E3C9B7 +82C8916CF599769F9F290D831ECFB86D88AB5FF6FB34099C82C6143DFB34BF77 +63C38ABA7107095B81B4A66E58B63DC10872C29F6B6C37385C2BA7F880006B91 +9AF6E1E6559AA076485AB2BE27211C3C3B534BFD625645B6EF04EBF823F0CB12 +B9B8883809BC1067E5B53289EC035D6B16BEBBDDE57C819173507330E9C60EE8 +CD0A5E38667CA5C60AF5451CB00AFDB7676A18EBEFB1DE9290B1F240C4DA7164 +869A440CBBE09F7CA08A1230175FEA1A7756E5D7CB636D19D6A0389BD0A1B129 +574C392F25A529347D5D99E33373882B874D6434AE6816D1F54127922E47CA43 +213E1773595E6B41D90946809A6CDAFC2322D19DBD36A42A357D79B86C7B9024 +66C1C00596D5E85EA99AA922457ABC99D6089A29FC675C61AEBEB8D1E2A3FEA0 +0BBA860D9217B53DEF98DA9421E8581BDBB8E7DE81B84CE43D4F1BDCF93CD9AA +C422EE69856B83136A9E851066565566B1876D89DE99F15FC934CB73A7AFA304 +9088ADE91D33B1558E81F5B77686ABE49A5F8968512B4DE8314F4FF00ED8CD0B +0BA1872AD7D8CD9FED4B52F3C9879B6CA358B7C9C14FC618A709030E0716E4DD +F9D7A156E3EF0EEA375EC183466FB8FB1732BE7F73D372B57A0CCB18705D1291 +BC36A788F44600314956400CC685587CD93CEFCF516315DCDC67BAC56E0E4879 +48E246682DA609FC7E19FF8674769438C05443A9E109DF9B563721AD8F8B6A47 +FCD8E35C26F212B1D7C14179C5D19CB5F25EEEB9F25E5E2C596CEB4CB6004ED9 +28E3650BD7E5B58A2DC9DE664472FFBBF6545E727BC547B98E5F92B61974D86E +3B34DC2538188EFA10CE7D84C5B2986A877FB3947A5A0C7964131BCB9CDE7768 +9C85C1F7EB4E70A4FD85511F97B98D57A1C10C49C0ACF1BB698BFDABB77EA7F1 +12EF2517CDEBA6AF4579E91C4C6266026A00B95463C453BF26ACB1A642EBE747 +C8C49C384435DBD76D7E76AEE899AE225801D774302AA9F2D070522095CD19D5 +B03A5224BD26605C5C47810B7B8EA8021DF68C34D995196969F4CED6B2270FEA +D3BCB93379249412B8A85AEF07EC532870FD72E532C093FE3459DCA4D718DC49 +C78BBDA3E4E04EE20CCD0EEB7A2C46CF404CEDA25C7E102BC31B1DD07FC2743F +4A926AECE153DB7B0B5076C60227FE0FDD149D669625D69AA168DDBEF5124AAA +FE4AB137BFB7192B0EB7685691E64E5495273892D7A5611095445A061BFA6C8E +8D54AE2E5CD612B0170D70561D858405F1D83F3D2AC2A64EB623055ED454C770 +216FCDA30F57234C5DBAC85A00EAD3544420D816A22B36E70751262D2E5846A3 +5280D68B9D18E032AF621EC32AC3F5569B595D99B8B92D42BB7EA067FDB4CE59 +229C7B62FC08F19E826A149CD092395B076DBEE5A8701B07EF7622AD4242CB7A +AEE2BAED03378CE11EF4912DDEBA09F12F688CB0E3ABC8FB65DE907B1CDAAD62 +DAF864052FC34D275099ECCF40C6B49FA35BFD75328971066BCDC80F62A15C05 +B2C74800A609614B2DCCB81E0CED76B9F12DEC69E0A0047782BA94C288878077 +6AF4D11C182B24A31BF0976CC6F5F7D193E4EC51662901ED14ADD7DA6112D7D4 +BB1159A36FB16B69AF531757FD8C342122F7EBA54E37B48C6DAFB92FC155328B +F476F91C574406FF84FD033D9E8592AEA0559A41DA2C80C310954CA99709EF05 +4E6D19C0D271C2C8FF33B3AD8EC86C08C5E3327C898062DDDCFC5ECAA8B99192 +63916FB3130967C5336051C9EAA12965E00EEC5E06948CFC76EA7569F62E917F +6961306D4C7E11FA25CDDDA77311C76198F23FFDB0D896D7CD87B1E7EF62605F +7DA05406EA15B76A6CCD2B44482320942EF0AFE71008CD0FB00A20EA93FFDB30 +CE7C083F7ECC120620901392911F0260AC22C4B5CB0F99AE3899ABA5ABFA731B +1ACC72D6AB20FA0854E26B3A2B1EB430FD26DC0529E12CD2E9B0ACF363CD62E6 +ABD71A25F90C63221F610DCB345953A3D7298D8349A3CA3B4C68190C4D7D0FC7 +E1DF632F358987036E507CECF9B6288F99C7C9DDB26D04F76173FD7EBD4EA2BC +EB7F45300282249B72ECCE0F0FAAFF243A83340253BA0CE6018C529C9B5C342F +D92E96705281952147F134E0835A5CF8B332F3DDC103EBAA2511F566630C3DA0 +94C8056F38AC21F54492D6422849D220FF7737E7017FDD41BDE1D0BBE8430C8E +225EA7DE27D3A07344822F8322CA2E85D95252517314B14B69EB6AD8A63ED9B0 +19D4E4E8424163870FFA1B43C76F8A78CA692A0D6D27D8CA302CA546383F3A07 +916B1E5CFD82055B90BED150098C5B7DED63749A5F225F72EC1B49398683A011 +850319F9A1207BFA7AABD4ECEBC4F2BBEA02CBC4B395418458FD1DF1C1571012 +71226693569C263137A05FF844202E698FC51C3EA44D4A1F2FFDB41633DAD991 +E00CF949E43CADCE75EEEB90185D58A8F5B952CB2DF3BEAA13E30AFC4A6E07F7 +21CEC8AE855B9FFAA554FCE973AD12331B94A3DF7E7E20218D3DAFDAA64045E5 +C7F1A5D5966FE289EB3772B5CA678BDBF64F529C275AF22F51B01C6F9B79C733 +88A6837331D8C3481C5DD52666A072465F9D2BCAB7ADC8653A8FB0258A251F53 +F4F29E0AD8201F5E201AB63DCAB93AFE5AD73166A3FE1CAF8473EE2767CB5474 +0A87820AB767D84DD5F64AA00AD42B565354B5A6C07E23CE618C085A1654C606 +2AA5CFFA99BB1ADB845C5F1796F107F4F78F15B750163A64A792FEAB051F00A3 +EC652C43F9F4290A2B58B234E559F7E564339D9F6958BC6A1229D4ECB29B5BC4 +4F657670039936DC92FFC160415A9A96BF01A2975103C001DE902E56B437A360 +5DAF980BAE42B1CF0E68EFFF2899CC6F566AEEDB7F0FA2F7C44A9614B15C96E4 +E8E26A3C090F9176864F74243424BD9FE758FE08F4B34D3D0DFD875EAB3FACC5 +B6A9C69A80FBA2C62553EC5A57445D0D3BC2DDDB6BBA637B95C25A63BC763C43 +C28F1EACDA48212A299D4F86FBF34DDE0CF5EF657F7F142A5AAAFB7EBAA3CAFE +CEBC71557E545DEBB80488909079CCAEB67C776A2FB6BA55D451E959DE67269A +09DCB5EC644EE877ACBEDE4312101CD36E4B80C93101D2372A6D05D0CAC960F5 +17869C88C1A487035866CBA895848BA2162E9B50CE6BAE31D11DDB0C7FBE4043 +5C57469404054EACA6EFB3B24A55199809998A3127DC8550FB9B3B0285C7FA7C +FD422E3AA4E578D6210B7423194A676C002706A7D3BC4D995900AB6556C492DA +14E8B4BE322AE2E3C9B744DE9C045D9B6A45473ACB4695BCE76BD2A05A5B7765 +840AF067AB2E3E74E58C40358C0070B87CC97A8C1C03E3E2AAABE323B97327EE +D99FE8509C51BAD987EE53498C1BF2307868898E217143812EE2A68E80719F47 +62E99A2FCCC56273CC4BBAE95BA15B96F8DC21AE33D695F7528390350F4C7AC0 +F2188948C926203A18F1C6533ED3F156C3E6873E74BD369D1CD222C545D8310E +163BBB9D6C8AC4F4DB68DFC969DDB7DABB4F1355F699EDB5693BDB69CC364436 +D54754FA1EDA7DAAEFD936C5AEEB004D73E428DC58D5C88314093BC194CB99CA +6CD303D23C907CC9C7337EA972917E4A824916FA4E243430251B9EB5E40FBD2F +D0913BDD933520D8222A2EC00E65743EBFCB25D83AA818FACB1EC130E5EE98E3 +C21F638F8BEA10CBADA5CADAF628ADBC6867B932811C460A9CDB090A55BFD546 +447E45E523439E55F3BEFBFBF3F6DFDB99CDF136C4C14B959B96ED152EAFD0EB +5B3A258860DF03901FF004F808385D352756AD70C2D967C47027D8A3C0A06A48 +2AE98B9A2D831BD3A750E693F69827D78B0B3EC8BC272D00B7DF5F69979F96B2 +1FCD30D809084EC17A11DF54644AD2388FB29E287B403C4E3ED73D14E8DF9BDB +0613B7A93BB9D24D30082DCAE0D18FBA22CBCC0CBC739516B591F0A276F26CF8 +9F98B45293806C63024EB4D9A21B1692A882E04150BE8D77FA5CA263DFB40A92 +DA23A9D968223BBE74931F20E9EB59F44C18808178C70B0FDFD88218E8B37C40 +A9CD39DE29E876EDA4D4DF0779273E90E05748F34054D891C676999DB0FCC23E +74E1E45CA2B4DA72AD6FE718739A173A7F2FD9DF7E530216CF2706A876AB9644 +BAA1A247E8BC77588337697F06FFE83B44C8C12B0A47EED53B8F53B7EA4924A8 +5B2AF250D1187A387C8CD33AEE21C585054E5E4F39BBA2A26BCF6006D3D9C856 +44873EE53F1ABB3F8713AF0E6A118C28BD3BDCACE2D58B7EBF3398EF48626B27 +86C840B2DAF6CE25378A894D8B5274C56F45AB77FEE98AA2FD5F697870C3BA62 +9C52FF6002722C36329CDDDAEA65E2D150863E237AD7B7071208B28A4DFD6DF0 +A62DC84C9C40276BF2CDA8BA7718971EC4DC11D6FBD5FC1FB19F497A4BB7C796 +66C4B622A1704D47392B82EA5335E04598C2BFFBD1ABFE2B1EC0F937A206A8BA +34DA088D35760B72F93828CAB41E43FF83BD7F49DC1A07552EF7DA4312C57D49 +883710255AEB417978092B416F90644F7BF5FCFEDAB36B28CD9C0DA1EC4A06F6 +3E34AE0754322FEC01B4FB4A81670ABB5CEE1A7C8A6745F9098DC4A4DA2DECAD +EFE2BE8BF49118A6C9964820829B0B1EC8CA6E0928BD7931139710E47398A4C9 +29978CBDEDE23EF300A179E1099B357903979EE55EF779F58AA19150E1A40C8E +42086D26EAF6BA06B8D789CBA3DD1A2C2A6FCF650E2532F7F3163DC19F1AADA9 +F985871397B41881A15312D1E3F6761054D843CF748D1F24E11B78182B473B7A +0C6B62EE52A2E317C15D715121DB08BB7C87583004B390ECBC575753C299BBAF +00EE6556444AC369E6BD2F92F8A280EF975A1DBE4B6875551A7A816DAD922BD1 +DFDE2583ACB47B0B53D2AACAAA1A8E5B063301E5A6EC6E71A1645B3929F036FB +2DBB1B53CE8EBB57846A989FDE37E61413D34178A49CFC4384D128DD959DAA36 +D066E70EAA80587EB49F9BEDC5BD3FBF7CA8B5BCA0812CBB1F02E122E578FA99 +512BDCB987B747B18A6653464FA664A1474B189DE8D4A0B4AD6F9163AFCB8797 +E27773DE6C2F5576A92C4E4602F2BF09F0A1563DF0FC25D75031D4BC03F19B4A +36D3C06E8F194CFB347E6A1A6B88D65D48D0863D296E2C78AAB35954BAFB50C6 +9D74AD0820BB68EDCC21BF6265E205483C5FE975AF38A41B333DD1B47FB60F98 +9AADCFD1E6EFE4C828A907EABE50D83688DB15D31F938C26CD42D3FC0058ACB0 +49D51BD3223C2185590F9F2224C1AE45152FF3B4CAABB1D95765C6A2689F4858 +E843B03DF8C5A2F43C998CEC23E3AF2185DCC31DE6E4701AEDE8AA97262EC0BD +94E4E0723358430E46A47DB940A686AF71E2F6411A45D19DE889B9100F4172CE +2C79359820A018CAF9DD87A809C7765AD22C414A1CA599CE18217C3458729099 +DE1A5D4BEB7479BBB87E9C2DCC57CB187FDC9A9ED5F8398522639BD02BF782F7 +22BF58053BCCD4790E98D8BDA345DD3B9D69922F057DE5C54B93932C1994C2AD +48C395A52FE6CD5AD7673FB3C9FC0017976A08F304A8E7D4A22BFE4852669923 +AAF550E330ED9C4878855079F947A865EF4D78E963836158F3CA9F2179BE7B38 +782D60984F44002A37424AECD0071E206B6BF255F8F7AF86AC139364E86CE5F2 +2367E58FA6816C49E10BDA1EF5E22BE8E6AA07C8DB0ADF64E91B87427B69FA3D +816C190439A0CD836E53D32304081AE55DECD4FE2F62A404ABCC03EDD35F0A96 +E93B35F08EC20162E6E76F61A23DDCD69D28C2795CB9024C580166C4D42521FF +9B75045439DECAD65913CB73C11FDED54D1827BC9410195255B9657218665291 +7E28C4B9E49424FF954A0377F66DE8EC925A951A615CEEAF18E5652706A71EDC +167CBD53EFD21D2BD6DA3CCAC6D1A7DBBA961F1D9698D11BC389323373BC8E4A +791EB85460DBCF21B697E84AE685454021E9B25B977DC7F15269B15877BA10B2 +DC2EC65BA009DDB335242ECD48B7E0807750CC611A5C864C0B918DBB1E74C748 +A721FC2D5AD4548C321BCC73B01005B5EE3C4455CBBEA258AA35AB211B29402D +9DB5E7C4E80A09503491549F30BCBA30C96A1E736E510616412B7B6342A18E17 +777B32973B62296B60B05EC092172F6F9DAF46E38F2A7D1230DDDBB7FADCF955 +66DB050F2AC4409CF6CD9274F586E96B8D5EDD9FAD1D0145BCBA5397BA7ADEA0 +D15663BE3D10513F8600FE55BD85F0ECC05AA746B75BF95D59584DF153EF00A4 +226B95CC841F5B2EA24F345D87BA59C2E50930044135F3CC6784F551E6B92A5D +E84B174EAA46B1CF816CD51298D3AC5AEA723D3A1C1883546956BB1C18CAEB77 +C40B76A47114CAFE0ED066BD91633F0F90A4D07127F8C9E412FC9A9C2041AA67 +8F78ECF3955D97FD9072661B17E135C89467AD2E8CF470474154FF66CB481B5F +FF43E69BBBDD74D0A248C636953E48B8F2C34A082094C39DC9495FEB570B0603 +78DB4C622F31347C29B7F4F96019FB2822AE4DD803745E3C391BBEE32DC23CFF +8AA10A64A1FE942F35D6FA3767B48196FFFD75953FB2832E1F65864BA31E745A +9E4EE99646C234ED9E20BFC1EB52C595D02C6C42ECAF9BF7DB20762980FD733C +7E1D3B52CFB232D750AF6E1BA7C0830C2FF62FA0E148F95DABE38BC2E01D3018 +A2BC04891485E74C646662C144016680D0984B2E852407994A897CC2D64C14E4 +3B50DB3EC7FAE5826A5F376BE48A732B8FC2FD629565A5463F525372BDE229F1 +1084C2C11C56DBD580E43731402ECFE28BC143AEA240D5E80510AA6C2F405FF0 +7CF5E4E08C89AE19498714E160C191EE872130E01AA7F6A9AE909ED32499539B +71E21626BF15D9A084FC4442AFDA60D8880076579765FBB57326A62B0C4CE72E +A246EFDDCBAFD84BF3A7219D9A34F2188DBFBF3D4702550E82DC3208B6721972 +8C5ADA0E27010F3C260FDE91818E174ECE94050457EE9F9CB567E823B37BA473 +789C9C4891AF5024286EE44CAE8927C817AC0FE97C0807BEBE9A9038C8CD6CA9 +D4D8119315684D47CD3AB5866D51CB184F41DC3B37E0DF288E8B0A640C82EC99 +8A82FB80EA38286422D913AEFC979EF739319C14F7358D67D6927DAF090BF54F +D4E710B5836B7C434F53CE33811078F5DEE653537B6BA77EE2A3B21C46C4EDC4 +637B703271E2D99C4779AF43A6726023A1E12761D201AC8310F78A2A2C72B733 +FE8282B4237A5D179565D91C1D4AAFC2EB4134CFA0D7D53312E5FD3E32FCA7D5 +21641FB3089FE5D2022B7B28C21D45ADCA15FD36825DB45209259CBA6D685A3F +A7E81682D8991EC7CCD548D7F919B5FF2B967974D3B51589B22BB3D18B35C343 +B8EE8D12DDBF1264A691B3F7E2CA7F9505CAB382B9FF7FAD33716417434D35DC +292DF580DE8643986E6F28B901D2A995D9D15A5B940DE41773D783B55D0B8803 +172CC3C11E1AF7F1EA37A060272494D947F561F48F9187AC00D21D6F631CD66E +EE1442530D83617349B6B94B1BDEC87145B9C3C3C5CE678AE80C747F33C9C17F +4618F74BA7ED5654BAF80E58C4EAB8E13129419B82F9EF28D7319ABCDFA4A2B7 +99B4EA63D7578DCE142D36A2046212CDD125B827B006CA4021D1DB95229EED8E +86F019AC46C8446B9081E1AA9E8D93BF6EDDCE85491BCAC7008CDBFF78D22445 +C1EE36DD63CEE245E8399B9B29E28E070B913A777D52163270A0F8F1B25698AE +3285B374F5F6626ACEBEF23D3036F7E0436B83C2D3BFF396787C97D207B43276 +98D24B1756CDCFCEADB776655BF3B168D1196F85ADE7E5BB9D476EEDAC887521 +E0ED4FCAE086B8079607DEB9F48C72D3800C898F853725971BB8C55D885DAB3D +AF1F61AE2B78AEB40B57AB05DB85CD83A9B2B06E8383AF39FB99EC4EF5E92016 +5AC282E09EF816134645CD61E2ACD2D28B74CBB216312411EB8803A4ADAC4B24 +B9923455CF09BE1B82143E8F4619BE05CF8B9128FA7606D47425353A65156E28 +F973441A0C0A1193C90D9F21125783D7B4BF5E081C8F1A1B20B95FE8AB15F5B8 +C4C65D36434DBAC53BCCB8DCCC36EE954E74F2EBA8589B5A7389ECDC9268FD3E +4E2F73EB27E7D02917CC9D4DEC989DFC487C42616268476B6E173B05DFE13EB7 +E3AF75A0A5F96ED845053DD6841BBADDA5BDEC78B633F0EA0B356670B4ACF8E1 +CCB807FC61B10E357E84DB435C29178EAB5C89DA28C552145DBD31184B7D45CF +99A5928914089EC6EEC83D3541D665B10EDA33F52B2780B866A5014EAF6BC778 +6B745F622247BEA874A5493B53B0F9C8D732D64FB6112ED79C9E0B9E930B3572 +B95AC29D8DA0C2E14FFB0EE6381C0AF772054CB416E6ED333AC6DA1223BE4366 +E36AEC27458F290ED609B2F26302B6540BD0C84DE4F53786972C8FAF3AC3EDF0 +51E1197F1B7739CA4C8A76FF280DE76D290034C2AD5DF4F7FAEEE81B3F3AC162 +7DCB0118133ACFEC07929E44DD805DC7254746DB504300ED0884A0FE10CED5E0 +6153F68489B5B9C4FF3574560FCA81CF98DF0213C8B88A1577565FF110B3D3FB +4721707ACC1E45E4755CE64094514C8267BE9E8EC6E0E875416040323469EF82 +2D8EE7660596A3A90F1F357AFAF5C5C0EA57AB5AAFE15CBB12C2135F1A43559F +24EED8F24B9397C19F366043391604ECD8FD90EF651596B234307338E01469BF +F4CFDEFF1FCB6BDA4197981957E69B5BD7F5B34539A97ACA5FAABD428D3D0CE9 +F57C12DC210BC7894E86272850DCBF42224D98A53D268FFA73B7A2794D19F838 +74A177070420C50FC71C61B2760023B71BF317178D018695BD74278F722F2326 +DC988323290A1CECC34458C3A3BD5C2B6D5B95D16A0801D0D8E24E09B7ED7483 +DC079B05CC9F0D74CD2AE7C16E1D24689A53EB0FF380CD72B1A8EA2CFCADFECC +6E160A074A4B9CF77F1155091AD7D4CD040BAFC296169E62EBF22A31C8799270 +52A896FF7B570DB0B3BD00AC1D544B83A5566C24B1AA378BF830139EA95ABC1B +5CC3AB7BA70C25D13E14012C2BA4C6A5EB6CBF6580C629A7592A3C2F8232CE28 +71FCD9B12A3059571ECD75DA09B14F30D85496DF78B40305469134302C1E03B9 +26B10CE5FB201F7156C5655B94930DE277BA98D3EDDA925FC2A4D4A667C4B7ED +4CE368F5D922272B1DF626693A0EDAF8F0B7F9DC2B495460922D9B0C26F91C7E +D0E3670A684D1138098278B1A73E2B2884BE990B3C9378FCD18CE6ACC373E732 +2CEDE329B9B331FE485FEF959C10B1C174FC916E4FD9ED1E456328B313082DC0 +15AAD3216ABA02BA6AB181A8158015B8187CA6C46B8FBF54860734A638AA833E +D71C61A408101EDD4290FB662A5B3442037567F6251712E9D143EE768635D05B +9D5880EF5F9F22E4F12811338B2AACEE06571BC38521BD8CF00579285F5B7F11 +24A10CA0F291B9E9505DE45DEAEB631BBC382AC35F6301E6B61141746B83AF3E +96779CA75EE681FC34E21C45D9BB2C2844CDE5785C2FC15BFC8ACEF5DB6F5F76 +34DD5821DABC85F976C83E07C4013B8151593B29EDFFCCD3E98444CCE1EB5FC3 +CB8014317EFBB9EA7F107E909AABE10650924BA73185EFEEBC97998FCA0E2B34 +1DBB2935DD1F23173D9DF75D2F2169348B35F0E716DD4E48E2AC8CDF3F6E79DE +8322F9A14792FD62A5C19255E2B5EFB9E35835339E3D60E1D7511D39099A8819 +94267197986F4D8B240312988ED8689E0529A1802520BC0BFF609D92EC95A923 +1D85ACE06503D1A6ED2D8DF8E5AE31966FEA136FB13C54D71E7DB6C82D7263DE +921EE8F33117236CB935B769A854AF74C73805CE05CFB989F2E8279A52149E06 +3B380C5ED496F852F10893FA1A52CBED190C4B939C557219DF94B27A23DFD996 +FEC06573BCC6E8647BDBB4A2F9C08951A5CA2A21958C9918703B053922E1BECE +F194E062490477C2D779916C3C8E673191E772F99F44BA018CE279D8EDE3A287 +92BEBC3087D83F94681BE89387C846C64E58E8E249346BE5A6257529AC898B09 +6E9766C46CB3829F1EE51AC766648270A8AC4502D4979837665CE04AE6825791 +EF6C45BE6D1FB3606A8E87C9F313F5E6AA8E79EFB3685ACF49689EB83AB9AAEF +F72D52F4FF005FE2ACD7BF11F3C2330F18F99ED227321617666A72A9829F929C +EBDF212A2153631E5E267C2A17E4D7462A9F54D6D93C0264D53963B3429C6007 +6E6536228C0467ED73B8A5D56C84E11CC77E5278063BF01CBCE4B4BC2D7FC2B3 +F03A5469B868A1298AA9CF4FE60D0FF3C9AB77855B56BC32614B61571B6E1267 +C4029FC045A3A0D6639A8E85E76509AE3CD7ED65356E64F77C418E339727F6C3 +346B934B5512E2CD8F47FAC3BFEEE49BB1A3EDDC541AED28ADFBA62705A060E5 +2209DEB801BB6686BF201095D983CF7D2071977677B86BBAF28490A1B34447DC +05DD594FC1951ABA54385BDD5C6C5014AE671B124A21F41702587CFE3888641F +3DB7FB7C6D49CE0E7A30131A39F32CF4D5290EAB977A53795C8A9C329415A804 +47935A081381ED1BA419CB9F3775A0FAEFA5AD8FD19F9B03EDE298597EE492F1 +2BCF58C559FCBA11B3E1C02A922180E63F677E16A4B21F498BED3D5F1214101E +63CFB32AB0214194BACF63680CA9E531A171879354A1A8DE7B69ACBB00D0FC7B +8B746C4B214ADEAAF7B10CD0FC4237E25147C62BF807BA541FBF20A743256F10 +753536BE3D63266E6E169D94CAD416CF33E2D8DFD72F543BDD4199C4CC6E6DBC +2F4331761492FFE0BA24C672ED1CD740949E8867EA0361B39CD10B929FF46D11 +B1D344A9F606B01272945283B438B1E2CBD1B4994D0144E018EA9C0C85199DA3 +E47647EE1EC28158C8E4E8BABEAC3A0BCD0EB8BF796045FFF51DB3ACEF7E6A67 +C2AC0D1F706060F729791470F5E8F2A16102247A5149E090F91A8F109234AA44 +4690F51357B91A989298E8E57481F30C5540171F238160402AA3945E564C4964 +DA9295C84E6D91462A9E6230D379A9AA22EACFE7B1BF3BFA9F5042F211E9A7AE +7BF5CBADD7064DF23655A43849BD036F4412A20D773A10DC344C6DE979B11213 +5BD222B9132AD8C446F4D96D4A9DD1D5965E5E2A1303E1863DD5CA72F0FCE3B0 +C55EAD9479C3B76F059D10CBE3F5A2D0681E4E0FE1F32F8F679AE539BC493776 +CB92FFAD8FB5B434CE801A068C090FB0DEB681A478A5323EAC3E572A436DDB59 +6FB812BD36F4CDA86356A4E70D701A220A377E60B686BB83DD1379B5C51DC2EE +371709A481A73484AD764DC0323BDE83C01153905F271C5CE8E40B511C38B41A +ACD8C463A4FACD56DC47CF4E39E984D976AB4692109535863C134C022D354233 +81426B0303BC3EF562B298A35C08180A934050565D5EDBC4FD218EC5CA258123 +2D889A632859102DF00C38AD1132B7CE2935F7C6D7714172275313A3F61D57F7 +0A03277EE2EE195D07F7A6BC62B31B6A44E058B71B176C99324FAEA818389940 +1E371849C0E4AECFB4839DCFBB55908CAEA7B708DA103B5769310D93189CCB2B +156349F522A08D2CF18B6E89A4D32D69CC4870026110D4BDFC835AF8E29759E7 +A1A50DBACF09E533CF65B3563DFEE71F6B4FCEAC2DD7FB9E19E23E0D52559349 +03BACBCFB2A399399CAA19B4361B325FF759B58A008E001B89E531C6FC7C6F13 +671FEE6A5A606E8B477F377DB2BF46C4FCC75ADB06D2FD4575840DAEFBB62305 +99D188FAFE4592C8DE6991B57B703932C112C88DACED3D035C728C8F4823567F +55D09A3B98D8FAE8771D6D1A7BA159CF4B2556FA4ED8C6CE9F72C1ABAF2F7384 +609E55CBDA027F4E92818449B7E3EB9D9C00C45331ACBF75A52143FDA65CF7A5 +E096784CFFE90141E4F399466C2B05EC9B3258F2F520E19DD3DF4EC01A749A0C +822ED605BDD874D981DD5035861410370A7A274F1CDE60A17D515B26497148DE +452E94FDB10C6A4EBD9B8C3350BFC35AAD342FBADFA9EF5F45AB94E123B36F66 +982EA714574E9B5444E886A088E1AD8B7D63D83130A3FFE59BE180BEA4EEFA7F +BE8FE639163BD3821EA17CC112CACB5E00C84971D45A8C3693906BB7919FB462 +3020C4BD5466B92BA6FE65976D58DA18EBDD98116FC1134525236C6408977728 +0DB9743689B8F79AF73D67B9BF839D8657924323877017E0CCB0291B9C4A0505 +5899D6AB45FFD198F58F3BAB9BB971CEC189256DC896EA4813E99894493CEB7A +A43AA8A45E491370822FC3C645D3C89C4536031D01C4E743D4D8E175E01B963F +FA5D564840F6C4B668DE88DF1F4825A236864A034D01A2229A3C196C41E2CB8F +2214EAEF962F6F411791A9062325E1C31A4E162188816ECDB607BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +%%BeginFont: CMTI12 +%!PS-AdobeFont-1.0: CMTI12 003.002 +%%Title: CMTI12 +%Version: 003.002 +%%CreationDate: Mon Jul 13 16:17:00 2009 +%%Creator: David M. Jones +%Copyright: Copyright (c) 1997, 2009 American Mathematical Society +%Copyright: (<http://www.ams.org>), with Reserved Font Name CMTI12. +% This Font Software is licensed under the SIL Open Font License, Version 1.1. +% This license is in the accompanying file OFL.txt, and is also +% available with a FAQ at: http://scripts.sil.org/OFL. +%%EndComments +FontDirectory/CMTI12 known{/CMTI12 findfont dup/UniqueID known{dup +/UniqueID get 5000829 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +11 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def +/FontName /CMTI12 def +/FontBBox {-36 -251 1103 750 }readonly def +/UniqueID 5000829 def +/PaintType 0 def +/FontInfo 9 dict dup begin +/version (003.002) readonly def +/Notice (Copyright \050c\051 1997, 2009 American Mathematical Society \050<http://www.ams.org>\051, with Reserved Font Name CMTI12.) readonly def +/FullName (CMTI12) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle -14.04 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 44 /comma put +dup 69 /E put +dup 71 /G put +dup 76 /L put +dup 82 /R put +dup 84 /T put +dup 87 /W put +dup 97 /a put +dup 98 /b put +dup 101 /e put +dup 103 /g put +dup 104 /h put +dup 105 /i put +dup 106 /j put +dup 107 /k put +dup 108 /l put +dup 109 /m put +dup 110 /n put +dup 111 /o put +dup 112 /p put +dup 114 /r put +dup 115 /s put +dup 116 /t put +dup 117 /u put +dup 118 /v put +dup 119 /w put +readonly def +currentdict end +currentfile eexec +D9D66F633B846AB284BCF8B0411B772DE5CE32340DC6F28AF40857E4451976E7 +5182433CF9F333A38BD841C0D4E68BF9E012EB32A8FFB76B5816306B5EDF7C99 +8B3A16D9B4BC056662E32C7CD0123DFAEB734C7532E64BBFBF5A60336E646716 +EFB852C877F440D329172C71F1E5D59CE9473C26B8AEF7AD68EF0727B6EC2E0C +02CE8D8B07183838330C0284BD419CBDAE42B141D3D4BE492473F240CEED931D +46E9F999C5CB3235E2C6DAAA2C0169E1991BEAEA0D704BF49CEA3E98E8C2361A +4B60D020D325E4C2450F3BCF59223103D20DB6943DE1B57C5E0311AE44B83C3E +4FBCDB0B74ABB18FDD877252FD3501E05E597A77D142BED9940318B98D508672 +4ECF79C43A857674E4DCF2556325CA8CC1C432E54543F706987376A084BF512F +0E4C517917FB1D607C83E479DD094240C3F309A57561CDF8496722F1D3EBF6FA +45CD3D7D810E2C07D39BFE08C0A25FD568DD37C2D182E5D30A7B2855BAD24559 +D455B29B1F723BE1C4F827D72B1156DC2C1EEA76C9B27733FBB23ED36F61919B +4A6E8253C8C05F3D4BDC64B99B8494F7C37E9C19DB6A9CA8E9B0F9E7E3346EE0 +EF416016CEE932E53A26599DD8CD09D77DF591A9D532AAD3E321CDCB28636809 +E61D9EC969F2E27190A475407B90211902429778103D18665A681B0DD51F6E92 +58D1288E2AB3FAEF05854938FEFFD3B4F376AAD303ECD28B23649E5D4C3CB85A +5C9CDCD1853BBF3282BCB5CF57720C6CF7AE468048D7AE5BCD2F15DEC1B33B5F +9917BF69BB64261CF101BB47A09E47D6508250374D00ACEC3E3FE8C5330AD9DB +9D9F60CC170F2FD6DEA12DA24CEA846E25ED6683A213E4FFD0BA239894C920B0 +EFF562ED994A7A46F8EE2AF98F88317E513A06AB82A629979AAD3ACE316E7074 +01EAD920A9E1D54E8FBD623773429C58A2964B498990E8420E5F7A45B3D4342C +1AC109FA67D4BF33C9D1E0E2973BB8B2495DDF5A7F8E306A0C712BD7A7FC98C7 +44B26D102D3CD44A320FE89CBA6B3AB39627DA4679A5BB7C27276B34ED66260F +DEB659189A797BC41D05323454CA4600A6D840CA3C1DC31BB7FEE8DE367B8177 +3F1546C9EA98FA9F7CD61F177CEC2950526D54A6E7A0038F2B20609E7BE31EFB +51FDB6829852937071FEAAA3A0E51E625D7FBF2F7C224467C7DB77F7AFE006A5 +418CF691841AB7A9923506845BFE066769A01A51EA48840E898FC6FF0ED9C2A6 +1DB61E8840029ED92A129D38CAFAD4084B17679A84A262D2F9376363D4B5E46B +1C94302E5CD24CBE93A27319A8F79138414B2E94CE6F78C6F06B544D5862C2C6 +297EFE524BBEF0CC2C32F63CDCE433E19B52BF0C2C7064E3ACD429E2466BB85A +ED82C6EDC8AF5D75855B43A61504128F75C2DAF7F5C4405BE36C136CB809DF31 +A40E0DEE80C10F6E6442CDCEDEF8DD0C01FB2C035A1D136693D366552862A421 +81A290080EB8A3C5160FC2CD760A69F8254E8B0EC8E7280EC33802EC2668C149 +73CADCFBD4E56A1E7A9CDA3F6A50E00AA536B02B4BBF4CE60B7A791098C3E434 +B5A7F17D6E461FEE23C6C8C148C54D14345DECB7A619E56268131F65F86C51B0 +E45860D46A1A798134AB3283BC8B73D9B39EC5D0C1241A85AA46B02E51DE6433 +60BEAC76351AB35D8DBFD60C6F12F8B32E08C671E0269174E1E142E687B1C558 +5668FDA480255261DC29288FF5ED56B50DD8512BD4948F31F14C71CB4F8FEFEC +DD8E4F4EBE9C28312640334BE454634EF26B5FD02A93210D487AA4F3AF284479 +303995AD31F4A6DD2C2DCDED3380D50EA1D8743A3C6561CBF4DE91634374DE87 +FED0CF17C73B49060648AC6AF2921D19FFE1B7C7E76AA84600078A0160160D5B +BFAA2007AE70640698BBBFEBFA5C11F351610023F563840413AF6934156D93B6 +551069D681492EE73D480D648503801A921E37868B4ABBB013B628772DAC3683 +3E44C318352E7700094ED0FF624AE560D2A783343B266FB925AE0D990B65F8E4 +7A9725F23F0A08EFA08F81616A5D51E5EC31CD1BA229A89AB63ED782A6D716C7 +1F00BA66A3158CDEAE3399653D7A29193760AD92F65C066A4DF35F91BDE771B1 +74E17E4879428B5692343AA963A349064693B52F14B09C5F4B329C4AF4078998 +D3F6C1046538F989C8AE84AE032A112C3E657907EE7A844B14C6A0FA8C9A1CD9 +797E195186C478057525CBCCAA0FFB09F67F97E69BC402F6199B6900D9F285E6 +47D359B1728728770C95B1A85E22D2132FDE7075F8FA1123F62504E53AB106D7 +99B33689D55D0BC0C552745C5129CEF9F874850240FA6BF5F4779E35BF15A8F9 +F425ED40480C60FE3ED85173E620320A462092834C0BCF6EFF9F1D5912CEB941 +9C18D8EED5CA36CF2C7D3965BB0929EDBF7FC997A9CFE79A9FA9C54A11E1F421 +7F3FA4ABB80A3C60E9165DBFB0EA765BD21846FD1260F1AA4644CBE05CEC736E +638311023F9F51F4C0166733A32BC1F615C8D9256E44BE8C2FFEC45B7B612FCB +21C52DB57E87EC8E166498AA8A4528B7C612E3BB8117D6BAF5CA8F9D038C1430 +B7EA8699F31ACDC03774AEDDF6B73233944A1A89ECBAED2EFBD30DDF42821846 +AF828EC54BEA6E7312B3255A7F55783C5D4AF1D9780A9670C9C7E02A50535A13 +6D957F895D53E4E18A4B4263695DF2BD9626E717D5C3B80E908E59EF5D093798 +7215550A5613AB86D67C1F89C95FBB0E6ACCAAB397479D483AEE4607E111EF34 +2FD92DC7F991B6AE84BC7CB982D819A17022ECFEFFB981A6F678655A6278825F +0EFB5733C5F46529EF1FBB01C6BA7413BA9211251C0A70A470F735A96F6E0D45 +DB1342D6B97ABC234790D346C74927F5C910F71918D615CA907984F0229E3F54 +4F5F75AFF784C7A470DDCFFC308ADF6EF43979DD3B54C6A8DF3B53DB783B81E3 +9C57413C3A317419C190F207720743084DC20288C1AD08B8B0FD4ED805FBA8B5 +BB874DCE4AE93AE3B8A117612787DA6C8C7512191BC36F6D8AA38F39099474AE +CD570CB5570BBA932C9C7A63DD386CABF1956FF87C266BF145ED5D27547234BD +943841047FE9A41C24B82FD3D3EA49A56C56840B1B359FB2A3F28E10AB09AECA +2FE2520DEE9B5542591E72ACE610DA4BF31C6E204574DC78033008F019519B2F +E45C99F1B938D212602E824CA1CA020211420C77FF545DF586702451B0923EDA +CA15BFF98CF2F0A56404591E57F7C89CAC6D22E0FEF9094770CF003801E5CC08 +110B272A50805F89C0BB5C2966B9385C26F4A5008AAD97A29408A5116BE613CD +5ED9F85D2BCDE96FCF3121D5EE1D455A4CB03BF2AC33493FEEBEB955EF737F7A +EABF96C137DD84B3EA39C61CE95B5967405CEF17D9CF1BDD1199346F95E77CB8 +5FA2D38D858DAEF10D0DD660211C8C4C69EF58B60DEDE48DF76300EAB8F0A547 +6DBC87BEE8DD4EDFE3020BA56F362503AFA62D8C13BB270C3884560E227AFABB +5D810B2B092531A679485FCFFB88BA8313646B644A35C413053DECCD4B371450 +18F54701F610E52E727AE8D25A8093B60093FAF775B6414F66F43F517488B4A4 +00AA4F672A34A73531218601904A7F50A045E80CD804D028EAFF506EDA1ED998 +ECF16435C6CA8E203F2A813506F4B8CDAC0A3D69F4B704AB80F170EC87B7C732 +AEFCBA3BF4050A9CFADB87F7AD4B53BECE197C10A2E84571A640328B90E9A294 +73F6CDDE4F4AF9F1F3A257BD130454CF95D390ECA95FC4221D5041E71D65FC21 +8323BA5A3335E2E905E33D5BA56BBBC9CC30D25764A066D013B116E693C56762 +4F683F112A572C2C04ED041CF7BB4FAB0D899B3F2679B431E8993A650184CB4B +1B391B39929AF803F868245A69C964B560A274B07DFCB88A6508082DD6092E38 +80D9187A146B60B225CA22F593AA6B4B7EE1EE41A0D375C4FA69EC6C8E02B54F +B855D385C973A7223DE22465D039D213315C35F0D079E8CD030F62993495B2EB +A0F9BA98565F89D2E09BB60D90B0CFFFF1F0845810ED27CC8F1088F74D48A30D +7FA0728498E78A381B0169B7678520EB5769522BB5838212D32C8C1ED5635753 +EAA3C14E6640BC34D43EC162711996E0CABBBDE0932FCB6B2838C22C0E42DCE7 +1BC85E372F24C1145655D59CCD50EA6E1A673CB0342BB744A43EA1B9104CF736 +324E367D82ED67E01B0608294A91386045C1564E4E417E1A62EFBC148C0B4A56 +73A98AE2F2433164740B839F851F9C38124B3C01CD976128DF6A06FEFE14B960 +4573E748370D70F9FBFDBF875584852E70264766FA5CE893F74D0D5884889178 +078CB149821A743D797E9577A7D27E7ED607349CB2CC6968A7CE402DF9A55069 +4A985B517B714C603F993944CC64083DE3D5F969F9C5913C297E8493D310CA42 +795C94740A5E5D3415CE7B4A5AA11A940D93992329D8B00213244405BBE73958 +37CD65B6AEBCCB2263B937F671FFF3C6314D400983E5AEB6A34709D854FDD0AA +3D27A62BB23E253E6E2CA994294009B857B5F1FFB66E772A0BF9D83F4F72B89F +51B125AC9E495343C9D84A4BB4759DA4D2ADA38A195C7905CE288FD8634ED996 +9068F0DC8DD08F3D3A1288A271E7F7EC4AF76EF6A78C47BAD95FA14A3AB690E1 +19A13639774593D77FC1610D7F1E25A31AF94C5354B35500B8E57B0F65AC82C2 +2A519581B587F5E3C941734A4269842D38F74E89C2AADB8ADB3D16542B0485BF +BD4F1EDB4064E96A330D735F73789614C8D606DC553A0A2409CF4C595AE51505 +CF203817971BD7F9B3346C036A18FECA44CE1C2042BA4E7FFA3FFEB6371A06F9 +30082F47FE87B207E13A68BCA122968AD74CF6A12EF6767988F0EB0CB64981C9 +30D9717F6C7D07F4B37CFDD68EE4480C0CA305AFA4BD21DFE131D6715E839973 +E1271BF576F70C2F8C6827B3EF02CCA123EA46A02B2722E06078C3D9B3743CDE +45B43B561743264277D0D1FCACDDA80E5C6185E90F82D1DA4DC076B6BE49D2BE +F03EF513F1861CF66D2B7F8D52C7A5C21DF1276B72CC1CDAAB5A16D20722A95F +8B1EB6E6B605D3878831204A0EFC95CB3C5B588D4F0A540D466D13B8468ECDC1 +DB08D36E7FA19709A67A0FA08421053EEC9068ED464D29BB1BEDD0BA88882707 +9F41334C3BD3F995321711B6ABDE3C12A8907F930F7AF490D774A05398ED03D6 +789D91B4DACEA3D8EE11C2CD850A6EF4128B60EDE9BD37710F43836EF6D53FD2 +D8123F81EC6F01A93A8B36FAE49692E7276F7CDCCB09F332ECE359E3E7DB2364 +A60B192438FD158B18CB3EB40FD28F74A740367F02D5CB6B53959A0D11BDF388 +9AAEE02F0E96AE2F802FF08BF778F26DBBAC8F5AA04CF3AEB180235BFDE493DA +4D0B13E0B61696A8ACE4FF7A09956A1896B2875E5B2BDBA09DA08B9589957E85 +51084D76A00FB728E286CCFD2F53088158005599835B18F6F5AAAA6051270AF2 +59F7BF641B0AF4E79F4491725189B89E57CD10B442B8EF89345D04EE3E18EC98 +217D81FFB1B473B9562605F7B0AC3FA8CFB798A988E5FF20F068A6B2399C71B8 +2E3C19E58601B0AD3872170B0AE8FA33F3A50EC5E67EC22C00D3DDDCD7B592E1 +0D1CF31DAA48D10F7C6A56CA052A5AE914EE08CEE011FFF20D00B46A7738C434 +D70F1040C611168D2C1851DBA89DA526428E6D5DDA244AA267AE3559B0C7DC8F +AAE1687F823CE628AAD59999E74DFFACCF7D3412B466F6C3A315D8AA3350FB18 +9EBE417717C42F3201D19E1870A2A3424E96F1A9734F32E85DF220E08C4DDF8A +AE6F3491A3C805578924F36C146CBAF1D38C8C18D18E5A9B38236BD3E6B9E5BA +595F66A2A8DE9F52C9DFE00ABA5B99806A87D2EA39EF2C3A8D94FBFCB0CB5345 +9AC36328B89AA13E4BBFAD70314009B0A2588847B7092C9EB938DD069CFA3679 +73D9CF01F9756B931B34E70F4A5F1C41FC577515A5CDC49FE2C9A13D62E7E612 +2AA5969248241BEAEEA5CAD34154EF5F9153D85ACD6FBD6B7F2834BC65C77E27 +5ED803220949B14126BFAAC7728CAE16EF205F408232C5D7B83AFDB9C2191997 +38005204EF424640DE1163B577274FB455EC0383BC6CC17F35112AB638743DEF +9954A5B2DF6A50DAA8662967E8E2208A9D1E3506309A9EC4C001CF91896E79A1 +F3F6FE998DDF7C7971707CF7DF7415F6D42EE28620C0A225A1B9E389F397F972 +552E566F748613EA1FD417CAA7B90A2BEC1AB07F44BB8AB6ED829F2D7F4DD597 +989617E6BEF5E701498823382DEFC2D5FD078DF888DDCA99E62890AC0E5BE8BE +0CB662B561A49D2221847151D203457C797A904BCB5A1D68A51EEA20A167047C +36FF0FDD999E46C857864D1CE7568CE9518230418124EE5E51FD96C0FD8EB7BC +2A49F49AD72BB71F849B112147271000A77F41CF476AD687E6BC3DFDDE0CDE1D +ABE816BF31348D25FE0A11FE7F5559BEDFC24A14F91BB73BE7F5FA95DA24D705 +3DA96E8D05B84A1E5BFB0F15D7D4638CE4C63B74404128CF56A016180EAA054B +85FEE6937681557D0B5BC3C560947D456F48D7F4CB7A5EED52B103281B152E3F +ADCE8B98497B74B05096AABA261D2A2EF56572904ACE2866C6A081C926BAC3E0 +DE02EBB63FA29197B3812809F08A9E3D5ECFFF751E60F7082749F57352040E06 +CAF9290336395684E85FA2446FBF1D0223F74B0D3464B06975010B83D0975181 +3DB6C0E2967CFBDAFBD555018305184953487AFAE112D36E696DB8A18F3E3A74 +C8B123F16D077DBBC85A226A26D406F622858EB7F1646BC0093A7C9711A1DCD2 +6302B0611AC20A3870195D8BBA4E8E4F2CC73030B2354308CF8C06D68DD7FA14 +87CE9D6FC7A8A356AA2DC356231B4993655A0FF55AF67090E2947C2B7FB9E96C +EAAF52A01ABA6D69B738D6E3D4B2CF1E037D991EB5943BB0E6AB3868138CBF20 +A112805F4CC00C65A4BE86D7492C23E34CC0BEEFAA0403E2AC21FD33D7A7FD09 +9DCAC0BE550881647B322FE5806735FD993F5ED7C62173AB29095F67A626B9F3 +20829E4788786C978B4BC9BAB9B3A750F130F9D4AFDA6EA3A7DF09D7615951D1 +0C783A653F0BBFC23902019BA276A6D7944F1A34C1EC7E2710091C0B94CC3938 +01C50C5E4A9C19F47D69074023F574D7A7302565EF9920A8E2A5076E6E3DDD2F +409CF1AB8BCE348FE63A136E03A520DDACA32571675AEB94D761B7B625AF1626 +8BA9ED761E12A52C511890DAF1F790857C3C9FD3FD033A8330CD8E19266FE888 +76AB1F3B3C8BA1FFCF3A6CA570290FC1640B6C4231D8346BD346E647D138B2B7 +F7861E2C7C7C4431E3E91E318BA1DF8338AD4EB4AC104EBE7AAD8F5A09E6AB3A +48B9EB51A85277B221E3A22AAF38219B681918DBBB2F77FA8AA27F310159C763 +A6E66D93879B592289B919B425FD7A367B7820FF430100E1EAE0877F84326FCF +5F1DD99964BC6BEB63528D2B218CCE41024EA2CE703959071A65EDE99127EFB8 +0CC01566E5E52DB32D01512383A7711C7770AE17A71E5D95629642AA79CD5F01 +D37FC89696F25C2EE4DD70DBDECEFA4FA2CD5D2F8ACE75937D2B1FEC7A31A893 +16D314D800AFD3EA28068983A2ED3A7C75A5570F30A2824A47D6A789AC554C3C +A78C2DE9771B86F73C66EF8E1D0FD046DD4F19A31EEAEE04D5F38B73C623F326 +F146C7164C9B18B5EED2113363092ADE0ABF0D7BD4C10BE9766F81C34878B236 +1A0FD6D8AB4BC7E3C01F1C880C3A9186E4006210D22EB64CD7690FDA750EAE7E +C87A9D29128D49082578ECC0BC977D91E9CBB1ECC0D3527DC0ACAB39402015F1 +B067FC5E7705586D97E81F8911FC2BC8E7C077384AAD4DDDEDBEF65CA4B75F6E +39E41528CF53CADA928537D557B518BB740593A6E4D0100ACBF126FF20888342 +A0D3D7C201C4CDE8CBF59A1BA4F924E4EBC3E02883D5FDF2C8249AD8117332E1 +BB52D2F621115C0F9803741E49217603F45AF366220D299DE85A0508D0717C6B +F11163BD8F0621055AF19529FA17706C1C0CE6A08C84FF50D42FE47F91FBB7C0 +75B515E12AB563DF30F06E69DE564553A2A0EBCC7E875A649656DE0C986ACDB8 +60B1B84DB9BCEECCD83F382E45211576133DBBDA5CC4582CC3218E63D9A9F8C8 +1F1A4ECF1D881CD77FFAF275CFB0D96F60F6ED768BD87C1806BB162028CF9D79 +ED3F21E23B4554E19407D4A864472E90A42B6F41EAFB6A2DD46609E9A78487CB +C560C89F0C83AF7745D914324C6B643803A47CDBA682D9039A73301D8EBE7FAC +67B4BD470C85AE4C6C9A353EBE7FAE21C318987F8E7B756F708B61A940FBFCD2 +6D87F92730C0E4302EAABF4EC427633D901C38728C7192AA9B07FE46FA963C9E +FD94B5719D301A3F0A68D25342DE4962DE6D2C0CDFC0FE93F2F482B39C51D812 +8E7832D473B7AE6E9218358D021FC2D6DDD200705B97E525E33F68FB4C5970B1 +83E9C4FEE96C8D4DF87F70F6C69E37786128691713CCB019E9DBB88562C949A4 +A723CB173ECC7E16781F23094C65BA164E54F8B8EC1FFFD774CC160C502F5CFB +D1D4B715C1461B8657CE4C79F9F53E8CA0DCA70743BC271FB324D1696AA1E540 +3059DB1791A5E154447FAAAE6E9B41E72B0C542380B3C65806969D1829191E5A +5E8CB3380F00DBF31EAE885FF0BB2A4250709BE834400F915E0A9289ABB8C252 +BF7C5FA2DF0B17736F20881ACDA4185AB1483E8AAB2B18014401565C32A5DED8 +883A9527CB9EDDAC301A0014FA03934944F1116FD14C8836E5363248994DD193 +3157A53F7207628DCEC444C12DF92CAA1F72612F76E73E3647172B65BFBF4188 +7CD9247F0AD8AFEF08685833D95CF0147D00594EEACDBA0DD45F3035980BCD3B +5E73186AE453DEA1B84D009E23D658705CF6DFF36DD38F435B495AA5D9F88CD7 +4FB0E612A25E1D4037F2E0F20FF29830E66ABC6C4C95483249AB0877CA164412 +73A0337D1B3CFF7DDD20C24444EAA44FEB555C34F37F7F6037422EB23F19C868 +AEDD2E507101D208334A72FB1B4098228F4A6F88424D655E7EA26D6F456C391A +B2E5A2E7759483FAF10D23147FD33963FC1AF53610FB251FB77F8063302577BB +8A8C85B118EA44F5FCC6A9967002F92896ECD5262A984C1C78E044ABA1149958 +B33BC03E47B570132951A70085E9370AE3F11995EB3BF45A24FA8E4B6CB2FD3E +490E570CE9DC758E427375F34B60952ABCB4796891B62D72C1D113417DFA4806 +53C9E65ECE8D49466E6ED1B54390CB3735C63A7B77346165209789CABBE8FAE1 +108B32B17C1E8AFE493BFFDCD2AE843FCA98BBDAD683618DA8DB5EEF72E5C62B +071774675DB85385832831766040E012B07C7CD7F49BEAD25A1014A0E7E7A91B +AEE8FC944FA5973A579CC1D94AD59B6463A6CA753DCB7F3450CC4091B014BD08 +C7FBB7265F5C91BF7A88ACED9139E8D66CBDFCB749D19DC3DAFA7BC9D9DE1C0E +4FC00F04A96A3F5C26DF13E27F2134128191D541893C4EB55A34C0B9A616FCDE +BFD87E55B05C78012899FDD28497BA26D4A7E3A59790D4C6B0ACA23BB473C8EF +8047D4D2251F9BA150F386445666E1DBBDE805322372D460C6756B57766A686B +2AED804E5DD4F0BF08BA3C78D31D693AD1DE0928DB79CBD4E7BD028A844AF922 +B48517FC2FE2F9CADDF4D5CB88DF25561C1BDE7D5E9A26CC48414DE5620C92C8 +C6D6D07DA742A94280A8101A66ED8C6F685C5CAAFFD9BF3498876632B26D408D +78DF5EBEF4EAEC0BC9FA77B4658DA17681365915815E56353F2F0A22E405AA16 +AFCD2D2DD479C8867066A82C932D85352A8F2AC09974E73E6F14EA9738FCBE75 +E92AFFD69F70E308A4E4551703F7C8781984771AF28D4D0FA0953639865399AB +E6DF95BB930CA2F11EA12F98E83C2DB2717370DD8458344B948529971A949CA5 +02ABEC52708BC62D8BAF876AA9BF8B97D8566D86D22B6B1B3DE8E7C569410537 +57A89AFF02149DA7F5DF077F07718BABAFE82099E510F8F0099414943CFC1D03 +2B1D33AC209D9178C9319A67F9507DEDAB232E62ED04B15B5D0205E23506FEDA +C76F7702A75F394409000FE8D9CC0BCF6CDB096D86A278962BDAC9A62C73B1AA +7BE98849FEDA65AAEF9F5339BF5CEDE547CE789A92DE842C5D70F7AF920F3112 +812AFB221D5C0F34551A9F8A6E8DC3784CB834EEB649951F905F345A2E3D2888 +A9C4D04CA205037E16AF23392067E24F630DC33BED95F60D4BF3B61D9AC94540 +577250E0A0C83CA927FCA845381671C6FAFC88F4EE32783D3406D701EA549E10 +94A2730E9ACAB68BF30F487E48F2951D8F2C7FA831D5DB14B0C754D8C582B3F6 +1791074A04BD93B6D1ADC0926F5416E1308C61911F430070E20E02CB0A7A921F +948C7C3E20D1C27FA5ADB06FBFF6B21EF1993DA470A7C32DF0446DC10C07E280 +47FE18895EACA37CCE6D188ED26E439C58255AC3CE51E83585F2DE7C89DF6531 +3D520CEB57B6688F5DE7894219A0F37F7FE82CA9B43941DFE63A7F54A63860BE +19384A7BAC0A1937F5A998970906311B5BCF32C99EBFC1F02C1DB553995D95BB +5292665CA639D6FBDC349F322C6CE639A4F83D5286B6CB759DA80D595C946297 +A23347C7B1FB127FEF07E9B88A793227F7CB0A59CED8E2F73622154D2C1E73B3 +49E5BD733EFB07A205F97083CE0553210865C912168F6C168C4B381C20502E34 +634B71915E0EA91C9BEE54F8E24931263F5858F52546BB13911F0652BF400DE2 +427AF0883D7A361451A560104306CDA2C3419285733BFE25B62EA405D8CECFA3 +710AE911C81D27A30F4464BF66F5C4047637E44343F2B78FA1A79763DA0418E5 +2F414C4D7C49090E6DFDB371615FA885B19FFB2861FD68161F30FD0277DB43E1 +14676B120E31554AB5FE3D1C6DE69428D1D33CF59A85654CF6A5CD3393EBF39E +ABB501CAD9992D532A0CFF51C082FE514448982540AA5A754D1E54027BEC4336 +7EB4443D5F9DADBD9AC62EEE0660A614E4CC432FA45958AB11CD728DE6414029 +EC1EA0BF418FC30C84E9A13AAD7DAB42F6F11426AE7E74158C7A9B93B218B60B +3CE1F810B36AC6434E008333CF9514D7305E9D724E22B4551B5AF54F8D53B483 +5B21107281E7259B0E6C40E4BC04FF6344B005BFDA68A233BD8100C0A43337C4 +160D45F78BEC989ABE8529765868AAF16E533CC83DFA4577E0810830EA4B211F +175ED1DF345E72F57D64E68CD0F58CE1D6F2F03022B3E6D121BE34152E170EE3 +439BF58F97634225738CB5783A36479D8B5C3816BBF9AC5BEE738493EB7EAC99 +BFB0F00C2FC607E452241D88250251C194AA43B8902550D0EBBCF40ADE481F03 +69B45314E22311CEC56E3CA807EADB2BB11AC1B41AC561A17B1D284EC4F3E900 +66BCAC12198EBBC01971D0D2EDD67F0CC6AEA6111BE36F6AD17DF810C503AF70 +E13DEAD228901961A09AB79146D26F1FB6AD51695BF30C2B99F015EFBB2589A3 +E222C5AF06742F69B995F0EEA89C7701EF1877C5627FBC2AB7E9BC8C1B24AD6F +4DE755D6874C697E1858E86D944A474796EB7C36E469179361F244110F40C021 +6D698CF0EACA95F0E582D1088E3617B19E888D7894D0796D33FEA4CE92EE4C52 +5D90173FD157771F0F76677B70039A27D3D57C4AA260215F76D9D56C3B4DE102 +F5299CF5F46533676179BA83168F864829A2F0779B0FD91D0B353B49D3B8CA28 +7CEA5CCE62C2ACB573439B3B4B6367DFEA87A4096DBE0A35136B20BD4AE18CBD +69D91C8061D6DD4702A97F013B915FF3512A4F05B1FD62333E456B6475B731FE +A28AF6AD338078ED222354A8B8D0EE52148F9FD5EDC1C461D5EF8303369642F5 +D49278EFF4EF127D0F56161ACDFB018BC268E1F7259FC2DEA318FC33E6CBD06E +4D71E9F80F2F5760A7961C2B1F8ED9C92DF3634D229AFA14F2CA6C20352FDFD4 +50B1FC6C8AD4F084DDDE32837DFAB8A86BF56C7FBAFEBE8B261D031DB259E3CC +CA543340B82A44F44226B19ACFFB81BD82E3097B97951D6729CA02D38A0D97A2 +F9CD0B84E171F808ABB57A1B379E536ED215B2D8D567168ED98730231466C015 +679EF6ECCA41163C445D5FBA068BCE2D548A149E82215FFCAD419A366286464C +19A6B65E0F322E52E14A85E87045770A64FC8F2C4D6A97198C1D1E0F029D0F9F +4611B2E8AC0F3B96A85FA1FDA56A2713F5A801C0020B54E10026CC0CD6916749 +A2106DC1693EDD05BE74CC57E678198AF41A2961EE607C9F82440DA3F014229C +2440B459BA288CB052A009B12343DE4EDC1BE72AC167006896E59DD44DC4D757 +ABDFC7AF5B55CC6B9BD17E38B16A97691CD1E265DB2F5257D7F0E5AA8E72B189 +F3E517F4D0840FE3948D2D1C083523E0EE08A2C2F9433E3219B0E67627ABE609 +C96B9B5A64D0DB63BD215C7D1A24A75F0FA5D48953F7A7D83A6F29F87F33EF9F +C24BA3C795E6A5FC28AE6A64410A842560D4B04718ABB3A9147D22D065C098D2 +8C109C44D94FE00C162F0E5A5BFD9E782CFA3E82058BB79FA43E972A81F65D43 +E1814FAB123E5F1C71786E0074E42FE8ACD45737CF9F7A10B456635F1D97174C +8AE0AB3479F4237F9778F7ADA02EBF26F4FD5BF91522527A39E038EEF983F6A8 +BDC5DF91751488D32F6DBA73FF60AC1B500010F00B45A984D155C5566AE1337A +8C0FF12869843EF7C84C5DA228EE2070100295C56294C6DB7854D4F5FEFA970E +8036489E5CE99B546C30CE03C4E3C2851D1A62E986D7178B008FBF2683326AA9 +F64BB4881D8A9868F71D48C300533D7F187E3DBF3382CF4340482CFD3F638F71 +539697BDE7585EE35C4CB891D407B23F22DE0CFDCB96330AB4C1090104CACEF2 +ADC13CB9D99E6D331F52B0D419A1154EB115C143E317612593CCCBA733F6F73B +AFD670CEBF488F7D4D052D402419FB451206866F614D48352E481D917A8366B1 +3C1F19EB0AAFCF9F9D25AB743781542514DE020B9767733D7207B11179D6DA1F +E58D0186F1075D90FE2748D4D3DFC57A81DDB9A4F4F11A8170F67B5F3B11B775 +353BF6E6285748E4BDB13E0CE82FB0BFEB5CA7C2202DDA3D3B6F8A28B9522F20 +8C083B4D6B8B5CED025AAF4F93E07A1935C68D5B3BEB5B00B5928E55AB9B5D09 +B2D230413E81CDCA6E0DE1E0B47236FF5140C2BE75AB8D3CBE139F7D3911F48E +1B30E55423D1D8C1A309E14927AAA4A8E06BBE0F340FF9471C62A1E81241A5A6 +F79268485FF7A5DD108B96B73733AE13539297A63A05F7F46E5F33A568DC6CC1 +ACD046FA5CF421DFEA4CCBA441AC9D4981E4F282DE1D487C7AB95B64D10B7B5B +26B722031FF92C2741273761514AC71CBF1F5ACB7C4C3E466F51E99804C98F9B +4421B02396B401AF9C715C21EC45CCD8DF377353B3C1E139C6EEE5485C05CD5E +7C61A781D17B5F5A12F0D4E2DE180239E58D967F8C488C9F883A2F3AFFB51EB1 +D029C31045DE8489B4451D24422EAC226A5AFE7110F4637E641B0C25C7E4435B +53787D714C0214E6296EBF57A88A8D607DD009532328585CBFAC6392C2006666 +5BE46F9AFB87F3EB2DBD186DCEC4AAA5FC1710119FDDB6C709542A86633433E3 +2EE884039C807C23A66D046182B59F0154CE40B7E103D743257FE23062DECAB2 +6423B6E3FAD59D53368D9D99D6EF9D1588CE89B91EC80044A1D849E87BC402D2 +D2E560AF47D6CE854959BDA7625E91F17A03B5903563DF307BB4181D1A51EF61 +5F489CEC76A58DB27BDEE73C0C23CBDD1EF4810F41C540FF422E2DA3F55E355E +1CDACFED8F285AC9970BB7AE6E39F55CAE10D08A7F5BDB5BF10FE693C27198CC +1A97F8246FBBA400744D014086B53E8CBC24DEE9197F890B075B3B8CE9530D0D +FF4721707ACC1E45E429DB249BF2CB897DA68ED9D6B919ECC89200251CC09E7C +85B37C98BF73409AE02313BA268C135E5A6EFCB22FB7A9D4A2C0218DB50592C1 +35959E2C754329D5AD3E6F1443FFD0DAAF7911D0BD75C701A0AADD9278C09ACB +8D1F08DEEED2A0BF4C5706802C442CB41DDE0DC844F4594D919ACD596A9D502B +BD7230EB03FF7DD8CD8EC458219DEC8910D6E561F9A03E57DFBBD841EB35EA8C +452160FEFDDB9E6B44557077B47BB1C7FE42F037177577E36185942E96E39E3B +E9D75DF6ECB5E7595F6B4F081BF680E96F50DBB99B2B3405BA1C13ED2647F8EA +96293D1B1061D06D81AA409FD2AA463B06C3B87308706C6B3AC16F26FD0ABB69 +8D0D2A55CF09450AFC18012881577B08DAD5F01DF2D33595D52083AD37EEC354 +F55356176B92745650482109056586258A6358A0D2EBBFA74E6D7042A53F3459 +028A4FD3E8595B9FCC829B6D2B37114E7AAABAE153FA34F51A691E36DD3023AA +B3658B4626B30821BA2FAFA2D82A24C33A453803D47C96A2745555C020CC9C05 +A21D81EBECB08F96CA57D01ADF3F4DC689B526B217292CF6D2BF0CA6FB0984E0 +8C26EFF220899F5FAAACB31CE4E6DBFFC590FB414E6259F73521BAEF9D04D3C5 +7C3E6CF2B239A8925E34A9E1C8A92BFBBF5B953D0B8AA2594D687B2E252B13ED +7B8A0E4E9C8B27D39752DECD86960757D26278FD919AB6943C668B38CC7F7F69 +436AEC24EB32FF3FE54186474B1FBD86D1282534BB3A6176FCE2E406CFED53D9 +EC74A838AFAFBF48B3BB4C82033144D2D719F55CEF11FCE3181FD3B15E15B3E1 +B530D9AF8410A9C9809DD806A2F639F040EFEC1E10E07F8325254DF468D3A1D8 +160FA55BFC7115A0F80C533474D1BE92BB2998793DB7749245EF32E4FBF6D61F +1E60E9D96C538CE4519A3DD4303CC9279F2ED8CA0EAA49DFC49223A2A40A079A +6C51E429B1F1063EC7E55CD9343B46E642B8C0D914D82B7BAD786C5BC255392A +89742025D9900418079B92F323F235B22E1E546EFB2C8F19E432F0BA090F584E +53AE93959D6A0CF44753EB9AD1FB49F3B3EDF251BE748E8F58BDDB5D4B1F761B +E1502E0CE6755DB11AED6F21A00EE59362C254C572E9C52788661977B78A6E67 +506B61173B93DDA6D3ABE9A13EF11A5DD244061FB161D0348582F975CC8BB3D3 +FB3B3036260EB6D45C7B132C7195261F0E08027806D9C84867CCA923D4D5BFC1 +1B8B955969742D5DEA0EA562DCE8409F29C6C0735BD977DDED9DA5330BBAF3FA +972CACF53DC150203DAE2AB4145B0B621546B4B7487C2495B53F3D461FECD570 +8FA0D2A785AE36C42C8424FB03BC2491F9FD0D68B7A4FB0C8D341F36B88C9DE2 +41D8393A39D5B4D461983AA508842E2C52D26C33F0886B9B047CCF6EFF3BFED0 +E06680ECBC38256FDDC73F54FB7649D3EB2221D48E0BE38DF0354764BB7BE1AA +9C7E30DE9681C5EC9444D8941B68C4A7939125708B27DC184F3DE914848D4B33 +12D21C2B9958A50F5E1CE54AE464C446317341E82473FED5E2EF1B510FE3094C +6F3F7A48D3A18ADF6327498061E24290862EB303DAF10B98E962AFBE06216662 +C400E44D45857EBF38C69F7116F7506B1647860656FDAF72EC6962A32C0BD2E4 +A500ECE63180ADE80C7C61BD4971BAB4E726C2E576447BA3DB7B2C51C3BAC516 +1F2E4CEA45A6D7526418A0149781D6D6972CFCA57D7D4DFBBD050FCF477E3370 +D5B56C95634CFA8616E5BB1DD3BA63A8855528BB1468C7ECFA8F806F00ABB1E2 +1B420D7F64477295FD676F37D0542075C64B7A1C1E506343276C789E9ED9B684 +94000B88843766073C596F8E86E5AAF1479ECCD62D18FB82DF93F4D0BBAEAB7D +319E45C3E1FD6DA52EA2A71BDC6E6D0421B4CCBBF5320DD9DD74EBCE9B2F0F96 +02837911D1756FE5DDFCBFD662B77067D02C46DCE1EC38EB7CCBA89599F52F2E +88B1FA31AD3E155164C796D14C2CA83B23E760E83EDC2401FA7FE913E7770D42 +48AA1A9020D90B539EEB7E368AC9AED254EDE3B8640F61320F932B36262C1AD2 +671856919DACEB02B5567FBC98F57495AC7D395307B76B93220A6E6A35EB0F7F +C239AA91984BF3AABBE551F1429A3420A229EC65195FE0AD7BFEE0F7839AD3E7 +D6B5342FFEEBDC8381EC6B595EF8A2BBF97E9EEDD30CBAEA2CACA72D813E3AE8 +CB3E9D41D65F890B0CAD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +{restore}if +%%EndFont +TeXDict begin 39158280 55380996 1000 600 600 (users-guide.dvi) +@start /Fa 165[51 51 4[51 51 2[51 1[51 51 51 2[51 2[51 +51 1[51 67[{}12 99.6264 /CMTT12 rf /Fb 134[41 1[55 1[43 +30 30 30 41 43 38 43 64 21 2[21 43 1[23 34 43 34 1[38 +12[55 3[52 2[70 3[28 58 4[55 7[21 12[21 46[{}27 74.7198 +/CMR9 rf /Fc 133[50 1[59 2[62 44 44 46 1[62 56 62 93 +31 1[34 31 62 56 34 51 62 2[54 10[85 86 1[62 84 2[84 +88 106 67 2[42 88 1[70 2[81 12[56 56 56 56 56 56 56 1[31 +33[62 12[{}40 99.6264 /CMBX12 rf /Fd 136[39 39 1[39 39 +39 1[39 39 39 39 39 2[39 39 39 3[39 1[39 38[39 10[39 +39 46[{}18 74.7198 /CMTT9 rf /Fe 205[30 30 49[{}2 49.8132 +/CMR6 rf /Ff 135[40 104[45 15[{}2 90.9091 /CMSY10 rf +/Fg 205[35 35 49[{}2 66.4176 /CMR8 rf /Fh 139[37 38 39 +14[42 53 46 31[72 65[{}7 83.022 /CMBX10 rf /Fi 134[44 +1[60 42 49 30 37 38 1[46 46 51 74 23 42 28 28 46 42 28 +42 46 42 42 46 9[91 1[68 65 51 66 1[62 70 1[82 57 2[35 +1[70 59 62 69 65 1[68 6[28 46 2[46 2[46 46 2[46 1[33 +28 4[28 39[{}48 90.9091 /CMTI10 rf /Fj 131[48 1[48 48 +48 48 48 48 48 48 48 48 48 48 48 48 48 48 1[48 48 48 +48 48 48 48 48 48 48 48 1[48 1[48 48 48 48 48 1[48 48 +48 48 1[48 48 48 48 48 48 1[48 48 48 48 48 48 48 48 48 +48 1[48 48 48 1[48 48 48 48 48 48 48 48 48 48 48 48 48 +48 48 48 48 48 48 48 1[48 48 48 48 34[{}81 90.9091 /CMTT10 +rf /Fk 133[46 55 1[76 55 58 41 41 43 1[58 52 58 87 29 +55 32 29 58 52 32 48 58 46 58 51 8[79 1[79 80 73 58 78 +1[71 79 82 99 63 2[40 82 82 66 2[76 74 79 6[29 52 52 +52 52 52 52 52 52 52 52 1[29 35 29 2[41 41 40[{}58 90.9091 +/CMBX10 rf /Fl 134[44 1[60 44 46 32 33 33 1[46 42 46 +69 23 44 25 23 46 42 25 37 46 37 46 42 9[85 1[62 60 46 +61 1[57 65 62 76 3[30 2[54 57 63 60 59 62 5[23 1[42 42 +1[42 1[42 42 42 42 42 42 23 28 23 2[32 32 25[69 1[46 +12[{}56 83.022 /CMR10 rf /Fm 136[65 45 52 32 40 41 1[50 +50 55 80 25 45 30 30 50 45 1[45 2[45 50 9[97 2[70 1[71 +5[61 4[75 1[66 24[30 44[{}26 99.6264 /CMTI12 rf /Fn 137[71 +75 52 53 55 1[75 67 75 112 37 1[41 37 75 67 41 61 75 +60 75 65 10[102 103 94 1[100 1[92 101 1[128 81 2[50 105 +106 3[97 96 102 6[37 67 67 67 67 67 67 67 67 67 67 2[45 +37 44[{}47 119.552 /CMBX12 rf /Fo 131[91 45 40 48 48 +66 48 51 35 36 36 48 51 45 51 76 25 48 28 25 51 45 28 +40 51 40 51 45 25 2[25 45 25 1[68 68 93 68 68 66 51 67 +1[62 71 68 83 57 71 47 33 68 71 59 62 69 66 64 68 3[71 +1[25 25 45 45 45 45 45 45 45 45 45 45 45 25 30 25 71 +45 35 35 25 71 2[76 45 19[76 51 51 53 11[{}85 90.9091 +/CMR10 rf end +%%EndProlog +%%BeginSetup +%%Feature: *Resolution 600dpi +TeXDict begin +%%BeginPaperSize: a4 +/setpagedevice where +{ pop << /PageSize [595 842] >> setpagedevice } +{ /a4 where { pop a4 } if } +ifelse +%%EndPaperSize + end +%%EndSetup +%%Page: 1 1 +TeXDict begin 1 0 bop 1140 -125 a Fo(AR)m(GONNE)31 b(NA)-8 +b(TIONAL)31 b(LABORA)-8 b(TOR)g(Y)1488 -12 y(9700)32 +b(South)e(Cass)g(Av)m(en)m(ue)1609 101 y(Argonne,)h(IL)e(60439)p +1453 614 1050 6 v 1586 786 a(ANL/MCS-TM-234)p 1453 899 +V 583 1829 a Fn(Users)46 b(Guide)f(for)g(R)l(OMIO:)g(A)g(High-P)l +(erformance,)985 1995 y(P)l(ortable)i(MPI-IO)d(Implemen)l(tation)1930 +2264 y Fo(b)m(y)394 2456 y Fm(R)-5 b(aje)g(ev)34 b(Thakur,)g(R)-5 +b(ob)g(ert)35 b(R)-5 b(oss,)35 b(Ewing)f(Lusk,)h(Wil)5 +b(liam)34 b(Gr)-5 b(opp,)35 b(R)-5 b(ob)g(ert)35 b(L)-5 +b(atham)1082 3168 y Fo(Mathematics)32 b(and)e(Computer)g(Science)h +(Division)1332 3381 y(T)-8 b(ec)m(hnical)32 b(Memorandum)d(No.)j(234) +1047 4334 y(Revised)e(Ma)m(y)i(2004,)g(No)m(v)m(em)m(b)s(er)g(2007,)g +(April)e(2010)28 4804 y Fl(This)f(w)n(ork)e(w)n(as)h(supp)r(orted)h(b)n +(y)f(the)h(Mathematical,)g(Information,)f(and)g(Computational)g +(Sciences)h(Division)g(subpro-)28 4916 y(gram)c(of)h(the)h(O\016ce)f +(of)g(Adv)-5 b(anced)27 b(Scien)n(ti\014c)f(Computing)g(Researc)n(h,)f +(U.S.)i(Departmen)n(t)f(of)g(Energy)-7 b(,)25 b(under)i(Con)n(tract)28 +5029 y(W-31-109-Eng-38;)37 b(and)g(b)n(y)f(the)i(Scalable)e(I/O)g +(Initiativ)n(e,)j(a)e(m)n(ultiagency)f(pro)5 b(ject)36 +b(funded)i(b)n(y)f(the)g(Defense)g(Ad-)28 5142 y(v)-5 +b(anced)29 b(Researc)n(h)f(Pro)5 b(jects)27 b(Agency)i(\(Con)n(tract)f +(D)n(ABT63-94-C-0049\),)d(the)k(Departmen)n(t)h(of)f(Energy)-7 +b(,)28 b(the)h(National)28 5255 y(Aeronautics)e(and)g(Space)h +(Administration,)f(and)h(the)g(National)f(Science)g(F)-7 +b(oundation.)p eop end +%%Page: 2 2 +TeXDict begin 2 1 bop 28 263 a Fn(Con)l(ten)l(ts)28 466 +y Fk(Abstract)3448 b(1)28 670 y(1)85 b(In)m(tro)s(duction)3135 +b(1)28 874 y(2)85 b(Ma)6 b(jor)35 b(Changes)f(in)h(This)g(V)-9 +b(ersion)2276 b(1)28 1078 y(3)85 b(General)35 b(Information)2774 +b(1)165 1191 y Fo(3.1)94 b(R)m(OMIO)30 b(Optimizations)38 +b(.)45 b(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g +(.)130 b(2)165 1304 y(3.2)94 b(Hin)m(ts)31 b(.)45 b(.)h(.)g(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.) +g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g +(.)f(.)h(.)g(.)130 b(3)374 1417 y(3.2.1)106 b(Hin)m(ts)31 +b(for)f(XFS)e(.)46 b(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.) +h(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)130 b(5)374 1530 y(3.2.2)106 b(Hin)m(ts)31 +b(for)f(PVFS2)g(\(a.k.a)i(OrangeFS\))52 b(.)45 b(.)h(.)g(.)f(.)h(.)g(.) +f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(5)374 1642 y(3.2.3)106 b(Hin)m(ts)31 b(for)f(Lustre)92 +b(.)46 b(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.) +f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(5)374 1755 y(3.2.4)106 b(Hin)m(ts)31 b(for)f(P)-8 b(ANFS)31 +b(\(P)m(anasas\))54 b(.)45 b(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f(.) +h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(6)374 1868 y(3.2.5)106 b(System)m(wide)30 b(Hin)m(ts)93 +b(.)46 b(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f(.) +h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(7)165 1981 y(3.3)94 b(Using)30 b(R)m(OMIO)h(on)f(NFS)38 +b(.)45 b(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g +(.)130 b(8)374 2094 y(3.3.1)106 b(R)m(OMIO,)30 b(NFS,)h(and)f(Sync)m +(hronization)83 b(.)46 b(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.) +f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 b(9)165 2207 +y(3.4)94 b(Using)30 b(testfs)61 b(.)45 b(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.)g +(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(9)165 2320 y(3.5)94 b(R)m(OMIO)30 b(and)g Fj(MPI)p +1053 2320 29 4 v 33 w(FILE)p 1278 2320 V 34 w(SYNC)38 +b Fo(.)46 b(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f(.)h +(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)130 +b(9)165 2433 y(3.6)94 b(R)m(OMIO)30 b(and)g Fj(MPI)p +1053 2433 V 33 w(FILE)p 1278 2433 V 34 w(SET)p 1456 2433 +V 33 w(SIZE)73 b Fo(.)46 b(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f +(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)84 +b(10)28 2637 y Fk(4)h(Installation)34 b(Instructions)2557 +b(10)165 2750 y Fo(4.1)94 b(Con\014guring)29 b(for)h(Lin)m(ux)g(and)g +(Large)h(Files)77 b(.)46 b(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g +(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)84 +b(11)28 2953 y Fk(5)h(T)-9 b(esting)35 b(R)m(OMIO)2919 +b(11)28 3157 y(6)85 b(Compiling)35 b(and)g(Running)h(MPI-IO)e(Programs) +1687 b(12)28 3361 y(7)85 b(Limitations)34 b(of)h(This)g(V)-9 +b(ersion)36 b(of)f(R)m(OMIO)1881 b(12)28 3565 y(8)85 +b(Usage)35 b(Tips)3151 b(13)28 3769 y(9)85 b(Rep)s(orting)35 +b(Bugs)2937 b(13)28 3973 y(10)33 b(R)m(OMIO)h(In)m(ternals)2847 +b(13)28 4176 y(11)33 b(Learning)i(MPI-IO)2858 b(14)28 +4380 y(12)33 b(Ma)6 b(jor)35 b(Changes)f(in)h(Previous)h(Releases)1984 +b(14)165 4493 y Fo(12.1)49 b(Ma)5 b(jor)31 b(Changes)f(in)g(V)-8 +b(ersion)31 b(1.2.3)51 b(.)46 b(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)84 b(14)165 4606 y(12.2)49 b(Ma)5 b(jor)31 b(Changes)f(in)g(V)-8 +b(ersion)31 b(1.0.3)51 b(.)46 b(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)84 b(14)165 4719 y(12.3)49 b(Ma)5 b(jor)31 b(Changes)f(in)g(V)-8 +b(ersion)31 b(1.0.2)51 b(.)46 b(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)84 b(14)165 4832 y(12.4)49 b(Ma)5 b(jor)31 b(Changes)f(in)g(V)-8 +b(ersion)31 b(1.0.1)51 b(.)46 b(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h +(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.)g(.)g(.)f(.)h(.)g(.)f(.)h(.) +g(.)84 b(16)28 5036 y Fk(References)3306 b(17)p eop end +%%Page: 1 3 +TeXDict begin 1 2 bop 892 263 a Fk(Users)36 b(Guide)f(for)g(R)m(OMIO:)f +(A)h(High-P)m(erformance,)1205 416 y(P)m(ortable)g(MPI-IO)f(Implemen)m +(tation)1930 607 y Fo(b)m(y)749 798 y Fi(R)-5 b(aje)g(ev)33 +b(Thakur,)g(R)-5 b(ob)g(ert)35 b(R)-5 b(oss,)33 b(Ewing)g(Lusk,)f(and)i +(Wil)5 b(liam)33 b(Gr)-5 b(opp)1796 1097 y Fh(Abstract)256 +1249 y Fl(R)n(OMIO)35 b(is)i(a)f(high-p)r(erformance,)h(p)r(ortable)f +(implemen)n(tation)h(of)f(MPI-IO)f(\(the)j(I/O)d(c)n(hapter)h(in)h(the) +256 1348 y(MPI)27 b(Standard)o(\).)77 b(This)41 b(do)r(cumen)n(t)g +(describ)r(es)f(ho)n(w)h(to)f(install)h(and)g(use)g(R)n(OMIO)f(v)n +(ersion)f(1.2.4)g(on)256 1448 y(v)-5 b(arious)26 b(mac)n(hines.)28 +1734 y Fn(1)135 b(In)l(tro)t(duction)28 1937 y Fo(R)m(OMIO)350 +1904 y Fg(1)418 1937 y Fo(is)28 b(a)g(high-p)s(erformance,)g(p)s +(ortable)g(implemen)m(tation)h(of)g(MPI-IO)e(\(the)i(I/O)f(c)m(hapter)g +(in)g(MPI)g([4]\).)28 2050 y(This)i(do)s(cumen)m(t)g(describ)s(es)g(ho) +m(w)g(to)h(install)g(and)f(use)g(R)m(OMIO)h(v)m(ersion)f(1.2.4)j(on)d +(v)-5 b(arious)30 b(mac)m(hines.)28 2337 y Fn(2)135 b(Ma)7 +b(jor)46 b(Changes)f(in)g(This)f(V)-11 b(ersion)165 2540 +y Ff(\017)46 b Fo(Added)40 b(section)j(describing)e(R)m(OMIO)g +Fj(MPI)p 1826 2540 29 4 v 34 w(FILE)p 2052 2540 V 33 +w(SYNC)g Fo(and)f Fj(MPI)p 2649 2540 V 34 w(FILE)p 2875 +2540 V 33 w(CLOSE)g Fo(b)s(eha)m(vior)i(to)g(User's)256 +2653 y(Guide)165 2840 y Ff(\017)k Fo(Bug)30 b(remo)m(v)m(ed)i(from)e +(PVFS)g(ADIO)g(implemen)m(tation)i(regarding)f(resize)g(op)s(erations) +165 3028 y Ff(\017)46 b Fo(Added)29 b(supp)s(ort)g(for)h(PVFS)g(listio) +i(op)s(erations)e(\(see)i(Section)f(3.2\))165 3215 y +Ff(\017)46 b Fo(Added)29 b(the)i(follo)m(wing)g(w)m(orking)g(hin)m(ts:) +41 b Fj(romio)p 1937 3215 V 33 w(pvfs)p 2162 3215 V 33 +w(listio)p 2483 3215 V 33 w(read)p Fo(,)29 b Fj(romio)p +3002 3215 V 33 w(pvfs)p 3227 3215 V 33 w(listio)p 3548 +3215 V 33 w(write)28 3502 y Fn(3)135 b(General)46 b(Information)28 +3705 y Fo(This)28 b(v)m(ersion)g(of)g(R)m(OMIO)g(includes)g(ev)m +(erything)h(de\014ned)e(in)g(the)h(MPI)g(I/O)g(c)m(hapter)h(except)g +(supp)s(ort)d(for)i(\014le)28 3818 y(in)m(terop)s(erabilit)m(y)36 +b(and)e(user-de\014ned)e(error)i(handlers)f(for)h(\014les)h(\()p +Ff(x)f Fo(4.13.3\).)55 b(The)34 b(subarra)m(y)g(and)f(distributed)28 +3931 y(arra)m(y)c(datat)m(yp)s(e)g(constructor)g(functions)e(from)h +(Chapter)f(4)i(\()p Ff(x)g Fo(4.14.4)h(&)e Ff(x)g Fo(4.14.5\))j(ha)m(v) +m(e)e(b)s(een)e(implemen)m(ted.)28 4044 y(They)h(are)h(useful)e(for)i +(accessing)g(arra)m(ys)g(stored)g(in)f(\014les.)40 b(The)27 +b(functions)h Fj(MPI)p 2783 4044 V 34 w(File)p 3009 4044 +V 33 w(f2c)g Fo(and)f Fj(MPI)p 3532 4044 V 34 w(File)p +3758 4044 V 33 w(c2f)28 4156 y Fo(\()p Ff(x)33 b Fo(4.12.4\))h(are)e +(also)g(implemen)m(ted.)45 b(C,)31 b(F)-8 b(ortran,)33 +b(and)e(pro\014ling)g(in)m(terfaces)i(are)f(pro)m(vided)f(for)g(all)i +(functions)28 4269 y(that)e(ha)m(v)m(e)h(b)s(een)e(implemen)m(ted.)169 +4382 y(R)m(OMIO)c(has)f(run)f(on)i(at)g(least)h(the)e(follo)m(wing)i +(mac)m(hines:)39 b(IBM)26 b(SP;)f(In)m(tel)h(P)m(aragon;)j(HP)d +(Exemplar;)h(SGI)28 4495 y(Origin2000;)j(Cra)m(y)c(T3E;)g(NEC)g(SX-4;)j +(other)d(symmetric)h(m)m(ultipro)s(cessors)f(from)g(HP)-8 +b(,)27 b(SGI,)f(DEC,)g(Sun,)g(and)28 4608 y(IBM;)34 b(and)e(net)m(w)m +(orks)i(of)f(w)m(orkstations)h(\(Sun,)f(SGI,)g(HP)-8 +b(,)33 b(IBM,)h(DEC,)f(Lin)m(ux,)g(and)f(F)-8 b(reeBSD\).)35 +b(Supp)s(orted)28 4721 y(\014le)e(systems)f(ha)m(v)m(e)i(at)f(one)g +(time)g(included)e(IBM)i(PIOFS,)f(In)m(tel)h(PFS,)g(HP/Con)m(v)m(ex)g +(HFS,)g(SGI)f(XFS,)h(NEC)28 4834 y(SFS,)j(PVFS,)h(NFS,)g(NTFS,)f(and)g +(an)m(y)h(Unix)f(\014le)h(system)f(\(UFS\).)i(Y)-8 b(ou)37 +b(ma)m(y)g(ha)m(v)m(e)h(to)f(do)m(wnload)g(an)f(older)28 +4947 y(R)m(OMIO)31 b(or)f(MPICH)g(release)i(for)e(out-of-date)i +(systems.)p 28 5026 1560 4 v 132 5080 a Fe(1)167 5111 +y Fd(http://www.mcs.anl.gov/romio)1956 5520 y Fo(1)p +eop end +%%Page: 2 4 +TeXDict begin 2 3 bop 169 263 a Fo(This)38 b(v)m(ersion)i(of)e(R)m +(OMIO)h(is)g(included)f(in)g(MPICH;)h(an)g(earlier)g(v)m(ersion)g(is)g +(included)f(in)h(at)g(least)h(the)28 376 y(follo)m(wing)f(MPI)d +(implemen)m(tations:)55 b(LAM,)38 b(HP)f(MPI,)g(SGI)f(MPI,)h(and)f(NEC) +h(MPI.)g(Man)m(y)g(HPC)g(v)m(endors)28 488 y(base)31 +b(their)f(MPI-IO)g(implemen)m(tation)i(on)f(R)m(OMIO.)169 +601 y(Note)h(that)e(prop)s(er)e(I/O)i(error)f(co)s(des)h(and)f(classes) +i(are)f(returned)f(and)g(the)h(status)g(v)-5 b(ariable)31 +b(is)f(\014lled)f(only)28 714 y(when)h(used)f(with)h(MPICH)h(revision)f +(1.2.1)i(or)f(later.)169 827 y(Y)-8 b(ou)35 b(can)f(op)s(en)g(\014les)g +(on)g(m)m(ultiple)h(\014le)f(systems)g(in)g(the)g(same)h(program.)52 +b(The)33 b(only)h(restriction)h(is)g(that)28 940 y(the)g(directory)g +(where)f(the)g(\014le)g(is)h(to)g(b)s(e)f(op)s(ened)f(m)m(ust)h(b)s(e)g +(accessible)i(from)e(the)h(pro)s(cess)e(op)s(ening)h(the)h(\014le.)28 +1053 y(F)-8 b(or)35 b(example,)h(a)f(pro)s(cess)f(running)e(on)i(one)h +(w)m(orkstation)g(ma)m(y)g(not)g(b)s(e)e(able)i(to)g(access)h(a)e +(directory)h(on)f(the)28 1166 y(lo)s(cal)i(disk)d(of)i(another)f(w)m +(orkstation,)i(and)e(therefore)h(R)m(OMIO)f(will)g(not)g(b)s(e)g(able)g +(to)h(op)s(en)f(a)g(\014le)g(in)g(suc)m(h)g(a)28 1279 +y(directory)-8 b(.)42 b(NFS-moun)m(ted)31 b(\014les)f(can)h(b)s(e)e +(accessed.)169 1392 y(An)f(MPI-IO)f(\014le)g(created)i(b)m(y)e(R)m +(OMIO)h(is)f(no)h(di\013eren)m(t)g(from)f(an)m(y)g(other)h(\014le)g +(created)g(b)m(y)g(the)f(underlying)28 1505 y(\014le)h(system.)40 +b(Therefore,)29 b(y)m(ou)f(ma)m(y)h(use)e(an)m(y)i(of)f(the)g(commands) +f(pro)m(vided)h(b)m(y)g(the)g(\014le)g(system)g(to)h(access)g(the)28 +1618 y(\014le,)i(for)f(example,)h Fj(ls)p Fo(,)g Fj(mv)p +Fo(,)f Fj(cp)p Fo(,)g Fj(rm)p Fo(,)g Fj(ftp)p Fo(.)169 +1730 y(Please)24 b(read)e(the)g(limitations)i(of)e(this)g(v)m(ersion)g +(of)h(R)m(OMIO)e(that)i(are)g(listed)f(in)g(Section)h(7)f(of)g(this)g +(do)s(cumen)m(t)28 1843 y(\(e.g.,)33 b(restriction)e(to)g(homogeneous)g +(en)m(vironmen)m(ts\).)28 2087 y Fc(3.1)113 b(R)m(OMIO)37 +b(Optimizations)28 2258 y Fo(R)m(OMIO)i(implemen)m(ts)g(t)m(w)m(o)h +(I/O)e(optimization)j(tec)m(hniques)e(that)g(in)f(general)i(result)e +(in)g(impro)m(v)m(ed)h(p)s(erfor-)28 2371 y(mance)44 +b(for)f(applications.)79 b(The)43 b(\014rst)f(of)h(these)h(is)f +Fi(data)i(sieving)51 b Fo([2].)79 b(Data)45 b(sieving)e(is)g(a)h(tec)m +(hnique)f(for)28 2484 y(e\016cien)m(tly)g(accessing)g(noncon)m(tiguous) +f(regions)f(of)h(data)g(in)f(\014les)g(when)f(noncon)m(tiguous)i +(accesses)g(are)g(not)28 2597 y(pro)m(vided)35 b(as)g(a)g(\014le)f +(system)h(primitiv)m(e.)55 b(The)34 b(naiv)m(e)i(approac)m(h)f(to)g +(accessing)h(noncon)m(tiguous)g(regions)f(is)g(to)28 +2710 y(use)j(a)f(separate)i(I/O)e(call)i(for)e(eac)m(h)i(con)m(tiguous) +g(region)f(in)f(the)h(\014le.)62 b(This)37 b(results)g(in)g(a)h(large)h +(n)m(um)m(b)s(er)d(of)28 2823 y(I/O)29 b(op)s(erations,)h(eac)m(h)g(of) +f(whic)m(h)f(is)h(often)g(for)g(a)g(v)m(ery)g(small)g(amoun)m(t)g(of)g +(data.)41 b(The)29 b(added)f(net)m(w)m(ork)h(cost)h(of)28 +2936 y(p)s(erforming)g(an)h(I/O)h(op)s(eration)f(across)h(the)f(net)m +(w)m(ork,)i(as)e(in)g(parallel)i(I/O)e(systems,)g(is)h(often)f(high)g +(b)s(ecause)28 3049 y(of)37 b(latency)-8 b(.)62 b(Th)m(us,)37 +b(this)g(naiv)m(e)h(approac)m(h)f(t)m(ypically)h(p)s(erforms)d(v)m(ery) +j(p)s(o)s(orly)e(b)s(ecause)g(of)h(the)g(o)m(v)m(erhead)h(of)28 +3162 y(m)m(ultiple)28 b(op)s(erations.)39 b(In)26 b(the)h(data)g +(sieving)g(tec)m(hnique,)i(a)e(n)m(um)m(b)s(er)e(of)i(noncon)m(tiguous) +g(regions)g(are)g(accessed)28 3275 y(b)m(y)g(reading)f(a)h(blo)s(c)m(k) +g(of)g(data)g(con)m(taining)h(all)g(of)f(the)f(regions,)i(including)e +(the)h(un)m(w)m(an)m(ted)g(data)g(b)s(et)m(w)m(een)g(them)28 +3388 y(\(called)h(\\holes"\).)41 b(The)25 b(regions)i(of)f(in)m(terest) +h(are)g(then)e(extracted)j(from)d(this)h(large)h(blo)s(c)m(k)g(b)m(y)f +(the)g(clien)m(t.)41 b(This)28 3500 y(tec)m(hnique)e(has)f(the)h(adv)-5 +b(an)m(tage)40 b(of)e(a)h(single)f(I/O)h(call,)i(but)d(additional)h +(data)g(is)f(read)g(from)g(the)g(disk)g(and)28 3613 y(passed)30 +b(across)h(the)g(net)m(w)m(ork.)169 3726 y(There)38 b(are)h(four)e(hin) +m(ts)i(that)f(can)h(b)s(e)f(used)f(to)i(con)m(trol)h(the)e(application) +i(of)e(data)h(sieving)g(in)f(R)m(OMIO:)28 3839 y Fj(ind)p +178 3839 29 4 v 34 w(rd)p 308 3839 V 34 w(buffer)p 630 +3839 V 32 w(size)p Fo(,)g Fj(ind)p 1061 3839 V 33 w(wr)p +1190 3839 V 34 w(buffer)p 1512 3839 V 33 w(size)p Fo(,)f +Fj(romio)p 2039 3839 V 33 w(ds)p 2168 3839 V 34 w(read)p +Fo(,)g(and)f Fj(romio)p 2879 3839 V 33 w(ds)p 3008 3839 +V 34 w(write)p Fo(.)58 b(These)36 b(are)h(dis-)28 3952 +y(cussed)30 b(in)g(Section)h(3.2.)169 4065 y(The)g(second)h +(optimization)h(is)e Fi(two-phase)k(I/O)40 b Fo([1)q(].)j(Tw)m(o-phase) +32 b(I/O,)f(also)i(called)f(collectiv)m(e)j(bu\013ering,)28 +4178 y(is)d(an)f(optimization)i(that)f(only)g(applies)f(to)i(collectiv) +m(e)i(I/O)c(op)s(erations.)44 b(In)31 b(t)m(w)m(o-phase)h(I/O,)g(the)g +(collection)28 4291 y(of)39 b(indep)s(enden)m(t)e(I/O)h(op)s(erations)h +(that)g(mak)m(e)g(up)e(the)i(collectiv)m(e)i(op)s(eration)e(are)g +(analyzed)g(to)g(determine)28 4404 y(what)31 b(data)h(regions)f(m)m +(ust)g(b)s(e)f(transferred)g(\(read)h(or)g(written\).)42 +b(These)31 b(regions)g(are)g(then)g(split)g(up)e(amongst)28 +4517 y(a)i(set)g(of)f(aggregator)j(pro)s(cesses)d(that)h(will)g +(actually)h(in)m(teract)g(with)e(the)g(\014le)h(system.)41 +b(In)29 b(the)i(case)g(of)f(a)h(read,)28 4630 y(these)f(aggregators)i +(\014rst)c(read)h(their)h(regions)f(from)g(disk)g(and)f(redistribute)h +(the)g(data)h(to)g(the)g(\014nal)f(lo)s(cations,)28 4742 +y(while)k(in)f(the)h(case)g(of)g(a)g(write,)g(data)h(is)e(\014rst)g +(collected)j(from)d(the)g(pro)s(cesses)h(b)s(efore)f(b)s(eing)g +(written)g(to)i(disk)28 4855 y(b)m(y)d(the)f(aggregators.)169 +4968 y(There)20 b(are)h(\014v)m(e)f(hin)m(ts)h(that)f(can)h(b)s(e)f +(used)f(to)i(con)m(trol)h(the)e(application)i(of)e(t)m(w)m(o-phase)i +(I/O:)e Fj(cb)p 3397 4968 V 34 w(config)p 3719 4968 V +33 w(list)p Fo(,)28 5081 y Fj(cb)p 130 5081 V 34 w(nodes)p +Fo(,)33 b Fj(cb)p 558 5081 V 33 w(buffer)p 879 5081 V +33 w(size)p Fo(,)g Fj(romio)p 1402 5081 V 33 w(cb)p 1531 +5081 V 34 w(read)p Fo(,)f(and)h Fj(romio)p 2234 5081 +V 33 w(cb)p 2363 5081 V 34 w(write)p Fo(.)47 b(These)33 +b(are)g(discussed)f(in)h(Subsec-)28 5194 y(tion)e(3.2.)1956 +5520 y(2)p eop end +%%Page: 3 5 +TeXDict begin 3 4 bop 28 263 a Fc(3.2)113 b(Hin)m(ts)28 +434 y Fo(If)27 b(R)m(OMIO)h(do)s(esn't)f(understand)f(a)i(hin)m(t,)g +(or)f(if)h(the)g(v)-5 b(alue)28 b(is)f(in)m(v)-5 b(alid,)29 +b(the)f(hin)m(t)f(will)h(b)s(e)f(ignored.)40 b(The)27 +b(v)-5 b(alues)28 547 y(of)31 b(hin)m(ts)f(b)s(eing)g(used)g(b)m(y)g(R) +m(OMIO)g(for)g(a)h(\014le)g(can)f(b)s(e)g(obtained)h(at)g(an)m(y)g +(time)g(via)g Fj(MPI)p 3103 547 29 4 v 33 w(File)p 3328 +547 V 33 w(get)p 3505 547 V 34 w(info)p Fo(.)169 660 +y(The)j(follo)m(wing)h(hin)m(ts)f(con)m(trol)h(the)f(data)h(sieving)g +(optimization)g(and)f(are)g(applicable)h(to)f(all)h(\014le)f(system)28 +773 y(t)m(yp)s(es:)165 986 y Ff(\017)46 b Fj(ind)p 406 +986 V 33 w(rd)p 535 986 V 34 w(buffer)p 857 986 V 33 +w(size)24 b Fo({)h(Con)m(trols)h(the)g(size)g(\(in)f(b)m(ytes\))h(of)f +(the)h(in)m(termediate)h(bu\013er)d(used)g(b)m(y)h(R)m(OMIO)256 +1098 y(when)k(p)s(erforming)g(data)i(sieving)g(during)e(read)i(op)s +(erations.)41 b(Default)31 b(is)g Fj(4194304)d Fo(\(4)j(Mb)m(ytes\).) +165 1286 y Ff(\017)46 b Fj(ind)p 406 1286 V 33 w(wr)p +535 1286 V 34 w(buffer)p 857 1286 V 33 w(size)24 b Fo({)h(Con)m(trols)h +(the)g(size)g(\(in)f(b)m(ytes\))h(of)f(the)h(in)m(termediate)h +(bu\013er)d(used)g(b)m(y)h(R)m(OMIO)256 1399 y(when)k(p)s(erforming)g +(data)i(sieving)g(during)e(write)i(op)s(erations.)41 +b(Default)31 b(is)g Fj(524288)e Fo(\(512)j(Kb)m(ytes\).)165 +1587 y Ff(\017)46 b Fj(romio)p 502 1587 V 33 w(ds)p 631 +1587 V 33 w(read)27 b Fo({)h(Determines)g(when)f(R)m(OMIO)g(will)h(c)m +(ho)s(ose)g(to)h(p)s(erform)d(data)i(sieving.)40 b(V)-8 +b(alid)29 b(v)-5 b(alues)256 1700 y(are)20 b Fj(enable)p +Fo(,)h Fj(disable)p Fo(,)g(or)f Fj(automatic)p Fo(.)35 +b(Default)21 b(v)-5 b(alue)21 b(is)f Fj(automatic)p Fo(.)35 +b(In)20 b Fj(automatic)d Fo(mo)s(de)j(R)m(OMIO)256 1812 +y(ma)m(y)31 b(c)m(ho)s(ose)g(to)g(enable)g(or)f(disable)h(data)g +(sieving)g(based)f(on)g(heuristics.)165 2000 y Ff(\017)46 +b Fj(romio)p 502 2000 V 33 w(ds)p 631 2000 V 33 w(write)29 +b Fo({)i(Same)g(as)f(ab)s(o)m(v)m(e,)i(only)e(for)h(writes.)169 +2213 y(The)d(follo)m(wing)h(hin)m(ts)f(con)m(trol)h(the)f(t)m(w)m +(o-phase)h(\(collectiv)m(e)j(bu\013ering\))27 b(optimization)j(and)d +(are)h(applicable)28 2326 y(to)j(all)h(\014le)e(system)h(t)m(yp)s(es:) +165 2513 y Ff(\017)46 b Fj(cb)p 358 2513 V 33 w(buffer)p +679 2513 V 33 w(size)34 b Fo({)h(Con)m(trols)g(the)h(size)f(\(in)g(b)m +(ytes\))h(of)f(the)g(in)m(termediate)h(bu\013er)e(used)g(in)h(t)m(w)m +(o-phase)256 2626 y(collectiv)m(e)29 b(I/O.)e(If)f(the)g(amoun)m(t)h +(of)f(data)h(that)g(an)g(aggregator)h(will)f(transfer)f(is)g(larger)h +(than)f(this)h(v)-5 b(alue,)256 2739 y(then)30 b(m)m(ultiple)h(op)s +(erations)f(are)h(used.)40 b(The)30 b(default)h(is)f +Fj(4194304)e Fo(\(4)j(Mb)m(ytes\).)165 2927 y Ff(\017)46 +b Fj(cb)p 358 2927 V 33 w(nodes)31 b Fo({)h(Con)m(trols)g(the)g(maxim)m +(um)g(n)m(um)m(b)s(er)e(of)i(aggregators)i(to)f(b)s(e)e(used.)44 +b(By)32 b(default)g(this)g(is)g(set)256 3040 y(to)f(the)f(n)m(um)m(b)s +(er)f(of)i(unique)e(hosts)i(in)f(the)g(comm)m(unicator)i(used)e(when)f +(op)s(ening)h(the)g(\014le.)165 3227 y Ff(\017)46 b Fj(romio)p +502 3227 V 33 w(cb)p 631 3227 V 33 w(read)33 b Fo({)h(Con)m(trols)h +(when)e(collectiv)m(e)k(bu\013ering)c(is)h(applied)g(to)g(collectiv)m +(e)k(read)c(op)s(erations.)256 3340 y(V)-8 b(alid)38 +b(v)-5 b(alues)37 b(are)h Fj(enable)p Fo(,)f Fj(disable)p +Fo(,)g(and)g Fj(automatic)p Fo(.)58 b(Default)38 b(is)g +Fj(automatic)p Fo(.)58 b(When)37 b(enabled,)256 3453 +y(all)h(collectiv)m(e)j(reads)c(will)h(use)f(collectiv)m(e)k +(bu\013ering.)61 b(When)37 b(disabled,)i(all)f(collectiv)m(e)j(reads)c +(will)h(b)s(e)256 3566 y(serviced)d(with)g(individual)g(op)s(erations)g +(b)m(y)g(eac)m(h)i(pro)s(cess.)55 b(When)35 b(set)h(to)g +Fj(automatic)p Fo(,)e(R)m(OMIO)h(will)256 3679 y(use)30 +b(heuristics)g(to)h(determine)g(when)e(to)i(enable)g(the)f +(optimization.)165 3866 y Ff(\017)46 b Fj(romio)p 502 +3866 V 33 w(cb)p 631 3866 V 33 w(write)26 b Fo({)h(Con)m(trols)g(when)f +(collectiv)m(e)k(bu\013ering)c(is)h(applied)g(to)g(collectiv)m(e)k +(write)c(op)s(erations.)256 3979 y(V)-8 b(alid)26 b(v)-5 +b(alues)25 b(are)g Fj(enable)p Fo(,)g Fj(disable)p Fo(,)f(and)h +Fj(automatic)p Fo(.)36 b(Default)26 b(is)f Fj(automatic)p +Fo(.)37 b(See)25 b(the)g(description)256 4092 y(of)37 +b Fj(romio)p 612 4092 V 33 w(cb)p 741 4092 V 34 w(read)29 +b Fo(for)h(an)h(explanation)g(of)g(the)f(v)-5 b(alues.)165 +4280 y Ff(\017)46 b Fj(romio)p 502 4280 V 33 w(no)p 631 +4280 V 33 w(indep)p 904 4280 V 33 w(rw)36 b Fo({)h(This)e(hin)m(t)i +(con)m(trols)g(when)e(\\deferred)h(op)s(en")g(is)h(used.)57 +b(When)36 b(set)h(to)g Fj(true)p Fo(,)256 4393 y(R)m(OMIO)30 +b(will)h(mak)m(e)g(an)f(e\013ort)h(to)h(a)m(v)m(oid)g(p)s(erforming)d +(an)m(y)h(\014le)h(op)s(eration)g(on)f(non-aggregator)j(no)s(des.)256 +4506 y(The)38 b(application)i(is)g(exp)s(ected)f(to)h(use)f(only)g +(collectiv)m(e)j(op)s(erations.)67 b(This)39 b(is)g(discussed)f(in)h +(further)256 4619 y(detail)31 b(b)s(elo)m(w.)165 4806 +y Ff(\017)46 b Fj(cb)p 358 4806 V 33 w(config)p 679 4806 +V 33 w(list)40 b Fo({)h(Pro)m(vides)g(explicit)h(con)m(trol)h(o)m(v)m +(er)f(aggregators.)74 b(This)40 b(is)h(discussed)f(in)h(further)256 +4919 y(detail)31 b(b)s(elo)m(w.)169 5107 y(F)-8 b(or)37 +b(some)e(systems)h(con\014gurations,)h(more)f(con)m(trol)g(is)g(needed) +f(to)h(sp)s(ecify)f(whic)m(h)g(hardw)m(are)g(resources)28 +5220 y(\(pro)s(cessors)i(or)f(no)s(des)g(in)g(an)h(SMP\))f(are)h +(preferred)f(for)g(collectiv)m(e)k(I/O,)d(either)g(for)f(p)s +(erformance)g(reasons)1956 5520 y(3)p eop end +%%Page: 4 6 +TeXDict begin 4 5 bop 28 263 a Fo(or)46 b(b)s(ecause)g(only)g(certain)g +(resources)g(ha)m(v)m(e)h(access)g(to)g(storage.)88 b(The)45 +b(additional)i(MPI)p 3307 263 28 4 v 32 w(Info)f(k)m(ey)g(name)28 +376 y Fj(cb)p 130 376 29 4 v 34 w(config)p 452 376 V +33 w(list)d Fo(sp)s(eci\014es)g(a)h(comma-separated)i(list)f(of)f +(strings,)j(eac)m(h)e(string)f(sp)s(ecifying)g(a)g(particular)28 +488 y(no)s(de)34 b(and)g(an)g(optional)h(limit)g(on)f(the)h(n)m(um)m(b) +s(er)e(of)h(pro)s(cesses)g(to)h(b)s(e)f(used)f(for)h(collectiv)m(e)k +(bu\013ering)33 b(on)h(this)28 601 y(no)s(de.)169 714 +y(This)26 b(refers)f(to)i(the)g(same)f(pro)s(cesses)g(that)h +Fj(cb)p 1781 714 V 34 w(nodes)d Fo(refers)i(to,)i(but)d(sp)s(eci\014es) +h(the)g(a)m(v)-5 b(ailable)29 b(no)s(des)c(more)28 827 +y(precisely)-8 b(.)169 940 y(The)30 b(format)h(of)g(the)f(v)-5 +b(alue)31 b(of)38 b Fj(cb)p 1360 940 V 33 w(config)p +1681 940 V 33 w(list)29 b Fo(is)i(giv)m(en)g(b)m(y)f(the)h(follo)m +(wing)h(BNF:)28 1128 y Fj(cb_config_list)44 b(=>)j(hostspec)f([)h(',')g +(cb_config_list)d(])28 1241 y(hostspec)i(=>)h(hostname)f([)h(':')g +(maxprocesses)d(])28 1354 y(hostname)i(=>)h(<alphanumeric)d(string>)458 +1466 y(|)95 b('*')28 1579 y(maxprocesses)45 b(=>)i(<digits>)458 +1692 y(|)95 b('*')169 1880 y Fo(The)45 b(v)-5 b(alue)45 +b Fj(hostname)e Fo(iden)m(ti\014es)j(a)f(pro)s(cessor.)84 +b(This)44 b(name)i(m)m(ust)e(matc)m(h)i(the)f(name)h(returned)d(b)m(y) +28 1993 y Fj(MPI)p 178 1993 V 34 w(Get)p 356 1993 V 33 +w(processor)p 821 1993 V 32 w(name)1079 1960 y Fg(2)1158 +1993 y Fo(for)e(the)f(sp)s(eci\014ed)g(hardw)m(are.)71 +b(The)40 b(v)-5 b(alue)40 b Fj(*)h Fo(as)f(a)h(hostname)g(matc)m(hes)g +(all)28 2106 y(pro)s(cessors.)g(The)29 b(v)-5 b(alue)31 +b(of)g(maxpro)s(cesses)f(ma)m(y)h(b)s(e)f(an)m(y)h(nonnegativ)m(e)h(in) +m(teger)f(\(zero)h(is)e(allo)m(w)m(ed\).)169 2219 y(The)41 +b(v)-5 b(alue)42 b Fj(maxprocesses)37 b Fo(sp)s(eci\014es)k(the)g +(maxim)m(um)g(n)m(um)m(b)s(er)f(of)h(pro)s(cesses)g(that)h(ma)m(y)g(b)s +(e)e(used)g(for)28 2332 y(collectiv)m(e)g(bu\013ering)34 +b(on)i(the)g(sp)s(eci\014ed)f(host.)56 b(If)35 b(no)h(v)-5 +b(alue)36 b(is)g(sp)s(eci\014ed,)g(the)g(v)-5 b(alue)36 +b(one)g(is)g(assumed.)55 b(If)43 b Fj(*)28 2444 y Fo(is)35 +b(sp)s(eci\014ed)f(for)h(the)g(n)m(um)m(b)s(er)e(of)i(pro)s(cesses,)h +(then)e(all)i(MPI)f(pro)s(cesses)f(with)h(this)g(same)g(hostname)g +(will)g(b)s(e)28 2557 y(used..)169 2670 y(Leftmost)d(comp)s(onen)m(ts)e +(of)h(the)f(info)g(v)-5 b(alue)31 b(tak)m(e)h(precedence.)169 +2783 y(Note:)38 b(Matc)m(hing)22 b(of)f(pro)s(cessor)f(names)h(to)g +Fj(cb)p 1768 2783 V 34 w(config)p 2090 2783 V 32 w(list)f +Fo(en)m(tries)h(is)g(p)s(erformed)e(with)i(string)f(matc)m(hing)28 +2896 y(functions)30 b(and)g(is)g(indep)s(enden)m(t)g(of)g(the)h +(listing)g(of)f(mac)m(hines)h(that)g(the)g(user)e(pro)m(vides)i(to)g +(mpirun/mpiexec.)28 3009 y(In)24 b(other)g(w)m(ords,)h(listing)f(the)h +(same)f(mac)m(hine)h(m)m(ultiple)f(times)h(in)e(the)h(list)h(of)f +(hosts)g(to)h(run)d(on)i(will)g(not)g(cause)h(a)28 3122 +y Fj(*:1)g Fo(to)h(assign)g(the)g(same)g(host)g(four)f(aggregators,)k +(b)s(ecause)d(the)g(matc)m(hing)g(co)s(de)g(will)g(see)h(that)f(the)g +(pro)s(cessor)28 3235 y(name)31 b(is)f(the)h(same)g(for)f(all)h(four)f +(and)f(will)i(assign)g(exactly)h(one)f(aggregator)i(to)e(the)f(pro)s +(cessor.)169 3348 y(The)39 b(v)-5 b(alue)40 b(of)f(this)g(info)g(k)m +(ey)h(m)m(ust)f(b)s(e)f(the)h(same)h(for)f(all)h(pro)s(cesses)e +(\(i.e.,)43 b(the)d(call)g(is)f(collectiv)m(e)k(and)28 +3461 y(eac)m(h)33 b(pro)s(cess)e(m)m(ust)g(receiv)m(e)i(the)e(same)h +(hin)m(t)f(v)-5 b(alue)32 b(for)f(these)h(collectiv)m(e)j(bu\013ering) +30 b(hin)m(ts\).)44 b(F)-8 b(urther,)31 b(in)g(the)28 +3574 y(R)m(OMIO)g(implemen)m(tation)h(the)e(hin)m(t)h(is)f(only)g +(recognized)i(at)f Fj(MPI)p 2372 3574 V 34 w(File)p 2598 +3574 V 33 w(open)e Fo(time.)169 3686 y(The)j(set)h(of)f(hin)m(ts)g +(used)g(with)f(a)i(\014le)f(is)h(a)m(v)-5 b(ailable)34 +b(through)e(the)g(routine)g Fj(MPI)p 2916 3686 V 34 w(File)p +3142 3686 V 33 w(get)p 3319 3686 V 33 w(info)p Fo(,)g(as)h(do)s(cu-)28 +3799 y(men)m(ted)g(in)g(the)f(MPI)h(standard.)47 b(As)32 +b(an)h(additional)g(feature)g(in)f(the)h(R)m(OMIO)g(implemen)m(tation,) +i(wildcards)28 3912 y(will)28 b(b)s(e)f(expanded)f(to)j(indicate)f(the) +g(precise)f(con\014guration)h(used)f(with)g(the)g(\014le,)i(with)e(the) +g(hostnames)h(in)f(the)28 4025 y(rank)j(order)g(used)g(for)g(the)g +(collectiv)m(e)k(bu\013ering)c(algorithm)h(\()p Fi(this)j(is)e(not)i +(implemente)-5 b(d)34 b(at)f(this)h(time)7 b Fo(\).)169 +4138 y(Here)31 b(are)g(some)g(examples)g(of)f(ho)m(w)h(this)f(hin)m(t)g +(migh)m(t)i(b)s(e)d(used:)165 4326 y Ff(\017)46 b Fj(*:1)29 +b Fo(One)h(pro)s(cess)g(p)s(er)f(hostname)i(\(i.e.,)h(one)f(pro)s(cess) +f(p)s(er)f(no)s(de\))165 4513 y Ff(\017)46 b Fj(box12:30,*:0)27 +b Fo(Thirt)m(y)j(pro)s(cesses)g(on)g(one)h(mac)m(hine,)g(namely)h +Fj(box12)p Fo(,)d(and)h(none)g(an)m(ywhere)h(else.)165 +4701 y Ff(\017)46 b Fj(n01,n11,n21,n31,n41)25 b Fo(One)30 +b(pro)s(cess)g(on)g(eac)m(h)h(of)g(these)g(sp)s(eci\014c)f(no)s(des)f +(only)-8 b(.)169 4889 y(When)40 b(the)g(v)-5 b(alues)40 +b(sp)s(eci\014ed)f(b)m(y)i Fj(cb)p 1505 4889 V 34 w(config)p +1827 4889 V 32 w(list)e Fo(con\015ict)i(with)e(other)h(hin)m(ts)g +(\(e.g.,)k(the)c(n)m(um)m(b)s(er)e(of)28 5002 y(collectiv)m(e)43 +b(bu\013ering)c(no)s(des)f(sp)s(eci\014ed)h(b)m(y)h Fj(cb)p +1700 5002 V 34 w(nodes)p Fo(\),)h(the)e(implemen)m(tation)i(is)e +(encouraged)h(to)g(tak)m(e)h(the)p 28 5086 1560 4 v 132 +5139 a Fe(2)167 5171 y Fb(The)25 b(MPI)h(standard)f(requires)h(that)f +(the)g(output)f(from)i(this)g(routine)f(iden)n(tify)h(a)f(particular)h +(piece)g(of)g(hardw)n(are;)h(some)f(MPI)28 5263 y(implemen)n(tations)h +(ma)n(y)e(not)h(conform)g(to)g(this)g(requiremen)n(t.)34 +b(MPICH)26 b(do)r(es)g(conform)h(to)f(the)f(MPI)h(standard.)1956 +5520 y Fo(4)p eop end +%%Page: 5 7 +TeXDict begin 5 6 bop 28 263 a Fo(minim)m(um)33 b(of)i(the)f(t)m(w)m(o) +h(v)-5 b(alues.)52 b(In)33 b(other)h(w)m(ords,)g(if)41 +b Fj(cb)p 2042 263 29 4 v 34 w(config)p 2364 263 V 33 +w(list)33 b Fo(sp)s(eci\014es)g(ten)h(pro)s(cessors)g(on)g(whic)m(h)28 +376 y(I/O)41 b(should)f(b)s(e)g(p)s(erformed,)i(but)f +Fj(cb)p 1404 376 V 33 w(nodes)f Fo(sp)s(eci\014es)g(a)i(smaller)f(n)m +(um)m(b)s(er,)h(then)f(an)g(implemen)m(tation)h(is)28 +488 y(encouraged)d(to)f(use)g(only)h Fj(cb)p 1104 488 +V 34 w(nodes)d Fo(total)k(aggregators.)65 b(If)45 b Fj(cb)p +2384 488 V 34 w(config)p 2706 488 V 32 w(list)37 b Fo(sp)s(eci\014es)g +(few)m(er)h(pro)s(cesses)28 601 y(than)30 b Fj(cb)p 342 +601 V 34 w(nodes)p Fo(,)f(no)i(more)f(than)g(the)h(n)m(um)m(b)s(er)e +(in)h Fj(cb)p 1926 601 V 34 w(config)p 2248 601 V 33 +w(list)f Fo(should)g(b)s(e)h(used.)169 714 y(The)i(implemen)m(tation)i +(is)e(also)i(encouraged)f(to)g(assign)f(pro)s(cesses)g(in)g(the)h +(order)f(that)h(they)f(are)h(listed)g(in)28 827 y Fj(cb)p +130 827 V 34 w(config)p 452 827 V 33 w(list)p Fo(.)169 +940 y(The)28 b(follo)m(wing)i(hin)m(t)f(con)m(trols)g(the)g(deferred)e +(op)s(en)h(feature)h(of)g(romio)f(and)g(are)h(also)g(applicable)h(to)f +(all)g(\014le)28 1053 y(system)i(t)m(yp)s(es:)165 1241 +y Ff(\017)46 b Fj(romio)p 502 1241 V 33 w(no)p 631 1241 +V 33 w(indep)p 904 1241 V 33 w(rw)36 b Fo({)h(If)f(the)h(application)g +(plans)f(on)g(p)s(erforming)g(only)g(collecitv)m(e)k(op)s(erations)d +(and)256 1354 y(this)44 b(hin)m(t)h(is)g(set)g(to)g(\\true",)50 +b(then)44 b(R)m(OMIO)h(can)g(ha)m(v)m(e)h(just)e(the)h(aggregators)i +(op)s(en)d(a)h(\014le.)84 b(The)256 1466 y Fj(cb)p 358 +1466 V 33 w(config)p 679 1466 V 33 w(list)32 b Fo(and)h +Fj(cb)p 1212 1466 V 34 w(nodes)f Fo(hin)m(ts)h(can)h(b)s(e)f(giv)m(en)h +(to)g(further)e(con)m(trol)j(whic)m(h)e(no)s(des)g(are)h(aggre-)256 +1579 y(gators.)169 1767 y(F)-8 b(or)32 b(PVFS2:)165 1955 +y Ff(\017)46 b Fj(striping)p 646 1955 V 32 w(factor)31 +b Fo({)j(Con)m(trols)f(the)h(n)m(um)m(b)s(er)e(of)h(I/O)g(devices)h(to) +g(strip)s(e)e(across.)50 b(The)33 b(default)g(is)g(\014le)256 +2068 y(system)c(dep)s(enden)m(t,)h(but)f(for)g(PVFS)h(it)g(is)g +Fj(-1)p Fo(,)f(indicating)i(that)f(the)g(\014le)g(should)e(b)s(e)h +(strip)s(ed)g(across)h(all)256 2180 y(I/O)g(devices.)165 +2368 y Ff(\017)46 b Fj(striping)p 646 2368 V 32 w(unit)38 +b Fo({)i(Con)m(trols)f(the)h(striping)f(unit)g(\(in)g(b)m(ytes\).)69 +b(F)-8 b(or)40 b(PVFS)f(the)g(default)h(will)f(b)s(e)g(the)256 +2481 y(PVFS)30 b(\014le)g(system)h(default)f(strip)g(size.)165 +2669 y Ff(\017)46 b Fj(start)p 502 2669 V 33 w(iodevice)22 +b Fo({)j(Determines)h(what)f(I/O)f(device)i(data)g(will)f(\014rst)f(b)s +(e)g(written)h(to.)40 b(This)24 b(is)g(a)i(n)m(um)m(b)s(er)256 +2782 y(in)k(the)g(range)h(of)f(0)h(...)41 b(striping)p +1370 2782 28 4 v 33 w(factor)31 b(-)g(1.)28 3022 y Fk(3.2.1)106 +b(Hin)m(ts)35 b(for)g(XFS)28 3193 y Fo(F)-8 b(or)31 b(XFS)g(con)m(trol) +h(is)e(pro)m(vided)g(for)g(the)h(direct)g(I/O)f(optimization:)165 +3381 y Ff(\017)46 b Fj(direct)p 550 3381 29 4 v 32 w(read)35 +b Fo({)g(Con)m(trols)h(direct)g(I/O)g(for)f(reads.)55 +b(V)-8 b(alid)37 b(v)-5 b(alues)35 b(are)h Fj(true)e +Fo(and)h Fj(false)p Fo(.)55 b(Default)36 b(is)256 3494 +y Fj(false)p Fo(.)165 3681 y Ff(\017)46 b Fj(direct)p +550 3681 V 32 w(write)30 b Fo({)h(Con)m(trols)h(direct)g(I/O)f(for)f +(writes.)43 b(V)-8 b(alid)32 b(v)-5 b(alues)32 b(are)f +Fj(true)f Fo(and)h Fj(false)p Fo(.)41 b(Default)32 b(is)256 +3794 y Fj(false)p Fo(.)28 4034 y Fk(3.2.2)106 b(Hin)m(ts)35 +b(for)g(PVFS2)g(\(a.k.a)g(OrangeFS\))28 4206 y Fo(The)30 +b(PVFS)g(v2)h(\014le)g(system)f(has)g(man)m(y)h(tuning)f(parameters.) +165 4394 y Ff(\017)46 b Fo(dt)m(yp)s(e)30 b(i/o)28 4634 +y Fk(3.2.3)106 b(Hin)m(ts)35 b(for)g(Lustre)165 4805 +y Ff(\017)46 b Fo(romio)p 488 4805 28 4 v 33 w(lustre)p +744 4805 V 33 w(co)p 862 4805 V 33 w(ratio)256 4956 y(In)37 +b(strip)s(e-con)m(tiguous)j(IO)e(pattern,)j(eac)m(h)f(OST)d(will)i(b)s +(e)f(accessed)i(b)m(y)e(a)h(group)f(of)h(IO)f(clien)m(ts.)67 +b(CO)256 5069 y(means)39 b(*C*lien)m(t/*O*ST)j(ratio,)h(or)d(the)f +(max.)69 b(n)m(um)m(b)s(er)38 b(of)i(IO)f(clien)m(ts)i(for)f(eac)m(h)h +(OST.)d(CO=1)h(b)m(y)256 5182 y(default.)1956 5520 y(5)p +eop end +%%Page: 6 8 +TeXDict begin 6 7 bop 165 263 a Ff(\017)46 b Fj(romio)p +502 263 29 4 v 33 w(lustre)p 823 263 V 32 w(coll)p 1047 +263 V 34 w(threshold)256 412 y Fo(W)-8 b(e)28 b(w)m(on't)g(do)g +(collectiv)m(e)j(I/O)c(if)g(this)h(hin)m(t)f(is)h(set)f(and)g(the)h(IO) +f(request)g(size)i(is)e(bigger)h(than)f(this)h(v)-5 b(alue.)256 +525 y(That's)28 b(b)s(ecause)h(when)f(the)h(request)g(size)h(is)e(big,) +i(the)f(collectiv)m(e)j(comm)m(unication)f(o)m(v)m(erhead)f(increases) +256 638 y(and)37 b(the)g(b)s(ene\014ts)g(from)g(collectiv)m(e)k(I/O)c +(b)s(ecomes)h(limited.)63 b(A)38 b(v)-5 b(alue)38 b(of)f(0)h(means)g +(alw)m(a)m(ys)h(p)s(erform)256 751 y(collectiv)m(e)34 +b(I/O)165 936 y Ff(\017)46 b Fj(romio)p 502 936 V 33 +w(lustre)p 823 936 V 32 w(cb)p 951 936 V 34 w(ds)p 1081 +936 V 34 w(threshold)256 1086 y Fo(R)m(OMIO)20 b(can)i(optimize)g +(collectiv)m(e)i(I/O)d(with)g(a)g(v)m(ersion)g(of)h(data)f(sieving.)38 +b(If)21 b(the)g(I/O)g(request)g(is)g(smaller)256 1199 +y(than)30 b(this)g(hin)m(t's)g(v)-5 b(alue,)32 b(though,)e(R)m(OMIO)g +(will)h(not)g(try)f(to)h(apply)f(the)g(data)i(sieving)f(optimization.) +165 1384 y Ff(\017)46 b Fj(romio)p 502 1384 V 33 w(lustre)p +823 1384 V 32 w(ds)p 951 1384 V 34 w(in)p 1081 1384 V +34 w(coll)256 1534 y Fo(Collectiv)m(e)27 b(IO)d(will)i(apply)e(read-mo) +s(dify-write)h(to)g(deal)h(with)e(non-con)m(tiguous)i(data)g(b)m(y)e +(default.)39 b(Ho)m(w-)256 1647 y(ev)m(er,)30 b(it)f(will)g(in)m(tro)s +(duce)g(some)g(o)m(v)m(erhead\(IO)h(op)s(eration)f(and)f(lo)s(c)m +(king\).)42 b(The)28 b(Lustre)g(dev)m(elop)s(ers)h(ha)m(v)m(e)256 +1760 y(run)c(tests)j(where)e(data)i(sieving)f(sho)m(w)m(ed)g(bad)f +(collectiv)m(e)31 b(write)c(p)s(erformance)f(for)h(some)g(kinds)f(of)h +(w)m(ork-)256 1872 y(loads.)62 b(So,)39 b(to)f(a)m(v)m(oid)h(this,)h(w) +m(e)d(de\014ne)g(the)h Fj(romio)p 2102 1872 V 33 w(lustre)p +2423 1872 V 32 w(ds)p 2551 1872 V 34 w(in)p 2681 1872 +V 34 w(coll)e Fo(hin)m(t)i(to)g(disable)f(the)h(read-)256 +1985 y(mo)s(dify-write)26 b(step)h(in)f(collectiv)m(e)k(I/O.)d(This)e +(optimization)k(is)e(distinct)g(from)f(the)g(one)h(in)f(indep)s(enden)m +(t)256 2098 y(I/O)k(\(con)m(trolled)i(b)m(y)g Fj(romio)p +1266 2098 V 33 w(ds)p 1395 2098 V 34 w(read)d Fo(and)h +Fj(romio)p 2067 2098 V 33 w(ds)p 2196 2098 V 33 w(write)p +Fo(\).)28 2337 y Fk(3.2.4)106 b(Hin)m(ts)35 b(for)g(P)-9 +b(ANFS)35 b(\(P)m(anasas\))28 2509 y Fo(P)m(anFS)29 b(allo)m(ws)g +(users)e(to)i(sp)s(ecify)f(the)h(la)m(y)m(out)h(of)e(a)h(\014le)f(at)h +(\014le-creation)h(time.)41 b(La)m(y)m(out)29 b(information)g(includes) +28 2622 y(the)f(n)m(um)m(b)s(er)d(of)j(StorageBlades)h(\(SB\))f(across) +f(whic)m(h)g(the)g(data)h(is)f(stored,)i(the)e(n)m(um)m(b)s(er)f(of)h +(SBs)g(across)h(whic)m(h)28 2735 y(a)h(parit)m(y)g(strip)s(e)f(is)h +(written,)g(and)f(the)h(n)m(um)m(b)s(er)e(of)i(consecutiv)m(e)i(strip)s +(es)d(that)h(are)g(placed)g(on)f(the)h(same)g(set)g(of)28 +2848 y(SBs.)41 b(The)30 b Fj(panfs)p 678 2848 V 33 w(layout)p +999 2848 V 32 w(*)g Fo(hin)m(ts)h(are)f(only)h(used)e(if)i(supplied)e +(at)i(\014le-creation)h(time.)165 3031 y Ff(\017)46 b +Fj(panfs)p 502 3031 V 33 w(layout)p 823 3031 V 32 w(type)30 +b Fo(Sp)s(eci\014es)f(the)i(la)m(y)m(out)h(of)f(a)f(\014le:)41 +b(2)31 b(=)f(RAID0)h(3)g(=)f(RAID5)h(P)m(arit)m(y)h(Strip)s(es)165 +3216 y Ff(\017)46 b Fj(panfs)p 502 3216 V 33 w(layout)p +823 3216 V 32 w(stripe)p 1143 3216 V 33 w(unit)29 b Fo(The)h(size)h(of) +g(the)f(strip)s(e)g(unit)g(in)g(b)m(ytes)165 3402 y Ff(\017)46 +b Fj(panfs)p 502 3402 V 33 w(layout)p 823 3402 V 32 w(total)p +1095 3402 V 33 w(num)p 1272 3402 V 34 w(comps)29 b Fo(The)h(total)i(n)m +(um)m(b)s(er)d(of)h(StorageBlades)j(a)e(\014le)f(is)g(strip)s(ed)g +(across.)165 3588 y Ff(\017)93 b Fj(panfs)p 549 3588 +V 33 w(layout)p 870 3588 V 33 w(parity)p 1191 3588 V +33 w(stripe)p 1512 3588 V 32 w(width)34 b Fo(If)g(the)h(la)m(y)m(out)h +(t)m(yp)s(e)f(is)g(RAID5)h(P)m(arit)m(y)g(Strip)s(es,)f(this)f(hin)m(t) +256 3701 y(sp)s(eci\014es)c(the)g(n)m(um)m(b)s(er)f(of)i(StorageBlades) +h(in)e(a)h(parit)m(y)g(strip)s(e.)165 3887 y Ff(\017)46 +b Fj(panfs)p 502 3887 V 33 w(layout)p 823 3887 V 32 w(parity)p +1143 3887 V 33 w(stripe)p 1464 3887 V 33 w(depth)38 b +Fo(If)h(the)g(la)m(y)m(out)i(t)m(yp)s(e)f(is)f(RAID5)h(P)m(arit)m(y)h +(Strip)s(es,)g(this)e(hin)m(t)256 3999 y(sp)s(eci\014es)30 +b(the)g(n)m(um)m(b)s(er)f(of)i(con)m(tiguous)g(parit)m(y)g(strip)s(es)f +(written)g(across)h(the)g(same)g(set)g(of)f(SBs.)165 +4185 y Ff(\017)46 b Fj(panfs)p 502 4185 V 33 w(layout)p +823 4185 V 32 w(visit)p 1095 4185 V 33 w(policy)32 b +Fo(If)h(the)g(la)m(y)m(out)j(t)m(yp)s(e)d(is)h(RAID5)g(P)m(arit)m(y)g +(Strip)s(es,)g(the)f(p)s(olicy)h(used)f(to)256 4298 y(determine)d(the)h +(parit)m(y)g(strip)s(e)e(a)i(giv)m(en)h(\014le)e(o\013set)h(is)g +(written)f(to:)42 b(1)30 b(=)g(Round)g(Robin)169 4481 +y(P)m(anFS)35 b(supp)s(orts)e(the)j(\\concurren)m(t)f(write")h(\(CW\))f +(mo)s(de,)h(where)f(groups)f(of)h(co)s(op)s(erating)h(clien)m(ts)g(can) +28 4594 y(disable)27 b(the)g(P)m(anFS)g(consistency)g(mec)m(hanisms)g +(and)f(use)g(their)h(o)m(wn)g(consistency)g(proto)s(col.)41 +b(Clien)m(ts)27 b(partici-)28 4707 y(pating)h(in)f(concurren)m(t)g +(write)g(mo)s(de)g(use)g(application)h(sp)s(eci\014c)f(information)g +(to)h(impro)m(v)m(e)g(p)s(erformance)e(while)28 4820 +y(main)m(taining)38 b(\014le)e(consistency)-8 b(.)60 +b(All)37 b(clien)m(ts)g(accessing)h(the)f(\014le\(s\))g(m)m(ust)f +(enable)h(concurren)m(t)f(write)g(mo)s(de.)28 4933 y(If)c(an)m(y)h +(clien)m(t)h(do)s(es)d(not)i(enable)g(concurren)m(t)f(write)h(mo)s(de,) +f(then)g(the)h(P)m(anFS)f(consistency)h(proto)s(col)g(will)g(b)s(e)28 +5046 y(in)m(v)m(ok)m(ed.)41 b(Once)27 b(a)f(\014le)h(is)g(op)s(ened)e +(in)h(CW)h(mo)s(de)f(on)g(a)h(mac)m(hine,)h(attempts)g(to)f(op)s(en)f +(a)h(\014le)f(in)g(non-CW)h(mo)s(de)28 5158 y(will)35 +b(fail)g(with)e(EA)m(CCES.)h(If)f(a)i(\014le)f(is)g(already)h(op)s +(ened)e(in)h(non-CW)g(mo)s(de,)h(attempts)g(to)g(op)s(en)e(the)h +(\014le)h(in)28 5271 y(CW)c(mo)s(de)f(will)g(fail)h(with)f(EA)m(CCES.)g +(The)g(follo)m(wing)i(hin)m(t)e(is)h(used)e(to)i(enable)g(concurren)m +(t)g(write)f(mo)s(de.)1956 5520 y(6)p eop end +%%Page: 7 9 +TeXDict begin 7 8 bop 165 263 a Ff(\017)46 b Fj(panfs)p +502 263 29 4 v 33 w(concurrent)p 1015 263 V 31 w(write)37 +b Fo(If)h(set)i(to)f(1)g(at)g(\014le)g(op)s(en)f(time,)j(the)e(\014le)g +(is)f(op)s(ened)g(using)g(the)h(P)m(anFS)256 376 y(concurren)m(t)30 +b(write)h(mo)s(de)f(\015ag.)41 b(Concurren)m(t)29 b(write)i(mo)s(de)f +(is)g(not)h(a)g(p)s(ersisten)m(t)f(attribute)h(of)g(the)f(\014le.)169 +588 y(Belo)m(w)i(is)f(an)f(example)h(P)m(anFS)g(la)m(y)m(out)h(using)e +(the)g(follo)m(wing)i(parameters:)124 889 y Fj(-)47 b +(panfs_layout_type)759 b(=)48 b(3)124 1002 y(-)f +(panfs_layout_total_num_co)o(mps)232 b(=)48 b(100)124 +1114 y(-)f(panfs_layout_parity_strip)o(e_wi)o(dth)41 +b(=)48 b(10)124 1227 y(-)f(panfs_layout_parity_strip)o(e_de)o(pth)41 +b(=)48 b(8)124 1340 y(-)f(panfs_layout_visit_policy)375 +b(=)48 b(1)172 1566 y(Parity)e(Stripe)g(Group)g(1)238 +b(Parity)46 b(Stripe)h(Group)f(2)95 b(.)48 b(.)f(.)g(Parity)g(Stripe)f +(Group)g(10)124 1679 y(----------------------)185 b +(----------------------)375 b(--------------------)172 +1792 y(SB1)190 b(SB2)94 b(...)47 b(SB10)238 b(SB11)189 +b(SB12)47 b(...)95 b(SB20)f(...)142 b(SB91)h(SB92)46 +b(...)h(SB100)124 1905 y(-----------------------)137 +b(-----------------------)327 b(---------------------)172 +2018 y(D1)238 b(D2)142 b(...)95 b(D10)285 b(D91)190 b(D92)95 +b(...)g(D100)380 b(D181)143 b(D182)94 b(...)47 b(D190)172 +2131 y(D11)190 b(D12)333 b(D20)285 b(D101)142 b(D102)286 +b(D110)380 b(D191)143 b(D192)285 b(D193)172 2244 y(D21)190 +b(D22)333 b(D30)285 b(.)48 b(.)f(.)1145 b(.)48 b(.)f(.)172 +2356 y(D31)190 b(D32)333 b(D40)172 2469 y(D41)190 b(D42)333 +b(D50)172 2582 y(D51)190 b(D52)333 b(D60)172 2695 y(D61)190 +b(D62)333 b(D70)172 2808 y(D71)190 b(D72)333 b(D80)172 +2921 y(D81)190 b(D82)333 b(D90)285 b(D171)142 b(D172)286 +b(D180)380 b(D261)143 b(D262)f(D270)172 3034 y(D271)g(D272)285 +b(D273)237 b(.)48 b(.)f(.)1145 b(.)48 b(.)f(.)172 3147 +y(...)28 3387 y Fk(3.2.5)106 b(System)m(wide)34 b(Hin)m(ts)28 +3559 y Fo(A)28 b(site)g(administrator)g(with)f(kno)m(wledge)h(of)g(the) +f(storage)i(and)e(net)m(w)m(orking)h(capabilities)h(of)f(a)f(mac)m +(hine)i(migh)m(t)28 3671 y(b)s(e)k(able)g(to)h(come)g(up)d(with)i(a)g +(set)h(of)f(hin)m(t)g(v)-5 b(alues)33 b(that)h(w)m(ork)f(b)s(etter)g +(for)f(that)i(mac)m(hine)g(than)e(the)h(R)m(OMIO)28 3784 +y(default)42 b(v)-5 b(alues.)76 b(As)42 b(an)f(exten)m(tion)j(to)f(the) +f(standard,)i(R)m(OMIO)e(will)g(consult)g(a)g(\\hin)m(ts)g(\014le".)76 +b(This)41 b(\014le)28 3897 y(pro)m(vides)35 b(an)g(additional)i(mec)m +(hanism)e(for)g(setting)h(MPI-IO)f(hin)m(ts,)h(alb)s(eit)g(in)f(a)h(R)m +(OMIO-sp)s(eci\014c)f(manner.)28 4010 y(The)d(hin)m(ts)g(\014le)g(con)m +(tains)h(a)g(list)g(of)f(hin)m(ts)g(and)f(their)i(v)-5 +b(alues.)46 b(R)m(OMIO)32 b(will)g(use)g(these)h(initial)g(hin)m(t)f +(settings,)28 4123 y(though)e(programs)g(are)h(free)g(to)g(o)m(v)m +(erride)g(an)m(y)g(of)f(them.)169 4236 y(The)35 b(format)g(of)g(the)f +(hin)m(ts)h(\014le)g(is)f(a)i(list)f(of)g(hin)m(ts)f(and)g(their)h(v)-5 +b(alues,)36 b(one)f(p)s(er)f(line.)54 b(A)35 b(#)f(c)m(haracter)j(in)28 +4349 y(the)31 b(\014rst)f(column)g(indicates)h(a)g(commen)m(t,)g(and)f +(R)m(OMIO)g(will)h(ignore)g(the)g(en)m(tire)g(line.)41 +b(Here's)31 b(an)f(example:)28 4561 y Fj(#)48 b(this)e(is)i(a)f +(comment)f(describing)f(the)i(following)e(setting)28 +4674 y(cb_nodes)h(32)28 4787 y(#)i(these)e(nodes)g(happen)h(to)g(have)f +(the)h(best)g(connection)e(to)i(storage)28 4900 y(cb_config_list)d +(n01,n11,n21,n31,n41)169 5113 y Fo(R)m(OMIO)27 b(will)h(lo)s(ok)g(for)f +(these)g(hin)m(ts)g(in)g(the)g(\014le)g Fj(/etc/romio-hints)p +Fo(.)36 b(A)27 b(user)f(can)i(set)f(the)h(en)m(vironmen)m(t)28 +5226 y(v)-5 b(ariable)31 b Fj(ROMIO)p 615 5226 V 33 w(HINTS)e +Fo(to)j(the)e(name)h(of)f(a)h(\014le)f(whic)m(h)g(R)m(OMIO)h(will)f +(use)g(instead.)1956 5520 y(7)p eop end +%%Page: 8 10 +TeXDict begin 8 9 bop 28 263 a Fc(3.3)113 b(Using)38 +b(R)m(OMIO)f(on)h(NFS)28 434 y Fo(It)33 b(is)g(w)m(orth)g(\014rst)f +(men)m(tioning)i(that)f(in)f(no)h(w)m(a)m(y)h(do)f(w)m(e)g(encourage)h +(the)f(use)f(of)h(R)m(OMIO)g(on)g(NFS)f(v)m(olumes.)28 +547 y(NFS)h(is)f(not)h(a)g(high-p)s(erformance)f(proto)s(col,)i(nor)e +(are)h(NFS)g(serv)m(ers)f(t)m(ypically)j(v)m(ery)e(go)s(o)s(d)f(at)h +(handling)f(the)28 660 y(t)m(yp)s(es)38 b(of)g(concurren)m(t)f(access)i +(seen)f(from)f(MPI-IO)g(applications.)63 b(Nev)m(ertheless,)42 +b(NFS)37 b(is)h(a)g(v)m(ery)g(p)s(opular)28 773 y(mec)m(hanism)43 +b(for)g(pro)m(viding)f(access)i(to)f(a)g(shared)f(space,)47 +b(and)42 b(R)m(OMIO)g(do)s(es)h(supp)s(ort)e(MPI-IO)h(to)h(NFS)28 +886 y(v)m(olumes,)32 b(pro)m(vided)e(that)h(they)f(are)h(con\014gured)e +(prop)s(erly)-8 b(.)169 999 y(T)g(o)23 b(use)f(R)m(OMIO)g(on)g(NFS,)h +(\014le)f(lo)s(c)m(king)i(with)e Fj(fcntl)e Fo(m)m(ust)i(w)m(ork)h +(correctly)g(on)g(the)f(NFS)g(installation.)40 b(On)28 +1112 y(some)30 b(installations,)h(fcn)m(tl)e(lo)s(c)m(ks)h(don't)f(w)m +(ork.)40 b(T)-8 b(o)29 b(get)h(them)f(to)g(w)m(ork,)h(y)m(ou)f(need)f +(to)i(use)e(V)-8 b(ersion)30 b(3)f(of)g(NFS,)28 1225 +y(ensure)k(that)g(the)h(lo)s(c)m(kd)f(daemon)h(is)f(running)e(on)i(all) +h(the)g(mac)m(hines,)g(and)f(ha)m(v)m(e)h(the)g(system)f(administrator) +28 1338 y(moun)m(t)i(the)g(NFS)g(\014le)g(system)g(with)g(the)g(\\)p +Fj(noac)p Fo(")f(option)i(\(no)f(attribute)g(cac)m(hing\).)57 +b(T)-8 b(urning)33 b(o\013)j(attribute)28 1450 y(cac)m(hing)c(ma)m(y)f +(reduce)f(p)s(erformance,)g(but)g(it)h(is)f(necessary)h(for)f(correct)i +(b)s(eha)m(vior.)169 1563 y(The)41 b(follo)m(wing)i(are)f(some)f +(instructions)h(w)m(e)f(receiv)m(ed)i(from)e(Ian)g(W)-8 +b(ells)43 b(of)e(HP)g(for)h(setting)g(the)f Fj(noac)28 +1676 y Fo(option)34 b(on)f(NFS.)h(W)-8 b(e)34 b(ha)m(v)m(e)h(not)e +(tried)h(them)f(ourselv)m(es.)50 b(W)-8 b(e)35 b(are)e(including)g +(them)h(here)f(b)s(ecause)g(y)m(ou)h(ma)m(y)28 1789 y(\014nd)e(them)h +(useful.)49 b(Note)35 b(that)e(some)h(of)g(the)f(steps)g(ma)m(y)h(b)s +(e)f(sp)s(eci\014c)g(to)h(HP)f(systems,)h(and)f(y)m(ou)h(ma)m(y)g(need) +28 1902 y(ro)s(ot)d(p)s(ermission)e(to)i(execute)h(some)f(of)f(the)h +(commands.)172 2110 y Fj(>1.)46 b(first)h(confirm)f(you)g(are)h +(running)f(nfs)h(version)f(3)172 2223 y(>)172 2336 y(>rpcnfo)f(-p)i +(`hostname`)e(|)j(grep)f(nfs)172 2449 y(>)172 2561 y(>ie)172 +2674 y(>)190 b(goedel)46 b(>rpcinfo)g(-p)h(goedel)f(|)h(grep)g(nfs)172 +2787 y(>)190 b(100003)f(2)143 b(udp)g(2049)94 b(nfs)172 +2900 y(>)190 b(100003)f(3)143 b(udp)g(2049)94 b(nfs)172 +3013 y(>)172 3126 y(>)172 3239 y(>2.)46 b(then)h(edit)g(/etc/fstab)e +(for)i(each)f(nfs)h(directory)e(read/written)g(by)i(MPIO)172 +3352 y(>)142 b(on)48 b(each)94 b(machine)46 b(used)g(for)h(multihost)f +(MPIO.)172 3465 y(>)172 3578 y(>)190 b(Here)47 b(is)g(an)g(example)f +(of)h(a)h(correct)d(fstab)i(entry)f(for)h(/epm1:)172 +3691 y(>)172 3804 y(>)142 b(ie)48 b(grep)e(epm1)h(/etc/fstab)172 +3916 y(>)172 4029 y(>)286 b(ROOOOT)46 b(11>grep)f(epm1)i(/etc/fstab)172 +4142 y(>)286 b(gershwin:/epm1)43 b(/rmt/gershwin/epm1)g(nfs)k +(bg,intr,noac)e(0)i(0)172 4255 y(>)172 4368 y(>)142 b(if)48 +b(the)e(noac)h(option)f(is)h(not)g(present,)f(add)h(it)172 +4481 y(>)142 b(and)47 b(then)g(remount)f(this)g(directory)172 +4594 y(>)142 b(on)48 b(each)e(of)h(the)g(machines)f(that)g(will)h(be)g +(used)g(to)g(share)f(MPIO)h(files)172 4707 y(>)172 4820 +y(>ie)172 4933 y(>)172 5046 y(>ROOOOT)e(>umount)h(/rmt/gershwin/epm1) +172 5158 y(>ROOOOT)f(>mount)94 b(/rmt/gershwin/epm1)172 +5271 y(>)1956 5520 y Fo(8)p eop end +%%Page: 9 11 +TeXDict begin 9 10 bop 172 263 a Fj(>3.)46 b(Confirm)g(that)h(the)g +(directory)e(is)i(mounted)f(noac:)172 376 y(>)172 488 +y(>ROOOOT)f(>grep)i(gershwin)e(/etc/mnttab)172 601 y(>gershwin:/epm1)e +(/rmt/gershwin/epm1)g(nfs)172 714 y(>noac,acregmin=0,acreg)o(max=)o +(0,ac)o(dir)o(min=)o(0,ac)o(dir)o(max=)o(0)f(0)47 b(0)h(899911504)28 +954 y Fk(3.3.1)106 b(R)m(OMIO,)34 b(NFS,)h(and)g(Sync)m(hronization)28 +1126 y Fo(NFS)29 b(has)g(a)h(\\sync")g(option)f(that)h(sp)s(eci\014es)f +(that)h(the)f(serv)m(er)h(should)e(put)g(data)i(on)f(the)h(disk)f(b)s +(efore)f(replying)28 1239 y(that)34 b(an)g(op)s(eration)g(is)f +(complete.)52 b(This)33 b(means)g(that)i(the)e(actual)i(I/O)f(cost)g +(on)g(the)f(serv)m(er)h(side)g(cannot)g(b)s(e)28 1352 +y(hidden)29 b(with)h(cac)m(hing,)i(etc.)42 b(when)30 +b(this)g(option)h(is)f(selected.)169 1465 y(In)g(the)h(\\async")h(mo)s +(de)e(the)h(serv)m(er)f(can)h(get)h(the)f(data)g(in)m(to)g(a)g +(bu\013er)f(\(and)g(p)s(erhaps)f(put)h(it)h(in)f(the)h(write)28 +1578 y(queue;)h(this)f(dep)s(ends)f(on)h(the)g(implemen)m(tation\))i +(and)e(reply)g(righ)m(t)h(a)m(w)m(a)m(y)-8 b(.)45 b(Ob)m(viously)32 +b(if)f(the)g(serv)m(er)h(w)m(ere)g(to)28 1691 y(go)c(do)m(wn)e(after)i +(the)f(reply)f(w)m(as)h(sen)m(t)h(but)e(b)s(efore)g(the)h(data)h(w)m +(as)f(written,)h(the)f(system)g(w)m(ould)g(b)s(e)f(in)g(a)i(strange)28 +1804 y(state,)k(whic)m(h)e(is)h(wh)m(y)f(so)g(man)m(y)h(articles)h +(suggest)f(the)f("sync")h(option.)169 1916 y(Some)36 +b(systems)f(default)h(to)g(\\sync",)h(while)e(others)h(default)f(to)h +(\\async",)i(and)d(the)g(default)h(can)f(c)m(hange)28 +2029 y(from)h(v)m(ersion)h(to)g(v)m(ersion)g(of)f(the)h(NFS)f(soft)m(w) +m(are.)60 b(If)36 b(y)m(ou)h(\014nd)e(that)i(access)g(to)g(an)g(NFS)f +(v)m(olume)h(through)28 2142 y(MPI-IO)30 b(is)h(particularly)g(slo)m +(w,)g(this)f(is)h(one)f(thing)h(to)g(c)m(hec)m(k)h(out.)28 +2386 y Fc(3.4)113 b(Using)38 b(testfs)28 2557 y Fo(The)31 +b(testfs)h(ADIO)g(implemen)m(tation)h(pro)m(vides)e(a)h(harness)e(for)i +(testing)g(comp)s(onen)m(ts)g(of)f(R)m(OMIO)h(or)f(disco)m(v-)28 +2670 y(ering)41 b(the)g(underlying)e(I/O)i(access)h(patterns)e(of)h(an) +f(application.)73 b(When)40 b(testfs)h(is)g(sp)s(eci\014ed)f(as)g(the)h +(\014le)28 2783 y(system)d(t)m(yp)s(e,)h(no)e(actual)h(\014les)f(will)h +(b)s(e)e(op)s(ened.)60 b(Instead)37 b(debugging)g(information)h(will)f +(b)s(e)g(displa)m(y)m(ed)g(on)28 2896 y(the)30 b(pro)s(cesses)f(op)s +(ening)f(the)i(\014le.)40 b(Subsequen)m(t)28 b(I/O)h(op)s(erations)h +(on)f(this)g(testfs)g(\014le)h(will)f(pro)m(vide)g(additional)28 +3009 y(debugging)i(information.)169 3122 y(The)38 b(in)m(ten)m(tion)h +(of)e(the)h(testfs)g(implemen)m(tation)i(is)d(that)h(it)h(serv)m(e)f +(as)g(a)g(starting)g(p)s(oin)m(t)g(for)f(further)f(in-)28 +3235 y(strumen)m(tation)31 b(when)d(debugging)i(new)f(features)h(or)g +(applications.)42 b(As)29 b(suc)m(h)h(it)g(is)g(exp)s(ected)g(that)g +(users)f(will)28 3348 y(w)m(an)m(t)j(to)f(mo)s(dify)e(the)i(ADIO)f +(implemen)m(tation)i(in)e(order)g(to)h(get)h(the)e(sp)s(eci\014c)h +(output)f(they)g(desire.)28 3591 y Fc(3.5)113 b(R)m(OMIO)37 +b(and)h Fa(MPI)p 1093 3591 31 4 v 38 w(FILE)p 1335 3591 +V 38 w(SYNC)28 3763 y Fo(The)30 b(MPI)h(sp)s(eci\014cation)g(notes)h +(that)f(a)g(call)h(to)f Fj(MPI)p 1882 3763 29 4 v 34 +w(FILE)p 2108 3763 V 33 w(SYNC)e Fo(\\causes)j(all)f(previous)f(writes) +h(to)h Fj(fh)e Fo(b)m(y)g(the)28 3876 y(calling)39 b(pro)s(cess)e(to)h +(b)s(e)e(transferred)g(to)i(the)g(storage)g(device.")63 +b(Lik)m(ewise,)40 b(calls)f(to)e Fj(MPI)p 3220 3876 V +34 w(FILE)p 3446 3876 V 33 w(CLOSE)f Fo(ha)m(v)m(e)28 +3989 y(this)g(same)h(seman)m(tic.)59 b(F)-8 b(urther,)38 +b(\\if)e(all)h(pro)s(cesses)f(ha)m(v)m(e)i(made)e(up)s(dates)f(to)i +(the)f(storage)i(device,)h(then)c(all)28 4101 y(suc)m(h)30 +b(up)s(dates)g(b)s(ecome)h(visible)f(to)h(subsequen)m(t)f(reads)g(of)h +Fj(fh)f Fo(b)m(y)g(the)g(calling)i(pro)s(cess.")169 4214 +y(The)e(in)m(tended)g(use)g(of)g Fj(MPI)p 1137 4214 V +33 w(FILE)p 1362 4214 V 34 w(SYNC)e Fo(is)j(to)f(allo)m(w)i(all)f(pro)s +(cesses)f(in)f(the)i(comm)m(unicator)g(used)e(to)i(op)s(en)28 +4327 y(the)k(\014le)g(to)h(see)f(c)m(hanges)h(made)f(to)h(the)f(\014le) +g(b)m(y)f(eac)m(h)i(other)f(\(the)h(second)f(part)f(of)h(the)g(sp)s +(eci\014cation\).)56 b(The)28 4440 y(de\014nition)38 +b(of)h(\\storage)h(device")g(in)e(the)g(sp)s(eci\014cation)h(is)f(v)-5 +b(ague,)42 b(and)37 b(it)i(isn't)g(necessarily)g(the)f(case)i(that)28 +4553 y(calling)32 b Fj(MPI)p 466 4553 V 34 w(FILE)p 692 +4553 V 33 w(SYNC)d Fo(will)i(force)g(data)g(out)g(to)g(p)s(ermanen)m(t) +e(storage.)169 4666 y(Since)37 b(users)f(often)i(use)e +Fj(MPI)p 1198 4666 V 34 w(FILE)p 1424 4666 V 33 w(SYNC)g +Fo(to)i(attempt)g(to)f(force)h(data)f(out)g(to)h(p)s(ermanen)m(t)e +(storage)j(\(i.e.)28 4779 y(disk\),)31 b(the)f(R)m(OMIO)h(implemen)m +(tation)h(of)e(this)g(call)i(enforces)f(stronger)f(seman)m(tics)i(for)e +(most)h(underlying)e(\014le)28 4892 y(systems)j(b)m(y)g(calling)h(the)f +(appropriate)g(\014le)g(sync)f(op)s(eration)i(when)d +Fj(MPI)p 2585 4892 V 34 w(FILE)p 2811 4892 V 33 w(SYNC)h +Fo(is)h(called)h(\(e.g.)46 b Fj(fsync)p Fo(\).)28 5005 +y(Ho)m(w)m(ev)m(er,)30 b(it)d(is)f(still)i(un)m(wise)e(to)h(assume)f +(that)h(the)g(data)g(has)f(all)i(made)e(it)h(to)g(disk)f(b)s(ecause)h +(some)g(\014le)f(systems)28 5118 y(\(e.g.)42 b(NFS\))31 +b(ma)m(y)g(not)g(force)g(data)g(to)g(disk)f(when)f(a)i(clien)m(t)h +(system)e(mak)m(es)i(a)e(sync)g(call.)1956 5520 y(9)p +eop end +%%Page: 10 12 +TeXDict begin 10 11 bop 169 263 a Fo(F)-8 b(or)28 b(p)s(erformance)e +(reasons)g(w)m(e)h(do)g Fi(not)36 b Fo(mak)m(e)27 b(this)g(same)g +(\014le)f(system)h(call)h(at)f Fj(MPI)p 3068 263 29 4 +v 34 w(FILE)p 3294 263 V 33 w(CLOSE)e Fo(time.)40 b(A)m(t)28 +376 y(close)33 b(time)g(R)m(OMIO)e(ensures)g(an)m(y)h(data)g(has)g(b)s +(een)e(written)i(out)g(to)g(the)g(\\storage)i(device")f(\(\014le)f +(system\))g(as)28 488 y(de\014ned)f(in)h(the)h(standard,)f(but)f(do)s +(es)h(not)h(try)f(to)h(push)e(the)h(data)h(b)s(ey)m(ond)f(this)g(and)f +(in)m(to)j(ph)m(ysical)e(storage.)28 601 y(Users)43 b(should)e(call)j +Fj(MPI)p 916 601 V 34 w(FILE)p 1142 601 V 33 w(SYNC)e +Fo(b)s(efore)g(the)h(close)h(if)e(they)h(wish)f(to)h(encourage)h(the)f +(underlying)e(\014le)28 714 y(system)31 b(to)g(push)e(data)i(to)g(p)s +(ermanen)m(t)f(storage.)28 958 y Fc(3.6)113 b(R)m(OMIO)37 +b(and)h Fa(MPI)p 1093 958 31 4 v 38 w(FILE)p 1335 958 +V 38 w(SET)p 1526 958 V 38 w(SIZE)28 1129 y Fj(MPI)p +178 1129 29 4 v 34 w(FILE)p 404 1129 V 33 w(SET)p 581 +1129 V 34 w(SIZE)29 b Fo(is)h(a)h(collectiv)m(e)j(routine)d(used)f(to)h +(resize)g(a)g(\014le.)41 b(It)31 b(is)f(imp)s(ortan)m(t)h(to)g(remem)m +(b)s(er)f(that)h(a)28 1242 y(MPI-IO)e(routine)g(b)s(eing)g(collectiv)m +(e)k(do)s(es)28 b(not)i(imply)e(that)i(the)f(routine)g(sync)m(hronizes) +h(the)f(calling)h(pro)s(cesses)28 1355 y(in)g(an)m(y)h(w)m(a)m(y)g +(\(unless)f(this)h(is)f(sp)s(eci\014ed)g(explicitly\).)169 +1468 y(As)k(of)g(1.2.4,)j(R)m(OMIO)d(implemen)m(ts)g +Fj(MPI)p 1653 1468 V 33 w(FILE)p 1878 1468 V 34 w(SET)p +2056 1468 V 33 w(SIZE)f Fo(b)m(y)h(calling)h Fj(ftruncate)c +Fo(from)i(all)i(pro)s(cesses.)28 1581 y(Since)41 b(di\013eren)m(t)f +(pro)s(cesses)g(ma)m(y)h(call)h(the)e(function)g(at)h(di\013eren)m(t)g +(times,)i(it)e(means)f(that)h(unless)e(external)28 1694 +y(sync)m(hronization)f(is)f(used,)g(a)g(resize)h(op)s(eration)f(mixed)g +(in)f(with)g(writes)h(or)g(reads)f(could)h(ha)m(v)m(e)h(unexp)s(ected) +28 1807 y(results.)169 1920 y(In)33 b(short,)i(if)f(sync)m(hronization) +g(after)g(a)g(set)h(size)f(is)g(needed,)g(the)g(user)f(should)g(add)g +(a)h(barrier)f(or)h(similar)28 2032 y(op)s(eration)d(to)g(ensure)f(the) +g(set)h(size)h(has)e(completed.)28 2319 y Fn(4)135 b(Installation)47 +b(Instructions)28 2522 y Fo(Since)36 b(R)m(OMIO)f(is)g(included)g(in)g +(MPICH,)g(LAM,)h(HP)f(MPI,)g(SGI)g(MPI,)h(and)e(NEC)h(MPI,)h(y)m(ou)f +(don't)h(need)28 2635 y(to)f(install)f(it)g(separately)h(if)f(y)m(ou)f +(are)h(using)g(an)m(y)g(of)f(these)h(MPI)g(implemen)m(tations.)52 +b(If)33 b(y)m(ou)h(are)g(using)f(some)28 2747 y(other)e(MPI,)g(y)m(ou)f +(can)h(con\014gure)f(and)g(build)f(R)m(OMIO)h(as)h(follo)m(ws:)169 +2860 y(Un)m(tar)g(the)g(tar)g(\014le)f(as)219 3047 y +Fj(gunzip)46 b(-c)h(romio.tar.gz)e(|)i(tar)g(xvf)g(-)28 +3234 y Fo(or)219 3420 y Fj(zcat)g(romio.tar.Z)e(|)i(tar)g(xvf)g(-)28 +3607 y Fo(then)219 3818 y Fj(cd)g(romio)219 3931 y(./configure)219 +4044 y(make)169 4255 y Fo(Some)38 b(example)h(programs)e(and)g(a)i(Mak) +m(e\014le)g(are)f(pro)m(vided)g(in)f(the)h Fj(romio/test)d +Fo(directory)-8 b(.)64 b(Run)37 b(the)28 4368 y(examples)27 +b(as)e(y)m(ou)h(w)m(ould)g(run)e(an)m(y)i(MPI)g(program.)38 +b(Eac)m(h)27 b(program)e(tak)m(es)i(the)f(\014lename)g(as)g(a)g +(command-line)28 4481 y(argumen)m(t)31 b(\\)p Fj(-fname)47 +b(filename)p Fo(".)169 4594 y(The)e Fj(configure)d Fo(script)j(b)m(y)g +(default)g(con\014gures)f(R)m(OMIO)h(for)g(the)g(\014le)g(systems)g +(most)g(lik)m(ely)h(to)g(b)s(e)28 4707 y(used)36 b(on)h(the)g(giv)m(en) +g(mac)m(hine.)61 b(If)36 b(y)m(ou)h(wish,)h(y)m(ou)f(can)f(explicitly)j +(sp)s(ecify)d(the)h(\014le)g(systems)f(b)m(y)h(using)f(the)28 +4820 y(\\)p Fj(-file)p 319 4820 V 34 w(system)p Fo(")43 +b(option)h(to)h(con\014gure.)82 b(Multiple)45 b(\014le)g(systems)f(can) +g(b)s(e)g(sp)s(eci\014ed)f(b)m(y)h(using)g(`+')g(as)h(a)28 +4933 y(separator,)32 b(e.g.,)299 5046 y Fj(./configure)44 +b(-file)p 1117 5046 V 33 w(system=xfs+nfs)28 5158 y Fo(F)-8 +b(or)31 b(the)g(en)m(tire)g(list)g(of)g(options)g(to)g(con\014gure,)f +(do)299 5271 y Fj(./configure)44 b(-h)k(|)f(more)1933 +5520 y Fo(10)p eop end +%%Page: 11 13 +TeXDict begin 11 12 bop 28 263 a Fo(After)31 b(building)e(a)i(sp)s +(eci\014c)f(v)m(ersion,)h(y)m(ou)g(can)g(install)g(it)g(in)f(a)h +(particular)g(directory)f(with)299 376 y Fj(make)46 b(install)g +(PREFIX=/usr/local/romio)c(\(or)k(whatever)g(directory)f(you)i(like\)) +28 488 y Fo(or)31 b(just)299 601 y Fj(make)46 b(install)g(\(if)h(you)g +(used)g(-prefix)e(at)j(configure)d(time\))169 714 y Fo(If)36 +b(y)m(ou)g(in)m(tend)f(to)i(lea)m(v)m(e)h(R)m(OMIO)d(where)g(y)m(ou)h +(built)g(it,)h(y)m(ou)f(should)f Fi(not)h Fo(install)h(it;)i +Fj(make)47 b(install)33 b Fo(is)28 827 y(used)g(only)g(to)g(mo)m(v)m(e) +i(the)e(necessary)g(parts)g(of)g(a)h(built)e(R)m(OMIO)h(to)h(another)f +(lo)s(cation.)50 b(The)33 b(installed)h(cop)m(y)28 940 +y(will)d(ha)m(v)m(e)h(the)e(include)g(\014les,)h(libraries,)g(man)f +(pages,)h(and)f(a)h(few)f(other)g(o)s(dds)g(and)f(ends,)h(but)g(not)g +(the)h(whole)28 1053 y(source)36 b(tree.)58 b(It)36 b(will)g(ha)m(v)m +(e)h(a)g Fj(test)d Fo(directory)j(for)e(testing)i(the)f(installation)i +(and)d(a)i(lo)s(cation-indep)s(enden)m(t)28 1166 y(Mak)m(e\014le)29 +b(built)d(during)f(installation,)30 b(whic)m(h)c(users)g(can)g(cop)m(y) +i(and)d(mo)s(dify)h(to)h(compile)h(and)e(link)g(against)i(the)28 +1279 y(installed)j(cop)m(y)-8 b(.)169 1392 y(T)g(o)31 +b(rebuild)f(R)m(OMIO)g(with)g(a)h(di\013eren)m(t)g(set)f(of)h +(con\014gure)f(options,)h(do)299 1505 y Fj(make)46 b(distclean)28 +1618 y Fo(to)40 b(clean)g(ev)m(erything,)i(including)c(the)h(Mak)m +(e\014les)i(created)e(b)m(y)g Fj(configure)p Fo(.)64 +b(Then)38 b(run)f Fj(configure)f Fo(again)28 1730 y(with)30 +b(the)h(new)f(options,)h(follo)m(w)m(ed)h(b)m(y)e Fj(make)p +Fo(.)28 1974 y Fc(4.1)113 b(Con\014guring)38 b(for)f(Lin)m(ux)i(and)f +(Large)g(Files)28 2146 y Fo(32-bit)j(systems)f(running)e(lin)m(ux)h(k)m +(ernel)h(v)m(ersion)g(2.4.0)i(or)d(new)m(er)h(and)f(glib)s(c)g(v)m +(ersion)h(2.2.0)i(or)d(new)m(er)h(can)28 2258 y(supp)s(ort)c(\014les)h +(greater)h(than)f(2)g(GBytes)i(in)e(size.)61 b(This)37 +b(supp)s(ort)e(is)i(curren)m(tly)g(automaticly)i(detected)g(and)28 +2371 y(enabled.)h(W)-8 b(e)28 b(do)s(cumen)m(t)e(the)h(man)m(ual)h +(steps)e(should)g(the)h(automatic)i(detection)f(not)f(w)m(ork)g(for)g +(some)g(reason.)169 2484 y(The)j(t)m(w)m(o)i(macros)p +843 2484 29 4 v 65 w Fj(FILE)p 1069 2484 V 34 w(OFFSET)p +1391 2484 V 32 w(BITS=64)d Fo(and)p 1964 2484 V 64 w +Fj(LARGEFILE64)p 2527 2484 V 31 w(SOURCE)g Fo(tell)j(gn)m(u)e(lib)s(c)g +(it's)h(ok)g(to)g(sup-)28 2597 y(p)s(ort)41 b(large)h(\014les)g(on)f +(32)h(bit)f(platforms.)73 b(The)41 b(former)g(c)m(hanges)h(the)g(size)g +(of)f Fj(off)p 3024 2597 V 34 w(t)g Fo(\(no)g(need)g(to)h(c)m(hange)28 +2710 y(source.)59 b(migh)m(t)36 b(a\013ect)i(in)m(terop)s(erabilit)m(y) +g(with)e(libraries)g(compiled)h(with)f(a)g(di\013eren)m(t)h(size)g(of)f +Fj(off)p 3578 2710 V 34 w(t)p Fo(\).)58 b(The)28 2823 +y(latter)28 b(exp)s(oses)e(the)g(gn)m(u)g(lib)s(c)g(functions)g(op)s +(en64\(\),)i(write64\(\),)h(read64\(\),)g(etc.)40 b(R)m(OMIO)26 +b(do)s(es)g(not)g(mak)m(e)i(use)28 2936 y(of)j(the)f(64)i(bit)e(system) +h(calls)g(directly)g(at)g(this)g(time,)g(but)f(w)m(e)g(add)g(this)g +(\015ag)h(for)f(go)s(o)s(d)g(measure.)169 3049 y(If)i(y)m(our)g(lin)m +(ux)f(system)h(is)g(relativ)m(ely)i(new,)e(there)g(is)g(an)g(excellen)m +(t)i(c)m(hance)f(it)f(is)g(running)e(k)m(ernel)j(2.4.0)g(or)28 +3162 y(new)m(er)e(and)e(glib)s(c-2.2.0)k(or)e(new)m(er.)40 +b(Add)30 b(the)g(string)28 3349 y Fj("-D_FILE_OFFSET_BITS=64)42 +b(-D_LARGEFILE64_SOURCE")28 3537 y Fo(to)31 b(y)m(our)g(CFLA)m(GS)f(en) +m(vironmen)m(t)h(v)-5 b(ariable)32 b(b)s(efore)d(runnin)m(t)h +Fj(./configure)28 3823 y Fn(5)135 b(T)-11 b(esting)45 +b(R)l(OMIO)28 4026 y Fo(T)-8 b(o)31 b(test)g(if)g(the)f(installation)j +(w)m(orks,)d(do)299 4139 y Fj(make)46 b(testing)28 4252 +y Fo(in)39 b(the)f Fj(romio/test)e Fo(directory)-8 b(.)66 +b(This)38 b(calls)i(a)f(script)f(that)i(runs)d(the)h(test)i(programs)e +(and)g(compares)h(the)28 4365 y(results)d(with)f(what)h(they)g(should)e +(b)s(e.)56 b(By)36 b(default,)i Fj(make)47 b(testing)33 +b Fo(causes)j(the)g(test)h(programs)e(to)i(create)28 +4478 y(\014les)31 b(in)g(the)g(curren)m(t)g(directory)h(and)e(use)h +(whatev)m(er)h(\014le)f(system)h(that)f(corresp)s(onds)f(to.)44 +b(T)-8 b(o)31 b(test)h(with)f(other)28 4591 y(\014le)41 +b(systems,)j(y)m(ou)d(need)g(to)g(sp)s(ecify)g(a)g(\014lename)g(in)g(a) +g(directory)g(corresp)s(onding)f(to)i(that)f(\014le)g(system)g(as)28 +4704 y(follo)m(ws:)299 4817 y Fj(make)46 b(testing)g +(TESTARGS="-fname=/foo/pio)o(fs/)o(test)o(")1933 5520 +y Fo(11)p eop end +%%Page: 12 14 +TeXDict begin 12 13 bop 28 263 a Fn(6)135 b(Compiling)46 +b(and)f(Running)f(MPI-IO)h(Programs)28 466 y Fo(If)29 +b(R)m(OMIO)g(is)f(not)i(already)f(included)f(in)h(the)g(MPI)g(implemen) +m(tation,)i(y)m(ou)e(need)g(to)g(include)g(the)g(\014le)g +Fj(mpio.h)28 579 y Fo(for)h(C)g(or)h Fj(mpiof.h)d Fo(for)i(F)-8 +b(ortran)31 b(in)f(y)m(our)h(MPI-IO)f(program.)169 691 +y(Note)40 b(that)f(on)f(HP)h(mac)m(hines)f(running)f(HPUX)i(and)e(on)i +(NEC)f(SX-4,)i(y)m(ou)f(need)f(to)h(compile)h(F)-8 b(ortran)28 +804 y(programs)30 b(with)g Fj(mpifort)p Fo(.)169 917 +y(With)h(MPICH,)g(HP)f(MPI,)h(or)f(NEC)g(MPI,)h(y)m(ou)f(can)h(compile) +g(MPI-IO)g(programs)f(as)299 1030 y Fj(mpicc)46 b(foo.c)28 +1143 y Fo(or)299 1256 y Fj(mpifort)f(foo.f)169 1482 y +Fo(With)31 b(SGI)f(MPI,)h(y)m(ou)g(can)f(compile)i(MPI-IO)e(programs)g +(as)299 1595 y Fj(cc)47 b(foo.c)f(-lmpi)28 1708 y Fo(or)299 +1821 y Fj(f77)h(foo.f)f(-lmpi)28 1933 y Fo(or)299 2046 +y Fj(f90)h(foo.f)f(-lmpi)169 2272 y Fo(With)31 b(LAM,)g(y)m(ou)g(can)g +(compile)g(MPI-IO)f(programs)g(as)299 2385 y Fj(hcc)47 +b(foo.c)f(-lmpi)28 2498 y Fo(or)299 2611 y Fj(hf77)g(foo.f)h(-lmpi)169 +2837 y Fo(If)d(y)m(ou)g(ha)m(v)m(e)h(built)f(R)m(OMIO)g(with)f(some)h +(other)g(MPI)g(implemen)m(tation,)49 b(y)m(ou)44 b(can)h(compile)f +(MPI-IO)28 2950 y(programs)24 b(b)m(y)g(explicitly)i(giving)f(the)f +(path)g(to)h(the)f(include)g(\014le)g(mpio.h)g(or)g(mpiof.h)f(and)h +(explicitly)h(sp)s(ecifying)28 3063 y(the)31 b(path)f(to)h(the)g +(library)f(libmpio.a,)h(whic)m(h)f(is)g(lo)s(cated)i(in)e +Fj($\(ROMIO)p 2500 3063 29 4 v 33 w(HOME\)/lib/$\(ARCH\)/libmp)o(io.)o +(a)p Fo(.)169 3175 y(Run)c(the)g(program)h(as)f(y)m(ou)h(w)m(ould)g +(run)e(an)m(y)h(MPI)h(program)f(on)h(the)f(mac)m(hine.)40 +b(If)26 b(y)m(ou)h(use)f Fj(mpirun)p Fo(,)g(mak)m(e)28 +3288 y(sure)g(y)m(ou)g(use)g(the)g(correct)i Fj(mpirun)c +Fo(for)i(the)g(MPI)g(implemen)m(tation)i(y)m(ou)e(are)h(using.)39 +b(F)-8 b(or)26 b(example,)i(if)e(y)m(ou)h(are)28 3401 +y(using)f(MPICH)f(on)h(an)g(SGI)f(mac)m(hine,)j(mak)m(e)f(sure)e(that)i +(y)m(ou)f(use)g(MPICH's)f Fj(mpirun)g Fo(and)g(not)h(SGI's)g +Fj(mpirun)p Fo(.)28 3688 y Fn(7)135 b(Limitations)47 +b(of)e(This)g(V)-11 b(ersion)44 b(of)i(R)l(OMIO)165 3891 +y Ff(\017)g Fo(When)41 b(used)f(with)h(an)m(y)g(MPI)g(implemen)m +(tation)i(other)f(than)e(MPICH)h(revision)h(1.2.1)h(or)e(later,)k(the) +256 4004 y Fj(status)37 b Fo(argumen)m(t)i(is)g(not)g(\014lled)f(in)h +(an)m(y)g(MPI-IO)f(function.)66 b(Consequen)m(tly)-8 +b(,)41 b Fj(MPI)p 3299 4004 V 34 w(Get)p 3477 4004 V +34 w(count)c Fo(and)256 4116 y Fj(MPI)p 406 4116 V 33 +w(Get)p 583 4116 V 34 w(elements)27 b Fo(will)j(not)g(w)m(ork)f(when)g +(passed)g(the)h Fj(status)d Fo(ob)5 b(ject)31 b(from)e(an)g(MPI-IO)h +(op)s(eration.)165 4304 y Ff(\017)46 b Fo(Additionally)-8 +b(,)34 b(when)d(used)g(with)h(an)m(y)h(MPI)f(implemen)m(tation)i(other) +e(than)g(MPICH)g(revision)g(1.2.1)i(or)256 4417 y(later,)26 +b(all)g(MPI-IO)e(functions)g(return)f(only)i(t)m(w)m(o)h(p)s(ossible)e +(error)g(co)s(des|)p Fj(MPI)p 2972 4417 V 33 w(SUCCESS)f +Fo(on)h(success)h(and)256 4530 y Fj(MPI)p 406 4530 V +33 w(ERR)p 583 4530 V 34 w(UNKNOWN)j Fo(on)i(failure.)165 +4718 y Ff(\017)46 b Fo(This)37 b(v)m(ersion)i(w)m(orks)f(only)h(on)f(a) +h(homogeneous)g(cluster)f(of)h(mac)m(hines,)i(and)d(only)g(the)h +(\\nativ)m(e")h(\014le)256 4830 y(data)31 b(represen)m(tation)g(is)g +(supp)s(orted.)165 5018 y Ff(\017)46 b Fo(Shared)28 b(\014le)h(p)s(oin) +m(ters)h(are)g(not)f(supp)s(orted)f(on)h(the)h(PVFS2)g(\014le)f(system) +h(b)s(ecause)f(it)h(do)s(es)f(not)h(supp)s(ort)256 5131 +y Fj(fcntl)f Fo(\014le)h(lo)s(c)m(ks,)i(and)d(R)m(OMIO)i(uses)e(that)i +(feature)g(to)g(implemen)m(t)g(shared)f(\014le)g(p)s(oin)m(ters.)1933 +5520 y(12)p eop end +%%Page: 13 15 +TeXDict begin 13 14 bop 165 263 a Ff(\017)46 b Fo(On)31 +b(HP)h(mac)m(hines)h(running)d(HPUX)j(and)f(on)g(NEC)g(SX-4,)h(y)m(ou)g +(need)f(to)h(compile)g(F)-8 b(ortran)33 b(programs)256 +376 y(with)d Fj(mpifort)p Fo(.)28 662 y Fn(8)135 b(Usage)46 +b(Tips)165 865 y Ff(\017)g Fo(When)41 b(using)h(R)m(OMIO)g(with)f(SGI)h +(MPI,)g(y)m(ou)h(ma)m(y)f(sometimes)h(get)g(an)f(error)g(message)h +(from)f(SGI)256 978 y(MPI:)d(\\MPI)h(has)f(run)f(out)i(of)f(in)m +(ternal)h(datat)m(yp)s(e)h(en)m(tries.)68 b(Please)41 +b(set)f(the)f(en)m(vironmen)m(t)h(v)-5 b(ariable)256 +1091 y Fj(MPI)p 406 1091 29 4 v 33 w(TYPE)p 631 1091 +V 33 w(MAX)33 b Fo(for)g(additional)h(space.")50 b(If)33 +b(y)m(ou)g(get)h(this)f(error)g(message,)i(add)e(the)g(follo)m(wing)i +(line)f(to)256 1204 y(y)m(our)c Fj(.cshrc)f Fo(\014le:)526 +1317 y Fj(setenv)46 b(MPI)p 1010 1317 V 34 w(TYPE)p 1236 +1317 V 33 w(MAX)h(65536)256 1429 y Fo(Use)30 b(a)h(larger)g(n)m(um)m(b) +s(er)e(if)i(y)m(ou)f(still)i(get)f(the)g(error)f(message.)165 +1617 y Ff(\017)46 b Fo(If)26 b(a)i(F)-8 b(ortran)27 b(program)g(uses)g +(a)g(\014le)g(handle)g(created)h(using)f(R)m(OMIO's)g(C)g(in)m +(terface,)i(or)e(vice)h(v)m(ersa,)h(y)m(ou)256 1730 y(m)m(ust)i(use)g +(the)g(functions)g Fj(MPI)p 1340 1730 V 34 w(File)p 1566 +1730 V 33 w(c2f)f Fo(or)i Fj(MPI)p 2030 1730 V 33 w(File)p +2255 1730 V 33 w(f2c)f Fo(\(see)h Ff(x)g Fo(4.12.4)h(in)e([4)q(]\).)44 +b(Suc)m(h)31 b(a)g(situation)256 1843 y(o)s(ccurs,)26 +b(for)g(example,)i(if)e(a)g(F)-8 b(ortran)27 b(program)e(uses)h(an)g +(I/O)g(library)f(written)h(in)g(C)f(with)h(MPI-IO)g(calls.)256 +1956 y(Similar)k(functions)g Fj(MPIO)p 1159 1956 V 33 +w(Request)p 1528 1956 V 33 w(f2c)f Fo(and)h Fj(MPIO)p +2103 1956 V 33 w(Request)p 2472 1956 V 33 w(c2f)f Fo(are)i(also)g(pro)m +(vided.)165 2143 y Ff(\017)46 b Fo(F)-8 b(or)34 b(F)-8 +b(ortran)35 b(programs)e(on)h(the)g(In)m(tel)h(P)m(aragon,)h(y)m(ou)e +(ma)m(y)g(need)g(to)h(pro)m(vide)f(the)g(complete)h(path)f(to)256 +2256 y Fj(mpif.h)28 b Fo(in)i(the)h Fj(include)d Fo(statemen)m(t,)33 +b(e.g.,)526 2369 y Fj(include)46 b('/usr/local/mpich/inclu)o(de/m)o +(pif.)o(h')256 2482 y Fo(instead)30 b(of)526 2595 y Fj(include)46 +b('mpif.h')256 2708 y Fo(This)31 b(is)h(b)s(ecause)g(the)g +Fj(-I)g Fo(option)g(to)h(the)f(P)m(aragon)i(F)-8 b(ortran)33 +b(compiler)f Fj(if77)f Fo(do)s(esn't)h(w)m(ork)g(correctly)-8 +b(.)256 2821 y(It)33 b(alw)m(a)m(ys)i(lo)s(oks)e(in)g(the)g(default)h +(directories)g(\014rst)e(and,)i(therefore,)g(pic)m(ks)g(up)e(In)m +(tel's)i Fj(mpif.h)p Fo(,)f(whic)m(h)256 2934 y(is)d(actually)i(the)f +Fj(mpif.h)d Fo(of)j(an)f(older)h(v)m(ersion)f(of)h(MPICH.)28 +3220 y Fn(9)135 b(Rep)t(orting)46 b(Bugs)28 3423 y Fo(If)36 +b(y)m(ou)h(ha)m(v)m(e)g(trouble,)h(\014rst)e(c)m(hec)m(k)i(the)e(users) +g(guide.)58 b(Then)36 b(c)m(hec)m(k)h(if)g(there)f(is)g(a)h(list)g(of)g +(kno)m(wn)e(bugs)h(and)28 3536 y(patc)m(hes)i(on)f(the)f(R)m(OMIO)h(w)m +(eb)g(page)g(at)h Fj(http://www.mcs.anl.gov/)o(romi)o(o)p +Fo(.)54 b(Finally)-8 b(,)40 b(if)c(y)m(ou)h(still)h(ha)m(v)m(e)28 +3649 y(problems,)30 b(send)g(a)h(detailed)g(message)g(con)m(taining:) +148 3762 y Ff(\017)g Fo(the)g(t)m(yp)s(e)f(of)h(system)f(\(often)h +Fj(uname)47 b(-a)p Fo(\),)148 3875 y Ff(\017)31 b Fo(the)g(output)f(of) +g Fj(configure)p Fo(,)148 3988 y Ff(\017)h Fo(the)g(output)f(of)g +Fj(make)p Fo(,)g(and)148 4101 y Ff(\017)h Fo(an)m(y)g(programs)f(or)g +(tests)28 4214 y(to)h Fj(romio-maint@mcs.anl.gov)p Fo(.)28 +4500 y Fn(10)135 b(R)l(OMIO)45 b(In)l(ternals)28 4703 +y Fo(A)34 b(k)m(ey)g(comp)s(onen)m(t)g(of)g(R)m(OMIO)f(that)h(enables)g +(suc)m(h)g(a)f(p)s(ortable)h(MPI-IO)f(implemen)m(tation)i(is)f(an)g(in) +m(ternal)28 4816 y(abstract)i(I/O)f(device)g(la)m(y)m(er)i(called)f +(ADIO)f([5].)55 b(Most)35 b(users)f(of)h(R)m(OMIO)g(will)g(not)g(need)g +(to)g(deal)h(with)e(the)28 4929 y(ADIO)d(la)m(y)m(er)h(at)f(all.)42 +b(Ho)m(w)m(ev)m(er,)33 b(ADIO)d(is)h(useful)f(to)h(those)g(who)f(w)m +(an)m(t)h(to)g(p)s(ort)f(R)m(OMIO)g(to)i(some)e(other)h(\014le)28 +5042 y(system.)41 b(The)30 b(R)m(OMIO)g(source)h(co)s(de)f(and)g(the)h +(ADIO)f(pap)s(er)g([5])h(will)g(help)f(y)m(ou)g(get)i(started.)169 +5155 y(MPI-IO)39 b(implemen)m(tation)h(issues)f(are)g(discussed)e(in)i +([6].)66 b(All)40 b(R)m(OMIO-related)f(pap)s(ers)f(are)h(a)m(v)-5 +b(ailable)28 5268 y(online)31 b(at)g Fj(http://www.mcs.anl.gov/ro)o +(mio)o Fo(.)1933 5520 y(13)p eop end +%%Page: 14 16 +TeXDict begin 14 15 bop 28 263 a Fn(11)135 b(Learning)46 +b(MPI-IO)28 466 y Fo(The)25 b(b)s(o)s(ok)f Fi(Using)k(MPI-2:)38 +b(A)-5 b(dvanc)g(e)g(d)29 b(F)-7 b(e)i(atur)g(es)30 b(of)e(the)g +(Message-Passing)f(Interfac)-5 b(e)26 b Fo([3)q(],)g(published)e(b)m(y) +h(MIT)28 579 y(Press,)j(pro)m(vides)g(a)g(tutorial)g(in)m(tro)s +(duction)g(to)g(all)h(asp)s(ects)f(of)f(MPI-2,)i(including)e(parallel)i +(I/O.)f(It)f(has)h(lots)g(of)28 691 y(example)35 b(programs.)50 +b(See)34 b Fj(http://www.mcs.anl.gov/mpi)o(/usi)o(ngm)o(pi2)27 +b Fo(for)34 b(further)e(information)j(ab)s(out)28 804 +y(the)c(b)s(o)s(ok.)28 1091 y Fn(12)135 b(Ma)7 b(jor)46 +b(Changes)f(in)g(Previous)h(Releases)28 1297 y Fc(12.1)113 +b(Ma)6 b(jor)38 b(Changes)h(in)f(V)-9 b(ersion)37 b(1.2.3)165 +1469 y Ff(\017)46 b Fo(Added)19 b(explicit)j(con)m(trol)f(o)m(v)m(er)h +(aggregators)h(for)d(collectiv)m(e)j(op)s(erations)e(\(see)g +(description)g(of)27 b Fj(cb)p 3578 1469 29 4 v 34 w(config)p +3900 1469 V 33 w(list)p Fo(\).)165 1656 y Ff(\017)46 +b Fo(Added)29 b(the)i(follo)m(wing)g(w)m(orking)g(hin)m(ts:)41 +b Fj(cb)p 1793 1656 V 34 w(config)p 2115 1656 V 32 w(list)p +Fo(,)30 b Fj(romio)p 2634 1656 V 33 w(cb)p 2763 1656 +V 34 w(read)p Fo(,)f Fj(romio)p 3283 1656 V 33 w(cb)p +3412 1656 V 34 w(write)p Fo(,)256 1769 y Fj(romio)p 502 +1769 V 33 w(ds)p 631 1769 V 33 w(read)p Fo(.)66 b(These)38 +b(additional)i(hin)m(ts)f(ha)m(v)m(e)h(b)s(een)e(added)h(but)f(are)h +(curren)m(tly)g(ignored)g(b)m(y)g(the)256 1882 y(implemen)m(tation:)j +Fj(romio)p 1186 1882 V 33 w(ds)p 1315 1882 V 34 w(write)p +Fo(,)29 b Fj(romio)p 1883 1882 V 33 w(no)p 2012 1882 +V 34 w(indep)p 2286 1882 V 33 w(rw)p Fo(.)165 2070 y +Ff(\017)46 b Fo(Added)29 b(NTFS)h(ADIO)g(implemen)m(tation.)165 +2257 y Ff(\017)46 b Fo(Added)29 b(testfs)i(ADIO)f(implemen)m(tation)i +(for)f(use)f(in)g(debugging.)165 2445 y Ff(\017)46 b +Fo(Added)23 b(delete)j(function)e(to)h(ADIO)f(in)m(terface)i(so)e(that) +h(\014le)g(systems)f(that)h(need)f(to)h(use)f(their)h(o)m(wn)f(delete) +256 2558 y(function)30 b(ma)m(y)h(do)f(so)h(\(e.g.)42 +b(PVFS\).)165 2746 y Ff(\017)k Fo(Changed)29 b(v)m(ersion)i(n)m(um)m(b) +s(ering)e(to)j(matc)m(h)f(v)m(ersion)g(n)m(um)m(b)s(er)e(of)h(MPICH)g +(release.)28 2989 y Fc(12.2)113 b(Ma)6 b(jor)38 b(Changes)h(in)f(V)-9 +b(ersion)37 b(1.0.3)165 3161 y Ff(\017)46 b Fo(When)31 +b(used)g(with)h(MPICH)f(1.2.1,)j(the)e(MPI-IO)g(functions)f(return)g +(prop)s(er)f(error)i(co)s(des)g(and)f(classes,)256 3273 +y(and)e(the)i(status)g(ob)5 b(ject)31 b(is)f(\014lled)h(in.)165 +3461 y Ff(\017)46 b Fo(On)37 b(SGI's)h(XFS)g(\014le)g(system,)j(R)m +(OMIO)d(can)g(use)g(direct)h(I/O)f(ev)m(en)h(if)f(the)g(user's)g +(request)g(do)s(es)g(not)256 3574 y(meet)27 b(the)g(v)-5 +b(arious)27 b(restrictions)h(needed)e(to)i(use)e(direct)h(I/O.)g(R)m +(OMIO)g(do)s(es)f(this)h(b)m(y)g(doing)f(part)h(of)g(the)256 +3687 y(request)34 b(with)f(bu\013ered)g(I/O)h(\(un)m(til)g(all)h(the)f +(restrictions)h(are)f(met\))h(and)e(doing)h(the)g(rest)g(with)g(direct) +256 3800 y(I/O.)c(\(This)g(feature)h(hasn't)f(b)s(een)g(tested)h +(rigorously)-8 b(.)41 b(Please)32 b(c)m(hec)m(k)g(for)e(errors.\))256 +3950 y(By)i(default,)i(R)m(OMIO)e(will)h(use)f(only)g(bu\013ered)g +(I/O.)g(Direct)i(I/O)e(can)h(b)s(e)f(enabled)g(either)h(b)m(y)f +(setting)256 4063 y(the)39 b(en)m(vironmen)m(t)h(v)-5 +b(ariables)40 b Fj(MPIO)p 1537 4063 V 33 w(DIRECT)p 1858 +4063 V 33 w(READ)e Fo(and/or)i Fj(MPIO)p 2626 4063 V +33 w(DIRECT)p 2947 4063 V 33 w(WRITE)e Fo(to)i Fj(TRUE)p +Fo(,)e(or)i(on)f(a)256 4176 y(p)s(er-\014le)29 b(basis)i(b)m(y)f(using) +g(the)g(info)h(k)m(eys)g Fj(direct)p 1979 4176 V 32 w(read)f +Fo(and)f Fj(direct)p 2697 4176 V 33 w(write)p Fo(.)256 +4326 y(Direct)i(I/O)f(will)h(result)f(in)g(higher)g(p)s(erformance)g +(only)g(if)g(y)m(ou)h(are)g(accessing)h(a)e(high-bandwidth)f(disk)256 +4439 y(system.)40 b(Otherwise,)31 b(bu\013ered)e(I/O)h(is)h(b)s(etter)f +(and)g(is)g(therefore)h(used)f(as)g(the)h(default.)165 +4627 y Ff(\017)46 b Fo(Miscellaneous)32 b(bug)e(\014xes.)28 +4870 y Fc(12.3)113 b(Ma)6 b(jor)38 b(Changes)h(in)f(V)-9 +b(ersion)37 b(1.0.2)165 5042 y Ff(\017)46 b Fo(Implemen)m(ted)33 +b(the)h(shared)f(\014le)h(p)s(oin)m(ter)g(functions)f(and)g(split)h +(collectiv)m(e)j(I/O)d(functions.)50 b(Therefore,)256 +5155 y(the)34 b(main)h(comp)s(onen)m(ts)f(of)h(the)g(MPI)f(I/O)h(c)m +(hapter)g(not)g(y)m(et)g(implemen)m(ted)g(are)g(\014le)g(in)m(terop)s +(erabilit)m(y)256 5268 y(and)29 b(error)h(handling.)1933 +5520 y(14)p eop end +%%Page: 15 17 +TeXDict begin 15 16 bop 165 263 a Ff(\017)46 b Fo(Added)23 +b(supp)s(ort)f(for)i(using)g(\\direct)h(I/O")g(on)f(SGI's)g(XFS)g +(\014le)g(system.)39 b(Direct)26 b(I/O)e(is)g(an)g(optional)h(fea-)256 +376 y(ture)f(of)h(XFS)g(in)g(whic)m(h)f(data)i(is)f(mo)m(v)m(ed)h +(directly)g(b)s(et)m(w)m(een)f(the)g(user's)g(bu\013er)e(and)i(the)g +(storage)h(devices,)256 488 y(b)m(ypassing)i(the)i(\014le-system)f(cac) +m(he.)42 b(This)28 b(can)h(impro)m(v)m(e)h(p)s(erformance)f +(signi\014can)m(tly)h(on)f(systems)g(with)256 601 y(high)34 +b(disk)h(bandwidth.)52 b(Without)36 b(high)f(disk)f(bandwidth,)h +(regular)g(I/O)g(\(that)h(uses)e(the)i(\014le-system)256 +714 y(cac)m(he\))d(p)s(erfoms)d(b)s(etter.)43 b(R)m(OMIO,)31 +b(therefore,)h(do)s(es)f(not)g(use)g(direct)h(I/O)f(b)m(y)g(default.)43 +b(The)31 b(user)f(can)256 827 y(turn)c(on)h(direct)h(I/O)f +(\(separately)i(for)e(reading)g(and)g(writing\))g(either)h(b)m(y)f +(using)g(en)m(vironmen)m(t)h(v)-5 b(ariables)256 940 +y(or)30 b(b)m(y)g(using)g(MPI's)h(hin)m(ts)f(mec)m(hanism)g(\(info\).) +42 b(T)-8 b(o)31 b(use)f(the)g(en)m(vironmen)m(t-v)-5 +b(ariables)32 b(metho)s(d,)e(do)590 1152 y Fj(setenv)46 +b(MPIO_DIRECT_READ)d(TRUE)590 1265 y(setenv)j(MPIO_DIRECT_WRITE)d(TRUE) +256 1476 y Fo(T)-8 b(o)29 b(use)g(the)h(hin)m(ts)f(metho)s(d,)g(the)g +(t)m(w)m(o)i(k)m(eys)f(are)f Fj(direct)p 2248 1476 29 +4 v 33 w(read)f Fo(and)h Fj(direct)p 2965 1476 V 32 w(write)p +Fo(.)39 b(By)30 b(default)f(their)256 1589 y(v)-5 b(alues)32 +b(are)g Fj(false)p Fo(.)44 b(T)-8 b(o)32 b(turn)f(on)g(direct)i(I/O,)f +(set)g(the)g(v)-5 b(alues)32 b(to)h Fj(true)p Fo(.)44 +b(The)31 b(en)m(vironmen)m(t)i(v)-5 b(ariables)256 1702 +y(ha)m(v)m(e)29 b(priorit)m(y)g(o)m(v)m(er)h(the)e(info)h(k)m(eys.)40 +b(In)28 b(other)h(w)m(ords,)f(if)h(the)f(en)m(vironmen)m(t)h(v)-5 +b(ariables)29 b(are)g(set)g(to)g Fj(TRUE)p Fo(,)256 1815 +y(direct)i(I/O)f(will)h(b)s(e)f(used)f(ev)m(en)i(if)g(the)g(info)f(k)m +(eys)h(sa)m(y)g Fj(false)p Fo(,)e(and)h(vice)i(v)m(ersa.)42 +b(Note)31 b(that)g(direct)g(I/O)256 1928 y(m)m(ust)37 +b(b)s(e)g(turned)g(on)h(separately)h(for)e(reading)h(and)f(writing.)63 +b(The)37 b(en)m(vironmen)m(t-v)-5 b(ariables)40 b(metho)s(d)256 +2041 y(assumes)30 b(that)h(the)f(en)m(vironmen)m(t)h(v)-5 +b(ariables)31 b(can)g(b)s(e)e(read)i(b)m(y)f(eac)m(h)h(pro)s(cess)f(in) +g(the)h(MPI)f(job.)41 b(This)29 b(is)256 2154 y(not)g(guaran)m(teed)h +(b)m(y)f(the)g(MPI)g(Standard,)f(but)g(it)i(w)m(orks)e(with)h(SGI's)g +(MPI)g(and)f(the)h Fj(ch)p 3388 2154 V 34 w(shmem)e Fo(device)256 +2266 y(of)j(MPICH.)165 2450 y Ff(\017)46 b Fo(Added)25 +b(supp)s(ort)g(\(new)h(ADIO)h(device,)i Fj(ad)p 1761 +2450 V 33 w(pvfs)p Fo(\))d(for)g(the)h(PVFS)g(parallel)g(\014le)g +(system)g(for)f(Lin)m(ux)g(clus-)256 2563 y(ters,)f(dev)m(elop)s(ed)e +(at)i(Clemson)e(Univ)m(ersit)m(y)h(\(see)h Fj(http://www.parl.clemson)o +(.edu)o(/pv)o(fs)p Fo(\).)33 b(T)-8 b(o)23 b(use)g(it,)256 +2675 y(y)m(ou)28 b(m)m(ust)g(\014rst)g(install)h(PVFS)f(and)g(then)g +(when)f(con\014guring)h(R)m(OMIO,)g(sp)s(ecify)g Fj(-file)p +3376 2675 V 33 w(system=pvfs)256 2788 y Fo(in)h(addition)h(to)g(an)m(y) +g(other)g(options)h(to)f Fj(configure)p Fo(.)38 b(\(As)30 +b(usual,)g(y)m(ou)g(can)g(con\014gure)f(for)h(m)m(ultiple)g(\014le)256 +2901 y(systems)i(b)m(y)g(using)f(\\)p Fj(+)p Fo(";)j(for)e(example,)h +Fj(-file)p 1929 2901 V 33 w(system=pvfs+ufs+nfs)p Fo(.\))41 +b(Y)-8 b(ou)33 b(will)f(need)g(to)h(sp)s(ecify)256 3014 +y(the)d(path)g(to)h(the)g(PVFS)f(include)g(\014les)h(via)g(the)f +Fj(-cflags)f Fo(option)h(to)i Fj(configure)p Fo(,)c(for)i(example,)256 +3127 y Fj(configure)45 b(-cflags=-I/usr/pvfs/incl)o(ude)o +Fo(.)33 b(Y)-8 b(ou)24 b(will)g(also)g(need)g(to)g(sp)s(ecify)f(the)h +(full)f(path)g(name)256 3240 y(of)30 b(the)g(PVFS)g(library)-8 +b(.)40 b(The)30 b(b)s(est)f(w)m(a)m(y)i(to)g(do)f(this)f(is)h(via)h +(the)f Fj(-lib)f Fo(option)h(to)h(MPICH's)f Fj(configure)256 +3353 y Fo(script)g(\(assuming)g(y)m(ou)h(are)g(using)f(R)m(OMIO)g(from) +g(within)g(MPICH\).)165 3536 y Ff(\017)46 b Fo(Uses)22 +b(w)m(eak)h(sym)m(b)s(ols)f(\(where)g(a)m(v)-5 b(ailable\))24 +b(for)e(building)g(the)g(pro\014ling)f(v)m(ersion,)k(i.e.,)g(the)d +(PMPI)g(routines.)256 3649 y(As)30 b(a)h(result,)f(the)h(size)g(of)g +(the)f(library)g(is)g(reduced)g(considerably)-8 b(.)165 +3832 y Ff(\017)46 b Fo(The)40 b(Mak)m(e\014les)i(use)e +Fi(virtual)i(p)-5 b(aths)43 b Fo(if)d(supp)s(orted)f(b)m(y)h(the)h(mak) +m(e)h(utilit)m(y)-8 b(.)72 b(GNU)42 b Fj(make)d Fo(supp)s(orts)f(it,) +256 3945 y(for)32 b(example.)48 b(This)31 b(feature)i(allo)m(ws)h(y)m +(ou)f(to)g(un)m(tar)g(the)f(distribution)g(in)g(some)h(directory)-8 +b(,)35 b(sa)m(y)e(a)g(slo)m(w)256 4058 y(NFS)39 b(directory)-8 +b(,)44 b(and)39 b(compile)i(the)e(library)h(\(create)i(the)d(.o)i +(\014les\))f(in)f(another)h(directory)-8 b(,)44 b(sa)m(y)c(on)g(a)256 +4171 y(faster)c(lo)s(cal)h(disk.)57 b(F)-8 b(or)37 b(example,)h(if)e +(the)g(tar)g(\014le)g(has)g(b)s(een)f(un)m(tarred)g(in)h(an)g(NFS)g +(directory)g(called)256 4284 y Fj(/home/thakur/romio)p +Fo(,)19 b(one)k(can)g(compile)h(it)f(in)f(a)i(di\013eren)m(t)f +(directory)-8 b(,)25 b(sa)m(y)f Fj(/tmp/thakur)p Fo(,)d(as)i(follo)m +(ws:)637 4495 y Fj(cd)48 b(/tmp/thakur)637 4608 y +(/home/thakur/romio/configu)o(re)637 4721 y(make)256 +4933 y Fo(The)29 b(.o)i(\014les)g(will)g(b)s(e)e(created)j(in)e +Fj(/tmp/thakur)p Fo(;)d(the)k(library)f(will)h(b)s(e)e(created)j(in)256 +5046 y Fj(/home/thakur/romio/lib/)o($AR)o(CH/l)o(ibmp)o(io.)o(a)p +Fo(.)63 b(This)39 b(metho)s(d)g(w)m(orks)h(only)g(if)f(the)h +Fj(make)f Fo(utilit)m(y)256 5158 y(supp)s(orts)28 b Fi(virtual)34 +b(p)-5 b(aths)p Fo(.)43 b(If)30 b(the)h(default)g Fj(make)e +Fo(utilit)m(y)j(do)s(es)e(not,)i(y)m(ou)f(can)f(install)i(GNU)f +Fj(make)f Fo(whic)m(h)256 5271 y(do)s(es,)g(and)g(sp)s(ecify)g(it)h(to) +g Fj(configure)d Fo(as)1933 5520 y(15)p eop end +%%Page: 16 18 +TeXDict begin 16 17 bop 590 263 a Fj(/home/thakur/romio/conf)o(igur)o +(e)42 b(-make=/usr/gnu/bin/gmak)o(e)g(\(or)47 b(whatever\))165 +488 y Ff(\017)f Fo(Lots)30 b(of)h(miscellaneous)h(bug)d(\014xes)h(and)g +(other)h(enhancemen)m(ts.)165 675 y Ff(\017)46 b Fo(This)33 +b(v)m(ersion)h(is)g(included)f(in)g(MPICH)h(1.2.0.)53 +b(If)33 b(y)m(ou)i(are)f(using)f(MPICH,)h(y)m(ou)g(need)g(not)g(do)m +(wnload)256 788 y(R)m(OMIO)45 b(separately;)53 b(it)46 +b(gets)g(built)f(as)g(part)g(of)g(MPICH.)g(The)g(previous)g(v)m(ersion) +g(of)g(R)m(OMIO)g(is)256 901 y(included)30 b(in)i(LAM,)g(HP)f(MPI,)h +(SGI)f(MPI,)h(and)f(NEC)g(MPI.)g(NEC)h(has)f(also)h(implemen)m(ted)g +(the)g(MPI-)256 1014 y(IO)e(functions)g(missing)g(in)g(R)m(OMIO,)h(and) +f(therefore)h(NEC)f(MPI)h(has)f(a)h(complete)h(implemen)m(tation)g(of) +256 1127 y(MPI-IO.)28 1370 y Fc(12.4)113 b(Ma)6 b(jor)38 +b(Changes)h(in)f(V)-9 b(ersion)37 b(1.0.1)165 1542 y +Ff(\017)46 b Fo(This)29 b(v)m(ersion)i(is)f(included)g(in)g(MPICH)g +(1.1.1)i(and)e(HP)h(MPI)f(1.4.)165 1730 y Ff(\017)46 +b Fo(Added)29 b(supp)s(ort)g(for)h(NEC)g(SX-4)h(and)e(created)j(a)e +(new)g(device)i Fj(ad)p 2608 1730 29 4 v 33 w(sfs)e Fo(for)g(NEC)g(SFS) +g(\014le)g(system.)165 1917 y Ff(\017)46 b Fo(New)30 +b(devices)h Fj(ad)p 873 1917 V 34 w(hfs)f Fo(for)g(HP)g(HFS)g(\014le)h +(system)f(and)g Fj(ad)p 2309 1917 V 34 w(xfs)f Fo(for)i(SGI)f(XFS)g +(\014le)g(system.)165 2105 y Ff(\017)46 b Fo(Users)30 +b(no)h(longer)g(need)g(to)g(pre\014x)f(the)h(\014lename)g(with)f(the)h +(t)m(yp)s(e)g(of)g(\014le)g(system;)h(R)m(OMIO)e(determines)256 +2218 y(the)g(\014le-system)h(t)m(yp)s(e)g(on)f(its)h(o)m(wn.)165 +2405 y Ff(\017)46 b Fo(Added)35 b(supp)s(ort)g(for)h(64-bit)i(\014le)f +(sizes)g(on)g(IBM)g(PIOFS,)f(SGI)g(XFS,)h(HP)f(HFS,)h(and)f(NEC)g(SFS)g +(\014le)256 2518 y(systems.)165 2706 y Ff(\017)46 b Fj(MPI)p +406 2706 V 33 w(Offset)c Fo(is)i(an)f(8-b)m(yte)j(in)m(teger)f(on)e +(mac)m(hines)h(that)h(supp)s(ort)d(8-b)m(yte)j(in)m(tegers.)82 +b(It)43 b(is)h(of)g(t)m(yp)s(e)256 2819 y Fj(long)i(long)31 +b Fo(in)g(C)h(and)f Fj(integer*8)e Fo(in)i(F)-8 b(ortran.)46 +b(With)32 b(a)g(F)-8 b(ortran)33 b(90)f(compiler,)h(y)m(ou)f(can)g(use) +g(either)256 2932 y Fj(integer*8)24 b Fo(or)i Fj(integer\(kind=MPI)p +1593 2932 V 30 w(OFFSET)p 1911 2932 V 33 w(KIND\))p Fo(.)g(If)g(y)m(ou) +h Fj(printf)e Fo(an)i Fj(MPI)p 3070 2932 V 33 w(Offset)e +Fo(in)i(C,)f(remem-)256 3045 y(b)s(er)31 b(to)i(use)f +Fj(\045lld)f Fo(or)h Fj(\045ld)f Fo(as)h(required)g(b)m(y)g(y)m(our)g +(compiler.)47 b(\(See)32 b(what)h(is)f(used)f(in)h(the)g(test)h +(program)256 3158 y Fj(romio/test/misc.c)p Fo(\).)i(On)26 +b(some)h(mac)m(hines,)i(R)m(OMIO)e(detects)h(at)g(con\014gure)e(time)i +(that)g Fj(long)46 b(long)256 3271 y Fo(is)25 b(either)h(not)f(supp)s +(orted)f(b)m(y)h(the)g(C)g(compiler)h(or)f(it)h(do)s(esn't)f(w)m(ork)g +(prop)s(erly)-8 b(.)39 b(In)24 b(suc)m(h)h(cases,)i(con\014gure)256 +3383 y(sets)g Fj(MPI)p 580 3383 V 33 w(Offset)e Fo(to)i +Fj(long)f Fo(in)g(C)g(and)g Fj(integer)f Fo(in)h(F)-8 +b(ortran.)40 b(This)26 b(happ)s(ens)f(on)h(In)m(tel)h(P)m(aragon,)i +(Sun4,)256 3496 y(and)g(F)-8 b(reeBSD.)165 3684 y Ff(\017)46 +b Fo(Added)24 b(supp)s(ort)h(for)g(passing)h(hin)m(ts)g(to)g(the)g +(implemen)m(tation)i(via)e(the)g Fj(MPI)p 2893 3684 V +34 w(Info)f Fo(parameter.)39 b(R)m(OMIO)256 3797 y(understands)28 +b(the)j(follo)m(wing)g(hin)m(ts)g(\(k)m(eys)g(in)f Fj(MPI)p +2024 3797 V 34 w(Info)f Fo(ob)5 b(ject\):)42 b Fj(cb)p +2721 3797 V 34 w(buffer)p 3043 3797 V 32 w(size)p Fo(,)30 +b Fj(cb)p 3418 3797 V 34 w(nodes)p Fo(,)256 3910 y Fj(ind)p +406 3910 V 33 w(rd)p 535 3910 V 34 w(buffer)p 857 3910 +V 33 w(size)p Fo(,)37 b Fj(ind)p 1288 3910 V 34 w(wr)p +1418 3910 V 34 w(buffer)p 1740 3910 V 32 w(size)f Fo(\(on)h(all)h(but)e +(IBM)h(PIOFS\),)g Fj(striping)p 3448 3910 V 32 w(factor)e +Fo(\(on)256 4023 y(PFS)d(and)h(PIOFS\),)g Fj(striping)p +1399 4023 V 32 w(unit)f Fo(\(on)h(PFS)g(and)g(PIOFS\),)g +Fj(start)p 2813 4023 V 33 w(iodevice)e Fo(\(on)i(PFS)g(and)f(PI-)256 +4136 y(OFS\),)e(and)g Fj(pfs)p 854 4136 V 33 w(svr)p +1031 4136 V 34 w(buf)f Fo(\(on)i(PFS)f(only\).)1933 5520 +y(16)p eop end +%%Page: 17 19 +TeXDict begin 17 18 bop 28 263 a Fn(References)28 466 +y Fo([1])47 b(Ra)5 b(jesh)32 b(Borda)m(w)m(ek)-5 b(ar,)35 +b(Juan)c(Miguel)j(del)e(Rosario,)j(and)c(Alok)j(Choudhary)-8 +b(.)45 b(Design)33 b(and)f(ev)-5 b(aluation)34 b(of)170 +579 y(primitiv)m(es)25 b(for)f(parallel)i(I/O.)31 b(In)24 +b Fi(Pr)-5 b(o)g(c)g(e)g(e)g(dings)30 b(of)d(Sup)-5 b(er)g(c)g +(omputing)30 b('93)p Fo(,)d(pages)e(452{461,)k(P)m(ortland,)d(OR,)170 +691 y(1993.)32 b(IEEE)e(Computer)f(So)s(ciet)m(y)j(Press.)28 +879 y([2])47 b(Alok)40 b(Choudhary)-8 b(,)40 b(Ra)5 b(jesh)39 +b(Borda)m(w)m(ek)-5 b(ar,)44 b(Mic)m(hael)d(Harry)-8 +b(,)42 b(Rak)m(esh)e(Krishnaiy)m(er,)h(Ra)m(vi)f(P)m(onn)m(usam)m(y)-8 +b(,)170 992 y(T)g(arvinder)44 b(Singh,)k(and)c(Ra)5 b(jeev)45 +b(Thakur.)83 b(P)-8 b(ASSION:)44 b(parallel)i(and)e(scalable)i(soft)m +(w)m(are)g(for)f(input-)170 1105 y(output.)26 b(T)-8 +b(ec)m(hnical)23 b(Rep)s(ort)e(SCCS-636,)j(ECE)d(Dept.,)j(NP)-8 +b(A)m(C)22 b(and)f(CASE)g(Cen)m(ter,)j(Syracuse)d(Univ)m(ersit)m(y)-8 +b(,)170 1218 y(Septem)m(b)s(er)29 b(1994.)28 1405 y([3])47 +b(William)c(Gropp,)g(Ewing)e(Lusk,)i(and)e(Ra)5 b(jeev)42 +b(Thakur.)72 b Fi(Using)42 b(MPI-2:)61 b(A)-5 b(dvanc)g(e)g(d)44 +b(F)-7 b(e)i(atur)g(es)44 b(of)f(the)170 1518 y(Message-Passing)32 +b(Interfac)-5 b(e)p Fo(.)41 b(MIT)30 b(Press,)h(Cam)m(bridge,)f(MA,)h +(1999.)28 1706 y([4])47 b(Message)37 b(P)m(assing)f(In)m(terface)h(F)-8 +b(orum.)56 b(MPI-2:)c(Extensions)35 b(to)i(the)e(Message-P)m(assing)k +(In)m(terface,)f(July)170 1819 y(1997.)k Fj(http://www.mpi-forum.org/)o +(doc)o(s/do)o(cs.h)o(tml)o Fo(.)28 2006 y([5])47 b(Ra)5 +b(jeev)31 b(Thakur,)f(William)i(Gropp,)e(and)g(Ewing)g(Lusk.)40 +b(An)30 b(abstract-device)j(in)m(terface)f(for)e(implemen)m(t-)170 +2119 y(ing)35 b(p)s(ortable)g(parallel-I/O)h(in)m(terfaces.)55 +b(In)34 b Fi(Pr)-5 b(o)g(c)g(e)g(e)g(dings)39 b(of)e(the)g(6th)h(Symp) +-5 b(osium)39 b(on)e(the)g(F)-7 b(r)i(ontiers)39 b(of)170 +2232 y(Massively)32 b(Par)-5 b(al)5 b(lel)34 b(Computation)p +Fo(,)f(pages)e(180{187.)j(IEEE)c(Computer)f(So)s(ciet)m(y)j(Press,)e +(Octob)s(er)g(1996.)28 2420 y([6])47 b(Ra)5 b(jeev)43 +b(Thakur,)h(William)f(Gropp,)i(and)d(Ewing)f(Lusk.)75 +b(On)41 b(implemen)m(ting)i(MPI-IO)f(p)s(ortably)g(and)170 +2533 y(with)28 b(high)h(p)s(erformance.)38 b(In)28 b +Fi(Pr)-5 b(o)g(c)g(e)g(e)g(dings)33 b(of)f(the)g(6th)g(Workshop)h(on)f +(I/O)g(in)f(Par)-5 b(al)5 b(lel)32 b(and)h(Distribute)-5 +b(d)170 2646 y(Systems)p Fo(,)31 b(pages)g(23{32.)i(A)m(CM)e(Press,)f +(Ma)m(y)i(1999.)1933 5520 y(17)p eop end +%%Trailer + +userdict /end-hook known{end-hook}if +%%EOF diff --git a/3rd-party/romio321/doc/users-guide.tex b/3rd-party/romio341/doc/users-guide.tex similarity index 96% rename from 3rd-party/romio321/doc/users-guide.tex rename to 3rd-party/romio341/doc/users-guide.tex index 3715431b7182cec12cb7c950f0ba8a68c9494ce7..0c40ca6ddf93170d1fada8118b7a757f9a55da07 100644 --- a/3rd-party/romio321/doc/users-guide.tex +++ b/3rd-party/romio341/doc/users-guide.tex @@ -134,16 +134,19 @@ and {\tt MPI\_File\_c2f} (\S~4.12.4) are also implemented. C, Fortran, and profiling interfaces are provided for all functions that have been implemented. -This version of ROMIO runs on at least the following machines: IBM SP; Intel +ROMIO has run on at least the following machines: IBM SP; Intel Paragon; HP Exemplar; SGI Origin2000; Cray T3E; NEC SX-4; other symmetric multiprocessors from HP, SGI, DEC, Sun, and IBM; and networks of -workstations (Sun, SGI, HP, IBM, DEC, Linux, and FreeBSD). -Supported file systems are IBM PIOFS, Intel PFS, HP/Convex -HFS, SGI XFS, NEC SFS, PVFS, NFS, NTFS, and any Unix file system (UFS). +workstations (Sun, SGI, HP, IBM, DEC, Linux, and FreeBSD). Supported file +systems have at one time included IBM PIOFS, Intel PFS, HP/Convex HFS, SGI XFS, +NEC SFS, PVFS, NFS, NTFS, and any Unix file system (UFS). You may have to +download an older ROMIO or MPICH release for out-of-date systems. -This version of ROMIO is included in MPICH 1.2.4; an earlier version -is included in at least the following MPI implementations: LAM, HP -MPI, SGI MPI, and NEC MPI. + +This version of ROMIO is included in MPICH; an earlier version +is included in at least the following MPI implementations: LAM, HP MPI, SGI +MPI, and NEC MPI. Many HPC vendors base their MPI-IO implementation on +ROMIO. Note that proper I/O error codes and classes are returned and the status variable is filled only when used with MPICH revision 1.2.1 or later. @@ -362,7 +365,7 @@ applicable to all file system types: aggregators. \end{itemize} -For PVFS, PIOFS, and PFS: +For PVFS2: \begin{itemize} \item \texttt{striping\_factor} -- Controls the number of I/O devices to stripe across. The default is file system dependent, but for PVFS it is @@ -375,13 +378,6 @@ first be written to. This is a number in the range of 0 ... striping\_factor - 1. \end{itemize} -\subsubsection{Hints for PFS} -\label{sec:hints_pfs} -\begin{itemize} -\item \texttt{pfs\_svr\_buf} -- Turns on PFS server buffering. Valid -values are \texttt{true} and \texttt{false}. Default is \texttt{false}. -\end{itemize} - \subsubsection{Hints for XFS} \label{sec:hints_xfs} For XFS control is provided for the direct I/O optimization: @@ -392,26 +388,7 @@ values are \texttt{true} and \texttt{false}. Default is \texttt{false}. values are \texttt{true} and \texttt{false}. Default is \texttt{false}. \end{itemize} -\subsubsection{Hints for PVFS (v1)} -\label{sec:hints_oldpvfs} - -For PVFS control is provided for the use of the listio interface. This -interface to PVFS allows for a collection of noncontiguous regions to be -requested (for reading or writing) with a single operation. This can result -in substantially higher performance when accessing noncontiguous regions. -Support for these operations in PVFS exists after version 1.5.4, but has not -been heavily tested, so use of the interface is disabled in ROMIO by default -at this time. The hints to control listio use are: -\begin{itemize} -\item \texttt{romio\_pvfs\_listio\_read} -- Controls use of listio for reads. -Valid values are \texttt{enable}, \texttt{disable}, and \texttt{automatic}. -Default is \texttt{disable}. -\item \texttt{romio\_pvfs\_listio\_write} -- Controls use of listio for writes. -Valid values are \texttt{enable}, \texttt{disable}, and \texttt{automatic}. -Default is \texttt{disable}. -\end{itemize} - -\subsubsection{Hints for PVFS (v2)} +\subsubsection{Hints for PVFS2 (a.k.a OrangeFS)} \label{sec:hints_pvfs} The PVFS v2 file system has many tuning parameters. @@ -864,17 +841,14 @@ on failure. \item This version works only on a homogeneous cluster of machines, and only the ``native'' file data representation is supported. -\item Shared file pointers are not supported on PVFS and IBM PIOFS -file systems because they don't support {\tt fcntl} file locks, +\item Shared file pointers are not supported on the PVFS2 +file system because it does not support {\tt fcntl} file locks, and ROMIO uses that feature to implement shared file pointers. \item On HP machines running HPUX and on NEC SX-4, you need to compile Fortran programs with {\tt mpifort} instead of {\tt mpif77}, because the {\tt f77} compilers on these machines don't support 8-byte integers. -\item The file-open mode {\tt MPI\_MODE\_EXCL} does not work on Intel -PFS file system, due to a bug in PFS. - \end{itemize} diff --git a/3rd-party/romio321/include/io_romio_conv.h b/3rd-party/romio341/include/io_romio_conv.h similarity index 100% rename from 3rd-party/romio321/include/io_romio_conv.h rename to 3rd-party/romio341/include/io_romio_conv.h diff --git a/3rd-party/romio321/include/mpio.h.in b/3rd-party/romio341/include/mpio.h.in similarity index 66% rename from 3rd-party/romio321/include/mpio.h.in rename to 3rd-party/romio341/include/mpio.h.in index 9ef709dc65101f58d763e9ff74df7f3838379228..b68a1865f2b9fc33241f2a83f81a4ee49cd6ed09 100644 --- a/3rd-party/romio321/include/mpio.h.in +++ b/3rd-party/romio341/include/mpio.h.in @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ /* user include file for MPI-IO programs */ @@ -22,6 +20,12 @@ #define MPIIMPL_HAVE_MPI_COMBINER_DUP 1 #define MPICH_ATTR_POINTER_WITH_TYPE_TAG(x,y) +#if defined(HAVE_VISIBILITY) +#define ROMIO_API_PUBLIC __attribute__((visibility ("default"))) +#else +#define ROMIO_API_PUBLIC +#endif + #if defined(__cplusplus) extern "C" { #endif @@ -34,7 +38,9 @@ extern "C" { typedef struct ADIOI_FileD *MPI_File; #endif +/* *INDENT-OFF* */ @DEFINE_HAVE_MPI_GREQUEST@ +/* *INDENT-ON* */ #ifndef HAVE_MPI_GREQUEST typedef struct ADIOI_RequestD *MPIO_Request; #else @@ -51,7 +57,9 @@ typedef struct ADIOI_RequestD *MPIO_Request; @DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS@ #ifndef HAVE_MPI_OFFSET +/* *INDENT-OFF* */ @DEFINE_MPI_OFFSET@ +/* *INDENT-ON* */ /* If we needed to define MPI_Offset, then we also need to make this definition. */ #ifndef HAVE_MPI_DATAREP_FUNCTIONS @@ -64,14 +72,18 @@ typedef int (MPI_Datarep_extent_function)(MPI_Datatype datatype, MPI_Aint *, #endif #ifndef NEEDS_MPI_FINT +/* *INDENT-OFF* */ @NEEDS_MPI_FINT@ +/* *INDENT-ON* */ #endif #ifdef NEEDS_MPI_FINT typedef int MPI_Fint; #endif #ifndef HAVE_MPI_INFO +/* *INDENT-OFF* */ @HAVE_MPI_INFO@ +/* *INDENT-ON* */ #endif #ifndef HAVE_MPI_INFO typedef struct MPIR_Info *MPI_Info; @@ -111,7 +123,9 @@ typedef int MPI_Fint; #endif #ifndef HAVE_MPI_DARRAY_SUBARRAY +/* *INDENT-OFF* */ @HAVE_MPI_DARRAY_SUBARRAY@ +/* *INDENT-ON* */ #endif #ifndef HAVE_MPI_DARRAY_SUBARRAY # define MPI_ORDER_C 56 @@ -132,150 +146,150 @@ typedef int MPI_Fint; /* Section 9.2 */ /* Begin Prototypes */ -int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh); -int MPI_File_close(MPI_File *fh); -int MPI_File_delete(const char *filename, MPI_Info info); -int MPI_File_set_size(MPI_File fh, MPI_Offset size); -int MPI_File_preallocate(MPI_File fh, MPI_Offset size); -int MPI_File_get_size(MPI_File fh, MPI_Offset *size); -int MPI_File_get_group(MPI_File fh, MPI_Group *group); -int MPI_File_get_amode(MPI_File fh, int *amode); -int MPI_File_set_info(MPI_File fh, MPI_Info info); -int MPI_File_get_info(MPI_File fh, MPI_Info *info_used); +int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh) ROMIO_API_PUBLIC; +int MPI_File_close(MPI_File *fh) ROMIO_API_PUBLIC; +int MPI_File_delete(const char *filename, MPI_Info info) ROMIO_API_PUBLIC; +int MPI_File_set_size(MPI_File fh, MPI_Offset size) ROMIO_API_PUBLIC; +int MPI_File_preallocate(MPI_File fh, MPI_Offset size) ROMIO_API_PUBLIC; +int MPI_File_get_size(MPI_File fh, MPI_Offset *size) ROMIO_API_PUBLIC; +int MPI_File_get_group(MPI_File fh, MPI_Group *group) ROMIO_API_PUBLIC; +int MPI_File_get_amode(MPI_File fh, int *amode) ROMIO_API_PUBLIC; +int MPI_File_set_info(MPI_File fh, MPI_Info info) ROMIO_API_PUBLIC; +int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) ROMIO_API_PUBLIC; /* Section 9.3 */ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, - const char *datarep, MPI_Info info); + const char *datarep, MPI_Info info) ROMIO_API_PUBLIC; int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, - char *datarep); + char *datarep) ROMIO_API_PUBLIC; /* Section 9.4.2 */ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void * buf, int count, MPI_Datatype datatype, MPI_Status *status) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_write_at(MPI_File fh, MPI_Offset offset, const void * buf, int count, MPI_Datatype datatype, MPI_Status *status) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; /* nonblocking calls currently use MPIO_Request, because generalized requests not yet implemented. For the same reason, MPIO_Test and MPIO_Wait are used to test and wait on nonblocking I/O requests */ int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, const void *buf, int count, MPI_Datatype datatype, MPIO_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; /* Section 9.4.3 */ int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_read_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_write(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_write_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; /* nonblocking calls currently use MPIO_Request, because generalized requests not yet implemented. For the same reason, MPIO_Test and MPIO_Wait are used to test and wait on nonblocking I/O requests */ int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPIO_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_iwrite(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence); -int MPI_File_get_position(MPI_File fh, MPI_Offset *offset); -int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp); +int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) ROMIO_API_PUBLIC; +int MPI_File_get_position(MPI_File fh, MPI_Offset *offset) ROMIO_API_PUBLIC; +int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) ROMIO_API_PUBLIC; /* Section 9.4.4 */ int MPI_File_read_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_write_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_iread_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_iwrite_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPIO_Request *request) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_read_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_write_ordered(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence); -int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset); + MPI_Status *status) MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) ROMIO_API_PUBLIC; +int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset) ROMIO_API_PUBLIC; /* Section 9.4.5 */ int MPI_File_read_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf, int count, - MPI_Datatype datatype) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); -int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status *status); + MPI_Datatype datatype) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; +int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status *status) ROMIO_API_PUBLIC; int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset, const void *buf, int count, - MPI_Datatype datatype) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); -int MPI_File_write_at_all_end(MPI_File fh, const void *buf, MPI_Status *status); + MPI_Datatype datatype) MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; +int MPI_File_write_at_all_end(MPI_File fh, const void *buf, MPI_Status *status) ROMIO_API_PUBLIC; int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) ROMIO_API_PUBLIC; int MPI_File_write_all_begin(MPI_File fh, const void *buf, int count, MPI_Datatype datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int MPI_File_write_all_end(MPI_File fh, const void *buf, MPI_Status *status); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int MPI_File_write_all_end(MPI_File fh, const void *buf, MPI_Status *status) ROMIO_API_PUBLIC; int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status) ROMIO_API_PUBLIC; int MPI_File_write_ordered_begin(MPI_File fh, const void *buf, int count, MPI_Datatype datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int MPI_File_write_ordered_end(MPI_File fh, const void *buf, MPI_Status *status); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int MPI_File_write_ordered_end(MPI_File fh, const void *buf, MPI_Status *status) ROMIO_API_PUBLIC; /* Section 9.5.1 */ -int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent); +int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent) ROMIO_API_PUBLIC; /* Section 9.5.3 */ int MPI_Register_datarep(const char *datarep, MPI_Datarep_conversion_function *read_conversion_fn, MPI_Datarep_conversion_function *write_conversion_fn, - MPI_Datarep_extent_function *dtype_file_extent_fn, void *extra_state); + MPI_Datarep_extent_function *dtype_file_extent_fn, void *extra_state) ROMIO_API_PUBLIC; /* Section 9.6.1 */ -int MPI_File_set_atomicity(MPI_File fh, int flag); -int MPI_File_get_atomicity(MPI_File fh, int *flag); -int MPI_File_sync(MPI_File fh); +int MPI_File_set_atomicity(MPI_File fh, int flag) ROMIO_API_PUBLIC; +int MPI_File_get_atomicity(MPI_File fh, int *flag) ROMIO_API_PUBLIC; +int MPI_File_sync(MPI_File fh) ROMIO_API_PUBLIC; /* Section 4.13.3 */ #ifndef MPICH /* MPICH provides these definitions */ -int MPI_File_set_errhandler(MPI_File file, MPI_Errhandler errhandler); -int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler); +int MPI_File_set_errhandler(MPI_File file, MPI_Errhandler errhandler) ROMIO_API_PUBLIC; +int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler) ROMIO_API_PUBLIC; #endif /* For MPI 3.1 */ int MPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int MPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int MPI_File_iwrite_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; /* End Prototypes */ #ifndef HAVE_MPI_DARRAY_SUBARRAY /* Section 4.14.4 */ int MPI_Type_create_subarray(int ndims, const int array_of_sizes[], const int array_of_subsizes[], const int array_of_starts[], int order, MPI_Datatype oldtype, - MPI_Datatype *newtype); + MPI_Datatype *newtype) ROMIO_API_PUBLIC; /* Section 4.14.5 */ int MPI_Type_create_darray(int size, int rank, int ndims, const int array_of_gsizes[], const int array_of_distribs[], const int array_of_dargs[], const int array_of_psizes, int order, MPI_Datatype oldtype, - MPI_Datatype *newtype); + MPI_Datatype *newtype) ROMIO_API_PUBLIC; #endif /* The globus2 device has to rename MPI_ symbols in order to use the vendor @@ -294,43 +308,44 @@ int MPI_Type_create_darray(int size, int rank, int ndims, const int array_of_gsi /* Open MPI: I can't seem to make these #define properly. Oh well -- we don't need them anyway :-( */ #if 0 -MPI_File MPI_File_f2c(MPI_Fint file); -MPI_Fint MPI_File_c2f(MPI_File file); +MPI_File MPI_File_f2c(MPI_Fint file) ROMIO_API_PUBLIC; +MPI_Fint MPI_File_c2f(MPI_File file) ROMIO_API_PUBLIC; #endif + #ifndef HAVE_MPI_GREQUEST /* The following functions are required if generalized requests are not available, because in that case, an MPIO_Request object is currently used for nonblocking I/O. */ -int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status); -int MPIO_Wait(MPIO_Request *request, MPI_Status *status); +int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) ROMIO_API_PUBLIC; +int MPIO_Wait(MPIO_Request *request, MPI_Status *status) ROMIO_API_PUBLIC; int MPIO_Testall(int count, MPIO_Request array_of_requests[], int *flag, - MPI_Status array_of_statuses[]); -int MPIO_Waitall(int count, MPIO_Request array_of_requests[], MPI_Status array_of_statuses[]); + MPI_Status array_of_statuses[]) ROMIO_API_PUBLIC; +int MPIO_Waitall(int count, MPIO_Request array_of_requests[], MPI_Status array_of_statuses[]) ROMIO_API_PUBLIC; int MPIO_Testany(int count, MPIO_Request array_of_requests[], int *indx, int *flag, - MPI_Status *status); -int MPIO_Waitany(int count, MPIO_Request array_of_requests[], int *indx, MPI_Status *status); + MPI_Status *status) ROMIO_API_PUBLIC; +int MPIO_Waitany(int count, MPIO_Request array_of_requests[], int *indx, MPI_Status *status) ROMIO_API_PUBLIC; int MPIO_Waitsome(int incount, MPIO_Request array_of_requests[], int *outcount, - int array_of_indices[], MPI_Status array_of_statuses[]); + int array_of_indices[], MPI_Status array_of_statuses[]) ROMIO_API_PUBLIC; int MPIO_Testsome(int incount, MPIO_Request array_of_requests[], int *outcount, - int array_of_indices[], MPI_Status array_of_statuses[]); + int array_of_indices[], MPI_Status array_of_statuses[]) ROMIO_API_PUBLIC; -MPI_Fint MPIO_Request_c2f(MPIO_Request request); -MPIO_Request MPIO_Request_f2c(MPI_Fint request); +MPI_Fint MPIO_Request_c2f(MPIO_Request request) ROMIO_API_PUBLIC; +MPIO_Request MPIO_Request_f2c(MPI_Fint request) ROMIO_API_PUBLIC; #endif /* HAVE_MPI_GREQUEST */ /* info functions if not defined in the MPI implementation */ #ifndef HAVE_MPI_INFO -int MPI_Info_create(MPI_Info *info); -int MPI_Info_set(MPI_Info info, const char *key, const char *value); -int MPI_Info_delete(MPI_Info info, const char *key); -int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag); -int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag); -int MPI_Info_get_nkeys(MPI_Info info, int *nkeys); -int MPI_Info_get_nthkey(MPI_Info info, int n, char *key); -int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo); -int MPI_Info_free(MPI_Info *info); +int MPI_Info_create(MPI_Info *info) ROMIO_API_PUBLIC; +int MPI_Info_set(MPI_Info info, const char *key, const char *value) ROMIO_API_PUBLIC; +int MPI_Info_delete(MPI_Info info, const char *key) ROMIO_API_PUBLIC; +int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag) ROMIO_API_PUBLIC; +int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag) ROMIO_API_PUBLIC; +int MPI_Info_get_nkeys(MPI_Info info, int *nkeys) ROMIO_API_PUBLIC; +int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) ROMIO_API_PUBLIC; +int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) ROMIO_API_PUBLIC; +int MPI_Info_free(MPI_Info *info) ROMIO_API_PUBLIC; /* The globus2 device has to rename MPI_ symbols in order to use the vendor MPI as one of its transport mechanisms. Therefore, the following undefines @@ -346,51 +361,49 @@ int MPI_Info_free(MPI_Info *info); /* above needed for some versions of mpi.h in MPICH!! */ /* Open MPI: we don't need these in ROMIO */ #if 0 -MPI_Fint MPI_Info_c2f(MPI_Info info); -MPI_Info MPI_Info_f2c(MPI_Fint info); +MPI_Fint MPI_Info_c2f(MPI_Info info) ROMIO_API_PUBLIC; +MPI_Info MPI_Info_f2c(MPI_Fint info) ROMIO_API_PUBLIC; #endif #endif #endif /* HAVE_PRAGMA_HP_SEC_DEF */ -/**************** BINDINGS FOR THE PROFILING INTERFACE ***************/ - /* Open MPI: We don't want any of the profiling layer */ #if 0 - +/**************** BINDINGS FOR THE PROFILING INTERFACE ***************/ /* Section 9.2 */ -int PMPI_File_open(MPI_Comm, const char *, int, MPI_Info, MPI_File *); -int PMPI_File_close(MPI_File *); -int PMPI_File_delete(const char *, MPI_Info); -int PMPI_File_set_size(MPI_File, MPI_Offset); -int PMPI_File_preallocate(MPI_File, MPI_Offset); -int PMPI_File_get_size(MPI_File, MPI_Offset *); -int PMPI_File_get_group(MPI_File, MPI_Group *); -int PMPI_File_get_amode(MPI_File, int *); -int PMPI_File_set_info(MPI_File, MPI_Info); -int PMPI_File_get_info(MPI_File, MPI_Info *); +int PMPI_File_open(MPI_Comm, const char *, int, MPI_Info, MPI_File *) ROMIO_API_PUBLIC; +int PMPI_File_close(MPI_File *) ROMIO_API_PUBLIC; +int PMPI_File_delete(const char *, MPI_Info) ROMIO_API_PUBLIC; +int PMPI_File_set_size(MPI_File, MPI_Offset) ROMIO_API_PUBLIC; +int PMPI_File_preallocate(MPI_File, MPI_Offset) ROMIO_API_PUBLIC; +int PMPI_File_get_size(MPI_File, MPI_Offset *) ROMIO_API_PUBLIC; +int PMPI_File_get_group(MPI_File, MPI_Group *) ROMIO_API_PUBLIC; +int PMPI_File_get_amode(MPI_File, int *) ROMIO_API_PUBLIC; +int PMPI_File_set_info(MPI_File, MPI_Info) ROMIO_API_PUBLIC; +int PMPI_File_get_info(MPI_File, MPI_Info *) ROMIO_API_PUBLIC; /* Section 9.3 */ int PMPI_File_set_view(MPI_File, MPI_Offset, - MPI_Datatype, MPI_Datatype, const char *, MPI_Info); + MPI_Datatype, MPI_Datatype, const char *, MPI_Info) ROMIO_API_PUBLIC; int PMPI_File_get_view(MPI_File, MPI_Offset *, - MPI_Datatype *, MPI_Datatype *, char *); + MPI_Datatype *, MPI_Datatype *, char *) ROMIO_API_PUBLIC; /* Section 9.4.2 */ int PMPI_File_read_at(MPI_File, MPI_Offset, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_read_at_all(MPI_File, MPI_Offset, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_write_at(MPI_File, MPI_Offset, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_write_at_all(MPI_File, MPI_Offset, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; /* nonblocking calls currently use MPIO_Request, because generalized requests not yet implemented. For the same reason, MPIO_Test and @@ -398,155 +411,155 @@ int PMPI_File_write_at_all(MPI_File, MPI_Offset, const void *, int PMPI_File_iread_at(MPI_File, MPI_Offset, void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_iwrite_at(MPI_File, MPI_Offset, const void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; /* Section 9.4.3 */ int PMPI_File_read(MPI_File, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_read_all(MPI_File, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_write(MPI_File, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_write_all(MPI_File, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; /* nonblocking calls currently use MPIO_Request, because generalized requests not yet implemented. For the same reason, MPIO_Test and MPIO_Wait are used to test and wait on nonblocking I/O requests */ int PMPI_File_iread(MPI_File, void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_iwrite(MPI_File, const void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; -int PMPI_File_seek(MPI_File, MPI_Offset, int); -int PMPI_File_get_position(MPI_File, MPI_Offset *); -int PMPI_File_get_byte_offset(MPI_File, MPI_Offset, MPI_Offset *); +int PMPI_File_seek(MPI_File, MPI_Offset, int) ROMIO_API_PUBLIC; +int PMPI_File_get_position(MPI_File, MPI_Offset *) ROMIO_API_PUBLIC; +int PMPI_File_get_byte_offset(MPI_File, MPI_Offset, MPI_Offset *) ROMIO_API_PUBLIC; /* Section 9.4.4 */ int PMPI_File_read_shared(MPI_File, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_write_shared(MPI_File, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_iread_shared(MPI_File, void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_iwrite_shared(MPI_File, const void *, int, MPI_Datatype, MPIO_Request *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_read_ordered(MPI_File, void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_write_ordered(MPI_File, const void *, int, MPI_Datatype, MPI_Status *) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int PMPI_File_seek_shared(MPI_File, MPI_Offset, int); -int PMPI_File_get_position_shared(MPI_File, MPI_Offset *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int PMPI_File_seek_shared(MPI_File, MPI_Offset, int) ROMIO_API_PUBLIC; +int PMPI_File_get_position_shared(MPI_File, MPI_Offset *) ROMIO_API_PUBLIC; /* Section 9.4.5 */ int PMPI_File_read_at_all_begin(MPI_File, MPI_Offset, void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); -int PMPI_File_read_at_all_end(MPI_File, void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; +int PMPI_File_read_at_all_end(MPI_File, void *, MPI_Status *) ROMIO_API_PUBLIC; int PMPI_File_write_at_all_begin(MPI_File, MPI_Offset, const void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); -int PMPI_File_write_at_all_end(MPI_File, const void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; +int PMPI_File_write_at_all_end(MPI_File, const void *, MPI_Status *) ROMIO_API_PUBLIC; int PMPI_File_read_all_begin(MPI_File, void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int PMPI_File_read_all_end(MPI_File, void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int PMPI_File_read_all_end(MPI_File, void *, MPI_Status *) ROMIO_API_PUBLIC; int PMPI_File_write_all_begin(MPI_File, const void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int PMPI_File_write_all_end(MPI_File, const void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int PMPI_File_write_all_end(MPI_File, const void *, MPI_Status *) ROMIO_API_PUBLIC; int PMPI_File_read_ordered_begin(MPI_File, void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int PMPI_File_read_ordered_end(MPI_File, void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int PMPI_File_read_ordered_end(MPI_File, void *, MPI_Status *) ROMIO_API_PUBLIC; int PMPI_File_write_ordered_begin(MPI_File, const void *, int, MPI_Datatype) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); -int PMPI_File_write_ordered_end(MPI_File, const void *, MPI_Status *); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; +int PMPI_File_write_ordered_end(MPI_File, const void *, MPI_Status *) ROMIO_API_PUBLIC; /* Section 9.5.1 */ -int PMPI_File_get_type_extent(MPI_File, MPI_Datatype, MPI_Aint *); +int PMPI_File_get_type_extent(MPI_File, MPI_Datatype, MPI_Aint *) ROMIO_API_PUBLIC; /* Section 9.5.3 */ int PMPI_Register_datarep(const char *, MPI_Datarep_conversion_function *, MPI_Datarep_conversion_function *, MPI_Datarep_extent_function *, - void *); + void *) ROMIO_API_PUBLIC; /* Section 9.6.1 */ -int PMPI_File_set_atomicity(MPI_File, int); -int PMPI_File_get_atomicity(MPI_File, int *); -int PMPI_File_sync(MPI_File); +int PMPI_File_set_atomicity(MPI_File, int) ROMIO_API_PUBLIC; +int PMPI_File_get_atomicity(MPI_File, int *) ROMIO_API_PUBLIC; +int PMPI_File_sync(MPI_File) ROMIO_API_PUBLIC; /* Section 4.13.3 */ #ifndef MPICH /* MPICH provides these definitions */ -int PMPI_File_set_errhandler( MPI_File, MPI_Errhandler ); -int PMPI_File_get_errhandler( MPI_File, MPI_Errhandler * ); +int PMPI_File_set_errhandler( MPI_File, MPI_Errhandler ) ROMIO_API_PUBLIC; +int PMPI_File_get_errhandler( MPI_File, MPI_Errhandler * ) ROMIO_API_PUBLIC; #endif /* For MPI 3.1 */ int PMPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(3,5) ROMIO_API_PUBLIC; int PMPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; int PMPI_File_iwrite_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request) - MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4); + MPICH_ATTR_POINTER_WITH_TYPE_TAG(2,4) ROMIO_API_PUBLIC; #ifndef HAVE_MPI_DARRAY_SUBARRAY /* Section 4.14.4 */ int PMPI_Type_create_subarray(int, int *, int *, int *, int, - MPI_Datatype, MPI_Datatype *); + MPI_Datatype, MPI_Datatype *) ROMIO_API_PUBLIC; /* Section 4.14.5 */ int PMPI_Type_create_darray(int, int, int, int *, int *, - int *, int *, int, MPI_Datatype, MPI_Datatype *); + int *, int *, int, MPI_Datatype, MPI_Datatype *) ROMIO_API_PUBLIC; #endif /* Section 4.12.4 */ -MPI_File PMPI_File_f2c(MPI_Fint); -MPI_Fint PMPI_File_c2f(MPI_File); +MPI_File PMPI_File_f2c(MPI_Fint) ROMIO_API_PUBLIC; +MPI_Fint PMPI_File_c2f(MPI_File) ROMIO_API_PUBLIC; #ifndef HAVE_MPI_GREQUEST /* The following functions are required if generalized requests are not available, because in that case, an MPIO_Request object is currently used for nonblocking I/O. */ -int PMPIO_Test(MPIO_Request *, int *, MPI_Status *); -int PMPIO_Wait(MPIO_Request *, MPI_Status *); -int PMPIO_Testall(int, MPIO_Request *, int *, MPI_Status *); -int PMPIO_Waitall(int, MPIO_Request *, MPI_Status *); -int PMPIO_Testany(int, MPIO_Request *, int *, int *, MPI_Status *); -int PMPIO_Waitany(int, MPIO_Request *, int *, MPI_Status *); -int PMPIO_Waitsome(int, MPIO_Request *, int *, int *, MPI_Status *); -int PMPIO_Testsome(int, MPIO_Request *, int *, int *, MPI_Status *); -MPI_Fint PMPIO_Request_c2f(MPIO_Request); -MPIO_Request PMPIO_Request_f2c(MPI_Fint); +int PMPIO_Test(MPIO_Request *, int *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Wait(MPIO_Request *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Testall(int, MPIO_Request *, int *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Waitall(int, MPIO_Request *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Testany(int, MPIO_Request *, int *, int *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Waitany(int, MPIO_Request *, int *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Waitsome(int, MPIO_Request *, int *, int *, MPI_Status *) ROMIO_API_PUBLIC; +int PMPIO_Testsome(int, MPIO_Request *, int *, int *, MPI_Status *) ROMIO_API_PUBLIC; +MPI_Fint PMPIO_Request_c2f(MPIO_Request) ROMIO_API_PUBLIC; +MPIO_Request PMPIO_Request_f2c(MPI_Fint) ROMIO_API_PUBLIC; #endif /* HAVE_MPI_GREQUEST */ /* info functions if not defined in the MPI implementation */ #ifndef HAVE_MPI_INFO -int PMPI_Info_create(MPI_Info *); -int PMPI_Info_set(MPI_Info, char *, char *); -int PMPI_Info_delete(MPI_Info, char *); -int PMPI_Info_get(MPI_Info, char *, int, char *, int *); -int PMPI_Info_get_valuelen(MPI_Info, char *, int *, int *); -int PMPI_Info_get_nkeys(MPI_Info, int *); -int PMPI_Info_get_nthkey(MPI_Info, int, char *); -int PMPI_Info_dup(MPI_Info, MPI_Info *); -int PMPI_Info_free(MPI_Info *); - -MPI_Fint PMPI_Info_c2f(MPI_Info); -MPI_Info PMPI_Info_f2c(MPI_Fint); +int PMPI_Info_create(MPI_Info *) ROMIO_API_PUBLIC; +int PMPI_Info_set(MPI_Info, char *, char *) ROMIO_API_PUBLIC; +int PMPI_Info_delete(MPI_Info, char *) ROMIO_API_PUBLIC; +int PMPI_Info_get(MPI_Info, char *, int, char *, int *) ROMIO_API_PUBLIC; +int PMPI_Info_get_valuelen(MPI_Info, char *, int *, int *) ROMIO_API_PUBLIC; +int PMPI_Info_get_nkeys(MPI_Info, int *) ROMIO_API_PUBLIC; +int PMPI_Info_get_nthkey(MPI_Info, int, char *) ROMIO_API_PUBLIC; +int PMPI_Info_dup(MPI_Info, MPI_Info *) ROMIO_API_PUBLIC; +int PMPI_Info_free(MPI_Info *) ROMIO_API_PUBLIC; + +MPI_Fint PMPI_Info_c2f(MPI_Info) ROMIO_API_PUBLIC; +MPI_Info PMPI_Info_f2c(MPI_Fint) ROMIO_API_PUBLIC; #endif #endif /* Open MPI: We don't want any of the profiling layer */ diff --git a/3rd-party/romio321/include/mpiof.h.in b/3rd-party/romio341/include/mpiof.h.in similarity index 91% rename from 3rd-party/romio321/include/mpiof.h.in rename to 3rd-party/romio341/include/mpiof.h.in index fa945807bdc24fdfaec3882d8d1c9a5d11783d0a..6b84d9d98f31b651dfc2ed5596bd335b6f2652a2 100644 --- a/3rd-party/romio321/include/mpiof.h.in +++ b/3rd-party/romio341/include/mpiof.h.in @@ -1,8 +1,8 @@ -! -! Copyright (C) 1997 University of Chicago. -! See COPYRIGHT notice in top-level directory. ! -! +! Copyright (C) by Argonne National Laboratory +! See COPYRIGHT in top-level directory +! + ! user include file for Fortran MPI-IO programs ! INTEGER MPI_MODE_RDONLY, MPI_MODE_RDWR, MPI_MODE_WRONLY diff --git a/3rd-party/romio321/localdefs.in b/3rd-party/romio341/localdefs.in similarity index 65% rename from 3rd-party/romio321/localdefs.in rename to 3rd-party/romio341/localdefs.in index 94fd9508daeda3d76bc8ea952549694767c72f8b..0a03bedfede598e14576006e35724f1f787fba8f 100644 --- a/3rd-party/romio321/localdefs.in +++ b/3rd-party/romio341/localdefs.in @@ -1,4 +1,8 @@ #! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## # Append ROMIO library dependencies to the global list WRAPPER_LIBS="$WRAPPER_LIBS @LIBS@" diff --git a/3rd-party/romio321/mpi-io/Makefile.mk b/3rd-party/romio341/mpi-io/Makefile.mk similarity index 94% rename from 3rd-party/romio321/mpi-io/Makefile.mk rename to 3rd-party/romio341/mpi-io/Makefile.mk index 264976e06c14b7ee2b503153f4556f3229d80ba6..43f32bc7d9cfdd59fb40087297d8eb6c0340f768 100644 --- a/3rd-party/romio321/mpi-io/Makefile.mk +++ b/3rd-party/romio341/mpi-io/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## include $(top_srcdir)/mpi-io/glue/Makefile.mk @@ -75,7 +73,8 @@ romio_other_sources += \ mpi-io/mpich_fileutil.c \ mpi-io/mpir-mpioinit.c \ mpi-io/mpiu_greq.c \ - mpi-io/mpiu_external32.c + mpi-io/mpiu_external32.c \ + mpi-io/mpir_cst_filesys.c # helper variables for conditionally compiled sources mpio_request_sources= \ @@ -103,4 +102,3 @@ endif BUILD_MPIO_REQUEST if BUILD_MPIO_ERRHAN romio_other_sources += $(mpio_request_sources) endif BUILD_MPIO_ERRHAN - diff --git a/3rd-party/romio321/mpi-io/close.c b/3rd-party/romio341/mpi-io/close.c similarity index 58% rename from 3rd-party/romio321/mpi-io/close.c rename to 3rd-party/romio341/mpi-io/close.c index 12d5c4791f575c9efd5aba8041f00d0059397089..343490fd62ad010999a8396f7a3a90f1207a8f7e 100644 --- a/3rd-party/romio321/mpi-io/close.c +++ b/3rd-party/romio341/mpi-io/close.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,7 @@ #pragma _CRI duplicate MPI_File_close as PMPI_File_close /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_close(MPI_File *fh) __attribute__((weak,alias("PMPI_File_close"))); +int MPI_File_close(MPI_File * fh) __attribute__ ((weak, alias("PMPI_File_close"))); #endif /* Include mapping from MPI->PMPI */ @@ -33,7 +31,7 @@ Input Parameters: .N fortran @*/ -int MPI_File_close(MPI_File *fh) +int MPI_File_close(MPI_File * fh) { int error_code; ADIO_File adio_fh; @@ -52,23 +50,23 @@ int MPI_File_close(MPI_File *fh) MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); /* --END ERROR HANDLING-- */ - if (ADIO_Feature(adio_fh, ADIO_SHARED_FP)) - { - ADIOI_Free((adio_fh)->shared_fp_fname); - /* POSIX semantics say a deleted file remains available until all - * processes close the file. But since when was NFS posix-compliant? - */ - /* this used to be gated by the lack of the UNLINK_AFTER_CLOSE feature, - * but a race condition in GPFS necessated this. See ticket #2214 */ - MPI_Barrier((adio_fh)->comm); - if ((adio_fh)->shared_fp_fd != ADIO_FILE_NULL) { - MPI_File *fh_shared = &(adio_fh->shared_fp_fd); - ADIO_Close((adio_fh)->shared_fp_fd, &error_code); + if (ADIO_Feature(adio_fh, ADIO_SHARED_FP)) { + ADIOI_Free((adio_fh)->shared_fp_fname); + /* POSIX semantics say a deleted file remains available until all + * processes close the file. But since when was NFS posix-compliant? + */ + /* this used to be gated by the lack of the UNLINK_AFTER_CLOSE feature, + * but a race condition in GPFS necessated this. See ticket #2214 */ + MPI_Barrier((adio_fh)->comm); + if ((adio_fh)->shared_fp_fd != ADIO_FILE_NULL) { + MPI_File *fh_shared = &(adio_fh->shared_fp_fd); + ADIO_Close((adio_fh)->shared_fp_fd, &error_code); MPIO_File_free(fh_shared); - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) goto fn_fail; - /* --END ERROR HANDLING-- */ - } + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + goto fn_fail; + /* --END ERROR HANDLING-- */ + } } /* Because ROMIO expects the MPI library to provide error handler management @@ -76,28 +74,31 @@ int MPI_File_close(MPI_File *fh) * somehow inform the MPI library that we no longer hold a reference to any * user defined error handler. We do this by setting the errhandler at this * point to MPI_ERRORS_RETURN. */ -/* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c - in routine mca_io_romio_file_close() -*/ + + /* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c + * in routine mca_io_romio_file_close() + */ #if 0 error_code = PMPI_File_set_errhandler(*fh, MPI_ERRORS_RETURN); - if (error_code != MPI_SUCCESS) goto fn_fail; + if (error_code != MPI_SUCCESS) + goto fn_fail; #endif ADIO_Close(adio_fh, &error_code); MPIO_File_free(fh); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) goto fn_fail; + if (error_code != MPI_SUCCESS) + goto fn_fail; /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_WEND(fl_xmpi); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; -fn_fail: + fn_fail: /* --BEGIN ERROR HANDLING-- */ error_code = MPIO_Err_return_file(adio_fh, error_code); goto fn_exit; diff --git a/3rd-party/romio321/mpi-io/delete.c b/3rd-party/romio341/mpi-io/delete.c similarity index 62% rename from 3rd-party/romio321/mpi-io/delete.c rename to 3rd-party/romio341/mpi-io/delete.c index 47b52a054c4015e8e707f2b00191d40a3f83ece5..61208ef59644d3efd23286cd21452a5cbb0dde38 100644 --- a/3rd-party/romio321/mpi-io/delete.c +++ b/3rd-party/romio341/mpi-io/delete.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_delete as PMPI_File_delete /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_delete(const char *filename, MPI_Info info) __attribute__((weak,alias("PMPI_File_delete"))); +int MPI_File_delete(const char *filename, MPI_Info info) + __attribute__ ((weak, alias("PMPI_File_delete"))); #endif /* Include mapping from MPI->PMPI */ @@ -41,32 +40,30 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info) ADIOI_Fns *fsops; #ifdef MPI_hpux int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEDELETE, TRDTBLOCK, - MPI_FILE_NULL, MPI_DATATYPE_NULL, -1); + + HPMP_IO_START(fl_xmpi, BLKMPIFILEDELETE, TRDTBLOCK, MPI_FILE_NULL, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ - MPIU_UNREFERENCED_ARG(info); + MPL_UNREFERENCED_ARG(info); ROMIO_THREAD_CS_ENTER(); MPIR_MPIOInit(&error_code); - if (error_code != MPI_SUCCESS) goto fn_exit; + if (error_code != MPI_SUCCESS) + goto fn_exit; /* resolve file system type from file name; this is a collective call */ - ADIO_ResolveFileType(MPI_COMM_SELF, filename, &file_system, &fsops, - &error_code); + ADIO_ResolveFileType(MPI_COMM_SELF, filename, &file_system, &fsops, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - /* ADIO_ResolveFileType() will print as informative a message as it - * possibly can or call MPIR_Err_setmsg. We just need to propagate - * the error up. In the PRINT_ERR_MSG case MPI_Abort has already - * been called as well, so we probably didn't even make it this far. - */ - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + if (error_code != MPI_SUCCESS) { + /* ADIO_ResolveFileType() will print as informative a message as it + * possibly can or call MPIR_Err_setmsg. We just need to propagate + * the error up. In the PRINT_ERR_MSG case MPI_Abort has already + * been called as well, so we probably didn't even make it this far. + */ + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -76,20 +73,20 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info) */ tmp = strchr(filename, ':'); if (tmp > filename + 1) - filename = tmp + 1; + filename = tmp + 1; /* call the fs-specific delete function */ - (fsops->ADIOI_xxx_Delete)(filename, &error_code); + (fsops->ADIOI_xxx_Delete) (filename, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); /* --END ERROR HANDLING-- */ - + #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, MPI_FILE_NULL, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/file_c2f.c b/3rd-party/romio341/mpi-io/file_c2f.c similarity index 74% rename from 3rd-party/romio321/mpi-io/file_c2f.c rename to 3rd-party/romio341/mpi-io/file_c2f.c index 4eaae9fafa0492879f5538b326d1e2181fa8a44d..116708730fa67ed1e9892dad29343850dd1b36ad 100644 --- a/3rd-party/romio321/mpi-io/file_c2f.c +++ b/3rd-party/romio341/mpi-io/file_c2f.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,7 @@ #pragma _CRI duplicate MPI_File_c2f as PMPI_File_c2f /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -MPI_Fint MPI_File_c2f(MPI_File fh) __attribute__((weak,alias("PMPI_File_c2f"))); +MPI_Fint MPI_File_c2f(MPI_File fh) __attribute__ ((weak, alias("PMPI_File_c2f"))); #endif /* Include mapping from MPI->PMPI */ diff --git a/3rd-party/romio321/mpi-io/file_f2c.c b/3rd-party/romio341/mpi-io/file_f2c.c similarity index 74% rename from 3rd-party/romio321/mpi-io/file_f2c.c rename to 3rd-party/romio341/mpi-io/file_f2c.c index b6b4896b389d5dbc71057411eb38b6d8db5a2c68..64dc4c9a46cc995014ea596232b0b3193070c0f6 100644 --- a/3rd-party/romio321/mpi-io/file_f2c.c +++ b/3rd-party/romio341/mpi-io/file_f2c.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,7 @@ #pragma _CRI duplicate MPI_File_f2c as PMPI_File_f2c /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -MPI_File MPI_File_f2c(MPI_Fint fh) __attribute__((weak,alias("PMPI_File_f2c"))); +MPI_File MPI_File_f2c(MPI_Fint fh) __attribute__ ((weak, alias("PMPI_File_f2c"))); #endif /* Include mapping from MPI->PMPI */ diff --git a/3rd-party/romio321/mpi-io/fortran/Makefile.mk b/3rd-party/romio341/mpi-io/fortran/Makefile.mk similarity index 93% rename from 3rd-party/romio321/mpi-io/fortran/Makefile.mk rename to 3rd-party/romio341/mpi-io/fortran/Makefile.mk index f7ed72b69b4a96fa84fc2524cec4141129e476b0..baa79662954aa29b0ac82ccfe6047ab011aa7e48 100644 --- a/3rd-party/romio321/mpi-io/fortran/Makefile.mk +++ b/3rd-party/romio341/mpi-io/fortran/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if BUILD_F77_BINDINGS @@ -65,4 +63,3 @@ romio_mpi_sources += \ mpi-io/fortran/writef.c endif BUILD_F77_BINDINGS - diff --git a/3rd-party/romio321/mpi-io/fortran/closef.c b/3rd-party/romio341/mpi-io/fortran/closef.c similarity index 79% rename from 3rd-party/romio321/mpi-io/fortran/closef.c rename to 3rd-party/romio341/mpi-io/fortran/closef.c index aebdf56a611e8ed32b20d9810d9ea98d5c97e809..c3fdb8a3ac8e0b9299438899914372cf636eda7e 100644 --- a/3rd-party/romio321/mpi-io/fortran/closef.c +++ b/3rd-party/romio341/mpi-io/fortran/closef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_CLOSE( MPI_File*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_CLOSE(MPI_File *, MPI_Fint *); #pragma weak MPI_FILE_CLOSE = PMPI_FILE_CLOSE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_close__( MPI_File*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_close__(MPI_File *, MPI_Fint *); #pragma weak mpi_file_close__ = pmpi_file_close__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_close( MPI_File*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_close(MPI_File *, MPI_Fint *); #pragma weak mpi_file_close = pmpi_file_close #else -extern FORTRAN_API void FORT_CALL mpi_file_close_( MPI_File*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_close_(MPI_File *, MPI_Fint *); #pragma weak mpi_file_close_ = pmpi_file_close_ #endif @@ -90,9 +88,9 @@ extern FORTRAN_API void FORT_CALL mpi_file_close_( MPI_File*, MPI_Fint * ); #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_close_(MPI_Fint *fh, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_close_(MPI_Fint * fh, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_close_(MPI_Fint *fh, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_close_(MPI_Fint * fh, MPI_Fint * ierr) { MPI_File fh_c; diff --git a/3rd-party/romio321/mpi-io/fortran/deletef.c b/3rd-party/romio341/mpi-io/fortran/deletef.c similarity index 74% rename from 3rd-party/romio321/mpi-io/fortran/deletef.c rename to 3rd-party/romio341/mpi-io/fortran/deletef.c index 660129f76054d7e12bd98c2922691210336639d2..8cc9eeeb3e68ed73cad5b185e6a9807e02eb2981 100644 --- a/3rd-party/romio321/mpi-io/fortran/deletef.c +++ b/3rd-party/romio341/mpi-io/fortran/deletef.c @@ -1,14 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ +#include "adio.h" #ifdef _UNICOS #include <fortran.h> #endif -#include "adio.h" #include "mpio.h" @@ -17,16 +15,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_DELETE( char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL MPI_FILE_DELETE(char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak MPI_FILE_DELETE = PMPI_FILE_DELETE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_delete__( char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_delete__(char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_delete__ = pmpi_file_delete__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_delete( char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_delete(char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_delete = pmpi_file_delete #else -extern FORTRAN_API void FORT_CALL mpi_file_delete_( char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_delete_(char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_delete_ = pmpi_file_delete_ #endif @@ -105,15 +107,17 @@ void mpi_file_delete_(_fcd filename_fcd, MPI_Fint *info, MPI_Fint *ierr) FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename, MPI_Fint *info, MPI_Fint *ierr, int str_len) */ /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename FORT_MIXED_LEN_DECL, MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN_DECL); +FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename FORT_MIXED_LEN_DECL, MPI_Fint * info, + MPI_Fint * ierr FORT_END_LEN_DECL); #ifdef _UNICOS -void mpi_file_delete_(_fcd filename_fcd, MPI_Fint *info, MPI_Fint *ierr) +void mpi_file_delete_(_fcd filename_fcd, MPI_Fint * info, MPI_Fint * ierr) { char *filename = _fcdtocp(filename_fcd); int str_len = _fcdlen(filename_fcd); #else -FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename FORT_MIXED_LEN(str_len), MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN(str_len)) +FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename FORT_MIXED_LEN(str_len), MPI_Fint * info, + MPI_Fint * ierr FORT_END_LEN(str_len)) { #endif char *newfname; @@ -127,14 +131,16 @@ FORTRAN_API void FORT_CALL mpi_file_delete_(char *filename FORT_MIXED_LEN(str_le FPRINTF(stderr, "MPI_File_delete: filename is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - for (i=str_len-1; i>=0; i--) if (filename[i] != ' ') break; + for (i = str_len - 1; i >= 0; i--) + if (filename[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_File_delete: filename is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } real_len = i + 1; - newfname = (char *) ADIOI_Malloc((real_len+1)*sizeof(char)); + newfname = (char *) ADIOI_Malloc((real_len + 1) * sizeof(char)); ADIOI_Strncpy(newfname, filename, real_len); newfname[real_len] = '\0'; diff --git a/3rd-party/romio321/mpi-io/fortran/fsyncf.c b/3rd-party/romio341/mpi-io/fortran/fsyncf.c similarity index 78% rename from 3rd-party/romio321/mpi-io/fortran/fsyncf.c rename to 3rd-party/romio341/mpi-io/fortran/fsyncf.c index b52245256b8f5f07a89643b01ef7ff5ada96b3ff..14ca3d7e6b16dd83f73eb15bb9cc7ea3a19da9b7 100644 --- a/3rd-party/romio321/mpi-io/fortran/fsyncf.c +++ b/3rd-party/romio341/mpi-io/fortran/fsyncf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SYNC( MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SYNC(MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_SYNC = PMPI_FILE_SYNC #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_sync__( MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_sync__(MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_sync__ = pmpi_file_sync__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_sync( MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_sync(MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_sync = pmpi_file_sync #else -extern FORTRAN_API void FORT_CALL mpi_file_sync_( MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_sync_(MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_sync_ = pmpi_file_sync_ #endif @@ -90,12 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_sync_( MPI_Fint *, MPI_Fint * ); #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_sync_(MPI_Fint *fh, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_sync_(MPI_Fint * fh, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_sync_(MPI_Fint *fh, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_sync_(MPI_Fint * fh, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_sync(fh_c); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_amodef.c b/3rd-party/romio341/mpi-io/fortran/get_amodef.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/get_amodef.c rename to 3rd-party/romio341/mpi-io/fortran/get_amodef.c index 2427f068310f859bbef5f0db84cd6cee5c965820..483120021682aa12b2d475a324e7095940f3142a 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_amodef.c +++ b/3rd-party/romio341/mpi-io/fortran/get_amodef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_AMODE( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_AMODE(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_GET_AMODE = PMPI_FILE_GET_AMODE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_amode__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_amode__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_amode__ = pmpi_file_get_amode__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_amode( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_amode(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_amode = pmpi_file_get_amode #else -extern FORTRAN_API void FORT_CALL mpi_file_get_amode_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_amode_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_amode_ = pmpi_file_get_amode_ #endif @@ -90,12 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_amode_( MPI_Fint *, MPI_Fint *, M #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_amode_(MPI_Fint *fh, MPI_Fint *amode, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_amode_(MPI_Fint * fh, MPI_Fint * amode, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_amode_(MPI_Fint *fh, MPI_Fint *amode, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_amode_(MPI_Fint * fh, MPI_Fint * amode, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_amode(fh_c, amode); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_atomf.c b/3rd-party/romio341/mpi-io/fortran/get_atomf.c similarity index 78% rename from 3rd-party/romio321/mpi-io/fortran/get_atomf.c rename to 3rd-party/romio341/mpi-io/fortran/get_atomf.c index 98bf557e34b4d3bec57dec73157dc3c7145f1e20..3afd9387eaa248d4ae5664dbad091da9d7971271 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_atomf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_atomf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_ATOMICITY( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_ATOMICITY(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_GET_ATOMICITY = PMPI_FILE_GET_ATOMICITY #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_atomicity__ = pmpi_file_get_atomicity__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_atomicity = pmpi_file_get_atomicity #else -extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_atomicity_ = pmpi_file_get_atomicity_ #endif @@ -90,13 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_atomicity_( MPI_Fint *, MPI_Fint #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_atomicity_(MPI_Fint *fh, MPI_Fint *flag, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_atomicity_(MPI_Fint * fh, MPI_Fint * flag, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_atomicity_(MPI_Fint *fh, MPI_Fint *flag, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_atomicity_(MPI_Fint * fh, MPI_Fint * flag, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_atomicity(fh_c, flag); } - diff --git a/3rd-party/romio321/mpi-io/fortran/get_bytofff.c b/3rd-party/romio341/mpi-io/fortran/get_bytofff.c similarity index 69% rename from 3rd-party/romio321/mpi-io/fortran/get_bytofff.c rename to 3rd-party/romio341/mpi-io/fortran/get_bytofff.c index fb38b7be4ca82a4fddfd78039faa07d6bd082022..8c919529b65e11338141a5d3ac33cbd7af1ce276 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_bytofff.c +++ b/3rd-party/romio341/mpi-io/fortran/get_bytofff.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_BYTE_OFFSET( MPI_Fint *, MPI_Offset *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_BYTE_OFFSET(MPI_Fint *, MPI_Offset *, MPI_Offset *, + MPI_Fint *); #pragma weak MPI_FILE_GET_BYTE_OFFSET = PMPI_FILE_GET_BYTE_OFFSET #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset__( MPI_Fint *, MPI_Offset *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset__(MPI_Fint *, MPI_Offset *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_byte_offset__ = pmpi_file_get_byte_offset__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset( MPI_Fint *, MPI_Offset *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset(MPI_Fint *, MPI_Offset *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_byte_offset = pmpi_file_get_byte_offset #else -extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_( MPI_Fint *, MPI_Offset *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_(MPI_Fint *, MPI_Offset *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_byte_offset_ = pmpi_file_get_byte_offset_ #endif @@ -90,12 +92,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_( MPI_Fint *, MPI_Off #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_(MPI_Fint *fh, MPI_Offset *offset, MPI_Offset *disp, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Offset * disp, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_(MPI_Fint *fh,MPI_Offset *offset, MPI_Offset *disp, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_byte_offset_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Offset * disp, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_get_byte_offset(fh_c,*offset,disp); + *ierr = MPI_File_get_byte_offset(fh_c, *offset, disp); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_errhf.c b/3rd-party/romio341/mpi-io/fortran/get_errhf.c similarity index 78% rename from 3rd-party/romio321/mpi-io/fortran/get_errhf.c rename to 3rd-party/romio341/mpi-io/fortran/get_errhf.c index 96901ad776615405a9b57ac3b034bac79e14e8e7..a4ae64bc294115cf14ba08ba6d219a1722d33a75 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_errhf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_errhf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_ERRHANDLER( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_ERRHANDLER(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_GET_ERRHANDLER = PMPI_FILE_GET_ERRHANDLER #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_errhandler__ = pmpi_file_get_errhandler__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_errhandler = pmpi_file_get_errhandler #else -extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_errhandler_ = pmpi_file_get_errhandler_ #endif @@ -90,13 +88,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_errhandler_( MPI_Fint *, MPI_Fint #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_errhandler_(MPI_Fint *fh, MPI_Fint *err_handler, MPI_Fint *ierr); +FORTRAN_API void FORT_CALL mpi_file_get_errhandler_(MPI_Fint * fh, MPI_Fint * err_handler, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_errhandler_(MPI_Fint *fh, MPI_Fint *err_handler, MPI_Fint *ierr) +FORTRAN_API void FORT_CALL mpi_file_get_errhandler_(MPI_Fint * fh, MPI_Fint * err_handler, + MPI_Fint * ierr) { MPI_File fh_c; MPI_Errhandler err_handler_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_errhandler(fh_c, &err_handler_c); *err_handler = MPI_Errhandler_c2f(err_handler_c); diff --git a/3rd-party/romio321/mpi-io/fortran/get_extentf.c b/3rd-party/romio341/mpi-io/fortran/get_extentf.c similarity index 63% rename from 3rd-party/romio321/mpi-io/fortran/get_extentf.c rename to 3rd-party/romio341/mpi-io/fortran/get_extentf.c index 9a11d3c946ff06d0ae7e2dfca10f0af72ab4368d..42f252cae2128d8f1b4aab65724c20aa1eadd956 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_extentf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_extentf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_TYPE_EXTENT( MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_TYPE_EXTENT(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *); #pragma weak MPI_FILE_GET_TYPE_EXTENT = PMPI_FILE_GET_TYPE_EXTENT #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent__( MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent__(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_get_type_extent__ = pmpi_file_get_type_extent__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent( MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_get_type_extent = pmpi_file_get_type_extent #else -extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent_( MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent_(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_get_type_extent_ = pmpi_file_get_type_extent_ #endif @@ -89,38 +91,38 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_type_extent_( MPI_Fint *, MPI_Fin #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_get_type_extent_(MPI_Fint *fh,MPI_Fint *datatype, - MPI_Fint *extent, MPI_Fint *ierr ); +void mpi_file_get_type_extent_(MPI_Fint * fh, MPI_Fint * datatype, + MPI_Fint * extent, MPI_Fint * ierr); -void mpi_file_get_type_extent_(MPI_Fint *fh,MPI_Fint *datatype, - MPI_Fint *extent, MPI_Fint *ierr ) +void mpi_file_get_type_extent_(MPI_Fint * fh, MPI_Fint * datatype, + MPI_Fint * extent, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; MPI_Aint extent_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_get_type_extent(fh_c,datatype_c, &extent_c); - *(MPI_Aint*)extent = extent_c; /* Have to assume it's really an MPI_Aint?*/ + *ierr = MPI_File_get_type_extent(fh_c, datatype_c, &extent_c); + *(MPI_Aint *) extent = extent_c; /* Have to assume it's really an MPI_Aint? */ } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_type_extent_(MPI_Fint *fh,MPI_Datatype *datatype, - MPI_Fint *extent, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_type_extent_(MPI_Fint * fh, MPI_Datatype * datatype, + MPI_Fint * extent, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_type_extent_(MPI_Fint *fh,MPI_Datatype *datatype, - MPI_Fint *extent, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_type_extent_(MPI_Fint * fh, MPI_Datatype * datatype, + MPI_Fint * extent, MPI_Fint * ierr) { MPI_File fh_c; MPI_Aint extent_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_get_type_extent(fh_c,*datatype, &extent_c); - *(MPI_Aint*)extent = extent_c; /* Have to assume it's really an MPI_Aint?*/ + *ierr = MPI_File_get_type_extent(fh_c, *datatype, &extent_c); + *(MPI_Aint *) extent = extent_c; /* Have to assume it's really an MPI_Aint? */ } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/get_groupf.c b/3rd-party/romio341/mpi-io/fortran/get_groupf.c similarity index 75% rename from 3rd-party/romio321/mpi-io/fortran/get_groupf.c rename to 3rd-party/romio341/mpi-io/fortran/get_groupf.c index bb8c9a9cba70c5ef0a00e11c82498c91e78732ed..f94b47005f3f060ec2971dde1ff453f47005f52a 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_groupf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_groupf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_GROUP( MPI_Fint *, MPI_Group*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_GROUP(MPI_Fint *, MPI_Group *, MPI_Fint *); #pragma weak MPI_FILE_GET_GROUP = PMPI_FILE_GET_GROUP #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_group__( MPI_Fint *, MPI_Group*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_group__(MPI_Fint *, MPI_Group *, MPI_Fint *); #pragma weak mpi_file_get_group__ = pmpi_file_get_group__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_group( MPI_Fint *, MPI_Group*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_group(MPI_Fint *, MPI_Group *, MPI_Fint *); #pragma weak mpi_file_get_group = pmpi_file_get_group #else -extern FORTRAN_API void FORT_CALL mpi_file_get_group_( MPI_Fint *, MPI_Group*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_group_(MPI_Fint *, MPI_Group *, MPI_Fint *); #pragma weak mpi_file_get_group_ = pmpi_file_get_group_ #endif @@ -89,11 +87,11 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_group_( MPI_Fint *, MPI_Group*, M #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_get_group_(MPI_Fint *fh, MPI_Fint *group, MPI_Fint *ierr ); +void mpi_file_get_group_(MPI_Fint * fh, MPI_Fint * group, MPI_Fint * ierr); -void mpi_file_get_group_(MPI_Fint *fh, MPI_Fint *group, MPI_Fint *ierr ) +void mpi_file_get_group_(MPI_Fint * fh, MPI_Fint * group, MPI_Fint * ierr) { MPI_File fh_c; MPI_Group group_c; @@ -104,12 +102,12 @@ void mpi_file_get_group_(MPI_Fint *fh, MPI_Fint *group, MPI_Fint *ierr ) } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_group_(MPI_Fint *fh,MPI_Group *group, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_group_(MPI_Fint * fh, MPI_Group * group, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_group_(MPI_Fint *fh,MPI_Group *group, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_group_(MPI_Fint * fh, MPI_Group * group, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_group(fh_c, group); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_infof.c b/3rd-party/romio341/mpi-io/fortran/get_infof.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/get_infof.c rename to 3rd-party/romio341/mpi-io/fortran/get_infof.c index eb2ba551a456574f3b4d6a4bb98ec5c08dd7ae5a..4d4a02f0f95e5fb5913e297134b1165cb4d2689a 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_infof.c +++ b/3rd-party/romio341/mpi-io/fortran/get_infof.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_INFO( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_INFO(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_GET_INFO = PMPI_FILE_GET_INFO #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_info__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_info__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_info__ = pmpi_file_get_info__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_info( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_info(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_info = pmpi_file_get_info #else -extern FORTRAN_API void FORT_CALL mpi_file_get_info_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_info_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_get_info_ = pmpi_file_get_info_ #endif @@ -90,13 +88,13 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_info_( MPI_Fint *, MPI_Fint *, MP #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_info_(MPI_Fint *fh, MPI_Fint *info_used, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_info_(MPI_Fint * fh, MPI_Fint * info_used, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_info_(MPI_Fint *fh, MPI_Fint *info_used, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_info_(MPI_Fint * fh, MPI_Fint * info_used, MPI_Fint * ierr) { MPI_File fh_c; MPI_Info info_used_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_info(fh_c, &info_used_c); diff --git a/3rd-party/romio321/mpi-io/fortran/get_posn_shf.c b/3rd-party/romio341/mpi-io/fortran/get_posn_shf.c similarity index 79% rename from 3rd-party/romio321/mpi-io/fortran/get_posn_shf.c rename to 3rd-party/romio341/mpi-io/fortran/get_posn_shf.c index 8f5bff5c06ef86044fbd3109e4f4dcf8bc16d82d..7555449a517c3c4ae3ee01f261594f3c83d93766 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_posn_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_posn_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_POSITION_SHARED( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_POSITION_SHARED(MPI_Fint *, MPI_Offset *, + MPI_Fint *); #pragma weak MPI_FILE_GET_POSITION_SHARED = PMPI_FILE_GET_POSITION_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared__( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared__(MPI_Fint *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_position_shared__ = pmpi_file_get_position_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared(MPI_Fint *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_position_shared = pmpi_file_get_position_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared_( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared_(MPI_Fint *, MPI_Offset *, + MPI_Fint *); #pragma weak mpi_file_get_position_shared_ = pmpi_file_get_position_shared_ #endif @@ -90,13 +92,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_position_shared_( MPI_Fint *, MPI #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_position_shared_(MPI_Fint *fh, MPI_Offset *offset, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_position_shared_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_position_shared_(MPI_Fint *fh, MPI_Offset *offset, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_position_shared_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_position_shared(fh_c, offset); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_posnf.c b/3rd-party/romio341/mpi-io/fortran/get_posnf.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/get_posnf.c rename to 3rd-party/romio341/mpi-io/fortran/get_posnf.c index e21f37674a7e6b9976cb1bf9e788d026ba649e65..9305545d3cc1975ca548cc8dd18756fb75957c47 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_posnf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_posnf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_POSITION( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_POSITION(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak MPI_FILE_GET_POSITION = PMPI_FILE_GET_POSITION #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_position__( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position__(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_position__ = pmpi_file_get_position__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_position( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_position = pmpi_file_get_position #else -extern FORTRAN_API void FORT_CALL mpi_file_get_position_( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_position_(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_position_ = pmpi_file_get_position_ #endif @@ -90,12 +88,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_position_( MPI_Fint *, MPI_Offset #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_position_(MPI_Fint *fh, MPI_Offset *offset, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_position_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_position_(MPI_Fint *fh, MPI_Offset *offset, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_position_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_position(fh_c, offset); } diff --git a/3rd-party/romio321/mpi-io/fortran/get_sizef.c b/3rd-party/romio341/mpi-io/fortran/get_sizef.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/get_sizef.c rename to 3rd-party/romio341/mpi-io/fortran/get_sizef.c index 71ff17bb562a05889cfd966bcb20136ac4bee2d6..dab17464f6833cbb9b32d90584a095c2678778c3 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_sizef.c +++ b/3rd-party/romio341/mpi-io/fortran/get_sizef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_SIZE( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_SIZE(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak MPI_FILE_GET_SIZE = PMPI_FILE_GET_SIZE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_size__( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_size__(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_size__ = pmpi_file_get_size__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_size( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_size(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_size = pmpi_file_get_size #else -extern FORTRAN_API void FORT_CALL mpi_file_get_size_( MPI_Fint *, MPI_Offset*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_get_size_(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_get_size_ = pmpi_file_get_size_ #endif @@ -90,13 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_size_( MPI_Fint *, MPI_Offset*, M #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_size_(MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_get_size_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_get_size_(MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_get_size_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_size(fh_c, size); } - diff --git a/3rd-party/romio321/mpi-io/fortran/get_viewf.c b/3rd-party/romio341/mpi-io/fortran/get_viewf.c similarity index 61% rename from 3rd-party/romio321/mpi-io/fortran/get_viewf.c rename to 3rd-party/romio341/mpi-io/fortran/get_viewf.c index 8a4bc3d7fb877c265296ab011c4e512ba1986c7c..ada465a7655efdc66d2e7d908eebb3695f4ea282 100644 --- a/3rd-party/romio321/mpi-io/fortran/get_viewf.c +++ b/3rd-party/romio341/mpi-io/fortran/get_viewf.c @@ -1,14 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ +#include "adio.h" #ifdef _UNICOS #include <fortran.h> #endif -#include "adio.h" #include "mpio.h" @@ -17,16 +15,24 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_GET_VIEW( MPI_Fint *, MPI_Offset*, MPI_Fint*, MPI_Fint*, char * FORT_MIXED_LEN_DECL, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL MPI_FILE_GET_VIEW(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak MPI_FILE_GET_VIEW = PMPI_FILE_GET_VIEW #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_view__( MPI_Fint *, MPI_Offset*, MPI_Fint*, MPI_Fint*, char * FORT_MIXED_LEN_DECL, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_get_view__(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_get_view__ = pmpi_file_get_view__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_get_view( MPI_Fint *, MPI_Offset*, MPI_Fint*, MPI_Fint*, char * FORT_MIXED_LEN_DECL, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_get_view(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_get_view = pmpi_file_get_view #else -extern FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *, MPI_Offset*, MPI_Fint*, MPI_Fint*, char * FORT_MIXED_LEN_DECL, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_get_view_(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_get_view_ = pmpi_file_get_view_ #endif @@ -92,13 +98,13 @@ extern FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *, MPI_Offset*, M #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, - MPI_Fint *filetype,char *datarep, MPI_Fint *ierr, int str_len ); +void mpi_file_get_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, char *datarep, MPI_Fint * ierr, int str_len); -void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, - MPI_Fint *filetype,char *datarep, MPI_Fint *ierr, int str_len ) +void mpi_file_get_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, char *datarep, MPI_Fint * ierr, int str_len) { MPI_File fh_c; MPI_Datatype etype_c, filetype_c; @@ -110,7 +116,7 @@ void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, MPI_Abort(MPI_COMM_WORLD, 1); } - tmprep = (char *) ADIOI_Malloc((MPI_MAX_DATAREP_STRING+1) * sizeof(char)); + tmprep = (char *) ADIOI_Malloc((MPI_MAX_DATAREP_STRING + 1) * sizeof(char)); fh_c = MPI_File_f2c(*fh); *ierr = MPI_File_get_view(fh_c, disp, &etype_c, &filetype_c, tmprep); @@ -119,15 +125,15 @@ void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, ADIOI_Strncpy(datarep, tmprep, tmpreplen); /* blank pad the remaining space */ - for (i=tmpreplen; i<str_len; i++) datarep[i] = ' '; - } - else { + for (i = tmpreplen; i < str_len; i++) + datarep[i] = ' '; + } else { /* not enough space */ ADIOI_Strncpy(datarep, tmprep, str_len); /* this should be flagged as an error. */ *ierr = MPI_ERR_UNKNOWN; } - + *etype = MPI_Type_c2f(etype_c); *filetype = MPI_Type_c2f(filetype_c); ADIOI_Free(tmprep); @@ -136,16 +142,22 @@ void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, #else #ifdef _UNICOS -void mpi_file_get_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, - MPI_Fint *filetype, _fcd datarep_fcd, MPI_Fint *ierr) +void mpi_file_get_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, _fcd datarep_fcd, MPI_Fint * ierr) { char *datarep = _fcdtocp(datarep_fcd); int str_len = _fcdlen(datarep_fcd); #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN_DECL, MPI_Fint *ierr FORT_END_LEN_DECL ); - -FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN(str_len), MPI_Fint *ierr FORT_END_LEN(str_len) ) +FORTRAN_API void FORT_CALL mpi_file_get_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, + char *datarep FORT_MIXED_LEN_DECL, + MPI_Fint * ierr FORT_END_LEN_DECL); + +FORTRAN_API void FORT_CALL mpi_file_get_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, + char *datarep FORT_MIXED_LEN(str_len), + MPI_Fint * ierr FORT_END_LEN(str_len)) { #endif MPI_File fh_c; @@ -159,8 +171,8 @@ FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *fh, MPI_Offset *disp, M FPRINTF(stderr, "MPI_File_get_view: datarep is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - - tmprep = (char *) ADIOI_Malloc((MPI_MAX_DATAREP_STRING+1) * sizeof(char)); + + tmprep = (char *) ADIOI_Malloc((MPI_MAX_DATAREP_STRING + 1) * sizeof(char)); fh_c = MPI_File_f2c(*fh); etype_c = MPI_Type_f2c(*etype); filetype_c = MPI_Type_f2c(*filetype); @@ -171,9 +183,9 @@ FORTRAN_API void FORT_CALL mpi_file_get_view_( MPI_Fint *fh, MPI_Offset *disp, M ADIOI_Strncpy(datarep, tmprep, tmpreplen); /* blank pad the remaining space */ - for (i=tmpreplen; i<str_len; i++) datarep[i] = ' '; - } - else { + for (i = tmpreplen; i < str_len; i++) + datarep[i] = ' '; + } else { /* not enough space */ ADIOI_Strncpy(datarep, tmprep, str_len); /* this should be flagged as an error. */ diff --git a/3rd-party/romio321/mpi-io/fortran/iotestf.c b/3rd-party/romio341/mpi-io/fortran/iotestf.c similarity index 67% rename from 3rd-party/romio321/mpi-io/fortran/iotestf.c rename to 3rd-party/romio341/mpi-io/fortran/iotestf.c index 2a2c96c886bdea340e781951e4c682912306c916..eb5af579edda64e058d33b8de9914e138066571d 100644 --- a/3rd-party/romio321/mpi-io/fortran/iotestf.c +++ b/3rd-party/romio341/mpi-io/fortran/iotestf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -13,16 +11,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -FORTRAN_API void FORT_CALL MPIO_TEST(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL MPIO_TEST(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr); #pragma weak MPIO_TEST = PMPIO_TEST #elif defined(FORTRANDOUBLEUNDERSCORE) -FORTRAN_API void FORT_CALL mpio_test__(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_test__(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr); #pragma weak mpio_test__ = pmpio_test__ #elif !defined(FORTRANUNDERSCORE) -FORTRAN_API void FORT_CALL mpio_test(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_test(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr); #pragma weak mpio_test = pmpio_test #else -FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr); #pragma weak mpio_test_ = pmpio_test_ #endif @@ -89,13 +91,15 @@ FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint *request,MPI_Fint *flag,MPI_Statu #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint *request,MPI_Fint *flag,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpio_test_(MPI_Fint * request, MPI_Fint * flag, MPI_Status * status, + MPI_Fint * ierr) { MPIO_Request req_c; - + req_c = MPIO_Request_f2c(*request); - *ierr = MPIO_Test(&req_c,flag,status); + *ierr = MPIO_Test(&req_c, flag, status); *request = MPIO_Request_c2f(req_c); } diff --git a/3rd-party/romio321/mpi-io/fortran/iowaitf.c b/3rd-party/romio341/mpi-io/fortran/iowaitf.c similarity index 74% rename from 3rd-party/romio321/mpi-io/fortran/iowaitf.c rename to 3rd-party/romio341/mpi-io/fortran/iowaitf.c index a87ca6a6d91bbee647c713a86c42a1eb9789c95a..7c469ab6ab584cc0bd4217d89a5b0faaf5661e72 100644 --- a/3rd-party/romio321/mpi-io/fortran/iowaitf.c +++ b/3rd-party/romio341/mpi-io/fortran/iowaitf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -13,16 +11,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -FORTRAN_API void FORT_CALL MPIO_WAIT(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL MPIO_WAIT(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr); #pragma weak MPIO_WAIT = PMPIO_WAIT #elif defined(FORTRANDOUBLEUNDERSCORE) -FORTRAN_API void FORT_CALL mpio_wait__(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_wait__(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr); #pragma weak mpio_wait__ = pmpio_wait__ #elif !defined(FORTRANUNDERSCORE) -FORTRAN_API void FORT_CALL mpio_wait(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_wait(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr); #pragma weak mpio_wait = pmpio_wait #else -FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr); #pragma weak mpio_wait_ = pmpio_wait_ #endif @@ -89,12 +87,12 @@ FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint *request,MPI_Status *status, MPI_ #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint *request,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpio_wait_(MPI_Fint * request, MPI_Status * status, MPI_Fint * ierr) { MPIO_Request req_c; - + req_c = MPIO_Request_f2c(*request); *ierr = MPIO_Wait(&req_c, status); *request = MPIO_Request_c2f(req_c); diff --git a/3rd-party/romio321/mpi-io/fortran/iread_atf.c b/3rd-party/romio341/mpi-io/fortran/iread_atf.c similarity index 59% rename from 3rd-party/romio321/mpi-io/fortran/iread_atf.c rename to 3rd-party/romio341/mpi-io/fortran/iread_atf.c index c6a687dcee07c6b480eb4b8814abb0c7a812b884..44010f273a45d5fc61041bef1d8c3403ca6a3e84 100644 --- a/3rd-party/romio321/mpi-io/fortran/iread_atf.c +++ b/3rd-party/romio341/mpi-io/fortran/iread_atf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD_AT( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD_AT(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IREAD_AT = PMPI_FILE_IREAD_AT #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread_at__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_at__(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_at__ = pmpi_file_iread_at__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread_at( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_at(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_at = pmpi_file_iread_at #else -extern FORTRAN_API void FORT_CALL mpi_file_iread_at_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_at_(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_at_ = pmpi_file_iread_at_ #endif @@ -89,42 +91,40 @@ extern FORTRAN_API void FORT_CALL mpi_file_iread_at_( MPI_Fint *, MPI_Offset *, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iread_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Fint *request, MPI_Fint *ierr ); +void mpi_file_iread_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr); -void mpi_file_iread_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iread_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_iread_at(fh_c,*offset,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iread_at(fh_c, *offset, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iread_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Datatype *datatype, - MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iread_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Datatype * datatype, + MPI_Fint * request, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iread_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Datatype *datatype, - MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iread_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Datatype * datatype, + MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iread_at(fh_c,*offset,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iread_at(fh_c, *offset, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/iread_shf.c b/3rd-party/romio341/mpi-io/fortran/iread_shf.c similarity index 61% rename from 3rd-party/romio321/mpi-io/fortran/iread_shf.c rename to 3rd-party/romio341/mpi-io/fortran/iread_shf.c index 84dc3753c4a9793d4c922e6bcf28f2c1958f6673..77d1ef189eeaaa18b6dadb3f2e86170944fe7746 100644 --- a/3rd-party/romio321/mpi-io/fortran/iread_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/iread_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD_SHARED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD_SHARED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IREAD_SHARED = PMPI_FILE_IREAD_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread_shared__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_shared__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_shared__ = pmpi_file_iread_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread_shared( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_shared(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_shared = pmpi_file_iread_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_iread_shared_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_shared_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_shared_ = pmpi_file_iread_shared_ #endif @@ -89,36 +91,38 @@ extern FORTRAN_API void FORT_CALL mpi_file_iread_shared_( MPI_Fint *, void*, MPI #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iread_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ); +void mpi_file_iread_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr); -void mpi_file_iread_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iread_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + datatype_c = MPI_Type_f2c(*datatype); fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iread_shared(fh_c,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iread_shared(fh_c, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iread_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iread_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iread_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iread_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iread_shared(fh_c,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iread_shared(fh_c, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/ireadf.c b/3rd-party/romio341/mpi-io/fortran/ireadf.c similarity index 61% rename from 3rd-party/romio321/mpi-io/fortran/ireadf.c rename to 3rd-party/romio341/mpi-io/fortran/ireadf.c index ae9fbaf3bfd926292daf20fea121fe2eeccf0d2f..bfe530bb2096bacaeae621f302beedb6a9c549cc 100644 --- a/3rd-party/romio321/mpi-io/fortran/ireadf.c +++ b/3rd-party/romio341/mpi-io/fortran/ireadf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IREAD(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IREAD = PMPI_FILE_IREAD #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread__ = pmpi_file_iread__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iread( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread = pmpi_file_iread #else -extern FORTRAN_API void FORT_CALL mpi_file_iread_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iread_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iread_ = pmpi_file_iread_ #endif @@ -89,36 +91,38 @@ extern FORTRAN_API void FORT_CALL mpi_file_iread_( MPI_Fint *, void*, MPI_Fint * #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iread_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ); +void mpi_file_iread_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr); -void mpi_file_iread_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iread_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + datatype_c = MPI_Type_f2c(*datatype); fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iread(fh_c,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iread(fh_c, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iread_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iread_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iread_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iread_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iread(fh_c,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iread(fh_c, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/iwrite_atf.c b/3rd-party/romio341/mpi-io/fortran/iwrite_atf.c similarity index 59% rename from 3rd-party/romio321/mpi-io/fortran/iwrite_atf.c rename to 3rd-party/romio341/mpi-io/fortran/iwrite_atf.c index b326fc3d1a7256a5d1d7e691d00e0aa58f8283d6..af4ee9a0706bb670f1d4828cd42396dceb01d701 100644 --- a/3rd-party/romio321/mpi-io/fortran/iwrite_atf.c +++ b/3rd-party/romio341/mpi-io/fortran/iwrite_atf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE_AT( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE_AT(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IWRITE_AT = PMPI_FILE_IWRITE_AT #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at__(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_at__ = pmpi_file_iwrite_at__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_at = pmpi_file_iwrite_at #else -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at_(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_at_ = pmpi_file_iwrite_at_ #endif @@ -89,41 +91,40 @@ extern FORTRAN_API void FORT_CALL mpi_file_iwrite_at_( MPI_Fint *, MPI_Offset *, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iwrite_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Fint *request, MPI_Fint *ierr ); +void mpi_file_iwrite_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Fint * request, MPI_Fint * ierr); -void mpi_file_iwrite_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iwrite_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_iwrite_at(fh_c,*offset,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iwrite_at(fh_c, *offset, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iwrite_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Datatype *datatype, - MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iwrite_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Datatype * datatype, + MPI_Fint * request, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iwrite_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Datatype *datatype, - MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iwrite_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Datatype * datatype, + MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iwrite_at(fh_c,*offset,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iwrite_at(fh_c, *offset, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/iwrite_shf.c b/3rd-party/romio341/mpi-io/fortran/iwrite_shf.c similarity index 62% rename from 3rd-party/romio321/mpi-io/fortran/iwrite_shf.c rename to 3rd-party/romio341/mpi-io/fortran/iwrite_shf.c index 90ea68777b6a17c00c36e1c5b22c9e1441dd6ce1..a78d55fe5a37cf42ca7901b2024c105e656d4d93 100644 --- a/3rd-party/romio321/mpi-io/fortran/iwrite_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/iwrite_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE_SHARED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE_SHARED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IWRITE_SHARED = PMPI_FILE_IWRITE_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_shared__ = pmpi_file_iwrite_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_shared = pmpi_file_iwrite_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_shared_ = pmpi_file_iwrite_shared_ #endif @@ -89,36 +91,38 @@ extern FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_( MPI_Fint *, void*, MP #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iwrite_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ); -void mpi_file_iwrite_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iwrite_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr); +void mpi_file_iwrite_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_iwrite_shared(fh_c,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iwrite_shared(fh_c, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iwrite_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iwrite_shared(fh_c,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iwrite_shared(fh_c, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/iwritef.c b/3rd-party/romio341/mpi-io/fortran/iwritef.c similarity index 61% rename from 3rd-party/romio321/mpi-io/fortran/iwritef.c rename to 3rd-party/romio341/mpi-io/fortran/iwritef.c index 4410c011a1485bb23b0cd4059a331d1f012a57f8..f11d5199fb718f7262757fc665410bfd78f3d462 100644 --- a/3rd-party/romio321/mpi-io/fortran/iwritef.c +++ b/3rd-party/romio341/mpi-io/fortran/iwritef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_IWRITE(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_IWRITE = PMPI_FILE_IWRITE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite__ = pmpi_file_iwrite__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_iwrite( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite = pmpi_file_iwrite #else -extern FORTRAN_API void FORT_CALL mpi_file_iwrite_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_iwrite_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_iwrite_ = pmpi_file_iwrite_ #endif @@ -89,37 +91,39 @@ extern FORTRAN_API void FORT_CALL mpi_file_iwrite_( MPI_Fint *, void*, MPI_Fint #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_iwrite_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ); +void mpi_file_iwrite_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr); -void mpi_file_iwrite_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *request, MPI_Fint *ierr ) +void mpi_file_iwrite_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * request, MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_iwrite(fh_c,buf,*count,datatype_c,&req_c); + *ierr = MPI_File_iwrite(fh_c, buf, *count, datatype_c, &req_c); *request = MPIO_Request_c2f(req_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_iwrite_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_iwrite_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_iwrite_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Datatype *datatype,MPI_Fint *request, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_iwrite_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Datatype * datatype, MPI_Fint * request, + MPI_Fint * ierr) { MPI_File fh_c; MPIO_Request req_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_iwrite(fh_c,buf,*count,*datatype,&req_c); + *ierr = MPI_File_iwrite(fh_c, buf, *count, *datatype, &req_c); *request = MPIO_Request_c2f(req_c); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/openf.c b/3rd-party/romio341/mpi-io/fortran/openf.c similarity index 58% rename from 3rd-party/romio321/mpi-io/fortran/openf.c rename to 3rd-party/romio341/mpi-io/fortran/openf.c index ea1a5d1c47eadae7366bfda2cf23fe24128026e9..8067a2791afce396142290207fda40be4521fea1 100644 --- a/3rd-party/romio321/mpi-io/fortran/openf.c +++ b/3rd-party/romio341/mpi-io/fortran/openf.c @@ -1,14 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ +#include "adio.h" #ifdef _UNICOS #include <fortran.h> #endif -#include "adio.h" #include "mpio.h" @@ -17,16 +15,24 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_OPEN( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL MPI_FILE_OPEN(MPI_Fint *, char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint *, MPI_File *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak MPI_FILE_OPEN = PMPI_FILE_OPEN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_open__( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_open__(MPI_Fint *, char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint *, MPI_File *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_open__ = pmpi_file_open__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_open( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_open(MPI_Fint *, char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint *, MPI_File *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_open = pmpi_file_open #else -extern FORTRAN_API void FORT_CALL mpi_file_open_( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *, char *FORT_MIXED_LEN_DECL, MPI_Fint *, + MPI_Fint *, MPI_File *, + MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_open_ = pmpi_file_open_ #endif @@ -92,13 +98,13 @@ extern FORTRAN_API void FORT_CALL mpi_file_open_( MPI_Fint *, char * FORT_MIXED_ #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len ); +void mpi_file_open_(MPI_Fint * comm, char *filename, MPI_Fint * amode, + MPI_Fint * info, MPI_Fint * fh, MPI_Fint * ierr, int str_len); -void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len ) +void mpi_file_open_(MPI_Fint * comm, char *filename, MPI_Fint * amode, + MPI_Fint * info, MPI_Fint * fh, MPI_Fint * ierr, int str_len) { char *newfname; MPI_File fh_c; @@ -114,14 +120,16 @@ void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode, FPRINTF(stderr, "MPI_File_open: filename is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - for (i=str_len-1; i>=0; i--) if (filename[i] != ' ') break; + for (i = str_len - 1; i >= 0; i--) + if (filename[i] != ' ') + break; if (i < 0) { - FPRINTF(stderr, "MPI_File_open: filename is a blank string\n"); + FPRINTF(stderr, "MPI_File_open: filename is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } real_len = i + 1; - newfname = (char *) ADIOI_Malloc((real_len+1)*sizeof(char)); + newfname = (char *) ADIOI_Malloc((real_len + 1) * sizeof(char)); ADIOI_Strncpy(newfname, filename, real_len); newfname[real_len] = '\0'; @@ -134,8 +142,8 @@ void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode, #else #ifdef _UNICOS -void mpi_file_open_(MPI_Fint *comm,_fcd filename_fcd,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr) +void mpi_file_open_(MPI_Fint * comm, _fcd filename_fcd, MPI_Fint * amode, + MPI_Fint * info, MPI_Fint * fh, MPI_Fint * ierr) { char *filename = _fcdtocp(filename_fcd); int str_len = _fcdlen(filename_fcd); @@ -143,17 +151,19 @@ void mpi_file_open_(MPI_Fint *comm,_fcd filename_fcd,MPI_Fint *amode, /* Prototype to keep compiler happy */ /* FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Comm *comm,char *filename,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len ); + MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len); FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Comm *comm,char *filename,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len ) + MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len) */ /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *comm,char *filename FORT_MIXED_LEN_DECL,MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr FORT_END_LEN_DECL); +FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint * comm, char *filename FORT_MIXED_LEN_DECL, + MPI_Fint * amode, MPI_Fint * info, MPI_Fint * fh, + MPI_Fint * ierr FORT_END_LEN_DECL); -FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *comm,char *filename FORT_MIXED_LEN(str_len),MPI_Fint *amode, - MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr FORT_END_LEN(str_len)) +FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint * comm, char *filename FORT_MIXED_LEN(str_len), + MPI_Fint * amode, MPI_Fint * info, MPI_Fint * fh, + MPI_Fint * ierr FORT_END_LEN(str_len)) { #endif char *newfname; @@ -168,18 +178,20 @@ FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *comm,char *filename FORT_MIX FPRINTF(stderr, "MPI_File_open: filename is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - for (i=str_len-1; i>=0; i--) if (filename[i] != ' ') break; + for (i = str_len - 1; i >= 0; i--) + if (filename[i] != ' ') + break; if (i < 0) { - FPRINTF(stderr, "MPI_File_open: filename is a blank string\n"); + FPRINTF(stderr, "MPI_File_open: filename is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } real_len = i + 1; - newfname = (char *) ADIOI_Malloc((real_len+1)*sizeof(char)); + newfname = (char *) ADIOI_Malloc((real_len + 1) * sizeof(char)); ADIOI_Strncpy(newfname, filename, real_len); newfname[real_len] = '\0'; - *ierr = MPI_File_open((MPI_Comm)(*comm), newfname, *amode, info_c, &fh_c); + *ierr = MPI_File_open((MPI_Comm) (*comm), newfname, *amode, info_c, &fh_c); *fh = MPI_File_c2f(fh_c); ADIOI_Free(newfname); diff --git a/3rd-party/romio321/mpi-io/fortran/preallocf.c b/3rd-party/romio341/mpi-io/fortran/preallocf.c similarity index 76% rename from 3rd-party/romio321/mpi-io/fortran/preallocf.c rename to 3rd-party/romio341/mpi-io/fortran/preallocf.c index 515aa4a9125f82af157f6699da6948f066174852..00e9e402d2c7f5708aa516160281dfc41d2f972c 100644 --- a/3rd-party/romio321/mpi-io/fortran/preallocf.c +++ b/3rd-party/romio341/mpi-io/fortran/preallocf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_PREALLOCATE( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_PREALLOCATE(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak MPI_FILE_PREALLOCATE = PMPI_FILE_PREALLOCATE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_preallocate__( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_preallocate__(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_preallocate__ = pmpi_file_preallocate__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_preallocate( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_preallocate(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_preallocate = pmpi_file_preallocate #else -extern FORTRAN_API void FORT_CALL mpi_file_preallocate_( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_preallocate_(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_preallocate_ = pmpi_file_preallocate_ #endif @@ -90,13 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_preallocate_( MPI_Fint *, MPI_Offset #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_preallocate_(MPI_Fint *fh,MPI_Offset *size, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_preallocate_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_preallocate_(MPI_Fint *fh,MPI_Offset *size, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_preallocate_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_preallocate(fh_c,*size); + *ierr = MPI_File_preallocate(fh_c, *size); } - diff --git a/3rd-party/romio321/mpi-io/fortran/rd_atallbf.c b/3rd-party/romio341/mpi-io/fortran/rd_atallbf.c similarity index 63% rename from 3rd-party/romio321/mpi-io/fortran/rd_atallbf.c rename to 3rd-party/romio341/mpi-io/fortran/rd_atallbf.c index 5fff4e9e7ec603f3da6e0b8e8711d4fb27ef6f06..93cb4704878ead03df0ec391d1b985e1c3671999 100644 --- a/3rd-party/romio321/mpi-io/fortran/rd_atallbf.c +++ b/3rd-party/romio341/mpi-io/fortran/rd_atallbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL_BEGIN( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL_BEGIN(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_READ_AT_ALL_BEGIN = PMPI_FILE_READ_AT_ALL_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin__(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_at_all_begin__ = pmpi_file_read_at_all_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_at_all_begin = pmpi_file_read_at_all_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_at_all_begin_ = pmpi_file_read_at_all_begin_ #endif @@ -89,13 +91,13 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_( MPI_Fint *, MPI_O #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ); +void mpi_file_read_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * ierr); -void mpi_file_read_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ) +void mpi_file_read_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; @@ -103,19 +105,21 @@ void mpi_file_read_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_at_all_begin(fh_c,*offset,buf,*count,datatype_c); + *ierr = MPI_File_read_at_all_begin(fh_c, *offset, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, + void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, + void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_at_all_begin(fh_c,*offset,buf,*count,(MPI_Datatype) *datatype); + *ierr = MPI_File_read_at_all_begin(fh_c, *offset, buf, *count, (MPI_Datatype) * datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/rd_atallef.c b/3rd-party/romio341/mpi-io/fortran/rd_atallef.c similarity index 70% rename from 3rd-party/romio321/mpi-io/fortran/rd_atallef.c rename to 3rd-party/romio341/mpi-io/fortran/rd_atallef.c index 8a3441126dd6812e08affc202063a91a9c9d677f..1c7c3a68635e75b80b9ab1358f693affb6259ec3 100644 --- a/3rd-party/romio321/mpi-io/fortran/rd_atallef.c +++ b/3rd-party/romio341/mpi-io/fortran/rd_atallef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_READ_AT_ALL_END = PMPI_FILE_READ_AT_ALL_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_at_all_end__ = pmpi_file_read_at_all_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_at_all_end = pmpi_file_read_at_all_end #else -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_at_all_end_ = pmpi_file_read_at_all_end_ #endif @@ -90,13 +92,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_( MPI_Fint *, void*, #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_at_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_at_all_end(fh_c,buf,status); + *ierr = MPI_File_read_at_all_end(fh_c, buf, status); } - diff --git a/3rd-party/romio321/mpi-io/fortran/read_allbf.c b/3rd-party/romio341/mpi-io/fortran/read_allbf.c similarity index 64% rename from 3rd-party/romio321/mpi-io/fortran/read_allbf.c rename to 3rd-party/romio341/mpi-io/fortran/read_allbf.c index 5708a03c8dc53d5c213aa68cb104aad4f1fb10d9..378522e0e59044ae11f8f14264818c743e04dbbd 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_allbf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_allbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL_BEGIN( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL_BEGIN(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_READ_ALL_BEGIN = PMPI_FILE_READ_ALL_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_all_begin__ = pmpi_file_read_all_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_all_begin = pmpi_file_read_all_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_all_begin_ = pmpi_file_read_all_begin_ #endif @@ -89,32 +91,33 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_all_begin_( MPI_Fint *, void*, M #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); +void mpi_file_read_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -void mpi_file_read_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *ierr ) +void mpi_file_read_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_all_begin(fh_c,buf,*count,datatype_c); + *ierr = MPI_File_read_all_begin(fh_c, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_read_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_all_begin(fh_c,buf,*count,(MPI_Datatype) *datatype); + *ierr = MPI_File_read_all_begin(fh_c, buf, *count, (MPI_Datatype) * datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_allef.c b/3rd-party/romio341/mpi-io/fortran/read_allef.c similarity index 70% rename from 3rd-party/romio321/mpi-io/fortran/read_allef.c rename to 3rd-party/romio341/mpi-io/fortran/read_allef.c index 776b182d640134cb42a89e3e673485a307dd4ebf..0cc63a6bc7207d46823f191d8ad8b3a28f5205c9 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_allef.c +++ b/3rd-party/romio341/mpi-io/fortran/read_allef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_READ_ALL_END = PMPI_FILE_READ_ALL_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_all_end__ = pmpi_file_read_all_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_all_end = pmpi_file_read_all_end #else -extern FORTRAN_API void FORT_CALL mpi_file_read_all_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_all_end_ = pmpi_file_read_all_end_ #endif @@ -90,14 +92,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_all_end_( MPI_Fint *, void*, MPI #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_all_end(fh_c,buf,status); + *ierr = MPI_File_read_all_end(fh_c, buf, status); } diff --git a/3rd-party/romio321/mpi-io/fortran/read_allf.c b/3rd-party/romio341/mpi-io/fortran/read_allf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/read_allf.c rename to 3rd-party/romio341/mpi-io/fortran/read_allf.c index 99e1229b7f1cd7a366d021bca2b1fe71e77a4ed5..0eb97a1bb3a410955814618884a9a71cb3f465a9 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_allf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_allf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ALL(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ_ALL = PMPI_FILE_READ_ALL #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_all__ = pmpi_file_read_all__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_all( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_all = pmpi_file_read_all #else -extern FORTRAN_API void FORT_CALL mpi_file_read_all_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_all_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_all_ = pmpi_file_read_all_ #endif @@ -89,32 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_all_( MPI_Fint *, void*, MPI_Fin #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_read_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_read_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_all(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_read_all(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_read_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_all(fh_c,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read_all(fh_c, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_atallf.c b/3rd-party/romio341/mpi-io/fortran/read_atallf.c similarity index 56% rename from 3rd-party/romio321/mpi-io/fortran/read_atallf.c rename to 3rd-party/romio341/mpi-io/fortran/read_atallf.c index b9f30a005623f8400b3ddf0cedaa7f12b0ce95f9..8aa043ed708a8e748bce95b842cc4f368701d5d3 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_atallf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_atallf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,22 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT_ALL(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ_AT_ALL = PMPI_FILE_READ_AT_ALL #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all__(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_at_all__ = pmpi_file_read_at_all__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_at_all = pmpi_file_read_at_all #else -extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_at_all_ = pmpi_file_read_at_all_ #endif @@ -89,15 +93,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_at_all_( MPI_Fint *, MPI_Offset #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_read_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -void mpi_file_read_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; @@ -105,21 +109,21 @@ void mpi_file_read_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_at_all(fh_c,*offset,buf,*count,datatype_c,status); + *ierr = MPI_File_read_at_all(fh_c, *offset, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_at_all(fh_c,*offset,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read_at_all(fh_c, *offset, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_atf.c b/3rd-party/romio341/mpi-io/fortran/read_atf.c similarity index 57% rename from 3rd-party/romio321/mpi-io/fortran/read_atf.c rename to 3rd-party/romio341/mpi-io/fortran/read_atf.c index 2602e399bf6f58aae9f6f5ebf03d8b441a4a6cf1..9b53faa4a4741c6c2080ff3d519515a02fd3252d 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_atf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_atf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_AT(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ_AT = PMPI_FILE_READ_AT #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at__(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_at__ = pmpi_file_read_at__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_at( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_at = pmpi_file_read_at #else -extern FORTRAN_API void FORT_CALL mpi_file_read_at_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_at_(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_at_ = pmpi_file_read_at_ #endif @@ -89,33 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_at_( MPI_Fint *, MPI_Offset *, v #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_read_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_read_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_at(fh_c,*offset,buf,*count,datatype_c,status); + *ierr = MPI_File_read_at(fh_c, *offset, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_at(fh_c,*offset,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read_at(fh_c, *offset, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_ordbf.c b/3rd-party/romio341/mpi-io/fortran/read_ordbf.c similarity index 68% rename from 3rd-party/romio321/mpi-io/fortran/read_ordbf.c rename to 3rd-party/romio341/mpi-io/fortran/read_ordbf.c index 74389174f4c67b30ddef621f6b5880b30efa5af9..f2237b028610cde953f572c6d2872434736dab16 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_ordbf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_ordbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED_BEGIN( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED_BEGIN(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_READ_ORDERED_BEGIN = PMPI_FILE_READ_ORDERED_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_ordered_begin__ = pmpi_file_read_ordered_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_ordered_begin = pmpi_file_read_ordered_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_read_ordered_begin_ = pmpi_file_read_ordered_begin_ #endif @@ -89,32 +91,33 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_( MPI_Fint *, void #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *ierr ); +void mpi_file_read_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -void mpi_file_read_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *ierr ) +void mpi_file_read_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_ordered_begin(fh_c,buf,*count,datatype_c); + *ierr = MPI_File_read_ordered_begin(fh_c, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_read_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_ordered_begin(fh_c,buf,*count,(MPI_Datatype)*datatype); + *ierr = MPI_File_read_ordered_begin(fh_c, buf, *count, (MPI_Datatype) * datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_ordef.c b/3rd-party/romio341/mpi-io/fortran/read_ordef.c similarity index 74% rename from 3rd-party/romio321/mpi-io/fortran/read_ordef.c rename to 3rd-party/romio341/mpi-io/fortran/read_ordef.c index 63425c8ad330b45e4d85f978124b22cc19a6869c..5bcedd16d7a57dc139d2bc1706a5234bc0511dac 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_ordef.c +++ b/3rd-party/romio341/mpi-io/fortran/read_ordef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_READ_ORDERED_END = PMPI_FILE_READ_ORDERED_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_ordered_end__ = pmpi_file_read_ordered_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_ordered_end = pmpi_file_read_ordered_end #else -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_read_ordered_end_ = pmpi_file_read_ordered_end_ #endif @@ -90,14 +92,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_( MPI_Fint *, void*, #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_(MPI_Fint *fh,void *buf,MPI_Status *status, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_ordered_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_ordered_end(fh_c,buf,status); + *ierr = MPI_File_read_ordered_end(fh_c, buf, status); } diff --git a/3rd-party/romio321/mpi-io/fortran/read_ordf.c b/3rd-party/romio341/mpi-io/fortran/read_ordf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/read_ordf.c rename to 3rd-party/romio341/mpi-io/fortran/read_ordf.c index a45ae1282fff8fe5b1dc41ac033825350b622b6b..cf23e913164958ebc68095f9692f55c234638506 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_ordf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_ordf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_ORDERED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ_ORDERED = PMPI_FILE_READ_ORDERED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_ordered__ = pmpi_file_read_ordered__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_ordered = pmpi_file_read_ordered #else -extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_ordered_ = pmpi_file_read_ordered_ #endif @@ -89,32 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_ordered_( MPI_Fint *, void*, MPI #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_read_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_read_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_ordered(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_read_ordered(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_read_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_ordered(fh_c,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read_ordered(fh_c, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/read_shf.c b/3rd-party/romio341/mpi-io/fortran/read_shf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/read_shf.c rename to 3rd-party/romio341/mpi-io/fortran/read_shf.c index 937e54fb95e6bbe3539772e717ae65b5a8edebb4..a92a9090f441279490159b3a385bea3c4c008978 100644 --- a/3rd-party/romio321/mpi-io/fortran/read_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/read_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ_SHARED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ_SHARED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ_SHARED = PMPI_FILE_READ_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_shared__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_shared__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_shared__ = pmpi_file_read_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read_shared( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_shared(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_shared = pmpi_file_read_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_read_shared_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_shared_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_shared_ = pmpi_file_read_shared_ #endif @@ -89,31 +91,33 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_shared_( MPI_Fint *, void*, MPI_ #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); -void mpi_file_read_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); +void mpi_file_read_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read_shared(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_read_shared(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); -FORTRAN_API void FORT_CALL mpi_file_read_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); +FORTRAN_API void FORT_CALL mpi_file_read_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read_shared(fh_c,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read_shared(fh_c, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/readf.c b/3rd-party/romio341/mpi-io/fortran/readf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/readf.c rename to 3rd-party/romio341/mpi-io/fortran/readf.c index c802739139ea4974a22c9f7648305a841c7c3330..753f8cf83bfc963e036633b06fae95ab2dbc68a6 100644 --- a/3rd-party/romio321/mpi-io/fortran/readf.c +++ b/3rd-party/romio341/mpi-io/fortran/readf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_READ( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_READ(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_READ = PMPI_FILE_READ #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read__ = pmpi_file_read__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_read( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read = pmpi_file_read #else -extern FORTRAN_API void FORT_CALL mpi_file_read_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_read_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_read_ = pmpi_file_read_ #endif @@ -89,33 +91,34 @@ extern FORTRAN_API void FORT_CALL mpi_file_read_( MPI_Fint *, void*, MPI_Fint *, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_read_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_read_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_read_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_read_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_read(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_read(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_read_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_read_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_read_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_read_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_read(fh_c,buf,*count,(MPI_Datatype)*datatype,status); + *ierr = MPI_File_read(fh_c, buf, *count, (MPI_Datatype) * datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/seek_shf.c b/3rd-party/romio341/mpi-io/fortran/seek_shf.c similarity index 69% rename from 3rd-party/romio321/mpi-io/fortran/seek_shf.c rename to 3rd-party/romio341/mpi-io/fortran/seek_shf.c index 158e626c0e79795f4d1469b22067d185bf13a59e..4f09012036719b8b64d18238296d65af3f88d677 100644 --- a/3rd-party/romio321/mpi-io/fortran/seek_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/seek_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SEEK_SHARED( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SEEK_SHARED(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *); #pragma weak MPI_FILE_SEEK_SHARED = PMPI_FILE_SEEK_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_seek_shared__( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek_shared__(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_seek_shared__ = pmpi_file_seek_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_seek_shared( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek_shared(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_seek_shared = pmpi_file_seek_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_seek_shared_( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek_shared_(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *); #pragma weak mpi_file_seek_shared_ = pmpi_file_seek_shared_ #endif @@ -90,13 +92,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_seek_shared_( MPI_Fint *, MPI_Offset #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_seek_shared_(MPI_Fint *fh,MPI_Offset *offset,MPI_Fint *whence, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_seek_shared_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * whence, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_seek_shared_(MPI_Fint *fh,MPI_Offset *offset,MPI_Fint *whence, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_seek_shared_(MPI_Fint * fh, MPI_Offset * offset, + MPI_Fint * whence, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_seek_shared(fh_c,*offset,*whence); + *ierr = MPI_File_seek_shared(fh_c, *offset, *whence); } diff --git a/3rd-party/romio321/mpi-io/fortran/seekf.c b/3rd-party/romio341/mpi-io/fortran/seekf.c similarity index 72% rename from 3rd-party/romio321/mpi-io/fortran/seekf.c rename to 3rd-party/romio341/mpi-io/fortran/seekf.c index 8e125d1849cbb1f57c82e9f11e0b19ebb09a9058..1a920a2ee0cc1f6b9afae34cd8ad10dab10b3955 100644 --- a/3rd-party/romio321/mpi-io/fortran/seekf.c +++ b/3rd-party/romio341/mpi-io/fortran/seekf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SEEK( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SEEK(MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_SEEK = PMPI_FILE_SEEK #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_seek__( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek__(MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_seek__ = pmpi_file_seek__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_seek( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek(MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_seek = pmpi_file_seek #else -extern FORTRAN_API void FORT_CALL mpi_file_seek_( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_seek_(MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_seek_ = pmpi_file_seek_ #endif @@ -90,12 +88,14 @@ extern FORTRAN_API void FORT_CALL mpi_file_seek_( MPI_Fint *, MPI_Offset *, MPI_ #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_seek_(MPI_Fint *fh,MPI_Offset *offset,MPI_Fint *whence, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_seek_(MPI_Fint * fh, MPI_Offset * offset, MPI_Fint * whence, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_seek_(MPI_Fint *fh,MPI_Offset *offset,MPI_Fint *whence, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_seek_(MPI_Fint * fh, MPI_Offset * offset, MPI_Fint * whence, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_seek(fh_c,*offset,*whence); + *ierr = MPI_File_seek(fh_c, *offset, *whence); } diff --git a/3rd-party/romio321/mpi-io/fortran/set_atomf.c b/3rd-party/romio341/mpi-io/fortran/set_atomf.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/set_atomf.c rename to 3rd-party/romio341/mpi-io/fortran/set_atomf.c index c4388950da51cab215da4e9c4802d3fa14e2734c..d41597382de36ba5e138244d1625385de0a3e31a 100644 --- a/3rd-party/romio321/mpi-io/fortran/set_atomf.c +++ b/3rd-party/romio341/mpi-io/fortran/set_atomf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SET_ATOMICITY( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SET_ATOMICITY(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_SET_ATOMICITY = PMPI_FILE_SET_ATOMICITY #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_atomicity__ = pmpi_file_set_atomicity__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_atomicity = pmpi_file_set_atomicity #else -extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_atomicity_ = pmpi_file_set_atomicity_ #endif @@ -90,13 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_set_atomicity_( MPI_Fint *, MPI_Fint #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_set_atomicity_(MPI_Fint *fh,MPI_Fint *flag, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_set_atomicity_(MPI_Fint * fh, MPI_Fint * flag, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_set_atomicity_(MPI_Fint *fh,MPI_Fint *flag, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_set_atomicity_(MPI_Fint * fh, MPI_Fint * flag, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_set_atomicity(fh_c,*flag); + *ierr = MPI_File_set_atomicity(fh_c, *flag); } - diff --git a/3rd-party/romio321/mpi-io/fortran/set_errhf.c b/3rd-party/romio341/mpi-io/fortran/set_errhf.c similarity index 76% rename from 3rd-party/romio321/mpi-io/fortran/set_errhf.c rename to 3rd-party/romio341/mpi-io/fortran/set_errhf.c index c622660898c72e95bd2a9d68f54953afde5711b8..94742793943089712c474195b2ac0d50df37bf61 100644 --- a/3rd-party/romio321/mpi-io/fortran/set_errhf.c +++ b/3rd-party/romio341/mpi-io/fortran/set_errhf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SET_ERRHANDLER( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SET_ERRHANDLER(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_SET_ERRHANDLER = PMPI_FILE_SET_ERRHANDLER #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_errhandler__ = pmpi_file_set_errhandler__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_errhandler = pmpi_file_set_errhandler #else -extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_errhandler_ = pmpi_file_set_errhandler_ #endif @@ -90,16 +88,17 @@ extern FORTRAN_API void FORT_CALL mpi_file_set_errhandler_( MPI_Fint *, MPI_Fint #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_set_errhandler_(MPI_Fint *fh, MPI_Fint *err_handler, MPI_Fint *ierr); +FORTRAN_API void FORT_CALL mpi_file_set_errhandler_(MPI_Fint * fh, MPI_Fint * err_handler, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_set_errhandler_(MPI_Fint *fh, MPI_Fint *err_handler, MPI_Fint *ierr) +FORTRAN_API void FORT_CALL mpi_file_set_errhandler_(MPI_Fint * fh, MPI_Fint * err_handler, + MPI_Fint * ierr) { MPI_File fh_c; MPI_Errhandler err_handler_c; - + fh_c = MPI_File_f2c(*fh); err_handler_c = MPI_Errhandler_f2c(*err_handler); - *ierr = MPI_File_set_errhandler(fh_c,err_handler_c); + *ierr = MPI_File_set_errhandler(fh_c, err_handler_c); } - diff --git a/3rd-party/romio321/mpi-io/fortran/set_infof.c b/3rd-party/romio341/mpi-io/fortran/set_infof.c similarity index 77% rename from 3rd-party/romio321/mpi-io/fortran/set_infof.c rename to 3rd-party/romio341/mpi-io/fortran/set_infof.c index 85c05e8f1da12a0c392c25a97a5f81340a26cea1..14dd8e504b1a7780735b3bcf4df6b48c0b39ab3e 100644 --- a/3rd-party/romio321/mpi-io/fortran/set_infof.c +++ b/3rd-party/romio341/mpi-io/fortran/set_infof.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SET_INFO( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SET_INFO(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_SET_INFO = PMPI_FILE_SET_INFO #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_info__( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_info__(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_info__ = pmpi_file_set_info__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_info( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_info(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_info = pmpi_file_set_info #else -extern FORTRAN_API void FORT_CALL mpi_file_set_info_( MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_info_(MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_set_info_ = pmpi_file_set_info_ #endif @@ -90,13 +88,13 @@ extern FORTRAN_API void FORT_CALL mpi_file_set_info_( MPI_Fint *, MPI_Fint *, MP #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_set_info_(MPI_Fint *fh, MPI_Fint *info, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_set_info_(MPI_Fint * fh, MPI_Fint * info, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_set_info_(MPI_Fint *fh, MPI_Fint *info, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_set_info_(MPI_Fint * fh, MPI_Fint * info, MPI_Fint * ierr) { MPI_File fh_c; MPI_Info info_c; - + fh_c = MPI_File_f2c(*fh); info_c = MPI_Info_f2c(*info); diff --git a/3rd-party/romio321/mpi-io/fortran/set_sizef.c b/3rd-party/romio341/mpi-io/fortran/set_sizef.c similarity index 76% rename from 3rd-party/romio321/mpi-io/fortran/set_sizef.c rename to 3rd-party/romio341/mpi-io/fortran/set_sizef.c index c595f2b85500c815a532a5710c1506870d07732a..fdcb598395e0bcef66ce33b027e3e25b7672bf4e 100644 --- a/3rd-party/romio321/mpi-io/fortran/set_sizef.c +++ b/3rd-party/romio341/mpi-io/fortran/set_sizef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,16 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SET_SIZE( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SET_SIZE(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak MPI_FILE_SET_SIZE = PMPI_FILE_SET_SIZE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_size__( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_size__(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_set_size__ = pmpi_file_set_size__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_size( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_size(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_set_size = pmpi_file_set_size #else -extern FORTRAN_API void FORT_CALL mpi_file_set_size_( MPI_Fint *, MPI_Offset *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_set_size_(MPI_Fint *, MPI_Offset *, MPI_Fint *); #pragma weak mpi_file_set_size_ = pmpi_file_set_size_ #endif @@ -90,13 +88,12 @@ extern FORTRAN_API void FORT_CALL mpi_file_set_size_( MPI_Fint *, MPI_Offset *, #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_set_size_(MPI_Fint *fh,MPI_Offset *size, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_set_size_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_set_size_(MPI_Fint *fh,MPI_Offset *size, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_set_size_(MPI_Fint * fh, MPI_Offset * size, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_set_size(fh_c,*size); + *ierr = MPI_File_set_size(fh_c, *size); } - diff --git a/3rd-party/romio321/mpi-io/fortran/set_viewf.c b/3rd-party/romio341/mpi-io/fortran/set_viewf.c similarity index 52% rename from 3rd-party/romio321/mpi-io/fortran/set_viewf.c rename to 3rd-party/romio341/mpi-io/fortran/set_viewf.c index 97151d978fb80098ee3c7fcff1f1eaa20b495f7a..1ea4bedd42965521204dd093f531e82fae04dae5 100644 --- a/3rd-party/romio321/mpi-io/fortran/set_viewf.c +++ b/3rd-party/romio341/mpi-io/fortran/set_viewf.c @@ -1,14 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ +#include "adio.h" #ifdef _UNICOS #include <fortran.h> #endif -#include "adio.h" #include "mpio.h" @@ -17,16 +15,24 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_SET_VIEW( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL MPI_FILE_SET_VIEW(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL); #pragma weak MPI_FILE_SET_VIEW = PMPI_FILE_SET_VIEW #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_view__( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_set_view__(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_set_view__ = pmpi_file_set_view__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_set_view( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_set_view(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_set_view = pmpi_file_set_view #else -extern FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL ); +extern FORTRAN_API void FORT_CALL mpi_file_set_view_(MPI_Fint *, MPI_Offset *, MPI_Fint *, + MPI_Fint *, char *FORT_MIXED_LEN_DECL, + MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL); #pragma weak mpi_file_set_view_ = pmpi_file_set_view_ #endif @@ -92,22 +98,22 @@ extern FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *, MPI_Offset *, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, - MPI_Fint *filetype,char *datarep,MPI_Fint *info, MPI_Fint *ierr, - int str_len ); +void mpi_file_set_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, char *datarep, MPI_Fint * info, MPI_Fint * ierr, + int str_len); -void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, - MPI_Fint *filetype,char *datarep,MPI_Fint *info, MPI_Fint *ierr, - int str_len ) +void mpi_file_set_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, char *datarep, MPI_Fint * info, MPI_Fint * ierr, + int str_len) { char *newstr; MPI_File fh_c; - int i, real_len; + int i, real_len; MPI_Datatype etype_c, filetype_c; MPI_Info info_c; - + etype_c = MPI_Type_f2c(*etype); filetype_c = MPI_Type_f2c(*filetype); info_c = MPI_Info_f2c(*info); @@ -117,20 +123,22 @@ void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, FPRINTF(stderr, "MPI_File_set_view: datarep is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - for (i=str_len-1; i>=0; i--) if (datarep[i] != ' ') break; + for (i = str_len - 1; i >= 0; i--) + if (datarep[i] != ' ') + break; if (i < 0) { - FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n"); + FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } real_len = i + 1; - newstr = (char *) ADIOI_Malloc((real_len+1)*sizeof(char)); + newstr = (char *) ADIOI_Malloc((real_len + 1) * sizeof(char)); ADIOI_Strncpy(newstr, datarep, real_len); newstr[real_len] = '\0'; - + fh_c = MPI_File_f2c(*fh); - - *ierr = MPI_File_set_view(fh_c,*disp,etype_c,filetype_c,newstr,info_c); + + *ierr = MPI_File_set_view(fh_c, *disp, etype_c, filetype_c, newstr, info_c); ADIOI_Free(newstr); } @@ -138,23 +146,30 @@ void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype, #else #ifdef _UNICOS -void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Datatype *etype, - MPI_Datatype *filetype,_fcd datarep_fcd,MPI_Fint *info, MPI_Fint *ierr) +void mpi_file_set_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Datatype * etype, + MPI_Datatype * filetype, _fcd datarep_fcd, MPI_Fint * info, MPI_Fint * ierr) { - char *datarep = _fcdtocp(datarep_fcd); - int str_len = _fcdlen(datarep_fcd); + char *datarep = _fcdtocp(datarep_fcd); + int str_len = _fcdlen(datarep_fcd); #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN_DECL, MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN_DECL ); - -FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN(str_len), MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN(str_len) ) +FORTRAN_API void FORT_CALL mpi_file_set_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, + char *datarep FORT_MIXED_LEN_DECL, MPI_Fint * info, + MPI_Fint * ierr FORT_END_LEN_DECL); + +FORTRAN_API void FORT_CALL mpi_file_set_view_(MPI_Fint * fh, MPI_Offset * disp, MPI_Fint * etype, + MPI_Fint * filetype, + char *datarep FORT_MIXED_LEN(str_len), + MPI_Fint * info, + MPI_Fint * ierr FORT_END_LEN(str_len)) { #endif char *newstr; MPI_File fh_c; - int i, real_len; + int i, real_len; MPI_Info info_c; - + info_c = MPI_Info_f2c(*info); /* strip trailing blanks in datarep */ @@ -162,20 +177,22 @@ FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *fh, MPI_Offset *disp, M FPRINTF(stderr, "MPI_File_set_view: datarep is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - for (i=str_len-1; i>=0; i--) if (datarep[i] != ' ') break; + for (i = str_len - 1; i >= 0; i--) + if (datarep[i] != ' ') + break; if (i < 0) { - FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n"); + FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } real_len = i + 1; - newstr = (char *) ADIOI_Malloc((real_len+1)*sizeof(char)); + newstr = (char *) ADIOI_Malloc((real_len + 1) * sizeof(char)); ADIOI_Strncpy(newstr, datarep, real_len); newstr[real_len] = '\0'; - + fh_c = MPI_File_f2c(*fh); - - *ierr = MPI_File_set_view(fh_c,*disp,*etype,*filetype,newstr,info_c); + + *ierr = MPI_File_set_view(fh_c, *disp, *etype, *filetype, newstr, info_c); ADIOI_Free(newstr); } diff --git a/3rd-party/romio321/mpi-io/fortran/wr_atallbf.c b/3rd-party/romio341/mpi-io/fortran/wr_atallbf.c similarity index 65% rename from 3rd-party/romio321/mpi-io/fortran/wr_atallbf.c rename to 3rd-party/romio341/mpi-io/fortran/wr_atallbf.c index 836dd378aee2dcc794a1a76dd184d7940690f170..6551644bc7d67b74858e6e5a75c26e7f14093240 100644 --- a/3rd-party/romio321/mpi-io/fortran/wr_atallbf.c +++ b/3rd-party/romio341/mpi-io/fortran/wr_atallbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL_BEGIN( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL_BEGIN(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_AT_ALL_BEGIN = PMPI_FILE_WRITE_AT_ALL_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin__(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_at_all_begin__ = pmpi_file_write_at_all_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_at_all_begin = pmpi_file_write_at_all_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_at_all_begin_ = pmpi_file_write_at_all_begin_ #endif @@ -90,33 +92,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_( MPI_Fint *, MPI_ #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ); +void mpi_file_write_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * ierr); -void mpi_file_write_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ) +void mpi_file_write_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_at_all_begin(fh_c,*offset,buf,*count,datatype_c); + *ierr = MPI_File_write_at_all_begin(fh_c, *offset, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, + void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_at_all_begin_(MPI_Fint * fh, MPI_Offset * offset, + void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_at_all_begin(fh_c,*offset,buf,*count,(MPI_Datatype)*datatype); + *ierr = MPI_File_write_at_all_begin(fh_c, *offset, buf, *count, (MPI_Datatype) * datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/wr_atallef.c b/3rd-party/romio341/mpi-io/fortran/wr_atallef.c similarity index 74% rename from 3rd-party/romio321/mpi-io/fortran/wr_atallef.c rename to 3rd-party/romio341/mpi-io/fortran/wr_atallef.c index 7426c48bf2f672ad3fd318bc53f945a5358acb9f..2177ea66e8bfc081e9eab60547b60e79ee93982e 100644 --- a/3rd-party/romio321/mpi-io/fortran/wr_atallef.c +++ b/3rd-party/romio341/mpi-io/fortran/wr_atallef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_WRITE_AT_ALL_END = PMPI_FILE_WRITE_AT_ALL_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all_end__ = pmpi_file_write_at_all_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all_end = pmpi_file_write_at_all_end #else -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all_end_ = pmpi_file_write_at_all_end_ #endif @@ -90,14 +92,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_( MPI_Fint *, void*, #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_at_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_at_all_end(fh_c,buf,status); + *ierr = MPI_File_write_at_all_end(fh_c, buf, status); } diff --git a/3rd-party/romio321/mpi-io/fortran/write_allbf.c b/3rd-party/romio341/mpi-io/fortran/write_allbf.c similarity index 64% rename from 3rd-party/romio321/mpi-io/fortran/write_allbf.c rename to 3rd-party/romio341/mpi-io/fortran/write_allbf.c index e47d3cd20083fb6ab5196510951f26e5d9507fde..4e09411a335933dc2dab64bdaca913b64e835da8 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_allbf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_allbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL_BEGIN( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL_BEGIN(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_ALL_BEGIN = PMPI_FILE_WRITE_ALL_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_all_begin__ = pmpi_file_write_all_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_all_begin = pmpi_file_write_all_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_all_begin_ = pmpi_file_write_all_begin_ #endif @@ -89,29 +91,31 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_all_begin_( MPI_Fint *, void*, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); -void mpi_file_write_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ){ +void mpi_file_write_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); +void mpi_file_write_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_all_begin(fh_c,buf,*count,datatype_c); + *ierr = MPI_File_write_all_begin(fh_c, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); -FORTRAN_API void FORT_CALL mpi_file_write_all_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); +FORTRAN_API void FORT_CALL mpi_file_write_all_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_all_begin(fh_c,buf,*count,(MPI_Datatype)*datatype); + *ierr = MPI_File_write_all_begin(fh_c, buf, *count, (MPI_Datatype) * datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_allef.c b/3rd-party/romio341/mpi-io/fortran/write_allef.c similarity index 70% rename from 3rd-party/romio321/mpi-io/fortran/write_allef.c rename to 3rd-party/romio341/mpi-io/fortran/write_allef.c index 9ccc1eb8db9e6a1c2ae9903620e9ae4b87100cc3..8997f2d35260caf4e9eae251eecf54097e54762e 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_allef.c +++ b/3rd-party/romio341/mpi-io/fortran/write_allef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_WRITE_ALL_END = PMPI_FILE_WRITE_ALL_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_all_end__ = pmpi_file_write_all_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_all_end = pmpi_file_write_all_end #else -extern FORTRAN_API void FORT_CALL mpi_file_write_all_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_all_end_ = pmpi_file_write_all_end_ #endif @@ -90,12 +92,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_all_end_( MPI_Fint *, void*, MP #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_all_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_all_end_(MPI_Fint * fh, void *buf, MPI_Status * status, + MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_all_end(fh_c,buf,status); + *ierr = MPI_File_write_all_end(fh_c, buf, status); } diff --git a/3rd-party/romio321/mpi-io/fortran/write_allf.c b/3rd-party/romio341/mpi-io/fortran/write_allf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/write_allf.c rename to 3rd-party/romio341/mpi-io/fortran/write_allf.c index bddcac150920542d460ba0d9e4257a25e4667f43..8b2021b8b4efa845659c48b1b31196c56f56ed43 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_allf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_allf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ALL(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_ALL = PMPI_FILE_WRITE_ALL #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_all__ = pmpi_file_write_all__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_all( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_all = pmpi_file_write_all #else -extern FORTRAN_API void FORT_CALL mpi_file_write_all_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_all_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_all_ = pmpi_file_write_all_ #endif @@ -89,31 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_all_( MPI_Fint *, void*, MPI_Fi #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +void mpi_file_write_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) +{ MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_all(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_write_all(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_all_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_all_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_all(fh_c,buf,*count,*datatype,status); + *ierr = MPI_File_write_all(fh_c, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_atallf.c b/3rd-party/romio341/mpi-io/fortran/write_atallf.c similarity index 55% rename from 3rd-party/romio321/mpi-io/fortran/write_atallf.c rename to 3rd-party/romio341/mpi-io/fortran/write_atallf.c index 030e7ae359d6e2f1072b7231478252f775adde6c..50a20cb56490284efa568618fdd320d9a4485e05 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_atallf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_atallf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,24 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT_ALL(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_WRITE_AT_ALL = PMPI_FILE_WRITE_AT_ALL #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all__(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all__ = pmpi_file_write_at_all__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all = pmpi_file_write_at_all #else -extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_(MPI_Fint *, MPI_Offset *, void *, + MPI_Fint *, MPI_Fint *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_at_all_ = pmpi_file_write_at_all_ #endif @@ -89,37 +95,37 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_at_all_( MPI_Fint *, MPI_Offset #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_write_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_at_all(fh_c,*offset,buf,*count,datatype_c,status); + *ierr = MPI_File_write_at_all(fh_c, *offset, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_at_all_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_at_all_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_at_all(fh_c,*offset,buf,*count,*datatype,status); + *ierr = MPI_File_write_at_all(fh_c, *offset, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_atf.c b/3rd-party/romio341/mpi-io/fortran/write_atf.c similarity index 57% rename from 3rd-party/romio321/mpi-io/fortran/write_atf.c rename to 3rd-party/romio341/mpi-io/fortran/write_atf.c index 8ba429dcc6bbb8f887e0289e0df2bda975f7d94a..12faa1fd7087bc7963d7505cda82cb00e5c8ef04 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_atf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_atf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_AT(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_AT = PMPI_FILE_WRITE_AT #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at__( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at__(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_at__ = pmpi_file_write_at__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_at( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_at = pmpi_file_write_at #else -extern FORTRAN_API void FORT_CALL mpi_file_write_at_( MPI_Fint *, MPI_Offset *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_at_(MPI_Fint *, MPI_Offset *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_at_ = pmpi_file_write_at_ #endif @@ -89,37 +91,36 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_at_( MPI_Fint *, MPI_Offset *, #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_write_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_at(fh_c,*offset,buf,*count,datatype_c,status); + *ierr = MPI_File_write_at(fh_c, *offset, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_at_(MPI_Fint *fh,MPI_Offset *offset,void *buf, - MPI_Fint *count,MPI_Fint *datatype, - MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_at_(MPI_Fint * fh, MPI_Offset * offset, void *buf, + MPI_Fint * count, MPI_Fint * datatype, + MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_at(fh_c,*offset,buf,*count,*datatype,status); + *ierr = MPI_File_write_at(fh_c, *offset, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_ordbf.c b/3rd-party/romio341/mpi-io/fortran/write_ordbf.c similarity index 70% rename from 3rd-party/romio321/mpi-io/fortran/write_ordbf.c rename to 3rd-party/romio341/mpi-io/fortran/write_ordbf.c index 41b9accfbef7c66a0a8a880c95e4e98b2b2141a2..36a90183e71c4aac7444429d2e1bb3a7caf2462f 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_ordbf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_ordbf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED_BEGIN( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED_BEGIN(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_ORDERED_BEGIN = PMPI_FILE_WRITE_ORDERED_BEGIN #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_ordered_begin__ = pmpi_file_write_ordered_begin__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_ordered_begin = pmpi_file_write_ordered_begin #else -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_file_write_ordered_begin_ = pmpi_file_write_ordered_begin_ #endif @@ -89,31 +91,33 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_( MPI_Fint *, voi #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); +void mpi_file_write_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -void mpi_file_write_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ){ +void mpi_file_write_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_ordered_begin(fh_c,buf,*count,datatype_c); + *ierr = MPI_File_write_ordered_begin(fh_c, buf, *count, datatype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_ordered_begin_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_ordered_begin(fh_c,buf,*count,*datatype); + *ierr = MPI_File_write_ordered_begin(fh_c, buf, *count, *datatype); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_ordef.c b/3rd-party/romio341/mpi-io/fortran/write_ordef.c similarity index 74% rename from 3rd-party/romio321/mpi-io/fortran/write_ordef.c rename to 3rd-party/romio341/mpi-io/fortran/write_ordef.c index a979f70eee9fb8e1f1ab337bd3542924e31cc4d1..1510a789c8315daedab939b0861458a2aa566ec4 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_ordef.c +++ b/3rd-party/romio341/mpi-io/fortran/write_ordef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED_END( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED_END(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak MPI_FILE_WRITE_ORDERED_END = PMPI_FILE_WRITE_ORDERED_END #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end__( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end__(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_ordered_end__ = pmpi_file_write_ordered_end__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_ordered_end = pmpi_file_write_ordered_end #else -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_( MPI_Fint *, void*, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_(MPI_Fint *, void *, MPI_Status *, + MPI_Fint *); #pragma weak mpi_file_write_ordered_end_ = pmpi_file_write_ordered_end_ #endif @@ -90,13 +92,15 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_( MPI_Fint *, void* #endif /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_(MPI_Fint *fh,void *buf,MPI_Status *status, - MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_(MPI_Fint * fh, void *buf, + MPI_Status * status, MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_(MPI_Fint *fh,void *buf,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_ordered_end_(MPI_Fint * fh, void *buf, + MPI_Status * status, MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_ordered_end(fh_c,buf,status); + *ierr = MPI_File_write_ordered_end(fh_c, buf, status); } diff --git a/3rd-party/romio321/mpi-io/fortran/write_ordf.c b/3rd-party/romio341/mpi-io/fortran/write_ordf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/write_ordf.c rename to 3rd-party/romio341/mpi-io/fortran/write_ordf.c index fe96406d9bbcc7a5a91953986dceb17206ff4cf5..fed62f49944a70c64a8e5994b04038b46af773ba 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_ordf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_ordf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_ORDERED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_ORDERED = PMPI_FILE_WRITE_ORDERED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_ordered__ = pmpi_file_write_ordered__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_ordered = pmpi_file_write_ordered #else -extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_ordered_ = pmpi_file_write_ordered_ #endif @@ -89,31 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_ordered_( MPI_Fint *, void*, MP #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +void mpi_file_write_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) +{ MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_ordered(fh_c,buf,*count,datatype_c,status); + *ierr = MPI_File_write_ordered(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_ordered_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ){ +FORTRAN_API void FORT_CALL mpi_file_write_ordered_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) +{ MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_ordered(fh_c,buf,*count,*datatype,status); + *ierr = MPI_File_write_ordered(fh_c, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/write_shf.c b/3rd-party/romio341/mpi-io/fortran/write_shf.c similarity index 60% rename from 3rd-party/romio321/mpi-io/fortran/write_shf.c rename to 3rd-party/romio341/mpi-io/fortran/write_shf.c index 30d80e0ee6d6192399d41b6941ec7fea5e5bdc9b..ba9d5b78ab431ee24afa13229a8397c925220458 100644 --- a/3rd-party/romio321/mpi-io/fortran/write_shf.c +++ b/3rd-party/romio341/mpi-io/fortran/write_shf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_SHARED( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE_SHARED(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_WRITE_SHARED = PMPI_FILE_WRITE_SHARED #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_shared__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_shared__(MPI_Fint *, void *, MPI_Fint *, + MPI_Fint *, MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_shared__ = pmpi_file_write_shared__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write_shared( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_shared(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_shared = pmpi_file_write_shared #else -extern FORTRAN_API void FORT_CALL mpi_file_write_shared_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_shared_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_shared_ = pmpi_file_write_shared_ #endif @@ -89,33 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_shared_( MPI_Fint *, void*, MPI #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_write_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write_shared(fh_c, buf,*count,datatype_c,status); + *ierr = MPI_File_write_shared(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_shared_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_shared_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write_shared(fh_c, buf,*count,*datatype,status); + *ierr = MPI_File_write_shared(fh_c, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fortran/writef.c b/3rd-party/romio341/mpi-io/fortran/writef.c similarity index 59% rename from 3rd-party/romio321/mpi-io/fortran/writef.c rename to 3rd-party/romio341/mpi-io/fortran/writef.c index 9b07ba095fa805c3b82c27f05a8698cb4beb5ff7..65be5d5559a396dc9ba31266e617ecfca80c34e7 100644 --- a/3rd-party/romio321/mpi-io/fortran/writef.c +++ b/3rd-party/romio341/mpi-io/fortran/writef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,20 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL MPI_FILE_WRITE(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak MPI_FILE_WRITE = PMPI_FILE_WRITE #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write__( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write__(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write__ = pmpi_file_write__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_file_write( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write = pmpi_file_write #else -extern FORTRAN_API void FORT_CALL mpi_file_write_( MPI_Fint *, void*, MPI_Fint *, MPI_Fint *, MPI_Status*, MPI_Fint * ); +extern FORTRAN_API void FORT_CALL mpi_file_write_(MPI_Fint *, void *, MPI_Fint *, MPI_Fint *, + MPI_Status *, MPI_Fint *); #pragma weak mpi_file_write_ = pmpi_file_write_ #endif @@ -89,33 +91,35 @@ extern FORTRAN_API void FORT_CALL mpi_file_write_( MPI_Fint *, void*, MPI_Fint * #endif #endif -#if defined(MPIHP) || defined(MPILAM) +#if defined(MPIHP) /* Prototype to keep compiler happy */ -void mpi_file_write_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +void mpi_file_write_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr); -void mpi_file_write_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +void mpi_file_write_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, MPI_Fint * ierr) { MPI_File fh_c; MPI_Datatype datatype_c; - + fh_c = MPI_File_f2c(*fh); datatype_c = MPI_Type_f2c(*datatype); - *ierr = MPI_File_write(fh_c, buf,*count,datatype_c,status); + *ierr = MPI_File_write(fh_c, buf, *count, datatype_c, status); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL mpi_file_write_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ); +FORTRAN_API void FORT_CALL mpi_file_write_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr); -FORTRAN_API void FORT_CALL mpi_file_write_(MPI_Fint *fh,void *buf,MPI_Fint *count, - MPI_Fint *datatype,MPI_Status *status, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL mpi_file_write_(MPI_Fint * fh, void *buf, MPI_Fint * count, + MPI_Fint * datatype, MPI_Status * status, + MPI_Fint * ierr) { MPI_File fh_c; - + fh_c = MPI_File_f2c(*fh); - *ierr = MPI_File_write(fh_c, buf,*count,*datatype,status); + *ierr = MPI_File_write(fh_c, buf, *count, *datatype, status); } #endif diff --git a/3rd-party/romio321/mpi-io/fsync.c b/3rd-party/romio341/mpi-io/fsync.c similarity index 68% rename from 3rd-party/romio321/mpi-io/fsync.c rename to 3rd-party/romio341/mpi-io/fsync.c index 00c9499629493276071b4c14bd48441061cd407e..74d90abc43ba82a15f86f094db64cb0dd8c3aceb 100644 --- a/3rd-party/romio321/mpi-io/fsync.c +++ b/3rd-party/romio341/mpi-io/fsync.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,7 @@ #pragma _CRI duplicate MPI_File_sync as PMPI_File_sync /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_sync(MPI_File fh) __attribute__((weak,alias("PMPI_File_sync"))); +int MPI_File_sync(MPI_File fh) __attribute__ ((weak, alias("PMPI_File_sync"))); #endif /* Include mapping from MPI->PMPI */ @@ -42,20 +40,17 @@ int MPI_File_sync(MPI_File fh) #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILESYNC, TRDTBLOCK, adio_fh, - MPI_DATATYPE_NULL, -1); + HPMP_IO_START(fl_xmpi, BLKMPIFILESYNC, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ ROMIO_THREAD_CS_ENTER(); adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ - if ((adio_fh == NULL) || ((adio_fh)->cookie != ADIOI_FILE_COOKIE)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadfh", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + if ((adio_fh == NULL) || ((adio_fh)->cookie != ADIOI_FILE_COOKIE)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadfh", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } MPIO_CHECK_WRITABLE(fh, myname, error_code); /* --END ERROR HANDLING-- */ @@ -63,14 +58,14 @@ int MPI_File_sync(MPI_File fh) ADIO_Flush(adio_fh, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ - -fn_exit: + + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_amode.c b/3rd-party/romio341/mpi-io/get_amode.c similarity index 76% rename from 3rd-party/romio321/mpi-io/get_amode.c rename to 3rd-party/romio341/mpi-io/get_amode.c index 3e9e2c3120fc1e3605d0639c65b4fa9e0cd5318c..c22df2482a5ba6249f64f847f6a8aa3c67c3fc45 100644 --- a/3rd-party/romio321/mpi-io/get_amode.c +++ b/3rd-party/romio341/mpi-io/get_amode.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_amode as PMPI_File_get_amode /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_amode(MPI_File fh, int *amode) __attribute__((weak,alias("PMPI_File_get_amode"))); +int MPI_File_get_amode(MPI_File fh, int *amode) + __attribute__ ((weak, alias("PMPI_File_get_amode"))); #endif /* Include mapping from MPI->PMPI */ @@ -38,10 +37,10 @@ Output Parameters: @*/ int MPI_File_get_amode(MPI_File fh, int *amode) { - int error_code=MPI_SUCCESS; + int error_code = MPI_SUCCESS; static char myname[] = "MPI_FILE_GET_AMODE"; ADIO_File adio_fh; - + adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ @@ -50,6 +49,6 @@ int MPI_File_get_amode(MPI_File fh, int *amode) *amode = adio_fh->orig_access_mode; -fn_exit: + fn_exit: return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_atom.c b/3rd-party/romio341/mpi-io/get_atom.c similarity index 79% rename from 3rd-party/romio321/mpi-io/get_atom.c rename to 3rd-party/romio341/mpi-io/get_atom.c index 1a9eae1389e8b1edbcf57e848cff60f6530462f5..4b846b2aaf7e247d54081bc8d7bd47e846248b97 100644 --- a/3rd-party/romio321/mpi-io/get_atom.c +++ b/3rd-party/romio341/mpi-io/get_atom.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_atomicity as PMPI_File_get_atomicity /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_atomicity(MPI_File fh, int *flag) __attribute__((weak,alias("PMPI_File_get_atomicity"))); +int MPI_File_get_atomicity(MPI_File fh, int *flag) + __attribute__ ((weak, alias("PMPI_File_get_atomicity"))); #endif /* Include mapping from MPI->PMPI */ @@ -41,7 +40,7 @@ int MPI_File_get_atomicity(MPI_File fh, int *flag) int error_code; ADIO_File adio_fh; static char myname[] = "MPI_FILE_GET_ATOMICITY"; - + adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ @@ -50,6 +49,6 @@ int MPI_File_get_atomicity(MPI_File fh, int *flag) *flag = adio_fh->atomicity; -fn_exit: + fn_exit: return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/get_bytoff.c b/3rd-party/romio341/mpi-io/get_bytoff.c similarity index 71% rename from 3rd-party/romio321/mpi-io/get_bytoff.c rename to 3rd-party/romio341/mpi-io/get_bytoff.c index f5cb452e5a8ef278d69698a8ae14f511843a6774..2de8383e71912313e4c036ecd8312c3b0ed45c2e 100644 --- a/3rd-party/romio321/mpi-io/get_bytoff.c +++ b/3rd-party/romio341/mpi-io/get_bytoff.c @@ -1,12 +1,10 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" -#include "adioi.h" /* ADIOI_Get_byte_offset() prototype */ +#include "adioi.h" /* ADIOI_Get_byte_offset() prototype */ #ifdef HAVE_WEAK_SYMBOLS @@ -18,7 +16,8 @@ #pragma _CRI duplicate MPI_File_get_byte_offset as PMPI_File_get_byte_offset /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) __attribute__((weak,alias("PMPI_File_get_byte_offset"))); +int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset * disp) + __attribute__ ((weak, alias("PMPI_File_get_byte_offset"))); #endif /* Include mapping from MPI->PMPI */ @@ -27,7 +26,7 @@ int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) _ #endif /*@ - MPI_File_get_byte_offset - Returns the absolute byte position in + MPI_File_get_byte_offset - Returns the absolute byte position in the file corresponding to "offset" etypes relative to the current view @@ -40,7 +39,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) +int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset * disp) { int error_code; ADIO_File adio_fh; @@ -51,13 +50,11 @@ int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if (offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); @@ -65,7 +62,7 @@ int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) ADIOI_Get_byte_offset(adio_fh, offset, disp); -fn_exit: + fn_exit: return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/get_errh.c b/3rd-party/romio341/mpi-io/get_errh.c similarity index 52% rename from 3rd-party/romio321/mpi-io/get_errh.c rename to 3rd-party/romio341/mpi-io/get_errh.c index 7962e33f92119eb57fa6e370d78eb332426da6cd..a175ac8ffe5f35008cc6373ed88f4b1c4fe5a998 100644 --- a/3rd-party/romio321/mpi-io/get_errh.c +++ b/3rd-party/romio341/mpi-io/get_errh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ #pragma _CRI duplicate MPI_File_get_errhandler as PMPI_File_get_errhandler /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler) __attribute__((weak,alias("PMPI_File_get_errhandler"))); +int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler * errhandler) + __attribute__ ((weak, alias("PMPI_File_get_errhandler"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,35 +36,31 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler) +int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler * errhandler) { int error_code = MPI_SUCCESS; ADIO_File fh; static char myname[] = "MPI_FILE_GET_ERRHANDLER"; - MPID_THREADPRIV_DECL; ROMIO_THREAD_CS_ENTER(); if (mpi_fh == MPI_FILE_NULL) { - *errhandler = ADIOI_DFLT_ERR_HANDLER; - } - else { - fh = MPIO_File_resolve(mpi_fh); - /* --BEGIN ERROR HANDLING-- */ - if ((fh <= (MPI_File) 0) || ((fh)->cookie != ADIOI_FILE_COOKIE)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadfh", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; - } - /* --END ERROR HANDLING-- */ + *errhandler = ADIOI_DFLT_ERR_HANDLER; + } else { + fh = MPIO_File_resolve(mpi_fh); + /* --BEGIN ERROR HANDLING-- */ + if ((fh <= (MPI_File) 0) || ((fh)->cookie != ADIOI_FILE_COOKIE)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadfh", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ - *errhandler = fh->err_handler; + *errhandler = fh->err_handler; } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/get_extent.c b/3rd-party/romio341/mpi-io/get_extent.c similarity index 83% rename from 3rd-party/romio321/mpi-io/get_extent.c rename to 3rd-party/romio341/mpi-io/get_extent.c index 960afab5e556c57a8a5dad1e0558b001ae5c2b96..9e3e3a580fd5deea63891af14650e29d24bc37cc 100644 --- a/3rd-party/romio321/mpi-io/get_extent.c +++ b/3rd-party/romio341/mpi-io/get_extent.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_type_extent as PMPI_File_get_type_extent /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent) __attribute__((weak,alias("PMPI_File_get_type_extent"))); +int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint * extent) + __attribute__ ((weak, alias("PMPI_File_get_type_extent"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,7 +36,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent) +int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint * extent) { int error_code; ADIO_File adio_fh; @@ -55,6 +54,6 @@ int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *exten error_code = MPI_Type_get_extent(datatype, &lb, extent); -fn_exit: + fn_exit: return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_group.c b/3rd-party/romio341/mpi-io/get_group.c similarity index 76% rename from 3rd-party/romio321/mpi-io/get_group.c rename to 3rd-party/romio341/mpi-io/get_group.c index 2b3077c7dc14c67b53d3dc2dd702cd9f38a5f752..b124c869c9e88b26424132dce859bd4a4ac32461 100644 --- a/3rd-party/romio321/mpi-io/get_group.c +++ b/3rd-party/romio341/mpi-io/get_group.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_group as PMPI_File_get_group /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_group(MPI_File fh, MPI_Group *group) __attribute__((weak,alias("PMPI_File_get_group"))); +int MPI_File_get_group(MPI_File fh, MPI_Group * group) + __attribute__ ((weak, alias("PMPI_File_get_group"))); #endif /* Include mapping from MPI->PMPI */ @@ -26,7 +25,7 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group) __attribute__((weak,alias( #endif /*@ - MPI_File_get_group - Returns the group of processes that + MPI_File_get_group - Returns the group of processes that opened the file Input Parameters: @@ -37,7 +36,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_group(MPI_File fh, MPI_Group *group) +int MPI_File_get_group(MPI_File fh, MPI_Group * group) { int error_code; ADIO_File adio_fh; @@ -58,7 +57,7 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group) */ error_code = MPI_Comm_group(adio_fh->comm, group); -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_info.c b/3rd-party/romio341/mpi-io/get_info.c similarity index 73% rename from 3rd-party/romio321/mpi-io/get_info.c rename to 3rd-party/romio341/mpi-io/get_info.c index e923e2b95eca0ee6ba099415ce62b56867582ccd..d258a82704368375643c2ffa3026d17a1402dff4 100644 --- a/3rd-party/romio321/mpi-io/get_info.c +++ b/3rd-party/romio341/mpi-io/get_info.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_info as PMPI_File_get_info /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) __attribute__((weak,alias("PMPI_File_get_info"))); +int MPI_File_get_info(MPI_File fh, MPI_Info * info_used) + __attribute__ ((weak, alias("PMPI_File_get_info"))); #endif /* Include mapping from MPI->PMPI */ @@ -36,7 +35,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) +int MPI_File_get_info(MPI_File fh, MPI_Info * info_used) { int error_code; ADIO_File adio_fh; @@ -53,10 +52,10 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) error_code = MPI_Info_dup(adio_fh->info, info_used); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); - return error_code; + return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_posn.c b/3rd-party/romio341/mpi-io/get_posn.c similarity index 74% rename from 3rd-party/romio321/mpi-io/get_posn.c rename to 3rd-party/romio341/mpi-io/get_posn.c index 49d8e4919bd2c22a097090fba59beedd27c24c8a..e2e64938c4f27519932f03336596bc413f4f60a1 100644 --- a/3rd-party/romio321/mpi-io/get_posn.c +++ b/3rd-party/romio341/mpi-io/get_posn.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ #pragma _CRI duplicate MPI_File_get_position as PMPI_File_get_position /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_position(MPI_File fh, MPI_Offset *offset) __attribute__((weak,alias("PMPI_File_get_position"))); +int MPI_File_get_position(MPI_File fh, MPI_Offset * offset) + __attribute__ ((weak, alias("PMPI_File_get_position"))); #endif /* Include mapping from MPI->PMPI */ @@ -27,7 +26,7 @@ int MPI_File_get_position(MPI_File fh, MPI_Offset *offset) __attribute__((weak,a #endif /*@ - MPI_File_get_position - Returns the current position of the + MPI_File_get_position - Returns the current position of the individual file pointer in etype units relative to the current view @@ -39,7 +38,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_position(MPI_File fh, MPI_Offset *offset) +int MPI_File_get_position(MPI_File fh, MPI_Offset * offset) { int error_code; ADIO_File adio_fh; @@ -54,6 +53,6 @@ int MPI_File_get_position(MPI_File fh, MPI_Offset *offset) ADIOI_Get_position(adio_fh, offset); -fn_exit: + fn_exit: return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/get_posn_sh.c b/3rd-party/romio341/mpi-io/get_posn_sh.c similarity index 77% rename from 3rd-party/romio321/mpi-io/get_posn_sh.c rename to 3rd-party/romio341/mpi-io/get_posn_sh.c index c6172c9d734f20136e653d064d3b17e2dfb9b2c2..ee626f2c5548f9e412a259692dc1adee13559209 100644 --- a/3rd-party/romio321/mpi-io/get_posn_sh.c +++ b/3rd-party/romio341/mpi-io/get_posn_sh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_position_shared as PMPI_File_get_position_shared /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset) __attribute__((weak,alias("PMPI_File_get_position_shared"))); +int MPI_File_get_position_shared(MPI_File fh, MPI_Offset * offset) + __attribute__ ((weak, alias("PMPI_File_get_position_shared"))); #endif /* Include mapping from MPI->PMPI */ @@ -26,7 +25,7 @@ int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset) __attribute__( #endif /*@ - MPI_File_get_position_shared - Returns the current position of the + MPI_File_get_position_shared - Returns the current position of the shared file pointer in etype units relative to the current view Input Parameters: @@ -37,7 +36,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset) +int MPI_File_get_position_shared(MPI_File fh, MPI_Offset * offset) { int error_code; ADIO_File adio_fh; @@ -56,9 +55,9 @@ int MPI_File_get_position_shared(MPI_File fh, MPI_Offset *offset) ADIO_Get_shared_fp(adio_fh, 0, offset, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: return error_code; } diff --git a/3rd-party/romio321/mpi-io/get_size.c b/3rd-party/romio341/mpi-io/get_size.c similarity index 76% rename from 3rd-party/romio321/mpi-io/get_size.c rename to 3rd-party/romio341/mpi-io/get_size.c index d7836c2791efe93d050965e2ce9f4990e6b05d27..e26fde6b3d8652642bad6beaa2ee1e5f1d10920c 100644 --- a/3rd-party/romio321/mpi-io/get_size.c +++ b/3rd-party/romio341/mpi-io/get_size.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_get_size as PMPI_File_get_size /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_size(MPI_File fh, MPI_Offset *size) __attribute__((weak,alias("PMPI_File_get_size"))); +int MPI_File_get_size(MPI_File fh, MPI_Offset * size) + __attribute__ ((weak, alias("PMPI_File_get_size"))); #endif /* Include mapping from MPI->PMPI */ @@ -36,7 +35,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_size(MPI_File fh, MPI_Offset *size) +int MPI_File_get_size(MPI_File fh, MPI_Offset * size) { int error_code; ADIO_File adio_fh; @@ -45,18 +44,17 @@ int MPI_File_get_size(MPI_File fh, MPI_Offset *size) #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEGETSIZE, TRDTBLOCK, adio_fh, - MPI_DATATYPE_NULL, -1); + HPMP_IO_START(fl_xmpi, BLKMPIFILEGETSIZE, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if(size == NULL){ + if (size == NULL) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**nullptr", "**nullptr %s", "size"); + myname, __LINE__, MPI_ERR_ARG, + "**nullptr", "**nullptr %s", "size"); goto fn_fail; } /* --END ERROR HANDLING-- */ @@ -67,7 +65,7 @@ int MPI_File_get_size(MPI_File fh, MPI_Offset *size) ADIO_Fcntl(adio_fh, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ *size = fcntl_struct->fsize; ADIOI_Free(fcntl_struct); @@ -76,9 +74,9 @@ int MPI_File_get_size(MPI_File fh, MPI_Offset *size) HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -fn_exit: + fn_exit: return error_code; -fn_fail: + fn_fail: /* --BEGIN ERROR HANDLING-- */ error_code = MPIO_Err_return_file(fh, error_code); goto fn_exit; diff --git a/3rd-party/romio321/mpi-io/get_view.c b/3rd-party/romio341/mpi-io/get_view.c similarity index 57% rename from 3rd-party/romio321/mpi-io/get_view.c rename to 3rd-party/romio341/mpi-io/get_view.c index e07cd9fa951fffeec93518dcc7ab0705e9027294..ee8e3ead6f5d20667a1208e300ccf6488e367dea 100644 --- a/3rd-party/romio321/mpi-io/get_view.c +++ b/3rd-party/romio341/mpi-io/get_view.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,17 +15,14 @@ #pragma _CRI duplicate MPI_File_get_view as PMPI_File_get_view /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, - char *datarep) __attribute__((weak,alias("PMPI_File_get_view"))); +int MPI_File_get_view(MPI_File fh, MPI_Offset * disp, MPI_Datatype * etype, MPI_Datatype * filetype, + char *datarep) __attribute__ ((weak, alias("PMPI_File_get_view"))); #endif /* Include mapping from MPI->PMPI */ #define MPIO_BUILD_PROFILING #include "mpioprof.h" #endif -#ifdef MPISGI -#include "mpisgi2.h" -#endif /*@ MPI_File_get_view - Returns the file view @@ -43,8 +38,8 @@ Output Parameters: .N fortran @*/ -int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, - MPI_Datatype *filetype, char *datarep) +int MPI_File_get_view(MPI_File fh, MPI_Offset * disp, MPI_Datatype * etype, + MPI_Datatype * filetype, char *datarep) { int error_code; ADIO_File adio_fh; @@ -59,35 +54,35 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if (datarep == NULL) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iodatarepnomem", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (datarep == NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iodatarepnomem", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ *disp = adio_fh->disp; - ADIOI_Strncpy(datarep, - (adio_fh->is_external32 ? "external32": "native"), MPI_MAX_DATAREP_STRING); + ADIOI_Strncpy(datarep, + (adio_fh->is_external32 ? "external32" : "native"), MPI_MAX_DATAREP_STRING); MPI_Type_get_envelope(adio_fh->etype, &i, &j, &k, &combiner); - if (combiner == MPI_COMBINER_NAMED) *etype = adio_fh->etype; + if (combiner == MPI_COMBINER_NAMED) + *etype = adio_fh->etype; else { - /* FIXME: It is wrong to use MPI_Type_contiguous; the user could choose to - re-implement MPI_Type_contiguous in an unexpected way. Either use - MPIR_Barrier_impl as in MPICH or PMPI_Type_contiguous */ + /* FIXME: It is wrong to use MPI_Type_contiguous; the user could choose to + * re-implement MPI_Type_contiguous in an unexpected way. Either use + * MPID_Barrier as in MPICH or PMPI_Type_contiguous */ MPI_Type_contiguous(1, adio_fh->etype, ©_etype); - /* FIXME: Ditto for MPI_Type_commit - use NMPI or PMPI */ + /* FIXME: Ditto for MPI_Type_commit - use NMPI or PMPI */ MPI_Type_commit(©_etype); *etype = copy_etype; } /* FIXME: Ditto for MPI_Type_xxx - use NMPI or PMPI */ MPI_Type_get_envelope(adio_fh->filetype, &i, &j, &k, &combiner); - if (combiner == MPI_COMBINER_NAMED) *filetype = adio_fh->filetype; + if (combiner == MPI_COMBINER_NAMED) + *filetype = adio_fh->filetype; else { MPI_Type_contiguous(1, adio_fh->filetype, ©_filetype); @@ -95,7 +90,7 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, *filetype = copy_filetype; } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi-io/glue/Makefile.mk b/3rd-party/romio341/mpi-io/glue/Makefile.mk similarity index 56% rename from 3rd-party/romio321/mpi-io/glue/Makefile.mk rename to 3rd-party/romio341/mpi-io/glue/Makefile.mk index 66f7f9efab92cac0d114bb8fd30451d561ccd05a..3950c1bf8d4403de1b577cb62ee28f2324b0a175 100644 --- a/3rd-party/romio321/mpi-io/glue/Makefile.mk +++ b/3rd-party/romio341/mpi-io/glue/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## include $(top_srcdir)/mpi-io/glue/default/Makefile.mk @@ -11,5 +9,5 @@ include $(top_srcdir)/mpi-io/glue/openmpi/Makefile.mk if !BUILD_ROMIO_EMBEDDED romio_other_sources += \ - mpi-io/glue/large_count.c + mpi-io/glue/large_count.c endif diff --git a/3rd-party/romio321/mpi-io/glue/default/Makefile.mk b/3rd-party/romio341/mpi-io/glue/default/Makefile.mk similarity index 53% rename from 3rd-party/romio321/mpi-io/glue/default/Makefile.mk rename to 3rd-party/romio341/mpi-io/glue/default/Makefile.mk index 96995410b7a9387a063b58117b6a4433464f31d4..838c61b0aae1e66baf820eb75517defc9f6de572 100644 --- a/3rd-party/romio321/mpi-io/glue/default/Makefile.mk +++ b/3rd-party/romio341/mpi-io/glue/default/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if MPIO_GLUE_DEFAULT @@ -10,4 +8,3 @@ romio_other_sources += \ mpi-io/glue/default/mpio_file.c \ mpi-io/glue/default/mpio_err.c endif MPIO_GLUE_DEFAULT - diff --git a/3rd-party/romio341/mpi-io/glue/default/mpio_err.c b/3rd-party/romio341/mpi-io/glue/default/mpio_err.c new file mode 100644 index 0000000000000000000000000000000000000000..028a8019b452ca90c0cf9420e46a205887d2e1ac --- /dev/null +++ b/3rd-party/romio341/mpi-io/glue/default/mpio_err.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" +#include "adio_extern.h" + +#include <stdarg.h> +#include <stdio.h> + +/* Default error handling implementation. + * + * Note that only MPI_ERRORS_ARE_FATAL and MPI_ERRORS_RETURN are + * handled correctly; other handlers cause an abort. + */ + +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ...) +{ + va_list Argp; + int idx = 0; + char *buf; + + buf = (char *) ADIOI_Malloc(1024); + if (buf != NULL) { + idx += MPL_snprintf(buf, 1023, "%s (line %d): ", fcname, line); + if (specific_msg == NULL) { + MPL_snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg); + } else { + va_start(Argp, specific_msg); + vsnprintf(&buf[idx], 1023 - idx, specific_msg, Argp); + va_end(Argp); + } + FPRINTF(stderr, "%s", buf); + ADIOI_Free(buf); + } + + return error_class; +} + +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) +{ + ADIO_File adio_fh; + + if (mpi_fh == MPI_FILE_NULL) { + if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_ARE_FATAL || + ADIOI_DFLT_ERR_HANDLER != MPI_ERRORS_RETURN) { + MPI_Abort(MPI_COMM_WORLD, 1); + } else { + return error_code; + } + } + + adio_fh = MPIO_File_resolve(mpi_fh); + + if (adio_fh->err_handler == MPI_ERRORS_ARE_FATAL || adio_fh->err_handler != MPI_ERRORS_RETURN) { + MPI_Abort(MPI_COMM_WORLD, 1); + } else { + return error_code; + } +} + +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) +{ + MPI_Errhandler errh; + + MPI_Comm_get_errhandler(mpi_comm, &errh); + + if (errh == MPI_ERRORS_ARE_FATAL || errh != MPI_ERRORS_RETURN) { + MPI_Abort(mpi_comm, 1); + } + + return error_code; +} diff --git a/3rd-party/romio341/mpi-io/glue/default/mpio_file.c b/3rd-party/romio341/mpi-io/glue/default/mpio_file.c new file mode 100644 index 0000000000000000000000000000000000000000..f81fc6406ca61bec3c5b7e0883938d852406d94d --- /dev/null +++ b/3rd-party/romio341/mpi-io/glue/default/mpio_file.c @@ -0,0 +1,90 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +/* Hooks for allocation of MPI_File handles. + * + * Three functions are used in ROMIO for allocation/deallocation + * of MPI_File structures: + * - MPIO_File_create(size) + * - MPIO_File_resolve(mpi_fh) + * - MPIO_File_free(mpi_fh) + * + */ + +MPI_File MPIO_File_create(int size) +{ + MPI_File mpi_fh; + + mpi_fh = (MPI_File) ADIOI_Calloc(size, 1); + return mpi_fh; +} + +ADIO_File MPIO_File_resolve(MPI_File mpi_fh) +{ + return mpi_fh; +} + +void MPIO_File_free(MPI_File * mpi_fh) +{ + ADIOI_Free(*mpi_fh); + *mpi_fh = MPI_FILE_NULL; +} + +extern ADIO_File *ADIOI_Ftable; +extern int ADIOI_Ftable_ptr; +extern int ADIOI_Ftable_max; + +MPI_File MPIO_File_f2c(MPI_Fint fh) +{ +#ifndef INT_LT_POINTER + return (MPI_File) ((void *) fh); + /* the extra cast is to get rid of a compiler warning on Exemplar. + * The warning is because MPI_File points to a structure containing + * longlongs, which may be 8-byte aligned. But MPI_Fint itself + * may not be 8-byte aligned. */ +#else + if (!fh) + return MPI_FILE_NULL; + if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { + FPRINTF(stderr, "MPI_File_f2c: Invalid file handle\n"); + /* there is no way to return an error from MPI_File_f2c */ + return MPI_FILE_NULL; + } + return ADIOI_Ftable[fh]; +#endif +} + +MPI_Fint MPIO_File_c2f(MPI_File fh) +{ +#ifndef INT_LT_POINTER + return (MPI_Fint) fh; +#else + int i; + + if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE)) + return (MPI_Fint) 0; + if (!ADIOI_Ftable) { + ADIOI_Ftable_max = 1024; + ADIOI_Ftable = (MPI_File *) + ADIOI_Malloc(ADIOI_Ftable_max * sizeof(MPI_File)); + ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because + * MPI_FILE_NULL=0 */ + for (i = 0; i < ADIOI_Ftable_max; i++) + ADIOI_Ftable[i] = MPI_FILE_NULL; + } + if (ADIOI_Ftable_ptr == ADIOI_Ftable_max - 1) { + ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable, + (ADIOI_Ftable_max + 1024) * sizeof(MPI_File)); + for (i = ADIOI_Ftable_max; i < ADIOI_Ftable_max + 1024; i++) + ADIOI_Ftable[i] = MPI_FILE_NULL; + ADIOI_Ftable_max += 1024; + } + ADIOI_Ftable_ptr++; + ADIOI_Ftable[ADIOI_Ftable_ptr] = fh; + return (MPI_Fint) ADIOI_Ftable_ptr; +#endif +} diff --git a/3rd-party/romio321/mpi-io/glue/large_count.c b/3rd-party/romio341/mpi-io/glue/large_count.c similarity index 51% rename from 3rd-party/romio321/mpi-io/glue/large_count.c rename to 3rd-party/romio341/mpi-io/glue/large_count.c index ee31e2b746e7a12b95209da0342de4ed7a3a2caa..ae574b077657d3017dbaf19c2b0d787fba839c95 100644 --- a/3rd-party/romio321/mpi-io/glue/large_count.c +++ b/3rd-party/romio341/mpi-io/glue/large_count.c @@ -1,13 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * Copyright (C) 2013 University of Chicago. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" #ifndef HAVE_MPI_TYPE_SIZE_X -int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) +int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count * size) { int size_int, ret; ret = MPI_Type_size(datatype, &size_int); @@ -17,8 +16,7 @@ int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) #endif #ifndef HAVE_MPI_STATUS_SET_ELEMENTS_X -int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, - MPI_Count count) +int MPI_Status_set_elements_x(MPI_Status * status, MPI_Datatype datatype, MPI_Count count) { int count_int = (int) count; return MPI_Status_set_elements(status, datatype, count_int); diff --git a/3rd-party/romio321/mpi-io/glue/mpich/Makefile.mk b/3rd-party/romio341/mpi-io/glue/mpich/Makefile.mk similarity index 52% rename from 3rd-party/romio321/mpi-io/glue/mpich/Makefile.mk rename to 3rd-party/romio341/mpi-io/glue/mpich/Makefile.mk index 4578670a319c04bbc9dd5444ee3bddb766870759..ddb03de7fa0ce76139ac97269dd288a9fdffbccd 100644 --- a/3rd-party/romio321/mpi-io/glue/mpich/Makefile.mk +++ b/3rd-party/romio341/mpi-io/glue/mpich/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if MPIO_GLUE_MPICH diff --git a/3rd-party/romio341/mpi-io/glue/mpich/mpio_err.c b/3rd-party/romio341/mpi-io/glue/mpich/mpio_err.c new file mode 100644 index 0000000000000000000000000000000000000000..fdf67328ddbbf1cd1a66c3c82693de126dd7d205 --- /dev/null +++ b/3rd-party/romio341/mpi-io/glue/mpich/mpio_err.c @@ -0,0 +1,98 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" +#include "adio_extern.h" +#include "mpir_ext.h" + +#include <stdarg.h> +#include <stdio.h> + + +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ...) +{ + va_list Argp; + int error_code; + + va_start(Argp, specific_msg); + + error_code = MPIR_Err_create_code_valist(lastcode, fatal, fcname, line, + error_class, generic_msg, specific_msg, Argp); + + va_end(Argp); + + return error_code; +} + +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) +{ + MPI_Errhandler e; + void (*c_errhandler) (MPI_File *, int *, ...); + int kind; /* Error handler kind (see below) */ + char error_msg[4096]; + int len; + + /* If the file pointer is not valid, we use the handler on + * MPI_FILE_NULL (MPI-2, section 9.7). For now, this code assumes that + * MPI_FILE_NULL has the default handler (return). FIXME. See + * below - the set error handler uses ADIOI_DFLT_ERR_HANDLER; + */ + + /* First, get the handler and the corresponding function */ + if (mpi_fh == MPI_FILE_NULL) { + e = ADIOI_DFLT_ERR_HANDLER; + } else { + ADIO_File fh; + + fh = MPIO_File_resolve(mpi_fh); + e = fh->err_handler; + } + + /* Actually, e is just the value provide by the MPICH routines + * file_set_errhandler. This is actually a *pointer* to the + * errhandler structure. We don't know that, so we ask + * the MPICH code to translate this object into an error handler. + * kind = 0: errors are fatal + * kind = 1: errors return + * kind = 2: errors call function + */ + if (e == MPI_ERRORS_RETURN || e == MPIR_ERRORS_THROW_EXCEPTIONS || !e) { + /* FIXME: This is a hack in case no error handler was set */ + kind = 1; + c_errhandler = 0; + } else { + MPIR_Get_file_error_routine(e, &c_errhandler, &kind); + } + + /* --BEGIN ERROR HANDLING-- */ + if (MPIR_Err_is_fatal(error_code) || kind == 0) { + ADIO_File fh = MPIO_File_resolve(mpi_fh); + + MPL_snprintf(error_msg, 4096, "I/O error: "); + len = (int) strlen(error_msg); + MPIR_Err_get_string(error_code, &error_msg[len], 4096 - len, NULL); + MPIR_Abort(fh->comm, MPI_SUCCESS, error_code, error_msg); + } + /* --END ERROR HANDLING-- */ + else if (kind == 2) { + (*c_errhandler) (&mpi_fh, &error_code, 0); + } else if (kind == 3) { + MPIR_File_call_cxx_errhandler(&mpi_fh, &error_code, c_errhandler); + } + + /* kind == 1 just returns */ + return error_code; +} + +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) +{ + /* note: MPI calls inside the MPICH implementation are prefixed + * with an "N", indicating a nested call. + */ + MPI_Comm_call_errhandler(mpi_comm, error_code); + return error_code; +} diff --git a/3rd-party/romio341/mpi-io/glue/mpich/mpio_file.c b/3rd-party/romio341/mpi-io/glue/mpich/mpio_file.c new file mode 100644 index 0000000000000000000000000000000000000000..11d48d3d3b8f994e11b00b383fbfc660650012f4 --- /dev/null +++ b/3rd-party/romio341/mpi-io/glue/mpich/mpio_file.c @@ -0,0 +1,92 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#include "adio_extern.h" + +/* Hooks for allocation of MPI_File handles. + * + * Three functions are used in ROMIO for allocation/deallocation + * of MPI_File structures: + * - MPIO_File_create(size) + * - MPIO_File_resolve(mpi_fh) + * - MPIO_File_free(mpi_fh) + * + */ + +MPI_File MPIO_File_create(int size) +{ + MPI_File mpi_fh; + + mpi_fh = (MPI_File) ADIOI_Calloc(size, 1); + return mpi_fh; +} + +ADIO_File MPIO_File_resolve(MPI_File mpi_fh) +{ + return mpi_fh; +} + +void MPIO_File_free(MPI_File * mpi_fh) +{ + ADIOI_Free(*mpi_fh); + *mpi_fh = MPI_FILE_NULL; +} + +MPI_File MPIO_File_f2c(MPI_Fint fh) +{ +#ifndef INT_LT_POINTER + return (MPI_File) ((void *) fh); + /* the extra cast is to get rid of a compiler warning on Exemplar. + * The warning is because MPI_File points to a structure containing + * longlongs, which may be 8-byte aligned. But MPI_Fint itself + * may not be 8-byte aligned. */ +#else + if (!fh) + return MPI_FILE_NULL; + if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { + /* there is no way to return an error from MPI_File_f2c */ + return MPI_FILE_NULL; + } + return ADIOI_Ftable[fh]; +#endif +} + +MPI_Fint MPIO_File_c2f(MPI_File fh) +{ +#ifndef INT_LT_POINTER + return (MPI_Fint) fh; +#else + int i; + + if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE)) + return (MPI_Fint) 0; + + if (fh->fortran_handle != -1) + return fh->fortran_handle; + + if (!ADIOI_Ftable) { + ADIOI_Ftable_max = 1024; + ADIOI_Ftable = (MPI_File *) + ADIOI_Malloc(ADIOI_Ftable_max * sizeof(MPI_File)); + ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because + * MPI_FILE_NULL=0 */ + for (i = 0; i < ADIOI_Ftable_max; i++) + ADIOI_Ftable[i] = MPI_FILE_NULL; + } + if (ADIOI_Ftable_ptr == ADIOI_Ftable_max - 1) { + ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable, + (ADIOI_Ftable_max + 1024) * sizeof(MPI_File)); + for (i = ADIOI_Ftable_max; i < ADIOI_Ftable_max + 1024; i++) + ADIOI_Ftable[i] = MPI_FILE_NULL; + ADIOI_Ftable_max += 1024; + } + ADIOI_Ftable_ptr++; + ADIOI_Ftable[ADIOI_Ftable_ptr] = fh; + fh->fortran_handle = ADIOI_Ftable_ptr; + return (MPI_Fint) ADIOI_Ftable_ptr; +#endif +} diff --git a/3rd-party/romio321/mpi-io/glue/openmpi/Makefile.mk b/3rd-party/romio341/mpi-io/glue/openmpi/Makefile.mk similarity index 53% rename from 3rd-party/romio321/mpi-io/glue/openmpi/Makefile.mk rename to 3rd-party/romio341/mpi-io/glue/openmpi/Makefile.mk index ab7c15078e929e9ffd403647c66995f9ce514c19..fe866de6c357f65c61909879d4644a023fea9357 100644 --- a/3rd-party/romio321/mpi-io/glue/openmpi/Makefile.mk +++ b/3rd-party/romio341/mpi-io/glue/openmpi/Makefile.mk @@ -1,8 +1,6 @@ -## -*- Mode: Makefile; -*- -## vim: set ft=automake : ## -## (C) 2011 by Argonne National Laboratory. -## See COPYRIGHT in top-level directory. +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory ## if MPIO_GLUE_OPENMPI @@ -10,4 +8,3 @@ romio_other_sources += \ mpi-io/glue/openmpi/mpio_file.c \ mpi-io/glue/openmpi/mpio_err.c endif MPIO_GLUE_OPENMPI - diff --git a/3rd-party/romio321/mpi-io/glue/openmpi/mpio_err.c b/3rd-party/romio341/mpi-io/glue/openmpi/mpio_err.c similarity index 76% rename from 3rd-party/romio321/mpi-io/glue/openmpi/mpio_err.c rename to 3rd-party/romio341/mpi-io/glue/openmpi/mpio_err.c index 2dddaee8edd6867f1d8e6f99c1ee7b2fcad7f5e1..3c6dcc79e1ecf8a9edc87d3d8773a32575f1a0d4 100644 --- a/3rd-party/romio321/mpi-io/glue/openmpi/mpio_err.c +++ b/3rd-party/romio341/mpi-io/glue/openmpi/mpio_err.c @@ -1,11 +1,12 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ +#include <romioconf.h> #include <stdarg.h> #include <stdio.h> +#include <stdlib.h> #include "mpioimpl.h" #include "adio_extern.h" @@ -26,11 +27,10 @@ int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], buf = (char *) ADIOI_Malloc(1024); if (buf != NULL) { - idx += ADIOI_Snprintf(buf, 1023, "%s (line %d): ", fcname, line); + idx += MPL_snprintf(buf, 1023, "%s (line %d): ", fcname, line); if (specific_msg == NULL) { - ADIOI_Snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg); - } - else { + MPL_snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg); + } else { va_start(Argp, specific_msg); vsnprintf(&buf[idx], 1023 - idx, specific_msg, Argp); va_end(Argp); diff --git a/3rd-party/romio321/mpi-io/glue/openmpi/mpio_file.c b/3rd-party/romio341/mpi-io/glue/openmpi/mpio_file.c similarity index 94% rename from 3rd-party/romio321/mpi-io/glue/openmpi/mpio_file.c rename to 3rd-party/romio341/mpi-io/glue/openmpi/mpio_file.c index f0b6d5118894f9d8e2c2d4758208ef9d8050ece8..ac6490dae9e22aaa8dc0045212627991c9157062 100644 --- a/3rd-party/romio321/mpi-io/glue/openmpi/mpio_file.c +++ b/3rd-party/romio341/mpi-io/glue/openmpi/mpio_file.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * - * Copyright (C) 2004 University of Chicago. - * See COPYRIGHT notice in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" diff --git a/3rd-party/romio321/mpi-io/ioreq_c2f.c b/3rd-party/romio341/mpi-io/ioreq_c2f.c similarity index 52% rename from 3rd-party/romio321/mpi-io/ioreq_c2f.c rename to 3rd-party/romio341/mpi-io/ioreq_c2f.c index d49ebcd2b940f22357c00a04c113033a571c2ea2..0ea8a008b78046cd85e891007a0165fa47b83f7b 100644 --- a/3rd-party/romio321/mpi-io/ioreq_c2f.c +++ b/3rd-party/romio341/mpi-io/ioreq_c2f.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -25,7 +23,7 @@ #include "adio_extern.h" /*@ - MPIO_Request_c2f - Translates a C I/O-request handle to a + MPIO_Request_c2f - Translates a C I/O-request handle to a Fortran I/O-request handle Input Parameters: @@ -37,7 +35,7 @@ Return Value: #ifdef HAVE_MPI_GREQUEST MPI_Fint MPIO_Request_c2f(MPIO_Request request) { - return ((MPI_Fint)request); + return ((MPI_Fint) request); } #else @@ -47,30 +45,30 @@ MPI_Fint MPIO_Request_c2f(MPIO_Request request) return (MPI_Fint) request; #else int i; - MPID_THREADPRIV_DECL; /* We can make this test outside of the GLOBAL mutex because it does - not access any shared data */ - if ((request <= (MPIO_Request) 0) || (request->cookie != ADIOI_REQ_COOKIE)) - { - return (MPI_Fint) 0; + * not access any shared data */ + if ((request <= (MPIO_Request) 0) || (request->cookie != ADIOI_REQ_COOKIE)) { + return (MPI_Fint) 0; } ROMIO_THREAD_CS_ENTER(); if (!ADIOI_Reqtable) { - ADIOI_Reqtable_max = 1024; - ADIOI_Reqtable = (MPIO_Request *) - ADIOI_Malloc(ADIOI_Reqtable_max*sizeof(MPIO_Request)); - ADIOI_Reqtable_ptr = 0; /* 0 can't be used though, because - MPIO_REQUEST_NULL=0 */ - for (i=0; i<ADIOI_Reqtable_max; i++) ADIOI_Reqtable[i] = MPIO_REQUEST_NULL; + ADIOI_Reqtable_max = 1024; + ADIOI_Reqtable = (MPIO_Request *) + ADIOI_Malloc(ADIOI_Reqtable_max * sizeof(MPIO_Request)); + ADIOI_Reqtable_ptr = 0; /* 0 can't be used though, because + * MPIO_REQUEST_NULL=0 */ + for (i = 0; i < ADIOI_Reqtable_max; i++) + ADIOI_Reqtable[i] = MPIO_REQUEST_NULL; } - if (ADIOI_Reqtable_ptr == ADIOI_Reqtable_max-1) { - ADIOI_Reqtable = (MPIO_Request *) ADIOI_Realloc(ADIOI_Reqtable, - (ADIOI_Reqtable_max+1024)*sizeof(MPIO_Request)); - for (i=ADIOI_Reqtable_max; i<ADIOI_Reqtable_max+1024; i++) - ADIOI_Reqtable[i] = MPIO_REQUEST_NULL; - ADIOI_Reqtable_max += 1024; + if (ADIOI_Reqtable_ptr == ADIOI_Reqtable_max - 1) { + ADIOI_Reqtable = (MPIO_Request *) ADIOI_Realloc(ADIOI_Reqtable, + (ADIOI_Reqtable_max + + 1024) * sizeof(MPIO_Request)); + for (i = ADIOI_Reqtable_max; i < ADIOI_Reqtable_max + 1024; i++) + ADIOI_Reqtable[i] = MPIO_REQUEST_NULL; + ADIOI_Reqtable_max += 1024; } ADIOI_Reqtable_ptr++; ADIOI_Reqtable[ADIOI_Reqtable_ptr] = request; diff --git a/3rd-party/romio321/mpi-io/ioreq_f2c.c b/3rd-party/romio341/mpi-io/ioreq_f2c.c similarity index 68% rename from 3rd-party/romio321/mpi-io/ioreq_f2c.c rename to 3rd-party/romio341/mpi-io/ioreq_f2c.c index a58e4a2e28208c06afeab5c910b7a77465544537..46ddb063537ba4f77027a00d29fd67530bb40e83 100644 --- a/3rd-party/romio321/mpi-io/ioreq_f2c.c +++ b/3rd-party/romio341/mpi-io/ioreq_f2c.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -25,7 +23,7 @@ #include "adio_extern.h" /*@ - MPIO_Request_f2c - Translates a Fortran I/O-request handle to + MPIO_Request_f2c - Translates a Fortran I/O-request handle to a C I/O-request handle Input Parameters: @@ -35,36 +33,35 @@ Return Value: C I/O-request handle (handle) @*/ #ifdef HAVE_MPI_GREQUEST -MPIO_Request MPIO_Request_f2c(MPI_Fint request) { - return((MPIO_Request) request); +MPIO_Request MPIO_Request_f2c(MPI_Fint request) +{ + return ((MPIO_Request) request); } #else MPIO_Request MPIO_Request_f2c(MPI_Fint request) { int error_code; static char myname[] = "MPIO_REQUEST_F2C"; - MPID_THREADPRIV_DECL; #ifndef INT_LT_POINTER return (MPIO_Request) request; #else ROMIO_THREAD_CS_ENTER(); - + if (!request) { - return MPIO_REQUEST_NULL; + return MPIO_REQUEST_NULL; } /* --BEGIN ERROR HANDLING-- */ if ((request < 0) || (request > ADIOI_Reqtable_ptr)) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_REQUEST, - "**request", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - return MPIO_REQUEST_NULL; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + return MPIO_REQUEST_NULL; } /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return ADIOI_Reqtable[request]; #endif diff --git a/3rd-party/romio321/mpi-io/iotest.c b/3rd-party/romio341/mpi-io/iotest.c similarity index 54% rename from 3rd-party/romio321/mpi-io/iotest.c rename to 3rd-party/romio341/mpi-io/iotest.c index 42bc8a3ae5e12f0df05dc4983a1156b5ea4a61be..1c15633b847ba047dfb35cf5ed379fed2fc8bf32 100644 --- a/3rd-party/romio321/mpi-io/iotest.c +++ b/3rd-party/romio341/mpi-io/iotest.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -27,7 +25,7 @@ /*@ MPIO_Test - Test the completion of a nonblocking read or write - + Input Parameters: . request - request object (handle) @@ -38,57 +36,53 @@ Output Parameters: .N fortran @*/ #ifdef HAVE_MPI_GREQUEST -int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) +int MPIO_Test(MPIO_Request * request, int *flag, MPI_Status * status) { - return (MPI_Test(request, flag, status)); + return (MPI_Test(request, flag, status)); } #else -int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) +int MPIO_Test(MPIO_Request * request, int *flag, MPI_Status * status) { int error_code; static char myname[] = "MPIO_TEST"; - MPID_THREADPRIV_DECL; #ifdef MPI_hpux int fl_xmpi; if (*request != MPIO_REQUEST_NULL) { - HPMP_IO_WSTART(fl_xmpi, BLKMPIOTEST, TRDTSYSTEM, (*request)->fd); + HPMP_IO_WSTART(fl_xmpi, BLKMPIOTEST, TRDTSYSTEM, (*request)->fd); } #endif /* MPI_hpux */ ROMIO_THREAD_CS_ENTER(); if (*request == MPIO_REQUEST_NULL) { - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ - if ((*request < (MPIO_Request) 0) || - ((*request)->cookie != ADIOI_REQ_COOKIE)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_REQUEST, - "**request", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + if ((*request < (MPIO_Request) 0) || ((*request)->cookie != ADIOI_REQ_COOKIE)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ switch ((*request)->optype) { - case ADIOI_READ: - *flag = ADIO_ReadDone(request, status, &error_code); - break; - case ADIOI_WRITE: - *flag = ADIO_WriteDone(request, status, &error_code); - break; + case ADIOI_READ: + *flag = ADIO_ReadDone(request, status, &error_code); + break; + case ADIOI_WRITE: + *flag = ADIO_WriteDone(request, status, &error_code); + break; } #ifdef MPI_hpux HPMP_IO_WEND(fl_xmpi); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio341/mpi-io/iotestall.c b/3rd-party/romio341/mpi-io/iotestall.c new file mode 100644 index 0000000000000000000000000000000000000000..767e53c7ac574b2f7b3b1f1ab8bb7b08af9d38ae --- /dev/null +++ b/3rd-party/romio341/mpi-io/iotestall.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Testall = PMPIO_Testall +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Testall MPIO_Testall +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Testall as PMPIO_Testall +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Testall(int count, MPIO_Request requests[], int *flag, MPI_Status statuses[]) +{ + int done, i, err; + + ROMIO_THREAD_CS_ENTER(); + if (count == 1) { + err = MPIO_Test(requests, flag, statuses); + goto fn_exit; + } + + /* This is actually very difficult to do. We can't use MPIO_Test, + * since we must change the requests only if *ALL* requests are complete + */ + /* FIXME: THIS IS NOT CORRECT (see above). But most applications won't + * care */ + done = 1; + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], flag, &statuses[i]); + if (!*flag) + done = 0; + if (err) + goto fn_exit; + } else { +#ifdef MPICH + /* need to set empty status */ + if (statuses != MPI_STATUSES_IGNORE) { + statuses[i].MPI_SOURCE = MPI_ANY_SOURCE; + statuses[i].MPI_TAG = MPI_ANY_TAG; + MPIR_STATUS_SET_COUNT(statuses[i], 0); + MPIR_STATUS_SET_CANCEL_BIT(statuses[i], 0); + } +#else + ; +#endif + } + } + + *flag = done; + + err = MPI_SUCCESS; + fn_exit: + ROMIO_THREAD_CS_EXIT(); + return err; +} diff --git a/3rd-party/romio321/mpi-io/iotestany.c b/3rd-party/romio341/mpi-io/iotestany.c similarity index 50% rename from 3rd-party/romio321/mpi-io/iotestany.c rename to 3rd-party/romio341/mpi-io/iotestany.c index eac6197ae4eeb2949a9a2da8afaac2e1f42a9ac2..bdf5f9d21867f2a9535d0ce1003e263c05d8c7fa 100644 --- a/3rd-party/romio321/mpi-io/iotestany.c +++ b/3rd-party/romio341/mpi-io/iotestany.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 2003 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -28,54 +26,54 @@ requests. */ -int MPIO_Testany(int count, MPIO_Request requests[], int *index, - int *flag, MPI_Status *status) +int MPIO_Testany(int count, MPIO_Request requests[], int *index, int *flag, MPI_Status * status) { - int i, err; - MPID_THREADPRIV_DECL; + int i, err; ROMIO_THREAD_CS_ENTER(); if (count == 1) { - err = MPIO_Test( requests, flag, status ); - if (!err) *index = 0; - goto fn_exit; + err = MPIO_Test(requests, flag, status); + if (!err) + *index = 0; + goto fn_exit; } /* Check for no active requests */ - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - break; - } + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + break; + } } if (i == count) { - *index = MPI_UNDEFINED; + *index = MPI_UNDEFINED; #ifdef MPICH - /* need to set empty status */ - if (status != MPI_STATUS_IGNORE) { - status->MPI_SOURCE = MPI_ANY_SOURCE; - status->MPI_TAG = MPI_ANY_TAG; + /* need to set empty status */ + if (status != MPI_STATUS_IGNORE) { + status->MPI_SOURCE = MPI_ANY_SOURCE; + status->MPI_TAG = MPI_ANY_TAG; MPIR_STATUS_SET_COUNT(*status, 0); MPIR_STATUS_SET_CANCEL_BIT(*status, 0); - } + } #endif - err = MPI_SUCCESS; - goto fn_exit; + err = MPI_SUCCESS; + goto fn_exit; } err = MPI_SUCCESS; - for (i=0; i<count; i++) { - if (requests[i] != MPIO_REQUEST_NULL) { - err = MPIO_Test( &requests[i], flag, status ); - if (*flag) { - if (!err) *index = i; - break; - } - } + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], flag, status); + if (*flag) { + if (!err) + *index = i; + break; + } + } } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return err; } diff --git a/3rd-party/romio341/mpi-io/iotestsome.c b/3rd-party/romio341/mpi-io/iotestsome.c new file mode 100644 index 0000000000000000000000000000000000000000..8e664fb7b4885b0d1dcb551fa1c351642f5958be --- /dev/null +++ b/3rd-party/romio341/mpi-io/iotestsome.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Testsome = PMPIO_Testsome +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Testsome MPIO_Testsome +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Testsome as PMPIO_Testsome +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount, + int indices[], MPI_Status * statuses) +{ + int i, err; + int flag; + + ROMIO_THREAD_CS_ENTER(); + + if (count == 1) { + err = MPIO_Test(requests, &flag, statuses); + if (!err) { + if (flag) { + indices[0] = 0; + *outcount = 1; + } else { + *outcount = 0; + } + } + goto fn_exit; + } + + /* Check for no active requests */ + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + break; + } + } + if (i == count) { + *outcount = MPI_UNDEFINED; + err = MPI_SUCCESS; + goto fn_exit; + } + + err = MPI_SUCCESS; + *outcount = 0; + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], &flag, statuses); + if (flag) { + if (!err) { + indices[0] = i; + indices++; + statuses++; + *outcount = *outcount + 1; + } + } + } + } + + fn_exit: + + ROMIO_THREAD_CS_EXIT(); + return err; +} diff --git a/3rd-party/romio321/mpi-io/iowait.c b/3rd-party/romio341/mpi-io/iowait.c similarity index 55% rename from 3rd-party/romio321/mpi-io/iowait.c rename to 3rd-party/romio341/mpi-io/iowait.c index 4d383c8cd8141a7a83e61a3a8875fed18177050e..a624d9763f41b7901d2d8e4322d1f12c167314dd 100644 --- a/3rd-party/romio321/mpi-io/iowait.c +++ b/3rd-party/romio341/mpi-io/iowait.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -37,59 +35,55 @@ Output Parameters: .N fortran @*/ #ifdef HAVE_MPI_GREQUEST -int MPIO_Wait(MPIO_Request *request, MPI_Status *status) +int MPIO_Wait(MPIO_Request * request, MPI_Status * status) { - return(MPI_Wait(request, status)); + return (MPI_Wait(request, status)); } #else -int MPIO_Wait(MPIO_Request *request, MPI_Status *status) +int MPIO_Wait(MPIO_Request * request, MPI_Status * status) { int error_code; static char myname[] = "MPIO_WAIT"; - MPID_THREADPRIV_DECL; #ifdef MPI_hpux int fl_xmpi; if (*request != MPIO_REQUEST_NULL) { - HPMP_IO_WSTART(fl_xmpi, BLKMPIOWAIT, TRDTBLOCK, (*request)->fd); + HPMP_IO_WSTART(fl_xmpi, BLKMPIOWAIT, TRDTBLOCK, (*request)->fd); } #endif /* MPI_hpux */ ROMIO_THREAD_CS_ENTER(); if (*request == MPIO_REQUEST_NULL) { - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ - if ((*request < (MPIO_Request) 0) || - ((*request)->cookie != ADIOI_REQ_COOKIE)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_REQUEST, - "**request", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + if ((*request < (MPIO_Request) 0) || ((*request)->cookie != ADIOI_REQ_COOKIE)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ switch ((*request)->optype) { - case ADIOI_READ: - ADIO_ReadComplete(request, status, &error_code); - break; - case ADIOI_WRITE: - ADIO_WriteComplete(request, status, &error_code); - break; + case ADIOI_READ: + ADIO_ReadComplete(request, status, &error_code); + break; + case ADIOI_WRITE: + ADIO_WriteComplete(request, status, &error_code); + break; } #ifdef MPI_hpux HPMP_IO_WEND(fl_xmpi); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio341/mpi-io/iowaitall.c b/3rd-party/romio341/mpi-io/iowaitall.c new file mode 100644 index 0000000000000000000000000000000000000000..83bb4f4a97e3d9d3be23c953b070f5f64854a72e --- /dev/null +++ b/3rd-party/romio341/mpi-io/iowaitall.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Waitall = PMPIO_Waitall +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Waitall MPIO_Waitall +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Waitall as PMPIO_Waitall +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitall(int count, MPIO_Request requests[], MPI_Status statuses[]) +{ + int notdone, i, flag, err; + + ROMIO_THREAD_CS_ENTER(); + + if (count == 1) { + err = MPIO_Wait(requests, statuses); + goto fn_exit; + } + + + do { + notdone = 0; + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], &flag, &statuses[i]); + if (!flag) + notdone = 1; + if (err) + goto fn_exit; + } else { +#ifdef MPICH + /* need to set empty status */ + if (statuses != MPI_STATUSES_IGNORE) { + statuses[i].MPI_SOURCE = MPI_ANY_SOURCE; + statuses[i].MPI_TAG = MPI_ANY_TAG; + MPIR_STATUS_SET_COUNT(statuses[i], 0); + MPIR_STATUS_SET_CANCEL_BIT(statuses[i], 0); + } +#else + ; +#endif + } + } + } while (notdone); + + err = MPI_SUCCESS; + fn_exit: + + ROMIO_THREAD_CS_EXIT(); + return err; +} diff --git a/3rd-party/romio341/mpi-io/iowaitany.c b/3rd-party/romio341/mpi-io/iowaitany.c new file mode 100644 index 0000000000000000000000000000000000000000..b287af613507fa7d57d2f5118fa4a5ca1c77355f --- /dev/null +++ b/3rd-party/romio341/mpi-io/iowaitany.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Waitany = PMPIO_Waitany +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Waitany MPIO_Waitany +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Waitany as PMPIO_Waitany +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitany(int count, MPIO_Request requests[], int *index, MPI_Status * status) +{ + int i, flag, err; + + ROMIO_THREAD_CS_ENTER(); + + if (count == 1) { + err = MPIO_Wait(requests, status); + if (!err) + *index = 0; + goto fn_exit; + } + + /* Check for no active requests */ + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + break; + } + } + if (i == count) { + *index = MPI_UNDEFINED; +#ifdef MPICH + /* need to set empty status */ + if (status != MPI_STATUS_IGNORE) { + status->MPI_SOURCE = MPI_ANY_SOURCE; + status->MPI_TAG = MPI_ANY_TAG; + MPIR_STATUS_SET_COUNT(*status, 0); + MPIR_STATUS_SET_CANCEL_BIT(*status, 0); + } +#endif + err = MPI_SUCCESS; + goto fn_exit; + } + + err = MPI_SUCCESS; + do { + flag = 0; + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], &flag, status); + if (flag) { + if (!err) + *index = i; + break; + } + } + } + } while (flag == 0); + + fn_exit: + ROMIO_THREAD_CS_EXIT(); + + return err; +} diff --git a/3rd-party/romio341/mpi-io/iowaitsome.c b/3rd-party/romio341/mpi-io/iowaitsome.c new file mode 100644 index 0000000000000000000000000000000000000000..a552f4beb52661aa7a4ef016146c9499dbeceed1 --- /dev/null +++ b/3rd-party/romio341/mpi-io/iowaitsome.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Waitsome = PMPIO_Waitsome +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Waitsome MPIO_Waitsome +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Waitsome as PMPIO_Waitsome +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount, + int indices[], MPI_Status * statuses) +{ + int i, flag, err; + + ROMIO_THREAD_CS_ENTER(); + + if (count == 1) { + err = MPIO_Wait(requests, statuses); + if (!err) { + *outcount = 1; + indices[0] = 0; + } + goto fn_exit; + } + + /* Check for no active requests */ + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + break; + } + } + if (i == count) { + *outcount = MPI_UNDEFINED; + err = MPI_SUCCESS; + goto fn_exit; + } + + err = MPI_SUCCESS; + *outcount = 0; + do { + for (i = 0; i < count; i++) { + if (requests[i] != MPIO_REQUEST_NULL) { + err = MPIO_Test(&requests[i], &flag, statuses); + if (flag) { + if (!err) { + indices[0] = i; + indices++; + statuses++; + *outcount = *outcount + 1; + } + } + } + } + } while (*outcount == 0); + + fn_exit: + ROMIO_THREAD_CS_EXIT(); + return err; +} diff --git a/3rd-party/romio321/mpi-io/iread.c b/3rd-party/romio341/mpi-io/iread.c similarity index 64% rename from 3rd-party/romio321/mpi-io/iread.c rename to 3rd-party/romio341/mpi-io/iread.c index 4b23a11dee0ecae0384c7ffcada371466395640a..e348f678da4cb79ab923bb4ebe4bf782e8bbebe7 100644 --- a/3rd-party/romio321/mpi-io/iread.c +++ b/3rd-party/romio341/mpi-io/iread.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,8 +15,8 @@ #pragma _CRI duplicate MPI_File_iread as PMPI_File_iread /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPIO_Request *request) - __attribute__((weak,alias("PMPI_File_iread"))); +int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPIO_Request * request) + __attribute__ ((weak, alias("PMPI_File_iread"))); #endif /* Include mapping from MPI->PMPI */ @@ -44,24 +42,23 @@ Output Parameters: .N fortran @*/ -int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request) +int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request * request) { - int error_code=MPI_SUCCESS; + int error_code = MPI_SUCCESS; static char myname[] = "MPI_FILE_IREAD"; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEIREAD, TRDTSYSTEM, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEIREAD, TRDTSYSTEM, fh, datatype, count); #endif /* MPI_hpux */ error_code = MPIOI_File_iread(fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, - buf, count, datatype, myname, request); - + buf, count, datatype, myname, request); + /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(fh, error_code); + error_code = MPIO_Err_return_file(fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux @@ -74,14 +71,14 @@ int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *buf, int count, - MPI_Datatype datatype, char *myname, MPI_Request *request) + MPI_Datatype datatype, char *myname, MPI_Request * request) { int error_code, buftype_is_contig, filetype_is_contig; MPI_Count datatype_size; ADIO_Status status; ADIO_File adio_fh; ADIO_Offset off, bufsize; - MPI_Offset nbytes=0; + MPI_Offset nbytes = 0; ROMIO_THREAD_CS_ENTER(); @@ -93,11 +90,10 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -116,44 +112,41 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); if (buftype_is_contig && filetype_is_contig) { - /* convert count and offset to bytes */ - bufsize = datatype_size * count; + /* convert count and offset to bytes */ + bufsize = datatype_size * count; - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = adio_fh->disp + adio_fh->etype_size * offset; - } - else { - off = adio_fh->fp_ind; - } + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = adio_fh->disp + adio_fh->etype_size * offset; + } else { + off = adio_fh->fp_ind; + } if (!(adio_fh->atomicity)) - ADIO_IreadContig(adio_fh, buf, count, datatype, file_ptr_type, - off, request, &error_code); + ADIO_IreadContig(adio_fh, buf, count, datatype, file_ptr_type, + off, request, &error_code); else { /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - if (ADIO_Feature(adio_fh, ADIO_LOCKS)) - { + * operations, lock (exclusive) and call blocking routine */ + if (ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - } + } ADIO_ReadContig(adio_fh, buf, count, datatype, file_ptr_type, - off, &status, &error_code); + off, &status, &error_code); - if (ADIO_Feature(adio_fh, ADIO_LOCKS)) - { + if (ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - if (error_code == MPI_SUCCESS) { - nbytes = count*datatype_size; - } - MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); + } + if (error_code == MPI_SUCCESS) { + nbytes = count * datatype_size; + } + MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); } - } - else ADIO_IreadStrided(adio_fh, buf, count, datatype, file_ptr_type, - offset, request, &error_code); + } else + ADIO_IreadStrided(adio_fh, buf, count, datatype, file_ptr_type, + offset, request, &error_code); -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/iread_all.c b/3rd-party/romio341/mpi-io/iread_all.c similarity index 77% rename from 3rd-party/romio321/mpi-io/iread_all.c rename to 3rd-party/romio341/mpi-io/iread_all.c index 00a0640f5a4066beea0f67374970f1b4d2c33712..eca932790cad1839a991c69e5746be909b70a4b6 100644 --- a/3rd-party/romio321/mpi-io/iread_all.c +++ b/3rd-party/romio341/mpi-io/iread_all.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,8 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Request *request) - __attribute__((weak,alias("PMPI_File_iread_all"))); + MPI_Request * request) + __attribute__ ((weak, alias("PMPI_File_iread_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,7 +44,7 @@ Output Parameters: .N fortran @*/ int MPI_File_iread_all(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Request *request) + MPI_Datatype datatype, MPI_Request * request) { int error_code; static char myname[] = "MPI_FILE_IREAD_ALL"; @@ -55,9 +54,8 @@ int MPI_File_iread_all(MPI_File fh, void *buf, int count, HPMP_IO_START(fl_xmpi, BLKMPIFILEREADALL, TRDTBLOCK, fh, datatype, count); #endif /* MPI_hpux */ - error_code = MPIOI_File_iread_all(fh, (MPI_Offset)0, - ADIO_INDIVIDUAL, buf, - count, datatype, myname, request); + error_code = MPIOI_File_iread_all(fh, (MPI_Offset) 0, + ADIO_INDIVIDUAL, buf, count, datatype, myname, request); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) { @@ -76,18 +74,15 @@ int MPI_File_iread_all(MPI_File fh, void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_iread_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request) + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -100,8 +95,7 @@ int MPIOI_File_iread_all(MPI_File fh, if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); error_code = MPIO_Err_return_file(adio_fh, error_code); goto fn_exit; } @@ -123,7 +117,7 @@ int MPIOI_File_iread_all(MPI_File fh, if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); + e32_buf = ADIOI_Malloc(e32_size * count); xbuf = e32_buf; } @@ -132,16 +126,15 @@ int MPIOI_File_iread_all(MPI_File fh, /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/iread_at.c b/3rd-party/romio341/mpi-io/iread_at.c similarity index 77% rename from 3rd-party/romio321/mpi-io/iread_at.c rename to 3rd-party/romio341/mpi-io/iread_at.c index 29bda8462f1da7e3dea082c8133dbaab76f97a5d..3e1519266457877693c3e1d9566076f3a4f572cd 100644 --- a/3rd-party/romio321/mpi-io/iread_at.c +++ b/3rd-party/romio341/mpi-io/iread_at.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) __attribute__((weak,alias("PMPI_File_iread_at"))); + MPIO_Request * request) __attribute__ ((weak, alias("PMPI_File_iread_at"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,8 +43,8 @@ Output Parameters: .N fortran @*/ -int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) +int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, + MPIO_Request * request) { int error_code; static char myname[] = "MPI_FILE_IREAD_AT"; @@ -54,17 +52,16 @@ int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_ #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADAT, TRDTSYSTEM, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADAT, TRDTSYSTEM, fh, datatype, count); #endif /* MPI_hpux */ error_code = MPIOI_File_iread(fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, request); + count, datatype, myname, request); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(fh, error_code); + error_code = MPIO_Err_return_file(fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux diff --git a/3rd-party/romio321/mpi-io/iread_atall.c b/3rd-party/romio341/mpi-io/iread_atall.c similarity index 75% rename from 3rd-party/romio321/mpi-io/iread_atall.c rename to 3rd-party/romio341/mpi-io/iread_atall.c index da9326a5b0d99ea0bafb4e91c583e5256747ad6d..d7965aa45a340c545078d8f1d15c692732a50f54 100644 --- a/3rd-party/romio321/mpi-io/iread_atall.c +++ b/3rd-party/romio341/mpi-io/iread_atall.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -16,9 +15,9 @@ #pragma _CRI duplicate MPI_File_iread_at_all as PMPI_File_iread_at_all /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void * buf, int count, - MPI_Datatype datatype, MPI_Request *request) - __attribute__((weak,alias("PMPI_File_iread_at_all"))); +int MPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, + MPI_Datatype datatype, MPI_Request * request) + __attribute__ ((weak, alias("PMPI_File_iread_at_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -46,24 +45,22 @@ Output Parameters: .N fortran @*/ int MPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPI_Request *request) + int count, MPI_Datatype datatype, MPI_Request * request) { int error_code; static char myname[] = "MPI_FILE_IREAD_AT_ALL"; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADATALL, TRDTBLOCK, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADATALL, TRDTBLOCK, fh, datatype, count); #endif /* MPI_hpux */ error_code = MPIOI_File_iread_all(fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, request); + count, datatype, myname, request); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(fh, error_code); + error_code = MPIO_Err_return_file(fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux diff --git a/3rd-party/romio321/mpi-io/iread_sh.c b/3rd-party/romio341/mpi-io/iread_sh.c similarity index 63% rename from 3rd-party/romio321/mpi-io/iread_sh.c rename to 3rd-party/romio341/mpi-io/iread_sh.c index bd6431305904f6304519848314493b0c9a45b132..31409920db5897d55cab35d4d819191f230cc097 100644 --- a/3rd-party/romio321/mpi-io/iread_sh.c +++ b/3rd-party/romio341/mpi-io/iread_sh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iread_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) __attribute__((weak,alias("PMPI_File_iread_shared"))); + MPIO_Request * request) + __attribute__ ((weak, alias("PMPI_File_iread_shared"))); #endif /* Include mapping from MPI->PMPI */ @@ -44,7 +43,7 @@ Output Parameters: .N fortran @*/ int MPI_File_iread_shared(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Request *request) + MPI_Datatype datatype, MPI_Request * request) { int error_code, buftype_is_contig, filetype_is_contig; ADIO_Offset bufsize; @@ -53,7 +52,7 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count, MPI_Count datatype_size, incr; MPI_Status status; ADIO_Offset off, shared_fp; - MPI_Offset nbytes=0; + MPI_Offset nbytes = 0; ROMIO_THREAD_CS_ENTER(); @@ -78,62 +77,53 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count, ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - /* note: ADIO_Get_shared_fp should have set up error code already? */ - MPIO_Err_return_file(adio_fh, error_code); + if (error_code != MPI_SUCCESS) { + /* note: ADIO_Get_shared_fp should have set up error code already? */ + MPIO_Err_return_file(adio_fh, error_code); } /* --END ERROR HANDLING-- */ - if (buftype_is_contig && filetype_is_contig) - { - /* convert count and shared_fp to bytes */ - bufsize = datatype_size * count; - off = adio_fh->disp + adio_fh->etype_size * shared_fp; - if (!(adio_fh->atomicity)) - { - ADIO_IreadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, request, &error_code); - } - else - { + if (buftype_is_contig && filetype_is_contig) { + /* convert count and shared_fp to bytes */ + bufsize = datatype_size * count; + off = adio_fh->disp + adio_fh->etype_size * shared_fp; + if (!(adio_fh->atomicity)) { + ADIO_IreadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, request, &error_code); + } else { /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ + * operations, lock (exclusive) and call blocking routine */ - if (adio_fh->file_system != ADIO_NFS) - { + if (adio_fh->file_system != ADIO_NFS) { ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - } + } ADIO_ReadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, &status, &error_code); + off, &status, &error_code); - if (adio_fh->file_system != ADIO_NFS) - { + if (adio_fh->file_system != ADIO_NFS) { ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - if (error_code == MPI_SUCCESS){ - nbytes = count * datatype_size; - } - MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); + } + if (error_code == MPI_SUCCESS) { + nbytes = count * datatype_size; + } + MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); } - } - else - { - ADIO_IreadStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, request, &error_code); + } else { + ADIO_IreadStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, request, &error_code); } /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/iwrite.c b/3rd-party/romio341/mpi-io/iwrite.c similarity index 61% rename from 3rd-party/romio321/mpi-io/iwrite.c rename to 3rd-party/romio341/mpi-io/iwrite.c index ae6c6aec59c56f4c3b927d44f71428ebcc567b0c..760cf0acbaa876a9465b31f1b3549817474c11f4 100644 --- a/3rd-party/romio321/mpi-io/iwrite.c +++ b/3rd-party/romio341/mpi-io/iwrite.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iwrite(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) __attribute__((weak,alias("PMPI_File_iwrite"))); + MPIO_Request * request) __attribute__ ((weak, alias("PMPI_File_iwrite"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,24 +43,23 @@ Output Parameters: #endif int MPI_File_iwrite(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Request *request) + MPI_Datatype datatype, MPI_Request * request) { - int error_code=MPI_SUCCESS; + int error_code = MPI_SUCCESS; static char myname[] = "MPI_FILE_IWRITE"; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITE, TRDTSYSTEM, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITE, TRDTSYSTEM, fh, datatype, count); #endif /* MPI_hpux */ error_code = MPIOI_File_iwrite(fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, - buf, count, datatype, myname, request); + buf, count, datatype, myname, request); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(fh, error_code); + error_code = MPIO_Err_return_file(fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux @@ -75,20 +72,17 @@ int MPI_File_iwrite(MPI_File fh, ROMIO_CONST void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_iwrite(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request) + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request) { int error_code, buftype_is_contig, filetype_is_contig; MPI_Count datatype_size; ADIO_Status status; ADIO_Offset off, bufsize; ADIO_File adio_fh; - MPI_Offset nbytes=0; + MPI_Offset nbytes = 0; ROMIO_THREAD_CS_ENTER(); adio_fh = MPIO_File_resolve(fh); @@ -99,11 +93,10 @@ int MPIOI_File_iwrite(MPI_File fh, MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -118,50 +111,45 @@ int MPIOI_File_iwrite(MPI_File fh, ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(adio_fh->filetype, &filetype_is_contig); - + ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); if (buftype_is_contig && filetype_is_contig) { - /* convert sizes to bytes */ - bufsize = datatype_size * count; - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = adio_fh->disp + adio_fh->etype_size * offset; - } - else { - off = adio_fh->fp_ind; - } + /* convert sizes to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = adio_fh->disp + adio_fh->etype_size * offset; + } else { + off = adio_fh->fp_ind; + } if (!(adio_fh->atomicity)) { - ADIO_IwriteContig(adio_fh, buf, count, datatype, file_ptr_type, - off, request, &error_code); - } - else { + ADIO_IwriteContig(adio_fh, buf, count, datatype, file_ptr_type, + off, request, &error_code); + } else { /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - if (ADIO_Feature(adio_fh, ADIO_LOCKS) ) - { + * operations, lock (exclusive) and call blocking routine */ + if (ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - } + } ADIO_WriteContig(adio_fh, buf, count, datatype, file_ptr_type, off, - &status, &error_code); + &status, &error_code); - if (ADIO_Feature(adio_fh, ADIO_LOCKS) ) - { + if (ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - if (error_code == MPI_SUCCESS) { - nbytes = count * datatype_size; - } - - MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); - } - } - else { - ADIO_IwriteStrided(adio_fh, buf, count, datatype, file_ptr_type, - offset, request, &error_code); + } + if (error_code == MPI_SUCCESS) { + nbytes = count * datatype_size; + } + + MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request); + } + } else { + ADIO_IwriteStrided(adio_fh, buf, count, datatype, file_ptr_type, + offset, request, &error_code); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/iwrite_all.c b/3rd-party/romio341/mpi-io/iwrite_all.c similarity index 76% rename from 3rd-party/romio321/mpi-io/iwrite_all.c rename to 3rd-party/romio341/mpi-io/iwrite_all.c index 9f486e700f57a0125153eb25abefe7128a220e6b..dbea4f823da9311e5ad849b8d4596d757f302ab8 100644 --- a/3rd-party/romio321/mpi-io/iwrite_all.c +++ b/3rd-party/romio341/mpi-io/iwrite_all.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,8 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iwrite_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Request *request) - __attribute__((weak,alias("PMPI_File_iwrite_all"))); + MPI_Request * request) + __attribute__ ((weak, alias("PMPI_File_iwrite_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,7 +44,7 @@ Output Parameters: .N fortran @*/ int MPI_File_iwrite_all(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Request *request) + MPI_Datatype datatype, MPI_Request * request) { int error_code; static char myname[] = "MPI_FILE_IWRITE_ALL"; @@ -56,8 +55,7 @@ int MPI_File_iwrite_all(MPI_File fh, ROMIO_CONST void *buf, int count, #endif /* MPI_hpux */ error_code = MPIOI_File_iwrite_all(fh, (MPI_Offset) 0, - ADIO_INDIVIDUAL, buf, - count, datatype, myname, request); + ADIO_INDIVIDUAL, buf, count, datatype, myname, request); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); @@ -70,19 +68,16 @@ int MPI_File_iwrite_all(MPI_File fh, ROMIO_CONST void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_iwrite_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Request *request) + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Request * request) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *e32buf=NULL; - const void *xbuf=NULL; + void *e32buf = NULL; + const void *xbuf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -93,11 +88,9 @@ int MPIOI_File_iwrite_all(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); error_code = MPIO_Err_return_file(adio_fh, error_code); goto fn_exit; } @@ -126,11 +119,12 @@ int MPIOI_File_iwrite_all(MPI_File fh, /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if (e32buf != NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/iwrite_at.c b/3rd-party/romio341/mpi-io/iwrite_at.c similarity index 72% rename from 3rd-party/romio321/mpi-io/iwrite_at.c rename to 3rd-party/romio341/mpi-io/iwrite_at.c index 10862bd0334b4d3149e0c31f12225db1bbb8be44..749b16076695a68e2e1945ca4e0cd3b7a8177fb8 100644 --- a/3rd-party/romio321/mpi-io/iwrite_at.c +++ b/3rd-party/romio341/mpi-io/iwrite_at.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,8 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, const void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) - __attribute__((weak,alias("PMPI_File_iwrite_at"))); + MPI_Datatype datatype, MPIO_Request * request) + __attribute__ ((weak, alias("PMPI_File_iwrite_at"))); #endif /* Include mapping from MPI->PMPI */ @@ -47,8 +45,7 @@ Output Parameters: #endif int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, - int count, MPI_Datatype datatype, - MPIO_Request *request) + int count, MPI_Datatype datatype, MPIO_Request * request) { int error_code; ADIO_File adio_fh; @@ -57,24 +54,22 @@ int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITEAT, TRDTSYSTEM, - fh, datatype, count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITEAT, TRDTSYSTEM, fh, datatype, count); #endif /* MPI_hpux */ adio_fh = MPIO_File_resolve(fh); error_code = MPIOI_File_iwrite(adio_fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, request); + count, datatype, myname, request); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count) #endif /* MPI_hpux */ - - return error_code; + return error_code; } diff --git a/3rd-party/romio321/mpi-io/iwrite_atall.c b/3rd-party/romio341/mpi-io/iwrite_atall.c similarity index 77% rename from 3rd-party/romio321/mpi-io/iwrite_atall.c rename to 3rd-party/romio341/mpi-io/iwrite_atall.c index 9c0564efd8d915ef9c0af0333fa0bee25629a7c2..9f0fcbe97ff39149053497e4b292263461368b91 100644 --- a/3rd-party/romio321/mpi-io/iwrite_atall.c +++ b/3rd-party/romio341/mpi-io/iwrite_atall.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2014 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,8 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count, - MPI_Datatype datatype, MPI_Request *request) - __attribute__((weak,alias("PMPI_File_iwrite_at_all"))); + MPI_Datatype datatype, MPI_Request * request) + __attribute__ ((weak, alias("PMPI_File_iwrite_at_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -46,8 +45,7 @@ Output Parameters: .N fortran @*/ int MPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, - int count, MPI_Datatype datatype, - MPI_Request *request) + int count, MPI_Datatype datatype, MPI_Request * request) { int error_code; static char myname[] = "MPI_FILE_IWRITE_AT_ALL"; @@ -58,11 +56,10 @@ int MPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf #endif /* MPI_hpux */ error_code = MPIOI_File_iwrite_all(fh, offset, ADIO_EXPLICIT_OFFSET, - buf, count, datatype, myname, request); + buf, count, datatype, myname, request); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); #endif /* MPI_hpux */ return error_code; } - diff --git a/3rd-party/romio321/mpi-io/iwrite_sh.c b/3rd-party/romio341/mpi-io/iwrite_sh.c similarity index 71% rename from 3rd-party/romio321/mpi-io/iwrite_sh.c rename to 3rd-party/romio341/mpi-io/iwrite_sh.c index 3f9612a7895c1e652ec1ee42cccb73d6d4500018..40a2fbc304341d8c934aaace60ac585c097b5621 100644 --- a/3rd-party/romio321/mpi-io/iwrite_sh.c +++ b/3rd-party/romio341/mpi-io/iwrite_sh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_iwrite_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPIO_Request *request) __attribute__((weak,alias("PMPI_File_iwrite_shared"))); + MPIO_Request * request) + __attribute__ ((weak, alias("PMPI_File_iwrite_shared"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,7 +44,7 @@ Output Parameters: #endif int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) + MPI_Datatype datatype, MPIO_Request * request) { int error_code, buftype_is_contig, filetype_is_contig; ADIO_File adio_fh; @@ -78,42 +77,41 @@ int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count, ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); if (error_code != MPI_SUCCESS) { - /* note: ADIO_Get_shared_fp should have set up error code already? */ - MPIO_Err_return_file(adio_fh, error_code); + /* note: ADIO_Get_shared_fp should have set up error code already? */ + MPIO_Err_return_file(adio_fh, error_code); } /* contiguous or strided? */ if (buftype_is_contig && filetype_is_contig) { - /* convert sizes to bytes */ - bufsize = datatype_size * count; - off = adio_fh->disp + adio_fh->etype_size * shared_fp; + /* convert sizes to bytes */ + bufsize = datatype_size * count; + off = adio_fh->disp + adio_fh->etype_size * shared_fp; if (!(adio_fh->atomicity)) - ADIO_IwriteContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, request, &error_code); - else { + ADIO_IwriteContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, request, &error_code); + else { /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ + * operations, lock (exclusive) and call blocking routine */ if (adio_fh->file_system != ADIO_NFS) ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); ADIO_WriteContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, &status, &error_code); + off, &status, &error_code); if (adio_fh->file_system != ADIO_NFS) ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - MPIO_Completed_request_create(&adio_fh, bufsize, &error_code, request); - } - } - else - ADIO_IwriteStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, request, &error_code); + MPIO_Completed_request_create(&adio_fh, bufsize, &error_code, request); + } + } else + ADIO_IwriteStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, request, &error_code); -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/mpich_fileutil.c b/3rd-party/romio341/mpi-io/mpich_fileutil.c similarity index 50% rename from 3rd-party/romio321/mpi-io/mpich_fileutil.c rename to 3rd-party/romio341/mpi-io/mpich_fileutil.c index b853b588fa702e04f3deca6cde111cb56ace9962..b5b2d132adccb47dd5a48c2e420f396996df1070 100644 --- a/3rd-party/romio321/mpi-io/mpich_fileutil.c +++ b/3rd-party/romio341/mpi-io/mpich_fileutil.c @@ -1,8 +1,8 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + #include "mpioimpl.h" #include "adio_extern.h" @@ -12,47 +12,47 @@ in a ROMIO File structure. FIXME: These should be imported from a common header file that is also used in errhan/file_set_errhandler.c */ -int MPIR_ROMIO_Get_file_errhand( MPI_File, MPI_Errhandler * ); -int MPIR_ROMIO_Set_file_errhand( MPI_File, MPI_Errhandler ); -void MPIR_Get_file_error_routine( MPI_Errhandler, - void (**)(MPI_File *, int *, ...), - int * ); +int MPIR_ROMIO_Get_file_errhand(MPI_File, MPI_Errhandler *); +int MPIR_ROMIO_Set_file_errhand(MPI_File, MPI_Errhandler); +void MPIR_Get_file_error_routine(MPI_Errhandler, void (**)(MPI_File *, int *, ...), int *); /* These next two routines are used to allow MPICH to access/set the error handers in the MPI_File structure until MPICH knows about the - file structure, and to handle the errhandler structure, which + file structure, and to handle the errhandler structure, which includes a reference count. Not currently used. */ -int MPIR_ROMIO_Set_file_errhand( MPI_File file_ptr, MPI_Errhandler e ) +int MPIR_ROMIO_Set_file_errhand(MPI_File file_ptr, MPI_Errhandler e) { - if (file_ptr == MPI_FILE_NULL) ADIOI_DFLT_ERR_HANDLER = e; + if (file_ptr == MPI_FILE_NULL) + ADIOI_DFLT_ERR_HANDLER = e; /* --BEGIN ERROR HANDLING-- */ else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { - return MPI_ERR_FILE; + return MPI_ERR_FILE; } /* --END ERROR HANDLING-- */ - else - file_ptr->err_handler = e; + else + file_ptr->err_handler = e; return 0; } -int MPIR_ROMIO_Get_file_errhand( MPI_File file_ptr, MPI_Errhandler *e ) + +int MPIR_ROMIO_Get_file_errhand(MPI_File file_ptr, MPI_Errhandler * e) { if (file_ptr == MPI_FILE_NULL) { - if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_RETURN) - *e = 0; - else { - *e = ADIOI_DFLT_ERR_HANDLER; - } + if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_RETURN) + *e = 0; + else { + *e = ADIOI_DFLT_ERR_HANDLER; + } } /* --BEGIN ERROR HANDLING-- */ else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { - return MPI_ERR_FILE; + return MPI_ERR_FILE; } /* --END ERROR HANDLING-- */ else { - if (file_ptr->err_handler == MPI_ERRORS_RETURN) - *e = 0; - else - *e = file_ptr->err_handler; + if (file_ptr->err_handler == MPI_ERRORS_RETURN) + *e = 0; + else + *e = file_ptr->err_handler; } return 0; } diff --git a/3rd-party/romio321/mpi-io/mpioimpl.h b/3rd-party/romio341/mpi-io/mpioimpl.h similarity index 54% rename from 3rd-party/romio321/mpi-io/mpioimpl.h rename to 3rd-party/romio341/mpi-io/mpioimpl.h index 4eb2843bcafc95bc189b527879e209d40d71e579..04514465006a0d8f0c2c7338b0f8eab92bc4c315 100644 --- a/3rd-party/romio321/mpi-io/mpioimpl.h +++ b/3rd-party/romio341/mpi-io/mpioimpl.h @@ -1,28 +1,24 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * Copyright (c) 2018 IBM Corporation. All rights reserved. - * $COPYRIGHT$ - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ /* header file for MPI-IO implementation. not intended to be - user-visible */ + user-visible */ -#ifndef MPIOIMPL_INCLUDE -#define MPIOIMPL_INCLUDE +#ifndef MPIOIMPL_H_INCLUDED +#define MPIOIMPL_H_INCLUDED #include "adio.h" #include "mpio.h" #ifdef ROMIO_INSIDE_MPICH -#include "glue_romio.h" +#include "mpir_ext.h" #define ROMIO_THREAD_CS_ENTER() MPIR_Ext_cs_enter() #define ROMIO_THREAD_CS_EXIT() MPIR_Ext_cs_exit() -#define ROMIO_THREAD_CS_YIELD() MPIR_Ext_cs_yield() +#define ROMIO_THREAD_CS_YIELD() MPL_thread_yield() /* committed datatype checking support in ROMIO */ #define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) \ @@ -32,23 +28,13 @@ #else /* not ROMIO_INSIDE_MPICH */ /* Any MPI implementation that wishes to follow the thread-safety and - error reporting features provided by MPICH must implement these - four functions. Defining these as empty should not change the behavior + error reporting features provided by MPICH must implement these + four functions. Defining these as empty should not change the behavior of correct programs */ #define ROMIO_THREAD_CS_ENTER() #define ROMIO_THREAD_CS_EXIT() #define ROMIO_THREAD_CS_YIELD() -/* The MPI_DATATYPE_ISCOMMITTED macro now always sets err_=0. - This is an optimistic approach for Open MPI, but it is likely other - upper layers already checked the datatype was committed. - Not setting err_ is incorrect since it can lead to use of - uninitialized variable.*/ -#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do { err_ = 0; } while (0) -#ifdef HAVE_WINDOWS_H -#define MPIU_UNREFERENCED_ARG(a) a -#else -#define MPIU_UNREFERENCED_ARG(a) -#endif +#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0) #endif /* ROMIO_INSIDE_MPICH */ /* info is a linked list of these structures */ @@ -60,12 +46,12 @@ struct MPIR_Info { #define MPIR_INFO_COOKIE 5835657 -MPI_Comm_delete_attr_function ADIOI_End_call; +MPI_Delete_function ADIOI_End_call; /* common initialization routine */ -void MPIR_MPIOInit(int * error_code); +void MPIR_MPIOInit(int *error_code); -#ifdef HAVE_MPIIO_CONST +#if MPI_VERSION >= 3 #define ROMIO_CONST const #else #define ROMIO_CONST @@ -73,12 +59,12 @@ void MPIR_MPIOInit(int * error_code); #include "mpiu_external32.h" - +#ifdef MPIO_BUILD_PROFILING #include "mpioprof.h" +#endif /* MPIO_BUILD_PROFILING */ #ifdef MPI_hpux -# include "mpioinst.h" +#include "mpioinst.h" #endif /* MPI_hpux */ -#endif - +#endif /* MPIOIMPL_H_INCLUDED */ diff --git a/3rd-party/romio321/mpi-io/mpioprof.h b/3rd-party/romio341/mpi-io/mpioprof.h similarity index 93% rename from 3rd-party/romio321/mpi-io/mpioprof.h rename to 3rd-party/romio341/mpi-io/mpioprof.h index c74413d1e81ed22a2521d0a918c6de87b1f55ec1..f9c5e1034713bd4104ea431b206bf577a7fc56a0 100644 --- a/3rd-party/romio321/mpi-io/mpioprof.h +++ b/3rd-party/romio341/mpi-io/mpioprof.h @@ -1,15 +1,23 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ -/* - This header file converts all MPI_ names into PMPI_ names, for +/* + This header file converts all MPI_ names into PMPI_ names, for building the profiling interface */ +/* This file is a no-op without MPIO_BUILD_PROFILING defined. + * Do not allow erroneous inclusion as that will falsely define + * MPIO_PROF_H_INCLUDED */ +#ifndef MPIO_BUILD_PROFILING +#error "The file must be included only when MPIO_BUILD_PROFILING is defined" +#endif + +#ifndef MPIO_PROF_H_INCLUDED +#define MPIO_PROF_H_INCLUDED + /* * Open MPI: Unfortunately, ROMIO doesn't seem to be able to build * without a profiling interface, but we don't want a profiling @@ -63,7 +71,7 @@ #undef MPI_File_read #define MPI_File_read PMPI_File_read #undef MPI_File_read_all -#define MPI_File_read_all PMPI_File_read_all +#define MPI_File_read_all PMPI_File_read_all #undef MPI_File_write #define MPI_File_write PMPI_File_write #undef MPI_File_write_all @@ -221,4 +229,7 @@ #define MPIX_Grequest_class_create PMPIX_Grequest_class_create #endif + +#endif /* MPIO_PROF_H_INCLUDED */ + #endif diff --git a/3rd-party/romio341/mpi-io/mpir-mpioinit.c b/3rd-party/romio341/mpi-io/mpir-mpioinit.c new file mode 100644 index 0000000000000000000000000000000000000000..012b3613e6dbbc0332f80677e5ff8978ee089619 --- /dev/null +++ b/3rd-party/romio341/mpi-io/mpir-mpioinit.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" +#include <string.h> + +#ifdef HAVE_WEAK_SYMBOLS +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +extern int ADIO_Init_keyval; + +/* common code to stuff an attribute on a communicator for the purpose of + * cleaning up in MPI_Finalize() */ + +void MPIR_MPIOInit(int *error_code) +{ + + int flag; + char myname[] = "MPIR_MPIOInit"; + + /* first check if ADIO has been initialized. If not, initialize it */ + if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) { + MPI_Initialized(&flag); + + /* --BEGIN ERROR HANDLING-- */ + if (!flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_OTHER, "**initialized", 0); + *error_code = MPIO_Err_return_file(MPI_FILE_NULL, *error_code); + return; + } + /* --END ERROR HANDLING-- */ + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_End_call, &ADIO_Init_keyval, (void *) 0); + + /* put a dummy attribute on MPI_COMM_SELF, because we want the delete + * function to be called when MPI_COMM_SELF is freed. Clarified + * in MPI-2 section 4.8, the standard mandates that attributes on + * MPI_COMM_SELF get cleaned up early in MPI_Finalize */ + + MPI_Attr_put(MPI_COMM_SELF, ADIO_Init_keyval, (void *) 0); + + /* initialize ADIO */ + ADIO_Init((int *) 0, (char ***) 0, error_code); + } + *error_code = MPI_SUCCESS; +} diff --git a/3rd-party/romio341/mpi-io/mpir_cst_filesys.c b/3rd-party/romio341/mpi-io/mpir_cst_filesys.c new file mode 100644 index 0000000000000000000000000000000000000000..3fab9a54b15616b1ddc8e7c3d783f0cd031ffa53 --- /dev/null +++ b/3rd-party/romio341/mpi-io/mpir_cst_filesys.c @@ -0,0 +1,258 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_DIRENT_H +#include <dirent.h> +#endif + +#ifdef MPICH + +static int comm_split_filesystem_exhaustive(MPI_Comm comm, int key, + const char *dirname, MPI_Comm * newcomm) +{ + /* If you run this at scale against GPFS, be prepared to spend 30 mintues + * creating 10,000 files -- and the numbers only get worse from there. + * + * - create random directory + * - create files in that directory + * - based on the visible files, construct a new group, then a new + * communicator + * - there are no directory operation routines in MPI so we'll do it via + * POSIX. */ + int rank, nprocs, ret; + int *ranks; + MPI_Group comm_group, newgroup; + int j = 0, mpi_errno = MPI_SUCCESS; + char *filename = NULL, *testdirname = NULL; + DIR *dir; + struct dirent *entry; + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &nprocs); + + /* rank zero constructs the candidate directory name (just the + * name). Everyone will create the directory though -- this will be + * a headache for the file system at scale.. don't do this on a + * large parallel file system! */ + + testdirname = MPL_malloc(PATH_MAX, MPL_MEM_IO); + filename = MPL_malloc(PATH_MAX, MPL_MEM_IO); + ranks = MPL_malloc(nprocs * sizeof(int), MPL_MEM_IO); + + if (rank == 0) + MPL_create_pathname(testdirname, dirname, ".commonfstest.0", 1); + + MPI_Bcast(testdirname, PATH_MAX, MPI_BYTE, 0, comm); + /* ignore EEXIST: quite likely another process will have made this + * directory, but since the whole point is to figure out who we share this + * directory with, brute force it is! */ + ret = mkdir(testdirname, S_IRWXU); + if (ret == -1 && errno != EEXIST) + goto fn_fail; + MPL_snprintf(filename, PATH_MAX, "%s/%d", testdirname, rank); + open(filename, O_CREAT, S_IRUSR | S_IWUSR); + + MPI_Barrier(comm); + /* each process has created a file in a M-way shared directory (where M in + * the range [1-nprocs]). Let's see who else can see this directory */ + if ((dir = opendir(testdirname)) == NULL) + goto fn_fail; + while ((entry = readdir(dir)) != NULL) { + if (strcmp(entry->d_name, ".") == 0) + continue; + if (strcmp(entry->d_name, "..") == 0) + continue; + ranks[j++] = atoi(entry->d_name); + } + + MPI_Comm_group(comm, &comm_group); + MPI_Group_incl(comm_group, j, ranks, &newgroup); + MPI_Comm_create(comm, newgroup, newcomm); + MPI_Group_free(&newgroup); + MPI_Group_free(&comm_group); + + unlink(filename); + /* ok to ignore errors */ + rmdir(testdirname); + + fn_exit: + MPL_free(ranks); + MPL_free(filename); + MPL_free(testdirname); + return mpi_errno; + fn_fail: + goto fn_exit; +} + +static int comm_split_filesystem_heuristic(MPI_Comm comm, int key, + const char *dirname, MPI_Comm * newcomm) +{ + int i, mpi_errno = MPI_SUCCESS; + int rank, nprocs; + int id; + int32_t *all_ids; + char *filename = NULL; + int challenge_rank, globally_visible = 0; + MPI_Request check_req; + + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &nprocs); + MPIR_Get_node_id(comm, rank, &id); + + /* We could detect the common file systems by parsing 'df'-style + * output, but that's fidgety, fragile, and error prone. Instead, + * determine who shares a file system through testing. + * + * As an optimization, we should try to avoid creating a lot of + * files: we want something that could work at hundreds of thousands + * of nodes, and creating a hundred thousand files in a directory is + * a recipe for sadness + * + * In CH3 and in wider practice "shared memory" is the same as "on + * the same node, so let's start there. + * + * - Create file on one processor + * - pick a processor outside the "on this node" group + * - if that processor can see the file, then assume the file is + * visible to all groups. + * + * note that this scheme works really well for traditional linux clusters: + * think nodes with a local scratch drive. this scheme works less well for + * a deeper heirarchy. what if the directory in question was hosted by an + * i/o forwarding agent? + */ + + /* learn a bit about what groups were created: as a scalable + * optimization we want to check a file's presence from a group + * other than which created it */ + all_ids = MPL_malloc(nprocs * sizeof(*all_ids), MPL_MEM_IO); + + mpi_errno = MPI_Gather(&id, 1, MPI_INT32_T, all_ids, 1, MPI_INT32_T, 0, comm); + + if (rank == 0) { + for (i = 0; i < nprocs; i++) { + if (all_ids[i] != id) + break; + } + if (i >= nprocs) + /* everyone is in the same group; pick a process that's not rank 0 + * just in case the file system is really weird */ + challenge_rank = nprocs - 1; + else + challenge_rank = i; + } + mpi_errno = MPI_Bcast(&challenge_rank, 1, MPI_INT, 0, comm); + + /* now that we've informally lumped everyone into groups based on node + * (like shared memory does) it's time to poke the file system and see + * which group can see what files */ + + /* here come a bunch of assumptions: + * - file system layouts are homogenous: if one system has /scratch, + * all have /scratch + * - a globally visible parallel file system will have the same name + * everywhere: e.g /gpfs/users/something + * - a file created on one node will be deterministically visible on + * another. NFS has problems with this + * - if a process from one group creates a file, and a process from + * another group finds that file, then a process from all groups + * can find that file + */ + + /* is the file globally visible to all? create on rank 0, test on a + * different off-group rank. + * Use a single short message to force check after create: ordering + * is a little odd in case we are creating and checking on the same + * rank */ + + filename = MPL_calloc(PATH_MAX, sizeof(char), MPL_MEM_IO); + + if (rank == 0) + MPL_create_pathname(filename, dirname, ".commonfstest.0", 0); + + MPI_Bcast(filename, PATH_MAX, MPI_BYTE, 0, comm); + + if (rank == challenge_rank) { + MPI_Irecv(NULL, 0, MPI_BYTE, 0, 0, comm, &check_req); + } + + if (rank == 0) { + MPI_File fh; + mpi_errno = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_WRONLY, + MPI_INFO_NULL, &fh); + if (mpi_errno != MPI_SUCCESS) + goto fn_exit; + MPI_File_close(&fh); + /* the check for file has to happen after file created. only need one + * process, though, not a full barrier */ + MPI_Send(NULL, 0, MPI_BYTE, challenge_rank, 0, comm); + } + + if (rank == challenge_rank) { + MPI_File fh; + + MPI_Wait(&check_req, MPI_STATUS_IGNORE); + + /* too bad there's no ADIO equivalent of access: we'll have to + * open/close the file instead */ + + mpi_errno = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); + if (mpi_errno == MPI_SUCCESS) { + globally_visible = 1; + MPI_File_close(&fh); + } else { + /* do not report error up to caller. we are merely testing the + * presence of the file */ + mpi_errno = MPI_SUCCESS; + globally_visible = 0; + } + } + MPI_Bcast(&globally_visible, 1, MPI_INT, challenge_rank, comm); + + /* with the above assumptions, we have two cases for a flie + * created on one process: + * -- either a process not in the group can access it (node-local + * storage of some sort) + * -- or a process not in the group cannot access it (globally + * accessable parallel file system) */ + + if (globally_visible) { + MPI_Comm_dup(comm, newcomm); + } else { + MPI_Comm_split(comm, id, key, newcomm); + } + if (rank == 0) + MPI_File_delete(filename, MPI_INFO_NULL); + + fn_exit: + MPL_free(all_ids); + MPL_free(filename); + return mpi_errno; +} + +/* not to be called directly (note the MPIR_ prefix), but instead from + * MPI-level MPI_Comm_split_type implementation (e.g. + * MPIR_Comm_split_type_impl). */ + +/* split communicator based on access to directory 'dirname'. */ +int MPIR_Comm_split_filesystem(MPI_Comm comm, int key, const char *dirname, MPI_Comm * newcomm) +{ + int mpi_errno = MPI_SUCCESS; + char *s; + if ((s = getenv("MPIX_SPLIT_DISABLE_HEURISTIC")) != NULL) { + mpi_errno = comm_split_filesystem_exhaustive(comm, key, dirname, newcomm); + } else { + mpi_errno = comm_split_filesystem_heuristic(comm, key, dirname, newcomm); + } + return mpi_errno; +} + +#endif /* MPICH */ diff --git a/3rd-party/romio321/mpi-io/mpiu_external32.c b/3rd-party/romio341/mpi-io/mpiu_external32.c similarity index 62% rename from 3rd-party/romio321/mpi-io/mpiu_external32.c rename to 3rd-party/romio341/mpi-io/mpiu_external32.c index 8a8254cbb828f4eca13e6b1f19fe99dc6d269d8b..e32472ac6abf7e3519885bda6ba87de687856195 100644 --- a/3rd-party/romio321/mpi-io/mpiu_external32.c +++ b/3rd-party/romio341/mpi-io/mpiu_external32.c @@ -1,6 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* (C) 2012 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -12,8 +12,8 @@ #include "mpioprof.h" #endif -int MPIU_write_external32_conversion_fn (const void *userbuf, MPI_Datatype datatype, - int count, void *filebuf) +int MPIU_write_external32_conversion_fn(const void *userbuf, MPI_Datatype datatype, + int count, void *filebuf) { int position_i = 0; MPI_Aint position = 0; @@ -26,57 +26,50 @@ int MPIU_write_external32_conversion_fn (const void *userbuf, MPI_Datatype datat if (mpi_errno != MPI_SUCCESS) goto fn_exit; - if (is_contig) - { -#ifdef HAVE_MPIIO_CONST + if (is_contig) { +#if MPI_VERSION >= 3 mpi_errno = MPI_Pack_external("external32", userbuf, count, - datatype, filebuf, bytes, &position); + datatype, filebuf, bytes, &position); #else - mpi_errno = MPI_Pack_external("external32", (void *)userbuf, count, - datatype, filebuf, bytes, &position); + mpi_errno = MPI_Pack_external("external32", (void *) userbuf, count, + datatype, filebuf, bytes, &position); #endif if (mpi_errno != MPI_SUCCESS) goto fn_exit; - } - else - { + } else { void *tmp_buf = NULL; - tmp_buf = ADIOI_Malloc(bytes); - if (!tmp_buf) - { + tmp_buf = ADIOI_Malloc(bytes); + if (!tmp_buf) { mpi_errno = MPI_ERR_NO_MEM; goto fn_exit; } - -#ifdef HAVE_MPIIO_CONST +#if MPI_VERSION >= 3 mpi_errno = MPI_Pack_external("external32", userbuf, count, - datatype, tmp_buf, bytes, &position); + datatype, tmp_buf, bytes, &position); #else - mpi_errno = MPI_Pack_external("external32", (void *)userbuf, count, - datatype, tmp_buf, bytes, &position); + mpi_errno = MPI_Pack_external("external32", (void *) userbuf, count, + datatype, tmp_buf, bytes, &position); #endif - if (mpi_errno != MPI_SUCCESS) - { + if (mpi_errno != MPI_SUCCESS) { ADIOI_Free(tmp_buf); goto fn_exit; } mpi_errno = MPI_Unpack(tmp_buf, bytes, &position_i, filebuf, count, - datatype, MPI_COMM_WORLD); - if (mpi_errno != MPI_SUCCESS) - { + datatype, MPI_COMM_WORLD); + if (mpi_errno != MPI_SUCCESS) { ADIOI_Free(tmp_buf); goto fn_exit; } ADIOI_Free(tmp_buf); } -fn_exit: + fn_exit: return mpi_errno; } int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype, - int count, void *filebuf) + int count, void *filebuf) { int position_i = 0; MPI_Aint position = 0; @@ -89,45 +82,39 @@ int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype, if (mpi_errno != MPI_SUCCESS) goto fn_exit; - if (is_contig) - { + if (is_contig) { mpi_errno = MPI_Unpack_external("external32", filebuf, bytes, - &position, userbuf, count, datatype); + &position, userbuf, count, datatype); if (mpi_errno != MPI_SUCCESS) goto fn_exit; - } - else - { + } else { void *tmp_buf = NULL; - tmp_buf = ADIOI_Malloc(bytes); - if (!tmp_buf) - { + tmp_buf = ADIOI_Malloc(bytes); + if (!tmp_buf) { mpi_errno = MPI_ERR_NO_MEM; goto fn_exit; } - mpi_errno = MPI_Pack(filebuf, count, datatype, tmp_buf, bytes, - &position_i, MPI_COMM_WORLD); - if (mpi_errno != MPI_SUCCESS) - { + mpi_errno = MPI_Pack(filebuf, count, datatype, tmp_buf, bytes, &position_i, MPI_COMM_WORLD); + if (mpi_errno != MPI_SUCCESS) { ADIOI_Free(tmp_buf); goto fn_exit; } mpi_errno = MPI_Unpack_external("external32", tmp_buf, bytes, - &position, userbuf, count, datatype); - if (mpi_errno != MPI_SUCCESS) - { + &position, userbuf, count, datatype); + if (mpi_errno != MPI_SUCCESS) { ADIOI_Free(tmp_buf); goto fn_exit; } ADIOI_Free(tmp_buf); } -fn_exit: + fn_exit: return mpi_errno; } -int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint *size) + +int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint * size) { int error_code = MPI_SUCCESS; MPI_Aint true_extent = 0; @@ -138,35 +125,30 @@ int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint *size) goto fn_exit; *size = true_extent; -fn_exit: + fn_exit: return error_code; } /* given a buffer, count, and datatype, return an apropriately allocated, sized * and external32-formatted buffer, suitable for handing off to a subsequent * write routine. Caller is responsible for freeing 'newbuf' */ -int MPIU_external32_buffer_setup(const void * buf, int count, MPI_Datatype type, void **newbuf) +int MPIU_external32_buffer_setup(const void *buf, int count, MPI_Datatype type, void **newbuf) { - MPI_Aint datatype_size=0, bytes=0; + MPI_Aint datatype_size = 0, bytes = 0; int error_code; error_code = MPIU_datatype_full_size(type, &datatype_size); if (error_code != MPI_SUCCESS) - return error_code; + return error_code; bytes = datatype_size * count; *newbuf = ADIOI_Malloc(bytes); error_code = MPIU_write_external32_conversion_fn(buf, type, count, *newbuf); if (error_code != MPI_SUCCESS) { - ADIOI_Free(*newbuf); - return error_code; + ADIOI_Free(*newbuf); + return error_code; } return MPI_SUCCESS; } - - -/* - * vim: ts=8 sts=4 sw=4 noexpandtab - */ diff --git a/3rd-party/romio321/mpi-io/mpiu_greq.c b/3rd-party/romio341/mpi-io/mpiu_greq.c similarity index 75% rename from 3rd-party/romio321/mpi-io/mpiu_greq.c rename to 3rd-party/romio341/mpi-io/mpiu_greq.c index ad1e4d25826789cb24d4a355a1382ceb9b68b9cc..6fe7499f328f02de822d85520ebbc086a0fff9b8 100644 --- a/3rd-party/romio321/mpi-io/mpiu_greq.c +++ b/3rd-party/romio341/mpi-io/mpiu_greq.c @@ -1,8 +1,8 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* - * (C) 2003 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + #include "mpioimpl.h" #include "mpiu_greq.h" @@ -13,7 +13,7 @@ #include "mpioprof.h" #endif -int MPIU_Greq_query_fn(void *extra_state, MPI_Status *status) +int MPIU_Greq_query_fn(void *extra_state, MPI_Status * status) { int foo; @@ -36,13 +36,14 @@ int MPIU_Greq_free_fn(void *extra_state) { /* frees the memory allocated in MPIO_Completed_request_create */ ADIOI_Free(extra_state); - + return MPI_SUCCESS; } + int MPIU_Greq_cancel_fn(void *extra_state, int complete) { - MPIU_UNREFERENCED_ARG(extra_state); - MPIU_UNREFERENCED_ARG(complete); + MPL_UNREFERENCED_ARG(extra_state); + MPL_UNREFERENCED_ARG(complete); /* can't cancel */ return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi-io/open.c b/3rd-party/romio341/mpi-io/open.c similarity index 55% rename from 3rd-party/romio321/mpi-io/open.c rename to 3rd-party/romio341/mpi-io/open.c index 7cebb5abc795f9fda92e2aa83520da46d6041a81..922c98f50b4164c3342b0217a17e4c878c75aea0 100644 --- a/3rd-party/romio321/mpi-io/open.c +++ b/3rd-party/romio341/mpi-io/open.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_open as PMPI_File_open /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh) __attribute__((weak,alias("PMPI_File_open"))); +int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File * fh) + __attribute__ ((weak, alias("PMPI_File_open"))); #endif /* Include mapping from MPI->PMPI */ @@ -46,9 +45,9 @@ Output Parameters: .N fortran @*/ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode, - MPI_Info info, MPI_File *fh) + MPI_Info info, MPI_File * fh) { - int error_code = MPI_SUCCESS, file_system, flag, tmp_amode=0, rank; + int error_code = MPI_SUCCESS, file_system, flag, tmp_amode = 0, rank; char *tmp; MPI_Comm dupcomm = MPI_COMM_NULL; ADIOI_Fns *fsops; @@ -68,45 +67,37 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode, error_code = MPI_Comm_test_inter(comm, &flag); /* --BEGIN ERROR HANDLING-- */ - if (error_code || flag) - { - error_code = MPIO_Err_create_code(error_code, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_COMM, - "**commnotintra", 0); - goto fn_fail; + if (error_code || flag) { + error_code = MPIO_Err_create_code(error_code, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_COMM, "**commnotintra", 0); + goto fn_fail; } - if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) + - ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_AMODE, - "**fileamodeone", 0); - goto fn_fail; + if (((amode & MPI_MODE_RDONLY) ? 1 : 0) + ((amode & MPI_MODE_RDWR) ? 1 : 0) + + ((amode & MPI_MODE_WRONLY) ? 1 : 0) != 1) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, "**fileamodeone", 0); + goto fn_fail; } - if ((amode & MPI_MODE_RDONLY) && - ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_AMODE, - "**fileamoderead", 0); - goto fn_fail; + if ((amode & MPI_MODE_RDONLY) && ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, "**fileamoderead", 0); + goto fn_fail; } - if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_AMODE, - "**fileamodeseq", 0); - goto fn_fail; + if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, "**fileamodeseq", 0); + goto fn_fail; } MPI_Comm_dup(comm, &dupcomm); /* check if ADIO has been initialized. If not, initialize it */ MPIR_MPIOInit(&error_code); - if (error_code != MPI_SUCCESS) goto fn_fail; + if (error_code != MPI_SUCCESS) + goto fn_fail; /* check if amode is the same on all processes: at first glance, one might try * to use a built-in operator like MPI_BAND, but we need every mpi process to @@ -117,10 +108,9 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode, MPI_Allreduce(&amode, &tmp_amode, 1, MPI_INT, ADIO_same_amode, dupcomm); if (tmp_amode == ADIO_AMODE_NOMATCH) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_NOT_SAME, - "**fileamodediff", 0); - goto fn_fail; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NOT_SAME, "**fileamodediff", 0); + goto fn_fail; } /* --END ERROR HANDLING-- */ @@ -129,13 +119,12 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode, /* resolve file system type from file name; this is a collective call */ ADIO_ResolveFileType(dupcomm, filename, &file_system, &fsops, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - /* ADIO_ResolveFileType() will print as informative a message as it - * possibly can or call MPIO_Err_setmsg. We just need to propagate - * the error up. - */ - goto fn_fail; + if (error_code != MPI_SUCCESS) { + /* ADIO_ResolveFileType() will print as informative a message as it + * possibly can or call MPIO_Err_setmsg. We just need to propagate + * the error up. + */ + goto fn_fail; } /* --END ERROR HANDLING-- */ @@ -146,63 +135,60 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode, tmp = strchr(filename, ':'); if (tmp > filename + 1) { - filename = tmp + 1; + filename = tmp + 1; } -/* use default values for disp, etype, filetype */ +/* use default values for disp, etype, filetype */ *fh = ADIO_Open(comm, dupcomm, filename, file_system, fsops, amode, 0, - MPI_BYTE, MPI_BYTE, info, ADIO_PERM_NULL, &error_code); + MPI_BYTE, MPI_BYTE, info, ADIO_PERM_NULL, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) { - goto fn_fail; + goto fn_fail; } /* --END ERROR HANDLING-- */ /* if MPI_MODE_SEQUENTIAL requested, file systems cannot do explicit offset * or independent file pointer accesses, leaving not much else aside from * shared file pointer accesses. */ - if ( !ADIO_Feature((*fh), ADIO_SHARED_FP) && (amode & MPI_MODE_SEQUENTIAL)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNSUPPORTED_OPERATION, - "**iosequnsupported", 0); - ADIO_Close(*fh, &error_code); - goto fn_fail; + if (!ADIO_Feature((*fh), ADIO_SHARED_FP) && (amode & MPI_MODE_SEQUENTIAL)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_OPERATION, "**iosequnsupported", 0); + ADIO_Close(*fh, &error_code); + goto fn_fail; } /* determine name of file that will hold the shared file pointer */ /* can't support shared file pointers on a file system that doesn't - support file locking. */ - if ((error_code == MPI_SUCCESS) && - ADIO_Feature((*fh), ADIO_SHARED_FP)) { - MPI_Comm_rank(dupcomm, &rank); - ADIOI_Shfp_fname(*fh, rank, &error_code); - if (error_code != MPI_SUCCESS) - goto fn_fail; + * support file locking. */ + if ((error_code == MPI_SUCCESS) && ADIO_Feature((*fh), ADIO_SHARED_FP)) { + MPI_Comm_rank(dupcomm, &rank); + ADIOI_Shfp_fname(*fh, rank, &error_code); + if (error_code != MPI_SUCCESS) + goto fn_fail; /* if MPI_MODE_APPEND, set the shared file pointer to end of file. - indiv. file pointer already set to end of file in ADIO_Open. - Here file view is just bytes. */ - if ((*fh)->access_mode & MPI_MODE_APPEND) { - if (rank == (*fh)->hints->ranklist[0]) /* only one person need set the sharedfp */ - ADIO_Set_shared_fp(*fh, (*fh)->fp_ind, &error_code); - MPI_Barrier(dupcomm); - } + * indiv. file pointer already set to end of file in ADIO_Open. + * Here file view is just bytes. */ + if ((*fh)->access_mode & MPI_MODE_APPEND) { + if (rank == (*fh)->hints->ranklist[0]) /* only one person need set the sharedfp */ + ADIO_Set_shared_fp(*fh, (*fh)->fp_ind, &error_code); + MPI_Barrier(dupcomm); + } } - #ifdef MPI_hpux HPMP_IO_OPEN_END(fl_xmpi, *fh, comm); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; -fn_fail: + fn_fail: /* --BEGIN ERROR HANDLING-- */ - if (dupcomm != MPI_COMM_NULL) MPI_Comm_free(&dupcomm); + if (dupcomm != MPI_COMM_NULL) + MPI_Comm_free(&dupcomm); error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); goto fn_exit; /* --END ERROR HANDLING-- */ diff --git a/3rd-party/romio321/mpi-io/prealloc.c b/3rd-party/romio341/mpi-io/prealloc.c similarity index 55% rename from 3rd-party/romio321/mpi-io/prealloc.c rename to 3rd-party/romio341/mpi-io/prealloc.c index 1542e47a5d2795a1fdeaeeba716ff3caab2a2305..d2d479e587fcff064789b05423d474840f7f7be6 100644 --- a/3rd-party/romio321/mpi-io/prealloc.c +++ b/3rd-party/romio341/mpi-io/prealloc.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_preallocate as PMPI_File_preallocate /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_preallocate(MPI_File fh, MPI_Offset size) __attribute__((weak,alias("PMPI_File_preallocate"))); +int MPI_File_preallocate(MPI_File fh, MPI_Offset size) + __attribute__ ((weak, alias("PMPI_File_preallocate"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,15 +36,14 @@ Input Parameters: int MPI_File_preallocate(MPI_File fh, MPI_Offset size) { ADIO_Fcntl_t *fcntl_struct; - int error_code=0, mynod=0; + int error_code = 0, mynod = 0; ADIO_File adio_fh; static char myname[] = "MPI_FILE_PREALLOCATE"; MPI_Offset tmp_sz, max_sz, min_sz; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEPREALLOCATE, TRDTBLOCK, - adio_fh, MPI_DATATYPE_NULL, -1); + HPMP_IO_START(fl_xmpi, BLKMPIFILEPREALLOCATE, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ ROMIO_THREAD_CS_ENTER(); @@ -56,11 +54,10 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size) MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); if (size < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadsize", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadsize", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } tmp_sz = size; @@ -68,40 +65,42 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size) MPI_Allreduce(&tmp_sz, &min_sz, 1, ADIO_OFFSET, MPI_MIN, adio_fh->comm); if (max_sz != min_sz) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**notsame", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**notsame", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ - if (size == 0) goto fn_exit; + if (size == 0) + goto fn_exit; ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); MPI_Comm_rank(adio_fh->comm, &mynod); if (!mynod) { - fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); - fcntl_struct->diskspace = size; - ADIO_Fcntl(adio_fh, ADIO_FCNTL_SET_DISKSPACE, fcntl_struct, &error_code); - ADIOI_Free(fcntl_struct); - /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); - /* --END ERROR HANDLING-- */ + fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); + fcntl_struct->diskspace = size; + ADIO_Fcntl(adio_fh, ADIO_FCNTL_SET_DISKSPACE, fcntl_struct, &error_code); + ADIOI_Free(fcntl_struct); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(adio_fh, error_code); + /* --END ERROR HANDLING-- */ } MPI_Barrier(adio_fh->comm); - + #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); /* TODO: bcast result? */ - if (!mynod) return error_code; - else return MPI_SUCCESS; + if (!mynod) + return error_code; + else + return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/rd_atallb.c b/3rd-party/romio341/mpi-io/rd_atallb.c similarity index 75% rename from 3rd-party/romio321/mpi-io/rd_atallb.c rename to 3rd-party/romio341/mpi-io/rd_atallb.c index a7120b3da21a93390d37ce7124699c5aa416e8df..f2c40f8e168e729be01243efb1d0bc7a7c9612dd 100644 --- a/3rd-party/romio321/mpi-io/rd_atallb.c +++ b/3rd-party/romio341/mpi-io/rd_atallb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf, int count, - MPI_Datatype datatype) __attribute__((weak,alias("PMPI_File_read_at_all_begin"))); + MPI_Datatype datatype) + __attribute__ ((weak, alias("PMPI_File_read_at_all_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -41,14 +40,13 @@ Output Parameters: .N fortran @*/ int MPI_File_read_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype) + int count, MPI_Datatype datatype) { int error_code; static char myname[] = "MPI_FILE_READ_AT_ALL_BEGIN"; error_code = MPIOI_File_read_all_begin(fh, offset, - ADIO_EXPLICIT_OFFSET, - buf, count, datatype, myname); + ADIO_EXPLICIT_OFFSET, buf, count, datatype, myname); return error_code; } diff --git a/3rd-party/romio321/mpi-io/rd_atalle.c b/3rd-party/romio341/mpi-io/rd_atalle.c similarity index 81% rename from 3rd-party/romio321/mpi-io/rd_atalle.c rename to 3rd-party/romio341/mpi-io/rd_atalle.c index 207d5ba3698a632c3c830aa0622be323d22d47bd..d24825faa8c6e87e65a8bb27b6f2f51c164b529a 100644 --- a/3rd-party/romio321/mpi-io/rd_atalle.c +++ b/3rd-party/romio341/mpi-io/rd_atalle.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_read_at_all_end as PMPI_File_read_at_all_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_at_all_end"))); +int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_at_all_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -38,7 +37,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_READ_AT_ALL_END"; diff --git a/3rd-party/romio321/mpi-io/read.c b/3rd-party/romio341/mpi-io/read.c similarity index 62% rename from 3rd-party/romio321/mpi-io/read.c rename to 3rd-party/romio341/mpi-io/read.c index 6f129148937a6ed750ae8ac58c0aeeab7e0c4c7d..764a986561d54c6f9ec1c5a1ba2078f9e0deb6e7 100644 --- a/3rd-party/romio321/mpi-io/read.c +++ b/3rd-party/romio341/mpi-io/read.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -16,8 +15,8 @@ #pragma _CRI duplicate MPI_File_read as PMPI_File_read /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) - __attribute__((weak,alias("PMPI_File_read"))); +int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read"))); #endif /* Include mapping from MPI->PMPI */ @@ -41,8 +40,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_read(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) +int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_READ"; @@ -53,7 +51,7 @@ int MPI_File_read(MPI_File fh, void *buf, int count, #endif /* MPI_hpux */ error_code = MPIOI_File_read(fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, buf, - count, datatype, myname, status); + count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); @@ -65,19 +63,15 @@ int MPI_File_read(MPI_File fh, void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_read(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status) + MPI_Offset offset, + int file_ptr_type, + void *buf, int count, MPI_Datatype datatype, char *myname, MPI_Status * status) { int error_code, buftype_is_contig, filetype_is_contig; MPI_Count datatype_size; ADIO_File adio_fh; ADIO_Offset off, bufsize; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -88,13 +82,11 @@ int MPIOI_File_read(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -104,13 +96,12 @@ int MPIOI_File_read(MPI_File fh, MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code); /* --END ERROR HANDLING-- */ - if (count*datatype_size == 0) - { + if (count * datatype_size == 0) { #ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); + MPIR_Status_set_bytes(status, datatype, 0); #endif - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ @@ -125,61 +116,55 @@ int MPIOI_File_read(MPI_File fh, ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); xbuf = buf; - if (adio_fh->is_external32) - { + if (adio_fh->is_external32) { MPI_Aint e32_size = 0; error_code = MPIU_datatype_full_size(datatype, &e32_size); if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); - xbuf = e32_buf; + e32_buf = ADIOI_Malloc(e32_size * count); + xbuf = e32_buf; } - if (buftype_is_contig && filetype_is_contig) - { - /* convert count and offset to bytes */ - bufsize = datatype_size * count; - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = adio_fh->disp + adio_fh->etype_size * offset; - } - else /* ADIO_INDIVIDUAL */ { - off = adio_fh->fp_ind; - } + if (buftype_is_contig && filetype_is_contig) { + /* convert count and offset to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = adio_fh->disp + adio_fh->etype_size * offset; + } else { /* ADIO_INDIVIDUAL */ + + off = adio_fh->fp_ind; + } /* if atomic mode requested, lock (exclusive) the region, because - there could be a concurrent noncontiguous request. - */ + * there could be a concurrent noncontiguous request. + */ if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - } + } - ADIO_ReadContig(adio_fh, xbuf, count, datatype, file_ptr_type, - off, status, &error_code); + ADIO_ReadContig(adio_fh, xbuf, count, datatype, file_ptr_type, off, status, &error_code); if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - } - else - { - ADIO_ReadStrided(adio_fh, xbuf, count, datatype, file_ptr_type, - offset, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ + } + } else { + ADIO_ReadStrided(adio_fh, xbuf, count, datatype, file_ptr_type, + offset, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ } /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); - ADIOI_Free(e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); + ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_all.c b/3rd-party/romio341/mpi-io/read_all.c similarity index 69% rename from 3rd-party/romio321/mpi-io/read_all.c rename to 3rd-party/romio341/mpi-io/read_all.c index efce7832b79431872dde5f3360cf6bfa4686e556..1d8d574212a64cf179effbb9c6a3eb1248f3314b 100644 --- a/3rd-party/romio321/mpi-io/read_all.c +++ b/3rd-party/romio341/mpi-io/read_all.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -16,8 +15,8 @@ #pragma _CRI duplicate MPI_File_read_all as PMPI_File_read_all /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) - __attribute__((weak,alias("PMPI_File_read_all"))); +int MPI_File_read_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -41,8 +40,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_all(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) +int MPI_File_read_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_READ_ALL"; @@ -53,8 +51,7 @@ int MPI_File_read_all(MPI_File fh, void *buf, int count, #endif /* MPI_hpux */ error_code = MPIOI_File_read_all(fh, (MPI_Offset) 0, - ADIO_INDIVIDUAL, buf, - count, datatype, myname, status); + ADIO_INDIVIDUAL, buf, count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); @@ -67,18 +64,15 @@ int MPI_File_read_all(MPI_File fh, void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_read_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status) + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -89,13 +83,11 @@ int MPIOI_File_read_all(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -109,32 +101,30 @@ int MPIOI_File_read_all(MPI_File fh, /* --END ERROR HANDLING-- */ xbuf = buf; - if (adio_fh->is_external32) - { + if (adio_fh->is_external32) { MPI_Aint e32_size = 0; error_code = MPIU_datatype_full_size(datatype, &e32_size); if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); - xbuf = e32_buf; + e32_buf = ADIOI_Malloc(e32_size * count); + xbuf = e32_buf; } ADIO_ReadStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type, - offset, status, &error_code); + offset, status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); - ADIOI_Free(e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); + ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_allb.c b/3rd-party/romio341/mpi-io/read_allb.c similarity index 64% rename from 3rd-party/romio321/mpi-io/read_allb.c rename to 3rd-party/romio341/mpi-io/read_allb.c index ae1053b1518e06629d22077e7b286af23aa83b6e..9b58c0e3977b20a256864234f2327ec55b0c4c23 100644 --- a/3rd-party/romio321/mpi-io/read_allb.c +++ b/3rd-party/romio341/mpi-io/read_allb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) - __attribute__((weak,alias("PMPI_File_read_all_begin"))); + __attribute__ ((weak, alias("PMPI_File_read_all_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -39,15 +37,13 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) +int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) { int error_code; static char myname[] = "MPI_FILE_READ_ALL_BEGIN"; error_code = MPIOI_File_read_all_begin(fh, (MPI_Offset) 0, - ADIO_INDIVIDUAL, buf, count, - datatype, myname); + ADIO_INDIVIDUAL, buf, count, datatype, myname); return error_code; } @@ -55,17 +51,14 @@ int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_read_all_begin(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - void *buf, - int count, - MPI_Datatype datatype, - char *myname) + MPI_Offset offset, + int file_ptr_type, + void *buf, int count, MPI_Datatype datatype, char *myname) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -76,16 +69,14 @@ int MPIOI_File_read_all_begin(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ - + MPI_Type_size_x(datatype, &datatype_size); /* --BEGIN ERROR HANDLING-- */ @@ -94,11 +85,10 @@ int MPIOI_File_read_all_begin(MPI_File fh, MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); if (adio_fh->split_coll_count) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcoll", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code); /* --END ERROR HANDLING-- */ @@ -106,32 +96,30 @@ int MPIOI_File_read_all_begin(MPI_File fh, adio_fh->split_coll_count = 1; xbuf = buf; - if (adio_fh->is_external32) - { + if (adio_fh->is_external32) { MPI_Aint e32_size = 0; error_code = MPIU_datatype_full_size(datatype, &e32_size); if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); - xbuf = e32_buf; + e32_buf = ADIOI_Malloc(e32_size * count); + xbuf = e32_buf; } ADIO_ReadStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type, - offset, &adio_fh->split_status, &error_code); + offset, &adio_fh->split_status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); - ADIOI_Free(e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); + ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_alle.c b/3rd-party/romio341/mpi-io/read_alle.c similarity index 66% rename from 3rd-party/romio321/mpi-io/read_alle.c rename to 3rd-party/romio341/mpi-io/read_alle.c index e2853c13dd2ecc73da6cd7ad183438f8577d7381..f24b10c58dae891a21a461b88fe83f8e94bd7260 100644 --- a/3rd-party/romio321/mpi-io/read_alle.c +++ b/3rd-party/romio341/mpi-io/read_alle.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_read_all_end as PMPI_File_read_all_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_all_end"))); +int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_all_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -38,7 +37,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_IREAD"; @@ -50,15 +49,12 @@ int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING -int MPIOI_File_read_all_end(MPI_File fh, - void *buf, - char *myname, - MPI_Status *status) +int MPIOI_File_read_all_end(MPI_File fh, void *buf, char *myname, MPI_Status * status) { int error_code = MPI_SUCCESS; ADIO_File adio_fh; - MPIU_UNREFERENCED_ARG(buf); + MPL_UNREFERENCED_ARG(buf); ROMIO_THREAD_CS_ENTER(); @@ -68,21 +64,20 @@ int MPIOI_File_read_all_end(MPI_File fh, MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); if (!(adio_fh->split_coll_count)) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcollnone", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) - *status = adio_fh->split_status; + *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_at.c b/3rd-party/romio341/mpi-io/read_at.c similarity index 79% rename from 3rd-party/romio321/mpi-io/read_at.c rename to 3rd-party/romio341/mpi-io/read_at.c index 53dc8c42e3aa7ddb9059363b04a7d8509c89cdc7..28f03fc4eb7440d84c212cd41e338d15d5ad9494 100644 --- a/3rd-party/romio321/mpi-io/read_at.c +++ b/3rd-party/romio341/mpi-io/read_at.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_at"))); + MPI_Status * status) __attribute__ ((weak, alias("PMPI_File_read_at"))); #endif /* Include mapping from MPI->PMPI */ @@ -43,20 +42,19 @@ Output Parameters: .N fortran @*/ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status) + int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_READ_AT"; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEREADAT, TRDTBLOCK, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEREADAT, TRDTBLOCK, fh, datatype, count); #endif /* MPI_hpux */ /* ADIOI_File_read() defined in mpi-io/read.c */ error_code = MPIOI_File_read(fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, status); + count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); diff --git a/3rd-party/romio321/mpi-io/read_atall.c b/3rd-party/romio341/mpi-io/read_atall.c similarity index 71% rename from 3rd-party/romio321/mpi-io/read_atall.c rename to 3rd-party/romio341/mpi-io/read_atall.c index 2bed66be4d61e775f11d2d3ae37c5f35312d2068..a5bb33746550722df6fc3d75444a76eb3fdc085b 100644 --- a/3rd-party/romio321/mpi-io/read_atall.c +++ b/3rd-party/romio341/mpi-io/read_atall.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,9 +15,9 @@ #pragma _CRI duplicate MPI_File_read_at_all as PMPI_File_read_at_all /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void * buf, int count, - MPI_Datatype datatype, MPI_Status *status) - __attribute__((weak,alias("PMPI_File_read_at_all"))); +int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, + MPI_Datatype datatype, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_at_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,20 +43,18 @@ Output Parameters: .N fortran @*/ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPI_Status *status) + int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_IREAD_AT"; #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILEREADATALL, TRDTBLOCK, fh, datatype, - count); + HPMP_IO_START(fl_xmpi, BLKMPIFILEREADATALL, TRDTBLOCK, fh, datatype, count); #endif /* MPI_hpux */ error_code = MPIOI_File_read_all(fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, status); + count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); diff --git a/3rd-party/romio321/mpi-io/read_ord.c b/3rd-party/romio341/mpi-io/read_ord.c similarity index 79% rename from 3rd-party/romio321/mpi-io/read_ord.c rename to 3rd-party/romio341/mpi-io/read_ord.c index be877633c8e69b5d9ceecdc265562ae8905573c1..ef92537769b6c0e898aaaae1bfe4a10837fe9a36 100644 --- a/3rd-party/romio321/mpi-io/read_ord.c +++ b/3rd-party/romio341/mpi-io/read_ord.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_ordered"))); + MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_ordered"))); #endif /* Include mapping from MPI->PMPI */ @@ -43,14 +42,14 @@ Output Parameters: .N fortran @*/ int MPI_File_read_ordered(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code, nprocs, myrank; ADIO_Offset incr; MPI_Count datatype_size; int source, dest; static char myname[] = "MPI_FILE_READ_ORDERED"; - ADIO_Offset shared_fp=0; + ADIO_Offset shared_fp = 0; ADIO_File adio_fh; ROMIO_THREAD_CS_ENTER(); @@ -76,34 +75,36 @@ int MPI_File_read_ordered(MPI_File fh, void *buf, int count, MPI_Comm_size(adio_fh->comm, &nprocs); MPI_Comm_rank(adio_fh->comm, &myrank); - incr = (count*datatype_size)/adio_fh->etype_size; - + incr = (count * datatype_size) / adio_fh->etype_size; + /* Use a message as a 'token' to order the operations */ source = myrank - 1; - dest = myrank + 1; - if (source < 0) source = MPI_PROC_NULL; - if (dest >= nprocs) dest = MPI_PROC_NULL; + dest = myrank + 1; + if (source < 0) + source = MPI_PROC_NULL; + if (dest >= nprocs) + dest = MPI_PROC_NULL; MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE); ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) { - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ MPI_Send(NULL, 0, MPI_BYTE, dest, 0, adio_fh->comm); ADIO_ReadStridedColl(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); + shared_fp, status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); /* FIXME: Check for error code from ReadStridedColl? */ diff --git a/3rd-party/romio321/mpi-io/read_ordb.c b/3rd-party/romio341/mpi-io/read_ordb.c similarity index 71% rename from 3rd-party/romio321/mpi-io/read_ordb.c rename to 3rd-party/romio341/mpi-io/read_ordb.c index 050934b731f920bc38d26af8c3ee3293c0269f1a..f67e2cf50ecb82eb75152a369ddaa3409c39c9b9 100644 --- a/3rd-party/romio321/mpi-io/read_ordb.c +++ b/3rd-party/romio341/mpi-io/read_ordb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) - __attribute__((weak,alias("PMPI_File_read_ordered_begin"))); + __attribute__ ((weak, alias("PMPI_File_read_ordered_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -39,16 +37,15 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) +int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, MPI_Datatype datatype) { - int error_code, nprocs, myrank; + int error_code, nprocs, myrank; MPI_Count datatype_size; int source, dest; ADIO_Offset shared_fp, incr; ADIO_File adio_fh; static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN"; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -59,13 +56,11 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (adio_fh->split_coll_count) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcoll", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (adio_fh->split_coll_count) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -84,53 +79,52 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, MPI_Comm_size(adio_fh->comm, &nprocs); MPI_Comm_rank(adio_fh->comm, &myrank); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; /* Use a message as a 'token' to order the operations */ source = myrank - 1; - dest = myrank + 1; - if (source < 0) source = MPI_PROC_NULL; - if (dest >= nprocs) dest = MPI_PROC_NULL; + dest = myrank + 1; + if (source < 0) + source = MPI_PROC_NULL; + if (dest >= nprocs) + dest = MPI_PROC_NULL; MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE); ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ MPI_Send(NULL, 0, MPI_BYTE, dest, 0, adio_fh->comm); xbuf = buf; - if (adio_fh->is_external32) - { + if (adio_fh->is_external32) { MPI_Aint e32_size = 0; error_code = MPIU_datatype_full_size(datatype, &e32_size); if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); - xbuf = e32_buf; + e32_buf = ADIOI_Malloc(e32_size * count); + xbuf = e32_buf; } ADIO_ReadStridedColl(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, &adio_fh->split_status, &error_code); + shared_fp, &adio_fh->split_status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); - ADIOI_Free(e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); + ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_orde.c b/3rd-party/romio341/mpi-io/read_orde.c similarity index 69% rename from 3rd-party/romio321/mpi-io/read_orde.c rename to 3rd-party/romio341/mpi-io/read_orde.c index 542f687bc20e1472a9de394efbe0df800e7d948b..c1385393e200c82a5e6d3b1df34ef1c30ed706f0 100644 --- a/3rd-party/romio321/mpi-io/read_orde.c +++ b/3rd-party/romio341/mpi-io/read_orde.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_read_ordered_end as PMPI_File_read_ordered_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_ordered_end"))); +int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_ordered_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,13 +36,13 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status * status) { - int error_code=MPI_SUCCESS; + int error_code = MPI_SUCCESS; ADIO_File adio_fh; static char myname[] = "MPI_FILE_READ_ORDERED_END"; - MPIU_UNREFERENCED_ARG(buf); + MPL_UNREFERENCED_ARG(buf); ROMIO_THREAD_CS_ENTER(); @@ -52,23 +51,21 @@ int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status) /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if (!(adio_fh->split_coll_count)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcollnone", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (!(adio_fh->split_coll_count)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) - *status = adio_fh->split_status; + *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/read_sh.c b/3rd-party/romio341/mpi-io/read_sh.c similarity index 72% rename from 3rd-party/romio321/mpi-io/read_sh.c rename to 3rd-party/romio341/mpi-io/read_sh.c index 83c29daa7e921e1077e52ff1f45c4bcc4320eac3..ab2f2266fa5f69326feeb6d16326e0a702cb0bbc 100644 --- a/3rd-party/romio321/mpi-io/read_sh.c +++ b/3rd-party/romio341/mpi-io/read_sh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_read_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_shared"))); + MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_read_shared"))); #endif /* Include mapping from MPI->PMPI */ @@ -43,14 +42,14 @@ Output Parameters: .N fortran @*/ int MPI_File_read_shared(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code, buftype_is_contig, filetype_is_contig; static char myname[] = "MPI_FILE_READ_SHARED"; MPI_Count datatype_size; ADIO_Offset off, shared_fp, incr, bufsize; ADIO_File adio_fh; - void *xbuf=NULL, *e32_buf=NULL; + void *xbuf = NULL, *e32_buf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -68,13 +67,12 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count, MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code); /* --END ERROR HANDLING-- */ - if (count*datatype_size == 0) - { + if (count * datatype_size == 0) { #ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); + MPIR_Status_set_bytes(status, datatype, 0); #endif - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ @@ -88,67 +86,61 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count, ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { + if (error_code != MPI_SUCCESS) { error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + goto fn_exit; } /* --END ERROR HANDLING-- */ xbuf = buf; - if (adio_fh->is_external32) - { + if (adio_fh->is_external32) { MPI_Aint e32_size = 0; error_code = MPIU_datatype_full_size(datatype, &e32_size); if (error_code != MPI_SUCCESS) goto fn_exit; - e32_buf = ADIOI_Malloc(e32_size*count); - xbuf = e32_buf; + e32_buf = ADIOI_Malloc(e32_size * count); + xbuf = e32_buf; } /* contiguous or strided? */ - if (buftype_is_contig && filetype_is_contig) - { - /* convert count and shared_fp to bytes */ + if (buftype_is_contig && filetype_is_contig) { + /* convert count and shared_fp to bytes */ bufsize = datatype_size * count; off = adio_fh->disp + adio_fh->etype_size * shared_fp; /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. On NFS, locking - is done in the ADIO_ReadContig.*/ + * could be a concurrent noncontiguous request. On NFS, locking + * is done in the ADIO_ReadContig. */ if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS)) ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); ADIO_ReadContig(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, &error_code); + off, status, &error_code); if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS)) ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - else - { - ADIO_ReadStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ + } else { + ADIO_ReadStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ } /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ if (e32_buf != NULL) { - error_code = MPIU_read_external32_conversion_fn(buf, datatype, - count, e32_buf); - ADIOI_Free(e32_buf); + error_code = MPIU_read_external32_conversion_fn(buf, datatype, count, e32_buf); + ADIOI_Free(e32_buf); } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/register_datarep.c b/3rd-party/romio341/mpi-io/register_datarep.c similarity index 53% rename from 3rd-party/romio321/mpi-io/register_datarep.c rename to 3rd-party/romio341/mpi-io/register_datarep.c index 38958723327ad52c3e2272be8a61a1fc8904115f..c2f3e6a3e7bdae8ead77b601d32a3fc4eaa41f75 100644 --- a/3rd-party/romio321/mpi-io/register_datarep.c +++ b/3rd-party/romio341/mpi-io/register_datarep.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,9 +16,10 @@ #pragma _CRI duplicate MPI_Register_datarep as PMPI_Register_datarep /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_Register_datarep(const char *datarep, MPI_Datarep_conversion_function *read_conversion_fn, - MPI_Datarep_conversion_function *write_conversion_fn, - MPI_Datarep_extent_function *dtype_file_extent_fn, void *extra_state) __attribute__((weak,alias("PMPI_Register_datarep"))); +int MPI_Register_datarep(const char *datarep, MPI_Datarep_conversion_function * read_conversion_fn, + MPI_Datarep_conversion_function * write_conversion_fn, + MPI_Datarep_extent_function * dtype_file_extent_fn, void *extra_state) + __attribute__ ((weak, alias("PMPI_Register_datarep"))); #endif /* Include mapping from MPI->PMPI */ @@ -28,7 +28,7 @@ int MPI_Register_datarep(const char *datarep, MPI_Datarep_conversion_function *r #endif /*@ - MPI_Register_datarep - Register functions for user-defined data + MPI_Register_datarep - Register functions for user-defined data representations Input Parameters: @@ -45,18 +45,17 @@ Input Parameters: Notes: This function allows the user to provide routines to convert data from an external representation, used within a file, and the native representation, - used within the CPU. There is one predefined data representation, + used within the CPU. There is one predefined data representation, 'external32'. Please consult the MPI-2 standard for details on this function. .N fortran - + @*/ int MPI_Register_datarep(ROMIO_CONST char *datarep, - MPI_Datarep_conversion_function *read_conversion_fn, - MPI_Datarep_conversion_function *write_conversion_fn, - MPI_Datarep_extent_function *dtype_file_extent_fn, - void *extra_state) + MPI_Datarep_conversion_function * read_conversion_fn, + MPI_Datarep_conversion_function * write_conversion_fn, + MPI_Datarep_extent_function * dtype_file_extent_fn, void *extra_state) { int error_code; ADIOI_Datarep *adio_datarep; @@ -66,79 +65,68 @@ int MPI_Register_datarep(ROMIO_CONST char *datarep, /* --BEGIN ERROR HANDLING-- */ /* check datarep name (use strlen instead of strnlen because - strnlen is not portable) */ - if (datarep == NULL || - strlen(datarep) < 1 || - strlen(datarep) > MPI_MAX_DATAREP_STRING) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**datarepname", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + * strnlen is not portable) */ + if (datarep == NULL || strlen(datarep) < 1 || strlen(datarep) > MPI_MAX_DATAREP_STRING) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**datarepname", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ MPIR_MPIOInit(&error_code); - if (error_code != MPI_SUCCESS) goto fn_exit; + if (error_code != MPI_SUCCESS) + goto fn_exit; /* --BEGIN ERROR HANDLING-- */ /* check datarep isn't already registered */ for (adio_datarep = ADIOI_Datarep_head; adio_datarep; adio_datarep = adio_datarep->next) { - if (!strncmp(datarep, adio_datarep->name, MPI_MAX_DATAREP_STRING)) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_DUP_DATAREP, - "**datarepused", - "**datarepused %s", - datarep); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; - } + if (!strncmp(datarep, adio_datarep->name, MPI_MAX_DATAREP_STRING)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_DUP_DATAREP, + "**datarepused", "**datarepused %s", datarep); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + } } /* Check Non-NULL Read and Write conversion function pointer */ /* Read and Write conversions are currently not supported. */ - if ( (read_conversion_fn != NULL) || (write_conversion_fn != NULL) ) - { + if ((read_conversion_fn != NULL) || (write_conversion_fn != NULL)) { error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, - MPI_ERR_CONVERSION, - "**drconvnotsupported", 0); + MPI_ERR_CONVERSION, "**drconvnotsupported", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* check extent function pointer */ - if (dtype_file_extent_fn == NULL) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_ARG, - "**datarepextent", 0); - error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); - goto fn_exit; + if (dtype_file_extent_fn == NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**datarepextent", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ adio_datarep = ADIOI_Malloc(sizeof(ADIOI_Datarep)); adio_datarep->name = ADIOI_Strdup(datarep); - adio_datarep->state = extra_state; - adio_datarep->read_conv_fn = read_conversion_fn; + adio_datarep->state = extra_state; + adio_datarep->read_conv_fn = read_conversion_fn; adio_datarep->write_conv_fn = write_conversion_fn; - adio_datarep->extent_fn = dtype_file_extent_fn; - adio_datarep->next = ADIOI_Datarep_head; + adio_datarep->extent_fn = dtype_file_extent_fn; + adio_datarep->next = ADIOI_Datarep_head; ADIOI_Datarep_head = adio_datarep; error_code = MPI_SUCCESS; -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio341/mpi-io/seek.c b/3rd-party/romio341/mpi-io/seek.c new file mode 100644 index 0000000000000000000000000000000000000000..4be25b87831abb847cf76328684b7d2bcec899bc --- /dev/null +++ b/3rd-party/romio341/mpi-io/seek.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" +#include "adioi.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_seek = PMPI_File_seek +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_seek MPI_File_seek +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_seek as PMPI_File_seek +/* end of weak pragmas */ +#elif defined(HAVE_WEAK_ATTRIBUTE) +int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) + __attribute__ ((weak, alias("PMPI_File_seek"))); +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_seek - Updates the individual file pointer + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (integer) +. whence - update mode (state) + +.N fortran +@*/ +int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) +{ + int error_code; + ADIO_File adio_fh; + static char myname[] = "MPI_FILE_SEEK"; + MPI_Offset curr_offset, eof_offset; + +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILESEEK, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); +#endif /* MPI_hpux */ + + ROMIO_THREAD_CS_ENTER(); + + adio_fh = MPIO_File_resolve(fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + switch (whence) { + case MPI_SEEK_SET: + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + case MPI_SEEK_CUR: + /* find offset corr. to current location of file pointer */ + ADIOI_Get_position(adio_fh, &curr_offset); + offset += curr_offset; + + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, "**ionegoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + break; + case MPI_SEEK_END: + /* we can in many cases do seeks w/o a file actually opened, but not in + * the MPI_SEEK_END case */ + ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_seek", &error_code); + + /* find offset corr. to end of file */ + ADIOI_Get_eof_offset(adio_fh, &eof_offset); + offset += eof_offset; + + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, "**ionegoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + break; + default: + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadwhence", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ + } + + ADIO_SeekIndividual(adio_fh, offset, ADIO_SEEK_SET, &error_code); + /* TODO: what do we do with this error? */ + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(adio_fh, error_code); + /* --END ERROR HANDLING-- */ + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); +#endif /* MPI_hpux */ + + error_code = MPI_SUCCESS; + + fn_exit: + ROMIO_THREAD_CS_EXIT(); + return error_code; +} diff --git a/3rd-party/romio341/mpi-io/seek_sh.c b/3rd-party/romio341/mpi-io/seek_sh.c new file mode 100644 index 0000000000000000000000000000000000000000..8ae6e6b3282af48f22c2011b8653c59cebe166ec --- /dev/null +++ b/3rd-party/romio341/mpi-io/seek_sh.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_seek_shared = PMPI_File_seek_shared +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_seek_shared MPI_File_seek_shared +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_seek_shared as PMPI_File_seek_shared +/* end of weak pragmas */ +#elif defined(HAVE_WEAK_ATTRIBUTE) +int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) + __attribute__ ((weak, alias("PMPI_File_seek_shared"))); +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_seek_shared - Updates the shared file pointer + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (integer) +. whence - update mode (state) + +.N fortran +@*/ +int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) +{ + int error_code = MPI_SUCCESS, tmp_whence, myrank; + static char myname[] = "MPI_FILE_SEEK_SHARED"; + MPI_Offset curr_offset, eof_offset, tmp_offset; + ADIO_File adio_fh; + + ROMIO_THREAD_CS_ENTER(); + + adio_fh = MPIO_File_resolve(fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + tmp_offset = offset; + MPI_Bcast(&tmp_offset, 1, ADIO_OFFSET, 0, adio_fh->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_offset != offset) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**notsame", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + tmp_whence = whence; + MPI_Bcast(&tmp_whence, 1, MPI_INT, 0, adio_fh->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_whence != whence) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadwhence", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_seek_shared", &error_code); + + MPI_Comm_rank(adio_fh->comm, &myrank); + + if (!myrank) { + switch (whence) { + case MPI_SEEK_SET: + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + case MPI_SEEK_CUR: + /* get current location of shared file pointer */ + ADIO_Get_shared_fp(adio_fh, 0, &curr_offset, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_FATAL, + myname, __LINE__, + MPI_ERR_INTERN, "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + offset += curr_offset; + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**ionegoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + case MPI_SEEK_END: + /* find offset corr. to end of file */ + ADIOI_Get_eof_offset(adio_fh, &eof_offset); + offset += eof_offset; + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "**ionegoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + default: + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadwhence", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ + } + + ADIO_Set_shared_fp(adio_fh, offset, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_FATAL, + myname, __LINE__, + MPI_ERR_INTERN, "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + } + + /* FIXME: explain why the barrier is necessary */ + MPI_Barrier(adio_fh->comm); + + error_code = MPI_SUCCESS; + + fn_exit: + ROMIO_THREAD_CS_EXIT(); + + return error_code; +} diff --git a/3rd-party/romio321/mpi-io/set_atom.c b/3rd-party/romio341/mpi-io/set_atom.c similarity index 72% rename from 3rd-party/romio321/mpi-io/set_atom.c rename to 3rd-party/romio341/mpi-io/set_atom.c index 00be9fc35b31c7b7afe7cf21fe6b55e4e8524e8e..b16ddff0be146fb2068cb52c20a350965fa3c428 100644 --- a/3rd-party/romio321/mpi-io/set_atom.c +++ b/3rd-party/romio341/mpi-io/set_atom.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_set_atomicity as PMPI_File_set_atomicity /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_set_atomicity(MPI_File fh, int flag) __attribute__((weak,alias("PMPI_File_set_atomicity"))); +int MPI_File_set_atomicity(MPI_File fh, int flag) + __attribute__ ((weak, alias("PMPI_File_set_atomicity"))); #endif /* Include mapping from MPI->PMPI */ @@ -51,7 +50,8 @@ int MPI_File_set_atomicity(MPI_File fh, int flag) ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); - if (flag) flag = 1; /* take care of non-one values! */ + if (flag) + flag = 1; /* take care of non-one values! */ /* check if flag is the same on all processes */ tmp_flag = flag; @@ -59,17 +59,16 @@ int MPI_File_set_atomicity(MPI_File fh, int flag) /* --BEGIN ERROR HANDLING-- */ if (tmp_flag != flag) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**notsame", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**notsame", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ - if (adio_fh->atomicity == flag){ - error_code = MPI_SUCCESS; - goto fn_exit; + if (adio_fh->atomicity == flag) { + error_code = MPI_SUCCESS; + goto fn_exit; } @@ -80,12 +79,12 @@ int MPI_File_set_atomicity(MPI_File fh, int flag) /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ ADIOI_Free(fcntl_struct); -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/set_errh.c b/3rd-party/romio341/mpi-io/set_errh.c similarity index 53% rename from 3rd-party/romio321/mpi-io/set_errh.c rename to 3rd-party/romio341/mpi-io/set_errh.c index d943787e35844eea9afe10d25ee7dd8f3f3b9287..25ade22daaee0ec5fca1631fee82a0e2ddc16336 100644 --- a/3rd-party/romio321/mpi-io/set_errh.c +++ b/3rd-party/romio341/mpi-io/set_errh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ #pragma _CRI duplicate MPI_File_set_errhandler as PMPI_File_set_errhandler /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_set_errhandler(MPI_File file, MPI_Errhandler errhandler) __attribute__((weak,alias("PMPI_File_set_errhandler"))); +int MPI_File_set_errhandler(MPI_File file, MPI_Errhandler errhandler) + __attribute__ ((weak, alias("PMPI_File_set_errhandler"))); #endif /* Include mapping from MPI->PMPI */ @@ -40,37 +39,32 @@ int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler) int error_code = MPI_SUCCESS; static char myname[] = "MPI_FILE_SET_ERRHANDLER"; ADIO_File fh; - MPID_THREADPRIV_DECL; ROMIO_THREAD_CS_ENTER(); if (mpi_fh == MPI_FILE_NULL) { - ADIOI_DFLT_ERR_HANDLER = errhandler; - } - else { - fh = MPIO_File_resolve(mpi_fh); + ADIOI_DFLT_ERR_HANDLER = errhandler; + } else { + fh = MPIO_File_resolve(mpi_fh); - /* --BEGIN ERROR HANDLING-- */ - MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); - /* --END ERROR HANDLING-- */ + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ - if ((errhandler != MPI_ERRORS_RETURN) && - (errhandler != MPI_ERRORS_ARE_FATAL)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, - MPIR_ERR_RECOVERABLE, - myname, __LINE__, - MPI_ERR_UNSUPPORTED_OPERATION, - "**fileopunsupported", - 0); - error_code = MPIO_Err_return_file(fh, error_code); - goto fn_exit; - } + if ((errhandler != MPI_ERRORS_RETURN) && (errhandler != MPI_ERRORS_ARE_FATAL)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_OPERATION, + "**fileopunsupported", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } - fh->err_handler = errhandler; + fh->err_handler = errhandler; } -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio321/mpi-io/set_info.c b/3rd-party/romio341/mpi-io/set_info.c similarity index 79% rename from 3rd-party/romio321/mpi-io/set_info.c rename to 3rd-party/romio341/mpi-io/set_info.c index 2c898fe85acc6151899809e2d47c0bccaa3df8cb..cddbaa0c34a461b01c715daeba22eded5a157eee 100644 --- a/3rd-party/romio321/mpi-io/set_info.c +++ b/3rd-party/romio341/mpi-io/set_info.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_set_info as PMPI_File_set_info /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_set_info(MPI_File fh, MPI_Info info) __attribute__((weak,alias("PMPI_File_set_info"))); +int MPI_File_set_info(MPI_File fh, MPI_Info info) + __attribute__ ((weak, alias("PMPI_File_set_info"))); #endif /* Include mapping from MPI->PMPI */ @@ -52,15 +51,15 @@ int MPI_File_set_info(MPI_File fh, MPI_Info info) /* set new info */ ADIO_SetInfo(adio_fh, info, &error_code); -fn_exit: + fn_exit: /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ ROMIO_THREAD_CS_EXIT(); return error_code; -fn_fail: + fn_fail: goto fn_exit; } diff --git a/3rd-party/romio321/mpi-io/set_size.c b/3rd-party/romio341/mpi-io/set_size.c similarity index 66% rename from 3rd-party/romio321/mpi-io/set_size.c rename to 3rd-party/romio341/mpi-io/set_size.c index b658929576db73d97f78cc86634e235f88bd2dfa..c57256460c6fd5b9c46170db1f20c448100aad86 100644 --- a/3rd-party/romio321/mpi-io/set_size.c +++ b/3rd-party/romio341/mpi-io/set_size.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_set_size as PMPI_File_set_size /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_set_size(MPI_File fh, MPI_Offset size) __attribute__((weak,alias("PMPI_File_set_size"))); +int MPI_File_set_size(MPI_File fh, MPI_Offset size) + __attribute__ ((weak, alias("PMPI_File_set_size"))); #endif /* Include mapping from MPI->PMPI */ @@ -44,8 +43,7 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size) #ifdef MPI_hpux int fl_xmpi; - HPMP_IO_START(fl_xmpi, BLKMPIFILESETSIZE, TRDTBLOCK, adio_fh, - MPI_DATATYPE_NULL, -1); + HPMP_IO_START(fl_xmpi, BLKMPIFILESETSIZE, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ ROMIO_THREAD_CS_ENTER(); @@ -57,11 +55,10 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size) MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); if (size < 0) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadsize", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadsize", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } MPIO_CHECK_WRITABLE(fh, myname, error_code); /* --END ERROR HANDLING-- */ @@ -72,33 +69,32 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size) /* --BEGIN ERROR HANDLING-- */ if (max_sz != min_sz) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**notsame", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**notsame", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ if (!ADIO_Feature(adio_fh, ADIO_SCALABLE_RESIZE)) { - /* rare stupid file systems (like NFS) need to carry out resize on all - * processes */ - ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_set_size", &error_code); + /* rare stupid file systems (like NFS) need to carry out resize on all + * processes */ + ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_set_size", &error_code); } ADIO_Resize(adio_fh, size, &error_code); /* TODO: what to do with error code? */ - + /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio341/mpi-io/set_view.c b/3rd-party/romio341/mpi-io/set_view.c new file mode 100644 index 0000000000000000000000000000000000000000..261c9a8f77d642be2487cd82257b3a9f2c9c84c8 --- /dev/null +++ b/3rd-party/romio341/mpi-io/set_view.c @@ -0,0 +1,185 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_set_view = PMPI_File_set_view +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_set_view MPI_File_set_view +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_set_view as PMPI_File_set_view +/* end of weak pragmas */ +#elif defined(HAVE_WEAK_ATTRIBUTE) +int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, + const char *datarep, MPI_Info info) + __attribute__ ((weak, alias("PMPI_File_set_view"))); +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_set_view - Sets the file view + +Input Parameters: +. fh - file handle (handle) +. disp - displacement (nonnegative integer) +. etype - elementary datatype (handle) +. filetype - filetype (handle) +. datarep - data representation (string) +. info - info object (handle) + +.N fortran +@*/ +int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, ROMIO_CONST char *datarep, MPI_Info info) +{ + int error_code = MPI_SUCCESS; + MPI_Count filetype_size, etype_size; + static char myname[] = "MPI_FILE_SET_VIEW"; + ADIO_Offset shared_fp, byte_off; + ADIO_File adio_fh; + + ROMIO_THREAD_CS_ENTER(); + + adio_fh = MPIO_File_resolve(fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); + + if ((disp < 0) && (disp != MPI_DISPLACEMENT_CURRENT)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobaddisp", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + + /* rudimentary checks for incorrect etype/filetype. */ + if (etype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**ioetype", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + MPIO_DATATYPE_ISCOMMITTED(etype, error_code); + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + + if (filetype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iofiletype", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + MPIO_DATATYPE_ISCOMMITTED(filetype, error_code); + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + + if ((adio_fh->access_mode & MPI_MODE_SEQUENTIAL) && (disp != MPI_DISPLACEMENT_CURRENT)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iodispifseq", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + + if ((disp == MPI_DISPLACEMENT_CURRENT) && !(adio_fh->access_mode & MPI_MODE_SEQUENTIAL)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iodispifseq", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + MPIO_CHECK_INFO_ALL(info, error_code, adio_fh->comm); + /* --END ERROR HANDLING-- */ + + MPI_Type_size_x(filetype, &filetype_size); + MPI_Type_size_x(etype, &etype_size); + + /* --BEGIN ERROR HANDLING-- */ + if (etype_size != 0 && filetype_size % etype_size != 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iofiletype", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + + if ((datarep == NULL) || (strcmp(datarep, "native") && + strcmp(datarep, "NATIVE") && + strcmp(datarep, "external32") && + strcmp(datarep, "EXTERNAL32") && + strcmp(datarep, "internal") && strcmp(datarep, "INTERNAL"))) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_DATAREP, "**unsupporteddatarep", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (disp == MPI_DISPLACEMENT_CURRENT) { + MPI_Barrier(adio_fh->comm); + ADIO_Get_shared_fp(adio_fh, 0, &shared_fp, &error_code); + /* TODO: check error code */ + + MPI_Barrier(adio_fh->comm); + ADIOI_Get_byte_offset(adio_fh, shared_fp, &byte_off); + /* TODO: check error code */ + + disp = byte_off; + } + + ADIO_Set_view(adio_fh, disp, etype, filetype, info, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + /* reset shared file pointer to zero */ + if (ADIO_Feature(adio_fh, ADIO_SHARED_FP) && (adio_fh->shared_fp_fd != ADIO_FILE_NULL)) { + /* only one process needs to set it to zero, but I don't want to + * create the shared-file-pointer file if shared file pointers have + * not been used so far. Therefore, every process that has already + * opened the shared-file-pointer file sets the shared file pointer + * to zero. If the file was not opened, the value is automatically + * zero. Note that shared file pointer is stored as no. of etypes + * relative to the current view, whereas indiv. file pointer is + * stored in bytes. */ + + ADIO_Set_shared_fp(adio_fh, 0, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(adio_fh, error_code); + /* --END ERROR HANDLING-- */ + } + + if (ADIO_Feature(adio_fh, ADIO_SHARED_FP)) { + MPI_Barrier(adio_fh->comm); /* for above to work correctly */ + } + if (strcmp(datarep, "external32") && strcmp(datarep, "EXTERNAL32")) + adio_fh->is_external32 = 0; + else + adio_fh->is_external32 = 1; + + fn_exit: + ROMIO_THREAD_CS_EXIT(); + + return error_code; + fn_fail: + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ +} diff --git a/3rd-party/romio321/mpi-io/wr_atallb.c b/3rd-party/romio341/mpi-io/wr_atallb.c similarity index 76% rename from 3rd-party/romio321/mpi-io/wr_atallb.c rename to 3rd-party/romio341/mpi-io/wr_atallb.c index 83eb28bc886cc5ee4db27af6240a9fe2c5f7af8b..36bcf75f34c1bfa691a328cded956adf65a821c3 100644 --- a/3rd-party/romio321/mpi-io/wr_atallb.c +++ b/3rd-party/romio341/mpi-io/wr_atallb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset, const void *buf, int count, - MPI_Datatype datatype) __attribute__((weak,alias("PMPI_File_write_at_all_begin"))); + MPI_Datatype datatype) + __attribute__ ((weak, alias("PMPI_File_write_at_all_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -40,14 +39,13 @@ Input Parameters: .N fortran @*/ int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, - int count, MPI_Datatype datatype) + int count, MPI_Datatype datatype) { int error_code; static char myname[] = "MPI_FILE_WRITE_AT_ALL_BEGIN"; error_code = MPIOI_File_write_all_begin(fh, offset, - ADIO_EXPLICIT_OFFSET, - buf, count, datatype, myname); + ADIO_EXPLICIT_OFFSET, buf, count, datatype, myname); return error_code; } diff --git a/3rd-party/romio321/mpi-io/wr_atalle.c b/3rd-party/romio341/mpi-io/wr_atalle.c similarity index 80% rename from 3rd-party/romio321/mpi-io/wr_atalle.c rename to 3rd-party/romio341/mpi-io/wr_atalle.c index fa2ab514231bef65989e9554894f677138e8b457..53a1be53f0752ecb9f11a63e91f6c2217325e272 100644 --- a/3rd-party/romio321/mpi-io/wr_atalle.c +++ b/3rd-party/romio341/mpi-io/wr_atalle.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_write_at_all_end as PMPI_File_write_at_all_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_write_at_all_end(MPI_File fh, const void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_at_all_end"))); +int MPI_File_write_at_all_end(MPI_File fh, const void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_at_all_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,7 +36,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_at_all_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *status) +int MPI_File_write_at_all_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_AT_ALL_END"; diff --git a/3rd-party/romio321/mpi-io/write.c b/3rd-party/romio341/mpi-io/write.c similarity index 59% rename from 3rd-party/romio321/mpi-io/write.c rename to 3rd-party/romio341/mpi-io/write.c index eb9a77fb82d7f0021ec755b9d8342f7154607ea3..b0ef4f202027cc0a7015e953fc607266e9171da0 100644 --- a/3rd-party/romio321/mpi-io/write.c +++ b/3rd-party/romio341/mpi-io/write.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_write"))); + MPI_Status * status) __attribute__ ((weak, alias("PMPI_File_write"))); #endif /* Include mapping from MPI->PMPI */ @@ -42,7 +41,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE"; @@ -53,7 +52,7 @@ int MPI_File_write(MPI_File fh, ROMIO_CONST void *buf, int count, #endif /* MPI_hpux */ error_code = MPIOI_File_write(fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, buf, - count, datatype, myname, status); + count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); @@ -65,20 +64,17 @@ int MPI_File_write(MPI_File fh, ROMIO_CONST void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_write(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status) -{ + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status) +{ int error_code, buftype_is_contig, filetype_is_contig; MPI_Count datatype_size; ADIO_Offset off, bufsize; ADIO_File adio_fh; - void *e32buf=NULL; - const void *xbuf=NULL; + void *e32buf = NULL; + const void *xbuf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -89,13 +85,11 @@ int MPIOI_File_write(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -105,13 +99,12 @@ int MPIOI_File_write(MPI_File fh, MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code); /* --END ERROR HANDLING-- */ - if (count*datatype_size == 0) - { + if (count * datatype_size == 0) { #ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); + MPIR_Status_set_bytes(status, datatype, 0); #endif - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ @@ -127,58 +120,53 @@ int MPIOI_File_write(MPI_File fh, xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } - if (buftype_is_contig && filetype_is_contig) - { - /* convert bufcount and offset to bytes */ - bufsize = datatype_size * count; - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = adio_fh->disp + adio_fh->etype_size * offset; - } - else /* ADIO_INDIVIDUAL */ { - off = adio_fh->fp_ind; - } + if (buftype_is_contig && filetype_is_contig) { + /* convert bufcount and offset to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = adio_fh->disp + adio_fh->etype_size * offset; + } else { /* ADIO_INDIVIDUAL */ + + off = adio_fh->fp_ind; + } /* if atomic mode requested, lock (exclusive) the region, because - there could be a concurrent noncontiguous request. Locking doesn't - work on PIOFS and PVFS, and on NFS it is done in the - ADIO_WriteContig. - */ + * there could be a concurrent noncontiguous request. Locking doesn't + * work on some parallel file systems, and on NFS it is done in the + * ADIO_WriteContig. + */ - if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) - { + if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - } + } - ADIO_WriteContig(adio_fh, xbuf, count, datatype, file_ptr_type, - off, status, &error_code); + ADIO_WriteContig(adio_fh, xbuf, count, datatype, file_ptr_type, off, status, &error_code); - if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) - { + if ((adio_fh->atomicity) && ADIO_Feature(adio_fh, ADIO_LOCKS)) { ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - } - else - { - /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ - ADIO_WriteStrided(adio_fh, xbuf, count, datatype, file_ptr_type, - offset, status, &error_code); + } + } else { + /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ + ADIO_WriteStrided(adio_fh, xbuf, count, datatype, file_ptr_type, + offset, status, &error_code); } /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if (e32buf!= NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/write_all.c b/3rd-party/romio341/mpi-io/write_all.c similarity index 68% rename from 3rd-party/romio321/mpi-io/write_all.c rename to 3rd-party/romio341/mpi-io/write_all.c index 6f17cc30ad9291dc789a280c25a2593f8cdb35e5..661e3728cd8272e303214464a4b8e53763ca0fd6 100644 --- a/3rd-party/romio321/mpi-io/write_all.c +++ b/3rd-party/romio341/mpi-io/write_all.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_all"))); + MPI_Status * status) __attribute__ ((weak, alias("PMPI_File_write_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -43,7 +41,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_all(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_ALL"; @@ -54,8 +52,7 @@ int MPI_File_write_all(MPI_File fh, ROMIO_CONST void *buf, int count, #endif /* MPI_hpux */ error_code = MPIOI_File_write_all(fh, (MPI_Offset) 0, - ADIO_INDIVIDUAL, buf, - count, datatype, myname, status); + ADIO_INDIVIDUAL, buf, count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); @@ -67,19 +64,16 @@ int MPI_File_write_all(MPI_File fh, ROMIO_CONST void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_write_all(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname, - MPI_Status *status) + MPI_Offset offset, + int file_ptr_type, + const void *buf, + int count, MPI_Datatype datatype, char *myname, MPI_Status * status) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *e32buf=NULL; - const void *xbuf=NULL; + void *e32buf = NULL; + const void *xbuf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -90,13 +84,11 @@ int MPIOI_File_write_all(MPI_File fh, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -111,22 +103,23 @@ int MPIOI_File_write_all(MPI_File fh, xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type, offset, status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if (e32buf != NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/write_allb.c b/3rd-party/romio341/mpi-io/write_allb.c similarity index 61% rename from 3rd-party/romio321/mpi-io/write_allb.c rename to 3rd-party/romio341/mpi-io/write_allb.c index e184723a876e618a7b2aaf2db803bd1dc0c3fb32..672b04fcd0586aa2c165e7912737e842b52ead30 100644 --- a/3rd-party/romio321/mpi-io/write_allb.c +++ b/3rd-party/romio341/mpi-io/write_allb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_all_begin(MPI_File fh, const void *buf, int count, MPI_Datatype datatype) - __attribute__((weak,alias("PMPI_File_write_all_begin"))); + __attribute__ ((weak, alias("PMPI_File_write_all_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -38,15 +36,13 @@ Input Parameters: .N fortran @*/ -int MPI_File_write_all_begin(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype) +int MPI_File_write_all_begin(MPI_File fh, ROMIO_CONST void *buf, int count, MPI_Datatype datatype) { int error_code; static char myname[] = "MPI_FILE_WRITE_ALL_BEGIN"; error_code = MPIOI_File_write_all_begin(fh, (MPI_Offset) 0, - ADIO_INDIVIDUAL, buf, count, - datatype, myname); + ADIO_INDIVIDUAL, buf, count, datatype, myname); return error_code; } @@ -54,18 +50,15 @@ int MPI_File_write_all_begin(MPI_File fh, ROMIO_CONST void *buf, int count, /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING int MPIOI_File_write_all_begin(MPI_File fh, - MPI_Offset offset, - int file_ptr_type, - const void *buf, - int count, - MPI_Datatype datatype, - char *myname) + MPI_Offset offset, + int file_ptr_type, + const void *buf, int count, MPI_Datatype datatype, char *myname) { int error_code; MPI_Count datatype_size; ADIO_File adio_fh; - void *e32buf=NULL; - const void *xbuf=NULL; + void *e32buf = NULL; + const void *xbuf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -77,22 +70,18 @@ int MPIOI_File_write_all_begin(MPI_File fh, MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code); - if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_ARG, - "**iobadoffset", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } - if (adio_fh->split_coll_count) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcoll", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (adio_fh->split_coll_count) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -107,24 +96,25 @@ int MPIOI_File_write_all_begin(MPI_File fh, xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } adio_fh->split_datatype = datatype; ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type, - offset, &adio_fh->split_status, &error_code); + offset, &adio_fh->split_status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if ( e32buf != NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/write_alle.c b/3rd-party/romio341/mpi-io/write_alle.c similarity index 67% rename from 3rd-party/romio321/mpi-io/write_alle.c rename to 3rd-party/romio341/mpi-io/write_alle.c index 6dc7f6d156670f4a4faec28467e7f32999c72f02..02809dc53384a44d42981c0d692898e32bfe2564 100644 --- a/3rd-party/romio321/mpi-io/write_alle.c +++ b/3rd-party/romio341/mpi-io/write_alle.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_write_all_end as PMPI_File_write_all_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_write_all_end(MPI_File fh, const void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_all_end"))); +int MPI_File_write_all_end(MPI_File fh, const void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_all_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,7 +36,7 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_all_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *status) +int MPI_File_write_all_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_ALL_END"; @@ -49,15 +48,12 @@ int MPI_File_write_all_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *statu /* prevent multiple definitions of this routine */ #ifdef MPIO_BUILD_PROFILING -int MPIOI_File_write_all_end(MPI_File fh, - const void *buf, - char *myname, - MPI_Status *status) +int MPIOI_File_write_all_end(MPI_File fh, const void *buf, char *myname, MPI_Status * status) { int error_code; ADIO_File adio_fh; - MPIU_UNREFERENCED_ARG(buf); + MPL_UNREFERENCED_ARG(buf); ROMIO_THREAD_CS_ENTER(); @@ -66,28 +62,26 @@ int MPIOI_File_write_all_end(MPI_File fh, /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if (!(adio_fh->split_coll_count)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcollnone", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (!(adio_fh->split_coll_count)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES /* FIXME - we should really ensure that the split_datatype remains - valid by incrementing the ref count in the write_allb.c routine - and decrement it here after setting the bytes */ + * valid by incrementing the ref count in the write_allb.c routine + * and decrement it here after setting the bytes */ if (status != MPI_STATUS_IGNORE) - *status = adio_fh->split_status; + *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; error_code = MPI_SUCCESS; -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return error_code; diff --git a/3rd-party/romio321/mpi-io/write_at.c b/3rd-party/romio341/mpi-io/write_at.c similarity index 81% rename from 3rd-party/romio321/mpi-io/write_at.c rename to 3rd-party/romio341/mpi-io/write_at.c index 4362322b67b9684019e5c0bf90b8fb8019ee8cb9..d872b7e4dfa863a76e5f0f860980e58d022c5f1a 100644 --- a/3rd-party/romio321/mpi-io/write_at.c +++ b/3rd-party/romio341/mpi-io/write_at.c @@ -1,7 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -16,9 +15,9 @@ #pragma _CRI duplicate MPI_File_write_at as PMPI_File_write_at /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_write_at(MPI_File fh, MPI_Offset offset, const void * buf, int count, - MPI_Datatype datatype, MPI_Status *status) - __attribute__((weak,alias("PMPI_File_write_at"))); +int MPI_File_write_at(MPI_File fh, MPI_Offset offset, const void *buf, int count, + MPI_Datatype datatype, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_at"))); #endif /* Include mapping from MPI->PMPI */ @@ -44,7 +43,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, - int count, MPI_Datatype datatype, MPI_Status *status) + int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_AT"; @@ -56,7 +55,7 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, /* MPIOI_File_write() defined in mpi-io/write.c */ error_code = MPIOI_File_write(fh, offset, ADIO_EXPLICIT_OFFSET, buf, - count, datatype, myname, status); + count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); diff --git a/3rd-party/romio321/mpi-io/write_atall.c b/3rd-party/romio341/mpi-io/write_atall.c similarity index 76% rename from 3rd-party/romio321/mpi-io/write_atall.c rename to 3rd-party/romio341/mpi-io/write_atall.c index 6f815cdd4cbe0659893095867af5ca330d07b98e..49589423100038334a9bde59b5f955fc2274bdd7 100644 --- a/3rd-party/romio321/mpi-io/write_atall.c +++ b/3rd-party/romio341/mpi-io/write_atall.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,8 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) - __attribute__((weak,alias("PMPI_File_write_at_all"))); + MPI_Datatype datatype, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_at_all"))); #endif /* Include mapping from MPI->PMPI */ @@ -45,8 +43,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, - int count, MPI_Datatype datatype, - MPI_Status *status) + int count, MPI_Datatype datatype, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_AT_ALL"; @@ -57,11 +54,10 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, ROMIO_CONST void *buf, #endif /* MPI_hpux */ error_code = MPIOI_File_write_all(fh, offset, ADIO_EXPLICIT_OFFSET, - buf, count, datatype, myname, status); + buf, count, datatype, myname, status); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, datatype, count); #endif /* MPI_hpux */ return error_code; } - diff --git a/3rd-party/romio321/mpi-io/write_ord.c b/3rd-party/romio341/mpi-io/write_ord.c similarity index 73% rename from 3rd-party/romio321/mpi-io/write_ord.c rename to 3rd-party/romio341/mpi-io/write_ord.c index eb72734e9c5265e476aaa4c4bfd299e4f497b19b..b158312dc9ad5872cbf8f7f539e76f197d9b5c6f 100644 --- a/3rd-party/romio321/mpi-io/write_ord.c +++ b/3rd-party/romio341/mpi-io/write_ord.c @@ -1,9 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - * +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -19,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_ordered(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_ordered"))); + MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_ordered"))); #endif /* Include mapping from MPI->PMPI */ @@ -44,7 +42,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code, nprocs, myrank; ADIO_Offset incr; @@ -53,7 +51,7 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count, static char myname[] = "MPI_FILE_WRITE_ORDERED"; ADIO_Offset shared_fp; ADIO_File adio_fh; - void *e32buf=NULL; + void *e32buf = NULL; const void *xbuf; ROMIO_THREAD_CS_ENTER(); @@ -79,23 +77,24 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count, MPI_Comm_size(adio_fh->comm, &nprocs); MPI_Comm_rank(adio_fh->comm, &myrank); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; /* Use a message as a 'token' to order the operations */ source = myrank - 1; - dest = myrank + 1; - if (source < 0) source = MPI_PROC_NULL; - if (dest >= nprocs) dest = MPI_PROC_NULL; + dest = myrank + 1; + if (source < 0) + source = MPI_PROC_NULL; + if (dest >= nprocs) + dest = MPI_PROC_NULL; MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE); ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, - myname, __LINE__, MPI_ERR_INTERN, - "**iosharedfailed", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -103,11 +102,11 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count, xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, @@ -115,14 +114,14 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count, /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if (e32buf != NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); /* FIXME: Check for error code from WriteStridedColl? */ return error_code; } - diff --git a/3rd-party/romio321/mpi-io/write_ordb.c b/3rd-party/romio341/mpi-io/write_ordb.c similarity index 68% rename from 3rd-party/romio321/mpi-io/write_ordb.c rename to 3rd-party/romio341/mpi-io/write_ordb.c index 8b5a3023660d3d0b8e2bb822447dfd1c1a0b10c8..5b27f6b25a834fa1bbf20d68ef8d38c5563d14e6 100644 --- a/3rd-party/romio321/mpi-io/write_ordb.c +++ b/3rd-party/romio341/mpi-io/write_ordb.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,7 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_ordered_begin(MPI_File fh, const void *buf, int count, MPI_Datatype datatype) - __attribute__((weak,alias("PMPI_File_write_ordered_begin"))); + __attribute__ ((weak, alias("PMPI_File_write_ordered_begin"))); #endif /* Include mapping from MPI->PMPI */ @@ -40,7 +38,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype) + MPI_Datatype datatype) { int error_code, nprocs, myrank; ADIO_Offset incr; @@ -50,7 +48,7 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count, ADIO_Offset shared_fp; ADIO_File adio_fh; void *e32buf = NULL; - const void *xbuf=NULL; + const void *xbuf = NULL; ROMIO_THREAD_CS_ENTER(); @@ -61,13 +59,11 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count, MPIO_CHECK_COUNT(adio_fh, count, myname, error_code); MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code); - if (adio_fh->split_coll_count) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcoll", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (adio_fh->split_coll_count) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -85,23 +81,23 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count, MPI_Comm_size(adio_fh->comm, &nprocs); MPI_Comm_rank(adio_fh->comm, &myrank); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; /* Use a message as a 'token' to order the operations */ source = myrank - 1; - dest = myrank + 1; - if (source < 0) source = MPI_PROC_NULL; - if (dest >= nprocs) dest = MPI_PROC_NULL; + dest = myrank + 1; + if (source < 0) + source = MPI_PROC_NULL; + if (dest >= nprocs) + dest = MPI_PROC_NULL; MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE); ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, - myname, __LINE__, MPI_ERR_INTERN, - "**iosharedfailed", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ @@ -109,22 +105,22 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count, xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, &adio_fh->split_status, &error_code); + shared_fp, &adio_fh->split_status, &error_code); /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); /* FIXME: Check for error code from WriteStridedColl? */ diff --git a/3rd-party/romio321/mpi-io/write_orde.c b/3rd-party/romio341/mpi-io/write_orde.c similarity index 69% rename from 3rd-party/romio321/mpi-io/write_orde.c rename to 3rd-party/romio341/mpi-io/write_orde.c index 8cfdba2ecf6dfeee47e5ea5e9383b2edf63f1b12..a99aa0cbb140e5f4b703793d39e21427626b62e9 100644 --- a/3rd-party/romio321/mpi-io/write_orde.c +++ b/3rd-party/romio341/mpi-io/write_orde.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -17,7 +15,8 @@ #pragma _CRI duplicate MPI_File_write_ordered_end as PMPI_File_write_ordered_end /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) -int MPI_File_write_ordered_end(MPI_File fh, const void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_ordered_end"))); +int MPI_File_write_ordered_end(MPI_File fh, const void *buf, MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_ordered_end"))); #endif /* Include mapping from MPI->PMPI */ @@ -37,13 +36,13 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *status) +int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status * status) { int error_code; static char myname[] = "MPI_FILE_WRITE_ORDERED_END"; ADIO_File adio_fh; - MPIU_UNREFERENCED_ARG(buf); + MPL_UNREFERENCED_ARG(buf); ROMIO_THREAD_CS_ENTER(); @@ -52,24 +51,22 @@ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *s /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); - if (!(adio_fh->split_coll_count)) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, - myname, __LINE__, MPI_ERR_IO, - "**iosplitcollnone", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (!(adio_fh->split_coll_count)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ #ifdef HAVE_STATUS_SET_BYTES if (status != MPI_STATUS_IGNORE) - *status = adio_fh->split_status; + *status = adio_fh->split_status; #endif adio_fh->split_coll_count = 0; -fn_exit: + fn_exit: ROMIO_THREAD_CS_EXIT(); return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi-io/write_sh.c b/3rd-party/romio341/mpi-io/write_sh.c similarity index 64% rename from 3rd-party/romio321/mpi-io/write_sh.c rename to 3rd-party/romio341/mpi-io/write_sh.c index ed8e1c198bb78ca73b8696b0bb46207cf4ad9aed..1626fd12fa400a1eae4a828243f2a9bd69e468c5 100644 --- a/3rd-party/romio321/mpi-io/write_sh.c +++ b/3rd-party/romio341/mpi-io/write_sh.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -18,7 +16,8 @@ /* end of weak pragmas */ #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_File_write_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_shared"))); + MPI_Status * status) + __attribute__ ((weak, alias("PMPI_File_write_shared"))); #endif /* Include mapping from MPI->PMPI */ @@ -43,7 +42,7 @@ Output Parameters: .N fortran @*/ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) + MPI_Datatype datatype, MPI_Status * status) { int error_code, buftype_is_contig, filetype_is_contig; ADIO_Offset bufsize; @@ -70,12 +69,12 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count, MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code); /* --END ERROR HANDLING-- */ - if (count*datatype_size == 0) { + if (count * datatype_size == 0) { #ifdef HAVE_STATUS_SET_BYTES - MPIR_Status_set_bytes(status, datatype, 0); + MPIR_Status_set_bytes(status, datatype, 0); #endif - error_code = MPI_SUCCESS; - goto fn_exit; + error_code = MPI_SUCCESS; + goto fn_exit; } /* --BEGIN ERROR HANDLING-- */ @@ -88,62 +87,58 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count, ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code); - incr = (count*datatype_size)/adio_fh->etype_size; + incr = (count * datatype_size) / adio_fh->etype_size; ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code); /* --BEGIN ERROR HANDLING-- */ - if (error_code != MPI_SUCCESS) - { - error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, - myname, __LINE__, MPI_ERR_INTERN, - "**iosharedfailed", 0); - error_code = MPIO_Err_return_file(adio_fh, error_code); - goto fn_exit; + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(adio_fh, error_code); + goto fn_exit; } /* --END ERROR HANDLING-- */ xbuf = buf; if (adio_fh->is_external32) { - error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); - if (error_code != MPI_SUCCESS) - goto fn_exit; + error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf); + if (error_code != MPI_SUCCESS) + goto fn_exit; - xbuf = e32buf; + xbuf = e32buf; } - if (buftype_is_contig && filetype_is_contig) - { + if (buftype_is_contig && filetype_is_contig) { /* convert bufocunt and shared_fp to bytes */ - bufsize = datatype_size * count; - off = adio_fh->disp + adio_fh->etype_size * shared_fp; + bufsize = datatype_size * count; + off = adio_fh->disp + adio_fh->etype_size * shared_fp; /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. On NFS, locking is - done in the ADIO_WriteContig.*/ + * could be a concurrent noncontiguous request. On NFS, locking is + * done in the ADIO_WriteContig. */ if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS)) ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize); - ADIO_WriteContig(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, &error_code); + ADIO_WriteContig(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, status, &error_code); if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS)) ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize); - } - else - { - ADIO_WriteStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ + } else { + ADIO_WriteStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ } /* --BEGIN ERROR HANDLING-- */ if (error_code != MPI_SUCCESS) - error_code = MPIO_Err_return_file(adio_fh, error_code); + error_code = MPIO_Err_return_file(adio_fh, error_code); /* --END ERROR HANDLING-- */ -fn_exit: - if (e32buf != NULL) ADIOI_Free(e32buf); + fn_exit: + if (e32buf != NULL) + ADIOI_Free(e32buf); ROMIO_THREAD_CS_EXIT(); return error_code; } diff --git a/3rd-party/romio341/mpi2-other/array/darray.c b/3rd-party/romio341/mpi2-other/array/darray.c new file mode 100644 index 0000000000000000000000000000000000000000..027bebff79aea6677817dba0f5145f921be2b805 --- /dev/null +++ b/3rd-party/romio341/mpi2-other/array/darray.c @@ -0,0 +1,194 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_Type_create_darray = PMPI_Type_create_darray +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_Type_create_darray MPI_Type_create_darray +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_Type_create_darray as PMPI_Type_create_darray +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ +MPI_Type_create_darray - Creates a datatype corresponding to a distributed, multidimensional array + +Input Parameters: +. size - size of process group (positive integer) +. rank - rank in process group (nonnegative integer) +. ndims - number of array dimensions as well as process grid dimensions (positive integer) +. array_of_gsizes - number of elements of type oldtype in each dimension of global array (array of positive integers) +. array_of_distribs - distribution of array in each dimension (array of state) +. array_of_dargs - distribution argument in each dimension (array of positive integers) +. array_of_psizes - size of process grid in each dimension (array of positive integers) +. order - array storage order flag (state) +. oldtype - old datatype (handle) + +Output Parameters: +. newtype - new datatype (handle) + +.N fortran +@*/ +int MPI_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype) +{ + int err, error_code; + int i; + MPI_Aint lb, orig_extent, size_with_aint; + MPI_Offset size_with_offset; + static char myname[] = "MPI_TYPE_CREATE_DARRAY"; + + /* --BEGIN ERROR HANDLING-- */ + if (size <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid size argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (rank < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid rank argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (ndims <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid ndoms argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_gsizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_gsizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_distribs <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_distribs argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_dargs <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_dargs argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_psizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_psizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + for (i = 0; i < ndims; i++) { + if (array_of_gsizes[i] <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid gsize argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + /* array_of_distribs checked below */ + + if ((array_of_dargs[i] != MPI_DISTRIBUTE_DFLT_DARG) && (array_of_dargs[i] <= 0)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid darg argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + if (array_of_psizes[i] <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid psize argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_distribs[i] != MPI_DISTRIBUTE_BLOCK && + array_of_distribs[i] != MPI_DISTRIBUTE_CYCLIC && + array_of_distribs[i] != MPI_DISTRIBUTE_NONE) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, "Invalid distrib argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_distribs[i] == MPI_DISTRIBUTE_NONE && array_of_psizes[i] != 1) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "For MPI_DISTRIBUTE_NONE, the number of processes in that dimension of the grid must be 1", + 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + } + + /* order argument checked below */ + + if (oldtype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid type argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + MPI_Type_get_extent(oldtype, &lb, &orig_extent); + +/* check if MPI_Aint is large enough for size of global array. + if not, complain. */ + + size_with_aint = orig_extent; + for (i = 0; i < ndims; i++) + size_with_aint *= array_of_gsizes[i]; + size_with_offset = orig_extent; + for (i = 0; i < ndims; i++) + size_with_offset *= array_of_gsizes[i]; + + if (size_with_aint != size_with_offset) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, "Invalid array size", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid order argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + /* --END ERROR HANDLING-- */ + + err = ADIO_Type_create_darray(size, + rank, + ndims, + array_of_gsizes, + array_of_distribs, + array_of_dargs, array_of_psizes, order, oldtype, newtype); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, err, "Internal error", 0); + } + /* --END ERROR HANDLING-- */ + + return MPI_SUCCESS; +} diff --git a/3rd-party/romio341/mpi2-other/array/fortran/darrayf.c b/3rd-party/romio341/mpi2-other/array/fortran/darrayf.c new file mode 100644 index 0000000000000000000000000000000000000000..4d695008a7160e58ac58b351225eb6ce9ed98af0 --- /dev/null +++ b/3rd-party/romio341/mpi2-other/array/fortran/darrayf.c @@ -0,0 +1,148 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "adio.h" +#include "mpio.h" + +#if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS) + +#if defined(HAVE_WEAK_SYMBOLS) +#if defined(HAVE_PRAGMA_WEAK) +#if defined(FORTRANCAPS) +extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_DARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); +#pragma weak MPI_TYPE_CREATE_DARRAY = PMPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_darray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); +#pragma weak mpi_type_create_darray__ = pmpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_darray(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); +#pragma weak mpi_type_create_darray = pmpi_type_create_darray +#else +extern FORTRAN_API void FORT_CALL mpi_type_create_darray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); +#pragma weak mpi_type_create_darray_ = pmpi_type_create_darray_ +#endif + +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#if defined(FORTRANCAPS) +#pragma _HP_SECONDARY_DEF PMPI_TYPE_CREATE_DARRAY MPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray__ mpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray mpi_type_create_darray +#else +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ mpi_type_create_darray_ +#endif + +#elif defined(HAVE_PRAGMA_CRI_DUP) +#if defined(FORTRANCAPS) +#pragma _CRI duplicate MPI_TYPE_CREATE_DARRAY as PMPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#pragma _CRI duplicate mpi_type_create_darray__ as pmpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +#pragma _CRI duplicate mpi_type_create_darray as pmpi_type_create_darray +#else +#pragma _CRI duplicate mpi_type_create_darray_ as pmpi_type_create_darray_ +#endif + +/* end of weak pragmas */ +#endif +/* Include mapping from MPI->PMPI */ +#include "mpioprof.h" +#endif + +#ifdef FORTRANCAPS +#define mpi_type_create_darray_ PMPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#define mpi_type_create_darray_ pmpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray pmpi_type_create_darray_ +#endif +#define mpi_type_create_darray_ pmpi_type_create_darray +#else +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ pmpi_type_create_darray +#endif +#define mpi_type_create_darray_ pmpi_type_create_darray_ +#endif + +#else + +#ifdef FORTRANCAPS +#define mpi_type_create_darray_ MPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#define mpi_type_create_darray_ mpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF mpi_type_create_darray mpi_type_create_darray_ +#endif +#define mpi_type_create_darray_ mpi_type_create_darray +#else +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF mpi_type_create_darray_ mpi_type_create_darray +#endif +#endif +#endif + +#ifdef MPIHP +/* Prototype to keep compiler happy */ +void mpi_type_create_darray_(int *size, int *rank, int *ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int *order, MPI_Fint * oldtype, MPI_Fint * newtype, int *ierr); + +void mpi_type_create_darray_(int *size, int *rank, int *ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int *order, MPI_Fint * oldtype, MPI_Fint * newtype, int *ierr) +{ + MPI_Datatype oldtype_c, newtype_c; + + oldtype_c = MPI_Type_f2c(*oldtype); + + *ierr = + MPI_Type_create_darray(*size, *rank, *ndims, array_of_gsizes, array_of_distribs, + array_of_dargs, array_of_psizes, *order, oldtype_c, &newtype_c); + + *newtype = MPI_Type_c2f(newtype_c); +} + +#else +/* Prototype to keep compiler happy */ +FORTRAN_API void FORT_CALL void mpi_type_create_darray_(MPI_Fint * size, MPI_Fint * rank, + MPI_Fint * ndims, + MPI_Fint * array_of_gsizes, + MPI_Fint * array_of_distribs, + MPI_Fint * array_of_dargs, + MPI_Fint * array_of_psizes, + MPI_Fint * order, MPI_Fint * oldtype, + MPI_Fint * newtype, MPI_Fint * ierr); + +FORTRAN_API void FORT_CALL void mpi_type_create_darray_(MPI_Fint * size, MPI_Fint * rank, + MPI_Fint * ndims, + MPI_Fint * array_of_gsizes, + MPI_Fint * array_of_distribs, + MPI_Fint * array_of_dargs, + MPI_Fint * array_of_psizes, + MPI_Fint * order, MPI_Fint * oldtype, + MPI_Fint * newtype, MPI_Fint * ierr) +{ + *ierr = + MPI_Type_create_darray(*size, *rank, *ndims, array_of_gsizes, array_of_distribs, + array_of_dargs, array_of_psizes, *order, *oldtype, newtype); +} +#endif diff --git a/3rd-party/romio321/mpi2-other/array/fortran/subarrayf.c b/3rd-party/romio341/mpi2-other/array/fortran/subarrayf.c similarity index 55% rename from 3rd-party/romio321/mpi2-other/array/fortran/subarrayf.c rename to 3rd-party/romio341/mpi2-other/array/fortran/subarrayf.c index 7a2e54a530b0b34ea80ddfed58fb6c7caa38f9e6..feae10613b1ceaf823b270be2322226576df8950 100644 --- a/3rd-party/romio321/mpi2-other/array/fortran/subarrayf.c +++ b/3rd-party/romio341/mpi2-other/array/fortran/subarrayf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "adio.h" @@ -14,16 +12,24 @@ #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) -extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_SUBARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); +extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_SUBARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak MPI_TYPE_CREATE_SUBARRAY = PMPI_TYPE_CREATE_SUBARRAY #elif defined(FORTRANDOUBLEUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_type_create_subarray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray__ = pmpi_type_create_subarray__ #elif !defined(FORTRANUNDERSCORE) -extern FORTRAN_API void FORT_CALL mpi_type_create_subarray(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray = pmpi_type_create_subarray #else -extern FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *, MPI_Fint *, + MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray_ = pmpi_type_create_subarray_ #endif @@ -91,37 +97,43 @@ extern FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *, MPI_Fint #ifdef MPIHP /* Prototype to keep compiler happy */ -void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, - int *array_of_subsizes,int *array_of_starts, - int *order,MPI_Fint *oldtype, - MPI_Fint *newtype, int *ierr ); - -void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, - int *array_of_subsizes,int *array_of_starts, - int *order,MPI_Fint *oldtype, - MPI_Fint *newtype, int *ierr ) +void mpi_type_create_subarray_(int *ndims, int *array_of_sizes, + int *array_of_subsizes, int *array_of_starts, + int *order, MPI_Fint * oldtype, MPI_Fint * newtype, int *ierr); + +void mpi_type_create_subarray_(int *ndims, int *array_of_sizes, + int *array_of_subsizes, int *array_of_starts, + int *order, MPI_Fint * oldtype, MPI_Fint * newtype, int *ierr) { MPI_Datatype oldtype_c, newtype_c; oldtype_c = MPI_Type_f2c(*oldtype); - *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes,array_of_subsizes,array_of_starts,*order,oldtype_c,&newtype_c); + *ierr = + MPI_Type_create_subarray(*ndims, array_of_sizes, array_of_subsizes, array_of_starts, *order, + oldtype_c, &newtype_c); *newtype = MPI_Type_c2f(newtype_c); } #else /* Prototype to keep compiler happy */ -FORTRAN_API void FORT_CALL void mpi_type_create_subarray_(MPI_Fint *ndims,MPI_Fint *array_of_sizes, - MPI_Fint *array_of_subsizes,MPI_Fint *array_of_starts, - MPI_Fint *order,MPI_Fint *oldtype, - MPI_Fint *newtype, MPI_Fint *ierr ); - -FORTRAN_API void FORT_CALL void mpi_type_create_subarray_(MPI_Fint *ndims,MPI_Fint *array_of_sizes, - MPI_Fint *array_of_subsizes,MPI_Fint *array_of_starts, - MPI_Fint *order,MPI_Fint *oldtype, - MPI_Fint *newtype, MPI_Fint *ierr ) +FORTRAN_API void FORT_CALL void mpi_type_create_subarray_(MPI_Fint * ndims, + MPI_Fint * array_of_sizes, + MPI_Fint * array_of_subsizes, + MPI_Fint * array_of_starts, + MPI_Fint * order, MPI_Fint * oldtype, + MPI_Fint * newtype, MPI_Fint * ierr); + +FORTRAN_API void FORT_CALL void mpi_type_create_subarray_(MPI_Fint * ndims, + MPI_Fint * array_of_sizes, + MPI_Fint * array_of_subsizes, + MPI_Fint * array_of_starts, + MPI_Fint * order, MPI_Fint * oldtype, + MPI_Fint * newtype, MPI_Fint * ierr) { -*ierr = MPI_Type_create_subarray(*ndims,array_of_sizes,array_of_subsizes,array_of_starts,*order,*oldtype,newtype); + *ierr = + MPI_Type_create_subarray(*ndims, array_of_sizes, array_of_subsizes, array_of_starts, *order, + *oldtype, newtype); } #endif diff --git a/3rd-party/romio341/mpi2-other/array/subarray.c b/3rd-party/romio341/mpi2-other/array/subarray.c new file mode 100644 index 0000000000000000000000000000000000000000..e0bee6c0c450385a06aff6cd675be56c391dcf06 --- /dev/null +++ b/3rd-party/romio341/mpi2-other/array/subarray.c @@ -0,0 +1,166 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_Type_create_subarray = PMPI_Type_create_subarray +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_Type_create_subarray MPI_Type_create_subarray +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_Type_create_subarray as PMPI_Type_create_subarray +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ +MPI_Type_create_subarray - Creates a datatype describing a subarray of a multidimensional array + +Input Parameters: +. ndims - number of array dimensions (positive integer) +. array_of_sizes - number of elements of type oldtype in each dimension of the full array (array of positive integers) +. array_of_subsizes - number of elements of type oldtype in each dimension of the subarray (array of positive integers) +. array_of_starts - starting coordinates of the subarray in each dimension (array of nonnegative integers) +. order - array storage order flag (state) +. oldtype - old datatype (handle) + +Output Parameters: +. newtype - new datatype (handle) + +.N fortran +@*/ +int MPI_Type_create_subarray(int ndims, int *array_of_sizes, + int *array_of_subsizes, int *array_of_starts, + int order, MPI_Datatype oldtype, MPI_Datatype * newtype) +{ + MPI_Aint lb, extent, size_with_aint; + int i, err, error_code; + MPI_Offset size_with_offset; + + /* --BEGIN ERROR HANDLING-- */ + if (ndims <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid ndims argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_sizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_sizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_subsizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_subsizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_starts <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_starts argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + for (i = 0; i < ndims; i++) { + if (array_of_sizes[i] <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid size argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_subsizes[i] <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid subsize argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_starts[i] < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid start argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_subsizes[i] > array_of_sizes[i]) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid subsize argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_starts[i] > (array_of_sizes[i] - array_of_subsizes[i])) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid start argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + } + + /* order argument checked below */ + + if (oldtype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid type argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + MPI_Type_get_extent(oldtype, &lb, &extent); + +/* check if MPI_Aint is large enough for size of global array. + if not, complain. */ + + size_with_aint = extent; + for (i = 0; i < ndims; i++) + size_with_aint *= array_of_sizes[i]; + size_with_offset = extent; + for (i = 0; i < ndims; i++) + size_with_offset *= array_of_sizes[i]; + if (size_with_aint != size_with_offset) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid size argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid order argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + /* --END ERROR HANDLING-- */ + + err = ADIO_Type_create_subarray(ndims, + array_of_sizes, + array_of_subsizes, array_of_starts, order, oldtype, newtype); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, err, "Internal error", 0); + } + /* --END ERROR HANDLING-- */ + + return MPI_SUCCESS; +} diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_createf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_createf.c similarity index 91% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_createf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_createf.c index 5d01ce93d02a69ab6fc2d47dde4c7ce854c09e88..a88be51fa71ed14fd46b9f020411269b6299c9a9 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_createf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_createf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,7 +82,7 @@ #endif #endif -void mpi_info_create_(MPI_Fint *info, int *ierr ) +void mpi_info_create_(MPI_Fint * info, int *ierr) { MPI_Info info_c; diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_deletef.c b/3rd-party/romio341/mpi2-other/info/fortran/info_deletef.c similarity index 86% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_deletef.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_deletef.c index f7a7bb4d58e33664ae5b39e244e6e89d3271347f..34b6b1a2f20661ed02f32ef1980bb080d9ece53d 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_deletef.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_deletef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,7 +82,7 @@ #endif #endif -void mpi_info_delete_(MPI_Fint *info, char *key, int *ierr, int keylen) +void mpi_info_delete_(MPI_Fint * info, char *key, int *ierr, int keylen) { MPI_Info info_c; char *newkey; @@ -97,11 +95,15 @@ void mpi_info_delete_(MPI_Fint *info, char *key, int *ierr, int keylen) /* strip leading and trailing blanks in key */ lead_blanks = 0; - for (i=0; i<keylen; i++) - if (key[i] == ' ') lead_blanks++; - else break; - - for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break; + for (i = 0; i < keylen; i++) + if (key[i] == ' ') + lead_blanks++; + else + break; + + for (i = keylen - 1; i >= 0; i--) + if (key[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_Info_delete: key is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); @@ -109,7 +111,7 @@ void mpi_info_delete_(MPI_Fint *info, char *key, int *ierr, int keylen) new_keylen = i + 1 - lead_blanks; key += lead_blanks; - newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); + newkey = (char *) ADIOI_Malloc((new_keylen + 1) * sizeof(char)); ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; @@ -117,4 +119,3 @@ void mpi_info_delete_(MPI_Fint *info, char *key, int *ierr, int keylen) *ierr = MPI_Info_delete(info_c, newkey); ADIOI_Free(newkey); } - diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_dupf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_dupf.c similarity index 90% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_dupf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_dupf.c index 87162005ab609e3a99132857ceacfe1d4aa3d564..8796d863e808999e4d190f8c6bc65b10a0fb09f1 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_dupf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_dupf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,7 +82,7 @@ #endif #endif -void mpi_info_dup_(MPI_Fint *info, MPI_Fint *newinfo, int *ierr ) +void mpi_info_dup_(MPI_Fint * info, MPI_Fint * newinfo, int *ierr) { MPI_Info info_c, newinfo_c; diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_freef.c b/3rd-party/romio341/mpi2-other/info/fortran/info_freef.c similarity index 91% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_freef.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_freef.c index 5f200c96227cdb15633f6e560fa473ca27d4541a..c060a1b5121c781147803c857a6c11accb6a8cab 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_freef.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_freef.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,7 +82,7 @@ #endif #endif -void mpi_info_free_(MPI_Fint *info, int *ierr ) +void mpi_info_free_(MPI_Fint * info, int *ierr) { MPI_Info info_c; @@ -92,4 +90,3 @@ void mpi_info_free_(MPI_Fint *info, int *ierr ) *ierr = MPI_Info_free(&info_c); *info = MPI_Info_c2f(info_c); } - diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_getf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_getf.c similarity index 78% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_getf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_getf.c index ae60cc22b07346d127b902891f1b959221b4a463..3c74a856428bc02b9fb33b71a67fc4205147c92e 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_getf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_getf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,8 +82,8 @@ #endif #endif -void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, - int *flag, int *ierr, int keylen, int valspace) +void mpi_info_get_(MPI_Fint * info, char *key, int *valuelen, char *value, + int *flag, int *ierr, int keylen, int valspace) { MPI_Info info_c; char *newkey, *tmpvalue; @@ -98,11 +96,15 @@ void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, /* strip leading and trailing blanks in key */ lead_blanks = 0; - for (i=0; i<keylen; i++) - if (key[i] == ' ') lead_blanks++; - else break; - - for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break; + for (i = 0; i < keylen; i++) + if (key[i] == ' ') + lead_blanks++; + else + break; + + for (i = keylen - 1; i >= 0; i--) + if (key[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_Info_get: key is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); @@ -110,7 +112,7 @@ void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, new_keylen = i + 1 - lead_blanks; key += lead_blanks; - newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); + newkey = (char *) ADIOI_Malloc((new_keylen + 1) * sizeof(char)); ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; @@ -123,22 +125,24 @@ void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, MPI_Abort(MPI_COMM_WORLD, 1); } if (*valuelen > valspace) { - FPRINTF(stderr, "MPI_Info_get: valuelen is greater than the amount of memory available in value\n"); + FPRINTF(stderr, + "MPI_Info_get: valuelen is greater than the amount of memory available in value\n"); MPI_Abort(MPI_COMM_WORLD, 1); } - - tmpvalue = (char *) ADIOI_Malloc((*valuelen + 1)*sizeof(char)); + + tmpvalue = (char *) ADIOI_Malloc((*valuelen + 1) * sizeof(char)); info_c = MPI_Info_f2c(*info); *ierr = MPI_Info_get(info_c, newkey, *valuelen, tmpvalue, flag); if (*flag) { - tmpvaluelen = strlen(tmpvalue); - ADIOI_Strncpy(value, tmpvalue, tmpvaluelen); - /* blank pad the remaining space */ - for (i=tmpvaluelen; i<valspace; i++) value[i] = ' '; + tmpvaluelen = strlen(tmpvalue); + ADIOI_Strncpy(value, tmpvalue, tmpvaluelen); + /* blank pad the remaining space */ + for (i = tmpvaluelen; i < valspace; i++) + value[i] = ' '; } - + ADIOI_Free(newkey); ADIOI_Free(tmpvalue); } diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_getnksf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_getnksf.c similarity index 91% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_getnksf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_getnksf.c index ac1fa8bac1ca23248baac6e0b19fa8f3ec8ff33d..d600c7b8c8784503e8f6e3e86163fd5f9ab8ab44 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_getnksf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_getnksf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,10 +82,10 @@ #endif #endif -void mpi_info_get_nkeys_(MPI_Fint *info, int *nkeys, int *ierr ) +void mpi_info_get_nkeys_(MPI_Fint * info, int *nkeys, int *ierr) { MPI_Info info_c; - + info_c = MPI_Info_f2c(*info); *ierr = MPI_Info_get_nkeys(info_c, nkeys); } diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_getnthf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_getnthf.c similarity index 82% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_getnthf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_getnthf.c index 5434fe3dd3effdd8ade7d31b62f29cbb4716704e..a172fd8974214b09cf22bd2cbb0363ad094a0ffa 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_getnthf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_getnthf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,8 +82,7 @@ #endif #endif -void mpi_info_get_nthkey_(MPI_Fint *info, int *n, char *key, int *ierr, - int keylen) +void mpi_info_get_nthkey_(MPI_Fint * info, int *n, char *key, int *ierr, int keylen) { MPI_Info info_c; int i, tmpkeylen; @@ -96,25 +93,24 @@ void mpi_info_get_nthkey_(MPI_Fint *info, int *n, char *key, int *ierr, MPI_Abort(MPI_COMM_WORLD, 1); } - tmpkey = (char *) ADIOI_Malloc((MPI_MAX_INFO_KEY+1) * sizeof(char)); + tmpkey = (char *) ADIOI_Malloc((MPI_MAX_INFO_KEY + 1) * sizeof(char)); info_c = MPI_Info_f2c(*info); *ierr = MPI_Info_get_nthkey(info_c, *n, tmpkey); tmpkeylen = strlen(tmpkey); if (tmpkeylen <= keylen) { - ADIOI_Strncpy(key, tmpkey, tmpkeylen); - - /* blank pad the remaining space */ - for (i=tmpkeylen; i<keylen; i++) key[i] = ' '; - } - else { - /* not enough space */ - ADIOI_Strncpy(key, tmpkey, keylen); - /* this should be flagged as an error. */ - *ierr = MPI_ERR_UNKNOWN; + ADIOI_Strncpy(key, tmpkey, tmpkeylen); + + /* blank pad the remaining space */ + for (i = tmpkeylen; i < keylen; i++) + key[i] = ' '; + } else { + /* not enough space */ + ADIOI_Strncpy(key, tmpkey, keylen); + /* this should be flagged as an error. */ + *ierr = MPI_ERR_UNKNOWN; } ADIOI_Free(tmpkey); } - diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_getvlnf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_getvlnf.c similarity index 86% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_getvlnf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_getvlnf.c index 95030277e63774071e60658cbc83491968af0155..01e5dffd1109144459e4d2e3662b9b7428005cab 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_getvlnf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_getvlnf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -84,8 +82,8 @@ #endif #endif -void mpi_info_get_valuelen_(MPI_Fint *info, char *key, int *valuelen, - int *flag, int *ierr, int keylen ) +void mpi_info_get_valuelen_(MPI_Fint * info, char *key, int *valuelen, + int *flag, int *ierr, int keylen) { MPI_Info info_c; char *newkey; @@ -98,11 +96,15 @@ void mpi_info_get_valuelen_(MPI_Fint *info, char *key, int *valuelen, /* strip leading and trailing blanks in key */ lead_blanks = 0; - for (i=0; i<keylen; i++) - if (key[i] == ' ') lead_blanks++; - else break; + for (i = 0; i < keylen; i++) + if (key[i] == ' ') + lead_blanks++; + else + break; - for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break; + for (i = keylen - 1; i >= 0; i--) + if (key[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_Info_get_valuelen: key is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); @@ -110,7 +112,7 @@ void mpi_info_get_valuelen_(MPI_Fint *info, char *key, int *valuelen, new_keylen = i + 1 - lead_blanks; key += lead_blanks; - newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); + newkey = (char *) ADIOI_Malloc((new_keylen + 1) * sizeof(char)); ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; diff --git a/3rd-party/romio321/mpi2-other/info/fortran/info_setf.c b/3rd-party/romio341/mpi2-other/info/fortran/info_setf.c similarity index 82% rename from 3rd-party/romio321/mpi2-other/info/fortran/info_setf.c rename to 3rd-party/romio341/mpi2-other/info/fortran/info_setf.c index 6b6458d26113c26e7183172632178f6290a6a797..a031d9ea17dfda8efd2804c9a04984cf961cf861 100644 --- a/3rd-party/romio321/mpi2-other/info/fortran/info_setf.c +++ b/3rd-party/romio341/mpi2-other/info/fortran/info_setf.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpio.h" @@ -85,8 +83,7 @@ #endif -void mpi_info_set_(MPI_Fint *info, char *key, char *value, int *ierr, - int keylen, int vallen) +void mpi_info_set_(MPI_Fint * info, char *key, char *value, int *ierr, int keylen, int vallen) { MPI_Info info_c; char *newkey, *newvalue; @@ -103,11 +100,15 @@ void mpi_info_set_(MPI_Fint *info, char *key, char *value, int *ierr, /* strip leading and trailing blanks in key */ lead_blanks = 0; - for (i=0; i<keylen; i++) - if (key[i] == ' ') lead_blanks++; - else break; - - for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break; + for (i = 0; i < keylen; i++) + if (key[i] == ' ') + lead_blanks++; + else + break; + + for (i = keylen - 1; i >= 0; i--) + if (key[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_Info_set: key is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); @@ -115,18 +116,22 @@ void mpi_info_set_(MPI_Fint *info, char *key, char *value, int *ierr, new_keylen = i + 1 - lead_blanks; key += lead_blanks; - newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); + newkey = (char *) ADIOI_Malloc((new_keylen + 1) * sizeof(char)); ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; /* strip leading and trailing blanks in value */ lead_blanks = 0; - for (i=0; i<vallen; i++) - if (value[i] == ' ') lead_blanks++; - else break; - - for (i=vallen-1; i>=0; i--) if (value[i] != ' ') break; + for (i = 0; i < vallen; i++) + if (value[i] == ' ') + lead_blanks++; + else + break; + + for (i = vallen - 1; i >= 0; i--) + if (value[i] != ' ') + break; if (i < 0) { FPRINTF(stderr, "MPI_Info_set: value is a blank string\n"); MPI_Abort(MPI_COMM_WORLD, 1); @@ -134,11 +139,11 @@ void mpi_info_set_(MPI_Fint *info, char *key, char *value, int *ierr, new_vallen = i + 1 - lead_blanks; value += lead_blanks; - newvalue = (char *) ADIOI_Malloc((new_vallen+1)*sizeof(char)); + newvalue = (char *) ADIOI_Malloc((new_vallen + 1) * sizeof(char)); ADIOI_Strncpy(newvalue, value, new_vallen); newvalue[new_vallen] = '\0'; - + info_c = MPI_Info_f2c(*info); *ierr = MPI_Info_set(info_c, newkey, newvalue); ADIOI_Free(newkey); diff --git a/3rd-party/romio321/mpi2-other/info/info_c2f.c b/3rd-party/romio341/mpi2-other/info/info_c2f.c similarity index 52% rename from 3rd-party/romio321/mpi2-other/info/info_c2f.c rename to 3rd-party/romio341/mpi2-other/info/info_c2f.c index 4486887b545d81162f3ccd4e00915c34771a7f03..54d750425b02e8a10636b0d9b65bec4c8195c8ee 100644 --- a/3rd-party/romio321/mpi2-other/info/info_c2f.c +++ b/3rd-party/romio341/mpi2-other/info/info_c2f.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -40,22 +38,23 @@ MPI_Fint MPI_Info_c2f(MPI_Info info) #else int i; - if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) - return (MPI_Fint) 0; + if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) + return (MPI_Fint) 0; if (!MPIR_Infotable) { - MPIR_Infotable_max = 1024; - MPIR_Infotable = (MPI_Info *) - ADIOI_Malloc(MPIR_Infotable_max*sizeof(MPI_Info)); - MPIR_Infotable_ptr = 0; /* 0 can't be used though, because - MPI_INFO_NULL=0 */ - for (i=0; i<MPIR_Infotable_max; i++) MPIR_Infotable[i] = MPI_INFO_NULL; + MPIR_Infotable_max = 1024; + MPIR_Infotable = (MPI_Info *) + ADIOI_Malloc(MPIR_Infotable_max * sizeof(MPI_Info)); + MPIR_Infotable_ptr = 0; /* 0 can't be used though, because + * MPI_INFO_NULL=0 */ + for (i = 0; i < MPIR_Infotable_max; i++) + MPIR_Infotable[i] = MPI_INFO_NULL; } - if (MPIR_Infotable_ptr == MPIR_Infotable_max-1) { - MPIR_Infotable = (MPI_Info *) ADIOI_Realloc(MPIR_Infotable, - (MPIR_Infotable_max+1024)*sizeof(MPI_Info)); - for (i=MPIR_Infotable_max; i<MPIR_Infotable_max+1024; i++) - MPIR_Infotable[i] = MPI_INFO_NULL; - MPIR_Infotable_max += 1024; + if (MPIR_Infotable_ptr == MPIR_Infotable_max - 1) { + MPIR_Infotable = (MPI_Info *) ADIOI_Realloc(MPIR_Infotable, + (MPIR_Infotable_max + 1024) * sizeof(MPI_Info)); + for (i = MPIR_Infotable_max; i < MPIR_Infotable_max + 1024; i++) + MPIR_Infotable[i] = MPI_INFO_NULL; + MPIR_Infotable_max += 1024; } MPIR_Infotable_ptr++; MPIR_Infotable[MPIR_Infotable_ptr] = info; diff --git a/3rd-party/romio321/mpi2-other/info/info_create.c b/3rd-party/romio341/mpi2-other/info/info_create.c similarity index 68% rename from 3rd-party/romio321/mpi2-other/info/info_create.c rename to 3rd-party/romio341/mpi2-other/info/info_create.c index 9b223406edcdb3cc92739dd91fae915fb5c1b158..8c83c0625fbced455a64ec87d7103eebffd107f2 100644 --- a/3rd-party/romio321/mpi2-other/info/info_create.c +++ b/3rd-party/romio341/mpi2-other/info/info_create.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -31,21 +29,22 @@ Output Parameters: .N fortran @*/ -int MPI_Info_create(MPI_Info *info) +int MPI_Info_create(MPI_Info * info) { int error_code; MPIR_MPIOInit(&error_code); - if (error_code != MPI_SUCCESS) goto fn_exit; + if (error_code != MPI_SUCCESS) + goto fn_exit; *info = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); (*info)->cookie = MPIR_INFO_COOKIE; (*info)->key = 0; (*info)->value = 0; (*info)->next = 0; - /* this is the first structure in this linked list. it is - always kept empty. new (key,value) pairs are added after it. */ + /* this is the first structure in this linked list. it is + * always kept empty. new (key,value) pairs are added after it. */ -fn_exit: + fn_exit: return MPI_SUCCESS; } diff --git a/3rd-party/romio321/mpi2-other/info/info_delete.c b/3rd-party/romio341/mpi2-other/info/info_delete.c similarity index 63% rename from 3rd-party/romio321/mpi2-other/info/info_delete.c rename to 3rd-party/romio341/mpi2-other/info/info_delete.c index 06ec27ee8dda38dc3f99d754fc6df46a17d102f5..054dac57ab2c95341f1a020ac7c668522ded1916 100644 --- a/3rd-party/romio321/mpi2-other/info/info_delete.c +++ b/3rd-party/romio341/mpi2-other/info/info_delete.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -43,17 +41,17 @@ int MPI_Info_delete(MPI_Info info, char *key) } if (key <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_delete: key is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_delete: key is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (strlen(key) > MPI_MAX_INFO_KEY) { - FPRINTF(stderr, "MPI_Info_delete: key is longer than MPI_MAX_INFO_KEY\n"); + FPRINTF(stderr, "MPI_Info_delete: key is longer than MPI_MAX_INFO_KEY\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (!strlen(key)) { - FPRINTF(stderr, "MPI_Info_delete: key is a null string\n"); + FPRINTF(stderr, "MPI_Info_delete: key is a null string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } @@ -62,21 +60,21 @@ int MPI_Info_delete(MPI_Info info, char *key) done = 0; while (curr) { - if (!strcmp(curr->key, key)) { - ADIOI_Free(curr->key); - ADIOI_Free(curr->value); - prev->next = curr->next; - ADIOI_Free(curr); - done = 1; - break; - } - prev = curr; - curr = curr->next; + if (!strcmp(curr->key, key)) { + ADIOI_Free(curr->key); + ADIOI_Free(curr->value); + prev->next = curr->next; + ADIOI_Free(curr); + done = 1; + break; + } + prev = curr; + curr = curr->next; } if (!done) { - FPRINTF(stderr, "MPI_Info_delete: key not defined in info\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "MPI_Info_delete: key not defined in info\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_dup.c b/3rd-party/romio341/mpi2-other/info/info_dup.c similarity index 68% rename from 3rd-party/romio321/mpi2-other/info/info_dup.c rename to 3rd-party/romio341/mpi2-other/info/info_dup.c index a1c1a9969fc5db51bb983b2da872bc288bc0a209..d1aa91058c96a57c32f6588801b2c4e407500811 100644 --- a/3rd-party/romio321/mpi2-other/info/info_dup.c +++ b/3rd-party/romio341/mpi2-other/info/info_dup.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -34,7 +32,7 @@ Output Parameters: .N fortran @*/ -int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) +int MPI_Info_dup(MPI_Info info, MPI_Info * newinfo) { MPI_Info curr_old, curr_new; @@ -52,14 +50,14 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) curr_old = info->next; while (curr_old) { - curr_new->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); - curr_new = curr_new->next; - curr_new->cookie = 0; /* cookie not set on purpose */ - curr_new->key = ADIOI_Strdup(curr_old->key); - curr_new->value = ADIOI_Strdup(curr_old->value); - curr_new->next = 0; - - curr_old = curr_old->next; + curr_new->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); + curr_new = curr_new->next; + curr_new->cookie = 0; /* cookie not set on purpose */ + curr_new->key = ADIOI_Strdup(curr_old->key); + curr_new->value = ADIOI_Strdup(curr_old->value); + curr_new->next = 0; + + curr_old = curr_old->next; } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_f2c.c b/3rd-party/romio341/mpi2-other/info/info_f2c.c similarity index 73% rename from 3rd-party/romio321/mpi2-other/info/info_f2c.c rename to 3rd-party/romio341/mpi2-other/info/info_f2c.c index 49d8ae5eec26f6d4c909403ff0ab2925fcb17659..e22e6847ae33f8aae8d369b47ab521a037625927 100644 --- a/3rd-party/romio321/mpi2-other/info/info_f2c.c +++ b/3rd-party/romio341/mpi2-other/info/info_f2c.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -39,10 +37,11 @@ MPI_Info MPI_Info_f2c(MPI_Fint info) #ifndef INT_LT_POINTER return (MPI_Info) info; #else - if (!info) return MPI_INFO_NULL; + if (!info) + return MPI_INFO_NULL; if ((info < 0) || (info > MPIR_Infotable_ptr)) { - FPRINTF(stderr, "MPI_Info_f2c: Invalid info handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + FPRINTF(stderr, "MPI_Info_f2c: Invalid info handle\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } return MPIR_Infotable[info]; #endif diff --git a/3rd-party/romio321/mpi2-other/info/info_free.c b/3rd-party/romio341/mpi2-other/info/info_free.c similarity index 74% rename from 3rd-party/romio321/mpi2-other/info/info_free.c rename to 3rd-party/romio341/mpi2-other/info/info_free.c index e682ce0cd58d2fe8c0b9b7ecc18c22b2af0c7acc..852115df6e9c0762af1965eb674b6b1d98f6b305 100644 --- a/3rd-party/romio321/mpi2-other/info/info_free.c +++ b/3rd-party/romio341/mpi2-other/info/info_free.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -31,7 +29,7 @@ Input Parameters: .N fortran @*/ -int MPI_Info_free(MPI_Info *info) +int MPI_Info_free(MPI_Info * info) { MPI_Info curr, next; @@ -45,11 +43,11 @@ int MPI_Info_free(MPI_Info *info) *info = MPI_INFO_NULL; while (curr) { - next = curr->next; - ADIOI_Free(curr->key); - ADIOI_Free(curr->value); - ADIOI_Free(curr); - curr = next; + next = curr->next; + ADIOI_Free(curr->key); + ADIOI_Free(curr->value); + ADIOI_Free(curr); + curr = next; } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_get.c b/3rd-party/romio341/mpi2-other/info/info_get.c similarity index 69% rename from 3rd-party/romio321/mpi2-other/info/info_get.c rename to 3rd-party/romio341/mpi2-other/info/info_get.c index ca4274672b5da4c99a504642822ba06c13b93d64..721877d382488047b35d6ece7d38dfce8e756cc0 100644 --- a/3rd-party/romio321/mpi2-other/info/info_get.c +++ b/3rd-party/romio341/mpi2-other/info/info_get.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -47,27 +45,27 @@ int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag) } if (key <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (strlen(key) > MPI_MAX_INFO_KEY) { - FPRINTF(stderr, "MPI_Info_get: key is longer than MPI_MAX_INFO_KEY\n"); + FPRINTF(stderr, "MPI_Info_get: key is longer than MPI_MAX_INFO_KEY\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (!strlen(key)) { - FPRINTF(stderr, "MPI_Info_get: key is a null string\n"); + FPRINTF(stderr, "MPI_Info_get: key is a null string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (valuelen <= 0) { - FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n"); + FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (value <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } @@ -75,13 +73,13 @@ int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag) *flag = 0; while (curr) { - if (!strcmp(curr->key, key)) { - ADIOI_Strncpy(value, curr->value, valuelen); - value[valuelen] = '\0'; - *flag = 1; - break; - } - curr = curr->next; + if (!strcmp(curr->key, key)) { + ADIOI_Strncpy(value, curr->value, valuelen); + value[valuelen] = '\0'; + *flag = 1; + break; + } + curr = curr->next; } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_getnks.c b/3rd-party/romio341/mpi2-other/info/info_getnks.c similarity index 83% rename from 3rd-party/romio321/mpi2-other/info/info_getnks.c rename to 3rd-party/romio341/mpi2-other/info/info_getnks.c index fd20826950fa5a1764683ce7b14a79333419f9a5..d7d6165aa7dfde3521942013ab8e328e4db65b22 100644 --- a/3rd-party/romio321/mpi2-other/info/info_getnks.c +++ b/3rd-party/romio341/mpi2-other/info/info_getnks.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -47,8 +45,8 @@ int MPI_Info_get_nkeys(MPI_Info info, int *nkeys) *nkeys = 0; while (curr) { - curr = curr->next; - (*nkeys)++; + curr = curr->next; + (*nkeys)++; } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_getnth.c b/3rd-party/romio341/mpi2-other/info/info_getnth.c similarity index 82% rename from 3rd-party/romio321/mpi2-other/info/info_getnth.c rename to 3rd-party/romio341/mpi2-other/info/info_getnth.c index fa325c41cc01655d92591f3ba223debf147e0dd9..5fd2847e339159adf7ab210a71ec29bd9c528760 100644 --- a/3rd-party/romio321/mpi2-other/info/info_getnth.c +++ b/3rd-party/romio341/mpi2-other/info/info_getnth.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -46,15 +44,15 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) } if (key <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } curr = info->next; nkeys = 0; while (curr) { - curr = curr->next; - nkeys++; + curr = curr->next; + nkeys++; } if ((n < 0) || (n >= nkeys)) { @@ -65,8 +63,8 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) curr = info->next; i = 0; while (i < n) { - curr = curr->next; - i++; + curr = curr->next; + i++; } ADIOI_Strncpy(key, curr->key, MPI_MAX_INFO_KEY); diff --git a/3rd-party/romio321/mpi2-other/info/info_getvln.c b/3rd-party/romio341/mpi2-other/info/info_getvln.c similarity index 73% rename from 3rd-party/romio321/mpi2-other/info/info_getvln.c rename to 3rd-party/romio341/mpi2-other/info/info_getvln.c index b484929b720318ebed00e3e919a7dc515ac1274e..1bf7e4e5d1be9217bef4d7d8bc1aaad9d253810f 100644 --- a/3rd-party/romio321/mpi2-other/info/info_getvln.c +++ b/3rd-party/romio341/mpi2-other/info/info_getvln.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -46,17 +44,17 @@ int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag) } if (key <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_get_valuelen: key is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_get_valuelen: key is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (strlen(key) > MPI_MAX_INFO_KEY) { - FPRINTF(stderr, "MPI_Info_get_valuelen: key is longer than MPI_MAX_INFO_KEY\n"); + FPRINTF(stderr, "MPI_Info_get_valuelen: key is longer than MPI_MAX_INFO_KEY\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (!strlen(key)) { - FPRINTF(stderr, "MPI_Info_get_valuelen: key is a null string\n"); + FPRINTF(stderr, "MPI_Info_get_valuelen: key is a null string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } @@ -64,12 +62,12 @@ int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag) *flag = 0; while (curr) { - if (!strcmp(curr->key, key)) { - *valuelen = strlen(curr->value); - *flag = 1; - break; - } - curr = curr->next; + if (!strcmp(curr->key, key)) { + *valuelen = strlen(curr->value); + *flag = 1; + break; + } + curr = curr->next; } return MPI_SUCCESS; diff --git a/3rd-party/romio321/mpi2-other/info/info_set.c b/3rd-party/romio341/mpi2-other/info/info_set.c similarity index 59% rename from 3rd-party/romio321/mpi2-other/info/info_set.c rename to 3rd-party/romio341/mpi2-other/info/info_set.c index e60d89d79e58f24ddb148c3a06afe65c1852ffeb..2c309661a75e571bc08c9b6a61d6d4e94474b967 100644 --- a/3rd-party/romio321/mpi2-other/info/info_set.c +++ b/3rd-party/romio341/mpi2-other/info/info_set.c @@ -1,8 +1,6 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ #include "mpioimpl.h" @@ -43,32 +41,32 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) } if (key <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_set: key is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_set: key is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (value <= (char *) 0) { - FPRINTF(stderr, "MPI_Info_set: value is an invalid address\n"); + FPRINTF(stderr, "MPI_Info_set: value is an invalid address\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (strlen(key) > MPI_MAX_INFO_KEY) { - FPRINTF(stderr, "MPI_Info_set: key is longer than MPI_MAX_INFO_KEY\n"); + FPRINTF(stderr, "MPI_Info_set: key is longer than MPI_MAX_INFO_KEY\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (strlen(value) > MPI_MAX_INFO_VAL) { - FPRINTF(stderr, "MPI_Info_set: value is longer than MPI_MAX_INFO_VAL\n"); + FPRINTF(stderr, "MPI_Info_set: value is longer than MPI_MAX_INFO_VAL\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (!strlen(key)) { - FPRINTF(stderr, "MPI_Info_set: key is a null string\n"); + FPRINTF(stderr, "MPI_Info_set: key is a null string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } if (!strlen(value)) { - FPRINTF(stderr, "MPI_Info_set: value is a null string\n"); + FPRINTF(stderr, "MPI_Info_set: value is a null string\n"); MPI_Abort(MPI_COMM_WORLD, 1); } @@ -76,22 +74,22 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) curr = info->next; while (curr) { - if (!strcmp(curr->key, key)) { - ADIOI_Free(curr->value); - curr->value = ADIOI_Strdup(value); - break; - } - prev = curr; - curr = curr->next; + if (!strcmp(curr->key, key)) { + ADIOI_Free(curr->value); + curr->value = ADIOI_Strdup(value); + break; + } + prev = curr; + curr = curr->next; } if (!curr) { - prev->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); - curr = prev->next; - curr->cookie = 0; /* cookie not set on purpose */ - curr->key = ADIOI_Strdup(key); - curr->value = ADIOI_Strdup(value); - curr->next = 0; + prev->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); + curr = prev->next; + curr->cookie = 0; /* cookie not set on purpose */ + curr->key = ADIOI_Strdup(key); + curr->value = ADIOI_Strdup(value); + curr->next = 0; } return MPI_SUCCESS; diff --git a/3rd-party/romio341/mpl/Makefile.am b/3rd-party/romio341/mpl/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..44e2e103757a55592fcd95b4a2ffa592b35c3c3c --- /dev/null +++ b/3rd-party/romio341/mpl/Makefile.am @@ -0,0 +1,108 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +ACLOCAL_AMFLAGS = -I confdb +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include + +lib@MPLLIBNAME@_la_SOURCES = +lib@MPLLIBNAME@_la_LDFLAGS = ${lib@MPLLIBNAME@_so_versionflags} + +noinst_HEADERS = +include src/Makefile.mk + +MPL_TESTS = strsep +TESTS = $(MPL_TESTS) +check_PROGRAMS = $(MPL_TESTS) +strsep_SOURCES = test/strsep.c +strsep_LDADD = lib@MPLLIBNAME@.la + +mpl_headers = \ + include/mpl.h \ + include/mpl_arg_serial.h\ + include/mpl_argstr.h \ + include/mpl_atomic.h \ + include/mpl_atomic_by_lock.h\ + include/mpl_atomic_c11.h\ + include/mpl_atomic_gcc_atomic.h\ + include/mpl_atomic_gcc_sync.h\ + include/mpl_atomic_none.h\ + include/mpl_atomic_nt_intrinsics.h\ + include/mpl_base.h \ + include/mpl_dbg.h \ + include/mpl_gpu.h \ + include/mpl_gpu_cuda.h \ + include/mpl_gpu_fallback.h\ + include/mpl_gpu_ze.h \ + include/mpl_math.h \ + include/mplconfig.h \ + include/utlist.h \ + include/mpl_valgrind.h \ + include/mpl_env.h \ + include/mpl_err.h \ + include/mpl_gavl.h \ + include/mpl_str.h \ + include/mpl_trmem.h \ + include/mpl_msg.h \ + include/mpl_posix_mutex_native.h\ + include/mpl_proc_mutex.h\ + include/mpl_proc_mutex_posix.h\ + include/mpl_shm_mmap.h \ + include/mpl_shm_sysv.h \ + include/mpl_shm_win.h \ + include/mpl_sock.h \ + include/mpl_sockaddr.h \ + include/mpl_iov.h \ + include/mpl_bt.h \ + include/mpl_shm.h \ + include/mpl_thread_argobots.h\ + include/mpl_thread.h \ + include/mpl_thread_posix.h\ + include/mpl_thread_priv.h\ + include/mpl_thread_solaris.h\ + include/mpl_thread_win.h\ + include/mpl_timer_clock_gettime.h\ + include/mpl_timer_gcc_ia64_cycle.h\ + include/mpl_timer_gethrtime.h\ + include/mpl_timer_gettimeofday.h\ + include/mpl_timer_linux86_cycle.h\ + include/mpl_timer_mach_absolute_time.h\ + include/mpl_timer_ppc64_cycle.h\ + include/mpl_yield.h\ + include/utarray.h\ + include/uthash.h + +if MPL_EMBEDDED_MODE +noinst_HEADERS += $(mpl_headers) +noinst_LTLIBRARIES = lib@MPLLIBNAME@.la +else !MPL_EMBEDDED_MODE +include_HEADERS = $(mpl_headers) +lib_LTLIBRARIES = lib@MPLLIBNAME@.la +endif !MPL_EMBEDDED_MODE + +# -------------------------------------------------------------------------- +.PHONY: coverage +gcov_sources = $(libmpl_la_SOURCES) +# assumes that these sources were compiled appropriately ("-fprofile-arcs" +# and "-ftest-coverage") +coverage: + @for file in $(gcov_sources) ; do \ + dir=`dirname $$file` ; \ + bname=`basename $$file` ; \ + aux=`echo $$bname | sed -e 's,\.*$$,,'` ; \ + echo "( $(GCOV) -b -f -o $$file $$file && mv $${bname}.gcov $$dir )" ; \ + ( $(GCOV) -b -f -o $$file $$file && mv $${bname}.gcov $$dir ) ; \ + rm -f *.gcov ; \ + done + for subdir in $(SUBDIRS) - ; do \ + if test $$subdir = "-" ; then break ; fi ; \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) coverage ) ; \ + done +# -------------------------------------------------------------------------- + +# files that automake doesn't know about by default that should be included in +# the distribution +EXTRA_DIST = VERSION confdb/cmd_prefix_config_h.pl + +DISTCLEANFILES = _configs.sed include/mplconfig.h diff --git a/3rd-party/romio341/mpl/VERSION b/3rd-party/romio341/mpl/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..204782421f749c852b0dd0633f32f481bf440b0e --- /dev/null +++ b/3rd-party/romio341/mpl/VERSION @@ -0,0 +1,20 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +# For libtool ABI versioning rules see: +# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info + +# 1. If the library source code has changed at all since the last +# update, then increment revision (`c:r:a' becomes `c:r+1:a'). +# +# 2. If any interfaces have been added, removed, or changed since +# the last update, increment current, and set revision to 0. +# +# 3. If any interfaces have been added since the last public +# release, then increment age. +# +# 4. If any interfaces have been removed since the last public +# release, then set age to 0. +libmpl_so_version=1:0 diff --git a/3rd-party/romio341/mpl/confdb/aclocal_am.m4 b/3rd-party/romio341/mpl/confdb/aclocal_am.m4 new file mode 100644 index 0000000000000000000000000000000000000000..4d3b0de2257e4685c29a1498e23da110c6a7bb01 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_am.m4 @@ -0,0 +1,6 @@ +dnl AM_IGNORE is an extension that tells (a patched) automake not to +dnl include the specified AC_SUBST variable in the Makefile.in that +dnl automake generates. We don't use AC_DEFUN, since aclocal will +dnl then complain that AM_IGNORE is a duplicate (if you are using the +dnl patched automake/aclocal). +m4_ifdef([AM_IGNORE],[],[m4_define([AM_IGNORE],[])]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_attr_alias.m4 b/3rd-party/romio341/mpl/confdb/aclocal_attr_alias.m4 new file mode 100644 index 0000000000000000000000000000000000000000..32f016546dc6d43b6d8af94f29c63ee1926bb452 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_attr_alias.m4 @@ -0,0 +1,504 @@ +dnl +dnl Check for BSD or POSIZ style global symbol lister, nm. +dnl If found, pac_path_NM_G contains the absolute athname of nm + options +dnl pac_path_NM_G_type will be either POSIX or BSD. NM_G will be +dnl pac_path_NM_G without the absolute path. Preference is BSD style. +dnl +dnl The test checks if nm accepts the known options and also if nm produces +dnl the expected BSD or POSIX output format. +dnl +AC_DEFUN([PAC_PATH_NM_G],[ +AC_MSG_CHECKING([for BSD/POSIX style global symbol lister]) +AC_LANG_PUSH(C) +AC_PATH_PROGS_FEATURE_CHECK(NM_G, nm, [ + # Check if nm accepts -g and BSD or POSIX compatible flag. + # Use the `sed 1q' to avoid HP-UX's unknown option message: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # + # AIX's sed does not accept \+, 1) instead of doing 's|a\+||', do 's|aa*||' + # or 2) instead of 's|A \+B|AB|g', do 's|A *B|AB|g' + + # Check if nm accepts -g + case `${ac_path_NM_G} -g /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + ac_path_NM_G="${ac_path_NM_G} -g" + # Check if nm accepts -B + case `${ac_path_NM_G} -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([int iglobal;]) + ],[ + changequote(,) + case `${ac_path_NM_G} -B conftest.$OBJEXT | sed -e 's|[0-9][0-9]* *[A-Z] *iglobal|XXXX|g'` in + *XXXX*) + pac_path_NM_G="${ac_path_NM_G} -B" + pac_path_NM_G_type="BSD" + ;; + esac + changequote([,]) + ]) + ;; + *) + # Check if nm accepts -P + case `${ac_path_NM_G} -P /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([int iglobal;]) + ],[ + changequote(,) + case `${ac_path_NM_G} -P conftest.$OBJEXT | sed -e 's|iglobal *[A-Z] *[0-9][0-9]*|XXXX|g'` in + *XXXX*) + pac_path_NM_G="${ac_path_NM_G} -P" + pac_path_NM_G_type="POSIX" + ;; + esac + changequote([,]) + ]) + ;; + esac # Endof case `${ac_path_NM_G} -P + ;; + esac # Endof case `${ac_path_NM_G} -B + ;; + esac # Endof case `${ac_path_NM_G} -g + if test "X$pac_path_NM_G" != "X" ; then + AC_MSG_RESULT([$pac_path_NM_G_type style,$pac_path_NM_G]) + NM_G="`echo $pac_path_NM_G | sed -e 's|^.*nm |nm |g'`" + else + AC_MSG_RESULT(no) + fi + ac_cv_path_NM_G=${ac_path_NM_G} + ac_path_NM_G_found=: +], [AC_MSG_RESULT(no)], +[$PATH$PATH_SEPARATOR/usr/ccs/bin/elf$PATH_SEPARATOR/usr/ccs/bin$PATH_SEPARATOR/usr/ucb$PATH_SEPARATOR/bin]) +AC_LANG_POP(C) +]) dnl Endof AC_DEFUN([PAC_PATH_NM_G] +dnl +dnl PAC_C_MULTI_ATTR_ALIAS() +dnl +dnl The checks if multiple __attribute__((alias)) is available +dnl If the multiple __attribute((alias)) support is found, +dnl pac_c_multi_attr_alias=yes is set. +dnl +dnl The default is to do a runtime test. When cross_compiling=yes, +dnl pac_path_NM_G will be used to determine the test result. +dnl If CFLAGS(or CPPFLAGS) contains ATTR_ALIAS_DEBUG, the runtime will print +dnl out addresses of struct(s) for debugging purpose. +dnl +dnl +AC_DEFUN([PAC_C_MULTI_ATTR_ALIAS],[ +AC_REQUIRE([PAC_PATH_NM_G]) +AC_LANG_PUSH(C) +AC_CHECK_HEADERS([stdio.h]) +AC_MSG_CHECKING([for multiple __attribute__((alias)) support]) + +#Compile the "other" __attribute__ object file. +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif + +struct mpif_cmblk_t_ { int imember; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; + +/* NOT initialize these structure so it appears in BSS or as COMMON symbols */ +mpif_cmblk_t mpifcmb; +mpif_cmblk_t MPIFCMB; + +/* + Do the test in this file instead in the file + where __attribute__((alias)) is used. + This is needed for pgcc since pgcc seems to + define aliased symbols if they are in the same file. +*/ +/* + We can't do the following comparision in one test: + + ilogical = (( &mpifcmb == ptr && &MPIFCMB == ptr ) ? TRUE : FALSE) ; + + because some compiler, like gcc 4.4.2's -O* optimizes the code + such that the ilogical expression is FALSE. The likely reason is that + mpifcmb and MPIFCMB are defined in the same scope in which C optimizer + may have treated them as different objects (with different addresses), + &mpifcmb != &MPIFCMB, before actually running the test and hence the + illogical expression is assumed to be always FALSE. The solution taken + here is to prevent the optimizer the opportunity to equate &mpifcmb and + &MPIFCMB (in same scope), e.g. using 2 separate tests and combine the + test results in a different scope. +*/ +int same_addrs1( void *ptr ); +int same_addrs1( void *ptr ) +{ +#if defined(ATTR_ALIAS_DEBUG) + printf( "others: addr(mpifcmb)=%p, addr(input ptr)=%p\n", &mpifcmb, ptr ); +#endif + return ( &mpifcmb == ptr ? 1 : 0 ); +} + +int same_addrs2( void *ptr ); +int same_addrs2( void *ptr ) +{ +#if defined(ATTR_ALIAS_DEBUG) + printf( "others: addr(MPIFCMB)=%p, addr(input ptr)=%p\n", &MPIFCMB, ptr ); +#endif + return ( &MPIFCMB == ptr ? 1 : 0 ); +} + + ]) +],[ + rm -f pac_conftest_other.$OBJEXT + PAC_RUNLOG([cp conftest.$OBJEXT pac_conftest_other.$OBJEXT]) + test -s pac_conftest_other.$OBJEXT && pac_c_attr_alias_other=yes +dnl cp conftest.$ac_ext pac_conftest_other.$ac_ext +dnl echo +dnl echo "pac_conftest_other.$OBJEXT" +dnl nm -P -g pac_conftest_other.$OBJEXT | grep -i "mpifcmb" +],[ + pac_c_attr_alias_other=no +]) dnl Endof AC_COMPILE_IFELSE + +pac_c_attr_alias_main=no +if test "$pac_c_attr_alias_other" = "yes" ; then + +# Push LIBS for later restoration. + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest_other.$OBJEXT $LIBS" + +# Link the "other" __attribute__ object file. + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif + +struct mpif_cmblk_t_ { int imember; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; + +mpif_cmblk_t mpifcmbr = {0}; +extern mpif_cmblk_t MPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb __attribute__ ((alias("mpifcmbr"))); + +extern int same_addrs1( void *ptr ); +extern int same_addrs2( void *ptr ); + + ],[ + int iaddr = 0; +#if defined(ATTR_ALIAS_DEBUG) + printf( "main: addr(mpifcmbr) = %p\n", &mpifcmbr ); + printf( "main: addr(mpifcmb) = %p\n", &mpifcmb ); + printf( "main: addr(MPIFCMB) = %p\n", &MPIFCMB ); +#endif + iaddr = same_addrs1( &mpifcmbr ) && same_addrs2( &mpifcmbr ); + FILE *file = fopen( "pac_conftestval", "w" ); + if (!file) return 1; + fprintf( file, "%d\n", iaddr ); + ]) + ],[ + rm -f pac_conftest_main$EXEEXT + PAC_RUNLOG([cp conftest$EXEEXT pac_conftest_main$EXEEXT]) + test -x pac_conftest_main$EXEEXT && pac_c_attr_alias_main=yes +dnl cp conftest.$ac_ext pac_conftest_main.$ac_ext +dnl echo +dnl echo "pac_conftest_main$EXEEXT" +dnl nm -P -g pac_conftest_main$EXEEXT | grep -i "mpifcmb" + ],[ + pac_c_attr_alias_main=no +dnl cp conftest.$ac_ext pac_conftest_main.$ac_ext + ]) dnl Endof AC_LINK_IFELSE + +# Restore the previously pushed LIBS + PAC_POP_FLAG([LIBS]) + rm -f pac_conftest_other.$OBJEXT +fi dnl Endof if test "$pac_c_attr_alias_other" = "yes" + +if test "$pac_c_attr_alias_main" = "yes" ; then + if test "$cross_compiling" = "yes" ; then + changequote(,) + # echo "PAC CROSS-COMPILING" dnl + # POSIX NM = nm -P format dnl + if test "$pac_path_NM_G_type" = "POSIX" ; then + addrs=`${pac_path_NM_G} ./pac_conftest_main$EXEEXT | grep -i mpifcmb | sed -e 's% *[a-zA-Z][a-zA-Z]* *[a-zA-Z] *\([0-9abcdef][0-9abcdef]*\).*%\1%g'` + fi + + # BSD NM = nm -B format dnl + if test "$pac_path_NM_G_type" = "BSD" ; then + addrs=`${pac_path_NM_G} -g ./pac_conftest_main$EXEEXT | grep -i mpifcmb | sed -e "s% *\([0-9abcdef][0-9abcdef]*\) *[a-zA-Z] *[a-zA-Z][a-zA-A]*.*%\1%g"` + fi + changequote([,]) + + cmp_addr="" + diff_addrs=no + for addr in ${addrs} ; do + if test "X${cmp_addr}" != "X" ; then + if test "${cmp_addr}" != "${addr}" ; then + diff_addrs=yes + break + fi + else + cmp_addr=${addr} + fi + done + + if test "$diff_addrs" != "yes" ; then + dnl echo "Same addresses. Multiple aliases support" + AC_MSG_RESULT([${NM_G} says yes]) + pac_c_multi_attr_alias=yes + else + dnl echo "Different addresses. No multiple aliases support." + AC_MSG_RESULT([${NM_G} says no]) + pac_c_multi_attr_alias=no + fi + + else # if test "$cross_compiling" != "yes" + rm -f pac_conftestval + ac_try="./pac_conftest_main$EXEEXT" + if AC_TRY_EVAL(ac_try) ; then + pac_c_attr_alias_val=0 + if test -s pac_conftestval ; then + eval pac_c_attr_alias_val=`cat pac_conftestval` + fi + if test "$pac_c_attr_alias_val" -eq 1 ; then + AC_MSG_RESULT(yes) + pac_c_multi_attr_alias=yes + else + AC_MSG_RESULT(no) + pac_c_multi_attr_alias=no + fi + rm -f pac_conftestval + fi + fi + dnl Endof if test "$cross_compiling" = "yes" + rm -f pac_conftest_main$EXEEXT +else + AC_MSG_RESULT(no! link failure) + pac_c_multi_attr_alias=no +fi dnl Endof if test "$pac_c_attr_alias_main" = "yes" + +AC_LANG_POP(C) + +]) dnl Endof AC_DEFUN([PAC_C_MULTI_ATTR_ALIAS] +dnl +dnl PAC_C_ATTR_ALIGNED() +dnl +dnl Check if __attribute__((aligned)) support is there. +dnl If so, set pac_c_attr_aligned=yes. +dnl +dnl Do a link test instead of compile test to check if the linker +dnl would emit an error. +dnl +AC_DEFUN([PAC_C_ATTR_ALIGNED],[ +AC_LANG_PUSH(C) +AC_MSG_CHECKING([for __attribute__((aligned)) support]) +#Link the __attribute__ object file. +AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +struct mpif_cmblk_t_ { int imembers[5]; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; +mpif_cmblk_t mpifcmbr __attribute__((aligned)) = {0}; + ],[]) +],[pac_c_attr_aligned=yes], [pac_c_attr_aligned=no]) +AC_MSG_RESULT([$pac_c_attr_aligned]) +AC_LANG_POP(C) +]) +dnl +dnl PAC_F2C_ATTR_ALIGNED_SIZE(ARRAY_SIZE, [OUTPUT_VAR], [MIN_ALIGNMENT]) +dnl +dnl ARRAY_SIZE : Size of the integer array within the fortran commmon block. +dnl OUTPUT_VAR : Optional variable to be set. +dnl if test succeeds, set OUTPUT_VAR=$pac_f2c_attr_aligned_str. +dnl if test fails, set OUTPUT_VAR="unknown". +dnl MIN_ALIGNMENT : Optional value. +dnl Minimum alignment size to be used in OUTPUT_VAR. +dnl pac_f2c_attr_aligned_str won't be modified. +dnl +dnl "pac_f2c_attr_aligned_str" will be set with +dnl 1) __attribute__((aligned(ALIGNMENT_SIZE))), +dnl 2) __attribute__((aligned)). +dnl 3) "", i.e. empty string. +dnl +dnl 2) means the test can't find a good alignment value, but both the Fortran +dnl and C compilers are OK with "aligned" which in principle means the C +dnl compiler will pick the maximum useful alignment supported by the +dnl architecture. +dnl 3) means that the test has failed to find the alignment. +dnl +AC_DEFUN([PAC_F2C_ATTR_ALIGNED_SIZE],[ +cmblksize=$1 +AC_MSG_CHECKING([the minimum alignment of Fortran common block of $cmblksize integers]) +dnl To find the minmium alignment of Fortran common block (of integer array) +dnl as seen by C object file, C object files of various (typical) alignments +dnl are linked to the Fortran code using the common block of integer array. +# +dnl Since the incorrect alignment results only a warning messages from the +dnl fortran compiler(or linker), so we use "diff" to compare the fortran +dnl compiler/linker output. We cannot use AC_LANG_WERROR, +dnl i.e. ac_fc_werror_flag=yes, because compiler like pgf77 at version 10.x) +dnl has non-zero stderr output if a fortran program is used in the linking. +dnl The stderr contains the name of fortran program even if the linking is +dnl successful. We could avoid the non-zero stderr output in pgf77 by +dnl compiling everthing into object files and linking all the object files +dnl with pgf77. Doing that would need us to use AC_TRY_EVAL instead of +dnl AC_LINK_IFELSE, so "diff" approach is used instead. +# +dnl Using diff of compiler(linker) output requires a reference output file +dnl as the base of diff. The process of creating this reference output file +dnl has to be exactly the same as the testing process, because pgf77 has +dnl the following weird behavour +dnl pgf77 -o ftest ftest.f => when $?=0 with zero stderr output +dnl pgf77 -o ftest ftest.f dummy.o => when $?=0 with non-zero stderr output. +dnl stderr has "ftest.f:". +dnl +# First create a fortran CONFTEST which will be used repeatedly. +AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program fconftest + integer isize + parameter (isize=$cmblksize) + integer status_array(isize) + common /mpifcmb/ status_array + save /mpifcmb/ + end + ]) +]) +AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) +dnl +dnl +dnl +# Compile a C dummy.$OBJEXT and link with Fortran test program to create +# a reference linker output file, pac_align0.log, as the base of "diff". +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[ + cp conftest.$ac_ext pac_conftest.c + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) + PAC_PUSH_FLAG([ac_link]) + ac_link="`echo $ac_link | sed -e 's|>.*$|> $pac_logfile 2>\&1|g'`" + pac_logfile="pac_align0.log" + rm -f $pac_logfile + AC_LINK_IFELSE([],[ + pac_f2c_alignedn_diffbase=yes + ],[ + pac_f2c_alignedn_diffbase=no + ]) + # Be sure NOT to remove the conftest.f which is still needed for later use. + # rm -f conftest.$ac_ext + # Restore everything in autoconf that has been overwritten + PAC_POP_FLAG([ac_link]) + # restore previously pushed LIBS + PAC_POP_FLAG([LIBS]) + AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) +],[ + pac_f2c_alignedn_diffbase=no +]) +AC_LANG_POP([C]) +dnl +dnl +if test "$pac_f2c_alignedn_diffbase" = "yes" ; then + # Initialize pac_result_str to empty string since part of the test + # depends on pac_result_str is empty or non-empty string. + pac_result_str="" + # Initialize pac_f2c_attr_aligned_str to empty string and + # it will remain as empty string if the following test fails. + pac_f2c_attr_aligned_str="" + for asize in 4 8 16 32 64 128 max ; do + if test "$asize" != "max" ; then + pac_attr_aligned_str="__attribute__((aligned($asize)))" + else + pac_attr_aligned_str="__attribute__((aligned))" + fi + AC_LANG_PUSH([C]) + #Compile the __attribute__ object file. + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +changequote(,) +struct mpif_cmblk_t_ { $MPI_FINT imembers[$cmblksize]; }; +changequote([,]) +typedef struct mpif_cmblk_t_ mpif_cmblk_t; +mpif_cmblk_t mpifcmbr $pac_attr_aligned_str = {0}; + +extern mpif_cmblk_t _CMPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t MPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t MPIFCMB_ __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t _Cmpifcmb __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb_ __attribute__ ((alias("mpifcmbr"))); + ]) + ],[ + cp conftest.$ac_ext pac_conftest.c + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) + PAC_PUSH_FLAG([ac_link]) + ac_link="`echo $ac_link | sed -e 's|>.*$|> $pac_logfile 2>\&1|g'`" + pac_logfile="pac_align1.log" + rm -f $pac_logfile + # Use conftest.f created in CONFTEST. + AC_LINK_IFELSE([],[ + PAC_RUNLOG_IFELSE([diff -b pac_align0.log pac_align1.log],[ + pac_attr_alignedn=yes + ],[ + pac_attr_alignedn=no + cat $pac_logfile >&AS_MESSAGE_LOG_FD + echo "failed C program was:" >&AS_MESSAGE_LOG_FD + cat pac_conftest.c >&AS_MESSAGE_LOG_FD + echo "failed Fortran program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD + ]) + ],[ + pac_attr_alignedn=no + ]) + # Restore everything in autoconf that has been overwritten + PAC_POP_FLAG([ac_link]) + # restore previously pushed LIBS + PAC_POP_FLAG([LIBS]) + AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) + # remove previously generated object file and C file. + rm -f pac_conftest.$OBJEXT pac_conftest.c + rm -f $pac_logfile + if test "$pac_attr_alignedn" = yes ; then + ifelse([$3],[],[ + pac_result_str="$asize" + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + break + ],[ + if test "$asize" != "max" -a "$asize" -lt "$3" ; then + if test "X$pac_result_str" = "X" ; then + pac_result_str="$asize" + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + fi + continue + else + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + if test "X$pac_result_str" != "X" ; then + pac_result_str="$pac_result_str, too small! reset to $asize" + else + pac_result_str="$asize" + fi + break + fi + ]) + fi + ], [ + pac_attr_alignedn=no + ]) + AC_LANG_POP([C]) + done + ifelse([$2],[],[],[$2="$pac_f2c_attr_aligned_str"]) +else + pac_result_str="" + # Since the test fails, set pac_f2c_attr_aligned_str to empty string. + pac_f2c_attr_aligned_str="" +fi +if test "X$pac_result_str" != "X" ; then + AC_MSG_RESULT([$pac_result_str]) +else + AC_MSG_RESULT([unknown]) +fi +rm -f pac_align0.log +]) +dnl diff --git a/3rd-party/romio341/mpl/confdb/aclocal_bugfix.m4 b/3rd-party/romio341/mpl/confdb/aclocal_bugfix.m4 new file mode 100644 index 0000000000000000000000000000000000000000..ef320dec57839484c18091e2b8b47fbed1dbd161 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_bugfix.m4 @@ -0,0 +1,75 @@ +dnl This internal macro fails to work properly with OTHER internal macros. +dnl Basically, if the prologue is [], then no message should be generated. +dnl This macro is in autoconf 2.52 +m4_define([AC_LANG_PROGRAM(Fortran 77)], +[m4_if([$1],[[[]]],,[m4_ifval([$1], + [m4_warn([syntax], [$0: ignoring PROLOGUE: $1])])])dnl + program main +$2 + end]) + + +dnl/*D +dnl PAC_PROG_CHECK_INSTALL_WORKS - Check whether the install program in INSTALL +dnl works. +dnl +dnl Synopsis: +dnl PAC_PROG_CHECK_INSTALL_WORKS +dnl +dnl Output Effect: +dnl Sets the variable 'INSTALL' to the value of 'ac_sh_install' if +dnl a file cannot be installed into a local directory with the 'INSTALL' +dnl program +dnl +dnl Notes: +dnl The 'AC_PROG_INSTALL' scripts tries to avoid broken versions of +dnl install by avoiding directories such as '/usr/sbin' where some +dnl systems are known to have bad versions of 'install'. Unfortunately, +dnl this is exactly the sort of test-on-name instead of test-on-capability +dnl that 'autoconf' is meant to eliminate. The test in this script +dnl is very simple but has been adequate for working around problems +dnl on Solaris, where the '/usr/sbin/install' program (known by +dnl autoconf to be bad because it is in /usr/sbin) is also reached by a +dnl soft link through /bin, which autoconf believes is good. +dnl +dnl No variables are cached to ensure that we do not make a mistake in +dnl our choice of install program. +dnl +dnl The Solaris configure requires the directory name to immediately +dnl follow the '-c' argument, rather than the more common +dnl.vb +dnl args sourcefiles destination-dir +dnl.ve +dnl D*/ +AC_DEFUN([PAC_PROG_CHECK_INSTALL_WORKS],[ +if test -z "$INSTALL" ; then + AC_MSG_RESULT([No install program available]) +else + # first make any "confdb/install-sh -c" into an absolute path + # this is a hack, but it's still much cleaner than anything else I could + # come up with (see tt#1007) [goodell@] + AS_CASE(["$INSTALL"], + [/*],[:], + [*install-sh*],[INSTALL="$main_top_srcdir/$INSTALL"]) + + # Check that this install really works + rm -f conftest + echo "Test file" > conftest + if test ! -d .conftest ; then mkdir .conftest ; fi + AC_MSG_CHECKING([whether install works]) + if $INSTALL conftest .conftest >/dev/null 2>&1 ; then + installOk=yes + else + installOk=no + fi + rm -rf .conftest conftest + AC_MSG_RESULT($installOk) + if test "$installOk" = no ; then + if test -n "$ac_install_sh" ; then + INSTALL=$ac_install_sh + else + AC_MSG_ERROR([Unable to find working install]) + fi + fi +fi +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_cache.m4 b/3rd-party/romio341/mpl/confdb/aclocal_cache.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9d02c416387f688093c917e519f3e3cd6babea0d --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_cache.m4 @@ -0,0 +1,372 @@ +dnl +dnl/*D +dnl AC_CACHE_LOAD - Replacement for autoconf cache load +dnl +dnl Notes: +dnl Caching in autoconf is broken (at least through version 2.13). +dnl The problem is that the cache is read +dnl without any check for whether it makes any sense to read it. +dnl A common problem is a build on a shared file system; connecting to +dnl a different computer and then building within the same directory will +dnl lead to at best error messages from configure and at worse a build that +dnl is wrong but fails only at run time (e.g., wrong datatype sizes used). +dnl Later versions of autoconf do include some checks for changes in the +dnl environment that impact the choices, but still misses problems with +dnl multiple different systems. +dnl +dnl This fixes that by requiring the user to explicitly enable caching +dnl before the cache file will be loaded. +dnl +dnl To use this version of 'AC_CACHE_LOAD', you need to include +dnl 'aclocal_cache.m4' in your 'aclocal.m4' file. The sowing 'aclocal.m4' +dnl file includes this file. +dnl +dnl If no --enable-cache or --disable-cache option is selected, the +dnl command causes configure to keep track of the system being configured +dnl in a config.system file; if the current system matches the value stored +dnl in that file (or there is neither a config.cache nor config.system file), +dnl configure will enable caching. In order to ensure that the configure +dnl tests make sense, the values of CC, F77, F90, and CXX are also included +dnl in the config.system file. In addition, the value of PATH is included +dnl to ensure that changes in the PATH that might select a different version +dnl of a program with the same name (such as a native make versus gnumake) +dnl are detected. +dnl +dnl Bugs: +dnl This does not work with the Cygnus configure because the enable arguments +dnl are processed *after* AC_CACHE_LOAD (!). To address this, we avoid +dnl changing the value of enable_cache, and use real_enable_cache, duplicating +dnl the "notgiven" value. +dnl +dnl The environment variable CONFIGURE_DEBUG_CACHE, if set to yes, +dnl will cause additional data to be written out during the configure process. +dnl This can be helpful in debugging the cache file process. +dnl +dnl See Also: +dnl PAC_ARG_CACHING +dnl D*/ +define([AC_CACHE_LOAD], +[if test "$CONFIGURE_DEBUG_CACHE" = yes ; then + oldopts="$-" + clearMinusX=no + set -x + if test "$oldopts" != "$-" ; then + clearMinusX=yes + fi +fi +if test "X$cache_system" = "X" ; then + # A default file name, just in case + cache_system="config.system" + if test "$cache_file" != "/dev/null" ; then + # Get the directory for the cache file, if any + changequote(,) + dnl Be careful to ensure that there is no doubled slash + cache_system=`echo $cache_file | sed -e 's%^\(.*/\)[^/]*%\1config.system%'` + changequote([,]) + test "x$cache_system" = "x$cache_file" && cache_system="config.system" +# else +# We must *not* set enable_cache to no because we need to know if +# enable_cache was not set. +# enable_cache=no + fi +fi +dnl +dnl The "action-if-not-given" part of AC_ARG_ENABLE is not executed until +dnl after the AC_CACHE_LOAD is executed (!). Thus, the value of +dnl enable_cache if neither --enable-cache or --disable-cache is selected +dnl is null. Just in case autoconf ever fixes this, we test both cases. +dnl +dnl Include PATH in the cache.system file since changing the path can +dnl change which versions of programs are found (such as vendor make +dnl or GNU make). +dnl +# +# Get a test value and flag whether we should remove/replace the +# cache_system file (do so unless cache_system_ok is yes) +# FC and F77 should be synonyms. Save both in case +# We include the xxxFLAGS in case the user is using the flags to change +# the language (either input or output) of the compiler. E.g., +# using -xarch=v9 on Solaris to select 64 bit output or using -D_BSD_SOURCE +# with gcc to get different header files on input. +cleanargs=`echo "$CC $F77 $FC $CXX $F90 $CFLAGS $FFLAGS $CXXFLAGS $F90FLAGS $PATH" | tr '"' ' '` +if uname -srm >/dev/null 2>&1 ; then + cache_system_text="`uname -srm` $cleanargs" +else + cache_system_text="-no-uname- $cleanargs" +fi +cache_system_ok=no +# +if test -z "$real_enable_cache" ; then + real_enable_cache=$enable_cache + if test -z "$real_enable_cache" ; then real_enable_cache="notgiven" ; fi +fi +if test "X$real_enable_cache" = "Xnotgiven" ; then + # check for valid cache file + if test -z "$cache_system" ; then cache_system="config.system" ; fi + if uname -srm >/dev/null 2>&1 ; then + if test -f "$cache_system" -a -n "$cache_system_text" ; then + if test "$cache_system_text" = "`cat $cache_system`" ; then + real_enable_cache="yes" + cache_system_ok=yes + fi + elif test ! -f "$cache_system" -a -n "$cache_system_text" ; then + # remove the cache file because it may not correspond to our + # system + if test "$cache_file" != "/dev/null" ; then + rm -f $cache_file + fi + real_enable_cache="yes" + fi + fi +fi +if test "X$real_enable_cache" = "Xyes" -a "$cache_file" = "/dev/null" ; then + real_enable_cache=no +fi +if test "X$real_enable_cache" = "Xyes" ; then + if test -r "$cache_file" ; then + echo "loading cache $cache_file" + if test -w "$cache_file" ; then + # Clean the cache file (ergh) + PAC_CACHE_CLEAN + fi + . $cache_file + else + echo "Configure in `pwd` creating cache $cache_file" + > $cache_file + rm -f $cache_system + fi +else + cache_file="/dev/null" +fi +# Remember our location and the name of the cachefile +pac_cv_my_conf_dir=`pwd` +dnl do not include the cachefile name, since this may contain the process +dnl number and cause comparisons looking for changes to the cache file +dnl to detect a change that isn't real. +dnl pac_cv_my_cachefile=$cachefile +# +# Update the cache_system file if necessary +if test "$cache_system_ok" != yes ; then + if test -n "$cache_system" ; then + rm -f $cache_system + echo $cache_system_text > $cache_system + fi +fi +if test "$clearMinusX" = yes ; then + set +x +fi +]) +dnl +dnl/*D +dnl PAC_ARG_CACHING - Enable caching of results from a configure execution +dnl +dnl Synopsis: +dnl PAC_ARG_CACHING +dnl +dnl Output Effects: +dnl Adds '--enable-cache' and '--disable-cache' to the command line arguments +dnl accepted by 'configure'. +dnl +dnl See Also: +dnl AC_CACHE_LOAD +dnl D*/ +dnl Add this call to the other ARG_ENABLE calls. Note that the values +dnl set here are redundant; the LOAD_CACHE call relies on the way autoconf +dnl initially processes ARG_ENABLE commands. +AC_DEFUN([PAC_ARG_CACHING],[ +AC_ARG_ENABLE(cache, + AC_HELP_STRING([--enable-cache], [Turn on configure caching]),, + [enable_cache="notgiven"]) +]) + +dnl Clean the cache of extraneous quotes that AC_CACHE_SAVE may add +dnl +AC_DEFUN([PAC_CACHE_CLEAN],[ + rm -f confcache + sed -e "s/'\\\\''//g" -e "s/'\\\\/'/" -e "s/\\\\'/'/" \ + -e "s/'\\\\''//g" $cache_file > confcache + if cmp -s $cache_file confcache ; then + : + else + if test -w $cache_file ; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + if test "$DEBUG_AUTOCONF_CACHE" = "yes" ; then + echo "Results of cleaned cache file:" + echo "--------------------------------------------------------" + cat $cache_file + echo "--------------------------------------------------------" + fi +]) + +dnl/*D +dnl PAC_SUBDIR_CACHE - Create a cache file before ac_output for subdirectory +dnl configures. +dnl +dnl Synopsis: +dnl PAC_SUBDIR_CACHE(when) +dnl +dnl Input Parameter: +dnl . when - Indicates when the cache should be created (optional) +dnl If 'always', create a new cache file. This option +dnl should be used if any of the cache parameters (such as +dnl CFLAGS or LDFLAGS) may have changed. +dnl +dnl Output Effects: +dnl +dnl Create a cache file before ac_output so that subdir configures don't +dnl make mistakes. +dnl We can't use OUTPUT_COMMANDS to remove the cache file, because those +dnl commands are executed *before* the subdir configures. +dnl +dnl D*/ +AC_DEFUN([PAC_SUBDIR_CACHE],[]) +AC_DEFUN([PAC_SUBDIR_CACHE_OLD],[ +if test "x$1" = "xalways" -o \( "$cache_file" = "/dev/null" -a "X$real_enable_cache" = "Xnotgiven" \) ; then + # Use an absolute directory to help keep the subdir configures from getting + # lost + cache_file=`pwd`/$$conf.cache + touch $cache_file + dnl + dnl For Autoconf 2.52+, we should ensure that the environment is set + dnl for the cache. Make sure that we get the values and set the + dnl xxx_set variables properly + ac_cv_env_CC_set=set + ac_cv_env_CC_value=$CC + ac_cv_env_CFLAGS_set=${CFLAGS+set} + ac_cv_env_CFLAGS_value=$CFLAGS + ac_cv_env_CPP_set=set + ac_cv_env_CPP_value=$CPP + ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} + ac_cv_env_CPPFLAGS_value=$CPPFLAGS + ac_cv_env_LDFLAGS_set=${LDFLAGS+set} + ac_cv_env_LDFLAGS_value=$LDFLAGS + ac_cv_env_LIBS_set=${LIBS+set} + ac_cv_env_LIBS_value=$LIBS + ac_cv_env_FC_set=${FC+set} + ac_cv_env_FC_value=$FC + ac_cv_env_F77_set=${F77+set} + ac_cv_env_F77_value=$F77 + ac_cv_env_F90_set=${F90+set} + ac_cv_env_F90_value=$F90 + ac_cv_env_FFLAGS_set=${FFLAGS+set} + ac_cv_env_FFLAGS_value=$FFLAGS + ac_cv_env_CXX_set=${CXX+set} + ac_cv_env_CXX_value=$CXX + + ac_env_CC_set=set + ac_env_CC_value=$CC + ac_env_CFLAGS_set=${CFLAGS+set} + ac_env_CFLAGS_value=$CFLAGS + ac_env_CPP_set=set + ac_env_CPP_value=$CPP + ac_env_CPPFLAGS_set=${CPPFLAGS+set} + ac_env_CPPFLAGS_value=$CPPFLAGS + ac_env_LDFLAGS_set=${LDFLAGS+set} + ac_env_LDFLAGS_value=$LDFLAGS + ac_env_LIBS_set=${LIBS+set} + ac_env_LIBS_value=$LIBS + ac_env_FC_set=${FC+set} + ac_env_FC_value=$FC + ac_env_F77_set=${F77+set} + ac_env_F77_value=$F77 + ac_env_F90_set=${F90+set} + ac_env_F90_value=$F90 + ac_env_FFLAGS_set=${FFLAGS+set} + ac_env_FFLAGS_value=$FFLAGS + ac_env_CXX_set=${CXX+set} + ac_env_CXX_value=$CXX + + dnl other parameters are + dnl build_alias, host_alias, target_alias + + # It turns out that A C CACHE_SAVE can't be invoked more than once + # with data that contains blanks. What happens is that the quotes + # that it adds get quoted and then added again. To avoid this, + # we strip off the outer quotes for all cached variables + dnl We add pac_cv_my_conf_dir to give the source of this cachefile, + dnl and pac_cv_my_cachefile to indicate how it chose the cachefile. + pac_cv_my_conf_dir=`pwd` + pac_cv_my_cachefile=$cachefile + AC_CACHE_SAVE + PAC_CACHE_CLEAN + ac_configure_args="$ac_configure_args -enable-cache" +fi +dnl Unconditionally export these values. Subdir configures break otherwise +export CC +export CFLAGS +export LDFLAGS +export LIBS +export CPPFLAGS +export CPP +export FC +export F77 +export F90 +export CXX +export FFLAGS +export CCFLAGS +]) +AC_DEFUN([PAC_SUBDIR_CACHE_CLEANUP],[]) +AC_DEFUN([PAC_SUBDIR_CACHE_CLEANUP_OLD],[ +if test "$cache_file" != "/dev/null" -a "X$real_enable_cache" = "Xnotgiven" ; then + rm -f $cache_file + cache_file=/dev/null +fi +]) +dnl +dnl The following three macros support the sharing of configure results +dnl by configure scripts, including ones that are not run with +dnl AC_CONFIG_SUBDIRS (the cachefiles managed by --enable-cache can +dnl only be used with AC_CONFIG_SUBDIRS; creating a autoconf-style +dnl cachefile before the the end of the autoconf process will often +dnl cause problems. +dnl +AC_DEFUN([PAC_CREATE_BASE_CACHE],[ +AC_ARG_ENABLE(base-cache, + AC_HELP_STRING([--enable-base-cache], + [Enable the use of a simple cache for the subsidiary + configure scripts]),,enable_base_cache=default) +# The default case is controlled by the environment variable CONF_USE_CACHEFILE +if test "$enable_base_cache" = "default" ; then + if test "$CONF_USE_CACHEFILE" = yes ; then + enable_base_cache=yes + else + enable_base_cache=no + fi +fi +if test "$enable_base_cache" != no ; then + if test "$enable_base_cache" = yes ; then + basecachefile=`pwd`/cache.base + else + basecachefile=`pwd`/$enable_base_cache + fi + set | grep ac_cv > $basecachefile + # Tell other configures to load this file + echo "Creating and exporting the base cache file $basecachefile" + CONF_BASE_CACHEFILE=$basecachefile + export CONF_BASE_CACHEFILE +fi +]) +AC_DEFUN([PAC_LOAD_BASE_CACHE],[ +if test -n "$CONF_BASE_CACHEFILE" -a -s "$CONF_BASE_CACHEFILE" ; then + echo "Loading base cachefile $CONF_BASE_CACHEFILE" + . $CONF_BASE_CACHEFILE + export CONF_BASE_CACHEFILE +fi +]) +AC_DEFUN([PAC_UPDATE_BASE_CACHE],[ +if test -n "$CONF_BASE_CACHEFILE" -a -s "$CONF_BASE_CACHEFILE" ; then + set | grep ac_cv > $CONF_BASE_CACHEFILE.new + if cmp -s $CONF_BASE_CACHEFILE.new $CONF_BASE_CACHEFILE ; then + : + else + echo "Replacing $CONF_BASE_CACHEFILE" + mv $CONF_BASE_CACHEFILE.new $CONF_BASE_CACHEFILE + fi +fi +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_cc.m4 b/3rd-party/romio341/mpl/confdb/aclocal_cc.m4 new file mode 100644 index 0000000000000000000000000000000000000000..207f7ca4040e14a258416fba3a258d7cc13d645a --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_cc.m4 @@ -0,0 +1,1683 @@ +dnl AC_PROG_CC_GNU +ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)]) + +dnl +dnl/*D +dnl PAC_C_CHECK_COMPILER_OPTION - Check that a compiler option is accepted +dnl without warning messages +dnl +dnl Synopsis: +dnl PAC_C_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'COPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl +dnl D*/ +AC_DEFUN([PAC_C_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether C compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([C]) +CFLAGS_orig="$CFLAGS" +CFLAGS_opt="$pac_opt $CFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([[#include <stdio.h> + const char hw[] = "Hello, World\n";]], + [[fputs (hw, stdout);]]) +]) +CFLAGS="$CFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + CFLAGS="$CFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes],[pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext + +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + CFLAGS="$CFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + int foo(void); + int foo(void){return 0;} + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + CFLAGS="$CFLAGS_opt" + rm -f pac_test5.log + PAC_LINK_IFELSE_LOG([pac_test5.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test4.log pac_test5.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log pac_test5.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore CFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying CFLAGS. +CFLAGS="$CFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[COPTIONS="$COPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([C]) +]) +dnl +dnl/*D +dnl PAC_C_OPTIMIZATION - Determine C options for producing optimized code +dnl +dnl Synopsis +dnl PAC_C_OPTIMIZATION([action if found]) +dnl +dnl Output Effect: +dnl Adds options to 'COPTIONS' if no other action is specified +dnl +dnl Notes: +dnl This is a temporary standin for compiler optimization. +dnl It should try to match known systems to known compilers (checking, of +dnl course), and then falling back to some common defaults. +dnl Note that many compilers will complain about -g and aggressive +dnl optimization. +dnl D*/ +AC_DEFUN([PAC_C_OPTIMIZATION],[ + for copt in "-O4 -Ofast" "-Ofast" "-fast" "-O3" "-xO3" "-O" ; do + PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) + if test "$found_opt" = "yes" ; then + ifelse($1,,COPTIONS="$COPTIONS $copt",$1) + break + fi + done + if test "$ac_cv_prog_gcc" = "yes" ; then + for copt in "-fomit-frame-pointer" "-finline-functions" \ + "-funroll-loops" ; do + PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) + if test "$found_opt" = "yes" ; then + ifelse($1,,COPTIONS="$COPTIONS $copt",$1) + # no break because we're trying to add them all + fi + done + # We could also look for architecture-specific gcc options + fi + +]) + +dnl/*D +dnl PAC_PROG_C_UNALIGNED_DOUBLES - Check that the C compiler allows unaligned +dnl doubles +dnl +dnl Synopsis: +dnl PAC_PROG_C_UNALIGNED_DOUBLES(action-if-true,action-if-false, +dnl action-if-unknown) +dnl +dnl Notes: +dnl 'action-if-unknown' is used in the case of cross-compilation. +dnl D*/ +AC_DEFUN([PAC_PROG_C_UNALIGNED_DOUBLES],[ +AC_CACHE_CHECK([whether C compiler allows unaligned doubles], +pac_cv_prog_c_unaligned_doubles,[ +AC_TRY_RUN([ +void fetch_double( v ) +double *v; +{ +*v = 1.0; +} +int main( argc, argv ) +int argc; +char **argv; +{ +int p[4]; +double *p_val; +fetch_double( (double *)&(p[0]) ); +p_val = (double *)&(p[0]); +if (*p_val != 1.0) return 1; +fetch_double( (double *)&(p[1]) ); +p_val = (double *)&(p[1]); +if (*p_val != 1.0) return 1; +return 0; +} +],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no", +pac_cv_prog_c_unaligned_doubles="unknown")]) +ifelse($1,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "yes" ; then +$1 +fi) +ifelse($2,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "no" ; then +$2 +fi) +ifelse($3,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "unknown" ; then +$3 +fi) +]) + +dnl/*D +dnl PAC_PROG_C_WEAK_SYMBOLS - Test whether C supports weak alias symbols. +dnl +dnl Synopsis +dnl PAC_PROG_C_WEAK_SYMBOLS(action-if-true,action-if-false) +dnl +dnl Output Effect: +dnl Defines one of the following if a weak symbol pragma is found: +dnl.vb +dnl HAVE_PRAGMA_WEAK - #pragma weak +dnl HAVE_PRAGMA_HP_SEC_DEF - #pragma _HP_SECONDARY_DEF +dnl HAVE_PRAGMA_CRI_DUP - #pragma _CRI duplicate x as y +dnl.ve +dnl May also define +dnl.vb +dnl HAVE_WEAK_ATTRIBUTE +dnl.ve +dnl if functions can be declared as 'int foo(...) __attribute__ ((weak));' +dnl sets the shell variable pac_cv_attr_weak to yes. +dnl Also checks for __attribute__((weak_import)) which is supported by +dnl Apple in Mac OSX (at least in Darwin). Note that this provides only +dnl weak symbols, not weak aliases +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_C_WEAK_SYMBOLS],[ +pragma_extra_message="" +AC_CACHE_CHECK([for type of weak symbol alias support], +pac_cv_prog_c_weak_symbols,[ +# Test for weak symbol support... +# We can't put # in the message because it causes autoconf to generate +# incorrect code +AC_TRY_LINK([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int a) { return a; } +],[return PFoo(1);],has_pragma_weak=yes) +# +# Some systems (Linux ia64 and ecc, for example), support weak symbols +# only within a single object file! This tests that case. +# Note that there is an extern int PFoo declaration before the +# pragma. Some compilers require this in order to make the weak symbol +# externally visible. +if test "$has_pragma_weak" = yes ; then + PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int); +int Foo(int a) { return a; } + ]) + ],[ + AC_LANG_SOURCE([ +extern int PFoo(int); +int main(int argc, char **argv) { +return PFoo(0);} + ]) + ],[ + PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int); +int Foo(int a) { return a; } + ]) + ],[ + AC_LANG_SOURCE([ +extern int Foo(int); +int PFoo(int a) { return a+1;} +int main(int argc, char **argv) { +return Foo(0);} + ]) + ],[ + pac_cv_prog_c_weak_symbols="pragma weak" + ],[ + has_pragma_weak=0 + pragma_extra_message="pragma weak accepted but does not work (probably creates two non-weak entries)" + ]) + ],[ + has_pragma_weak=0 + pragma_extra_message="pragma weak accepted but does not work (probably creates two non-weak entries)" + ]) +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _HP_SECONDARY_DEF Foo PFoo +int Foo(int a) { return a; } +],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF") +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _CRI duplicate PFoo as Foo +int Foo(int a) { return a; } +],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y") +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + pac_cv_prog_c_weak_symbols="no" +fi +dnl +dnl If there is an extra explanatory message, echo it now so that it +dnl doesn't interfere with the cache result value +if test -n "$pragma_extra_message" ; then + echo $pragma_extra_message +fi +dnl +]) +if test "$pac_cv_prog_c_weak_symbols" != "no" ; then + case "$pac_cv_prog_c_weak_symbols" in + "pragma weak") AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Supports weak pragma]) + ;; + "pragma _HP") AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,1,[HP style weak pragma]) + ;; + "pragma _CRI") AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Cray style weak pragma]) + ;; + esac +fi +AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed], +pac_cv_attr_weak,[ +AC_TRY_COMPILE([int foo(int) __attribute__ ((weak));],[int a;], +pac_cv_attr_weak=yes,pac_cv_attr_weak=no)]) +# Note that being able to compile with weak_import doesn't mean that +# it works. +AC_CACHE_CHECK([whether __attribute__ ((weak_import)) allowed], +pac_cv_attr_weak_import,[ +AC_TRY_COMPILE([int foo(int) __attribute__ ((weak_import));],[int a;], +pac_cv_attr_weak_import=yes,pac_cv_attr_weak_import=no)]) +# Check if the alias option for weak attributes is allowed +AC_CACHE_CHECK([whether __attribute__((weak,alias(...))) allowed], +pac_cv_attr_weak_alias,[ +PAC_PUSH_FLAG([CFLAGS]) +# force an error exit if the weak attribute isn't understood +CFLAGS=-Werror +AC_TRY_COMPILE([int __foo(int a){return 0;} int foo(int) __attribute__((weak,alias("__foo")));],[int a;], +pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no) +# Restore original CFLAGS +PAC_POP_FLAG([CFLAGS])]) +if test "$pac_cv_attr_weak_alias" = "yes" ; then + AC_DEFINE(HAVE_WEAK_ATTRIBUTE,1,[Attribute style weak pragma]) +fi +if test "$pac_cv_prog_c_weak_symbols" = "no" -a "$pac_cv_attr_weak_alias" = "no" ; then + ifelse([$2],,:,[$2]) +else + ifelse([$1],,:,[$1]) +fi +]) + +# +# This is a replacement that checks that FAILURES are signaled as well +# (later configure macros look for the .o file, not just success from the +# compiler, but they should not HAVE to +# +dnl --- insert 2.52 compatibility here --- +dnl 2.52 does not have AC_PROG_CC_WORKS +ifdef([AC_PROG_CC_WORKS],,[AC_DEFUN([AC_PROG_CC_WORKS],)]) +dnl +AC_DEFUN([PAC_PROG_CC_WORKS], +[AC_PROG_CC_WORKS +AC_MSG_CHECKING([whether the C compiler sets its return status correctly]) +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes) +AC_MSG_RESULT($notbroken) +if test "$notbroken" = "no" ; then + AC_MSG_ERROR([installation or configuration problem: C compiler does not +correctly set error code when a fatal error occurs]) +fi +]) + +dnl/*D +dnl PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS - Test whether C and the +dnl linker allow multiple weak symbols. +dnl +dnl Synopsis +dnl PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS(action-if-true,action-if-false) +dnl +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS],[ +AC_CACHE_CHECK([for multiple weak symbol support], +pac_cv_prog_c_multiple_weak_symbols,[ +# Test for multiple weak symbol support... +PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +extern int PFoo_(int); +extern int pfoo_(int); +#pragma weak PFoo = Foo +#pragma weak PFoo_ = Foo +#pragma weak pfoo_ = Foo +int Foo(int); +int Foo(a) { return a; } + ]) +],[ + AC_LANG_SOURCE([ +extern int PFoo(int), PFoo_(int), pfoo_(int); +int main() { +return PFoo(0) + PFoo_(1) + pfoo_(2);} + ]) +],[ + pac_cv_prog_c_multiple_weak_symbols="yes" +]) +dnl +]) +if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" ; then + ifelse([$1],,:,[$1]) +else + ifelse([$2],,:,[$2]) +fi +]) + +dnl Use the value of enable-strict to update CFLAGS +dnl pac_cc_strict_flags contains the strict flags. +dnl +dnl -std=c89 is used to select the C89 version of the ANSI/ISO C standard. +dnl As of this writing, many C compilers still accepted only this version, +dnl not the later C99 version. When all compilers accept C99, this +dnl should be changed to the appropriate standard level. Note that we've +dnl had trouble with gcc 2.95.3 accepting -std=c89 but then trying to +dnl compile program with a invalid set of options +dnl (-D __STRICT_ANSI__-trigraphs) +AC_DEFUN([PAC_CC_STRICT],[ +export enable_strict_done +if test "$enable_strict_done" != "yes" ; then + # make sure we don't add the below flags multiple times + enable_strict_done=yes + + # Some comments on strict warning options. + # These were added to improve portability + # -Wstack-usage=262144 -- 32 bit FreeBSD did not like the mprobe test + # allocating a big variable on the stack. (See tt#2160). The "right" + # value requires further investigation; 1 MiB would have at least + # caught #2160 at compile-time, and only two other tests show a + # warning at 256k. + # + # These were added to reduce warnings: + # -Wno-missing-field-initializers -- We want to allow a struct to be + # initialized to zero using "struct x y = {0};" and not require + # each field to be initialized individually. + # -Wno-unused-parameter -- For portability, some parameters go unused + # when we have different implementations of functions for + # different platforms + # -Wno-unused-label -- We add fn_exit: and fn_fail: on all functions, + # but fn_fail may not be used if the function doesn't return an + # error. + # -Wno-sign-compare -- read() and write() return bytes read/written + # as a signed value, but we often compare this to size_t (or + # msg_sz_t) variables. + # These were removed to reduce warnings: + # -Wcast-qual -- Sometimes we need to cast "volatile char*" to + # "char*", e.g., for memcpy. + # -Wpadded -- We catch struct padding with asserts when we need to + # -Wredundant-decls -- Having redundant declarations is benign and the + # code already has some. + # -Waggregate-return -- This seems to be a performance-related warning + # aggregate return values are legal in ANSI C, but they may be returned + # in memory rather than through a register. We do use aggregate return + # values, but they are structs of a single basic type (used to enforce + # type checking for relative vs. absolute ptrs), and with optimization + # the aggregate value is converted to a scalar. + # -Wdeclaration-after-statement -- This is a C89 + # requirement. When compiling with C99, this should be + # disabled. + # -Wfloat-equal -- There are places in hwloc that set a float var to 0, then + # compare it to 0 later to see if it was updated. Also when using strtod() + # one needs to compare the return value with 0 to see whether a conversion + # was performed. + # -Werror-implicit-function-declaration -- implicit function declarations + # should never be tolerated. This also ensures that we get quick + # compilation failures rather than later link failures that usually + # come from a function name typo. + # -Wcast-align -- Casting alignment warnings. This is an + # important check, but is temporarily disabled, since it is + # throwing too many (correct) warnings currently, causing us + # to miss other warnings. + # -Wshorten-64-to-32 -- Bad type-casting warnings. This is an + # important check, but is temporarily disabled, since it is + # throwing too many (correct) warnings currently, causing us + # to miss other warnings. + # + # This was removed because it masks important failures (see ticket #2094). + # However, since Intel compiler currently does not include -Wtype-limits + # in -Wextra, -Wtype-limits was added to handle warnings with the Intel + # compiler. + # -Wno-type-limits -- There are places where we compare an unsigned to + # a constant that happens to be zero e.g., if x is unsigned and + # MIN_VAL is zero, we'd like to do "MPIR_Assert(x >= MIN_VAL);". + # Note this option is not supported by gcc 4.2. This needs to be added + # after most other warning flags, so that we catch a gcc bug on 32-bit + # that doesn't give a warning that this is unsupported, unless another + # warning is triggered, and then if gives an error. + # the embedded newlines in this string are safe because we evaluate each + # argument in the for-loop below and append them to the CFLAGS with a space + # as the separator instead + pac_common_strict_flags=" + -Wall + -Wextra + -Wno-missing-field-initializers + -Wstrict-prototypes + -Wmissing-prototypes + -DGCC_WALL + -Wno-unused-parameter + -Wno-unused-label + -Wshadow + -Wmissing-declarations + -Wno-long-long + -Wundef + -Wno-endif-labels + -Wpointer-arith + -Wbad-function-cast + -Wwrite-strings + -Wno-sign-compare + -Wold-style-definition + -Wno-multichar + -Wno-deprecated-declarations + -Wnested-externs + -Winvalid-pch + -Wno-pointer-sign + -Wvariadic-macros + -Wtype-limits + -Werror-implicit-function-declaration + -Wstack-usage=262144 + -diag-disable=all + " + + if test -z "$1"; then + flags=no + else + flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`" + fi + add_cflags=yes + c_std=c99 + posix_std=2001 + enable_opt=yes + pac_cc_strict_werror=no + for flag in ${flags}; do + case "$flag" in + error) + # note: we can't enable -Werror early as it will break many config tests + # Need apply to CFLAGS at the end of configure. + pac_cc_strict_werror=yes + ;; + stdc89) + c_std=c89 + ;; + stdc99) + c_std=c99 + ;; + stdgnu99) + c_std=gnu99 + ;; + nostdc) + c_std=none + ;; + posix1995) + posix_std=1995 + ;; + posix2001) + posix_std=2001 + ;; + posix2008) + posix_std=2008 + ;; + noposix) + posix_std=none + ;; + opt) + enable_opt=yes + ;; + noopt) + enable_opt=no + ;; + all|yes) + # leave the defaults + ;; + no|none) + add_cflags=no + ;; + *) + if test -n "$flag" ; then + AC_MSG_WARN([Unrecognized value for enable-strict:$flag]) + fi + ;; + esac + done + + pac_cc_strict_flags="" + if test "${add_cflags}" = "yes" ; then + # common flags + pac_cc_strict_flags="$pac_cc_strict_flags $pac_common_strict_flags" + + # optimization flags + if test "${enable_opt}" = "yes" ; then + PAC_APPEND_FLAG([-O2],[pac_cc_strict_flags]) + fi + + # stdc flags + case "${c_std}" in + none) + : + ;; + c89) + PAC_APPEND_FLAG([-std=c89],[pac_cc_strict_flags]) + PAC_APPEND_FLAG([-Wdeclaration-after-statement],[pac_cc_strict_flags]) + ;; + c99) + PAC_APPEND_FLAG([-std=c99],[pac_cc_strict_flags]) + # Use -D_STDC_C99= for Solaris compilers. See + # http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html + # for discussion on why not to use -xc99 + PAC_APPEND_FLAG([-D_STDC_C99=],[pac_cc_strict_flags]) + ;; + gnu99) + PAC_APPEND_FLAG([-std=gnu99],[pac_cc_strict_flags]) + ;; + *) + AC_MSG_ERROR([internal error, unexpected C std version: '$c_std']) + ;; + esac + + # posix flags + case "${posix_std}" in + none) : ;; + 1995) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=199506L],[pac_cc_strict_flags]) ;; + 2001) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200112L],[pac_cc_strict_flags]) ;; + 2008) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200809L],[pac_cc_strict_flags]) ;; + *) AC_MSG_ERROR([internal error, unexpected POSIX version: '$posix_std']) ;; + esac + if test "${posix_std}" != "none" ; then + AS_CASE([$host],[*-*-darwin*], [PAC_APPEND_FLAG([-D_DARWIN_C_SOURCE],[pac_cc_strict_flags])]) + fi + fi + + # See if the above options work with the compiler + accepted_flags="" + for flag in $pac_cc_strict_flags ; do + PAC_PUSH_FLAG([CFLAGS]) + CFLAGS="$CFLAGS $accepted_flags" + PAC_C_CHECK_COMPILER_OPTION([$flag],[accepted_flags="$accepted_flags $flag"],) + PAC_POP_FLAG([CFLAGS]) + done + pac_cc_strict_flags=$accepted_flags +fi +]) + +dnl/*D +dnl PAC_ARG_STRICT - Add --enable-strict to configure. +dnl +dnl Synopsis: +dnl PAC_ARG_STRICT +dnl +dnl Output effects: +dnl Adds '--enable-strict' to the command line. +dnl +dnl D*/ +AC_DEFUN([PAC_ARG_STRICT],[ +AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], [Turn on strict compilation testing]),,enable_strict=no) +PAC_CC_STRICT($enable_strict) +CFLAGS="$CFLAGS $pac_cc_strict_flags" +export CFLAGS +]) + +dnl Return the integer structure alignment in pac_cv_c_max_integer_align +dnl Possible values include +dnl packed +dnl two +dnl four +dnl eight +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_INTEGER_ALIGN],[ +AC_CACHE_CHECK([for max C struct integer alignment], +pac_cv_c_max_integer_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + struct { char a; int b; } char_int; + struct { char a; short b; } char_short; + struct { char a; long b; } char_long; + struct { char a; int b; char c; } char_int_char; + struct { char a; short b; char c; } char_short_char; +#ifdef HAVE_LONG_LONG_INT + struct { long long int a; char b; } lli_c; + struct { char a; long long int b; } c_lli; +#endif + int size, extent, extent2; + + /* assume max integer alignment isn't 8 if we don't have + * an eight-byte value :) + */ +#ifdef HAVE_LONG_LONG_INT + if (sizeof(int) < 8 && sizeof(long) < 8 && sizeof(long long int) < 8) + is_eight = 0; +#else + if (sizeof(int) < 8 && sizeof(long) < 8) is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int); + extent = sizeof(char_int); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_int",size,extent); + + size = sizeof(char) + sizeof(short); + extent = sizeof(char_short); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_short",size,extent); + + size = sizeof(char) + sizeof(long); + extent = sizeof(char_long); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(long) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_long",size,extent); + +#ifdef HAVE_LONG_LONG_INT + size = sizeof(char) + sizeof(long long int); + extent = sizeof(lli_c); + extent2 = sizeof(c_lli); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long long int) >= 8 && (extent % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int) + sizeof(char); + extent = sizeof(char_int_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_int_char",size,extent); + + size = sizeof(char) + sizeof(short) + sizeof(char); + extent = sizeof(char_short_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_short_char",size,extent); + + /* If aligned mod 8, it will be aligned mod 4 */ + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_integer_align=`cat ctest.out`, +pac_cv_c_max_integer_align="unknown", +pac_cv_c_max_integer_align="$CROSS_ALIGN_STRUCT_INT") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_integer_align" ; then + pac_cv_c_max_integer_align="unknown" +fi +]) + +dnl Return the floating point structure alignment in +dnl pac_cv_c_max_fp_align. +dnl +dnl Possible values include: +dnl packed +dnl two +dnl four +dnl eight +dnl sixteen +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct floating point alignment], +pac_cv_c_max_fp_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; float b; } char_float; + struct { float b; char a; } float_char; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; +#ifdef HAVE_LONG_DOUBLE + struct { char a; long double b; } char_long_double; + struct { long double b; char a; } long_double_char; + struct { long double a; int b; char c; } long_double_int_char; +#endif + int size, extent1, extent2; + + size = sizeof(char) + sizeof(float); + extent1 = sizeof(char_float); + extent2 = sizeof(float_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_float",size,extent1); + + size = sizeof(char) + sizeof(double); + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_double",size,extent1); + +#ifdef HAVE_LONG_DOUBLE + size = sizeof(char) + sizeof(long double); + extent1 = sizeof(char_long_double); + extent2 = sizeof(long_double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0 + && (extent2 % 16) != 0) is_sixteen = 0; + DBG("char_long-double",size,extent1); + + extent1 = sizeof(long_double_int_char); + if ( (extent1 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; +#else + is_sixteen = 0; +#endif + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + if (is_sixteen) fprintf( cf, "sixteen\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_fp_align=`cat ctest.out`, +pac_cv_c_max_fp_align="unknown", +pac_cv_c_max_fp_align="$CROSS_ALIGN_STRUCT_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_fp_align" ; then + pac_cv_c_max_fp_align="unknown" +fi +]) + +dnl Return the floating point structure alignment in +dnl pac_cv_c_max_double_fp_align. +dnl +dnl Possible values include: +dnl packed +dnl two +dnl four +dnl eight +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_DOUBLE_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct alignment of structs with doubles], +pac_cv_c_max_double_fp_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + struct { char a; float b; } char_float; + struct { float b; char a; } float_char; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(float); + extent1 = sizeof(char_float); + extent2 = sizeof(float_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_float",size,extent1); + + size = sizeof(char) + sizeof(double); + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_double",size,extent1); + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_double_fp_align=`cat ctest.out`, +pac_cv_c_max_double_fp_align="unknown", +pac_cv_c_max_double_fp_align="$CROSS_ALIGN_STRUCT_DOUBLE_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_double_fp_align" ; then + pac_cv_c_max_double_fp_align="unknown" +fi +]) +AC_DEFUN([PAC_C_MAX_LONGDOUBLE_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct floating point alignment with long doubles], +pac_cv_c_max_longdouble_fp_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; long double b; } char_long_double; + struct { long double b; char a; } long_double_char; + struct { long double a; int b; char c; } long_double_int_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(long double); + extent1 = sizeof(char_long_double); + extent2 = sizeof(long_double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0 + && (extent2 % 16) != 0) is_sixteen = 0; + DBG("char_long-double",size,extent1); + + extent1 = sizeof(long_double_int_char); + if ( (extent1 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + if (is_sixteen) fprintf( cf, "sixteen\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_longdouble_fp_align=`cat ctest.out`, +pac_cv_c_max_longdouble_fp_align="unknown", +pac_cv_c_max_longdouble_fp_align="$CROSS_ALIGN_STRUCT_LONGDOUBLE_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_longdouble_fp_align" ; then + pac_cv_c_max_longdouble_fp_align="unknown" +fi +]) + +dnl Other tests assume that there is potentially a maximum alignment +dnl and that if there is no maximum alignment, or a type is smaller than +dnl that value, then we align on the size of the value, with the exception +dnl of the "position-based alignment" rules we test for separately. +dnl +dnl It turns out that these assumptions have fallen short in at least one +dnl case, on MacBook Pros, where doubles are aligned on 4-byte boundaries +dnl even when long doubles are aligned on 16-byte boundaries. So this test +dnl is here specifically to handle this case. +dnl +dnl Puts result in pac_cv_c_double_alignment_exception. +dnl +dnl Possible values currently include no and four. +dnl +AC_DEFUN([PAC_C_DOUBLE_ALIGNMENT_EXCEPTION],[ +AC_CACHE_CHECK([if double alignment breaks rules, find actual alignment], +pac_cv_c_double_alignment_exception,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int extent1, extent2, align_4 = 0; + + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + + /* we're interested in the largest value, will let separate test + * deal with position-based issues. + */ + if (extent1 < extent2) extent1 = extent2; + if ((sizeof(double) == 8) && (extent1 % 8) != 0) { + if (extent1 % 4 == 0) { + align_4 = 1; + } + } + + cf = fopen( "ctest.out", "w" ); + + if (align_4) fprintf( cf, "four\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_double_alignment_exception=`cat ctest.out`, +pac_cv_c_double_alignment_exception="unknown", +pac_cv_c_double_alignment_exception="$CROSS_ALIGN_DOUBLE_EXCEPTION") +rm -f ctest.out +]) +if test -z "$pac_cv_c_double_alignment_exception" ; then + pac_cv_c_double_alignment_exception="unknown" +fi +]) + +dnl Test for odd struct alignment rule that only applies max. +dnl padding when double value is at front of type. +dnl Puts result in pac_cv_c_double_pos_align. +dnl +dnl Search for "Power alignment mode" for more details. +dnl +dnl Possible values include yes, no, and unknown. +dnl +AC_DEFUN([PAC_C_DOUBLE_POS_ALIGN],[ +AC_CACHE_CHECK([if alignment of structs with doubles is based on position], +pac_cv_c_double_pos_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int padding_varies_by_pos = 0; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int extent1, extent2; + + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (extent1 != extent2) padding_varies_by_pos = 1; + + cf = fopen( "ctest.out", "w" ); + if (padding_varies_by_pos) fprintf( cf, "yes\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_double_pos_align=`cat ctest.out`, +pac_cv_c_double_pos_align="unknown", +pac_cv_c_double_pos_align="$CROSS_ALIGN_DOUBLE_POS") +rm -f ctest.out +]) +if test -z "$pac_cv_c_double_pos_align" ; then + pac_cv_c_double_pos_align="unknown" +fi +]) + +dnl Test for odd struct alignment rule that only applies max. +dnl padding when long long int value is at front of type. +dnl Puts result in pac_cv_c_llint_pos_align. +dnl +dnl Search for "Power alignment mode" for more details. +dnl +dnl Possible values include yes, no, and unknown. +dnl +AC_DEFUN([PAC_C_LLINT_POS_ALIGN],[ +AC_CACHE_CHECK([if alignment of structs with long long ints is based on position], +pac_cv_c_llint_pos_align,[ +AC_TRY_RUN([ +#include <stdio.h> +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int padding_varies_by_pos = 0; +#ifdef HAVE_LONG_LONG_INT + struct { char a; long long int b; } char_llint; + struct { long long int b; char a; } llint_char; + int extent1, extent2; + + extent1 = sizeof(char_llint); + extent2 = sizeof(llint_char); + if (extent1 != extent2) padding_varies_by_pos = 1; +#endif + + cf = fopen( "ctest.out", "w" ); + if (padding_varies_by_pos) fprintf( cf, "yes\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_llint_pos_align=`cat ctest.out`, +pac_cv_c_llint_pos_align="unknown", +pac_cv_c_llint_pos_align="$CROSS_ALIGN_LLINT_POS") +rm -f ctest.out +]) +if test -z "$pac_cv_c_llint_pos_align" ; then + pac_cv_c_llint_pos_align="unknown" +fi +]) + +dnl/*D +dnl PAC_FUNC_NEEDS_DECL - Set NEEDS_<funcname>_DECL if a declaration is needed +dnl +dnl Synopsis: +dnl PAC_FUNC_NEEDS_DECL(headerfiles,funcname) +dnl +dnl Output Effect: +dnl Sets 'NEEDS_<funcname>_DECL' if 'funcname' is not declared by the +dnl headerfiles. +dnl +dnl Approach: +dnl Attempt to assign library function to function pointer. If the function +dnl is not declared in a header, this will fail. Use a non-static global so +dnl the compiler does not warn about an unused variable. +dnl +dnl Simply calling the function is not enough because C89 compilers allow +dnl calls to implicitly-defined functions. Re-declaring a library function +dnl with an incompatible prototype is also not sufficient because some +dnl compilers (notably clang-3.2) only produce a warning in this case. +dnl +dnl D*/ +AC_DEFUN([PAC_FUNC_NEEDS_DECL],[ +AC_CACHE_CHECK([whether $2 needs a declaration], +pac_cv_func_decl_$2,[ +AC_TRY_COMPILE([$1 +void (*fptr)(void) = (void(*)(void))$2;],[], +pac_cv_func_decl_$2=no,pac_cv_func_decl_$2=yes)]) +if test "$pac_cv_func_decl_$2" = "yes" ; then +changequote(<<,>>)dnl +define(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnl +changequote([, ])dnl + AC_DEFINE_UNQUOTED(PAC_FUNC_NAME,1,[Define if $2 needs a declaration]) +undefine([PAC_FUNC_NAME]) +fi +]) + +dnl PAC_C_GNU_ATTRIBUTE - See if the GCC __attribute__ specifier is allow. +dnl Use the following +dnl #ifndef HAVE_GCC_ATTRIBUTE +dnl #define __attribute__(a) +dnl #endif +dnl If *not*, define __attribute__(a) as null +dnl +dnl We start by requiring Gcc. Some other compilers accept __attribute__ +dnl but generate warning messages, or have different interpretations +dnl (which seems to make __attribute__ just as bad as #pragma) +dnl For example, the Intel icc compiler accepts __attribute__ and +dnl __attribute__((pure)) but generates warnings for __attribute__((format...)) +dnl +AC_DEFUN([PAC_C_GNU_ATTRIBUTE],[ +AC_REQUIRE([AC_PROG_CC_GNU]) +if test "$ac_cv_prog_gcc" = "yes" ; then + AC_CACHE_CHECK([whether __attribute__ allowed], +pac_cv_gnu_attr_pure,[ +AC_TRY_COMPILE([int foo(int) __attribute__ ((pure));],[int a;], +pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no)]) +AC_CACHE_CHECK([whether __attribute__((format)) allowed], +pac_cv_gnu_attr_format,[ +AC_TRY_COMPILE([int foo(char *,...) __attribute__ ((format(printf,1,2)));],[int a;], +pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)]) + if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE,1,[Define if GNU __attribute__ is supported]) + fi +fi +]) + +# +# determine if the compiler defines a symbol containing the function name +# +# These tests check not only that the compiler defines some symbol, such +# as __FUNCTION__, but that the symbol correctly names the function. +# +# Defines +# HAVE__FUNC__ (if __func__ defined) +# HAVE_CAP__FUNC__ (if __FUNC__ defined) +# HAVE__FUNCTION__ (if __FUNCTION__ defined) +# +AC_DEFUN([PAC_CC_FUNCTION_NAME_SYMBOL],[ +AC_CACHE_CHECK([whether the compiler defines __func__], +pac_cv_have__func__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__func__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__func__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have__func__" = "yes" ; then + AC_DEFINE(HAVE__FUNC__,,[define if the compiler defines __func__]) +fi + +AC_CACHE_CHECK([whether the compiler defines __FUNC__], +pac_cv_have_cap__func__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__FUNC__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have_cap__func__=yes, pac_cv_have_cap__func__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__FUNC__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have_cap__func__" = "yes" ; then + AC_DEFINE(HAVE_CAP__FUNC__,,[define if the compiler defines __FUNC__]) +fi + +AC_CACHE_CHECK([whether the compiler sets __FUNCTION__], +pac_cv_have__function__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__FUNCTION__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have__function__=yes, pac_cv_have__function__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include <string.h> +int foo(void); +int foo(void) +{ + return (strcmp(__FUNCTION__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have__function__" = "yes" ; then + AC_DEFINE(HAVE__FUNCTION__,,[define if the compiler defines __FUNCTION__]) +fi + +]) + + +dnl Check structure alignment +AC_DEFUN([PAC_STRUCT_ALIGNMENT],[ + # Initialize alignment checks + is_packed=1 + is_two=1 + is_four=1 + is_eight=1 + is_largest=1 + + # See if long double exists + AC_TRY_COMPILE(,[long double a;],have_long_double=yes,have_long_double=no) + + # Get sizes of regular types + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(float) + AC_CHECK_SIZEOF(double) + AC_CHECK_SIZEOF(long double) + + # char_int comparison + AC_CHECK_SIZEOF(char_int, 0, [typedef struct { char a; int b; } char_int; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_int` + extent=$ac_cv_sizeof_char_int + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_int`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_int" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_short comparison + AC_CHECK_SIZEOF(char_short, 0, [typedef struct { char a; short b; } char_short; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_short` + extent=$ac_cv_sizeof_char_short + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_short`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "$ac_cv_sizeof_short" = "4" -a "`expr $extent % 4`" != "0" ; then + is_four=0 + fi + if test "$ac_cv_sizeof_short" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_long comparison + AC_CHECK_SIZEOF(char_long, 0, [typedef struct { char a; long b; } char_long; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_long` + extent=$ac_cv_sizeof_char_long + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_long`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_long" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_float comparison + AC_CHECK_SIZEOF(char_float, 0, [typedef struct { char a; float b; } char_float; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_float` + extent=$ac_cv_sizeof_char_float + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_float`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_float" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_double comparison + AC_CHECK_SIZEOF(char_double, 0, [typedef struct { char a; double b; } char_double; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_double` + extent=$ac_cv_sizeof_char_double + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_double`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_double" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_long_double comparison + if test "$have_long_double" = "yes"; then + AC_CHECK_SIZEOF(char_long_double, 0, [ + typedef struct { + char a; + long double b; + } char_long_double; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_long_double` + extent=$ac_cv_sizeof_char_long_double + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_long_double`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_long_double" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + fi + + # char_int_char comparison + AC_CHECK_SIZEOF(char_int_char, 0, [ + typedef struct { + char a; + int b; + char c; + } char_int_char; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_int + $ac_cv_sizeof_char` + extent=$ac_cv_sizeof_char_int_char + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_int`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_int" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_short_char comparison + AC_CHECK_SIZEOF(char_short_char, 0, [ + typedef struct { + char a; + short b; + char c; + } char_short_char; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_short + $ac_cv_sizeof_char` + extent=$ac_cv_sizeof_char_short_char + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_short`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "$ac_cv_sizeof_short" = "4" -a "`expr $extent % 4`" != "0" ; then + is_four=0 + fi + if test "$ac_cv_sizeof_short" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # If aligned mod 8, it will be aligned mod 4 + if test $is_eight = 1 ; then is_four=0 ; is_two=0 ; fi + if test $is_four = 1 ; then is_two=0 ; fi + + # Largest supersedes 8 + if test $is_largest = 1 ; then is_eight=0 ; fi + + # Find the alignment + if test "`expr $is_packed + $is_largest + $is_two + $is_four + $is_eight`" = "0" ; then + pac_cv_struct_alignment="unknown" + elif test "`expr $is_packed + $is_largest + $is_two + $is_four + $is_eight`" != "1" ; then + pac_cv_struct_alignment="unknown" + elif test $is_packed = 1 ; then + pac_cv_struct_alignment="packed" + elif test $is_largest = 1 ; then + pac_cv_struct_alignment="largest" + elif test $is_two = 1 ; then + pac_cv_struct_alignment="two" + elif test $is_four = 1 ; then + pac_cv_struct_alignment="four" + elif test $is_eight = 1 ; then + pac_cv_struct_alignment="eight" + fi +]) +dnl +dnl PAC_C_MACRO_VA_ARGS +dnl +dnl will AC_DEFINE([HAVE_MACRO_VA_ARGS]) if the compiler supports C99 variable +dnl length argument lists in macros (#define foo(...) bar(__VA_ARGS__)) +AC_DEFUN([PAC_C_MACRO_VA_ARGS],[ + AC_MSG_CHECKING([for variable argument list macro functionality]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <stdio.h> + #define conftest_va_arg_macro(...) printf(__VA_ARGS__) + ], + [conftest_va_arg_macro("a test %d", 3);])], + [AC_DEFINE([HAVE_MACRO_VA_ARGS],[1],[Define if C99-style variable argument list macro functionality]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) +])dnl + +# Will AC_DEFINE([HAVE_BUILTIN_EXPECT]) if the compiler supports __builtin_expect. +AC_DEFUN([PAC_C_BUILTIN_EXPECT],[ +AC_MSG_CHECKING([if C compiler supports __builtin_expect]) + +AC_TRY_LINK(, [ + return __builtin_expect(1, 1) ? 1 : 0 +], [ + have_builtin_expect=yes + AC_MSG_RESULT([yes]) +], [ + have_builtin_expect=no + AC_MSG_RESULT([no]) +]) +if test x$have_builtin_expect = xyes ; then + AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.]) +fi +]) + +dnl +dnl PAC_C_STATIC_ASSERT - Test whether C11 _Static_assert is supported +dnl +dnl will AC_DEFINE([HAVE_C11__STATIC_ASSERT]) if C11 _Static_assert is supported. +dnl +AC_DEFUN([PAC_C_STATIC_ASSERT], [ + AC_MSG_CHECKING([for C11 _Static_assert functionality]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ + int main(){ + _Static_assert(1, "The impossible happened!"); + return 0; + } + ])],[ + AC_DEFINE([HAVE_C11__STATIC_ASSERT],[1],[Define if C11 _Static_assert is supported.]) + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + +dnl +dnl PAC_CC_CHECK_TLS - Test for thread local storage support +dnl +dnl will AC_DEFINE([TLS]) to a compiler supported TLS keyword +dnl +AC_DEFUN([PAC_CC_CHECK_TLS], [ + AC_CACHE_CHECK([for thread local storage], [pac_cv_tls], [ + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE([AC_LANG_PROGRAM([_Thread_local int foo=0;],[foo=1])], + [pac_cv_tls=_Thread_local]) + fi + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE( [AC_LANG_PROGRAM([__thread int foo=0;],[foo=1])], + [pac_cv_tls=__thread]) + fi + if test -z $pac_cv_tls ; then + AC_LINK_IFELSE( [AC_LANG_PROGRAM([__declspec(thread) int foo=0;],[foo=1])], + [pac_cv_tls="__declspec(thread)"]) + fi]) + if test -z $pac_cv_tls ; then + AC_MSG_WARN([Compiler does not support thread local storage]) + else + AC_DEFINE_UNQUOTED([COMPILER_TLS], [$pac_cv_tls], [Defined the keyword for thread-local storage.]) + fi +]) + +dnl Test whether pointers can be aligned on a int boundary or require +dnl a pointer boundary. +AC_DEFUN([PAC_CHECK_PTR_ALIGN]), [ + AC_MSG_CHECKING([for alignment restrictions on pointers]) + AC_TRY_RUN( + changequote(<<,>>) + struct foo { int a; void *b; }; + int main() { + int buf[10]; + struct foo *p1; + p1=(struct foo*)&buf[0]; + p1->b = (void *)0; + p1=(struct foo*)&buf[1]; + p1->b = (void *)0; + return 0; + changequote([,]) + },pac_cv_pointers_have_int_alignment=yes,pac_cv_pointers_have_int_alignment=no,pac_cv_pointers_have_int_alignment=unknown) + + if test "$pac_cv_pointers_have_int_alignment" != "yes" ; then + AC_DEFINE(NEEDS_POINTER_ALIGNMENT_ADJUST,1,[define if pointers must be aligned on pointer boundaries]) + AC_MSG_RESULT([pointer]) + else + AC_MSG_RESULT([int or better]) + fi +]) + +dnl PAC_ARG_ATOMIC_PRIMITIVES +dnl - Provide configure option to select atomic primitives. Defaults to auto. +AC_DEFUN([PAC_ARG_ATOMIC_PRIMITIVES], [ + AC_ARG_WITH([mpl-atomic-primitives], + [ --with-mpl-atomic-primitives=package Atomic primitives to use. The following is include: + auto - Automatically choose the best one (default) + c11 - C11 atomics + gcc_atomic - GCC atomic builtins + gcc_sync - GCC sync builtins + win - Windows builtins + lock - Mutex-based synchronization + no|none - atomic operations are performed without synchronization + ],,with_mpl_atomic_primitives=auto)]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_check_visibility.m4 b/3rd-party/romio341/mpl/confdb/aclocal_check_visibility.m4 new file mode 100644 index 0000000000000000000000000000000000000000..1ea85bae1140adff990f4b689ad3ea40705ec723 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_check_visibility.m4 @@ -0,0 +1,123 @@ +# This macro set originally copied from hwloc. +# MPICH modifications: +# - renamed macro to PAC_CHECK_VISIBILITY +# - removed C compiler vendor check +# - sed -e 's/HWLOC/MPICH/gI' +# +# Copyright © 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright © 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright © 2004-2007 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright © 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright © 2006-2007 Cisco Systems, Inc. All rights reserved. +# and renamed/modified for hwloc: +# Copyright © 2009 Inria. All rights reserved. +# Copyright © 2009-2010 Université Bordeaux +# Copyright © 2010-2012 Cisco Systems, Inc. All rights reserved. +# See COPYING in top-level directory. +# +# 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 listed +# in this license in the documentation and/or other materials +# provided with the distribution. +# +# - Neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# The copyright holders provide no reassurances that the source code +# provided does not infringe any patent, copyright, or any other +# intellectual property rights of third parties. The copyright holders +# disclaim any liability to any recipient for claims brought against +# recipient by any third party for infringement of that parties +# intellectual property rights. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT +# OWNER 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. +# + +# PAC_CHECK_VISIBILITY +# -------------------------------------------------------- +AC_DEFUN([PAC_CHECK_VISIBILITY],[ + # Be safe for systems that have ancient Autoconf's (e.g., RHEL5) + m4_ifdef([AC_PROG_GREP], + [AC_REQUIRE([AC_PROG_GREP])], + [GREP=grep]) + + # Check if the compiler has support for visibility, like some + # versions of gcc, icc, Sun Studio cc. + AC_ARG_ENABLE(visibility, + AC_HELP_STRING([--enable-visibility], + [enable visibility feature of certain compilers/linkers (default: enabled on platforms that support it)])) + + case ${target} in + *-*-aix*|*-*-mingw*|*-*-cygwin*|*-*-hpux*) + enable_visibility=no + ;; + esac + + mpich_visibility_define=0 + mpich_msg="whether to enable symbol visibility" + if test "$enable_visibility" = "no"; then + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([no (disabled)]) + else + CFLAGS_orig=$CFLAGS + mpich_add=-fvisibility=hidden + CFLAGS="$CFLAGS_orig $mpich_add -Werror" + + AC_MSG_CHECKING([if $CC supports $mpich_add]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include <stdio.h> + __attribute__((visibility("default"))) int foo; + ]],[[fprintf(stderr, "Hello, world\n");]])], + [AS_IF([test -s conftest.err], + [$GREP -iq visibility conftest.err + # If we find "visibility" in the stderr, then + # assume it doesn't work + AS_IF([test "$?" = "0"], [mpich_add=])]) + ], [mpich_add=]) + AS_IF([test "$mpich_add" = ""], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes])]) + + CFLAGS=$CFLAGS_orig + VISIBILITY_CFLAGS=$mpich_add + + if test "$mpich_add" != "" ; then + mpich_visibility_define=1 + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([yes (via $mpich_add)]) + elif test "$enable_visibility" = "yes"; then + AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting]) + else + AC_MSG_CHECKING([$mpich_msg]) + AC_MSG_RESULT([no (unsupported)]) + fi + unset mpich_add + fi + + AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$mpich_visibility_define], + [Whether C compiler supports symbol visibility or not]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_coverage.m4 b/3rd-party/romio341/mpl/confdb/aclocal_coverage.m4 new file mode 100644 index 0000000000000000000000000000000000000000..844beb5098f92976a644dbdd7d08e59435fa6d18 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_coverage.m4 @@ -0,0 +1,89 @@ + +dnl Macro to add --enable-coverage option (disabled by default) and add +dnl appropriate compiler flags to permit usage of gcov if that option is +dnl enabled. If WRAPPER_xFLAGS variables are set then the flags will also be +dnl added to those variables. +dnl +dnl Sets "pac_cv_use_coverage=yes" and AC_DEFINEs USE_COVERAGE if coverage was +dnl successfully enabled. Also creates an AM_CONDITIONAL with the name +dnl "BUILD_COVERAGE" that is true iff pac_cv_use_coverage=yes. +dnl +dnl Usage: PAC_CONFIG_SUBDIR_ARGS +dnl +dnl Assumes that all of the compiler macros have already been invoked +dnl (AC_PROG_CC and friends). +AC_DEFUN([PAC_ENABLE_COVERAGE],[ + +AC_ARG_VAR([GCOV],[name/path for the gcov utility]) +AC_CHECK_PROGS([GCOV],[gcov]) + +AC_ARG_ENABLE([coverage], + [AC_HELP_STRING([--enable-coverage], + [Turn on coverage analysis using gcc and gcov])], + [],[enable_coverage=no]) + +if test "$enable_coverage" = "yes" ; then + if test "$ac_cv_prog_gcc" = "yes" ; then + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + LIBS="$LIBS -lgcov" + if test ${WRAPPER_CFLAGS+set} = set ; then + WRAPPER_CFLAGS="$WRAPPER_CFLAGS -fprofile-arcs -ftest-coverage" + fi + else + AC_MSG_WARN([--enable-coverage only supported for GCC]) + fi + if test "$enable_cxx" = "yes" ; then + if test "$ac_cv_cxx_compiler_gnu" = "yes" ; then + CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage" + LIBS="$LIBS -lgcov" + if test ${WRAPPER_CXXFLAGS+set} = set ; then + WRAPPER_CXXFLAGS="$WRAPPER_CXXFLAGS -fprofile-arcs -ftest-coverage" + fi + else + AC_MSG_WARN([--enable-coverage only supported for GCC]) + fi + fi + # Add similar options for g77 so that the Fortran tests will also + # + if test "$enable_f77" = yes ; then + if test "$ac_cv_f77_compiler_gnu" = "yes" ; then + FFLAGS="$FFLAGS -fprofile-arcs -ftest-coverage" + LIBS="$LIBS -lgcov" + if test ${WRAPPER_FFLAGS+set} = set ; then + WRAPPER_FFLAGS="$WRAPPER_FFLAGS -fprofile-arcs -ftest-coverage" + fi + else + AC_MSG_WARN([--enable-coverage only supported for G77/GFORTRAN]) + fi + fi + if test "$enable_fc" = yes ; then + if test "$ac_cv_fc_compiler_gnu" = "yes" ; then + FCFLAGS="$FCFLAGS -fprofile-arcs -ftest-coverage" + LIBS="$LIBS -lgcov" + if test ${WRAPPER_FCFLAGS+set} = set ; then + WRAPPER_FCFLAGS="$WRAPPER_FCFLAGS -fprofile-arcs -ftest-coverage" + fi + else + AC_MSG_WARN([--enable-coverage only supported for GFORTRAN]) + fi + fi + # On some platforms (e.g., Mac Darwin), we must also *link* + # with the -fprofile-args -ftest-coverage option. + AC_MSG_CHECKING([whether compilation with coverage analysis enabled works]) + AC_LINK_IFELSE([AC_LANG_SOURCE([int main(int argc, char **argv){return 1;}])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Unable to link programs when coverage analysis enabled])]) + + # Test for the routines that we need to use to ensure that the + # data files are (usually) written out + # FIXME: Some versions of Linux provide usleep, but it rounds times + # up to the next second (!) + AC_CHECK_FUNCS([usleep]) + + # NOTE: using a "pac_cv_" prefix but not caching because of xFLAGS "side effects" + pac_cv_use_coverage=yes + AC_DEFINE([USE_COVERAGE],[1],[Define if performing coverage tests]) +fi +AM_CONDITIONAL([BUILD_COVERAGE],[test "X$pac_cv_use_coverage" = "Xyes"]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_cxx.m4 b/3rd-party/romio341/mpl/confdb/aclocal_cxx.m4 new file mode 100644 index 0000000000000000000000000000000000000000..6c902af2c5316bdea33f5dbab3d8508e0fab97ba --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_cxx.m4 @@ -0,0 +1,168 @@ +dnl This is from crypt.to/autoconf-archive, slightly modified. +dnl It defines bool as int if it is not availalbe +dnl +AC_DEFUN([AX_CXX_BOOL], +[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type, +ac_cv_cxx_bool, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +int f(int x){return 1;} +int f(char x){return 1;} +int f(bool x){return 1;} +],[bool b = true; return f(b);], + ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_bool" != yes; then + AC_DEFINE(bool,int,[define if bool is a built-in type]) +fi +]) + +dnl This is from crypt.to/autoconf-archive, slightly modified (name defined) +dnl +AC_DEFUN([AX_CXX_EXCEPTIONS], +[AC_CACHE_CHECK(whether the compiler supports exceptions, +ac_cv_cxx_exceptions, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE(,[try { throw 1; } catch (int i) { return i; }], + ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_exceptions" = yes; then + AC_DEFINE(HAVE_CXX_EXCEPTIONS,,[define if the compiler supports exceptions]) +fi +]) + +dnl This is from crypt.to/autoconf-archive +dnl +AC_DEFUN([AX_CXX_NAMESPACES], +[AC_CACHE_CHECK(whether the compiler implements namespaces, +ac_cv_cxx_namespaces, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) +fi +]) + +dnl Some compilers support namespaces but don't know about std +dnl +AC_DEFUN([AX_CXX_NAMESPACE_STD], +[AC_REQUIRE([AX_CXX_NAMESPACES]) +AC_CACHE_CHECK(whether the compiler implements the namespace std, +ac_cv_cxx_namespace_std, +[ac_cv_cxx_namespace_std=no +if test "$ac_cv_cxx_namespaces" = yes ; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include <iostream> +using namespace std;], + [cout << "message\n";], + ac_cv_cxx_namespace_std=yes, ac_cv_cxx_namespace_std=no) + AC_LANG_RESTORE +fi +]) +if test "$ac_cv_cxx_namespace_std" = yes; then + AC_DEFINE(HAVE_NAMESPACE_STD,,[define if the compiler implements namespace std]) +fi +]) + +dnl/*D +dnl PAC_CXX_CHECK_COMPILER_OPTION - Check that a C++ compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_CXX_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'CXXOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_CXX_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether C++ compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([C++]) +CXXFLAGS_orig="$CXXFLAGS" +CXXFLAGS_opt="$pac_opt $CXXFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +CXXFLAGS="$CXXFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + CXXFLAGS="$CXXFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes],[pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext + +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + CXXFLAGS="$CXXFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + int foo(void); + int foo(void){return 0;} + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + CXXFLAGS="$CXXFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore CXXFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying CXXFLAGS. +CXXFLAGS="$CXXFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[CXXOPTIONS="$CXXOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([C++]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_f77.m4 b/3rd-party/romio341/mpl/confdb/aclocal_f77.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f44151074604be3855b741ca1e0eb173be7bcd1e --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_f77.m4 @@ -0,0 +1,1475 @@ +dnl +dnl/*D +dnl PAC_PROG_F77_NAME_MANGLE - Determine how the Fortran compiler mangles +dnl names +dnl +dnl Synopsis: +dnl PAC_PROG_F77_NAME_MANGLE([action]) +dnl +dnl Output Effect: +dnl If no action is specified, one of the following names is defined: +dnl.vb +dnl If fortran names are mapped: +dnl lower -> lower F77_NAME_LOWER +dnl lower -> lower_ F77_NAME_LOWER_USCORE +dnl lower -> UPPER F77_NAME_UPPER +dnl lower_lower -> lower__ F77_NAME_LOWER_2USCORE +dnl mixed -> mixed F77_NAME_MIXED +dnl mixed -> mixed_ F77_NAME_MIXED_USCORE +dnl mixed -> UPPER@STACK_SIZE F77_NAME_UPPER_STDCALL +dnl.ve +dnl If an action is specified, it is executed instead. +dnl +dnl Notes: +dnl We assume that if lower -> lower (any underscore), upper -> upper with the +dnl same underscore behavior. Previous versions did this by +dnl compiling a Fortran program and running strings -a over it. Depending on +dnl strings is a bad idea, so instead we try compiling and linking with a +dnl C program, since that is why we are doing this anyway. A similar approach +dnl is used by FFTW, though without some of the cases we check (specifically, +dnl mixed name mangling). STD_CALL not only specifies a particular name +dnl mangling convention (adding the size of the calling stack into the function +dnl name, but also the stack management convention (callee cleans the stack, +dnl and arguments are pushed onto the stack from right to left) +dnl +dnl One additional problem is that some Fortran implementations include +dnl references to the runtime (like pgf90_compiled for the pgf90 compiler +dnl used as the "Fortran 77" compiler). This is not yet solved. +dnl +dnl D*/ +dnl +AC_DEFUN([PAC_PROG_F77_NAME_MANGLE],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_CACHE_CHECK([for Fortran 77 name mangling], +pac_cv_prog_f77_name_mangle,[ +# Initialize pac_found to indicate if name mangling scheme has been found +pac_found=no +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine MY_name( ii ) + return + end + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + dnl FLIBS is set by AC_F77_LIBRARY_LDFLAGS + LIBS="f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + for call in "" __stdcall ; do + for sym in my_name_ my_name__ my_name MY_NAME MY_name MY_name_ NONE ; do + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([extern void ${call} ${sym}(int);],[${sym}(0);]) + ],[ + pac_found=yes + break + ]) + done + test "$pac_found" = "yes" && break + done + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +dnl +# If we got to here and pac_cv_prog_f77_name_mangle is still NOT definable, +# it may be that the programs have to be linked with the Fortran compiler, +# not the C compiler. Try reversing the language used for the test +if test "$pac_found" != "yes" ; then + AC_LANG_PUSH([C]) + for call in "" __stdcall ; do + for sym in my_name_ my_name__ my_name MY_NAME MY_name MY_name_ NONE ; do + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([void ${call} ${sym}(int a) {}]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT cconftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="cconftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([],[ call my_name(0)]) + ],[ + pac_found=yes + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f cconftest.$OBJEXT + test "$pac_found" = "yes" && break + ]) + done + test "$pac_found" = "yes" && break + done + AC_LANG_POP([C]) +fi +if test "$pac_found" = "yes" ; then + case ${sym} in + my_name_) + pac_cv_prog_f77_name_mangle="lower uscore" ;; + my_name__) + pac_cv_prog_f77_name_mangle="lower 2uscore" ;; + my_name) + pac_cv_prog_f77_name_mangle="lower" ;; + MY_NAME) + pac_cv_prog_f77_name_mangle="upper" ;; + MY_name) + pac_cv_prog_f77_name_mangle="mixed" ;; + MY_name_) + pac_cv_prog_f77_name_mangle="mixed uscore" ;; + *) + pac_cv_prog_f77_name_mangle="" + pac_found=no; + ;; + esac + if test "X$pac_cv_prog_f77_name_mangle" != "X" ; then + if test "$call" = "__stdcall" ; then + pac_cv_prog_f77_name_mangle="$pac_cv_prog_f77_name_mangle stdcall" + fi + fi +fi +]) +dnl Endof ac_cache_check +case $pac_cv_prog_f77_name_mangle in + *stdcall) + F77_STDCALL="__stdcall" ;; + *) + F77_STDCALL="" ;; +esac +# Get the standard call definition +# FIXME: This should use F77_STDCALL, not STDCALL (non-conforming name) +F77_STDCALL="$call" +AC_DEFINE_UNQUOTED(STDCALL,[$F77_STDCALL],[Define calling convention]) + +# new_name="`echo $name | tr ' ' '_' | tr [a-z] [A-Z]`" +# We could have done the character conversion with 'tr' +# which may not be portable, e.g. solaris's /usr/ucb/bin/tr. +# So use a conservative approach. + +# Replace blank with underscore +name_scheme="`echo $pac_cv_prog_f77_name_mangle | sed 's% %_%g'`" +# Turn lowercase into uppercase. +name_scheme="`echo $name_scheme | sed -e 'y%abcdefghijklmnopqrstuvwxyz%ABCDEFGHIJKLMNOPQRSTUVWXYZ%'`" +F77_NAME_MANGLE="F77_NAME_${name_scheme}" +AC_DEFINE_UNQUOTED([$F77_NAME_MANGLE]) +AC_SUBST(F77_NAME_MANGLE) +if test "X$pac_cv_prog_f77_name_mangle" = "X" ; then + AC_MSG_WARN([Unknown Fortran naming scheme]) +fi +dnl +dnl Define the macros that is needed by AC_DEFINE_UNQUOTED([$F77_NAME_MANGLE]) +AH_TEMPLATE([F77_NAME_LOWER], + [Fortran names are lowercase with no trailing underscore]) +AH_TEMPLATE([F77_NAME_LOWER_USCORE], + [Fortran names are lowercase with one trailing underscore]) +AH_TEMPLATE([F77_NAME_LOWER_2USCORE], + [Fortran names are lowercase with two trailing underscores]) +AH_TEMPLATE([F77_NAME_MIXED], + [Fortran names preserve the original case]) +AH_TEMPLATE([F77_NAME_MIXED_USCORE], + [Fortran names preserve the original case with one trailing underscore]) +AH_TEMPLATE([F77_NAME_UPPER], + [Fortran names are uppercase]) +AH_TEMPLATE([F77_NAME_LOWER_STDCALL], + [Fortran names are lowercase with no trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_LOWER_USCORE_STDCALL], + [Fortran names are lowercase with one trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_LOWER_2USCORE_STDCALL], + [Fortran names are lowercase with two trailing underscores in stdcall]) +AH_TEMPLATE([F77_NAME_MIXED_STDCALL], + [Fortran names preserve the original case in stdcall]) +AH_TEMPLATE([F77_NAME_MIXED_USCORE_STDCALL], + [Fortran names preserve the original case with one trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_UPPER_STDCALL], + [Fortran names are uppercase in stdcall]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_CHECK_SIZEOF - Determine the size in bytes of a Fortran +dnl type +dnl +dnl Synopsis: +dnl PAC_PROG_F77_CHECK_SIZEOF(type,[cross-size]) +dnl +dnl Output Effect: +dnl Sets SIZEOF_F77_uctype to the size if bytes of type. +dnl If type is unknown, the size is set to 0. +dnl If cross-compiling, the value cross-size is used (it may be a variable) +dnl For example 'PAC_PROG_F77_CHECK_SIZEOF(real)' defines +dnl 'SIZEOF_F77_REAL' to 4 on most systems. The variable +dnl 'pac_cv_sizeof_f77_<type>' (e.g., 'pac_cv_sizeof_f77_real') is also set to +dnl the size of the type. +dnl If the corresponding variable is already set, that value is used. +dnl If the name has an '*' in it (e.g., 'integer*4'), the defined name +dnl replaces that with an underscore (e.g., 'SIZEOF_F77_INTEGER_4'). +dnl +dnl Notes: +dnl If the 'cross-size' argument is not given, 'autoconf' will issue an error +dnl message. You can use '0' to specify undetermined. +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_CHECK_SIZEOF],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +changequote(<<, >>)dnl +dnl The name to #define. +dnl dnl If the arg value contains a variable, we need to update that +define(<<PAC_TYPE_NAME>>, translit(sizeof_f77_$1, [a-z *], [A-Z__]))dnl +dnl The cache variable name. +define(<<PAC_CV_NAME>>, translit(pac_cv_f77_sizeof_$1, [ *], [__]))dnl +changequote([, ])dnl +AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[ +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine isize() + $1 i(2) + call cisize( i(1), i(2) ) + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +static int isize_val=0; +void cisize_(char *,char*); +void isize_(void); +void cisize_(char *i1p, char *i2p) +{ + isize_val = (int)(i2p - i1p); +} + ],[ + FILE *f = fopen("conftestval", "w"); + if (!f) return 1; + isize_(); + fprintf(f,"%d\n", isize_val); + ]) + dnl Endof ac_lang_program + ],[ + eval PAC_CV_NAME=`cat conftestval` + ],[ + eval PAC_CV_NAME=0 + ],[ + # Use -9999 as value to emit a warning message after the cache_check. + ifelse([$2],[],[eval PAC_CV_NAME=-9999],[eval PAC_CV_NAME=$2]) + ]) + dnl Endof ac_run_ifelse + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + # remove previously generated object file. + rm -f pac_f77conftest.$OBJEXT +],[ + # pac_f77compile_ok=no + ifelse([$2],,eval PAC_CV_NAME=0,eval PAC_CV_NAME=$2) +]) Endof ac_compile_ifelse +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "$PAC_CV_NAME" = "-9999" ; then + AC_MSG_WARN([No value provided for size of $1 when cross-compiling]) +fi +AC_DEFINE_UNQUOTED(PAC_TYPE_NAME,$PAC_CV_NAME,[Define size of PAC_TYPE_NAME]) +undefine([PAC_TYPE_NAME]) +undefine([PAC_CV_NAME]) +]) +dnl +dnl This version uses a Fortran program to link programs. +dnl This is necessary because some compilers provide shared libraries +dnl that are not within the default linker paths (e.g., our installation +dnl of the Portland Group compilers) +dnl +AC_DEFUN([PAC_PROG_F77_CHECK_SIZEOF_EXT],[ +changequote(<<,>>)dnl +dnl The name to #define. +dnl If the arg value contains a variable, we need to update that +define(<<PAC_TYPE_NAME>>, translit(sizeof_f77_$1, [a-z *], [A-Z__]))dnl +dnl The cache variable name. +define(<<PAC_CV_NAME>>, translit(pac_cv_f77_sizeof_$1, [ *], [__]))dnl +changequote([,])dnl +AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +dnl if test "$cross_compiling" = yes ; then +dnl ifelse([$2],[], +dnl [AC_MSG_WARN([No value provided for size of $1 when cross-compiling])], +dnl [eval PAC_CV_NAME=$2]) +dnl fi +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +int cisize_(char *,char*); +int cisize_(char *i1p, char *i2p) { + int isize_val=0; + FILE *f = fopen("conftestval", "w"); + if (!f) return 1; + isize_val = (int)(i2p - i1p); + fprintf(f,"%d\n", isize_val); + fclose(f); + return 0; +} + ]) + dnl Endof ac_lang_source +],[ + # pac_compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + # Save LIBS and prepend object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + $1 a(2) + integer irc, cisize + irc = cisize(a(1),a(2)) + end + ]) + ],[ + eval PAC_CV_NAME=`cat conftestval` + ],[ + eval PAC_CV_NAME=0 + ],[ + # Use -9999 as value to emit a warning message after the cache_check. + ifelse([$2],[],[eval PAC_CV_NAME=-9999],[eval PAC_CV_NAME=$2]) + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + # remove previously generated object file. + rm -f pac_conftest.$OBJEXT +],[ + AC_MSG_WARN([Unable to compile the C routine for finding the size of a $1]) +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_check +if test "$PAC_CV_NAME" = "-9999" ; then + AC_MSG_WARN([No value provided for size of $1 when cross-compiling]) +fi +AC_DEFINE_UNQUOTED(PAC_TYPE_NAME,$PAC_CV_NAME,[Define size of PAC_TYPE_NAME]) +undefine([PAC_TYPE_NAME]) +undefine([PAC_CV_NAME]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_EXCLAIM_COMMENTS +dnl +dnl Synopsis: +dnl PAC_PROG_F77_EXCLAIM_COMMENTS([action-if-true],[action-if-false]) +dnl +dnl Notes: +dnl Check whether '!' may be used to begin comments in Fortran. +dnl +dnl This macro requires a version of autoconf `after` 2.13; the 'acgeneral.m4' +dnl file contains an error in the handling of Fortran programs in +dnl 'AC_TRY_COMPILE' (fixed in our local version). +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_EXCLAIM_COMMENTS],[ +AC_CACHE_CHECK([whether Fortran 77 accepts ! for comments], +pac_cv_prog_f77_exclaim_comments,[ +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([],[! This is a comment]) +],[ + pac_cv_prog_f77_exclaim_comments="yes" +],[ + pac_cv_prog_f77_exclaim_comments="no" +]) +AC_LANG_POP([Fortran 77]) +]) +if test "$pac_cv_prog_f77_exclaim_comments" = "yes" ; then + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +])dnl +dnl +dnl/*D +dnl PAC_F77_CHECK_COMPILER_OPTION - Check that a F77 compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_F77_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'FOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_F77_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether Fortran 77 compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([Fortran 77]) +FFLAGS_orig="$FFLAGS" +FFLAGS_opt="$pac_opt $FFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +FFLAGS="$FFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + FFLAGS="$FFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext +# +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + FFLAGS="$FFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + subroutine try() + end + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + FFLAGS="$FFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore FFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying FFLAGS. +FFLAGS="$FFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[FOPTIONS="$FOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_LIBRARY_DIR_FLAG - Determine the flag used to indicate +dnl the directories to find libraries in +dnl +dnl Notes: +dnl Many compilers accept '-Ldir' just like most C compilers. +dnl Unfortunately, some (such as some HPUX Fortran compilers) do not, +dnl and require instead either '-Wl,-L,dir' or something else. This +dnl command attempts to determine what is accepted. The flag is +dnl placed into 'F77_LIBDIR_LEADER'. +dnl +dnl D*/ +dnl +dnl An earlier version of this only tried the arguments without using +dnl a library. This failed when the HP compiler complained about the +dnl arguments, but produced an executable anyway. +AC_DEFUN([PAC_PROG_F77_LIBRARY_DIR_FLAG],[ +AC_CACHE_CHECK([for Fortran 77 flag for library directories], +pac_cv_prog_f77_library_dir_flag,[ +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine f1conf + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + PAC_RUNLOG([test -d conftestdir || mkdir conftestdir]) + PAC_RUNLOG([${AR-ar} ${AR_FLAGS-cr} conftestdir/libf77conftest.a pac_f77conftest.$OBJEXT]) + PAC_RUNLOG([${RANLIB-ranlib} conftestdir/libf77conftest.a]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="-lf77conftest $LIBS" + saved_LDFLAGS="$LDFLAGS" + pac_cv_prog_f77_library_dir_flag="none" + for ldir in "-L" "-Wl,-L," ; do + LDFLAGS="${ldir}conftestdir $saved_LDFLAGS" + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + call f1conf + end + ]) + ],[pac_cv_prog_f77_library_dir_flag="$ldir";break]) + done + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + rm -rf conftestdir + rm -f pac_f77conftest.$OBJEXT +],[]) +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_library_dir_flag" != "Xnone" ; then + F77_LIBDIR_LEADER="$pac_cv_prog_f77_library_dir_flag" + AC_SUBST(F77_LIBDIR_LEADER) +fi +]) +dnl +dnl/*D +dnl PAC_PROG_F77_HAS_INCDIR - Check whether Fortran accepts -Idir flag +dnl +dnl Syntax: +dnl PAC_PROG_F77_HAS_INCDIR(directory,action-if-true,action-if-false) +dnl +dnl Output Effect: +dnl Sets 'F77_INCDIR' to the flag used to choose the directory. +dnl +dnl Notes: +dnl This refers to the handling of the common Fortran include extension, +dnl not to the use of '#include' with the C preprocessor. +dnl If directory does not exist, it will be created. In that case, the +dnl directory should be a direct descendant of the current directory. +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_HAS_INCDIR],[ +ifelse([$1],[],[checkdir=f77tmpdir],[checkdir=$1;checkdir_is_given=yes]) +AC_CACHE_CHECK([for include directory flag for Fortran], +pac_cv_prog_f77_has_incdir,[ +test -d $checkdir || mkdir $checkdir +dnl PAC_RUNLOG([echo ' call sub()' > $checkdir/conftestf.h]) +echo ' call sub()' > $checkdir/conftestf.h +AC_LANG_PUSH([Fortran 77]) +saved_FFLAGS="$FFLAGS" +pac_cv_prog_f77_has_incdir="none" +# SGI wants -Wf,-I +for idir in "-I" "-Wf,-I" ; do + FFLAGS="${idir} $checkdir $saved_FFLAGS" + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + program main + include 'conftestf.h' + end + ]) + ],[pac_cv_prog_f77_has_incdir="$idir"; break]) +done +FFLAGS="$saved_FFLAGS" +AC_LANG_POP([Fortran 77]) +if test "$checkdir_is_given" = "yes" ; then + rm -f $checkdir/conftestf.h +else + rm -rf $checkdir +fi +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_has_incdir" != "Xnone" ; then + F77_INCDIR="$pac_cv_prog_f77_has_incdir" + AC_SUBST(F77_INCDIR) +fi +]) +dnl +dnl/*D +dnl PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS - Check whether the Fortran compiler +dnl allows unused and undefined functions to be listed in an external +dnl statement +dnl +dnl Syntax: +dnl PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS(action-if-true,action-if-false) +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS],[ +AC_CACHE_CHECK([whether Fortran allows unused externals], +pac_cv_prog_f77_allows_unused_externals,[ +AC_LANG_PUSH([Fortran 77]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + external bar + end + ]) +],[ + pac_cv_prog_f77_allows_unused_externals="yes" +],[ + pac_cv_prog_f77_allows_unused_externals="no" +]) +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_allows_unused_externals" = "Xyes" ; then + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl PAC_PROG_F77_RUN_PROC_FROM_C( c main program, fortran routine, +dnl [action-if-works], [action-if-fails], +dnl [cross-action] ) +dnl Fortran routine MUST be named ftest unless you include code +dnl to select the appropriate Fortran name. +dnl +AC_DEFUN([PAC_PROG_F77_RUN_PROC_FROM_C],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([$2]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +$1 + ]) + ],[ + ifelse([$3],[],[:],[$3]) + ],[ + ifelse([$4],[],[:],[$4]) + ],[ + ifelse([$5],[],[:],[$5]) + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +],[ +]) +AC_LANG_POP([Fortran 77]) +]) +dnl PAC_PROG_F77_IN_C_LIBS +dnl +dnl Find the essential libraries that are needed to use the C linker to +dnl create a program that includes a trival Fortran code. +dnl +dnl For example, all pgf90 compiled objects include a reference to the +dnl symbol pgf90_compiled, found in libpgf90 . +dnl +dnl There is an additional problem. To *run* programs, we may need +dnl additional arguments; e.g., if shared libraries are used. Even +dnl with autoconf 2.52, the autoconf macro to find the library arguments +dnl doesn't handle this, either by detecting the use of -rpath or +dnl by trying to *run* a trivial program. It only checks for *linking*. +dnl +dnl +AC_DEFUN([PAC_PROG_F77_IN_C_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([for which Fortran libraries are needed to link C with Fortran]) +F77_IN_C_LIBS="invalid" +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine ftest + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + + # Create conftest for all link tests. + AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif + ],[ +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +extern void ftest_(void); +ftest_(); + ]) + ]) + + F77_IN_C_LIBS="" + AC_LINK_IFELSE([],[:],[ + flibdirs=`echo $FLIBS | tr ' ' '\012' | grep '\-L' | tr '\012' ' '` + fliblibs=`echo $FLIBS | tr ' ' '\012' | grep -v '\-L' | tr '\012' ' '` + for flibs in $fliblibs ; do + LIBS="pac_f77conftest.$OBJEXT $flibdirs $flibs $saved_LIBS" + AC_LINK_IFELSE([],[F77_IN_C_LIBS="$flibdirs $flibs"; break]) + done + if test "X$F77_IN_C_LIBS" = "X" ; then + flibscat="" + for flibs in $fliblibs ; do + flibscat="$flibscat $flibs" + LIBS="pac_f77conftest.$OBJEXT $flibdirs $flibscat $saved_LIBS" + AC_LINK_IFELSE([],[F77_IN_C_LIBS="$flibdirs $flibscat";break]) + done + fi + ]) + + # remove conftest created by ac_lang_conftest + rm -f conftest.$ac_ext + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +if test "X$F77_IN_C_LIBS" = "X" ; then + AC_MSG_RESULT(none) +else + AC_MSG_RESULT($F77_IN_C_LIBS) +fi +]) +dnl +dnl Test to see if we should use C or Fortran to link programs whose +dnl main program is in Fortran. We may find that neither work because +dnl we need special libraries in each case. +dnl +AC_DEFUN([PAC_PROG_F77_LINKER_WITH_C],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([for linker for Fortran main program]) +dnl Create a C program that uses multiplication and division +dnl in case that requires special libraries +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([],[long long a;]) +],[ + AC_DEFINE(HAVE_LONG_LONG,1,[Define if long long allowed]) +]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ +#ifdef HAVE_LONG_LONG +int f(int a, long long b) { int c; c = a * ( b / 3 ) / (b-1); return c ; } +#else +int f(int a, long b) { int c; c = a * b / (b-1); return c ; } +#endif + ]) +]) +AC_LANG_POP([C]) + +dnl Create a Fortran program for test +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + double precision d + print *, "hi" + end + ]) +]) +AC_LANG_POP([Fortran 77]) + +dnl Initialize flags +pac_linkwithf77=no +pac_linkwithC=no + +dnl Use F77 as a linker to compile a Fortran main and C subprogram. +if test "$pac_linkwithC" != "yes" ; then + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([],[ + AC_MSG_RESULT([Use Fortran to link programs]) + pac_linkwithf77=yes + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ]) + AC_LANG_POP([C]) +fi + +dnl Use C as a linker and FLIBS to compile a Fortran main and C subprogram. +if test "$pac_linkwithf77" != "yes" ; then + AC_LANG_PUSH([Fortran 77]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([],[ + pac_linkwithC=yes + AC_MSG_RESULT([Use C with FLIBS to link programs]) + F77LINKER="$CC" + F77_LDFLAGS="$F77_LDFLAGS $FLIBS" + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT + ]) + AC_LANG_POP([Fortran 77]) +fi + +AC_LANG_PUSH([Fortran 77]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) + +AC_LANG_PUSH([C]) +rm -f conftest.$ac_ext +AC_LANG_POP([C]) + +if test "$pac_linkwithf77" != "yes" -a "$pac_linkwithC" != "yes" ; then + AC_MSG_ERROR([Could not determine a way to link a Fortran test program!]) +fi +]) +dnl +dnl Check to see if a C program can be linked when using the libraries +dnl needed by C programs +dnl +AC_DEFUN([PAC_PROG_F77_CHECK_FLIBS],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether $CC links with FLIBS found by autoconf]) +AC_LANG_PUSH([C]) +# Create a simple C program for the tests. +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[int a;]) +]) +# Try to link a C program with all of these libraries +saved_LIBS="$LIBS" +LIBS="$FLIBS $saved_LIBS" +AC_LINK_IFELSE([],[ + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for which libraries can be used]) + pac_ldirs="" + pac_libs="" + pac_other="" + for name in $FLIBS ; do + case $name in + -l*) pac_libs="$pac_libs $name" ;; + -L*) pac_ldirs="$pac_ldirs $name" ;; + *) pac_other="$pac_other $name" ;; + esac + done + keep_libs="" + for name in $pac_libs ; do + LIBS="$saved_LIBS $pac_ldirs $pac_other $name" + AC_LINK_IFELSE([],[ + keep_libs="$keep_libs $name" + ]) + done + AC_MSG_RESULT($keep_libs) + FLIBS="$pac_ldirs $pac_other $keep_libs" +]) +LIBS="$saved_LIBS" +rm -f conftest.$ac_ext +AC_LANG_PUSH([C]) +]) +dnl +dnl Test for extra libraries needed when linking C routines that use +dnl stdio with Fortran. This test was created for OSX, which +dnl sometimes requires -lSystemStubs. If another library is needed, +dnl add it to F77_OTHER_LIBS +dnl +AC_DEFUN([PAC_PROG_F77_AND_C_STDIO_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +# To simply the code in the cache_check macro, chose the routine name +# first, in case we need it +confname=conf1_ +case "$pac_cv_prog_f77_name_mangle" in + "lower underscore") confname=conf1_ ;; + "upper stdcall") confname=CONF1 ;; + "upper") confname=CONF1 ;; + "lower doubleunderscore") confname=conf1_ ;; + "lower") confname=conf1 ;; + "mixed underscore") confname=conf1_ ;; + "mixed") confname=conf1 ;; +esac + +AC_CACHE_CHECK([for libraries to link Fortran main with C stdio routines], +pac_cv_prog_f77_and_c_stdio_libs,[ +pac_cv_prog_f77_and_c_stdio_libs=unknown +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +int $confname(int a) { + printf( "The answer is %d\n", a ); fflush(stdout); return 0; +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + call conf1(0) + end + ]) + ]) + for extralib in "" "-lSystemStubs" ; do + LIBS="pac_conftest.$OBJEXT $saved_LIBS $extralib" + AC_LINK_IFELSE([],[ + pac_cv_prog_f77_and_c_stdio_libs="$extralib"; break + ]) + done + if test "X$pac_cv_prog_f77_and_c_stdio_libs" = "X" ; then + pac_cv_prog_f77_and_c_stdio_libs=none + fi + rm -f conftest.$ac_ext + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_check +if test "$pac_cv_prog_f77_and_c_stdio_libs" != "none" \ + -a "$pac_cv_prog_f77_and_c_stdio_libs" != "unknown" ; then + F77_OTHER_LIBS="$F77_OTHER_LIBS $pac_cv_prog_f77_and_c_stdio_libs" +fi +]) +dnl +dnl Check that the FLIBS determined by AC_F77_LIBRARY_LDFLAGS is valid. +dnl That macro (at least as of autoconf 2.59) attempted to parse the output +dnl of the compiler when asked to be verbose; in the case of the Fujitsu +dnl frt Fortran compiler, it included files that frt looked for and then +dnl discarded because they did not exist. +dnl +AC_DEFUN([PAC_PROG_F77_FLIBS_VALID],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether $F77 accepts the FLIBS found by autoconf]) +pac_cv_f77_flibs_valid=unknown +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + end + ]) +]) +AC_LINK_IFELSE([],[ + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for valid entries in FLIBS]) + goodFLIBS="" + saveFLIBS=$FLIBS + FLIBS="" + for arg in $saveFLIBS ; do + FLIBS="$goodFLIBS $arg" + AC_LINK_IFELSE([],[goodFLIBS=$FLIBS]) + done + FLIBS=$goodFLIBS + AC_MSG_RESULT($FLIBS) +]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl Check if the Fortran 77 and C objects are compatible in linking. +dnl e.g. On some intel x86_64 Mac, Fortran compiler's default binary format +dnl is different from C, so either -m64 or -m32 is needed in either CFLAGS +dnl or FFLAGS. +dnl +AC_DEFUN([PAC_PROG_F77_OBJ_LINKS_WITH_C],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether Fortran 77 and C objects are compatible]) +AC_LANG_PUSH([C]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ +/* lower */ +void c_subpgm( int *rc ); +void c_subpgm( int *rc ) { *rc = 1; } + +/* lower underscore */ +void c_subpgm_( int *rc ); +void c_subpgm_( int *rc ) { *rc = 2; } + +/* upper */ +void C_SUBPGM( int *rc ); +void C_SUBPGM( int *rc ) { *rc = 3; } + +/* lower doubleunderscore */ +void c_subpgm__( int *rc ); +void c_subpgm__( int *rc ) { *rc = 4; } + +/* mixed */ +void C_subpgm( int *rc ); +void C_subpgm( int *rc ) { *rc = 5; } + +/* mixed underscore */ +void C_subpgm_( int *rc ); +void C_subpgm_( int *rc ) { *rc = 6; } + ]) +]) +AC_LANG_POP([C]) + +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program test + integer rc + rc = -1 + call c_subpgm( rc ) + write(6,*) "rc=", rc + end + ]) +]) +AC_LANG_POP([Fortran 77]) + +dnl Initialize flags +pac_linkwithf77=no +pac_linkwithC=no + +dnl Use F77 as a linker to compile a Fortran main and C subprogram. +if test "$pac_linkwithC" != "yes" ; then + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([],[ + pac_linkwithf77=yes + AC_MSG_RESULT([yes]) + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + if test "$pac_linkwithf77" = "yes" ; then + rm -f pac_conftest.$OBJEXT + fi + ]) + AC_LANG_POP([C]) +fi + +dnl Use C as a linker and FLIBS to compile a Fortran main and C subprogram. +if test "$pac_linkwithf77" != "yes" ; then + AC_LANG_PUSH([Fortran 77]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([],[ + pac_linkwithC=yes + AC_MSG_RESULT([yes]) + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + if test "$pac_linkwithC" = "yes" ; then + rm -f pac_f77conftest.$OBJEXT + fi + ]) + AC_LANG_POP([Fortran 77]) +fi + +AC_LANG_PUSH([Fortran 77]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) + +AC_LANG_PUSH([C]) +rm -f conftest.$ac_ext +AC_LANG_POP([C]) + +if test "$pac_linkwithf77" != "yes" -a "$pac_linkwithC" != "yes" ; then + AC_MSG_RESULT(no) + AC_CHECK_PROG(FILE, file, file, []) + if test "X$FILE" != "X" ; then + fobjtype="`${FILE} pac_f77conftest.$OBJEXT | sed -e \"s|pac_f77conftest\.$OBJEXT||g\"`" + cobjtype="`${FILE} pac_conftest.$OBJEXT | sed -e \"s|pac_conftest\.$OBJEXT||g\"`" + if test "$fobjtype" != "$cobjtype" ; then + AC_MSG_ERROR([**** Incompatible Fortran and C Object File Types! **** +F77 Object File Type produced by \"${F77} ${FFLAGS}\" is : ${fobjtype}. + C Object File Type produced by \"${CC} ${CFLAGS}\" is : ${cobjtype}.]) + fi + fi +fi +]) +dnl +dnl /*D +dnl PAC_F77_WORKS_WITH_CPP +dnl +dnl Checks if Fortran 77 compiler works with C preprocessor +dnl +dnl Most systems allow the Fortran compiler to process .F and .F90 files +dnl using the C preprocessor. However, some systems either do not +dnl allow this or have serious bugs (OSF Fortran compilers have a bug +dnl that generates an error message from cpp). The following test +dnl checks to see if .F works, and if not, whether "cpp -P -C" can be used +dnl D*/ +AC_DEFUN([PAC_F77_WORKS_WITH_CPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([whether Fortran 77 compiler processes .F files with C preprocessor]) +AC_LANG_PUSH([Fortran 77]) +saved_f77_ext=${ac_ext} +ac_ext="F" +saved_FFLAGS="$FFLAGS" +FFLAGS="$FFLAGS $CPPFLAGS" +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main +#define ASIZE 10 + integer a(ASIZE) + end + ]) +]) +AC_COMPILE_IFELSE([],[ + pac_cv_f77_accepts_F=yes + ifelse([$1],[],[],[$1=""]) +],[ + pac_cv_f77_accepts_F=no + ifelse([$1],[],[:],[$1="false"]) +]) +# Restore Fortran 77's ac_ext but not FFLAGS +ac_ext="$saved_f77_ext" + +if test "$pac_cv_f77_accepts_F" != "yes" ; then + pac_cpp_f77="$ac_cpp -C -P conftest.F > conftest.$ac_ext" + PAC_RUNLOG_IFELSE([$pac_cpp_f77],[ + if test -s conftest.${ac_ext} ; then + AC_COMPILE_IFELSE([],[ + pac_cv_f77_accepts_F="no, use cpp" + ifelse([$1],[],[],[$1="$CPP -C -P"]) + ],[]) + rm -f conftest.${ac_ext} + fi + ],[]) +fi +FFLAGS="$saved_FFLAGS" +rm -f conftest.F +AC_LANG_POP([Fortran 77]) +AC_MSG_RESULT([$pac_cv_f77_accepts_F]) +]) +dnl +dnl /*D +dnl PAC_PROG_F77_CRAY_POINTER - Check if Fortran 77 supports Cray-style pointer. +dnl If so, set pac_cv_prog_f77_has_pointer to yes +dnl and find out if any extra compiler flag is +dnl needed and set it as CRAYPTR_FFLAGS. +dnl i.e. CRAYPTR_FFLAGS is meaningful only if +dnl pac_cv_prog_f77_has_pointer = yes. +dnl +dnl Synopsis: +dnl PAC_PROG_F77_CRAY_POINTER([action-if-true],[action-if-false]) +dnl D*/ +AC_DEFUN([PAC_PROG_F77_CRAY_POINTER],[ +AC_CACHE_CHECK([whether Fortran 77 supports Cray-style pointer], +pac_cv_prog_f77_has_pointer,[ +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[ + integer M + pointer (MPTR,M) + data MPTR/0/ + ]) +]) +saved_FFLAGS="$FFLAGS" +pac_cv_prog_f77_has_pointer=no +CRAYPTR_FFLAGS="" +for ptrflag in '' '-fcray-pointer' ; do + FFLAGS="$saved_FFLAGS $ptrflag" + AC_COMPILE_IFELSE([], [ + pac_cv_prog_f77_has_pointer=yes + CRAYPTR_FFLAGS="$ptrflag" + break + ]) +done +dnl Restore FFLAGS first, since user may not want to modify FFLAGS +FFLAGS="$saved_FFLAGS" +dnl remove conftest after ac_lang_conftest +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) +]) +if test "$pac_cv_prog_f77_has_pointer" = "yes" ; then + AC_MSG_CHECKING([for Fortran 77 compiler flag for Cray-style pointer]) + if test "X$CRAYPTR_FFLAGS" != "X" ; then + AC_MSG_RESULT([$CRAYPTR_FFLAGS]) + else + AC_MSG_RESULT([none]) + fi + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl +dnl +dnl PAC_F77_INIT_WORKS_WITH_C +dnl +AC_DEFUN([PAC_F77_INIT_WORKS_WITH_C],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_MSG_CHECKING([whether Fortran init will work with C]) +pac_f_init_works_with_c=unknown +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine minit() + common /m1/ vc, vc2 + character*1 vc(1,1), vc2(1) + common /m2/ vd + integer vd + save /m1/, /m2/ + call minitc( vc, vc2, vd ) + end + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + # This test checks if Fortran init can be done in pure C environment, + # i.e. no FLIBS in linking, so don't put FLIBS in LIBS below + dnl LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + LIBS="pac_f77conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +#ifdef F77_NAME_UPPER +#define minit_ MINIT +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define minit_ minit +#endif +extern void minit_(void); +int main( int argc, char **argv ) +{ + minit_(); + return 0; +} +char *v1 = 0; +char *vc2 = 0; +int v2 = 0; +void minitc_( char *dv1, int d, char *dv2, int d2, int dv3 ); +void minitc_( char *dv1, int d, char *dv2, int d2, int dv3 ) +{ +v1 = dv1; +v2 = dv3; +vc2 = dv2; +*vc2 = ' '; +} + ]) + ],[pac_f_init_works_with_c=yes],[pac_f_init_works_with_c=no]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +AC_MSG_RESULT([$pac_f_init_works_with_c]) +]) +dnl +dnl PAC_F77_LOGICALS_IN_C(MPI_FINT) +dnl +dnl where MPI_FINT is the C type for Fortran integer. +dnl +dnl Use a Fortran main program. This simplifies some steps, +dnl since getting all of the Fortran libraries (including shared +dnl libraries that are not in the default library search path) can +dnl be tricky. Specifically, The PROG_F77_RUN_PROC_FROM_C failed with +dnl some installations of the Portland group compiler. +dnl +dnl We'd also like to check other values for .TRUE. and .FALSE. to see +dnl if the compiler allows (or uses) more than one value (some DEC compilers, +dnl for example, used the high (sign) bit to indicate true and false; the +dnl rest of the bits were ignored. For now, we'll assume that there are +dnl unique true and false values. +dnl +AC_DEFUN([PAC_F77_LOGICALS_IN_C],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +pac_mpi_fint="$1" +AC_MSG_CHECKING([for values of Fortran logicals]) +AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[ +pac_cv_prog_f77_true_false_value="" +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +#if defined(HAVE_STDLIB_H) || defined(STDC_HEADERS) +#include <stdlib.h> +#endif +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +void ftest_( $pac_mpi_fint *, $pac_mpi_fint *); +void ftest_( $pac_mpi_fint *itrue, $pac_mpi_fint *ifalse ) +{ + FILE *f = fopen("conftestval","w"); + if (!f) exit(1); + fprintf( f, "%d %d\n", *itrue, *ifalse ); + fclose(f); +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + logical itrue, ifalse + itrue = .TRUE. + ifalse = .FALSE. + call ftest( itrue, ifalse ) + end + ]) + ],[ + pac_cv_prog_f77_true_false_value="`cat conftestval`" + ],[ + AC_MSG_WARN([Failed to build/run program to determine Fortran logical values.]) + ],[ + # Cross-Compiling. Allow the user to set the values + if test -n "$CROSS_F77_TRUE_VALUE" -a -n "$CROSS_F77_FALSE_VALUE" ; then + pac_cv_prog_f77_true_false_value="$CROSS_F77_TRUE_VALUE $CROSS_F77_FALSE_VALUE" + else + AC_MSG_WARN([Either CROSS_F77_TRUE_VALUE="$CROSS_F77_TRUE_VALUE" or CROSS_F77_FALSE_VALUE="$CROSS_F77_FALSE_VALUE" is not set.]) + fi + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_val +if test "X$pac_cv_prog_f77_true_false_value" != "X" ; then + true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`" + false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.* *//g'`" + if test -n "$true_val" -a -n "$false_val" ; then + AC_MSG_RESULT([True is $true_val and False is $false_val]) + else + AC_MSG_RESULT([could not determine]) + fi +fi +if test -n "$true_val" -a -n "$false_val" ; then + AC_DEFINE(F77_TRUE_VALUE_SET,1,[Define if we know the value of Fortran true and false]) + AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran]) + AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran]) +fi +]) +dnl/*D +dnl PAC_PROG_F77_MISMATCHED_ARGS([option],[AllOnly]) - Determine whether the +dnl Fortran compiler allows routines to be called with different +dnl argument types. If not, attempts to determine a command-line argument +dnl that permits such use +dnl (The Fortran standard prohibits this usage) +dnl +dnl option is set to the compiler option to use. +dnl if AllOnly is yes (literal, not variable with value), then only consider +dnl options that turn off checking +dnl for all routines +dnl +dnl The NAG Fortran compiler, nagfor, is known to enforce this part of the +dnl Fortran standard. +dnl D*/ +AC_DEFUN([PAC_PROG_F77_MISMATCHED_ARGS],[ +AC_MSG_CHECKING([whether $F77 allows mismatched arguments]) +if test "X$pac_cv_prog_f77_mismatched_args" = X ; then + pac_cv_prog_f77_mismatched_args_parm="" + pac_cv_prog_f77_mismatched_args=no + AC_LANG_PUSH([Fortran 77]) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + program main + integer a + real b + character c + call foo1(a) + call foo1(b) + call foo1(c) + end +])],[pac_cv_prog_f77_mismatched_args=yes]) + if test "$pac_cv_prog_f77_mismatched_args" != "yes" ; then + # try again with -wmismatch=foo1 + save_FFLAGS="$FFLAGS" + # The best solution is to turn off errors on particular routines + # if that isn't possible (e.g., too many of them), then + # just try arguments that turn off all checking + for flags in ifelse($2,yes,,"-wmismatch=foo1") "-mismatch" "-fallow-argument-mismatch" ; do + testok=no + FFLAGS="$FFLAGS $flags" + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + program main + integer a + real b + character c + call foo1(a) + call foo1(b) + call foo1(c) + end +])],[testok=yes]) + FFLAGS="$save_FFLAGS" + if test "$testok" = yes ; then break ; fi + done + if test "$testok" = yes ; then + pac_cv_prog_f77_mismatched_args_parm="$flags" + pac_cv_prog_f77_mismatched_args="yes, with $pac_cv_prog_f77_mismatched_args_parm" + fi + fi + AC_LANG_POP([Fortran 77]) +fi +AC_MSG_RESULT($pac_cv_prog_f77_mismatched_args) +if test "$pac_cv_prog_f77_mismatched_args" = no ; then + AC_MSG_ERROR([The Fortran compiler $F77 will not compile files that call +the same routine with arguments of different types.]) +fi + +ifelse($1,,,[$1=$pac_cv_prog_f77_mismatched_args_parm]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_f77old.m4 b/3rd-party/romio341/mpl/confdb/aclocal_f77old.m4 new file mode 100644 index 0000000000000000000000000000000000000000..5d6e2d9e70a3c754b23791d7013c408a7fab1e36 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_f77old.m4 @@ -0,0 +1,389 @@ +dnl/*D +dnl PAC_PROG_F77_CMDARGS - Determine how to access the command line from +dnl Fortran 77 +dnl +dnl Output Effects: +dnl The following variables are set: +dnl.vb +dnl F77_GETARG - Statement to get an argument i into string s +dnl F77_IARGC - Routine to return the number of arguments +dnl FXX_MODULE - Module command when using Fortran 90 compiler +dnl F77_GETARGDECL - Declaration of routine used for F77_GETARG +dnl F77_GETARG_FFLAGS - Flags needed when compiling/linking +dnl F77_GETARG_LDFLAGS - Flags needed when linking +dnl.ve +dnl If 'F77_GETARG' has a value, then that value and the values for these +dnl other symbols will be used instead. If no approach is found, all of these +dnl variables will have empty values. +dnl If no other approach works and a file 'f77argdef' is in the directory, +dnl that file will be sourced for the values of the above four variables. +dnl +dnl In most cases, you should add F77_GETARG_FFLAGS to the FFLAGS variable +dnl and F77_GETARG_LDFLAGS to the LDFLAGS variable, to ensure that tests are +dnl performed on the compiler version that will be used. +dnl +dnl 'AC_SUBST' is called for all six variables. +dnl +dnl One complication is that on systems with multiple Fortran compilers, +dnl some libraries used by one Fortran compiler may have been (mis)placed +dnl in a common location. We have had trouble with libg2c in particular. +dnl To work around this, we test whether iargc etc. work first. This +dnl will catch most systems and will speed up the tests. +dnl +dnl Next, the libraries are only added if they are needed to complete a +dnl link; they aren''t added just because they exist. +dnl +dnl f77argdef +dnl D*/ +dnl +dnl Random notes +dnl You can export the command line arguments from C to the g77 compiler +dnl using +dnl extern char **__libc_argv; +dnl extern int __libc_argc; +dnl f_setarg( __libc_argc, __libc_argv ); +dnl +AC_DEFUN([PAC_PROG_F77_CMDARGS],[ +found_cached="yes" +AC_MSG_CHECKING([for routines to access the command line from Fortran 77]) +AC_CACHE_VAL(pac_cv_prog_f77_cmdarg, +[ + AC_MSG_RESULT([searching...]) + found_cached="no" + # First, we perform a quick check. Does iargc and getarg work? + fxx_module="${FXX_MODULE:-}" + f77_getargdecl="${F77_GETARGDECL:-external getarg}" + f77_getarg="${F77_GETARG:-call GETARG(i,s)}" + f77_iargc="${F77_IARGC:-IARGC()}" + # + # Grumble. The Absoft Fortran compiler computes i - i as 0 and then + # 1.0 / 0 at compile time, even though the code may never be executed. + # What we need is a way to generate an error, so the second usage of i + # was replaced with f77_iargc. + cat > conftest.f <<EOF + program main +$fxx_module + integer i, j + character*20 s + $f77_getargdecl + i = 0 + $f77_getarg + i=$f77_iargc + if (i .gt. 1) then + j = i - $f77_iargc + j = 1.0 / j + endif + end +EOF + found_answer="no" + if test -z "$ac_fcompilelink" ; then + ac_fcompilelink="${F77-f77} -o conftest $FFLAGS $flags conftest.f $LDFLAGS $LIBS 1>&AC_FD_CC" + fi + AC_MSG_CHECKING([whether ${F77-f77} $flags $libs works with GETARG and IARGC]) + if AC_TRY_EVAL(ac_fcompilelink) && test -x conftest ; then + # Check that cross != yes so that this works with autoconf 2.52 + # Check that cross_compiling != yes so that this works with + # autoconf 2.6x for some (but almost certainly not all)x + # Question: why do we test that this runs? It looks like we + # needed this for some old Fortran compilers that produced + # executable code that then did not run. + if test "$ac_cv_prog_f77_cross" != "yes" -a \ + "$cross_compiling" != "yes" ; then + if ./conftest >/dev/null 2>&1 ; then + found_answer="yes" + FXX_MODULE="$fxx_module" + F77_GETARGDECL="$f77_getargdecl" + F77_GETARG="$f77_getarg" + F77_IARGC="$f77_iargc" + AC_MSG_RESULT(yes) + fi + fi + fi + if test $found_answer = "no" ; then + AC_MSG_RESULT(no) + # Grumph. Here are a bunch of different approaches + # We have several axes the check: + # Library to link with (none, -lU77 (HPUX), -lg2c (LINUX f77)) + # PEPCF90 (Intel ifc) + # The first line is a dummy + # (we experimented with using a <space>, but this caused other + # problems because we need <space> in the IFS) + trial_LIBS="0 -lU77 -lPEPCF90" + if test "$NOG2C" != "1" ; then + trial_LIBS="$trial_LIBS -lg2c" + fi + # Discard libs that are not availble: + save_IFS="$IFS" + # Make sure that IFS includes a space, or the tests that run programs + # may fail + IFS=" "" +" + save_trial_LIBS="$trial_LIBS" + trial_LIBS="" + cat > conftest.f <<EOF + program main + end +EOF + ac_fcompilelink_test='${F77-f77} -o conftest $FFLAGS conftest.f $LDFLAGS $libs $LIBS 1>&AC_FD_CC' + for libs in $save_trial_LIBS ; do + if test "$libs" = "0" ; then + lib_ok="yes" + else + AC_MSG_CHECKING([whether Fortran 77 links with $libs]) + if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then + AC_MSG_RESULT([yes]) + lib_ok="yes" + else + AC_MSG_RESULT([no]) + lib_ok="no" + fi + fi + if test "$lib_ok" = "yes" ; then + trial_LIBS="$trial_LIBS +$libs" + fi + done + + # Options to use when compiling and linking + # +U77 is needed by HP Fortran to access getarg etc. + # The -N109 was used for getarg before we realized that GETARG + # was necessary with the (non standard conforming) Absoft compiler + # (Fortran is monocase; Absoft uses mixedcase by default) + # The -f is used by Absoft and is the compiler switch that folds + # symbolic names to lower case. Without this option, the compiler + # considers upper- and lower-case letters to be unique. + # The -YEXT_NAMES=LCS will cause external names to be output as lower + # case letter for Absoft F90 compilers (default is upper case) + # The first line is "<space><newline>, the space is important + # To make the Absoft f77 and f90 work together, we need to prefer the + # upper case versions of the arguments. They also require libU77. + # -YCFRL=1 causes Absoft f90 to work with g77 and similar (f2c-based) + # Fortran compilers + # + # Problem: The Intel efc compiler hangs when presented with -N109 . + # The only real fix for this is to detect this compiler and exclude + # the test. We may want to reorganize these tests so that if we + # can compile code without special options, we never look for them. + # + using_intel_efc="no" + pac_test_msg=`$F77 -V 2>&1 | grep 'Intel(R) Fortran Itanium'` + if test "$pac_test_msg" != "" ; then + using_intel_efc="yes" + fi + if test "$using_intel_efc" = "yes" ; then + trial_FLAGS="000" + else + trial_FLAGS="000 +-N109 +-f +-YEXT_NAMES=UCS +-YEXT_NAMES=LCS +-YCFRL=1 ++U77" + fi + # Discard options that are not available: + # (IFS already saved above) + IFS=" "" +" + save_trial_FLAGS="$trial_FLAGS" + trial_FLAGS="" + for flag in $save_trial_FLAGS ; do + if test "$flag" = " " -o "$flag" = "000" ; then + opt_ok="yes" + else + PAC_F77_CHECK_COMPILER_OPTION($flag,opt_ok=yes,opt_ok=no) + fi + if test "$opt_ok" = "yes" ; then + if test "$flag" = " " -o "$flag" = "000" ; then + fflag="" + else + fflag="$flag" + fi + # discard options that don't allow mixed-case name matching + cat > conftest.f <<EOF + program main + call aB() + end + subroutine Ab() + end +EOF + if test -n "$fflag" ; then flagval="with $fflag" ; else flagval="" ; fi + AC_MSG_CHECKING([whether Fortran 77 routine names are case-insensitive $flagval]) + dnl we can use double quotes here because all is already + dnl evaluated + ac_fcompilelink_test="${F77-f77} -o conftest $fflag $FFLAGS conftest.f $LDFLAGS $LIBS 1>&AC_FD_CC" + if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + opt_ok="no" + fi + fi + if test "$opt_ok" = "yes" ; then + trial_FLAGS="$trial_FLAGS +$flag" + fi + done + IFS="$save_IFS" + # Name of routines. Since these are in groups, we use a case statement + # and loop until the end (accomplished by reaching the end of the + # case statement + # For one version of Nag F90, the names are + # call f90_unix_MP_getarg(i,s) and f90_unix_MP_iargc(). + trial=0 + while test -z "$pac_cv_prog_f77_cmdarg" ; do + case $trial in + 0) # User-specified values, if any + if test -z "$F77_GETARG" -o -z "$F77_IARGC" ; then + trial=`expr $trial + 1` + continue + fi + MSG="Using environment values of F77_GETARG etc." + ;; + 1) # Standard practice, uppercase (some compilers are case-sensitive) + FXX_MODULE="" + F77_GETARGDECL="external GETARG" + F77_GETARG="call GETARG(i,s)" + F77_IARGC="IARGC()" + MSG="GETARG and IARGC" + ;; + 2) # Standard practice, lowercase + FXX_MODULE="" + F77_GETARGDECL="external getarg" + F77_GETARG="call getarg(i,s)" + F77_IARGC="iargc()" + MSG="getarg and iargc" + ;; + 3) # Posix alternative + FXX_MODULE="" + F77_GETARGDECL="external pxfgetarg" + F77_GETARG="call pxfgetarg(i,s,l,ier)" + F77_IARGC="ipxfargc()" + MSG="pxfgetarg and ipxfargc" + ;; + 4) # Nag f90_unix_env module + FXX_MODULE=" use f90_unix_env" + F77_GETARGDECL="" + F77_GETARG="call getarg(i,s)" + F77_IARGC="iargc()" + MSG="f90_unix_env module" + ;; + 5) # Nag f90_unix module + FXX_MODULE=" use f90_unix" + F77_GETARGDECL="" + F77_GETARG="call getarg(i,s)" + F77_IARGC="iargc()" + MSG="f90_unix module" + ;; + 6) # user spec in a file + if test -s f77argdef ; then + . ./f77argdef + MSG="Using definitions in the file f77argdef" + else + trial=`expr $trial + 1` + continue + fi + ;; + 7) # gfortran won't find getarg if it is marked as external + FXX_MODULE="" + F77_GETARGDECL="intrinsic GETARG" + F77_GETARG="call GETARG(i,s)" + F77_IARGC="IARGC()" + MSG="intrinsic GETARG and IARGC" + ;; + *) # exit from while loop + FXX_MODULE="" + F77_GETARGDECL="" + F77_GETARG="" + F77_IARGC="" + break + ;; + esac + # Create the program. Make sure that we can run it. + # Force a divide-by-zero if there is a problem (but only at runtime! + # (the Absoft compiler does divide-by-zero at compile time) + cat > conftest.f <<EOF + program main +$FXX_MODULE + integer i, j + character*20 s + $F77_GETARGDECL + i = 0 + $F77_GETARG + i=$F77_IARGC + if (i .gt. 1) then + j = i - $F77_IARGC + j = 1.0 / j + endif + end +EOF + # + # Now, try to find some way to compile and link that program, looping + # over the possibilities of options and libraries + save_IFS="$IFS" + IFS=" "" +" + for libs in $trial_LIBS ; do + if test -n "$pac_cv_prog_f77_cmdarg" ; then break ; fi + if test "$libs" = " " -o "$libs" = "0" ; then libs="" ; fi + for flags in $trial_FLAGS ; do + if test "$flags" = " " -o "$flags" = "000"; then flags="" ; fi + AC_MSG_CHECKING([whether ${F77-f77} $flags $libs works with $MSG]) + IFS="$save_IFS" + dnl We need this here because we've fiddled with IFS + ac_fcompilelink_test="${F77-f77} -o conftest $FFLAGS $flags conftest.f $LDFLAGS $libs $LIBS 1>&AC_FD_CC" + found_answer="no" + if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then + if test "$ac_cv_prog_f77_cross" != "yes" -a \ + "$cross_compiling" != "yes" ; then + if ./conftest >/dev/null 2>&1 ; then + found_answer="yes" + fi + else + found_answer="yes" + fi + fi + IFS=" "" +" + if test "$found_answer" = "yes" ; then + AC_MSG_RESULT([yes]) + pac_cv_prog_f77_cmdarg="$MSG" + pac_cv_prog_f77_cmdarg_fflags="$flags" + pac_cv_prog_f77_cmdarg_ldflags="$libs" + break + else + AC_MSG_RESULT([no]) + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.f >&AC_FD_CC + fi + done + done + IFS="$save_IFS" + rm -f conftest.* + trial=`expr $trial + 1` + done +fi +pac_cv_F77_GETARGDECL="$F77_GETARGDECL" +pac_cv_F77_IARGC="$F77_IARGC" +pac_cv_F77_GETARG="$F77_GETARG" +pac_cv_FXX_MODULE="$FXX_MODULE" +]) +if test "$found_cached" = "yes" ; then + AC_MSG_RESULT([$pac_cv_prog_f77_cmdarg]) +elif test -z "$pac_cv_F77_IARGC" ; then + AC_MSG_WARN([Could not find a way to access the command line from Fortran 77]) +fi +# Set the variable values based on pac_cv_prog_xxx +F77_GETARGDECL="$pac_cv_F77_GETARGDECL" +F77_IARGC="$pac_cv_F77_IARGC" +F77_GETARG="$pac_cv_F77_GETARG" +FXX_MODULE="$pac_cv_FXX_MODULE" +F77_GETARG_FFLAGS="$pac_cv_prog_f77_cmdarg_fflags" +F77_GETARG_LDFLAGS="$pac_cv_prog_f77_cmdarg_ldflags" +AC_SUBST(F77_GETARGDECL) +AC_SUBST(F77_IARGC) +AC_SUBST(F77_GETARG) +AC_SUBST(FXX_MODULE) +AC_SUBST(F77_GETARG_FFLAGS) +AC_SUBST(F77_GETARG_LDFLAGS) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_fc.m4 b/3rd-party/romio341/mpl/confdb/aclocal_fc.m4 new file mode 100644 index 0000000000000000000000000000000000000000..93465edaa6bd364de449f3dc8c5a77eb5f0000d2 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_fc.m4 @@ -0,0 +1,1197 @@ +dnl +dnl PAC_FC_EXT checks for the default Fortran 90 program extension, f90 then f. +dnl This could be replaced by AC_FC_SRCEXT but since AC_FC_SRCEXT +dnl adds FCFLAGS_ext, which is used to modify FCFLAGS or Makefile.in. +dnl So will do this later. +dnl +AC_DEFUN([PAC_FC_EXT],[ +AC_MSG_CHECKING([for extension for Fortran 90 programs]) +ac_fc_srcext="f90" +AC_LANG_PUSH(Fortran) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM() +],[ + AC_MSG_RESULT([f90]) +],[ + ac_fc_srcext="f" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM() + ],[ + AC_MSG_RESULT([f]) + ],[ + AC_MSG_RESULT([unknown!]) + ]) +]) +AC_LANG_POP(Fortran) +]) +dnl +dnl Internal routine for testing F90 +dnl PAC_PROG_FC_WORKS() +dnl +AC_DEFUN([PAC_PROG_FC_WORKS],[ +AC_REQUIRE([PAC_FC_EXT]) +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + integer, dimension(10) :: n + end + ]) +],[ + pac_cv_prog_fc_works="yes" + AC_MSG_RESULT([$pac_cv_prog_fc_works]) + AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) is a cross-compiler]) + AC_RUN_IFELSE([], + [pac_cv_prog_fc_cross="no"], + [pac_cv_prog_fc_cross="yes"], + [pac_cv_prog_fc_cross="$cross_compiling"] + ) + AC_MSG_RESULT($pac_cv_prog_fc_cross) +],[ + pac_cv_prog_fc_works="no" + AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +dnl cross_compiling no longer maintained by autoconf as part of the +dnl AC_LANG changes. If we set it here, a later AC_LANG may not +dnl restore it (in the case where one compiler claims to be a cross compiler +dnl and another does not) +dnl cross_compiling=$pac_cv_prog_f90_cross +]) +dnl/*D +dnl PAC_PROG_FC_INT_KIND - Determine kind parameter for an integer with +dnl the specified number of bytes. +dnl +dnl Synopsis: +dnl PAC_PROG_FC_INT_KIND(variable-to-set,number-of-bytes,[cross-size]) +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_FC_INT_KIND],[ +# Set the default +$1=-1 +if test "$pac_cv_prog_fc_cross" = "yes" ; then + AS_IF([test -z "$3"],[AC_MSG_ERROR(['$3' is empty])]) + $1="$3" +else + AC_LANG_PUSH(Fortran) + AC_MSG_CHECKING([for Fortran 90 integer kind for $2-byte integers]) + # Convert bytes to digits + case $2 in + 1) sellen=2 ;; + 2) sellen=4 ;; + 4) sellen=8 ;; + 8) sellen=16 ;; + 16) sellen=30 ;; + *) sellen=8 ;; + esac + # Check for cached value + eval testval=\$"pac_cv_prog_fc_int_kind_$sellen" + if test -n "$testval" ; then + AC_MSG_RESULT([$testval (cached)]) + $1=$testval + else + KINDVAL="unavailable" + eval "pac_cv_prog_fc_int_kind_$sellen"=-1 + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + integer ii + ii = selected_int_kind($sellen) + open(8, file="conftest1.out", form="formatted") + write (8,*) ii + close(8) + stop + end + ]) + ],[pac_run_ok=yes],[pac_run_ok=no]) + if test "$pac_run_ok" = "yes" ; then + if test -s conftest1.out ; then + # Because of write, there may be a leading blank. + KINDVAL=`cat conftest1.out | sed 's/ //g'` + eval "pac_cv_prog_fc_int_kind_$sellen"=$KINDVAL + $1=$KINDVAL + fi + fi + AC_MSG_RESULT([$KINDVAL]) + fi # not cached + AC_LANG_POP(Fortran) +fi # is not cross compiling +])dnl +dnl +dnl ------------------------------------------------------------------------ +dnl Special characteristics that have no autoconf counterpart but that +dnl we need as part of the Fortran 90 support. To distinquish these, they +dnl have a [PAC] prefix. +dnl +dnl At least one version of the Cray compiler needs the option -em to +dnl generate a separate module file, rather than including the module +dnl information in the object (.o) file. +dnl +dnl +dnl PAC_FC_MODULE_EXT(action if found,action if not found) +dnl +AC_DEFUN([PAC_FC_MODULE_EXT], +[AC_CACHE_CHECK([for Fortran 90 module extension], +pac_cv_fc_module_ext,[ +pac_cv_fc_module_case="unknown" +AC_LANG_PUSH(Fortran) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + module conftest + integer n + parameter (n=1) + end module conftest + ]) +],[ + # Look for module name + # First, try to find known names. This avoids confusion caused by + # additional files (like <name>.stb created by some versions of pgf90) + # Early versions of the Intel compiler used d as the module extension; + # we include that just to finish the test as early as possible. + for name in conftest CONFTEST ; do + for ext in mod MOD d ; do + if test -s $name.$ext ; then + if test $name = conftest ; then + pac_cv_fc_module_case=lower + else + pac_cv_fc_module_case=upper + fi + pac_cv_fc_module_ext=$ext + pac_MOD=$ext + break + fi + done + if test -n "$pac_cv_fc_module_ext" ; then break ; fi + done + if test -z "$pac_MOD" ; then + # The test on .err is needed for Cray Fortran. + pac_MOD=`ls conftest.* 2>&1 | grep -v conftest.${ac_fc_srcext} | grep -v conftest.o | grep -v conftest.err` + pac_MOD=`echo $pac_MOD | sed -e 's/conftest\.//g'` + pac_cv_fc_module_case="lower" + if test "X$pac_MOD" = "X" ; then + pac_MOD=`ls CONFTEST* 2>&1 | grep -v CONFTEST.${ac_fc_srcext} | grep -v CONFTEST.o | grep -v CONFTEST.err` + pac_MOD=`echo $pac_MOD | sed -e 's/CONFTEST\.//g'` + if test -n "$pac_MOD" -a -s "CONFTEST.$pac_MOD" ; then + pac_cv_fc_module_case="upper" + else + # Clear because we must have gotten an error message + pac_MOD="" + fi + fi + if test -z "$pac_MOD" ; then + pac_cv_fc_module_ext="unknown" + else + pac_cv_fc_module_ext=$pac_MOD + fi + fi +],[ + pac_cv_fc_module_ext="unknown" +]) + +if test "$pac_cv_fc_module_ext" = "unknown" ; then + # Try again, but with an -em option. Abbreviated, because we're + # just looking for the Cray option + saveFCFLAGS=$FCFLAGS + FCFLAGS="$FCFLAGS -em" + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + module conftest + integer n + parameter (n=1) + end module conftest + ]) +],[ + if test -s conftest.mod ; then + pac_cv_fc_module_ext="mod" + pac_cv_fc_module_case="lower" + elif test -s CONFTEST.mod ; then + pac_cv_fc_module_ext="mod" + pac_cv_fc_module_case="upper" + fi +],[ + : + # do nothing - already have the unknown default value +]) + if test "$pac_cv_fc_module_ext" = "unknown" ; then + # The additional command line option did not help - restore + # the original flags. + FCFLAGS=$saveFCFLAGS + fi +fi +AC_LANG_POP(Fortran) +]) +# +AC_SUBST(FCMODEXT) +if test "$pac_cv_fc_module_ext" = "unknown" ; then + ifelse($2,,:,[$2]) +else + ifelse($1,,FCMODEXT=$pac_MOD,[$1]) +fi +]) +dnl +dnl +dnl PAC_FC_MODULE_INCFLAG +AC_DEFUN([PAC_FC_MODULE_INCFLAG],[ +AC_REQUIRE([PAC_FC_MODULE_EXT]) +AC_CACHE_CHECK([for Fortran 90 module include flag], +pac_cv_fc_module_incflag,[ +AC_LANG_PUSH(Fortran) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + module conf + integer n + parameter (n=1) + end module conf + ]) +]) +pac_madedir="no" +if test ! -d conf ; then mkdir conftestdir ; pac_madedir="yes"; fi +if test "$pac_cv_fc_module_case" = "upper" ; then + pac_module="CONF.$pac_cv_fc_module_ext" +else + pac_module="conf.$pac_cv_fc_module_ext" +fi +AC_COMPILE_IFELSE([],[ + if test -s "$pac_module" ; then + mv $pac_module conftestdir + # Remove any temporary files, and hide the work.pc file + # (if the compiler generates them) + if test -f work.pc ; then + mv -f work.pc conftest.pc + fi + rm -f work.pcl + else + AC_MSG_WARN([Unable to build a simple Fortran 90 module]) + # echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + # cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD + _AC_MSG_LOG_CONFTEST + fi +],[]) +# Remove the conftest* after AC_LANG_CONFTEST +rm -rf conftest.dSYM +rm -f conftest.$ac_ext + +dnl Create the conftest here so the test isn't created everytime inside loop. +AC_LANG_CONFTEST([AC_LANG_PROGRAM([],[use conf])]) + +# Save the original FCFLAGS +saved_FCFLAGS="$FCFLAGS" +pac_cv_fc_module_incflag="" +for inchdr in '-I' '-M' '-p' ; do + FCFLAGS="$saved_FCFLAGS ${inchdr}conftestdir" + AC_COMPILE_IFELSE([],[pac_cv_fc_module_incflag="$inchdr" ; break]) +done +if test "X$pac_cv_fc_module_incflag" = "X" ; then + if test -s conftest.pc ; then + mv conftest.pc conftestdir/mpimod.pc + echo "mpimod.pc" > conftestdir/mpimod.pcl + echo "`pwd`/conftestdir/mpimod.pc" >> conftestdir/mpimod.pcl + inchdr='-cl,' + FCFLAGS="$save_FCFLAGS ${inchdr}conftestdir" + AC_COMPILE_IFELSE([], [pac_fcompile_ok=yes], [pac_fcompile_ok=no]) + if test "$pac_fcompile_ok" = "yes" ; then + pac_cv_fc_module_incflag="$inchdr" + # Not quite right; see the comments that follow + AC_MSG_RESULT([-cl,filename where filename contains a list of files and directories]) + FC_WORK_FILES_ARG="-cl,mpimod.pcl" + FCMODINCSPEC="-cl,<dir>/<file>mod.pcl" + else + # The version of the Intel compiler that I have refuses to let + # you put the "work catalog" list anywhere but the current directory. + pac_cv_fc_module_incflag="Unavailable!" + fi + else + # Early versions of the Intel ifc compiler required a *file* + # containing the names of files that contained the names of the + # + # -cl,filename.pcl + # filename.pcl contains + # fullpathname.pc + # The "fullpathname.pc" is generated, I believe, when a module is + # compiled. + # Intel compilers use a wierd system: -cl,filename.pcl . If no file is + # specified, work.pcl and work.pc are created. However, if you specify + # a file, it must contain the name of a file ending in .pc . Ugh! + pac_cv_fc_module_incflag="unknown" + fi +fi +# Restore the original FCFLAGS +FCFLAGS="$saved_FCFLAGS" +if test "$pac_madedir" = "yes" ; then rm -rf conftestdir ; fi +# Remove the conftest* after AC_LANG_CONFTEST +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +AC_LANG_POP(Fortran) +]) +AC_SUBST(FC_WORK_FILES_ARG) +AC_SUBST(FCMODINCFLAG) +FCMODINCFLAG=$pac_cv_fc_module_incflag +]) +dnl +dnl +dnl +AC_DEFUN([PAC_FC_MODULE],[ +PAC_FC_MODULE_EXT +PAC_FC_MODULE_INCFLAG +PAC_FC_MODULE_OUTFLAG +]) +dnl +dnl PAC_FC_MODULE_OUTFLAG +AC_DEFUN([PAC_FC_MODULE_OUTFLAG],[ +AC_REQUIRE([PAC_FC_MODULE_EXT]) +AC_CACHE_CHECK([for Fortran 90 module output directory flag], + [pac_cv_fc_module_outflag], +[ +AC_LANG_PUSH([Fortran]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + module conf + integer n + parameter (n=1) + end module conf + ]) +]) +pac_madedir="no" +if test ! -d conf ; then mkdir conftestdir ; pac_madedir="yes"; fi +if test "$pac_cv_fc_module_case" = "upper" ; then + pac_module="CONF.$pac_cv_fc_module_ext" +else + pac_module="conf.$pac_cv_fc_module_ext" +fi + +# check base case that the compiler can create modules and that they endup in +# the current directory +AC_COMPILE_IFELSE([],[ + if test -s "$pac_module" ; then + rm -f "$pac_module" + # Remove any temporary files, and hide the work.pc file + # (if the compiler generates them) + if test -f work.pc ; then + mv -f work.pc conftest.pc + fi + rm -f work.pcl + else + AC_MSG_WARN([Unable to build a simple Fortran 90 module]) + # echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + # cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD + _AC_MSG_LOG_CONFTEST + fi +],[]) + +# known flags for reasonably recent versions of various f90 compilers: +# gfortran -J${dir} +# xlf -qmoddir=${dir} +# pgf90 -module ${dir} +# ifort -module ${dir} +# nagfor -mdir ${dir} +# ftn -J ${dir} ## the Cray fortran compiler +# ftn -em -J${dir} ## the Cray fortran compiler (crayftn, in 2013) +# For this above case, we must have added -em to FCFLAGS, since other +# module tests do not always use the module output flag. See +# FC_MODULE_EXT , where this is determined. +# f95 -YMOD_OUT_DIR=${dir} ## the Absoft fortran compiler +# lf95 -M ${dir} ## the Lahey/Fujitsu fortran compiler +# f90 -moddir=${dir} ## the Sun f90 compiler +# g95 -fmod=${dir} +# +# If there are any compilers still out there that are totally brain-dead and +# don't support an output directory flag, we can write a wrapper script to tell +# users to use. Alternatively they can use an older version of MPICH. + +pac_cv_fc_module_outflag= +for mod_flag in '-J' '-J ' '-qmoddir=' '-module ' '-YMOD_OUT_DIR=' '-mdir ' '-moddir=' '-fmod=' '-M '; do + rm -f conftestdir/NONEXISTENT conftestdir/* + PAC_PUSH_FLAG([FCFLAGS]) + FCFLAGS="$FCFLAGS ${mod_flag}conftestdir" + AC_COMPILE_IFELSE([],[pac_build_success=yes],[pac_build_success=no]) + AS_IF([test "X$pac_build_success" = Xyes], + [AS_IF([test -s "conftestdir/${pac_module}"], + [pac_cv_fc_module_outflag="$mod_flag"])]) + PAC_POP_FLAG([FCFLAGS]) + AS_IF([test "X$pac_cv_fc_module_outflag" = X],[:],[break]) +done + +# Remove the conftest* after AC_LANG_CONFTEST +rm -rf conftest.dSYM +rm -f conftest.$ac_ext + +if test "$pac_madedir" = "yes" ; then rm -rf conftestdir ; fi +AS_UNSET([pac_madedir]) +# Remove the conftest* after AC_LANG_CONFTEST +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +AC_LANG_POP(Fortran) +])dnl end AC_CACHE_CHECK + +AC_SUBST([FCMODOUTFLAG],[$pac_cv_fc_module_outflag]) +])dnl end AC_DEFUN([PAC_FC_MODULE_OUTFLAG]) +dnl +dnl PAC_FC_AND_F77_COMPATIBLE([action-if-true],[action-if-false]) +dnl +dnl Determine whether object files compiled with Fortran 77 can be +dnl linked to Fortran 90 main programs. +dnl +dnl The test uses a name that includes an underscore unless the 3rd +dnl argument provides another routine name. +dnl +AC_DEFUN([PAC_FC_AND_F77_COMPATIBLE],[ +AC_REQUIRE([PAC_PROG_FC_WORKS]) +AC_CACHE_CHECK([whether Fortran 90 compiler works with Fortran 77 compiler], +pac_cv_fc_and_f77,[ +pacTestRoutine=foo_abc +ifelse([$3],,,[eval pacTestRoutine=$3]) +pac_cv_fc_and_f77="unknown" +# compile the f77 program and link with the f90 program +# The reverse may not work because the Fortran 90 environment may +# expect to be in control (and to provide library files unknown to any other +# environment, even Fortran 77!) +AC_LANG_PUSH(Fortran 77) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine ${pacTestRoutine}(b) + integer b + b = b + 1 + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $LIBS" + AC_LANG_PUSH(Fortran) + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + integer a + a = 1 + call ${pacTestRoutine}(a) + end + ]) + ],[pac_cv_fc_and_f77=yes],[pac_cv_fc_and_f77=no]) + # Some versions of the Intel compiler produce these two files + rm -f work.pc work.pcl + # Restore LIBS + LIBS="$saved_LIBS" + AC_LANG_POP(Fortran) + # remove previously generated object file. + rm -f pac_f77conftest.$OBJEXT +], [ + # pac_f77compile_ok=no + pac_cv_fc_and_f77=no +]) +AC_LANG_POP(Fortran 77) +# Perform the requested action based on whether the test succeeded +if test "$pac_cv_fc_and_f77" = yes ; then + ifelse($1,,:,[$1]) +else + ifelse($2,,:,[$2]) + AC_MSG_WARN([See config.log for the failed test program and its output.]) +fi +]) +dnl +]) +dnl +dnl +dnl /*D +dnl PAC_PROG_FC_CRAY_POINTER - Check if Fortran supports Cray-style pointer. +dnl If so, set pac_cv_prog_fc_has_pointer to yes +dnl and find out if any extra compiler flag is +dnl needed and set it as CRAYPTR_FCFLAGS. +dnl i.e. CRAYPTR_FCFLAGS is meaningful only if +dnl pac_cv_prog_fc_has_pointer = yes. +dnl +dnl Synopsis: +dnl PAC_PROG_FC_CRAY_POINTER([action-if-true],[action-if-false]) +dnl D*/ +AC_DEFUN([PAC_PROG_FC_CRAY_POINTER],[ +AC_CACHE_CHECK([whether Fortran 90 supports Cray-style pointer], +pac_cv_prog_fc_has_pointer,[ +AC_LANG_PUSH([Fortran]) +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[ + integer M + pointer (MPTR,M) + data MPTR/0/ + ]) +]) +saved_FCFLAGS="$FCFLAGS" +pac_cv_prog_fc_has_pointer=no +CRAYPTR_FCFLAGS="" +for ptrflag in '' '-fcray-pointer' ; do + FCFLAGS="$saved_FCFLAGS $ptrflag" + AC_COMPILE_IFELSE([],[ + pac_cv_prog_fc_has_pointer=yes + CRAYPTR_FCFLAGS="$ptrflag" + break + ]) +done +dnl Restore FCFLAGS first, since user may not want to modify FCFLAGS +FCFLAGS="$saved_FCFLAGS" +dnl remove conftest after ac_lang_conftest +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran]) +]) +if test "$pac_cv_prog_fc_has_pointer" = "yes" ; then + AC_MSG_CHECKING([for Fortran 90 compiler flag for Cray-style pointer]) + if test "X$CRAYPTR_FCFLAGS" != "X" ; then + AC_MSG_RESULT([$CRAYPTR_FCFLAGS]) + else + AC_MSG_RESULT([none]) + fi + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl +dnl +dnl +AC_DEFUN([PAC_PROG_FC_AND_C_STDIO_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +# To simply the code in the cache_check macro, chose the routine name +# first, in case we need it +confname=conf1_ +case "$pac_cv_prog_f77_name_mangle" in + "lower underscore") confname=conf1_ ;; + "upper stdcall") confname=CONF1 ;; + upper) confname=CONF1 ;; + "lower doubleunderscore") confname=conf1_ ;; + lower) confname=conf1 ;; + "mixed underscore") confname=conf1_ ;; + mixed) confname=conf1 ;; +esac + +AC_CACHE_CHECK([what libraries are needed to link Fortran90 programs with C routines that use stdio],pac_cv_prog_fc_and_c_stdio_libs,[ +pac_cv_prog_fc_and_c_stdio_libs=unknown + +AC_LANG_PUSH(C) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include <stdio.h> +#endif +int $confname( int a ) +{ printf( "The answer is %d\n", a ); fflush(stdout); return 0; } + ]) +],[ + pac_compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + # Save LIBS and prepend object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH(Fortran) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([],[call conf1(0)]) + ],[ + pac_cv_prog_fc_and_c_stdio_libs=none + ],[ + # Try again with -lSystemStubs + LIBS="$LIBS -lSystemStubs" + AC_LINK_IFELSE([],[ + pac_cv_prog_fc_and_c_stdio_libs="-lSystemStubs" + ],[]) + ]) + LIBS="$saved_LIBS" + AC_LANG_POP(Fortran) + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP(C) +dnl +if test "$pac_cv_prog_fc_and_c_stdio_libs" != none -a \ + "$pac_cv_prog_fc_and_c_stdio_libs" != unknown ; then + FC_OTHER_LIBS="$FC_OTHER_LIBS $pac_cv_prog_fc_and_c_stdio_libs" +fi +]) +dnl +]) +dnl +dnl/*D +dnl PAC_FC_CHECK_COMPILER_OPTION - Check that a FC compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_FC_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'FCOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_FC_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether Fortran 90 compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH(Fortran) +FCFLAGS_orig="$FCFLAGS" +FCFLAGS_opt="$pac_opt $FCFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +FCFLAGS="$FCFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + FCFLAGS="$FCFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext +# +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + FCFLAGS="$FCFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + subroutine try() + end + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + FCFLAGS="$FCFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore FCFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying FCFLAGS. +FCFLAGS="$FCFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[FCOPTIONS="$FCOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP(Fortran) +]) +dnl /*D +dnl PAC_FC_WORKS_WITH_CPP +dnl +dnl Checks if Fortran 90 compiler works with C preprocessor +dnl +dnl Most systems allow the Fortran compiler to process .F and .F90 files +dnl using the C preprocessor. However, some systems either do not +dnl allow this or have serious bugs (OSF Fortran compilers have a bug +dnl that generates an error message from cpp). The following test +dnl checks to see if .F works, and if not, whether "cpp -P -C" can be used +dnl D*/ +AC_DEFUN([PAC_FC_WORKS_WITH_CPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([whether Fortran 90 compiler processes .F90 files with C preprocessor]) +AC_LANG_PUSH([Fortran]) +saved_fc_ext=${ac_ext} +ac_ext="F90" +saved_FCFLAGS="$FCFLAGS" +FCFLAGS="$FCFLAGS $CPPFLAGS" +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main +#define ASIZE 10 + integer a(ASIZE) + end + ]) +]) +AC_COMPILE_IFELSE([],[ + pac_cv_fc_accepts_F90=yes + ifelse([$1],[],[],[$1=""]) +],[ + pac_cv_fc_accepts_F90=no + ifelse([$1],[],[:],[$1="false"]) +]) +# Restore Fortran's ac_ext but not FCFLAGS +ac_ext="$saved_fc_ext" + +if test "$pac_cv_fc_accepts_F90" != "yes" ; then + pac_cpp_fc="$ac_cpp -C -P conftest.F90 > conftest.$ac_ext" + PAC_RUNLOG_IFELSE([$pac_cpp_fc],[ + if test -s conftest.${ac_ext} ; then + AC_COMPILE_IFELSE([],[ + pac_cv_fc_accepts_F90="no, use cpp" + ifelse([$1],[],[],[$1="$CPP -C -P"]) + ],[]) + rm -f conftest.${ac_ext} + fi + ],[]) +fi +FCFLAGS="$saved_FCFLAGS" +rm -f conftest.F90 +AC_LANG_POP([Fortran]) +AC_MSG_RESULT([$pac_cv_fc_accepts_F90]) +]) +dnl +dnl PAC_FC_VENDOR: +dnl Try to get a version string for the F90 compiler. We may +dnl need this to find likely command-line arguments for accessing +dnl shared libraries +dnl +AC_DEFUN([PAC_FC_VENDOR],[ +AC_MSG_CHECKING([for Fortran 90 compiler vendor]) +# This is complicated by some compilers (such as the Intel 8.1 ifort) +# that return a non-zero status even when they accept the -V option +# (a zero status is returned only if there is a file). +pac_cv_fc_vendor="unknown" +for arg in --version -V -v ; do + rm -f conftest.txt + PAC_RUNLOG([$FC $arg </dev/null >conftest.txt 2>&1]) + # Ignore the return code, because some compilers set the + # return code to zero on invalid arguments and some to + # non-zero on success (with no files to compile) + if test -f conftest.txt ; then + if grep 'Portland Group' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=pgi + elif grep 'Sun Workshop' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=sun + elif grep 'Sun Fortran 9' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=sun + elif grep 'Absoft' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=absoft + elif grep 'G95' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=gnu + elif grep 'GNU Fortran' conftest.txt >/dev/null 2>&1 ; then + # This is gfortran + pac_cv_fc_vendor=gnu + elif grep Intel conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=intel + fi + fi + if test "$pac_cv_fc_vendor" != "unknown" ; then break ; fi +done +if test "$pac_cv_fc_vendor" = "unknown" ; then + # Try to use the compiler name + if test "$FC" = "ifort" -o "$FC" = "ifc" ; then + pac_cv_fc_vendor=intel + elif test "$FC" = "pgf90" ; then + pac_cv_fc_vendor=pgi + elif test "$FC" = "xlf90" -o "$FC" = "xlf90_r" ; then + pac_cv_fc_vendor=ibm + elif test "$FC" = "xlf95" -o "$FC" = "xlf95_r" ; then + pac_cv_fc_vendor=ibm + fi +fi +AC_MSG_RESULT([$pac_cv_fc_vendor]) +rm -f conftest.txt +# End of checking for F90 compiler vendor +]) +dnl +dnl PAC_F77_IS_FC([ACTION_IF_TRUE],[ACTION_IF_FALSE]) +dnl Check if F77 is a Fortran 90 compiler. +dnl +AC_DEFUN([PAC_F77_IS_FC],[ +AC_MSG_CHECKING([whether $F77 is a Fortran 90 compiler]) +AC_LANG_PUSH([Fortran 77]) +saved_ac_ext=$ac_ext +ac_ext="f90" +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + integer, dimension(10) :: n + integer k + print *, range(k) + end + ]) +],[ + pac_cv_prog_f77_is_fc=yes + ifelse([$1],[],[],[$1]) +],[ + pac_cv_prog_f77_is_fc=no + ifelse([$2],[],[],[$2]) +]) +AC_MSG_RESULT([$pac_cv_prog_f77_is_fc]) +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl PAC_FC_FLOAT_MODEL(float_type, [variable-set-if-successful-test]) +dnl variable-set-if-successful-test is optional variable. +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_FLOAT_MODEL],[ +type="$1" +AC_MSG_CHECKING([for precision and range of $type]) +AC_LANG_PUSH([Fortran]) +rm -f pac_fconftest.out +AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + $type aa + open(8, file="pac_fconftest.out", form="formatted") + write(8,*) precision(aa), ",", range(aa) + close(8) + end + ]) +],[ + if test -s pac_fconftest.out ; then + pac_fc_num_model="`sed -e 's/ */ /g' pac_fconftest.out`" + AC_MSG_RESULT([$pac_fc_num_model]) + ifelse([$2],[],[],[$2=$pac_fc_num_model]) + else + AC_MSG_RESULT([Error]) + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_fconftest.out +],[ + AC_MSG_RESULT([Error]) + AC_MSG_WARN([Failed to run program to determine the precision and range of $type]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_SIMPLE_NUMBER_MODEL(message, Fortran-type, Fortran-write, +dnl [variable-set-if-successful-test], +dnl [cross-value]) +dnl +dnl message : message of what test-fc-code is checking +dnl Fortran-type : Fortran90 type's data model to be examined. +dnl Fortran-write : Fortran90 type's write statement used with write(N,*). +dnl variable-set-if-successful-test : +dnl The optional variable to be set if the codelet: +dnl "Fortran-type" + "write(N,*) Fortran-write" +dnl is successful in returning the simple data model. +dnl cross-value : value to be used for above variable when +dnl cross_compiling=yes +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_SIMPLE_NUMBER_MODEL],[ +pac_msg="$1" +AC_MSG_CHECKING([for $pac_msg]) +AC_LANG_PUSH([Fortran]) +rm -f pac_fconftest.out +AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + $2 + open(8, file="pac_fconftest.out", form="formatted") + write(8,*) $3 + close(8) + end + ]) +],[ + if test -s pac_fconftest.out ; then + pac_fc_num_model="`sed -e 's/ */ /g' pac_fconftest.out`" + AC_MSG_RESULT([$pac_fc_num_model]) + ifelse([$4],[],[],[$4=$pac_fc_num_model]) + else + AC_MSG_RESULT([Error]) + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_fconftest.out +],[ + AC_MSG_RESULT([Error]) + AC_MSG_WARN([Failed to run program to determine $pac_msg]) +],[ + AC_MSG_RESULT([$5]) + ifelse([$4],[],[],[$4=$5]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_AVAIL_INTEGER_MODELS([INTEGER-MODELS-FLAG],[CROSS-VARIABLE]) +dnl +dnl INTEGER-MODELS-FLAG : an optional variable to be set if provided. +dnl If it isn't provided, PAC_FC_ALL_INTEGER_MODELS +dnl will be set. +dnl CROSS-VALUE : value will be used to set INTEGER-MODELS-FLAG +dnl or PAC_FC_ALL_INTEGER_MODELS if cross_compiling=yes. +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_AVAIL_INTEGER_MODELS],[ +AC_MSG_CHECKING([for available integer kinds]) +AC_LANG_PUSH([Fortran]) +rm -f pac_fconftest.out +AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + integer r, lastkind + lastkind=selected_int_kind(1) + open(8, file="pac_fconftest.out", form="formatted") + do r=2,30 + k = selected_int_kind(r) + if (k .ne. lastkind) then + write(8,*) r-1, ",", lastkind + lastkind = k + endif + if (k .le. 0) then + exit + endif + enddo + if (k.ne.lastkind) then + write(8,*) 31, ",", k + endif + close(8) + end + ]) +],[ + if test -s pac_fconftest.out ; then + pac_flag="`sed -e 's/ */ /g' pac_fconftest.out | tr '\012' ','`" + AC_MSG_RESULT([$pac_flag]) + pac_validKinds="`sed -e 's/ */ /g' pac_fconftest.out | tr '\012' ':'`" + ifelse([$1],[],[PAC_FC_ALL_INTEGER_MODELS=$pac_flag],[$1=$pac_flag]) + else + AC_MSG_RESULT([Error]) + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_fconftest.out +],[ + AC_MSG_RESULT([Error]) + AC_MSG_WARN([Failed to run program to determine available integer models]) +],[ + dnl Even when cross_compiling=yes, + dnl pac_validKinds needs to be set for PAC_FC_INTEGER_MODEL_MAP() + pac_validKinds="`echo \"$2\" | tr ',' ':'`" + AC_MSG_RESULT([$2]) + ifelse([$1],[],[PAC_FC_ALL_INTEGER_MODELS=$2],[$1=$2]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_INTEGER_MODEL_MAP([INTEGER-MODEL-MAP-FLAG],[CROSS-VALUE])) +dnl +dnl INTEGER-MODEL-MAP-FLAG : an optional variable to be set if provided. +dnl If it isn't provided, PAC_FC_INTEGER_MODEL_MAP +dnl will be set. +dnl CROSS-VALUE : value will be used to set INTEGER-MODEL-MAP-FLAG +dnl or PAC_FC_INTEGER_MODEL_MAP if cross_compiling=yes. +dnl +dnl This test requires $pac_validKinds set by PAC_FC_ALL_INTEGER_MODELS(). +dnl +dnl This is a runtime test. +dnl +dnl Compile the C subroutine as pac_conftest.o and Link it with a Fortran main. +AC_DEFUN([PAC_FC_INTEGER_MODEL_MAP],[ +AC_REQUIRE([PAC_FC_AVAIL_INTEGER_MODELS]) +AC_MSG_CHECKING([for available integer ranges]) +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +int cisize_(char *,char*); +int cisize_(char *i1p, char *i2p) +{ + int isize_val=0; + isize_val = (int)(i2p - i1p); + return isize_val; +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + pac_ccompile_ok=yes +],[ + pac_ccompile_ok=no +]) +AC_LANG_POP([C]) +dnl +if test "$pac_ccompile_ok" = "yes" ; then + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + saved_IFS=$IFS + IFS=: + AC_LANG_PUSH([Fortran]) + pac_flag="" + for rangekind in $pac_validKinds ; do + kind="`echo $rangekind | sed -e 's/.*,//'`" + range="`echo $rangekind | sed -e 's/,.*//'`" + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + integer (kind=$kind) a(2) + integer cisize + open(8, file="pac_fconftest.out", form="formatted") + write(8,*) $range, ",", $kind, ",", cisize( a(1), a(2) ) + close(8) + end + ]) + ]) + IFS=$saved_IFS + rm -f pac_fconftest.out + AC_RUN_IFELSE([],[ + if test -s pac_fconftest.out ; then + sizes="`sed -e 's/ */ /g' pac_fconftest.out`" + pac_flag="$pac_flag { $sizes }," + else + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_fconftest.out + ],[ + AC_MSG_WARN([Fortran program fails to build or run!]) + ],[ + pac_flag="$2" + ]) + IFS=: + done + IFS=$saved_IFS + AC_MSG_RESULT([$pac_flag]) + ifelse([$1],[],[PAC_FC_INTEGER_MODEL_MAP=$pac_flag],[$1=$pac_flag]) + AC_LANG_POP([Fortran]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +fi +]) + + +AC_DEFUN([PAC_FC_2008_SUPPORT],[ +AC_MSG_CHECKING([for Fortran 2008 support]) + +AC_LANG_PUSH([C]) +f08_works=yes +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE( +[[ +#include <ISO_Fortran_binding.h> + +int foo_c(CFI_cdesc_t * a_desc, CFI_cdesc_t * b_desc) +{ + char * a_row = (char*) a_desc->base_addr; + if (a_desc->type != CFI_type_int) { return 1; } + if (a_desc->rank != 2) { return 2; } + if (a_desc->dim[1].extent != b_desc->dim[0].extent) { return 3; } + return 0; +} + +void test_assumed_rank_async_impl_c(CFI_cdesc_t * a_desc) +{ + return; +} +]])],[mv conftest.$OBJEXT conftest1.$OBJEXT],[f08_works=no]) +AC_LANG_POP([C]) + +AC_LANG_PUSH([Fortran]) +PAC_PUSH_FLAG([LIBS]) +LIBS="conftest1.$OBJEXT $LIBS" +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +MODULE F08TS_MODULE +IMPLICIT NONE + +! Test public, private, protected +REAL, PUBLIC :: x +REAL, PRIVATE :: y +LOGICAL, PROTECTED :: z + +! Test abstract +ABSTRACT INTERFACE + SUBROUTINE user_func(x, y) + INTEGER :: x(*) + REAL :: y + END SUBROUTINE +END INTERFACE + +! Test TS 29113 assumed type , assumed rank and bind(C) +INTERFACE + FUNCTION FOO(A, B, C) & + BIND(C,name="foo_c") RESULT(err) + USE, intrinsic :: iso_c_binding, ONLY : c_int + TYPE(*), DIMENSION(..) :: A, B, C + INTEGER(c_int) :: err + END FUNCTION FOO +END INTERFACE + + +! Test assumed-rank + asynchronous +INTERFACE TEST_ASSUMED_RANK_ASYNC + SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) & + BIND(C,name="test_assumed_rank_async_impl_c") + IMPLICIT NONE + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: BUF + END SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL +END INTERFACE TEST_ASSUMED_RANK_ASYNC + +CONTAINS + +! Test TS 29113 asychronous attribute and optional +SUBROUTINE test1(buf, count, ierr) + INTEGER, ASYNCHRONOUS :: buf(*) + INTEGER :: count + INTEGER, OPTIONAL :: ierr +END SUBROUTINE + +! Test procedure type and non-bind(c) x in C_FUNCLOC(x) +SUBROUTINE test2(func) + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_FUNLOC, C_FUNPTR + PROCEDURE(user_func) :: func + TYPE(C_FUNPTR) :: errhandler_fn + errhandler_fn = C_FUNLOC(func) +END SUBROUTINE + +! Test intrinsic storage_size +SUBROUTINE test3(x, size) + CHARACTER, DIMENSION(..) :: x + INTEGER, INTENT(OUT) :: size + size = storage_size(x)/8 +END SUBROUTINE test3 + +END MODULE + +!============================================== +PROGRAM MAIN +USE :: F08TS_MODULE, ONLY : FOO, TEST_ASSUMED_RANK_ASYNC +IMPLICIT NONE + +INTEGER, DIMENSION(4,4) :: A, B +INTEGER, DIMENSION(2,2) :: C +INTEGER :: ERRCODE +INTEGER, DIMENSION(10), ASYNCHRONOUS :: IAR + +! Test contiguous and non-contiguous array section passing +! and linkage with C code +ERRCODE = FOO(A(1:4:2, :), B(:, 2:4:2), C) +CALL TEST_ASSUMED_RANK_ASYNC(IAR(2:7)) + +END PROGRAM + ])],[],[f08_works=no]) +PAC_POP_FLAG([LIBS]) +AC_LANG_POP([Fortran]) + +if test "$f08_works" = "yes" ; then + $1 +else + $2 +fi +rm -f conftest1.$OBJEXT F08TS_MODULE.* f08ts_module.* +AC_MSG_RESULT([$f08_works]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_libs.m4 b/3rd-party/romio341/mpl/confdb/aclocal_libs.m4 new file mode 100644 index 0000000000000000000000000000000000000000..50d6a8b4cbce540d671440c05d47265fc911dc74 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_libs.m4 @@ -0,0 +1,119 @@ + +dnl PAC_SET_HEADER_LIB_PATH(with_option,[default_path]) +dnl This macro looks for the --with-xxx=, --with-xxx-include and --with-xxx-lib= +dnl options and sets the library and include paths. +dnl +dnl TODO as written, this macro cannot handle a "with_option" arg that has "-" +dnl characters in it. Use AS_TR_SH (and possibly AS_VAR_* macros) to handle +dnl this case if it ever arises. +AC_DEFUN([PAC_SET_HEADER_LIB_PATH],[ + AC_ARG_WITH([$1], + [AC_HELP_STRING([--with-$1=[[PATH]]], + [specify path where $1 include directory and lib directory can be found])],, + [with_$1=$2]) + AC_ARG_WITH([$1-include], + [AC_HELP_STRING([--with-$1-include=PATH], + [specify path where $1 include directory can be found])], + [AS_CASE(["$withval"], + [yes|no|''], + [AC_MSG_WARN([--with[out]-$1-include=PATH expects a valid PATH]) + with_$1_include=""])], + []) + AC_ARG_WITH([$1-lib], + [AC_HELP_STRING([--with-$1-lib=PATH], + [specify path where $1 lib directory can be found])], + [AS_CASE(["$withval"], + [yes|no|''], + [AC_MSG_WARN([--with[out]-$1-lib=PATH expects a valid PATH]) + with_$1_lib=""])], + []) + + # The args have been sanitized into empty/non-empty values above. + # Now append -I/-L args to CPPFLAGS/LDFLAGS, with more specific options + # taking priority + + AS_IF([test -n "${with_$1_include}"], + [PAC_APPEND_FLAG([-I${with_$1_include}],[CPPFLAGS])], + [AS_IF([test -n "${with_$1}"], + [PAC_APPEND_FLAG([-I${with_$1}/include],[CPPFLAGS])])]) + + AS_IF([test -n "${with_$1_lib}"], + [PAC_APPEND_FLAG([-L${with_$1_lib}],[LDFLAGS])], + [AS_IF([test -n "${with_$1}"], + dnl is adding lib64 by default really the right thing to do? What if + dnl we are on a 32-bit host that happens to have both lib dirs available? + [PAC_APPEND_FLAG([-L${with_$1}/lib],[LDFLAGS]) + AS_IF([test -d "${with_$1}/lib64"], + [PAC_APPEND_FLAG([-L${with_$1}/lib64],[LDFLAGS])]) + ]) + ]) +]) + + +dnl PAC_CHECK_HEADER_LIB(header.h, libname, function, action-if-yes, action-if-no) +dnl This macro checks for a header and lib. It is assumed that the +dnl user can specify a path to the includes and libs using --with-xxx=. +dnl The xxx is specified in the "with_option" parameter. +dnl +dnl NOTE: This macro expects a corresponding PAC_SET_HEADER_LIB_PATH +dnl macro (or equivalent logic) to be used before this macro is used. +AC_DEFUN([PAC_CHECK_HEADER_LIB],[ + failure=no + AC_CHECK_HEADER([$1],,failure=yes) + AC_CHECK_LIB($2,$3,,failure=yes) + if test "$failure" = "no" ; then + $4 + else + $5 + fi +]) + +dnl PAC_CHECK_HEADER_LIB_FATAL(with_option, header.h, libname, function) +dnl Similar to PAC_CHECK_HEADER_LIB, but errors out on failure +AC_DEFUN([PAC_CHECK_HEADER_LIB_FATAL],[ + PAC_SET_HEADER_LIB_PATH($1) + PAC_CHECK_HEADER_LIB($2,$3,$4,success=yes,success=no) + if test "$success" = "no" ; then + AC_MSG_ERROR(['$2 or lib$3 library not found. Did you specify --with-$1= or --with-$1-include= or --with-$1-lib=?']) + fi +]) + +dnl PAC_CHECK_PREFIX(with_option,prefixvar) +AC_DEFUN([PAC_CHECK_PREFIX],[ + AC_ARG_WITH([$1-prefix], + [AS_HELP_STRING([[--with-$1-prefix[=DIR]]], [use the $1 + library installed in DIR, rather than the + one included in the distribution. Pass + "embedded" to force usage of the included + $1 source.])], + [if test "$withval" = "system" ; then + : + elif test "$withval" = "embedded" ; then + : + elif test "$withval" = "no" ; then + : + else + PAC_APPEND_FLAG([-I${with_$1_prefix}/include],[CPPFLAGS]) + if test -d "${with_$1_prefix}/lib64" ; then + PAC_APPEND_FLAG([-L${with_$1_prefix}/lib64],[LDFLAGS]) + fi + PAC_APPEND_FLAG([-L${with_$1_prefix}/lib],[LDFLAGS]) + fi + ], + [with_$1_prefix="embedded"]) + ] +) + +dnl PAC_LIB_DEPS(library_name, library_pc_path) +dnl library_pc_path is the path to the library pkg-config directory +AC_DEFUN([PAC_LIB_DEPS],[ +if test "x$2" != "x"; then + ac_lib$1_deps=`pkg-config --static --libs $2/lib$1.pc 2>/dev/null` + # remove the library itself in case it is embedded + ac_lib$1_deps=`echo $ac_lib$1_deps | sed 's/-l$1//'` +else + # use system default + ac_lib$1_deps=`pkg-config --static --libs lib$1 2>/dev/null` +fi +]) + diff --git a/3rd-party/romio341/mpl/confdb/aclocal_make.m4 b/3rd-party/romio341/mpl/confdb/aclocal_make.m4 new file mode 100644 index 0000000000000000000000000000000000000000..147e92e9c2e1cd7883bca971a0786d8b7de06c6c --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_make.m4 @@ -0,0 +1,315 @@ +dnl +dnl We need routines to check that make works. Possible problems with +dnl make include +dnl +dnl It is really gnumake, and contrary to the documentation on gnumake, +dnl it insists on screaming everytime a directory is changed. The fix +dnl is to add the argument --no-print-directory to the make +dnl +dnl It is really BSD 4.4 make, and can't handle 'include'. For some +dnl systems, this can be fatal; there is no fix (other than removing this +dnl alleged make). +dnl +dnl It is the OSF V3 make, and can't handle a comment in a block of target +dnl code. There is no acceptable fix. +dnl +dnl +dnl +dnl +dnl Find a make program if none is defined. +AC_DEFUN([PAC_PROG_MAKE_PROGRAM],[true +if test "X$MAKE" = "X" ; then + AC_CHECK_PROGS(MAKE,make gnumake nmake pmake smake) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_INCLUDE - Check whether make supports include +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_INCLUDE([action if true],[action if false]) +dnl +dnl Output Effect: +dnl None +dnl +dnl Notes: +dnl This checks for makes that do not support 'include filename'. Some +dnl versions of BSD 4.4 make required '#include' instead; some versions of +dnl 'pmake' have the same syntax. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_INCLUDE],[ +AC_CACHE_CHECK([whether make supports include],pac_cv_prog_make_include,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +ALL: + @echo "success" +. +cat > conftest1 <<. +include conftest +. +pac_str=`$MAKE -f conftest1 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest conftest1 +if test "$pac_str" != "success" ; then + pac_cv_prog_make_include="no" +else + pac_cv_prog_make_include="yes" +fi +]) +if test "$pac_cv_prog_make_include" = "no" ; then + ifelse([$2],,:,[$2]) +else + ifelse([$1],,:,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_ALLOWS_COMMENTS - Check whether comments are allowed in +dnl shell commands in a makefile +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_ALLOWS_COMMENTS([false text]) +dnl +dnl Output Effect: +dnl Issues a warning message if comments are not allowed in a makefile. +dnl Executes the argument if one is given. +dnl +dnl Notes: +dnl Some versions of OSF V3 make do not all comments in action commands. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl D*/ +dnl +AC_DEFUN([PAC_PROG_MAKE_ALLOWS_COMMENTS],[ +AC_CACHE_CHECK([whether make allows comments in actions], +pac_cv_prog_make_allows_comments,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +SHELL=/bin/sh +ALL: + @# This is a valid comment! + @echo "success" +. +pac_str=`$MAKE -f conftest 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" != "success" ; then + pac_cv_prog_make_allows_comments="no" +else + pac_cv_prog_make_allows_comments="yes" +fi +]) +if test "$pac_cv_prog_make_allows_comments" = "no" ; then + AC_MSG_WARN([Your make does not allow comments in target code. +Using this make may cause problems when building programs. +You should consider using gnumake instead.]) + ifelse([$1],,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_VPATH - Check whether make supports source-code paths. +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_VPATH +dnl +dnl Output Effect: +dnl Sets the variable 'VPATH' to either +dnl.vb +dnl VPATH = .:${srcdir} +dnl.ve +dnl or +dnl.vb +dnl .PATH: . ${srcdir} +dnl.ve +dnl +dnl Notes: +dnl The test checks that the path works with implicit targets (some makes +dnl support only explicit targets with 'VPATH' or 'PATH'). +dnl +dnl NEED TO DO: Check that $< works on explicit targets. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_VPATH],[ +AC_SUBST(VPATH) +dnl AM_IGNORE(VPATH) +AC_CACHE_CHECK([for virtual path format], +pac_cv_prog_make_vpath,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* +mkdir conftestdir +cat >conftestdir/a.c <<EOF +A sample file +EOF +cat > conftest <<EOF +all: a.o +VPATH=.:conftestdir +.c.o: + @echo \$< +EOF +ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'` +if test -n "$ac_out" ; then + pac_cv_prog_make_vpath="VPATH" +else + rm -f conftest + cat > conftest <<EOF +all: a.o +.PATH: . conftestdir +.c.o: + @echo \$< +EOF + ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'` + if test -n "$ac_out" ; then + pac_cv_prog_make_vpath=".PATH" + else + pac_cv_prog_make_vpath="neither VPATH nor .PATH works" + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* +]) +if test "$pac_cv_prog_make_vpath" = "VPATH" ; then + VPATH='VPATH=.:${srcdir}' +elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then + VPATH='.PATH: . ${srcdir}' +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_SET_CFLAGS - Check whether make sets CFLAGS +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_SET_CFLAGS([action if true],[action if false]) +dnl +dnl Output Effects: +dnl Executes the first argument if 'CFLAGS' is set by 'make'; executes +dnl the second argument if 'CFLAGS' is not set by 'make'. +dnl +dnl Notes: +dnl If 'CFLAGS' is set by make, you may wish to override that choice in your +dnl makefile. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_SET_CFLAGS],[ +AC_CACHE_CHECK([whether make sets CFLAGS], +pac_cv_prog_make_set_cflags,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<EOF +SHELL=/bin/sh +ALL: + @echo X[\$]{CFLAGS}X +EOF +pac_str=`$MAKE -f conftest 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" = "XX" ; then + pac_cv_prog_make_set_cflags="no" +else + pac_cv_prog_make_set_cflags="yes" +fi +]) +if test "$pac_cv_prog_make_set_cflags" = "no" ; then + ifelse([$2],,:,[$2]) +else + ifelse([$1],,:,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_CLOCK_SKEW - Check whether there is a problem with +dnl clock skew in suing make. +dnl +dnl Effect: +dnl Sets the cache variable 'pac_cv_prog_make_found_clock_skew' to yes or no +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_CLOCK_SKEW],[ +AC_CACHE_CHECK([whether clock skew breaks make], +pac_cv_prog_make_found_clock_skew,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +cat > conftest <<EOF +ALL: + @-echo "success" +EOF +$MAKE -f conftest > conftest.out 2>&1 +if grep -i skew conftest >/dev/null 2>&1 ; then + pac_cv_prog_make_found_clock_skew=yes +else + pac_cv_prog_make_found_clock_skew=no +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +]) +dnl We should really do something if we detect clock skew. The question is, +dnl what? +if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then + AC_MSG_WARN([Clock skew found by make. The configure and build may fail. +Consider building in a local instead of NFS filesystem.]) +fi +]) + +dnl/*D +dnl PAC_PROG_MAKE - Checks for the varieties of MAKE, including support for +dnl VPATH +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE +dnl +dnl Output Effect: +dnl Sets 'MAKE' to the make program to use if 'MAKE' is not already set. +dnl Sets the variable 'SET_CFLAGS' to 'CFLAGS =' if make sets 'CFLAGS'. +dnl +dnl Notes: +dnl This macro uses 'PAC_PROG_MAKE_INCLUDE', +dnl 'PAC_PROG_MAKE_ALLOWS_COMMENTS', 'PAC_PROG_MAKE_VPATH', and +dnl 'PAC_PROG_MAKE_SET_CFLAGS'. See those commands for details about their +dnl actions. +dnl +dnl It may call 'AC_PROG_MAKE_SET', which sets 'SET_MAKE' to 'MAKE = @MAKE@' +dnl if the make program does not set the value of make, otherwise 'SET_MAKE' +dnl is set to empty; if the make program echos the directory name, then +dnl 'SET_MAKE' is set to 'MAKE = $MAKE'. +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE],[ +PAC_PROG_MAKE_PROGRAM +PAC_PROG_MAKE_CLOCK_SKEW +PAC_PROG_MAKE_INCLUDE +PAC_PROG_MAKE_ALLOWS_COMMENTS +PAC_PROG_MAKE_VPATH +AC_SUBST(SET_CFLAGS) +dnl AM_IGNORE(SET_CFLAGS) +PAC_PROG_MAKE_SET_CFLAGS([SET_CFLAGS='CFLAGS=']) +if test "$pac_cv_prog_make_echos_dir" = "no" ; then + AC_PROG_MAKE_SET +else + SET_MAKE="MAKE=${MAKE-make}" +fi +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_mpi.m4 b/3rd-party/romio341/mpl/confdb/aclocal_mpi.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f4d98d57aa06dc0aca12411c5b6d3d537b52ae7c --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_mpi.m4 @@ -0,0 +1,11 @@ +dnl +dnl/*D +dnl PAC_HAVE_ROMIO - make mpi.h include mpio.h if romio enabled +dnl +dnl Output Effect: +dnl expands @HAVE_ROMIO@ in mpi.h into #include "mpio.h" +dnl D*/ +AC_DEFUN([PAC_HAVE_ROMIO],[ +if test "$enable_romio" = "yes" ; then HAVE_ROMIO='#include "mpio.h"'; fi +AC_SUBST(HAVE_ROMIO) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_romio.m4 b/3rd-party/romio341/mpl/confdb/aclocal_romio.m4 new file mode 100644 index 0000000000000000000000000000000000000000..802e2855eea806e226433335f7ce2980fe5f8281 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_romio.m4 @@ -0,0 +1,850 @@ +dnl +dnl This files contains additional macros for using autoconf to +dnl build configure scripts. +dnl +dnl Almost all of this file is taken from the aclocal.m4 of MPICH +dnl +dnl Get the format of Fortran names. Uses F77, FFLAGS, and sets WDEF. +dnl If the test fails, sets NOF77 to 1, HAVE_FORTRAN to 0. +dnl +dnl +AC_DEFUN([PAC_GET_FORTNAMES],[ + rm -f confftest.f confftest.$OBJEXT + cat > confftest.f <<EOF + subroutine mpir_init_fop( a ) + integer a + a = 1 + return + end +EOF + $F77 $FFLAGS -c confftest.f > /dev/null 2>&1 + if test ! -s confftest.$OBJEXT ; then + AC_MSG_WARN([Unable to test Fortran compiler. Compiling a test +program failed to produce an object file]) + NOF77=1 + elif test -z "$FORTRANNAMES" ; then + # MAC OS X (and probably FreeBSD need strings - (not strings -a) + # Cray doesn't accept -a ... + allstrings="-a" + if test $arch_CRAY ; then + allstrings="" + elif strings - confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-" + elif strings -a confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-a" + fi + + nameform1=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop_ | head -1` + nameform2=`strings $allstrings confftest.$OBJEXT | grep MPIR_INIT_FOP | head -1` + nameform3=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop | head -1` + nameform4=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop__ | head -1` + rm -f confftest.f confftest.$OBJEXT + if test -n "$nameform4" ; then + echo "Fortran externals are lower case and have two trailing underscores" + FORTRANNAMES="FORTRANDOUBLEUNDERSCORE" + elif test -n "$nameform1" ; then + # We don't set this in CFLAGS; it is a default case + echo "Fortran externals have a trailing underscore and are lowercase" + FORTRANNAMES="FORTRANUNDERSCORE" + elif test -n "$nameform2" ; then + echo "Fortran externals are uppercase" + FORTRANNAMES="FORTRANCAPS" + elif test -n "$nameform3" ; then + echo "Fortran externals are lower case" + FORTRANNAMES="FORTRANNOUNDERSCORE" + else + AC_MSG_WARN([Unable to determine the form of Fortran external names. +Make sure that the compiler $F77 can be run on this system. +Turning off Fortran (-nof77 being assumed)]) + NOF77=1 + fi + fi + if test -n "$FORTRANNAMES" ; then + WDEF="-D$FORTRANNAMES" + fi + # Delete confftest files with any extension. This catches the case + # where auxillary files, such as coverage files, are removed. + rm -f confftest.* + ])dnl +dnl +define(PAC_GET_SPECIAL_SYSTEM_INFO,[ +# +if test -n "$arch_IRIX"; then + AC_MSG_CHECKING(for IRIX OS version) + dnl This block of code replaces a generic "IRIX" arch value with + dnl IRIX_<version>_<chip> + dnl For example + dnl IRIX_5_4400 (IRIX 5.x, using MIPS 4400) + osversion=`uname -r | sed 's/\..*//'` + dnl Note that we need to allow brackets here, so we briefly turn off + dnl the macro quotes + changequote(,)dnl + dnl Get the second field (looking for 6.1) + osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'` + changequote([,])dnl + AC_MSG_RESULT($osversion) + dnl Get SGI processor count by quick hack + AC_MSG_CHECKING(for IRIX cpucount) + changequote(,)dnl + cpucount=`hinv | grep '[0-9]* [0-9]* MHZ IP[0-9]* Proc' | cut -f 1 -d' '` + if test "$cpucount" = "" ; then + cpucount=`hinv | grep 'Processor [0-9]*:' | wc -l | sed -e 's/ //g'` + fi + changequote([,])dnl + if test "$cpucount" = "" ; then + AC_MSG_RESULT([Could not determine cpucount. Please send]) + hinv + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + fi + AC_MSG_RESULT($cpucount) + dnl + AC_MSG_CHECKING(for IRIX cpumodel) + dnl The tail -1 is necessary for multiple processor SGI boxes + dnl We might use this to detect SGI multiprocessors and recommend + dnl -comm=shared + cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '` + if test -z "$cputype" ; then + AC_MSG_RESULT([Could not get cputype from hinv -t cpu command. Please send]) + hinv -t cpu 2>&1 + hinv -t cpu | cut -f 3 -d' ' 2>&1 + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + fi + AC_MSG_RESULT($cputype) + dnl echo "checking for osversion and cputype" + dnl cputype may contain R4400, R2000A/R3000, or something else. + dnl We may eventually need to look at it. + if test -z "$osversion" ; then + AC_MSG_RESULT([Could not determine OS version. Please send]) + uname -a + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + elif test $osversion = 4 ; then + true + elif test $osversion = 5 ; then + true + elif test $osversion = 6 ; then + true + else + AC_MSG_RESULT([Could not recognize the version of IRIX (got $osversion). +ROMIO knows about versions 4, 5 and 6; the version being returned from +uname -r is $osversion. Please send]) + uname -a 2>&1 + hinv 2>&1 + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + fi + AC_MSG_CHECKING(for cputype) + OLD_ARCH=IRIX + IRIXARCH="$ARCH_$osversion" + dnl Now, handle the chip set + changequote(,)dnl + cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"` + changequote([,])dnl + case $cputype in + 3000) ;; + 4000) ;; + 4400) ;; + 4600) ;; + 5000) ;; + 8000) ;; + 10000);; + 12000);; + *) + AC_MSG_WARN([Unexpected IRIX/MIPS chipset $cputype. Please send the output]) + uname -a 2>&1 + hinv 2>&1 + AC_MSG_WARN([to romio-maint@mcs.anl.gov +ROMIO will continue and assume that the cputype is +compatible with a MIPS 4400 processor.]) + cputype=4400 + ;; + esac + AC_MSG_RESULT($cputype) + IRIXARCH="$IRIXARCH_$cputype" + echo "IRIX-specific architecture is $IRIXARCH" +fi +])dnl +dnl +dnl +define(PAC_TEST_MPI,[ + AC_MSG_CHECKING(if a simple MPI program compiles and links) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + MPI_Init(&argc,&argv); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + cmd="$CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB" + echo "$as_me:$LINENO: $cmd" >&5 + $cmd >&5 2>&5 + if test ! -x conftest$EXEEXT ; then + echo "$as_me:$LINENO: failed program was:" >&5 + sed 's/^/| /' mpitest.c >&5 + rm -f conftest$EXEEXT mpitest.c + AC_MSG_ERROR([Unable to compile a simple MPI program. +Use environment variables to provide the location of MPI libraries and +include directories]) + else + rm -f conftest$EXEEXT mpitest.c + fi +AC_MSG_RESULT(yes) +])dnl +dnl +dnl +dnl +define(PAC_NEEDS_FINT,[ + AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation) + cat > mpitest1.c <<EOF +#include "mpi.h" + main() + { + MPI_Fint i; + i = 0; + } +EOF + rm -f mpitest1.$OBJEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -c mpitest1.c > /dev/null 2>&1 + if test ! -s mpitest1.$OBJEXT ; then + NEEDS_MPI_FINT="#define NEEDS_MPI_FINT" + CFLAGS="$CFLAGS -DNEEDS_MPI_FINT" + AC_MSG_RESULT(no) + rm -f mpitest1.$OBJEXT mpitest1.c + else + NEEDS_MPI_FINT="" + AC_MSG_RESULT(yes) + rm -f mpitest1.$OBJEXT mpitest1.c + fi +])dnl +dnl +define(PAC_MPI_LONG_LONG_INT,[ + AC_MSG_CHECKING(if MPI_LONG_LONG_INT is defined in mpi.h) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + long long i; + MPI_Init(&argc,&argv); + MPI_Send(&i, 1, MPI_LONG_LONG_INT, 0, 0, MPI_COMM_WORLD); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if mpi has long long it]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl PAC_LONG_LONG_64: check if there is a 64-bit long long +dnl +define(PAC_LONG_LONG_64,[ +if test -n "$longlongsize" ; then + if test "$longlongsize" = 8 ; then + echo "defining MPI_Offset as long long in C and integer*8 in Fortran" + AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits]) + DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer*8" + LL="\%lld" + elif test "$longlongsize" = "int" ; then # a hack to set MPI_Offset as int + echo "defining MPI_Offset as int in C and integer in Fortran" + DEFINE_MPI_OFFSET="typedef int MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int]) + LL="\%d" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + echo "defining MPI_Offset as long in C and integer in Fortran" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="\%ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + fi +else + PAC_GET_TYPE_SIZE(long long, longlongsize) + if test -n "$longlongsize" ; then + if test "$longlongsize" = 8 ; then + PAC_TEST_LONG_LONG() + else + echo "defining MPI_Offset as long in C and integer in Fortran" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="\%ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + fi + else +dnl check if longlong is not supported or only its size cannot be determined +dnl because the program cannot be run. + rm -f ltest.c + cat > ltest.c <<EOF + main() + { + long long i=8; + return 0; + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT ltest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise" + rm -f conftest$EXEEXT ltest.c + echo "defining MPI_Offset as long long in C and integer*8 in Fortran" + AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits]) + DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer*8" + LL="\%lld" + else + echo "assuming long long is not available; use '-longlongsize' to indicate otherwise" + echo "defining MPI_Offset as long in C and integer in Fortran" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="\%ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + fi + fi +fi +])dnl +dnl +dnl +define(PAC_MPI_INFO,[ + AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + MPI_Info info; + MPI_Init(&argc,&argv); + MPI_Info_create(&info); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI_Info available]) + HAVE_MPI_INFO="#define HAVE_MPI_INFO" + MPI_FINFO1="!" + MPI_FINFO2="!" + MPI_FINFO3="!" + MPI_FINFO4="!" + else + AC_MSG_RESULT(no) + BUILD_MPI_INFO=1 + MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL" + MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)" + MPI_FINFO3=" INTEGER MPI_INFO_NULL" + MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)" + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +define(PAC_MPI_DARRAY_SUBARRAY,[ + AC_MSG_CHECKING(if darray and subarray constructors are defined in the MPI implementation) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + int i=MPI_DISTRIBUTE_CYCLIC; + MPI_Datatype t; + MPI_Init(&argc,&argv); + MPI_Type_create_darray(i, i, i, &i, &i, &i, &i, i, MPI_INT, &t); + MPI_Type_create_subarray(i, &i, &i, &i, i, MPI_INT, &t); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if MPI Darray available]) + HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" + MPI_FARRAY1="!" + MPI_FARRAY2="!" + MPI_FARRAY3="!" + MPI_FARRAY4="!" + MPI_FARRAY5="!" + MPI_FARRAY6="!" + MPI_FARRAY7="!" + else + AC_MSG_RESULT(no) + BUILD_MPI_ARRAY=1 + MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN" + MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)" + MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC" + MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG" + MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)" + MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)" + MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)" + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +define(PAC_CHECK_MPI_SGI_INFO_NULL,[ + AC_MSG_CHECKING([if MPI_INFO_NULL is defined in mpi.h]) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + int i; + i = MPI_INFO_NULL; + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + cp adio/sgi/mpi3.1/*.h include + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl +define(PAC_CHECK_MPIOF_H,[ + AC_MSG_CHECKING(if mpiof.h is included in mpif.h) + rm -f mpitest.f + cat > mpitest.f <<EOF + program main + implicit none + include 'mpif.h' + integer i + i = MPI_MODE_RDWR + stop + end +EOF + rm -f conftest$EXEEXT + $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.f $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + MPIOF_H_INCLUDED=1 + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.f +])dnl +dnl +dnl +dnl check if pread64 is defined in IRIX. needed on IRIX 6.5 +dnl +define(PAC_HAVE_PREAD64,[ + AC_MSG_CHECKING(if pread64 is defined) + rm -f conftest.c + cat > conftest.c <<EOF +#include <unistd.h> + main() + { + int fd=0, buf=0, i=0; + off64_t off=0; + pread64(fd, &buf, i, off); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PREAD64,,[Define if pread64 available]) + else + AC_MSG_RESULT(no) + fi +rm -f conftest$EXEEXT conftest.c +])dnl +dnl +dnl +define(PAC_TEST_MPI_SGI_type_is_contig,[ + AC_MSG_CHECKING(if MPI_SGI_type_is_contig is defined) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + MPI_Datatype type; + int i; + + MPI_Init(&argc,&argv); + i = MPI_SGI_type_is_contig(type); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no MPI type is contig]) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl +define(PAC_TEST_MPI_COMBINERS,[ + AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + int i; + + MPI_Init(&argc,&argv); + i = MPI_COMBINER_STRUCT; + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl PAC_MPI_OFFSET_KIND() +dnl +dnl tries to determine the Fortran 90 kind parameter for 8-byte integers +dnl +define(PAC_MPI_OFFSET_KIND, +[ +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +# Determine the extension for Fortran 90 files (not all compilers accept +# .f and not all accept .f90) +if test -z "$ac_f90ext" ; then + if test -z "$FC" ; then + # This list should correspond to the list in aclocal_fc.m4 + AC_CHECK_PROGS(FC,ifort pgf90 pathf90 pathf95 xlf90 xlf95 f90 epcf90 \ + f95 fort lf95 gfortran g95 ifc efc) + fi + AC_MSG_CHECKING([for extension for Fortran 90 programs]) + ac_f90ext="f90" + ac_f90compile='${FC-f90} -c $FCFLAGS conftest.$ac_f90ext 1>&AC_FD_CC' + cat > conftest.$ac_f90ext <<EOF + program conftest + end +EOF + if AC_TRY_EVAL(ac_f90compile) ; then + AC_MSG_RESULT([f90]) + else + # This is needed for Mac OSX 10.5 + rm -rf conftest.dSYM + rm -f conftest* + ac_f90ext="f" + cat > conftest.$ac_f90ext <<EOF + program conftest + end +EOF + if AC_TRY_EVAL(ac_f90compile) ; then + AC_MSG_RESULT([f]) + else + AC_MSG_RESULT([unknown!]) + fi + fi +fi +AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers]) +cat <<EOF > conftest.$ac_f90ext + program main + integer i + i = selected_int_kind(16) + open(8, file="conftest.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o conftest$EXEEXT conftest.$ac_f90ext $FCFLAGS >/dev/null 2>&1 ; then + ./conftest$EXEEXT >/dev/null 2>&1 + if test -s conftest.out ; then + KINDVAL=`cat conftest.out` + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + AC_MSG_RESULT($KINDVAL) + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + AC_MSG_RESULT(unavailable) +fi +])dnl +dnl +dnl +define(PAC_TEST_MPI_HAVE_OFFSET_KIND,[ + AC_MSG_CHECKING(if MPI_OFFSET_KIND is defined in mpif.h) + rm -f mpitest.f + cat > mpitest.f <<EOF + program main + implicit none + include 'mpif.h' + integer i + i = MPI_OFFSET_KIND + stop + end +EOF + rm -f conftest$EXEEXT + $F77 $FFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.f $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.f +])dnl +dnl +dnl +dnl PAC_GET_XFS_MEMALIGN +dnl +dnl +define(PAC_GET_XFS_MEMALIGN, +[AC_MSG_CHECKING([for memory alignment needed for direct I/O]) +rm -f memalignval +rm -f /tmp/romio_tmp.bin +AC_TEST_PROGRAM([#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> +main() { + struct dioattr st; + int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); + FILE *f=fopen("memalignval","w"); + if (fd == -1) exit(1); + if (!f) exit(1); + fcntl(fd, F_DIOINFO, &st); + fprintf( f, "%u\n", st.d_mem); + exit(0); +}],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="") +rm -f memalignval +rm -f /tmp/romio_tmp.bin +if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then + AC_MSG_RESULT($Pac_CV_NAME) + CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME" +else + AC_MSG_RESULT(unavailable, assuming 128) + CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" +fi +])dnl +dnl + +define(PAC_HAVE_MOUNT_NFS,[ + AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files]) + rm -f conftest.c + cat > conftest.c <<EOF +#include <sys/param.h> +#include <sys/mount.h> + main() + { + int i=MOUNT_NFS; + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + ROMIO_HAVE_MOUNT_NFS=1 + AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined]) + else + ROMIO_HAVE_MOUNT_NFS=0 + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT conftest.c +])dnl +dnl +dnl +dnl PAC_MPI_OFFSET_KIND_4BYTE() +dnl +dnl tries to determine the Fortran 90 kind parameter for 4-byte integers +dnl +define(PAC_MPI_OFFSET_KIND_4BYTE, +[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers]) +rm -f kind.f kind.$OBJEXT kind$EXEEXT +cat <<EOF > kind.f + program main + integer i + i = selected_int_kind(8) + open(8, file="k.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o kind$EXEEXT kind.f $FCFLAGS >/dev/null 2>&1 ; then + ./kind >/dev/null 2>&1 + if test -s k.out ; then + KINDVAL=`cat k.out` + fi +fi +rm -f kind$EXEEXT k.out kind.f kind.$OBJEXT +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + AC_MSG_RESULT($KINDVAL) + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + AC_MSG_RESULT(unavailable) +fi +])dnl +dnl +dnl +define(PAC_FUNC_STRERROR,[ + AC_MSG_CHECKING([for strerror()]) + rm -f conftest.c + cat > conftest.c <<EOF +#include <string.h> + main() + { + char *s = strerror(5); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEXT conftest.c >> config.log 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STRERROR,,[Define if strerror available]) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING([for sys_errlist]) + rm -f conftest.c +changequote(,) + cat > conftest.c <<EOF +#include <stdio.h> + main() + { + extern char *sys_errlist[]; + printf("%s\n", sys_errlist[34]); + } +EOF +changequote([,]) + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > config.log 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available]) + else + AC_MSG_RESULT(no) + fi + fi + rm -f conftest$EXEEXT conftest.c +])dnl +dnl +define(PAC_TEST_MPIR_STATUS_SET_BYTES,[ + AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" + main(int argc, char **argv) + { + MPI_Status status; + MPI_Datatype type; + int err; + + MPI_Init(&argc,&argv); + MPIR_Status_set_bytes(status,type,err); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +define(PAC_TEST_MPI_GREQUEST,[ + AC_MSG_CHECKING(support for generalized requests) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" +#include "stdio.h" + main(int argc, char **argv) + { + MPI_Request request; + MPI_Init(&argc, &argv); + MPI_Grequest_start(NULL, NULL, NULL, NULL, &request); + MPI_Finalize(); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_GREQUEST,1,[Define if generalized requests avaliable]) + DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl + +define(PAC_TEST_MPI_GREQUEST_EXTENSIONS,[ + AC_MSG_CHECKING(support for non-standard extended generalized requests) + rm -f mpitest.c + cat > mpitest.c <<EOF +#include "mpi.h" +#include "stdio.h" + main(int argc, char **argv) + { + MPIX_Grequest_class classtest + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest$EXEEXT mpitest.c $MPI_LIB > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_GREQUEST_EXTENTIONS,1,[Define if non-standard generalized requests extensions avaliable]) + DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#define HAVE_MPI_GREQUEST_EXTENSIONS 1" + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl + +define(PAC_TEST_NEEDS_CONST,[ + AC_MSG_CHECKING([const declarations needed in MPI routines]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [ #include <mpi.h> + int MPI_File_delete(char *filename, MPI_Info info) { return (0); } + ] )], + [ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPIIO_CONST, const, [Define if MPI-IO routines need a const qualifier]) + ]) + ]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_runlog.m4 b/3rd-party/romio341/mpl/confdb/aclocal_runlog.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f22e6ddbc3a952e4cb5d896453736fe12ca0b779 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_runlog.m4 @@ -0,0 +1,218 @@ +dnl +dnl PAC_RUN_LOG mimics _AC_RUN_LOG which is autoconf internal routine. +dnl We also make sure PAC_RUN_LOG can be used in AS_IF, so the last +dnl test command should have terminating ]), i.e. without newline before ]). +dnl +AC_DEFUN([PAC_RUNLOG],[ +{ AS_ECHO(["$as_me:$LINENO: $1"]) >&AS_MESSAGE_LOG_FD + (eval $1) 2>&AS_MESSAGE_LOG_FD + ac_status=$? + AS_ECHO(["$as_me:$LINENO: \$? = $ac_status"]) >&AS_MESSAGE_LOG_FD + test $ac_status = 0; }]) + +dnl +dnl PAC_COMMAND_IFELSE is written to replace AC_TRY_EVAL with added logging +dnl to config.log, i.e. AC_TRY_EVAL does not log anything to config.log. +dnl If autoconf provides AC_COMMAND_IFELSE or AC_EVAL_IFELSE, +dnl AC_COMMAND_IFELSE dnl should be replaced by the official autoconf macros. +dnl +dnl PAC_COMMAND_IFELSE(COMMMAND,[ACTION-IF-RUN-OK],[ACTION-IF-RUN-FAIL]) +dnl +AC_DEFUN([PAC_COMMAND_IFELSE],[ +AS_IF([PAC_RUNLOG([$1])],[ + $2 +],[ + AS_ECHO(["$as_me: program exited with status $ac_status"]) >&AS_MESSAGE_LOG_FD + m4_ifvaln([$3],[ + (exit $ac_status) + $3 + ]) +]) +]) + +AC_DEFUN([PAC_RUNLOG_IFELSE],[ +dnl pac_TESTLOG is the internal temporary logfile for this macro. +pac_TESTLOG="pac_test.log" +rm -f $pac_TESTLOG +PAC_COMMAND_IFELSE([$1 > $pac_TESTLOG],[ + ifelse([$2],[],[],[$2]) +],[ + AS_ECHO(["*** $1 :"]) >&AS_MESSAGE_LOG_FD + cat $pac_TESTLOG >&AS_MESSAGE_LOG_FD + ifelse([$3],[],[],[$3]) +]) +rm -f $pac_TESTLOG +]) + + +dnl PAC_VAR_PUSHVAL(VARNAME, [LastSavedValue])) +dnl +dnl Save the content of the shell variable, VARNAME, onto a stack. +dnl The saved value of VARNAME is restorable with respect to the nesting +dnl of the macro. +dnl +dnl The Last saved value of VARNAME on the stack is stored in shell variable +dnl pac_LastSavedValueOf_$VARNAME if the 2nd argument is NOT supplied. +dnl If the 2nd argument is present, the last saved value will be stored +dnl in the 2nd argument instead. +dnl +dnl The First saved value of VARNAME on the stack is stored in shell variable +dnl dnl pac_FirstSavedValueOf_$VARNAME. +dnl +AC_DEFUN([PAC_VAR_PUSHVAL],[ +# START of PUSHVAL +dnl define local m4-name pac_stk_level. +AS_VAR_PUSHDEF([pac_stk_level], [pac_stk_$1_level]) +AS_VAR_SET_IF([pac_stk_level],[ + AS_VAR_ARITH([pac_stk_level], [$pac_stk_level + 1]) +],[ + AS_VAR_SET([pac_stk_level], [0]) +]) +dnl AS_ECHO_N(["PUSHVAL: pac_stk_level = $pac_stk_level, "]) +dnl Save the content of VARNAME, i.e. $VARNAME, onto the stack. +AS_VAR_SET([pac_stk_$1_$pac_stk_level],[$$1]) +AS_VAR_IF([pac_stk_level], [0], [ + dnl Save the 1st pushed value of VARNAME as pac_FirstSavedValueOf_$VARNAME + AS_VAR_COPY([pac_FirstSavedValueOf_$1],[pac_stk_$1_$pac_stk_level]) +]) +ifelse([$2],[],[ + dnl Save the last pushed value of VARNAME as pac_LastSavedValueOf_$VARNAME + AS_VAR_COPY([pac_LastSavedValueOf_$1],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["pac_LastSavedValueOf_$1 = $pac_LastSavedValueOf_$1"]) +],[ + dnl Save the last pushed value of VARNAME as $2 + AS_VAR_COPY([$2],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["$2 = $$2"]) +]) +AS_VAR_POPDEF([pac_stk_level]) +# END of PUSHVAL +]) +dnl +dnl +dnl +dnl PAC_VAR_POPVAL(VARNAME) +dnl +dnl Restore variable, VARNAME, from the stack. +dnl This macro is safe with respect to the nesting. +dnl Some minimal checking of nesting balance of PAC_VAR_PUSH[POP]VAL() +dnl is done here. +dnl +AC_DEFUN([PAC_VAR_POPVAL],[ +# START of POPVAL +dnl define local m4-name pac_stk_level. +AS_VAR_PUSHDEF([pac_stk_level], [pac_stk_$1_level]) +AS_VAR_SET_IF([pac_stk_level],[ + AS_VAR_IF([pac_stk_level],[-1],[ + AC_MSG_WARN(["Imbalance of PUSHVAL/POPVAL of $1"]) + ],[ + dnl AS_ECHO_N(["POPVAL: pac_stk_level = $pac_stk_level, "]) + AS_VAR_COPY([$1],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["popped_val = $$1"]) + AS_VAR_ARITH([pac_stk_level], [ $pac_stk_level - 1 ]) + ]) +],[ + AC_MSG_WARN(["Uninitialized PUSHVAL/POPVAL of $1"]) +]) +AS_VAR_POPDEF([pac_stk_level]) +# END of POPVAL +]) +dnl +dnl +dnl +dnl PAC_COMPILE_IFELSE_LOG is a wrapper around AC_COMPILE_IFELSE with the +dnl output of ac_compile to a specified logfile instead of AS_MESSAGE_LOG_FD +dnl +dnl PAC_COMPILE_IFELSE_LOG(logfilename, input, +dnl [action-if-true], [action-if-false]) +dnl +dnl where input, [action-if-true] and [action-if-false] are used +dnl in AC_COMPILE_IFELSE(input, [action-if-true], [action-if-false]). +dnl This macro is nesting safe. +dnl +AC_DEFUN([PAC_COMPILE_IFELSE_LOG],[ +dnl +dnl Instead of defining our own ac_compile and do AC_TRY_EVAL +dnl on these variables. We modify ac_compile used by AC_*_IFELSE +dnl by piping the output of the command to a logfile. The reason is that +dnl 1) AC_TRY_EVAL is discouraged by Autoconf. 2) defining our ac_compile +dnl could mess up the usage and order of *CFLAGS, LDFLAGS and LIBS in +dnl these commands, i.e. deviate from how GNU standard uses these variables. +dnl +dnl Replace ">&AS_MESSAGE_LOG_FD" by "> FILE 2>&1" in ac_compile. +dnl Save a copy of ac_compile on a stack +dnl which is safe through nested invocations of this macro. +PAC_VAR_PUSHVAL([ac_compile]) +dnl Modify ac_compile based on the unmodified ac_compile. +ac_compile="`echo $pac_FirstSavedValueOf_ac_compile | sed -e 's|>.*$|> $1 2>\&1|g'`" +AC_COMPILE_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) +],[ + ifelse([$4],[],[:],[$4]) +]) +dnl Restore the original ac_compile from the stack. +PAC_VAR_POPVAL([ac_compile]) +]) +dnl +dnl +dnl +dnl PAC_LINK_IFELSE_LOG is a wrapper around AC_LINK_IFELSE with the +dnl output of ac_link to a specified logfile instead of AS_MESSAGE_LOG_FD +dnl +dnl PAC_LINK_IFELSE_LOG(logfilename, input, +dnl [action-if-true], [action-if-false]) +dnl +dnl where input, [action-if-true] and [action-if-false] are used +dnl in AC_LINK_IFELSE(input, [action-if-true], [action-if-false]). +dnl This macro is nesting safe. +dnl +AC_DEFUN([PAC_LINK_IFELSE_LOG],[ +dnl +dnl Instead of defining our own ac_link and do AC_TRY_EVAL +dnl on these variables. We modify ac_link used by AC_*_IFELSE +dnl by piping the output of the command to a logfile. The reason is that +dnl 1) AC_TRY_EVAL is discouraged by Autoconf. 2) defining our ac_link +dnl could mess up the usage and order of *CFLAGS, LDFLAGS and LIBS in +dnl these commands, i.e. deviate from how GNU standard uses these variables. +dnl +dnl Replace ">&AS_MESSAGE_LOG_FD" by "> FILE 2>&1" in ac_link. +dnl Save a copy of ac_link on a stack +dnl which is safe through nested invocations of this macro. +PAC_VAR_PUSHVAL([ac_link]) +dnl Modify ac_link based on the unmodified ac_link. +ac_link="`echo $pac_FirstSavedValueOf_ac_link | sed -e 's|>.*$|> $1 2>\&1|g'`" +dnl +AC_LINK_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) +],[ + ifelse([$4],[],[:],[$4]) +]) +dnl Restore the original ac_link from the stack. +PAC_VAR_POPVAL([ac_link]) +]) +dnl +dnl +dnl +dnl PAC_COMPLINK_IFELSE (input1, input2, [action-if-true], [action-if-false]) +dnl +dnl where input1 and input2 are either AC_LANG_SOURCE or AC_LANG_PROGRAM +dnl enclosed input programs. +dnl +dnl The macro first compiles input1 and uses the object file created +dnl as part of LIBS during linking. This macro is nesting safe. +dnl +AC_DEFUN([PAC_COMPLINK_IFELSE],[ +AC_COMPILE_IFELSE([$1],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_VAR_PUSHVAL([LIBS]) + LIBS="pac_conftest.$OBJEXT $pac_FirstSavedValueOf_LIBS" + AC_LINK_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) + ],[ + ifelse([$4],[],[:],[$4]) + ]) + PAC_VAR_POPVAL([LIBS]) + rm -f pac_conftest.$OBJEXT +],[ + ifelse([$4],[],[:],[$4]) +]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_shl.m4 b/3rd-party/romio341/mpl/confdb/aclocal_shl.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9997fe54a1b61a8061414596b265d95c90bbe07f --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_shl.m4 @@ -0,0 +1,499 @@ +dnl +dnl Definitions for creating shared libraries +dnl +dnl The purpose of these definitions is to provide common support for +dnl shared libraries, with *or without* the use of the GNU Libtool package. +dnl For many of our important platforms, the Libtool approach is overkill, +dnl and can be particularly painful for developers. +dnl +dnl To use libtool, you need macros that are defined by libtool for libtool +dnl Don't even think about the consequences of this for updating and for +dnl using user-versions of libtool :( +dnl +dnl !!!!!!!!!!!!!!!!!!!!! +dnl libtool requires ac 2.50 !!!!!!!!!!!!!!!!! +dnl +dnl builtin(include,libtool.m4) +dnl +dnl/*D +dnl PAC_ARG_SHAREDLIBS - Add --enable-sharedlibs=kind to configure. +dnl +dnl Synopsis: +dnl PAC_ARG_SHAREDLIBS +dnl +dnl Output effects: +dnl Adds '--enable-sharedlibs=kind' to the command line. If this is enabled, +dnl then based on the value of 'kind', programs are selected for the +dnl names 'CC_SHL' and 'CC_LINK_SHL' that configure will substitute for in +dnl 'Makefile.in's. These symbols are generated by 'simplemake' when +dnl shared library support is selected. +dnl The variable 'C_LINKPATH_SHL' is set to the option to specify the +dnl path to search at runtime for libraries (-rpath in gcc/GNU ld). +dnl This can be turned off with --disable-rpath , which is appropriate +dnl for libraries and for executables that may be installed in different +dnl locations. +dnl The variable 'SHLIB_EXT' is set to the extension used by shared +dnl libraries; under most forms of Unix, this is 'so'; under Mac OS/X, this +dnl is 'dylib', and under Windows (including cygwin), this is 'dll'. +dnl +dnl Supported values of 'kind' include \: +dnl+ gcc - Use gcc to create both shared objects and libraries +dnl. osx-gcc - Use gcc on Mac OS/X to create both shared objects and +dnl libraries +dnl. solaris-cc - Use native Solaris cc to create shared objects and +dnl libraries +dnl. cygwin-gcc - Use gcc on Cygwin to create shared objects and libraries +dnl- none - The same as '--disable-sharedlibs' +dnl +dnl Others will be added as experience dictates. Likely names are +dnl + libtool - For general GNU libtool +dnl - linux-pgcc - For Portland group under Linux +dnl +dnl Notes: +dnl Shared libraries are only partially implemented. Additional symbols +dnl will probably be defined, including symbols to specify how shared library +dnl search paths are specified and how shared library names are set. +dnl D*/ +AC_DEFUN([PAC_ARG_SHAREDLIBS],[ + +AC_ARG_ENABLE(shared, + AC_HELP_STRING([--enable-shared], [Enable shared library builds]),, + enable_shared=no) + +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--enable-rpath], + [Determine whether the rpath is set when programs are + compiled and linked when shared libraries are built. + The default is yes; use --disable-rpath to turn this + feature off; in that case, shared libraries will be + found according to the rules for your system (e.g., in + LD_LIBRARY_PATH)]),,enable_rpath=yes) + +AC_ARG_ENABLE(sharedlibs, +[ --enable-sharedlibs=kind - Enable shared libraries. kind may be + gcc - Standard gcc and GNU ld options for creating shared libraries + osx-gcc - Special options for gcc needed only on OS/X + solaris-cc - Solaris native (SPARC) compilers for 32 bit systems + cygwin-gcc - Special options for gcc needed only for cygwin + none - same as --disable-sharedlibs + Only gcc, osx-gcc, and solaris-cc are currently supported +],,enable_sharedlibs=default) + +if test "$enable_sharedlibs" = "default" ; then + if test "$enable_shared" = "yes" ; then + AS_CASE([$host], + [*-*-darwin*], [enable_sharedlibs=gcc-osx], + [*-*-cygwin*|*-*-mingw*|*-*-pw32*|*-*-cegcc*], [enable_sharedlibs=cygwin-gcc], + [*-*-sunos*], [enable_sharedlibs=solaris-gcc], + [enable_sharedlibs=gcc]) + else + enable_sharedlibs=none + fi +fi + +# If --enable-sharedlibs is given, but --enable-shared is not, throw +# an error +if test "$enable_sharedlibs" != "no" -a "$enable_sharedlibs" != "none" ; then + if test "$enable_shared" = "no" ; then + AC_MSG_ERROR([--enable-sharedlibs cannot be used without --enable-shared]) + fi +fi + +CC_SHL=true +C_LINK_SHL=true +C_LINKPATH_SHL="" +SHLIB_EXT=unknown +SHLIB_FROM_LO=no +SHLIB_INSTALL='$(INSTALL_PROGRAM)' +case "$enable_sharedlibs" in + no|none) + ;; + gcc-osx|osx-gcc) + AC_MSG_RESULT([Creating shared libraries using GNU for Mac OSX]) + C_LINK_SHL='${CC} -dynamiclib -undefined suppress -single_module -flat_namespace' + CC_SHL='${CC} -fPIC' + # No way in osx to specify the location of the shared libraries at link + # time (see the code in createshlib in mpich/src/util) + # As of 10.5, -Wl,-rpath,dirname should work . The dirname + # must be a single directory, not a colon-separated list (use multiple + # -Wl,-rpath,path for each of the paths in the list). However, os x + # apparently records the library full path, so rpath isn't as useful + # as it is on other systems + C_LINKPATH_SHL="" + SHLIB_EXT="dylib" + enable_sharedlibs="osx-gcc" + ;; + gcc) + AC_MSG_RESULT([Creating shared libraries using GNU]) + # Not quite right yet. See mpich/util/makesharedlib + # Use syntax that works in both Make and the shell + #C_LINK_SHL='${CC} -shared -Wl,-r' + C_LINK_SHL='${CC} -shared' + # For example, include the libname as ${LIBNAME_SHL} + #C_LINK_SHL='${CC} -shared -Wl,-h,<finallibname>' + # May need -fPIC . Test to see which one works. + for sh_arg in "-fPIC" "-fpic" "-KPIC" ; do + PAC_C_CHECK_COMPILER_OPTION($sh_arg,works=yes,works=no) + if test "$works" = "yes" ; then + CC_SHL="${CC} ${sh_arg}" + break + fi + done + if test "$works" != "yes"; then + AC_MSG_ERROR([Cannot build shared libraries with this compiler]) + fi + # This used to have -Wl,-rpath earlier, but that causes problems + # on many systems. + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-Wl,-rpath," + fi + SHLIB_EXT=so + # We need to test that this isn't osx. The following is a + # simple hack + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=osx-gcc for Mac OS/X]) + ;; + *CYGWIN*|*cygwin*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=cygwin-gcc for Cygwin]) + ;; + *SunOS*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=solaris-gcc for Solaris with gcc]) + ;; + esac + ;; + + cygwin|cygwin-gcc|gcc-cygwin) + AC_MSG_RESULT([Creating shared libraries using GNU under CYGWIN]) + C_LINK_SHL='${CC} -shared' + CC_SHL='${CC}' + # DLL Libraries need to be in the user's path (!) + C_LINKPATH_SHL="" + SHLIB_EXT="dll" + enable_sharedlibs="cygwin-gcc" + ;; + + libtool) + # set TRY_LIBTOOL to yes to experiment with libtool. You are on your + # own - only send fixes, not bug reports. + if test "$TRY_LIBTOOL" != yes ; then + AC_MSG_ERROR([Creating shared libraries using libtool not yet supported]) + else + # Using libtool requires a heavy-weight process to test for + # various stuff that libtool needs. Without this, you'll get a + # bizarre error message about libtool being unable to find + # configure.in or configure.ac (!) + # Libtool expects to see at least enable-shared. + if test "X$enable_shared" = "X" ; then enable_shared=yes ; fi + # Initialize libtool + # This works, but libtool version 2 places the object files + # in a different place, making it harder to integrate with + # our base approach. Disabling for now + dnl LT_PREREQ([2.2.6]) + dnl LT_INIT([disable-shared]) + AC_MSG_ERROR([To use this test verison, edit aclocal_shl.m4]) + # Likely to be + # either CC or CC_SHL is libtool $cc + CC_SHL='${LIBTOOL} --mode=compile ${CC}' + # CC_LINK_SHL includes the final installation path + # For many systems, the link may need to include *all* libraries + # (since many systems don't allow any unsatisfied dependencies) + # We need to give libtool the .lo file, not the .o files + SHLIB_FROM_LO=yes + # We also need to add -no-undefined when the compiler is gcc and + # we are building under cygwin + sysname=`uname -s | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` + isCygwin=no + case "$sysname" in + *CYGWIN*) isCygwin=yes ;; + esac + if test "$isCygwin" = yes ; then + C_LINK_SHL='${LIBTOOL} --mode=link ${CC} -no-undefined -rpath ${libdir}' + else + C_LINK_SHL='${LIBTOOL} --mode=link ${CC} -rpath ${libdir}' + fi + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-rpath " + fi + # We also need a special install process with libtool. Note that this + # will also install the static libraries + SHLIB_INSTALL='$(LIBTOOL) --mode=install $(INSTALL_PROGRAM)' + # Note we may still need to add + #'$(LIBTOOL) --mode=finish $(libdir)' + fi + ;; +dnl +dnl Other, such as solaris-cc + solaris|solaris-cc) + AC_MSG_RESULT([Creating shared libraries using Solaris]) + # pic32 is appropriate for both 32 and 64 bit Solaris + C_LINK_SHL='${CC} -G -xcode=pic32' + CC_SHL='${CC} -xcode=pic32' + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-R" + fi + SHLIB_EXT=so + enable_sharedlibs="solaris-cc" + ;; + + solaris-gcc) + # This is the same as gcc, except for the C_LINKPATH_SHL + AC_MSG_RESULT([Creating shared libraries using Solaris with gcc]) + C_LINK_SHL='${CC} -shared' + CC_SHL='${CC} -fPIC' + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-R" + fi + SHLIB_EXT=so + enable_sharedlibs="solaris-gcc" + ;; + + linuxppc-xlc) + # This is only the beginning of xlc support, thanks to andy@vpac.org + CC_SHL='${CC} -qmkshrobj' + # More recent versions allow multiple args, separated by commas + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-Wl,-rpath," + fi + #C_LINKPATH_SHL="-Wl,-rpath -Wl," + C_LINK_SHL='${CC} -shared -qmkshrobj' + SHLIB_EXT=so + # Note that the full line should be more like + # $CLINKER -shared -qmkshrobj -Wl,-h,$libbase.$slsuffix -o ../shared/$libbase.$slsuffix *.o $OtherLibs + # for the appropriate values of $libbase and $slsuffix + # The -h name sets the name of the object; this is necessary to + # ensure that the dynamic linker can find the proper shared library. + ;; + + *) + AC_MSG_ERROR([Unknown value $enable_sharedlibs for enable-sharedlibs. Values should be gcc or osx-gcc]) + enable_sharedlibs=no + ;; +esac +# Check for the shared-library extension +PAC_CC_SHLIB_EXT +dnl +AC_SUBST(CC_SHL) +AC_SUBST(C_LINK_SHL) +AC_SUBST(C_LINKPATH_SHL) +AC_SUBST(SHLIB_EXT) +AC_SUBST(SHLIB_FROM_LO) +AC_SUBST(SHLIB_INSTALL) +]) + +dnl /*D +dnl PAC_xx_SHAREDLIBS - Get compiler and linker for shared libraries +dnl These routines may be used to determine the compiler and the +dnl linker to be used in creating shared libraries +dnl Rather than set predefined variable names, they set an argument +dnl (if provided) +dnl +dnl Synopsis +dnl PAC_CC_SHAREDLIBS(type,CCvar,CLINKvar) +dnl D*/ +AC_DEFUN([PAC_CC_SHAREDLIBS], +[ +pac_kinds=$1 +ifelse($1,,[ + pac_prog="" + AC_CHECK_PROG(pac_prog,gcc,yes,no) + # If we are gcc but OS X, set the special type + # We need a similar setting for cygwin + if test "$pac_prog" = yes ; then + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) pac_kinds=gcc-osx + ;; + *) pac_kinds=gcc + ;; + esac + fi + pac_prog="" + AC_CHECK_PROG(pac_prog,libtool,yes,no) + if test "$pac_prog" = yes ; then pac_kinds="$pac_kinds libtool" ; fi +]) +for pac_arg in $pac_kinds ; do + case $pac_arg in + gcc) + # For example, include the libname as ${LIBNAME_SHL} + #C_LINK_SHL='${CC} -shared -Wl,-h,<finallibname>' + pac_cc_sharedlibs='gcc -shared' + # Make sure we select the correct fpic option + PAC_C_CHECK_COMPILER_OPTION(-fPIC,fPIC_OK=yes,fPIC_OK=no) + if test "$fPIC_OK" != yes ; then + PAC_C_CHECK_COMPILER_OPTION(-fpic,fpic_ok=yes,fpic_ok=no) + if test "$fpic_ok" != yes ; then + AC_MSG_ERROR([Neither -fpic nor -fPIC accepted by $CC]) + else + pac_cc_sharedlibs="$pac_cc_sharedlibs -fpic" + fi + else + pac_cc_sharedlibs="$pac_cc_sharedlibs -fPIC" + fi + pac_clink_sharedlibs='gcc -shared' + pac_type_sharedlibs=gcc + ;; + gcc-osx|osx-gcc) + pac_clink_sharedlibs='${CC} -dynamiclib -undefined suppress -single_module -flat_namespace' + pac_cc_sharedlibs='${CC} -fPIC' + pac_type_sharedlibs=gcc-osx + ;; + libtool) + AC_CHECK_PROGS(LIBTOOL,libtool,false) + if test "$LIBTOOL" = "false" ; then + AC_MSG_WARN([Could not find libtool]) + else + # Likely to be + # either CC or CC_SHL is libtool $cc + pac_cc_sharedlibs'${LIBTOOL} -mode=compile ${CC}' + pac_clink_sharedlibs='${LIBTOOL} -mode=link ${CC} -rpath ${libdir}' + pac_type_sharedlibs=libtool + fi + ;; + *) + ;; + esac + if test -n "$pac_cc_sharedlibs" ; then break ; fi +done +if test -z "$pac_cc_sharedlibs" ; then pac_cc_sharedlibs=true ; fi +if test -z "$pac_clink_sharedlibs" ; then pac_clink_sharedlibs=true ; fi +ifelse($2,,CC_SHL=$pac_cc_sharedlibs,$2=$pac_cc_sharedlibs) +ifelse($3,,C_LINK_SHL=$pac_clink_sharedlibs,$3=$pac_clink_sharedlibs) +ifelse($4,,SHAREDLIB_TYPE=$pac_type_sharedlibs,$4=$pac_type_sharedlibs) +]) + +dnl This macro ensures that all of the necessary substitutions are +dnl made by any subdirectory configure (which may simply SUBST the +dnl necessary values rather than trying to determine them from scratch) +dnl This is a more robust (and, in the case of libtool, only +dnl managable) method. +AC_DEFUN([PAC_CC_SUBDIR_SHLIBS],[ + AC_SUBST(CC_SHL) + AC_SUBST(C_LINK_SHL) + AC_SUBST(LIBTOOL) + AC_SUBST(ENABLE_SHLIB) + AC_SUBST(SHLIB_EXT) + if test "$ENABLE_SHLIB" = "libtool" ; then + if test -z "$LIBTOOL" ; then + AC_MSG_WARN([libtool selected for shared library support but LIBTOOL is not defined]) + fi + # Libtool needs main_top_builddir + if test "X$main_top_builddir" = "X" ; then + AC_MSG_ERROR([Libtool requires main_top_builddir - check configure.ac sources]) + fi + AC_SUBST(main_top_builddir) + fi +]) + +dnl PAC_CC_SHLIB_EXT - get the extension for shared libraries +dnl Set the variable SHLIB_EXT if it is other than unknown. +AC_DEFUN([PAC_CC_SHLIB_EXT],[ +# Not all systems use .so as the extension for shared libraries (cygwin +# and OSX are two important examples). If we did not set the SHLIB_EXT, +# then try and determine it. We need this to properly implement +# clean steps that look for libfoo.$SHLIB_EXT . +if test "$SHLIB_EXT" = "unknown" ; then + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) SHLIB_EXT=dylib + ;; + *CYGWIN*|*cygwin*) SHLIB_EXT=dll + ;; + *Linux*|*LINUX*|*SunOS*) SHLIB_EXT=so + ;; + esac +fi +]) + +dnl PAC_COMPILER_SHLIB_FLAGS(compiler-var,output-file) +dnl +dnl Uses confdb/config.rpath to determine important linking flags and +dnl information. This is mainly intended to support the compiler wrapper +dnl scripts in MPICH ("mpicc" and friends) which cannot directly use libtool to +dnl handle linking. MPICH's compiler wrappers attempt to link executables with +dnl an rpath by default. The resulting variable assignment statements will be +dnl placed into "output-file", which is then suitable for AC_SUBST_FILE or +dnl sourcing in a shell script (including configure itself). +dnl +dnl This macro assumes that the basic tests associated with "compiler-var" have +dnl been run already, but does not AC_REQUIRE them in order to prevent problems +dnl with "expanded before required" when requiring the AC_PROG_{CC,F77,FC,CXX} +dnl macros. +dnl +dnl Example usage: +dnl +dnl ----8<---- +dnl # compute flags for linking executables against shared libraries when using +dnl # the modern Fortran compiler ($FC). +dnl PAC_COMPILER_SHLIB_FLAGS([FC],[src/env/fc_shlib.conf]) +dnl ----8<---- +AC_DEFUN([PAC_COMPILER_SHLIB_FLAGS],[ +AC_REQUIRE_AUX_FILE([config.rpath]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +# It appears that the libtool dynamic linking strategy on Darwin is this: +# 1. Link all shared libs with "-install_name /full/path/to/libfoo.dylib" +# 2. Don't do anything special when linking programs, since it seems that the +# darwin dynamic linker will always use the "install_name" field from the lib +# that was found at program link-time. (CONFIRMED) This is in opposition to +# the way that Linux does it, where specifying a "-rpath" argument at program +# link-time is important. +# +# There is an alternative darwin strategy for versions +# >= 10.5, see this: http://www.cmake.org/pipermail/cmake/2010-August/038970.html +# (goodell@ 2011-06-17) + +AC_MSG_CHECKING([for shared library (esp. rpath) characteristics of $1]) + +# unfortunately, config.rpath expects the compiler in question is always CC and +# uses several other environment variables as input +PAC_PUSH_FLAG([CC]) +PAC_PUSH_FLAG([GCC]) +PAC_PUSH_FLAG([LD]) +# these two don't currently get overridden, but we push/pop them for safety in +# case they do in the future +PAC_PUSH_FLAG([LDFLAGS]) +PAC_PUSH_FLAG([with_gnu_ld]) + +# set the temporary override values (if any) +m4_case([$1], +[CC], + [:], dnl do nothing special for CC, values are already correct +[F77], + [CC="$$1" + GCC="$G77" + LD="$LD_F77"], +[FC], + [CC="$$1" + GCC="$GCC_FC" + LD="$LD_FC"], +[CXX], + [CC="$$1" + GCC="$GXX" + LD="$LD_CXX"], +[m4_fatal([unknown compiler argument "$1"])]) + +# ensure the values are available to the script +export CC +export GCC +export LDFLAGS +export LD +export with_gnu_ld + +AS_IF([$ac_aux_dir/config.rpath "$host" > $2],[:],[AC_MSG_ERROR([unable to execute $ac_aux_dir/config.rpath])]) + +C_LINKPATH_SHL="" +AC_SUBST([C_LINKPATH_SHL]) + +rm -f conftest.out + +# restore the old values +PAC_POP_FLAG([with_gnu_ld]) +PAC_POP_FLAG([LD]) +PAC_POP_FLAG([LDFLAGS]) +PAC_POP_FLAG([GCC]) +PAC_POP_FLAG([CC]) + +AC_MSG_RESULT([done (results in $2)]) +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_shm.m4 b/3rd-party/romio341/mpl/confdb/aclocal_shm.m4 new file mode 100644 index 0000000000000000000000000000000000000000..8560b4efcd0eab53a09e28b37a6ba65fd14a0d5b --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_shm.m4 @@ -0,0 +1,56 @@ +dnl +dnl Definitions for using shared memory +dnl + +dnl/*D +dnl PAC_ARG_SHARED_MEMORY - add --with-shared-memory=kind to configure +dnl +dnl Synopsis: +dnl PAC_ARG_SHARED_MEMORY +dnl +dnl Output effects: +dnl Adds '--with-shared-memory' to the command line. Checks for available +dnl shared memory functionality. +dnl +dnl Supported values of 'kind' include \: +dnl+ auto - default +dnl. mmap - use mmap and munmap +dnl- sysv - use sysv shared memory functions +dnl D*/ +AC_DEFUN([PAC_ARG_SHARED_MEMORY],[ + +# check how to allocate shared memory +AC_ARG_WITH(shared-memory, + AC_HELP_STRING([--with-shared-memory[=auto|sysv|mmap]], [create shared memory using sysv or mmap (default is auto)]),, + with_shared_memory=auto) + +if test "$with_shared_memory" = auto -o "$with_shared_memory" = mmap; then + found_mmap_funcs=yes + AC_CHECK_FUNCS(mmap munmap, , found_mmap_funcs=no) + if test "$found_mmap_funcs" = yes ; then + with_shared_memory=mmap + AC_DEFINE(USE_MMAP_SHM,1,[Define if we have sysv shared memory]) + AC_MSG_NOTICE([Using a memory-mapped file for shared memory]) + elif test "$with_shared_memory" = mmap ; then + AC_MSG_ERROR([cannot support shared memory: mmap() or munmap() not found]) + fi +fi +if test "$with_shared_memory" = auto -o "$with_shared_memory" = sysv; then + found_sysv_shm_funcs=yes + AC_CHECK_FUNCS(shmget shmat shmctl shmdt, , found_sysv_shm_funcs=no) + if test "$found_sysv_shm_funcs" = yes ; then + with_shared_memory=sysv + AC_DEFINE(USE_SYSV_SHM,1,[Define if we have sysv shared memory]) + AC_MSG_NOTICE([Using SYSV shared memory]) + elif test "$with_shared_memory" = sysv ; then + AC_MSG_ERROR([cannot support shared memory: sysv shared memory functions functions not found]) + fi +fi +if test "$with_shared_memory" = nt ; then + AC_DEFINE(USE_NT_SHM,1,[Define if use Windows shared memory]) +fi + +if test "$with_shared_memory" = "auto" ; then + AC_MSG_ERROR([cannot support shared memory: need either sysv shared memory functions or mmap in order to support shared memory]) +fi +]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_subcfg.m4 b/3rd-party/romio341/mpl/confdb/aclocal_subcfg.m4 new file mode 100644 index 0000000000000000000000000000000000000000..fbd1899f4ddcfff8ae074818cf0996a46042f649 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_subcfg.m4 @@ -0,0 +1,260 @@ +dnl PAC_RESET_ALL_FLAGS - Reset precious flags to those set by the user +AC_DEFUN([PAC_RESET_ALL_FLAGS],[ + if test "$FROM_MPICH" = "yes" ; then + CFLAGS="$USER_CFLAGS" + CPPFLAGS="$USER_CPPFLAGS" + CXXFLAGS="$USER_CXXFLAGS" + FFLAGS="$USER_FFLAGS" + FCFLAGS="$USER_FCFLAGS" + LDFLAGS="$USER_LDFLAGS" + LIBS="$USER_LIBS" + fi +]) + +dnl PAC_RESET_LINK_FLAGS - Reset precious link flags to those set by the user +AC_DEFUN([PAC_RESET_LINK_FLAGS],[ + if test "$FROM_MPICH" = "yes" ; then + LDFLAGS="$USER_LDFLAGS" + LIBS="$USER_LIBS" + fi +]) + +dnl Sandbox configure with additional arguments +dnl Usage: PAC_CONFIG_SUBDIR_ARGS(subdir,configure-args,action-if-success,action-if-failure) +dnl +dnl The subconfigure argument list is created based on "ac_precious_vars" +dnl instead of explicitly use of well-known Makefile variables, like +dnl CC/CFLAGS/CPPFLAGS..., this generalization is effective as long as +dnl calling configure.ac declares the needed variables to be passed down +dnl to subconfigure as "precious" appropriately. The precious variable +dnl can be created in the following ways: +dnl 1) implicit declaration through use of autoconf macros, like +dnl AC_PROG_CC (declares CC/CFLAGS/CPPFLAGS/LIBS/LDFLAGS), or +dnl AC_PROG_F77 (declares F77/FFLAGS/FLIBS) ... +dnl which are in turns invoked by other subconfigure. +dnl When in doubt, check "ac_precious_var" in the calling configure. +dnl 2) explicit "precious" declaration through AC_ARG_VAR. +dnl Without correct "precious" declaration in the calling configure.ac, +dnl there would be variables not being included in the subconfigure +dnl argument list. +dnl +dnl Note: I suspect this DEFUN body is underquoted in places, but it does not +dnl seem to cause problems in practice yet. [goodell@ 2010-05-18] +AC_DEFUN([PAC_CONFIG_SUBDIR_ARGS],[ + pac_dir="$1" + AC_MSG_NOTICE([===== configuring $1 =====]) + + pac_abs_srcdir=`(cd $srcdir && pwd)` + + if test -f $pac_abs_srcdir/$1/setup ; then + AC_MSG_NOTICE([sourcing $pac_abs_srcdir/$1/setup]) + . $pac_abs_srcdir/$1/setup + fi + + # Adapted for MPICH from the autoconf-2.67 implementation of + # AC_CONFIG_SUBDIRS. Search for "MPICH note:" for relevant commentary and + # local modifications. + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. Otherwise relative paths (like --srcdir=.. from + # make distcheck) will be incorrect. + pac_sub_configure_args="$2" + pac_prev= + eval "set x $ac_configure_args" + shift + for pac_arg + do + if test -n "$pac_prev"; then + pac_prev= + continue + fi + case $pac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + pac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + pac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + pac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + # MPICH note: this is a more robust version of the "precious + # variable" propagation code that was present in the previous + # incarnation of this macro + for pac_pvar in $ac_precious_vars ; do + # check if configure argument token contains the + # precious variable, i.e. "name_of_prec_var=". + if ( echo $pac_arg | grep "^$pac_pvar=" >/dev/null 2>&1 ) ; then + # check if current precious variable is set in env + eval pvar_set=\${$pac_pvar+set} + if test "$pvar_set" = "set" ; then + # Append 'name_of_prec_var=value_of_prec_var' + # to the subconfigure arguments list, where + # value_of_prec_var is fetched from the env. + # this also overrides any value set on the command line + eval pac_pval=\${$pac_pvar} + pac_arg="$pac_pvar=$pac_pval" + break + fi + fi + done + case $pac_arg in + *\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; + esac + AS_VAR_APPEND([pac_sub_configure_args], [" '$pac_arg'"]) ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + # MPICH note: see tt#983 for an example of why this is necessary + pac_arg="--prefix=$prefix" + case $pac_arg in + *\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; + esac + pac_sub_configure_args="'$pac_arg' $pac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + pac_sub_configure_args="--silent $pac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + pac_sub_configure_args="--disable-option-checking $pac_sub_configure_args" + + pac_popdir=`pwd` + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$pac_dir" || continue + + # MPICH note: modified to remove the internal "_AS_*" macro usage, also + # msg is already printed at top +dnl _AS_ECHO_LOG([$pac_msg]) +dnl _AS_ECHO([$pac_msg]) + AS_MKDIR_P(["$pac_dir"]) + # MPICH note: we leave this internal macro reference for now. We can clone + # the macro locally if this turns out to be non-portable across several autoconf + # versions. It sets the following variables: ac_builddir, + # ac_top_builddir_sub, ac_top_build_prefix, ac_srcdir, ac_top_srcdir, + # ac_abs_top_builddir, ac_abs_builddir, ac_abs_top_srcdir, ac_abs_srcdir + _AC_SRCDIRS(["$pac_dir"]) + + cd "$pac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + pac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + pac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.ac"; then + # This should be Cygnus configure. + pac_sub_configure=$ac_aux_dir/configure + else + AC_MSG_WARN([no configuration information is in $pac_dir]) + pac_sub_configure= + fi + + # The recursion is here. + if test -n "$pac_sub_configure"; then + # MPICH note: overriding the cache file on purpose to prevent strange + # issues resulting from inter-dir caching +dnl # Make the cache file name correct relative to the subdirectory. +dnl case $cache_file in +dnl [[\\/]]* | ?:[[\\/]]* ) pac_sub_cache_file=$cache_file ;; +dnl *) # Relative name. +dnl pac_sub_cache_file=$ac_top_build_prefix$cache_file ;; +dnl esac + pac_sub_cache_file="/dev/null" + + AC_MSG_NOTICE([running $SHELL $pac_sub_configure $pac_sub_configure_args --cache-file=$pac_sub_cache_file --srcdir=$ac_srcdir]) + # The eval makes quoting arguments work. + # MPICH note: we want to execute the provided actions, not be silent + # or error out if the subconfigure succeeded/failed +dnl eval "\$SHELL \"\$pac_sub_configure\" $pac_sub_configure_args \ +dnl --cache-file=\"\$pac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || +dnl AC_MSG_ERROR([$pac_sub_configure failed for $pac_dir]) + if eval "\$SHELL \"\$pac_sub_configure\" $pac_sub_configure_args \ + --cache-file=\"\$pac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" + then + # restore the current dir for the provided actions + cd "$pac_popdir" + $3 + else + # restore the current dir for the provided actions + cd "$pac_popdir" + $4 + fi + fi + + cd "$pac_popdir" + + AC_MSG_NOTICE([===== done with $1 configure =====]) + + # Check for any localdefs files. These may be created, so we + # look in the local directory first. + if test -f $1/localdefs ; then + AC_MSG_NOTICE([sourcing $1/localdefs]) + . $1/localdefs + elif test -f $pac_abs_srcdir/$1/localdefs ; then + AC_MSG_NOTICE([sourcing $pac_abs_srcdir/$1/localdefs]) + . $pac_abs_srcdir/$1/localdefs + fi +]) + +dnl Sandbox configure +dnl Usage: PAC_CONFIG_SUBDIR(subdir,action-if-success,action-if-failure) +AC_DEFUN([PAC_CONFIG_SUBDIR],[PAC_CONFIG_SUBDIR_ARGS([$1],[],[$2],[$3])]) + +dnl PAC_SUBCFG_EXPAND_SUFFIX_MACRO(MACRO_PREFIX,MACRO_PATH_SUFFIX) +dnl converts the path given by MACRO_PATH_SUFFIX (with '/' chars in it) to one +dnl with '_' chars in it and then appends that to MACRO_PREFIX with '_' in +dnl between. The resulting macro name is then expanded, but with informative +dnl "##" comments before and after the expansion. +dnl +dnl This is intended to be an internal helper macro for the PAC_SUBCFG +dnl implementation. +dnl +dnl XXX DJG FIXME: need to be able to deal with PREREQ macros that potentially +dnl aren't present while having safety for BODY macros when there are +dnl misspellings +AC_DEFUN([PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO],[ +dnl convert path separators into '_', the m4_translit is intentionally unquoted +m4_pushdef([subsys_uscore_name],[$1_]m4_translit([$2],[\/],[__]))dnl +m4_ifdef(m4_defn([subsys_uscore_name]),[],[m4_fatal([macro ]m4_defn([subsys_uscore_name])[ is undefined])])dnl +[##] begin expansion of m4_defn([subsys_uscore_name]) +dnl call the computed routine name with the remaining args +m4_indir(m4_defn([subsys_uscore_name]),m4_shift($@)) +dnl there is intentionally no "dnl" on the previous line to reduce the chance of +dnl a "fi## end expansion" bug when the BODY macro doesn't end in a newline +[##] end expansion of m4_defn([subsys_uscore_name]) +]) + +dnl invokes the PAC_SUBCFG_BODY_foo macro for the "foo" subsys, when "foo" is +dnl passed as the only argument to this macro. The first arg may be the '/' +dnl path version instead of having underscores. +AC_DEFUN([PAC_SUBCFG_CONFIGURE_SUBSYS],[PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO([PAC_SUBCFG_BODY],[$1])]) + +dnl invokes the PAC_SUBCFG_PREREQ_foo macro for the "foo" subsys, when "foo" is +dnl passed as the only argument to this macro. The first arg may be the '/' +dnl path version instead of having underscores. +AC_DEFUN([PAC_SUBCFG_DO_PREREQ],[PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO([PAC_SUBCFG_PREREQ],[$1])]) + +dnl takes no arguments, expands to "foo_bar_baz" when invoked in a file named +dnl "foo/bar/baz/subconfigure.m4" +dnl +dnl This is useful for reducing copy-paste errors when defining PREREQ and BODY +dnl macros. If you tinker with this macro, watch the quoting carefully. +AC_DEFUN([PAC_SUBCFG_AUTO_SUFFIX],[m4_translit(m4_bpatsubst(m4_dquote(__file__),[/[^/]+.m4],[]),[/],[_])]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_threads.m4 b/3rd-party/romio341/mpl/confdb/aclocal_threads.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a506dc18e5080d0d20a625d44c6a5ed836c7b583 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_threads.m4 @@ -0,0 +1,22 @@ +dnl PAC_ARG_THREAD_PACKAGE +dnl - Provide configure option to select a thread package. Defaults to posix. +AC_DEFUN([PAC_ARG_THREAD_PACKAGE], [ + AC_ARG_WITH([thread-package], + [ --with-thread-package=package Thread package to use. Supported thread packages include: + posix or pthreads - POSIX threads (default, if required) + solaris - Solaris threads (Solaris OS only) + abt or argobots - Argobots threads + win - windows threads + uti - POSIX threads plus Utility Thread Offloading library + none - no threads + ],,with_thread_package=posix)]) + +dnl PAC_ARG_POSIX_MUTEX +dnl - Provide configure option to select alternate mutex when posix thread package used. Defaults is to use +dnl pthread mutex. +AC_DEFUN([PAC_ARG_POSIX_MUTEX], [ + AC_ARG_WITH([posix-mutex], + [ --with-posix-mutex=option Posix thread mutex to use. Supported options include: + native - pthread mutex (default) + ticketlock - use ticketlock, a fair lock based on atomics and busyloop + ],,with_posix_mutex=native)]) diff --git a/3rd-party/romio341/mpl/confdb/aclocal_util.m4 b/3rd-party/romio341/mpl/confdb/aclocal_util.m4 new file mode 100644 index 0000000000000000000000000000000000000000..2648be54303d5f15ba5824f403eb7904a9af33a2 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/aclocal_util.m4 @@ -0,0 +1,216 @@ +dnl Nesting safe macros for saving variables +dnl Usage: PAC_PUSH_FLAG(CFLAGS) +AC_DEFUN([PAC_PUSH_FLAG],[ + if test -z "${pac_save_$1_nesting}" ; then + pac_save_$1_nesting=0 + fi + eval pac_save_$1_${pac_save_$1_nesting}='"$$1"' + pac_save_$1_nesting=`expr ${pac_save_$1_nesting} + 1` +]) + +dnl Usage: PAC_POP_FLAG(CFLAGS) +AC_DEFUN([PAC_POP_FLAG],[ + pac_save_$1_nesting=`expr ${pac_save_$1_nesting} - 1` + eval $1="\$pac_save_$1_${pac_save_$1_nesting}" + eval pac_save_$1_${pac_save_$1_nesting}="" +]) + +dnl Usage: PAC_PUSH_ALL_FLAGS +AC_DEFUN([PAC_PUSH_ALL_FLAGS],[ + PAC_PUSH_FLAG(CFLAGS) + PAC_PUSH_FLAG(CPPFLAGS) + PAC_PUSH_FLAG(CXXFLAGS) + PAC_PUSH_FLAG(FFLAGS) + PAC_PUSH_FLAG(FCFLAGS) + PAC_PUSH_FLAG(LDFLAGS) + PAC_PUSH_FLAG(LIBS) +]) + +dnl Usage: PAC_POP_ALL_FLAGS +AC_DEFUN([PAC_POP_ALL_FLAGS],[ + PAC_POP_FLAG(CFLAGS) + PAC_POP_FLAG(CPPFLAGS) + PAC_POP_FLAG(CXXFLAGS) + PAC_POP_FLAG(FFLAGS) + PAC_POP_FLAG(FCFLAGS) + PAC_POP_FLAG(LDFLAGS) + PAC_POP_FLAG(LIBS) +]) + +dnl PAC_PREFIX_FLAG - Save flag with a prefix +dnl Usage: PAC_PREFIX_FLAG(PREFIX, FLAG) +AC_DEFUN([PAC_PREFIX_FLAG],[ + $1_$2=$$2 + export $1_$2 + AC_SUBST($1_$2) +]) + +dnl PAC_PREFIX_ALL_FLAGS - Save flags with a prefix +dnl Usage: PAC_PREFIX_ALL_FLAGS(PREFIX) +AC_DEFUN([PAC_PREFIX_ALL_FLAGS],[ + PAC_PREFIX_FLAG($1, CFLAGS) + PAC_PREFIX_FLAG($1, CPPFLAGS) + PAC_PREFIX_FLAG($1, CXXFLAGS) + PAC_PREFIX_FLAG($1, FFLAGS) + PAC_PREFIX_FLAG($1, FCFLAGS) + PAC_PREFIX_FLAG($1, LDFLAGS) + PAC_PREFIX_FLAG($1, LIBS) + PAC_PREFIX_FLAG($1, EXTRA_LIBS) +]) + +dnl Usage: PAC_APPEND_FLAG([-02], [CFLAGS]) +dnl appends the given argument to the specified shell variable unless the +dnl argument is already present in the variable +AC_DEFUN([PAC_APPEND_FLAG],[ + AC_REQUIRE([AC_PROG_FGREP]) + AS_IF( + [echo "$$2" | $FGREP -e "\<$1\>" >/dev/null 2>&1], + [echo "$2(='$$2') contains '$1', not appending" >&AS_MESSAGE_LOG_FD], + [echo "$2(='$$2') does not contain '$1', appending" >&AS_MESSAGE_LOG_FD + $2="$$2 $1"] + ) +]) + +dnl Usage: PAC_PREPEND_FLAG([-lpthread], [LIBS]) +dnl Prepends the given argument to the specified shell variable unless the +dnl argument is already present in the variable. +dnl +dnl This is typically used for LIBS and similar variables because libraries +dnl should be added in reverse order. +AC_DEFUN([PAC_PREPEND_FLAG],[ + AC_REQUIRE([AC_PROG_FGREP]) + AS_IF( + [echo "$$2" | $FGREP -e "\<$1\>" >/dev/null 2>&1], + [echo "$2(='$$2') contains '$1', not prepending" >&AS_MESSAGE_LOG_FD], + [echo "$2(='$$2') does not contain '$1', prepending" >&AS_MESSAGE_LOG_FD + $2="$1 $$2"] + ) +]) + + +dnl PAC_MKDIRS(path) +dnl Create any missing directories in the path +AC_DEFUN([PAC_MKDIRS],[ +# Build any intermediate directories +for dir in $1 ; do + PAC_PUSH_FLAG([IFS]) + IFS="/" + tmp_curdir="" + for tmp_subdir in $dir ; do + tmp_curdir="${tmp_curdir}$tmp_subdir" + if test ! -d "$tmp_curdir" ; then mkdir "$tmp_curdir" ; fi + tmp_curdir="${tmp_curdir}/" + done + PAC_POP_FLAG([IFS]) +done +]) + +# Find something to use for mkdir -p. Eventually, this will have a +# script for backup. As of autoconf-2.63, AC_PROG_MKDIR_P was broken; +# it was checking to see if it recognized the "version" of mkdir and +# was deciding based on that. This should always be a feature test. +AC_DEFUN([PAC_PROG_MKDIR_P],[ +AC_CACHE_CHECK([whether mkdir -p works], +pac_cv_mkdir_p,[ +pac_cv_mkdir_p=no +rm -rf .tmp +if mkdir -p .tmp/.foo 1>/dev/null 2>&1 ; then + if test -d .tmp/.foo ; then + pac_cv_mkdir_p=yes + fi +fi +rm -rf .tmp +]) +if test "$pac_cv_mkdir_p" = "yes" ; then + MKDIR_P="mkdir -p" + export MKDIR_P +else + AC_MSG_WARN([mkdir -p does not work; the install step may fail]) +fi +AC_SUBST(MKDIR_P) +]) + +dnl Test for a clean VPATH directory. Provide this command with the names +dnl of all of the generated files that might cause problems +dnl (Makefiles won't cause problems because there's no VPATH usage for them) +dnl +dnl Synopsis +dnl PAC_VPATH_CHECK([file-names],[directory-names]) +dnl file-names should be files other than config.status and any header (e.g., +dnl fooconf.h) file that should be removed. It is optional +AC_DEFUN([PAC_VPATH_CHECK],[ +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +date >conftest$$ +# If creating a file in the current directory does not show up in the srcdir +# then we're doing a VPATH build (or something is very wrong) +if test ! -s $srcdir/conftest$$ ; then + pac_dirtyfiles="" + pac_dirtydirs="" + pac_header="" + ifdef([AC_LIST_HEADER],[pac_header=AC_LIST_HEADER]) + for file in config.status $pac_header $1 ; do + if test -f $srcdir/$file ; then + pac_dirtyfiles="$pac_dirtyfiles $file" + fi + done + ifelse($2,,,[ + for dir in $2 ; do + if test -d $srcdir/$dir ; then + pac_dirtydirs="$pac_dirtydirs $dir" + fi + done + ]) + + if test -n "$pac_dirtyfiles" -o -n "$pac_dirtydirs" ; then + # Create a nice message about what to remove + rmmsg="" + if test -n "$pac_dirtyfiles" ; then + rmmsg="files $pac_dirtyfiles" + fi + if test -n "$pac_dirtydirs" ; then + if test -n "$rmmsg" ; then + rmmsg="$rmmsg and directories $pac_dirtydirs" + else + rmmsg="directories $pac_dirtydirs" + fi + fi + if test -f $srcdir/Makefile ; then + AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been + configured. Run "make distclean" in $srcdir first and make sure that the + $rmmsg have been removed.]) + else + AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been + configured. Remove the $rmmsg in $srcdir.]) + fi + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +]) + +dnl PAC_CONF_HEX_TO_DEC(value,out_var) +dnl +dnl Converts the given hexadecimal integer constant to an integer constant and +dnl stores the result in the shell variable given by 'out_var'. +dnl +dnl I think that printf like this will be sufficiently portable, but I don't +dnl have any guarantee of it. If not, we can fall back to AS_VAR_ARITH +dnl and/or AC_COMPUTE_INT (the latter will probably be slow) +AC_DEFUN([PAC_CONV_HEX_TO_DEC],[AS_VAR_SET([$2],[`printf "%d" $1`])]) + +dnl PAC_GET_EXENAME(exe_name, out_exe_name) +dnl +dnl Prepends and appends program prefix and suffix as supplied by --program_prefix +dnl and --program-sufix +AC_DEFUN([PAC_GET_EXENAME],[ +$2=$1 +if test "$program_prefix" != "NONE" ; then + $2="${program_prefix}$$2" +fi +if test "$program_suffix" != "NONE" ; then + $2="$$2$program_suffix" +fi +]) diff --git a/3rd-party/romio341/mpl/confdb/ax_check_posix_regcomp.m4 b/3rd-party/romio341/mpl/confdb/ax_check_posix_regcomp.m4 new file mode 100644 index 0000000000000000000000000000000000000000..e5ba61ce2d928f8bc7f90f009b8356b030a89f96 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/ax_check_posix_regcomp.m4 @@ -0,0 +1,48 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_posix_regcomp.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_POSIX_REGCOMP +# +# DESCRIPTION +# +# Check that the POSIX compliant regular expression compiler is available +# in the POSIX specified manner, and it works. If it fails, we have a +# backup -- use gnu-regex. +# +# LICENSE +# +# Copyright (c) 2008 Bruce Korb <bkorb@gnu.org> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AG_CHECK_POSIX_REGCOMP], [AX_CHECK_POSIX_REGCOMP]) +AC_DEFUN([AX_CHECK_POSIX_REGCOMP],[ + AC_MSG_CHECKING([whether POSIX compliant regcomp()/regexec()]) + AC_CACHE_VAL([ax_cv_posix_regcomp],[ + AC_TRY_RUN([ +#include <sys/types.h> +#include <regex.h> +int main() { + int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE; + regex_t re; + if (regcomp( &re, "^.*$", flags ) != 0) + return 1; + return regcomp( &re, "yes.*|no.*", flags ); +}], + [ax_cv_posix_regcomp=yes],[ax_cv_posix_regcomp=no],[ax_cv_posix_regcomp=no] + ) # end of TRY_RUN]) # end of CACHE_VAL + + AC_MSG_RESULT([$ax_cv_posix_regcomp]) + if test "$ax_cv_posix_regcomp" = "yes"; then + AC_DEFINE(HAVE_POSIX_REGCOMP, 1, + [Define this if POSIX compliant regcomp()/regexec()]) + fi +]) # end of AC_DEFUN of AX_CHECK_POSIX_REGCOMP diff --git a/3rd-party/romio341/mpl/confdb/ax_execinfo.m4 b/3rd-party/romio341/mpl/confdb/ax_execinfo.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0ff5fc0ee9b0b7e8a088cb933a87ec19f224ac19 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/ax_execinfo.m4 @@ -0,0 +1,67 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_execinfo.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_EXECINFO([ACTION-IF-EXECINFO-H-IS-FOUND], [ACTION-IF-EXECINFO-H-IS-NOT-FOUND], [ADDITIONAL-TYPES-LIST]) +# +# DESCRIPTION +# +# Checks for execinfo.h header and if the len parameter/return type can be +# found from a list, also define backtrace_size_t to that type. +# +# By default the list of types to try contains int and size_t, but should +# some yet undiscovered system use e.g. unsigned, the 3rd argument can be +# used for extensions. I'd like to hear of further suggestions. +# +# Executes ACTION-IF-EXECINFO-H-IS-FOUND when present and the execinfo.h +# header is found or ACTION-IF-EXECINFO-H-IS-NOT-FOUND in case the header +# seems unavailable. +# +# Also adds -lexecinfo to LIBS on BSD if needed. +# +# LICENSE +# +# Copyright (c) 2014 Thomas Jahns <jahns@dkrz.de> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_EXECINFO], + [AC_CHECK_HEADERS([execinfo.h]) + AS_IF([test x"$ac_cv_header_execinfo_h" = xyes], + [AC_CACHE_CHECK([size parameter type for backtrace()], + [ax_cv_proto_backtrace_type], + [AC_LANG_PUSH([C]) + for ax_cv_proto_backtrace_type in size_t int m4_ifnblank([$3],[$3 ])none; do + AS_IF([test "${ax_cv_proto_backtrace_type}" = none], + [ax_cv_proto_backtrace_type= ; break]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +#include <execinfo.h> +extern +${ax_cv_proto_backtrace_type} backtrace(void **addrlist, ${ax_cv_proto_backtrace_type} len); +char **backtrace_symbols(void *const *buffer, ${ax_cv_proto_backtrace_type} size); +])], + [break]) + done + AC_LANG_POP([C])])]) + AS_IF([test x${ax_cv_proto_backtrace_type} != x], + [AC_DEFINE_UNQUOTED([backtrace_size_t], [$ax_cv_proto_backtrace_type], + [Defined to return type of backtrace().])]) + AC_SEARCH_LIBS([backtrace],[execinfo]) + AS_IF([test x"${ax_cv_proto_backtrace_type}" != x -a x"$ac_cv_header_execinfo_h" = xyes -a x"$ac_cv_search_backtrace" != xno], + [AC_DEFINE([HAVE_BACKTRACE],[1], + [Defined if backtrace() could be fully identified.]) + ]m4_ifnblank([$1],[$1 +]),m4_ifnblank([$2],[$2 +]))]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: +dnl diff --git a/3rd-party/romio341/mpl/confdb/ax_gcc_func_attribute.m4 b/3rd-party/romio341/mpl/confdb/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000000000000000000000000000000000000..098c9aadff6c9733249015bec3449f9b24616663 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/ax_gcc_func_attribute.m4 @@ -0,0 +1,238 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>. +# +# The macro caches its result in the ax_cv_have_func_attribute_<attribute> +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/3rd-party/romio341/mpl/confdb/ax_gcc_var_attribute.m4 b/3rd-party/romio341/mpl/confdb/ax_gcc_var_attribute.m4 new file mode 100644 index 0000000000000000000000000000000000000000..47635d467e8171f6b75af1aa61562763d96969fe --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/ax_gcc_var_attribute.m4 @@ -0,0 +1,141 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_var_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_VAR_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's variable +# attributes; many other compilers also provide variable attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_VAR_ATTRIBUTE_<ATTRIBUTE>. +# +# The macro caches its result in the ax_cv_have_var_attribute_<attribute> +# variable. +# +# The macro currently supports the following variable attributes: +# +# aligned +# cleanup +# common +# nocommon +# deprecated +# mode +# packed +# tls_model +# unused +# used +# vector_size +# weak +# dllimport +# dllexport +# init_priority +# +# Unsupported variable attributes will be tested against a global integer +# variable and without any arguments given to the attribute itself; the +# result of this check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AC_DEFUN([AX_GCC_VAR_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_var_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [aligned], [ + int foo __attribute__(($1(32))); + ], + [cleanup], [ + int bar(int *t) { return *t; }; + ], + [common], [ + int foo __attribute__(($1)); + ], + [nocommon], [ + int foo __attribute__(($1)); + ], + [deprecated], [ + int foo __attribute__(($1)) = 0; + ], + [mode], [ + long foo __attribute__(($1(word))); + ], + [packed], [ + struct bar { + int baz __attribute__(($1)); + }; + ], + [tls_model], [ + __thread int bar1 __attribute__(($1("global-dynamic"))); + __thread int bar2 __attribute__(($1("local-dynamic"))); + __thread int bar3 __attribute__(($1("initial-exec"))); + __thread int bar4 __attribute__(($1("local-exec"))); + ], + [unused], [ + int foo __attribute__(($1)); + ], + [used], [ + int foo __attribute__(($1)); + ], + [vector_size], [ + int foo __attribute__(($1(16))); + ], + [weak], [ + int foo __attribute__(($1)); + ], + [dllimport], [ + int foo __attribute__(($1)); + ], + [dllexport], [ + int foo __attribute__(($1)); + ], + [init_priority], [ + struct bar { bar() {} ~bar() {} }; + bar b __attribute__(($1(65535/2))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo __attribute__(($1)); + ] + )], [ + m4_case([$1], + [cleanup], [ + int foo __attribute__(($1(bar))) = 0; + foo = foo + 1; + ], + [] + )]) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_VAR_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' variable attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/3rd-party/romio341/mpl/confdb/ax_lib_socket_nsl.m4 b/3rd-party/romio341/mpl/confdb/ax_lib_socket_nsl.m4 new file mode 100644 index 0000000000000000000000000000000000000000..54cad68b4c8cd8faec8f672c5b801225a5558509 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/ax_lib_socket_nsl.m4 @@ -0,0 +1,40 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_SOCKET_NSL +# +# DESCRIPTION +# +# This macro figures out what libraries are required on this platform to +# link sockets programs. +# +# The common cases are not to need any extra libraries, or to need +# -lsocket and -lnsl. We need to avoid linking with libnsl unless we need +# it, though, since on some OSes where it isn't necessary it will totally +# break networking. Unisys also includes gethostbyname() in libsocket but +# needs libnsl for socket(). +# +# LICENSE +# +# Copyright (c) 2008 Russ Allbery <rra@stanford.edu> +# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz> +# Copyright (c) 2008 Warren Young <warren@etr-usa.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL]) +AC_DEFUN([AX_LIB_SOCKET_NSL], +[ + AC_SEARCH_LIBS([gethostbyname], [nsl]) + AC_SEARCH_LIBS([socket], [socket], [], [ + AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], + [], [-lnsl])]) +]) diff --git a/3rd-party/romio341/mpl/confdb/cmd_prefix_config_h.pl b/3rd-party/romio341/mpl/confdb/cmd_prefix_config_h.pl new file mode 100644 index 0000000000000000000000000000000000000000..a7368b396ed5b55362b95627a80b43209f6ce1db --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/cmd_prefix_config_h.pl @@ -0,0 +1,72 @@ +#! /usr/bin/env perl +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +use strict; + +# This script is to be run by AC_CONFIG_COMMANDS in configure.ac. +# USAGE: +# AC_CONFIG_COMMANDS([prefix-config],[perl cmd_prefix_config_h.pl PREFIX input_config.h output_config.h]) +# +# The script will read "input_config.h", and write "output_config.h", adding prefix to every defined macros. This script is a replacement to AX_PREFIX_CONFIG_H. + +sub add_prefix { + my ($name, $prefix) = @_; + if($name=~/^(inline|const|restrict)/){ + # leave c99 keywords alone + } + elsif($name=~/^_/){ + # leave underscore keywords alone, e.g _MINIX + } + elsif($name=~/^$prefix\_/i){ + # avoid double prefix + } + elsif($name=~/^[A-Z0-9_]+$/){ + $name = uc($prefix)."_$name"; + } + else{ + $name = "_".lc($prefix)."_$name"; + } + return $name; +} + +my ($prefix, $config_in, $config_out)=@ARGV; +if(!$prefix){ + die "missing prefix!\n"; +} +if(!$config_in){ + $config_in = "config.h"; +} +if(!$config_out){ + $config_out = $config_in; +} +my @lines; +open In, "$config_in" or die "Can't open $config_in.\n"; +while(<In>){ + if(/^#define\s+(\w+)\s*(.+)/){ + my $name = add_prefix($1, $prefix); + push @lines, "#ifndef $name\n"; + push @lines, "#define $name $2\n"; + push @lines, "#endif\n"; + next; + } + elsif(/^\/\*\s*#undef (\w+)/){ + my $name = add_prefix($1, $prefix); + push @lines, "/* #undef $name */\n"; + next; + } + push @lines, $_; +} +close In; +my $DEFH=uc($config_out); +$DEFH=~s/\W/_/g; +open Out, ">$config_out" or die "Can't write $config_out.\n"; +print Out "#ifndef $DEFH\n"; +print Out "#define $DEFH 1\n\n"; +print Out "\x2f* $config_out. Generated automatically at end of configure. *\x2f\n"; +print Out @lines; +print Out "\x2f* once: $DEFH *\x2f\n"; +print Out "#endif\n"; +close Out; diff --git a/3rd-party/romio341/mpl/confdb/config.rpath b/3rd-party/romio341/mpl/confdb/config.rpath new file mode 100755 index 0000000000000000000000000000000000000000..1effeeecc2aaa6a6a5ae27757318e0e64e0bef44 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/config.rpath @@ -0,0 +1,719 @@ +#! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +# +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2011 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl* | *bgq-linux-xl* ) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-4]]*) + wl= + ;; + *Sun\ F* | *Sun*Fortran* | *Studio*Fortran*) + wl='-Qoption ld ' + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +enable_dtags_flag= +disable_dtags_flag= + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + # use --enable-new-dtags for RUNPATH support, which is required for + # switching between ABI compatible libraries at runtime. + if test "$GCC" = yes; then + enable_dtags_flag="${wl}--enable-new-dtags" + disable_dtags_flag="${wl}--disable-new-dtags" + else + case $cc_basename in ifort*) + enable_dtags_flag="${wl}--enable-new-dtags" + disable_dtags_flag="${wl}--disable-new-dtags" + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +# MPICH modification: we don't prefix with acl_cv_ by default. This +# is causing problems in the stock version of config.rpath as well. +# LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/\1=/' <<EOF + +# How to pass a linker flag through the compiler. +wl="$escaped_wl" + +# Static library suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally "so"). +shlibext="$shlibext" + +# Format of library name prefix. +libname_spec="$escaped_libname_spec" + +# Library names that the linker finds when passed -lNAME. +library_names_spec="$escaped_library_names_spec" + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" + +# Flag to add dtags to allow using runpath instead of rpath +enable_dtags_flag="$enable_dtags_flag" +disable_dtags_flag="$disable_dtags_flag" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="$hardcode_libdir_separator" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct="$hardcode_direct" + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L="$hardcode_minus_L" + +EOF diff --git a/3rd-party/romio341/mpl/confdb/random_r.m4 b/3rd-party/romio341/mpl/confdb/random_r.m4 new file mode 100644 index 0000000000000000000000000000000000000000..8d04a27fc37d9cf1a0a415306edf6d4bf52f9391 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/random_r.m4 @@ -0,0 +1,43 @@ +# serial 5 +dnl Copyright (C) 2008-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_RANDOM_R], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) + if test $ac_cv_header_random_h = no; then + HAVE_RANDOM_H=0 + fi + + AC_CHECK_TYPES([struct random_data], + [], [HAVE_STRUCT_RANDOM_DATA=0], + [[#include <stdlib.h> + #if HAVE_RANDOM_H + # include <random.h> + #endif + ]]) + + dnl On AIX and OSF/1, these functions exist, but with different declarations. + dnl Override them all. + case "$host_os" in + aix* | osf*) + REPLACE_RANDOM_R=1 + ;; + *) + AC_CHECK_FUNCS([random_r]) + if test $ac_cv_func_random_r = no; then + HAVE_RANDOM_R=0 + fi + ;; + esac +]) + +# Prerequisites of lib/random_r.c. +AC_DEFUN([gl_PREREQ_RANDOM_R], [ + : +]) diff --git a/3rd-party/romio341/mpl/confdb/stdlib_h.m4 b/3rd-party/romio341/mpl/confdb/stdlib_h.m4 new file mode 100644 index 0000000000000000000000000000000000000000..19107c4199631631d193f34b5d69eff5548360a6 --- /dev/null +++ b/3rd-party/romio341/mpl/confdb/stdlib_h.m4 @@ -0,0 +1,119 @@ +# stdlib_h.m4 serial 42 +dnl Copyright (C) 2007-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDLIB_H], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_NEXT_HEADERS([stdlib.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> +#if HAVE_SYS_LOADAVG_H +# include <sys/loadavg.h> +#endif +#if HAVE_RANDOM_H +# include <random.h> +#endif + ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt + initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps + posix_openpt ptsname ptsname_r random random_r realpath rpmatch + secure_getenv setenv setstate setstate_r srandom srandom_r + strtod strtoll strtoull unlockpt unsetenv]) +]) + +AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_STDLIB_H_DEFAULTS], +[ + GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) + GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) + GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) + GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) + GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) + GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) + GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) + GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) + GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) + GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) + GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) + GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) + GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) + GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) + HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) + HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) + HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) + HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) + HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) + HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) + HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) + HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) + HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) + HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) + HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) + HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) + HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) + HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) + HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) + HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) + HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) + HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) + HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) + REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) + REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) + REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) + REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) + REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) + REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) + REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) + REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) + REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) + REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) +]) diff --git a/3rd-party/romio341/mpl/configure.ac b/3rd-party/romio341/mpl/configure.ac new file mode 100644 index 0000000000000000000000000000000000000000..6c162862596c4d47a21ae24b80e651f9fef22adc --- /dev/null +++ b/3rd-party/romio341/mpl/configure.ac @@ -0,0 +1,1082 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +AC_PREREQ(2.63) + +AC_INIT([MPL], [0.1]) + +# sanity check that --srcdir was specified correctly +AC_CONFIG_SRCDIR([src/str/mpl_str.c]) + +AC_CONFIG_AUX_DIR(confdb) +AC_CONFIG_MACRO_DIR(confdb) +AM_INIT_AUTOMAKE([subdir-objects] [-Wall -Werror foreign 1.12.3]) + +dnl must come before LT_INIT, which AC_REQUIREs AC_PROG_CC +AC_PROG_CC +AC_PROG_CC_C99 +AM_PROG_CC_C_O + +AC_USE_SYSTEM_EXTENSIONS + +AM_PROG_AR + +LT_PREREQ([2.2.6]) + +# Bug in libtool adds -O2 and -g by default +PAC_PUSH_FLAG([CFLAGS]) +LT_INIT() +PAC_POP_FLAG([CFLAGS]) + +# ---------------------------------------------------------------------------- +# Set default library names if names haven't already been provided +AC_ARG_VAR([MPLLIBNAME],[can be used to override the name of the MPL library (default: "mpl")]) +MPLLIBNAME=${MPLLIBNAME:-"mpl"} +AC_SUBST(MPLLIBNAME) +export MPLLIBNAME + +if test -s "$srcdir/VERSION" ; then + . $srcdir/VERSION + AC_SUBST(libmpl_so_version) +else + AC_MSG_ERROR([Version information not found. Configuration aborted.]) +fi + +AC_CONFIG_HEADER([include/config.h]) +AC_CONFIG_COMMANDS([prefix-config],[perl $srcdir/confdb/cmd_prefix_config_h.pl MPL include/config.h include/mplconfig.h]) + +# Non-verbose make +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_C_CONST +AC_C_RESTRICT +AC_C_INLINE + +PAC_C_MACRO_VA_ARGS +PAC_C_BUILTIN_EXPECT +PAC_C_STATIC_ASSERT + +AC_ARG_ENABLE(embedded, + AC_HELP_STRING([--enable-embedded], [Build MPL in embedded mode (default is no)]), + [embedded=yes], + [embedded=no]) +AM_CONDITIONAL([MPL_EMBEDDED_MODE],[test "x${embedded}" = "xyes"]) + +AC_ARG_ENABLE(g, + AC_HELP_STRING([--enable-g=option], + [ + Control the level of debugging support in MPL. + "option" is a list of comma separated names. Default + is "all". + + none|no - No debugging + log - Enable debug event logging + mem - Enable memory tracing + most|yes|all - All of the above choices (except "none", obviously) + ]),,[enable_g=none]) + +# enable-g +# strip off multiple options, separated by commas +PAC_PUSH_FLAG(IFS) +# Change IFS to process enable_g values; save for use after AC_MSG_WARN +# below to provide single point of maintenance +enable_g_IFS="," +IFS="$enable_g_IFS" +for option in $enable_g ; do + case "$option" in + log) + enable_g_log=yes + ;; + + mem|memarena) + enable_g_mem=yes + ;; + + most|yes|all) + enable_g_log=yes + enable_g_mem=yes + ;; + + no|none) + ;; + + *) + # Default IFS required by AC_MSG_WARN + PAC_POP_FLAG(IFS) + AC_MSG_WARN([Unknown value $option for enable-g]) + # Restore previous IFS to process any remaining enable_g values + PAC_PUSH_FLAG(IFS) + IFS="$enable_g_IFS" + ;; + esac +done +PAC_POP_FLAG(IFS) + +if test "$enable_g_log" = "yes" ; then + AC_DEFINE([USE_DBG_LOGGING],[1],[Define to enable logging macros]) +fi + +if test "$enable_g_mem" = "yes" ; then + AC_DEFINE([USE_MEMORY_TRACING],[1],[Define to enable memory tracing]) +fi + + +# support gcov test coverage information +PAC_ENABLE_COVERAGE + +# check for compiler support for the __typeof() extension +AC_CACHE_CHECK([whether the compiler supports __typeof(variable)], + [pac_cv_have___typeof], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[double foo = 0.0; __typeof(foo) bar = 1.0;]])], + [pac_cv_have___typeof=yes], + [pac_cv_have___typeof=no])] +) +if test "$pac_cv_have___typeof" = "yes" ; then + AC_DEFINE([HAVE___TYPEOF],[1],[defined if the C compiler supports __typeof(variable)]) +fi + +dnl Check if the necessary headers are available +AC_CHECK_HEADERS(stdio.h stdlib.h string.h stdarg.h ctype.h sys/types.h sys/uio.h execinfo.h unistd.h errno.h windows.h sys/mman.h) + +# A C99 compliant compiler should have inttypes.h for fixed-size int types +AC_CHECK_HEADERS(inttypes.h stdint.h) +AC_HEADER_STDBOOL + +AC_ARG_ENABLE(fast, +[ --enable-fast=option - Control the level of fast execution supported by MPL. + alwaysinline - Force compiler to always inline functions with MPL_STATIC_INLINE_PREFIX|SUFFIX + all|yes - Same as "alwaysinline" + none - Disable alwaysinline (default) +],,enable_fast=none) + +# enable-fast +# only alwaysinline option is valid but still need break down multiple options +# transferred from MPICH separated by commas +enable_fast_alwaysinline=no +save_IFS="$IFS" +IFS="," +for option in $enable_fast ; do + case "$option" in + alwaysinline) + enable_fast_alwaysinline=yes + ;; + all|yes) + enable_fast_alwaysinline=yes + ;; + *) # do not change default value (no) for other fast options + ;; + esac +done +IFS="$save_IFS" + +if test "$enable_fast_alwaysinline" = "yes"; then + AC_DEFINE(ENABLE_ALWAYS_INLINE,1,[Define if force compiler to always inline functions with MPL_STATIC_INLINE_PREFIX|SUFFIX]) +fi + +####################################################################### +# valgrind support +AC_ARG_WITH([valgrind], +[AS_HELP_STRING([--without-valgrind],[to disable valgrind support (such as because of version issues)])] +[AS_HELP_STRING([--with-valgrind=PATH],[use valgrind headers installed in PATH (default is "yes", use no special path)])], +[],[with_valgrind=yes]) +if test "$with_valgrind" != "no" ; then + savedCPPFLAGS="$CPPFLAGS" + if test "$with_valgrind" != "yes" ; then + # Clients of MPL will either need to respect the localdefs file (as in + # MPICH) or add this entry to their own CPPFLAGS-equivalent. + # (TODO: a pkg-config file would help with this) + PAC_APPEND_FLAG([-I${with_valgrind}], [CPPFLAGS]) + fi + # headers for valgrind client requests + AC_CHECK_HEADERS([valgrind.h memcheck.h valgrind/valgrind.h valgrind/memcheck.h]) + # headers for valgrind-based thread checking tools + # TODO: incorporate ThreadSanitizer as well (include dynamic_annotations.h, + # link with dynamic_annotations.c) + AC_CHECK_HEADERS([helgrind.h valgrind/helgrind.h]) + AC_CHECK_HEADERS([drd.h valgrind/drd.h]) + + # ensure that we have a new enough valgrind with all the client macros + # a preproc test would probably be sufficient, but the LINK_IFELSE helps us + # double-check that we aren't accidentally grabbing the headers for some + # other platform + AC_CACHE_CHECK([whether the valgrind headers are broken or too old], + [pac_cv_have_broken_valgrind], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([ +#if defined(HAVE_VALGRIND_H) && defined(HAVE_MEMCHECK_H) +# include <valgrind.h> +# include <memcheck.h> +#elif defined(HAVE_VALGRIND_VALGRIND_H) && defined(HAVE_VALGRIND_MEMCHECK_H) +# include <valgrind/valgrind.h> +# include <valgrind/memcheck.h> +#else +# error unexpected valgrind header error +#endif +int foo = 10; +char mempool_obj; +],[ +#if defined(VALGRIND_MAKE_MEM_DEFINED) + VALGRIND_MAKE_MEM_NOACCESS(&foo,sizeof(foo)); + VALGRIND_MAKE_MEM_UNDEFINED(&foo,sizeof(foo)); + VALGRIND_MAKE_MEM_DEFINED(&foo,sizeof(foo)); + VALGRIND_CHECK_MEM_IS_DEFINED(&foo,sizeof(foo)); + VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&foo,sizeof(foo)); +#elif defined(VALGRIND_MAKE_READABLE) +/* older (pre-3.2.0), but still supported style */ + VALGRIND_MAKE_READABLE(&foo,sizeof(foo)); + VALGRIND_MAKE_NOACCESS(&foo,sizeof(foo)); + VALGRIND_MAKE_UNDEFINED(&foo,sizeof(foo)); + VALGRIND_CHECK_READABLE(&foo,sizeof(foo)); + VALGRIND_CHECK_WRITEABLE(&foo,sizeof(foo)); +#else +#error missing essential valgrind client macros +#endif + VALGRIND_CREATE_BLOCK(&foo,sizeof(foo),"description"); + if (RUNNING_ON_VALGRIND) ++foo; + VALGRIND_PRINTF_BACKTRACE("testing: %s","valgrind support"); + VALGRIND_CREATE_MEMPOOL(&mempool_obj,0,0); + VALGRIND_MEMPOOL_ALLOC(&mempool_obj,&foo,sizeof(foo)); + VALGRIND_MEMPOOL_FREE(&mempool_obj,&foo); + VALGRIND_DESTROY_MEMPOOL(&mempool_obj); +]) dnl end PROGRAM + ], + [pac_cv_have_broken_valgrind=no], dnl end if-true + [pac_cv_have_broken_valgrind=yes] dnl end if-false + )] dnl end IFELSE + ) dnl end CACHE_CHECK + + if test "$pac_cv_have_broken_valgrind" = "yes" ; then + AC_DEFINE([HAVE_BROKEN_VALGRIND],[1],[define if valgrind is old and/or broken compared to what we are expecting]) + CPPFLAGS="$savedCPPFLAGS" + fi +fi + + +####################################################################### +## TIMER CODE +####################################################################### + +# ---------------------------------------------------------------------------- +# Support for timers. The following code processes the +# --enable-timer-type=name argument and selects the timer based on +# both that field and what configure is able to determine is available. +# The file src/include/mpl_timer.h is also created. +# ---------------------------------------------------------------------------- + +# clock_gettime is the POSIX gettimeofday +# gethrtime is the Solaris high-resolution timer +dnl +dnl Specific checks that a function works correctly +dnl +dnl Now that we know what the options are, choose the timer to use +dnl +dnl The default preference is +dnl Solaris gethrtime +dnl Posix clock_gettime +dnl Unix gettimeofday (one of two versions) +dnl +dnl Also available are various hardware time stamps +dnl Linux-x86 cycle counter +dnl Powerpc-64bit timebase cycle counter +dnl +dnl We also allow --enable-timer-type=name to select a timer type +AC_ARG_ENABLE(timer-type, +[ --enable-timer-type=name - Select the timer to use for MPI_Wtime and + internal timestamps. + ppc64_cycle - Powerpc-64bit; returns cycle counts using timebase register + gethrtime - Solaris timer (Solaris systems only) + clock_gettime - Posix timer (where available) + gettimeofday - Most Unix systems + linux86_cycle - Linux x86; returns cycle counts, not time in seconds* + gcc_ia64_cycle - IPF ar.itc timer* + mach_absolute_time - Mach absolute time (alternative to clock_gettime + for OSX) + + *Note that the cycle timers are intended to be used by + developers for internal low-level timing. Normal users should + not use these as they are not guaranteed to be accurate in + certain situations. +],timer_type=$enable_timer_type) + +## The user did not specify a timer type. Try to find a sane option +## that is supported by the platform. +if test -z "$timer_type" ; then + # Try to pick a timer based on what is available + AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime mach_absolute_time gettimeofday) + if test "$ac_cv_func_gethrtime" = "yes" ; then + # Sigh. The Solaris include files do not define hrtime_t + # Before we accept this choice, make sure that we can + # do arithmetic with hrtime_t . + AC_CACHE_CHECK([that hrtime_t is properly defined for gethrtime], + pac_cv_hrtime_works,[ + AC_TRY_COMPILE([ +#include <sys/time.h> +],[hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2;], +pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)]) + # A more ambitious test would look to see if casting an + # hrtime_t to int64_t works, and even more ambitious + # would check whether long or long long was 64 bits (or even + # better, the sizeof hrtime_t). + + # AC_CHECK_FUNCS has false positive when checking whether gethrtime is + # available on Solaris with strict configuration. We must use + # AC_CHECK_DECL to confirm it. + AC_CHECK_DECL(gethrtime) + fi + if test "$ac_cv_func_gethrtime" = "yes" -a \ + "$ac_cv_has_decl_gethrtime" = "yes" -a \ + "$pac_cv_hrtime_works" = "yes" ; then + timer_type=gethrtime + elif test "$ac_cv_func_clock_gettime" = "yes" -a \ + "$ac_cv_func_clock_getres" = "yes" ; then + # Test on both because some systems (e.g., cygwin) provide + # clock_gettime but not clock_getres + timer_type=clock_gettime + elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then + timer_type=mach_absolute_time + elif test "$ac_cv_func_gettimeofday" = "yes" ; then + timer_type=gettimeofday + fi +fi +if test -z "$timer_type" ; then + AC_MSG_ERROR([No timer found]) +fi + +# Check for valid timer and select datatypes for the time stamp +case "$timer_type" in + + gethrtime) + MPL_TIMER_TYPE=hrtime_t + AC_CHECK_FUNC(gethrtime,,[ + AC_MSG_ERROR([Requested timer gethrtime is not available]) +]) + ;; + + clock_gettime) + missing_function=no + AC_SEARCH_LIBS([clock_gettime],[rt],,AC_MSG_ERROR([clock_gettime is not available])) + AC_SEARCH_LIBS([clock_getres],[rt],,AC_MSG_ERROR([clock_getres is not available])) + MPL_TIMER_TYPE="struct timespec" + # AIX does not always define struct timespec (!) + # Make sure that we can use struct timespec + AC_CACHE_CHECK([whether struct timespec is defined in time.h], + pac_cv_struct_timespec_defined,[ + AC_TRY_COMPILE([ +#include <time.h>],[ + struct timespec t;],pac_cv_struct_timespec_defined=yes, + pac_cv_struct_timespec_defined=no) +]) + if test "$pac_cv_struct_timespec_defined" != "yes" ; then + # Try again, but with -D_XOPEN_SOURCE=500 (works for AIX) + AC_CACHE_CHECK([whether struct timespec is defined in time.h with _XOPEN_SOURCE=500], + pac_cv_struct_timespec_defined_with_xopen500,[ + AC_TRY_COMPILE([ +#define _XOPEN_SOURCE 500 +#include <time.h>],[ + struct timespec t;],pac_cv_struct_timespec_defined_with_xopen500=yes, + pac_cv_struct_timespec_defined_with_xopen500=no) +]) + if test "$pac_cv_struct_timespec_defined_with_xopen500" = "yes" ; then + # We need to define _XOPEN_SOURCE=500, but we need to ensure that + # this is done before any include files are loaded. At + # this point it is really too late to add this definition, + # since it may make other tests incompatible. + AC_MSG_ERROR([The available timer requires _XOPEN_SOURCE=500. Add -D_XOPEN_SOURCE=500 to CFLAGS and rerun configure]) + fi + fi + # + # FreeBSD 4.3 incorrectly puts the header into sys/time.h; + # time.h is required (see pages 45 and 46 in the POSIX standard). + # See if we can compile + AC_CACHE_CHECK([for CLOCK_REALTIME defined in time.h],pac_cv_posix_clock_realtime,[ + AC_TRY_COMPILE([ +#include <time.h>],[ + clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes, +pac_cv_posix_clock_realtime=no)]) + if test "$pac_cv_posix_clock_realtime" = "no" ; then + AC_MSG_WARN([POSIX timer requires definitions in time.h]) + # Check for the definition in sys/time.h, which is where + # OpenBSD and FreeBSD have put it by mistake + AC_TRY_COMPILE([ +#include <time.h> +#include <sys/time.h>],[ + clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes, +pac_cv_posix_clock_realtime=no) + if test "$pac_cv_posix_clock_realtime" = yes ; then + AC_MSG_WARN([sys/time.h required for POSIX timer]) + AC_DEFINE(NEEDS_SYS_TIME_H,1,[Define if sys/time.h is required to get timer definitions]) + else + AC_MSG_ERROR([Cannot find the definition of CLOCK_REALTIME for the POSIX timer]) + fi + fi + ;; + + gettimeofday) + MPL_TIMER_TYPE="struct timeval" + # We may have already tested for gettimeofday. If we got a "yes", + # we're good to go + if test "$ac_cv_func_gettimeofday" != "yes" ; then + AC_CHECK_FUNC(gettimeofday,,[ + AC_MSG_ERROR([Requested timer gettimeofday is not available]) +]) + fi + ;; + + linux86_cycle|linux86_cycle_2) + +# The following AC_TRY_RUN statements are needed because x86_64 compilers +# usually know about rdtscp but the cpu may or may not actually implement the +# feature. This is not cross-compile safe, unfortunately. In the long run we +# should allow the user to override this with a configure flag. + AC_CACHE_CHECK([that linux86 cycle counter is available], + pac_cv_linux86_cycle, + AC_TRY_RUN([ +int main() +{ + /* rdtscp */ + long long var, *var_ptr=&var; + __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); + return 0; +} + ],pac_cv_linux86_cycle=rdtscp, + AC_TRY_RUN([[ +int main() +{ + /* cpuid 64 */ + long long var, *var_ptr=&var; + __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); + return 0; +} + ]],pac_cv_linux86_cycle=cpuid_rdtsc64, + AC_TRY_RUN([[[ +int main() +{ + /* cpuid 32 */ + long long var, *var_ptr=&var; + __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); + return 0; +} + ]]],pac_cv_linux86_cycle=cpuid_rdtsc32, + AC_TRY_RUN([[[[ +int main() +{ + /* simple */ + long long var, *var_ptr=&var; + __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); + return 0; +} + ]]]],pac_cv_linux86_cycle=rdtsc, + pac_cv_linux86_cycle=no) + ) + ), +dnl The if-cross-compiling clause from the first AC_TRY_RUN. Hope that if the +dnl compiler knows about the instruction then it's supported by the target +dnl platform. + AC_TRY_COMPILE(,[[ + long long var, *var_ptr=&var; + __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); + ]],pac_cv_linux86_cycle=rdtscp, + AC_TRY_COMPILE(,[[[ + long long var, *var_ptr=&var; + __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); + ]]],pac_cv_linux86_cycle=cpuid_rdtsc64, + AC_TRY_COMPILE(,[[[[ + long long var, *var_ptr=&var; + __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); + ]]]],pac_cv_linux86_cycle=cpuid_rdtsc32, + AC_TRY_COMPILE(,[[[[[ + long long var, *var_ptr=&var; + __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); + ]]]]],pac_cv_linux86_cycle=rdtsc, + pac_cv_linux86_cycle=no) + ) + ) + ) + ) + ) + + case "$pac_cv_linux86_cycle" in + "rdtscp") + AC_DEFINE(LINUX86_CYCLE_RDTSCP,1,[Define which x86 cycle counter to use]) + ;; + "cpuid_rdtsc64") + AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC64,1,[Define which x86 cycle counter to use]) + ;; + "cpuid_rdtsc32") + AC_DEFINE(LINUX86_CYCLE_CPUID_RDTSC32,1,[Define which x86 cycle counter to use]) + ;; + "rdtsc") + AC_DEFINE(LINUX86_CYCLE_RDTSC,1,[Define which x86 cycle counter to use]) + ;; + *) + cpu_gcc_x86_cycle=no + ;; + esac + + if test "$cpu_gcc_x86_cycle" = "no" ; then + AC_MSG_ERROR([Linux86 cycle counter is not available on this system and or with the $CC compiler]) + fi + MPL_TIMER_TYPE="long long" + ;; + + gcc_ia64_cycle) + AC_CACHE_CHECK([that IPF timer is available], +pac_cv_ia64_cycle,[ + AC_TRY_COMPILE(,[ + long var, *var_ptr=&var; +#ifdef __INTEL_COMPILER +#include "ia64regs.h" + var=__getReg(_IA64_REG_AR_ITC); +#else + __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr)); +#endif +],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)]) + if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then + AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler]) + fi + MPL_TIMER_TYPE="long" + ;; + + mach_absolute_time) + AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])]) + AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])]) + MPL_TIMER_TYPE="uint64_t" + ;; + + ppc64_cycle) + AC_CACHE_CHECK([that ppc64 timebase cycle counter is available], + pac_cv_ppc64_cycle,[ + AC_TRY_COMPILE([ + ],[ + unsigned temp; + asm volatile ("mfspr %0,%1" : "=r" (temp) : "i" (0x10D)); + ],pac_cv_ppc64_cycle=yes, + pac_cv_ppc64_cycle=no) + ]) + if test "$pac_cv_ppc64_cycle" != "yes" ; then + AC_MSG_ERROR([The PPC64 cycle counter is not available on this system and or with the $CC compiler]) + fi + MPL_TIMER_TYPE="uint64_t" + ;; + *) + AC_MSG_ERROR([Invalid timer type $timer_type]) + ;; +esac +# Convert timer type to upper case +timer_type=`echo $timer_type | \ + tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +MPL_TIMER_KIND=MPL_TIMER_KIND__$timer_type +AC_SUBST(MPL_TIMER_KIND) +AC_SUBST(MPL_TIMER_TYPE) +AC_MSG_NOTICE([Timer type selected is $timer_type]) + +####################################################################### +## END OF TIMER CODE +####################################################################### + + +####################################################################### +## START OF PROCESSOR YIELD CODE +####################################################################### +# If the user specified a method to use, we check if it's available. +# If a method was not specified, we make a guess based on the OS. The +# default is to use sched_yield() or yield() if one is available, +# otherwise, default to nothing. After that we define the appropriate +# macro. + +AC_CHECK_HEADERS(sched.h) +AC_CHECK_HEADERS(unistd.h) +AC_CHECK_HEADERS(sys/select.h) +AC_CHECK_FUNCS(sched_yield yield usleep sleep select) + +if test "$ac_cv_func_usleep" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <unistd.h>],usleep) +fi + +AC_ARG_ENABLE([yield], + [AS_HELP_STRING([--enable-yield], [choose a method to yield the processor in busy loops. Available methods are: sched_yield, yield, select, usleep, sleep, nothing])], + [AS_CASE([$enableval], + [sched_yield], [AS_IF([test "x$ac_cv_func_sched_yield" != "xyes"], [enable_yield=unavail])], + [yield], [AS_IF([test "x$ac_cv_func_yield" != "xyes"], [enable_yield=unavail])], + [select], [AS_IF([test "x$ac_cv_func_select" != "xyes"], [enable_yield=unavail])], + [usleep], [AS_IF([test "x$ac_cv_func_usleep" != "xyes"], [enable_yield=unavail])], + [sleep], [AS_IF([test "x$ac_cv_func_sleep" != "xyes"], [enable_yield=unavail])], + [nothing|no|none], [], + [AC_MSG_ERROR([Invalid option $enableval for --enable-yield])]) + + AS_IF([test "x$enable_yield" = "xunavail"], + [AC_MSG_ERROR([Yield method $enableval is not available on this platform.])]) + ], + [# none specified by user; make a guess based on os + AS_CASE([$host], + [*-*-darwin*], + [# In Lion, sched_yield worked but none of the other options had any effect + # In Mojave x86_64, sched_yield may yield to threads in thread_wait_barrier which is slow to yield back, + # usleep(0) seems work well. + AS_IF([test "x$ac_cv_func_usleep" = "xyes"], [enable_yield=usleep], + [enable_yield=nothing])], + [*-*-linux*], + [# sched_yield() has been broken in linux since 2.6.23, and no good alternative exists. + enable_yield=nothing], + [# default: just use sched_yield() or yield() + AS_IF([test "x$ac_cv_func_sched_yield" = "xyes"], [enable_yield=sched_yield], + [test "x$ac_cv_func_yield" = "xyes"], [enable_yield=yield], + [enable_yield=nothing])]) + ] +) + +# set the appropriate macro +AS_CASE([$enable_yield], + [sched_yield], + [AC_DEFINE(USE_SCHED_YIELD_FOR_YIELD,1,[Define to use sched_yield to yield processor])], + [yield], + [AC_DEFINE(USE_YIELD_FOR_YIELD,1,[Define to use yield to yield processor])], + [select], + [AC_DEFINE(USE_SELECT_FOR_YIELD,1,[Define to use select to yield processor])], + [usleep], + [AC_DEFINE(USE_USLEEP_FOR_YIELD,1,[Define to use usleep to yield processor])], + [sleep], + [AC_DEFINE(USE_SLEEP_FOR_YIELD,1,[Define to use sleep to yield processor])], + [nothing|no|none], + [AC_DEFINE(USE_NOTHING_FOR_YIELD,1,[Define to use nothing to yield processor])], + [AC_MSG_ERROR([Invalid value $enable_yield for enable_yield.])] +) + +####################################################################### +## END OF PROCESSOR YIELD CODE +####################################################################### + + +####################################################################### +## START OF THREADS CODE +####################################################################### + +PAC_ARG_THREAD_PACKAGE +PAC_ARG_POSIX_MUTEX + +THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_INVALID +case $with_thread_package in + yes|posix|pthreads) + AC_CHECK_HEADERS(pthread.h) + + # If pthreads library is found, just include it on the link line. We don't try + # to test if the C compiler needs it or not, since the C++ or Fortran + # compilers might need it even if the C compiler doesn't + # (nvcc with gfortran, for example). + # + # OSF1 has __pthread_create but not pthread_create (because of + # inconsistencies in the pthread spec). Thus, we look for pthread_key_create + AC_CHECK_LIB([pthread],[pthread_key_create],have_pthreads=yes) + if test "$have_pthreads" = "yes" ; then + PAC_PREPEND_FLAG([-lpthread],[LIBS]) + fi + + AC_CHECK_FUNCS(pthread_yield) + + # this check should come after the AC_CHECK_LIB for -lpthread + AC_CHECK_FUNC([pthread_key_create],[],[AC_MSG_ERROR([unable to find pthreads library])]) + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_POSIX + ;; + uti) + PAC_CHECK_HEADER_LIB_FATAL(uti,uti.h,uti,uti_attr_init) + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_UTI + ;; + solaris) + AC_CHECK_HEADERS(thread.h) + AC_CHECK_FUNCS(thr_yield) + AC_SEARCH_LIBS(thr_create,thread,found=yes,found=no) + if test "$found" != "yes" ; then + AC_MSG_ERROR([unable to find Solaris threads library]) + fi + # FIXME: need to add -mt if using solaris compilers + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_SOLARIS + ;; + win|windows) + with_thread_package=win + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_WIN + AC_MSG_ERROR([The 'win' thread package is not supported via autoconf builds at this time.]) + ;; + abt|argobots) + with_thread_package=argobots + PAC_CHECK_HEADER_LIB_FATAL([argobots], [abt.h], [abt], [ABT_key_create]) + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_ARGOBOTS + ;; + no|none) + with_thread_package=none + THREAD_PACKAGE_NAME=MPL_THREAD_PACKAGE_NONE + ;; + *) + AC_MSG_ERROR([The specified thread package, $with_thread_package, is not supported.]) + ;; +esac + +case $with_posix_mutex in + ticketlock) + POSIX_MUTEX_NAME=MPL_POSIX_MUTEX_TICKETLOCK + ;; + *) + POSIX_MUTEX_NAME=MPL_POSIX_MUTEX_NATIVE + ;; +esac + +AC_DEFINE_UNQUOTED([THREAD_PACKAGE_NAME],[$THREAD_PACKAGE_NAME],[set to the name of the thread package]) +AC_DEFINE_UNQUOTED([POSIX_MUTEX_NAME],[$POSIX_MUTEX_NAME],[set to the choice of the posix mutex]) + +# check for compiler-support for thread-local storage (MPL_TLS) +PAC_CC_CHECK_TLS + +####################################################################### +## END OF THREADS CODE +####################################################################### + +####################################################################### +## START OF PROCESS MUTEX CODE +####################################################################### + +AC_ARG_WITH([proc-mutex-package], +[ --with-proc-mutex-package=package Interprocess mutex package to use. Supported packages include: + posix or pthreads - POSIX threads (default, if required) + none - no interprocess mutex support +],,with_proc_mutex_package=posix) + +if test "${with_proc_mutex_package}" = "no" ; then + with_proc_mutex_package=none +fi +if test "${with_proc_mutex_package}" = "yes" ; then + with_proc_mutex_package=posix +fi + +PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_INVALID +case $with_proc_mutex_package in + posix|pthreads) + if test "${with_proc_mutex_package}" = "pthreads" ; then + with_proc_mutex_package=posix + fi + + # Do not prepend -lpthread again if already checked by thread package + if test "${with_thread_package}" != "posix" ; then + AC_CHECK_HEADERS(pthread.h) + + # If pthreads library is found, just include it on the link line. We don't try + # to test if the C compiler needs it or not, since the C++ or Fortran + # compilers might need it even if the C compiler doesn't + # (nvcc with gfortran, for example). + AC_CHECK_LIB([pthread],[pthread_mutex_init],have_pthreads=yes) + if test "$have_pthreads" = "yes" ; then + PAC_PREPEND_FLAG([-lpthread],[LIBS]) + fi + fi + + # this check should come after the AC_CHECK_LIB for -lpthread + AC_CHECK_FUNC([pthread_mutex_init],[],[AC_MSG_ERROR([unable to find pthreads library])]) + # pthread_mutexattr_setpshared is first released in Issue 5 + AC_CHECK_FUNCS(pthread_mutexattr_setpshared) + + AC_MSG_NOTICE([POSIX will be used for interprocess mutex package.]) + PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_POSIX + ;; + no|none) + with_proc_mutex_package=none + PROC_MUTEX_PACKAGE_NAME=MPL_PROC_MUTEX_PACKAGE_NONE + ;; + *) + AC_MSG_ERROR([The specified interprocess mutex package, $with_proc_mutex_package, is not supported.]) + ;; +esac + +# Define and export the selected interprocess mutex package so that other packages +# know what's used in MPL +AC_DEFINE_UNQUOTED([PROC_MUTEX_PACKAGE_NAME],[$PROC_MUTEX_PACKAGE_NAME],[set to the name of the interprocess mutex package]) +####################################################################### +## END OF PROCESS MUTEX CODE +####################################################################### + +####################################################################### +## START OF PTHREAD MUTEX COMMON CHECK +####################################################################### +if test "${with_thread_package}" = "pthreads" -o "${with_proc_mutex_package}" = "pthreads"; then + # Check for PTHREAD_MUTEX_ERRORCHECK_NP and PTHREAD_MUTEX_ERRORCHECK + AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK_NP], + pac_cv_has_pthread_mutex_errorcheck_np,[ + AC_TRY_COMPILE([#include <pthread.h>], + [int a=PTHREAD_MUTEX_ERRORCHECK_NP;], + pac_cv_has_pthread_mutex_errorcheck_np=yes, + pac_cv_has_pthread_mutex_errorcheck_np=no)]) + AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK], + pac_cv_has_pthread_mutex_errorcheck,[ + AC_TRY_COMPILE([#include <pthread.h>], + [int a=PTHREAD_MUTEX_ERRORCHECK;], + pac_cv_has_pthread_mutex_errorcheck=yes, + pac_cv_has_pthread_mutex_errorcheck=no)]) + + if test "$pac_cv_has_pthread_mutex_errorcheck" = yes ; then + AC_DEFINE(PTHREAD_MUTEX_ERRORCHECK_VALUE,PTHREAD_MUTEX_ERRORCHECK, + [Define to an expression that will result in an error checking mutex type.]) + elif test "$pac_cv_has_pthread_mutex_errorcheck_np" = yes ; then + AC_DEFINE(PTHREAD_MUTEX_ERRORCHECK_VALUE,PTHREAD_MUTEX_ERRORCHECK_NP, + [Define to an expression that will result in an error checking mutex type.]) + fi + + PAC_FUNC_NEEDS_DECL([#include <pthread.h>],pthread_mutexattr_settype) +fi +####################################################################### +## END OF PTHREAD MUTEX COMMON CHECK +####################################################################### + +####################################################################### +## START OF ATOMIC CODE +####################################################################### + +PAC_ARG_ATOMIC_PRIMITIVES + +AC_DEFUN([MPL_ATOMIC_TEST_PROGRAM], [AC_LANG_SOURCE([[ + #include "$1" + int main() + { + struct MPL_atomic_int_t a, b; + int c; + + MPL_atomic_relaxed_store_int(&a, 0); + MPL_atomic_relaxed_store_int(&b, 1); + c = MPL_atomic_relaxed_load_int(&a); + + MPL_atomic_release_store_int(&a, 0); + MPL_atomic_release_store_int(&b, 1); + c = MPL_atomic_acquire_load_int(&a); + + MPL_atomic_fetch_add_int(&a, 10); + MPL_atomic_fetch_sub_int(&a, 10); + + c = MPL_atomic_cas_int(&a, 10, 11); + c = MPL_atomic_swap_int(&a, 10); + + MPL_atomic_write_barrier(); + MPL_atomic_read_barrier(); + MPL_atomic_read_write_barrier(); + + return c; + } + ]])] +) + +dnl MPL_TRY_ATOMIC_HEADER([header file from src/ dir], +dnl [HAVE_ macro suffix],[feature description]) +dnl Does an AC_LINK_IFELSE() to see if the header file works. +AC_DEFUN([MPL_TRY_ATOMIC_HEADER],[ + checked_specified_primitive=yes + AC_MSG_CHECKING([for support for $3]) + + AC_LINK_IFELSE([MPL_ATOMIC_TEST_PROGRAM([$1])], + [AC_DEFINE([HAVE_$2], [1], [Define to 1 if we have support for $3])] + [AC_MSG_RESULT([yes])] + [mpl_atomic_primitives_set=true] + , + [AC_MSG_RESULT([no])] + ) +]) + +AC_CHECK_SIZEOF([void *]) + +PAC_PUSH_FLAG([CFLAGS]) +CFLAGS="$CFLAGS -I${srcdir}/include" +# Add -Werror to favor the option that does not result in warnings. +# Do not add the flag if the compiler doesn't accept -Werror +PAC_C_CHECK_COMPILER_OPTION([-Werror],[CFLAGS="$CFLAGS -Werror"],) +mpl_atomic_primitives_set=false +if test "$with_mpl_atomic_primitives" = "auto" \ + -o "$with_mpl_atomic_primitives" = "gcc_sync"; then + MPL_TRY_ATOMIC_HEADER([mpl_atomic_gcc_sync.h], [GCC_INTRINSIC_SYNC], + [gcc __sync intrinsics]) +fi +if test "$with_mpl_atomic_primitives" = "auto" \ + -o "$with_mpl_atomic_primitives" = "gcc_atomic"; then + MPL_TRY_ATOMIC_HEADER([mpl_atomic_gcc_atomic.h], [GCC_INTRINSIC_ATOMIC], + [gcc __atomic intrinsics]) +fi +if test "$with_mpl_atomic_primitives" = "auto" \ + -o "$with_mpl_atomic_primitives" = "c11"; then + MPL_TRY_ATOMIC_HEADER([mpl_atomic_c11.h], [C11_ATOMICS], + [C11 atomic intrinsics]) +fi +if test "$with_mpl_atomic_primitives" = "auto" \ + -o "$with_mpl_atomic_primitives" = "windows"; then + MPL_TRY_ATOMIC_HEADER([mpl_atomic_nt_intrinsics.h], [NT_INTRINSICS], + [Windows NT atomic intrinsics]) +fi +PAC_POP_FLAG([CFLAGS]) + +if test "$mpl_atomic_primitives_set" = "true" ; then + : # got native atomic support already +elif test "$with_mpl_atomic_primitives" = "auto" \ + -o "$with_mpl_atomic_primitives" = "lock" ; then + AC_DEFINE(USE_LOCK_BASED_PRIMITIVES, 1, + [Define to 1 if mutex-based synchronization is used]) + mpl_atomic_primitives_set=true +elif test "$with_mpl_atomic_primitives" = "no" \ + -o "$with_mpl_atomic_primitives" = "none" ; then + AC_DEFINE(USE_NO_ATOMIC_PRIMITIVES, 1, + [Define to 1 if no atomic primitives are used]) + mpl_atomic_primitives_set=true +fi + +if test "$mpl_atomic_primitives_set" = "false"; then + AC_MSG_ERROR([cannot support atomic primitives (argument: \ +`--with-mpl-atomic-primitives=$with_mpl_atomic_primitives`)]) +fi + +####################################################################### +## END OF ATOMIC CODE +####################################################################### + +####################################################################### +## START OF DBG CODE +####################################################################### + +# mkstemp() is a better replacement for mktemp() +AC_HAVE_FUNCS(mkstemp) +if test "$ac_cv_func_mkstemp" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],mkstemp) +fi +# fdopen() converts from an fd to a FILE* +AC_HAVE_FUNCS(fdopen) +if test "$ac_cv_func_fdopen" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <stdio.h>],fdopen) +fi + +AC_CHECK_FUNCS(getpid) + +####################################################################### +## END OF DBG CODE +####################################################################### + +####################################################################### +## START OF SHM CODE +####################################################################### + +dnl Check for shm +PAC_ARG_SHARED_MEMORY + +####################################################################### +## END OF SHM CODE +####################################################################### + +## Enable creation of libtool-style versioning or no versioning +AC_ARG_ENABLE(versioning, + [AC_HELP_STRING([--enable-versioning],[Enable library versioning])],, + [enable_versioning=yes]) + +if test "$enable_versioning" = "yes" ; then + libmpl_so_versionflags="-version-info \$(libmpl_so_version)" +else + libmpl_so_versionflags="-avoid-version" +fi +export libmpl_so_versionflags +AC_SUBST(libmpl_so_versionflags) + +####################################################################### + +####################################################################### +## START OF GPU CODE +####################################################################### +have_gpu="no" +# Check CUDA availability +PAC_SET_HEADER_LIB_PATH([cuda]) +PAC_CHECK_HEADER_LIB([cuda_runtime_api.h],[cudart],[cudaStreamSynchronize],[have_cudart=yes],[have_cudart=no]) +PAC_CHECK_HEADER_LIB([cuda.h],[cuda],[cuMemGetAddressRange],[have_cuda=yes],[have_cuda=no]) +if test "X${have_cudart}" = "Xyes" -a \ + "X${have_cuda}" = "Xyes" ; then + AC_DEFINE([HAVE_CUDA],[1],[Define if CUDA is available]) + have_gpu="yes" +fi +AM_CONDITIONAL([MPL_HAVE_CUDA],[test "X${have_cudart}" = "Xyes" -a "X${have_cuda}" = "Xyes"]) + +if test "$have_gpu" = "no" ; then + # Check Level Zero availability when no other GPU library is available + PAC_SET_HEADER_LIB_PATH([ze]) + PAC_CHECK_HEADER_LIB([level_zero/ze_api.h],[ze_loader],[zeInit],[have_ze=yes],[have_ze=no]) + if test "X${have_ze}" = "Xyes" ; then + AC_DEFINE([HAVE_ZE],[1],[Define if ZE is available]) + have_gpu="yes" + fi +fi +AM_CONDITIONAL([MPL_HAVE_ZE],[test "X${have_ze}" = "Xyes"]) +####################################################################### +## END OF GPU CODE +####################################################################### + +# Check for strdup +AC_CHECK_FUNCS(strdup) +if test "$ac_cv_func_strdup" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup) +fi + +# Check for snprintf +AC_CHECK_FUNCS(snprintf) +if test "$ac_cv_func_snprintf" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <stdio.h>],snprintf) +fi + +# Check for putenv +AC_CHECK_FUNCS(putenv) +if test "$ac_cv_func_putenv" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],putenv) +fi + +# Check for strerror +AC_CHECK_FUNCS(strerror) +if test "$ac_cv_func_strerror" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <string.h>],strerror) +fi + +# Check for usleep +AC_CHECK_FUNCS(usleep) +if test "$ac_cv_func_usleep" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <unistd.h>],usleep) +fi + +# Check if we can implement MPL_aligned_alloc +AC_CHECK_FUNCS(posix_memalign) +AC_CHECK_FUNCS(aligned_alloc) +if test "$ac_cv_func_aligned_alloc" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],aligned_alloc) +fi +if test "$ac_cv_func_posix_memalign" = "yes" -o "$ac_cv_func_aligned_alloc" = "yes"; then + AC_DEFINE([DEFINE_ALIGNED_ALLOC],[1],[Define to 1 if MPL enables MPL_aligned_alloc.]) +fi + +# Define some configurable constants +AC_ARG_WITH([cacheline], +[--with-cacheline=<N> + Define cacheline size (default is 64)], +[], +[with_cacheline=64]) +if test $with_cacheline -le 0 ; then + AC_MSG_ERROR(Cache line size must be greater than 0) +fi +AC_DEFINE_UNQUOTED([CACHELINE_SIZE],[$with_cacheline], [Define cache-line size.]) + +# Check for execinfo backtrace support +AX_EXECINFO + +AX_LIB_SOCKET_NSL +AC_CHECK_HEADERS(ifaddrs.h arpa/inet.h) +AC_CHECK_FUNCS(inet_ntop getifaddrs) + +dnl Check for ATTRIBUTE +PAC_C_GNU_ATTRIBUTE +AX_GCC_VAR_ATTRIBUTE(aligned) +AX_GCC_VAR_ATTRIBUTE(used) + +dnl Check for fallthrough attribute +PAC_PUSH_ALL_FLAGS +dnl This check requires removing -Wall and -Wextra first or it will fail. Just +dnl clear them all. +CFLAGS="" +AX_GCC_FUNC_ATTRIBUTE(fallthrough) +PAC_POP_ALL_FLAGS + +dnl Final output +AC_CONFIG_FILES([Makefile localdefs include/mpl_timer.h]) +AC_OUTPUT diff --git a/3rd-party/romio341/mpl/include/mpl.h b/3rd-party/romio341/mpl/include/mpl.h new file mode 100644 index 0000000000000000000000000000000000000000..94d7de7ac3a8a0ef24eccb83cb39322c6fbee5d9 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_H_INCLUDED +#define MPL_H_INCLUDED + +#include "mpl_base.h" +#include "mpl_err.h" +/* must come before mpltrmem.h */ +#include "mpl_valgrind.h" +#include "mpl_argstr.h" +#include "mpl_arg_serial.h" +#include "mpl_atomic.h" +#include "mpl_str.h" +#include "mpl_trmem.h" +#include "mpl_env.h" +#include "mpl_sock.h" +#include "mpl_sockaddr.h" +#include "mpl_msg.h" +#include "mpl_iov.h" +#include "mpl_bt.h" +#include "mpl_thread.h" +#include "mpl_timer.h" +#include "mpl_yield.h" +#include "mpl_dbg.h" +#include "mpl_shm.h" +#include "mpl_math.h" +#include "mpl_proc_mutex.h" +#include "mpl_gpu.h" +#include "mpl_gavl.h" + +#endif /* MPL_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_arg_serial.h b/3rd-party/romio341/mpl/include/mpl_arg_serial.h new file mode 100644 index 0000000000000000000000000000000000000000..7d99bf8680d8bf1cf057e006ddba860fe9e95d33 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_arg_serial.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ARG_SERIAL_H_INCLUDED +#define MPL_ARG_SERIAL_H_INCLUDED + +#include "mplconfig.h" + +int MPL_args_serialize(int argc, char **argv, int *len, void **serialized_buf); +int MPL_args_deserialize(int len, const void *serialized_buf, int *argc, char ***argv); + +#endif /* MPL_ARG_SERIAL_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_argstr.h b/3rd-party/romio341/mpl/include/mpl_argstr.h new file mode 100644 index 0000000000000000000000000000000000000000..7fc304d83b9b1ca9122b0b65d062122ec14ac2a9 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_argstr.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ARGSTR_H_INCLUDED +#define MPL_ARGSTR_H_INCLUDED + +#include "mplconfig.h" + +/* Make sure that we have the definitions for the malloc routines and size_t */ +#include <stdio.h> +#include <stdlib.h> +#include "mpl_dbg.h" + +#if defined (MPL_USE_DBG_LOGGING) +extern MPL_dbg_class MPIR_DBG_STRING; +#endif /* MPL_USE_DBG_LOGGING */ + +#define MPL_STR_QUOTE_CHAR '\"' +#define MPL_STR_QUOTE_STR "\"" +#define MPL_STR_DELIM_CHAR '#' +#define MPL_STR_DELIM_STR "#" +#define MPL_STR_ESCAPE_CHAR '\\' +#define MPL_STR_HIDE_CHAR '*' +#define MPL_STR_SEPAR_CHAR '$' +#define MPL_STR_SEPAR_STR "$" + +int MPL_str_get_string_arg(const char *str, const char *key, char *val, int maxlen); +int MPL_str_get_binary_arg(const char *str, const char *key, char *buffer, + int maxlen, int *out_length); +int MPL_str_get_int_arg(const char *str, const char *key, int *val_ptr); +int MPL_str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *key, const char *val); +int MPL_str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *key, + const char *buffer, int length); +int MPL_str_add_int_arg(char **str_ptr, int *maxlen_ptr, const char *key, int val); +int MPL_str_add_string(char **str_ptr, int *maxlen_ptr, const char *val); +int MPL_str_get_string(char **str_ptr, char *val, int maxlen); + +#endif /* MPL_ARGSTR_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic.h b/3rd-party/romio341/mpl/include/mpl_atomic.h new file mode 100644 index 0000000000000000000000000000000000000000..7f68f8990d7604f72daf41cd705dedd4b106526e --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_H_INCLUDED +#define MPL_ATOMIC_H_INCLUDED + +#include "mplconfig.h" +#include <stdint.h> + +typedef struct MPL_atomic_int_t MPL_atomic_int_t; +typedef struct MPL_atomic_int32_t MPL_atomic_int32_t; +typedef struct MPL_atomic_uint32_t MPL_atomic_uint32_t; +typedef struct MPL_atomic_int64_t MPL_atomic_int64_t; +typedef struct MPL_atomic_uint64_t MPL_atomic_uint64_t; +typedef struct MPL_atomic_ptr_t MPL_atomic_ptr_t; + +/* By default, we use stronger atomic sematics for load and store. However, + * the relaxed semantics still can be used where it deemed approprate. + */ +#define MPL_atomic_load_int MPL_atomic_acquire_load_int +#define MPL_atomic_load_int32 MPL_atomic_acquire_load_int32 +#define MPL_atomic_load_uint32 MPL_atomic_acquire_load_uint32 +#define MPL_atomic_load_int64 MPL_atomic_acquire_load_int64 +#define MPL_atomic_load_uint64 MPL_atomic_acquire_load_uint64 +#define MPL_atomic_load_ptr MPL_atomic_acquire_load_ptr +#define MPL_atomic_store_int MPL_atomic_release_store_int +#define MPL_atomic_store_int32 MPL_atomic_release_store_int32 +#define MPL_atomic_store_uint32 MPL_atomic_release_store_uint32 +#define MPL_atomic_store_int64 MPL_atomic_release_store_int64 +#define MPL_atomic_store_uint64 MPL_atomic_release_store_uint64 +#define MPL_atomic_store_ptr MPL_atomic_release_store_ptr + +/* Forward declarations of atomic functions */ +/* MPL_atomic_relaxed_load */ +static int MPL_atomic_relaxed_load_int(const MPL_atomic_int_t * ptr); +static int32_t MPL_atomic_relaxed_load_int32(const MPL_atomic_int32_t * ptr); +static uint32_t MPL_atomic_relaxed_load_uint32(const MPL_atomic_uint32_t * ptr); +static int64_t MPL_atomic_relaxed_load_int64(const MPL_atomic_int64_t * ptr); +static uint64_t MPL_atomic_relaxed_load_uint64(const MPL_atomic_uint64_t * ptr); +static void *MPL_atomic_relaxed_load_ptr(const MPL_atomic_ptr_t * ptr); +/* MPL_atomic_acquire_load */ +static int MPL_atomic_acquire_load_int(const MPL_atomic_int_t * ptr); +static int32_t MPL_atomic_acquire_load_int32(const MPL_atomic_int32_t * ptr); +static uint32_t MPL_atomic_acquire_load_uint32(const MPL_atomic_uint32_t * ptr); +static int64_t MPL_atomic_acquire_load_int64(const MPL_atomic_int64_t * ptr); +static uint64_t MPL_atomic_acquire_load_uint64(const MPL_atomic_uint64_t * ptr); +static void *MPL_atomic_acquire_load_ptr(const MPL_atomic_ptr_t * ptr); +/* MPL_atomic_relaxed_store */ +static void MPL_atomic_relaxed_store_int(MPL_atomic_int_t * ptr, int val); +static void MPL_atomic_relaxed_store_int32(MPL_atomic_int32_t * ptr, int32_t val); +static void MPL_atomic_relaxed_store_uint32(MPL_atomic_uint32_t * ptr, uint32_t val); +static void MPL_atomic_relaxed_store_int64(MPL_atomic_int64_t * ptr, int64_t val); +static void MPL_atomic_relaxed_store_uint64(MPL_atomic_uint64_t * ptr, uint64_t val); +static void MPL_atomic_relaxed_store_ptr(MPL_atomic_ptr_t * ptr, void *val); +/* MPL_atomic_release_store */ +static void MPL_atomic_release_store_int(MPL_atomic_int_t * ptr, int val); + +static void MPL_atomic_release_store_int32(MPL_atomic_int32_t * ptr, int32_t val); +static void MPL_atomic_release_store_uint32(MPL_atomic_uint32_t * ptr, uint32_t val); +static void MPL_atomic_release_store_int64(MPL_atomic_int64_t * ptr, int64_t val); +static void MPL_atomic_release_store_uint64(MPL_atomic_uint64_t * ptr, uint64_t val); +static void MPL_atomic_release_store_ptr(MPL_atomic_ptr_t * ptr, void *val); +/* MPL_atomic_swap */ +static int MPL_atomic_swap_int(MPL_atomic_int_t * ptr, int val); +static int32_t MPL_atomic_swap_int32(MPL_atomic_int32_t * ptr, int32_t val); +static uint32_t MPL_atomic_swap_uint32(MPL_atomic_uint32_t * ptr, uint32_t val); +static int64_t MPL_atomic_swap_int64(MPL_atomic_int64_t * ptr, int64_t val); +static uint64_t MPL_atomic_swap_uint64(MPL_atomic_uint64_t * ptr, uint64_t val); +static void *MPL_atomic_swap_ptr(MPL_atomic_ptr_t * ptr, void *val); +/* MPL_atomic_cas (compare-and-swap) */ +static int MPL_atomic_cas_int(MPL_atomic_int_t * ptr, int oldv, int newv); +static int32_t MPL_atomic_cas_int32(MPL_atomic_int32_t * ptr, int32_t oldv, int32_t newv); +static uint32_t MPL_atomic_cas_uint32(MPL_atomic_uint32_t * ptr, uint32_t oldv, uint32_t newv); +static int64_t MPL_atomic_cas_int64(MPL_atomic_int64_t * ptr, int64_t oldv, int64_t newv); +static uint64_t MPL_atomic_cas_uint64(MPL_atomic_uint64_t * ptr, uint64_t oldv, uint64_t newv); +static void *MPL_atomic_cas_ptr(MPL_atomic_ptr_t * ptr, void *oldv, void *newv); +/* MPL_atomic_fetch_add */ +static int MPL_atomic_fetch_add_int(MPL_atomic_int_t * ptr, int val); +static int32_t MPL_atomic_fetch_add_int32(MPL_atomic_int32_t * ptr, int32_t val); +static uint32_t MPL_atomic_fetch_add_uint32(MPL_atomic_uint32_t * ptr, uint32_t val); +static int64_t MPL_atomic_fetch_add_int64(MPL_atomic_int64_t * ptr, int64_t val); +static uint64_t MPL_atomic_fetch_add_uint64(MPL_atomic_uint64_t * ptr, uint64_t val); +/* MPL_atomic_fetch_sub */ +static int MPL_atomic_fetch_sub_int(MPL_atomic_int_t * ptr, int val); +static int32_t MPL_atomic_fetch_sub_int32(MPL_atomic_int32_t * ptr, int32_t val); +static uint32_t MPL_atomic_fetch_sub_uint32(MPL_atomic_uint32_t * ptr, uint32_t val); +static int64_t MPL_atomic_fetch_sub_int64(MPL_atomic_int64_t * ptr, int64_t val); +static uint64_t MPL_atomic_fetch_sub_uint64(MPL_atomic_uint64_t * ptr, uint64_t val); + +/* MPL_atomic_barrier */ +static void MPL_atomic_write_barrier(void); +static void MPL_atomic_read_barrier(void); +static void MPL_atomic_read_write_barrier(void); +static void MPL_atomic_compiler_barrier(void); + +#if defined(MPL_USE_NO_ATOMIC_PRIMITIVES) +#include "mpl_atomic_none.h" +#elif defined(MPL_HAVE_C11_ATOMICS) +#include "mpl_atomic_c11.h" +#elif defined(MPL_HAVE_GCC_INTRINSIC_ATOMIC) +#include "mpl_atomic_gcc_atomic.h" +#elif defined(MPL_HAVE_GCC_INTRINSIC_SYNC) +#include "mpl_atomic_gcc_sync.h" +#elif defined(MPL_HAVE_NT_INTRINSICS) +#include "mpl_atomic_nt_intrinsics.h" +#elif defined(MPL_USE_LOCK_BASED_PRIMITIVES) +#include "mpl_atomic_by_lock.h" +#else +#error no primitives implementation specified +#endif + +#endif /* MPL_ATOMIC_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_by_lock.h b/3rd-party/romio341/mpl/include/mpl_atomic_by_lock.h new file mode 100644 index 0000000000000000000000000000000000000000..87bb4ea587699fda95a8186100c93a25bef67def --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_by_lock.h @@ -0,0 +1,166 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_BY_LOCK_H_INCLUDED +#define MPL_ATOMIC_BY_LOCK_H_INCLUDED + +#include <stdint.h> +#include <assert.h> +#include <pthread.h> + +/* defined in mpl_atomic.c */ +extern pthread_mutex_t MPLI_emulation_lock; + +#define MPLI_ATOMIC_CS_ENTER() \ + do { \ + pthread_mutex_lock(&MPLI_emulation_lock); \ + } while (0) + +#define MPLI_ATOMIC_CS_EXIT() \ + do { \ + pthread_mutex_unlock(&MPLI_emulation_lock); \ + } while (0) + + +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ +struct MPL_atomic_ ## NAME ## _t { \ + volatile TYPE v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + TYPE val; \ + MPLI_ATOMIC_CS_ENTER(); \ + val = (TYPE)ptr->v; \ + MPLI_ATOMIC_CS_EXIT(); \ + return val; \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + TYPE val; \ + MPLI_ATOMIC_CS_ENTER(); \ + val = (TYPE)ptr->v; \ + MPLI_ATOMIC_CS_EXIT(); \ + return val; \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + MPLI_ATOMIC_CS_ENTER(); \ + ptr->v = val; \ + MPLI_ATOMIC_CS_EXIT(); \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + MPLI_ATOMIC_CS_ENTER(); \ + ptr->v = val; \ + MPLI_ATOMIC_CS_EXIT(); \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + TYPE prev; \ + MPLI_ATOMIC_CS_ENTER(); \ + prev = (TYPE)ptr->v; \ + if (prev == oldv) \ + ptr->v = newv; \ + MPLI_ATOMIC_CS_EXIT(); \ + return prev; \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev; \ + MPLI_ATOMIC_CS_ENTER(); \ + prev = (TYPE)ptr->v; \ + ptr->v = val; \ + MPLI_ATOMIC_CS_EXIT(); \ + return prev; \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev; \ + MPLI_ATOMIC_CS_ENTER(); \ + prev = (TYPE)ptr->v; \ + ptr->v += val; \ + MPLI_ATOMIC_CS_EXIT(); \ + return prev; \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev; \ + MPLI_ATOMIC_CS_ENTER(); \ + prev = (TYPE)ptr->v; \ + ptr->v -= val; \ + MPLI_ATOMIC_CS_EXIT(); \ + return prev; \ +} + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) + +/* int */ +MPLI_ATOMIC_DECL_FUNC_VAL(int, int) +/* int32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32) +/* uint32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32) +/* int64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64) +/* uint64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64) +/* void * */ +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr) +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +/* lock/unlock provides barrier */ +static inline void MPL_atomic_write_barrier(void) +{ + MPLI_ATOMIC_CS_ENTER(); + MPLI_ATOMIC_CS_EXIT(); +} + +static inline void MPL_atomic_read_barrier(void) +{ + MPLI_ATOMIC_CS_ENTER(); + MPLI_ATOMIC_CS_EXIT(); +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + MPLI_ATOMIC_CS_ENTER(); + MPLI_ATOMIC_CS_EXIT(); +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + __asm__ __volatile__("":::"memory"); +} + +#undef MPLI_ATOMIC_CS_ENTER +#undef MPLI_ATOMIC_CS_EXIT + +#endif /* MPL_ATOMIC_BY_LOCK_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_c11.h b/3rd-party/romio341/mpl/include/mpl_atomic_c11.h new file mode 100644 index 0000000000000000000000000000000000000000..7c278ea60aae15853c3a2c8eecad0433df3852d1 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_c11.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_C11_H_INCLUDED +#define MPL_ATOMIC_C11_H_INCLUDED + +#ifdef __INTEL_COMPILER +/* + * Function prototypes of C11 atomic functions in ICC 19.0.4 are different from + * the C11 standard, causing countless "dropping qualifiers" warnings. + * The following pragmas are to suppress these warnings. + */ +#pragma warning(push) +#pragma warning(disable: 2330) +#endif + +#include <stdint.h> +#include <stdatomic.h> + +#if __STDC_VERSION__ >= 201710L +// C17 obsoletes ATOMIC_VAR_INIT. +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } +#else +#define MPLI_ATOMIC_INITIALIZER(val_) { ATOMIC_VAR_INIT(val_) } +#endif + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) \ + MPLI_ATOMIC_INITIALIZER((intptr_t)(val_)) + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) \ +struct MPL_atomic_ ## NAME ## _t { \ + ATOMIC_TYPE v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return (TYPE)atomic_load_explicit(&ptr->v, memory_order_relaxed); \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return (TYPE)atomic_load_explicit(&ptr->v, memory_order_acquire); \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + atomic_store_explicit(&ptr->v, (CAST_TYPE)val, memory_order_relaxed); \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + atomic_store_explicit(&ptr->v, (CAST_TYPE)val, memory_order_release); \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + CAST_TYPE oldv_tmp = (CAST_TYPE)oldv; \ + atomic_compare_exchange_strong_explicit(&ptr->v, &oldv_tmp, \ + (CAST_TYPE)newv, \ + memory_order_acq_rel, \ + memory_order_acquire); \ + return (TYPE)oldv_tmp; \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return (TYPE)atomic_exchange_explicit(&ptr->v, (CAST_TYPE)val, \ + memory_order_acq_rel); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return (TYPE)atomic_fetch_add_explicit(&ptr->v, (CAST_TYPE)val, \ + memory_order_acq_rel); \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return (TYPE)atomic_fetch_sub_explicit(&ptr->v, (CAST_TYPE)val, \ + memory_order_acq_rel); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, CAST_TYPE) + +MPLI_ATOMIC_DECL_FUNC_VAL(int, int, atomic_int, int) +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32, atomic_int_fast32_t, int_fast32_t) +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32, atomic_uint_fast32_t, uint_fast32_t) +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64, atomic_int_fast64_t, int_fast64_t) +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64, atomic_uint_fast64_t, uint_fast64_t) +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr, atomic_intptr_t, intptr_t) +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +static inline void MPL_atomic_write_barrier(void) +{ + atomic_thread_fence(memory_order_release); +} + +static inline void MPL_atomic_read_barrier(void) +{ + atomic_thread_fence(memory_order_acquire); +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + atomic_thread_fence(memory_order_acq_rel); +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + /* atomic_signal_fence performs a compiler barrier without any overhead */ + atomic_signal_fence(memory_order_acq_rel); +} + +#ifdef __INTEL_COMPILER +#pragma warning(pop) +#endif + +#endif /* MPL_ATOMIC_C11_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_gcc_atomic.h b/3rd-party/romio341/mpl/include/mpl_atomic_gcc_atomic.h new file mode 100644 index 0000000000000000000000000000000000000000..36c8dacb7b51872ddf13527a0205e3bc8a387db2 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_gcc_atomic.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_GCC_ATOMIC_H_INCLUDED +#define MPL_ATOMIC_GCC_ATOMIC_H_INCLUDED + +#include <stdint.h> + +#ifdef __SUNPRO_C +/* Solaris Studio 12.6 shows warnings if an argument of __atomic builtins is + * qualified with const or volatile. The following pragma suppresses it. */ +#pragma error_messages (off, E_ARG_INCOMPATIBLE_WITH_ARG_L) +#endif + +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ +struct MPL_atomic_ ## NAME ## _t { \ + TYPE volatile v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return __atomic_load_n(&ptr->v, __ATOMIC_RELAXED); \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return __atomic_load_n(&ptr->v, __ATOMIC_ACQUIRE); \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + __atomic_store_n(&ptr->v, val, __ATOMIC_RELAXED); \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + __atomic_store_n(&ptr->v, val, __ATOMIC_RELEASE); \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + __atomic_compare_exchange_n(&ptr->v, &oldv, newv, 0, __ATOMIC_ACQ_REL, \ + __ATOMIC_ACQUIRE); \ + return oldv; \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return __atomic_exchange_n(&ptr->v, val, __ATOMIC_ACQ_REL); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return __atomic_fetch_add(&ptr->v, val, __ATOMIC_ACQ_REL); \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return __atomic_fetch_sub(&ptr->v, val, __ATOMIC_ACQ_REL); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) + +/* int */ +MPLI_ATOMIC_DECL_FUNC_VAL(int, int) +/* int32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32) +/* uint32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32) +/* int64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64) +/* uint64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64) +/* void * */ +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr) +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +static inline void MPL_atomic_write_barrier(void) +{ + __atomic_thread_fence(__ATOMIC_RELEASE); +} + +static inline void MPL_atomic_read_barrier(void) +{ + __atomic_thread_fence(__ATOMIC_ACQUIRE); +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + __atomic_thread_fence(__ATOMIC_ACQ_REL); +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + /* atomic_signal_fence performs a compiler barrier without any overhead */ + __atomic_signal_fence(__ATOMIC_ACQ_REL); +} + +#ifdef __SUNPRO_C +#pragma error_messages (default, E_ARG_INCOMPATIBLE_WITH_ARG_L) +#endif + +#endif /* MPL_ATOMIC_GCC_ATOMIC_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_gcc_sync.h b/3rd-party/romio341/mpl/include/mpl_atomic_gcc_sync.h new file mode 100644 index 0000000000000000000000000000000000000000..3b1a5ebf53150b937124ca145b14042409c8fbf9 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_gcc_sync.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_GCC_SYNC_H_INCLUDED +#define MPL_ATOMIC_GCC_SYNC_H_INCLUDED + +#include <stdint.h> + +#ifdef __SUNPRO_C +/* Solaris Studio 12.6 shows warnings if an argument of __sync builtins is + * qualified with const or volatile. The following pragma suppresses it. */ +#pragma error_messages (off, E_ARG_INCOMPATIBLE_WITH_ARG_L) +#endif + +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) + +/* The following implementation assumes that loads/stores are atomic on the + * current platform, even though this may not be true at all. */ + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ +struct MPL_atomic_ ## NAME ## _t { \ + TYPE volatile v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return ptr->v; \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + TYPE val = ptr->v; \ + /* Need a full barrier (see https://github.com/pmodels/mpich/pull/4222) */ \ + __sync_synchronize(); \ + return val; \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + ptr->v = val; \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + /* Need a full barrier (see https://github.com/pmodels/mpich/pull/4222) */ \ + __sync_synchronize(); \ + ptr->v = val; \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + return __sync_val_compare_and_swap(&ptr->v, oldv, newv, \ + /* protected variables: */ &ptr->v); \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE cmp; \ + TYPE prev = MPL_atomic_acquire_load_ ## NAME(ptr); \ + do { \ + cmp = prev; \ + prev = MPL_atomic_cas_ ## NAME(ptr, cmp, val); \ + } while (cmp != prev); \ + return prev; \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return __sync_fetch_and_add(&ptr->v, val, \ + /* protected variables: */ &ptr->v); \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return __sync_fetch_and_sub(&ptr->v, val, \ + /* protected variables: */ &ptr->v); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) + +/* int */ +MPLI_ATOMIC_DECL_FUNC_VAL(int, int) +/* int32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32) +/* uint32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32) +/* int64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64) +/* uint64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64) +/* void * */ +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr) +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +static inline void MPL_atomic_write_barrier(void) +{ + __sync_synchronize(); +} + +static inline void MPL_atomic_read_barrier(void) +{ + __sync_synchronize(); +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + __sync_synchronize(); +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + __asm__ __volatile__("":::"memory"); +} + +#ifdef __SUNPRO_C +#pragma error_messages (default, E_ARG_INCOMPATIBLE_WITH_ARG_L) +#endif + +#endif /* MPL_ATOMIC_GCC_SYNC_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_none.h b/3rd-party/romio341/mpl/include/mpl_atomic_none.h new file mode 100644 index 0000000000000000000000000000000000000000..970e87a73e01d5555091eea0593f572692559307 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_none.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_NONE_H_INCLUDED +#define MPL_ATOMIC_NONE_H_INCLUDED + +#include <stdint.h> + +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) + +/* The following implementation assumes that loads/stores are atomic on the + * current platform, even though this may not be true at all. */ + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ +struct MPL_atomic_ ## NAME ## _t { \ + TYPE v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return ptr->v; \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return ptr->v; \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + ptr->v = val; \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + ptr->v = val; \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + TYPE prev = ptr->v; \ + if (prev == oldv) \ + ptr->v = newv; \ + return prev; \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev = ptr->v; \ + ptr->v = val; \ + return prev; \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev = ptr->v; \ + ptr->v += val; \ + return prev; \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + TYPE prev = ptr->v; \ + ptr->v -= val; \ + return prev; \ +} + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME) + +/* int */ +MPLI_ATOMIC_DECL_FUNC_VAL(int, int) +/* int32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32) +/* uint32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32) +/* int64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64) +/* uint64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64) +/* void * */ +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr) +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +/* Null barriers */ +static inline void MPL_atomic_write_barrier(void) +{ + ; +} + +static inline void MPL_atomic_read_barrier(void) +{ + ; +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + ; +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + ; +} + +#endif /* MPL_ATOMIC_NONE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_atomic_nt_intrinsics.h b/3rd-party/romio341/mpl/include/mpl_atomic_nt_intrinsics.h new file mode 100644 index 0000000000000000000000000000000000000000..614bf1f2db21b7313f642b7646dd0575c4151a16 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_atomic_nt_intrinsics.h @@ -0,0 +1,166 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ATOMIC_NT_INTRINSICS_H_INCLUDED +#define MPL_ATOMIC_NT_INTRINSICS_H_INCLUDED + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <intrin.h> + +#define MPLI_ATOMIC_INITIALIZER(val_) { (val_) } + +#define MPL_ATOMIC_INT_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT32_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_INT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#define MPL_ATOMIC_UINT64_T_INITIALIZER(val_) MPLI_ATOMIC_INITIALIZER(val_) +#if MPL_SIZEOF_VOID_P == 4 +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) \ + MPLI_ATOMIC_INITIALIZER((long)(val_)) +#elif MPL_SIZEOF_VOID_P == 8 +#define MPL_ATOMIC_PTR_T_INITIALIZER(val_) \ + MPLI_ATOMIC_INITIALIZER((__int64)(val_)) +#else +#error "MPL_SIZEOF_VOID_P not valid" +#endif + +/* + * NOTE: the current implementations assumes the following: + * - _Interlocked builtins do not support int, uint32_t, uint64_t, and a void + * pointer, so they are internally converted to long, long, __int64, and + * long/__int64, respectively. + * - Any normal read and write satisfy the relaxed memory ordering. + * - Full memory barriers are used for acquire/release loads in a naive way. + * TODO: read-write barriers guarantees nothing about interthread memory + * synchronization (see MSDN + _ReadWriteBarrier). Use std::atomic. + * Someone with more Windows expertise should feel free to improve these. + */ + +#define MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, CAST_FROM_ATOMIC,\ + CAST_TO_ATOMIC, SUFFIX) \ +struct MPL_atomic_ ## NAME ## _t { \ + ATOMIC_TYPE volatile v; \ +}; \ +static inline TYPE MPL_atomic_relaxed_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + return CAST_FROM_ATOMIC(ptr->v); \ +} \ +static inline TYPE MPL_atomic_acquire_load_ ## NAME \ + (const struct MPL_atomic_ ## NAME ## _t * ptr) \ +{ \ + TYPE val = CAST_FROM_ATOMIC(ptr->v); \ + _ReadWriteBarrier(); \ + return val; \ +} \ +static inline void MPL_atomic_relaxed_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + ptr->v = CAST_TO_ATOMIC(val); \ +} \ +static inline void MPL_atomic_release_store_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + _ReadWriteBarrier(); \ + ptr->v = CAST_TO_ATOMIC(val); \ +} \ +static inline TYPE MPL_atomic_cas_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE oldv, TYPE newv) \ +{ \ + return CAST_FROM_ATOMIC(_InterlockedCompareExchange ## SUFFIX \ + ((ATOMIC_TYPE volatile *)&ptr->v, \ + CAST_TO_ATOMIC(newv), CAST_TO_ATOMIC(oldv))); \ +} \ +static inline TYPE MPL_atomic_swap_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return CAST_FROM_ATOMIC(_InterlockedExchange ## SUFFIX \ + ((ATOMIC_TYPE volatile *)&ptr->v, \ + CAST_TO_ATOMIC(val))); \ +} + +#define MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME, ATOMIC_TYPE, CAST_FROM_ATOMIC, \ + CAST_TO_ATOMIC, SUFFIX) \ +static inline TYPE MPL_atomic_fetch_add_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return CAST_FROM_ATOMIC(_InterlockedExchangeAdd ## SUFFIX \ + (&ptr->v, CAST_TO_ATOMIC(val))); \ +} \ +static inline TYPE MPL_atomic_fetch_sub_ ## NAME \ + (struct MPL_atomic_ ## NAME ## _t * ptr, TYPE val) \ +{ \ + return CAST_FROM_ATOMIC(_InterlockedExchangeAdd ## SUFFIX \ + (&ptr->v, -CAST_TO_ATOMIC(val))); \ +} + +#define MPLI_ATOMIC_CAST_FROM_ATOMIC_VAL(TYPE) (TYPE) +#define MPLI_ATOMIC_CAST_TO_ATOMIC_VAL(ATOMIC_TYPE) (ATOMIC_TYPE) +#define MPLI_ATOMIC_CAST_FROM_ATOMIC_PTR(TYPE) (TYPE)(LONG_PTR) +#define MPLI_ATOMIC_CAST_TO_ATOMIC_PTR(ATOMIC_TYPE) (ATOMIC_TYPE)(LONG_PTR) + +#define MPLI_ATOMIC_DECL_FUNC_VAL(TYPE, NAME, ATOMIC_TYPE, SUFFIX) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, \ + MPLI_ATOMIC_CAST_FROM_ATOMIC_VAL(TYPE), \ + MPLI_ATOMIC_CAST_TO_ATOMIC_VAL(ATOMIC_TYPE), SUFFIX) \ + MPLI_ATOMIC_DECL_FUNC_FAA(TYPE, NAME, ATOMIC_TYPE, \ + MPLI_ATOMIC_CAST_FROM_ATOMIC_VAL(TYPE), \ + MPLI_ATOMIC_CAST_TO_ATOMIC_VAL(ATOMIC_TYPE), SUFFIX) + +#define MPLI_ATOMIC_DECL_FUNC_PTR(TYPE, NAME, ATOMIC_TYPE, SUFFIX) \ + MPLI_ATOMIC_DECL_FUNC_COMMON(TYPE, NAME, ATOMIC_TYPE, \ + MPLI_ATOMIC_CAST_FROM_ATOMIC_PTR(TYPE), \ + MPLI_ATOMIC_CAST_TO_ATOMIC_PTR(ATOMIC_TYPE), SUFFIX) + +/* int */ +MPLI_ATOMIC_DECL_FUNC_VAL(int, int, long, /* empty */) +/* int32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int32_t, int32, long, /* empty */) +/* uint32_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint32_t, uint32, long, /* empty */) +/* int64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(int64_t, int64, __int64, 64) +/* uint64_t */ +MPLI_ATOMIC_DECL_FUNC_VAL(uint64_t, uint64, __int64, 64) +/* void * */ +#if MPL_SIZEOF_VOID_P == 4 +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr, long, /* empty */) +#elif MPL_SIZEOF_VOID_P == 8 +MPLI_ATOMIC_DECL_FUNC_PTR(void *, ptr, __int64, 64) +#else +#error "MPL_SIZEOF_VOID_P not valid" +#endif +#undef MPLI_ATOMIC_DECL_FUNC_COMMON +#undef MPLI_ATOMIC_DECL_FUNC_FAA +#undef MPLI_ATOMIC_CAST_FROM_ATOMIC_VAL +#undef MPLI_ATOMIC_CAST_TO_ATOMIC_VAL +#undef MPLI_ATOMIC_CAST_FROM_ATOMIC_PTR +#undef MPLI_ATOMIC_CAST_TO_ATOMIC_PTR +#undef MPLI_ATOMIC_DECL_FUNC_VAL +#undef MPLI_ATOMIC_DECL_FUNC_PTR +/* Barriers */ +static inline void MPL_atomic_write_barrier(void) +{ + _WriteBarrier(); +} + +static inline void MPL_atomic_read_barrier(void) +{ + _ReadBarrier(); +} + +static inline void MPL_atomic_read_write_barrier(void) +{ + _ReadWriteBarrier(); +} + +static inline void MPL_atomic_compiler_barrier(void) +{ + /* FIXME: there must be a more efficient way to implement this. */ + _ReadWriteBarrier(); +} + +#endif /* MPL_ATOMIC_NT_INTRINSICS_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_base.h b/3rd-party/romio341/mpl/include/mpl_base.h new file mode 100644 index 0000000000000000000000000000000000000000..186963b96e912337234f7c1956b4f7c008ae8bdb --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_base.h @@ -0,0 +1,163 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_BASE_H_INCLUDED +#define MPL_BASE_H_INCLUDED + +/* this file splits off the base functionality in MPL, which does not + * depend on any of the exposed features. */ + +#include "mplconfig.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <stdint.h> + +#if defined MPL_HAVE_CTYPE_H +#include <ctype.h> +#endif /* MPL_HAVE_CTYPE_H */ + +#if defined(MPL_HAVE_INTTYPES_H) +#include <inttypes.h> +#endif /* MPL_HAVE_INTTYPES_H */ + +#if defined MPL_HAVE_IFADDRS_H +#include <ifaddrs.h> +#endif /* MPL_HAVE_IFADDRS_H */ + +#if defined MPL_HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif /* MPL_HAVE_ARPA_INET_H */ + +#if !defined ATTRIBUTE +#if defined MPL_HAVE_GCC_ATTRIBUTE +#define ATTRIBUTE(a_) __attribute__(a_) +#else /* MPL_HAVE_GCC_ATTRIBUTE */ +#define ATTRIBUTE(a_) +#endif /* MPL_HAVE_GCC_ATTRIBUTE */ +#endif /* ATTRIBUTE */ + +#define MPL_UNUSED ATTRIBUTE((unused)) +#ifdef MPL_ENABLE_ALWAYS_INLINE +#define MPL_STATIC_INLINE_PREFIX ATTRIBUTE((always_inline)) static inline +#define MPL_STATIC_INLINE_SUFFIX ATTRIBUTE((always_inline)) +#else +#define MPL_STATIC_INLINE_PREFIX static inline +#define MPL_STATIC_INLINE_SUFFIX +#endif + +#ifdef MPL_HAVE_FUNC_ATTRIBUTE_FALLTHROUGH +#define MPL_FALLTHROUGH __attribute__((fallthrough)) +#else +#define MPL_FALLTHROUGH +#endif + +#ifdef MPL_HAVE_VAR_ATTRIBUTE_ALIGNED +#define MPL_ATTR_ALIGNED(x) __attribute__((aligned(x))) +#else +#define MPL_ATTR_ALIGNED(x) +#endif + +#ifdef MPL_HAVE_VAR_ATTRIBUTE_USED +#define MPL_USED __attribute__((used)) +#else +#define MPL_USED +#endif + +/* These likely/unlikely macros provide static branch prediction hints to the + * compiler, if such hints are available. Simply wrap the relevant expression in + * the macro, like this: + * + * if (unlikely(ptr == NULL)) { + * // ... some unlikely code path ... + * } + * + * They should be used sparingly, especially in upper-level code. It's easy to + * incorrectly estimate branching likelihood, while the compiler can often do a + * decent job if left to its own devices. + * + * These macros are not namespaced because the namespacing is cumbersome. + */ +#ifdef MPL_HAVE_BUILTIN_EXPECT +#define unlikely(x_) __builtin_expect(!!(x_),0) +#define likely(x_) __builtin_expect(!!(x_),1) +#else +#define unlikely(x_) (x_) +#define likely(x_) (x_) +#endif + +#ifdef MPL_HAVE_C11__STATIC_ASSERT +#define MPL_static_assert(cond_,msg_) _Static_assert(cond_,msg_) +#else +/* A hack: + When cond_ is false, result in compile-time duplicated case error. + When cond_ is true, compiler should optimize it away. + Since it is compile time error, we don't care (much) about how the error message look. + */ +#define MPL_static_assert(cond_,msg_) \ + do { switch(0) { case 0: case (cond_): default: break; } } while (0) +#endif + +#define MPL_COMPILE_TIME_ASSERT(cond_) MPL_static_assert(cond_, "MPL_COMPILE_TIME_ASSERT failure") + +#define MPL_QUOTE(A) MPL_QUOTE2(A) +#define MPL_QUOTE2(A) #A + +#define MPL_MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MPL_MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* Use this macro for each parameter to a function that is not referenced in + the body of the function */ +#ifdef MPL_HAVE_WINDOWS_H +#define MPL_UNREFERENCED_ARG(a) a +#else +#define MPL_UNREFERENCED_ARG(a) +#endif + +/* macro for finding the enclosing structure of an element */ +#define MPL_container_of(ptr, type, member) (type *)((char *)(ptr) - offsetof(type,member)) + +/* This macro is used to silence warnings from the Mac OS X linker when + * an object file "has no symbols". The unused attribute prevents a + * warning about the unused dummy variable while the used attribute + * prevents the compiler from discarding the symbol altogether. This + * macro should be used at the top of any file that might not define any + * other variables or functions (perhaps due to conditional compilation + * via the preprocessor). A semicolon is expected after each invocation + * of this macro. */ +#define MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING \ + static int MPL_UNIQUE_SYMBOL_NAME(dummy) ATTRIBUTE((unused)) MPL_USED = 0 + +/* we jump through a couple of extra macro hoops to append the line + * number to the variable name in order to reduce the chance of a name + * collision with headers that might be included in the translation + * unit */ +#define MPL_UNIQUE_SYMBOL_NAME(prefix_) MPL_UNIQUE_IMPL1_(prefix_##_unique_L,__LINE__) +#define MPL_UNIQUE_IMPL1_(prefix_,line_) MPL_UNIQUE_IMPL2_(prefix_,line_) +#define MPL_UNIQUE_IMPL2_(prefix_,line_) MPL_UNIQUE_IMPL3_(prefix_,line_) +#define MPL_UNIQUE_IMPL3_(prefix_,line_) prefix_##line_ + +#ifdef MPL_HAVE_STDBOOL_H +#include <stdbool.h> +#else +#ifndef MPL_HAVE__BOOL +#ifdef __cplusplus +typedef bool _Bool; +#else +#define _Bool signed char +#endif +#endif +#define bool _Bool +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 +#endif + +#define MPL_ROUND_UP_ALIGN(a, alignment) (((a) + ((alignment) - 1)) & (~((alignment) - 1))) +#define MPL_ROUND_DOWN_ALIGN(a, alignment) ((a) & (~((alignment) - 1))) + +#endif /* MPL_BASE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_bt.h b/3rd-party/romio341/mpl/include/mpl_bt.h new file mode 100644 index 0000000000000000000000000000000000000000..b39514c454e20d50e10bd150c9e2c8af0656a5d6 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_bt.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + + +#ifndef MPL_BT_H_INCLUDED +#define MPL_BT_H_INCLUDED + +#include "mplconfig.h" +#if defined(__cplusplus) +extern "C" { +#endif + + void MPL_backtrace_show(FILE * output); + +#if defined(__cplusplus) + +} +#endif +#endif /* MPL_BT_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_dbg.h b/3rd-party/romio341/mpl/include/mpl_dbg.h new file mode 100644 index 0000000000000000000000000000000000000000..6f5053198cab5482a17f2b266ca60277a175e320 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_dbg.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_DBG_H_INCLUDED +#define MPL_DBG_H_INCLUDED + +#include "mplconfig.h" +#include <assert.h> + +/* + * Multilevel debugging and tracing macros. + * The design is discussed at + * http://wiki.mpich.org/mpich/index.php/Debug_Event_Logging + * + * Basically, this provide a way to place debugging messages into + * groups (called *classes*), with levels of detail, and arbitrary + * messages. The messages can be turned on and off using environment + * variables and/or command-line options. + */ + +#ifdef MPL_USE_DBG_LOGGING + +#define MPL_DBG_SELECTED(_class, _level) \ + ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) + +#define MPL_DBG_MSG(_class, _level, _string) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 0, "%s", _string); \ + } \ + } + +#define MPL_DBG_MSG_S(_class, _level, _fmat, _string) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 1, _fmat, _string); \ + } \ + } + +#define MPL_DBG_MSG_D(_class, _level, _fmat, _int) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 2, _fmat, _int); \ + } \ + } + +#define MPL_DBG_MSG_P(_class, _level, _fmat, _pointer) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 3, _fmat, _pointer); \ + } \ + } + +#define MPL_DBG_MAXLINE 256 +#define MPL_DBG_FDEST _s,(size_t)MPL_DBG_MAXLINE +/*M + MPL_DBG_MSG_FMT - General debugging output macro + + Notes: + To use this macro, the third argument should be an "sprintf" - style + argument, using MPL_DBG_FDEST as the buffer argument. For example, +.vb + MPL_DBG_MSG_FMT(CMM,VERBOSE,(MPL_DBG_FDEST,"fmat",args...)); +.ve + M*/ + +#define MPL_DBG_MSG_FMT(_class, _level, _fmatargs) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + char _s[MPL_DBG_MAXLINE]; \ + int _ret = MPL_snprintf _fmatargs ; \ + /* by checking _ret, we supress -Wformat-trunction in gcc-8 */ \ + assert(_ret >= 0); \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 0, "%s", _s); \ + } \ + } + +#define MPL_DBG_STMT(_class, _level, _stmt) \ + { \ + if ((_class & MPL_dbg_active_classes) && MPL_DBG_##_level <= MPL_dbg_max_level) { \ + _stmt; \ + } \ + } + +#define MPL_DBG_OUT(_class, _msg) \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 0, "%s", _msg) + +#define MPL_DBG_OUT_FMT(_class,_fmatargs) \ + { \ + char _s[MPL_DBG_MAXLINE]; \ + MPL_snprintf _fmatargs ; \ + MPL_dbg_outevent(__FILE__, __LINE__, _class, 0, "%s", _s); \ + } + +#else +#define MPL_DBG_SELECTED(_class,_level) 0 +#define MPL_DBG_MSG(_class,_level,_string) +#define MPL_DBG_MSG_S(_class,_level,_fmat,_string) +#define MPL_DBG_MSG_D(_class,_level,_fmat,_int) +#define MPL_DBG_MSG_P(_class,_level,_fmat,_int) +#define MPL_DBG_MSG_FMT(_class,_level,_fmatargs) +#define MPL_DBG_STMT(_class,_level,_stmt) +#define MPL_DBG_OUT(_class,_msg) +#define MPL_DBG_OUT_FMT(_class,_fmtargs) +#endif + +typedef unsigned int MPL_dbg_class; + +/* Special constants */ +enum MPL_DBG_LEVEL { + MPL_DBG_TERSE = 0, + MPL_DBG_TYPICAL = 50, + MPL_DBG_VERBOSE = 99 +}; + +extern int MPL_dbg_active_classes; +extern int MPL_dbg_max_level; + +extern MPL_dbg_class MPL_DBG_ROUTINE_ENTER; +extern MPL_dbg_class MPL_DBG_ROUTINE_EXIT; +extern MPL_dbg_class MPL_DBG_ROUTINE; +extern MPL_dbg_class MPL_DBG_ALL; + +MPL_dbg_class MPL_dbg_class_alloc(const char *ucname, const char *lcname); +void MPL_dbg_class_register(MPL_dbg_class cls, const char *ucname, const char *lcname); + +#define MPL_DBG_CLASS_CLR(cls) \ + do { \ + (cls) = 0; \ + } while (0) + +#define MPL_DBG_CLASS_APPEND(out_class, in_class) \ + do { \ + (out_class) |= (in_class); \ + } while (0) + +/* *INDENT-OFF* */ +int MPL_dbg_outevent(const char *, int, int, int, const char *, ...) ATTRIBUTE((format(printf, 5, 6))); +/* *INDENT-ON* */ + +int MPL_dbg_pre_init(int *, char ***); +int MPL_dbg_init(int, int); + +#endif /* MPL_DBG_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_env.h b/3rd-party/romio341/mpl/include/mpl_env.h new file mode 100644 index 0000000000000000000000000000000000000000..95379b645543256b91f0c0649ca2e971365f897f --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_env.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ENV_H_INCLUDED +#define MPL_ENV_H_INCLUDED + +#include "mplconfig.h" + +/* *INDENT-ON* */ +#if defined(__cplusplus) +extern "C" { +#endif +/* *INDENT-OFF* */ + +#if defined(MPL_HAVE_PUTENV) && defined(MPL_NEEDS_PUTENV_DECL) +extern int putenv(char *string); +#endif + +/* Prototypes for the functions to provide uniform access to the environment */ +int MPL_env2int(const char *envName, int *val); +int MPL_env2range(const char *envName, int *lowPtr, int *highPtr); +int MPL_env2bool(const char *envName, int *val); +int MPL_env2str(const char *envName, const char **val); +int MPL_env2double(const char *envName, double *val); +int MPL_putenv(char *name_val); + +/* *INDENT-ON* */ +#if defined(__cplusplus) +} +#endif +/* *INDENT-OFF* */ + +#endif /* MPL_ENV_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_err.h b/3rd-party/romio341/mpl/include/mpl_err.h new file mode 100644 index 0000000000000000000000000000000000000000..67fe570a4b0b657832d3d40b434e15b545aa6556 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_err.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_ERR_H_INCLUDED +#define MPL_ERR_H_INCLUDED + +/* this file defines all the return code all the MPL components */ + +enum { + MPL_SUCCESS = 0, + MPL_ERR_THREAD, + MPL_ERR_PROC_MUTEX_EINTR, + MPL_ERR_PROC_MUTEX_EINVAL, + MPL_ERR_STR_FAIL, + MPL_ERR_STR_NOMEM, + MPL_ERR_STR_TRUNCATED, + MPL_ERR_DBG_INTERN, + MPL_ERR_DBG_OTHER, + MPL_ERR_SHM_INTERN, + MPL_ERR_SHM_INVAL, + MPL_ERR_SHM_NOMEM, + /* The timer code is allowed to return "NOT_INITIALIZED" before it is + * initialized. Once it is initialized, it must always return + * SUCCESS, so the upper layers do not need to check for the return + * code. */ + MPL_ERR_TIMER_NOT_INITIALIZED, + MPL_ERR_GPU_INTERNAL, + MPL_ERR_GPU_NOMEM, + MPL_ERR_NOMEM +}; + +#endif /* MPL_ERR_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_gavl.h b/3rd-party/romio341/mpl/include/mpl_gavl.h new file mode 100644 index 0000000000000000000000000000000000000000..41a465e3d55ab38c2d99a5db7bebe42b8920b958 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_gavl.h @@ -0,0 +1,159 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_GAVL_H_INCLUDED +#define MPL_GAVL_H_INCLUDED + +typedef void *MPL_gavl_tree_t; + +int MPL_gavl_tree_create(void (*free_fn) (void *), MPL_gavl_tree_t * gavl_tree); +int MPL_gavl_tree_insert(MPL_gavl_tree_t gavl_tree, const void *addr, uintptr_t len, + const void *val); +int MPL_gavl_tree_destory(MPL_gavl_tree_t gavl_tree); +int MPL_gavl_tree_delete_range(MPL_gavl_tree_t gavl_tree, const void *addr, uintptr_t len); +int MPL_gavl_tree_delete_start_addr(MPL_gavl_tree_t gavl_tree, const void *addr); +MPL_STATIC_INLINE_PREFIX int MPL_gavl_tree_search(MPL_gavl_tree_t gavl_tree, const void *addr, + uintptr_t len, void **val); + +/* + * We assume AVL tree height will not exceed 64. AVL tree with 64 height in worst case + * can contain 27777890035287 nodes which is far enough for current applications. + * The idea to compute worse case nodes is as follows: + * In worse case, AVL tree with height h_p should have h_p - 1 height left child and + * h_p - 2 height right child; therefore, the worse case nodes N(h_p) = N(h_p - 1) + N(h_p - 2) + 1. + * Since we know N(1) = 1 and N(2) = 2, we can use iteration to compute N(64) = 27777890035287. + */ +#define MPLI_GAVL_MAX_STACK_SIZE 64 + +enum { + MPLI_GAVL_SEARCH_LEFT, + MPLI_GAVL_SEARCH_RIGHT, + MPLI_GAVL_BUFFER_MATCH, + MPLI_GAVL_NO_BUFFER_MATCH +}; + +enum { + /* range search */ + MPLI_GAVL_SUBSET_SEARCH, + MPLI_GAVL_INTERSECTION_SEARCH, + /* address search */ + MPLI_GAVL_START_ADDR_SEARCH +}; + +typedef struct MPLI_gavl_tree_node { + union { + struct { + struct MPLI_gavl_tree_node *parent; + struct MPLI_gavl_tree_node *left; + struct MPLI_gavl_tree_node *right; + } s; + struct MPLI_gavl_tree_node *next; + } u; + uintptr_t height; + uintptr_t addr; + uintptr_t len; + const void *val; +} MPLI_gavl_tree_node_s; + +typedef struct MPLI_gavl_tree { + MPLI_gavl_tree_node_s *root; + void (*gavl_free_fn) (void *); + /* internal stack structure. used to track the traverse trace for + * tree rebalance at node insertion or deletion */ + MPLI_gavl_tree_node_s *stack[MPLI_GAVL_MAX_STACK_SIZE]; + int stack_sp; + /* cur_node points to the starting node of tree rebalance */ + MPLI_gavl_tree_node_s *cur_node; + /* store nodes that are removed from tree but haven't been freed */ + MPLI_gavl_tree_node_s *remove_list; +} MPLI_gavl_tree_s; + +MPL_STATIC_INLINE_PREFIX int MPLI_gavl_subset_cmp_func(MPLI_gavl_tree_node_s * tnode, + uintptr_t ustart, uintptr_t len) +{ + int cmp_ret; + uintptr_t uend = ustart + len; + uintptr_t tstart = tnode->addr; + uintptr_t tend = tnode->addr + tnode->len; + + if (tstart <= ustart && uend <= tend) + cmp_ret = MPLI_GAVL_BUFFER_MATCH; + else if (ustart < tstart) + cmp_ret = MPLI_GAVL_SEARCH_LEFT; + else + cmp_ret = MPLI_GAVL_SEARCH_RIGHT; + + return cmp_ret; +} + +MPL_STATIC_INLINE_PREFIX int MPLI_gavl_intersect_cmp_func(MPLI_gavl_tree_node_s * tnode, + uintptr_t ustart, uintptr_t len) +{ + int cmp_ret; + uintptr_t uend = ustart + len; + uintptr_t tstart = tnode->addr; + uintptr_t tend = tnode->addr + tnode->len; + + if (uend <= tstart) + cmp_ret = MPLI_GAVL_SEARCH_LEFT; + else if (tend <= ustart) + cmp_ret = MPLI_GAVL_SEARCH_RIGHT; + else + cmp_ret = MPLI_GAVL_BUFFER_MATCH; + + return cmp_ret; +} + +MPL_STATIC_INLINE_PREFIX int MPLI_gavl_start_addr_cmp_func(MPLI_gavl_tree_node_s * tnode, + uintptr_t ustart) +{ + int cmp_ret; + uintptr_t tstart = tnode->addr; + + if (tstart == ustart) + cmp_ret = MPLI_GAVL_BUFFER_MATCH; + else if (ustart < tstart) + cmp_ret = MPLI_GAVL_SEARCH_LEFT; + else + cmp_ret = MPLI_GAVL_SEARCH_RIGHT; + + return cmp_ret; +} + +/* + * MPL_gavl_tree_search + * Description: search a node that matches input key (addr, len) and return corresponding + * buffer object. This function is not thread-safe. + * Parameters: + * gavl_tree - (IN) gavl tree object + * addr - (IN) input buffer starting addr + * len - (IN) input buffer length + * val - (OUT) matched buffer object + */ +MPL_STATIC_INLINE_PREFIX int MPL_gavl_tree_search(MPL_gavl_tree_t gavl_tree, const void *addr, + uintptr_t len, void **val) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_node_s *cur_node; + MPLI_gavl_tree_s *tree_ptr = (MPLI_gavl_tree_s *) gavl_tree; + + *val = NULL; + cur_node = tree_ptr->root; + while (cur_node) { + int cmp_ret = MPLI_gavl_subset_cmp_func(cur_node, (uintptr_t) addr, len); + if (cmp_ret == MPLI_GAVL_BUFFER_MATCH) { + *val = (void *) cur_node->val; + break; + } else if (cmp_ret == MPLI_GAVL_SEARCH_LEFT) { + cur_node = cur_node->u.s.left; + } else { + cur_node = cur_node->u.s.right; + } + } + + return mpl_err; +} + +#endif /* MPL_GAVL_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_gpu.h b/3rd-party/romio341/mpl/include/mpl_gpu.h new file mode 100644 index 0000000000000000000000000000000000000000..9fca2eb1c55b2028f5cf3d903992e513312ebccd --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_gpu.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef MPL_GPU_H_INCLUDED +#define MPL_GPU_H_INCLUDED + +#include "mplconfig.h" + +#undef MPL_HAVE_GPU +#ifdef MPL_HAVE_CUDA +#define MPL_HAVE_GPU MPL_GPU_TYPE_CUDA +#include "mpl_gpu_cuda.h" +#elif defined MPL_HAVE_ZE +#define MPL_HAVE_GPU MPL_GPU_TYPE_ZE +#include "mpl_gpu_ze.h" +#else +#include "mpl_gpu_fallback.h" +#endif + +typedef enum { + MPL_GPU_POINTER_UNREGISTERED_HOST = 0, + MPL_GPU_POINTER_REGISTERED_HOST, + MPL_GPU_POINTER_DEV, + MPL_GPU_POINTER_MANAGED +} MPL_pointer_type_t; + +typedef struct { + MPL_pointer_type_t type; + MPL_gpu_device_handle_t device; +} MPL_pointer_attr_t; + +typedef enum { + MPL_GPU_TYPE_NONE = 0, + MPL_GPU_TYPE_CUDA, + MPL_GPU_TYPE_ZE, +} MPL_gpu_type_t; + +#ifndef MPL_HAVE_GPU +/* inline the query function in the fallback path to provide compiler optimization opportunity */ +static inline int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr) +{ + attr->type = MPL_GPU_POINTER_UNREGISTERED_HOST; + attr->device = -1; + + return MPL_SUCCESS; +} + +#endif /* ! MPL_HAVE_GPU */ + +int MPL_gpu_query_support(MPL_gpu_type_t * type); +int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr); + +int MPL_gpu_ipc_handle_create(const void *ptr, MPL_gpu_ipc_mem_handle_t * ipc_handle); +int MPL_gpu_ipc_handle_map(MPL_gpu_ipc_mem_handle_t ipc_handle, MPL_gpu_device_handle_t dev_handle, + void **ptr); +int MPL_gpu_ipc_handle_unmap(void *ptr); + +int MPL_gpu_malloc_host(void **ptr, size_t size); +int MPL_gpu_free_host(void *ptr); +int MPL_gpu_register_host(const void *ptr, size_t size); +int MPL_gpu_unregister_host(const void *ptr); + +int MPL_gpu_malloc(void **ptr, size_t size, MPL_gpu_device_handle_t h_device); +int MPL_gpu_free(void *ptr); + +int MPL_gpu_init(int *device_count, int *max_dev_id_ptr); +int MPL_gpu_finalize(void); + +int MPL_gpu_get_dev_id(MPL_gpu_device_handle_t dev_handle, int *dev_id); +int MPL_gpu_get_dev_handle(int dev_id, MPL_gpu_device_handle_t * dev_handle); +int MPL_gpu_get_global_dev_ids(int *global_ids, int count); +int MPL_gpu_get_buffer_bounds(const void *ptr, void **pbase, uintptr_t * len); + +int MPL_gpu_free_hook_register(void (*free_hook) (void *dptr)); + +#endif /* ifndef MPL_GPU_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_gpu_cuda.h b/3rd-party/romio341/mpl/include/mpl_gpu_cuda.h new file mode 100644 index 0000000000000000000000000000000000000000..49f750c255cbc5f74e39aaa62481da7c439af17c --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_gpu_cuda.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef MPL_GPU_CUDA_H_INCLUDED +#define MPL_GPU_CUDA_H_INCLUDED + +#include "cuda.h" +#include "cuda_runtime_api.h" + +typedef cudaIpcMemHandle_t MPL_gpu_ipc_mem_handle_t; +typedef int MPL_gpu_device_handle_t; +#define MPL_GPU_DEVICE_INVALID -1 + +#endif /* ifndef MPL_GPU_CUDA_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_gpu_fallback.h b/3rd-party/romio341/mpl/include/mpl_gpu_fallback.h new file mode 100644 index 0000000000000000000000000000000000000000..99d0b6c0128ce2c6a93dd74e5eff201e02d6f22c --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_gpu_fallback.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef MPL_GPU_CUDA_H_INCLUDED +#define MPL_GPU_CUDA_H_INCLUDED + +typedef int MPL_gpu_ipc_mem_handle_t; +typedef int MPL_gpu_device_handle_t; +#define MPL_GPU_DEVICE_INVALID -1 + +#endif /* ifndef MPL_GPU_CUDA_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_gpu_ze.h b/3rd-party/romio341/mpl/include/mpl_gpu_ze.h new file mode 100644 index 0000000000000000000000000000000000000000..5521efdf83872de7518a69fe3e0cdbc47ac2b70d --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_gpu_ze.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_GPU_ZE_H_INCLUDED +#define MPL_GPU_ZE_H_INCLUDED + +#include "level_zero/ze_api.h" + +typedef ze_ipc_mem_handle_t MPL_gpu_ipc_mem_handle_t; +typedef ze_device_handle_t MPL_gpu_device_handle_t; +#define MPL_GPU_DEVICE_INVALID NULL + +#endif /* ifndef MPL_GPU_ZE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_iov.h b/3rd-party/romio341/mpl/include/mpl_iov.h new file mode 100644 index 0000000000000000000000000000000000000000..30e4df65386c11de7c1e3431c33b7d6565dc75b3 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_iov.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_IOV_H_INCLUDED +#define MPL_IOV_H_INCLUDED + +#include <stdio.h> + +#include <sys/types.h> /* macs need sys/types.h before uio.h can be included */ +#include <sys/uio.h> + +/* FIXME: How is IOV_LIMIT chosen? */ +#define MPL_IOV_LIMIT 16 + +#endif /* MPL_IOV_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_math.h b/3rd-party/romio341/mpl/include/mpl_math.h new file mode 100644 index 0000000000000000000000000000000000000000..38ba8e2811882ca799181f3d61078efa9ff617f0 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_math.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#if !defined(MPL_MATH_H_INCLUDED) +#define MPL_MATH_H_INCLUDED + +/* *INDENT-ON* */ +#if defined(__cplusplus) +extern "C" { +#endif +/* *INDENT-OFF* */ + +/* Returns the nearest (smaller than or equal to) power of two of a number*/ +static inline int MPL_pof2(int number) +{ + int pof2 = 1; + + while (pof2 <= number) + pof2 <<= 1; + pof2 >>= 1; + + return pof2; +} + +/* Returns non-zero if val is a power of two. If ceil_pof2 is non-NULL, it sets + *ceil_pof2 to the power of two that is just larger than or equal to val. + That is, it rounds up to the nearest power of two. */ +static inline int MPL_is_pof2(int val, int *ceil_pof2) +{ + int pof2 = 1; + + while (pof2 < val) + pof2 *= 2; + if (ceil_pof2) + *ceil_pof2 = pof2; + + if (pof2 == val) + return 1; + else + return 0; +} + +/* Routine to calculate log_k of an integer */ +static inline int MPL_ilog(int k, int number) +{ + int i = 1, p = k - 1; + + for (; p - 1 < number; i++) + p *= k; + + return i; +} + +/* Routing to calculate base^exp for integers */ +static inline int MPL_ipow(int base, int exp) +{ + int result = 1; + + while (exp) { + if (exp & 1) + result *= base; + + exp >>= 1; + base *= base; + } + + return result; +} + +/* get the number at 'digit'th location in base k representation of 'number' */ +static inline int MPL_getdigit(int k, int number, int digit) +{ + return (number / MPL_ipow(k, digit)) % k; +} + +/* set the number at 'digit'the location in base k representation of 'number' to newdigit */ +static inline int MPL_setdigit(int k, int number, int digit, int newdigit) +{ + int res = number; + int lshift = MPL_ipow(k, digit); + res -= MPL_getdigit(k, number, digit) * lshift; + res += newdigit * lshift; + return res; +} + +/* Implements the "mirror permutation" of "bits" low-order bits of an integer "x". + * + * positions 76543210, bits==3 yields 76543012. + */ +ATTRIBUTE((const)) /* tells the compiler that this func only depends on its args + and may be optimized much more aggressively, similar to "pure" */ +static inline int MPL_mirror_permutation(unsigned int x, int bits) +{ + /* a mask for the high order bits that should be copied as-is */ + int high_mask = ~((0x1 << bits) - 1); + int retval = x & high_mask; + int i; + + for (i = 0; i < bits; ++i) { + unsigned int bitval = (x & (0x1 << i)) >> i; /* 0x1 or 0x0 */ + retval |= bitval << ((bits - i) - 1); + } + + return retval; +} + +/* *INDENT-ON* */ +#if defined(__cplusplus) +} +#endif +/* *INDENT-OFF* */ + +#endif /* MPL_MATH_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_msg.h b/3rd-party/romio341/mpl/include/mpl_msg.h new file mode 100644 index 0000000000000000000000000000000000000000..cca8384c0251bef18764a7c77af5a5a1b3e21710 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_msg.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_MSG_H_INCLUDED +#define MPL_MSG_H_INCLUDED + +#include "mpl.h" + +#if defined(MPL_HAVE_MACRO_VA_ARGS) +#define MPL_error_printf(...) fprintf(stderr,__VA_ARGS__) +#else +#define MPL_error_printf printf +#endif + +/* These routines are used to ensure that messages are sent to the + * appropriate output and (eventually) are properly + * internationalized */ +int MPL_usage_printf(const char *str, ...) ATTRIBUTE((format(printf, 1, 2))); +int MPL_msg_printf(const char *str, ...) ATTRIBUTE((format(printf, 1, 2))); +int MPL_internal_error_printf(const char *str, ...) ATTRIBUTE((format(printf, 1, 2))); +int MPL_internal_sys_error_printf(const char *, int, const char *str, + ...) ATTRIBUTE((format(printf, 3, 4))); +void MPL_exit(int); + +#endif /* MPL_MSG_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_posix_mutex_native.h b/3rd-party/romio341/mpl/include/mpl_posix_mutex_native.h new file mode 100644 index 0000000000000000000000000000000000000000..e7f5837c5e84a01deb27bd1360b3856fc530abe6 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_posix_mutex_native.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_POSIX_MUTEX_NATIVE_H_INCLUDED +#define MPL_POSIX_MUTEX_NATIVE_H_INCLUDED + +typedef pthread_mutex_t MPL_thread_mutex_t; +typedef pthread_cond_t MPL_thread_cond_t; + +#if defined(MPL_NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL) +int pthread_mutexattr_settype(pthread_mutexattr_t * attr, int kind); +#endif /* MPL_NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL */ + +/* FIXME: mutex creation and destruction should be implemented as routines + because there is no reason to use macros (these are not on the performance + critical path). Making these macros requires that any code that might use + these must load all of the pthread.h (or other thread library) support. + */ + +/* FIXME: using constant initializer if available */ + +/* FIXME: convert errors to an MPL_THREAD_ERR value */ + +#if !defined(MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE) + +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_mutex_init(mutex_ptr_, NULL); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_mutex_init", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#else /* defined(MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE) */ + +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + pthread_mutexattr_t attr__; \ + \ + pthread_mutexattr_init(&attr__); \ + pthread_mutexattr_settype(&attr__, MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE); \ + err__ = pthread_mutex_init(mutex_ptr_, &attr__); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_mutex_init", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#endif /* defined(MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE) */ + +#define MPL_thread_mutex_destroy(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_mutex_destroy(mutex_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_mutex_destroy", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + + +#define MPL_thread_mutex_lock(mutex_ptr_, err_ptr_, prio_) \ + do { \ + int err__; \ + err__ = pthread_mutex_lock(mutex_ptr_); \ + if (unlikely(err__)) { \ + MPL_internal_sys_error_printf("pthread_mutex_lock", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + } \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_mutex_unlock(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_mutex_unlock(mutex_ptr_); \ + if (unlikely(err__)) { \ + MPL_internal_sys_error_printf("pthread_mutex_unlock", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + } \ + *(int *)(err_ptr_) = err__; \ + } while (0) + + +/* + * Condition Variables + */ + +#define MPL_thread_cond_create(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_cond_init((cond_ptr_), NULL); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_cond_init", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_destroy(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_cond_destroy(cond_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_cond_destroy", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + /* The latest pthread specification says that cond_wait \ + * routines aren't allowed to return EINTR, but some of the \ + * older implementations still do. */ \ + do { \ + err__ = pthread_cond_wait((cond_ptr_), mutex_ptr_); \ + } while (err__ == EINTR); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_cond_wait", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_broadcast(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_cond_broadcast(cond_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_cond_broadcast", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_signal(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_cond_signal(cond_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_cond_signal", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + + +#endif /* MPL_POSIX_MUTEX_NATIVE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_posix_mutex_ticketlock.h b/3rd-party/romio341/mpl/include/mpl_posix_mutex_ticketlock.h new file mode 100644 index 0000000000000000000000000000000000000000..055ccac45d2a5fdde6c5c17ed76eac42b0134712 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_posix_mutex_ticketlock.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_POSIX_MUTEX_TICKETLOCK_H_INCLUDED +#define MPL_POSIX_MUTEX_TICKETLOCK_H_INCLUDED + +#include "mpl_atomic.h" + +#ifdef MPL_HAVE_SCHED_H +#include <sched.h> +#define MPLI_TICKETLOCK_YIELD() sched_yield() +#else +#define MPLI_TICKETLOCK_YIELD() do { } while (0) +#endif + +/* Ticket lock implementation */ + +typedef struct { + MPL_atomic_int_t num; + MPL_atomic_int_t next; +} MPLI_ticket_lock; + +#define MPLI_ticket_lock_init(lock_) \ + do { \ + MPL_atomic_store_int(&(lock_)->num, 0); \ + MPL_atomic_store_int(&(lock_)->next, 0); \ + } while (0) + +#define MPLI_ticket_lock_lock(lock_) \ + do { \ + int ticket = MPL_atomic_fetch_add_int(&(lock_)->num, 1); \ + while (MPL_atomic_load_int(&(lock_)->next) != ticket) { \ + MPLI_TICKETLOCK_YIELD(); \ + } \ + } while (0) + +#define MPLI_ticket_lock_unlock(lock_) \ + do { \ + MPL_atomic_fetch_add_int(&(lock_)->next, 1); \ + } while (0) + +/* MPL wrappers */ + +typedef MPLI_ticket_lock MPL_thread_mutex_t; +typedef int MPL_thread_cond_t; + +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + MPLI_ticket_lock_init(mutex_ptr_); \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_mutex_destroy(mutex_ptr_, err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_mutex_lock(mutex_ptr_, err_ptr_, prio_) \ + do { \ + MPLI_ticket_lock_lock(mutex_ptr_); \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_mutex_unlock(mutex_ptr_, err_ptr_) \ + do { \ + MPLI_ticket_lock_unlock(mutex_ptr_); \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +/* No support for condition variable */ +#define MPL_thread_cond_create(cond_ptr_, err_ptr_) assert(0) +#define MPL_thread_cond_destroy(cond_ptr_, err_ptr_) assert(0) +#define MPL_thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_) assert(0) +#define MPL_thread_cond_broadcast(cond_ptr_, err_ptr_) assert(0) +#define MPL_thread_cond_signal(cond_ptr_, err_ptr_) assert(0) + +#endif /* MPL_POSIX_MUTEX_TICKETLOCK_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_proc_mutex.h b/3rd-party/romio341/mpl/include/mpl_proc_mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..085c4ab94e6bcf826e905307bcf30bf71a7a82b5 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_proc_mutex.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_PROC_MUTEX_H_INCLUDED +#define MPL_PROC_MUTEX_H_INCLUDED + +#include "mplconfig.h" + +/* Define interprocess mutex interface. + * + * The user should always call MPL_proc_mutex_enabled(void) to check if + * the functionality of interprocess mutex is enabled before use. + * It returns 1 if the functionality is enabled, otherwise returns 0. + */ + +/* _INVALID exists to avoid accidental macro evaluations to 0 */ +#define MPL_PROC_MUTEX_PACKAGE_INVALID 0 +#define MPL_PROC_MUTEX_PACKAGE_NONE 1 +#define MPL_PROC_MUTEX_PACKAGE_POSIX 2 + +#if defined(MPL_PROC_MUTEX_PACKAGE_NAME) && (MPL_PROC_MUTEX_PACKAGE_NAME == MPL_PROC_MUTEX_PACKAGE_POSIX) +#include "mpl_proc_mutex_posix.h" +#elif defined(MPL_PROC_MUTEX_PACKAGE_NAME) && (MPL_PROC_MUTEX_PACKAGE_NAME == MPL_PROC_MUTEX_PACKAGE_NONE) +typedef int MPL_proc_mutex_t; +static inline int MPL_proc_mutex_enabled(void) +{ + return 0; /* always disabled */ +} + +#define MPL_proc_mutex_create(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_destroy(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_lock(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_unlock(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#else +#error "proc package (MPL_PROC_MUTEX_PACKAGE_NAME) not defined or unknown" +#endif + +#endif /* MPL_PROC_MUTEX_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_proc_mutex_posix.h b/3rd-party/romio341/mpl/include/mpl_proc_mutex_posix.h new file mode 100644 index 0000000000000000000000000000000000000000..1dc1268a063abee3f91b5e6828a915b59ef72ada --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_proc_mutex_posix.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* + * Interprocess Mutex + */ +#ifndef MPL_PROC_MUTEX_POSIX_H_INCLUDED +#define MPL_PROC_MUTEX_POSIX_H_INCLUDED + +#include <errno.h> +#include <pthread.h> + +typedef pthread_mutex_t MPL_proc_mutex_t; + +#if defined(MPL_NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL) +int pthread_mutexattr_settype(pthread_mutexattr_t * attr, int kind); +#endif /* MPL_NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL */ + +#ifdef MPL_HAVE_PTHREAD_MUTEXATTR_SETPSHARED +static inline int MPL_proc_mutex_enabled(void) +{ + int mutex_err; + pthread_mutexattr_t attr; + + /* Test for PTHREAD_PROCESS_SHARED support. Some platforms do not support + * this capability even though it is a part of the pthreads core API (e.g., + * FreeBSD does not support this as of version 9.1) */ + pthread_mutexattr_init(&attr); + mutex_err = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutexattr_destroy(&attr); + return !mutex_err; /* if no error, return 1 */ +} + +#define PROC_MUTEX_EINTR_PRINT_BREAK(func_name, err__, err_ptr_) { \ + MPL_internal_sys_error_printf(func_name, err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = MPL_ERR_PROC_MUTEX_EINTR; \ + break; /* do not wrap by do-while (0) to break from caller's loop.*/ \ + } + +#ifdef MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE +#define PROC_MUTEX_SET_MUTEXATTR_SETTYPE \ + do { \ + err__ = pthread_mutexattr_settype(&attr__, MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE); \ + } while (0) +#else +#define PROC_MUTEX_SET_MUTEXATTR_SETTYPE do {} while (0) +#endif /* MPL_PTHREAD_MUTEX_ERRORCHECK_VALUE */ + +#define MPL_proc_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + pthread_mutexattr_t attr__; \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + \ + err__ = pthread_mutexattr_init(&attr__); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutexattr_init", err__, err_ptr_); \ + err__ = pthread_mutexattr_setpshared(&attr__, PTHREAD_PROCESS_SHARED); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutexattr_setpshared", err__, err_ptr_); \ + PROC_MUTEX_SET_MUTEXATTR_SETTYPE; \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutexattr_settype", err__, err_ptr_); \ + err__ = pthread_mutex_init(mutex_ptr_, &attr__); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutex_init", err__, err_ptr_); \ + err__ = pthread_mutexattr_destroy(&attr__); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutexattr_destroy", err__, err_ptr_); \ + } while (0) + +#define MPL_proc_mutex_destroy(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + err__ = pthread_mutex_destroy(mutex_ptr_); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutex_destroy", err__, err_ptr_); \ + } while (0) + + +#define MPL_proc_mutex_lock(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + err__ = pthread_mutex_lock(mutex_ptr_); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutex_lock", err__, err_ptr_); \ + } while (0) + + +#define MPL_proc_mutex_unlock(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + err__ = pthread_mutex_unlock(mutex_ptr_); \ + if (unlikely(err__)) \ + PROC_MUTEX_EINTR_PRINT_BREAK("pthread_mutex_unlock", err__, err_ptr_); \ + } while (0) + +#else +static inline int MPL_proc_mutex_enabled(void) +{ + return 0; /* always disabled */ +} + +#define MPL_proc_mutex_create(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_destroy(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_lock(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#define MPL_proc_mutex_unlock(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = MPL_ERR_PROC_MUTEX_EINVAL;} +#endif /* MPL_HAVE_PTHREAD_MUTEXATTR_SETPSHARED */ + +#endif /* MPL_PROC_MUTEX_POSIX_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_shm.h b/3rd-party/romio341/mpl/include/mpl_shm.h new file mode 100644 index 0000000000000000000000000000000000000000..f070081dc3e244b392a02c6b1c0267aa673d1844 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_shm.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* This file contains "pre" definitions and declarations for the OS wrappers. + * That is, things that shouldn't depend on much more than the mpichconf.h + * values. */ + +#ifndef MPL_SHM_H_INCLUDED +#define MPL_SHM_H_INCLUDED + +#include "mplconfig.h" + +#ifdef MPL_USE_SYSV_SHM +#include "mpl_shm_sysv.h" +#elif defined MPL_USE_MMAP_SHM +#include "mpl_shm_mmap.h" +#elif defined MPL_USE_NT_SHM +#include "mpl_shm_win.h" +#endif + +#define MPLI_SHM_FLAG_CLR 0x0 +#define MPLI_SHM_FLAG_SHM_CREATE 0x1 +#define MPLI_SHM_FLAG_SHM_ATTACH 0x10 +#define MPLI_SHM_FLAG_GHND_STATIC 0x100 +#define MPLI_SHM_FLAG_FIXED_ADDR 0x1000 + +#define MPL_SHM_HND_INVALID NULL +#define MPLI_SHM_GHND_INVALID NULL +#define MPLI_SHM_GHND_INIT_VAL '\0' +#define MPL_SHM_HND_SZ (sizeof(MPLI_shm_lghnd_t)) +#define MPL_SHM_GHND_SZ MPLI_SHM_GHND_SZ + +/* A Handle is valid if it is initialized/init and has a value + * different from the default/invalid value assigned during init + */ +#define MPLI_shm_hnd_is_valid(hnd) (\ + ((hnd) && \ + MPLI_shm_lhnd_is_valid(hnd) && \ + MPLI_shm_ghnd_is_valid(hnd)) \ +) + +/* With MMAP_SHM, NT_SHM & SYSV_SHM local handle is always init'ed */ +#define MPLI_shm_hnd_is_init(hnd) (\ + ((hnd) && /* MPL_shm_lhnd_is_init(hnd) && */ \ + MPLI_shm_ghnd_is_init(hnd)) \ +) + +/* These macros are the setters/getters for the shm handle */ +#define MPLI_shm_lhnd_get(hnd) ((hnd)->lhnd) +#define MPLI_shm_lhnd_set(hnd, val) ((hnd)->lhnd=val) +#define MPLI_shm_lhnd_is_valid(hnd) (((hnd)->lhnd != MPLI_SHM_LHND_INVALID)) +#define MPLI_shm_lhnd_is_init(hnd) 1 + +/* Allocate mem for references within the handle */ +/* Returns MPL_SUCCESS on success, MPL_ERR_SHM_NOMEM on error */ +#define MPL_shm_hnd_ref_alloc(hnd)(\ + ((hnd)->ghnd = (MPLI_shm_ghnd_t) \ + MPL_malloc(MPLI_SHM_GHND_SZ, MPL_MEM_SHM)) ? MPL_SUCCESS : MPL_ERR_SHM_NOMEM \ +) + + +/* These macros are the setters/getters for the shm handle */ +#define MPLI_shm_ghnd_get_by_ref(hnd) ((hnd)->ghnd) + +/* Returns -1 on error, 0 on success */ +#define MPLI_shm_ghnd_get_by_val(hnd, str, strlen) (\ + (MPL_snprintf(str, strlen, "%s", \ + MPLI_shm_ghnd_get_by_ref(hnd))) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN \ +) +#define MPLI_shm_ghnd_set_by_ref(hnd, val) ((hnd)->ghnd = val) +/* Returns -1 on error, 0 on success */ +/* FIXME: What if val is a non-null terminated string ? */ +#define MPLI_shm_ghnd_set_by_val(hnd, fmt, val) (\ + (MPL_snprintf(MPLI_shm_ghnd_get_by_ref(hnd), \ + MPLI_SHM_GHND_SZ, fmt, val)) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN \ +) + +#define MPLI_shm_ghnd_is_valid(hnd) (\ + (((hnd)->ghnd == MPLI_SHM_GHND_INVALID) || \ + (strlen((hnd)->ghnd) == 0)) ? 0 : 1 \ +) +#define MPLI_shm_ghnd_is_init(hnd) (\ + ((hnd)->flag & MPLI_SHM_FLAG_GHND_STATIC) ? \ + 1 : \ + (((hnd)->ghnd != MPLI_SHM_GHND_INVALID) ? 1 : 0) \ +) + +/* Allocate mem for global handle. + * Returns 0 on success, -1 on failure + */ +static inline int MPLI_shm_ghnd_alloc(MPL_shm_hnd_t hnd, MPL_memory_class class) +{ + if (!(hnd->ghnd)) { + hnd->ghnd = (MPLI_shm_ghnd_t) MPL_malloc(MPLI_SHM_GHND_SZ, class); + if (!(hnd->ghnd)) { + return MPL_ERR_SHM_NOMEM; + } + } + /* Global handle is no longer static */ + hnd->flag &= ~MPLI_SHM_FLAG_GHND_STATIC; + return MPL_SUCCESS; +} + + +/* Allocate mem for handle. Lazy allocation for global handle */ +/* Returns 0 on success, -1 on error */ +static inline int MPLI_shm_hnd_alloc(MPL_shm_hnd_t * hnd_ptr, MPL_memory_class class) +{ + *hnd_ptr = (MPL_shm_hnd_t) MPL_malloc(MPL_SHM_HND_SZ, class); + if (*hnd_ptr) { + (*hnd_ptr)->flag = MPLI_SHM_FLAG_GHND_STATIC; + } else { + return MPL_ERR_SHM_NOMEM; + } + return MPL_SUCCESS; +} + +/* Close Handle */ +#define MPLI_shm_hnd_close(hnd) MPLI_shm_lhnd_close(hnd) + +static inline void MPLI_shm_hnd_reset_val(MPL_shm_hnd_t hnd) +{ + MPLI_shm_lhnd_set(hnd, MPLI_SHM_LHND_INIT_VAL); + if (hnd->flag & MPLI_SHM_FLAG_GHND_STATIC) { + hnd->ghnd = MPLI_SHM_GHND_INVALID; + } else { + (hnd->ghnd)[0] = MPLI_SHM_GHND_INIT_VAL; + } +} + +static inline void MPLI_shm_hnd_free(MPL_shm_hnd_t hnd) +{ + if (MPLI_shm_hnd_is_init(hnd)) { + if (!(hnd->flag & MPLI_SHM_FLAG_GHND_STATIC)) { + MPL_free(hnd->ghnd); + } + MPL_free(hnd); + } +} + +/* interfaces */ +int MPL_shm_hnd_serialize(char *str, MPL_shm_hnd_t hnd, int str_len); +int MPL_shm_hnd_deserialize(MPL_shm_hnd_t hnd, const char *str_hnd, size_t str_hnd_len); +int MPL_shm_hnd_get_serialized_by_ref(MPL_shm_hnd_t hnd, char **str_ptr); +int MPL_shm_hnd_deserialize_by_ref(MPL_shm_hnd_t hnd, char **ser_hnd_ptr); +int MPL_shm_hnd_init(MPL_shm_hnd_t * hnd_ptr); +int MPL_shm_hnd_finalize(MPL_shm_hnd_t * hnd_ptr); +int MPL_shm_seg_create(MPL_shm_hnd_t hnd, intptr_t seg_sz); +int MPL_shm_seg_open(MPL_shm_hnd_t hnd, intptr_t seg_sz); +int MPL_shm_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset); +int MPL_shm_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset); +int MPL_shm_fixed_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset); +int MPL_shm_fixed_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset); +int MPL_shm_seg_detach(MPL_shm_hnd_t hnd, void **shm_addr_ptr, intptr_t seg_sz); +int MPL_shm_seg_remove(MPL_shm_hnd_t hnd); + +#endif /* MPL_SHM_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_shm_mmap.h b/3rd-party/romio341/mpl/include/mpl_shm_mmap.h new file mode 100644 index 0000000000000000000000000000000000000000..2d55e5168630499fa7a8a6a7fd8fe88bd730ee34 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_shm_mmap.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_SHM_MMAP_H_INCLUDED +#define MPL_SHM_MMAP_H_INCLUDED + +#include <fcntl.h> + +#ifdef MPL_HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +typedef intptr_t MPLI_shm_lhnd_t; + +typedef char *MPLI_shm_ghnd_t; +/* The local handle, lhnd, is valid only for the current process, + * The global handle, ghnd, is valid across multiple processes + * The handle flag, flag, is used to set various attributes of the + * handle. + */ +typedef struct MPLI_shm_lghnd_t { + MPLI_shm_lhnd_t lhnd; + MPLI_shm_ghnd_t ghnd; + int flag; +} MPLI_shm_lghnd_t; + +typedef MPLI_shm_lghnd_t *MPL_shm_hnd_t; + +#define MPL_SHM_FNAME_LEN 50 +#define MPLI_SHM_GHND_SZ MPL_SHM_FNAME_LEN +#define MPLI_SHM_LHND_INVALID (-1) +#define MPLI_SHM_LHND_INIT_VAL (-1) + +#define MPLI_SHM_SEG_ALREADY_EXISTS EEXIST + +/* Returns MPL_SUCCESS on success, MPL_ERR_SHM_INTERN on error */ +int MPLI_shm_lhnd_close(MPL_shm_hnd_t hnd); + +#endif /* MPL_SHM_MMAP_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_shm_sysv.h b/3rd-party/romio341/mpl/include/mpl_shm_sysv.h new file mode 100644 index 0000000000000000000000000000000000000000..2ebc9584008357a5653afd86e7dbac3c6dda3be4 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_shm_sysv.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_SHM_SYSV_H_INCLUDED +#define MPL_SHM_SYSV_H_INCLUDED + +#include <sys/stat.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +typedef int MPLI_shm_lhnd_t; + +typedef char *MPLI_shm_ghnd_t; +/* The local handle, lhnd, is valid only for the current process, + * The global handle, ghnd, is valid across multiple processes + * The handle flag, flag, is used to set various attributes of the + * handle. + */ +typedef struct MPLI_shm_lghnd_t { + MPLI_shm_lhnd_t lhnd; + MPLI_shm_ghnd_t ghnd; + int flag; +} MPLI_shm_lghnd_t; + +typedef MPLI_shm_lghnd_t *MPL_shm_hnd_t; + +#define MPL_SHM_MAX_INT_STR_LEN 20 +#define MPL_SHM_SEG_KEY_LEN MPL_SHM_MAX_INT_STR_LEN +#define MPLI_SHM_GHND_SZ MPL_SHM_SEG_KEY_LEN +#define MPLI_SHM_LHND_INVALID (-1) +#define MPLI_SHM_LHND_INIT_VAL (-1) +#define MPL_SHM_SER_HND_SZ MPLI_SHM_GHND_SZ + +#define MPL_SHM_SEG_ALREADY_EXISTS EEXIST + +/* Nothing to be done at close */ +#define MPLI_shm_lhnd_close(hnd) 0 + +#endif /* MPL_SHM_SYSV_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_shm_win.h b/3rd-party/romio341/mpl/include/mpl_shm_win.h new file mode 100644 index 0000000000000000000000000000000000000000..9f2e56a5dd708aa961eb6f5db6776fb2ee2d5cc7 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_shm_win.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_SHM_WIN_H_INCLUDED +#define MPL_SHM_WIN_H_INCLUDED + +#include <winsock2.h> +#include <windows.h> + +typedef HANDLE MPLI_shm_lhnd_t; + +typedef char *MPLI_shm_ghnd_t; +/* The local handle, lhnd, is valid only for the current process, + * The global handle, ghnd, is valid across multiple processes + * The handle flag, flag, is used to set various attributes of the + * handle. + */ +typedef struct MPLI_shm_lghnd_t { + MPLI_shm_lhnd_t lhnd; + MPLI_shm_ghnd_t ghnd; + int flag; +} MPLI_shm_lghnd_t; + +typedef MPLI_shm_lghnd_t *MPL_shm_hnd_t; + +#define MPL_SHM_SEG_NAME_LEN 70 +#define MPLI_SHM_GHND_SZ MPL_SHM_SEG_NAME_LEN +#define MPLI_SHM_LHND_INVALID INVALID_HANDLE_VALUE +#define MPLI_SHM_LHND_INIT_VAL INVALID_HANDLE_VALUE + +#define MPL_shm_SEG_ALREADY_EXISTS ERROR_ALREADY_EXISTS + +/* Returns MPL_SUCCESS on success, MPL_ERR_SHM_INTERN on error */ +#define MPLI_shm_lhnd_close(hnd)(\ + (CloseHandle(MPLI_shm_lhnd_get(hnd)) != 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN \ +) + +#if defined (HAVE_QUERYPERFORMANCECOUNTER) +/* + * Returns size of uniqStr, 0 on error + */ +static inline int MPL_shm_get_uniq_str(char *str, int strlen) +{ + LARGE_INTEGER perfCnt; + QueryPerformanceCounter(&perfCnt); + return (MPL_snprintf(str, strlen, "MPICH_NEM_%d_%I64d", + GetCurrentThreadId(), (perfCnt.QuadPart))); +} +#endif + +/* Returns MPL_SUCCESS on success, MPL_ERR_SHM_INTERN on error */ +static inline int MPLI_shm_ghnd_set_uniq(MPL_shm_hnd_t hnd) +{ + if (MPL_shm_hnd_ref_alloc(hnd) == MPL_SUCCESS) { + if (MPLI_shm_get_uniq_str(hnd->ghnd, MPLI_SHM_GHND_SZ) != 0) { + return MPL_ERR_SHM_INTERN; + } + } else { + return MPL_ERR_SHM_INTERN; + } + return MPL_SUCCESS; +} + +/* Nothing to be done when removing an SHM segment */ +static inline int MPL_shm_seg_remove(MPL_shm_hnd_t hnd) +{ + return MPL_SUCCESS; +} + +#endif /* MPL_SHM_WIN_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_sock.h b/3rd-party/romio341/mpl/include/mpl_sock.h new file mode 100644 index 0000000000000000000000000000000000000000..dcfde486caf29526c319d9a41b01125da2014071 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_sock.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_SOCK_H_INCLUDED +#define MPL_SOCK_H_INCLUDED + +#include "mplconfig.h" + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <errno.h> +#include <netinet/tcp.h> +#include <netdb.h> +#include <limits.h> + +#ifdef MPL_HAVE_SYS_TYPES_H +#include <sys/types.h> /* macs need sys/types.h before uio.h can be included */ +#endif +#ifdef MPL_HAVE_SYS_UIO_H +#include <sys/uio.h> +#endif + +#if !defined(MPL_HAVE_SYS_UIO_H) +struct iovec; +#endif + +/* *INDENT-ON* */ +#if defined(__cplusplus) +extern "C" { +#endif +/* *INDENT-OFF* */ + +ssize_t MPL_large_writev(int fd, const struct iovec *iov, int iovcnt); +ssize_t MPL_large_readv(int fd, const struct iovec *iov, int iovcnt); +int MPL_host_is_local(const char *host); + +/* *INDENT-ON* */ +#if defined(__cplusplus) +} +#endif +/* *INDENT-OFF* */ + +#endif /* MPL_SOCK_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_sockaddr.h b/3rd-party/romio341/mpl/include/mpl_sockaddr.h new file mode 100644 index 0000000000000000000000000000000000000000..636b2b101516c12fc78d95738dbe0d5557bf35c3 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_sockaddr.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_SOCKADDR_H_INCLUDED +#define MPL_SOCKADDR_H_INCLUDED + +#include <sys/socket.h> + +#define MPL_SOCKADDR_ANY 0 +#define MPL_SOCKADDR_LOOPBACK 1 + +/* modifies the default behavior of MPL_Listen + * a - whether listen on loopback (default: listen on all interfaces) + * b - maximum simultaneous connection (default: SOMAXCONN) + */ +#define MPL_LISTEN_PUSH(a,b) MPL_set_listen_attr(a, b) +#define MPL_LISTEN_POP MPL_set_listen_attr(0, SOMAXCONN) + +typedef struct sockaddr_storage MPL_sockaddr_t; + +/* The following functions when return an int, it returns 0 on success, + * non-zero indicates error. It is consistent with posix socket functions. + */ +void MPL_sockaddr_set_aftype(int type); +int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr); +int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr); +int MPL_get_sockaddr_iface(const char *s_iface, MPL_sockaddr_t * p_addr); +int MPL_socket(void); +int MPL_connect(int socket, MPL_sockaddr_t * p_addr, unsigned short port); +void MPL_set_listen_attr(int use_loopback, int max_conn); +int MPL_listen(int socket, unsigned short port); +int MPL_listen_anyport(int socket, unsigned short *p_port); +int MPL_listen_portrange(int socket, unsigned short *p_port, int low_port, int high_port); +int MPL_sockaddr_to_str(MPL_sockaddr_t * p_addr, char *str, int maxlen); +int MPL_sockaddr_port(MPL_sockaddr_t * p_addr); + +#endif /* MPL_SOCKADDR_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_str.h b/3rd-party/romio341/mpl/include/mpl_str.h new file mode 100644 index 0000000000000000000000000000000000000000..a4f3d15101009726e200b072085e02e180203656 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_str.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_STR_H_INCLUDED +#define MPL_STR_H_INCLUDED + +#include "mplconfig.h" + +/* *INDENT-ON* */ +#if defined(__cplusplus) +extern "C" { +#endif +/* *INDENT-OFF* */ + +#if defined MPL_NEEDS_SNPRINTF_DECL +extern int snprintf(char *, size_t, const char *, ...) ATTRIBUTE((format(printf,3,4))); +#endif + +#define MPL_snprintf_nowarn(...) \ + (MPL_snprintf(__VA_ARGS__) < 0 ? assert(0) : (void) 0) + +#if defined MPL_HAVE_SNPRINTF +#define MPL_snprintf snprintf +#else +int MPL_snprintf(char *, size_t, const char *, ...) ATTRIBUTE((format(printf,3,4))); +#endif /* MPL_HAVE_SNPRINTF */ + +int MPL_strncpy(char *dest, const char *src, size_t n); +char *MPL_strsep(char **stringp, const char *delim); + +#if defined MPL_NEEDS_STRERROR_DECL +extern char *strerror(int errnum); +#endif +#if defined MPL_HAVE_STRERROR +#define MPL_strerror strerror +#else +char *MPL_strerror(int errnum); +#endif /* MPL_HAVE_STRERROR */ + +int MPL_strnapp(char *dest, const char *src, size_t n); +void MPL_create_pathname(char *dest_filename, const char *dirname, + const char *prefix, const int is_dir); + +/* *INDENT-ON* */ +#if defined(__cplusplus) +} +#endif +/* *INDENT-OFF* */ + +#endif /* MPL_STR_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread.h b/3rd-party/romio341/mpl/include/mpl_thread.h new file mode 100644 index 0000000000000000000000000000000000000000..4e25d48696ada4803c4c3224d53faa0f842ecd9d --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_THREAD_H_INCLUDED +#define MPL_THREAD_H_INCLUDED + +#include "mplconfig.h" + +/* _INVALID exists to avoid accidental macro evaluations to 0 */ +#define MPL_THREAD_PACKAGE_INVALID 0 +#define MPL_THREAD_PACKAGE_NONE 1 +#define MPL_THREAD_PACKAGE_POSIX 2 +#define MPL_THREAD_PACKAGE_SOLARIS 3 +#define MPL_THREAD_PACKAGE_WIN 4 +#define MPL_THREAD_PACKAGE_UTI 5 +#define MPL_THREAD_PACKAGE_ARGOBOTS 6 + +#define MPL_THREAD_PRIO_HIGH 0 +#define MPL_THREAD_PRIO_LOW 1 + +#if !defined MPL_THREAD_PACKAGE_NAME +#error "thread package (MPL_THREAD_PACKAGE_NAME) not defined or unknown" +#elif MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_POSIX || MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_UTI +#include "mpl_thread_posix.h" +#elif MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_SOLARIS +#include "mpl_thread_solaris.h" +#elif MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_WIN +#include "mpl_thread_win.h" +#elif MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_ARGOBOTS +#include "mpl_thread_argobots.h" +#elif MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_NONE +typedef int MPL_thread_mutex_t; +typedef int MPL_thread_cond_t; +typedef int MPL_thread_id_t; +typedef int MPL_thread_tls_key_t; +typedef void (*MPL_thread_func_t) (void *data); +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = 0;} +#define MPL_thread_mutex_destroy(mutex_ptr_, err_ptr_) { *((int*)err_ptr_) = 0;} +#define MPL_thread_init(err_ptr_) do { *((int*)err_ptr_) = 0;} while (0) +#define MPL_thread_finalize(err_ptr_) do { *((int*)err_ptr_) = 0;} while (0) +#define MPL_thread_yield() do { } while (0) +#else +#error "thread package (MPL_THREAD_PACKAGE_NAME) not defined or unknown" +#endif + +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_NONE +#define MPL_TLS /* empty */ + +#elif defined(MPL_COMPILER_TLS) && !defined(MPL_NO_COMPILER_TLS) +/* Thread package such as argobots may define MPL_NO_COMPILER_TLS to indicate that + * compiler native tls (e.g. __thread) should not be used. + */ +#define MPL_TLS MPL_COMPILER_TLS + +#else +/* undef MPL_TLS */ + +#endif + +#include "mpl_thread_priv.h" + +#endif /* MPL_THREAD_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread_argobots.h b/3rd-party/romio341/mpl/include/mpl_thread_argobots.h new file mode 100644 index 0000000000000000000000000000000000000000..f86f68312c606e03e6d043c7c619fa7b8ffd359e --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread_argobots.h @@ -0,0 +1,239 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* This file is used when configured with (MPICH_THREAD_PACKAGE_NAME == + * MPICH_THREAD_PACKAGE_ARGOBOTS) */ + +#ifndef MPL_THREAD_ARGOBOTS_H_INCLUDED +#define MPL_THREAD_ARGOBOTS_H_INCLUDED + +#include "mpl.h" +#include "abt.h" + +#include <errno.h> +#include <assert.h> + +typedef ABT_mutex MPL_thread_mutex_t; +typedef ABT_cond MPL_thread_cond_t; +typedef ABT_thread MPL_thread_id_t; +typedef ABT_key MPL_thread_tls_key_t; + +/* ====================================================================== + * Creation and misc + * ======================================================================*/ + +/* MPL_thread_init()/MPL_thread_finalize() can be called in a nested manner + * (e.g., MPI_T_init_thread() and MPI_Init_thread()), but Argobots internally + * maintains a counter so it is okay. */ +#define MPL_thread_init(err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_init(0, NULL); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_init", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_finalize(err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_finalize(); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_finalize", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +/* MPL_thread_create() defined in mpiu_thread_argobots.c */ +typedef void (*MPL_thread_func_t) (void *data); +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp); + +#define MPL_thread_exit() +#define MPL_thread_self(idp_) ABT_thread_self(idp_) +#define MPL_thread_join(idp_) ABT_thread_free(idp_) +#define MPL_thread_same(idp1_, idp2_, same_) ABT_thread_equal(*idp1_, *idp2_, same_) + +/* ====================================================================== + * Scheduling + * ======================================================================*/ + +#define MPL_thread_yield ABT_thread_yield + +/* ====================================================================== + * Mutexes + * ======================================================================*/ +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_mutex_create(mutex_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_mutex_create", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_mutex_destroy(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_mutex_free(mutex_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_mutex_free", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_mutex_lock(mutex_ptr_, err_ptr_, prio_) \ + do { \ + int err__; \ + if (prio_ == MPL_THREAD_PRIO_HIGH) { \ + err__ = ABT_mutex_lock(*mutex_ptr_); \ + } else { \ + assert(prio_ == MPL_THREAD_PRIO_LOW); \ + err__ = ABT_mutex_lock_low(*mutex_ptr_); \ + } \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_mutex_lock", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_mutex_unlock(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_mutex_unlock(*mutex_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_mutex_unlock", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_mutex_unlock_se(mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_mutex_unlock_se(*mutex_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_mutex_unlock_se", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +/* ====================================================================== + * Condition Variables + * ======================================================================*/ + +#define MPL_thread_cond_create(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_cond_create((cond_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_cond_create", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_destroy(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_cond_free(cond_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_cond_free", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_) \ + do { \ + int err__; \ + MPL_DBG_MSG_FMT(THREAD,TYPICAL, \ + (MPL_DBG_FDEST, \ + "Enter cond_wait on cond=%p mutex=%p", \ + (cond_ptr_),(mutex_ptr_))); \ + do { \ + err__ = ABT_cond_wait((*cond_ptr_), *mutex_ptr_); \ + } while (err__ == EINTR); \ + *(int *)(err_ptr_) = err__; \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_cond_free", err__, \ + " %s:%d error in cond_wait on cond=%p mutex=%p err__=%d", \ + __FILE__, __LINE__); \ + MPL_DBG_MSG_FMT(THREAD,TYPICAL,(MPL_DBG_FDEST, \ + "Exit cond_wait on cond=%p mutex=%p", \ + (cond_ptr_),(mutex_ptr_))); \ + } while (0) + +#define MPL_thread_cond_broadcast(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + MPL_DBG_MSG_P(THREAD,TYPICAL, \ + "About to cond_broadcast on MPL_thread_cond %p", \ + (cond_ptr_)); \ + err__ = ABT_cond_broadcast((*cond_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_cond_broadcast", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_cond_signal(cond_ptr_, err_ptr_) \ + do { \ + int err__; \ + MPL_DBG_MSG_P(THREAD,TYPICAL, \ + "About to cond_signal on MPL_thread_cond %p", \ + (cond_ptr_)); \ + err__ = ABT_cond_signal((*cond_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_cond_signal", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +/* ====================================================================== + * Thread Local Storage + * ======================================================================*/ + +#define MPL_NO_COMPILER_TLS /* Cannot use compiler tls with argobots */ + +#define MPL_thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_key_create((exit_func_ptr_), (tls_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_key_create", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_tls_destroy(tls_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_key_free(tls_ptr_); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_key_free", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_tls_set(tls_ptr_, value_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_key_set(*(tls_ptr_), (value_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_key_set", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_tls_get(tls_ptr_, value_ptr_, err_ptr_) \ + do { \ + int err__; \ + err__ = ABT_key_get(*(tls_ptr_), (value_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("ABT_key_get", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#endif /* MPL_THREAD_ARGOBOTS_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread_posix.h b/3rd-party/romio341/mpl/include/mpl_thread_posix.h new file mode 100644 index 0000000000000000000000000000000000000000..da2df6c51ecda248addf80e4caa6289b42fd10b9 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread_posix.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* + * Threads + */ +#ifndef MPL_THREAD_POSIX_H_INCLUDED +#define MPL_THREAD_POSIX_H_INCLUDED + +#include "mpl.h" /* for MPL_sched_yield */ + +#include <errno.h> +#include <pthread.h> + +#define MPL_POSIX_MUTEX_NATIVE 0 +#define MPL_POSIX_MUTEX_TICKETLOCK 1 + +#if MPL_POSIX_MUTEX_NAME == MPL_POSIX_MUTEX_TICKETLOCK +#include "mpl_posix_mutex_ticketlock.h" +#else +#include "mpl_posix_mutex_native.h" +#endif + +typedef pthread_t MPL_thread_id_t; +typedef pthread_key_t MPL_thread_tls_key_t; + +typedef void (*MPL_thread_func_t) (void *data); +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * id, int *err); + +#define MPL_thread_init(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_finalize(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_exit() \ + do { \ + pthread_exit(NULL); \ + } while (0) + +#define MPL_thread_self(id_) \ + do { \ + *(id_) = pthread_self(); \ + } while (0) + +#define MPL_thread_join(id_) \ + do { \ + pthread_join(id_, NULL); \ + } while (0) + +#define MPL_thread_same(id1_, id2_, same_) \ + do { \ + *(same_) = pthread_equal(*(id1_), *(id2_)) ? TRUE : FALSE; \ + } while (0) + +#define MPL_thread_yield MPL_sched_yield + +/* + * Thread Local Storage + */ + +#define MPL_thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_key_create((tls_ptr_), (exit_func_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_key_create", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_tls_destroy(tls_ptr_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_key_delete(*(tls_ptr_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_key_delete", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_tls_set(tls_ptr_, value_, err_ptr_) \ + do { \ + int err__; \ + \ + err__ = pthread_setspecific(*(tls_ptr_), (value_)); \ + if (unlikely(err__)) \ + MPL_internal_sys_error_printf("pthread_setspecific", err__, \ + " %s:%d\n", __FILE__, __LINE__); \ + \ + *(int *)(err_ptr_) = err__; \ + } while (0) + +#define MPL_thread_tls_get(tls_ptr_, value_ptr_, err_ptr_) \ + do { \ + *(value_ptr_) = pthread_getspecific(*(tls_ptr_)); \ + \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + } while (0) + +#endif /* MPL_THREAD_POSIX_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread_priv.h b/3rd-party/romio341/mpl/include/mpl_thread_priv.h new file mode 100644 index 0000000000000000000000000000000000000000..79834376c52436f70660076454c8981cfd278497 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread_priv.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_THREAD_PRIV_H_INCLUDED +#define MPL_THREAD_PRIV_H_INCLUDED + +#if !defined(MPL_TLS) +/* We need to provide a function that will cleanup the storage attached + * to the key. */ +void MPLI_cleanup_tls(void *a); + +/* In the case where the thread level is set in MPI_Init_thread, we + need a blended version of the non-threaded and the thread-multiple + definitions. + + The approach is to have TWO MPLI_per_thread_t pointers. One is local + as in the threaded version of these macros. This is set by using a routine + to get thread-private storage. The second is a preallocated, extern + MPLI_per_thread_t struct, as in the single threaded case. Based on + whether MPL is initialized with thread safety, one or the other is used. + */ + +#define MPL_TLS_KEY_CREATE(key, var, err_ptr_, class_) \ + do { \ + void *thread_ptr; \ + \ + MPL_thread_tls_create(MPLI_cleanup_tls, &(key) , err_ptr_); \ + if (unlikely(*((int *) err_ptr_))) \ + break; \ + thread_ptr = MPL_calloc(1, sizeof(var), class_); \ + if (unlikely(!thread_ptr)) { \ + *((int *) err_ptr_) = MPL_THREAD_ERROR; \ + break; \ + } \ + MPL_thread_tls_set(&(key), thread_ptr, err_ptr_); \ + } while (0) + +#define MPL_TLS_KEY_RETRIEVE(key, var, addr, err_ptr_) \ + do { \ + void *thread_ptr; \ + MPL_thread_tls_get(&(key), &thread_ptr, err_ptr_); \ + if (unlikely(*((int *) err_ptr_))) \ + break; \ + if (!thread_ptr) { \ + thread_ptr = MPL_calloc(1, sizeof(var), MPL_MEM_OTHER); \ + if (unlikely(!thread_ptr)) { \ + *((int *) err_ptr_) = MPL_THREAD_ERROR; \ + break; \ + } \ + MPL_thread_tls_set(&(key), thread_ptr, err_ptr_); \ + if (unlikely(*((int *) err_ptr_))) \ + break; \ + } \ + addr = thread_ptr; \ + } while (0) + +#define MPL_TLS_KEY_DESTROY(key, err_ptr_) \ + do { \ + void *thread_ptr; \ + \ + MPL_thread_tls_get(&(key), &thread_ptr, err_ptr_); \ + if (unlikely(*((int *) err_ptr_))) \ + break; \ + \ + MPL_free(thread_ptr); \ + \ + MPL_thread_tls_set(&(key), NULL, err_ptr_); \ + if (unlikely(*((int *) err_ptr_))) \ + break; \ + \ + MPL_thread_tls_destroy(&(key), err_ptr_); \ + } while (0) + +#else /* defined(MPL_TLS) */ + +#define MPL_TLS_KEY_CREATE(...) +#define MPL_TLS_KEY_RETRIEVE(key, var, addr, err_ptr_) \ + do { \ + addr = &(var); \ + *((int *) err_ptr_) = MPL_SUCCESS; \ + } while (0) +#define MPL_TLS_KEY_DESTROY(...) + +#endif + +#endif /* MPL_THREAD_PRIV_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread_solaris.h b/3rd-party/romio341/mpl/include/mpl_thread_solaris.h new file mode 100644 index 0000000000000000000000000000000000000000..08aee3517a7b4a16968bf6e4a91565199734eaf8 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread_solaris.h @@ -0,0 +1,216 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_THREAD_SOLARIS_H_INCLUDED +#define MPL_THREAD_SOLARIS_H_INCLUDED + +#include <thread.h> +#include <synch.h> + +typedef mutex_t MPL_thread_mutex_t; +typedef cond_t MPL_thread_cond_t; +typedef thread_t MPL_thread_id_t; +typedef thread_key_t MPL_thread_tls_key_t; + +typedef void (*MPL_thread_func_t) (void *data); +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * id, int *err); + +/* + * Threads + */ + +#define MPL_thread_init(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_finalize(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_exit() \ + do { \ + thr_exit(NULL); \ + } while (0) + +#define MPL_thread_self(id_ptr_) \ + do { \ + *(id_ptr_) = thr_self(); \ + } while (0) + +#define MPL_thread_join(id_ptr_) \ + do { \ + thr_join(id_ptr_, NULL, NULL); \ + } while (0) + +#define MPL_thread_same(id1_ptr_, id2_ptr_, same_ptr_) \ + do { \ + *(same_ptr_) = (*(id1_ptr_) == *(id2_ptr_)) ? TRUE : FALSE; \ + } while (0) + +#define MPL_thread_yield thr_yield + + +/* + * Mutexes + */ + +#define MPL_thread_mutex_create(mutex_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + mutex_init(mutex_ptr_, USYNC_THREAD, NULL); \ + } \ + else { \ + *(err_ptr_) = mutex_init(mutex_ptr_, USYNC_THREAD, NULL); \ + /* FIXME: convert error to an MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_mutex_destroy(mutex_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + mutex_destroy(mutex_ptr_); \ + } \ + else { \ + *(err_ptr_) = mutex_destroy(mutex_ptr_); \ + /* FIXME: convert error to an MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_mutex_lock(mutex_ptr_, err_ptr_, prio_) \ + do { \ + if ((err_ptr_) == NULL) { \ + mutex_lock(mutex_ptr_); \ + } \ + else { \ + *(err_ptr_) = mutex_lock(mutex_ptr_); \ + /* FIXME: convert error to an MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_mutex_unlock(mutex_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + mutex_unlock(mutex_ptr_); \ + } \ + else { \ + *(err_ptr_) = mutex_unlock(mutex_ptr_); \ + /* FIXME: convert error to an MPL_THREAD_ERR value */ \ + } \ + } while (0) + + +/* + * Condition Variables + */ + +#define MPL_thread_cond_create(cond_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + cond_init(cond_ptr_, NULL, NULL); \ + } \ + else { \ + *(err_ptr_) == cond_init(cond_ptr_, NULL, NULL); \ + /* FIXME: convert error to an MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_cond_destroy(cond_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + cond_destroy(cond_ptr_); \ + } \ + else { \ + *(err_ptr_) = cond_destroy(cond_ptr_); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + cond_wait((cond_ptr_), (mutex_ptr_)); \ + } \ + else { \ + *(err_ptr_) = cond_wait((cond_ptr_), (mutex_ptr_)); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_cond_broadcast(cond_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + cond_broadcast(cond_ptr_); \ + } \ + else { \ + *(err_ptr_) = cond_broadcast(cond_ptr_); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_cond_signal(cond_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + cond_signal(cond_ptr_); \ + } \ + else { \ + *(err_ptr_) = cond_signal(cond_ptr_); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + + +/* + * Thread Local Storage + */ +#define MPL_thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + thr_keycreate((tls_ptr_), (exit_func_ptr_)); \ + } \ + else { \ + *(err_ptr_) = thr_keycreate((tls_ptr_), (exit_func_ptr_)); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_tls_destroy(tls_ptr_, err_ptr_) \ + do { \ + /* \ + * FIXME: Solaris threads does not have a key destroy. We \ + * need to create equivalent functionality to prevent a \ + * callback from occuring when a thread exits after the TLS is \ + * destroyed. This is the only way to prevent subsystems that \ + * have shutdown from continuing to receive callbacks. \ + */ \ + if ((err_ptr_) != NULL) { \ + *(err_ptr_) = MPL_SUCCESS; \ + } \ + } while (0) + +#define MPL_thread_tls_set(tls_ptr_, value_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + thr_setspecific(*(tls_ptr_), (value_)); \ + } \ + else { \ + *(err_ptr_) = thr_setspecific(*(tls_ptr_), (value_)); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#define MPL_thread_tls_get(tls_ptr_, value_ptr_, err_ptr_) \ + do { \ + if ((err_ptr_) == NULL) { \ + thr_setspecific(*(tls_ptr_), (value_ptr_)); \ + } \ + else { \ + *(err_ptr_) = thr_setspecific(*(tls_ptr_), (value_ptr_)); \ + /* FIXME: convert error to a MPL_THREAD_ERR value */ \ + } \ + } while (0) + +#endif /* MPL_THREAD_SOLARIS_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_thread_win.h b/3rd-party/romio341/mpl/include/mpl_thread_win.h new file mode 100644 index 0000000000000000000000000000000000000000..89fefc1f04e9c3cb859cf0ef8285110fcdfceee4 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_thread_win.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_THREAD_WIN_H_INCLUDED +#define MPL_THREAD_WIN_H_INCLUDED + +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> + +typedef HANDLE MPL_thread_mutex_t; +typedef HANDLE MPL_thread_id_t; +typedef DWORD MPL_thread_tls_key_t; + +typedef struct MPLI_win_thread_cond_fifo_t { + HANDLE event; + struct MPLI_win_thread_cond_fifo_t *next; +} MPLI_win_thread_cond_fifo_t; +typedef struct MPL_thread_cond_t { + MPL_thread_tls_key_t tls; + MPL_thread_mutex_t fifo_mutex; + MPLI_win_thread_cond_fifo_t *fifo_head, *fifo_tail; +} MPL_thread_cond_t; + +typedef void (*MPL_thread_func_t) (void *data); + +#define MPL_thread_init(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +#define MPL_thread_finalize(err_ptr_) \ + do { \ + *(int *)(err_ptr_) = 0; \ + } while (0) + +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * id, int *err); +void MPL_thread_exit(void); +void MPL_thread_self(MPL_thread_id_t * id); +void MPL_thread_join(MPL_thread_id_t * id); +void MPL_thread_same(MPL_thread_id_t * id1, MPL_thread_id_t * id2, int *same); +void MPL_thread_yield(); + +void MPL_thread_mutex_create(MPL_thread_mutex_t * mutex, int *err); +void MPL_thread_mutex_destroy(MPL_thread_mutex_t * mutex, int *err); +void MPL_thread_mutex_lock(MPL_thread_mutex_t * mutex, int *err, int prio); +void MPL_thread_mutex_unlock(MPL_thread_mutex_t * mutex, int *err); + +void MPL_thread_cond_create(MPL_thread_cond_t * cond, int *err); +void MPL_thread_cond_destroy(MPL_thread_cond_t * cond, int *err); +void MPL_thread_cond_wait(MPL_thread_cond_t * cond, MPL_thread_mutex_t * mutex, int *err); +void MPL_thread_cond_broadcast(MPL_thread_cond_t * cond, int *err); +void MPL_thread_cond_signal(MPL_thread_cond_t * cond, int *err); + +/* + * Thread Local Storage + */ + +#define MPL_thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_) \ + do { \ + *(tls_ptr_) = TlsAlloc(); \ + if ((err_ptr_) != NULL) { \ + if (*(tls_ptr_) == TLS_OUT_OF_INDEXES) { \ + *(int *)(err_ptr_) = GetLastError(); \ + } \ + else { \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + } \ + } \ + } while (0) + +#define MPL_thread_tls_destroy(tls_ptr_, err_ptr_) \ + do { \ + BOOL result__; \ + result__ = TlsFree(*(tls_ptr_)); \ + if ((err_ptr_) != NULL) { \ + if (result__) { \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + } \ + else { \ + *(int *)(err_ptr_) = GetLastError(); \ + } \ + } \ + } while (0) + +#define MPL_thread_tls_set(tls_ptr_, value_, err_ptr_) \ + do { \ + BOOL result__; \ + result__ = TlsSetValue(*(tls_ptr_), (value_)); \ + if ((err_ptr_) != NULL) { \ + if (result__) { \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + } \ + else { \ + *(int *)(err_ptr_) = GetLastError(); \ + } \ + } \ + } while (0) + +#define MPL_thread_tls_get(tls_ptr_, value_ptr_, err_ptr_) \ + do { \ + *((void **)value_ptr_) = TlsGetValue(*(tls_ptr_)); \ + if ((err_ptr_) != NULL) { \ + if (*(value_ptr_) == 0 && GetLastError() != NO_ERROR) { \ + *(int *)(err_ptr_) = GetLastError(); \ + } \ + else { \ + *(int *)(err_ptr_) = MPL_SUCCESS; \ + } \ + } \ + } while (0) + +#endif /* MPL_THREAD_WIN_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer.h.in b/3rd-party/romio341/mpl/include/mpl_timer.h.in new file mode 100644 index 0000000000000000000000000000000000000000..8aeead7048f88e0c86081035bd44e876deb56b75 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer.h.in @@ -0,0 +1,214 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#if !defined(MPL_TIMER_H_INCLUDED) +#define MPL_TIMER_H_INCLUDED + +#include "mplconfig.h" + +#if defined (MPL_HAVE_UNISTD_H) +#include <unistd.h> +#if defined (MPL_NEEDS_USLEEP_DECL) +int usleep(useconds_t usec); +#endif +#endif + +/* + * This include file provide the definitions that are necessary to use the + * timer calls, including the definition of the time stamp type and + * any inlined timer calls. + * + * The include file timerconf.h (created by autoheader from configure.ac) + * is needed only to build the function versions of the timers. + */ +/* Include the appropriate files */ +#define MPL_TIMER_KIND__GETHRTIME 1 +#define MPL_TIMER_KIND__CLOCK_GETTIME 2 +#define MPL_TIMER_KIND__GETTIMEOFDAY 3 +#define MPL_TIMER_KIND__LINUX86_CYCLE 4 +#define MPL_TIMER_KIND__GCC_IA64_CYCLE 5 +#define MPL_TIMER_KIND__MACH_ABSOLUTE_TIME 6 +#define MPL_TIMER_KIND__PPC64_CYCLE 7 +#define MPL_TIMER_KIND @MPL_TIMER_KIND@ + +/* Define a time stamp */ +/* *INDENT-OFF* */ +typedef @MPL_TIMER_TYPE@ MPL_time_t; +/* *INDENT-ON* */ + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETHRTIME +#include "mpl_timer_gethrtime.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__CLOCK_GETTIME +#include "mpl_timer_clock_gettime.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__GETTIMEOFDAY +#include "mpl_timer_gettimeofday.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__LINUX86_CYCLE +#include "mpl_timer_linux86_cycle.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__GCC_IA64_CYCLE +#include "mpl_timer_gcc_ia64_cycle.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__MACH_ABSOLUTE_TIME +#include "mpl_timer_mach_absolute_time.h" +#elif MPL_TIMER_KIND == MPL_TIMER_KIND__PPC64_CYCLE +#include "mpl_timer_ppc64_cycle.h" +#endif + +/* + * Prototypes. These are defined here so that inlined timer calls can + * use them, as well as any profiling and timing code that is built into + * MPL + */ + +#if defined MPLI_WTIME_IS_A_FUNCTION + +/*@ + MPL_wtime - Return a time stamp + + Output Parameter: +. timeval - A pointer to an 'MPL_wtime_t' variable. + + Notes: + This routine returns an `opaque` time value. This difference between two + time values returned by 'MPL_wtime' can be converted into an elapsed time + in seconds with the routine 'MPL_wtime_diff'. + + This routine is defined this way to simplify its implementation as a macro. + For example, the for Intel x86 and gcc, +.vb +#define MPL_wtime(timeval) \ + __asm__ __volatile__("rdtsc" : "=A" (*timeval)) +.ve + + For some purposes, it is important + that the timer calls change the timing of the code as little as possible. + This form of a timer routine provides for a very fast timer that has + minimal impact on the rest of the code. + + From a semantic standpoint, this format emphasizes that any particular + timer value has no meaning; only the difference between two values is + meaningful. + + Module: + Timer + + Question: + MPI-2 allows 'MPI_Wtime' to be a macro. We should make that easy; this + version does not accomplish that. + @*/ +int MPL_wtime(MPL_time_t * timeval); +#endif /* MPLI_WTIME_IS_A_FUNCTION */ + +/*@ + MPL_wtime_diff - Compute the difference between two time stamps + + Input Parameters: +. t1, t2 - Two time values set by 'MPL_wtime' on this process. + + + Output Parameter: +. diff - The different in time between t2 and t1, measured in seconds. + + Note: + If 't1' is null, then 't2' is assumed to be differences accumulated with + 'MPL_wtime_acc', and the output value gives the number of seconds that + were accumulated. + + Question: + Instead of handling a null value of 't1', should we have a separate + routine 'MPL_wtime_todouble' that converts a single timestamp to a + double value? + + Module: + Timer + @*/ +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff); + +/*@ + MPL_wtime_acc - Accumulate time values + + Input Parameters: +. t1,t2,t3 - Three time values. 't3' is updated with the difference between + 't2' and 't1': '*t3 += (t2 - t1)'. + + Notes: + This routine is used to accumulate the time spent with a block of code + without first converting the time stamps into a particular arithmetic + type such as a 'double'. For example, if the 'MPL_wtime' routine accesses + a cycle counter, this routine (or macro) can perform the accumulation using + integer arithmetic. + + To convert a time value accumulated with this routine, use 'MPL_wtime_diff' + with a 't1' of zero. + + Module: + Timer + @*/ +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3); + +/*@ + MPL_wtime_touint - Converts a timestamp to an unsigned int. + Input Parameter: +. timeval - 'MPL_time_t' time stamp + + Output Parameter: +. val - unsigned int generated from the timestamp. + + Notes: + This routine may be used for initializing random seeds. The value is not + necessary a timestamp if 64-bit to 32-bit conversion happened. + + + @*/ +int MPL_wtime_touint(MPL_time_t * timeval, unsigned int *val); + +/*@ + MPL_wtime_todouble - Converts a timestamp to a double + + Input Parameter: +. timeval - 'MPL_time_t' time stamp + + Output Parameter: +. seconds - Time in seconds from an arbitrary (but fixed) time in the past + + Notes: + This routine may be used to change a timestamp into a number of seconds, + suitable for 'MPI_Wtime'. + + @*/ +int MPL_wtime_todouble(MPL_time_t * timeval, double *seconds); + +/*@ + MPL_wtick - Provide the resolution of the 'MPL_wtime' timer + + Return value: + Resolution of the timer in seconds. In many cases, this is the + time between ticks of the clock that 'MPL_wtime' returns. In other + words, the minimum significant difference that can be computed by + 'MPL_wtime_diff'. + + Note that in some cases, the resolution may be estimated. No application + should expect either the same estimate in different runs or the same + value on different processes. + + Module: + Timer + @*/ +int MPL_wtick(double *); + +/*@ + MPL_wtime_init - Initialize the timer + + Note: + This routine should perform any steps needed to initialize the timer. + In addition, it should set the value of the attribute 'MPI_WTIME_IS_GLOBAL' + if the timer is known to be the same for all processes in 'MPI_COMM_WORLD' + (the value is zero by default). + + Module: + Timer + + @*/ +int MPL_wtime_init(void); + +#endif /* !defined(MPL_TIMER_H_INCLUDED) */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_clock_gettime.h b/3rd-party/romio341/mpl/include/mpl_timer_clock_gettime.h new file mode 100644 index 0000000000000000000000000000000000000000..9ebe9a6af2eff5383a4d777f269284809ba821ae --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_clock_gettime.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_CLOCK_GETTIME_H_INCLUDED +#define MPL_TIMER_CLOCK_GETTIME_H_INCLUDED + +#define MPLI_WTIME_IS_A_FUNCTION + +#include <time.h> +#ifdef MPL_NEEDS_SYS_TIME_H +/* Some OS'es mistakenly require sys/time.h to get the definition of + CLOCK_REALTIME (POSIX requires the definition to be in time.h) */ +#include <sys/time.h> +#endif + +#endif /* MPL_TIMER_CLOCK_GETTIME_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_gcc_ia64_cycle.h b/3rd-party/romio341/mpl/include/mpl_timer_gcc_ia64_cycle.h new file mode 100644 index 0000000000000000000000000000000000000000..42bdb24c9d0ff36fe993e4abae87a3996e832fdf --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_gcc_ia64_cycle.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_GCC_IA64_CYCLE_H_INCLUDED +#define MPL_TIMER_GCC_IA64_CYCLE_H_INCLUDED + +static inline void MPL_wtime(MPL_time_t * timeval) +{ + MPL_time_t t_val; + +#ifdef __INTEL_COMPILER +#include "ia64regs.h" + t_val = __getReg(_IA64_REG_AR_ITC); +#else + __asm__ __volatile__("mov %0=ar.itc":"=r"(t_val)); +#endif + + *timeval = t_val; + + return MPL_SUCCESS; +} + +#endif /* MPL_TIMER_GCC_IA64_CYCLE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_gethrtime.h b/3rd-party/romio341/mpl/include/mpl_timer_gethrtime.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f382e76f880870a2188bbe83b37f0cf0975cfd --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_gethrtime.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_GETHRTIME_H_INCLUDED +#define MPL_TIMER_GETHRTIME_H_INCLUDED + +#define MPLI_WTIME_IS_A_FUNCTION + +#include <sys/time.h> + +#endif /* MPL_TIMER_GETHRTIME_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_gettimeofday.h b/3rd-party/romio341/mpl/include/mpl_timer_gettimeofday.h new file mode 100644 index 0000000000000000000000000000000000000000..9f688916de3d43d5c0b6067ea5bb8dc5215d786c --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_gettimeofday.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_GETTIMEOFDAY_H_INCLUDED +#define MPL_TIMER_GETTIMEOFDAY_H_INCLUDED + +#define MPLI_WTIME_IS_A_FUNCTION + +#include <sys/types.h> +#include <sys/time.h> + +#endif /* MPL_TIMER_GETTIMEOFDAY_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_linux86_cycle.h b/3rd-party/romio341/mpl/include/mpl_timer_linux86_cycle.h new file mode 100644 index 0000000000000000000000000000000000000000..853598605bc9cbed64304cb1529fb5d8cca92d9d --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_linux86_cycle.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_LINUX86_CYCLE_H_INCLUDED +#define MPL_TIMER_LINUX86_CYCLE_H_INCLUDED + +static inline int MPL_wtime(MPL_time_t * timeval) +{ +/* The rdtsc instruction is not a "serializing" instruction, so the + processor is free to reorder it. In order to get more accurate + timing numbers with rdtsc, we need to put a serializing + instruction, like cpuid, before rdtsc. X86_64 architectures have + the rdtscp instruction which is synchronizing, we use this when we + can. */ +#ifdef MPL_LINUX86_CYCLE_RDTSCP + unsigned long long lower, upper, extra; + __asm__ __volatile__("rdtscp\n":"=a"(lower), "=d"(upper), "=c"(extra)); + *timeval = (upper << 32) + lower; + +#elif defined(MPL_LINUX86_CYCLE_CPUID_RDTSC64) + unsigned long long lower, upper; + __asm__ __volatile__("cpuid ; rdtsc":"=a"(lower), "=d"(upper)::"ebx", "ecx"); + *timeval = (upper << 32) + lower; + +#elif defined(MPL_LINUX86_CYCLE_CPUID_RDTSC32) + __asm__ __volatile__("cpuid ; rdtsc":"=A"(*timeval)::"ebx", "ecx"); + +#elif defined(MPL_LINUX86_CYCLE_RDTSC) +/* The configure test using cpuid must have failed, try just rdtsc by itself */ + __asm__ __volatile__("rdtsc":"=A"(*timeval)); + +#else +#error Dont know which Linux timer to use +#endif + + return MPL_SUCCESS; +} + +#endif /* MPL_TIMER_LINUX86_CYCLE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_mach_absolute_time.h b/3rd-party/romio341/mpl/include/mpl_timer_mach_absolute_time.h new file mode 100644 index 0000000000000000000000000000000000000000..8efdf4d47dcecba9cf417ed6a730cf4729a79679 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_mach_absolute_time.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED +#define MPL_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED + +#define MPLI_WTIME_IS_A_FUNCTION + +#include <mach/mach_time.h> + +#endif /* MPL_TIMER_MACH_ABSOLUTE_TIME_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_timer_ppc64_cycle.h b/3rd-party/romio341/mpl/include/mpl_timer_ppc64_cycle.h new file mode 100644 index 0000000000000000000000000000000000000000..b2c76fe63feef5728997eaac397b463a7b31b942 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_timer_ppc64_cycle.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_PPC64_CYCLE_H_INCLUDED +#define MPL_TIMER_PPC64_CYCLE_H_INCLUDED + +#define SPRN_TBRU 0x10D +#define SPRN_TBRL 0x10C + +static inline uint64_t tb() +{ + unsigned temp; + union { + struct { + unsigned hi, lo; + } w; + uint64_t d; + } result; + + do { + asm volatile ("mfspr %0,%1":"=r" (temp):"i"(SPRN_TBRU)); + asm volatile ("mfspr %0,%1":"=r" (result.w.lo):"i"(SPRN_TBRL)); + asm volatile ("mfspr %0,%1":"=r" (result.w.hi):"i"(SPRN_TBRU)); + } + while (temp != result.w.hi); + + return result.d; +} + +static inline int MPL_wtime(MPL_time_t * timeval) +{ + *timeval = tb(); + return MPL_SUCCESS; +} + +#endif /* MPL_TIMER_PPC64_CYCLE_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_trmem.h b/3rd-party/romio341/mpl/include/mpl_trmem.h new file mode 100644 index 0000000000000000000000000000000000000000..d576bafe7ab0df1e098ed9f00f7540e0143af187 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_trmem.h @@ -0,0 +1,416 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TRMEM_H_INCLUDED +#define MPL_TRMEM_H_INCLUDED + +#include <stdlib.h> + +/* Sometime we have memory allocated from external library but requires + * us to free. Use MPL_external_free for these cases. +*/ +MPL_STATIC_INLINE_PREFIX void MPL_external_free(void *buf) +{ + free(buf); +} + +#if defined MPL_NEEDS_STRDUP_DECL && !defined strdup +extern char *strdup(const char *); +#endif /* MPL_NEEDS_STRDUP_DECL */ + +#if defined(MPL_USE_MEMORY_TRACING) +#define MPL_strdup(a) MPL_trstrdup(a,__LINE__,__FILE__) +#elif defined(MPL_HAVE_STRDUP) +#define MPL_strdup strdup +#else +char *MPL_strdup(const char *str); +#endif /* defined(MPL_USE_MEMORY_TRACING) || defined(MPL_HAVE_STRDUP) */ + +#if defined MPL_NEEDS_ALIGNED_ALLOC_DECL +extern void *aligned_alloc(size_t alignment, size_t size); +#endif + +/* This list should match the array in mpl_trmem.c */ +typedef enum { + MPL_MEM_ADDRESS, /* Address information */ + MPL_MEM_OBJECT, /* General MPI Objects */ + MPL_MEM_COMM, /* Communicators */ + MPL_MEM_GROUP, /* Groups */ + MPL_MEM_STRINGS, /* String buffers */ + MPL_MEM_RMA, /* RMA data transfers, windows, etc. */ + MPL_MEM_BUFFER, /* Internal buffers for data transfers */ + MPL_MEM_SHM, /* Shared memory windows, buffers, etc. */ + MPL_MEM_THREAD, /* Threading information, locks, etc. */ + MPL_MEM_DYNAMIC, /* Dynamic process related information */ + MPL_MEM_IO, /* MPI I/O related objects */ + MPL_MEM_GREQ, /* Generalized requests */ + MPL_MEM_DATATYPE, /* MPI datatypes and related structures */ + MPL_MEM_MPIT, /* MPI_T structures */ + MPL_MEM_DEBUG, /* Data for the debugging information */ + MPL_MEM_PM, /* Data for process managers */ + MPL_MEM_COLL, /* Memory related to collective operations */ + MPL_MEM_USER, /* User memory allocations */ + MPL_MEM_OTHER, /* Other small memory allocations */ + MPL_MAX_MEMORY_CLASS +} MPL_memory_class; + +typedef struct { + long max_allocated_mem; /* The maximum amount of memory allocated at one time */ + long curr_allocated_mem; /* The current amount of memory allocated at one time */ + long total_allocated_mem; /* The total amount of memory allocated */ + long num_allocations; /* The total number of alloations */ +} MPL_memory_allocation_t; + +/*M + MPL_malloc - Allocate memory + + Synopsis: +.vb + void *MPL_malloc(size_t len, MPL_memory_allocation_t type) +.ve + + Input Parameter: +. len - Length of memory to allocate in bytes +. type - The category of memory being allocated + + Return Value: + Pointer to allocated memory, or null if memory could not be allocated. + + Notes: + This routine will often be implemented as the simple macro +.vb + #define MPL_malloc(n) malloc(n) +.ve + However, it can also be defined as +.vb + #define MPL_malloc(n) MPL_trmalloc(n,__LINE__,__FILE__) +.ve + where 'MPL_trmalloc' is a tracing version of 'malloc' that is included with + MPICH. + + Module: + Utility + M*/ + +/*M + MPL_calloc - Allocate memory that is initialized to zero. + + Synopsis: +.vb + void *MPL_calloc(size_t nelm, size_t elsize) +.ve + + Input Parameters: ++ nelm - Number of elements to allocate +- elsize - Size of each element. +. type - The category of memory being allocated + + Notes: + Like 'MPL_malloc' and 'MPL_free', this will often be implemented as a + macro but may use 'MPL_trcalloc' to provide a tracing version. + + Module: + Utility + M*/ + +/*M + MPL_free - Free memory + + Synopsis: +.vb + void MPL_free(void *ptr) +.ve + + Input Parameter: +. ptr - Pointer to memory to be freed. This memory must have been allocated + with 'MPL_malloc'. + + Notes: + This routine will often be implemented as the simple macro +.vb + #define MPL_free(n) free(n) +.ve + However, it can also be defined as +.vb + #define MPL_free(n) MPL_trfree(n,__LINE__,__FILE__) +.ve + where 'MPL_trfree' is a tracing version of 'free' that is included with + MPICH. + + Module: + Utility + M*/ + +/*M + MPL_mmap - Map memory + + Synopsis: +.vb + void *MPL_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) +.ve + + Input Parameters: +. addr - Starting address for the new mapping +. length - Length of the mapping +. prot - Desired memory protection of the mapping +. flags - Determines whether updates to the mapping are visible to other + processes mapping the same region, and whether updates are carried + through to the underlying file. +. fd - The file backing the memory region +. offset - Offset into the file +. type - The category of memory being allocated + + Notes: + This routine will often be implemented as the simple macro +.vb + #define MPL_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +.ve + However, it can also be defined as +.vb + #define MPL_mmap(a,b,c,d,e,f) MPL_trmmap(a,b,c,d,e,f,__LINE__,__FILE__) +.ve + where 'MPL_trmmap' is a tracing version of 'mmap' that is included with + MPICH. + + Module: + Utility + M*/ + +/*M + MPL_munmap - Unmapmemory + + Synopsis: +.vb + void *MPL_munmap(void *addr, size_t length) +.ve + + Input Parameters: +. addr - Starting address for the new mapping +. length - Length of the mapping + + Notes: + This routine will often be implemented as the simple macro +.vb + #define MPL_munmap(a,b) munmap(a,b) +.ve + However, it can also be defined as +.vb + #define MPL_munmap(a,b) MPL_trmunmap(a,b,__LINE__,__FILE__) +.ve + where 'MPL_trmunmap' is a tracing version of 'munmap' that is included with + MPICH. + + Module: + Utility + M*/ + +/*M + MPL_aligned_alloc - Allocate aligned memory + + Synopsis: +.vb + void *MPL_aligned_alloc(size_t alignment, size_t size) +.ve + + Input Parameters: +. alignment - Returned address will be multiple of this value. + It must be power of two and multiple of sizeof(void *). +. length - Length of the memory to allocate + + Notes: + This routine will often be implemented as a call to posix_memalign(3), + However, it can also be defined as +.vb + #define MPL_aligned_alloc(a,b,c) MPL_traligned_alloc(a,b,c,__LINE__,__FILE__) +.ve + where 'MPL_traligned_alloc' is a tracing version of 'aligned_alloc' that is included with + MPICH. + + Module: + Utility + M*/ + +#ifdef MPL_USE_MEMORY_TRACING + +/* Define these as invalid C to catch their use in the code. + * The ::: should cause the compiler to choke; the string will give the explanation + */ +#define malloc(a) 'Error use MPL_malloc' ::: +#define calloc(a,b) 'Error use MPL_calloc' ::: +#define free(a) 'Error use MPL_free' ::: +#define realloc(a) 'Error use MPL_realloc' ::: +/* These two functions can't be guarded because we use #include <sys/mman.h> + * throughout the code to be able to use other symbols in that header file. + * Because we include that header directly, we bypass this guard and cause + * compile problems. + * #define mmap(a,b,c,d,e,f) 'Error use MPL_mmap' ::: + * #define munmap(a,b) 'Error use MPL_munmap' ::: + */ +#undef strdup /* in case strdup is a macro */ +#define strdup(a) 'Error use MPL_strdup' ::: + +#define MPL_malloc(a,b) MPL_trmalloc((a),(b),__LINE__,__FILE__) +#define MPL_calloc(a,b,c) MPL_trcalloc((a),(b),(c),__LINE__,__FILE__) +#define MPL_free(a) MPL_trfree(a,__LINE__,__FILE__) +#define MPL_realloc(a,b,c) MPL_trrealloc((a),(b),(c),__LINE__,__FILE__) +#define MPL_mmap(a,b,c,d,e,f,g) MPL_trmmap((a),(b),(c),(d),(e),(f),(g),__LINE__,__FILE__) +#define MPL_munmap(a,b,c) MPL_trmunmap((a),(b),(c),__LINE__,__FILE__) + +#ifdef MPL_DEFINE_ALIGNED_ALLOC +#define MPL_aligned_alloc(a,b,c) MPL_traligned_alloc((a),(b),(c),__LINE__,__FILE__) +#endif /* #ifdef MPL_DEFINE_ALIGNED_ALLOC */ + +#else /* MPL_USE_MEMORY_TRACING */ +/* No memory tracing; just use native functions */ +/* size_t allows for larger values than PTRDIFF_MAX. GCC throws a + * warning if we pass a signed integer to MPL_malloc and friends, + * which when typecast to size_t becomes a very large number, saying + * that the max size exceeds that of PTRDIFF_MAX. */ +static inline void *MPL_malloc(size_t size, MPL_memory_class memclass) +{ + if (size <= PTRDIFF_MAX) { + return malloc(size); + } else { + return NULL; + } +} + +static inline void *MPL_calloc(size_t nmemb, size_t size, MPL_memory_class memclass) +{ + if (size <= PTRDIFF_MAX) { + return calloc(nmemb, size); + } else { + return NULL; + } +} + +static inline void *MPL_realloc(void *ptr, size_t size, MPL_memory_class memclass) +{ + if (size <= PTRDIFF_MAX) { + return realloc(ptr, size); + } else { + return NULL; + } +} + +#define MPL_free(a) free((void *)(a)) +#define MPL_mmap(a,b,c,d,e,f,g) mmap((void *)(a),(size_t)(b),(int)(c),(int)(d),(int)(e),(off_t)(f)) +#define MPL_munmap(a,b,c) munmap((void *)(a),(size_t)(b)) + +#ifdef MPL_DEFINE_ALIGNED_ALLOC +MPL_STATIC_INLINE_PREFIX void *MPL_aligned_alloc(size_t alignment, size_t size, + MPL_memory_class class) +{ +#if defined (MPL_HAVE_ALIGNED_ALLOC) + return aligned_alloc(alignment, size); +#elif defined (MPL_HAVE_POSIX_MEMALIGN) + void *ptr; + int ret; + + ret = posix_memalign(&ptr, alignment, size); + if (ret != 0) + return NULL; + return ptr; +#else +#error "MPL_DEFINE_ALIGNED_ALLOC defined but no underlying support function found - should not reach here." +#endif +} +#endif /* #ifdef MPL_DEFINE_ALIGNED_ALLOC */ + +#endif /* MPL_USE_MEMORY_TRACING */ + + +/* -------------------------------------------------------------------- + * MPL memory alignment union + * The MPL_mem_alignment_t union is used to help internal structures or buffers + * follow the alignment rules for all predefined datatypes. */ + +#if 0 /* sample usage : wrap up sample_t structure. */ +typedef union { + sample_t var; + MPL_mem_alignment_t alignment; +} aligned_sample_t; +#endif + +/* Union including all C types that possibly require the largest alignment bytes. + * Note that we do not need other Fortran/CXX predefined types because all of them + * are internally translated to appropriate C types. */ +typedef union { + /* Integer types. + * We only list signed types here, because an unsigned type always require + * the same alignment as its signed version. Fix me if this theory is wrong.*/ + long long_align; +#ifdef HAVE_LONG_LONG + long long ll_align; +#endif +#ifdef HAVE_INT32_T + int32_t int32_t_align; +#endif +#ifdef HAVE_INT64_T + int64_t int64_t_align; +#endif + + /* Logical type */ +#ifdef HAVE__BOOL + _Bool bool_align; +#endif + + /* Floating-point types */ + double double_align; +#ifdef HAVE_LONG_DOUBLE + long double ld_align; +#endif + + /* Complex types */ +#ifdef HAVE_DOUBLE__COMPLEX + double _Complex d_complex_align; +#endif +#ifdef HAVE_LONG_DOUBLE__COMPLEX + long double _Complex ld_complex_align; +#endif + /* MPICH handles Fortran/CXX complex types as structure (see src/include/oputil.h). + * Because some platform may have special alignment rule for structures, + * we include them as well. */ + struct { + double re; + double im; + } mpl_d_complex_align; +#ifdef HAVE_LONG_DOUBLE + struct { + long double re; + long double im; + } mpl_ld_complex_align; +#endif +} MPL_mem_alignment_t; + +/* END of MPL memory alignment union + * -------------------------------------------------------------------- */ + +/* FIXME: Consider an option of specifying __attribute__((malloc)) for + gcc - this lets gcc-style compilers know that the returned pointer + does not alias any pointer prior to the call. + */ +void MPL_trinit(void); +void MPL_trconfig(int, int); +void *MPL_trmalloc(size_t, MPL_memory_class, int, const char[]); +void MPL_trfree(void *, int, const char[]); +int MPL_trvalid(const char[]); +int MPL_trvalid2(const char[], int, const char[]); +void *MPL_trcalloc(size_t, size_t, MPL_memory_class, int, const char[]); +#include <sys/types.h> +void *MPL_trmmap(void *, size_t, int, int, int, off_t, MPL_memory_class, int, const char[]); +void MPL_trmunmap(void *, size_t, MPL_memory_class, int, const char[]); +void *MPL_trrealloc(void *, size_t, MPL_memory_class, int, const char[]); +void *MPL_trstrdup(const char *, int, const char[]); +void *MPL_traligned_alloc(size_t alignment, size_t length, MPL_memory_class, int, const char[]); + +/* Make sure that FILE is defined */ +#include <stdio.h> +void MPL_trdump(FILE *, int); +void MPL_trcategorydump(FILE * fp); + +char *MPL_strdup_no_spaces(const char *str); + +#endif /* MPL_TRMEM_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_valgrind.h b/3rd-party/romio341/mpl/include/mpl_valgrind.h new file mode 100644 index 0000000000000000000000000000000000000000..587edb61f09b74acdd42058b205e5266dfda9e09 --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_valgrind.h @@ -0,0 +1,198 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* IMPORTANT!!!: you must define MPL_VG_ENABLED before including mpl.h if you + want the the actual valgrind macros to be expanded when an MPL_VG_ macro is + used */ + +/* this file should not be included directly, it expects to be included from + * mpl.h with the results of various configure tests and several system + * libraries already included */ +#if !defined(MPL_H_INCLUDED) +#error do not include mpl_valgrind.h directly, use mpl.h instead +#endif + +/* valgrind interaction macros and header include logic + + These macros are intended to simplify client request interactions with + valgrind. A client source file that needs valgrind client requests if they + are available can include this file instead and use MPL_VG_ macros without + worrying about whether or not valgrind is actually present, which headers to + include, and how to include them. + + For more complicated logic this header will also define/undefine the + preprocessor token "MPL_VG_AVAILABLE". + + */ +#if !defined(MPL_VALGRIND_H_INCLUDED) +#define MPL_VALGRIND_H_INCLUDED + +#undef MPL_VG_AVAILABLE + +#if !defined(HAVE_BROKEN_VALGRIND) && defined(MPL_VG_ENABLED) +#if !defined(NVALGRIND) +#if defined(MPL_HAVE_VALGRIND_H) && defined(MPL_HAVE_MEMCHECK_H) +#include <valgrind.h> +#include <memcheck.h> +#define MPL_VG_AVAILABLE 1 +#elif defined(MPL_HAVE_VALGRIND_VALGRIND_H) && defined(MPL_HAVE_VALGRIND_MEMCHECK_H) +#include <valgrind/valgrind.h> +#include <valgrind/memcheck.h> +#define MPL_VG_AVAILABLE 1 +#endif +#endif +#endif + + +/* Valgrind-based thread checking tools: + * + * There are three main tools right now, Helgrind and DRD come in the standard + * Valgrind distribution, while ThreadSanitizer (tsan) requires a separate + * download. All three tools are fairly similar, with a few variations. They + * primarily check for data races by tracing the happens-before relation between + * memory accesses and synchronization primitives. Helgrind also offers good + * pthread API usage checking and lock-order checking, which usually makes it + * the most useful tool of the group. Unfortunately, Helgrind has the most + * limited support for client requests. + * + * All three tools are source-level compatible with the ANNOTATE_* set of macros + * defined by tsan. However, they are not totally binary compatible, so a + * particular tool must usually be selected at compile time. One exception to + * this is that modern-ish DRDs will usually understand Helgrind requests (but + * Helgrind won't understand DRD requests). + * + * To further complicate matters, Helgrind will issue warnings when a client + * request is encountered that it does not implement. In particular, Helgrind + * does not support ANNOTATE_BENIGN_RACE or + * ANNOTATE_IGNORE_{READS,WRITES}_{BEGIN,END}, which makes it difficult to avoid + * emitting warning/error messages w.r.t. some kinds of lockfree + * synchronization. + * + * So for the moment, we only provide a minimal set of annotations that seems to + * be both common between the tools and useful in MPICH. + */ + +#define MPL_VG_THREAD_INVALID 0 +#define MPL_VG_THREAD_HELGRIND 1 +#define MPL_VG_THREAD_DRD 2 +#define MPL_VG_THREAD_TSAN 3 + +/* TODO make this selectable by configure */ +/* default to helgrind for now, since DRD understands helgrind annotations, but + * not the other way around */ +#define MPL_VG_THREAD_TOOL MPL_VG_THREAD_HELGRIND + + +#if defined(MPL_VG_AVAILABLE) +#if (MPL_VG_THREAD_TOOL == MPL_VG_THREAD_HELGRIND) +#if defined(MPL_HAVE_HELGRIND_H) +#include <helgrind.h> +#define MPL_VG_THREAD_TOOL_SUPPORTED_ 1 +#elif defined(MPL_HAVE_VALGRIND_HELGRIND_H) +#include <valgrind/helgrind.h> +#define MPL_VG_THREAD_TOOL_SUPPORTED_ 1 +#endif +#elif (MPL_VG_THREAD_TOOL == MPL_VG_THREAD_DRD) +#if defined(MPL_HAVE_DRD_H) +#include <drd.h> +#define MPL_VG_THREAD_TOOL_SUPPORTED_ 1 +#elif defined(MPL_HAVE_VALGRIND_DRD_H) +#include <valgrind/drd.h> +#define MPL_VG_THREAD_TOOL_SUPPORTED_ 1 +#endif +#elif (MPL_VG_THREAD_TOOL == MPL_VG_THREAD_TSAN) + /* support wouldn't be hard to add, but it does require additional build + * system work */ +#error 'ThreadSanitizer not currently supported' +#else +#error 'unknown or unsupported tool' +#endif +#else +#undef MPL_VG_THREAD_TOOL_SUPPORTED_ /*defensive */ +#endif + +/* This is only a modest subset of all of the available client requests defined + in the valgrind headers. As MPICH is modified to use more of them, this + list should be expanded appropriately. */ +#if defined(MPL_VG_AVAILABLE) +#if defined(VALGRIND_MAKE_MEM_DEFINED) +/* this valgrind is version 3.2.0 or later */ +/* tt#1784: do not add extra parens around the VALGRIND_... macros, since + * valgrind-3.6.0 incorrectly includes a ";" at the end of the macro */ +#define MPL_VG_MAKE_MEM_DEFINED(addr_,len_) do { (void) VALGRIND_MAKE_MEM_DEFINED((addr_),(len_)); } while (0) +#define MPL_VG_MAKE_MEM_NOACCESS(addr_,len_) do { (void) VALGRIND_MAKE_MEM_NOACCESS((addr_),(len_)); } while (0) +#define MPL_VG_MAKE_MEM_UNDEFINED(addr_,len_) do { (void) VALGRIND_MAKE_MEM_UNDEFINED((addr_),(len_)); } while (0) +#define MPL_VG_CHECK_MEM_IS_DEFINED(addr_,len_) do { (void) VALGRIND_CHECK_MEM_IS_DEFINED((addr_),(len_)); } while (0) +#define MPL_VG_CHECK_MEM_IS_ADDRESSABLE(addr_,len_) do { (void) VALGRIND_CHECK_MEM_IS_ADDRESSABLE((addr_),(len_)); } while (0) +#else +/* this is an older version of valgrind. Use the older (subtly misleading) names */ +#define MPL_VG_MAKE_MEM_DEFINED(addr_,len_) VALGRIND_MAKE_READABLE((addr_),(len_)) +#define MPL_VG_MAKE_MEM_NOACCESS(addr_,len_) VALGRIND_MAKE_NOACCESS((addr_),(len_)) +#define MPL_VG_MAKE_MEM_UNDEFINED(addr_,len_) VALGRIND_MAKE_WRITABLE((addr_),(len_)) +#define MPL_VG_CHECK_MEM_IS_DEFINED(addr_,len_) VALGRIND_CHECK_READABLE((addr_),(len_)) +#define MPL_VG_CHECK_MEM_IS_ADDRESSABLE(addr_,len_) VALGRIND_CHECK_WRITABLE((addr_),(len_)) +#endif +#define MPL_VG_CREATE_BLOCK(addr_,len_,desc_) do { (void) VALGRIND_CREATE_BLOCK((addr_),(len_),(desc_)); } while (0) +#define MPL_VG_RUNNING_ON_VALGRIND() RUNNING_ON_VALGRIND +#define MPL_VG_PRINTF_BACKTRACE VALGRIND_PRINTF_BACKTRACE +/* Valgrind has a bug + * (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524488) that + * causes it to report a warning when the compiler adds padding to + * structures. Even when we initialize all the fields in the + * structure, the padding bytes are not initialized. The idea here is + * to detect when we are in "valgrind mode" and in such cases + * initialize all bytes of the structure. */ +#define MPL_VG_MEM_INIT(addr_,len_) do { memset(addr_, 0, len_); } while (0) + +/* custom allocator client requests, you probably shouldn't use these unless you + * really know what you are doing */ +#define MPL_VG_CREATE_MEMPOOL(pool, rzB, is_zeroed) VALGRIND_CREATE_MEMPOOL((pool), (rzB), (is_zeroed)) +#define MPL_VG_DESTROY_MEMPOOL(pool) VALGRIND_DESTROY_MEMPOOL((pool)) +#define MPL_VG_MEMPOOL_ALLOC(pool, addr, size) VALGRIND_MEMPOOL_ALLOC((pool), (addr), (size)) +#define MPL_VG_MEMPOOL_FREE(pool, addr) VALGRIND_MEMPOOL_FREE((pool), (addr)) + +#else /* !defined(MPL_VG_AVAILABLE) */ +#define MPL_VG_MAKE_MEM_DEFINED(addr_,len_) do {} while (0) +#define MPL_VG_MAKE_MEM_NOACCESS(addr_,len_) do {} while (0) +#define MPL_VG_MAKE_MEM_UNDEFINED(addr_,len_) do {} while (0) +#define MPL_VG_CHECK_MEM_IS_DEFINED(addr_,len_) do {} while (0) +#define MPL_VG_CHECK_MEM_IS_ADDRESSABLE(addr_,len_) do {} while (0) +#define MPL_VG_CREATE_BLOCK(addr_,len_,desc_) do {} while (0) +#define MPL_VG_RUNNING_ON_VALGRIND() (0) /*always false */ +#define MPL_VG_MEM_INIT(addr_,len_) do {} while (0) +#if defined(MPL_HAVE_MACRO_VA_ARGS) +#define MPL_VG_PRINTF_BACKTRACE(...) do {} while (0) +#else +#define MPL_VG_PRINTF_BACKTRACE MPL_VG_printf_do_nothing_func +static inline void MPL_VG_printf_do_nothing_func(char *fmt, ...) +{ + /* do nothing */ +} +#endif /* defined(MPL_HAVE_MACRO_VA_ARGS) */ +#define MPL_VG_CREATE_MEMPOOL(pool, rzB, is_zeroed) do {} while (0) +#define MPL_VG_DESTROY_MEMPOOL(pool) do {} while (0) +#define MPL_VG_MEMPOOL_ALLOC(pool, addr, size) do {} while (0) +#define MPL_VG_MEMPOOL_FREE(pool, addr) do {} while (0) + +#endif /* defined(MPL_VG_AVAILABLE) */ + +#if defined(MPL_VG_THREAD_TOOL_SUPPORTED_) + /* could switch on tool type, but all three tools know about these annotations */ +#define MPL_VG_ANNOTATE_HAPPENS_BEFORE(obj_) ANNOTATE_HAPPENS_BEFORE(obj_) +#define MPL_VG_ANNOTATE_HAPPENS_AFTER(obj_) ANNOTATE_HAPPENS_AFTER(obj_) + /* older versions of some of Helgrind & DRD don't support this annotation */ +#if defined(ANNOTATE_NEW_MEMORY) +#define MPL_VG_ANNOTATE_NEW_MEMORY(obj_,size_) ANNOTATE_NEW_MEMORY(obj_,size_) +#else +#define MPL_VG_ANNOTATE_NEW_MEMORY(obj_,size_) do {} while (0) +#endif +#else +#define MPL_VG_ANNOTATE_HAPPENS_BEFORE(obj_) do {} while (0) +#define MPL_VG_ANNOTATE_HAPPENS_AFTER(obj_) do {} while (0) +#define MPL_VG_ANNOTATE_NEW_MEMORY(obj_,size_) do {} while (0) +#endif + + +#endif /* MPL_VALGRIND_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/mpl_yield.h b/3rd-party/romio341/mpl/include/mpl_yield.h new file mode 100644 index 0000000000000000000000000000000000000000..4b40698d40183e4775fc13078202a2158675622d --- /dev/null +++ b/3rd-party/romio341/mpl/include/mpl_yield.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_YIELD_H_INCLUDED +#define MPL_YIELD_H_INCLUDED + +#include "mplconfig.h" + +/* MPL_SCHED_YIELD() - Yield the processor to OS scheduler */ +/* On a typical Linux system (verified with kernels 3.2 and 3.5), + * usleep has a resolution of more than 1000 cycles. This makes + * it impractical if the desired sleeping period is shorter. On + * the other hand, sleep(0) returns immediately without going to + * the kernel. This means that there is no actual yielding, which + * is equivalent to doing nothing. Thus, usleep and sleep are not + * recommended as ways to yield the CPU, and sched_yield would be + * preferred if available. + * Note that nanosleep has the same shortcomings as usleep.*/ + +#if defined(MPL_USE_SWITCHTOTHREAD_FOR_YIELD) +#include <winsock2.h> +#include <windows.h> +#define MPL_sched_yield() SwitchToThread() +#elif defined(MPL_USE_WIN32_SLEEP_FOR_YIELD) +#include <winsock2.h> +#include <windows.h> +#define MPL_sched_yield() Sleep(0) +#elif defined(MPL_USE_SCHED_YIELD_FOR_YIELD) +#ifdef MPL_HAVE_SCHED_H +#include <sched.h> +#endif +#define MPL_sched_yield() sched_yield() +#elif defined(MPL_USE_YIELD_FOR_YIELD) +#ifdef MPL_HAVE_SCHED_H +#include <sched.h> +#endif +#define MPL_sched_yield() yield() +#elif defined (MPL_USE_SELECT_FOR_YIELD) +#ifdef MPL_HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif +#define MPL_sched_yield() do { struct timeval t; t.tv_sec = 0; t.tv_usec = 0; select(0,0,0,0,&t); } while (0) +#elif defined (MPL_USE_USLEEP_FOR_YIELD) +#ifdef MPL_HAVE_UNISTD_H +#include <unistd.h> +#if defined (MPL_NEEDS_USLEEP_DECL) +int usleep(useconds_t usec); +#endif +#endif +#define MPL_sched_yield() usleep(0) +#elif defined (MPL_USE_SLEEP_FOR_YIELD) +#ifdef MPL_HAVE_UNISTD_H +#include <unistd.h> +#endif +#define MPL_sched_yield() sleep(0) +#elif defined (MPL_USE_NOTHING_FOR_YIELD) +#define MPL_sched_yield() do {} while (0) +#else +#error "No mechanism available to yield" +#endif + +#endif /* MPL_YIELD_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/utarray.h b/3rd-party/romio341/mpl/include/utarray.h new file mode 100644 index 0000000000000000000000000000000000000000..8e2e4fac293911aee5f4816a29c923e8ac22dcf4 --- /dev/null +++ b/3rd-party/romio341/mpl/include/utarray.h @@ -0,0 +1,270 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* +Copyright (c) 2008-2011, Troy D. Hanson http://uthash.sourceforge.net +All rights reserved. + +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER +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. +*/ + +/* MPICH notes: + * - The file name has been changed to avoid conflicts with any system-installed + * "utlist.h" header files. + * - malloc/free/realloc usages have been substituted with utarray_malloc_ + * (etc.) indirection macros and then changed to use MPL_malloc and friends + * - add a ut_ptr_icd for the common case of dynamic tables of pointers + * - intentionally omitted from "mpiimpl.h" in order to require using code to + * opt-in + * [goodell@ 2011-10-04] */ + +/* a dynamic array implementation using macros + * see http://uthash.sourceforge.net/utarray + */ +#ifndef UTARRAY_H_INCLUDED +#define UTARRAY_H_INCLUDED + +#define UTARRAY_VERSION 1.9.4 + +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((__unused__)) +#else +#define _UNUSED_ +#endif + +#include <stddef.h> /* size_t */ +#include <string.h> /* memset, etc */ +#include <stdlib.h> /* exit */ + +/* MPICH modification: override these to change what malloc/free/realloc + * routines are used by the utarray code */ +#define utarray_malloc_(x_,class_) MPL_malloc(x_,class_) +#define utarray_free_(x_) MPL_free(x_) +#define utarray_realloc_(x_,y_,class_) MPL_realloc(x_,y_,class_) +#define utarray_strdup_(x_) MPL_strdup(x_) + +#ifndef utarray_oom +#define utarray_oom() exit(-1) +#endif + +typedef void (ctor_f) (void *dst, const void *src); +typedef void (dtor_f) (void *elt); +typedef void (init_f) (void *elt); +typedef struct { + size_t sz; + init_f *init; + ctor_f *copy; + dtor_f *dtor; +} UT_icd; + +typedef struct { + unsigned i, n; /* i: index of next available slot, n: num slots */ + const UT_icd *icd; /* initializer, copy and destructor functions */ + char *d; /* n slots of size icd->sz */ +} UT_array; + +#define utarray_init(a,_icd) do { \ + memset(a,0,sizeof(UT_array)); \ + (a)->icd=_icd; \ +} while (0) + +#define utarray_done(a) do { \ + if ((a)->n) { \ + if ((a)->icd->dtor) { \ + size_t _ut_i; \ + for(_ut_i=0; _ut_i < (a)->i; _ut_i++) { \ + (a)->icd->dtor(utarray_eltptr(a,_ut_i)); \ + } \ + } \ + utarray_free_((a)->d); \ + } \ + (a)->n=0; \ +} while (0) + +#define utarray_new(a,_icd, class) do { \ + a=(UT_array*)utarray_malloc_(sizeof(UT_array), class); \ + if (a == NULL) utarray_oom(); \ + utarray_init(a,_icd); \ +} while (0) + +#define utarray_free(a) do { \ + utarray_done(a); \ + utarray_free_(a); \ +} while (0) + +#define utarray_reserve(a,by,class) do { \ + if (((a)->i+by) > ((a)->n)) { \ + void * d_; \ + while (((a)->i+by) > ((a)->n)) { (a)->n = ((a)->n ? (2*(a)->n) : 8); } \ + d_=(char*)utarray_realloc_((a)->d, (a)->n*(a)->icd->sz, class); \ + if (d_ == NULL) utarray_oom(); \ + (a)->d = d_; \ + } \ +} while (0) + +#define utarray_push_back(a,p,class) do { \ + utarray_reserve(a,1,class); \ + if ((a)->icd->copy) { (a)->icd->copy(_utarray_eltptr(a,(a)->i++), p); } \ + else { memcpy(_utarray_eltptr(a,(a)->i++), p, (a)->icd->sz); }; \ +} while (0) + +#define utarray_pop_back(a) do { \ + if ((a)->icd->dtor) { (a)->icd->dtor(_utarray_eltptr(a,--((a)->i))); } \ + else { (a)->i--; } \ +} while (0) + +#define utarray_extend_back(a,class) do { \ + utarray_reserve(a,1,class); \ + if ((a)->icd->init) { (a)->icd->init(_utarray_eltptr(a,(a)->i)); } \ + else { memset(_utarray_eltptr(a,(a)->i),0,(a)->icd->sz); } \ + (a)->i++; \ +} while (0) + +#define utarray_len(a) ((a)->i) + +#define utarray_eltptr(a,j) ((((unsigned) j) < (a)->i) ? _utarray_eltptr(a,j) : NULL) +#define _utarray_eltptr(a,j) ((char*)((a)->d + ((a)->icd->sz*(j)))) + +#define utarray_insert(a,p,j,class) do { \ + utarray_reserve(a,1,class); \ + if (j > (a)->i) break; \ + if ((j) < (a)->i) { \ + memmove(_utarray_eltptr(a,(j)+1), _utarray_eltptr(a,j), \ + ((a)->i - (j))*((a)->icd->sz)); \ + } \ + if ((a)->icd->copy) { (a)->icd->copy(_utarray_eltptr(a,j), p); } \ + else { memcpy(_utarray_eltptr(a,j), p, (a)->icd->sz); }; \ + (a)->i++; \ +} while (0) + +#define utarray_inserta(a,w,j,class) do { \ + if (utarray_len(w) == 0) break; \ + if (j > (a)->i) break; \ + utarray_reserve(a,utarray_len(w),class); \ + if ((j) < (a)->i) { \ + memmove(_utarray_eltptr(a,(j)+utarray_len(w)), \ + _utarray_eltptr(a,j), \ + ((a)->i - (j))*((a)->icd->sz)); \ + } \ + if ((a)->icd->copy) { \ + size_t _ut_i; \ + for(_ut_i=0;_ut_i<(w)->i;_ut_i++) { \ + (a)->icd->copy(_utarray_eltptr(a,j+_ut_i), _utarray_eltptr(w,_ut_i)); \ + } \ + } else { \ + memcpy(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \ + utarray_len(w)*((a)->icd->sz)); \ + } \ + (a)->i += utarray_len(w); \ +} while (0) + +#define utarray_resize(dst,num,class) do { \ + size_t _ut_i; \ + if (dst->i > (size_t)(num)) { \ + if ((dst)->icd->dtor) { \ + for(_ut_i=num; _ut_i < dst->i; _ut_i++) { \ + (dst)->icd->dtor(utarray_eltptr(dst,_ut_i)); \ + } \ + } \ + } else if (dst->i < (size_t)(num)) { \ + utarray_reserve(dst,num-dst->i,class); \ + if ((dst)->icd->init) { \ + for(_ut_i=dst->i; _ut_i < num; _ut_i++) { \ + (dst)->icd->init(utarray_eltptr(dst,_ut_i)); \ + } \ + } else { \ + memset(_utarray_eltptr(dst,dst->i),0,(dst)->icd->sz*(num-dst->i)); \ + } \ + } \ + dst->i = num; \ +} while (0) + +#define utarray_concat(dst,src,class) do { \ + utarray_inserta((dst),(src),utarray_len(dst),class); \ +} while (0) + +#define utarray_erase(a,pos,len) do { \ + if ((a)->icd->dtor) { \ + size_t _ut_i; \ + for(_ut_i=0; _ut_i < len; _ut_i++) { \ + (a)->icd->dtor(utarray_eltptr(a,pos+_ut_i)); \ + } \ + } \ + if ((a)->i > (pos+len)) { \ + memmove(_utarray_eltptr(a,pos), _utarray_eltptr(a,pos+len), \ + ((a->i)-(pos+len))*((a)->icd->sz)); \ + } \ + (a)->i -= (len); \ +} while (0) + +#define utarray_clear(a) do { \ + if ((a)->i > 0) { \ + if ((a)->icd->dtor) { \ + size_t _ut_i; \ + for(_ut_i=0; _ut_i < (a)->i; _ut_i++) { \ + (a)->icd->dtor(utarray_eltptr(a,_ut_i)); \ + } \ + } \ + (a)->i = 0; \ + } \ +} while (0) + +#define utarray_sort(a,cmp) do { \ + qsort((a)->d, (a)->i, (a)->icd->sz, cmp); \ +} while (0) + +#define utarray_find(a,v,cmp) bsearch((v),(a)->d,(a)->i,(a)->icd->sz,cmp) + +#define utarray_front(a) (((a)->i) ? (_utarray_eltptr(a,0)) : NULL) +#define utarray_next(a,e) (((e)==NULL) ? utarray_front(a) : ((((a)->i) > (utarray_eltidx(a,e)+1)) ? _utarray_eltptr(a,utarray_eltidx(a,e)+1) : NULL)) +#define utarray_back(a) (((a)->i) ? (_utarray_eltptr(a,(a)->i-1)) : NULL) +#define utarray_eltidx(a,e) (((char*)(e) >= (char*)((a)->d)) ? (((char*)(e) - (char*)((a)->d))/(a)->icd->sz) : -1) + +/* last we pre-define a few icd for common utarrays of ints and strings */ +static void utarray_str_cpy(void *dst, const void *src) +{ + char **_src = (char **) src, **_dst = (char **) dst; + *_dst = (*_src == NULL) ? NULL : (char *) utarray_strdup_(*_src); +} + +static void utarray_str_dtor(void *elt) +{ + char **eltc = (char **) elt; + if (*eltc) + utarray_free_(*eltc); +} +static const UT_icd ut_str_icd _UNUSED_ = + { sizeof(char *), NULL, utarray_str_cpy, utarray_str_dtor }; +static const UT_icd ut_int_icd _UNUSED_ = { sizeof(int), NULL, NULL, NULL }; + +/* MPICH additions: */ +static const UT_icd ut_ptr_icd _UNUSED_ = { sizeof(void *), NULL, NULL, NULL }; + +/* These are convenience macros for directly accessing the array. + Care should be taken when using the returned pointer as the pointer + can be invalidated by other utarray operations. */ +#define ut_int_array(a) ((int*)(a)->d) +#define ut_str_array(a) ((char**)(a)->d) +#define ut_ptr_array(a) ((void**)(a)->d) +#define ut_type_array(a, type) ((type)(a)->d) + + +#endif /* UTARRAY_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/uthash.h b/3rd-party/romio341/mpl/include/uthash.h new file mode 100644 index 0000000000000000000000000000000000000000..1a4f8a2758a636a1436d3535e0036a48fb0b79ec --- /dev/null +++ b/3rd-party/romio341/mpl/include/uthash.h @@ -0,0 +1,1078 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* +Copyright (c) 2003-2017, Troy D. Hanson http://troydhanson.github.com/uthash/ +All rights reserved. + +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER +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. +*/ + +/* MPICH changes: + * + * - some configure-time checking for __typeof() support was added + * - intentionally omitted from "mpl.h" in order to require using code to opt-in + * - override malloc/free/realloc to call MPL routines + * - check head first before calculating HASH_VALUE in HASH_FIND + */ + +#ifndef UTHASH_H_INCLUDED +#define UTHASH_H_INCLUDED + +#define UTHASH_VERSION 2.0.2 + +#include <string.h> /* memcmp,strlen */ +#include <stddef.h> /* ptrdiff_t */ +#include <stdlib.h> /* exit() */ + +#ifdef MPL_HAVE___TYPEOF /* MPICH modification */ +/* These macros use decltype or the earlier __typeof GNU extension. + As decltype is only available in newer compilers (VS2010 or gcc 4.3+ + when compiling c++ source) this code uses whatever method is needed + or, for VS2008 where neither is available, uses casting workarounds. */ +#if defined(_MSC_VER) /* MS compiler */ +#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ +#define DECLTYPE(x) (decltype(x)) +#else /* VS2008 or older (or VS2010 in C mode) */ +#define NO_DECLTYPE +#define DECLTYPE(x) +#endif +#elif defined(__BORLANDC__) || defined(__LCC__) || defined(__WATCOMC__) +#define NO_DECLTYPE +#define DECLTYPE(x) +#else /* GNU, Sun and other compilers */ +#define DECLTYPE(x) (__typeof(x)) +#endif +#else /* !MPL_HAVE___TYPEOF */ +#define MPL_NO_DECLTYPE +#define MPL_DECLTYPE(x) +#endif /* !MPL_HAVE__TYPEOF */ + +#ifdef NO_DECLTYPE +#define DECLTYPE_ASSIGN(dst,src) \ +do { \ + char **_da_dst = (char**)(&(dst)); \ + *_da_dst = (char*)(src); \ +} while (0) +#else +#define DECLTYPE_ASSIGN(dst,src) \ +do { \ + (dst) = DECLTYPE(dst)(src); \ +} while (0) +#endif + +#ifndef uthash_fatal +#define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ +#endif +#ifndef uthash_malloc +#define uthash_malloc(sz,class) MPL_malloc(sz,class) /* malloc fcn */ +#endif +#ifndef uthash_free +#define uthash_free(ptr,sz) MPL_free(ptr) /* free fcn */ +#endif +#ifndef uthash_strlen +#define uthash_strlen(s) strlen(s) +#endif +#ifndef uthash_memcmp +#define uthash_memcmp(a,b,n) memcmp(a,b,n) +#endif + +#ifndef uthash_noexpand_fyi +#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ +#endif +#ifndef uthash_expand_fyi +#define uthash_expand_fyi(tbl) /* can be defined to log expands */ +#endif + +/* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ +#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ + +/* calculate the element whose hash handle address is hhp */ +#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) +/* calculate the hash handle from element address elp */ +#define HH_FROM_ELMT(tbl,elp) ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho))) + +#define HASH_VALUE(keyptr,keylen,hashv) \ +do { \ + HASH_FCN(keyptr, keylen, hashv); \ +} while (0) + +#define HASH_FIND_BYHASHVALUE(hh,head,keyptr,keylen,hashval,out) \ +do { \ + (out) = NULL; \ + if (head) { \ + unsigned _hf_bkt; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ + if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \ + HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \ + } \ + } \ +} while (0) + +#define HASH_FIND(hh,head,keyptr,keylen,out) \ +do { \ + unsigned _hf_hashv; \ + (out) = NULL; \ + if (head) { \ + HASH_VALUE(keyptr, keylen, _hf_hashv); \ + HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \ + } \ +} while (0) + +#ifdef HASH_BLOOM +#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) +#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) +#define HASH_BLOOM_MAKE(tbl,class) \ +do { \ + (tbl)->bloom_nbits = HASH_BLOOM; \ + (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN,class); \ + if (!((tbl)->bloom_bv)) { uthash_fatal("out of memory"); } \ + memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ + (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ +} while (0) + +#define HASH_BLOOM_FREE(tbl) \ +do { \ + uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ +} while (0) + +#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) +#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) + +#define HASH_BLOOM_ADD(tbl,hashv) \ + HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) + +#define HASH_BLOOM_TEST(tbl,hashv) \ + HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) + +#else +#define HASH_BLOOM_MAKE(tbl,class) +#define HASH_BLOOM_FREE(tbl) +#define HASH_BLOOM_ADD(tbl,hashv) +#define HASH_BLOOM_TEST(tbl,hashv) (1) +#define HASH_BLOOM_BYTELEN 0U +#endif + +#define HASH_MAKE_TABLE(hh,head,class) \ +do { \ + (head)->hh.tbl = (UT_hash_table*)uthash_malloc(\ + sizeof(UT_hash_table),class); \ + if (!((head)->hh.tbl)) { uthash_fatal("out of memory"); } \ + memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ + (head)->hh.tbl->tail = &((head)->hh); \ + (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ + (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ + (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ + (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc(\ + HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket),class); \ + if (! (head)->hh.tbl->buckets) { uthash_fatal("out of memory"); } \ + memset((head)->hh.tbl->buckets, 0, \ + HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ + HASH_BLOOM_MAKE((head)->hh.tbl,class); \ + (head)->hh.tbl->signature = HASH_SIGNATURE; \ +} while (0) + +#define HASH_REPLACE_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,replaced,cmpfcn,class) \ +do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn, class); \ +} while (0) + +#define HASH_REPLACE_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,replaced,class) \ +do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add, class); \ +} while (0) + +#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced,class) \ +do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, class); \ +} while (0) + +#define HASH_REPLACE_INORDER(hh,head,fieldname,keylen_in,add,replaced,cmpfcn,class) \ +do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn, class); \ +} while (0) + +#define HASH_APPEND_LIST(hh, head, add) \ +do { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ + (head)->hh.tbl->tail->next = (add); \ + (head)->hh.tbl->tail = &((add)->hh); \ +} while (0) + +#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh,head,keyptr,keylen_in,hashval,add,cmpfcn,class) \ +do { \ + unsigned _ha_bkt; \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (char*) (keyptr); \ + (add)->hh.keylen = (unsigned) (keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + (head) = (add); \ + HASH_MAKE_TABLE(hh, head, class); \ + } else { \ + void *_hs_iter = (head); \ + (add)->hh.tbl = (head)->hh.tbl; \ + do { \ + if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) \ + break; \ + } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ + if (_hs_iter) { \ + (add)->hh.next = _hs_iter; \ + if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \ + HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \ + } else { \ + (head) = (add); \ + } \ + HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \ + } else { \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + } \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh, class); \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ + HASH_FSCK(hh, head); \ +} while (0) + +#define HASH_ADD_KEYPTR_INORDER(hh,head,keyptr,keylen_in,add,cmpfcn,class) \ +do { \ + unsigned _hs_hashv; \ + HASH_VALUE(keyptr, keylen_in, _hs_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn, class); \ +} while (0) + +#define HASH_ADD_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,cmpfcn,class) \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn, class) + +#define HASH_ADD_INORDER(hh,head,fieldname,keylen_in,add,cmpfcn,class) \ + HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn, class) + +#define HASH_ADD_KEYPTR_BYHASHVALUE(hh,head,keyptr,keylen_in,hashval,add,class) \ +do { \ + unsigned _ha_bkt; \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (char*) (keyptr); \ + (add)->hh.keylen = (unsigned) (keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + (head) = (add); \ + HASH_MAKE_TABLE(hh, head, class); \ + } else { \ + (add)->hh.tbl = (head)->hh.tbl; \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh, class); \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ + HASH_FSCK(hh, head); \ +} while (0) + +#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add,class) \ +do { \ + unsigned _ha_hashv; \ + HASH_VALUE(keyptr, keylen_in, _ha_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add, class); \ +} while (0) + +#define HASH_ADD_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,class) \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add, class) + +#define HASH_ADD(hh,head,fieldname,keylen_in,add,class) \ + HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add, class) + +#define HASH_TO_BKT(hashv,num_bkts,bkt) \ +do { \ + bkt = ((hashv) & ((num_bkts) - 1U)); \ +} while (0) + +/* delete "delptr" from the hash table. + * "the usual" patch-up process for the app-order doubly-linked-list. + * The use of _hd_hh_del below deserves special explanation. + * These used to be expressed using (delptr) but that led to a bug + * if someone used the same symbol for the head and deletee, like + * HASH_DELETE(hh,users,users); + * We want that to work, but by changing the head (users) below + * we were forfeiting our ability to further refer to the deletee (users) + * in the patch-up process. Solution: use scratch space to + * copy the deletee pointer, then the latter references are via that + * scratch pointer rather than through the repointed (users) symbol. + */ +#define HASH_DELETE(hh,head,delptr) \ +do { \ + struct UT_hash_handle *_hd_hh_del; \ + if (((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL)) { \ + uthash_free((head)->hh.tbl->buckets, \ + (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ + HASH_BLOOM_FREE((head)->hh.tbl); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + head = NULL; \ + } else { \ + unsigned _hd_bkt; \ + _hd_hh_del = &((delptr)->hh); \ + if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \ + (head)->hh.tbl->tail = \ + (UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ + (head)->hh.tbl->hho); \ + } \ + if ((delptr)->hh.prev != NULL) { \ + ((UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ + (head)->hh.tbl->hho))->next = (delptr)->hh.next; \ + } else { \ + DECLTYPE_ASSIGN(head,(delptr)->hh.next); \ + } \ + if (_hd_hh_del->next != NULL) { \ + ((UT_hash_handle*)((ptrdiff_t)_hd_hh_del->next + \ + (head)->hh.tbl->hho))->prev = \ + _hd_hh_del->prev; \ + } \ + HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ + HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ + (head)->hh.tbl->num_items--; \ + } \ + HASH_FSCK(hh,head); \ +} while (0) + + +/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ +#define HASH_FIND_STR(head,findstr,out) \ + HASH_FIND(hh,head,findstr,(unsigned)uthash_strlen(findstr),out) +#define HASH_ADD_STR(head,strfield,add,class) \ + HASH_ADD(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add,class) +#define HASH_REPLACE_STR(head,strfield,add,replaced,class) \ + HASH_REPLACE(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add,replaced,class) +#define HASH_FIND_INT(head,findint,out) \ + HASH_FIND(hh,head,findint,sizeof(int),out) +#define HASH_ADD_INT(head,intfield,add,class) \ + HASH_ADD(hh,head,intfield,sizeof(int),add,class) +#define HASH_REPLACE_INT(head,intfield,add,replaced,class) \ + HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced,class) +#define HASH_FIND_PTR(head,findptr,out) \ + HASH_FIND(hh,head,findptr,sizeof(void *),out) +#define HASH_ADD_PTR(head,ptrfield,add,class) \ + HASH_ADD(hh,head,ptrfield,sizeof(void *),add,class) +#define HASH_REPLACE_PTR(head,ptrfield,add,replaced,class) \ + HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced,class) +#define HASH_DEL(head,delptr) \ + HASH_DELETE(hh,head,delptr) + +/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. + * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. + */ +#ifdef HASH_DEBUG +#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) +#define HASH_FSCK(hh,head) \ +do { \ + struct UT_hash_handle *_thh; \ + if (head) { \ + unsigned _bkt_i; \ + unsigned _count; \ + char *_prev; \ + _count = 0; \ + for(_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ + unsigned _bkt_count = 0; \ + _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ + _prev = NULL; \ + while (_thh) { \ + if (_prev != (char*)(_thh->hh_prev)) { \ + HASH_OOPS("invalid hh_prev %p, actual %p\n", \ + _thh->hh_prev, _prev); \ + } \ + _bkt_count++; \ + _prev = (char*)(_thh); \ + _thh = _thh->hh_next; \ + } \ + _count += _bkt_count; \ + if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ + HASH_OOPS("invalid bucket count %u, actual %u\n", \ + (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ + } \ + } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("invalid hh item count %u, actual %u\n", \ + (head)->hh.tbl->num_items, _count); \ + } \ + /* traverse hh in app order; check next/prev integrity, count */ \ + _count = 0; \ + _prev = NULL; \ + _thh = &(head)->hh; \ + while (_thh) { \ + _count++; \ + if (_prev !=(char*)(_thh->prev)) { \ + HASH_OOPS("invalid prev %p, actual %p\n", \ + _thh->prev, _prev); \ + } \ + _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ + _thh = (_thh->next ? (UT_hash_handle*)((char*)(_thh->next) + \ + (head)->hh.tbl->hho) : NULL); \ + } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("invalid app item count %u, actual %u\n", \ + (head)->hh.tbl->num_items, _count); \ + } \ + } \ +} while (0) +#else +#define HASH_FSCK(hh,head) +#endif + +/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to + * the descriptor to which this macro is defined for tuning the hash function. + * The app can #include <unistd.h> to get the prototype for write(2). */ +#ifdef HASH_EMIT_KEYS +#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ +do { \ + unsigned _klen = fieldlen; \ + write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ + write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ +} while (0) +#else +#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) +#endif + +/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ +#ifdef HASH_FUNCTION +#define HASH_FCN HASH_FUNCTION +#else +#define HASH_FCN HASH_JEN +#endif + +/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ +#define HASH_BER(key,keylen,hashv) \ +do { \ + unsigned _hb_keylen=(unsigned)keylen; \ + const unsigned char *_hb_key=(const unsigned char*)(key); \ + (hashv) = 0; \ + while (_hb_keylen-- != 0U) { \ + (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ + } \ +} while (0) + + +/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at + * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ +#define HASH_SAX(key,keylen,hashv) \ +do { \ + unsigned _sx_i; \ + const unsigned char *_hs_key=(const unsigned char*)(key); \ + hashv = 0; \ + for(_sx_i=0; _sx_i < keylen; _sx_i++) { \ + hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ + } \ +} while (0) +/* FNV-1a variation */ +#define HASH_FNV(key,keylen,hashv) \ +do { \ + unsigned _fn_i; \ + const unsigned char *_hf_key=(const unsigned char*)(key); \ + hashv = 2166136261U; \ + for(_fn_i=0; _fn_i < keylen; _fn_i++) { \ + hashv = hashv ^ _hf_key[_fn_i]; \ + hashv = hashv * 16777619U; \ + } \ +} while (0) + +#define HASH_OAT(key,keylen,hashv) \ +do { \ + unsigned _ho_i; \ + const unsigned char *_ho_key=(const unsigned char*)(key); \ + hashv = 0; \ + for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ + hashv += _ho_key[_ho_i]; \ + hashv += (hashv << 10); \ + hashv ^= (hashv >> 6); \ + } \ + hashv += (hashv << 3); \ + hashv ^= (hashv >> 11); \ + hashv += (hashv << 15); \ +} while (0) + +#define HASH_JEN_MIX(a,b,c) \ +do { \ + a -= b; a -= c; a ^= (c >> 13); \ + b -= c; b -= a; b ^= (a << 8); \ + c -= a; c -= b; c ^= (b >> 13); \ + a -= b; a -= c; a ^= (c >> 12); \ + b -= c; b -= a; b ^= (a << 16); \ + c -= a; c -= b; c ^= (b >> 5); \ + a -= b; a -= c; a ^= (c >> 3); \ + b -= c; b -= a; b ^= (a << 10); \ + c -= a; c -= b; c ^= (b >> 15); \ +} while (0) + +#define HASH_JEN(key,keylen,hashv) \ +do { \ + unsigned _hj_i,_hj_j,_hj_k; \ + unsigned const char *_hj_key=(unsigned const char*)(key); \ + hashv = 0xfeedbeefu; \ + _hj_i = _hj_j = 0x9e3779b9u; \ + _hj_k = (unsigned)(keylen); \ + while (_hj_k >= 12U) { \ + _hj_i += (_hj_key[0] + ((unsigned)_hj_key[1] << 8) \ + + ((unsigned)_hj_key[2] << 16) \ + + ((unsigned)_hj_key[3] << 24)); \ + _hj_j += (_hj_key[4] + ((unsigned)_hj_key[5] << 8) \ + + ((unsigned)_hj_key[6] << 16) \ + + ((unsigned)_hj_key[7] << 24)); \ + hashv += (_hj_key[8] + ((unsigned)_hj_key[9] << 8) \ + + ((unsigned)_hj_key[10] << 16) \ + + ((unsigned)_hj_key[11] << 24)); \ + \ + HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ + \ + _hj_key += 12; \ + _hj_k -= 12U; \ + } \ + hashv += (unsigned)(keylen); \ + switch (_hj_k) { \ + case 11: hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \ + case 10: hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \ + case 9: hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \ + case 8: _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \ + case 7: _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \ + case 6: _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \ + case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ + case 4: _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \ + case 3: _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \ + case 2: _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \ + case 1: _hj_i += _hj_key[0]; \ + } \ + HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ +} while (0) + +/* The Paul Hsieh hash function */ +#undef get16bits +#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ + || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) +#define get16bits(d) (*((const uint16_t *) (d))) +#endif + +#if !defined (get16bits) +#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ + +(uint32_t)(((const uint8_t *)(d))[0])) +#endif +#define HASH_SFH(key,keylen,hashv) \ +do { \ + unsigned const char *_sfh_key=(unsigned const char*)(key); \ + uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ + \ + unsigned _sfh_rem = _sfh_len & 3U; \ + _sfh_len >>= 2; \ + hashv = 0xcafebabeu; \ + \ + /* Main loop */ \ + for (;_sfh_len > 0U; _sfh_len--) { \ + hashv += get16bits (_sfh_key); \ + _sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \ + hashv = (hashv << 16) ^ _sfh_tmp; \ + _sfh_key += 2U*sizeof (uint16_t); \ + hashv += hashv >> 11; \ + } \ + \ + /* Handle end cases */ \ + switch (_sfh_rem) { \ + case 3: hashv += get16bits (_sfh_key); \ + hashv ^= hashv << 16; \ + hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \ + hashv += hashv >> 11; \ + break; \ + case 2: hashv += get16bits (_sfh_key); \ + hashv ^= hashv << 11; \ + hashv += hashv >> 17; \ + break; \ + case 1: hashv += *_sfh_key; \ + hashv ^= hashv << 10; \ + hashv += hashv >> 1; \ + } \ + \ + /* Force "avalanching" of final 127 bits */ \ + hashv ^= hashv << 3; \ + hashv += hashv >> 5; \ + hashv ^= hashv << 4; \ + hashv += hashv >> 17; \ + hashv ^= hashv << 25; \ + hashv += hashv >> 6; \ +} while (0) + +#ifdef HASH_USING_NO_STRICT_ALIASING +/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. + * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. + * MurmurHash uses the faster approach only on CPU's where we know it's safe. + * + * Note the preprocessor built-in defines can be emitted using: + * + * gcc -m64 -dM -E - < /dev/null (on gcc) + * cc -## a.c (where a.c is a simple test file) (Sun Studio) + */ +#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) +#define MUR_GETBLOCK(p,i) p[i] +#else /* non intel */ +#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL) +#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL) +#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) +#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) +#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) +#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) +#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) +#define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) +#define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) +#else /* assume little endian non-intel */ +#define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) +#define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) +#define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) +#endif +#define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ + (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ + (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ + MUR_ONE_THREE(p)))) +#endif +#define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) +#define MUR_FMIX(_h) \ +do { \ + _h ^= _h >> 16; \ + _h *= 0x85ebca6bu; \ + _h ^= _h >> 13; \ + _h *= 0xc2b2ae35u; \ + _h ^= _h >> 16; \ +} while (0) + +#define HASH_MUR(key,keylen,hashv) \ +do { \ + const uint8_t *_mur_data = (const uint8_t*)(key); \ + const int _mur_nblocks = (int)(keylen) / 4; \ + uint32_t _mur_h1 = 0xf88D5353u; \ + uint32_t _mur_c1 = 0xcc9e2d51u; \ + uint32_t _mur_c2 = 0x1b873593u; \ + uint32_t _mur_k1 = 0; \ + const uint8_t *_mur_tail; \ + const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \ + int _mur_i; \ + for(_mur_i = -_mur_nblocks; _mur_i!=0; _mur_i++) { \ + _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ + _mur_k1 *= _mur_c1; \ + _mur_k1 = MUR_ROTL32(_mur_k1,15); \ + _mur_k1 *= _mur_c2; \ + \ + _mur_h1 ^= _mur_k1; \ + _mur_h1 = MUR_ROTL32(_mur_h1,13); \ + _mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \ + } \ + _mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \ + _mur_k1=0; \ + switch((keylen) & 3U) { \ + case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \ + case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \ + case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \ + _mur_k1 *= _mur_c1; \ + _mur_k1 = MUR_ROTL32(_mur_k1,15); \ + _mur_k1 *= _mur_c2; \ + _mur_h1 ^= _mur_k1; \ + } \ + _mur_h1 ^= (uint32_t)(keylen); \ + MUR_FMIX(_mur_h1); \ + hashv = _mur_h1; \ +} while (0) +#endif /* HASH_USING_NO_STRICT_ALIASING */ + +/* iterate over items in a known bucket to find desired item */ +#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,hashval,out) \ +do { \ + if ((head).hh_head != NULL) { \ + DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \ + } else { \ + (out) = NULL; \ + } \ + while ((out) != NULL) { \ + if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \ + if (uthash_memcmp((out)->hh.key, keyptr, keylen_in) == 0) { \ + break; \ + } \ + } \ + if ((out)->hh.hh_next != NULL) { \ + DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \ + } else { \ + (out) = NULL; \ + } \ + } \ +} while (0) + +/* add an item to a bucket */ +#define HASH_ADD_TO_BKT(head,addhh,class) \ +do { \ + head.count++; \ + (addhh)->hh_next = head.hh_head; \ + (addhh)->hh_prev = NULL; \ + if (head.hh_head != NULL) { (head).hh_head->hh_prev = (addhh); } \ + (head).hh_head=addhh; \ + if ((head.count >= ((head.expand_mult+1U) * HASH_BKT_CAPACITY_THRESH)) \ + && ((addhh)->tbl->noexpand != 1U)) { \ + HASH_EXPAND_BUCKETS((addhh)->tbl, class); \ + } \ +} while (0) + +/* remove an item from a given bucket */ +#define HASH_DEL_IN_BKT(hh,head,hh_del) \ + (head).count--; \ + if ((head).hh_head == hh_del) { \ + (head).hh_head = hh_del->hh_next; \ + } \ + if (hh_del->hh_prev) { \ + hh_del->hh_prev->hh_next = hh_del->hh_next; \ + } \ + if (hh_del->hh_next) { \ + hh_del->hh_next->hh_prev = hh_del->hh_prev; \ + } + +/* Bucket expansion has the effect of doubling the number of buckets + * and redistributing the items into the new buckets. Ideally the + * items will distribute more or less evenly into the new buckets + * (the extent to which this is true is a measure of the quality of + * the hash function as it applies to the key domain). + * + * With the items distributed into more buckets, the chain length + * (item count) in each bucket is reduced. Thus by expanding buckets + * the hash keeps a bound on the chain length. This bounded chain + * length is the essence of how a hash provides constant time lookup. + * + * The calculation of tbl->ideal_chain_maxlen below deserves some + * explanation. First, keep in mind that we're calculating the ideal + * maximum chain length based on the *new* (doubled) bucket count. + * In fractions this is just n/b (n=number of items,b=new num buckets). + * Since the ideal chain length is an integer, we want to calculate + * ceil(n/b). We don't depend on floating point arithmetic in this + * hash, so to calculate ceil(n/b) with integers we could write + * + * ceil(n/b) = (n/b) + ((n%b)?1:0) + * + * and in fact a previous version of this hash did just that. + * But now we have improved things a bit by recognizing that b is + * always a power of two. We keep its base 2 log handy (call it lb), + * so now we can write this with a bit shift and logical AND: + * + * ceil(n/b) = (n>>lb) + ((n & (b-1)) ? 1:0) + * + */ +#define HASH_EXPAND_BUCKETS(tbl,class) \ +do { \ + unsigned _he_bkt; \ + unsigned _he_bkt_i; \ + struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ + UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ + _he_new_buckets = (UT_hash_bucket*)uthash_malloc(\ + 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket),class); \ + if (!_he_new_buckets) { uthash_fatal("out of memory"); } \ + memset(_he_new_buckets, 0, \ + 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ + tbl->ideal_chain_maxlen = \ + (tbl->num_items >> (tbl->log2_num_buckets+1U)) + \ + (((tbl->num_items & ((tbl->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \ + tbl->nonideal_items = 0; \ + for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) \ + { \ + _he_thh = tbl->buckets[ _he_bkt_i ].hh_head; \ + while (_he_thh != NULL) { \ + _he_hh_nxt = _he_thh->hh_next; \ + HASH_TO_BKT(_he_thh->hashv, tbl->num_buckets*2U, _he_bkt); \ + _he_newbkt = &(_he_new_buckets[ _he_bkt ]); \ + if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \ + tbl->nonideal_items++; \ + _he_newbkt->expand_mult = _he_newbkt->count / \ + tbl->ideal_chain_maxlen; \ + } \ + _he_thh->hh_prev = NULL; \ + _he_thh->hh_next = _he_newbkt->hh_head; \ + if (_he_newbkt->hh_head != NULL) { _he_newbkt->hh_head->hh_prev = \ + _he_thh; } \ + _he_newbkt->hh_head = _he_thh; \ + _he_thh = _he_hh_nxt; \ + } \ + } \ + uthash_free(tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ + tbl->num_buckets *= 2U; \ + tbl->log2_num_buckets++; \ + tbl->buckets = _he_new_buckets; \ + tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? \ + (tbl->ineff_expands+1U) : 0U; \ + if (tbl->ineff_expands > 1U) { \ + tbl->noexpand=1; \ + uthash_noexpand_fyi(tbl); \ + } \ + uthash_expand_fyi(tbl); \ +} while (0) + + +/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ +/* Note that HASH_SORT assumes the hash handle name to be hh. + * HASH_SRT was added to allow the hash handle name to be passed in. */ +#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) +#define HASH_SRT(hh,head,cmpfcn) \ +do { \ + unsigned _hs_i; \ + unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ + struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ + if (head != NULL) { \ + _hs_insize = 1; \ + _hs_looping = 1; \ + _hs_list = &((head)->hh); \ + while (_hs_looping != 0U) { \ + _hs_p = _hs_list; \ + _hs_list = NULL; \ + _hs_tail = NULL; \ + _hs_nmerges = 0; \ + while (_hs_p != NULL) { \ + _hs_nmerges++; \ + _hs_q = _hs_p; \ + _hs_psize = 0; \ + for (_hs_i = 0; _hs_i < _hs_insize; _hs_i++) { \ + _hs_psize++; \ + _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ + ((void*)((char*)(_hs_q->next) + \ + (head)->hh.tbl->hho)) : NULL); \ + if (! (_hs_q)) { break; } \ + } \ + _hs_qsize = _hs_insize; \ + while ((_hs_psize > 0U) || ((_hs_qsize > 0U) && (_hs_q != NULL))) {\ + if (_hs_psize == 0U) { \ + _hs_e = _hs_q; \ + _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ + ((void*)((char*)(_hs_q->next) + \ + (head)->hh.tbl->hho)) : NULL); \ + _hs_qsize--; \ + } else if ((_hs_qsize == 0U) || (_hs_q == NULL)) { \ + _hs_e = _hs_p; \ + if (_hs_p != NULL){ \ + _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ + ((void*)((char*)(_hs_p->next) + \ + (head)->hh.tbl->hho)) : NULL); \ + } \ + _hs_psize--; \ + } else if ((\ + cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \ + DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \ +) <= 0) { \ + _hs_e = _hs_p; \ + if (_hs_p != NULL){ \ + _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ + ((void*)((char*)(_hs_p->next) + \ + (head)->hh.tbl->hho)) : NULL); \ + } \ + _hs_psize--; \ + } else { \ + _hs_e = _hs_q; \ + _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ + ((void*)((char*)(_hs_q->next) + \ + (head)->hh.tbl->hho)) : NULL); \ + _hs_qsize--; \ + } \ + if (_hs_tail != NULL) { \ + _hs_tail->next = ((_hs_e != NULL) ? \ + ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \ + } else { \ + _hs_list = _hs_e; \ + } \ + if (_hs_e != NULL) { \ + _hs_e->prev = ((_hs_tail != NULL) ? \ + ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \ + } \ + _hs_tail = _hs_e; \ + } \ + _hs_p = _hs_q; \ + } \ + if (_hs_tail != NULL){ \ + _hs_tail->next = NULL; \ + } \ + if (_hs_nmerges <= 1U) { \ + _hs_looping=0; \ + (head)->hh.tbl->tail = _hs_tail; \ + DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ + } \ + _hs_insize *= 2U; \ + } \ + HASH_FSCK(hh,head); \ + } \ +} while (0) + +/* This function selects items from one hash into another hash. + * The end result is that the selected items have dual presence + * in both hashes. There is no copy of the items made; rather + * they are added into the new hash through a secondary hash + * hash handle that must be present in the structure. */ +#define HASH_SELECT(hh_dst, dst, hh_src, src, cond, class) \ +do { \ + unsigned _src_bkt, _dst_bkt; \ + void *_last_elt=NULL, *_elt; \ + UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ + ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ + if (src != NULL) { \ + for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ + for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ + _src_hh != NULL; \ + _src_hh = _src_hh->hh_next) { \ + _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ + if (cond(_elt)) { \ + _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ + _dst_hh->key = _src_hh->key; \ + _dst_hh->keylen = _src_hh->keylen; \ + _dst_hh->hashv = _src_hh->hashv; \ + _dst_hh->prev = _last_elt; \ + _dst_hh->next = NULL; \ + if (_last_elt_hh != NULL) { _last_elt_hh->next = _elt; } \ + if (dst == NULL) { \ + DECLTYPE_ASSIGN(dst,_elt); \ + HASH_MAKE_TABLE(hh_dst,dst,class); \ + } else { \ + _dst_hh->tbl = (dst)->hh_dst.tbl; \ + } \ + HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ + HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt],_dst_hh,class); \ + (dst)->hh_dst.tbl->num_items++; \ + _last_elt = _elt; \ + _last_elt_hh = _dst_hh; \ + } \ + } \ + } \ + } \ + HASH_FSCK(hh_dst,dst); \ +} while (0) + +#define HASH_CLEAR(hh,head) \ +do { \ + if (head != NULL) { \ + uthash_free((head)->hh.tbl->buckets, \ + (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ + HASH_BLOOM_FREE((head)->hh.tbl); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head)=NULL; \ + } \ +} while (0) + +#define HASH_OVERHEAD(hh,head) \ + ((head != NULL) ? (\ + (size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ + ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ + sizeof(UT_hash_table) + \ + (HASH_BLOOM_BYTELEN))) : 0U) + +#ifdef NO_DECLTYPE +#define HASH_ITER(hh,head,el,tmp) \ +for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \ + (el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL))) +#else +#define HASH_ITER(hh,head,el,tmp) \ +for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \ + (el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL))) +#endif + +/* obtain a count of items in the hash */ +#define HASH_COUNT(head) HASH_CNT(hh,head) +#define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) + +typedef struct UT_hash_bucket { + struct UT_hash_handle *hh_head; + unsigned count; + + /* expand_mult is normally set to 0. In this situation, the max chain length + * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If + * the bucket's chain exceeds this length, bucket expansion is triggered). + * However, setting expand_mult to a non-zero value delays bucket expansion + * (that would be triggered by additions to this particular bucket) + * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. + * (The multiplier is simply expand_mult+1). The whole idea of this + * multiplier is to reduce bucket expansions, since they are expensive, in + * situations where we know that a particular bucket tends to be overused. + * It is better to let its chain length grow to a longer yet-still-bounded + * value, than to do an O(n) bucket expansion too often. + */ + unsigned expand_mult; + +} UT_hash_bucket; + +/* random signature used only to find hash tables in external analysis */ +#define HASH_SIGNATURE 0xa0111fe1u +#define HASH_BLOOM_SIGNATURE 0xb12220f2u + +typedef struct UT_hash_table { + UT_hash_bucket *buckets; + unsigned num_buckets, log2_num_buckets; + unsigned num_items; + struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ + ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ + + /* in an ideal situation (all buckets used equally), no bucket would have + * more than ceil(#items/#buckets) items. that's the ideal chain length. */ + unsigned ideal_chain_maxlen; + + /* nonideal_items is the number of items in the hash whose chain position + * exceeds the ideal chain maxlen. these items pay the penalty for an uneven + * hash distribution; reaching them in a chain traversal takes >ideal steps */ + unsigned nonideal_items; + + /* ineffective expands occur when a bucket doubling was performed, but + * afterward, more than half the items in the hash had nonideal chain + * positions. If this happens on two consecutive expansions we inhibit any + * further expansion, as it's not helping; this happens when the hash + * function isn't a good fit for the key domain. When expansion is inhibited + * the hash will still work, albeit no longer in constant time. */ + unsigned ineff_expands, noexpand; + + uint32_t signature; /* used only to find hash tables in external analysis */ +#ifdef HASH_BLOOM + uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ + uint8_t *bloom_bv; + uint8_t bloom_nbits; +#endif + +} UT_hash_table; + +typedef struct UT_hash_handle { + struct UT_hash_table *tbl; + void *prev; /* prev element in app order */ + void *next; /* next element in app order */ + struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ + struct UT_hash_handle *hh_next; /* next hh in bucket order */ + void *key; /* ptr to enclosing struct's key */ + unsigned keylen; /* enclosing struct's key len */ + unsigned hashv; /* result of hash-fcn(key) */ +} UT_hash_handle; + +#endif /* UTHASH_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/include/utlist.h b/3rd-party/romio341/mpl/include/utlist.h new file mode 100644 index 0000000000000000000000000000000000000000..12196130bad93f2450c70d9f6b77a1acb9a8a1cd --- /dev/null +++ b/3rd-party/romio341/mpl/include/utlist.h @@ -0,0 +1,579 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* +Copyright (c) 2007-2011, Troy D. Hanson http://uthash.sourceforge.net +All rights reserved. + +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER +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. +*/ + +/* Argonne changes: + + - some configure-time checking for __typeof() support was added + - intentionally omitted from "mpl.h" in order to require using code to opt-in + [goodell@ 2010-12-20] + + - Added _N (for LL_ macros) and _NP (for DL_ and CDL_ macros) + variants to each macro. Thease take additional parameters to specify the + next or next and prev fields, respectively. The field name should be used in + those parameters. E.g., say the struct looks like this: + + struct my_struct { + struct my_struct *my_next; + struct my_struct *my_prev; + int some_data; + }; + + Then, to append an element "my_element" of type my_struct: + + DL_APPEND_NP(my_head, my_element, my_next, my_prev); + + For convenience one can define a macro to eliminate the need to specify the + field names every time: + + #define MY_STRUCT_DL_APPEND(head, add) \ + DL_APPEND_NP(head, add, my_next, my_prev) + + [buntinas 12/2/2011] +*/ + +#ifndef UTLIST_H_INCLUDED +#define UTLIST_H_INCLUDED + +#define UTLIST_VERSION 1.9.5 + +#include "mplconfig.h" + +/* + * This file contains macros to manipulate singly and doubly-linked lists. + * + * 1. LL_ macros: singly-linked lists. + * 2. DL_ macros: doubly-linked lists. + * 3. CDL_ macros: circular doubly-linked lists. + * + * To use singly-linked lists, your structure must have a "next" pointer. + * To use doubly-linked lists, your structure must "prev" and "next" pointers. + * Either way, the pointer to the head of the list must be initialized to NULL. + * + * ----------------.EXAMPLE ------------------------- + * struct item { + * int id; + * struct item *prev, *next; + * } + * + * struct item *list = NULL: + * + * int main() { + * struct item *item; + * ... allocate and populate item ... + * DL_APPEND(list, item); + * } + * -------------------------------------------------- + * + * For doubly-linked lists, the append and delete macros are O(1) + * For singly-linked lists, append and delete are O(n) but prepend is O(1) + * The sort macro is O(n log(n)) for all types of single/double/circular lists. + */ + +#ifdef MPL_HAVE___TYPEOF /* MPICH modification */ +/* These macros use decltype or the earlier __typeof GNU extension. + As decltype is only available in newer compilers (VS2010 or gcc 4.3+ + when compiling c++ code), this code uses whatever method is needed + or, for VS2008 where neither is available, uses casting workarounds. */ +#ifdef _MSC_VER /* MS compiler */ +#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ +#define LDECLTYPE(x) decltype(x) +#else /* VS2008 or older (or VS2010 in C mode) */ +#define NO_DECLTYPE +#define LDECLTYPE(x) char* +#endif +#else /* GNU, Sun and other compilers */ +#define LDECLTYPE(x) __typeof(x) +#endif +#else /* !MPL_HAVE___TYPEOF */ +#define NO_DECLTYPE +#define LDECLTYPE(x) char* +#endif /* !MPL_HAVE___TYPEOF */ + +/* for VS2008 we use some workarounds to get around the lack of decltype, + * namely, we always reassign our tmp variable to the list head if we need + * to dereference its prev/next pointers, and save/restore the real head.*/ +#ifdef NO_DECLTYPE +#define _SV(elt,list) _tmp = (char*)(list); {char **_alias = (char**)&(list); *_alias = (elt); } +#define _NEXT(elt,list,_next) ((char*)((list)->_next)) +#define _NEXTASGN(elt,list,to,_next) { char **_alias = (char**)&((list)->_next); *_alias=(char*)(to); } +#define _PREV(elt,list,_prev) ((char*)((list)->_prev)) +#define _PREVASGN(elt,list,to,_prev) { char **_alias = (char**)&((list)->_prev); *_alias=(char*)(to); } +#define _RS(list) { char **_alias = (char**)&(list); *_alias=_tmp; } +#define _CASTASGN(a,b) { char **_alias = (char**)&(a); *_alias=(char*)(b); } +#else +#define _SV(elt,list) +#define _NEXT(elt,list,_next) ((elt)->_next) +#define _NEXTASGN(elt,list,to,_next) ((elt)->_next)=(to) +#define _PREV(elt,list,_prev) ((elt)->_prev) +#define _PREVASGN(elt,list,to,_prev) ((elt)->_prev)=(to) +#define _RS(list) +#define _CASTASGN(a,b) (a)=(b) +#endif + +/****************************************************************************** + * The sort macro is an adaptation of Simon Tatham's O(n log(n)) mergesort * + * Unwieldy variable names used here to avoid shadowing passed-in variables. * + *****************************************************************************/ +#define LL_SORT(list, cmp) LL_SORT_N(list, cmp, next) +#define LL_SORT_N(list, cmp, _next) \ +do { \ + LDECLTYPE(list) _ls_p; \ + LDECLTYPE(list) _ls_q; \ + LDECLTYPE(list) _ls_e; \ + LDECLTYPE(list) _ls_tail; \ + LDECLTYPE(list) _ls_oldhead; \ + LDECLTYPE(list) _tmp; \ + int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \ + if (list) { \ + _ls_insize = 1; \ + _ls_looping = 1; \ + while (_ls_looping) { \ + _CASTASGN(_ls_p,list); \ + _CASTASGN(_ls_oldhead,list); \ + list = NULL; \ + _ls_tail = NULL; \ + _ls_nmerges = 0; \ + while (_ls_p) { \ + _ls_nmerges++; \ + _ls_q = _ls_p; \ + _ls_psize = 0; \ + for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \ + _ls_psize++; \ + _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); \ + if (!_ls_q) break; \ + } \ + _ls_qsize = _ls_insize; \ + while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \ + if (_ls_psize == 0) { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + } else if (_ls_qsize == 0 || !_ls_q) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + } else if (cmp(_ls_p,_ls_q) <= 0) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + } else { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + } \ + if (_ls_tail) { \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e,_next); _RS(list); \ + } else { \ + _CASTASGN(list,_ls_e); \ + } \ + _ls_tail = _ls_e; \ + } \ + _ls_p = _ls_q; \ + } \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL,_next); _RS(list); \ + if (_ls_nmerges <= 1) { \ + _ls_looping=0; \ + } \ + _ls_insize *= 2; \ + } \ + } else _tmp=NULL; /* quiet gcc unused variable warning */ \ +} while (0) + +#define DL_SORT(list, cmp) DL_SORT_NP(list, cmp, next, prev) +#define DL_SORT_NP(list, cmp, _next, _prev) \ +do { \ + LDECLTYPE(list) _ls_p; \ + LDECLTYPE(list) _ls_q; \ + LDECLTYPE(list) _ls_e; \ + LDECLTYPE(list) _ls_tail; \ + LDECLTYPE(list) _ls_oldhead; \ + LDECLTYPE(list) _tmp; \ + int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \ + if (list) { \ + _ls_insize = 1; \ + _ls_looping = 1; \ + while (_ls_looping) { \ + _CASTASGN(_ls_p,list); \ + _CASTASGN(_ls_oldhead,list); \ + list = NULL; \ + _ls_tail = NULL; \ + _ls_nmerges = 0; \ + while (_ls_p) { \ + _ls_nmerges++; \ + _ls_q = _ls_p; \ + _ls_psize = 0; \ + for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \ + _ls_psize++; \ + _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); \ + if (!_ls_q) break; \ + } \ + _ls_qsize = _ls_insize; \ + while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \ + if (_ls_psize == 0) { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + } else if (_ls_qsize == 0 || !_ls_q) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + } else if (cmp(_ls_p,_ls_q) <= 0) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + } else { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + } \ + if (_ls_tail) { \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e,_next); _RS(list); \ + } else { \ + _CASTASGN(list,_ls_e); \ + } \ + _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail,_prev); _RS(list); \ + _ls_tail = _ls_e; \ + } \ + _ls_p = _ls_q; \ + } \ + _CASTASGN(list->_prev, _ls_tail); \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL,_next); _RS(list); \ + if (_ls_nmerges <= 1) { \ + _ls_looping=0; \ + } \ + _ls_insize *= 2; \ + } \ + } else _tmp=NULL; /* quiet gcc unused variable warning */ \ +} while (0) + +#define CDL_SORT(list, cmp) CDL_SORT_NP(list, cmp, next, prev) +#define CDL_SORT_NP(list, cmp, _next, _prev) \ +do { \ + LDECLTYPE(list) _ls_p; \ + LDECLTYPE(list) _ls_q; \ + LDECLTYPE(list) _ls_e; \ + LDECLTYPE(list) _ls_tail; \ + LDECLTYPE(list) _ls_oldhead; \ + LDECLTYPE(list) _tmp; \ + LDECLTYPE(list) _tmp2; \ + int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \ + if (list) { \ + _ls_insize = 1; \ + _ls_looping = 1; \ + while (_ls_looping) { \ + _CASTASGN(_ls_p,list); \ + _CASTASGN(_ls_oldhead,list); \ + list = NULL; \ + _ls_tail = NULL; \ + _ls_nmerges = 0; \ + while (_ls_p) { \ + _ls_nmerges++; \ + _ls_q = _ls_p; \ + _ls_psize = 0; \ + for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \ + _ls_psize++; \ + _SV(_ls_q,list); \ + if (_NEXT(_ls_q,list,_next) == _ls_oldhead) { \ + _ls_q = NULL; \ + } else { \ + _ls_q = _NEXT(_ls_q,list,_next); \ + } \ + _RS(list); \ + if (!_ls_q) break; \ + } \ + _ls_qsize = _ls_insize; \ + while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \ + if (_ls_psize == 0) { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + if (_ls_q == _ls_oldhead) { _ls_q = NULL; } \ + } else if (_ls_qsize == 0 || !_ls_q) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + if (_ls_p == _ls_oldhead) { _ls_p = NULL; } \ + } else if (cmp(_ls_p,_ls_q) <= 0) { \ + _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list,_next); _RS(list); _ls_psize--; \ + if (_ls_p == _ls_oldhead) { _ls_p = NULL; } \ + } else { \ + _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list,_next); _RS(list); _ls_qsize--; \ + if (_ls_q == _ls_oldhead) { _ls_q = NULL; } \ + } \ + if (_ls_tail) { \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e,_next); _RS(list); \ + } else { \ + _CASTASGN(list,_ls_e); \ + } \ + _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail,_prev); _RS(list); \ + _ls_tail = _ls_e; \ + } \ + _ls_p = _ls_q; \ + } \ + _CASTASGN(list->_prev,_ls_tail); \ + _CASTASGN(_tmp2,list); \ + _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_tmp2,_next); _RS(list); \ + if (_ls_nmerges <= 1) { \ + _ls_looping=0; \ + } \ + _ls_insize *= 2; \ + } \ + } else _tmp=NULL; /* quiet gcc unused variable warning */ \ +} while (0) + +/****************************************************************************** + * singly linked list macros (non-circular) * + *****************************************************************************/ +#define LL_PREPEND(head,tail,add) LL_PREPEND_N(head,tail,add,next) +#define LL_PREPEND_N(head,tail,add,_next) \ +do { \ + (add)->_next = head; \ + head = add; \ + if ((add)->_next == NULL) \ + (tail) = (add); \ +} while (0) + +#define LL_CONCAT(head1,head2,tail1,tail2) LL_CONCAT_N(head1,head2,tail1,tail2,next) +#define LL_CONCAT_N(head1,head2,tail1,tail2,_next) \ +do { \ + if (tail1) { \ + (tail1)->_next=(head2); \ + } else { \ + (head1)=(head2); \ + } \ + if (tail2) { \ + (tail1)=(tail2); \ + } \ +} while (0) + +#define LL_APPEND(head,tail,add) LL_APPEND_N(head,tail,add,next) +#define LL_APPEND_N(head,tail,add,_next) \ +do { \ + (add)->_next=NULL; \ + if (tail) { \ + (tail)->_next=(add); \ + } else { \ + (head)=(add); \ + } \ + (tail)=(add); \ +} while (0) + +#define LL_DELETE(head,tail,del) LL_DELETE_N(head,tail,del,next) +#define LL_DELETE_N(head,tail,del,_next) \ +do { \ + LDECLTYPE(head) _tmp; \ + if ((head) == (del)) { \ + (head)=(head)->_next; \ + if ((tail) == (del)) \ + (tail)=(head); \ + } else { \ + _tmp = head; \ + while (_tmp->_next && (_tmp->_next != (del))) { \ + _tmp = _tmp->_next; \ + } \ + if (_tmp->_next) { \ + _tmp->_next = ((del)->_next); \ + if ((tail) == (del)) \ + (tail)=_tmp; \ + } \ + } \ +} while (0) + +/* Here are VS2008 replacements for LL_DELETE */ +#define LL_DELETE_VS2008(head,tail,del) LL_DELETE_N_VS2008(head,tail,del,next) +#define LL_DELETE_N_VS2008(head,tail,del,_next) \ +do { \ + if ((head) == (del)) { \ + (head)=(head)->_next; \ + if ((tail) == (del)) \ + (tail)=(head); \ + } else { \ + char *_tmp = (char*)(head); \ + while ((head)->_next && ((head)->_next != (del))) { \ + (head) = (head)->_next; \ + } \ + if ((head)->_next) { \ + (head)->_next = ((del)->_next); \ + if ((tail) == (del)) \ + (tail)=(head); \ + } \ + { \ + char **_head_alias = (char**)&(head); \ + *_head_alias = _tmp; \ + } \ + } \ +} while (0) +#ifdef NO_DECLTYPE +#undef LL_DELETE +#define LL_DELETE LL_DELETE_VS2008 +#undef DL_CONCAT /* no DL_CONCAT_VS2008 */ +#endif +/* end VS2008 replacements */ + +#define LL_FOREACH(head,el) LL_FOREACH_N(head,el,next) +#define LL_FOREACH_N(head,el,_next) \ + for(el=head;el;el=el->_next) + +#define LL_FOREACH_SAFE(head,el,tmp) LL_FOREACH_SAFE_N(head,el,tmp,next) +#define LL_FOREACH_SAFE_N(head,el,tmp,_next) \ + for((el)=(head);(el) && (tmp = (el)->_next, 1); (el) = tmp) + +#define LL_SEARCH_SCALAR(head,out,field,val) LL_SEARCH_SCALAR_N(head,out,field,val,next) +#define LL_SEARCH_SCALAR_N(head,out,field,val,_next) \ +do { \ + LL_FOREACH_N(head,out,_next) { \ + if ((out)->field == (val)) break; \ + } \ +} while (0) + +#define LL_SEARCH(head,out,elt,cmp) LL_SEARCH_N(head,out,elt,cmp,next) +#define LL_SEARCH_N(head,out,elt,cmp,_next) \ +do { \ + LL_FOREACH_N(head,out,_next) { \ + if ((cmp(out,elt))==0) break; \ + } \ +} while (0) + +/****************************************************************************** + * doubly linked list macros (non-circular) * + *****************************************************************************/ +#define DL_PREPEND(head,add) DL_PREPEND_NP(head,add,next,prev) +#define DL_PREPEND_NP(head,add,_next,_prev) \ +do { \ + (add)->_next = head; \ + if (head) { \ + (add)->_prev = (head)->_prev; \ + (head)->_prev = (add); \ + } else { \ + (add)->_prev = (add); \ + } \ + (head) = (add); \ +} while (0) + +#define DL_APPEND(head,add) DL_APPEND_NP(head,add,next,prev) +#define DL_APPEND_NP(head,add,_next,_prev) \ +do { \ + if (head) { \ + (add)->_prev = (head)->_prev; \ + (head)->_prev->_next = (add); \ + (head)->_prev = (add); \ + (add)->_next = NULL; \ + } else { \ + (head)=(add); \ + (head)->_prev = (head); \ + (head)->_next = NULL; \ + } \ +} while (0) + +#define DL_CONCAT(head1,head2) DL_CONCAT_NP(head1,head2,next,prev) +#define DL_CONCAT_NP(head1,head2,_next,_prev) \ +do { \ + LDECLTYPE(head1) _tmp; \ + if (head2) { \ + if (head1) { \ + _tmp = (head2)->_prev; \ + (head2)->_prev = (head1)->_prev; \ + (head1)->_prev->_next = (head2); \ + (head1)->_prev = _tmp; \ + } else { \ + (head1)=(head2); \ + } \ + } \ +} while (0) + +#define DL_DELETE(head,del) DL_DELETE_NP(head,del,next,prev) +#define DL_DELETE_NP(head,del,_next,_prev) \ +do { \ + if ((del)->_prev == (del)) { \ + (head)=NULL; \ + } else if ((del)==(head)) { \ + (del)->_next->_prev = (del)->_prev; \ + (head) = (del)->_next; \ + } else { \ + (del)->_prev->_next = (del)->_next; \ + if ((del)->_next) { \ + (del)->_next->_prev = (del)->_prev; \ + } else { \ + (head)->_prev = (del)->_prev; \ + } \ + } \ +} while (0) + + +#define DL_FOREACH(head,el) DL_FOREACH_NP(head,el,next,prev) +#define DL_FOREACH_NP(head,el,_next,_prev) \ + for(el=head;el;el=el->_next) + +/* this version is safe for deleting the elements during iteration */ +#define DL_FOREACH_SAFE(head,el,tmp) DL_FOREACH_SAFE_NP(head,el,tmp,next,prev) +#define DL_FOREACH_SAFE_NP(head,el,tmp,_next,_prev) \ + for((el)=(head);(el) && (tmp = (el)->_next, 1); (el) = tmp) + +/* these are identical to their singly-linked list counterparts */ +#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR +#define DL_SEARCH_SCALAR_NP(head,out,field,val,_next,_prev) LL_SEARCH_SCALAR_N(head,out,field,val,_next) +#define DL_SEARCH LL_SEARCH +#define DL_SEARCH_NP(head,out,elt,cmp,_next,_prev) LL_SEARCH_N(head,out,elt,cmp,_next) + +/****************************************************************************** + * circular doubly linked list macros * + *****************************************************************************/ +#define CDL_PREPEND(head,add) CDL_PREPEND_NP(head,add,next,prev) +#define CDL_PREPEND_NP(head,add,_next,_prev) \ +do { \ + if (head) { \ + (add)->_prev = (head)->_prev; \ + (add)->_next = (head); \ + (head)->_prev = (add); \ + (add)->_prev->_next = (add); \ + } else { \ + (add)->_prev = (add); \ + (add)->_next = (add); \ + } \ +(head)=(add); \ +} while (0) + +#define CDL_DELETE(head,del) CDL_DELETE_NP(head,del,next,prev) +#define CDL_DELETE_NP(head,del,_next,_prev) \ +do { \ + if (((head)==(del)) && ((head)->_next == (head))) { \ + (head) = 0L; \ + } else { \ + (del)->_next->_prev = (del)->_prev; \ + (del)->_prev->_next = (del)->_next; \ + if ((del) == (head)) (head)=(del)->_next; \ + } \ +} while (0) + +#define CDL_FOREACH(head,el) CDL_FOREACH_NP(head,el,next,prev) +#define CDL_FOREACH_NP(head,el,_next,_prev) \ + for(el=head;el;el=(el->_next==head ? 0L : el->_next)) + +#define CDL_FOREACH_SAFE(head,el,tmp1,tmp2) CDL_FOREACH_SAFE_NP(head,el,tmp1,tmp2,next,prev) +#define CDL_FOREACH_SAFE_NP(head,el,tmp1,tmp2,_next,_prev) \ + for((el)=(head), ((tmp1)=(head)?((head)->_prev):NULL); \ + (el) && ((tmp2)=(el)->_next, 1); \ + ((el) = (((el)==(tmp1)) ? 0L : (tmp2)))) + +#define CDL_SEARCH_SCALAR(head,out,field,val) CDL_SEARCH_SCALAR_NP(head,out,field,val,next,prev) +#define CDL_SEARCH_SCALAR_NP(head,out,field,val,_next,_prev) \ +do { \ + CDL_FOREACH_NP(head,out,_next,_prev) { \ + if ((out)->field == (val)) break; \ + } \ +} while (0) + +#define CDL_SEARCH(head,out,elt,cmp) CDL_SEARCH_NP(head,out,elt,cmp,next,prev) +#define CDL_SEARCH_NP(head,out,elt,cmp,_next,_prev) \ +do { \ + CDL_FOREACH_NP(head,out,_next,_prev) { \ + if ((cmp(out,elt))==0) break; \ + } \ +} while (0) + +#endif /* UTLIST_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/localdefs.in b/3rd-party/romio341/mpl/localdefs.in new file mode 100644 index 0000000000000000000000000000000000000000..6d2667297777ec75fc53ed35cfdb23591d950140 --- /dev/null +++ b/3rd-party/romio341/mpl/localdefs.in @@ -0,0 +1,7 @@ +#! /bin/sh +# When configured within MPICH via PAC_CONFIG_SUBDIR, this file will be sourced +# by the top-level configure. This lets us propagate shell variable changes +# back upstream. + +CPPFLAGS="@CPPFLAGS@" +WRAPPER_LIBS="$WRAPPER_LIBS @LIBS@" diff --git a/3rd-party/romio341/mpl/src/Makefile.mk b/3rd-party/romio341/mpl/src/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..be8bed99edb87def809e88ebaac132c6c6236e6e --- /dev/null +++ b/3rd-party/romio341/mpl/src/Makefile.mk @@ -0,0 +1,18 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +include src/atomic/Makefile.mk +include src/bt/Makefile.mk +include src/dbg/Makefile.mk +include src/env/Makefile.mk +include src/mem/Makefile.mk +include src/msg/Makefile.mk +include src/sock/Makefile.mk +include src/str/Makefile.mk +include src/thread/Makefile.mk +include src/timer/Makefile.mk +include src/shm/Makefile.mk +include src/gpu/Makefile.mk +include src/gavl/Makefile.mk diff --git a/3rd-party/romio341/mpl/src/atomic/Makefile.mk b/3rd-party/romio341/mpl/src/atomic/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..fe313011b7155c0b7f21e8e4c3db1eef6925c115 --- /dev/null +++ b/3rd-party/romio341/mpl/src/atomic/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/atomic/mpl_atomic.c diff --git a/3rd-party/romio341/mpl/src/atomic/mpl_atomic.c b/3rd-party/romio341/mpl/src/atomic/mpl_atomic.c new file mode 100644 index 0000000000000000000000000000000000000000..053c1828bb2eeeebe8059e544eb62efe81213fd2 --- /dev/null +++ b/3rd-party/romio341/mpl/src/atomic/mpl_atomic.c @@ -0,0 +1,18 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* FIXME For now we rely on pthreads for our IPC locks. This is fairly + * portable, although it is obviously not 100% portable. We need to figure out + * how to support other threading packages and lock implementations, such as the + * BG/P lockbox. */ + +#include "mpl_atomic.h" + +#ifdef MPL_HAVE_PTHREAD_H +#include <pthread.h> + +pthread_mutex_t MPLI_emulation_lock = PTHREAD_MUTEX_INITIALIZER; + +#endif /* MPL_HAVE_PTHREAD_H */ diff --git a/3rd-party/romio341/mpl/src/bt/Makefile.mk b/3rd-party/romio341/mpl/src/bt/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..ea28a30ced7855dd688c481004d1808f486c202a --- /dev/null +++ b/3rd-party/romio341/mpl/src/bt/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/bt/mpl_bt.c diff --git a/3rd-party/romio341/mpl/src/bt/mpl_bt.c b/3rd-party/romio341/mpl/src/bt/mpl_bt.c new file mode 100644 index 0000000000000000000000000000000000000000..5722c21651f5e002a7ad34ded5d4d46914fa53c3 --- /dev/null +++ b/3rd-party/romio341/mpl/src/bt/mpl_bt.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#ifdef MPL_HAVE_BACKTRACE +#include <execinfo.h> + +#define MAX_TRACE_DEPTH 32 + +void MPL_backtrace_show(FILE * output) +{ + void *trace[MAX_TRACE_DEPTH]; + _mpl_backtrace_size_t frames; + + frames = backtrace(trace, MAX_TRACE_DEPTH); + char **strs = backtrace_symbols(trace, frames); + for (_mpl_backtrace_size_t i = 0; i < frames; i++) + fprintf(output, "%s\n", strs[i]); + + MPL_external_free(strs); +} +#else +void MPL_backtrace_show(FILE * output) +{ + fprintf(output, "No backtrace info available\n"); +} +#endif diff --git a/3rd-party/romio341/mpl/src/dbg/Makefile.mk b/3rd-party/romio341/mpl/src/dbg/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..020da9b8c190c57ee58d385d50db22d55ba9ba3e --- /dev/null +++ b/3rd-party/romio341/mpl/src/dbg/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/dbg/mpl_dbg.c diff --git a/3rd-party/romio341/mpl/src/dbg/mpl_dbg.c b/3rd-party/romio341/mpl/src/dbg/mpl_dbg.c new file mode 100644 index 0000000000000000000000000000000000000000..bc047274d849a6cc147d3988d4e6d475cb300f20 --- /dev/null +++ b/3rd-party/romio341/mpl/src/dbg/mpl_dbg.c @@ -0,0 +1,901 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* + * This file provides a set of routines that can be used to record debug + * messages in a ring so that the may be dumped at a later time. For example, + * this can be used to record debug messages without printing them. + */ + +#include "mpl.h" + +#ifdef MPL_HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef MPL_HAVE_ERRNO_H +#include <errno.h> +#endif + +#if defined(MPL_HAVE_MKSTEMP) && defined(MPL_NEEDS_MKSTEMP_DECL) +extern int mkstemp(char *t); +#endif + +#if defined(MPL_HAVE_FDOPEN) && defined(MPL_NEEDS_FDOPEN_DECL) +extern FILE *fdopen(int fd, const char *mode); +#endif + +#ifdef MPL_USE_DBG_LOGGING + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +int MPL_dbg_active_classes = 0; +int MPL_dbg_max_level = MPL_DBG_TYPICAL; + +static enum { + DBG_UNINIT, + DBG_PREINIT, + DBG_INITIALIZED, + DBG_ERROR +} dbg_initialized = DBG_UNINIT; + +static char file_pattern_buf[MAXPATHLEN] = ""; +static const char *file_pattern = "-stdout-"; /* "log%d.log"; */ +static const char *default_file_pattern = "dbg@W%w-@%d@T-%t@.log"; +static char temp_filename[MAXPATHLEN] = ""; +static int world_num = 0; +static int world_rank = -1; +static int which_rank = -1; /* all ranks */ +static double time_origin = 0.0; + +static int dbg_usage(const char *, const char *); +static int dbg_openfile(FILE ** dbg_fp); +static int dbg_set_class(const char *); +static int dbg_set_level(const char *, const char *(names[])); +static int dbg_get_filename(char *filename, int len); + +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) +static MPL_thread_tls_key_t dbg_tls_key; +#endif + +static FILE *dbg_static_fp = 0; + +/* + * This function finds the basename in a path (ala "man 1 basename"). + * *basename will point to an element in path. + * More formally: This function sets basename to the character just + * after the last '/' in path. +*/ +static void find_basename(char *path, char **basename) ATTRIBUTE((unused)); +static void find_basename(char *path, char **basename) +{ + char *c; + + c = *basename = path; + while (*c) { + if (*c == '/') + *basename = c + 1; + ++c; + } +} + +static int dbg_init_tls(void) +{ + int err = 0; + +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + MPL_thread_tls_create(NULL, &dbg_tls_key, &err); +#endif + + return err; +} + +static FILE *get_fp(void) +{ +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + int err; + /* if we're not initialized, use the static fp, since there should + * only be one thread in here until then */ + if (dbg_initialized == DBG_INITIALIZED) { + FILE *fp; + MPL_thread_tls_get(&dbg_tls_key, (void **) &fp, &err); + return fp; + } +#endif + + return dbg_static_fp; +} + +static void set_fp(FILE * fp) +{ +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + int err; + /* if we're not initialized, use the static fp, since there should + * only be one thread in here until then */ + if (dbg_initialized == DBG_INITIALIZED) { + MPL_thread_tls_set(&dbg_tls_key, (void *) fp, &err); + return; + } +#endif + + dbg_static_fp = fp; +} + +int MPL_dbg_outevent(const char *file, int line, int class, int kind, const char *fmat, ...) +{ + int mpl_errno = MPL_SUCCESS; + va_list list; + char *str, stmp[MPL_DBG_MAXLINE]; + int i; + void *p; + MPL_time_t t; + double curtime; + unsigned long long int threadID = 0; + int pid = -1; + FILE *dbg_fp = NULL; + + if (dbg_initialized == DBG_UNINIT || dbg_initialized == DBG_ERROR) + goto fn_exit; + + dbg_fp = get_fp(); + +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + { + /* the thread ID is not necessarily unique between processes, so a + * (pid,tid) pair should be used to uniquely identify output from + * particular threads on a system */ + MPL_thread_id_t tid; + MPL_thread_self(&tid); + threadID = (unsigned long long int) tid; + } +#endif +#if defined(MPL_HAVE_GETPID) + pid = (int) getpid(); +#endif /* MPL_HAVE_GETPID */ + + if (!dbg_fp) { + mpl_errno = dbg_openfile(&dbg_fp); + if (mpl_errno) + goto fn_fail; + set_fp(dbg_fp); + } + + MPL_wtime(&t); + MPL_wtime_todouble(&t, &curtime); + curtime = curtime - time_origin; + + /* The kind values are used with the macros to simplify these cases */ + switch (kind) { + case 0: + va_start(list, fmat); + str = va_arg(list, char *); + fprintf(dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n", + world_num, world_rank, threadID, pid, class, curtime, file, line, str); + va_end(list); + break; + case 1: + va_start(list, fmat); + str = va_arg(list, char *); + MPL_snprintf(stmp, sizeof(stmp), fmat, str); + va_end(list); + fprintf(dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n", + world_num, world_rank, threadID, pid, class, curtime, file, line, stmp); + break; + case 2: + va_start(list, fmat); + i = va_arg(list, int); + MPL_snprintf(stmp, sizeof(stmp), fmat, i); + va_end(list); + fprintf(dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n", + world_num, world_rank, threadID, pid, class, curtime, file, line, stmp); + break; + case 3: + va_start(list, fmat); + p = va_arg(list, void *); + MPL_snprintf(stmp, sizeof(stmp), fmat, p); + va_end(list); + fprintf(dbg_fp, "%d\t%d\t%llx[%d]\t%d\t%f\t%s\t%d\t%s\n", + world_num, world_rank, threadID, pid, class, curtime, file, line, stmp); + break; + default: + break; + } + fflush(dbg_fp); + + fn_exit: + fn_fail: + return 0; +} + +/* These are used to simplify the handling of options. + To add a new name, add an dbg_classname element to the array + classnames. The "classbits" values are defined by MPL_DBG_CLASS + in mpl_dbg.h + */ + +typedef struct dbg_classname { + int classbits; + const char *ucname, *lcname; +} dbg_classname; + +#define MAX_DBG_CLASSNAMES (sizeof(unsigned int) * 8) + +static dbg_classname classnames[MAX_DBG_CLASSNAMES]; +static int num_classnames = 0; + +static const char *unregistered_classes[MAX_DBG_CLASSNAMES]; +static int num_unregistered_classes = 0; + +/* Because the level values are simpler and are rarely changed, these + * use a simple set of parallel arrays */ +static const int level_values[] = { + MPL_DBG_TERSE, + MPL_DBG_TYPICAL, + MPL_DBG_VERBOSE, + 100 +}; +static const char *level_name[] = { "TERSE", "TYPICAL", "VERBOSE", 0 }; +static const char *lc_level_name[] = { "terse", "typical", "verbose", 0 }; + +void MPL_dbg_class_register(MPL_dbg_class class, const char *ucname, const char *lcname) +{ + int i, j; + + classnames[num_classnames].classbits = class; + classnames[num_classnames].ucname = ucname; + classnames[num_classnames].lcname = lcname; + num_classnames++; + + if (num_unregistered_classes) { + /* there are some unregistered classes. look through to see + * if any of them match this class. */ + size_t len = strlen(lcname); + + for (i = 0; i < num_unregistered_classes; i++) { + size_t slen = strlen(unregistered_classes[i]); + if (len == slen && (!strncmp(unregistered_classes[i], lcname, len) || + !strncmp(unregistered_classes[i], ucname, len))) { + /* got a match */ + MPL_dbg_active_classes |= class; + for (j = i; j < num_unregistered_classes - 1; j++) + unregistered_classes[j] = unregistered_classes[j + 1]; + num_unregistered_classes--; + break; + } + } + } +} + +MPL_dbg_class MPL_dbg_class_alloc(const char *ucname, const char *lcname) +{ + static unsigned int class = 1; + + /* create a user handle for this class */ + MPL_dbg_class_register(class, ucname, lcname); + + class <<= 1; + + return (class >> 1); +} + +/* + * Initialize the DBG_MSG system. This is called during the job + * initialization to process command-line arguments as well as + * checking either the MPICH_DBG or MPL_DBG environment variables. + * The initialization + * is split into two steps: a preinit and an init. This makes it + * possible to enable most of the features before the full + * initialization, where a significant amount of the initialization + * takes place. + */ + +static int dbg_process_args(int *argc_p, char ***argv_p) +{ + int i, rc; + + /* Here's where we do the same thing with the command-line options */ + if (argc_p) { + for (i = 1; i < *argc_p; i++) { + if (strncmp((*argv_p)[i], "-mpich-dbg", 10) == 0) { + char *s = (*argv_p)[i] + 10; + /* Found a command */ + if (*s == 0) { + /* Just -mpich-dbg */ + MPL_dbg_max_level = MPL_DBG_TYPICAL; + MPL_dbg_active_classes = MPL_DBG_ALL; + } else if (*s == '=') { + /* look for file */ + MPL_dbg_max_level = MPL_DBG_TYPICAL; + MPL_dbg_active_classes = MPL_DBG_ALL; + s++; + if (strncmp(s, "file", 4) == 0) { + file_pattern = default_file_pattern; + } + } else if (strncmp(s, "-level", 6) == 0) { + char *p = s + 6; + if (*p == '=') { + p++; + rc = dbg_set_level(p, lc_level_name); + if (rc) + dbg_usage("-mpich-dbg-level", "terse, typical, verbose"); + } + } else if (strncmp(s, "-class", 6) == 0) { + char *p = s + 6; + if (*p == '=') { + p++; + rc = dbg_set_class(p); + if (rc) + dbg_usage("-mpich-dbg-class", 0); + } + } else if (strncmp(s, "-filename", 9) == 0) { + char *p = s + 9; + if (*p == '=') { + p++; + /* A special case for a filepattern of "-default", + * use the predefined default pattern */ + if (strcmp(p, "-default") == 0) { + file_pattern = default_file_pattern; + } else { + strncpy(file_pattern_buf, p, sizeof(file_pattern_buf) - 1); + + /* Make sure the string is NULL-terminated */ + file_pattern_buf[MAXPATHLEN - 1] = '\0'; + + file_pattern = file_pattern_buf; + } + } + } else if (strncmp(s, "-rank", 5) == 0) { + char *p = s + 5; + if (*p == '=' && p[1] != 0) { + char *sOut; + p++; + which_rank = (int) strtol(p, &sOut, 10); + if (p == sOut) { + dbg_usage("-mpich-dbg-rank", 0); + which_rank = -1; + } + } + } else { + dbg_usage((*argv_p)[i], 0); + } + + /* Eventually, should null it out and reduce argc value */ + } + } + } + return MPL_SUCCESS; +} + +/* could two different environment variables control the same thing? sure they + * could! consider MPICH: we moved all our logging code into MPL, so it should + * have an MPL_ prefix, but all the documentation assumes an "MPICH_" prefix. + * So we'll look for both. */ +static char *getenv_either(const char *env_a, const char *env_b) +{ + char *s; + if ((s = getenv(env_a)) == NULL) + s = getenv(env_b); + + return s; +} + + +static int dbg_process_env(void) +{ + char *s; + int rc; + + s = getenv_either("MPICH_DBG", "MPL_DBG"); + if (s) { + /* Set the defaults */ + MPL_dbg_max_level = MPL_DBG_TYPICAL; + MPL_dbg_active_classes = MPL_DBG_ALL; + if (strncmp(s, "FILE", 4) == 0) { + file_pattern = default_file_pattern; + } + } + s = getenv_either("MPICH_DBG_LEVEL", "MPL_DBG_LEVEL"); + if (s) { + rc = dbg_set_level(s, level_name); + if (rc) + dbg_usage("MPL_DBG_LEVEL", "TERSE, TYPICAL, VERBOSE"); + } + + s = getenv_either("MPICH_DBG_CLASS", "MPL_DBG_CLASS"); + if (s) { + rc = dbg_set_class(s); + if (rc) + dbg_usage("MPL_DBG_CLASS", 0); + } + + s = getenv_either("MPICH_DBG_FILENAME", "MPL_DBG_FILENAME"); + if (s) { + strncpy(file_pattern_buf, s, sizeof(file_pattern_buf) - 1); + + /* Make sure the string is NULL-terminated */ + file_pattern_buf[MAXPATHLEN - 1] = '\0'; + + file_pattern = file_pattern_buf; + } + + s = getenv_either("MPICH_DBG_RANK", "MPL_DBG_RANK"); + if (s) { + char *sOut; + which_rank = (int) strtol(s, &sOut, 10); + if (s == sOut) { + dbg_usage("MPL_DBG_RANK", 0); + which_rank = -1; + } + } + return MPL_SUCCESS; +} + +MPL_dbg_class MPL_DBG_ROUTINE_ENTER; +MPL_dbg_class MPL_DBG_ROUTINE_EXIT; +MPL_dbg_class MPL_DBG_ROUTINE; +MPL_dbg_class MPL_DBG_ALL = ~(0); /* pre-initialize the ALL class */ + +/* + * Attempt to initialize the logging system. This works only if the + * full initialization is not required for updating the environment + * and/or command-line arguments. + */ +int MPL_dbg_pre_init(int *argc_p, char ***argv_p) +{ + MPL_time_t t; + + /* if the DBG_MSG system was already initialized, say by the + * device, then return immediately */ + if (dbg_initialized != DBG_UNINIT) + return MPL_SUCCESS; + + if (dbg_init_tls()) + return MPL_ERR_DBG_OTHER; + + /* Check to see if any debugging was selected. The order of these + * tests is important, as they allow general defaults to be set, + * followed by more specific modifications */ + /* First, the environment variables */ + dbg_process_env(); + + dbg_process_args(argc_p, argv_p); + + MPL_wtime_init(); + MPL_wtime(&t); + MPL_wtime_todouble(&t, &time_origin); + + /* Allocate the predefined classes */ + MPL_DBG_ROUTINE_ENTER = MPL_dbg_class_alloc("ROUTINE_ENTER", "routine_enter"); + MPL_DBG_ROUTINE_EXIT = MPL_dbg_class_alloc("ROUTINE_EXIT", "routine_exit"); + + MPL_DBG_CLASS_CLR(MPL_DBG_ROUTINE); + MPL_DBG_CLASS_APPEND(MPL_DBG_ROUTINE, MPL_DBG_ROUTINE_ENTER); + MPL_DBG_CLASS_APPEND(MPL_DBG_ROUTINE, MPL_DBG_ROUTINE_EXIT); + MPL_dbg_class_register(MPL_DBG_ROUTINE, "ROUTINE", "routine"); + + MPL_dbg_class_register(MPL_DBG_ALL, "ALL", "all"); + + dbg_initialized = DBG_PREINIT; + + return MPL_SUCCESS; +} + +int MPL_dbg_init(int wnum, int wrank) +{ + int ret; + FILE *dbg_fp = NULL; + + /* if the DBG_MSG system was already initialized, say by the + * device, then return immediately. Note that the device is then + * responsible for handling the file mode (e.g., reopen when the + * rank become available) */ + if (dbg_initialized == DBG_INITIALIZED || dbg_initialized == DBG_ERROR) + return MPL_SUCCESS; + + if (dbg_initialized != DBG_PREINIT) { + if (dbg_init_tls()) + return MPL_ERR_DBG_OTHER; + } + + dbg_fp = get_fp(); + + world_num = wnum; + world_rank = wrank; + + if (which_rank >= 0 && which_rank != wrank) { + /* Turn off logging on this process */ + MPL_dbg_active_classes = 0; + } + + /* If the file has already been opened with a temp filename, + * rename it. */ + if (dbg_fp && dbg_fp != stdout && dbg_fp != stderr) { + char filename[MAXPATHLEN] = ""; + + dbg_get_filename(filename, MAXPATHLEN); + ret = rename(temp_filename, filename); + if (ret) { + /* Retry renaming file after closing it */ + fclose(dbg_fp); + ret = rename(temp_filename, filename); + if (ret) { + MPL_error_printf("Could not rename temp log file to %s\n", filename); + goto fn_fail; + } else { + dbg_fp = fopen(filename, "a+"); + set_fp(dbg_fp); + if (dbg_fp == NULL) { + MPL_error_printf("Error re-opening log file, %s\n", filename); + goto fn_fail; + } + } + } + } + + dbg_initialized = DBG_INITIALIZED; + + /* updating dbg_initialized may alter where dbg_fp is stored, set it again */ + set_fp(dbg_fp); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + dbg_initialized = DBG_ERROR; + goto fn_exit; +} + +/* Print the usage statement to stderr */ +static int dbg_usage(const char *cmd, const char *vals) +{ + if (vals) { + fprintf(stderr, "Incorrect value for %s, should be one of %s\n", cmd, vals); + } else { + fprintf(stderr, "Incorrect value for %s\n", cmd); + } + fprintf(stderr, "Command line for debug switches\n\ + -mpich-dbg-class=name[,name,...]\n\ + -mpich-dbg-level=name (one of terse, typical, verbose)\n\ + -mpich-dbg-filename=pattern (includes %%d for world rank, %%t for thread id\n\ + -mpich-dbg-rank=val (only this rank in COMM_WORLD will be logged)\n\ + -mpich-dbg (shorthand for -mpich-dbg-class=all -mpich-dbg-level=typical)\n\ + -mpich-dbg=file (shorthand for -mpich-dbg -mpich-dbg-filename=%s)\n\ +Environment variables\n\ + MPICH_DBG_CLASS=NAME[,NAME...]\n\ + MPICH_DBG_LEVEL=NAME\n\ + MPICH_DBG_FILENAME=pattern\n\ + MPICH_DBG_RANK=val\n\ + MPICH_DBG=YES or FILE\n", default_file_pattern); + + fflush(stderr); + + return 0; +} + +#if defined (MPL_HAVE_MKSTEMP) && defined (MPL_HAVE_FDOPEN) + +/* creates a temporary file in the same directory the user specified + * for the log file */ +static int dbg_open_tmpfile(FILE ** dbg_fp) +{ + int mpl_errno = MPL_SUCCESS; + const char temp_pattern[] = "templogXXXXXX"; + int fd; + char *basename; + int ret; + + ret = MPL_strncpy(temp_filename, file_pattern, MAXPATHLEN); + if (ret) + goto fn_fail; + + find_basename(temp_filename, &basename); + + /* make sure there's enough room in temp_filename to store temp_pattern */ + if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) + goto fn_fail; + + MPL_strncpy(basename, temp_pattern, sizeof(temp_pattern)); + + fd = mkstemp(temp_filename); + if (fd == -1) + goto fn_fail; + + *dbg_fp = fdopen(fd, "a+"); + if (*dbg_fp == NULL) + goto fn_fail; + + fn_exit: + return mpl_errno; + fn_fail: + MPL_error_printf("Could not open log file %s\n", temp_filename); + dbg_initialized = DBG_ERROR; + mpl_errno = MPL_ERR_DBG_INTERN; + goto fn_exit; +} + +#elif defined(MPL_HAVE__MKTEMP_S) && defined(MPL_HAVE_FOPEN_S) + +/* creates a temporary file in the same directory the user specified + * for the log file */ +static int dbg_open_tmpfile(FILE ** dbg_fp) +{ + int mpl_errno = MPL_SUCCESS; + const char temp_pattern[] = "templogXXXXXX"; + int fd; + char *basename; + int ret; + errno_t ret_errno; + + ret = MPL_strncpy(temp_filename, file_pattern, MAXPATHLEN); + if (ret) + goto fn_fail; + + find_basename(temp_filename, &basename); + + /* make sure there's enough room in temp_filename to store temp_pattern */ + if (basename - temp_filename > MAXPATHLEN - sizeof(temp_pattern)) + goto fn_fail; + + MPL_strncpy(basename, temp_pattern, sizeof(temp_pattern)); + + ret_errno = _mktemp_s(temp_filename, MAXPATHLEN); + if (ret_errno != 0) + goto fn_fail; + + ret_errno = fopen_s(dbg_fp, temp_filename, "a+"); + if (ret_errno != 0) + goto fn_fail; + + fn_exit: + return mpl_errno; + fn_fail: + MPL_error_printf("Could not open log file %s\n", temp_filename); + dbg_initialized = DBG_ERROR; + mpl_errno = MPL_ERR_DBG_INTERN; + goto fn_exit; +} + +#else + +/* creates a temporary file in some directory, which may not be where + * the user wants the log file. When the file is renamed later, it + * may require a copy. + * + * Note that this is not safe: By the time we call fopen(), another + * file with the same name may exist. That file would get clobbered. +*/ +static int dbg_open_tmpfile(FILE ** dbg_fp) +{ + int mpl_errno = MPL_SUCCESS; + char *cret; + + cret = tmpnam(temp_filename); + if (cret == NULL) + goto fn_fail; + + *dbg_fp = fopen(temp_filename, "w"); + if (*dbg_fp == NULL) + goto fn_fail; + + fn_exit: + return mpl_errno; + fn_fail: + MPL_error_printf("Could not open log file %s\n", temp_filename); + dbg_initialized = DBG_ERROR; + mpl_errno = MPL_ERR_DBG_INTERN; + goto fn_exit; +} + +#endif + +/* This routine can make no MPI calls, since it may be logging those + * calls. */ +static int dbg_get_filename(char *filename, int len) +{ + int withinMworld = 0, /* True if within an @W...@ */ + withinMthread = 0; /* True if within an @T...@ */ + /* FIXME: Need to know how many process groups are known */ +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + unsigned long long int threadID = 0; + int nThread = 2; +#else + int nThread = 1; +#endif + static char world_numAsChar[10] = "0"; + char *pDest; + const char *p; + + if (world_num == 1) { + world_numAsChar[0] = '1'; + world_numAsChar[1] = '\0'; + } + + p = file_pattern; + pDest = filename; + *filename = 0; + while (*p && (pDest - filename) < len - 1) { + /* There are two special cases that allow text to + * be optionally included. Those patterns are + * @T...@ (only if multi-threaded) and + * @W...@ (only if more than one process group) + * UNIMPLEMENTED/UNTESTED */ + if (*p == '@') { + /* Escaped @? */ + if (p[1] == '@') { + *pDest++ = *++p; + continue; + } + /* If within an @...@, terminate it */ + if (withinMworld) { + withinMworld = 0; + p++; + } else if (withinMthread) { + withinMthread = 0; + p++; + } else { + /* Look for command */ + p++; + if (*p == 'W') { + p++; + withinMworld = 1; + } else if (*p == 'T') { + p++; + withinMthread = 1; + } else { + /* Unrecognized char */ + *pDest++ = *p++; + } + } + } else if ((withinMworld && world_num == 0) || (withinMthread && nThread == 1)) { + /* Simply skip this character since we're not showing + * this string */ + p++; + } else if (*p == '%') { + p++; + if (*p == 'd') { + char rankAsChar[20]; + MPL_snprintf(rankAsChar, sizeof(rankAsChar), "%d", world_rank); + *pDest = 0; + MPL_strnapp(filename, rankAsChar, len); + pDest += strlen(rankAsChar); + } else if (*p == 't') { +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) + char threadIDAsChar[30]; + MPL_thread_id_t tid; + MPL_thread_self(&tid); + threadID = (unsigned long long int) tid; + + MPL_snprintf(threadIDAsChar, sizeof(threadIDAsChar), "%llx", threadID); + *pDest = 0; + MPL_strnapp(filename, threadIDAsChar, len); + pDest += strlen(threadIDAsChar); +#else + *pDest++ = '0'; +#endif /* MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE */ + } else if (*p == 'w') { + /* *pDest++ = '0'; */ + *pDest = 0; + MPL_strnapp(filename, world_numAsChar, len); + pDest += strlen(world_numAsChar); + } else if (*p == 'p') { + /* Appends the pid of the proceess to the file name. */ + char pidAsChar[20]; +#if defined(MPL_HAVE_GETPID) + pid_t pid = getpid(); +#else + int pid = -1; +#endif /* MPL_HAVE_GETPID */ + MPL_snprintf(pidAsChar, sizeof(pidAsChar), "%d", (int) pid); + *pDest = 0; + MPL_strnapp(filename, pidAsChar, len); + pDest += strlen(pidAsChar); + } else { + *pDest++ = '%'; + *pDest++ = *p; + } + p++; + } else { + *pDest++ = *p++; + } + } + *pDest = 0; + + return 0; +} + +/* This routine can make no MPI calls, since it may be logging those + * calls. */ +static int dbg_openfile(FILE ** dbg_fp) +{ + int mpl_errno = MPL_SUCCESS; + if (!file_pattern || *file_pattern == 0 || strcmp(file_pattern, "-stdout-") == 0) { + *dbg_fp = stdout; + } else if (strcmp(file_pattern, "-stderr-") == 0) { + *dbg_fp = stderr; + } else { + char filename[MAXPATHLEN]; + + /* if we're not at DBG_INITIALIZED, we don't know our + * rank yet, so we create a temp file, to be renamed later */ + if (dbg_initialized != DBG_INITIALIZED) { + mpl_errno = dbg_open_tmpfile(dbg_fp); + if (mpl_errno) + goto fn_fail; + } else { + mpl_errno = dbg_get_filename(filename, MAXPATHLEN); + if (mpl_errno) + goto fn_fail; + + *dbg_fp = fopen(filename, "w"); + if (!*dbg_fp) { + MPL_error_printf("Could not open log file %s\n", filename); + goto fn_fail; + } + } + } + fn_exit: + return mpl_errno; + fn_fail: + dbg_initialized = DBG_ERROR; + mpl_errno = MPL_ERR_DBG_INTERN; + goto fn_exit; +} + +/* Support routines for processing mpich-dbg values */ +/* Update the GLOBAL variable MPL_dbg_active_classes with the bits + * corresponding to this name */ +static int dbg_set_class(const char *s) +{ + int i, found_match; + size_t slen = 0; + char *str; + + if (s && *s) + slen = strlen(s); + + str = strtok((char *) s, ","); + while (str) { + found_match = 0; + for (i = 0; i < num_classnames; i++) { + size_t len = strlen(classnames[i].lcname); + + if (slen == len && (!strncmp(str, classnames[i].lcname, len) || + !strncmp(str, classnames[i].ucname, len))) { + /* we have a match */ + MPL_dbg_active_classes |= classnames[i].classbits; + found_match = 1; + break; + } + } + + if (!found_match) { + /* no match was found. the component might not have + * registered yet. store the user string for later + * access. */ + unregistered_classes[num_unregistered_classes] = str; + num_unregistered_classes++; + } + + str = strtok(NULL, ","); + } + + return 0; +} + +/* Set the global MPL_dbg_max_level if there is a match with the known + * level names */ +static int dbg_set_level(const char *s, const char *(names[])) +{ + int i; + + for (i = 0; names[i]; i++) { + if (strcmp(names[i], s) == 0) { + MPL_dbg_max_level = level_values[i]; + return 0; + } + } + return 1; +} +#endif /* MPL_USE_DBG_LOGGING */ diff --git a/3rd-party/romio341/mpl/src/env/Makefile.mk b/3rd-party/romio341/mpl/src/env/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..d933203c86f7744e9d48c498e9edea854687d815 --- /dev/null +++ b/3rd-party/romio341/mpl/src/env/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/env/mpl_env.c diff --git a/3rd-party/romio341/mpl/src/env/mpl_env.c b/3rd-party/romio341/mpl/src/env/mpl_env.c new file mode 100644 index 0000000000000000000000000000000000000000..734c0393ed368b4a359b082d6df537481525eb92 --- /dev/null +++ b/3rd-party/romio341/mpl/src/env/mpl_env.c @@ -0,0 +1,158 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +/* This is taken from src/pm/util/pmiport.c */ +int MPL_env2range(const char *envName, int *lowPtr, int *highPtr) +{ + const char *range_ptr; + int low = 0, high = 0; + + /* Get the low and high range. */ + range_ptr = getenv(envName); + if (range_ptr) { + const char *p; + /* Look for n:m format */ + p = range_ptr; + while (*p && isspace(*p)) + p++; + while (*p && isdigit(*p)) + low = 10 * low + (*p++ - '0'); + if (*p == ':') { + p++; + while (*p && isdigit(*p)) + high = 10 * high + (*p++ - '0'); + } + if (*p) { + MPL_error_printf("Invalid character %c in %s\n", *p, envName); + return -1; + } + *lowPtr = low; + *highPtr = high; + } + return 0; +} + +/* + * Returns the value for a given envName in val if present, returns -1 if + * there is an error, 0 for no value, and 1 for value found (note that this + * isn't the same as GetEnvRange). val is changed only if envName is + * found and is a valid integer. + */ +int MPL_env2int(const char *envName, int *val) +{ + const char *val_ptr; + + val_ptr = getenv(envName); + if (val_ptr) { + const char *p; + int sign = 1, value = 0; + p = val_ptr; + while (*p && isspace(*p)) + p++; + if (*p == '-') { + p++; + sign = -1; + } + if (*p == '+') + p++; + while (*p && isdigit(*p)) + value = 10 * value + (*p++ - '0'); + if (*p) { + MPL_error_printf("Invalid character %c in %s\n", *p, envName); + return -1; + } + *val = sign * value; + return 1; + } + return 0; +} + +/* Get a boolean value for an environment variable. To be user-friendly, + accept a range of choices: + + TRUE: yes, YES, true, TRUE, on, ON, 1 + FALSE: no, NO, false, FALSE, off, OFF, 0 + + returns 1 if a value was found, 0 if no value and -1 if an unrecognized + value was found. The boolean value is stored in *val if found. +*/ +int MPL_env2bool(const char *envName, int *val) +{ + const char *val_ptr; + + val_ptr = getenv(envName); + if (val_ptr) { + if (strcmp(val_ptr, "YES") == 0 || + strcmp(val_ptr, "yes") == 0 || + strcmp(val_ptr, "TRUE") == 0 || + strcmp(val_ptr, "true") == 0 || + strcmp(val_ptr, "ON") == 0 || strcmp(val_ptr, "on") == 0 || strcmp(val_ptr, "1") == 0) { + *val = 1; + return 1; + } + if (strcmp(val_ptr, "NO") == 0 || + strcmp(val_ptr, "no") == 0 || + strcmp(val_ptr, "FALSE") == 0 || + strcmp(val_ptr, "false") == 0 || + strcmp(val_ptr, "OFF") == 0 || + strcmp(val_ptr, "off") == 0 || strcmp(val_ptr, "0") == 0) { + *val = 0; + return 1; + } + /* Else an invalid value */ + /* FIXME: We need to provide a way to signal this error */ + return -1; + } + return 0; +} + +int MPL_env2str(const char *envName, const char **val) +{ + const char *val_ptr; + + val_ptr = getenv(envName); + + if (val_ptr) { + *val = val_ptr; + return 1; + } + + return 0; +} + +int MPL_putenv(char *name_val) +{ + return putenv(name_val); +} + +/* + * Returns the value for a given envName in val if present, returns -1 if + * there is an error, 0 for no value, and 1 for value found (note that this + * isn't the same as GetEnvRange). val is changed only if envName is + * found and is a valid double. + */ +int MPL_env2double(const char *envName, double *val) +{ + const char *val_ptr; + char *end_ptr = NULL; + double tmp; + + val_ptr = getenv(envName); + if (val_ptr) { + /* just use strtod for now, we can patch it up with configury if we + * encounter any platforms that don't actually have it */ + tmp = strtod(val_ptr, &end_ptr); + if (tmp == 0.0 && val_ptr == end_ptr) { + /* no conversion was performed by strtod */ + return -1; + } else { + *val = tmp; + return 1; + } + } + return 0; +} diff --git a/3rd-party/romio341/mpl/src/gavl/Makefile.mk b/3rd-party/romio341/mpl/src/gavl/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..d573b9c343e9b74e46d3c752e782cb73cd17115a --- /dev/null +++ b/3rd-party/romio341/mpl/src/gavl/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/gavl/mpl_gavl.c diff --git a/3rd-party/romio341/mpl/src/gavl/mpl_gavl.c b/3rd-party/romio341/mpl/src/gavl/mpl_gavl.c new file mode 100644 index 0000000000000000000000000000000000000000..7b343be71225789df9da1917f7310c141e9647d9 --- /dev/null +++ b/3rd-party/romio341/mpl/src/gavl/mpl_gavl.c @@ -0,0 +1,535 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#include <assert.h> + +#define GAVL_TREE_NODE_INIT(node_ptr, addr, len, val) \ + do { \ + (node_ptr)->height = 1; \ + (node_ptr)->addr = (uintptr_t) addr; \ + (node_ptr)->len = len; \ + (node_ptr)->val = val; \ + } while (0) + +#define GAVL_TREE_NODE_CMP(node_ptr, addr, len, mode, ret) \ + do { \ + switch(mode) { \ + case MPLI_GAVL_SUBSET_SEARCH: \ + ret = MPLI_gavl_subset_cmp_func(node_ptr, addr, len); \ + break; \ + case MPLI_GAVL_INTERSECTION_SEARCH: \ + ret = MPLI_gavl_intersect_cmp_func(node_ptr, addr, len);\ + break; \ + case MPLI_GAVL_START_ADDR_SEARCH: \ + ret = MPLI_gavl_start_addr_cmp_func(node_ptr, addr); \ + break; \ + } \ + } while (0) + +/* STACK is needed to rebalance the tree */ +#define TREE_STACK_PUSH(tree_ptr, value) \ + do { \ + assert(tree_ptr->stack_sp < MPLI_GAVL_MAX_STACK_SIZE); \ + tree_ptr->stack[tree_ptr->stack_sp++] = value; \ + } while (0) + +#define TREE_STACK_POP(tree_ptr, value) \ + do { \ + assert(tree_ptr->stack_sp > 0); \ + value = tree_ptr->stack[--tree_ptr->stack_sp]; \ + } while (0) + +#define TREE_STACK_START(tree_ptr) (tree_ptr)->stack_sp = 0 +#define TREE_STACK_IS_EMPTY(tree_ptr) (!(tree_ptr)->stack_sp) + +static void gavl_tree_remove_nodes(MPLI_gavl_tree_s * tree_ptr, uintptr_t addr, uintptr_t len, + int mode); +static void gavl_tree_delete_removed_nodes(MPLI_gavl_tree_s * tree_ptr, uintptr_t addr, + uintptr_t len, int mode); + +static void gavl_update_node_info(MPLI_gavl_tree_node_s * node_iptr) +{ + int lheight = node_iptr->u.s.left == NULL ? 0 : node_iptr->u.s.left->height; + int rheight = node_iptr->u.s.right == NULL ? 0 : node_iptr->u.s.right->height; + node_iptr->height = (lheight < rheight ? rheight : lheight) + 1; + return; +} + +static void gavl_right_rotation(MPLI_gavl_tree_node_s * parent_ptr, MPLI_gavl_tree_node_s * lchild) +{ + parent_ptr->u.s.left = lchild->u.s.right; + lchild->u.s.right = parent_ptr; + lchild->u.s.parent = parent_ptr->u.s.parent; + if (lchild->u.s.parent != NULL) { + if (lchild->u.s.parent->u.s.left == parent_ptr) + lchild->u.s.parent->u.s.left = lchild; + else + lchild->u.s.parent->u.s.right = lchild; + } + + parent_ptr->u.s.parent = lchild; + if (parent_ptr->u.s.left != NULL) + parent_ptr->u.s.left->u.s.parent = parent_ptr; + + gavl_update_node_info(parent_ptr); + gavl_update_node_info(lchild); + return; +} + +static void gavl_left_rotation(MPLI_gavl_tree_node_s * parent_ptr, MPLI_gavl_tree_node_s * rchild) +{ + parent_ptr->u.s.right = rchild->u.s.left; + rchild->u.s.left = parent_ptr; + rchild->u.s.parent = parent_ptr->u.s.parent; + if (rchild->u.s.parent != NULL) { + if (rchild->u.s.parent->u.s.left == parent_ptr) + rchild->u.s.parent->u.s.left = rchild; + else + rchild->u.s.parent->u.s.right = rchild; + } + + parent_ptr->u.s.parent = rchild; + if (parent_ptr->u.s.right != NULL) + parent_ptr->u.s.right->u.s.parent = parent_ptr; + + gavl_update_node_info(parent_ptr); + gavl_update_node_info(rchild); + return; +} + +static void gavl_left_right_rotation(MPLI_gavl_tree_node_s * parent_ptr, + MPLI_gavl_tree_node_s * lchild) +{ + MPLI_gavl_tree_node_s *rlchild = lchild->u.s.right; + gavl_left_rotation(lchild, rlchild); + gavl_right_rotation(parent_ptr, rlchild); + return; +} + +static void gavl_right_left_rotation(MPLI_gavl_tree_node_s * parent_ptr, + MPLI_gavl_tree_node_s * rchild) +{ + MPLI_gavl_tree_node_s *lrchild = rchild->u.s.left; + gavl_right_rotation(rchild, lrchild); + gavl_left_rotation(parent_ptr, lrchild); + return; +} + +/* + * MPL_gavl_tree_create + * Description: create a gavl tree + * Parameters: + * free_fn - (IN) user free function to free buffer object + * gavl_tree - (OUT) created gavl tree + */ +int MPL_gavl_tree_create(void (*free_fn) (void *), MPL_gavl_tree_t * gavl_tree) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_s *tree_ptr; + + tree_ptr = (MPLI_gavl_tree_s *) MPL_calloc(1, sizeof(MPLI_gavl_tree_s), MPL_MEM_OTHER); + if (tree_ptr == NULL) { + mpl_err = MPL_ERR_NOMEM; + goto fn_fail; + } + + tree_ptr->gavl_free_fn = free_fn; + *gavl_tree = (MPL_gavl_tree_t) tree_ptr; + + fn_exit: + return mpl_err; + fn_fail: + goto fn_exit; +} + +static MPLI_gavl_tree_node_s *gavl_tree_search_internal(MPLI_gavl_tree_s * tree_ptr, uintptr_t addr, + uintptr_t len, int mode, int *cmp_ret_ptr) +{ + /* this function assumes there is at least one node in the tree */ + int cmp_ret = MPLI_GAVL_NO_BUFFER_MATCH; + MPLI_gavl_tree_node_s *cur_node = tree_ptr->root; + + TREE_STACK_START(tree_ptr); + do { + GAVL_TREE_NODE_CMP(cur_node, addr, len, mode, cmp_ret); + if (cmp_ret == MPLI_GAVL_SEARCH_LEFT) { + if (cur_node->u.s.left != NULL) { + TREE_STACK_PUSH(tree_ptr, cur_node); + cur_node = cur_node->u.s.left; + continue; + } else { + break; + } + } else if (cmp_ret == MPLI_GAVL_SEARCH_RIGHT) { + if (cur_node->u.s.right != NULL) { + TREE_STACK_PUSH(tree_ptr, cur_node); + cur_node = cur_node->u.s.right; + continue; + } else { + break; + } + } else { + /* node match */ + break; + } + } while (1); + + *cmp_ret_ptr = cmp_ret; + tree_ptr->cur_node = cur_node; + return cur_node; +} + +/* if avl tree is possibly unbalanced, gavl_tree_rebalance should be called to rebalance + * it. In unbalanced avl tree, the height difference between left and right child is at + * most 2; gavl_tree_rebalance takes it as a premise in order to rebalance tree correcly */ +static void gavl_tree_rebalance(MPLI_gavl_tree_s * tree_ptr) +{ + MPLI_gavl_tree_node_s *cur_node = tree_ptr->cur_node; + + if (cur_node) { + do { + gavl_update_node_info(cur_node); + + int lheight = cur_node->u.s.left == NULL ? 0 : cur_node->u.s.left->height; + int rheight = cur_node->u.s.right == NULL ? 0 : cur_node->u.s.right->height; + if (lheight - rheight > 1) { + /* find imbalance: left child is 2 level higher than right child */ + MPLI_gavl_tree_node_s *lnode = cur_node->u.s.left; + int llheight = lnode->u.s.left == NULL ? 0 : lnode->u.s.left->height; + /* if left child's (lnode's) left child causes this imbalance, we need to perform right + * rotation to reduce the height of lnode's left child; + * right rotation sets left child (lnode) as central node, moves lnode to parent (cur_node) + * position, assigns cur_node to right child of lnode and then lnode's right child to left + * child of cur_node. + * else we need to perform left-right rotation for rebalance; left-right rotation first + * moves right child (rlnode) of left child (lnode) to lnode position and assigns left + * child of rlnode to right child of lnode; then set rlnode as central node and perform + * right rotation as mentioned above */ + if (llheight + 1 == lheight) + gavl_right_rotation(cur_node, lnode); + else + gavl_left_right_rotation(cur_node, lnode); + } else if (rheight - lheight > 1) { + /* find imbalance: right child is 2 level higher than left child */ + MPLI_gavl_tree_node_s *rnode = cur_node->u.s.right; + int rlheight = rnode->u.s.left == NULL ? 0 : rnode->u.s.left->height; + /* the purpose of gavl_right_left_rotation and gavl_left_rotation is similar to + * gavl_right_rotation and gavl_left_right_rotation mention above; the difference + * is just doing rotation for right child here*/ + if (rlheight + 1 == rheight) + gavl_right_left_rotation(cur_node, rnode); + else + gavl_left_rotation(cur_node, rnode); + } + + /* rebalance the previous nodes in traverse trace */ + if (!TREE_STACK_IS_EMPTY(tree_ptr)) { + TREE_STACK_POP(tree_ptr, cur_node); + continue; + } else { + break; + } + } while (1); + + /* after rebalance, we need to update root because it might be changed after rebalance */ + while (tree_ptr->root && tree_ptr->root->u.s.parent != NULL) + tree_ptr->root = tree_ptr->root->u.s.parent; + } + + return; +} + +/* + * MPL_gavl_tree_insert + * Description: insert a node with key (addr, len) into gavl tree. If new node is duplicate, + * we should not insert it and need to free the node and return. This function + * is not thread-safe. + * Parameters: + * gavl_tree - (IN) gavl tree object + * addr - (IN) input buffer starting addr + * len - (IN) input buffer length + * val - (IN) buffer object + */ +int MPL_gavl_tree_insert(MPL_gavl_tree_t gavl_tree, const void *addr, uintptr_t len, + const void *val) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_node_s *node_ptr; + MPLI_gavl_tree_s *tree_ptr = (MPLI_gavl_tree_s *) gavl_tree; + + /* we remove all nodes that are subset of input key (addr, len) from the tree and add them + * into tree remove_list */ + gavl_tree_remove_nodes(tree_ptr, (uintptr_t) addr, len, MPLI_GAVL_SUBSET_SEARCH); + + node_ptr = (MPLI_gavl_tree_node_s *) MPL_calloc(1, + sizeof(MPLI_gavl_tree_node_s), MPL_MEM_OTHER); + if (node_ptr == NULL) { + mpl_err = MPL_ERR_NOMEM; + goto fn_fail; + } + + GAVL_TREE_NODE_INIT(node_ptr, addr, len, val); + + if (tree_ptr->root == NULL) { + tree_ptr->root = node_ptr; + } else { + MPLI_gavl_tree_node_s *pnode; + int cmp_ret; + + /* search the node which will become the parent of new node */ + pnode = gavl_tree_search_internal(tree_ptr, (uintptr_t) node_ptr->addr, node_ptr->len, + MPLI_GAVL_SUBSET_SEARCH, &cmp_ret); + + /* find which side the new node should be inserted */ + if (cmp_ret == MPLI_GAVL_BUFFER_MATCH) { + /* new node is duplicate, we need to delete new node and exit */ + tree_ptr->gavl_free_fn((void *) node_ptr->val); + MPL_free(node_ptr); + goto fn_exit; + } + + /* insert new node into pnode */ + if (cmp_ret == MPLI_GAVL_SEARCH_LEFT) + pnode->u.s.left = node_ptr; + else + pnode->u.s.right = node_ptr; + node_ptr->u.s.parent = pnode; + + /* after insertion, the tree could be imbalanced, so rebalance is required here */ + gavl_tree_rebalance(tree_ptr); + } + + fn_exit: + return mpl_err; + fn_fail: + goto fn_exit; +} + +/* + * MPL_gavl_tree_destory + * Description: free all nodes and buffer objects in the tree and tree itself. + * Parameters: + * gavl_tree - (IN) gavl tree object + */ +int MPL_gavl_tree_destory(MPL_gavl_tree_t gavl_tree) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_s *tree_ptr = (MPLI_gavl_tree_s *) gavl_tree; + MPLI_gavl_tree_node_s *cur_node = tree_ptr->root; + MPLI_gavl_tree_node_s *dnode = NULL; + while (cur_node) { + if (cur_node->u.s.left) { + cur_node = cur_node->u.s.left; + } else if (cur_node->u.s.right) { + cur_node = cur_node->u.s.right; + } else { + dnode = cur_node; + cur_node = cur_node->u.s.parent; + if (cur_node) { + if (cur_node->u.s.left == dnode) + cur_node->u.s.left = NULL; + else + cur_node->u.s.right = NULL; + } + if (tree_ptr->gavl_free_fn) + tree_ptr->gavl_free_fn((void *) dnode->val); + MPL_free(dnode); + } + } + MPL_free(tree_ptr); + return mpl_err; +} + +static void gavl_tree_remove_node_internal(MPLI_gavl_tree_s * tree_ptr, + MPLI_gavl_tree_node_s * dnode) +{ + MPLI_gavl_tree_node_s *inorder_node; + + if (dnode->u.s.right == NULL) { + /* no right child, next inorder node is parent */ + if (dnode->u.s.parent == NULL) { + /* delete root node; if it has left child, set left child as root node; + * if not, set tree root as NULL */ + if (dnode->u.s.left) { + tree_ptr->root = dnode->u.s.left; + tree_ptr->root->u.s.parent = NULL; + } else { + tree_ptr->root = NULL; + } + } else { + /* assign deleted node's left child to its parent */ + inorder_node = dnode->u.s.parent; + if (inorder_node->u.s.left == dnode) + inorder_node->u.s.left = dnode->u.s.left; + else + inorder_node->u.s.right = dnode->u.s.left; + + if (dnode->u.s.left) + dnode->u.s.left->u.s.parent = inorder_node; + + TREE_STACK_PUSH(tree_ptr, inorder_node); + } + } else { + const void *tmp_val; + uintptr_t tmp_addr, tmp_len; + + /* find the next inorder node and move its buffer objects to dnode; + * the original buffer object in dnode is freed */ + inorder_node = dnode->u.s.right; + TREE_STACK_PUSH(tree_ptr, dnode); + + /* search left most node of right child of dnode for next inorder node */ + while (inorder_node->u.s.left) { + TREE_STACK_PUSH(tree_ptr, inorder_node); + inorder_node = inorder_node->u.s.left; + } + + /* remove inorder_node from the tree. */ + if (inorder_node->u.s.parent != dnode) { + if (inorder_node->u.s.right) + inorder_node->u.s.right->u.s.parent = inorder_node->u.s.parent; + inorder_node->u.s.parent->u.s.left = inorder_node->u.s.right; + } else { + dnode->u.s.right = NULL; + } + + /* exchange inorder_node with dnode and then add dnode into remove_list */ + tmp_val = dnode->val; + tmp_addr = dnode->addr; + tmp_len = dnode->len; + dnode->addr = inorder_node->addr; + dnode->len = inorder_node->len; + dnode->val = inorder_node->val; + inorder_node->addr = tmp_addr; + inorder_node->len = tmp_len; + inorder_node->val = tmp_val; + dnode = inorder_node; + } + + /* add removed node into remove list */ + dnode->u.next = tree_ptr->remove_list; + tree_ptr->remove_list = dnode; + + /* update stack for the consequent rebalance which will start from the top of + * the stack (i.e., tree_ptr->cur_node). */ + if (TREE_STACK_IS_EMPTY(tree_ptr)) { + tree_ptr->cur_node = NULL; + } else { + TREE_STACK_POP(tree_ptr, tree_ptr->cur_node); + } + return; +} + +/* + * MPL_gavl_tree_delete_range + * Description: delete all nodes containing the address range intersecting with the + * input buffer in gavl tree and free corresponding buffer objects + * using user-provided free function. This function is not thread-safe. + * Parameters: + * gavl_tree - (IN) gavl tree object + * addr - (IN) input buffer starting addr + * len - (IN) input buffer length + */ +int MPL_gavl_tree_delete_range(MPL_gavl_tree_t gavl_tree, const void *addr, uintptr_t len) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_s *tree_ptr = (MPLI_gavl_tree_s *) gavl_tree; + + /* move all nodes intersecting input buffer (addr, len) to remove_list */ + gavl_tree_remove_nodes(tree_ptr, (uintptr_t) addr, len, MPLI_GAVL_INTERSECTION_SEARCH); + + /* free nodes and buffer objects from remove list */ + gavl_tree_delete_removed_nodes(tree_ptr, (uintptr_t) addr, len, MPLI_GAVL_INTERSECTION_SEARCH); + + fn_exit: + return mpl_err; + fn_fail: + goto fn_exit; +} + + +/* MPL_gavl_tree_delete_start_addr + * Description: delete all nodes containing the starting address strictly matching + * the input address. This function is not thread-safe. + * Parameters: + * gavl_tree - (IN) gavl tree object + * addr - (IN) input buffer starting addr + */ +int MPL_gavl_tree_delete_start_addr(MPL_gavl_tree_t gavl_tree, const void *addr) +{ + int mpl_err = MPL_SUCCESS; + MPLI_gavl_tree_s *tree_ptr = (MPLI_gavl_tree_s *) gavl_tree; + + /* move all nodes intersecting input buffer (addr, len) to remove_list */ + gavl_tree_remove_nodes(tree_ptr, (uintptr_t) addr, 0, MPLI_GAVL_START_ADDR_SEARCH); + + /* free nodes and buffer objects from remove list */ + gavl_tree_delete_removed_nodes(tree_ptr, (uintptr_t) addr, 0, MPLI_GAVL_START_ADDR_SEARCH); + + fn_exit: + return mpl_err; + fn_fail: + goto fn_exit; +} + +static void gavl_tree_remove_nodes(MPLI_gavl_tree_s * tree_ptr, uintptr_t addr, uintptr_t len, + int mode) +{ + int cmp_ret; + MPLI_gavl_tree_node_s *dnode; + + while (tree_ptr->root) { + /* search and return the node to be deleted */ + dnode = gavl_tree_search_internal(tree_ptr, (uintptr_t) addr, len, mode, &cmp_ret); + + /* check whether dnode matches (addr, len) */ + if (cmp_ret != MPLI_GAVL_BUFFER_MATCH) { + /* we didn't find deleted node and exit */ + goto fn_exit; + } + + /* detach the matched node from tree and add removed node into remove list */ + gavl_tree_remove_node_internal(tree_ptr, dnode); + + /* we perform rebalance after every internal deletion in order to ensure + * lightweight rebalance that rotates left and right childs with at most + * 2 height difference. */ + gavl_tree_rebalance(tree_ptr); + }; + + fn_exit: + return; +} + +/* gavl_tree_delete_removed_nodes searches all nodes that match with the + * input key (addr, len) and search mode in remove_list and delete them.*/ +static void gavl_tree_delete_removed_nodes(MPLI_gavl_tree_s * tree_ptr, uintptr_t addr, + uintptr_t len, int mode) +{ + int cmp_ret; + MPLI_gavl_tree_node_s *prev, *cur, *dnode; + + cur = tree_ptr->remove_list; + prev = NULL; + while (cur) { + GAVL_TREE_NODE_CMP(cur, addr, len, mode, cmp_ret); + if (cmp_ret == MPLI_GAVL_BUFFER_MATCH) { + if (prev) + prev->u.next = cur->u.next; + else + tree_ptr->remove_list = cur->u.next; + + dnode = cur; + cur = cur->u.next; + if (tree_ptr->gavl_free_fn) + tree_ptr->gavl_free_fn((void *) dnode->val); + MPL_free(dnode); + } else { + prev = cur; + cur = cur->u.next; + } + } +} diff --git a/3rd-party/romio341/mpl/src/gpu/Makefile.mk b/3rd-party/romio341/mpl/src/gpu/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..d6163910d293a95724fd4a56aff8482f3dd96682 --- /dev/null +++ b/3rd-party/romio341/mpl/src/gpu/Makefile.mk @@ -0,0 +1,16 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/gpu/mpl_gpu_common.c + +if MPL_HAVE_CUDA +lib@MPLLIBNAME@_la_SOURCES += src/gpu/mpl_gpu_cuda.c +else +if MPL_HAVE_ZE +lib@MPLLIBNAME@_la_SOURCES += src/gpu/mpl_gpu_ze.c +else +lib@MPLLIBNAME@_la_SOURCES += src/gpu/mpl_gpu_fallback.c +endif +endif diff --git a/3rd-party/romio341/mpl/src/gpu/mpl_gpu_common.c b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_common.c new file mode 100644 index 0000000000000000000000000000000000000000..86a51d399565be49b970ac6ef5abbcffc2a51dc8 --- /dev/null +++ b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_common.c @@ -0,0 +1,19 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "mpl.h" + +int MPL_gpu_query_support(MPL_gpu_type_t * type) +{ +#ifdef MPL_HAVE_CUDA + *type = MPL_GPU_TYPE_CUDA; +#elif defined MPL_HAVE_ZE + *type = MPL_GPU_TYPE_ZE; +#else + *type = MPL_GPU_TYPE_NONE; +#endif + + return MPL_SUCCESS; +} diff --git a/3rd-party/romio341/mpl/src/gpu/mpl_gpu_cuda.c b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_cuda.c new file mode 100644 index 0000000000000000000000000000000000000000..92bfc84f28d7cd7ca47e12eb1b9fc0be821fafb7 --- /dev/null +++ b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_cuda.c @@ -0,0 +1,344 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "mpl.h" +#include <dlfcn.h> +#include <assert.h> + +#define CUDA_ERR_CHECK(ret) if (unlikely((ret) != cudaSuccess)) goto fn_fail +#define CU_ERR_CHECK(ret) if (unlikely((ret) != CUDA_SUCCESS)) goto fn_fail + +typedef struct gpu_free_hook { + void (*free_hook) (void *dptr); + struct gpu_free_hook *next; +} gpu_free_hook_s; + +static gpu_free_hook_s *free_hook_chain = NULL; + +static CUresult CUDAAPI(*sys_cuMemFree) (CUdeviceptr dptr); +static cudaError_t CUDARTAPI(*sys_cudaFree) (void *dptr); + +static int gpu_mem_hook_init(); + +int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr) +{ + cudaError_t ret; + struct cudaPointerAttributes ptr_attr; + ret = cudaPointerGetAttributes(&ptr_attr, ptr); + if (ret == cudaSuccess) { + switch (ptr_attr.type) { + case cudaMemoryTypeUnregistered: + attr->type = MPL_GPU_POINTER_UNREGISTERED_HOST; + attr->device = ptr_attr.device; + break; + case cudaMemoryTypeHost: + attr->type = MPL_GPU_POINTER_REGISTERED_HOST; + attr->device = ptr_attr.device; + break; + case cudaMemoryTypeDevice: + attr->type = MPL_GPU_POINTER_DEV; + attr->device = ptr_attr.device; + break; + case cudaMemoryTypeManaged: + attr->type = MPL_GPU_POINTER_MANAGED; + attr->device = ptr_attr.device; + break; + } + } else if (ret == cudaErrorInvalidValue) { + attr->type = MPL_GPU_POINTER_UNREGISTERED_HOST; + attr->device = -1; + } else { + goto fn_fail; + } + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_create(const void *ptr, MPL_gpu_ipc_mem_handle_t * ipc_handle) +{ + cudaError_t ret; + + ret = cudaIpcGetMemHandle(ipc_handle, (void *) ptr); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_map(MPL_gpu_ipc_mem_handle_t ipc_handle, MPL_gpu_device_handle_t dev_handle, + void **ptr) +{ + cudaError_t ret; + int prev_devid; + + cudaGetDevice(&prev_devid); + cudaSetDevice(dev_handle); + ret = cudaIpcOpenMemHandle(ptr, ipc_handle, cudaIpcMemLazyEnablePeerAccess); + CUDA_ERR_CHECK(ret); + + fn_exit: + cudaSetDevice(prev_devid); + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_unmap(void *ptr) +{ + cudaError_t ret; + ret = cudaIpcCloseMemHandle(ptr); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_malloc_host(void **ptr, size_t size) +{ + cudaError_t ret; + ret = cudaMallocHost(ptr, size); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_free_host(void *ptr) +{ + cudaError_t ret; + ret = cudaFreeHost(ptr); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_register_host(const void *ptr, size_t size) +{ + cudaError_t ret; + ret = cudaHostRegister((void *) ptr, size, cudaHostRegisterDefault); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_unregister_host(const void *ptr) +{ + cudaError_t ret; + ret = cudaHostUnregister((void *) ptr); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_malloc(void **ptr, size_t size, MPL_gpu_device_handle_t h_device) +{ + int mpl_errno = MPL_SUCCESS; + int prev_devid; + cudaError_t ret; + cudaGetDevice(&prev_devid); + cudaSetDevice(h_device); + ret = cudaMalloc(ptr, size); + CUDA_ERR_CHECK(ret); + + fn_exit: + cudaSetDevice(prev_devid); + return mpl_errno; + fn_fail: + mpl_errno = MPL_ERR_GPU_INTERNAL; + goto fn_exit; +} + +int MPL_gpu_free(void *ptr) +{ + cudaError_t ret; + ret = cudaFree(ptr); + CUDA_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_init(int *device_count, int *max_dev_id_ptr) +{ + int count, max_dev_id = -1; + cudaError_t ret = cudaGetDeviceCount(&count); + CUDA_ERR_CHECK(ret); + + char *visible_devices = getenv("CUDA_VISIBLE_DEVICES"); + if (visible_devices) { + uintptr_t len = strlen(visible_devices); + char *devices = MPL_malloc(len + 1, MPL_MEM_OTHER); + char *free_ptr = devices; + memcpy(devices, visible_devices, len + 1); + for (int i = 0; i < count; i++) { + int global_dev_id; + char *tmp = strtok(devices, ","); + assert(tmp); + global_dev_id = atoi(tmp); + if (global_dev_id > max_dev_id) + max_dev_id = global_dev_id; + devices = NULL; + } + MPL_free(free_ptr); + } else { + max_dev_id = count - 1; + } + + *max_dev_id_ptr = max_dev_id; + *device_count = count; + + gpu_mem_hook_init(); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_finalize() +{ + gpu_free_hook_s *prev; + while (free_hook_chain) { + prev = free_hook_chain; + free_hook_chain = free_hook_chain->next; + MPL_free(prev); + } + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_id(MPL_gpu_device_handle_t dev_handle, int *dev_id) +{ + *dev_id = dev_handle; + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_handle(int dev_id, MPL_gpu_device_handle_t * dev_handle) +{ + *dev_handle = dev_id; + return MPL_SUCCESS; +} + +int MPL_gpu_get_global_dev_ids(int *global_ids, int count) +{ + char *visible_devices = getenv("CUDA_VISIBLE_DEVICES"); + + if (visible_devices) { + uintptr_t len = strlen(visible_devices); + char *devices = MPL_malloc(len + 1, MPL_MEM_OTHER); + char *free_ptr = devices; + memcpy(devices, visible_devices, len + 1); + for (int i = 0; i < count; i++) { + char *tmp = strtok(devices, ","); + assert(tmp); + global_ids[i] = atoi(tmp); + devices = NULL; + } + MPL_free(free_ptr); + } else { + for (int i = 0; i < count; i++) { + global_ids[i] = i; + } + } + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_get_buffer_bounds(const void *ptr, void **pbase, uintptr_t * len) +{ + CUresult curet; + + curet = cuMemGetAddressRange((CUdeviceptr *) pbase, (size_t *) len, (CUdeviceptr) ptr); + CU_ERR_CHECK(curet); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +static void gpu_free_hooks_cb(void *dptr) +{ + gpu_free_hook_s *current = free_hook_chain; + if (dptr != NULL) { + /* we call gpu hook only when dptr != NULL */ + while (current) { + current->free_hook(dptr); + current = current->next; + } + } + return; +} + +static int gpu_mem_hook_init() +{ + void *libcuda_handle; + void *libcudart_handle; + + libcuda_handle = dlopen("libcuda.so", RTLD_LAZY | RTLD_GLOBAL); + assert(libcuda_handle); + libcudart_handle = dlopen("libcudart.so", RTLD_LAZY | RTLD_GLOBAL); + assert(libcudart_handle); + + sys_cuMemFree = (void *) dlsym(libcuda_handle, "cuMemFree"); + assert(sys_cuMemFree); + sys_cudaFree = (void *) dlsym(libcudart_handle, "cudaFree"); + assert(sys_cudaFree); + return MPL_SUCCESS; +} + +int MPL_gpu_free_hook_register(void (*free_hook) (void *dptr)) +{ + gpu_free_hook_s *hook_obj = MPL_malloc(sizeof(gpu_free_hook_s), MPL_MEM_OTHER); + assert(hook_obj); + hook_obj->free_hook = free_hook; + hook_obj->next = NULL; + if (!free_hook_chain) + free_hook_chain = hook_obj; + else { + hook_obj->next = free_hook_chain; + free_hook_chain = hook_obj; + } + + return MPL_SUCCESS; +} + +CUresult CUDAAPI cuMemFree(CUdeviceptr dptr) +{ + CUresult result; + gpu_free_hooks_cb((void *) dptr); + result = sys_cuMemFree(dptr); + return (result); +} + +cudaError_t CUDARTAPI cudaFree(void *dptr) +{ + cudaError_t result; + gpu_free_hooks_cb(dptr); + result = sys_cudaFree(dptr); + return result; +} diff --git a/3rd-party/romio341/mpl/src/gpu/mpl_gpu_fallback.c b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_fallback.c new file mode 100644 index 0000000000000000000000000000000000000000..e6454ca05fb86d17df506975a4a5be2c487d47c7 --- /dev/null +++ b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_fallback.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "mpl.h" + +int MPL_gpu_ipc_handle_create(const void *ptr, MPL_gpu_ipc_mem_handle_t * ipc_handle) +{ + abort(); + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_map(MPL_gpu_ipc_mem_handle_t ipc_handle, MPL_gpu_device_handle_t dev_handle, + void **ptr) +{ + abort(); + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_unmap(void *ptr) +{ + abort(); + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_malloc_host(void **ptr, size_t size) +{ + *ptr = MPL_malloc(size, MPL_MEM_BUFFER); + return MPL_SUCCESS; +} + +int MPL_gpu_free_host(void *ptr) +{ + MPL_free(ptr); + return MPL_SUCCESS; +} + +int MPL_gpu_register_host(const void *ptr, size_t size) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_unregister_host(const void *ptr) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_malloc(void **ptr, size_t size, MPL_gpu_device_handle_t h_device) +{ + abort(); + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_free(void *ptr) +{ + abort(); + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_init(int *device_count, int *max_dev_id_ptr) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_finalize() +{ + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_id(MPL_gpu_device_handle_t dev_handle, int *dev_id) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_handle(int dev_id, MPL_gpu_device_handle_t * dev_handle) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_get_global_dev_ids(int *global_ids, int count) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_get_buffer_bounds(const void *ptr, void **pbase, uintptr_t * len) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_free_hook_register(void (*free_hook) (void *dptr)) +{ + return MPL_SUCCESS; +} diff --git a/3rd-party/romio341/mpl/src/gpu/mpl_gpu_ze.c b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_ze.c new file mode 100644 index 0000000000000000000000000000000000000000..a196aa2a938f06c1a4cee7bc91f3afea31e4971a --- /dev/null +++ b/3rd-party/romio341/mpl/src/gpu/mpl_gpu_ze.c @@ -0,0 +1,302 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#include <assert.h> + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#ifdef MPL_HAVE_ZE + +ze_driver_handle_t global_ze_driver_handle; +ze_device_handle_t *global_ze_devices_handle; +int gpu_ze_init_driver(); + +#define ZE_ERR_CHECK(ret) \ + do { \ + if (unlikely((ret) != ZE_RESULT_SUCCESS)) \ + goto fn_fail; \ + } while (0) + +int MPL_gpu_init(int *device_count_ptr, int *max_dev_id_ptr) +{ + ze_result_t ret; + int ret_error, device_count; + ret_error = gpu_ze_init_driver(); + if (ret_error != MPL_SUCCESS) + goto fn_fail; + + zeDriverGet(NULL, &global_ze_driver_handle); + ret = zeDeviceGet(global_ze_driver_handle, &device_count, NULL); + ZE_ERR_CHECK(ret); + + *max_dev_id_ptr = *device_count_ptr = device_count; + global_ze_devices_handle = + (ze_device_handle_t *) MPL_malloc(sizeof(ze_device_handle_t) * device_count, MPL_MEM_OTHER); + ret = zeDeviceGet(global_ze_driver_handle, &device_count, global_ze_devices_handle); + ZE_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return ret_error; +} + +/* Loads a global ze driver */ +int gpu_ze_init_driver() +{ + uint32_t driver_count = 0; + ze_result_t ret; + int ret_error = MPL_SUCCESS; + ze_driver_handle_t *all_drivers; + + ret = zeDriverGet(&driver_count, NULL); + ZE_ERR_CHECK(ret); + if (driver_count == 0) { + goto fn_fail; + } + + all_drivers = MPL_malloc(driver_count * sizeof(ze_driver_handle_t), MPL_MEM_OTHER); + if (all_drivers == NULL) { + ret_error = MPL_ERR_GPU_NOMEM; + goto fn_fail; + } + ret = zeDriverGet(&driver_count, all_drivers); + ZE_ERR_CHECK(ret); + + int i, d; + ze_device_handle_t *all_devices = NULL; + /* Find a driver instance with a GPU device */ + for (i = 0; i < driver_count; ++i) { + uint32_t device_count = 0; + ret = zeDeviceGet(all_drivers[i], &device_count, NULL); + ZE_ERR_CHECK(ret); + all_devices = MPL_malloc(device_count * sizeof(ze_device_handle_t), MPL_MEM_OTHER); + if (all_devices == NULL) { + ret_error = MPL_ERR_GPU_NOMEM; + goto fn_fail; + } + ret = zeDeviceGet(all_drivers[i], &device_count, all_devices); + ZE_ERR_CHECK(ret); + /* Check if the driver supports a gpu */ + for (d = 0; d < device_count; ++d) { + ze_device_properties_t device_properties; + ret = zeDeviceGetProperties(all_devices[d], &device_properties); + ZE_ERR_CHECK(ret); + + if (ZE_DEVICE_TYPE_GPU == device_properties.type) { + global_ze_driver_handle = all_drivers[i]; + break; + } + } + + MPL_free(all_devices); + all_devices = NULL; + if (NULL != global_ze_driver_handle) { + break; + } + } + + fn_exit: + MPL_free(all_drivers); + return ret_error; + fn_fail: + MPL_free(all_devices); + /* If error code is already set, preserve it */ + if (ret_error == MPL_SUCCESS) + ret_error = MPL_ERR_GPU_INTERNAL; + goto fn_exit; +} + +int MPL_gpu_finalize() +{ + MPL_free(global_ze_devices_handle); + return MPL_SUCCESS; +} + +int MPL_gpu_ipc_handle_create(const void *ptr, MPL_gpu_ipc_mem_handle_t * ipc_handle) +{ + int mpl_err; + ze_result_t ret; + ret = zeDriverGetMemIpcHandle(global_ze_driver_handle, ptr, ipc_handle); + ZE_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_ipc_handle_map(MPL_gpu_ipc_mem_handle_t ipc_handle, MPL_gpu_device_handle_t dev_handle, + void **ptr) +{ + int mpl_err = MPL_SUCCESS; + ze_result_t ret; + + ret = + zeDriverOpenMemIpcHandle(global_ze_driver_handle, + global_ze_devices_handle[ipc_handle.global_dev_id], + ipc_handle.handle, ZE_IPC_MEMORY_FLAG_NONE, ptr); + if (ret != ZE_RESULT_SUCCESS) { + mpl_err = MPL_ERR_GPU_INTERNAL; + goto fn_fail; + } + + fn_exit: + return mpl_err; + fn_fail: + goto fn_exit; +} + +int MPL_gpu_ipc_handle_unmap(void *ptr) +{ + ze_result_t ret; + ret = zeDriverCloseMemIpcHandle(global_ze_driver_handle, ptr); + ZE_ERR_CHECK(ret); + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr) +{ + ze_result_t ret; + ze_memory_allocation_properties_t ptr_attr; + ze_device_handle_t device; + ze_device_properties_t p_device_properties; + ret = zeDriverGetMemAllocProperties(global_ze_driver_handle, ptr, &ptr_attr, &device); + ZE_ERR_CHECK(ret); + attr->device = device; + switch (ptr_attr.type) { + case ZE_MEMORY_TYPE_UNKNOWN: + attr->type = MPL_GPU_POINTER_UNREGISTERED_HOST; + break; + case ZE_MEMORY_TYPE_HOST: + attr->type = MPL_GPU_POINTER_REGISTERED_HOST; + break; + case ZE_MEMORY_TYPE_DEVICE: + attr->type = MPL_GPU_POINTER_DEV; + break; + case ZE_MEMORY_TYPE_SHARED: + attr->type = MPL_GPU_POINTER_MANAGED; + break; + default: + goto fn_fail; + } + + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_malloc(void **ptr, size_t size, MPL_gpu_device_handle_t h_device) +{ + int ret; + size_t mem_alignment; + ze_device_mem_alloc_desc_t device_desc; + device_desc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT; + device_desc.ordinal = 0; /* We currently support a single memory type */ + device_desc.version = ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT; + /* Currently ZE ignores this augument and uses an internal alignment + * value. However, this behavior can change in the future. */ + mem_alignment = 1; + ret = zeDriverAllocDeviceMem(global_ze_driver_handle, &device_desc, + size, mem_alignment, h_device, ptr); + + ZE_ERR_CHECK(ret); + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_malloc_host(void **ptr, size_t size) +{ + int ret; + size_t mem_alignment; + ze_host_mem_alloc_desc_t host_desc; + host_desc.flags = ZE_HOST_MEM_ALLOC_FLAG_DEFAULT; + host_desc.version = ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT; + + /* Currently ZE ignores this augument and uses an internal alignment + * value. However, this behavior can change in the future. */ + mem_alignment = 1; + ret = zeDriverAllocHostMem(global_ze_driver_handle, &host_desc, size, mem_alignment, ptr); + ZE_ERR_CHECK(ret); + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_free(void *ptr) +{ + int ret; + ret = zeDriverFreeMem(global_ze_driver_handle, ptr); + ZE_ERR_CHECK(ret); + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_free_host(void *ptr) +{ + int ret; + ret = zeDriverFreeMem(global_ze_driver_handle, ptr); + ZE_ERR_CHECK(ret); + fn_exit: + return MPL_SUCCESS; + fn_fail: + return MPL_ERR_GPU_INTERNAL; +} + +int MPL_gpu_register_host(const void *ptr, size_t size) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_unregister_host(const void *ptr) +{ + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_id(MPL_gpu_device_handle_t dev_handle, int *dev_id) +{ + ze_device_properties_t devproerty; + + zeDeviceGetProperties(dev_handle, &devproerty); + *dev_id = devproerty.deviceId; + return MPL_SUCCESS; +} + +int MPL_gpu_get_dev_handle(int dev_id, MPL_gpu_device_handle_t * dev_handle) +{ + *dev_handle = device_handles[dev_id]; + return MPL_SUCCESS; +} + +int MPL_gpu_get_global_dev_ids(int *global_ids, int count) +{ + for (int i = 0; i < count; ++i) + global_ids[i] = i; + return MPL_SUCCESS; +} + +int MPL_gpu_get_buffer_bounds(const void *ptr, void **pbase, uintptr_t * len) +{ + /* TODO: need to find oneAPI function to retrieve base addr and buffer len */ + return MPL_SUCCESS; +} + +int MPL_gpu_free_hook_register(void (*free_hook) (void *dptr)) +{ + return MPL_SUCCESS; +} + +#endif /* MPL_HAVE_ZE */ diff --git a/3rd-party/romio341/mpl/src/mem/Makefile.mk b/3rd-party/romio341/mpl/src/mem/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..d9dc9ba1476c0311e050f8e99e519c045d89bc2b --- /dev/null +++ b/3rd-party/romio341/mpl/src/mem/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/mem/mpl_trmem.c diff --git a/3rd-party/romio341/mpl/src/mem/mpl_trmem.c b/3rd-party/romio341/mpl/src/mem/mpl_trmem.c new file mode 100644 index 0000000000000000000000000000000000000000..d6bc78bd40992d1143b9cb03f459ecd382d0c8c1 --- /dev/null +++ b/3rd-party/romio341/mpl/src/mem/mpl_trmem.c @@ -0,0 +1,994 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* Always enable valgrind macros (if possible) in this file. If these functions + * are used, the caller is concerned about correctness, not performance. */ +#define MPL_VG_ENABLED 1 + +/* style: allow:calloc:1 sig:0 */ +/* style: allow:free:2 sig:0 */ +/* style: allow:malloc:2 sig:0 */ +/* style: allow:strdup:1 sig:0 */ + +#include "mpl.h" +#include <assert.h> + +#ifdef malloc +/* Undefine these in case they were set to 'error' */ +#undef malloc +#undef calloc +#undef free +#undef strdup +#undef mmap +#undef munmap +/* Some GNU implementations use __strdup for strdup */ +#if defined(__strdup) +#define strdup(s) __strdup(s) +#endif +#endif + +#ifdef MPL_HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#define TR_ALIGN_BYTES 8 +#define TR_ALIGN_MASK 0x7 +#define TR_FNAME_LEN 48 + +#define COOKIE_VALUE 0xf0e0d0c9 +#define ALREADY_FREED 0x0f0e0d9c + +enum TR_mem_type { + TR_MALLOC_TYPE = 0, + TR_MMAP_TYPE = 1, +}; + +typedef struct TRSPACE { + enum TR_mem_type type; + MPL_memory_class class; + size_t size; + int id; + int lineno; + int freed_lineno; + char freed_fname[TR_FNAME_LEN]; + char fname[TR_FNAME_LEN]; + void *real_head; /* Pointer we got from (libc) malloc */ + struct TRSPACE *volatile next, *prev; + unsigned long cookie; /* Cookie is always the last element + * inorder to catch the off-by-one + * errors */ +} TRSPACE; +/* This union is used to ensure that the block passed to the user is + aligned on a double boundary */ +typedef union TrSPACE { + TRSPACE sp; + /* Ensure trSPACE header follows the alignment rules for all predefined types. + * Because any internal buffer is allocated as (TrSPACE)header + (void*)buffer.*/ + MPL_mem_alignment_t alignment; +} TrSPACE; + +/* + * This package maintains some state about itself. These globals hold + * this information. + */ +#define TRHEAD_PRESENTINAL ((TRSPACE *)0xbacdef01) +#define TRHEAD_POSTSENTINAL ((TRSPACE *)0x10fedcba) +static int world_rank = -1; +static volatile size_t allocated = 0; +static volatile long frags = 0; +static TRSPACE *volatile TRhead[3] = { TRHEAD_PRESENTINAL, 0, TRHEAD_POSTSENTINAL }; + +static volatile int TRid = 0; +static volatile int TRidSet = 0; +static volatile int TRlevel = 0; +static unsigned char TRDefaultByte = 0xda; +static unsigned char TRFreedByte = 0xfc; +static int TRdebugLevel = 0; +static int TRSetBytes = 0; +#define TR_MALLOC 0x1 +#define TR_FREE 0x2 +#define TR_MMAP 0x4 +#define TR_MUNMAP 0x8 + +/* Used to keep track of allocations */ +static volatile size_t TRMaxMem = 0; +static volatile int TRMaxMemId = 0; +static volatile size_t TRCurOverhead = 0; +static volatile size_t TRMaxOverhead = 314572800; +/* Used to limit allocation */ +static volatile size_t TRMaxMemAllow = 0; + +static int TR_is_threaded = 0; + +static int is_configured = 0; +static int classes_initialized = 0; + +static MPL_memory_allocation_t allocation_classes[MPL_MAX_MEMORY_CLASS]; + +/* This list should match the enum in mpl_trmem.h */ +static const char *allocation_class_strings[] = { + "MPL_MEM_ADDRESS", + "MPL_MEM_OBJECT", + "MPL_MEM_COMM", + "MPL_MEM_GROUP", + "MPL_MEM_STRINGS", + "MPL_MEM_RMA", + "MPL_MEM_BUFFER", + "MPL_MEM_SHM", + "MPL_MEM_THREAD", + "MPL_MEM_DYNAMIC", + "MPL_MEM_IO", + "MPL_MEM_GREQ", + "MPL_MEM_DATATYPE", + "MPL_MEM_MPIT", + "MPL_MEM_DEBUG", + "MPL_MEM_PM", + "MPL_MEM_COLL", + "MPL_MEM_USER", + "MPL_MEM_OTHER" +}; + +#if MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE + +static MPL_thread_mutex_t memalloc_mutex; + +#define TR_THREAD_CS_ENTER \ + do { \ + if (TR_is_threaded) { \ + int err_; \ + MPL_thread_mutex_lock(&memalloc_mutex, &err_, MPL_THREAD_PRIO_HIGH);\ + if (err_) \ + MPL_error_printf("Error acquiring memalloc mutex lock\n"); \ + } \ + } while (0) + +#define TR_THREAD_CS_EXIT \ + do { \ + if (TR_is_threaded) { \ + int err_; \ + MPL_thread_mutex_unlock(&memalloc_mutex, &err_); \ + if (err_) \ + MPL_error_printf("Error releasing memalloc mutex lock\n"); \ + } \ + } while (0) + +#else /* MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_NONE */ + +#define TR_THREAD_CS_ENTER +#define TR_THREAD_CS_EXIT + +#endif /* MPL_THREAD_PACKAGE_NAME */ + +static void init_classes() +{ + int i; + + for (i = 0; i < MPL_MAX_MEMORY_CLASS; i++) { + allocation_classes[i] = (MPL_memory_allocation_t) { + .max_allocated_mem = 0,.curr_allocated_mem = 0,.total_allocated_mem = + 0,.num_allocations = 0}; + } + + classes_initialized = 1; +} + +/*+C + MPL_trinit - Setup the space package. Only needed for + error messages and flags. ++*/ +void MPL_trinit() +{ + char *s; + + /* FIXME: We should use generalized parameter handling here + * to allow use of the command line as well as environment + * variables */ + s = getenv("MPL_TRMEM_INIT"); + if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) { + TRSetBytes = 1; + } + s = getenv("MPL_TRMEM_VALIDATE"); + if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) { + TRdebugLevel = 1; + } + s = getenv("MPL_TRMEM_INITZERO"); + if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) { + TRDefaultByte = 0; + TRFreedByte = 0; + } + s = getenv("MPL_TRMEM_TRACELEVEL"); + if (s && *s) { + int l = atoi(s); + TRlevel = l; + } + s = getenv("MPL_TRMEM_MAX_OVERHEAD"); + if (s && *s) { + long l = atol(s); + TRMaxOverhead = (size_t) l; + } +} + +void MPL_trconfig(int rank, int need_thread_safety) +{ + world_rank = rank; + + if (is_configured) + return; + + /* If the upper layer asked for thread safety and there's no + * threading package available, we need to return an error. */ +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_NONE + if (need_thread_safety) + MPL_error_printf("No thread package to provide thread-safe memory allocation\n"); +#endif + +#if MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE + if (need_thread_safety) { + int err; + + MPL_thread_mutex_create(&memalloc_mutex, &err); + if (err) { + MPL_error_printf("Error creating memalloc mutex\n"); + } + + TR_is_threaded = 1; + } +#endif + + is_configured = 1; +} + +/* + Validate given alignment. + Invoked only when memory tracing is enabled. + */ +MPL_STATIC_INLINE_PREFIX int is_valid_alignment(size_t a) +{ + /* No alignment constraints - okay */ + if (a == 0) + return 1; + + /* Alignment should be multiple of sizeof(void *), as in posix_memalign(3) */ + if (a % sizeof(void *) != 0) + return 0; + + /* Check if it's power of two */ + while (a > 1) { + if (a % 2 == 1) + return 0; /* Don't allow non-power-of-two numbers */ + a /= 2; + } + + return 1; +} + +/*+C + MPL_trmalloc - Malloc with tracing + +Input Parameters: ++ a - number of bytes to allocate +. lineno - line number where used. Use __LINE__ for this +- fname - file name where used. Use __FILE__ for this + + Returns: + double aligned pointer to requested storage, or null if not + available. + +*/ +static void *trmalloc(size_t alignment, size_t a, MPL_memory_class class, int lineno, + const char fname[]) +{ + TRSPACE *head; + char *new = NULL; + unsigned long *nend; + size_t nsize, alloc_size, align_shift; + int l; + + if (!is_valid_alignment(alignment)) + goto fn_exit; + + if (TRdebugLevel > 0) { + if (MPL_trvalid2("Invalid MALLOC arena detected at line %d in %s\n", lineno, fname)) + goto fn_exit; + } + + nsize = a; + if (nsize & TR_ALIGN_MASK) + nsize += (TR_ALIGN_BYTES - (nsize & TR_ALIGN_MASK)); + if ((allocated + nsize > TRMaxMemAllow) && TRMaxMemAllow) { + /* Return a null when memory would be exhausted */ + /* This is only called when additional debugging is enabled, + * so the fact that this does not go through the regular error + * message system is not a problem. */ + MPL_error_printf("Exceeded allowed memory!\n"); + goto fn_exit; + } + + /* + * Memory layout: + * _______________________________________ + * | pad | TrSPACE | user space | cookie | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * ^ | | | + * real_head: pointer we got from underlying malloc (len(pad) == align_shift) + * ^ | | + * head: our own metadata block for memory tracing + * ^ | + * Pointer returned to user (aligned if requested) + * ^ + * Cookied at the tail (unsigned long) + */ + + alloc_size = alignment + sizeof(TrSPACE) + nsize + sizeof(unsigned long); + + new = (char *) malloc(alloc_size); + if (!new) + goto fn_exit; + + if (TRSetBytes) + memset(new, TRDefaultByte, alloc_size); + + if (alignment > 0) + align_shift = alignment - ((uintptr_t) new + sizeof(TrSPACE)) % alignment; + else + align_shift = 0; + if (align_shift == alignment) + align_shift = 0; /* buffer was already aligned at desired boundary */ + /* Cast to (void*) to avoid false warnings about alignment issues */ + head = (TRSPACE *) (void *) (new + align_shift); + head->real_head = new; /* Record the pointer we got from malloc */ + new += sizeof(TrSPACE) + align_shift; + assert(!alignment || (uintptr_t) new % alignment == 0); + + if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) { + MPL_error_printf("TRhead corrupted - likely memory overwrite.\n"); + free(head->real_head); + new = NULL; + goto fn_exit; + } + if (TRhead[1]) { + MPL_VG_MAKE_MEM_DEFINED(&TRhead[1]->prev, sizeof(TRhead[1]->prev)); + TRhead[1]->prev = head; + MPL_VG_MAKE_MEM_NOACCESS(&TRhead[1]->prev, sizeof(TRhead[1]->prev)); + } + head->next = TRhead[1]; + TRhead[1] = head; + head->type = TR_MALLOC_TYPE; + head->class = class; + head->prev = 0; + head->size = nsize; + head->id = TRid; + head->lineno = lineno; + if ((l = (int) strlen(fname)) > TR_FNAME_LEN - 1) + fname += (l - (TR_FNAME_LEN - 1)); + MPL_strncpy(head->fname, fname, TR_FNAME_LEN); + head->fname[TR_FNAME_LEN - 1] = 0; + head->cookie = COOKIE_VALUE; + /* Cast to (void*) to avoid false warning about alignment */ + nend = (unsigned long *) (void *) (new + nsize); + nend[0] = COOKIE_VALUE; + + if (!classes_initialized) + init_classes(); + + /* Add to the hash counters */ + allocation_classes[class].curr_allocated_mem += nsize; + allocation_classes[class].total_allocated_mem += nsize; + allocation_classes[class].num_allocations++; + if (allocation_classes[class].curr_allocated_mem > allocation_classes[class].max_allocated_mem) + allocation_classes[class].max_allocated_mem = allocation_classes[class].curr_allocated_mem; + + allocated += nsize; + if (allocated > TRMaxMem) { + TRMaxMem = allocated; + TRMaxMemId = TRid; + } + frags++; + + if (TRlevel & TR_MALLOC) { + /* Note that %08p (what we'd like to use) isn't accepted by + * all compilers */ + MPL_error_printf("[%d] Allocating %ld(%ld) bytes at %8p in %s[%d]\n", + world_rank, (long) a, (long) nsize, new, fname, lineno); + } + + /* Warn the user about tracing overhead if the total memory overhead for + * tracing is larger than the threshold, TRMaxOverhead. */ + TRCurOverhead += sizeof(TrSPACE) + align_shift; + if ((TRCurOverhead > TRMaxOverhead) && TRMaxOverhead) { + MPL_error_printf("[%d] %.1lf MB was used for memory usage tracing!\n", + world_rank, (double) TRCurOverhead / 1024 / 1024); + TRMaxOverhead = TRMaxOverhead * 2; + } + + /* Without these macros valgrind actually catches far fewer errors when + * using --enable-g=mem. Note that it would be nice to use + * MPL_VG_MALLOCLIKE_BLOCK and friends, but they don't work when the + * underlying source of the memory is malloc/free. */ + MPL_VG_MAKE_MEM_UNDEFINED(new, nsize); + MPL_VG_MAKE_MEM_NOACCESS(head->real_head, sizeof(TrSPACE) + align_shift); + MPL_VG_MAKE_MEM_NOACCESS(nend, sizeof(unsigned long)); + fn_exit: + return (void *) new; +} + +void *MPL_trmalloc(size_t a, MPL_memory_class class, int lineno, const char fname[]) +{ + void *retval; + + TR_THREAD_CS_ENTER; + retval = trmalloc(0, a, class, lineno, fname); + TR_THREAD_CS_EXIT; + + return retval; +} + +#ifdef MPL_DEFINE_ALIGNED_ALLOC +void *MPL_traligned_alloc(size_t alignment, size_t size, MPL_memory_class class, int lineno, + const char fname[]) +{ + void *memptr; + + TR_THREAD_CS_ENTER; + memptr = trmalloc(alignment, size, class, lineno, fname); + TR_THREAD_CS_EXIT; + + return memptr; +} +#endif /* #ifdef MPL_DEFINE_ALIGNED_ALLOC */ + +/*+C + MPL_trfree - Free with tracing + +Input Parameters: ++ a - pointer to a block allocated with trmalloc +. line - line in file where called +- file - Name of file where called + +*/ +static void trfree(void *a_ptr, int line, const char file[]) +{ + TRSPACE *head; + unsigned long *nend; + size_t nset; + int l; + +/* Don't try to handle empty blocks */ + if (!a_ptr) + return; + + if (TRdebugLevel > 0) { + if (MPL_trvalid2("Invalid MALLOC arena detected by FREE at line %d in %s\n", line, file)) + return; + } + + /* Alignment guaranteed by the way a_ptr was allocated. Use + * (void *) cast to suppress false warning about alignment issues */ + head = (TRSPACE *) (void *) (((char *) a_ptr) - sizeof(TrSPACE)); + + /* We need to mark the memory as defined before performing our own error + * checks or valgrind will flag the trfree function as erroneous. The real + * free() at the end of this function will mark the whole block as NOACCESS + * again. See the corresponding block in the trmalloc function for more + * info. */ + MPL_VG_MAKE_MEM_DEFINED(head, sizeof(TrSPACE)); + + if (head->cookie != COOKIE_VALUE) { + /* Damaged header */ + MPL_error_printf("[%d] Block at address %p is corrupted; cannot free;\n" + "may be block not allocated with MPL_trmalloc or MALLOC\n" + "called in %s at line %d\n", world_rank, a_ptr, file, line); + return; + } + /* Cast to (void*) to avoid false warning about alignment */ + nend = (unsigned long *) (void *) ((char *) a_ptr + head->size); +/* Check that nend is properly aligned */ + if ((sizeof(long) == 4 && ((long) nend & 0x3) != 0) || + (sizeof(long) == 8 && ((long) nend & 0x7) != 0)) { + MPL_error_printf + ("[%d] Block at address %p is corrupted (invalid address or header)\n" + "called in %p at line %d\n", world_rank, a_ptr, file, line); + return; + } + + MPL_VG_MAKE_MEM_DEFINED(nend, sizeof(*nend)); + if (*nend != COOKIE_VALUE) { + if (*nend == ALREADY_FREED) { + if (TRidSet) { + MPL_error_printf + ("[%d] Block [id=%d(%lu)] at address %p was already freed\n", world_rank, + head->id, (unsigned long) head->size, a_ptr); + } else { + MPL_error_printf("[%d] Block at address %p was already freed\n", world_rank, a_ptr); + } + head->fname[TR_FNAME_LEN - 1] = 0; /* Just in case */ + head->freed_fname[TR_FNAME_LEN - 1] = 0; /* Just in case */ + MPL_error_printf("[%d] Block freed in %s[%d]\n", + world_rank, head->freed_fname, head->freed_lineno); + MPL_error_printf("[%d] Block allocated at %s[%d]\n", + world_rank, head->fname, head->lineno); + return; + } else { + /* Damaged tail */ + if (TRidSet) { + MPL_error_printf + ("[%d] Block [id=%d(%lu)] at address %p is corrupted (probably write past end)\n", + world_rank, head->id, (unsigned long) head->size, a_ptr); + } else { + MPL_error_printf + ("[%d] Block at address %p is corrupted (probably write past end)\n", + world_rank, a_ptr); + } + head->fname[TR_FNAME_LEN - 1] = 0; /* Just in case */ + MPL_error_printf("[%d] Block being freed allocated in %s[%d]\n", + world_rank, head->fname, head->lineno); + MPL_error_printf("[%d] Block cookie should be %lx but was %lx\n", + world_rank, (long) COOKIE_VALUE, *nend); + } + } +/* Mark the location freed */ + *nend = ALREADY_FREED; + head->freed_lineno = line; + if ((l = (int) strlen(file)) > TR_FNAME_LEN - 1) + file += (l - (TR_FNAME_LEN - 1)); + MPL_strncpy(head->freed_fname, file, TR_FNAME_LEN); + + allocation_classes[head->class].curr_allocated_mem -= head->size; + + allocated -= head->size; + frags--; + if (head->prev) { + MPL_VG_MAKE_MEM_DEFINED(&head->prev->next, sizeof(head->prev->next)); + head->prev->next = head->next; + MPL_VG_MAKE_MEM_NOACCESS(&head->prev->next, sizeof(head->prev->next)); + } else { + TRhead[1] = head->next; + } + + if (head->next) { + MPL_VG_MAKE_MEM_DEFINED(&head->next->prev, sizeof(head->next->prev)); + head->next->prev = head->prev; + MPL_VG_MAKE_MEM_NOACCESS(&head->next->prev, sizeof(head->next->prev)); + } + + if (TRlevel & TR_FREE) { + MPL_error_printf("[%d] Freeing %lu bytes at %p in %s[%d]\n", + world_rank, (unsigned long) head->size, a_ptr, file, line); + } + + TRCurOverhead -= (uintptr_t) a_ptr - (uintptr_t) head->real_head; + + /* + * Now, scrub the data (except possibly the first few ints) to + * help catch access to already freed data + */ + /* FIXME why do we skip the first few ints? [goodell@] */ + /* Answer lost in time. Probably because in some case, the + * first few bytes provided useful information in tracking down + * a problem. */ + if (head->size > 2 * sizeof(int)) { + /* Now that nset is size_t, it might be defined as unsigned, + * so we can't compare nset - 2*sizeof(int) against zero */ + nset = head->size - 2 * sizeof(int); + /* If an upper layer (like the handle allocation code) ever used the + * MPL_VG_MAKE_MEM_NOACCESS macro on part/all of the data we gave + * them then our memset will elicit "invalid write" errors from + * valgrind. Mark it as accessible but undefined here to prevent this. */ + MPL_VG_MAKE_MEM_UNDEFINED((char *) a_ptr + 2 * sizeof(int), nset); + if (TRSetBytes) + memset((char *) a_ptr + 2 * sizeof(int), TRFreedByte, nset); + } + free(head->real_head); +} + +void MPL_trfree(void *a_ptr, int line, const char fname[]) +{ + TR_THREAD_CS_ENTER; + trfree(a_ptr, line, fname); + TR_THREAD_CS_EXIT; +} + +/*+C + MPL_trvalid - test the allocated blocks for validity. This can be used to + check for memory overwrites. + +Input Parameters: +. str - string to write out only if an error is detected. + + Return value: + The number of errors detected. + + Output Effect: + Error messages are written to stdout. These have the form of either + +$ Block [id=%d(%d)] at address %lx is corrupted (probably write past end) +$ Block allocated in <filename>[<linenumber>] + + if the sentinal at the end of the block has been corrupted, and + +$ Block at address %lx is corrupted + + if the sentinal at the begining of the block has been corrupted. + + The address is the actual address of the block. The id is the + value of TRID. + + No output is generated if there are no problems detected. ++*/ +static int trvalid(const char str[]) +{ + return MPL_trvalid2(str, -1, (const char *) 0); +} + +int MPL_trvalid2(const char str[], int line, const char file[]) +{ + TRSPACE *head; + TRSPACE *next; + char *a; + unsigned long *nend; + int errs = 0; + + if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) { + MPL_error_printf("TRhead corrupted - likely memory overwrite.\n"); + errs++; + goto fn_exit; + } + head = TRhead[1]; + while (head) { + /* mark defined before accessing head contents */ + MPL_VG_MAKE_MEM_DEFINED(head, sizeof(*head)); + if (head->cookie != COOKIE_VALUE) { + if (!errs) { + if (line > 0) + MPL_error_printf(str, line, file); + else + MPL_error_printf("%s\n", str); + } + errs++; + MPL_error_printf + ("[%d] Block at address %p is corrupted (invalid cookie in head)\n", + world_rank, head + 1); + MPL_VG_MAKE_MEM_NOACCESS(head, sizeof(*head)); + /* Must stop because if head is invalid, then the data in the + * head is probably also invalid, and using could lead to + * SEGV or BUS */ + goto fn_exit; + } + /* Get the address of the first byte of the memory, which begins + * just after the end of the header. We must use the full header + * (TrSPACE) rather than the struct with the data (TRSPACE) because + * the full header is padded to ensure correct byte alignment with + * the data */ + a = (char *) ((TrSPACE *) head + 1); + /* Cast to (void*) to avoid false warning about alignment */ + nend = (unsigned long *) (void *) (a + head->size); + + /* mark defined before accessing nend contents */ + MPL_VG_MAKE_MEM_DEFINED(nend, sizeof(*nend)); + + if (nend[0] != COOKIE_VALUE) { + if (!errs) { + if (line > 0) + MPL_error_printf(str, line, file); + else + MPL_error_printf("%s\n", str); + } + errs++; + head->fname[TR_FNAME_LEN - 1] = 0; /* Just in case */ + if (TRidSet) { + MPL_error_printf + ("[%d] Block [id=%d(%lu)] at address %p is corrupted (probably write past end)\n", + world_rank, head->id, (unsigned long) head->size, a); + } else { + MPL_error_printf + ("[%d] Block at address %p is corrupted (probably write past end)\n", + world_rank, a); + } + MPL_error_printf("[%d] Block allocated in %s[%d]\n", + world_rank, head->fname, head->lineno); + MPL_error_printf("[%d] Block cookie should be %lx but was %lx\n", + world_rank, (long) COOKIE_VALUE, *nend); + } + + /* set both regions back to NOACCESS */ + next = head->next; + MPL_VG_MAKE_MEM_NOACCESS(head, sizeof(*head)); + MPL_VG_MAKE_MEM_NOACCESS(nend, sizeof(*nend)); + head = next; + } + fn_exit: + return errs; +} + +int MPL_trvalid(const char str[]) +{ + int retval; + TR_THREAD_CS_ENTER; + retval = trvalid(str); + TR_THREAD_CS_EXIT; + return retval; +} + +/*+C + MPL_trdump - Dump the allocated memory blocks to a file + +Input Parameters: ++ fp - file pointer. If fp is NULL, stderr is assumed. +- minid - Only print allocated memory blocks whose id is at least 'minid' + + +*/ +static void trdump(FILE * fp, int minid) +{ + TRSPACE *head; +#ifdef VALGRIND_MAKE_MEM_NOACCESS + TRSPACE *old_head; +#endif + + if (fp == 0) + fp = stderr; + if (TRhead[0] != TRHEAD_PRESENTINAL || TRhead[2] != TRHEAD_POSTSENTINAL) { + MPL_error_printf("TRhead corrupted - likely memory overwrite.\n"); + return; + } + head = TRhead[1]; + while (head) { + /* these "rank and size" strings are supposed to be small: enough to + * hold an mpi rank, a size, and a hexadecimal address. */ +#define ADDRESS_STR_BUFLEN 256 + + char address_str[ADDRESS_STR_BUFLEN]; + MPL_VG_MAKE_MEM_DEFINED(head, sizeof(*head)); + if (head->id >= minid) { + address_str[ADDRESS_STR_BUFLEN - 1] = 0; + snprintf(address_str, ADDRESS_STR_BUFLEN - 1, "[%d] %lu at [%p],", world_rank, + (unsigned long) head->size, (char *) head + sizeof(TrSPACE)); + head->fname[TR_FNAME_LEN - 1] = 0; /* Be extra careful */ + if (TRidSet) { + /* For head->id >= 0, we can add code to map the id to + * the name of a package, rather than using a raw number */ + fprintf(fp, "%s id = %d %s[%d]\n", address_str, head->id, head->fname, + head->lineno); + } else { + fprintf(fp, "%s %s[%d]\n", address_str, head->fname, head->lineno); + } + } +#ifdef VALGRIND_MAKE_MEM_NOACCESS + old_head = head; +#endif + head = head->next; + MPL_VG_MAKE_MEM_NOACCESS(old_head, sizeof(*old_head)); + } +/* + msg_fprintf(fp, "# [%d] The maximum space allocated was %ld bytes [%ld]\n", + world_rank, TRMaxMem, TRMaxMemId); + */ +} + +void MPL_trdump(FILE * fp, int minid) +{ + TR_THREAD_CS_ENTER; + trdump(fp, minid); + TR_THREAD_CS_EXIT; +} + +/*+C + MPL_trcalloc - Calloc with tracing + +Input Parameters: +. nelem - number of elements to allocate +. elsize - size of each element +. lineno - line number where used. Use __LINE__ for this +. fname - file name where used. Use __FILE__ for this + + Returns: + Double aligned pointer to requested storage, or null if not + available. + +*/ +static void *trcalloc(size_t nelem, size_t elsize, MPL_memory_class class, int lineno, + const char fname[]) +{ + void *p; + + p = trmalloc(0, nelem * elsize, class, lineno, fname); + if (p) { + memset(p, 0, nelem * elsize); + } + return p; +} + +void *MPL_trcalloc(size_t nelem, size_t elsize, MPL_memory_class class, int lineno, + const char fname[]) +{ + void *retval; + TR_THREAD_CS_ENTER; + retval = trcalloc(nelem, elsize, class, lineno, fname); + TR_THREAD_CS_EXIT; + return retval; +} + +/*+C + MPL_trrealloc - Realloc with tracing + +Input Parameters: +. p - pointer to old storage +. size - number of bytes to allocate +. lineno - line number where used. Use __LINE__ for this +. fname - file name where used. Use __FILE__ for this + + Returns: + Double aligned pointer to requested storage, or null if not + available. This implementation ALWAYS allocates new space and copies + the contents into the new space. + +*/ +static void *trrealloc(void *p, size_t size, MPL_memory_class class, int lineno, const char fname[]) +{ + void *pnew; + size_t nsize; + TRSPACE *head = 0; + + /* We should really use the size of the old block... */ + if (p) { + head = (TRSPACE *) (void *) ((char *) p - sizeof(TrSPACE)); + MPL_VG_MAKE_MEM_DEFINED(head, sizeof(*head)); /* mark defined before accessing contents */ + if (head->cookie != COOKIE_VALUE) { + /* Damaged header */ + MPL_error_printf("[%d] Block at address %p is corrupted; cannot realloc;\n" + "may be block not allocated with MPL_trmalloc or MALLOC\n", + world_rank, p); + return 0; + } + } + + /* Per the POSIX Standard, realloc() with zero size has two possible + * results. In both cases the given pointer (p) is freed, and the function + * will either return NULL or a unique value that can safely be passed to + * free(). We return NULL here because that is more likely to catch + * programming errors at higher levels. */ + if (!size) { + trfree(p, lineno, fname); + return NULL; + } + + pnew = trmalloc(0, size, class, lineno, fname); + + if (p && pnew) { + nsize = size; + if (head->size < nsize) + nsize = head->size; + memcpy(pnew, p, nsize); + trfree(p, lineno, fname); + } + + /* Re-mark the head as NOACCESS before returning. */ + /* FIXME: Note head is no longer valid after MPL_trfree above */ + if (head) { + MPL_VG_MAKE_MEM_NOACCESS(head, sizeof(*head)); + } + + /* If the MPL_trmalloc failed above pnew will be NULL, just like a + * regular realloc failure. */ + return pnew; +} + +void *MPL_trrealloc(void *p, size_t size, MPL_memory_class class, int lineno, const char fname[]) +{ + void *retval; + TR_THREAD_CS_ENTER; + retval = trrealloc(p, size, class, lineno, fname); + TR_THREAD_CS_EXIT; + return retval; +} + +static void *trmmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset, + MPL_memory_class class, int lineno, const char fname[]) +{ + char *new = NULL; + + new = (char *) mmap(addr, length, prot, flags, fd, offset); + if (new == MAP_FAILED) + goto fn_exit; + + if (TRlevel & TR_MMAP) { + MPL_error_printf("[%d] Mmapping %ld(%ld) bytes at %p in %s[%d]\n", + world_rank, (long) length, (long) length, new, fname, lineno); + } + + if (!classes_initialized) + init_classes(); + + allocation_classes[class].curr_allocated_mem += length; + allocation_classes[class].total_allocated_mem += length; + allocation_classes[class].num_allocations++; + if (allocation_classes[class].max_allocated_mem < allocation_classes[class].curr_allocated_mem) + allocation_classes[class].max_allocated_mem = allocation_classes[class].curr_allocated_mem; + + fn_exit: + return (void *) new; +} + +void *MPL_trmmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset, + MPL_memory_class class, int lineno, const char fname[]) +{ + void *retval; + TR_THREAD_CS_ENTER; + retval = trmmap(addr, length, prot, flags, fd, offset, class, lineno, fname); + TR_THREAD_CS_EXIT; + return retval; +} + +static void trmunmap(void *addr, size_t length, MPL_memory_class class, int lineno, + const char fname[]) +{ + allocation_classes[class].curr_allocated_mem -= length; + + munmap(addr, length); +} + +void MPL_trmunmap(void *addr, size_t length, MPL_memory_class class, int lineno, const char fname[]) +{ + TR_THREAD_CS_ENTER; + trmunmap(addr, length, class, lineno, fname); + TR_THREAD_CS_EXIT; +} + +/*+C + MPL_trstrdup - Strdup with tracing + +Input Parameters: +. str - string to duplicate +. lineno - line number where used. Use __LINE__ for this +. fname - file name where used. Use __FILE__ for this + + Returns: + Pointer to copy of the input string. + +*/ +static void *trstrdup(const char *str, int lineno, const char fname[]) +{ + void *p; + size_t len = strlen(str) + 1; + + p = trmalloc(0, len, MPL_MEM_STRINGS, lineno, fname); + if (p) { + memcpy(p, str, len); + } + return p; +} + +void *MPL_trstrdup(const char *str, int lineno, const char fname[]) +{ + void *retval; + TR_THREAD_CS_ENTER; + retval = trstrdup(str, lineno, fname); + TR_THREAD_CS_EXIT; + return retval; +} + +void MPL_trcategorydump(FILE * fp) +{ + int i; + + fprintf(fp, "%16s\t%16s\t%16s\t%16s\t%16s\n", + "CLASS", "MAX ALLOCATED", "CURR ALLOCATED", "TOT ALLOCATIED", "NUM ALLOCATIONS"); + for (i = 0; i < MPL_MAX_MEMORY_CLASS; i++) { + fprintf(fp, "%16s\t%16ld\t%16ld\t%16ld\t%16ld\n", + allocation_class_strings[i], + allocation_classes[i].max_allocated_mem, + allocation_classes[i].curr_allocated_mem, + allocation_classes[i].total_allocated_mem, allocation_classes[i].num_allocations); + } +} + + +char *MPL_strdup_no_spaces(const char *str) +{ + char *newstr = MPL_malloc(strlen(str) + 1, MPL_MEM_COLL); + + int j = 0; + for (int i = 0; i < strlen(str); i++) { + if (str[i] != ' ') + newstr[j++] = str[i]; + } + newstr[j] = 0; + + return newstr; +} diff --git a/3rd-party/romio341/mpl/src/msg/Makefile.mk b/3rd-party/romio341/mpl/src/msg/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..192fd5c8c25d9eaae2377f8efcc5ba22ab540fc5 --- /dev/null +++ b/3rd-party/romio341/mpl/src/msg/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/msg/mpl_msg.c diff --git a/3rd-party/romio341/mpl/src/msg/mpl_msg.c b/3rd-party/romio341/mpl/src/msg/mpl_msg.c new file mode 100644 index 0000000000000000000000000000000000000000..f5c61ea56aa273fba02528a6bd5ef037a9f6627c --- /dev/null +++ b/3rd-party/romio341/mpl/src/msg/mpl_msg.c @@ -0,0 +1,90 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +/* style: allow:vprintf:1 sig:0 */ +/* style: allow:vfprintf:4 sig:0 */ +/* style: allow:fprintf:2 sig:0 */ + +int MPL_usage_printf(const char *str, ...) +{ + int n; + va_list list; + const char *format_str; + + va_start(list, str); + format_str = str; + n = vprintf(format_str, list); + va_end(list); + + fflush(stdout); + + return n; +} + +int MPL_internal_error_printf(const char *str, ...) +{ + int n; + va_list list; + const char *format_str; + + va_start(list, str); + format_str = str; + n = vfprintf(stderr, format_str, list); + va_end(list); + + fflush(stderr); + + return n; +} + +/* Like internal_error_printf, but for the system routine name with + errno errnum. Str may be null */ +int MPL_internal_sys_error_printf(const char *name, int errnum, const char *str, ...) +{ + int n = 0; + va_list list; + const char *format_str = 0; + + /* Prepend information on the system error */ + if (!format_str) + format_str = "Error in system call %s: %s\n"; + + fprintf(stderr, format_str, name, MPL_strerror(errnum)); + + /* Now add the message that is specific to this use, if any */ + if (str) { + va_start(list, str); + format_str = str; + n = vfprintf(stderr, format_str, list); + va_end(list); + } + + fflush(stderr); + + return n; +} + +int MPL_msg_printf(const char *str, ...) +{ + int n; + va_list list; + const char *format_str; + + va_start(list, str); + format_str = str; + n = vfprintf(stdout, format_str, list); + va_end(list); + + fflush(stdout); + + return n; +} + +void MPL_exit(int exit_code) +{ + exit(exit_code); +} diff --git a/3rd-party/romio341/mpl/src/shm/Makefile.mk b/3rd-party/romio341/mpl/src/shm/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..e43c13f411b7a9563b0dc34a6219afda94f67a09 --- /dev/null +++ b/3rd-party/romio341/mpl/src/shm/Makefile.mk @@ -0,0 +1,10 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += \ + src/shm/mpl_shm.c \ + src/shm/mpl_shm_sysv.c \ + src/shm/mpl_shm_mmap.c \ + src/shm/mpl_shm_win.c diff --git a/3rd-party/romio341/mpl/src/shm/mpl_shm.c b/3rd-party/romio341/mpl/src/shm/mpl_shm.c new file mode 100644 index 0000000000000000000000000000000000000000..3874795739f82719143330281d619c23d279ad1d --- /dev/null +++ b/3rd-party/romio341/mpl/src/shm/mpl_shm.c @@ -0,0 +1,110 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +/* Serialize a handle. A serialized handle is a string of + * characters that can be persisted by the caller. The serialized + * handle can be used to create another ref to the shared mem seg + * by deserializing it. + * str : A string of chars of len, str_len. + * If the function succeeds the serialized handle is copied + * into this user buffer + * hnd : Handle to shared memory + */ +int MPL_shm_hnd_serialize(char *str, MPL_shm_hnd_t hnd, int str_len) +{ + return MPLI_shm_ghnd_get_by_val(hnd, str, str_len); +} + +/* Deserialize a handle. + * str_hnd : A null-terminated string of len str_hnd_len that + * contains the serialized handle. + * hnd : If the call succeeds the user gets back a handle,hnd, to + * shared mem - deserialized from strhnd. This handle + * will refer to the shm seg referred by the serialized + * handle. + */ +int MPL_shm_hnd_deserialize(MPL_shm_hnd_t hnd, const char *str_hnd, size_t str_hnd_len) +{ + int rc = MPL_SUCCESS; + MPLI_shm_hnd_reset_val(hnd); + rc = MPLI_shm_ghnd_alloc(hnd, MPL_MEM_SHM); + if (rc != MPL_SUCCESS) + return rc; + rc = MPLI_shm_ghnd_set_by_val(hnd, "%s", str_hnd); + if (rc != MPL_SUCCESS) + return rc; + rc = MPL_shm_seg_open(hnd, 0); + return rc; +} + +/* Get a serialized handle by reference. + * Rationale: The user might only want to read the serialized view + * of the handle & hence not want to allocate a buffer for the ser view + * of the handle. + * str_ptr : Pointer to a string of chars to hold the serialized handle + * If the function succeeds, the pointer points to a + * serialized view of the handle. + * hnd : Handle to shm seg which has to be serialized + */ + +int MPL_shm_hnd_get_serialized_by_ref(MPL_shm_hnd_t hnd, char **str_ptr) +{ + *str_ptr = (char *) MPLI_shm_ghnd_get_by_ref(hnd); + return MPL_SUCCESS; +} + +/* Deserialize a handle by reference. + * Rationale : The user already has a serialized view of the handle. + * The user does not want to manage the view buffer any more + * & also needs to deserialize from the buffer. + * ser_hnd_ptr : Pointer to a serialized view of the handle. The user + * no longer needs to take care of this buffer. + * hnd : If the function succeeds this points to the deserialized + * handle. + */ +int MPL_shm_hnd_deserialize_by_ref(MPL_shm_hnd_t hnd, char **ser_hnd_ptr) +{ + MPLI_shm_hnd_reset_val(hnd); + MPLI_shm_ghnd_set_by_ref(hnd, *ser_hnd_ptr); + + return MPL_shm_seg_open(hnd, 0); +} + +/* Initialize a shared memory handle + * hnd_ptr : A pointer to the shared memory handle + */ + +int MPL_shm_hnd_init(MPL_shm_hnd_t * hnd_ptr) +{ + int rc = -1; + + rc = MPLI_shm_hnd_alloc(hnd_ptr, MPL_MEM_SHM); + + if (MPL_SUCCESS != rc) + return rc; + + MPLI_shm_hnd_reset_val(*hnd_ptr); + + return rc; +} + +/* Finalize a shared memory handle. + * hnd_ptr : A pointer to the shm handle to be finalized. + * Any handle that is init has to be finalized. + */ +int MPL_shm_hnd_finalize(MPL_shm_hnd_t * hnd_ptr) +{ + /* A finalize can/should be called on an invalid handle + * Don't assert if we fail here ... + */ + MPLI_shm_hnd_close(*hnd_ptr); + MPLI_shm_hnd_free(*hnd_ptr); + + *hnd_ptr = MPL_SHM_HND_INVALID; + + return 0; +} diff --git a/3rd-party/romio341/mpl/src/shm/mpl_shm_mmap.c b/3rd-party/romio341/mpl/src/shm/mpl_shm_mmap.c new file mode 100644 index 0000000000000000000000000000000000000000..bbc89191951b3cafc32661aaffd6a02c18a04e9f --- /dev/null +++ b/3rd-party/romio341/mpl/src/shm/mpl_shm_mmap.c @@ -0,0 +1,244 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#ifdef MPL_USE_MMAP_SHM + +#include <fcntl.h> + +#ifdef MPL_HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#if defined (MPL_HAVE_MKSTEMP) && defined (MPL_NEEDS_MKSTEMP_DECL) +extern int mkstemp(char *template); +#endif + +inline int MPLI_shm_lhnd_close(MPL_shm_hnd_t hnd) +{ + MPLI_shm_lhnd_t lhnd = MPLI_SHM_LHND_INVALID; + lhnd = MPLI_shm_lhnd_get(hnd); + if (lhnd != MPLI_SHM_LHND_INVALID) { + if (close(lhnd) == 0) { + MPLI_shm_lhnd_set(hnd, MPLI_SHM_LHND_INIT_VAL); + } else { + /* close() failed */ + return MPL_ERR_SHM_INTERN; + } + } + return MPL_SUCCESS; +} + +static inline int check_valid_fixed_mmap_range(void *shm_addr, intptr_t seg_sz) +{ + int rc = 0, is_valid = 1; + size_t page_sz = 0, mapsize = 0, num_pages = 0, i; + + if (shm_addr == NULL) + return 0; /* NULL is not a valid maprage */ + + page_sz = sysconf(_SC_PAGESIZE); + mapsize = (seg_sz + (page_sz - 1)) & (~(page_sz - 1)); + num_pages = mapsize / page_sz; + + char *ptr = (char *) shm_addr; + for (i = 0; i < num_pages; i++) { + /* return ENOMEM if the page is not mapped */ + rc = msync(ptr, page_sz, 0); + if (rc != -1 || errno != ENOMEM) { + is_valid = 0; + break; + } + ptr += page_sz; + } + return is_valid; +} + +/* A template function which creates/attaches shm seg handle + * to the shared memory. Used by user-exposed functions below + */ +static inline int MPL_shm_seg_create_attach_templ(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset, int flag) +{ + MPLI_shm_lhnd_t lhnd = -1; + int rc = MPL_SUCCESS, rc_close = MPL_SUCCESS; + + if (flag & MPLI_SHM_FLAG_SHM_CREATE) { + char dev_shm_fname[] = "/dev/shm/mpich_shar_tmpXXXXXX"; + char tmp_fname[] = "/tmp/mpich_shar_tmpXXXXXX"; + char *chosen_fname = NULL; + + chosen_fname = dev_shm_fname; + lhnd = mkstemp(chosen_fname); + if (lhnd == -1) { + chosen_fname = tmp_fname; + lhnd = mkstemp(chosen_fname); + if (lhnd == -1) { + rc = MPL_ERR_SHM_INTERN; + goto fn_fail; + } + } + + MPLI_shm_lhnd_set(hnd, lhnd); + rc = (MPLI_shm_lhnd_t) lseek(lhnd, seg_sz - 1, SEEK_SET); + do { + rc = (int) write(lhnd, "", 1); + } while ((rc == -1) && (errno == EINTR)); + + rc = MPLI_shm_ghnd_alloc(hnd, MPL_MEM_SHM); + if (rc != MPL_SUCCESS) { + goto fn_fail; + } + rc = MPLI_shm_ghnd_set_by_val(hnd, "%s", chosen_fname); + if (rc != MPL_SUCCESS) { + goto fn_fail; + } + } else { + /* Open an existing shared memory seg */ + if (!MPLI_shm_lhnd_is_valid(hnd)) { + lhnd = open(MPLI_shm_ghnd_get_by_ref(hnd), O_RDWR); + if (lhnd == -1) { + rc = MPL_ERR_SHM_INTERN; + goto fn_fail; + } + MPLI_shm_lhnd_set(hnd, lhnd); + } + } + + if (flag & MPLI_SHM_FLAG_SHM_ATTACH) { + if (flag & MPLI_SHM_FLAG_FIXED_ADDR) { + void *start_addr = *shm_addr_ptr; + /* mmap with MAP_FIXED discards any overlapped part of the existing mapping. + * Thus, we need manually check if the entire range is valid. */ + if (check_valid_fixed_mmap_range(start_addr, seg_sz)) { + *shm_addr_ptr = MPL_mmap(start_addr, seg_sz, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FIXED, MPLI_shm_lhnd_get(hnd), 0, + MPL_MEM_SHM); + } else + rc = MPL_ERR_SHM_INVAL; + } else { + *shm_addr_ptr = MPL_mmap(NULL, seg_sz, PROT_READ | PROT_WRITE, + MAP_SHARED, MPLI_shm_lhnd_get(hnd), 0, MPL_MEM_SHM); + } + + if (*shm_addr_ptr == MAP_FAILED || *shm_addr_ptr == NULL) { + rc = MPL_ERR_SHM_INVAL; + goto fn_fail; + } + } + + fn_exit: + /* FIXME: Close local handle only when closing the shm handle */ + if (MPLI_shm_lhnd_is_valid(hnd)) { + rc_close = MPLI_shm_lhnd_close(hnd); + } + return (rc != MPL_SUCCESS) ? rc : rc_close; + fn_fail: + goto fn_exit; +} + +/* Create new SHM segment + * hnd : A "init"ed shared memory handle + * seg_sz : Size of shared memory segment to be created + */ +int MPL_shm_seg_create(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + int rc = MPL_SUCCESS; + rc = MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_SHM_CREATE); + return rc; +} + +/* Open an existing SHM segment + * hnd : A shm handle with a valid global handle + * seg_sz : Size of shared memory segment to open + * Currently only using internally within wrapper funcs + */ +int MPL_shm_seg_open(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + int rc = MPL_SUCCESS; + rc = MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_CLR); + return rc; +} + +/* Create new SHM segment and attach to it + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Attach to an existing SHM segment + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Create new SHM segment and attach to it with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH | + MPLI_SHM_FLAG_FIXED_ADDR); +} + +/* Attach to an existing SHM segment with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH | MPLI_SHM_FLAG_FIXED_ADDR); +} + +/* Detach from an attached SHM segment */ +int MPL_shm_seg_detach(MPL_shm_hnd_t hnd, void **shm_addr_ptr, intptr_t seg_sz) +{ + int rc = -1; + + rc = munmap(*shm_addr_ptr, seg_sz); + *shm_addr_ptr = NULL; + + return (rc == 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN; +} + +/* Remove an existing SHM segment */ +int MPL_shm_seg_remove(MPL_shm_hnd_t hnd) +{ + int rc = -1; + + rc = unlink(MPLI_shm_ghnd_get_by_ref(hnd)); + + return (rc == 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN; +} + +#endif /* MPL_USE_MMAP_SHM */ diff --git a/3rd-party/romio341/mpl/src/shm/mpl_shm_sysv.c b/3rd-party/romio341/mpl/src/shm/mpl_shm_sysv.c new file mode 100644 index 0000000000000000000000000000000000000000..e23c8c828f6565f3f8c4cd30e109c18aa6d5490a --- /dev/null +++ b/3rd-party/romio341/mpl/src/shm/mpl_shm_sysv.c @@ -0,0 +1,167 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#ifdef MPL_USE_SYSV_SHM + +#include <sys/stat.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +/* A template function which creates/attaches shm seg handle + * to the shared memory. Used by user-exposed functions below + */ +static inline int MPL_shm_seg_create_attach_templ(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset, int flag) +{ + int rc = MPL_SUCCESS; + int lhnd = -1; + + if (flag & MPLI_SHM_FLAG_SHM_CREATE) { + lhnd = shmget(IPC_PRIVATE, seg_sz, IPC_CREAT | S_IRWXU); + MPLI_shm_lhnd_set(hnd, lhnd); + rc = MPLI_shm_ghnd_alloc(hnd, MPL_MEM_SHM); + if (rc) { + goto fn_exit; + } + rc = MPLI_shm_ghnd_set_by_val(hnd, "%d", lhnd); + if (rc != MPL_SUCCESS) { + goto fn_exit; + } + } else { + /* Open an existing shared memory seg */ + if (!MPLI_shm_lhnd_is_valid(hnd)) { + lhnd = atoi(MPLI_shm_ghnd_get_by_ref(hnd)); + MPLI_shm_lhnd_set(hnd, lhnd); + } + } + + if (flag & MPLI_SHM_FLAG_SHM_ATTACH) { + const void *start_addr = NULL; + + /* Caller ensures that shmaddr must be a page-aligned address + * at which the attach occurs. EINVAL error would result if a + * mapping already exists in this address range or the address + * is not page-aligned. */ + if (flag & MPLI_SHM_FLAG_FIXED_ADDR) + start_addr = (const void *) *shm_addr_ptr; + + /* Attach to shared mem seg */ + *shm_addr_ptr = shmat(MPLI_shm_lhnd_get(hnd), start_addr, 0x0); + if (*shm_addr_ptr == (void *) -1) { + rc = MPL_ERR_SHM_INVAL; + } + } + + fn_exit: + return rc; +} + +/* Create new SHM segment + * hnd : A "init"ed shared memory handle + * seg_sz : Size of shared memory segment to be created + */ +int MPL_shm_seg_create(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_SHM_CREATE); +} + +/* Open an existing SHM segment + * hnd : A shm handle with a valid global handle + * seg_sz : Size of shared memory segment to open + * Currently only using internally within wrapper funcs + */ +int MPL_shm_seg_open(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_CLR); +} + +/* Create new SHM segment and attach to it + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Attach to an existing SHM segment + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Create new SHM segment and attach to it with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The actual attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH | + MPLI_SHM_FLAG_FIXED_ADDR); +} + +/* Attach to an existing SHM segment with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The actual attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH | MPLI_SHM_FLAG_FIXED_ADDR); +} + +/* Detach from an attached SHM segment + * hnd : Handle to the shm segment + * shm_addr_ptr : Pointer to the shm address to detach + * seg_sz : Size of shm segment + */ +int MPL_shm_seg_detach(MPL_shm_hnd_t hnd, void **shm_addr_ptr, intptr_t seg_sz) +{ + int rc = -1; + + rc = shmdt(*shm_addr_ptr); + *shm_addr_ptr = NULL; + + return (rc == 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN; +} + +/* Remove a shared memory segment + * hnd : Handle to the shared memory segment to be removed + */ +int MPL_shm_seg_remove(MPL_shm_hnd_t hnd) +{ + struct shmid_ds ds; + int rc = -1; + + rc = shmctl(MPLI_shm_lhnd_get(hnd), IPC_RMID, &ds); + + return (rc == 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN; +} + +#endif /* MPL_USE_SYSV_SHM */ diff --git a/3rd-party/romio341/mpl/src/shm/mpl_shm_win.c b/3rd-party/romio341/mpl/src/shm/mpl_shm_win.c new file mode 100644 index 0000000000000000000000000000000000000000..e0614768fb3f0c82b285aabfc4f32a015b82af8d --- /dev/null +++ b/3rd-party/romio341/mpl/src/shm/mpl_shm_win.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#ifdef MPL_USE_NT_SHM + +#include <winsock2.h> +#include <windows.h> + +/* A template function which creates/attaches shm seg handle + * to the shared memory. Used by user-exposed functions below + */ +static inline int MPL_shm_seg_create_attach_templ(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset, int flag) +{ + HANDLE lhnd = INVALID_HANDLE_VALUE; + int rc = MPL_SUCCESS; + ULARGE_INTEGER seg_sz_large; + seg_sz_large.QuadPart = seg_sz; + + if (!MPLI_shm_ghnd_is_valid(hnd)) { + rc = MPLI_shm_ghnd_set_uniq(hnd); + if (rc) { + goto fn_exit; + } + } + + if (flag & MPLI_SHM_FLAG_SHM_CREATE) { + lhnd = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, + PAGE_READWRITE, seg_sz_large.HighPart, seg_sz_large.LowPart, + MPLI_shm_ghnd_get_by_ref(hnd)); + if (lhnd == NULL) { + rc = MPL_ERR_SHM_INTERN; + goto fn_exit; + } + MPLI_shm_lhnd_set(hnd, lhnd); + } else { + if (!MPLI_shm_lhnd_is_valid(hnd)) { + /* Strangely OpenFileMapping() returns NULL on error! */ + lhnd = OpenFileMapping(FILE_MAP_WRITE, FALSE, MPLI_shm_ghnd_get_by_ref(hnd)); + if (lhnd == NULL) { + rc = MPL_ERR_SHM_INTERN; + goto fn_exit; + } + + MPLI_shm_lhnd_set(hnd, lhnd); + } + } + + if (flag & MPLI_SHM_FLAG_SHM_ATTACH) { + if (flag & MPLI_SHM_FLAG_FIXED_ADDR) { + void *start_addr = (void *) *shm_addr_ptr; + /* The start_addr must be a multiple of the system's memory allocation granularity, + * or the function fails. To determine the memory allocation granularity of the system, + * use the GetSystemInfo function. If there is not enough address space at the + * specified address, the function fails. + * If the function fails, the return value is NULL.*/ + *shm_addr_ptr = MapViewOfFileEx(MPLI_shm_lhnd_get(hnd), + FILE_MAP_WRITE, 0, offset, 0, start_addr); + } else { + *shm_addr_ptr = MapViewOfFile(MPLI_shm_lhnd_get(hnd), FILE_MAP_WRITE, 0, offset, 0); + } + if (*shm_addr_ptr == NULL) { + rc = MPL_ERR_SHM_INVAL; + } + } + + fn_exit: + return rc; +} + +/* Create new SHM segment + * hnd : A "init"ed shared memory handle + * seg_sz : Size of shared memory segment to be created + */ +int MPL_shm_seg_create(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_SHM_CREATE); +} + +/* Open an existing SHM segment + * hnd : A shm handle with a valid global handle + * seg_sz : Size of shared memory segment to open + * Currently only using internally within wrapper funcs + */ +int MPL_shm_seg_open(MPL_shm_hnd_t hnd, intptr_t seg_sz) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, NULL, 0, MPLI_SHM_FLAG_CLR); +} + +/* Create new SHM segment and attach to it + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Attach to an existing SHM segment + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr : Pointer to shared memory address to attach + * the shared mem segment + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH); +} + +/* Create new SHM segment and attach to it with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The actual attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_create_and_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, + void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_CREATE | MPLI_SHM_FLAG_SHM_ATTACH | + MPLI_SHM_FLAG_FIXED_ADDR, MPL_MEM_SHM); +} + +/* Attach to an existing SHM segment with specified starting address + * hnd : A "init"ed shared mem handle + * seg_sz: Size of shared mem segment + * shm_addr_ptr (inout): Pointer to specified starting address, the address cannot be NULL. + * The actual attached memory address is updated at return. + * offset : Offset to attach the shared memory address to + */ +int MPL_shm_fixed_seg_attach(MPL_shm_hnd_t hnd, intptr_t seg_sz, void **shm_addr_ptr, int offset) +{ + return MPL_shm_seg_create_attach_templ(hnd, seg_sz, shm_addr_ptr, offset, + MPLI_SHM_FLAG_SHM_ATTACH | MPLI_SHM_FLAG_FIXED_ADDR); +} + +/* Detach from an attached SHM segment */ +static inline int MPL_shm_seg_detach(MPL_shm_hnd_t hnd, void **shm_addr_ptr, intptr_t seg_sz) +{ + int rc = -1; + + rc = UnmapViewOfFile(*shm_addr_ptr); + *shm_addr_ptr = NULL; + + /* If the function succeeds, the return value is nonzero, + * otherwise the return value is zero. */ + return (rc != 0) ? MPL_SUCCESS : MPL_ERR_SHM_INTERN; +} + + +#endif /* MPL_USE_NT_SHM */ diff --git a/3rd-party/romio341/mpl/src/sock/Makefile.mk b/3rd-party/romio341/mpl/src/sock/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..170fc08885c2541b39b9fd6b5c52b752ce6eb3c2 --- /dev/null +++ b/3rd-party/romio341/mpl/src/sock/Makefile.mk @@ -0,0 +1,8 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/sock/mpl_sock.c \ + src/sock/mpl_sockaddr.c \ + src/sock/mpl_host.c diff --git a/3rd-party/romio341/mpl/src/sock/mpl_host.c b/3rd-party/romio341/mpl/src/sock/mpl_host.c new file mode 100644 index 0000000000000000000000000000000000000000..2be8956d0025a131e955f7614e9d9156995e65af --- /dev/null +++ b/3rd-party/romio341/mpl/src/sock/mpl_host.c @@ -0,0 +1,92 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +#if (!defined MAXHOSTNAMELEN) && (!defined MAX_HOSTNAME_LEN) +#define MAX_HOSTNAME_LEN 256 +#elif !defined MAX_HOSTNAME_LEN +#define MAX_HOSTNAME_LEN MAXHOSTNAMELEN +#endif + +#define MAX_LOCAL_HOSTNAMES (100) +static char lhost[MAX_LOCAL_HOSTNAMES][MAX_HOSTNAME_LEN]; +static int lhost_count = 0; + +static void append_lhost(const char *host) +{ + int i; + + for (i = 0; i < lhost_count; i++) + if (!strcmp(lhost[i], host)) + return; + + MPL_strncpy(lhost[lhost_count], host, MAX_HOSTNAME_LEN); + lhost_count++; +} + +static void init_lhost_list(void) +{ + /* if the local host list is already initialized, return */ + if (lhost_count) + return; + +#if defined(MPL_HAVE_GETIFADDRS) && defined (MPL_HAVE_INET_NTOP) + char tmp_lhost[MAX_HOSTNAME_LEN]; + int ret; + MPL_sockaddr_t addr; + struct ifaddrs *ifaddr, *ifa; + char buf[MAX_HOSTNAME_LEN]; + + if (gethostname(tmp_lhost, MAX_HOSTNAME_LEN) < 0) { + /* we can't figure out our local hostname. *sigh* */ + goto common_names; + } + append_lhost(tmp_lhost); + + /* we have our host name; try gethostbyname */ + ret = MPL_get_sockaddr(tmp_lhost, &addr); + if (ret == 0) { + /* Find the IP address of the host */ + ret = MPL_sockaddr_to_str(&addr, buf, MAX_HOSTNAME_LEN); + if (ret == 0) + append_lhost(buf); + } + + /* try getifaddrs to see if we can get additional IPs */ + if (getifaddrs(&ifaddr) == -1) + goto common_names; + + /* Find the IP addresses of all local interfaces */ + for (ifa = ifaddr; ifa; ifa = ifa->ifa_next) { + /* FIXME: IPv4 only local addresses */ + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) { + ret = MPL_sockaddr_to_str((MPL_sockaddr_t *) ifa->ifa_addr, buf, MAX_HOSTNAME_LEN); + if (ret == 0) + append_lhost(buf); + } + } + freeifaddrs(ifaddr); +#endif + + common_names: + /* list the common localhost names */ + append_lhost("localhost"); + append_lhost("127.0.0.1"); + append_lhost("127.0.1.1"); +} + +int MPL_host_is_local(const char *host) +{ + int i; + + init_lhost_list(); + + for (i = 0; i < lhost_count; i++) + if (!strcmp(lhost[i], host)) + return 1; + + return 0; +} diff --git a/3rd-party/romio341/mpl/src/sock/mpl_sock.c b/3rd-party/romio341/mpl/src/sock/mpl_sock.c new file mode 100644 index 0000000000000000000000000000000000000000..d577fa341e083dbf4257065858fc5c24a44a0689 --- /dev/null +++ b/3rd-party/romio341/mpl/src/sock/mpl_sock.c @@ -0,0 +1,116 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +#if defined MPL_HAVE_SYS_UIO_H +/* Some platforms, such as Mac OSX (at least as of 10.9.1) hang when + * attempting to send more than 2GB data, even though the writev + * function is supposed to be able to handle large data. This + * function is a simple workaround for this case by attempting to send + * lesser data, and having the upper layer retry later if needed. + * This adds a small amount of bookkeeping overhead, but it should be + * negligible compared to the system call overhead for small messages + * and compared to the data transmission overhead for large + * messages. */ +ssize_t MPL_large_writev(int fd, const struct iovec *iov, int iovcnt) +{ + ssize_t total_size, tmp; + struct iovec dummy; + int i; + + /* If the total data fits into INT_MAX, directly use writev */ + total_size = 0; + for (i = 0; i < iovcnt; i++) + total_size += iov[i].iov_len; + + if (total_size <= INT_MAX) { + do { + tmp = writev(fd, iov, iovcnt); + } while (tmp == -1 && errno == EINTR); + return tmp; + } + + /* Total data is larger than INT_MAX. Issue writev with fewer + * elements, so as to not exceed INT_MAX. In this case, doing + * multiple write calls, one for each iov segment is not a big + * deal with respect to performance. */ + + total_size = 0; + for (i = 0; i < iovcnt; i++) { + if (iov[i].iov_len <= INT_MAX) { + do { + tmp = writev(fd, &iov[i], 1); + } while (tmp == -1 && errno == EINTR); + } else { + dummy.iov_base = iov[i].iov_base; + dummy.iov_len = INT_MAX; + do { + tmp = writev(fd, &dummy, 1); + } while (tmp == -1 && errno == EINTR); + } + + if (tmp < 0) + return tmp; + else if (tmp < iov[i].iov_len) { + total_size += tmp; + return total_size; + } else + total_size += tmp; + } + + return total_size; +} + + +ssize_t MPL_large_readv(int fd, const struct iovec * iov, int iovcnt) +{ + ssize_t total_size, tmp; + struct iovec dummy; + int i; + + /* If the total data fits into INT_MAX, directly use readv */ + total_size = 0; + for (i = 0; i < iovcnt; i++) + total_size += iov[i].iov_len; + + if (total_size <= INT_MAX) { + do { + tmp = readv(fd, iov, iovcnt); + } while (tmp == -1 && errno == EINTR); + return tmp; + } + + /* Total data is larger than INT_MAX. Issue readv with fewer + * elements, so as to not exceed INT_MAX. In this case, doing + * multiple read calls, one for each iov segment is not a big + * deal with respect to performance. */ + + total_size = 0; + for (i = 0; i < iovcnt; i++) { + if (iov[i].iov_len <= INT_MAX) { + do { + tmp = readv(fd, &iov[i], 1); + } while (tmp == -1 && errno == EINTR); + } else { + dummy.iov_base = iov[i].iov_base; + dummy.iov_len = INT_MAX; + do { + tmp = readv(fd, &dummy, 1); + } while (tmp == -1 && errno == EINTR); + } + + if (tmp < 0) + return tmp; + else if (tmp < iov[i].iov_len) { + total_size += tmp; + return total_size; + } else + total_size += tmp; + } + + return total_size; +} +#endif /* MPL_HAVE_SYS_UIO_H */ diff --git a/3rd-party/romio341/mpl/src/sock/mpl_sockaddr.c b/3rd-party/romio341/mpl/src/sock/mpl_sockaddr.c new file mode 100644 index 0000000000000000000000000000000000000000..c0e991c68d8535c72257526e24f5b1840892c535 --- /dev/null +++ b/3rd-party/romio341/mpl/src/sock/mpl_sockaddr.c @@ -0,0 +1,339 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/** Rationale: + * MPL wrap for handling IPv4 and IPv6. + * + * Applications: pm, pmi, ch3. + * ch4 supports tcp sockets indirectly through ucx and ofi. + */ + +/** Design considerations: + * Either IPv4 or IPv6, globally set as defalt or with command line option, to + * simplify logic. + * TCP only, no UDP or unix domain sockets. + * + * Application use struct sockaddr_storage (typedefed to MPL_sockaddr_t) exclusively. + * MPL_get_sockaddr for hostname + * MPL_get_sockaddr_iface for network interface + * MPL_get_sockaddr_direct for listening socket on ANY or LOOPBACK + * + * Simplified MPL_connect and MPL_listen interface. + * Both have a port parameter. + * MPL_listen combines bind with listen. + */ + +/** Portability: + * struct sockaddr_storage: + * In case this struct is not available (in sys/socket.h), it can be + * circumvented by declare following (in mpl_sockaddr.h): + * struct sockaddr_storage { + * unsigend short ss_family; + * char padding[126]; + * }; + * Since we use typedef MPL_sockaddr_t, there is no need for code change. + * Only the ss_family field is directly accessed. All the other fields are + * always accessed by casting to either struct sockaddr_in or struct + * sockaddr_in6. + * + * The implementation uses getaddrinfo and getifaddrs. The former, as with + * sockaddr_storage and sockaddr_in6, are documented in RFC 2553, 1999, and are + * expected to be supported on most supported platforms. getifaddrs is not in + * POSIX.1, but it is present on Linux since glibc 2.3.3, and available on BSD + * systems even earlier. + */ + +#include "mplconfig.h" +#include <assert.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> +#include <netinet/in.h> +#include <string.h> +#include <ifaddrs.h> +#include <errno.h> +#include <stdio.h> + +#include "mpl_sockaddr.h" + +static int is_localhost(struct sockaddr *p_addr); + +static int af_type = AF_INET; +static int _use_loopback = 0; +static int _max_conn = SOMAXCONN; + +void MPL_sockaddr_set_aftype(int type) +{ + af_type = type; +} + +int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr) +{ + struct addrinfo ai_hint; + struct addrinfo *ai_list; + int ret; + +#ifdef __APPLE__ + /* Macos adds .local to hostname when network is unavailable or limited. + * This will result in long timeout in getaddrinfo below. + * Bypass it by resetting the hostname to "localhost" + */ + int n = strlen(s_hostname); + if (n > 6 && strcmp(s_hostname + n - 6, ".local") == 0) { + s_hostname = "localhost"; + } +#endif + + /* NOTE: there is report that getaddrinfo implementations will call kernel + * even when s_hostname is entirely numerical string and it may cause + * problems when host is configured with thousands of ip addresses. + */ + /* TODO: detect the cases when s_hostname is entirely numerical string and + * call inet_pton directly (-- do this on first bug report). + */ + memset(p_addr, 0, sizeof(*p_addr)); + memset(&ai_hint, 0, sizeof(ai_hint)); + ai_hint.ai_family = af_type; + ai_hint.ai_socktype = SOCK_STREAM; + ai_hint.ai_protocol = IPPROTO_TCP; + ai_hint.ai_flags = AI_V4MAPPED; + ret = getaddrinfo(s_hostname, NULL, &ai_hint, &ai_list); + if (ret) { + return ret; + } + if (af_type == AF_INET) { + memcpy(p_addr, ai_list->ai_addr, sizeof(struct sockaddr_in)); + } else if (af_type == AF_INET6) { + memcpy(p_addr, ai_list->ai_addr, sizeof(struct sockaddr_in6)); + } else { + assert(0); + } + freeaddrinfo(ai_list); + return 0; +} + +int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr) +{ + memset(p_addr, 0, sizeof(*p_addr)); + assert(type == MPL_SOCKADDR_ANY || type == MPL_SOCKADDR_LOOPBACK); + if (af_type == AF_INET) { + struct sockaddr_in *p_addr4 = (struct sockaddr_in *) p_addr; + + p_addr4->sin_family = AF_INET; + if (type == MPL_SOCKADDR_LOOPBACK) { + p_addr4->sin_addr.s_addr = htonl(0x7f000001); + } else { + p_addr4->sin_addr.s_addr = htonl(INADDR_ANY); + } + return 0; + } else if (af_type == AF_INET6) { + struct sockaddr_in6 *p_addr6 = (struct sockaddr_in6 *) p_addr; + + p_addr6->sin6_family = AF_INET6; + if (type == MPL_SOCKADDR_LOOPBACK) { + p_addr6->sin6_addr = in6addr_loopback; + } else { + p_addr6->sin6_addr = in6addr_any; + } + return 0; + } else { + assert(0); + } +} + +int MPL_get_sockaddr_iface(const char *s_iface, MPL_sockaddr_t * p_addr) +{ + struct ifaddrs *ifaddr; + int ret; + struct ifaddrs *ifa; + int found = 0; + + memset(p_addr, 0, sizeof(*p_addr)); + ret = getifaddrs(&ifaddr); + if (ret) { + return ret; + } + ifa = ifaddr; + while (ifa) { + if (s_iface && ifa->ifa_name && strcmp(s_iface, ifa->ifa_name) != 0) { + ifa = ifa->ifa_next; + continue; + } + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == af_type) { + found++; + if (af_type == AF_INET) { + memcpy(p_addr, ifa->ifa_addr, sizeof(struct sockaddr_in)); + } else if (af_type == AF_INET6) { + memcpy(p_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6)); + } + if (!is_localhost((struct sockaddr *) ifa->ifa_addr)) { + break; + } + } + ifa = ifa->ifa_next; + } + freeifaddrs(ifaddr); + if (!found) { + return -1; + } else { + return 0; + } +} + +int MPL_socket() +{ + return socket(af_type, SOCK_STREAM, IPPROTO_TCP); +} + +int MPL_connect(int sock_fd, MPL_sockaddr_t * p_addr, unsigned short port) +{ + if (af_type == AF_INET) { + ((struct sockaddr_in *) p_addr)->sin_port = htons(port); + return connect(sock_fd, (const struct sockaddr *) p_addr, sizeof(struct sockaddr_in)); + } else if (af_type == AF_INET6) { + ((struct sockaddr_in6 *) p_addr)->sin6_port = htons(port); + return connect(sock_fd, (const struct sockaddr *) p_addr, sizeof(struct sockaddr_in6)); + } else { + return -1; + } +} + +void MPL_set_listen_attr(int use_loopback, int max_conn) +{ + _use_loopback = use_loopback; + _max_conn = max_conn; +} + +int MPL_listen(int sock_fd, unsigned short port) +{ + MPL_sockaddr_t addr; + int ret; + + if (_use_loopback) { + MPL_get_sockaddr_direct(MPL_SOCKADDR_LOOPBACK, &addr); + } else { + MPL_get_sockaddr_direct(MPL_SOCKADDR_ANY, &addr); + } + if (af_type == AF_INET) { + ((struct sockaddr_in *) &addr)->sin_port = htons(port); + ret = bind(sock_fd, (const struct sockaddr *) &addr, sizeof(struct sockaddr_in)); + } else if (af_type == AF_INET6) { + ((struct sockaddr_in6 *) &addr)->sin6_port = htons(port); + ret = bind(sock_fd, (const struct sockaddr *) &addr, sizeof(struct sockaddr_in6)); + } else { + assert(0); + } + if (ret) { + return ret; + } + return listen(sock_fd, _max_conn); +} + +int MPL_listen_anyport(int sock_fd, unsigned short *p_port) +{ + MPL_sockaddr_t addr; + int ret; + + if (_use_loopback) { + MPL_get_sockaddr_direct(MPL_SOCKADDR_LOOPBACK, &addr); + } else { + MPL_get_sockaddr_direct(MPL_SOCKADDR_ANY, &addr); + } + if (af_type == AF_INET) { + ((struct sockaddr_in *) &addr)->sin_port = 0; + ret = bind(sock_fd, (const struct sockaddr *) &addr, sizeof(struct sockaddr_in)); + } else if (af_type == AF_INET6) { + ((struct sockaddr_in6 *) &addr)->sin6_port = 0; + ret = bind(sock_fd, (const struct sockaddr *) &addr, sizeof(struct sockaddr_in6)); + } else { + assert(0); + } + if (ret) { + return ret; + } + unsigned int n = sizeof(addr); + ret = getsockname(sock_fd, (struct sockaddr *) &addr, &n); + if (ret) { + return ret; + } + if (af_type == AF_INET) { + *p_port = ntohs(((struct sockaddr_in *) &addr)->sin_port); + } else if (af_type == AF_INET6) { + *p_port = ntohs(((struct sockaddr_in6 *) &addr)->sin6_port); + } + return listen(sock_fd, _max_conn); +} + +int MPL_listen_portrange(int sock_fd, unsigned short *p_port, int low_port, int high_port) +{ + MPL_sockaddr_t addr; + int i; + int ret; + + if (_use_loopback) { + MPL_get_sockaddr_direct(MPL_SOCKADDR_LOOPBACK, &addr); + } else { + MPL_get_sockaddr_direct(MPL_SOCKADDR_ANY, &addr); + } + for (i = low_port; i <= high_port; i++) { + ret = MPL_listen(sock_fd, i); + if (ret == 0) { + *p_port = i; + break; + } else if (errno == EADDRINUSE) { + continue; + } else { + return -1; + } + } + if (i > high_port) { + return -2; + } + return listen(sock_fd, _max_conn); +} + +int MPL_sockaddr_to_str(MPL_sockaddr_t * p_addr, char *str, int maxlen) +{ + unsigned char *p; + + /* TODO: consider inet_ntop */ + if (p_addr->ss_family == AF_INET) { + p = (void *) &((struct sockaddr_in *) p_addr)->sin_addr; + snprintf(str, maxlen, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + } else if (p_addr->ss_family == AF_INET6) { + p = (void *) &((struct sockaddr_in6 *) p_addr)->sin6_addr; + snprintf(str, maxlen, + "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], + p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); + } + return 0; +} + +int MPL_sockaddr_port(MPL_sockaddr_t * p_addr) +{ + if (p_addr->ss_family == AF_INET) { + return ntohs(((struct sockaddr_in *) p_addr)->sin_port); + } else if (p_addr->ss_family == AF_INET6) { + return ntohs(((struct sockaddr_in6 *) p_addr)->sin6_port); + } + return 0; +} + +int is_localhost(struct sockaddr *p_addr) +{ + char *p; + + if (p_addr->sa_family == AF_INET) { + p = (void *) &((struct sockaddr_in *) p_addr)->sin_addr; + return strncmp(p, "\x7f\x00\x00\x01", 4) == 0; + } else if (p_addr->sa_family == AF_INET6) { + p = (void *) &((struct sockaddr_in6 *) p_addr)->sin6_addr; + return strncmp(p, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01", 16) == 0 || + strncmp(p, "\xfe\x80\0\0\0\0\0\0\0\0\0\0\0\0\0\x01", 16) == 0; + } else { + return 0; + } +} diff --git a/3rd-party/romio341/mpl/src/str/Makefile.mk b/3rd-party/romio341/mpl/src/str/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..7bea9a4d38bf0930a2a522463e4e82c0cf7035f7 --- /dev/null +++ b/3rd-party/romio341/mpl/src/str/Makefile.mk @@ -0,0 +1,6 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += src/str/mpl_str.c src/str/mpl_argstr.c src/str/mpl_arg_serial.c diff --git a/3rd-party/romio341/mpl/src/str/mpl_arg_serial.c b/3rd-party/romio341/mpl/src/str/mpl_arg_serial.c new file mode 100644 index 0000000000000000000000000000000000000000..b0e70ca51f65ee62f8e80369b56ca18d8144ff05 --- /dev/null +++ b/3rd-party/romio341/mpl/src/str/mpl_arg_serial.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#include <assert.h> + +int MPL_args_serialize(int argc, char **argv, int *len, void **serialized_buf) +{ + int buf_size, offset, tmp; + char *buf; + int i; + + /* + * the serialized format will contain the following: + * 1. An integer indicating how many arguments there are + * 2. An array of integers indicating the length of each argument + * 3. An array of strings with the actual arguments + */ + + buf_size = 0; + buf_size += sizeof(int); /* for the number of arguments */ + buf_size += argc * sizeof(int); /* for the argument lengths */ + for (i = 0; i < argc; i++) + buf_size += strlen(argv[i]); /* for the arguments themselves */ + + buf = MPL_malloc(buf_size, MPL_MEM_STRINGS); + assert(buf); + + offset = 0; + memcpy(buf, &argc, sizeof(int)); + offset += sizeof(int); + + for (i = 0; i < argc; i++) { + tmp = strlen(argv[i]); + memcpy(buf + offset, &tmp, sizeof(int)); + offset += sizeof(int); + } + + for (i = 0; i < argc; i++) { + memcpy(buf + offset, argv[i], strlen(argv[i])); + offset += strlen(argv[i]); + } + + *len = buf_size; + *serialized_buf = buf; + + return 0; +} + +int MPL_args_deserialize(int len, const void *serialized_buf, int *argc, char ***argv) +{ + const char *buf = serialized_buf; + int nargs; + int *arg_lengths; + char **targv; + int i; + + nargs = *((int *) buf); + buf += sizeof(int); + + targv = (char **) MPL_malloc(nargs * sizeof(char *), MPL_MEM_STRINGS); + arg_lengths = (int *) MPL_malloc(nargs * sizeof(int), MPL_MEM_STRINGS); + + assert(targv && arg_lengths); + + for (i = 0; i < nargs; i++) { + arg_lengths[i] = (*((int *) buf)); + buf += sizeof(int); + + /* allocate an extra end-of-string character for each string */ + targv[i] = (char *) MPL_malloc(arg_lengths[i] + 1, MPL_MEM_STRINGS); + assert(targv[i]); + } + + for (i = 0; i < nargs; i++) { + memcpy(targv[i], buf, arg_lengths[i]); + targv[i][arg_lengths[i]] = 0; /* append an end of string character */ + buf += arg_lengths[i]; + } + + *argc = nargs; + *argv = targv; + + MPL_free(arg_lengths); + + return 0; +} diff --git a/3rd-party/romio341/mpl/src/str/mpl_argstr.c b/3rd-party/romio341/mpl/src/str/mpl_argstr.c new file mode 100644 index 0000000000000000000000000000000000000000..81fc2a1e2c930a6830e1fc3a436fe3cc5aa488b0 --- /dev/null +++ b/3rd-party/romio341/mpl/src/str/mpl_argstr.c @@ -0,0 +1,770 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +#ifdef MPL_HAVE_MATH_H +#include <math.h> +#endif +/* ctype is needed for isspace and isascii (isspace is only defined for + values on which isascii returns true). */ +#include <ctype.h> + +static int encode_buffer(char *dest, int dest_length, const char *src, + int src_length, int *num_encoded) +{ + int num_used; + int n = 0; + if (src_length == 0) { + if (dest_length > 2) { + *dest = MPL_STR_QUOTE_CHAR; + dest++; + *dest = MPL_STR_QUOTE_CHAR; + dest++; + *dest = '\0'; + *num_encoded = 0; + return MPL_SUCCESS; + } else { + return MPL_ERR_STR_TRUNCATED; + } + } + while (src_length && dest_length) { + num_used = MPL_snprintf(dest, dest_length, "%02X", (unsigned char) *src); + if (num_used < 0) { + *num_encoded = n; + return MPL_ERR_STR_TRUNCATED; + } + /*MPL_DBG_MSG_FMT(STRING,VERBOSE,(MPL_DBG_FDEST," %c = %c%c", + * ch, dest[0], dest[1])); */ + dest += num_used; + dest_length -= num_used; + src++; + n++; + src_length--; + } + *num_encoded = n; + return src_length ? MPL_ERR_STR_TRUNCATED : MPL_SUCCESS; +} + +static int decode_buffer(const char *str, char *dest, int length, int *num_decoded) +{ + char hex[3]; + int value; + int n = 0; + + if (str == NULL || dest == NULL || num_decoded == NULL) + return MPL_ERR_STR_FAIL; + if (length < 1) { + *num_decoded = 0; + if (*str == '\0') + return MPL_SUCCESS; + return MPL_ERR_STR_TRUNCATED; + } + if (*str == MPL_STR_QUOTE_CHAR) + str++; + hex[2] = '\0'; + while (*str != '\0' && *str != MPL_STR_SEPAR_CHAR && *str != MPL_STR_QUOTE_CHAR && length) { + hex[0] = *str; + str++; + hex[1] = *str; + str++; + if (0 == sscanf(hex, "%X", &value)) + return MPL_ERR_STR_TRUNCATED; + *dest = (char) value; + /*MPL_DBG_MSG_FMT(STRING,VERBOSE,(MPL_DBG_FDEST," %s = %c", + * hex, *dest)); */ + dest++; + n++; + length--; + } + *num_decoded = n; + if (length == 0) { + if (*str != '\0' && *str != MPL_STR_SEPAR_CHAR && *str != MPL_STR_QUOTE_CHAR) + return MPL_ERR_STR_TRUNCATED; + } + return MPL_SUCCESS; +} + +static const char *first_token(const char *str) +{ + if (str == NULL) + return NULL; + /* isspace is defined only if isascii is true */ + while (/*isascii(*str) && isspace(*str) */ *str == MPL_STR_SEPAR_CHAR) + str++; + if (*str == '\0') + return NULL; + return str; +} + +static const char *next_token(const char *str) +{ + if (str == NULL) + return NULL; + str = first_token(str); + if (str == NULL) + return NULL; + if (*str == MPL_STR_QUOTE_CHAR) { + /* move over string */ + str++; /* move over the first quote */ + if (*str == '\0') + return NULL; + while (*str != MPL_STR_QUOTE_CHAR) { + /* move until the last quote, ignoring escaped quotes */ + if (*str == MPL_STR_ESCAPE_CHAR) { + str++; + if (*str == MPL_STR_QUOTE_CHAR) + str++; + } else { + str++; + } + if (*str == '\0') + return NULL; + } + str++; /* move over the last quote */ + } else { + if (*str == MPL_STR_DELIM_CHAR) { + /* move over the DELIM token */ + str++; + } else { + /* move over literal */ + while (/*(isascii(*str) && + * !isspace(*str)) && */ + *str != MPL_STR_SEPAR_CHAR && *str != MPL_STR_DELIM_CHAR && *str != '\0') + str++; + } + } + return first_token(str); +} + +static int compare_token(const char *token, const char *str) +{ + if (token == NULL || str == NULL) + return -1; + + if (*token == MPL_STR_QUOTE_CHAR) { + /* compare quoted strings */ + token++; /* move over the first quote */ + /* compare characters until reaching the end of the string or the + * end quote character */ + for (;;) { + if (*token == MPL_STR_ESCAPE_CHAR) { + if (*(token + 1) == MPL_STR_QUOTE_CHAR) { + /* move over the escape character if the next character + * is a quote character */ + token++; + } + if (*token != *str) + break; + } else { + if (*token != *str || *token == MPL_STR_QUOTE_CHAR) + break; + } + if (*str == '\0') + break; + token++; + str++; + } + if (*str == '\0' && *token == MPL_STR_QUOTE_CHAR) + return 0; + if (*token == MPL_STR_QUOTE_CHAR) + return 1; + if (*str < *token) + return -1; + return 1; + } + + /* compare DELIM token */ + if (*token == MPL_STR_DELIM_CHAR) { + if (*str == MPL_STR_DELIM_CHAR) { + str++; + if (*str == '\0') + return 0; + return 1; + } + if (*token < *str) + return -1; + return 1; + } + + /* compare literals */ + while (*token == *str && + *str != '\0' && *token != MPL_STR_DELIM_CHAR && (*token != MPL_STR_SEPAR_CHAR)) { + token++; + str++; + } + if ((*str == '\0') && + (*token == MPL_STR_DELIM_CHAR || (*token == MPL_STR_SEPAR_CHAR) || *token == '\0')) + return 0; + if (*token == MPL_STR_DELIM_CHAR || (*token == MPL_STR_SEPAR_CHAR) || *token < *str) + return -1; + return 1; +} + + +static int token_copy(const char *token, char *str, int maxlen) +{ + /* check parameters */ + if (token == NULL || str == NULL) + return MPL_ERR_STR_FAIL; + + /* check special buffer lengths */ + if (maxlen < 1) + return MPL_ERR_STR_FAIL; + if (maxlen == 1) { + *str = '\0'; + return (str[0] == '\0') ? MPL_SUCCESS : MPL_ERR_STR_TRUNCATED; + } + + /* cosy up to the token */ + token = first_token(token); + if (token == NULL) { + *str = '\0'; + return MPL_SUCCESS; + } + + if (*token == MPL_STR_DELIM_CHAR) { + /* copy the special deliminator token */ + str[0] = MPL_STR_DELIM_CHAR; + str[1] = '\0'; + return MPL_SUCCESS; + } + + if (*token == MPL_STR_QUOTE_CHAR) { + /* quoted copy */ + token++; /* move over the first quote */ + do { + if (*token == MPL_STR_ESCAPE_CHAR) { + if (*(token + 1) == MPL_STR_QUOTE_CHAR) + token++; + *str = *token; + } else { + if (*token == MPL_STR_QUOTE_CHAR) { + *str = '\0'; + return MPL_SUCCESS; + } + *str = *token; + } + str++; + token++; + maxlen--; + } while (maxlen); + /* we've run out of destination characters so back up and null + * terminate the string */ + str--; + *str = '\0'; + return MPL_ERR_STR_TRUNCATED; + } + + /* literal copy */ + while (*token != MPL_STR_DELIM_CHAR && + (*token != MPL_STR_SEPAR_CHAR) && *token != '\0' && maxlen) { + *str = *token; + str++; + token++; + maxlen--; + } + if (maxlen) { + *str = '\0'; + return MPL_SUCCESS; + } + str--; + *str = '\0'; + return MPL_ERR_STR_TRUNCATED; +} + +/*@ MPL_str_get_string_arg - Extract an option from a string with a + maximum length + +Input Parameters: ++ str - Source string +. key - key +- maxlen - Maximum total length of 'val' + +Output Parameters: +. val - output string + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine searches for a "key = value" entry in a string + + Module: + Utility + @*/ +int MPL_str_get_string_arg(const char *str, const char *flag, char *val, int maxlen) +{ + if (maxlen < 1) + return MPL_ERR_STR_FAIL; + + /* line up with the first token */ + str = first_token(str); + if (str == NULL) + return MPL_ERR_STR_FAIL; + + /* This loop will match the first instance of "flag = value" in the string. */ + do { + if (compare_token(str, flag) == 0) { + str = next_token(str); + if (compare_token(str, MPL_STR_DELIM_STR) == 0) { + str = next_token(str); + if (str == NULL) + return MPL_ERR_STR_FAIL; + return token_copy(str, val, maxlen); + } + } else { + str = next_token(str); + } + } while (str); + return MPL_ERR_STR_FAIL; +} + +/*@ MPL_str_get_binary_arg - Extract an option from a string with a maximum + length + +Input Parameters: ++ str - Source string +. key - key +- maxlen - Maximum total length of 'buffer' + +Output Parameters: ++ buffer - output buffer +- out_length - output length + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine searches for a "key = value" entry in a string and decodes + the value + back to binary data. The data must have been encoded with + MPL_str_add_binary_arg. + + Module: + Utility + @*/ +int MPL_str_get_binary_arg(const char *str, const char *flag, char *buffer, + int maxlen, int *out_length) +{ + if (maxlen < 1) + return MPL_ERR_STR_FAIL; + + /* line up with the first token */ + str = first_token(str); + if (str == NULL) + return MPL_ERR_STR_FAIL; + + /* This loop will match the first instance of "flag = value" in the string. */ + do { + if (compare_token(str, flag) == 0) { + str = next_token(str); + if (compare_token(str, MPL_STR_DELIM_STR) == 0) { + str = next_token(str); + if (str == NULL) + return MPL_ERR_STR_FAIL; + return decode_buffer(str, buffer, maxlen, out_length); + } + } else { + str = next_token(str); + } + } while (str); + return MPL_ERR_STR_FAIL; +} + +/*@ MPL_str_get_int_arg - Extract an option from a string + +Input Parameters: ++ str - Source string +- key - key + +Output Parameters: +. val_ptr - pointer to the output integer + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine searches for a "key = value" entry in a string and decodes the value + back to an int. + + Module: + Utility + @*/ +int MPL_str_get_int_arg(const char *str, const char *flag, int *val_ptr) +{ + int result; + char int_str[12]; + + result = MPL_str_get_string_arg(str, flag, int_str, 12); + if (result == MPL_SUCCESS) { + *val_ptr = atoi(int_str); + return MPL_SUCCESS; + } + return result; +} + +/* quoted_printf does not NULL terminate the string if maxlen is reached */ +static int quoted_printf(char *str, int maxlen, const char *val) +{ + int count = 0; + if (maxlen < 1) + return 0; + *str = MPL_STR_QUOTE_CHAR; + str++; + maxlen--; + count++; + while (maxlen) { + if (*val == '\0') + break; + if (*val == MPL_STR_QUOTE_CHAR) { + *str = MPL_STR_ESCAPE_CHAR; + str++; + maxlen--; + count++; + if (maxlen == 0) + return count; + } + *str = *val; + str++; + maxlen--; + count++; + val++; + } + if (maxlen) { + *str = MPL_STR_QUOTE_CHAR; + str++; + maxlen--; + count++; + if (maxlen == 0) + return count; + *str = '\0'; + } + return count; +} + +/*@ MPL_str_add_string - Add a string to a string + +Input Parameters: ++ str_ptr - pointer to the destination string +. maxlen_ptr - pointer to the maximum length of '*str_ptr' +- val - string to add + +Output Parameters: ++ str_ptr - The string pointer is updated to the next available location in + the string +- maxlen_ptr - maxlen is decremented by the amount str_ptr is incremented + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine adds a string to a string in such a way that + MPL_str_get_string can + retreive the same string back. It takes into account spaces and quote + characters. + The string pointer is updated to the start of the next string in the + string and maxlen is updated accordingly. + + Module: + Utility + @*/ +int MPL_str_add_string(char **str_ptr, int *maxlen_ptr, const char *val) +{ + int num_chars; + char *str; + int maxlen; + + str = *str_ptr; + maxlen = *maxlen_ptr; + + if (strchr(val, MPL_STR_SEPAR_CHAR) || + strchr(val, MPL_STR_QUOTE_CHAR) || strchr(val, MPL_STR_DELIM_CHAR)) { + num_chars = quoted_printf(str, maxlen, val); + if (num_chars == maxlen) { + /* truncation, cleanup string */ + *str = '\0'; + return -1; + } + if (num_chars < maxlen - 1) { + str[num_chars] = MPL_STR_SEPAR_CHAR; + str[num_chars + 1] = '\0'; + num_chars++; + } else { + str[num_chars] = '\0'; + } + } else { + if (*val == '\0') { + num_chars = MPL_snprintf(str, maxlen, MPL_STR_QUOTE_STR MPL_STR_QUOTE_STR /*"\"\"" */); + } else { + num_chars = MPL_snprintf(str, maxlen, "%s%c", val, MPL_STR_SEPAR_CHAR); + } + if (num_chars == maxlen) { + *str = '\0'; + return -1; + } + } + *str_ptr += num_chars; + *maxlen_ptr -= num_chars; + return 0; +} + +/*@ MPL_str_get_string - Get the next string from a string + +Input Parameters: ++ str_ptr - pointer to the destination string +- maxlen_ptr - pointer to the maximum length of '*str_ptr' + +Output Parameters: ++ str_ptr - location of the next string +- val - location to store the string + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Return Value: + The return value is 0 for success, -1 for insufficient buffer space, and + 1 for failure. + + Notes: + This routine gets a string that was previously added by + MPL_str_add_string. + It takes into account spaces and quote characters. The string pointer is + updated to the start of the next string in the string. + + Module: + Utility + @*/ +int MPL_str_get_string(char **str_ptr, char *val, int maxlen) +{ + int result; + char *str; + + if (str_ptr == NULL) { + return -2; + } + + str = *str_ptr; + + if (maxlen < 1) { + return 0; + } + + /* line up with the first token */ + str = (char *) first_token(str); + if (str == NULL) { + return 0; + } + + /* copy the token */ + result = token_copy(str, val, maxlen); + if (result == MPL_SUCCESS) { + str = (char *) next_token(str); + *str_ptr = str; + return 0; + } else if (result == MPL_ERR_STR_TRUNCATED) { + return -1; + } + + /* failure */ + return -2; +} + +/*@ MPL_str_add_string_arg - Add an option to a string with a maximum length + +Input Parameters: ++ str_ptr - Pointer to the destination string +. maxlen_ptr - Pointer to the maximum total length of '*str_ptr' +. key - key +- val - input string + +Output Parameters: ++ str_ptr - The string pointer is updated to the next available location in + the string +- maxlen_ptr - maxlen is reduced by the number of characters written + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine adds a string option to a string in the form "key = value". + + Module: + Utility + @*/ +int MPL_str_add_string_arg(char **str_ptr, int *maxlen_ptr, const char *flag, const char *val) +{ + int num_chars; + char **orig_str_ptr; + + if (maxlen_ptr == NULL) + return MPL_ERR_STR_FAIL; + + orig_str_ptr = str_ptr; + + if (*maxlen_ptr < 1) + return MPL_ERR_STR_FAIL; + + /* add the flag */ + if (strstr(flag, MPL_STR_SEPAR_STR) || strstr(flag, MPL_STR_DELIM_STR) || + flag[0] == MPL_STR_QUOTE_CHAR) { + num_chars = quoted_printf(*str_ptr, *maxlen_ptr, flag); + } else { + num_chars = MPL_snprintf(*str_ptr, *maxlen_ptr, "%s", flag); + } + *maxlen_ptr = *maxlen_ptr - num_chars; + if (*maxlen_ptr < 1) { + MPL_DBG_MSG_S(MPIR_DBG_STRING, VERBOSE, "partial argument added to string: '%s'", *str_ptr); + **str_ptr = '\0'; + return MPL_ERR_STR_NOMEM; + } + *str_ptr = *str_ptr + num_chars; + + /* add the deliminator character */ + **str_ptr = MPL_STR_DELIM_CHAR; + *str_ptr = *str_ptr + 1; + *maxlen_ptr = *maxlen_ptr - 1; + + /* add the value string */ + if (strstr(val, MPL_STR_SEPAR_STR) || strstr(val, MPL_STR_DELIM_STR) || + val[0] == MPL_STR_QUOTE_CHAR) { + num_chars = quoted_printf(*str_ptr, *maxlen_ptr, val); + } else { + if (*val == '\0') { + num_chars = MPL_snprintf(*str_ptr, *maxlen_ptr, + MPL_STR_QUOTE_STR MPL_STR_QUOTE_STR /*"\"\"" */); + } else { + num_chars = MPL_snprintf(*str_ptr, *maxlen_ptr, "%s", val); + } + } + *str_ptr = *str_ptr + num_chars; + *maxlen_ptr = *maxlen_ptr - num_chars; + if (*maxlen_ptr < 2) { + MPL_DBG_MSG_S(MPIR_DBG_STRING, VERBOSE, "partial argument added to string: '%s'", *str_ptr); + **orig_str_ptr = '\0'; + return MPL_ERR_STR_NOMEM; + } + + /* add the trailing space */ + **str_ptr = MPL_STR_SEPAR_CHAR; + *str_ptr = *str_ptr + 1; + **str_ptr = '\0'; + *maxlen_ptr = *maxlen_ptr - 1; + + return MPL_SUCCESS; +} + +/*@ MPL_str_add_int_arg - Add an option to a string with a maximum length + +Input Parameters: ++ str_ptr - Pointer to the destination string +. maxlen_ptr - Pointer to the maximum total length of '*str_ptr' +. key - key +- val - input integer + +Output Parameters: ++ str_ptr - The string pointer is updated to the next available location in + the string +- maxlen_ptr - maxlen is reduced by the number of characters written + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine adds an integer option to a string in the form "key = value". + + Module: + Utility + @*/ +int MPL_str_add_int_arg(char **str_ptr, int *maxlen_ptr, const char *flag, int val) +{ + char val_str[12]; + MPL_snprintf(val_str, 12, "%d", val); + return MPL_str_add_string_arg(str_ptr, maxlen_ptr, flag, val_str); +} + +/*@ MPL_str_add_binary_arg - Add an option to a string with a maximum length + +Input Parameters: ++ str_ptr - Pointer to the destination string +. maxlen_ptr - Pointer to the maximum total length of '*str_ptr' +. key - key +. val - input data +- length - length of the input data + +Output Parameters: ++ str_ptr - The string pointer is updated to the next available location in + the string +- maxlen_ptr - maxlen is reduced by the number of characters written + + Return value: + MPL_SUCCESS, MPL_ERR_STR_NOMEM, MPL_ERR_STR + + Notes: + This routine encodes binary data into a string option in the form + "key = encoded_value". + + Module: + Utility + @*/ +int MPL_str_add_binary_arg(char **str_ptr, int *maxlen_ptr, const char *flag, + const char *buffer, int length) +{ + int result; + int num_chars; + char **orig_str_ptr; + + if (maxlen_ptr == NULL) + return MPL_ERR_STR_FAIL; + + orig_str_ptr = str_ptr; + + if (*maxlen_ptr < 1) + return MPL_ERR_STR_FAIL; + + /* add the flag */ + if (strstr(flag, MPL_STR_SEPAR_STR) || strstr(flag, MPL_STR_DELIM_STR) || + flag[0] == MPL_STR_QUOTE_CHAR) { + num_chars = quoted_printf(*str_ptr, *maxlen_ptr, flag); + } else { + num_chars = MPL_snprintf(*str_ptr, *maxlen_ptr, "%s", flag); + } + *maxlen_ptr = *maxlen_ptr - num_chars; + if (*maxlen_ptr < 1) { + MPL_DBG_MSG_S(MPIR_DBG_STRING, VERBOSE, "partial argument added to string: '%s'", *str_ptr); + **str_ptr = '\0'; + return MPL_ERR_STR_NOMEM; + } + *str_ptr = *str_ptr + num_chars; + + /* add the deliminator character */ + **str_ptr = MPL_STR_DELIM_CHAR; + *str_ptr = *str_ptr + 1; + *maxlen_ptr = *maxlen_ptr - 1; + + /* add the value string */ + result = encode_buffer(*str_ptr, *maxlen_ptr, buffer, length, &num_chars); + if (result != MPL_SUCCESS) { + **orig_str_ptr = '\0'; + return result; + } + num_chars = num_chars * 2; /* the encoding function turns one source + * character into two destination characters */ + *str_ptr = *str_ptr + num_chars; + *maxlen_ptr = *maxlen_ptr - num_chars; + if (*maxlen_ptr < 2) { + MPL_DBG_MSG_S(MPIR_DBG_STRING, VERBOSE, "partial argument added to string: '%s'", *str_ptr); + **orig_str_ptr = '\0'; + return MPL_ERR_STR_NOMEM; + } + + /* add the trailing space */ + **str_ptr = MPL_STR_SEPAR_CHAR; + *str_ptr = *str_ptr + 1; + **str_ptr = '\0'; + *maxlen_ptr = *maxlen_ptr - 1; + + return MPL_SUCCESS; +} diff --git a/3rd-party/romio341/mpl/src/str/mpl_str.c b/3rd-party/romio341/mpl/src/str/mpl_str.c new file mode 100644 index 0000000000000000000000000000000000000000..925793dec6455fdb9249610b1139883ae6514467 --- /dev/null +++ b/3rd-party/romio341/mpl/src/str/mpl_str.c @@ -0,0 +1,418 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#include <assert.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_TIME_H +#include <time.h> +#endif + +#if !defined MPL_HAVE_SNPRINTF +int MPL_snprintf(char *str, size_t size, const char *format, ...) +{ + int n; + const char *p; + char *out_str = str; + va_list list; + + va_start(list, format); + + p = format; + while (*p && size > 0) { + char *nf; + + nf = strchr(p, '%'); + if (!nf) { + /* No more format characters */ + while (size-- > 0 && *p) { + *out_str++ = *p++; + } + } else { + int nc; + int width = -1; + + /* Copy until nf */ + while (p < nf && size-- > 0) { + *out_str++ = *p++; + } + /* p now points at nf */ + /* Handle the format character */ + nc = nf[1]; + if (isdigit(nc)) { + /* Get the field width */ + /* FIXME : Assumes ASCII */ + width = nc - '0'; + p = nf + 2; + while (*p && isdigit(*p)) { + width = 10 * width + (*p++ - '0'); + } + /* When there is no longer a digit, get the format + * character */ + nc = *p++; + } else { + /* Skip over the format string */ + p += 2; + } + + switch (nc) { + case '%': + *out_str++ = '%'; + size--; + break; + + case 'd': + { + int val; + char tmp[20]; + char *t = tmp; + /* Get the argument, of integer type */ + val = va_arg(list, int); + sprintf(tmp, "%d", val); + if (width > 0) { + size_t tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + * left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 'x': + { + int val; + char tmp[20]; + char *t = tmp; + /* Get the argument, of integer type */ + val = va_arg(list, int); + sprintf(tmp, "%x", val); + if (width > 0) { + size_t tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + * left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 'p': + { + void *val; + char tmp[20]; + char *t = tmp; + /* Get the argument, of pointer type */ + val = va_arg(list, void *); + sprintf(tmp, "%p", val); + if (width > 0) { + size_t tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + * left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 's': + { + char *s_arg; + /* Get the argument, of pointer to char type */ + s_arg = va_arg(list, char *); + while (size-- > 0 && s_arg && *s_arg) { + *out_str++ = *s_arg++; + } + } + break; + + default: + /* Error, unknown case */ + return -1; + break; + } + } + } + + va_end(list); + + if (size-- > 0) + *out_str++ = '\0'; + + n = (int) (out_str - str); + return n; +} +#endif /* MPL_HAVE_SNPRINTF */ + +/*@ + MPL_strdup - Duplicate a string + + Synopsis: +.vb + char *MPL_strdup(const char *str) +.ve + +Input Parameters: +. str - null-terminated string to duplicate + + Return value: + A pointer to a copy of the string, including the terminating null. A + null pointer is returned on error, such as out-of-memory. + + Module: + Utility + @*/ +#if !defined MPL_HAVE_STRDUP +char *MPL_strdup(const char *str) +{ + char *restrict p = (char *) malloc(strlen(str) + 1); + const char *restrict in_p = str; + char *save_p; + + save_p = p; + if (p) { + while (*in_p) { + *p++ = *in_p++; + } + *p = 0; + } + return save_p; +} +#endif /* MPL_HAVE_STRDUP */ + +/* + * MPL_strncpy - Copy at most n characters. Stop once a null is reached. + * + * This is different from strncpy, which null pads so that exactly + * n characters are copied. The strncpy behavior is correct for many + * applications because it guarantees that the string has no uninitialized + * data. + * + * If n characters are copied without reaching a null, return an error. + * Otherwise, return 0. + * + * Question: should we provide a way to request the length of the string, + * since we know it? + */ +/*@ MPL_strncpy - Copy a string with a maximum length + +Input Parameters: ++ instr - String to copy +- maxlen - Maximum total length of 'outstr' + +Output Parameters: +. outstr - String to copy into + + Notes: + This routine is the routine that you wish 'strncpy' was. In copying + 'instr' to 'outstr', it stops when either the end of 'outstr' (the + null character) is seen or the maximum length 'maxlen' is reached. + Unlike 'strncpy', it does not add enough nulls to 'outstr' after + copying 'instr' in order to move precisely 'maxlen' characters. + Thus, this routine may be used anywhere 'strcpy' is used, without any + performance cost related to large values of 'maxlen'. + + If there is insufficient space in the destination, the destination is + still null-terminated, to avoid potential failures in routines that neglect + to check the error code return from this routine. + + Module: + Utility + @*/ +int MPL_strncpy(char *dest, const char *src, size_t n) +{ + char *restrict d_ptr = dest; + const char *restrict s_ptr = src; + register int i; + + if (n == 0) + return 0; + + i = (int) n; + while (*s_ptr && i-- > 0) { + *d_ptr++ = *s_ptr++; + } + + if (i > 0) { + *d_ptr = 0; + return 0; + } else { + /* Force a null at the end of the string (gives better safety + * in case the user fails to check the error code) */ + dest[n - 1] = 0; + /* We may want to force an error message here, at least in the + * debugging version */ + /*printf("failure in copying %s with length %d\n", src, n); */ + return 1; + } +} + +/* replacement for strsep. Conforms to the following description (from the OS X + * 10.6 man page): + * + * The strsep() function locates, in the string referenced by *stringp, the first occur- + * rence of any character in the string delim (or the terminating `\0' character) and + * replaces it with a `\0'. The location of the next character after the delimiter + * character (or NULL, if the end of the string was reached) is stored in *stringp. The + * original value of *stringp is returned. + * + * An ``empty'' field (i.e., a character in the string delim occurs as the first charac- + * ter of *stringp) can be detected by comparing the location referenced by the returned + * pointer to `\0'. + * + * If *stringp is initially NULL, strsep() returns NULL. + */ +char *MPL_strsep(char **stringp, const char *delim) +{ + int i, j; + char *ret; + + if (!*stringp) + return NULL; + + ret = *stringp; + i = 0; + while (1) { + if (!ret[i]) { + *stringp = NULL; + return ret; + } + for (j = 0; delim[j] != '\0'; ++j) { + if (ret[i] == delim[j]) { + ret[i] = '\0'; + *stringp = &ret[i + 1]; + return ret; + } + } + ++i; + } +} + + +/* there's no standard portable way to convert error codes to human readable + * strings. The standard way to do that is via strerror() but if for some + * resason we don't have it, then we'll merely output the error code seen */ +#if !defined MPL_HAVE_STRERROR +char *MPL_strerror(int errnum) +{ +#define STRERROR_SIZE 256 + static char msgbuf[STRERROR_SIZE]; + snprintf(msgbuf, STRERROR_SIZE, "errno = %d", errnum); +#undef STRERROR_SIZE + return msgbuf; +} +#endif /* MPL_HAVE_STRERROR */ + +/*@ MPL_strnapp - Append to a string with a maximum length + +Input Parameters: ++ instr - String to copy +- maxlen - Maximum total length of 'outstr' + +Output Parameters: +. outstr - String to copy into + + Notes: + This routine is similar to 'strncat' except that the 'maxlen' argument + is the maximum total length of 'outstr', rather than the maximum + number of characters to move from 'instr'. Thus, this routine is + easier to use when the declared size of 'instr' is known. + + Module: + Utility + @*/ +int MPL_strnapp(char *dest, const char *src, size_t n) +{ + char *restrict d_ptr = dest; + const char *restrict s_ptr = src; + register int i; + + /* Get to the end of dest */ + i = (int) n; + while (i-- > 0 && *d_ptr) + d_ptr++; + if (i <= 0) + return 1; + + /* Append. d_ptr points at first null and i is remaining space. */ + while (*s_ptr && i-- > 0) { + *d_ptr++ = *s_ptr++; + } + + /* We allow i >= (not just >) here because the first while decrements + * i by one more than there are characters, leaving room for the null */ + if (i >= 0) { + *d_ptr = 0; + return 0; + } else { + /* Force the null at the end */ + *--d_ptr = 0; + + /* We may want to force an error message here, at least in the + * debugging version */ + return 1; + } +} + +static unsigned int xorshift_rand(void) +{ + /* time returns long; keep the lower and most significant 32 bits */ + unsigned int val = time(NULL) & 0xffffffff; + + /* Marsaglia's xorshift random number generator */ + val ^= val << 13; + val ^= val >> 17; + val ^= val << 5; + + return val; +} + +/*@ MPL_create_pathname - Generate a random pathname + +Input Parameters: ++ dirname - String containing the path of the parent dir (current dir if NULL) ++ prefix - String containing the prefix of the generated name +- is_dir - Boolean to tell if the path should be treated as a directory + +Output Parameters: +. dest_filename - String to copy the generated path name + + Notes: + dest_filename should point to a preallocated buffer of PATH_MAX size. + + Module: + Utility + @*/ +void MPL_create_pathname(char *dest_filename, const char *dirname, + const char *prefix, const int is_dir) +{ + /* Generate a random number which doesn't interfere with user application */ + const unsigned int rdm = xorshift_rand(); + const unsigned int pid = (unsigned int) getpid(); + + if (dirname) { + MPL_snprintf(dest_filename, PATH_MAX, "%s/%s.%u.%u%c", dirname, prefix, + rdm, pid, is_dir ? '/' : '\0'); + } else { + MPL_snprintf(dest_filename, PATH_MAX, "%s.%u.%u%c", prefix, rdm, pid, is_dir ? '/' : '\0'); + } +} diff --git a/3rd-party/romio341/mpl/src/thread/Makefile.mk b/3rd-party/romio341/mpl/src/thread/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..d1893fc0a30345fa8268930ab2d8bb641ca10d1b --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/Makefile.mk @@ -0,0 +1,12 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +lib@MPLLIBNAME@_la_SOURCES += \ + src/thread/mpl_thread.c \ + src/thread/mpl_thread_win.c \ + src/thread/mpl_thread_solaris.c \ + src/thread/mpl_thread_argobots.c \ + src/thread/mpl_thread_posix.c \ + src/thread/mpl_thread_uti.c diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread.c b/3rd-party/romio341/mpl/src/thread/mpl_thread.c new file mode 100644 index 0000000000000000000000000000000000000000..3216cd2a85319fc67b304c9d4192bdf994cfaccc --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread.c @@ -0,0 +1,18 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +#if (MPL_THREAD_PACKAGE_NAME != MPL_THREAD_PACKAGE_NONE) && !defined(MPL_TLS) + +/* This routine is called when a thread exits; it is passed the value + * associated with the key. In our case, this is simply storage + * allocated with MPL_calloc */ +void MPLI_cleanup_tls(void *a) +{ + MPL_free(a); +} + +#endif diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread_argobots.c b/3rd-party/romio341/mpl/src/thread/mpl_thread_argobots.c new file mode 100644 index 0000000000000000000000000000000000000000..d9a03dfb4f61fd3c7f943d8f8eed1c7b86cf1bf5 --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread_argobots.c @@ -0,0 +1,21 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* common header includes */ +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if defined(MPL_THREAD_PACKAGE_NAME) && (MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_ARGOBOTS) +/* begin argobots impl */ + +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp) +{ + /* not used */ + return; +} + +/* end argobots impl */ +#endif diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread_posix.c b/3rd-party/romio341/mpl/src/thread/mpl_thread_posix.c new file mode 100644 index 0000000000000000000000000000000000000000..51359ac7a53884a8bd2e6a41e835a70c0a3f47d5 --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread_posix.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +/* This file currently implements these as a preprocessor if/elif/else sequence. + * This has the upside of not doing #includes for .c files or (poorly + * named) .i files. It has the downside of making this file large-ish + * and a little harder to read in some cases. If this becomes + * unmanagable at some point these should be separated back out into + * header files and included as needed. [goodell@ 2009-06-24] */ + +/* Implementation specific function definitions (usually in the form of macros) */ +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_POSIX + +/* + * struct MPLI_thread_info + * + * Structure used to pass the user function and data to the intermediate + * function, MPLI_thread_start. See comment in + * MPLI_thread_start() header for more information. + */ +struct MPLI_thread_info { + MPL_thread_func_t func; + void *data; +}; + + +void *MPLI_thread_start(void *arg); + + +/* + * MPL_thread_create() + */ +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp) +{ + struct MPLI_thread_info *thread_info; + int err = MPL_SUCCESS; + + /* FIXME: faster allocation, or avoid it all together? */ + thread_info = + (struct MPLI_thread_info *) MPL_malloc(sizeof(struct MPLI_thread_info), MPL_MEM_THREAD); + if (thread_info != NULL) { + + thread_info->func = func; + thread_info->data = data; + + err = pthread_create(idp, NULL, MPLI_thread_start, thread_info); + /* FIXME: convert error to an MPL_THREAD_ERR value */ + } else { + err = 1000000000; + } + + if (errp != NULL) { + *errp = err; + } +} + + +/* + * MPLI_thread_start() + * + * Start functions in pthreads are expected to return a void pointer. Since + * our start functions do not return a value we must + * use an intermediate function to perform call to the user's start function + * and then return a value of NULL. + */ +void *MPLI_thread_start(void *arg) +{ + struct MPLI_thread_info *thread_info = (struct MPLI_thread_info *) arg; + MPL_thread_func_t func = thread_info->func; + void *data = thread_info->data; + + MPL_free(arg); + + func(data); + + return NULL; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread_solaris.c b/3rd-party/romio341/mpl/src/thread/mpl_thread_solaris.c new file mode 100644 index 0000000000000000000000000000000000000000..d5a78c7f8404e800c2b1ecb13eb93ce5c30c4d36 --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread_solaris.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +/* This file currently implements these as a preprocessor if/elif/else sequence. + * This has the upside of not doing #includes for .c files or (poorly + * named) .i files. It has the downside of making this file large-ish + * and a little harder to read in some cases. If this becomes + * unmanagable at some point these should be separated back out into + * header files and included as needed. [goodell@ 2009-06-24] */ + +/* Implementation specific function definitions (usually in the form of macros) */ + +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_SOLARIS + +/* + * struct MPLI_thread_info + * + * Structure used to pass the user function and data to the intermediate function, MPLI_thread_start. See comment in + * MPLI_thread_start() header for more information. + */ +struct MPLI_thread_info { + MPL_thread_func_t func; + void *data; +}; + + +void *MPLI_thread_start(void *arg); + + +/* + * MPL_thread_create() + */ +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp) +{ + struct MPLI_thread_info *thread_info; + int err = MPL_SUCCESS; + + /* FIXME: faster allocation, or avoid it all together? */ + thread_info = + (struct MPLI_thread_info *) MPL_malloc(sizeof(struct MPLI_thread_info), MPL_MEM_THREAD); + if (thread_info != NULL) { + thread_info->func = func; + thread_info->data = data; + + err = thr_create(NULL, 0, MPLI_thread_start, thread_info, THR_DETACHED, idp); + /* FIXME: convert error to an MPL_THREAD_ERR value */ + } else { + err = 1000000000; + } + + if (errp != NULL) { + *errp = err; + } +} + + +/* + * MPLI_thread_start() + * + * Start functions in Solaris threads are expected to return a void pointer. Since our start functions do not return a value we + * must use an intermediate function to perform call to the user's start function and then return a value of NULL. + */ +void *MPLI_thread_start(void *arg) +{ + struct MPLI_thread_info *thread_info = (struct MPLI_thread_info *) arg; + MPL_thread_func_t func = thread_info->func; + void *data = thread_info->data; + + MPL_free(arg); + + func(data); + + return NULL; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread_uti.c b/3rd-party/romio341/mpl/src/thread/mpl_thread_uti.c new file mode 100644 index 0000000000000000000000000000000000000000..ed07912d8935173a84c5c06b219da34ffc79e0f6 --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread_uti.c @@ -0,0 +1,115 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +/* This file currently implements these as a preprocessor if/elif/else sequence. + * This has the upside of not doing #includes for .c files or (poorly + * named) .i files. It has the downside of making this file large-ish + * and a little harder to read in some cases. If this becomes + * unmanagable at some point these should be separated back out into + * header files and included as needed. [goodell@ 2009-06-24] */ + +/* Implementation specific function definitions (usually in the form of macros) */ +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_UTI + +#include "uti.h" + +/* + * struct MPLI_thread_info + * + * Structure used to pass the user function and data to the intermediate + * function, MPLI_thread_start. See comment in + * MPLI_thread_start() header for more information. + */ +struct MPLI_thread_info { + MPL_thread_func_t func; + void *data; +}; + + +void *MPLI_thread_start(void *arg); + + +/* + * MPL_thread_create() + */ +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp) +{ + struct MPLI_thread_info *thread_info; + int err = MPL_SUCCESS; + + /* FIXME: faster allocation, or avoid it all together? */ + thread_info = + (struct MPLI_thread_info *) MPL_malloc(sizeof(struct MPLI_thread_info), MPL_MEM_THREAD); + + if (thread_info == NULL) { + err = 1000000000; + goto uti_exit; + } + + thread_info->func = func; + thread_info->data = data; + + uti_attr_t uti_attr; + err = uti_attr_init(&uti_attr); + if (err) { + goto uti_exit; + } + + /* Give a hint that it's beneficial to put the thread + * on the same NUMA-node as the creator */ + err = UTI_ATTR_SAME_NUMA_DOMAIN(&uti_attr); + if (err) { + goto uti_destroy_and_exit; + } + + /* Give a hint that the thread repeatedly monitors a device + * using CPU. */ + err = UTI_ATTR_CPU_INTENSIVE(&uti_attr); + if (err) { + goto uti_destroy_and_exit; + } + + err = uti_pthread_create(idp, NULL, MPLI_thread_start, thread_info, &uti_attr); + if (err) { + goto uti_destroy_and_exit; + } + + uti_exit: + if (errp != NULL) { + *errp = err; + } + return; + uti_destroy_and_exit: + err = uti_attr_destroy(&uti_attr); + goto uti_exit; +} + + +/* + * MPLI_thread_start() + * + * Start functions in pthreads are expected to return a void pointer. Since + * our start functions do not return a value we must + * use an intermediate function to perform call to the user's start function + * and then return a value of NULL. + */ +void *MPLI_thread_start(void *arg) +{ + struct MPLI_thread_info *thread_info = (struct MPLI_thread_info *) arg; + MPL_thread_func_t func = thread_info->func; + void *data = thread_info->data; + + MPL_free(arg); + + func(data); + + return NULL; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/thread/mpl_thread_win.c b/3rd-party/romio341/mpl/src/thread/mpl_thread_win.c new file mode 100644 index 0000000000000000000000000000000000000000..d02fedf87aa153c83452a7c8597c091136a8a6be --- /dev/null +++ b/3rd-party/romio341/mpl/src/thread/mpl_thread_win.c @@ -0,0 +1,352 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +/* This file currently implements these as a preprocessor if/elif/else sequence. + * This has the upside of not doing #includes for .c files or (poorly + * named) .i files. It has the downside of making this file large-ish + * and a little harder to read in some cases. If this becomes + * unmanagable at some point these should be separated back out into + * header files and included as needed. [goodell@ 2009-06-24] */ + +/* Implementation specific function definitions (usually in the form of macros) */ + +#if MPL_THREAD_PACKAGE_NAME == MPL_THREAD_PACKAGE_WIN + +/* + * struct MPLI_thread_info + * + * Structure used to pass the user function and data to the intermediate function, MPLI_thread_start. See comment in + * MPLI_thread_start() header for more information. + */ +struct MPLI_thread_info { + MPL_thread_func_t func; + void *data; +}; + + +DWORD WINAPI MPLI_thread_start(LPVOID arg); + +/* + * MPL_thread_create() + */ +void MPL_thread_create(MPL_thread_func_t func, void *data, MPL_thread_id_t * idp, int *errp) +{ + struct MPLI_thread_info *thread_info; + int err = MPL_SUCCESS; + + thread_info = + (struct MPLI_thread_info *) MPL_malloc(sizeof(struct MPLI_thread_info), MPL_MEM_THREAD); + if (thread_info != NULL) { + thread_info->func = func; + thread_info->data = data; + *idp = CreateThread(NULL, 0, MPLI_thread_start, thread_info, 0, NULL); + if (*idp == NULL) { + err = GetLastError(); + } + } else { + err = 1000000000; + } + + if (errp != NULL) { + *errp = err; + } +} + + +/* + * MPLI_thread_start() + * + * Start functions in Windows are expected to return a DWORD. Since our start functions do not return a value we must + * use an intermediate function to perform the call to the user's start function and then return a value of 0. + */ +DWORD WINAPI MPLI_thread_start(LPVOID arg) +{ + struct MPLI_thread_info *thread_info = (struct MPLI_thread_info *) arg; + MPL_thread_func_t func = thread_info->func; + void *data = thread_info->data; + + MPL_free(arg); + + func(data); + + return 0; +} + +void MPL_thread_exit() +{ + ExitThread(0); +} + +void MPL_thread_self(MPL_thread_id_t * id) +{ + *id = GetCurrentThread(); +} + +void MPL_thread_join(MPL_thread_id_t * id) +{ + WaitForSingleObject(id, INFINITE); +} + +void MPL_thread_same(MPL_thread_id_t * id1, MPL_thread_id_t * id2, int *same) +{ + *same = (*id1 == *id2) ? TRUE : FALSE; +} + +void MPL_thread_yield(void) +{ + Sleep(0); +} + +/* + * Mutexes + */ + +void MPL_thread_mutex_create(MPL_thread_mutex_t * mutex, int *err) +{ + *mutex = CreateMutex(NULL, FALSE, NULL); + if (err != NULL) { + if (*mutex == NULL) { + *err = GetLastError(); + } else { + *err = MPL_SUCCESS; + } + } +} + +void MPL_thread_mutex_destroy(MPL_thread_mutex_t * mutex, int *err) +{ + BOOL result; + + result = CloseHandle(*mutex); + if (err != NULL) { + if (result) { + *err = MPL_SUCCESS; + } else { + *err = GetLastError(); + } + } +} + +void MPL_thread_mutex_lock(MPL_thread_mutex_t * mutex, int *err, int prio __attribute__ ((unused))) +{ + DWORD result; + + result = WaitForSingleObject(*mutex, INFINITE); + if (err != NULL) { + if (result == WAIT_OBJECT_0) { + *err = MPL_SUCCESS; + } else { + if (result == WAIT_FAILED) { + *err = GetLastError(); + } else { + *err = result; + } + } + } +} + +void MPL_thread_mutex_unlock(MPL_thread_mutex_t * mutex, int *err) +{ + BOOL result; + + result = ReleaseMutex(*mutex); + if (err != NULL) { + if (result) { + *err = MPL_SUCCESS; + } else { + *err = GetLastError(); + } + } +} + + +/* + * Condition Variables + */ + +void MPL_thread_cond_create(MPL_thread_cond_t * cond, int *err) +{ + /* Create a tls slot to store the events used to wakeup each thread in cond_bcast or cond_signal */ + MPL_thread_tls_create(NULL, &cond->tls, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + /* Create a mutex to protect the fifo queue. This is required because the mutex passed in to the + * cond functions need not be the same in each thread. */ + MPL_thread_mutex_create(&cond->fifo_mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + cond->fifo_head = NULL; + cond->fifo_tail = NULL; + if (err != NULL) { + *err = MPL_SUCCESS; + } +} + +void MPL_thread_cond_destroy(MPL_thread_cond_t * cond, int *err) +{ + MPLI_win_thread_cond_fifo_t *iter; + + while (cond->fifo_head) { + iter = cond->fifo_head; + cond->fifo_head = cond->fifo_head->next; + MPL_free(iter); + } + MPL_thread_mutex_destroy(&cond->fifo_mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + MPL_thread_tls_destroy(&cond->tls, err); + /* + * if (err != NULL) + * { + * *err = MPL_SUCCESS; + * } + */ +} + +void MPL_thread_cond_wait(MPL_thread_cond_t * cond, MPL_thread_mutex_t * mutex, int *err) +{ + HANDLE event; + DWORD result; + MPL_thread_tls_get(&cond->tls, &event, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + if (event == NULL) { + event = CreateEvent(NULL, TRUE, FALSE, NULL); + if (event == NULL) { + if (err != NULL) { + *err = GetLastError(); + } + return; + } + MPL_thread_tls_set(&cond->tls, event, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + } + MPL_thread_mutex_lock(&cond->fifo_mutex, err, MPL_THREAD_PRIO_HIGH); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + if (cond->fifo_tail == NULL) { + cond->fifo_tail = + (MPLI_win_thread_cond_fifo_t *) MPL_malloc(sizeof(MPLI_win_thread_cond_fifo_t), + MPL_MEM_THREAD); + cond->fifo_head = cond->fifo_tail; + } else { + cond->fifo_tail->next = + (MPLI_win_thread_cond_fifo_t *) MPL_malloc(sizeof(MPLI_win_thread_cond_fifo_t), + MPL_MEM_THREAD); + cond->fifo_tail = cond->fifo_tail->next; + } + if (cond->fifo_tail == NULL) { + if (err != NULL) { + *err = -1; + } + return; + } + cond->fifo_tail->event = event; + cond->fifo_tail->next = NULL; + MPL_thread_mutex_unlock(&cond->fifo_mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + MPL_thread_mutex_unlock(mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + result = WaitForSingleObject(event, INFINITE); + if (err != NULL) { + if (result != WAIT_OBJECT_0) { + if (result == WAIT_FAILED) { + *err = GetLastError(); + } else { + *err = result; + } + return; + } + } + result = ResetEvent(event); + if (!result && err != NULL) { + *err = GetLastError(); + return; + } + MPL_thread_mutex_lock(mutex, err, MPL_THREAD_PRIO_HIGH); + /* + * if (err != NULL) + * { + * *err = MPL_SUCCESS; + * } + */ +} + +void MPL_thread_cond_broadcast(MPL_thread_cond_t * cond, int *err) +{ + MPLI_win_thread_cond_fifo_t *fifo, *temp; + MPL_thread_mutex_lock(&cond->fifo_mutex, err, MPL_THREAD_PRIO_HIGH); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + /* remove the fifo queue from the cond variable */ + fifo = cond->fifo_head; + cond->fifo_head = cond->fifo_tail = NULL; + MPL_thread_mutex_unlock(&cond->fifo_mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + /* signal each event in the fifo queue */ + while (fifo) { + if (!SetEvent(fifo->event) && err != NULL) { + *err = GetLastError(); + /* lost memory */ + return; + } + temp = fifo; + fifo = fifo->next; + MPL_free(temp); + } + if (err != NULL) { + *err = MPL_SUCCESS; + } +} + +void MPL_thread_cond_signal(MPL_thread_cond_t * cond, int *err) +{ + MPLI_win_thread_cond_fifo_t *fifo; + MPL_thread_mutex_lock(&cond->fifo_mutex, err, MPL_THREAD_PRIO_HIGH); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + fifo = cond->fifo_head; + if (fifo) { + cond->fifo_head = cond->fifo_head->next; + if (cond->fifo_head == NULL) + cond->fifo_tail = NULL; + } + MPL_thread_mutex_unlock(&cond->fifo_mutex, err); + if (err != NULL && *err != MPL_SUCCESS) { + return; + } + if (fifo) { + if (!SetEvent(fifo->event) && err != NULL) { + *err = GetLastError(); + MPL_free(fifo); + return; + } + MPL_free(fifo); + } + if (err != NULL) { + *err = MPL_SUCCESS; + } +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/Makefile.mk b/3rd-party/romio341/mpl/src/timer/Makefile.mk new file mode 100644 index 0000000000000000000000000000000000000000..919241a44605c54343a4c8edff3aec2e54068e7d --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/Makefile.mk @@ -0,0 +1,15 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +noinst_HEADERS += src/timer/mpl_timer_common.h + +lib@MPLLIBNAME@_la_SOURCES += \ + src/timer/mpl_timer_clock_gettime.c \ + src/timer/mpl_timer_gcc_ia64_cycle.c \ + src/timer/mpl_timer_gethrtime.c \ + src/timer/mpl_timer_gettimeofday.c \ + src/timer/mpl_timer_linux86_cycle.c \ + src/timer/mpl_timer_ppc64_cycle.c \ + src/timer/mpl_timer_mach_absolute_time.c diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_clock_gettime.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_clock_gettime.c new file mode 100644 index 0000000000000000000000000000000000000000..3a5cc6ba5d0bd90ca9423b43ed54875a702719a1 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_clock_gettime.c @@ -0,0 +1,96 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__CLOCK_GETTIME + +#include "mpl_timer_common.h" +static time_t time_epoch; +static int is_initialized = 0; + +int MPL_wtime(MPL_time_t * timeval) +{ + clock_gettime(CLOCK_REALTIME, timeval); + + return MPL_SUCCESS; +} + +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = ((double) (t2->tv_sec - t1->tv_sec) + 1.0e-9 * (double) (t2->tv_nsec - t1->tv_nsec)); + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) t->tv_nsec; + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + *val = ((double) (t->tv_sec - time_epoch) + 1.0e-9 * (double) (t->tv_nsec)); + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + long nsec, sec; + + nsec = t2->tv_nsec - t1->tv_nsec; + sec = t2->tv_sec - t1->tv_sec; + + t3->tv_sec += sec; + t3->tv_nsec += nsec; + while (t3->tv_nsec > 1000000000) { + t3->tv_nsec -= 1000000000; + t3->tv_sec++; + } + + return MPL_SUCCESS; +} + +int MPL_wtick(double *wtick) +{ + struct timespec res; + int rc; + + /* May return -1 for unimplemented. If not implemented (POSIX + * allows that), then we need to return the generic tick value. */ + rc = clock_getres(CLOCK_REALTIME, &res); + if (!rc) + *wtick = res.tv_sec + 1.0e-9 * res.tv_nsec; + else + *wtick = tickval; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + if (is_initialized) + goto fn_exit; + + /* set a closer time_epoch so MPL_wtime_todouble retain ns resolution */ + /* time across process are still relavant within 1 hour */ + MPL_time_t t; + MPL_wtime(&t); + time_epoch = t.tv_sec - t.tv_sec % (3600); + + init_wtick(); + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_common.h b/3rd-party/romio341/mpl/src/timer/mpl_timer_common.h new file mode 100644 index 0000000000000000000000000000000000000000..ae7b3ee864de3fd98167e5eae37acd2160f03ea8 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_common.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef MPL_TIMER_COMMON_H_INCLUDED +#define MPL_TIMER_COMMON_H_INCLUDED + +#include "mpl_timer.h" + +static double tickval = -1.0; + +/* + * For timers that do not have defined resolutions, compute the resolution + * by sampling the clock itself. + * + */ +static void init_wtick(void) +{ + double timediff; + MPL_time_t t1, t2; + int cnt; + int icnt; + + tickval = 1.0e6; + for (icnt = 0; icnt < 10; icnt++) { + cnt = 1000; + MPL_wtime(&t1); + do { + MPL_wtime(&t2); + MPL_wtime_diff(&t1, &t2, &timediff); + if (timediff > 0) + break; + } + while (cnt--); + if (cnt && timediff > 0.0 && timediff < tickval) { + MPL_wtime_diff(&t1, &t2, &tickval); + } + } +} + +#endif /* MPL_TIMER_COMMON_H_INCLUDED */ diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c new file mode 100644 index 0000000000000000000000000000000000000000..c69ee213293a4b122d8f98deca43c9922b60d645 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_gcc_ia64_cycle.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__GCC_IA64_CYCLE + +#include <sys/time.h> + +static double seconds_per_tick = 0.0; +static int is_initialized = 0; + +int MPL_wtick(double *wtick) +{ + *wtick = seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + unsigned long long t1, t2; + struct timeval tv1, tv2; + double td1, td2; + + if (is_initialized) + goto fn_exit; + + gettimeofday(&tv1, NULL); + MPL_wtime(&t1); + usleep(250000); + gettimeofday(&tv2, NULL); + MPL_wtime(&t2); + + td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0; + td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0; + + seconds_per_tick = (td2 - td1) / (double) (t2 - t1); + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +/* Time stamps created by a macro */ +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = (double) (*t2 - *t1) * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + /* This returns the number of cycles as the "time". This isn't correct + * for implementing MPI_Wtime, but it does allow us to insert cycle + * counters into test programs */ + *val = (unsigned int) *t; + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + /* This returns the number of cycles as the "time". This isn't correct + * for implementing MPI_Wtime, but it does allow us to insert cycle + * counters into test programs */ + *val = (double) *t * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + *t3 += (*t2 - *t1); + + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_gethrtime.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_gethrtime.c new file mode 100644 index 0000000000000000000000000000000000000000..69c002c2fff9ea61126e4dedfd7723f2458abb00 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_gethrtime.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETHRTIME + +static int is_initialized = 0; + +/* + * MPL_time_t is hrtime_t, which under Solaris is defined as a 64bit + * longlong_t . However, the Solaris header files will define + * longlong_t as a structure in some circumstances, making arithmetic + * with hrtime_t invalid. FIXME. + * To fix this, we'll need to test hrtime_t arithmetic in the configure + * program, and if it fails, check for the Solaris defintions ( + * union { double _d; int32_t _l[2]; }. Alternately, we may decide that + * if hrtime_t is not supported, then neither is gethrtime. + * + * Note that the Solaris sys/types.h file *assumes* that no other compiler + * supports an 8 byte long long. We can also cast hrtime_t to long long + * if long long is available and 8 bytes. + */ +int MPL_wtime(MPL_time_t * timeval) +{ + *timeval = gethrtime(); + + return MPL_SUCCESS; +} + +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = 1.0e-9 * (double) (*t2 - *t1); + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) (*t & 0xffffffffUL); + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + *val = 1.0e-9 * (*t); + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + *t3 += ((*t2) - (*t1)); + + return MPL_SUCCESS; +} + +int MPL_wtick(double *wtick) +{ + /* According to the documentation, ticks should be in nanoseconds. This + * is untested */ + *wtick = 1.0e-9; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + if (is_initialized) + goto fn_exit; + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_gettimeofday.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_gettimeofday.c new file mode 100644 index 0000000000000000000000000000000000000000..3790f9b4d63054d9bd9f2b822b2119a0b32b9825 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_gettimeofday.c @@ -0,0 +1,88 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__GETTIMEOFDAY + +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include "mpl_timer_common.h" + +static int is_initialized = 0; + +int MPL_wtime(MPL_time_t * tval) +{ + gettimeofday(tval, NULL); + + return MPL_SUCCESS; +} + +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = ((double) (t2->tv_sec - t1->tv_sec) + .000001 * (double) (t2->tv_usec - t1->tv_usec)); + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) t->tv_usec; + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + *val = (double) t->tv_sec + .000001 * (double) t->tv_usec; + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + int usec, sec; + + usec = t2->tv_usec - t1->tv_usec; + sec = t2->tv_sec - t1->tv_sec; + t3->tv_usec += usec; + t3->tv_sec += sec; + /* Handle carry to the integer seconds field */ + while (t3->tv_usec > 1000000) { + t3->tv_usec -= 1000000; + t3->tv_sec++; + } + + return MPL_SUCCESS; +} + +int MPL_wtick(double *wtick) +{ + *wtick = tickval; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + if (is_initialized) + goto fn_exit; + + init_wtick(); + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_linux86_cycle.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_linux86_cycle.c new file mode 100644 index 0000000000000000000000000000000000000000..45cb449314883d01b406bc57de483b7876e25e70 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_linux86_cycle.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__LINUX86_CYCLE + +#include <sys/time.h> + +static double seconds_per_tick = 0.0; +static int is_initialized = 0; + +int MPL_wtick(double *wtick) +{ + *wtick = seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + MPL_time_t t1, t2; + struct timeval tv1, tv2; + double td1, td2; + + if (is_initialized) + goto fn_exit; + + gettimeofday(&tv1, NULL); + MPL_wtime(&t1); + usleep(250000); + gettimeofday(&tv2, NULL); + MPL_wtime(&t2); + + td1 = tv1.tv_sec + tv1.tv_usec / 1000000.0; + td2 = tv2.tv_sec + tv2.tv_usec / 1000000.0; + + seconds_per_tick = (td2 - td1) / (double) (t2 - t1); + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +/* Time stamps created by a macro */ +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = (double) (*t2 - *t1) * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) (*t & 0xffffffffUL); + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + /* This returns the number of cycles as the "time". This isn't correct + * for implementing MPI_Wtime, but it does allow us to insert cycle + * counters into test programs */ + *val = (double) *t * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + *t3 += (*t2 - *t1); + + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_mach_absolute_time.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_mach_absolute_time.c new file mode 100644 index 0000000000000000000000000000000000000000..aa3f04473f0954d61fa0fac4a0c611d7a7ed6146 --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_mach_absolute_time.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__MACH_ABSOLUTE_TIME + +#include "mpl_timer_common.h" + +static double wtime_mult; +static int is_initialized = 0; + +int MPL_wtime_init(void) +{ + if (is_initialized) + goto fn_exit; + + mach_timebase_info_data_t info; + mach_timebase_info(&info); + wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom); + init_wtick(); + + is_initialized = 1; + + fn_exit: + return MPL_SUCCESS; +} + +int MPL_wtime(MPL_time_t * timeval) +{ + *timeval = mach_absolute_time(); + + return MPL_SUCCESS; +} + +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = (*t2 - *t1) * wtime_mult; + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) (*t & 0xffffffffUL); + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + *val = *t * wtime_mult; + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + *t3 += *t2 - *t1; + + return MPL_SUCCESS; +} + +int MPL_wtick(double *wtick) +{ + *wtick = tickval; + + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/src/timer/mpl_timer_ppc64_cycle.c b/3rd-party/romio341/mpl/src/timer/mpl_timer_ppc64_cycle.c new file mode 100644 index 0000000000000000000000000000000000000000..164a94912f003fa27a3a2196f00b218734d8b08b --- /dev/null +++ b/3rd-party/romio341/mpl/src/timer/mpl_timer_ppc64_cycle.c @@ -0,0 +1,135 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" + +MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING; + +#if MPL_TIMER_KIND == MPL_TIMER_KIND__PPC64_CYCLE + +#include <sys/time.h> + +static double seconds_per_tick = 0.0; +static uint64_t clockMHz = 0; +static int is_initialized = 0; + +static uint64_t timeGetTime(void) +{ + struct timeval tv; + gettimeofday(&tv, 0); + return tv.tv_sec * 1000000ULL + tv.tv_usec; +} + +static inline uint64_t getClockMHz() +{ + if (clockMHz == 0) { + uint64_t sampleTime = 100ULL; //sample time in usec + uint64_t timeStart = 0ULL, timeStop = 0ULL; + uint64_t startBase = 0ULL, endBase = 0ULL; + uint64_t overhead = 0ULL, tbf = 0ULL, tbi = 0ULL; + uint64_t ticks = 0ULL; + int iter = 0ULL; + + do { + tbi = tb(); + tbf = tb(); + tbi = tb(); + tbf = tb(); + + overhead = tbf - tbi; + timeStart = timeGetTime(); + + while (timeGetTime() == timeStart) + timeStart = timeGetTime(); + + while (1) { + timeStop = timeGetTime(); + + if ((timeStop - timeStart) > 1) { + startBase = tb(); + break; + } + } + + timeStart = timeStop; + + while (1) { + timeStop = timeGetTime(); + + if ((timeStop - timeStart) > sampleTime) { + endBase = tb(); + break; + } + } + + ticks = ((endBase - startBase) + (overhead)); + iter++; + + if (iter == 10ULL) { + fprintf(stderr, "Warning: unable to initialize high resolution timer.\n"); + return -1; + } + } + while (endBase <= startBase); + + return (uint64_t) (ticks / sampleTime); + } else + return clockMHz; +} + +int MPL_wtick(double *wtick) +{ + *wtick = seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_init(void) +{ + int rc = MPL_SUCCESS; + + if (is_initialized) + goto fn_exit; + + clockMHz = getClockMHz(); + seconds_per_tick = 1.0 / ((double) clockMHz * 1000000.0); + if (clockMHz == -1ULL) + rc = MPL_ERR_TIMER_NOT_INITIALIZED; + + is_initialized = 1; + + fn_exit: + return rc; +} + +int MPL_wtime_diff(MPL_time_t * t1, MPL_time_t * t2, double *diff) +{ + *diff = (double) (*t2 - *t1) * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_touint(MPL_time_t * t, unsigned int *val) +{ + *val = (unsigned int) (*t & 0xffffffffUL); + + return MPL_SUCCESS; +} + +int MPL_wtime_todouble(MPL_time_t * t, double *val) +{ + *val = (double) *t * seconds_per_tick; + + return MPL_SUCCESS; +} + +int MPL_wtime_acc(MPL_time_t * t1, MPL_time_t * t2, MPL_time_t * t3) +{ + *t3 += (*t2 - *t1); + + return MPL_SUCCESS; +} + +#endif diff --git a/3rd-party/romio341/mpl/test/strsep.c b/3rd-party/romio341/mpl/test/strsep.c new file mode 100644 index 0000000000000000000000000000000000000000..587e6834df9e93eef3ca4c93b8164d5229e330a6 --- /dev/null +++ b/3rd-party/romio341/mpl/test/strsep.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpl.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +int main(void) +{ + char *orig; + char *str; + char *next; + + str = NULL; + next = MPL_strsep(&str, "|"); + assert(next == NULL); + assert(str == NULL); + + orig = MPL_strdup(""); + str = orig; + next = MPL_strsep(&str, "|"); + assert(str == NULL); + assert(next == orig); + MPL_free(orig); + + orig = MPL_strdup("a|b|c"); + str = orig; + next = MPL_strsep(&str, "|"); + assert(next == orig); + assert(0 == strcmp(next, "a")); + next = MPL_strsep(&str, "|"); + assert(0 == strcmp(next, "b")); + next = MPL_strsep(&str, "|"); + assert(0 == strcmp(next, "c")); + next = MPL_strsep(&str, "|"); + assert(next == NULL); + assert(str == NULL); + MPL_free(orig); + + orig = MPL_strdup("a|b:c"); + str = orig; + next = MPL_strsep(&str, ":|"); + assert(next == orig); + assert(0 == strcmp(next, "a")); + next = MPL_strsep(&str, ":|"); + assert(0 == strcmp(next, "b")); + next = MPL_strsep(&str, ":|"); + assert(0 == strcmp(next, "c")); + next = MPL_strsep(&str, ":|"); + assert(next == NULL); + assert(str == NULL); + MPL_free(orig); + + orig = MPL_strdup("a|:b:c"); + str = orig; + next = MPL_strsep(&str, ":|"); + assert(next == orig); + assert(0 == strcmp(next, "a")); + next = MPL_strsep(&str, ":|"); + assert(0 == strcmp(next, "")); + next = MPL_strsep(&str, ":|"); + assert(0 == strcmp(next, "b")); + next = MPL_strsep(&str, ":|"); + assert(0 == strcmp(next, "c")); + next = MPL_strsep(&str, ":|"); + assert(next == NULL); + assert(str == NULL); + MPL_free(orig); + + return 0; +} diff --git a/3rd-party/romio321/test-internal/Makefile.am b/3rd-party/romio341/test-internal/Makefile.am similarity index 83% rename from 3rd-party/romio321/test-internal/Makefile.am rename to 3rd-party/romio341/test-internal/Makefile.am index ec7c7eb0ef5aaa57b071545acbbf498e5ff8188b..97a6f90fb9c2841cf9464bd6c01a0a3e019858a4 100644 --- a/3rd-party/romio321/test-internal/Makefile.am +++ b/3rd-party/romio341/test-internal/Makefile.am @@ -1,8 +1,7 @@ -# -*- Mode: Makefile; -*- -# -# (C) 2011 by Argonne National Laboratory. -# See COPYRIGHT in top-level directory. -# +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## # This directory is only listed in DIST_SUBDIRS, not SUBDIRS, so its contents # will not be built by default, but it will participate in "make distclean" and diff --git a/3rd-party/romio341/test-internal/file_realms_test.c b/3rd-party/romio341/test-internal/file_realms_test.c new file mode 100644 index 0000000000000000000000000000000000000000..8ea08f64d295d2a6ff2ee015bb2a809ad7bc11ee --- /dev/null +++ b/3rd-party/romio341/test-internal/file_realms_test.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "../adio/include/adio.h" +#include "../adio/include/adio_extern.h" +#include "mpi.h" + +int main(int argc, char **argv) +{ + int i; + ADIO_File fd; + ADIO_Offset min_st_offset, max_end_offset; + int rank; + int nprocs_for_coll; + int lb; + MPI_Count size, extent; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if (argc != 4) { + if (!rank) + printf("Usage: file_realms_test <number of aggregators> <lower bound> <upper bound>\n" + " simulates file_realm calculation\n"); + MPI_Finalize(); + return 1; + } + + nprocs_for_coll = atoi(argv[1]); + + min_st_offset = atoi(argv[2]); + max_end_offset = atoi(argv[3]); + + if (max_end_offset < min_st_offset) { + if (!rank) + printf("end offset %lld is less then start offset %lld\n", + max_end_offset, min_st_offset); + MPI_Finalize(); + return 1; + } + + printf("min_st_offset = %lld\nmax_end_offset = %lld\n", min_st_offset, max_end_offset); + + fd = (ADIO_File) ADIOI_Malloc(sizeof(struct ADIOI_FileD)); + fd->hints = (ADIOI_Hints *) + ADIOI_Malloc(sizeof(struct ADIOI_Hints_struct)); + fd->hints->cb_nodes = nprocs_for_coll; + ADIOI_Calc_file_realms(fd, min_st_offset, max_end_offset); + + for (i = 0; i < nprocs_for_coll; i++) { + printf("file_realm_st_offs[%d] = %lld\n", i, fd->file_realm_st_offs[i]); + } + for (i = 0; i < nprocs_for_coll; i++) { + MPI_Type_size_x(fd->file_realm_types[i], &size); + printf("file_realm [%d] size = %d\n", i, size); + } + for (i = 0; i < nprocs_for_coll; i++) { + MPI_Type_get_extent(fd->file_realm_types[i], &lb, &extent); + printf("file_realm [%d] extent = %d\n", i, extent); + } + + for (i = 0; i < nprocs_for_coll; i++) + MPI_Type_free(&fd->file_realm_types[i]); + ADIOI_Free(fd->file_realm_st_offs); + ADIOI_Free(fd->file_realm_types); + ADIOI_Free(fd->hints); + ADIOI_Free(fd); + + MPI_Finalize(); + + return 0; +} diff --git a/3rd-party/romio341/test-internal/heap_test.c b/3rd-party/romio341/test-internal/heap_test.c new file mode 100644 index 0000000000000000000000000000000000000000..2d72cfddf3e432db633b48eff948188c8a6023da --- /dev/null +++ b/3rd-party/romio341/test-internal/heap_test.c @@ -0,0 +1,443 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "../adio/include/heap_sort.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#define PREDEF_TESTS 2 +/* test types */ +#define ALL 0 +#define RANDOM -1 +#define CUSTOM -2 + +/* ACTIONS */ +#define BUILD 0 +#define INSERT 1 +#define EXTRACT 2 +#define EXTRACT_INSERT 3 + +typedef struct { + char name[64]; + int heap_size; + int print; + int verify; + int action_arr_sz; + int *action_arr; + int *action_count_arr; + ADIO_Offset *offsets; + ADIO_Offset *correct_order; +} test_params_t; + +void print_usage(); +void print_keys(ADIO_Offset * offsets, int size); +void print_params(test_params_t * params); +int run_test(test_params_t * test); +void fill_random_test(test_params_t * params); +void init_predefined_test(test_params_t * params, int index); +void dumb_sort(test_params_t * params); + +int main(int argc, char **argv) +{ + int i, print = 1, verify = 1; + int adding_elements; + int curr_add_idx; + int test_type = RANDOM; + test_params_t predefined_tests[PREDEF_TESTS]; + test_params_t test; + + /* parse args */ + adding_elements = 0; + curr_add_idx = 0; + if (argc == 1) { + print_usage(); + return 1; + } + i = 1; + while (i < argc) { + if (!strcmp("-A", argv[i])) { + adding_elements = 0; + test_type = ALL; + i++; + } else if (!strcmp("-T", argv[i])) { + adding_elements = 0; + test_type = atoi(argv[i + 1]); + i += 2; + } else if (!strcmp("-r", argv[i])) { + adding_elements = 0; + test.heap_size = atoi(argv[i + 1]); + if (test.heap_size <= 0) { + printf("heap size should be a positive integer\n"); + return 1; + } + test.offsets = (ADIO_Offset *) malloc(test.heap_size * sizeof(ADIO_Offset)); + test_type = RANDOM; + i += 2; + } else if (!strcmp("-e", argv[i])) { + test.heap_size = argc - 2; + if (test.heap_size <= 0) { + printf("need at least one key\n"); + return 1; + } + test.offsets = (ADIO_Offset *) malloc(test.heap_size * sizeof(ADIO_Offset)); + adding_elements = 1; + test_type = CUSTOM; + i++; + } else if (!strcmp("-v", argv[i])) { + verify = 1; + i++; + } else if (!strcmp("-p", argv[i])) { + print = 1; + i++; + } else if (!strcmp("-V", argv[i])) { + verify = 0; + i++; + } else if (!strcmp("-P", argv[i])) { + print = 0; + i++; + } else if (adding_elements) { + test.offsets[curr_add_idx] = atoi(argv[i]); + curr_add_idx++; + i++; + } else { + printf("Illegal argument: %s", argv[i]); + print_usage(); + return 1; + } + } + + if (test_type == RANDOM) { + fill_random_test(&test); + strcpy(test.name, "RANDOMIZED TEST"); + } else if (test_type == CUSTOM) + strcpy(test.name, "CUSTOM TEST"); + if ((test_type == CUSTOM) || (test_type == RANDOM)) { + test.print = print; + test.verify = verify; + test.action_arr_sz = 2; + test.action_arr = (int *) malloc(test.action_arr_sz * sizeof(int)); + test.action_count_arr = (int *) malloc(test.action_arr_sz * sizeof(int)); + /* build the entire heap */ + /* test.action_arr[0] = BUILD; + * test.action_count_arr[0] = 1; */ + /* insert keys one at a time */ + test.action_arr[0] = INSERT; + test.action_count_arr[0] = test.heap_size; + /* extract all the keys */ + test.action_arr[1] = EXTRACT; + test.action_count_arr[1] = test.heap_size; + + if (verify) { + test.correct_order = (ADIO_Offset *) malloc(test.heap_size * sizeof(ADIO_Offset)); + dumb_sort(&test); + } + if (print) + print_params(&test); + run_test(&test); + } else { + if (test_type == ALL) { + for (i = 0; i < PREDEF_TESTS; i++) { + predefined_tests[i].print = print; + predefined_tests[i].verify = verify; + init_predefined_test(&predefined_tests[i], i); + if (print) + print_params(&test); + run_test(&predefined_tests[i]); + } + } else { + predefined_tests[test_type - 1].print = print; + predefined_tests[test_type - 1].verify = verify; + init_predefined_test(&predefined_tests[test_type - 1], test_type - 1); + if (print) + print_params(&predefined_tests[test_type - 1]); + run_test(&predefined_tests[test_type - 1]); + } + } + + return 0; +} + +void print_usage() +{ + printf("Usage: test <options>\n" + " -r <size> Create a random test and verify of size <size>\n" + " -e <keys> test with the space delimited list of keys\n" + " -p print parameters and keys (default)\n" + " -P do not print parameters and keys\n" + " -v verify keys (default)\n" " -V do not verify keys\n"); +} + +void print_keys(ADIO_Offset * offsets, int size) +{ + int i; + for (i = 0; i < size; i++) + printf("%lld ", offsets[i]); +} + +void print_params(test_params_t * params) +{ + int i; + static char action_map[3][8] = { "BUILD", "INSERT", "EXTRACT" }; + + printf("----------------Test Parameters---------------\n"); + printf("Actions:\n"); + for (i = 0; i < params->action_arr_sz; i++) { + printf("%sx%d\n", action_map[params->action_arr[i]], params->action_count_arr[i]); + } + + printf("Initial order :\n"); + print_keys(params->offsets, params->heap_size); + printf("\n"); + + if (params->verify) { + printf("Expected order:\n"); + print_keys(params->correct_order, params->heap_size); + printf("\n"); + } + printf("----------------------------------------------\n"); +} + +void fill_random_test(test_params_t * params) +{ + int i; + int max_key; + time_t seed; + int order = 0; + + time(&seed); + srand(seed); + + order = 0; + max_key = 1; + while (order < 25) { + max_key *= 10; + if (!((int) (params->heap_size / max_key))) + break; + order++; + } + for (i = 0; i < params->heap_size; i++) + params->offsets[i] = (rand() % max_key); +} + +void dumb_sort(test_params_t * params) +{ + ADIO_Offset *offsets, tmp_offset; + int i, j; + + offsets = params->correct_order; + memcpy(offsets, params->offsets, params->heap_size * sizeof(ADIO_Offset)); + for (i = 0; i < params->heap_size; i++) { + for (j = i; j < params->heap_size; j++) { + if (offsets[j] < offsets[i]) { + tmp_offset = offsets[i]; + offsets[i] = offsets[j]; + offsets[j] = tmp_offset; + } + } + } +} + +int run_test(test_params_t * test) +{ + heap_t myheap; + ADIO_Offset *extracted; + int stored_proc; + ADIO_Offset stored_reg_max_len; + int i, j, k, err_flag = 0; + int curr_insert_idx = 0; + int curr_extract_idx = 0; + + create_heap(&myheap, test->heap_size); + myheap.size = 0; + + extracted = (ADIO_Offset *) malloc(test->heap_size * sizeof(ADIO_Offset)); + for (i = 0; i < test->action_arr_sz; i++) { + for (j = 0; j < test->action_count_arr[i]; j++) { + switch (test->action_arr[i]) { + case BUILD: + myheap.size = test->heap_size; + for (k = 0; k < test->heap_size; k++) { + myheap.nodes[k].offset = test->offsets[k]; + myheap.nodes[k].proc = k; + } + build_heap(&myheap); + break; + case INSERT: + ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], + curr_insert_idx, curr_insert_idx); + curr_insert_idx++; + break; + case EXTRACT: + heap_extract_min(&myheap, &extracted[curr_extract_idx], + &stored_proc, &stored_reg_max_len); + if (test->verify && (extracted[curr_extract_idx] != + test->correct_order[curr_extract_idx])) + err_flag++; + curr_extract_idx++; + break; + case EXTRACT_INSERT: + heap_extract_min(&myheap, &extracted[curr_extract_idx], + &stored_proc, &stored_reg_max_len); + if (test->verify && (extracted[curr_extract_idx] != + test->correct_order[curr_extract_idx])) + err_flag++; + curr_extract_idx++; + + ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], + curr_insert_idx, curr_insert_idx); + curr_insert_idx++; + break; + default: + break; + } + } + } + + if (test->verify) { + if (err_flag) { + printf("***%s FAILED***\n", test->name); + if (test->print) { + printf("Min extraction:\n"); + print_keys(extracted, test->heap_size); + printf("\n"); + } + } else + printf("***%s PASSED***\n", test->name); + } + + free_heap(&myheap); + free(extracted); + /* clean up test params */ + free(test->offsets); + if (test->verify) + free(test->correct_order); + free(test->action_arr); + free(test->action_count_arr); + + return err_flag; +} + +void init_predefined_test(test_params_t * params, int index) +{ + + switch (index) { + case 0: + strcpy(params->name, "TEST 1"); + params->heap_size = 15; + params->action_arr_sz = 3; + + /* allocate space */ + params->action_arr = (int *) malloc(params->action_arr_sz * sizeof(int)); + params->action_count_arr = (int *) malloc(params->action_arr_sz * sizeof(int)); + params->offsets = (ADIO_Offset *) malloc(params->heap_size * sizeof(ADIO_Offset)); + if (params->verify) + params->correct_order = + (ADIO_Offset *) malloc(params->heap_size * sizeof(ADIO_Offset)); + + /* Set procs */ + params->offsets[0] = 65; + params->offsets[1] = 53; + params->offsets[2] = 51; + params->offsets[3] = 74; + params->offsets[4] = 1; + params->offsets[5] = 3; + params->offsets[6] = 86; + params->offsets[7] = 82; + params->offsets[8] = 42; + params->offsets[9] = 62; + params->offsets[10] = 33; + params->offsets[11] = 12; + params->offsets[12] = 79; + params->offsets[13] = 13; + params->offsets[14] = 28; + + if (params->verify) { + params->correct_order[0] = 1; + params->correct_order[1] = 3; + params->correct_order[2] = 12; + params->correct_order[3] = 33; + params->correct_order[4] = 13; + params->correct_order[5] = 28; + params->correct_order[6] = 42; + params->correct_order[7] = 51; + params->correct_order[8] = 53; + params->correct_order[9] = 62; + params->correct_order[10] = 65; + params->correct_order[11] = 74; + params->correct_order[12] = 79; + params->correct_order[13] = 82; + params->correct_order[14] = 86; + } + + params->action_arr[0] = INSERT; + params->action_arr[1] = EXTRACT_INSERT; + params->action_arr[11] = EXTRACT; + + params->action_count_arr[0] = 10; + params->action_count_arr[1] = 5; + params->action_count_arr[11] = 10; + break; + case 1: + strcpy(params->name, "TEST 1"); + params->heap_size = 15; + params->action_arr_sz = 3; + + /* allocate space */ + params->action_arr = (int *) malloc(params->action_arr_sz * sizeof(int)); + params->action_count_arr = (int *) malloc(params->action_arr_sz * sizeof(int)); + params->offsets = (ADIO_Offset *) malloc(params->heap_size * sizeof(ADIO_Offset)); + if (params->verify) + params->correct_order = + (ADIO_Offset *) malloc(params->heap_size * sizeof(ADIO_Offset)); + + /* Set values */ + params->offsets[0] = 65; + params->offsets[1] = 53; + params->offsets[2] = 51; + params->offsets[3] = 74; + params->offsets[4] = 1; + params->offsets[5] = 3; + params->offsets[6] = 86; + params->offsets[7] = 82; + params->offsets[8] = 42; + params->offsets[9] = 62; + params->offsets[10] = 33; + params->offsets[11] = 12; + params->offsets[12] = 79; + params->offsets[13] = 13; + params->offsets[14] = 28; + + if (params->verify) { + params->correct_order[0] = 1; + params->correct_order[1] = 3; + params->correct_order[2] = 12; + params->correct_order[3] = 33; + params->correct_order[4] = 13; + params->correct_order[5] = 28; + params->correct_order[6] = 42; + params->correct_order[7] = 51; + params->correct_order[8] = 53; + params->correct_order[9] = 62; + params->correct_order[10] = 65; + params->correct_order[11] = 74; + params->correct_order[12] = 79; + params->correct_order[13] = 82; + params->correct_order[14] = 86; + } + + params->action_arr[0] = INSERT; + params->action_arr[1] = EXTRACT_INSERT; + params->action_arr[11] = EXTRACT; + + params->action_count_arr[0] = 10; + params->action_count_arr[1] = 5; + params->action_count_arr[11] = 10; + break; + default: + break; + } +} diff --git a/3rd-party/romio341/test-internal/io_bounds_test.c b/3rd-party/romio341/test-internal/io_bounds_test.c new file mode 100644 index 0000000000000000000000000000000000000000..d49c4184a31d28f7fb2feb1239c9e22f56315bc7 --- /dev/null +++ b/3rd-party/romio341/test-internal/io_bounds_test.c @@ -0,0 +1,277 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "../adio/include/adio.h" +#include "../adio/include/adioi.h" +#include "../adio/include/adio_extern.h" +#include "mpi.h" + +#define PREDEF_TESTS 5 +#define MAX_OFF_LENS 4 + +typedef struct { + ADIO_Offset offset; + int count; + int type_blocklens[MAX_OFF_LENS]; + int type_indices[MAX_OFF_LENS]; + MPI_Datatype type_oldtypes[MAX_OFF_LENS]; + int type_count; + + ADIO_Offset correct_st_offset; + ADIO_Offset correct_end_offset; +} test_param_t; + +int run_test(test_param_t * test); +int setup_predefined(test_param_t * tests_arr, int count); +int print_usage(void); +int print_test_params(test_param_t * test); + +int main(int argc, char **argv) +{ + int rank; + int run_test_number = 0; + int failed; + int while_condition; + int i; + + test_param_t predefined_tests[PREDEF_TESTS]; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if (argc != 1) { + if (!rank) { + printf("Use only one process\n"); + print_usage(); + } + MPI_Finalize(); + return 1; + } + i = 1; + while (i < argc) { + if (!strcmp(argv[i], "-A")) { + run_test_number = 0; + i++; + } else if (!strcmp(argv[i], "-T")) { + run_test_number = atoi(argv[i + 1]); + if ((run_test_number > PREDEF_TESTS) || (run_test_number < 1)) { + if (!rank) + printf("Invalid test number, only %d tests\n", PREDEF_TESTS); + MPI_Finalize(); + return 1; + } + i += 2; + } else { + if (!rank) { + printf("Invalid Argument: %s\n", argv[i]); + print_usage(); + } + i++; + } + } + + setup_predefined(predefined_tests, PREDEF_TESTS); + + if (!run_test_number) { + i = 0; + while_condition = PREDEF_TESTS; + } else { + i = run_test_number - 1; + while_condition = run_test_number; + } + while (i < while_condition) { + printf("***** Test %d *****\n", i + 1); + failed = run_test(&predefined_tests[i]); + printf("******************\n"); + i++; + } + + MPI_Finalize(); + + return 0; +} + +int run_test(test_param_t * test) +{ + ADIO_Offset st_offset, end_offset; + MPI_File fh; + int is_contig; + int ind_err = 0, exp_err = 0; + + MPI_Datatype filetype; + + MPI_Type_create_struct(test->type_count, test->type_blocklens, + test->type_indices, test->type_oldtypes, &filetype); + MPI_Type_commit(&filetype); + + MPI_File_open(MPI_COMM_WORLD, "test_file.txt", MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + + MPI_File_set_view(fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); + + MPI_File_seek(fh, test->offset, MPI_SEEK_SET); + ADIOI_Calc_bounds((ADIO_File) fh, test->count, MPI_BYTE, ADIO_INDIVIDUAL, + test->offset, &st_offset, &end_offset); + + ind_err = 0; + if (st_offset != test->correct_st_offset) { + printf("Individual st_offset = %lld end_offset = %lld\n", st_offset, end_offset); + ind_err = 1; + } + if (end_offset != test->correct_end_offset) { + printf("Individual st_offset = %lld end_offset = %lld\n", st_offset, end_offset); + ind_err = 1; + } + MPI_File_close(&fh); + if (ind_err) + printf("Individual Calc FAILED\n"); + + MPI_File_open(MPI_COMM_WORLD, "test_file.txt", MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + + if (!is_contig) + MPI_File_set_view(fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); + + MPI_File_seek(fh, 0, MPI_SEEK_SET); + ADIOI_Calc_bounds((ADIO_File) fh, test->count, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, test->offset, &st_offset, &end_offset); + + exp_err = 0; + if (st_offset != test->correct_st_offset) { + printf("Explicit st_offset = %lld end_offset = %lld\n", st_offset, end_offset); + exp_err = 1; + } + if (end_offset != test->correct_end_offset) { + printf("Explicit st_offset = %lld end_offset = %lld\n", st_offset, end_offset); + exp_err = 1; + } + if (exp_err) + printf("Explicit Calc FAILED\n"); + + MPI_File_close(&fh); + + if (!is_contig) + MPI_Type_free(&filetype); + + return (exp_err || ind_err); +} + +int print_usage() +{ + printf("Usage:\n" " io_bounds_test -A -T <test #>\n"); +} + +int print_test_params(test_param_t * test) +{ + int i; + printf("I/O offset: %lld\n" + "bytes: %d\n" "Filetype [n](disp, lens, type):\n", test->offset, test->count); + + for (i = 0; i < test->type_count; i++) { + printf(" [%d](%lld, %d, ", i, test->type_blocklens[i], test->type_indices[i]); + if (test->type_oldtypes[i] == MPI_BYTE) { + printf("%s)\n", "MPI_BYTE"); + } else if (test->type_oldtypes[i] == MPI_UB) { + printf("%s)\n", "MPI_UB"); + } else if (test->type_oldtypes[i] == MPI_LB) { + printf("%s)\n", "MPI_LB"); + } + } + printf("Expected Start offset: %lld\n" + "Expected End offset: %lld\n", test->correct_st_offset, test->correct_end_offset); +} + +int setup_predefined(test_param_t * tests_arr, int count) +{ + int i; + for (i = 0; i < PREDEF_TESTS; i++) { + switch (i) { + case 0: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 1: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 2: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 3: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 4: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + } + } + return 0; +} diff --git a/3rd-party/romio321/test/.codingcheck b/3rd-party/romio341/test/.codingcheck similarity index 100% rename from 3rd-party/romio321/test/.codingcheck rename to 3rd-party/romio341/test/.codingcheck diff --git a/3rd-party/romio321/test/Makefile.am b/3rd-party/romio341/test/Makefile.am similarity index 85% rename from 3rd-party/romio321/test/Makefile.am rename to 3rd-party/romio341/test/Makefile.am index 5e2e0240856a1183b483a7694b96fd6f1b69fad9..191cf0b6e7adacf4554582e079a9613972e2d782 100644 --- a/3rd-party/romio321/test/Makefile.am +++ b/3rd-party/romio341/test/Makefile.am @@ -1,8 +1,7 @@ -# -*- Mode: Makefile; -*- -# -# (C) 2011 by Argonne National Laboratory. -# See COPYRIGHT in top-level directory. -# +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## # This directory is only listed in DIST_SUBDIRS, not SUBDIRS, so its contents # will not be built by default, but it will participate in "make distclean" and @@ -25,8 +24,8 @@ AM_FFLAGS = $(USER_FFLAGS) CTESTS = simple perf async coll_test coll_perf misc file_info excl large_array \ atomicity noncontig i_noncontig noncontig_coll split_coll shared_fp \ large_file psimple error status noncontig_coll2 aggregation1 aggregation2 \ - async-multiple ordered_fp hindexed external32 types_with_zeros darray_read -FTESTS = fcoll_test fperf fmisc pfcoll_test + async-multiple ordered_fp hindexed external32 types_with_zeros darray_read syshints +FTESTS = fcoll_test fperf fmisc pfcoll_test noinst_PROGRAMS = $(CTESTS) @@ -40,3 +39,4 @@ fmisc_SOURCES = fmisc.f pfcoll_test_SOURCES = pfcoll_test.f endif BUILD_F77_TESTS + diff --git a/3rd-party/romio321/test/Mfile.in b/3rd-party/romio341/test/Mfile.in similarity index 95% rename from 3rd-party/romio321/test/Mfile.in rename to 3rd-party/romio341/test/Mfile.in index c2e1c2982596ba0bc59eb30e9b03058cb9b05ea0..5e8b531182b00396bda7e6bfb66f490feb8b2f14 100644 --- a/3rd-party/romio321/test/Mfile.in +++ b/3rd-party/romio341/test/Mfile.in @@ -1,3 +1,8 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + ALL: default # This is a special Makefile.in source for use by the test suite (see the diff --git a/3rd-party/romio321/test/README b/3rd-party/romio341/test/README similarity index 100% rename from 3rd-party/romio321/test/README rename to 3rd-party/romio341/test/README diff --git a/3rd-party/romio341/test/aggregation1.c b/3rd-party/romio341/test/aggregation1.c new file mode 100644 index 0000000000000000000000000000000000000000..160ee44cce41798c16c4da9a4414e3bef78a054d --- /dev/null +++ b/3rd-party/romio341/test/aggregation1.c @@ -0,0 +1,263 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* Test case from John Bent (ROMIO req #835) + * Aggregation code was not handling certain access patterns when collective + * buffering forced */ +#define _XOPEN_SOURCE 500 /* strdup not in string.h otherwsie */ +#include <unistd.h> +#include <stdlib.h> +#include <mpi.h> +#include <stdio.h> +#include <string.h> + +#define NUM_OBJS 4 +#define OBJ_SIZE 1048576 + +extern char *optarg; +extern int optind, opterr, optopt; + + +char *prog = NULL; +int debug = 0; + +static void Usage(int line) +{ + int rank; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (rank == 0) { + fprintf(stderr, + "Usage (line %d): %s [-d] [-h] -f filename\n" + "\t-d for debugging\n" + "\t-h to turn on the hints to force collective aggregation\n", line, prog); + } + exit(0); +} + +static void fatal_error(int mpi_ret, MPI_Status * mpi_stat, const char *msg) +{ + fprintf(stderr, "Fatal error %s: %d\n", msg, mpi_ret); + MPI_Abort(MPI_COMM_WORLD, -1); +} + +static void print_hints(int rank, MPI_File * mfh) +{ + MPI_Info info; + int nkeys; + int i, dummy_int; + char key[1024]; + char value[1024]; + + MPI_Barrier(MPI_COMM_WORLD); + if (rank == 0) { + MPI_File_get_info(*mfh, &info); + MPI_Info_get_nkeys(info, &nkeys); + + printf("HINTS:\n"); + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info, i, key); + printf("%35s -> ", key); + MPI_Info_get(info, key, 1024, value, &dummy_int); + printf("%s\n", value); + } + MPI_Info_free(&info); + } + MPI_Barrier(MPI_COMM_WORLD); +} + +static void fill_buffer(char *buffer, int bufsize, int rank, MPI_Offset offset) +{ + memset((void *) buffer, 0, bufsize); + snprintf(buffer, bufsize, "Hello from %d at %lld\n", rank, offset); +} + +static MPI_Offset get_offset(int rank, int num_objs, int obj_size, int which_obj) +{ + MPI_Offset offset; + offset = (MPI_Offset) rank *num_objs * obj_size + which_obj * obj_size; + return offset; +} + +static void write_file(char *target, int rank, MPI_Info * info) +{ + MPI_File wfh; + MPI_Status mpi_stat; + int mpi_ret; + int i; + char *buffer; + + buffer = malloc(OBJ_SIZE); + + if (debug) + printf("%d writing file %s\n", rank, target); + + if ((mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, + MPI_MODE_WRONLY | MPI_MODE_CREATE, *info, &wfh)) + != MPI_SUCCESS) { + fatal_error(mpi_ret, NULL, "open for write"); + } + + for (i = 0; i < NUM_OBJS; i++) { + MPI_Offset offset = get_offset(rank, NUM_OBJS, OBJ_SIZE, i); + fill_buffer(buffer, OBJ_SIZE, rank, offset); + if (debug) + printf("%s", buffer); + if ((mpi_ret = MPI_File_write_at_all(wfh, offset, buffer, OBJ_SIZE, + MPI_CHAR, &mpi_stat)) != MPI_SUCCESS) { + fatal_error(mpi_ret, &mpi_stat, "write"); + } + } + + if (debug) + print_hints(rank, &wfh); + + if ((mpi_ret = MPI_File_close(&wfh)) != MPI_SUCCESS) { + fatal_error(mpi_ret, NULL, "close for write"); + } + if (debug) + printf("%d wrote file %s\n", rank, target); + free(buffer); +} + +static int reduce_corruptions(int corrupt_blocks) +{ + int mpi_ret; + int sum; + if ((mpi_ret = MPI_Reduce(&corrupt_blocks, &sum, 1, + MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD)) != MPI_SUCCESS) { + fatal_error(mpi_ret, NULL, "MPI_Reduce"); + } + return sum; +} + +static void read_file(char *target, int rank, MPI_Info * info, int *corrupt_blocks) +{ + MPI_File rfh; + MPI_Status mpi_stat; + int mpi_ret; + int i; + char *buffer; + char *verify_buf = NULL; + buffer = malloc(OBJ_SIZE); + verify_buf = (char *) malloc(OBJ_SIZE); + + if (debug) + printf("%d reading file %s\n", rank, target); + + if ((mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, + MPI_MODE_RDONLY, *info, &rfh)) != MPI_SUCCESS) { + fatal_error(mpi_ret, NULL, "open for read"); + } + + for (i = 0; i < NUM_OBJS; i++) { + MPI_Offset offset = get_offset(rank, NUM_OBJS, OBJ_SIZE, i); + fill_buffer(verify_buf, OBJ_SIZE, rank, offset); + if (debug) + printf("Expecting %s", buffer); + if ((mpi_ret = MPI_File_read_at_all(rfh, offset, buffer, OBJ_SIZE, + MPI_CHAR, &mpi_stat)) != MPI_SUCCESS) { + fatal_error(mpi_ret, &mpi_stat, "read"); + } + if (memcmp(verify_buf, buffer, OBJ_SIZE) != 0) { + (*corrupt_blocks)++; + printf("Corruption at %lld\n", offset); + if (debug) { + printf("\tExpecting %s\n" "\tRecieved %s\n", verify_buf, buffer); + } + } + } + + if ((mpi_ret = MPI_File_close(&rfh)) != MPI_SUCCESS) { + fatal_error(mpi_ret, NULL, "close for read"); + } + free(buffer); + free(verify_buf); + +} + +static void set_hints(MPI_Info * info) +{ + MPI_Info_set(*info, "romio_cb_write", "enable"); + MPI_Info_set(*info, "romio_no_indep_rw", "1"); + MPI_Info_set(*info, "cb_nodes", "1"); + MPI_Info_set(*info, "cb_buffer_size", "4194304"); +} + +/* +void +set_hints(MPI_Info *info, char *hints) { + char *delimiter = " "; + char *hints_cp = strdup(hints); + char *key = strtok(hints_cp, delimiter); + char *val; + while (key) { + val = strtok(NULL, delimiter); + if (debug) printf("HINT: %s = %s\n", key, val); + if (! val) { + Usage(__LINE__); + } + MPI_Info_set(*info, key, val); + key = strtok(NULL, delimiter); + } + free(hints_cp); +} +*/ + +int main(int argc, char *argv[]) +{ + int nproc = 1, rank = 0; + char *target = NULL; + int c; + MPI_Info info; + int mpi_ret; + int corrupt_blocks = 0; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nproc); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if ((mpi_ret = MPI_Info_create(&info)) != MPI_SUCCESS) { + if (rank == 0) + fatal_error(mpi_ret, NULL, "MPI_info_create.\n"); + } + + prog = strdup(argv[0]); + + while ((c = getopt(argc, argv, "df:h")) != EOF) { + switch (c) { + case 'd': + debug = 1; + break; + case 'f': + target = strdup(optarg); + break; + case 'h': + set_hints(&info); + break; + default: + Usage(__LINE__); + } + } + if (!target) { + Usage(__LINE__); + } + + write_file(target, rank, &info); + read_file(target, rank, &info, &corrupt_blocks); + + corrupt_blocks = reduce_corruptions(corrupt_blocks); + if (rank == 0) { + if (corrupt_blocks == 0) { + fprintf(stdout, " No Errors\n"); + } else { + fprintf(stdout, "%d/%d blocks corrupt\n", corrupt_blocks, nproc * NUM_OBJS); + } + } + MPI_Info_free(&info); + + MPI_Finalize(); + free(prog); + exit(0); +} diff --git a/3rd-party/romio341/test/aggregation2.c b/3rd-party/romio341/test/aggregation2.c new file mode 100644 index 0000000000000000000000000000000000000000..582f0a068c256f05221596e90ee2a874b2a602aa --- /dev/null +++ b/3rd-party/romio341/test/aggregation2.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* Look for regressions in aggregator code. A more simple access pattern than + * aggregation1 */ + +#include <mpi.h> + +#include <stdlib.h> +#include <stdio.h> +#include <time.h> + +#include <sys/types.h> +#include <unistd.h> + +#include <string.h> + +#define BUFSIZE 512 + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +int main(int argc, char **argv) +{ + MPI_Info info = MPI_INFO_NULL; + MPI_File fh; + MPI_Offset off = 0; + MPI_Status status; + int errcode; + int i, rank, errs = 0, toterrs, buffer[BUFSIZE], buf2[BUFSIZE]; + + MPI_Init(&argc, &argv); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + MPI_Info_create(&info); + MPI_Info_set(info, "romio_cb_write", "enable"); + MPI_Info_set(info, "cb_nodes", "1"); + + for (i = 0; i < BUFSIZE; i++) { + buffer[i] = 10000 + rank; + } + off = rank * sizeof(buffer); + + errcode = MPI_File_open(MPI_COMM_WORLD, argv[1], MPI_MODE_WRONLY | MPI_MODE_CREATE, info, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open"); + errcode = MPI_File_write_at_all(fh, off, buffer, BUFSIZE, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_write_at_all"); + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close"); + + errcode = MPI_File_open(MPI_COMM_WORLD, argv[1], MPI_MODE_RDONLY, info, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open"); + errcode = MPI_File_read_at_all(fh, off, buf2, BUFSIZE, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_read_at_all"); + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close"); + + for (i = 0; i < BUFSIZE; i++) { + if (buf2[i] != 10000 + rank) + errs++; + } + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + MPI_Info_free(&info); + MPI_Finalize(); + + return 0; +} diff --git a/3rd-party/romio341/test/async-multiple.c b/3rd-party/romio341/test/async-multiple.c new file mode 100644 index 0000000000000000000000000000000000000000..88c1e431008d3d1086f67aa2dd13f1f92d456f43 --- /dev/null +++ b/3rd-party/romio341/test/async-multiple.c @@ -0,0 +1,148 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define SIZE (65536) +#define NR_NBOPS (32) + +/* Uses asynchronous I/O. Each process writes to separate files and + reads them back. The file name is taken as a command-line argument, + and the process rank is appended to it.*/ + +void handle_error(int errcode, const char *str); + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len; + char *filename, *tmp; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status[NR_NBOPS]; + MPI_Request request[NR_NBOPS]; + int errcode = 0; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: async -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + nints = SIZE / sizeof(int); + for (i = 0; i < nints; i++) + buf[i] = rank * 100000 + i; + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + errcode = MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } + for (i = 0; i < NR_NBOPS; i++) { + errcode = MPI_File_iwrite_at(fh, nints / NR_NBOPS * i, + buf + (nints / NR_NBOPS * i), nints / NR_NBOPS, MPI_INT, + &(request[i])); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_iwrite"); + } + } + MPI_Waitall(NR_NBOPS, request, status); + + MPI_File_close(&fh); + + /* reopen the file and read the data back */ + + for (i = 0; i < nints; i++) + buf[i] = 0; + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } + for (i = 0; i < NR_NBOPS; i++) { + errcode = MPI_File_iread_at(fh, nints / NR_NBOPS * i, + buf + (nints / NR_NBOPS * i), nints / NR_NBOPS, MPI_INT, + &(request[i])); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + } + MPI_Waitall(NR_NBOPS, request, status); + + MPI_File_close(&fh); + + /* check if the data read is correct */ + for (i = 0; i < nints; i++) { + if (buf[i] != (rank * 100000 + i)) { + errs++; + fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], + rank * 100000 + i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + free(buf); + free(filename); + free(tmp); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/async.c b/3rd-party/romio341/test/async.c new file mode 100644 index 0000000000000000000000000000000000000000..27313dbc6ae9557b4661574fac574d6ae1ef7600 --- /dev/null +++ b/3rd-party/romio341/test/async.c @@ -0,0 +1,147 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define SIZE (65536) + +/* Uses asynchronous I/O. Each process writes to separate files and + reads them back. The file name is taken as a command-line argument, + and the process rank is appended to it.*/ + +void handle_error(int errcode, const char *str); + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len; + char *filename, *tmp; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status; + MPIO_Request request; + int errcode = 0; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: async -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + nints = SIZE / sizeof(int); + for (i = 0; i < nints; i++) + buf[i] = rank * 100000 + i; + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + errcode = MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } + + errcode = MPI_File_iwrite(fh, buf, nints, MPI_INT, &request); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_iwrite"); + } +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&request, &status); +#else + MPIO_Wait(&request, &status); +#endif + MPI_File_close(&fh); + + /* reopen the file and read the data back */ + + for (i = 0; i < nints; i++) + buf[i] = 0; + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } + errcode = MPI_File_iread(fh, buf, nints, MPI_INT, &request); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&request, &status); +#else + MPIO_Wait(&request, &status); +#endif + + MPI_File_close(&fh); + + /* check if the data read is correct */ + for (i = 0; i < nints; i++) { + if (buf[i] != (rank * 100000 + i)) { + errs++; + fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], + rank * 100000 + i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + free(buf); + free(filename); + free(tmp); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/atomicity.c b/3rd-party/romio341/test/atomicity.c new file mode 100644 index 0000000000000000000000000000000000000000..fafbdd9de15c94e32ecd3f80d962013c97c9eeff --- /dev/null +++ b/3rd-party/romio341/test/atomicity.c @@ -0,0 +1,233 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests whether atomicity semantics are satisfied for overlapping accesses + in atomic mode. The probability of detecting errors is higher if you run + it on 8 or more processes. */ + +/* The file name is taken as a command-line argument. */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +#define BUFSIZE 10000 /* no. of integers */ +#define VERBOSE 0 +int main(int argc, char **argv) +{ + int *writebuf, *readbuf, i, mynod, nprocs, len, err; + char *filename; + int errs = 0, toterrs; + MPI_Datatype newtype; + MPI_File fh; + MPI_Status status; + MPI_Info info; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + writebuf = (int *) malloc(BUFSIZE * sizeof(int)); + readbuf = (int *) malloc(BUFSIZE * sizeof(int)); + +/* test atomicity of contiguous accesses */ + +/* initialize file to all zeros */ + if (!mynod) { + /* ignore error: file may or may not exist */ + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + for (i = 0; i < BUFSIZE; i++) + writebuf[i] = 0; + MPI_CHECK(MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status)); + MPI_CHECK(MPI_File_close(&fh)); +#if VERBOSE + fprintf(stderr, "\ntesting contiguous accesses\n"); +#endif + } + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < BUFSIZE; i++) + writebuf[i] = 10; + for (i = 0; i < BUFSIZE; i++) + readbuf[i] = 20; + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + +/* set atomicity to true */ + err = MPI_File_set_atomicity(fh, 1); + if (err != MPI_SUCCESS) { + fprintf(stderr, "Atomic mode not supported on this file system.\n"); + fflush(stderr); + errs++; + goto fn_exit; + } + + MPI_Barrier(MPI_COMM_WORLD); + +/* process 0 writes and others concurrently read. In atomic mode, + the data read must be either all old values or all new values; nothing + in between. */ + + if (!mynod) { + MPI_CHECK(MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status)); + } else { + err = MPI_File_read(fh, readbuf, BUFSIZE, MPI_INT, &status); + if (err == MPI_SUCCESS) { + if (readbuf[0] == 0) { /* the rest must also be 0 */ + for (i = 1; i < BUFSIZE; i++) + if (readbuf[i] != 0) { + errs++; + fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 0\n", mynod, i, + readbuf[i]); + goto fn_exit; + } + } else if (readbuf[0] == 10) { /* the rest must also be 10 */ + for (i = 1; i < BUFSIZE; i++) + if (readbuf[i] != 10) { + errs++; + fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 10\n", mynod, i, + readbuf[i]); + goto fn_exit; + } + } else { + errs++; + fprintf(stderr, "Process %d: readbuf[0] is %d, should be either 0 or 10\n", mynod, + readbuf[0]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + +/* repeat the same test with a noncontiguous filetype */ + + MPI_Type_vector(BUFSIZE, 1, 2, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + + MPI_Info_create(&info); + /* I am setting these info values for testing purposes only. It is + * better to use the default values in practice. */ + MPI_Info_set(info, "ind_rd_buffer_size", "1209"); + MPI_Info_set(info, "ind_wr_buffer_size", "1107"); + + if (!mynod) { + MPI_CHECK(MPI_File_delete(filename, MPI_INFO_NULL)); + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + for (i = 0; i < BUFSIZE; i++) + writebuf[i] = 0; + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + MPI_CHECK(MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status)); + MPI_File_close(&fh); +#if VERBOSE + fprintf(stderr, "\ntesting noncontiguous accesses\n"); +#endif + } + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < BUFSIZE; i++) + writebuf[i] = 10; + for (i = 0; i < BUFSIZE; i++) + readbuf[i] = 20; + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + MPI_CHECK(MPI_File_set_atomicity(fh, 1)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { + MPI_CHECK(MPI_File_write(fh, writebuf, BUFSIZE, MPI_INT, &status)); + } else { + err = MPI_File_read(fh, readbuf, BUFSIZE, MPI_INT, &status); + if (err == MPI_SUCCESS) { + if (readbuf[0] == 0) { + for (i = 1; i < BUFSIZE; i++) + if (readbuf[i] != 0) { + errs++; + fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 0\n", mynod, i, + readbuf[i]); + goto fn_exit; + } + } else if (readbuf[0] == 10) { + for (i = 1; i < BUFSIZE; i++) + if (readbuf[i] != 10) { + errs++; + fprintf(stderr, "Process %d: readbuf[%d] is %d, should be 10\n", mynod, i, + readbuf[i]); + goto fn_exit; + } + } else { + errs++; + fprintf(stderr, "Process %d: readbuf[0] is %d, should be either 0 or 10\n", mynod, + readbuf[0]); + } + } + } + + MPI_Type_free(&newtype); + MPI_Info_free(&info); + fn_exit: + MPI_File_close(&fh); + + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + free(writebuf); + free(readbuf); + free(filename); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/big_extents.c b/3rd-party/romio341/test/big_extents.c new file mode 100644 index 0000000000000000000000000000000000000000..0524cb9b6a4e77bf3017f7bba24f525a21ad6709 --- /dev/null +++ b/3rd-party/romio341/test/big_extents.c @@ -0,0 +1,204 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* a test to exercise very large extents: on most platforms with 32 bit + * integers, we'd expect these tests to give unexpected values. On platforms + * with 64 bit integers, these tests will be fine. On BlueGene we're not sure + * yet :> + */ + + +#include <mpi.h> +#include <stdint.h> +#include <math.h> +#include <stdio.h> + +#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, NULL); } + + +static void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +static void typestats(MPI_Datatype type) +{ + MPI_Aint lb, extent; + MPI_Count size; + + MPI_Type_get_extent(type, &lb, &extent); + MPI_Type_size_x(type, &size); + + printf("dtype %d: lb = %ld extent = %ld size = %ld...", type, (long) lb, (long) extent, size); + +} + +static int verify_type(char *filename, MPI_Datatype type, int64_t expected_extent, int do_coll) +{ + int rank, canary; + MPI_Count tsize; + int compare = -1; + int errs = 0, toterrs = 0; + MPI_Status status; + MPI_File fh; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + CHECK(MPI_File_set_view(fh, rank * sizeof(int), MPI_BYTE, type, "native", MPI_INFO_NULL)); + + MPI_Type_size_x(type, &tsize); + + canary = rank + 1000000; + + /* skip over first instance of type */ + if (do_coll) { + CHECK(MPI_File_write_at_all(fh, tsize, &canary, 1, MPI_INT, &status)); + } else { + CHECK(MPI_File_write_at(fh, tsize, &canary, 1, MPI_INT, &status)); + } + + CHECK(MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL)); + + if (do_coll) { + CHECK(MPI_File_read_at_all(fh, expected_extent / sizeof(int) + rank, + &compare, 1, MPI_INT, &status)); + } else { + CHECK(MPI_File_read_at(fh, expected_extent / sizeof(int) + rank, + &compare, 1, MPI_INT, &status)); + } + + if (compare != canary) + errs = 1; + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + + MPI_File_close(&fh); + + if (toterrs) { + printf("%d: got %d expected %d\n", rank, compare, canary); + /* keep file if there's an error */ + } else { + if (rank == 0) + MPI_File_delete(filename, MPI_INFO_NULL); + } + + return (toterrs); + +} + +static int testtype(char *filename, MPI_Datatype type, int64_t expected_extent) +{ + int rank, ret, errs = 0; + int collective = 1, nocollective = 0; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (!rank) + typestats(type); + + ret = verify_type(filename, type, expected_extent, nocollective); + if (ret) { + errs++; + fprintf(stderr, "type %d failed indep\n", type); + } else if (!rank) + printf("indep: OK "); + + ret = verify_type(filename, type, expected_extent, collective); + if (ret) { + errs++; + fprintf(stderr, "type %d failed collective\n", type); + } else if (!rank) + printf("coll: OK\n"); + + return errs; +} + +int main(int argc, char **argv) +{ + int count = 2; + int blocks[2]; + int disps[2]; + + int ndims = 2; + int sizes[2]; + int subs[2]; + int starts[2]; + + MPI_Datatype baseindex, indexed1G, indexed3G, indexed6G; + MPI_Datatype subarray1G, subarray3G, subarray6G; + int ret, rank; + + MPI_Init(&argc, &argv); + + if (argc != 2) { + fprintf(stderr, "usage: %s <filename>\n", argv[0]); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + /* base type: 1MB indexed type of ints */ + count = 2; + blocks[0] = 1; + disps[0] = 0; + blocks[1] = 1; + disps[1] = 1024 * 256 - 1; + + MPI_Type_indexed(count, blocks, disps, MPI_INT, &baseindex); + /* simple case: 1GB extent */ + MPI_Type_contiguous(1024, baseindex, &indexed1G); + MPI_Type_commit(&indexed1G); + + /* a little trickier: 3Gb extent */ + MPI_Type_contiguous(3072, baseindex, &indexed3G); + MPI_Type_commit(&indexed3G); + + /* and finally 6GB extent */ + MPI_Type_contiguous(6144, baseindex, &indexed6G); + MPI_Type_commit(&indexed6G); + + /* TODO: + * - add a darray test + * - add a test with crazy extents */ + sizes[0] = 1024 * 16; + sizes[1] = 1024 * 16; + subs[0] = subs[1] = 256; + starts[0] = starts[1] = 0; + + MPI_Type_create_subarray(ndims, sizes, subs, starts, MPI_ORDER_C, MPI_INT, &subarray1G); + MPI_Type_commit(&subarray1G); + + sizes[1] = 1024 * 16 * 3; + MPI_Type_create_subarray(ndims, sizes, subs, starts, MPI_ORDER_C, MPI_INT, &subarray3G); + MPI_Type_commit(&subarray3G); + + sizes[1] = 1024 * 16 * 6; + MPI_Type_create_subarray(ndims, sizes, subs, starts, MPI_ORDER_C, MPI_INT, &subarray6G); + MPI_Type_commit(&subarray6G); + + /* assume command line arguments make it out to all processes */ + ret = testtype(argv[1], indexed1G, (int64_t) 1024 * 1024 * 1024); + + ret = testtype(argv[1], indexed3G, (int64_t) 1024 * 1024 * 1024 * 3); + + ret = testtype(argv[1], indexed6G, (int64_t) 1024 * 1024 * 1024 * 6); + + ret = testtype(argv[1], subarray1G, (int64_t) 1024 * 1024 * 1024); + + ret = testtype(argv[1], subarray3G, (int64_t) 1024 * 1024 * 1024 * 3); + + ret = testtype(argv[1], subarray6G, (int64_t) 1024 * 1024 * 1024 * 6); + + if (!ret && !rank) + fprintf(stderr, " No Errors\n"); + + MPI_Finalize(); + return (-ret); + +} diff --git a/3rd-party/romio341/test/coll_perf.c b/3rd-party/romio341/test/coll_perf.c new file mode 100644 index 0000000000000000000000000000000000000000..96b9ee26c1d257a4a08b4927ad129be430953cc5 --- /dev/null +++ b/3rd-party/romio341/test/coll_perf.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +/* The file name is taken as a command-line argument. */ + +/* Measures the I/O bandwidth for writing/reading a 3D + block-distributed array to a file corresponding to the global array + in row-major (C) order. + Note that the file access pattern is noncontiguous. + + Array size 128^3. For other array sizes, change array_of_gsizes below.*/ + + +int main(int argc, char **argv) +{ + MPI_Datatype newtype; + int i, ndims, array_of_gsizes[3], array_of_distribs[3]; + int order, nprocs, len, *buf, mynod; + MPI_Count bufcount; + int array_of_dargs[3], array_of_psizes[3]; + MPI_File fh; + MPI_Status status; + double stim, write_tim, new_write_tim, write_bw; + double read_tim, new_read_tim, read_bw; + char *filename; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: coll_perf -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + ndims = 3; + order = MPI_ORDER_C; + + array_of_gsizes[0] = 128 * 17; + array_of_gsizes[1] = 128 * 9; + array_of_gsizes[2] = 128 * 11; + + array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; + + array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; + + for (i = 0; i < ndims; i++) + array_of_psizes[i] = 0; + MPI_Dims_create(nprocs, ndims, array_of_psizes); + + MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, + array_of_distribs, array_of_dargs, + array_of_psizes, order, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + + MPI_Type_size_x(newtype, &bufcount); + bufcount = bufcount / sizeof(int); + buf = (int *) malloc(bufcount * sizeof(int)); + +/* to eliminate paging effects, do the operations once but don't time + them */ + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status)); + MPI_CHECK(MPI_File_seek(fh, 0, MPI_SEEK_SET)); + MPI_CHECK(MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status)); + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); +/* now time write_all */ + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status)); + write_tim = MPI_Wtime() - stim; + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + + if (mynod == 0) { + write_bw = + (array_of_gsizes[0] * array_of_gsizes[1] * array_of_gsizes[2] * sizeof(int)) / + (new_write_tim * 1024.0 * 1024.0); + fprintf(stderr, "Global array size %d x %d x %d integers\n", array_of_gsizes[0], + array_of_gsizes[1], array_of_gsizes[2]); + fprintf(stderr, + "Collective write time = %f sec, Collective write bandwidth = %f Mbytes/sec\n", + new_write_tim, write_bw); + } + + MPI_Barrier(MPI_COMM_WORLD); +/* now time read_all */ + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_read_all(fh, buf, bufcount, MPI_INT, &status)); + read_tim = MPI_Wtime() - stim; + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + + if (mynod == 0) { + read_bw = + (array_of_gsizes[0] * array_of_gsizes[1] * array_of_gsizes[2] * sizeof(int)) / + (new_read_tim * 1024.0 * 1024.0); + fprintf(stderr, + "Collective read time = %f sec, Collective read bandwidth = %f Mbytes/sec\n", + new_read_tim, read_bw); + } + + MPI_Type_free(&newtype); + free(buf); + free(filename); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/coll_test.c b/3rd-party/romio341/test/coll_test.c new file mode 100644 index 0000000000000000000000000000000000000000..619a8b1afae291206eb4748def58aef1ae2e3ce6 --- /dev/null +++ b/3rd-party/romio341/test/coll_test.c @@ -0,0 +1,214 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +/* A 32^3 array. For other array sizes, change array_of_gsizes below. */ + +/* Uses collective I/O. Writes a 3D block-distributed array to a file + corresponding to the global array in row-major (C) order, reads it + back, and checks that the data read is correct. */ + +/* The file name is taken as a command-line argument. */ + +/* Note that the file access pattern is noncontiguous. */ + +void handle_error(int errcode, const char *str); + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +int main(int argc, char **argv) +{ + MPI_Datatype newtype; + int i, ndims, array_of_gsizes[3], array_of_distribs[3]; + int order, nprocs, j, len; + int array_of_dargs[3], array_of_psizes[3]; + int *readbuf, *writebuf, mynod, *tmpbuf, array_size; + MPI_Count bufcount; + char *filename; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status; + MPI_Request request; + MPI_Info info = MPI_INFO_NULL; + int errcode; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + +/* create the distributed array filetype */ + ndims = 3; + order = MPI_ORDER_C; + + array_of_gsizes[0] = 32; + array_of_gsizes[1] = 32; + array_of_gsizes[2] = 32; + + array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; + + array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; + + for (i = 0; i < ndims; i++) + array_of_psizes[i] = 0; + MPI_Dims_create(nprocs, ndims, array_of_psizes); + + MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, + array_of_distribs, array_of_dargs, + array_of_psizes, order, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + +/* initialize writebuf */ + + MPI_Type_size_x(newtype, &bufcount); + bufcount = bufcount / sizeof(int); + writebuf = (int *) malloc(bufcount * sizeof(int)); + for (i = 0; i < bufcount; i++) + writebuf[i] = 1; + + array_size = array_of_gsizes[0] * array_of_gsizes[1] * array_of_gsizes[2]; + tmpbuf = (int *) calloc(array_size, sizeof(int)); + MPI_Irecv(tmpbuf, 1, newtype, mynod, 10, MPI_COMM_WORLD, &request); + MPI_Send(writebuf, bufcount, MPI_INT, mynod, 10, MPI_COMM_WORLD); + MPI_Wait(&request, &status); + + j = 0; + for (i = 0; i < array_size; i++) + if (tmpbuf[i]) { + writebuf[j] = i; + j++; + } + free(tmpbuf); + + if (j != bufcount) { + fprintf(stderr, "Error in initializing writebuf on process %d\n", mynod); + MPI_Abort(MPI_COMM_WORLD, 1); + } +/* end of initialization */ + + /* write the array to the file */ + errcode = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open"); + + errcode = MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_set_view"); + + errcode = MPI_File_write_all(fh, writebuf, bufcount, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_write_all"); + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close"); + + if (!mynod) { + /* wkl suggests potential for false " No Errors" if both read + * and write use the same file view */ + /* solution: rank 0 reads entire file and checks write values */ + errcode = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, info, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open"); + + readbuf = (int *) malloc(array_size * sizeof(int)); + errcode = MPI_File_read(fh, readbuf, array_size, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_read"); + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close"); + + for (i = 0; i < array_size; i++) + if (readbuf[i] != i) { + errs++; + fprintf(stderr, "Error: write integer %d but read %d\n", i, readbuf[i]); + break; + } + free(readbuf); + } + MPI_Barrier(MPI_COMM_WORLD); + + /* now read it back */ + readbuf = (int *) malloc(bufcount * sizeof(int)); + errcode = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open"); + + errcode = MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_set_view"); + errcode = MPI_File_read_all(fh, readbuf, bufcount, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_read_all"); + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close"); + + /* check the data read */ + for (i = 0; i < bufcount; i++) { + if (readbuf[i] != writebuf[i]) { + errs++; + fprintf(stderr, "Process %d, readbuf %d, writebuf %d, i %d\n", mynod, readbuf[i], + writebuf[i], i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + MPI_Type_free(&newtype); + free(readbuf); + free(writebuf); + free(filename); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/creat_excl.c b/3rd-party/romio341/test/creat_excl.c new file mode 100644 index 0000000000000000000000000000000000000000..e26e7f06960c7a229512e08640e1529f21f1c124 --- /dev/null +++ b/3rd-party/romio341/test/creat_excl.c @@ -0,0 +1,135 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +/* + * the new defered open code made some changes to the way we manage CREAT|EXCL, + * so test out that code path */ + +struct options { + char *fname; + int verbose; + int do_aggregation; +}; +typedef struct options options; + + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +void parse_args(int argc, char **argv, int rank, options * opts) +{ + int i, len = 0; + if (rank == 0) { + i = 1; + while (i < argc) { + if (strcmp("-fname", argv[i]) == 0) { + len = strlen(argv[i + 1]); + opts->fname = (char *) malloc(len + 1); + strcpy(opts->fname, argv[i + 1]); + i += 2; /* option and argument */ + continue; + } + if (strcmp("-aggregate", argv[i]) == 0) { + opts->do_aggregation = 1; + i++; + continue; + } + if (strcmp("-verbose", argv[i]) == 0) { + opts->verbose = 1; + i++; + continue; + } + } + if (opts->fname == NULL) { /* didn't get a filename */ + fprintf(stderr, "Usage: %s -fname filename [-aggregate] [-verbose]\n", argv[0]); + MPI_Abort(MPI_COMM_WORLD, 1); + } + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(opts->fname, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + opts->fname = (char *) malloc(len + 1); + MPI_Bcast(opts->fname, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); + } + +} + +int main(int argc, char **argv) +{ + int nprocs, mynod, errcode; + options my_options = { NULL, 0, 0 }; + MPI_File fh; + MPI_Status status; + MPI_Info info; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + parse_args(argc, argv, mynod, &my_options); + + if (my_options.do_aggregation) { + MPI_Info_create(&info); + MPI_Info_set(info, "romio_no_indep_rw", "true"); + MPI_Info_set(info, "cb_config_list", "leela.mcs.anl.gov:1"); + } else { + info = MPI_INFO_NULL; + } + + /* create the file w/o EXCL: this must not fail */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_close"); + } + + /* now try to open w/ CREAT|EXCL: this must fail */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, info, &fh); + if (errcode == MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open: expected an error: got"); + } + + /* ignore the error: File_delete is not aggregator-aware */ + MPI_File_delete(my_options.fname, info); + + /* this must succeed: the file no longer exists */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_close"); + } + + if (mynod == 0) { + printf(" No Errors\n"); + } + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/darray_read.c b/3rd-party/romio341/test/darray_read.c new file mode 100644 index 0000000000000000000000000000000000000000..24203fe51cfc5ec3a6a7ba57ac0ebc76490cfc76 --- /dev/null +++ b/3rd-party/romio341/test/darray_read.c @@ -0,0 +1,129 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <stdio.h> +#include <stdlib.h> +#include <mpi.h> + +#define NSIDE 5 +#define NBLOCK 3 +#define NPROC 2 + +#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn);} + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + + +int main(int argc, char *argv[]) +{ + int i, j, nerrors = 0, total_errors = 0; + + int rank, size; + int bpos; + + MPI_Datatype darray; + MPI_Status status; + MPI_File mpi_fh; + + /* Define array distribution + * A 2x2 block size works with ROMIO, a 3x3 block size breaks it. */ + int distrib[2] = { MPI_DISTRIBUTE_CYCLIC, MPI_DISTRIBUTE_CYCLIC }; + int bsize[2] = { NBLOCK, NBLOCK }; + int gsize[2] = { NSIDE, NSIDE }; + int psize[2] = { NPROC, NPROC }; + + double data[NSIDE * NSIDE]; + double *ldata, *pdata; + + int tsize, nelem; + + MPI_File dfile; + + MPI_Init(&argc, &argv); + + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + /* Set up type */ + CHECK(MPI_Type_create_darray(size, rank, 2, gsize, distrib, + bsize, psize, MPI_ORDER_FORTRAN, MPI_DOUBLE, &darray)); + CHECK(MPI_Type_commit(&darray)); + CHECK(MPI_Type_size(darray, &tsize)); + nelem = tsize / sizeof(double); + + for (i = 0; i < (NSIDE * NSIDE); i++) + data[i] = i; + + if (rank == 0) { + CHECK(MPI_File_open(MPI_COMM_SELF, argv[1], + MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &dfile)); + CHECK(MPI_File_write(dfile, data, NSIDE * NSIDE, MPI_DOUBLE, &status)); + CHECK(MPI_File_close(&dfile)); + } + MPI_Barrier(MPI_COMM_WORLD); + + /* Allocate buffer */ + ldata = (double *) malloc(tsize); + pdata = (double *) malloc(tsize); + + /* Use Pack to pull out array */ + bpos = 0; + CHECK(MPI_Pack(data, 1, darray, pdata, tsize, &bpos, MPI_COMM_WORLD)); + + MPI_Barrier(MPI_COMM_WORLD); + + /* Read in array from file. */ + CHECK(MPI_File_open(MPI_COMM_WORLD, argv[1], MPI_MODE_RDONLY, MPI_INFO_NULL, &mpi_fh)); + CHECK(MPI_File_set_view(mpi_fh, 0, MPI_DOUBLE, darray, "native", MPI_INFO_NULL)); + CHECK(MPI_File_read_all(mpi_fh, ldata, nelem, MPI_DOUBLE, &status)); + CHECK(MPI_File_close(&mpi_fh)); + + for (i = 0; i < size; i++) { +#ifdef VERBOSE + MPI_Barrier(MPI_COMM_WORLD); + if (rank == i) { + printf("=== Rank %i === (%i elements) \nPacked: ", rank, nelem); + for (j = 0; j < nelem; j++) { + printf("%4.1f ", pdata[j]); + fflush(stdout); + } + printf("\nRead: "); + for (j = 0; j < nelem; j++) { + printf("%4.1f ", ldata[j]); + fflush(stdout); + } + printf("\n\n"); + fflush(stdout); + } +#endif + if (rank == i) { + for (j = 0; j < nelem; j++) { + if (pdata[j] != ldata[j]) { + fprintf(stderr, "rank %d at index %d: packbuf %4.1f filebuf %4.1f\n", + rank, j, pdata[j], ldata[j]); + nerrors++; + } + } + } + } + MPI_Allreduce(&nerrors, &total_errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0 && total_errors == 0) + printf(" No Errors\n"); + + free(ldata); + free(pdata); + MPI_Type_free(&darray); + MPI_Finalize(); + + exit(total_errors); + +} diff --git a/3rd-party/romio341/test/error.c b/3rd-party/romio341/test/error.c new file mode 100644 index 0000000000000000000000000000000000000000..84af951658f2c55c39e929baff1411a23315a476 --- /dev/null +++ b/3rd-party/romio341/test/error.c @@ -0,0 +1,118 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* many calls are deliberately passed bogus values, are expected to fail, and + * then checked to see if we get the right error message. Other + * calls are expected to succeed but the preciese return string is not checked. This + * rouine and MPI_CHECK macro handle these unexpected error cases */ +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +#define VERBOSE 0 +/* tests if error message is printed correctly */ + +int main(int argc, char **argv) +{ + int i, rank, len, err; + int errs = 0; + char *filename, *tmp; + MPI_File fh; + char string[MPI_MAX_ERROR_STRING]; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +#if VERBOSE + if (!rank) { + fprintf(stderr, "Tests if errors are reported correctly...\n"); + fprintf(stderr, "Should say \"Invalid displacement argument\"\n\n"); + } +#endif + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE + MPI_MODE_RDWR, + MPI_INFO_NULL, &fh)); + err = MPI_File_set_view(fh, -1, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL); + /* disp is deliberately passed as -1 */ + + /* This test is designed for ROMIO specifically and tests for a + * specific error message */ + if (err != MPI_SUCCESS) { + MPI_Error_string(err, string, &len); + if (!rank) { +#if VERBOSE + fprintf(stderr, "%s\n", string); +#else + /* check for the word "displacement" in the message. + * This allows other formatting of the message */ + if (strstr(string, "displacement") == 0) { + fprintf(stderr, "Unexpected error message %s\n", string); + errs++; + } +#endif + } + } else { + errs++; + fprintf(stderr, "File set view did not return an error\n"); + } + + MPI_File_close(&fh); + + free(filename); + free(tmp); + + if (!rank) { + if (errs == 0) { + printf(" No Errors\n"); + } else { + printf(" Found %d errors\n", errs); + } + } + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/excl.c b/3rd-party/romio341/test/excl.c new file mode 100644 index 0000000000000000000000000000000000000000..b464a5fddfbe9c88f3416ebd5355c95c5f991bbc --- /dev/null +++ b/3rd-party/romio341/test/excl.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests MPI_MODE_EXCL */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); +} + +int main(int argc, char **argv) +{ + MPI_File fh; + int rank, len, err, i; + int errs = 0, toterrs; + char *filename; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: excl -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + if (!rank) + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); + + /* this open should succeed */ + err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (err != MPI_SUCCESS) { + handle_error(err, "MPI_File_open"); + errs++; + fprintf(stderr, "Process %d: open failed when it should have succeeded\n", rank); + } else + MPI_File_close(&fh); + + MPI_Barrier(MPI_COMM_WORLD); + + /* this open should fail */ + err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (err == MPI_SUCCESS) { + errs++; + fprintf(stderr, "Process %d: open succeeded when it should have failed\n", rank); + MPI_File_close(&fh); + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/external32.c b/3rd-party/romio341/test/external32.c new file mode 100644 index 0000000000000000000000000000000000000000..84b1a67e6d8a817ce59f376afe7f24bfac379207 --- /dev/null +++ b/3rd-party/romio341/test/external32.c @@ -0,0 +1,110 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <stdlib.h> +#include <stdio.h> +#include "mpi.h" + +#define TEST_LE 0x1 +#define TEST_BE 0x2 +#define TEST_FILENAME "test.datarep" + +#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, NULL); } + +static void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: (%d) %s\n", str, errcode, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + + + +static void is_little_or_big_endian(const char *datarep, char *c, char *c_le, int len) +{ + int i, is_le = 1, is_be = 1; + for (i = 0; i < len; i++) { + is_le = is_le && (c[i] == c_le[i]); + is_be = is_be && (c[i] == c_le[len - 1 - i]); + } + printf("%s datarep is ", datarep); + switch ((is_le ? TEST_LE : 0x0) | (is_be ? TEST_BE : 0x0)) { + case TEST_LE: + printf("LITTLE ENDIAN\n"); + break; + case TEST_BE: + printf("BIG ENDIAN\n"); + break; + case TEST_LE | TEST_BE: + printf("LITTLE or BIG ENDIAN\n"); + break; + default: + printf("unknown\n"); + break; + } +} + +/* This test checks if datareps given are little- or big-endian */ +int main(int argc, char *argv[]) +{ + int sample_i = 123456789, i, j; + char sample_i_le[4] = { 0x15, 0xcd, 0x5b, 0x07 }, c[4]; + const char *datarep[3] = { "native", "external32", "internal" }; + MPI_File fileh; + int rank; + FILE *fileh_std; + + if (sizeof(int) != 4) { + printf("non-supported sizeof(int)=%ld\n", sizeof(int)); + return (-1); + } + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + /* For each datarep */ + for (i = 0; i < 3; i++) { + + /* Open file */ + CHECK(MPI_File_open(MPI_COMM_WORLD, TEST_FILENAME, + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fileh)); + + /* Set view */ + CHECK(MPI_File_set_view(fileh, 0, MPI_INT, MPI_INT, datarep[i], MPI_INFO_NULL)); + + /* Write into file */ + CHECK(MPI_File_write_at(fileh, (MPI_Offset) rank, (void *) &sample_i, 1, + MPI_INT, MPI_STATUS_IGNORE)); + + /* Close file */ + CHECK(MPI_File_close(&fileh)); + + /* Check if your datarep is little or big endian */ + MPI_Barrier(MPI_COMM_WORLD); + if (rank == 0) { + fileh_std = fopen(TEST_FILENAME, "r"); + for (j = 0; j < 4; j++) { + if (feof(fileh_std)) { + printf("unexpected eof, aborted\n"); + return (-1); + } + fscanf(fileh_std, "%c", &c[j]); + } + is_little_or_big_endian(datarep[i], c, sample_i_le, 4); + fclose(fileh_std); + } + + /* Delete file */ + if (rank == 0) { + CHECK(MPI_File_delete(TEST_FILENAME, MPI_INFO_NULL)); + } + } + + MPI_Finalize(); + + return 0; +} diff --git a/3rd-party/romio321/test/fcoll_test.f.in b/3rd-party/romio341/test/fcoll_test.f.in similarity index 97% rename from 3rd-party/romio321/test/fcoll_test.f.in rename to 3rd-party/romio341/test/fcoll_test.f.in index d6bae7446c58ecb4fc731771e66be1c0b5f26889..9de090d73acddac4bf0b154ae89d87238e6eca62 100644 --- a/3rd-party/romio321/test/fcoll_test.f.in +++ b/3rd-party/romio341/test/fcoll_test.f.in @@ -1,7 +1,6 @@ -! -*- Mode: Fortran; -*- ! -! (C) 2001 by Argonne National Laboratory. -! See COPYRIGHT in top-level directory. +! Copyright (C) by Argonne National Laboratory +! See COPYRIGHT in top-level directory ! program main implicit none @@ -32,7 +31,6 @@ character*1024 str ! used to store the filename integer errs, toterrs @FORTRAN_MPI_OFFSET@ disp - @FTESTDEFINE@ errs = 0 call MPI_INIT(ierr) diff --git a/3rd-party/romio341/test/file_info.c b/3rd-party/romio341/test/file_info.c new file mode 100644 index 0000000000000000000000000000000000000000..a89b6041cd4811463a40affca37c888c4fc901fa --- /dev/null +++ b/3rd-party/romio341/test/file_info.c @@ -0,0 +1,424 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* Change for BG/L made by Hao Yu, yuh@us.ibm.com + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +/* this test wants to compare the hints it gets from a file with a set of + * default hints. These hints are specific to the MPI-IO implementation, so if + * you want to test something besides the default you'll have to use a command + * line argument */ + +typedef struct hint_defaults { + int cb_buffer_size; + int ind_rd_buffer_size; + int ind_wr_buffer_size; + const char *romio_cb_read; + const char *romio_cb_write; + const char *cb_config_list; +} hint_defaults; + +hint_defaults UFS_DEFAULTS = { + .cb_buffer_size = 16777216, + .ind_rd_buffer_size = 4194304, + .ind_wr_buffer_size = 524288, + .romio_cb_read = "automatic", + .romio_cb_write = "automatic", + .cb_config_list = "*:1" +}; + +hint_defaults BLUEGENE_DEFAULTS = { + .cb_buffer_size = 16777216, + .ind_rd_buffer_size = 4194304, + .ind_wr_buffer_size = 4194304, + .romio_cb_read = "enable", + .romio_cb_write = "enable", + .cb_config_list = NULL +}; + +/* #undef INFO_DEBUG */ + +/* Test will print out information about unexpected hint keys or values that + * differ from the default. Since this is often interesting but rarely an + * error, default will be to increment errror cound for true error conditions + * but not print out these "interesting" non-error cases. */ + +static int verbose = 0; +static int test_ufs = 0; +static int test_bluegene = 0; + +int main(int argc, char **argv) +{ + int i, len, nkeys, flag, mynod, default_striping_factor = 0, nprocs, errs = 0; + MPI_File fh; + MPI_Info info, info_used; + char *filename, key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL]; + hint_defaults *defaults; + int ret; + + MPI_Init(&argc, &argv); + + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + if (!strcmp("-v", *argv)) + verbose = 1; + else if (!strcmp("-u", *argv)) + test_ufs = 1; + else if (!strcmp("-b", *argv)) + test_bluegene = 1; + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: file_info [-v] -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&test_ufs, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&test_bluegene, 1, MPI_INT, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&test_ufs, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&test_bluegene, 1, MPI_INT, 0, MPI_COMM_WORLD); + } + if (test_ufs) { + defaults = &UFS_DEFAULTS; + } else if (test_bluegene) { + defaults = &BLUEGENE_DEFAULTS; + } else { + defaults = NULL; + } + +/* open the file with MPI_INFO_NULL */ + ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_INFO_NULL, &fh); + if (ret != MPI_SUCCESS) + handle_error(ret, "MPI_File_open"); + +/* check the default values set by ROMIO */ + MPI_File_get_info(fh, &info_used); + MPI_Info_get_nkeys(info_used, &nkeys); + + if (defaults != NULL) { + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info_used, i, key); + MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL - 1, value, &flag); +#ifdef INFO_DEBUG + if (!mynod) + fprintf(stderr, "Process %d, Default: key = %s, value = %s\n", mynod, key, value); +#endif + if (!strcmp("striping_factor", key)) { + default_striping_factor = atoi(value); + /* no check */ + } else if (!strcmp("cb_buffer_size", key)) { + if (atoi(value) != defaults->cb_buffer_size) { + errs++; + if (verbose) + fprintf(stderr, "cb_buffer_size is %d; should be %d\n", + atoi(value), defaults->cb_buffer_size); + } + } else if (!strcmp("romio_cb_read", key)) { + if (strcmp(defaults->romio_cb_read, value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_read is set to %s; should be %s\n", + value, defaults->romio_cb_read); + } + } else if (!strcmp("romio_cb_write", key)) { + if (strcmp(defaults->romio_cb_write, value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_write is set to %s; should be %s\n", + value, defaults->romio_cb_write); + } + } else if (!strcmp("cb_nodes", key)) { + /* unreliable test -- just ignore value */ + } else if (!strcmp("romio_no_indep_rw", key)) { + if (strcmp("false", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n", + value, "false"); + } + } else if (!strcmp("ind_rd_buffer_size", key)) { + if (atoi(value) != defaults->ind_rd_buffer_size) { + errs++; + if (verbose) + fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n", + atoi(value), defaults->ind_rd_buffer_size); + } + } else if (!strcmp("ind_wr_buffer_size", key)) { + if (atoi(value) != defaults->ind_wr_buffer_size) { + errs++; + if (verbose) + fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n", + atoi(value), defaults->ind_wr_buffer_size); + } + } else if (!strcmp("romio_ds_read", key)) { + if (strcmp("automatic", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_ds_read is set to %s; should be %s\n", + value, "automatic"); + } + } else if (!strcmp("romio_ds_write", key)) { + /* Unreliable test -- value is file system dependent. Ignore. */ + } else if (!strcmp("cb_config_list", key)) { +#ifndef SKIP_CB_CONFIG_LIST_TEST + if (strcmp(defaults->cb_config_list, value)) { + errs++; + if (verbose) + fprintf(stderr, "cb_config_list is set to %s; should be %s\n", + value, defaults->cb_config_list); + } +#endif + } + /* don't care about the defaults for these keys */ + else if (!strcmp("romio_cb_pfr", key)) { + } else if (!strcmp("romio_cb_fr_types", key)) { + } else if (!strcmp("romio_cb_fr_alignment", key)) { + } else if (!strcmp("romio_cb_ds_threshold", key)) { + } else if (!strcmp("romio_cb_alltoall", key)) { + } else { + if (verbose) + fprintf(stderr, "unexpected key %s (not counted as an error)\n", key); + } + } + } + MPI_Info_free(&info_used); + + MPI_File_close(&fh); + + /* delete the file */ + if (!mynod) + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); + +/* set new info values. */ + + MPI_Info_create(&info); + +/* The following four hints are accepted on all machines. They can + be specified at file-open time or later (any number of times). */ + + /* buffer size for collective I/O */ + MPI_Info_set(info, "cb_buffer_size", "8388608"); + + /* number of processes that actually perform I/O in collective I/O */ + sprintf(value, "%d", nprocs / 2); + MPI_Info_set(info, "cb_nodes", value); + + /* buffer size for data sieving in independent reads */ + MPI_Info_set(info, "ind_rd_buffer_size", "2097152"); + + /* buffer size for data sieving in independent writes */ + MPI_Info_set(info, "ind_wr_buffer_size", "1048576"); + + +/* The following three hints related to file striping are accepted only + on some parallel file systems and are ignored elsewhere. + They can be specified only at file-creation time; if specified later + they will be ignored. */ + + /* number of I/O devices across which the file will be striped. + * accepted only if 0 < value < default_striping_factor; + * ignored otherwise */ + if (default_striping_factor - 1 > 0) { + sprintf(value, "%d", default_striping_factor - 1); + MPI_Info_set(info, "striping_factor", value); + } else { + sprintf(value, "%d", default_striping_factor); + MPI_Info_set(info, "striping_factor", value); + } + + /* the striping unit in bytes */ + MPI_Info_set(info, "striping_unit", "131072"); + +#ifndef SKIP_CB_CONFIG_LIST_TEST + /* set the cb_config_list so we'll get deterministic cb_nodes output */ + MPI_Info_set(info, "cb_config_list", "*:*"); +#endif + + /* the I/O device number from which to start striping the file. + * accepted only if 0 <= value < default_striping_factor; + * ignored otherwise */ + sprintf(value, "%d", default_striping_factor - 2); + MPI_Info_set(info, "start_iodevice", value); + + +/* The following hint about PFS server buffering is accepted only on + Intel PFS. It can be specified anytime. */ + MPI_Info_set(info, "pfs_svr_buf", "true"); + +/* open the file and set new info */ + ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + if (ret != MPI_SUCCESS) + handle_error(ret, "MPI_File_open"); + +/* check the values set */ + ret = MPI_File_get_info(fh, &info_used); + if (ret != MPI_SUCCESS) + handle_error(ret, "MPI_File_get_info"); + MPI_Info_get_nkeys(info_used, &nkeys); + + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info_used, i, key); + MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL - 1, value, &flag); +#ifdef INFO_DEBUG + if (!mynod) + fprintf(stderr, "Process %d, key = %s, value = %s\n", mynod, key, value); +#endif + if (!strcmp("striping_factor", key)) { + if ((default_striping_factor - 1 > 0) && (atoi(value) != default_striping_factor - 1)) { + errs++; + if (verbose) + fprintf(stderr, "striping_factor is %d; should be %d\n", + atoi(value), default_striping_factor - 1); + } else if (atoi(value) != default_striping_factor) { + errs++; + if (verbose) + fprintf(stderr, "striping_factor is %d; should be %d\n", + atoi(value), default_striping_factor); + } + } else if (!strcmp("cb_buffer_size", key)) { + if (atoi(value) != 8388608) { + errs++; + if (verbose) + fprintf(stderr, "cb_buffer_size is %d; should be %d\n", atoi(value), 8388608); + } + } + /* only check the hints we set */ + else if (!strcmp("cb_nodes", key)) { + /* unreliable test: just skip */ + } else if (!strcmp("romio_no_indep_rw", key)) { + if (strcmp("false", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n", + value, "false"); + } + } else if (!strcmp("ind_rd_buffer_size", key)) { + if (atoi(value) != 2097152) { + errs++; + if (verbose) + fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n", + atoi(value), 2097152); + } + } else if (!strcmp("ind_wr_buffer_size", key)) { + if (atoi(value) != 1048576) { + errs++; + if (verbose) + fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n", + atoi(value), 1048576); + } + } else if (!strcmp("romio_ds_read", key)) { + if (strcmp("automatic", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_ds_read is set to %s; should be %s\n", + value, "automatic"); + } + } else if (!strcmp("romio_ds_write", key)) { + /* Unreliable test -- value is file system dependent. Ignore. */ + } else if (!strcmp("cb_config_list", key)) { +#ifndef SKIP_CB_CONFIG_LIST_TEST + if (strcmp("*:*", value)) { + errs++; + if (verbose) + fprintf(stderr, "cb_config_list is set to %s; should be %s\n", value, "*:*"); + } +#endif + } else if (!strcmp("romio_cb_pfr", key)) { + if (strcmp("disable", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_pfr is set to %s; should be %s\n", + value, "automatic"); + } + } else if (!strcmp("romio_cb_fr_types", key)) { + if (strcmp("aar", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_fr_types is set to %s; should be %s\n", value, "aar"); + } + } else if (!strcmp("romio_cb_fr_alignment", key)) { + if (strcmp("1", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_fr_alignment is set to %s; should be %s\n", + value, "1"); + } + } else if (!strcmp("romio_cb_ds_threshold", key)) { + if (strcmp("0", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_ds_threshold is set to %s; should be %s\n", + value, "0"); + } + } else if (!strcmp("romio_cb_alltoall", key)) { + if (strcmp("automatic", value)) { + errs++; + if (verbose) + fprintf(stderr, "romio_cb_alltoall is set to %s; should be %s\n", + value, "automatic"); + } + } + + else { + if (verbose) + fprintf(stderr, "unexpected key %s (not counted as an error)\n", key); + } + } + + /* Q: SHOULD WE BOTHER LOOKING AT THE OTHER PROCESSES? */ + if (!mynod) { + if (errs) + fprintf(stderr, "Found %d errors.\n", errs); + else + printf(" No Errors\n"); + } + + MPI_File_close(&fh); + + /* delete the file */ + if (!mynod) + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); + + free(filename); + MPI_Info_free(&info_used); + MPI_Info_free(&info); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio321/test/fmisc.f.in b/3rd-party/romio341/test/fmisc.f.in similarity index 97% rename from 3rd-party/romio321/test/fmisc.f.in rename to 3rd-party/romio341/test/fmisc.f.in index a75c4ee16edeb309a2f36d1c953ddf3d02e2b4aa..4bd02b605db174079598a4f0cc9909565f34f97a 100644 --- a/3rd-party/romio321/test/fmisc.f.in +++ b/3rd-party/romio341/test/fmisc.f.in @@ -1,7 +1,6 @@ -! -*- Mode: Fortran; -*- -! -! (C) 2001 by Argonne National Laboratory. -! See COPYRIGHT in top-level directory. +! +! Copyright (C) by Argonne National Laboratory +! See COPYRIGHT in top-level directory ! program main implicit none @@ -21,7 +20,6 @@ character*7 datarep character*1024 str ! used to store the filename @FORTRAN_MPI_OFFSET@ disp, offset, filesize - @FTESTDEFINE@ errs = 0 verbose = .false. diff --git a/3rd-party/romio321/test/fperf.f.in b/3rd-party/romio341/test/fperf.f.in similarity index 97% rename from 3rd-party/romio321/test/fperf.f.in rename to 3rd-party/romio341/test/fperf.f.in index 627794955cfa35dcb51ba96f8794d85cf9f200b7..cbd583cf62af6f1b2da71d2faa8e1560671a8c79 100644 --- a/3rd-party/romio321/test/fperf.f.in +++ b/3rd-party/romio341/test/fperf.f.in @@ -1,7 +1,6 @@ -! -*- Mode: Fortran; -*- -! -! (C) 2001 by Argonne National Laboratory. -! See COPYRIGHT in top-level directory. +! +! Copyright (C) by Argonne National Laboratory +! See COPYRIGHT in top-level directory ! program main implicit none @@ -22,7 +21,6 @@ integer fh, status(MPI_STATUS_SIZE), ierr, argc, iargc, i character*1024 str ! used to store the filename @FORTRAN_MPI_OFFSET@ offset - @FTESTDEFINE@ ntimes = 5 min_read_tim = 10000000.0D0 diff --git a/3rd-party/romio341/test/hindexed.c b/3rd-party/romio341/test/hindexed.c new file mode 100644 index 0000000000000000000000000000000000000000..256c765c2764d22f1c3d791ef58af06f66059dc2 --- /dev/null +++ b/3rd-party/romio341/test/hindexed.c @@ -0,0 +1,273 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* Wei-keng Liao (wkliao@ece.northwestern.edu) September 8, 2008 */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mpi.h> + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +#define YLEN 5 +#define XLEN 10 +#define SUB_XLEN 3 + +/* rjl: I was just too lazy to compute this at run-time */ +char compare_buf[XLEN * 4][YLEN * 4] = { + {'0', '1', '2', 0, 0, '3', '4', '5', 0, 0, 'D', 'E', 'F', 0, 0, 'G', 'H', 'I'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'6', '7', '8', 0, 0, '9', ':', ';', 0, 0, 'J', 'K', 'L', 0, 0, 'M', 'N', 'O'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'X', 'Y', 'Z', 0, 0, '[', '\\', ']', 0, 0, 'l', 'm', 'n', 0, 0, 'o', 'p', 'q'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'^', '_', '`', 0, 0, 'a', 'b', 'c', 0, 0, 'r', 's', 't', 0, 0, 'u', 'v', 'w'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'0', '1', '2', 0, 0, '3', '4', '5', 0, 0, 'D', 'E', 'F', 0, 0, 'G', 'H', 'I'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'6', '7', '8', 0, 0, '9', ':', ';', 0, 0, 'J', 'K', 'L', 0, 0, 'M', 'N', 'O'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'X', 'Y', 'Z', 0, 0, '[', '\\', ']', 0, 0, 'l', 'm', 'n', 0, 0, 'o', 'p', 'q'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {'^', '_', '`', 0, 0, 'a', 'b', 'c', 0, 0, 'r', 's', 't', 0, 0, 'u', 'v', 'w'}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +}; + + +/* set this if you want a dump of the global array +#define VERBOSE 1 +*/ + +/*----< main() >------------------------------------------------------------*/ +int main(int argc, char **argv) +{ + int i, j, err, rank, np, num_io; + char *buf, *filename; + int rank_dim[2], array_of_sizes[2]; + int array_of_subsizes[2]; + int count, *blocklengths, global_array_size; + MPI_Count ftype_size; + MPI_Aint *displacements; + MPI_File fh; + MPI_Datatype ftype; + MPI_Status status; + MPI_Offset offset = 0; + int nr_errors = 0; +#ifdef VERBOSE + int k; +#endif + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &np); + + if (np != 4) { + if (!rank) + printf("Please run with 4 processes. Exiting ...\n\n"); + MPI_Finalize(); + return 1; + } + + filename = argv[1]; + + num_io = 2; + + /*-----------------------------------------------------------------------*/ + /* process rank in each dimension */ + rank_dim[0] = rank / 2; + rank_dim[1] = rank % 2; + + /* global 2D array size */ + array_of_sizes[0] = YLEN * 2; + array_of_sizes[1] = XLEN * 2; + + global_array_size = array_of_sizes[0] * array_of_sizes[1]; + + array_of_subsizes[0] = YLEN / 2; + array_of_subsizes[1] = XLEN * SUB_XLEN / 5; + + offset = rank_dim[0] * YLEN * array_of_sizes[1] + rank_dim[1] * XLEN; + + /* define data type for file view */ + count = array_of_subsizes[0] * 2; /* 2 is the no. blocks along X */ + blocklengths = (int *) malloc(count * sizeof(int)); + displacements = (MPI_Aint *) malloc(count * sizeof(MPI_Aint)); + for (i = 0; i < count; i++) + blocklengths[i] = array_of_subsizes[1] / 2; + for (i = 0; i < array_of_subsizes[0]; i++) + for (j = 0; j < 2; j++) + displacements[i * 2 + j] = offset + i * 2 * array_of_sizes[1] + j * XLEN / 2; + MPI_Type_create_hindexed(count, blocklengths, displacements, MPI_CHAR, &ftype); + MPI_Type_commit(&ftype); + MPI_Type_size_x(ftype, &ftype_size); + +/* subarray's layout in the global array + + P0's 's layout P1's layout + [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] | [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] +[ 0] 0 1 2 3 4 5 | D E F G H I +[ 1] | +[ 2] 6 7 8 9 : ; | J K L M N O +[ 3] | +[ 4] | +[ 5] | +[ 6] | +[ 7] | +[ 8] | +[ 9] | + + P2's 's layout P3's layout + [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] | [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9] +[ 0] | +[ 1] | +[ 2] | +[ 3] | +[ 4] | +[ 5] X Y Z [ \ ] | l m n o p q +[ 6] | +[ 7] ^ _ ` a b c | r s t u v w +[ 8] | +[ 9] | +*/ + + /* initialize the write buffer */ + buf = (char *) malloc(array_of_subsizes[0] * array_of_subsizes[1]); + for (i = 0; i < array_of_subsizes[0] * array_of_subsizes[1]; i++) + buf[i] = '0' + rank * 20 + i % 79; + + /* zero file contents --------------------------------------------------- */ + if (rank == 0) { + char *wr_buf = (char *) calloc(num_io * global_array_size, 1); + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_write(fh, wr_buf, num_io * global_array_size, MPI_CHAR, &status)); + MPI_CHECK(MPI_File_close(&fh)); + free(wr_buf); + } + /* open the file -------------------------------------------------------- */ + err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); + if (err != MPI_SUCCESS) { + printf("Error: MPI_File_open() filename %s\n", filename); + MPI_Abort(MPI_COMM_WORLD, -1); + exit(1); + } + + /* MPI collective write */ + for (i = 0; i < num_io; i++) { + offset = i * global_array_size; + /* set the file view */ + MPI_CHECK(MPI_File_set_view(fh, offset, MPI_BYTE, ftype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_write_all(fh, buf, ftype_size, MPI_CHAR, &status)); + } + MPI_CHECK(MPI_File_close(&fh)); + + /* read and print file contents ----------------------------------------- */ + if (rank == 0) { + char *ptr; + char *rd_buf = (char *) calloc(num_io * global_array_size, 1); + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_read(fh, rd_buf, num_io * global_array_size, MPI_CHAR, &status)); + MPI_CHECK(MPI_File_close(&fh)); + +#ifdef VERBOSE + printf("-------------------------------------------------------\n"); + printf(" ["); + for (i = 0; i < 2; i++) { + for (j = 0; j < XLEN; j++) + printf(" %d", j); + printf(" "); + } + printf("]\n\n"); + + + ptr = rd_buf; + for (k = 0; k < num_io; k++) { + for (i = 0; i < 2 * YLEN; i++) { + printf("[%2d]", k * 2 * YLEN + i); + for (j = 0; j < 2 * XLEN; j++) { + if (j > 0 && j % XLEN == 0) + printf(" "); + if (*ptr != 0) + printf(" %c", *ptr); + else + printf(" "); + ptr++; + } + printf("\n"); + } + printf("\n"); + } +#endif + ptr = rd_buf; + for (i = 0; i < 2 * YLEN * num_io; i++) { + for (j = 0; j < 2 * XLEN; j++) { + if (*ptr != compare_buf[i][j]) { + fprintf(stderr, "expected %c got %c at [%d][%d]\n", + *ptr, compare_buf[i][j], i, j); + nr_errors++; + } + ptr++; + } + } + free(rd_buf); + + if (nr_errors == 0) + fprintf(stdout, " No Errors\n"); + else + fprintf(stderr, "Found %d errors\n", nr_errors); + } + + free(blocklengths); + free(displacements); + free(buf); + MPI_Type_free(&ftype); + MPI_Finalize(); + return 0; +} + +/* command-line outputs are: (the global array is written twice) + +% mpiexec -n 4 wkl_subarray +------------------------------------------------------- + [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ] + +[ 0] 0 1 2 3 4 5 D E F G H I +[ 1] +[ 2] 6 7 8 9 : ; J K L M N O +[ 3] +[ 4] +[ 5] X Y Z [ \ ] l m n o p q +[ 6] +[ 7] ^ _ ` a b c r s t u v w +[ 8] +[ 9] + +[10] 0 1 2 3 4 5 D E F G H I +[11] +[12] 6 7 8 9 : ; J K L M N O +[13] +[14] +[15] X Y Z [ \ ] l m n o p q +[16] +[17] ^ _ ` a b c r s t u v w +[18] +[19] + +*/ diff --git a/3rd-party/romio341/test/i_noncontig.c b/3rd-party/romio341/test/i_noncontig.c new file mode 100644 index 0000000000000000000000000000000000000000..7d3dc737ecc4ae408d712862cab5adb9dc9b25b8 --- /dev/null +++ b/3rd-party/romio341/test/i_noncontig.c @@ -0,0 +1,276 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests noncontiguous reads/writes using nonblocking I/O */ +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + + +#define SIZE 5000 + +#define VERBOSE 0 + +int main(int argc, char **argv) +{ + int *buf, i, mynod, nprocs, len, b[3]; + int errs = 0, toterrs; + MPI_Aint d[3]; + MPI_File fh; + MPI_Status status; + char *filename; + MPI_Datatype typevec, newtype, t[3]; + MPIO_Request req; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + if (nprocs != 2) { + fprintf(stderr, "Run this program on two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: i_noncontig -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(SIZE * sizeof(int)); + + MPI_Type_vector(SIZE / 2, 1, 2, MPI_INT, &typevec); + + b[0] = b[1] = b[2] = 1; + d[0] = 0; + d[1] = mynod * sizeof(int); + d[2] = SIZE * sizeof(int); + t[0] = MPI_LB; + t[1] = typevec; + t[2] = MPI_UB; + + MPI_Type_create_struct(3, b, d, t, &newtype); + MPI_Type_commit(&newtype); + MPI_Type_free(&typevec); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, noncontiguous in file using nonblocking I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_iwrite(fh, buf, 1, newtype, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_iread_at(fh, 0, buf, 1, newtype, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, contiguous in file using nonblocking I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_iwrite_at(fh, mynod * (SIZE / 2) * sizeof(int), buf, 1, newtype, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_iread_at(fh, mynod * (SIZE / 2) * sizeof(int), buf, 1, newtype, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting contiguous in memory, noncontiguous in file using nonblocking I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_iwrite(fh, buf, SIZE, MPI_INT, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_iread_at(fh, 0, buf, SIZE, MPI_INT, &req)); +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait(&req, &status); +#else + MPIO_Wait(&req, &status); +#endif + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if (buf[i] != i) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if (buf[i] != i + mynod * SIZE) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + MPI_Type_free(&newtype); + free(buf); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/large_array.c b/3rd-party/romio341/test/large_array.c new file mode 100644 index 0000000000000000000000000000000000000000..388d9826b9e9adb2378da712aaab67b937973702 --- /dev/null +++ b/3rd-party/romio341/test/large_array.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* Writes a 4-Gbyte distributed array, reads it back, and then deletes the + file. Uses collective I/O. */ +/* The file name is taken as a command-line argument. */ +/* Run it only on a machine with sufficient memory and a file system + on which ROMIO supports large files, i.e., any file system created after + 1999 */ + +/* This program will work only if the MPI implementation defines MPI_Aint + as a 64-bit integer. */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + + + +int main(int argc, char **argv) +{ + MPI_Datatype newtype; + int i, ndims, array_of_gsizes[3], array_of_distribs[3]; + int order, nprocs, len, flag, err; + int array_of_dargs[3], array_of_psizes[3]; + int *readbuf, *writebuf, mynod; + MPI_Count bufcount; + char filename[1024]; + MPI_File fh; + MPI_Status status; + MPI_Aint size_with_aint; + MPI_Offset size_with_offset; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: large_array -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + fprintf(stderr, + "This program creates a 4 Gbyte file. Don't run it if you don't have that much disk space!\n"); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + +/* create the distributed array filetype */ + ndims = 3; + order = MPI_ORDER_C; + + array_of_gsizes[0] = 1024; + array_of_gsizes[1] = 1024; + array_of_gsizes[2] = 4 * 1024 / sizeof(int); + + array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; + + array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; + + for (i = 0; i < ndims; i++) + array_of_psizes[i] = 0; + MPI_Dims_create(nprocs, ndims, array_of_psizes); + +/* check if MPI_Aint is large enough for size of global array. + if not, complain. */ + + size_with_aint = sizeof(int); + for (i = 0; i < ndims; i++) + size_with_aint *= array_of_gsizes[i]; + size_with_offset = sizeof(int); + for (i = 0; i < ndims; i++) + size_with_offset *= array_of_gsizes[i]; + if (size_with_aint != size_with_offset) { + fprintf(stderr, + "Can't use an array of this size unless the MPI implementation defines a 64-bit MPI_Aint\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, + array_of_distribs, array_of_dargs, + array_of_psizes, order, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + +/* initialize writebuf */ + + MPI_Type_size_x(newtype, &bufcount); + bufcount = bufcount / sizeof(int); + writebuf = (int *) malloc(bufcount * sizeof(int)); + if (!writebuf) + fprintf(stderr, "Process %d, not enough memory for writebuf\n", mynod); + for (i = 0; i < bufcount; i++) + writebuf[i] = mynod * 1024 + i; + + /* write the array to the file */ + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_write_all(fh, writebuf, bufcount, MPI_INT, &status)); + MPI_CHECK(MPI_File_close(&fh)); + + free(writebuf); + + /* now read it back */ + readbuf = (int *) calloc(bufcount, sizeof(int)); + if (!readbuf) + fprintf(stderr, "Process %d, not enough memory for readbuf\n", mynod); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_read_all(fh, readbuf, bufcount, MPI_INT, &status)); + MPI_CHECK(MPI_File_close(&fh)); + + /* check the data read */ + flag = 0; + for (i = 0; i < bufcount; i++) + if (readbuf[i] != mynod * 1024 + i) { + fprintf(stderr, "Process %d, readbuf=%d, writebuf=%d\n", mynod, readbuf[i], + mynod * 1024 + i); + flag = 1; + } + if (!flag) + fprintf(stderr, "Process %d: data read back is correct\n", mynod); + + MPI_Type_free(&newtype); + free(readbuf); + + MPI_Barrier(MPI_COMM_WORLD); + if (!mynod) { + err = MPI_File_delete(filename, MPI_INFO_NULL); + if (err == MPI_SUCCESS) + fprintf(stderr, "file deleted\n"); + } + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/large_file.c.in b/3rd-party/romio341/test/large_file.c.in new file mode 100644 index 0000000000000000000000000000000000000000..c1cbba8feafc50519f8be932b444193eb3117d0d --- /dev/null +++ b/3rd-party/romio341/test/large_file.c.in @@ -0,0 +1,122 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +/* writes a file of size 4 Gbytes and reads it back. + should be run on one process only*/ +/* The file name is taken as a command-line argument. */ +/* Can be used only on file systems on which ROMIO supports large files, + i.e., any file system created after 1999 */ + +#define SIZE 1048576*4 /* no. of long longs in each write/read */ +#define NTIMES 128 /* no. of writes/reads */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +int main(int argc, char **argv) +{ + MPI_File fh; + MPI_Status status; + MPI_Offset size; + long long *buf, i; + char *filename; + int j, mynod, nprocs, len, flag, err; + + MPI_Init(&argc, &argv); + + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + + if (nprocs != 1) { + fprintf(stderr, "Run this program on one process only\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: large -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + fprintf(stderr, + "This program creates an 4 Gbyte file. Don't run it if you don't have that much disk space!\n"); + + buf = (long long *) malloc(SIZE * sizeof(long long)); + if (!buf) { + fprintf(stderr, "not enough memory to allocate buffer\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + for (i = 0; i < NTIMES; i++) { + for (j = 0; j < SIZE; j++) + buf[j] = i * SIZE + j; + + err = MPI_File_write(fh, buf, SIZE, MPI_DOUBLE, &status); + /* MPI_DOUBLE because not all MPI implementations define + * MPI_LONG_LONG_INT, even though the C compiler supports long long. */ + if (err != MPI_SUCCESS) { + fprintf(stderr, "MPI_File_write returned error\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + + MPI_CHECK(MPI_File_get_size(fh, &size)); + fprintf(stderr, "file size = %@LL@ bytes\n", size); + + MPI_CHECK(MPI_File_seek(fh, 0, MPI_SEEK_SET)); + + for (j = 0; j < SIZE; j++) + buf[j] = -1; + + flag = 0; + for (i = 0; i < NTIMES; i++) { + err = MPI_File_read(fh, buf, SIZE, MPI_DOUBLE, &status); + /* MPI_DOUBLE because not all MPI implementations define + * MPI_LONG_LONG_INT, even though the C compiler supports long long. */ + if (err != MPI_SUCCESS) { + fprintf(stderr, "MPI_File_write returned error\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + for (j = 0; j < SIZE; j++) + if (buf[j] != i * SIZE + j) { + fprintf(stderr, "error: buf %d is %@LL@, should be %@LL@ \n", j, buf[j], + i * SIZE + j); + flag = 1; + } + } + + if (!flag) + fprintf(stderr, "Data read back is correct\n"); + MPI_CHECK(MPI_File_close(&fh)); + + free(buf); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/misc.c.in b/3rd-party/romio341/test/misc.c.in new file mode 100644 index 0000000000000000000000000000000000000000..5607d028dbd8868eafd8acdce65aaae5411d6f9d --- /dev/null +++ b/3rd-party/romio341/test/misc.c.in @@ -0,0 +1,267 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +/* tests various miscellaneous functions. */ +#define VERBOSE 0 + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); +} + +int main(int argc, char **argv) +{ + int buf[1024], amode, flag, mynod, len, i; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status; + MPI_Datatype newtype; + MPI_Offset disp, offset; + MPI_Group group; + MPI_Datatype etype, filetype; + char datarep[25], *filename; + int errcode = 0; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: misc -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + errcode = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_write(fh, buf, 1024, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_write"); + } + + errcode = MPI_File_sync(fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_sync"); + } + + errcode = MPI_File_get_amode(fh, &amode); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_amode"); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_get_amode\n"); +#endif + if (amode != (MPI_MODE_CREATE | MPI_MODE_RDWR)) { + errs++; + fprintf(stderr, "amode is %d, should be %d\n\n", amode, MPI_MODE_CREATE | MPI_MODE_RDWR); + } + + errcode = MPI_File_get_atomicity(fh, &flag); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_atomicity"); + } + if (flag) { + errs++; + fprintf(stderr, "atomicity is %d, should be 0\n", flag); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "setting atomic mode\n"); +#endif + errcode = MPI_File_set_atomicity(fh, 1); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_atomicity"); + } + errcode = MPI_File_get_atomicity(fh, &flag); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_atomicity"); + } + if (!flag) { + errs++; + fprintf(stderr, "atomicity is %d, should be 1\n", flag); + } + errcode = MPI_File_set_atomicity(fh, 0); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_atomicity"); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "reverting back to nonatomic mode\n"); +#endif + + MPI_Type_vector(10, 10, 20, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + + errcode = MPI_File_set_view(fh, 1000, MPI_INT, newtype, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_get_view\n"); +#endif + errcode = MPI_File_get_view(fh, &disp, &etype, &filetype, datarep); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_view"); + } + if ((disp != 1000) || strcmp(datarep, "native")) { + errs++; + fprintf(stderr, "disp = %@LL@, datarep = %s, should be 1000, native\n\n", disp, datarep); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_get_byte_offset\n"); +#endif + errcode = MPI_File_get_byte_offset(fh, 10, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (disp != (1000 + 20 * sizeof(int))) { + errs++; + fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", + disp, (int) (1000 + 20 * sizeof(int))); + } + + errcode = MPI_File_get_group(fh, &group); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_group"); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_set_size\n"); +#endif + errcode = MPI_File_set_size(fh, 1000 + 15 * sizeof(int)); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_size"); + } + MPI_Barrier(MPI_COMM_WORLD); + errcode = MPI_File_sync(fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_sync"); + } + errcode = MPI_File_get_size(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_size"); + } + if (disp != 1000 + 15 * sizeof(int)) { + errs++; + fprintf(stderr, "file size = %@LL@, should be %d\n\n", + disp, (int) (1000 + 15 * sizeof(int))); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "seeking to eof and testing MPI_File_get_position\n"); +#endif + errcode = MPI_File_seek(fh, 0, MPI_SEEK_END); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek"); + } + errcode = MPI_File_get_position(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_position"); + } + if (disp != 10) { + errs++; + fprintf(stderr, "file pointer posn = %@LL@, should be 10\n\n", disp); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_get_byte_offset\n"); +#endif + errcode = MPI_File_get_byte_offset(fh, disp, &offset); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (offset != (1000 + 20 * sizeof(int))) { + errs++; + fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", + offset, (int) (1000 + 20 * sizeof(int))); + } + MPI_Barrier(MPI_COMM_WORLD); + +#if VERBOSE + if (!mynod) + fprintf(stderr, "testing MPI_File_seek with MPI_SEEK_CUR\n"); +#endif + errcode = MPI_File_seek(fh, -10, MPI_SEEK_CUR); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek"); + } + errcode = MPI_File_get_position(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_position"); + } + errcode = MPI_File_get_byte_offset(fh, disp, &offset); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (offset != 1000) { + errs++; + fprintf(stderr, "file pointer posn in bytes = %@LL@, should be 1000\n\n", offset); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "preallocating disk space up to 8192 bytes\n"); +#endif + errcode = MPI_File_preallocate(fh, 8192); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_Preallocate"); + } +#if VERBOSE + if (!mynod) + fprintf(stderr, "closing the file and deleting it\n"); +#endif + MPI_File_close(&fh); + + MPI_Barrier(MPI_COMM_WORLD); + if (!mynod) + MPI_File_delete(filename, MPI_INFO_NULL); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + MPI_Type_free(&newtype); + MPI_Type_free(&filetype); + MPI_Group_free(&group); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/noncontig.c b/3rd-party/romio341/test/noncontig.c new file mode 100644 index 0000000000000000000000000000000000000000..63b9a2f53345a9ccb2ae22443b4408747907aec6 --- /dev/null +++ b/3rd-party/romio341/test/noncontig.c @@ -0,0 +1,279 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests noncontiguous reads/writes using independent I/O */ + +#define SIZE 5000 + +#define VERBOSE 0 + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +int main(int argc, char **argv) +{ + int *buf, i, mynod, nprocs, len, b[3]; + int errs = 0, toterrs; + MPI_Aint d[3]; + MPI_File fh; + MPI_Status status; + char *filename; + MPI_Datatype typevec, newtype, t[3]; + MPI_Info info; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + if (nprocs != 2) { + fprintf(stderr, "Run this program on two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes (length first, then string) */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: noncontig -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(SIZE * sizeof(int)); + + MPI_Type_vector(SIZE / 2, 1, 2, MPI_INT, &typevec); + + /* create a struct type with explicitly set LB and UB; displacements + * of typevec are such that the types for the two processes won't + * overlap. + */ + b[0] = b[1] = b[2] = 1; + d[0] = 0; + d[1] = mynod * sizeof(int); + d[2] = SIZE * sizeof(int); + t[0] = MPI_LB; + t[1] = typevec; + t[2] = MPI_UB; + + /* keep the struct, ditch the vector */ + MPI_Type_create_struct(3, b, d, t, &newtype); + MPI_Type_commit(&newtype); + MPI_Type_free(&typevec); + + MPI_Info_create(&info); + /* I am setting these info values for testing purposes only. It is + * better to use the default values in practice. */ + MPI_Info_set(info, "ind_rd_buffer_size", "1209"); + MPI_Info_set(info, "ind_wr_buffer_size", "1107"); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, noncontiguous in file using independent I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + + /* set the file view for each process -- now writes go into the non- + * overlapping but interleaved region defined by the struct type up above + */ + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + + /* fill our buffer with a pattern and write, using our type again */ + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write(fh, buf, 1, newtype, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + /* fill the entire buffer with -1's. read back with type. + * note that the result of this read should be that every other value + * in the buffer is still -1, as defined by our type. + */ + for (i = 0; i < SIZE; i++) + buf[i] = -1; + MPI_CHECK(MPI_File_read_at(fh, 0, buf, 1, newtype, &status)); + + /* check that all the values read are correct and also that we didn't + * overwrite any of the -1 values that we shouldn't have. + */ + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, contiguous in file using independent I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + + /* in this case we write to either the first half or the second half + * of the file space, so the regions are not interleaved. this is done + * by leaving the file view at its default. + */ + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write_at(fh, mynod * (SIZE / 2) * sizeof(int), buf, 1, newtype, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + /* same as before; fill buffer with -1's and then read; every other + * value should still be -1 after the read + */ + for (i = 0; i < SIZE; i++) + buf[i] = -1; + MPI_CHECK(MPI_File_read_at(fh, mynod * (SIZE / 2) * sizeof(int), buf, 1, newtype, &status)); + + /* verify that the buffer looks like it should */ + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting contiguous in memory, noncontiguous in file using independent I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + + /* set the file view so that we have interleaved access again */ + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + + /* this time write a contiguous buffer */ + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write(fh, buf, SIZE, MPI_INT, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + /* fill buffer with -1's; this time they will all be overwritten */ + for (i = 0; i < SIZE; i++) + buf[i] = -1; + MPI_CHECK(MPI_File_read_at(fh, 0, buf, SIZE, MPI_INT, &status)); + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if (buf[i] != i) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if (buf[i] != i + mynod * SIZE) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + /* delete the file */ + if (!mynod) + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + MPI_Type_free(&newtype); + MPI_Info_free(&info); + free(buf); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/noncontig_coll.c b/3rd-party/romio341/test/noncontig_coll.c new file mode 100644 index 0000000000000000000000000000000000000000..bd01b7a9452f9fbcfc4a97f399790ee961b74815 --- /dev/null +++ b/3rd-party/romio341/test/noncontig_coll.c @@ -0,0 +1,251 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests noncontiguous reads/writes using collective I/O */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +#define SIZE 5000 + +#define VERBOSE 0 +int main(int argc, char **argv) +{ + int *buf, i, mynod, nprocs, len, b[3]; + int errs = 0, toterrs; + MPI_Aint d[3]; + MPI_File fh; + MPI_Status status; + char *filename; + MPI_Datatype typevec, newtype, t[3]; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + if (nprocs != 2) { + fprintf(stderr, "Run this program on two processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: noncontig_coll -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(SIZE * sizeof(int)); + + MPI_Type_vector(SIZE / 2, 1, 2, MPI_INT, &typevec); + + b[0] = b[1] = b[2] = 1; + d[0] = 0; + d[1] = mynod * sizeof(int); + d[2] = SIZE * sizeof(int); + t[0] = MPI_LB; + t[1] = typevec; + t[2] = MPI_UB; + + MPI_Type_create_struct(3, b, d, t, &newtype); + MPI_Type_commit(&newtype); + MPI_Type_free(&typevec); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, noncontiguous in file using collective I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write_all(fh, buf, 1, newtype, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_read_at_all(fh, 0, buf, 1, newtype, &status)); + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting noncontiguous in memory, contiguous in file using collective I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write_at_all(fh, mynod * (SIZE / 2) * sizeof(int), + buf, 1, newtype, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_read_at_all(fh, mynod * (SIZE / 2) * sizeof(int), buf, 1, newtype, &status)); + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if ((i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + if (!(i % 2) && (buf[i] != i)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if ((i % 2) && (buf[i] != i + mynod * SIZE)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + if (!(i % 2) && (buf[i] != -1)) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { +#if VERBOSE + fprintf(stderr, + "\ntesting contiguous in memory, noncontiguous in file using collective I/O\n"); +#endif + MPI_File_delete(filename, MPI_INFO_NULL); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + + for (i = 0; i < SIZE; i++) + buf[i] = i + mynod * SIZE; + MPI_CHECK(MPI_File_write_all(fh, buf, SIZE, MPI_INT, &status)); + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + MPI_CHECK(MPI_File_read_at_all(fh, 0, buf, SIZE, MPI_INT, &status)); + + for (i = 0; i < SIZE; i++) { + if (!mynod) { + if (buf[i] != i) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], i); + } + } else { + if (buf[i] != i + mynod * SIZE) { + errs++; + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], i + mynod * SIZE); + } + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + /* delete the file */ + if (!mynod) + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + MPI_Type_free(&newtype); + free(buf); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/noncontig_coll2.c b/3rd-party/romio341/test/noncontig_coll2.c new file mode 100644 index 0000000000000000000000000000000000000000..9f597a8da0aa93166a7b9f91fb1ac01ef2fda519 --- /dev/null +++ b/3rd-party/romio341/test/noncontig_coll2.c @@ -0,0 +1,569 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* tests noncontiguous reads/writes using collective I/O */ + +/* this test is almost exactly like noncontig_coll.c with the following changes: + * + * . generalized file writing/reading to handle arbitrary number of processors + * . provides the "cb_config_list" hint with several permutations of the + * avaliable processors. + * [ makes use of code copied from ROMIO's ADIO code to collect the names of + * the processors ] + */ + + +#define MPI_CHECK(fn) { int _errcode; _errcode = (fn); if (_errcode != MPI_SUCCESS) handle_error(_errcode, #fn); } + +/* we are going to muck with this later to make it evenly divisible by however many compute nodes we have */ +#define STARTING_SIZE 5000 + +int test_file(char *filename, int mynod, int nprocs, char *cb_hosts, const char *msg, int verbose); + +#define ADIOI_Free free +#define ADIOI_Malloc malloc +#define FPRINTF fprintf +/* I have no idea what the "D" stands for; it's how things are done in adio.h + */ +struct ADIO_cb_name_arrayD { + int refct; + int namect; + char **names; +}; +typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; + +void handle_error(int errcode, const char *str); +int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array * arrayp); +void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest); + + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + + +/* cb_gather_name_array() - gather a list of processor names from all processes + * in a communicator and store them on rank 0. + * + * This is a collective call on the communicator(s) passed in. + * + * Obtains a rank-ordered list of processor names from the processes in + * "dupcomm". + * + * Returns 0 on success, -1 on failure. + * + * NOTE: Needs some work to cleanly handle out of memory cases! + */ +int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array * arrayp) +{ + /* this is copied from ROMIO, but since this test is for correctness, + * not performance, note that we have removed the parts where ROMIO + * uses a keyval to cache the name array. We'll just rebuild it if we + * need to */ + + char my_procname[MPI_MAX_PROCESSOR_NAME], **procname = 0; + int *procname_len = NULL, my_procname_len, *disp = NULL, i; + int commsize, commrank; + ADIO_cb_name_array array = NULL; + + MPI_Comm_size(comm, &commsize); + MPI_Comm_rank(comm, &commrank); + + MPI_Get_processor_name(my_procname, &my_procname_len); + + /* allocate space for everything */ + array = (ADIO_cb_name_array) malloc(sizeof(*array)); + if (array == NULL) { + return -1; + } + array->refct = 1; + + if (commrank == 0) { + /* process 0 keeps the real list */ + array->namect = commsize; + + array->names = (char **) ADIOI_Malloc(sizeof(char *) * commsize); + if (array->names == NULL) { + return -1; + } + procname = array->names; /* simpler to read */ + + procname_len = (int *) ADIOI_Malloc(commsize * sizeof(int)); + if (procname_len == NULL) { + return -1; + } + } else { + /* everyone else just keeps an empty list as a placeholder */ + array->namect = 0; + array->names = NULL; + } + /* gather lengths first */ + MPI_Gather(&my_procname_len, 1, MPI_INT, procname_len, 1, MPI_INT, 0, comm); + + if (commrank == 0) { +#ifdef CB_CONFIG_LIST_DEBUG + for (i = 0; i < commsize; i++) { + FPRINTF(stderr, "len[%d] = %d\n", i, procname_len[i]); + } +#endif + + for (i = 0; i < commsize; i++) { + /* add one to the lengths because we need to count the + * terminator, and we are going to use this list of lengths + * again in the gatherv. + */ + procname_len[i]++; + procname[i] = malloc(procname_len[i]); + if (procname[i] == NULL) { + return -1; + } + } + + /* create our list of displacements for the gatherv. we're going + * to do everything relative to the start of the region allocated + * for procname[0] + * + * I suppose it is theoretically possible that the distance between + * malloc'd regions could be more than will fit in an int. We don't + * cover that case. + */ + disp = malloc(commsize * sizeof(int)); + disp[0] = 0; + for (i = 1; i < commsize; i++) { + disp[i] = (int) (procname[i] - procname[0]); + } + + } + + /* now gather strings */ + if (commrank == 0) { + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + procname[0], procname_len, disp, MPI_CHAR, 0, comm); + } else { + /* if we didn't do this, we would need to allocate procname[] + * on all processes...which seems a little silly. + */ + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + NULL, NULL, NULL, MPI_CHAR, 0, comm); + } + + if (commrank == 0) { + /* no longer need the displacements or lengths */ + free(disp); + free(procname_len); + +#ifdef CB_CONFIG_LIST_DEBUG + for (i = 0; i < commsize; i++) { + fprintf(stderr, "name[%d] = %s\n", i, procname[i]); + } +#endif + } + + *arrayp = array; + return 0; +} + +void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest) +{ + char *ptr; + int i, p; + if (!mynod) { + ptr = dest; + for (i = 0; i < array->namect; i++) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + /* chop off that last comma */ + dest[strlen(dest) - 1] = '\0'; + } + MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); +} + +void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest) +{ + char *ptr; + int i, p; + if (!mynod) { + ptr = dest; + for (i = (array->namect - 1); i >= 0; i--) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + dest[strlen(dest) - 1] = '\0'; + } + MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); +} + +void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest) +{ + char *ptr; + int i, p; + if (!mynod) { + ptr = dest; + /* evens */ + for (i = (array->namect - 1); i >= 0; i -= 2) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + /* odds */ + for (i = (array->namect - 2); i > 0; i -= 2) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + dest[strlen(dest) - 1] = '\0'; + } + MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); +} + +void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest) +{ + char *ptr; + int i, p; + if (!mynod) { + ptr = dest; + for (i = (array->namect / 2); i < array->namect; i++) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + for (i = 0; i < (array->namect / 2); i++) { + p = snprintf(ptr, len, "%s,", array->names[i]); + ptr += p; + } + dest[strlen(dest) - 1] = '\0'; + } + MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); +} + +int main(int argc, char **argv) +{ + int i, mynod, nprocs, len, errs = 0, sum_errs = 0, verbose = 0; + char *filename; + char *cb_config_string; + int cb_config_len; + ADIO_cb_name_array array; + + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + + /* process 0 takes the file name as a command-line argument and + * broadcasts it to other processes */ + if (!mynod) { + i = 1; + /* TODO: at some point, accept -v for verbose */ + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: noncontig_coll -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + /* want to hint the cb_config_list, but do so in a non-sequential way */ + cb_gather_name_array(MPI_COMM_WORLD, &array); + + /* sanity check */ + if (!mynod) { + if (array->namect < 2) { + fprintf(stderr, "Run this test on two or more hosts\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + /* get space for the permuted cb_config_string */ + if (!mynod) { + cb_config_len = 0; + for (i = 0; i < array->namect; i++) { + /* +1: space for either a , or \0 if last */ + cb_config_len += strlen(array->names[i]) + 1; + } + ++cb_config_len; + } + MPI_Bcast(&cb_config_len, 1, MPI_INT, 0, MPI_COMM_WORLD); + if ((cb_config_string = malloc(cb_config_len)) == NULL) { + perror("malloc"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + /* first, no hinting */ + errs += test_file(filename, mynod, nprocs, NULL, "collective w/o hinting", verbose); + + /* hint, but no change in order */ + default_str(mynod, cb_config_len, array, cb_config_string); + errs += + test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: default order", + verbose); + + /* reverse order */ + reverse_str(mynod, cb_config_len, array, cb_config_string); + errs += + test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: reverse order", + verbose); + + /* reverse, every other */ + reverse_alternating_str(mynod, cb_config_len, array, cb_config_string); + errs += + test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: permutation1", + verbose); + + /* second half, first half */ + simple_shuffle_str(mynod, cb_config_len, array, cb_config_string); + errs += + test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: permutation2", + verbose); + + MPI_Allreduce(&errs, &sum_errs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + + if (!mynod) { + if (sum_errs) + fprintf(stderr, "Found %d error cases\n", sum_errs); + else + printf(" No Errors\n"); + } + free(filename); + free(cb_config_string); + MPI_Finalize(); + return 0; +} + +#define SEEDER(x,y,z) ((x)*1000000 + (y) + (x)*(z)) + +int test_file(char *filename, int mynod, int nprocs, char *cb_hosts, const char *msg, int verbose) +{ + MPI_Datatype typevec, newtype, t[3]; + int *buf, i, b[3], errcode, errors = 0; + MPI_File fh; + MPI_Aint d[3]; + MPI_Status status; + int SIZE = (STARTING_SIZE / nprocs) * nprocs; + MPI_Info info; + + if (mynod == 0 && verbose) + fprintf(stderr, "%s\n", msg); + + buf = (int *) malloc(SIZE * sizeof(int)); + if (buf == NULL) { + perror("test_file"); + MPI_Abort(MPI_COMM_WORLD, -1); + } + + + if (cb_hosts != NULL) { + MPI_Info_create(&info); + MPI_Info_set(info, "cb_config_list", cb_hosts); + } else { + info = MPI_INFO_NULL; + } + + MPI_Type_vector(SIZE / nprocs, 1, nprocs, MPI_INT, &typevec); + + b[0] = b[1] = b[2] = 1; + d[0] = 0; + d[1] = mynod * sizeof(int); + d[2] = SIZE * sizeof(int); + t[0] = MPI_LB; + t[1] = typevec; + t[2] = MPI_UB; + + MPI_Type_create_struct(3, b, d, t, &newtype); + MPI_Type_commit(&newtype); + MPI_Type_free(&typevec); + + if (!mynod) { + if (verbose) + fprintf(stderr, + "\ntesting noncontiguous in memory, noncontiguous in file using collective I/O\n"); + MPI_File_delete(filename, info); + } + MPI_Barrier(MPI_COMM_WORLD); + + errcode = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + + for (i = 0; i < SIZE; i++) + buf[i] = SEEDER(mynod, i, SIZE); + errcode = MPI_File_write_all(fh, buf, 1, newtype, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "nc mem - nc file: MPI_File_write_all"); + } + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + errcode = MPI_File_read_at_all(fh, 0, buf, 1, newtype, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "nc mem - nc file: MPI_File_read_at_all"); + } + + /* the verification for N compute nodes is tricky. Say we have 3 + * processors. + * process 0 sees: 0 -1 -1 3 -1 -1 ... + * process 1 sees: -1 34 -1 -1 37 -1 ... + * process 2 sees: -1 -1 68 -1 -1 71 ... */ + + /* verify those leading -1s exist if they should */ + for (i = 0; i < mynod; i++) { + if (buf[i] != -1) { + if (verbose) + fprintf(stderr, "Process %d: buf is %d, should be -1\n", mynod, buf[i]); + errors++; + } + } + /* now the modulo games are hairy. processor 0 sees real data in the 0th, + * 3rd, 6th... elements of the buffer (assuming nprocs==3). proc 1 sees + * the data in 1st, 4th, 7th..., and proc 2 sees it in 2nd, 5th, 8th */ + + for (/* 'i' set in above loop */ ; i < SIZE; i++) { + if (((i - mynod) % nprocs) && buf[i] != -1) { + if (verbose) + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + errors++; + } + if (!((i - mynod) % nprocs) && buf[i] != SEEDER(mynod, i, SIZE)) { + if (verbose) + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], SEEDER(mynod, i, SIZE)); + errors++; + } + } + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { + if (verbose) + fprintf(stderr, + "\ntesting noncontiguous in memory, contiguous in file using collective I/O\n"); + MPI_File_delete(filename, info); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + + for (i = 0; i < SIZE; i++) + buf[i] = SEEDER(mynod, i, SIZE); + errcode = MPI_File_write_at_all(fh, mynod * (SIZE / nprocs) * sizeof(int), + buf, 1, newtype, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "nc mem - c file: MPI_File_write_at_all"); + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + errcode = MPI_File_read_at_all(fh, mynod * (SIZE / nprocs) * sizeof(int), + buf, 1, newtype, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "nc mem - c file: MPI_File_read_at_all"); + + /* just like as above */ + for (i = 0; i < mynod; i++) { + if (buf[i] != -1) { + if (verbose) + fprintf(stderr, "Process %d: buf is %d, should be -1\n", mynod, buf[i]); + errors++; + } + } + for (/* i set in above loop */ ; i < SIZE; i++) { + if (((i - mynod) % nprocs) && buf[i] != -1) { + if (verbose) + fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", mynod, i, buf[i]); + errors++; + } + if (!((i - mynod) % nprocs) && buf[i] != SEEDER(mynod, i, SIZE)) { + if (verbose) + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", + mynod, i, buf[i], SEEDER(mynod, i, SIZE)); + errors++; + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + if (!mynod) { + if (verbose) + fprintf(stderr, + "\ntesting contiguous in memory, noncontiguous in file using collective I/O\n"); + MPI_File_delete(filename, info); + } + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh)); + + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info)); + + for (i = 0; i < SIZE; i++) + buf[i] = SEEDER(mynod, i, SIZE); + errcode = MPI_File_write_all(fh, buf, SIZE, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "c mem - nc file: MPI_File_write_all"); + + MPI_Barrier(MPI_COMM_WORLD); + + for (i = 0; i < SIZE; i++) + buf[i] = -1; + + errcode = MPI_File_read_at_all(fh, 0, buf, SIZE, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "c mem - nc file: MPI_File_read_at_all"); + + /* same crazy checking */ + for (i = 0; i < SIZE; i++) { + if (buf[i] != SEEDER(mynod, i, SIZE)) { + if (verbose) + fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", mynod, i, buf[i], + SEEDER(mynod, i, SIZE)); + errors++; + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + /* delete the file */ + if (!mynod) + MPI_File_delete(filename, info); + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Type_free(&newtype); + free(buf); + if (info != MPI_INFO_NULL) + MPI_Info_free(&info); + return errors; +} diff --git a/3rd-party/romio341/test/ordered_fp.c b/3rd-party/romio341/test/ordered_fp.c new file mode 100644 index 0000000000000000000000000000000000000000..ab3471ce99d74fb1ad12a1297813dfccebd88802 --- /dev/null +++ b/3rd-party/romio341/test/ordered_fp.c @@ -0,0 +1,142 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define COUNT (200) +#undef TIMING + +void handle_error(int errcode, const char *str); + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); +} + +/* tests shared file pointer functions */ + +int main(int argc, char **argv) +{ + int *buf, i, rank, nprocs, len, sum; + int global_sum; + int errs = 0, toterrs, errcode; + char *filename; + MPI_File fh; + MPI_Status status; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + double wr_stime, wr_etime, wr_time, wr_sumtime; + double rd_stime, rd_etime, rd_time, rd_sumtime; + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(COUNT * sizeof(int)); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + + for (i = 0; i < COUNT; i++) + buf[i] = COUNT * rank + i; + + errcode = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + wr_stime = MPI_Wtime(); + + errcode = MPI_File_write_ordered(fh, buf, COUNT, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_write_shared"); + } + wr_etime = MPI_Wtime(); + + for (i = 0; i < COUNT; i++) + buf[i] = 0; + + MPI_Barrier(MPI_COMM_WORLD); + + rd_stime = MPI_Wtime(); + errcode = MPI_File_seek_shared(fh, 0, MPI_SEEK_SET); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek_shared"); + } + + errcode = MPI_File_read_ordered(fh, buf, COUNT, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_read_shared"); + } + + rd_etime = MPI_Wtime(); + MPI_File_close(&fh); + + sum = 0; + for (i = 0; i < COUNT; i++) + sum += buf[i]; + + MPI_Allreduce(&sum, &global_sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + + wr_time = wr_etime - wr_stime; + rd_time = rd_etime - rd_stime; + + MPI_Allreduce(&wr_time, &wr_sumtime, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(&rd_time, &rd_sumtime, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + + if (global_sum != (((COUNT * nprocs - 1) * (COUNT * nprocs)) / 2)) { + errs++; + fprintf(stderr, "Error: sum %d, global_sum %d, %d\n", + sum, global_sum, (((COUNT * nprocs - 1) * (COUNT * nprocs)) / 2)); + } + + free(buf); + free(filename); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); +#ifdef TIMING + fprintf(stderr, "nprocs: %d bytes: %d write: %f read %f\n", + nprocs, COUNT * sizeof(int), wr_sumtime, rd_sumtime); +#endif + } + } + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/perf.c b/3rd-party/romio341/test/perf.c new file mode 100644 index 0000000000000000000000000000000000000000..e8c469d3e9e10687ab4a572a66521bb4c8cb575a --- /dev/null +++ b/3rd-party/romio341/test/perf.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* A simple performance test. The file name is taken as a + command-line argument. */ + +#define SIZE (1048576*4) /* read/write size per node in bytes */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + + +int main(int argc, char **argv) +{ + int *buf, i, j, mynod, nprocs, ntimes = 5, len, err, flag; + double stim, read_tim, write_tim, new_read_tim, new_write_tim; + double min_read_tim = 10000000.0, min_write_tim = 10000000.0, read_bw, write_bw; + MPI_File fh; + MPI_Status status; + char *filename; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: perf -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + fprintf(stderr, "Access size per process = %d bytes, ntimes = %d\n", SIZE, ntimes); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + + for (j = 0; j < ntimes; j++) { + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_seek(fh, mynod * SIZE, MPI_SEEK_SET)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_write(fh, buf, SIZE, MPI_BYTE, &status)); + write_tim = MPI_Wtime() - stim; + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | + MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_seek(fh, mynod * SIZE, MPI_SEEK_SET)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_read(fh, buf, SIZE, MPI_BYTE, &status)); + read_tim = MPI_Wtime() - stim; + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + + min_read_tim = (new_read_tim < min_read_tim) ? new_read_tim : min_read_tim; + min_write_tim = (new_write_tim < min_write_tim) ? new_write_tim : min_write_tim; + } + + if (mynod == 0) { + read_bw = (SIZE * nprocs) / (min_read_tim * 1024.0 * 1024.0); + write_bw = (SIZE * nprocs) / (min_write_tim * 1024.0 * 1024.0); + fprintf(stderr, "Write bandwidth without file sync = %f Mbytes/sec\n", write_bw); + fprintf(stderr, "Read bandwidth without prior file sync = %f Mbytes/sec\n", read_bw); + } + + min_write_tim = 10000000.0; + min_read_tim = 10000000.0; + + flag = 0; + for (j = 0; j < ntimes; j++) { + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | + MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_seek(fh, mynod * SIZE, MPI_SEEK_SET)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_write(fh, buf, SIZE, MPI_BYTE, &status)); + err = MPI_File_sync(fh); + write_tim = MPI_Wtime() - stim; + if (err == MPI_ERR_UNKNOWN) { + flag = 1; + break; + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Barrier(MPI_COMM_WORLD); + + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | + MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_seek(fh, mynod * SIZE, MPI_SEEK_SET)); + + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + MPI_CHECK(MPI_File_read(fh, buf, SIZE, MPI_BYTE, &status)); + read_tim = MPI_Wtime() - stim; + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&write_tim, &new_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_Allreduce(&read_tim, &new_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + + min_read_tim = (new_read_tim < min_read_tim) ? new_read_tim : min_read_tim; + min_write_tim = (new_write_tim < min_write_tim) ? new_write_tim : min_write_tim; + } + + if (mynod == 0) { + if (flag) + fprintf(stderr, "MPI_File_sync returns error.\n"); + else { + read_bw = (SIZE * nprocs) / (min_read_tim * 1024.0 * 1024.0); + write_bw = (SIZE * nprocs) / (min_write_tim * 1024.0 * 1024.0); + fprintf(stderr, "Write bandwidth including file sync = %f Mbytes/sec\n", write_bw); + fprintf(stderr, "Read bandwidth after file sync = %f Mbytes/sec\n", read_bw); + } + } + + free(buf); + free(filename); + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio321/test/pfcoll_test.f.in b/3rd-party/romio341/test/pfcoll_test.f.in similarity index 97% rename from 3rd-party/romio321/test/pfcoll_test.f.in rename to 3rd-party/romio341/test/pfcoll_test.f.in index d05db1d9d0fdc34ffbcd3bd24a7d233f2884f14e..b8dfada4477def049a4a9b81f20baeb35ed97c77 100644 --- a/3rd-party/romio321/test/pfcoll_test.f.in +++ b/3rd-party/romio341/test/pfcoll_test.f.in @@ -1,7 +1,6 @@ -! -*- Mode: Fortran; -*- -! -! (C) 2001 by Argonne National Laboratory. -! See COPYRIGHT in top-level directory. +! +! Copyright (C) by Argonne National Laboratory +! See COPYRIGHT in top-level directory ! program main implicit none @@ -33,7 +32,6 @@ character*1024 str ! used to store the filename integer errs, toterrs @FORTRAN_MPI_OFFSET@ disp - @FTESTDEFINE@ errs = 0 call PMPI_INIT(ierr) diff --git a/3rd-party/romio341/test/psimple.c b/3rd-party/romio341/test/psimple.c new file mode 100644 index 0000000000000000000000000000000000000000..9f3e54ef60fb421267b59e6618fdc00c14f9f8c7 --- /dev/null +++ b/3rd-party/romio341/test/psimple.c @@ -0,0 +1,116 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define SIZE (65536) + +/* This is the same as simple.c, but uses the PMPI versions of all + MPI functions in order to test the profiling interface. */ + +/* Each process writes to separate files and reads them back. + The file name is taken as a command-line argument, and the process rank + is appended to it. */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len; + char *filename, *tmp; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status; + + PMPI_Init(&argc, &argv); + PMPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); + PMPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + PMPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + PMPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + nints = SIZE / sizeof(int); + for (i = 0; i < nints; i++) + buf[i] = rank * 100000 + i; + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + MPI_CHECK(PMPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(PMPI_File_write(fh, buf, nints, MPI_INT, &status)); + MPI_CHECK(PMPI_File_close(&fh)); + + /* reopen the file and read the data back */ + + for (i = 0; i < nints; i++) + buf[i] = 0; + MPI_CHECK(PMPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(PMPI_File_read(fh, buf, nints, MPI_INT, &status)); + MPI_CHECK(PMPI_File_close(&fh)); + + /* check if the data read is correct */ + for (i = 0; i < nints; i++) { + if (buf[i] != (rank * 100000 + i)) { + errs++; + fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], + rank * 100000 + i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + free(buf); + free(filename); + free(tmp); + + PMPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio321/test/rtest.in b/3rd-party/romio341/test/rtest.in similarity index 96% rename from 3rd-party/romio321/test/rtest.in rename to 3rd-party/romio341/test/rtest.in index c6fd30584354a73138eb7ee06202f418a24251e6..01b43b9a4e556ab4fd051d83a862d2cbb1fda6cd 100644 --- a/3rd-party/romio321/test/rtest.in +++ b/3rd-party/romio341/test/rtest.in @@ -1,5 +1,9 @@ #! /bin/sh -# +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + # Run some of the tests. If any arguments are provided, pass them to the # test programs. # diff --git a/3rd-party/romio321/test/runtests.in b/3rd-party/romio341/test/runtests.in similarity index 99% rename from 3rd-party/romio321/test/runtests.in rename to 3rd-party/romio341/test/runtests.in index 0e5e58fcd928d934b1813446df5ed0258b4a8fd3..7af4ee053cfcf862b54eb51d0919172ded61bffb 100644 --- a/3rd-party/romio321/test/runtests.in +++ b/3rd-party/romio341/test/runtests.in @@ -1,4 +1,9 @@ #! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ @@ -159,6 +164,7 @@ if [ ! -x simple -a $makeeach = 0 ] ; then $MAKE default fi # + testfiles="" if [ $runtests = 1 ] ; then echo '**** Testing I/O functions ****' @@ -438,6 +444,7 @@ else exit 1 fi fi + # # echo '*** Checking for differences from expected output ***' # rm -f iotests.diff diff --git a/3rd-party/romio341/test/shared_fp.c b/3rd-party/romio341/test/shared_fp.c new file mode 100644 index 0000000000000000000000000000000000000000..e5c413a319f34e475539ec1d4e7bda561d3cbddb --- /dev/null +++ b/3rd-party/romio341/test/shared_fp.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define COUNT 1024 + +void handle_error(int errcode, const char *str); + +void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); +} + +/* tests shared file pointer functions */ + +int main(int argc, char **argv) +{ + int *buf, i, rank, nprocs, len, sum, global_sum; + int errs = 0, toterrs, errcode; + char *filename; + MPI_File fh; + MPI_Status status; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(COUNT * sizeof(int)); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + + for (i = 0; i < COUNT; i++) + buf[i] = COUNT * rank + i; + + errcode = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + errs++; + } + + errcode = MPI_File_write_shared(fh, buf, COUNT, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_write_shared"); + errs++; + } + + for (i = 0; i < COUNT; i++) + buf[i] = 0; + + MPI_Barrier(MPI_COMM_WORLD); + + errcode = MPI_File_seek_shared(fh, 0, MPI_SEEK_SET); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek_shared"); + errs++; + } + + errcode = MPI_File_read_shared(fh, buf, COUNT, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_read_shared"); + errs++; + } + + MPI_File_close(&fh); + + sum = 0; + for (i = 0; i < COUNT; i++) + sum += buf[i]; + + MPI_Allreduce(&sum, &global_sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + + if (global_sum != (((COUNT * nprocs - 1) * (COUNT * nprocs)) / 2)) { + errs++; + fprintf(stderr, "Error: sum %d, global_sum %d, %d\n", + sum, global_sum, (((COUNT * nprocs - 1) * (COUNT * nprocs)) / 2)); + } + + free(buf); + free(filename); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/simple.c b/3rd-party/romio341/test/simple.c new file mode 100644 index 0000000000000000000000000000000000000000..33ed4fd9e2c25d95fbdfe02e3104cbf6d21ec873 --- /dev/null +++ b/3rd-party/romio341/test/simple.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define SIZE (65536) + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +/* Each process writes to separate files and reads them back. + The file name is taken as a command-line argument, and the process rank + is appended to it. */ + +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len; + char *filename, *tmp; + int errs = 0, toterrs, errcode; + MPI_File fh; + MPI_Status status; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + nints = SIZE / sizeof(int); + for (i = 0; i < nints; i++) + buf[i] = rank * 100000 + i; + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open(1)"); + + errcode = MPI_File_write(fh, buf, nints, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_write"); + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_clode (1)"); + + /* reopen the file and read the data back */ + + for (i = 0; i < nints; i++) + buf[i] = 0; + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_open(2)"); + + errcode = MPI_File_read(fh, buf, nints, MPI_INT, &status); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_read"); + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) + handle_error(errcode, "MPI_File_close(2)"); + + /* check if the data read is correct */ + for (i = 0; i < nints; i++) { + if (buf[i] != (rank * 100000 + i)) { + errs++; + fprintf(stderr, "Process %d: error, read %d, should be %d\n", + rank, buf[i], rank * 100000 + i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + free(buf); + free(filename); + free(tmp); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/split_coll.c b/3rd-party/romio341/test/split_coll.c new file mode 100644 index 0000000000000000000000000000000000000000..bb4a187d2c567b554173865f97e889d35110bf7d --- /dev/null +++ b/3rd-party/romio341/test/split_coll.c @@ -0,0 +1,172 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +/* A 32^3 array. For other array sizes, change array_of_gsizes below. */ + +/* Uses split collective I/O. Writes a 3D block-distributed array to a file + corresponding to the global array in row-major (C) order, reads it + back, and checks that the data read is correct. */ + +/* The file name is taken as a command-line argument. */ + +/* Note that the file access pattern is noncontiguous. */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +int main(int argc, char **argv) +{ + MPI_Datatype newtype; + int i, ndims, array_of_gsizes[3], array_of_distribs[3]; + int order, nprocs, j, len; + int array_of_dargs[3], array_of_psizes[3]; + int *readbuf, *writebuf, mynod, *tmpbuf, array_size; + MPI_Count bufcount; + int errs = 0, toterrs; + char *filename; + MPI_File fh; + MPI_Status status; + MPI_Request request; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!mynod) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: coll_test -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 1); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 1); + MPI_Bcast(filename, len + 1, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + +/* create the distributed array filetype */ + ndims = 3; + order = MPI_ORDER_C; + + array_of_gsizes[0] = 32; + array_of_gsizes[1] = 32; + array_of_gsizes[2] = 32; + + array_of_distribs[0] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[1] = MPI_DISTRIBUTE_BLOCK; + array_of_distribs[2] = MPI_DISTRIBUTE_BLOCK; + + array_of_dargs[0] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[1] = MPI_DISTRIBUTE_DFLT_DARG; + array_of_dargs[2] = MPI_DISTRIBUTE_DFLT_DARG; + + for (i = 0; i < ndims; i++) + array_of_psizes[i] = 0; + MPI_Dims_create(nprocs, ndims, array_of_psizes); + + MPI_Type_create_darray(nprocs, mynod, ndims, array_of_gsizes, + array_of_distribs, array_of_dargs, + array_of_psizes, order, MPI_INT, &newtype); + MPI_Type_commit(&newtype); + +/* initialize writebuf */ + + MPI_Type_size_x(newtype, &bufcount); + bufcount = bufcount / sizeof(int); + writebuf = (int *) malloc(bufcount * sizeof(int)); + for (i = 0; i < bufcount; i++) + writebuf[i] = 1; + + array_size = array_of_gsizes[0] * array_of_gsizes[1] * array_of_gsizes[2]; + tmpbuf = (int *) calloc(array_size, sizeof(int)); + MPI_Irecv(tmpbuf, 1, newtype, mynod, 10, MPI_COMM_WORLD, &request); + MPI_Send(writebuf, bufcount, MPI_INT, mynod, 10, MPI_COMM_WORLD); + MPI_Wait(&request, &status); + + j = 0; + for (i = 0; i < array_size; i++) + if (tmpbuf[i]) { + writebuf[j] = i; + j++; + } + free(tmpbuf); + + if (j != bufcount) { + fprintf(stderr, "Error in initializing writebuf on process %d\n", mynod); + MPI_Abort(MPI_COMM_WORLD, 1); + } +/* end of initialization */ + + /* write the array to the file */ + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_write_all_begin(fh, writebuf, bufcount, MPI_INT)); + MPI_CHECK(MPI_File_write_all_end(fh, writebuf, &status)); + MPI_CHECK(MPI_File_close(&fh)); + + + /* now read it back */ + readbuf = (int *) malloc(bufcount * sizeof(int)); + MPI_CHECK(MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL)); + MPI_CHECK(MPI_File_read_all_begin(fh, readbuf, bufcount, MPI_INT)); + MPI_CHECK(MPI_File_read_all_end(fh, readbuf, &status)); + MPI_CHECK(MPI_File_close(&fh)); + + /* check the data read */ + for (i = 0; i < bufcount; i++) { + if (readbuf[i] != writebuf[i]) { + errs++; + fprintf(stderr, "Process %d, readbuf %d, writebuf %d, i %d\n", + mynod, readbuf[i], writebuf[i], i); + } + } + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (mynod == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + + MPI_Type_free(&newtype); + free(readbuf); + free(writebuf); + free(filename); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/status.c b/3rd-party/romio341/test/status.c new file mode 100644 index 0000000000000000000000000000000000000000..c94fbc9e8ff004880349c50439a36866f4f71a1f --- /dev/null +++ b/3rd-party/romio341/test/status.c @@ -0,0 +1,103 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpi.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define SIZE (65536) + +/* Checks if the status objects is filled correctly by I/O functions */ + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define MPI_CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + + +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len, count, elements; + char *filename, *tmp; + int errs = 0, toterrs; + MPI_File fh; + MPI_Status status; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len + 10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len + 10); + MPI_Bcast(filename, len + 10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(SIZE); + nints = SIZE / sizeof(int); + + /* each process opens a separate file called filename.'myrank' */ + tmp = (char *) malloc(len + 10); + strcpy(tmp, filename); + sprintf(filename, "%s.%d", tmp, rank); + + MPI_CHECK(MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + MPI_CHECK(MPI_File_write(fh, buf, nints, MPI_INT, &status)); + + MPI_Get_count(&status, MPI_INT, &count); + MPI_Get_elements(&status, MPI_INT, &elements); + if (!rank) { + if (count != nints) { + errs++; + printf("count = %d, should be %d\n", count, nints); + } + if (elements != nints) { + errs++; + printf("elements = %d, should be %d\n", elements, nints); + } + } + + MPI_CHECK(MPI_File_close(&fh)); + + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + if (rank == 0) { + if (toterrs > 0) { + fprintf(stderr, "Found %d errors\n", toterrs); + } else { + fprintf(stdout, " No Errors\n"); + } + } + free(buf); + free(filename); + free(tmp); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio341/test/syshints.c b/3rd-party/romio341/test/syshints.c new file mode 100644 index 0000000000000000000000000000000000000000..5723e06c72cb298d10d878451590e13c54dc2b00 --- /dev/null +++ b/3rd-party/romio341/test/syshints.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <mpi.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn); } + +static int hint_check(MPI_Info info_used, const char *key, const char *expected) +{ + char value[MPI_MAX_INFO_VAL + 1]; + int flag; + + CHECK(MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL, value, &flag)); + if (strcmp(expected, value)) { + fprintf(stderr, "expected value \"%s\" for key \"%s\" got \"%s\"\n", expected, key, value); + return 1; + } + return 0; +} + +int main(int argc, char **argv) +{ + setenv("ROMIO_HINTS", argv[1], 1); + MPI_File fh; + MPI_Info info_used, info_mine; + int nr_errors = 0; + + MPI_Init(&argc, &argv); + MPI_Info_create(&info_mine); + MPI_Info_set(info_mine, "romio_cb_read", "disable"); + CHECK(MPI_File_open(MPI_COMM_WORLD, argv[1], MPI_MODE_RDONLY, info_mine, &fh)); + CHECK(MPI_File_get_info(fh, &info_used)); + + nr_errors += hint_check(info_used, "ind_rd_buffer_size", "49"); + nr_errors += hint_check(info_used, "romio_no_indep_rw", "true"); + + if (nr_errors == 0) + printf(" No Errors\n"); + + CHECK(MPI_Info_free(&info_mine)); + CHECK(MPI_Info_free(&info_used)); + CHECK(MPI_File_close(&fh)); + MPI_Finalize(); + return nr_errors; +} diff --git a/3rd-party/romio321/test/test_hintfile b/3rd-party/romio341/test/test_hintfile similarity index 100% rename from 3rd-party/romio321/test/test_hintfile rename to 3rd-party/romio341/test/test_hintfile diff --git a/3rd-party/romio341/test/types_with_zeros.c b/3rd-party/romio341/test/types_with_zeros.c new file mode 100644 index 0000000000000000000000000000000000000000..763eef92d16013ff85fb7290ea70dbc4f1ccd7c8 --- /dev/null +++ b/3rd-party/romio341/test/types_with_zeros.c @@ -0,0 +1,161 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/uio.h> + +#include <mpi.h> + +#define MAXLEN 9 + +static void handle_error(int errcode, const char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +enum { + INDEXED, + HINDEXED, + STRUCT +} testcases; + +static int test_indexed_with_zeros(char *filename, int testcase) +{ + int i, rank, np, buflen, num, err, nr_errors = 0; + int nelms[MAXLEN], buf[MAXLEN], indices[MAXLEN], blocklen[MAXLEN]; + MPI_File fh; + MPI_Status status; + MPI_Datatype filetype; + MPI_Datatype types[MAXLEN]; + MPI_Aint addrs[MAXLEN]; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &np); + + /* set up the number of integers to write in each iteration */ + for (i = 0; i < MAXLEN; i++) + nelms[i] = 0; + if (rank == 0) + nelms[4] = nelms[5] = nelms[7] = 1; + if (rank == 1) + nelms[0] = nelms[1] = nelms[2] = nelms[3] = nelms[6] = nelms[8] = 1; + + /* pre-fill the file with integers -999 */ + if (rank == 0) { + for (i = 0; i < MAXLEN; i++) + buf[i] = -999; + err = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_WRONLY, + MPI_INFO_NULL, &fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_open"); + err = MPI_File_write(fh, buf, MAXLEN, MPI_INT, &status); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_write"); + err = MPI_File_close(&fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_close"); + } + MPI_Barrier(MPI_COMM_WORLD); + + /* define a filetype with spurious leading zeros */ + buflen = num = 0; + for (i = 0; i < MAXLEN; i++) { + buflen += nelms[i]; + indices[num] = i; + addrs[num] = i * sizeof(int); + blocklen[num] = nelms[i]; + types[num] = MPI_INT; + num++; + } + switch (testcase) { + case INDEXED: + MPI_Type_indexed(num, blocklen, indices, MPI_INT, &filetype); + break; + case HINDEXED: + MPI_Type_create_hindexed(num, blocklen, addrs, MPI_INT, &filetype); + break; + case STRUCT: + MPI_Type_create_struct(num, blocklen, addrs, types, &filetype); + break; + default: + fprintf(stderr, "unknown testcase!\n"); + return (-100); + + } + + MPI_Type_commit(&filetype); + + /* initialize write buffer and write to file */ + for (i = 0; i < MAXLEN; i++) + buf[i] = 1; + err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_open"); + err = MPI_File_set_view(fh, 0, MPI_INT, filetype, "native", MPI_INFO_NULL); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_set_view"); + err = MPI_File_write_all(fh, buf, buflen, MPI_INT, &status); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_write_all"); + MPI_Type_free(&filetype); + err = MPI_File_close(&fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_close"); + + /* read back and check */ + if (rank == 0) { + err = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_open"); + err = MPI_File_read(fh, buf, MAXLEN, MPI_INT, &status); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_read"); + err = MPI_File_close(&fh); + if (err != MPI_SUCCESS) + handle_error(err, "MPI_File_close"); + for (i = 0; i < MAXLEN; i++) { + if (buf[i] < 0) { + nr_errors++; + printf("Error: unexpected value for case %d at buf[%d] == %d\n", + testcase, i, buf[i]); + } + } + } + return nr_errors; +} + +int main(int argc, char **argv) +{ + + int nr_errors, rank, np; + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &np); + + if (np != 2) { + if (rank == 0) + fprintf(stderr, "Must run on 2 MPI processes\n"); + MPI_Finalize(); + return 1; + } + nr_errors = test_indexed_with_zeros(argv[1], INDEXED); + nr_errors += test_indexed_with_zeros(argv[1], HINDEXED); + nr_errors += test_indexed_with_zeros(argv[1], STRUCT); + + if (rank == 0 && nr_errors == 0) + printf(" No Errors\n"); + + MPI_Finalize(); + return 0; +} diff --git a/3rd-party/romio321/util/nfslock.c b/3rd-party/romio341/util/nfslock.c similarity index 67% rename from 3rd-party/romio321/util/nfslock.c rename to 3rd-party/romio341/util/nfslock.c index 69d5e7995c521a6e461eeed3eaecc3d897a2600a..74d48335e43719c6413e96187c46ef35ba05e4ed 100644 --- a/3rd-party/romio321/util/nfslock.c +++ b/3rd-party/romio341/util/nfslock.c @@ -1,29 +1,29 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2004 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory */ + #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> /* - * This program tests to see if fcntl returns success when asked to + * This program tests to see if fcntl returns success when asked to * establish a file lock. This test is intended for use on file systems * such as NFS that may not implement file locks. ROMIO makes use * of file locks to implement certain operations, and may not work - * properly if file locks are not available. + * properly if file locks are not available. * * This is a simple test and has at least two limitations: - * - * 1. Some implementations of NFS are known to return success for + * + * 1. Some implementations of NFS are known to return success for * setting a file lock when in fact no lock has been set. This * test will not detect such erroneous implementations of NFS * * 2. Some implementations will hang (enter and wait indefinitately) * within the fcntl call. This program will also hang in that case. - * Under normal conditions, this program should only take a few seconds to + * Under normal conditions, this program should only take a few seconds to * run. * * The program prints a message showing the success or failure of @@ -34,7 +34,7 @@ /* style: allow:printf:2 sig:0 */ -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { struct flock lock; int fd, err; @@ -42,31 +42,29 @@ int main( int argc, char *argv[] ) /* Set the filename. Either arg[1] or conftest.dat */ if (argc > 1 && argv[1]) { - filename = argv[1]; - } - else { - filename = "conftest.dat"; + filename = argv[1]; + } else { + filename = "conftest.dat"; } - - lock.l_type = F_WRLCK; - lock.l_start = 0; + + lock.l_type = F_WRLCK; + lock.l_start = 0; lock.l_whence = SEEK_SET; - lock.l_len = 100; + lock.l_len = 100; fd = open(filename, O_RDWR | O_CREAT, 0644); err = fcntl(fd, F_SETLKW, &lock); if (err) { - printf( "Failed to set a file lock on %s\n", filename ); - perror( "Reason " ); - } - else { - printf( "fcntl claims success in setting a file lock on %s\n", filename ); + printf("Failed to set a file lock on %s\n", filename); + perror("Reason "); + } else { + printf("fcntl claims success in setting a file lock on %s\n", filename); } - /* printf("err = %d, errno = %d\n", err, errno); */ + /* printf("err = %d, errno = %d\n", err, errno); */ close(fd); - unlink( filename ); + unlink(filename); return err; } diff --git a/3rd-party/romio321/util/romioinstall.in b/3rd-party/romio341/util/romioinstall.in similarity index 98% rename from 3rd-party/romio321/util/romioinstall.in rename to 3rd-party/romio341/util/romioinstall.in index 95a6309231554a857d14cdb2110ad655b65aa370..c3c09c9ec47cdc3f80246ecd3be87a535cab7b66 100644 --- a/3rd-party/romio321/util/romioinstall.in +++ b/3rd-party/romio341/util/romioinstall.in @@ -1,5 +1,9 @@ -#!/bin/sh -# +#! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + # This script needs to be built by configure. # # This is a script to install ROMIO. It can be invoked with diff --git a/3rd-party/romio321/util/tarch b/3rd-party/romio341/util/tarch similarity index 96% rename from 3rd-party/romio321/util/tarch rename to 3rd-party/romio341/util/tarch index ccccf4d514a76c1342a84d4830010a39521d8111..1c752765364ad47bf279b74b2697314396ac393e 100755 --- a/3rd-party/romio321/util/tarch +++ b/3rd-party/romio341/util/tarch @@ -1,4 +1,9 @@ #! /bin/sh +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + # set -x # # Returns the arch of the machine. This file is from MPICH. diff --git a/3rd-party/romio341/version.m4 b/3rd-party/romio341/version.m4 new file mode 100644 index 0000000000000000000000000000000000000000..77362f686773b0092ce3c4badeff84c7ad49b92c --- /dev/null +++ b/3rd-party/romio341/version.m4 @@ -0,0 +1,40 @@ +[#] start of __file__ +# +# Copyright (C) by Argonne National Laboratory +# See COPYRIGHT in top-level directory +# +# This file contains versioning information for MPICH's configure process. +# This was previously (as "maint/Version") a bit of shell code that was sourced +# by configure, but shell variables are not permitted in the modern form of +# AC_INIT. See "Rebuilding Makefiles" in the automake-1.11.1 manual. +# +# !!! NOTE !!! absolutely no shell code from this file will end up in the +# configure script, including these shell comments. Any shell code must live in +# the configure script and/or use m4 values defined here. We could consider +# changing this by playing with diversions, but then we would probably be +# playing with autotools-fire. + +m4_define([MPICH_VERSION_m4],[3.4.1])dnl +m4_define([MPICH_RELEASE_DATE_m4],[Fri Jan 22 14:17:48 CST 2021])dnl + +# For libtool ABI versioning rules see: +# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info +# +# 1. If the library source code has changed at all since the last +# update, then increment revision (`c:r:a' becomes `c:r+1:a'). +# +# 2. If any interfaces have been added, removed, or changed since +# the last update, increment current, and set revision to 0. +# +# 3. If any interfaces have been added since the last public +# release, then increment age. +# +# 4. If any interfaces have been removed or changed since the last +# public release, then set age to 0. + +# libmpi so version only includes functionality defined in the MPI +# standard, and does not include MPIX_ functions and C++ bindings. + +m4_define([libmpi_so_version_m4],[13:10:1])dnl + +[#] end of __file__ diff --git a/ompi/mca/io/romio321/.gitignore b/ompi/mca/io/romio321/.gitignore deleted file mode 100644 index beaeb9ba92dbd016e07f7c8a824c9ebe87306e14..0000000000000000000000000000000000000000 --- a/ompi/mca/io/romio321/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -/Makefile -/.deps -/*.bb -/*.bbg -/*.gcda -/*.gcno -/.libs -/.libstamp* -/*.lo -/.*-cache -.state-cache -romio/version.m4 -romio/confdb/._l* -romio/confdb/config.rpath -romio/adio/include/romioconf.h.in -!romio/mpi2-other/**/Makefile.in diff --git a/ompi/mca/io/romio321/REFRESH_NOTES.txt b/ompi/mca/io/romio321/REFRESH_NOTES.txt deleted file mode 100644 index e4dfa704068b3b1d4175f14204233e21873a6dac..0000000000000000000000000000000000000000 --- a/ompi/mca/io/romio321/REFRESH_NOTES.txt +++ /dev/null @@ -1,39 +0,0 @@ -1. prepare new romio directory -cp -a <old romio> <new romio> -# cp -a ompi/mca/io/romio ompi/mca/io/romio321 -rm -rf <new romio>/romio -# rm -rf ompi/mca/io/romio321/romio -git add <new romio> -# git add ompi/mca/io/romio321 -# git commit - -2. import new romio -cp -a <mpich dir>/src/mpi/romio <new romio> -# cp -a /.../mpich-3.2b1/src/mpi/romio ompi/mca/io/romio321 -git add <new romio> -# git add ompi/mca/io/romio321 -# git commit - -3. patch romio -cd <new romio> -# cd ompi/mca/io/romio321 -# git show 7a7968f02e2bad912426d1535119fb30d881b460 | patch -p5 -# cd ../../../.. -git add <new romio> -# git add ompi/mca/io/romio321 -# git commit - -4. prepare ompi to use new romio -vi <new romio>/Makefile.am <new romio>/configure.m4 <new romio>/src/Makefile.extra -# vi ompi/mca/io/romio321/Makefile.am ompi/mca/io/romio321/configure.m4 ompi/mca/io/romio321/src/Makefile.extra -git add <new romio> -# git add ompi/mca/io/romio321 -# git commit - - -5. remove old romio -git rm -r <old romio> -# git rm -r ompi/mca/io/romio -# git commit -rm -rf <old romio> -# rm -rf ompi/mca/io/romio diff --git a/ompi/mca/io/romio321/ompi.patch b/ompi/mca/io/romio321/ompi.patch deleted file mode 100644 index 9d6dd5ffc4c3c8bf1c8fa05aec47c90821752f31..0000000000000000000000000000000000000000 --- a/ompi/mca/io/romio321/ompi.patch +++ /dev/null @@ -1,717 +0,0 @@ -diff --git a/ompi/mca/io/romio321/romio/.config_params b/ompi/mca/io/romio321/romio/.config_params -index 96f735f..fcc2f91 100644 ---- a/ompi/mca/io/romio321/romio/.config_params -+++ b/ompi/mca/io/romio321/romio/.config_params -@@ -36,3 +36,4 @@ __sgi_mpi - __hp_mpi - __cray_mpi - __lam_mpi -+__open_mpi -diff --git a/ompi/mca/io/romio321/romio/Makefile.am b/ompi/mca/io/romio321/romio/Makefile.am -index b9d4e25..69d7014 100644 ---- a/ompi/mca/io/romio321/romio/Makefile.am -+++ b/ompi/mca/io/romio321/romio/Makefile.am -@@ -1,9 +1,28 @@ - # -*- Mode: Makefile; -*- -+# Copyright (c) 2004-2006 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 Cisco Systems, Inc. All rights reserved. -+# $COPYRIGHT$ -+# -+# Additional copyrights may follow -+# -+# $HEADER$ - # - # (C) 2011 by Argonne National Laboratory. - # See COPYRIGHT in top-level directory. - # - -+# OMPI: include a top level makefile with some options -+include $(top_srcdir)/Makefile.options -+ - ## TODO: need to write an automakefile that handles two primary cases: - ## 1) that ROMIO is being embedded within the MPI library, as in MPICH or Open - ## MPI -@@ -17,7 +36,6 @@ ACLOCAL_AMFLAGS = -I confdb - include_HEADERS = - nodist_include_HEADERS = - noinst_HEADERS = --AM_CPPFLAGS = - EXTRA_DIST = - SUFFIXES = - doc1_src_txt = -@@ -46,7 +64,9 @@ AM_CPPFLAGS += $(MPI_H_INCLUDE) - # handle the "include" directory here - AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include - # nodist_ b/c these are created by config.status and should not be distributed --nodist_include_HEADERS += include/mpio.h include/mpiof.h -+# Open MPI: do not install mpio.h -+noinst_HEADERS += include/mpio.h -+noinst_HEADERS += include/io_romio_conv.h - - # ------------------------------------------------------------------------ - -@@ -63,8 +83,8 @@ EXTRA_DIST += autogen.sh - if BUILD_ROMIO_EMBEDDED - # Build a libtool convenience library that the enclosing MPI implementation can - # use by adding it to the right _LIBADD variable. --noinst_LTLIBRARIES = libromio.la --libromio_la_SOURCES = $(romio_mpi_sources) $(romio_other_sources) $(glue_sources) -+noinst_LTLIBRARIES = libromio_dist.la -+libromio_dist_la_SOURCES = $(romio_mpi_sources) $(romio_other_sources) $(glue_sources) - - ## NOTE: ROMIO's old build system builds a bunch of _foo.o objects that contain - ## PMPI_ implementations as well as calls to only other PMPI routines. In -diff --git a/ompi/mca/io/romio321/romio/adio/Makefile.mk b/ompi/mca/io/romio321/romio/adio/Makefile.mk -index 505d518..ffc05cb 100644 ---- a/ompi/mca/io/romio321/romio/adio/Makefile.mk -+++ b/ompi/mca/io/romio321/romio/adio/Makefile.mk -@@ -20,6 +20,7 @@ noinst_HEADERS += \ - adio/include/mpipr.h \ - adio/include/mpiu_greq.h \ - adio/include/nopackage.h \ -+ adio/include/romioconf-undefs.h \ - adio/include/mpiu_external32.h \ - adio/include/hint_fns.h - -diff --git a/ompi/mca/io/romio321/romio/adio/common/ad_end.c b/ompi/mca/io/romio321/romio/adio/common/ad_end.c -index ea4dfeb..066c65c 100644 ---- a/ompi/mca/io/romio321/romio/adio/common/ad_end.c -+++ b/ompi/mca/io/romio321/romio/adio/common/ad_end.c -@@ -16,7 +16,12 @@ void ADIO_End(int *error_code) - - /* if a default errhandler was set on MPI_FILE_NULL then we need to ensure - * that our reference to that errhandler is released */ -+/* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c -+ in routine mca_io_romio_file_close() -+*/ -+#if 0 - PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN); -+#endif - - /* delete the flattened datatype list */ - curr = ADIOI_Flatlist; -diff --git a/ompi/mca/io/romio321/romio/adio/common/ad_iread_coll.c b/ompi/mca/io/romio321/romio/adio/common/ad_iread_coll.c -index 2ec23fb..8487c25 100644 ---- a/ompi/mca/io/romio321/romio/adio/common/ad_iread_coll.c -+++ b/ompi/mca/io/romio321/romio/adio/common/ad_iread_coll.c -@@ -16,6 +16,8 @@ - #include "mpe.h" - #endif - -+#ifdef HAVE_MPI_GREQUEST_EXTENSIONS -+ - /* ADIOI_GEN_IreadStridedColl */ - struct ADIOI_GEN_IreadStridedColl_vars { - /* requests */ -@@ -1340,3 +1342,4 @@ static int ADIOI_GEN_irc_wait_fn(int count, void **array_of_states, - return errcode; - } - -+#endif /* HAVE_MPI_GREQUEST_EXTENSIONS */ -diff --git a/ompi/mca/io/romio321/romio/adio/common/ad_iwrite_coll.c b/ompi/mca/io/romio321/romio/adio/common/ad_iwrite_coll.c -index d275f78..9b27b42 100644 ---- a/ompi/mca/io/romio321/romio/adio/common/ad_iwrite_coll.c -+++ b/ompi/mca/io/romio321/romio/adio/common/ad_iwrite_coll.c -@@ -13,6 +13,8 @@ - #include "mpe.h" - #endif - -+#ifdef HAVE_MPI_GREQUEST_EXTENSIONS -+ - /* ADIOI_GEN_IwriteStridedColl */ - struct ADIOI_GEN_IwriteStridedColl_vars { - /* requests */ -@@ -1565,3 +1567,4 @@ static int ADIOI_GEN_iwc_wait_fn(int count, void **array_of_states, - return errcode; - } - -+#endif /* HAVE_MPI_GREQUEST_EXTENSIONS */ -diff --git a/ompi/mca/io/romio321/romio/adio/include/adioi.h b/ompi/mca/io/romio321/romio/adio/include/adioi.h -index 0e91ead..13c0f25 100644 ---- a/ompi/mca/io/romio321/romio/adio/include/adioi.h -+++ b/ompi/mca/io/romio321/romio/adio/include/adioi.h -@@ -440,18 +440,26 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -+#ifdef HAVE_MPI_GREQUEST_EXTENSIONS - void ADIOI_GEN_IreadStridedColl(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -+#else -+#define ADIOI_GEN_IreadStridedColl NULL -+#endif - void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Status *status, int - *error_code); -+#ifdef HAVE_MPI_GREQUEST_EXTENSIONS - void ADIOI_GEN_IwriteStridedColl(ADIO_File fd, const void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, MPI_Request *request, - int *error_code); -+#else -+#define ADIOI_GEN_IwriteStridedColl NULL -+#endif - void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype - datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, ADIO_Offset -diff --git a/ompi/mca/io/romio321/romio/configure.ac b/ompi/mca/io/romio321/romio/configure.ac -index 93f8b09..0b85d53 100644 ---- a/ompi/mca/io/romio321/romio/configure.ac -+++ b/ompi/mca/io/romio321/romio/configure.ac -@@ -3,12 +3,21 @@ - # autoconf --localdir=../confdb configure.ac - # (or wherever the confdb is) - # -+# irrelevant / unnecessary in an Open MPI environment, but are -+# harmless and are left here solely for the sake of ease of future -+# patching/importing. - AC_PREREQ([2.63]) - --m4_include([version.m4]) --dnl 2nd arg is intentionally underquoted -+# Open MPI: Modifications to this file were done on an "let's do the -+# minimum possible" basis, not so that we can skip on the work or -+# provide any less functionality, but more from a perspective that we -+# want to be able to import new versions of ROMIO in as easy a fashion -+# as possible. Hence, there are some things in this file that are -+# irrelevant / unnecessary in an Open MPI environment, but are -+# harmless and are left here solely for the sake of ease of future -+# patching/importing. - AC_INIT([ROMIO], -- MPICH_VERSION_m4, -+ [Open MPI], - [discuss@mpich.org], - [romio], - [http://www.mpich.org/]) -@@ -22,7 +31,7 @@ dnl scripts. - AC_CONFIG_AUX_DIR([confdb]) - AC_CONFIG_MACRO_DIR([confdb]) - --AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability-recursive foreign 1.12.3 silent-rules subdir-objects]) -+AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability-recursive foreign 1.12 silent-rules subdir-objects]) - AM_MAINTAINER_MODE([enable]) - - dnl must come before LT_INIT, which AC_REQUIREs AC_PROG_CC -@@ -43,12 +52,15 @@ if test -n "$CONFIGURE_ARGS" ; then - fi - - AC_CONFIG_HEADER(adio/include/romioconf.h) -+# Open MPI: modified AH_TOP - AH_TOP([/* - * (C) 2011 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - #ifndef ROMIOCONF_H_INCLUDED - #define ROMIOCONF_H_INCLUDED -+ -+#include "romioconf-undefs.h" - ]) - AH_BOTTOM([ - /* quash PACKAGE and PACKAGE_* vars, see MPICH top-level configure.ac for -@@ -58,9 +70,37 @@ AH_BOTTOM([ - #endif /* !defined(ROMIOCONF_H_INCLUDED) */ - ]) - -+# Open MPI: this configure script doesn't seem to define these -+# anywhere, so just do them manually here because "we know better" -+# (i.e., Open MPI can be hard-wired to these values). -+AC_DEFINE([HAVE_MPI_OFFSET], [1], [Will always be 1 - OMPI has MPI_OFFSET]) -+ -+# Open MPI: look for top Open MPI directory -+AC_MSG_CHECKING([for Open MPI support files]) -+if test -f "$srcdir/../../../../../config/opal_mca.m4"; then -+ -+ # This is needed for VPATH builds, so that it will -I the -+ # appropriate include directory (don't know why automake -+ # doesn't do this # automatically). -+ -+ OMPI_TOP_SRCDIR='$(top_srcdir)/../../../../..' -+ OMPI_TOP_BUILDDIR='$(top_builddir)/../../../../..' -+ with_mpi="$OMPI_TOP_SRCDIR" -+ AC_MSG_RESULT([in Open MPI source tree -- good]) -+ AC_SUBST(OMPI_TOP_SRCDIR) -+ AC_SUBST(OMPI_TOP_BUILDDIR) -+else -+ AC_MSG_RESULT([not found]) -+ AC_MSG_WARN([*** Could not find Open MPI support files]) -+ AC_MSG_WARN([*** Can only build this version of ROMIO in an Open MPI source tree]) -+ AC_MSG_ERROR([*** Cannot continue]) -+fi -+ - dnl --NOF77=0 --NOF90=0 -+# Open MPI: disable the f77 and f90 tests, as we provide our own -+# MPI interface and use only the C parts of ROMIO -+NOF77=1 -+NOF90=1 - ARCH="" - arch_IRIX="" - MPI_IMPL="" -@@ -95,6 +135,10 @@ AC_ARG_VAR([FROM_OMPI],[set to "yes" if building ROMIO inside of Open MPI]) - FROM_OMPI=${FROM_OMPI:-no} - if test "$FROM_OMPI" = 1 ; then FROM_OMPI=yes ; fi - -+AC_ARG_VAR([FROM_OMPI],[set to "yes" if building ROMIO inside of Open MPI]) -+FROM_OMPI=${FROM_OMPI:-no} -+if test "$FROM_OMPI" = 1 ; then FROM_OMPI=yes ; fi -+ - CFLAGS=${CFLAGS:-""} - LL="lld" - AR_LOCAL="" -@@ -120,7 +164,8 @@ ROMIO_TFFLAGS="" - NOPROFILE=0 - MPIRUN="" - FORTRAN_TEST="" --MAKE=${MAKE:-"make"} -+# Open MPI: This (setting make) is a Bad Thing to do in Automake-based build systems -+# MAKE=${MAKE:-"make"} - # foll. needed for f77 test programs - F77GETARG="call getarg(i,str)" - F77IARGC="iargc()" -@@ -133,6 +178,18 @@ MPI_OFFSET_KIND2="!" - TEST_CC="" - TEST_F77="" - # -+# Error handlers (not used with MPICH2, which provides its own routines) -+MPIO_EXTRA_OBJECTS="get_errh.o set_errh.o" -+MPIO_EXTRA_TMP_POBJECTS="get_errh.p set_errh.p" -+MPIO_EXTRA_REAL_POBJECTS="_get_errh.o _set_errh.o" -+# -+# Completion routines for MPIO_Requests. MPI Implementations with -+# generalized requests do not need these -+# ioreq_c2f and ioreq_f2c are not MPIO_Requests; rather, they -+MPIO_REQOBJECTS="iotest.o iotestall.o iotestany.o iotestsome.o iowait.o iowaitall.o iowaitany.o iowaitsome.o ioreq_c2f.o ioreq_f2c.o" -+MPIO_REQ_TMP_POBJECTS="iotest.p iowait.p iowaitall.p iowaitany.p iotestall.p iotestany.p iowaitsome.p iotestsome.p" -+MPIO_REQ_REAL_POBJECTS="_iotest.o _iowait.o _iowaitall.o _iowaitany.o _iotestall.o _iotestany.o _iowaitsome.o _iotestsome.o" -+# - known_mpi_impls="mpich_mpi mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi open_mpi_mpi" - - dnl An m4 macro for use with m4_foreach_w and friends. You should modify this -@@ -169,7 +226,7 @@ AC_ARG_ENABLE(f77, - AC_ARG_ENABLE(f90, - [--enable-f90 - Turn on support for Fortran 90 (default)],,enable_f90=yes) - AC_ARG_ENABLE(weak-symbols, --[--enable-weak-symbols - Turn on support for weak symbols],,enable_weak_symbols=yes) -+[--enable-weak-symbols - Turn on support for weak symbols],,enable_weak_symbols=no) - AC_ARG_ENABLE(debug, - [--enable-debug - Build a debugging version],,) - AC_ARG_WITH(file-system,[ -@@ -192,9 +249,10 @@ if test "$enable_debug" = "yes" ; then - DEBUG=yes - fi - MPI=$with_mpi --if test -n "$with_mpi"; then -- CC=$MPI/bin/mpicc --fi -+# Open MPI: No! -+#if test -n "$with_mpi"; then -+# CC=$MPI/bin/mpicc -+#fi - - # start with the set of file systems that the user asked for - # FILE_SYSTEM=$with_file_system -@@ -257,6 +315,7 @@ top_build_dir=`pwd` - # used in romioinstall - AC_SUBST(top_build_dir) - -+# Open MPI: these shouldn't be needed with AM - # - # Create the "autoconf" style directory names... - # Most of these are done for us; add the documentation directories -@@ -378,8 +437,9 @@ if test "$CC" = "gcc" -a -z "$C_DEBUG_FLAG" ; then - fi - if test $DEBUG = "yes" ; then - CFLAGS="$CFLAGS $C_DEBUG_FLAG" --else -- CFLAGS="$CFLAGS $C_OPT_FLAG" -+# Open MPI: don't add optflags - they'll come from the top-level configure -+#else -+# CFLAGS="$CFLAGS $C_OPT_FLAG" - fi - # --------------------------------------------------------------------------- - # Here go the rest of the tests -@@ -426,7 +486,8 @@ else - F77=":" - fi - # --AC_C_INLINE -+# Open MPI: We already do this test top-level -+dnl AC_C_INLINE - - AC_TYPE_SIZE_T - AC_TYPE_SSIZE_T -@@ -649,7 +710,9 @@ AM_CONDITIONAL([BUILD_MPIO_ERRHAN],[false]) - - # if we don't have weak symbol support, we must build a separate convenience - # library in order to provide the "PMPI_" symbols --AM_CONDITIONAL([BUILD_PROFILING_LIB],[test "x$HAVE_WEAK_SYMBOLS" = "x0"]) -+# Open MPI: Disable the profile library -+#AM_CONDITIONAL([BUILD_PROFILING_LIB],[test "x$HAVE_WEAK_SYMBOLS" = "x0"]) -+AM_CONDITIONAL([BUILD_PROFILING_LIB],[false]) - - # weird: we have conflated "buid ROMIO's versions of the fortran bindings" and - # "build ROMIO"s fortran I/O tests". Of course the common situaiton is that we -@@ -1447,8 +1510,10 @@ if test $FROM_OMPI = yes ; then - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - # Open MPI: see comments in mpi-io/mpioprof.h - AC_DEFINE(MPIO_BUILD_PROFILING, 1, [hack to make ROMIO build without profiling]) -- DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST" -+ DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" -+ DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#undef HAVE_MPI_GREQUEST_EXTENSIONS" - AC_DEFINE(HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK, 1, [Define if MPI library provides HINDEXED_BLOCK datatype]) -+ AC_DEFINE(HAVE_MPIIO_CONST, 1, Set if MPI-IO prototypes use const qualifier) - elif test $FROM_LAM = yes ; then - # LAM does have the status set bytes functionality - AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes]) -@@ -1497,7 +1562,7 @@ elif test $FROM_MPICH = yes ; then - DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS="#define HAVE_MPI_GREQUEST_EXTENSIONS 1" - AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH memory tracing macros defined]) - AC_DEFINE(HAVE_MPIX_H, 1, []) -- AC_DEFINE(HAVE_MPIIO_CONST, const, Set if MPI-IO prototypes use const qualifier) -+ AC_DEFINE(HAVE_MPIIO_CONST, 1, Set if MPI-IO prototypes use const qualifier) - AC_DEFINE(HAVE_MPI_TYPE_SIZE_X, 1, [Define if MPI library provides MPI_TYPE_SIZE_X]) - AC_DEFINE(HAVE_MPI_STATUS_SET_ELEMENTS_X, 1, [Define if MPI library provides MPI_STATUS_SET_ELEMENTS_X]) - AC_DEFINE(HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK, 1, [Define if MPI library provides HINDEXED_BLOCK datatype]) -@@ -1620,9 +1685,22 @@ fi - echo "setting SYSDEP_INC to $SYSDEP_INC" - AC_SUBST(SYSDEP_INC) - -+# Open MPI: use the exact same restrict test that we use in the -+# upper-level Open MPI configure script so that we always get the same -+# #define for "restrict" (there are a small number of files that will -+# end up including both ROMIO's romioconf.h and opal_config.h, so we -+# need to #defines to agree). - AC_C_RESTRICT - PAC_C_GNU_ATTRIBUTE - -+# Open MPI: we need libtool -+AM_PROG_LIBTOOL -+ -+# Open MPI: setup the AM_CONDITIONALs to build the different adio devices -+ m4_foreach([my_fs], -+ [gpfs, gridftp, hfs, lustre, nfs, ntfs, panfs, pfs, pvfs, piofs, pvfs, pvfs2, sfs, testfs, ufs, xfs, zoidfs], -+ [AM_CONDITIONAL(BUILD_[]AS_TR_CPP(my_fs), [test -n "$file_system_]my_fs["])]) -+ - # support gcov test coverage information - PAC_ENABLE_COVERAGE - -@@ -1634,23 +1712,29 @@ echo "setting CFLAGS to $CFLAGS" - echo "setting USER_CFLAGS to $USER_CFLAGS" - echo "setting USER_FFLAGS to $USER_FFLAGS" - -+# Open MPI: Add on CFLAGS that we figured out up top. They have -+# makefile macros in them, so we couldn't substitute them until now. -+CFLAGS="$CFLAGS $OMPI_CFLAGS "'-I$(top_builddir)/include' -+# -+# Open MPI - AM doesn't want the following: -+# VPATH, CC, CPPFLAGS, CFLAGS, AR, RANLIB, F77, MAKE - AC_SUBST(ARCH) - AC_SUBST(FILE_SYSTEM) --AC_SUBST(CC) --AC_SUBST(CPPFLAGS) --AC_SUBST(CFLAGS) -+#AC_SUBST(CC) -+#AC_SUBST(CPPFLAGS) -+#AC_SUBST(CFLAGS) - AC_SUBST(USER_CFLAGS) - AC_SUBST(USER_FFLAGS) - AC_SUBST(MIPS) - AC_SUBST(BITS) --AC_SUBST(AR) -+#AC_SUBST(AR) - AC_SUBST(AR_FLAGS) - AC_SUBST(MPI_INCLUDE_DIR) - AC_SUBST(MPI_LIB) --AC_SUBST(F77) -+#AC_SUBST(F77) - AC_SUBST(NOF77) - AC_SUBST(NOPROFILE) --AC_SUBST(MAKE) -+#AC_SUBST(MAKE) - AC_SUBST(arch_IRIX) - AC_SUBST(ROMIO_HOME) - AC_SUBST(LIBNAME) -@@ -1671,6 +1755,7 @@ AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY) - AC_SUBST(BUILD_MPI_ARRAY) - AC_SUBST(DEFINE_MPI_OFFSET) - AC_SUBST(DEFINE_HAVE_MPI_GREQUEST) -+AC_SUBST(DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS) - AC_SUBST(MPI_OFFSET_TYPE) - AC_SUBST(MPI_FINFO1) - AC_SUBST(MPI_FINFO2) -@@ -1694,24 +1779,25 @@ AC_SUBST(ROMIO_TCPPFLAGS) - AC_SUBST(ROMIO_TFFLAGS) - AC_SUBST(MPIRUN) - AC_SUBST(FORTRAN_TEST) --dnl --dnl Support shared libraries --if test -z "$ENABLE_SHLIB" ; then -- ENABLE_SHLIB=none --fi --AC_SUBST(ENABLE_SHLIB) --AC_SUBST(CC_SHL) --AC_SUBST(LIBTOOL) -+#dnl -+#dnl Support shared libraries -+#if test -z "$ENABLE_SHLIB" ; then -+# ENABLE_SHLIB=none -+#fi -+#AC_SUBST(ENABLE_SHLIB) -+#AC_SUBST(CC_SHL) -+#AC_SUBST(LIBTOOL) -+# Open MPI: This is no longer necessary with modern versions of autotools - # Remove the .a from the library file name (so that we can use .so or - # other appropriate suffix) --SHLIBNAME=`echo $LIBNAME | sed 's/\.a$//'` --AC_SUBST(SHLIBNAME) --dnl --if test ! -d adio ; then mkdir adio ; fi --if test ! -d adio/include ; then mkdir adio/include ; fi --if test ! -d mpi2-other ; then mkdir mpi2-other ; fi --if test ! -d mpi-io ; then mkdir mpi-io ; fi --if test ! -d mpi-io/glue ; then mkdir mpi-io/glue ; fi -+#SHLIBNAME=`echo $LIBNAME | sed 's/\.a$//'` -+#AC_SUBST(SHLIBNAME) -+#dnl -+#if test ! -d adio ; then mkdir adio ; fi -+#if test ! -d adio/include ; then mkdir adio/include ; fi -+#if test ! -d mpi2-other ; then mkdir mpi2-other ; fi -+#if test ! -d mpi-io ; then mkdir mpi-io ; fi -+#if test ! -d mpi-io/glue ; then mkdir mpi-io/glue ; fi - - # Create makefiles for all of the adio devices. Only the ones that - # are active will be called by the top level ROMIO make -@@ -1719,8 +1805,6 @@ AC_OUTPUT_COMMANDS([chmod 755 util/romioinstall test/runtests]) - AC_CONFIG_FILES([ - Makefile - localdefs -- mpi2-other/info/Makefile -- mpi2-other/array/Makefile - test/Makefile - test/misc.c - test/large_file.c -@@ -1728,14 +1812,17 @@ AC_CONFIG_FILES([ - test-internal/Makefile - util/romioinstall - include/mpio.h -- include/mpiof.h -- mpi2-other/info/fortran/Makefile -- mpi2-other/array/fortran/Makefile - test/fmisc.f - test/fcoll_test.f - test/pfcoll_test.f - test/fperf.f - ]) -+# Open MPI: intentionally skip the following: -+# mpi2-other/info/Makefile -+# mpi2-other/array/Makefile -+# mpi2-other/info/fortran/Makefile -+# mpi2-other/array/fortran/Makefile -+# include/mpiof.h - AC_OUTPUT - - dnl PAC_SUBDIR_CACHE_CLEANUP -diff --git a/ompi/mca/io/romio321/romio/doc/users-guide.tex b/ompi/mca/io/romio321/romio/doc/users-guide.tex -index b33d483..3715431 100644 ---- a/ompi/mca/io/romio321/romio/doc/users-guide.tex -+++ b/ompi/mca/io/romio321/romio/doc/users-guide.tex -@@ -807,13 +807,19 @@ to include the file {\tt mpio.h} for C or {\tt mpiof.h} for Fortran in - your MPI-IO program. - - Note that on HP machines running HPUX and on NEC SX-4, you need to --compile Fortran programs with {\tt mpifort}. -+compile Fortran programs with {\tt mpifort}, because {\tt mpif77} does -+not support 8-byte integers. - - With MPICH, HP MPI, or NEC MPI, you can compile MPI-IO programs as \\ - \hspace*{.4in} {\tt mpicc foo.c}\\ - or \\ -+\hspace*{.4in} {\tt mpif77 foo.f }\\ -+or\\ - \hspace*{.4in} {\tt mpifort foo.f}\\ - -+As mentioned above, mpifort is preferred over mpif77 on HPUX and NEC -+because the f77 compilers on those machines do not support 8-byte integers. -+ - With SGI MPI, you can compile MPI-IO programs as \\ - \hspace*{.4in} {\tt cc foo.c -lmpi}\\ - or \\ -@@ -863,7 +869,8 @@ file systems because they don't support {\tt fcntl} file locks, - and ROMIO uses that feature to implement shared file pointers. - - \item On HP machines running HPUX and on NEC SX-4, you need to compile --Fortran programs with {\tt mpifort}. -+Fortran programs with {\tt mpifort} instead of {\tt mpif77}, because -+the {\tt f77} compilers on these machines don't support 8-byte integers. - - \item The file-open mode {\tt MPI\_MODE\_EXCL} does not work on Intel - PFS file system, due to a bug in PFS. -diff --git a/ompi/mca/io/romio321/romio/include/mpio.h.in b/ompi/mca/io/romio321/romio/include/mpio.h.in -index 1f3f382..9ef709d 100644 ---- a/ompi/mca/io/romio321/romio/include/mpio.h.in -+++ b/ompi/mca/io/romio321/romio/include/mpio.h.in -@@ -11,6 +11,16 @@ - #define MPIO_INCLUDE - - #include "mpi.h" -+/* Open MPI: We need to rename almost all of these functions, as well -+ a the types to be names that conform to the prefix rule */ -+#include "io_romio_conv.h" -+ -+#define MPIIMPL_HAVE_MPI_COMBINER_DARRAY 1 -+#define MPIIMPL_HAVE_MPI_TYPE_CREATE_DARRAY 1 -+#define MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY 1 -+#define MPIIMPL_HAVE_MPI_TYPE_CREATE_DARRAY 1 -+#define MPIIMPL_HAVE_MPI_COMBINER_DUP 1 -+#define MPICH_ATTR_POINTER_WITH_TYPE_TAG(x,y) - - #if defined(__cplusplus) - extern "C" { -@@ -38,6 +48,8 @@ typedef struct ADIOI_RequestD *MPIO_Request; - #endif - #define MPIO_REQUEST_DEFINED - -+@DEFINE_HAVE_MPI_GREQUEST_EXTENSIONS@ -+ - #ifndef HAVE_MPI_OFFSET - @DEFINE_MPI_OFFSET@ - /* If we needed to define MPI_Offset, then we also need to make -@@ -279,9 +291,12 @@ int MPI_Type_create_darray(int size, int rank, int ndims, const int array_of_gsi - #endif - #endif - /* above needed for some versions of mpi.h in MPICH!! */ -+/* Open MPI: I can't seem to make these #define properly. Oh well -- -+ we don't need them anyway :-( */ -+#if 0 - MPI_File MPI_File_f2c(MPI_Fint file); - MPI_Fint MPI_File_c2f(MPI_File file); -- -+#endif - - #ifndef HAVE_MPI_GREQUEST - /* The following functions are required if generalized requests are not -@@ -329,15 +344,21 @@ int MPI_Info_free(MPI_Info *info); - #endif - #endif - /* above needed for some versions of mpi.h in MPICH!! */ -+/* Open MPI: we don't need these in ROMIO */ -+#if 0 - MPI_Fint MPI_Info_c2f(MPI_Info info); - MPI_Info MPI_Info_f2c(MPI_Fint info); - #endif -+#endif - - #endif /* HAVE_PRAGMA_HP_SEC_DEF */ - - - /**************** BINDINGS FOR THE PROFILING INTERFACE ***************/ - -+/* Open MPI: We don't want any of the profiling layer */ -+#if 0 -+ - - /* Section 9.2 */ - int PMPI_File_open(MPI_Comm, const char *, int, MPI_Info, MPI_File *); -@@ -528,6 +549,8 @@ MPI_Fint PMPI_Info_c2f(MPI_Info); - MPI_Info PMPI_Info_f2c(MPI_Fint); - #endif - -+#endif /* Open MPI: We don't want any of the profiling layer */ -+ - #if defined(__cplusplus) - } - #endif -diff --git a/ompi/mca/io/romio321/romio/mpi-io/Makefile.mk b/ompi/mca/io/romio321/romio/mpi-io/Makefile.mk -index d4d5a29..264976e 100644 ---- a/ompi/mca/io/romio321/romio/mpi-io/Makefile.mk -+++ b/ompi/mca/io/romio321/romio/mpi-io/Makefile.mk -@@ -14,8 +14,6 @@ noinst_HEADERS += mpi-io/mpioimpl.h mpi-io/mpioprof.h - romio_mpi_sources += \ - mpi-io/close.c \ - mpi-io/delete.c \ -- mpi-io/file_c2f.c \ -- mpi-io/file_f2c.c \ - mpi-io/fsync.c \ - mpi-io/get_amode.c \ - mpi-io/get_atom.c \ -diff --git a/ompi/mca/io/romio321/romio/mpi-io/close.c b/ompi/mca/io/romio321/romio/mpi-io/close.c -index 3f2b0b1..12d5c47 100644 ---- a/ompi/mca/io/romio321/romio/mpi-io/close.c -+++ b/ompi/mca/io/romio321/romio/mpi-io/close.c -@@ -76,8 +76,13 @@ int MPI_File_close(MPI_File *fh) - * somehow inform the MPI library that we no longer hold a reference to any - * user defined error handler. We do this by setting the errhandler at this - * point to MPI_ERRORS_RETURN. */ -+/* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c -+ in routine mca_io_romio_file_close() -+*/ -+#if 0 - error_code = PMPI_File_set_errhandler(*fh, MPI_ERRORS_RETURN); - if (error_code != MPI_SUCCESS) goto fn_fail; -+#endif - - ADIO_Close(adio_fh, &error_code); - MPIO_File_free(fh); -diff --git a/ompi/mca/io/romio321/romio/mpi-io/glue/Makefile.mk b/ompi/mca/io/romio321/romio/mpi-io/glue/Makefile.mk -index 05954a1..66f7f9e 100644 ---- a/ompi/mca/io/romio321/romio/mpi-io/glue/Makefile.mk -+++ b/ompi/mca/io/romio321/romio/mpi-io/glue/Makefile.mk -@@ -7,6 +7,7 @@ - - include $(top_srcdir)/mpi-io/glue/default/Makefile.mk - include $(top_srcdir)/mpi-io/glue/mpich/Makefile.mk -+include $(top_srcdir)/mpi-io/glue/openmpi/Makefile.mk - - if !BUILD_ROMIO_EMBEDDED - romio_other_sources += \ -diff --git a/ompi/mca/io/romio321/romio/mpi-io/iread_all.c b/ompi/mca/io/romio321/romio/mpi-io/iread_all.c -index 2615e56..00a0640 100644 ---- a/ompi/mca/io/romio321/romio/mpi-io/iread_all.c -+++ b/ompi/mca/io/romio321/romio/mpi-io/iread_all.c -@@ -26,7 +26,7 @@ int MPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - #include "mpioprof.h" - #endif - --#ifdef HAVE_MPI_GREQUEST -+#if HAVE_MPI_GREQUEST - #include "mpiu_greq.h" - #endif - -diff --git a/ompi/mca/io/romio321/romio/mpi-io/mpioprof.h b/ompi/mca/io/romio321/romio/mpi-io/mpioprof.h -index f3ee3b4..c74413d 100644 ---- a/ompi/mca/io/romio321/romio/mpi-io/mpioprof.h -+++ b/ompi/mca/io/romio321/romio/mpi-io/mpioprof.h -@@ -10,6 +10,15 @@ - building the profiling interface - */ - -+/* -+ * Open MPI: Unfortunately, ROMIO doesn't seem to be able to build -+ * without a profiling interface, but we don't want a profiling -+ * interface, since we are just using ROMIO "behind the scenes". -+ * So enable all the profiling defines, only compile once, and don't -+ * do all the name mangling. The effect is about the same, but without -+ * modification to all the files in the mpi-io directory. -+ */ -+#if 0 - #ifdef MPIO_BUILD_PROFILING - - #undef MPI_File_open -@@ -212,3 +221,4 @@ - #define MPIX_Grequest_class_create PMPIX_Grequest_class_create - - #endif -+#endif diff --git a/ompi/mca/io/romio321/src/io_romio321_module.c b/ompi/mca/io/romio321/src/io_romio321_module.c deleted file mode 100644 index 24b17d8a111dd1a7ade0e1275e11fa1b7e0752a3..0000000000000000000000000000000000000000 --- a/ompi/mca/io/romio321/src/io_romio321_module.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 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 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -#include "ompi_config.h" - -#include "mpi.h" -#include "ompi/datatype/ompi_datatype.h" -#include "ompi/mca/io/io.h" -#include "io_romio321.h" - - -/* - * Global functions that do not need to be prototyped in a header - * because ROMIO just expects these functions to exist. - */ -int MPIR_Status_set_bytes(ompi_status_public_t *status, - struct ompi_datatype_t *datatype, MPI_Count size); -void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); - - -/* - * The ROMIO module operations - */ -mca_io_base_module_2_0_0_t mca_io_romio321_module = { - /* Back end to MPI API calls (pretty much a 1-to-1 mapping) */ - - mca_io_romio321_file_open, - mca_io_romio321_file_close, - - mca_io_romio321_file_set_size, - mca_io_romio321_file_preallocate, - mca_io_romio321_file_get_size, - mca_io_romio321_file_get_amode, - mca_io_romio321_file_set_info, - mca_io_romio321_file_get_info, - mca_io_romio321_file_set_view, - mca_io_romio321_file_get_view, - - /* Index IO operations */ - mca_io_romio321_file_read_at, - mca_io_romio321_file_read_at_all, - mca_io_romio321_file_write_at, - mca_io_romio321_file_write_at_all, - mca_io_romio321_file_iread_at, - mca_io_romio321_file_iwrite_at, - mca_io_romio321_file_iread_at_all, - mca_io_romio321_file_iwrite_at_all, - - /* non-indexed IO operations */ - mca_io_romio321_file_read, - mca_io_romio321_file_read_all, - mca_io_romio321_file_write, - mca_io_romio321_file_write_all, - mca_io_romio321_file_iread, - mca_io_romio321_file_iwrite, - mca_io_romio321_file_iread_all, - mca_io_romio321_file_iwrite_all, - - mca_io_romio321_file_seek, - mca_io_romio321_file_get_position, - mca_io_romio321_file_get_byte_offset, - - mca_io_romio321_file_read_shared, - mca_io_romio321_file_write_shared, - mca_io_romio321_file_iread_shared, - mca_io_romio321_file_iwrite_shared, - mca_io_romio321_file_read_ordered, - mca_io_romio321_file_write_ordered, - mca_io_romio321_file_seek_shared, - mca_io_romio321_file_get_position_shared, - - /* Split IO operations */ - mca_io_romio321_file_read_at_all_begin, - mca_io_romio321_file_read_at_all_end, - mca_io_romio321_file_write_at_all_begin, - mca_io_romio321_file_write_at_all_end, - mca_io_romio321_file_read_all_begin, - mca_io_romio321_file_read_all_end, - mca_io_romio321_file_write_all_begin, - mca_io_romio321_file_write_all_end, - mca_io_romio321_file_read_ordered_begin, - mca_io_romio321_file_read_ordered_end, - mca_io_romio321_file_write_ordered_begin, - mca_io_romio321_file_write_ordered_end, - - mca_io_romio321_file_get_type_extent, - - /* Sync/atomic IO operations */ - mca_io_romio321_file_set_atomicity, - mca_io_romio321_file_get_atomicity, - mca_io_romio321_file_sync -}; - - -/* - * This function is required by ROMIO to set information on an Open - * MPI status. Conveniently, it maps directly to - * MPI_Status_set_elements (almost like they planned that... hmmm...). - */ -int MPIR_Status_set_bytes(ompi_status_public_t *status, - struct ompi_datatype_t *datatype, MPI_Count nbytes) -{ - /* Note that ROMIO is going to give a number of *bytes* here, but - MPI_STATUS_SET_ELEMENTS requires a number of *elements*. So - rather than try to do a conversion up here, just set the number - of bytes with MPI_CHAR as the datatype. If someone does a - GET_STATUS later, they have to supply their own datatype, and - we do the right calculations there. This prevents roundoff - errors here, potentially "losing" bytes in the process. */ - - MPI_Status_set_elements_x(status, MPI_CHAR, nbytes); - return MPI_SUCCESS; -} - - -void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) -{ - /* - * Open MPI contiguous check return true for datatype with - * gaps in the beginning and at the end. We have to provide - * a count of 2 in order to get these gaps taken into acount. - * In addition, if the data is contiguous but true_lb differes - * from zero, ROMIO will ignore the displacement. Thus, lie! - */ - *flag = ompi_datatype_is_contiguous_memory_layout(datatype, 2); - if (*flag) { - MPI_Aint true_extent, true_lb; - - ompi_datatype_get_true_extent(datatype, &true_lb, &true_extent); - - if (true_lb > 0) - *flag = 0; - } -} diff --git a/ompi/mca/io/romio321/Makefile.am b/ompi/mca/io/romio341/Makefile.am similarity index 65% rename from ompi/mca/io/romio321/Makefile.am rename to ompi/mca/io/romio341/Makefile.am index b6bdb972dd4a94f4c52b49823adc4fff5af2db68..616e4f5e1b347210f66428816eb5932062d92843 100644 --- a/ompi/mca/io/romio321/Makefile.am +++ b/ompi/mca/io/romio341/Makefile.am @@ -11,8 +11,8 @@ # All rights reserved. # Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2021 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -27,29 +27,29 @@ include src/Makefile.extra # mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la # (for static builds). -if MCA_BUILD_ompi_io_romio321_DSO +if MCA_BUILD_ompi_io_romio341_DSO lib = lib_sources = -component = mca_io_romio321.la +component = mca_io_romio341.la component_sources = $(sources) else -lib = libmca_io_romio321.la +lib = libmca_io_romio341.la lib_sources = $(sources) component = component_sources = endif -libs = $(top_builddir)/3rd-party/romio321/libromio_dist.la +libs = $(top_builddir)/3rd-party/romio341/libromio_dist.la mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component) -mca_io_romio321_la_SOURCES = $(component_sources) -mca_io_romio321_la_LIBADD = $(libs) -mca_io_romio321_la_DEPENDENCIES = $(libs) -mca_io_romio321_la_LDFLAGS = -module -avoid-version +mca_io_romio341_la_SOURCES = $(component_sources) +mca_io_romio341_la_LIBADD = $(libs) +mca_io_romio341_la_DEPENDENCIES = $(libs) +mca_io_romio341_la_LDFLAGS = -module -avoid-version noinst_LTLIBRARIES = $(lib) -libmca_io_romio321_la_SOURCES = $(lib_sources) -libmca_io_romio321_la_LIBADD = $(libs) -libmca_io_romio321_la_DEPENDENCIES = $(libs) -libmca_io_romio321_la_LDFLAGS = -module -avoid-version +libmca_io_romio341_la_SOURCES = $(lib_sources) +libmca_io_romio341_la_LIBADD = $(libs) +libmca_io_romio341_la_DEPENDENCIES = $(libs) +libmca_io_romio341_la_LDFLAGS = -module -avoid-version diff --git a/ompi/mca/io/romio341/REFRESH_NOTES.txt b/ompi/mca/io/romio341/REFRESH_NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..8554471fd9894b3e115810184bde749bb7fa3751 --- /dev/null +++ b/ompi/mca/io/romio341/REFRESH_NOTES.txt @@ -0,0 +1,36 @@ +1. update .gitignore + +2. import new romio +cp -a <mpich dir>/src/mpi/romio 3rd-party/<new romio> +# cp -a /.../mpich-3.4.1/src/mpi/romio 3rd-party/romio341 +git add <new romio> +# git add 3rd-party/romio341 +# git commit + +3. patch romio +cd <new romio> +# cd 3rd-party/romio341 +modernize ROMIO +# git show 7d1dce82198e50e998e8079a044676831f713d1c | patch -p3 +# git add . +# git commit +patch ROMIO +# git show bb7396248655cecfd0542ddb7b5904064bc13677 | patch -p3 +# git add . +# git commit + +4. create new romio component +cp -a <old romio> <new romio> +# cp -a ompi/mca/io/romio321 ompi/mca/io/romio341 +vi <new romio>/Makefile.am <new romio>/configure.m4 <new romio>/src/Makefile.extra +# vi ompi/mca/io/romio341/Makefile.am ompi/mca/io/romio341/configure.m4 ompi/mca/io/romio341/src/Makefile.extra +git add <new romio> +# git add ompi/mca/io/romio341 +# git commit + +5. remove old romio +git rm -r <old romio> +# git rm -r 3rd-party/romio321 ompi/mca/io/romio321 +# git commit +rm -rf <old romio> +# rm -rf 3rd-party/romio321 ompi/mca/io/romio321 diff --git a/ompi/mca/io/romio321/configure.m4 b/ompi/mca/io/romio341/configure.m4 similarity index 63% rename from ompi/mca/io/romio321/configure.m4 rename to ompi/mca/io/romio341/configure.m4 index b3ebea263873dad0cc8a00a899cd50449eb6ec0b..553649e426aa9d000d8fdc009a8465bf72248c53 100644 --- a/ompi/mca/io/romio321/configure.m4 +++ b/ompi/mca/io/romio341/configure.m4 @@ -20,24 +20,24 @@ # $HEADER$ # -AC_DEFUN([MCA_ompi_io_romio321_POST_CONFIG], [ - AM_CONDITIONAL([MCA_io_romio321_SHOULD_BUILD], [test $1 -eq 1]) +AC_DEFUN([MCA_ompi_io_romio341_POST_CONFIG], [ + AM_CONDITIONAL([MCA_io_romio341_SHOULD_BUILD], [test $1 -eq 1]) ]) -# MCA_io_romio321_CONFIG([action-if-found], [action-if-not-found]) +# MCA_io_romio341_CONFIG([action-if-found], [action-if-not-found]) # ----------------------------------------------------------- -AC_DEFUN([MCA_ompi_io_romio321_CONFIG],[ - AC_CONFIG_FILES([ompi/mca/io/romio321/Makefile]) +AC_DEFUN([MCA_ompi_io_romio341_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/io/romio341/Makefile]) - OPAL_VAR_SCOPE_PUSH([io_romio321_flags io_romio321_flags_define io_romio321_happy io_romio321_save_LIBS]) + OPAL_VAR_SCOPE_PUSH([io_romio341_flags io_romio341_flags_define io_romio341_happy io_romio341_save_LIBS]) AC_ARG_ENABLE([io-romio], [AS_HELP_STRING([--disable-io-romio], [Disable the ROMIO MPI-IO component])]) AC_ARG_WITH([io-romio-flags], [AS_HELP_STRING([--with-io-romio-flags=FLAGS], [Pass FLAGS to the ROMIO distribution configuration script])]) - AC_DEFINE_UNQUOTED([MCA_io_romio321_USER_CONFIGURE_FLAGS], ["$with_io_romio_flags"], [Set of user-defined configure flags given to ROMIOs configure script via --with-io-romio-flags]) + AC_DEFINE_UNQUOTED([MCA_io_romio341_USER_CONFIGURE_FLAGS], ["$with_io_romio_flags"], [Set of user-defined configure flags given to ROMIOs configure script via --with-io-romio-flags]) AC_MSG_CHECKING([if want ROMIO component]) AS_IF([test "$enable_io_romio" = "no"], [AC_MSG_RESULT([no]) @@ -53,54 +53,54 @@ AC_DEFUN([MCA_ompi_io_romio321_CONFIG],[ [AC_MSG_RESULT([yes]) AS_IF([test -n "$with_io_romio_flags" && test "$with_io_romio_flags" != "no"], - [io_romio321_flags="$with_io_romio_flags $io_romio321_flags"], - [io_romio321_flags=]) + [io_romio341_flags="$with_io_romio_flags $io_romio341_flags"], + [io_romio341_flags=]) # If ROMIO is going to end up in a DSO, all we need is # shared library-ized objects, as we're only building a # DSO (which is always shared). Otherwise, build with # same flags as OMPI, as we might need any combination of # shared and static-ized objects... AS_IF([test "$compile_mode" = "dso"], - [io_romio321_shared=enable - io_romio321_static=disable], + [io_romio341_shared=enable + io_romio341_static=disable], [AS_IF([test "$enable_shared" = "yes"], - [io_romio321_shared=enable], - [io_romio321_shared=disable]) + [io_romio341_shared=enable], + [io_romio341_shared=disable]) AS_IF([test "$enable_static" = "yes"], - [io_romio321_static=enable], - [io_romio321_static=disable])]) + [io_romio341_static=enable], + [io_romio341_static=disable])]) AS_IF([test -n "$prefix" && test "$prefix" != "NONE"], - [io_romio321_prefix_arg="--prefix=$prefix"], - [io_romio321_prefix_arg=]) + [io_romio341_prefix_arg="--prefix=$prefix"], + [io_romio341_prefix_arg=]) AS_IF([test "$cross_compiling" = "yes"], - [AS_IF([test ! -z $build], [io_romio321_flags="$io_romio321_flags --build=$build"]) - AS_IF([test ! -z $host], [io_romio321_flags="$io_romio321_flags --host=$host"]) - AS_IF([test ! -z $target], [io_romio321_flags="$io_romio321_flags --target=$target"])]) + [AS_IF([test ! -z $build], [io_romio341_flags="$io_romio341_flags --build=$build"]) + AS_IF([test ! -z $host], [io_romio341_flags="$io_romio341_flags --host=$host"]) + AS_IF([test ! -z $target], [io_romio341_flags="$io_romio341_flags --target=$target"])]) AS_IF([test "$enable_grequest_extensions" = "yes"], - [io_romio321_flags="$io_romio321_flags --enable-grequest-extensions"]) - io_romio321_flags_define="$io_romio321_flags FROM_OMPI=yes CC='$CC' CFLAGS='$CFLAGS -D__EXTENSIONS__' CPPFLAGS='$CPPFLAGS' FFLAGS='$FFLAGS' LDFLAGS='$LDFLAGS' --$io_romio321_shared-shared --$io_romio321_static-static $io_romio321_flags $io_romio321_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90" - AC_DEFINE_UNQUOTED([MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS], ["$io_romio321_flags_define"], [Complete set of command line arguments given to ROMIOs configure script]) + [io_romio341_flags="$io_romio341_flags --enable-grequest-extensions"]) + io_romio341_flags_define="$io_romio341_flags FROM_OMPI=yes CC='$CC' CFLAGS='$CFLAGS -D__EXTENSIONS__' CPPFLAGS='$CPPFLAGS' FFLAGS='$FFLAGS' LDFLAGS='$LDFLAGS' --$io_romio341_shared-shared --$io_romio341_static-static $io_romio341_flags $io_romio341_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90" + AC_DEFINE_UNQUOTED([MCA_io_romio341_COMPLETE_CONFIGURE_FLAGS], ["$io_romio341_flags_define"], [Complete set of command line arguments given to ROMIOs configure script]) - io_romio321_flags="$io_romio321_flags FROM_OMPI=yes CC="'"'"$CC"'"'" CFLAGS="'"'"$CFLAGS -D__EXTENSIONS__"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LDFLAGS"'"'" --$io_romio321_shared-shared --$io_romio321_static-static $io_romio321_flags $io_romio321_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90" + io_romio341_flags="$io_romio341_flags FROM_OMPI=yes CC="'"'"$CC"'"'" CFLAGS="'"'"$CFLAGS -D__EXTENSIONS__"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LDFLAGS"'"'" --$io_romio341_shared-shared --$io_romio341_static-static $io_romio341_flags $io_romio341_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90" opal_show_subtitle "Configuring ROMIO distribution" - OPAL_CONFIG_SUBDIR([3rd-party/romio321], - [$io_romio321_flags], - [io_romio321_happy=1], [io_romio321_happy=0]) + OPAL_CONFIG_SUBDIR([3rd-party/romio341], + [$io_romio341_flags], + [io_romio341_happy=1], [io_romio341_happy=0]) - AS_IF([test "$io_romio321_happy" = "1"], + AS_IF([test "$io_romio341_happy" = "1"], [ # grab the libraries list from ROMIO. We don't # need this for building the component, as libtool # will figure that part out. But we do need it for # the wrapper settings - io_romio321_save_LIBS="$LIBS" + io_romio341_save_LIBS="$LIBS" LIBS= - . 3rd-party/romio321/localdefs - io_romio321_LIBS="$LIBS" - LIBS="$io_romio321_save_LIBS" - OPAL_3RDPARTY_SUBDIRS="$OPAL_3RDPARTY_SUBDIRS romio321" - OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS romio321" + . 3rd-party/romio341/localdefs + io_romio341_LIBS="$LIBS" + LIBS="$io_romio341_save_LIBS" + OPAL_3RDPARTY_SUBDIRS="$OPAL_3RDPARTY_SUBDIRS romio341" + OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS romio341" echo "ROMIO distribution configured successfully" $1], diff --git a/ompi/mca/io/romio321/owner.txt b/ompi/mca/io/romio341/owner.txt similarity index 100% rename from ompi/mca/io/romio321/owner.txt rename to ompi/mca/io/romio341/owner.txt diff --git a/ompi/mca/io/romio321/src/Makefile.extra b/ompi/mca/io/romio341/src/Makefile.extra old mode 100644 new mode 100755 similarity index 73% rename from ompi/mca/io/romio321/src/Makefile.extra rename to ompi/mca/io/romio341/src/Makefile.extra index dc684a8d6a950ea02f0054aa1fb3d9370466e6d6..c2382bed5eabf583d1bcc07250433d40deea8ac4 --- a/ompi/mca/io/romio321/src/Makefile.extra +++ b/ompi/mca/io/romio341/src/Makefile.extra @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017-2019 Research Organization for Information Science +# Copyright (c) 2017-2021 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ # @@ -30,16 +30,17 @@ AM_CPPFLAGS = \ -I$(OMPI_TOP_BUILDDIR)/ompi/include \ -I$(OMPI_TOP_SRCDIR)/ompi \ -I$(OMPI_TOP_SRCDIR)/ompi/include \ - -I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio321 \ - -I$(OMPI_TOP_SRCDIR)/3rd-party/romio321/include \ - -I$(OMPI_TOP_SRCDIR)/3rd-party/romio321/adio/include \ + -I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio341 \ + -I$(OMPI_TOP_SRCDIR)/3rd-party/romio341/include \ + -I$(OMPI_TOP_SRCDIR)/3rd-party/romio341/adio/include \ + -I$(top_builddir)/3rd-party/romio341/mpl/include \ -I$(top_builddir) sources += \ - src/io_romio321.h \ - src/io_romio321_component.c \ - src/io_romio321_file_open.c \ - src/io_romio321_file_read.c \ - src/io_romio321_file_write.c \ - src/io_romio321_module.c + src/io_romio341.h \ + src/io_romio341_component.c \ + src/io_romio341_file_open.c \ + src/io_romio341_file_read.c \ + src/io_romio341_file_write.c \ + src/io_romio341_module.c diff --git a/ompi/mca/io/romio321/src/io_romio321.h b/ompi/mca/io/romio341/src/io_romio341.h similarity index 73% rename from ompi/mca/io/romio321/src/io_romio321.h rename to ompi/mca/io/romio341/src/io_romio341.h index 9fd44d353c5c11730a6b0defc2241a70b5bb408b..dfaf1439d645e8e9cd9069f3d84ea07b3c641082 100644 --- a/ompi/mca/io/romio321/src/io_romio321.h +++ b/ompi/mca/io/romio341/src/io_romio341.h @@ -10,8 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -20,36 +20,36 @@ * $HEADER$ */ -#ifndef MCA_IO_ROMIO321_H -#define MCA_IO_ROMIO321_H +#ifndef MCA_IO_ROMIO341_H +#define MCA_IO_ROMIO341_H #include "ompi_config.h" #include "opal/mca/threads/mutex.h" #include "ompi/request/request.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" -#include "3rd-party/romio321/adio/include/romioconf.h" -#include "3rd-party/romio321/include/mpio.h" +#include "3rd-party/romio341/adio/include/romioconf.h" +#include "3rd-party/romio341/include/mpio.h" BEGIN_C_DECLS -OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio321_component; +OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio341_component; /* * global variables, instantiated in module.c */ -extern opal_mutex_t mca_io_romio321_mutex; -extern mca_io_base_module_2_0_0_t mca_io_romio321_module; -OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio321_component; +extern opal_mutex_t mca_io_romio341_mutex; +extern mca_io_base_module_2_0_0_t mca_io_romio341_module; +OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio341_component; /* * Private data for ROMIO modules */ -struct mca_io_romio321_data_t { +struct mca_io_romio341_data_t { ROMIO_PREFIX (MPI_File) romio_fh; }; -typedef struct mca_io_romio321_data_t mca_io_romio321_data_t; +typedef struct mca_io_romio341_data_t mca_io_romio341_data_t; /* @@ -64,84 +64,84 @@ typedef struct mca_io_romio321_data_t mca_io_romio321_data_t; * ROMIO_PREFIX(MPI_File_XXX) */ /* Section 9.2 */ -int mca_io_romio321_file_open (struct ompi_communicator_t *comm, +int mca_io_romio341_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, struct opal_info_t *info, ompi_file_t *fh); -int mca_io_romio321_file_close (struct ompi_file_t *fh); -int mca_io_romio321_file_delete (const char *filename, +int mca_io_romio341_file_close (struct ompi_file_t *fh); +int mca_io_romio341_file_delete (const char *filename, struct opal_info_t *info); -int mca_io_romio321_file_set_size (struct ompi_file_t *fh, +int mca_io_romio341_file_set_size (struct ompi_file_t *fh, MPI_Offset size); -int mca_io_romio321_file_preallocate (struct ompi_file_t *fh, +int mca_io_romio341_file_preallocate (struct ompi_file_t *fh, MPI_Offset size); -int mca_io_romio321_file_get_size (struct ompi_file_t *fh, +int mca_io_romio341_file_get_size (struct ompi_file_t *fh, MPI_Offset * size); -int mca_io_romio321_file_get_amode (struct ompi_file_t *fh, +int mca_io_romio341_file_get_amode (struct ompi_file_t *fh, int *amode); -int mca_io_romio321_file_set_info (struct ompi_file_t *fh, +int mca_io_romio341_file_set_info (struct ompi_file_t *fh, struct ompi_info_t *info); -int mca_io_romio321_file_get_info (struct ompi_file_t *fh, +int mca_io_romio341_file_get_info (struct ompi_file_t *fh, struct ompi_info_t ** info_used); /* Section 9.3 */ -int mca_io_romio321_file_set_view (struct ompi_file_t *fh, +int mca_io_romio341_file_set_view (struct ompi_file_t *fh, MPI_Offset disp, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, struct opal_info_t *info); -int mca_io_romio321_file_get_view (struct ompi_file_t *fh, +int mca_io_romio341_file_get_view (struct ompi_file_t *fh, MPI_Offset * disp, struct ompi_datatype_t ** etype, struct ompi_datatype_t ** filetype, char *datarep); /* Section 9.4.2 */ -int mca_io_romio321_file_read_at (struct ompi_file_t *fh, +int mca_io_romio341_file_read_at (struct ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_read_at_all (struct ompi_file_t *fh, +int mca_io_romio341_file_read_at_all (struct ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write_at (struct ompi_file_t *fh, +int mca_io_romio341_file_write_at (struct ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write_at_all (struct ompi_file_t *fh, +int mca_io_romio341_file_write_at_all (struct ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_iread_at (struct ompi_file_t *fh, +int mca_io_romio341_file_iread_at (struct ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iread_at_all (struct ompi_file_t *fh, +int mca_io_romio341_file_iread_at_all (struct ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iwrite_at (struct ompi_file_t *fh, +int mca_io_romio341_file_iwrite_at (struct ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iwrite_at_all (struct ompi_file_t *fh, +int mca_io_romio341_file_iwrite_at_all (struct ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, @@ -149,151 +149,151 @@ int mca_io_romio321_file_iwrite_at_all (struct ompi_file_t *fh, ompi_request_t **request); /* Section 9.4.3 */ -int mca_io_romio321_file_read (struct ompi_file_t *fh, +int mca_io_romio341_file_read (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_read_all (struct ompi_file_t *fh, +int mca_io_romio341_file_read_all (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write (struct ompi_file_t *fh, +int mca_io_romio341_file_write (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write_all (struct ompi_file_t *fh, +int mca_io_romio341_file_write_all (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_iread (struct ompi_file_t *fh, +int mca_io_romio341_file_iread (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iread_all (struct ompi_file_t *fh, +int mca_io_romio341_file_iread_all (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iwrite (struct ompi_file_t *fh, +int mca_io_romio341_file_iwrite (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iwrite_all (struct ompi_file_t *fh, +int mca_io_romio341_file_iwrite_all (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_seek (struct ompi_file_t *fh, +int mca_io_romio341_file_seek (struct ompi_file_t *fh, MPI_Offset offset, int whence); -int mca_io_romio321_file_get_position (struct ompi_file_t *fh, +int mca_io_romio341_file_get_position (struct ompi_file_t *fh, MPI_Offset * offset); -int mca_io_romio321_file_get_byte_offset (struct ompi_file_t *fh, +int mca_io_romio341_file_get_byte_offset (struct ompi_file_t *fh, MPI_Offset offset, MPI_Offset * disp); /* Section 9.4.4 */ -int mca_io_romio321_file_read_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_read_shared (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_write_shared (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_iread_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_iread_shared (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_iwrite_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_iwrite_shared (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); -int mca_io_romio321_file_read_ordered (struct ompi_file_t *fh, +int mca_io_romio341_file_read_ordered (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_write_ordered (struct ompi_file_t *fh, +int mca_io_romio341_file_write_ordered (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status); -int mca_io_romio321_file_seek_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_seek_shared (struct ompi_file_t *fh, MPI_Offset offset, int whence); -int mca_io_romio321_file_get_position_shared (struct ompi_file_t *fh, +int mca_io_romio341_file_get_position_shared (struct ompi_file_t *fh, MPI_Offset * offset); /* Section 9.4.5 */ -int mca_io_romio321_file_read_at_all_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_read_at_all_begin (struct ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_read_at_all_end (struct ompi_file_t *fh, +int mca_io_romio341_file_read_at_all_end (struct ompi_file_t *fh, void *buf, ompi_status_public_t * status); -int mca_io_romio321_file_write_at_all_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_write_at_all_begin (struct ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_write_at_all_end (struct ompi_file_t *fh, +int mca_io_romio341_file_write_at_all_end (struct ompi_file_t *fh, const void *buf, ompi_status_public_t * status); -int mca_io_romio321_file_read_all_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_read_all_begin (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_read_all_end (struct ompi_file_t *fh, +int mca_io_romio341_file_read_all_end (struct ompi_file_t *fh, void *buf, ompi_status_public_t * status); -int mca_io_romio321_file_write_all_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_write_all_begin (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_write_all_end (struct ompi_file_t *fh, +int mca_io_romio341_file_write_all_end (struct ompi_file_t *fh, const void *buf, ompi_status_public_t * status); -int mca_io_romio321_file_read_ordered_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_read_ordered_begin (struct ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_read_ordered_end (struct ompi_file_t *fh, +int mca_io_romio341_file_read_ordered_end (struct ompi_file_t *fh, void *buf, ompi_status_public_t * status); -int mca_io_romio321_file_write_ordered_begin (struct ompi_file_t *fh, +int mca_io_romio341_file_write_ordered_begin (struct ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype); -int mca_io_romio321_file_write_ordered_end (struct ompi_file_t *fh, +int mca_io_romio341_file_write_ordered_end (struct ompi_file_t *fh, const void *buf, struct ompi_status_public_t * status); /* Section 9.5.1 */ -int mca_io_romio321_file_get_type_extent (struct ompi_file_t *fh, +int mca_io_romio341_file_get_type_extent (struct ompi_file_t *fh, struct ompi_datatype_t *datatype, MPI_Aint * extent); /* Section 9.6.1 */ -int mca_io_romio321_file_set_atomicity (struct ompi_file_t *fh, +int mca_io_romio341_file_set_atomicity (struct ompi_file_t *fh, int flag); -int mca_io_romio321_file_get_atomicity (struct ompi_file_t *fh, +int mca_io_romio341_file_get_atomicity (struct ompi_file_t *fh, int *flag); -int mca_io_romio321_file_sync (struct ompi_file_t *fh); +int mca_io_romio341_file_sync (struct ompi_file_t *fh); /* End Prototypes */ END_C_DECLS -#endif /* MCA_IO_ROMIO321_H */ +#endif /* MCA_IO_ROMIO341_H */ diff --git a/ompi/mca/io/romio321/src/io_romio321_component.c b/ompi/mca/io/romio341/src/io_romio341_component.c similarity index 84% rename from ompi/mca/io/romio321/src/io_romio321_component.c rename to ompi/mca/io/romio341/src/io_romio341_component.c index 2f1b50a822f69d4e6d2326366b5e37c0ebfd0cf7..8d94bbf027bd67379f52eeea16681e19838a4570 100644 --- a/ompi/mca/io/romio321/src/io_romio321_component.c +++ b/ompi/mca/io/romio341/src/io_romio341_component.c @@ -13,8 +13,8 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -30,9 +30,9 @@ #include "opal/mca/threads/mutex.h" #include "opal/mca/base/base.h" #include "ompi/mca/io/io.h" -#include "io_romio321.h" +#include "io_romio341.h" -#define ROMIO_VERSION_STRING "from MPICH v3.1.4" +#define ROMIO_VERSION_STRING "from MPICH v3.4.1" /* * Private functions @@ -71,23 +71,23 @@ static int delete_priority_param = 20; /* * Global, component-wide ROMIO mutex because ROMIO is not thread safe */ -opal_mutex_t mca_io_romio321_mutex = {{0}}; +opal_mutex_t mca_io_romio341_mutex = {{0}}; /* * Public string showing this component's version number */ -const char *mca_io_romio321_component_version_string = +const char *mca_io_romio341_component_version_string = "OMPI/MPI ROMIO io MCA component version " OMPI_VERSION ", " ROMIO_VERSION_STRING; -mca_io_base_component_2_0_0_t mca_io_romio321_component = { +mca_io_base_component_2_0_0_t mca_io_romio341_component = { /* First, the mca_base_component_t struct containing meta information about the component itself */ .io_version = { MCA_IO_BASE_VERSION_2_0_0, - .mca_component_name = "romio321", + .mca_component_name = "romio341", MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION), .mca_open_component = open_component, @@ -113,44 +113,44 @@ mca_io_base_component_2_0_0_t mca_io_romio321_component = { .io_register_datarep = register_datarep, }; -static char *ompi_io_romio321_version = ROMIO_VERSION_STRING; -static char *ompi_io_romio321_user_configure_params = MCA_io_romio321_USER_CONFIGURE_FLAGS; -static char *ompi_io_romio321_complete_configure_params = MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS; +static char *ompi_io_romio341_version = ROMIO_VERSION_STRING; +static char *ompi_io_romio341_user_configure_params = MCA_io_romio341_USER_CONFIGURE_FLAGS; +static char *ompi_io_romio341_complete_configure_params = MCA_io_romio341_COMPLETE_CONFIGURE_FLAGS; static int register_component(void) { /* Use a low priority, but allow other components to be lower */ priority_param = 10; - (void) mca_base_component_var_register(&mca_io_romio321_component.io_version, + (void) mca_base_component_var_register(&mca_io_romio341_component.io_version, "priority", "Priority of the io romio component", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &priority_param); delete_priority_param = 10; - (void) mca_base_component_var_register(&mca_io_romio321_component.io_version, + (void) mca_base_component_var_register(&mca_io_romio341_component.io_version, "delete_priority", "Delete priority of the io romio component", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &delete_priority_param); - (void) mca_base_component_var_register(&mca_io_romio321_component.io_version, + (void) mca_base_component_var_register(&mca_io_romio341_component.io_version, "version", "Version of ROMIO", MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_version); - (void) mca_base_component_var_register(&mca_io_romio321_component.io_version, + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio341_version); + (void) mca_base_component_var_register(&mca_io_romio341_component.io_version, "user_configure_params", "User-specified command line parameters passed to ROMIO's configure script", MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_user_configure_params); - (void) mca_base_component_var_register(&mca_io_romio321_component.io_version, + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio341_user_configure_params); + (void) mca_base_component_var_register(&mca_io_romio341_component.io_version, "complete_configure_params", "Complete set of command line parameters passed to ROMIO's configure script", MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_complete_configure_params); + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio341_complete_configure_params); return OMPI_SUCCESS; } @@ -158,7 +158,7 @@ static int register_component(void) static int open_component(void) { /* Create the mutex */ - OBJ_CONSTRUCT(&mca_io_romio321_mutex, opal_mutex_t); + OBJ_CONSTRUCT(&mca_io_romio341_mutex, opal_mutex_t); return OMPI_SUCCESS; } @@ -166,7 +166,7 @@ static int open_component(void) static int close_component(void) { - OBJ_DESTRUCT(&mca_io_romio321_mutex); + OBJ_DESTRUCT(&mca_io_romio341_mutex); return OMPI_SUCCESS; } @@ -189,14 +189,14 @@ file_query(struct ompi_file_t *file, struct mca_io_base_file_t **private_data, int *priority) { - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; *priority = priority_param; /* Allocate a space for this module to hang private data (e.g., the ROMIO file handle) */ - data = malloc(sizeof(mca_io_romio321_data_t)); + data = malloc(sizeof(mca_io_romio341_data_t)); if (NULL == data) { return NULL; } @@ -205,7 +205,7 @@ file_query(struct ompi_file_t *file, /* All done */ - return &mca_io_romio321_module; + return &mca_io_romio341_module; } @@ -249,9 +249,9 @@ static int delete_select(const char *filename, struct opal_info_t *info, opal_info_t *opal_info = &(ompi_info->super); opal_info_dup (info, &opal_info); - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_delete)(filename, ompi_info); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); ompi_info_free(&ompi_info); return ret; @@ -267,10 +267,10 @@ register_datarep(const char * datarep, { int ret; - OPAL_THREAD_LOCK(&mca_io_romio321_mutex); + OPAL_THREAD_LOCK(&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_Register_datarep(datarep, read_fn, write_fn, extent_fn, state)); - OPAL_THREAD_UNLOCK(&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK(&mca_io_romio341_mutex); return ret; } diff --git a/ompi/mca/io/romio321/src/io_romio321_file_open.c b/ompi/mca/io/romio341/src/io_romio341_file_open.c similarity index 58% rename from ompi/mca/io/romio321/src/io_romio321_file_open.c rename to ompi/mca/io/romio341/src/io_romio341_file_open.c index 5b641c3e4e5e9d223f4bc6ae168b328042087932..587f56d3302a1d6488a83c58bbbe1a48f4eae73d 100644 --- a/ompi/mca/io/romio321/src/io_romio321_file_open.c +++ b/ompi/mca/io/romio341/src/io_romio341_file_open.c @@ -9,8 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -25,18 +25,18 @@ #include "ompi/info/info.h" #include "ompi/file/file.h" -#include "io_romio321.h" +#include "io_romio341.h" int -mca_io_romio321_file_open (ompi_communicator_t *comm, +mca_io_romio341_file_open (ompi_communicator_t *comm, const char *filename, int amode, opal_info_t *info, ompi_file_t *fh) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; // An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call // below with an MPI_Info, we need to create an equivalent MPI_Info. This @@ -47,11 +47,11 @@ mca_io_romio321_file_open (ompi_communicator_t *comm, opal_info_t *opal_info = &(ompi_info->super); opal_info_dup (info, &opal_info); - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; -// OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; +// OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info, &data->romio_fh); -// OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); +// OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); ompi_info_free(&ompi_info); return ret; @@ -59,10 +59,10 @@ mca_io_romio321_file_open (ompi_communicator_t *comm, int -mca_io_romio321_file_close (ompi_file_t *fh) +mca_io_romio341_file_close (ompi_file_t *fh) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; int finalized; /* If we've already started MPI_Finalize by this point, then just @@ -87,113 +87,113 @@ mca_io_romio321_file_close (ompi_file_t *fh) OBJ_RETAIN(fh->error_handler); } - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_close) (&data->romio_fh); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_set_size (ompi_file_t *fh, +mca_io_romio341_file_set_size (ompi_file_t *fh, MPI_Offset size) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_set_size) (data->romio_fh, size); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_preallocate (ompi_file_t *fh, +mca_io_romio341_file_preallocate (ompi_file_t *fh, MPI_Offset size) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_preallocate) (data->romio_fh, size); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_size (ompi_file_t *fh, +mca_io_romio341_file_get_size (ompi_file_t *fh, MPI_Offset * size) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_size) (data->romio_fh, size); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_amode (ompi_file_t *fh, +mca_io_romio341_file_get_amode (ompi_file_t *fh, int *amode) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_amode) (data->romio_fh, amode); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_set_info (ompi_file_t *fh, +mca_io_romio341_file_set_info (ompi_file_t *fh, ompi_info_t *info) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, info); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_info (ompi_file_t *fh, +mca_io_romio341_file_get_info (ompi_file_t *fh, ompi_info_t ** info_used) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, info_used); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_set_view (ompi_file_t *fh, +mca_io_romio341_file_set_view (ompi_file_t *fh, MPI_Offset disp, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, @@ -201,7 +201,7 @@ mca_io_romio321_file_set_view (ompi_file_t *fh, opal_info_t *info) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; // An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call // below with an MPI_Info, we need to create an equivalent MPI_Info. This @@ -212,12 +212,12 @@ mca_io_romio321_file_set_view (ompi_file_t *fh, opal_info_t *opal_info = &(ompi_info->super); opal_info_dup (info, &opal_info); - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype, datarep, ompi_info); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); ompi_info_free(&ompi_info); return ret; @@ -225,21 +225,21 @@ mca_io_romio321_file_set_view (ompi_file_t *fh, int -mca_io_romio321_file_get_view (ompi_file_t *fh, +mca_io_romio341_file_get_view (ompi_file_t *fh, MPI_Offset * disp, struct ompi_datatype_t ** etype, struct ompi_datatype_t ** filetype, char *datarep) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_view) (data->romio_fh, disp, etype, filetype, datarep); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; @@ -247,146 +247,146 @@ mca_io_romio321_file_get_view (ompi_file_t *fh, int -mca_io_romio321_file_get_type_extent (ompi_file_t *fh, +mca_io_romio341_file_get_type_extent (ompi_file_t *fh, struct ompi_datatype_t *datatype, MPI_Aint * extent) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_type_extent) (data->romio_fh, datatype, extent); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_set_atomicity (ompi_file_t *fh, +mca_io_romio341_file_set_atomicity (ompi_file_t *fh, int flag) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_set_atomicity) (data->romio_fh, flag); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_atomicity (ompi_file_t *fh, +mca_io_romio341_file_get_atomicity (ompi_file_t *fh, int *flag) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_atomicity) (data->romio_fh, flag); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_sync (ompi_file_t *fh) +mca_io_romio341_file_sync (ompi_file_t *fh) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_sync) (data->romio_fh); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_seek_shared (ompi_file_t *fh, +mca_io_romio341_file_seek_shared (ompi_file_t *fh, MPI_Offset offset, int whence) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_seek_shared) (data->romio_fh, offset, whence); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_position_shared (ompi_file_t *fh, +mca_io_romio341_file_get_position_shared (ompi_file_t *fh, MPI_Offset * offset) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_position_shared) (data->romio_fh, offset); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_seek (ompi_file_t *fh, +mca_io_romio341_file_seek (ompi_file_t *fh, MPI_Offset offset, int whence) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_seek) (data->romio_fh, offset, whence); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_position (ompi_file_t *fh, +mca_io_romio341_file_get_position (ompi_file_t *fh, MPI_Offset * offset) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_position) (data->romio_fh, offset); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_get_byte_offset (ompi_file_t *fh, +mca_io_romio341_file_get_byte_offset (ompi_file_t *fh, MPI_Offset offset, MPI_Offset * disp) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_get_byte_offset) (data->romio_fh, offset, disp); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } diff --git a/ompi/mca/io/romio321/src/io_romio321_file_read.c b/ompi/mca/io/romio341/src/io_romio341_file_read.c similarity index 65% rename from ompi/mca/io/romio321/src/io_romio321_file_read.c rename to ompi/mca/io/romio341/src/io_romio341_file_read.c index 8944d926cc96c04c693e3f45efd3018a6ecd3a7c..3e09fd2fb374a4078a625cb956d81eb48a148aee 100644 --- a/ompi/mca/io/romio321/src/io_romio321_file_read.c +++ b/ompi/mca/io/romio341/src/io_romio341_file_read.c @@ -10,8 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,11 +22,11 @@ #include "ompi_config.h" #include "mpi.h" #include "ompi/file/file.h" -#include "io_romio321.h" +#include "io_romio341.h" int -mca_io_romio321_file_read_at (ompi_file_t *fh, +mca_io_romio341_file_read_at (ompi_file_t *fh, MPI_Offset offset, void *buf, int count, @@ -34,21 +34,21 @@ mca_io_romio321_file_read_at (ompi_file_t *fh, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_at) (data->romio_fh, offset, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_at_all (ompi_file_t *fh, +mca_io_romio341_file_read_at_all (ompi_file_t *fh, MPI_Offset offset, void *buf, int count, @@ -56,21 +56,21 @@ mca_io_romio321_file_read_at_all (ompi_file_t *fh, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_at_all) (data->romio_fh, offset, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iread_at (ompi_file_t *fh, +mca_io_romio341_file_iread_at (ompi_file_t *fh, MPI_Offset offset, void *buf, int count, @@ -78,20 +78,20 @@ mca_io_romio321_file_iread_at (ompi_file_t *fh, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iread_at) (data->romio_fh, offset, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iread_at_all (ompi_file_t *fh, +mca_io_romio341_file_iread_at_all (ompi_file_t *fh, MPI_Offset offset, void *buf, int count, @@ -99,10 +99,10 @@ mca_io_romio321_file_iread_at_all (ompi_file_t *fh, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); // ---------------------------------------------------- // NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call. // ---------------------------------------------------- @@ -112,86 +112,86 @@ mca_io_romio321_file_iread_at_all (ompi_file_t *fh, ret = ROMIO_PREFIX(MPI_File_iread_at_all) (data->romio_fh, offset, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read (ompi_file_t *fh, +mca_io_romio341_file_read (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_all (ompi_file_t *fh, +mca_io_romio341_file_read_all (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_all) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iread (ompi_file_t *fh, +mca_io_romio341_file_iread (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iread) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iread_all (ompi_file_t *fh, +mca_io_romio341_file_iread_all (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); // ---------------------------------------------------- // NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call. // ---------------------------------------------------- @@ -201,182 +201,182 @@ mca_io_romio321_file_iread_all (ompi_file_t *fh, ret = ROMIO_PREFIX(MPI_File_iread_all) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_shared (ompi_file_t *fh, +mca_io_romio341_file_read_shared (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_shared) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iread_shared (ompi_file_t *fh, +mca_io_romio341_file_iread_shared (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iread_shared) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_ordered (ompi_file_t *fh, +mca_io_romio341_file_read_ordered (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_ordered) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_at_all_begin (ompi_file_t *fh, +mca_io_romio341_file_read_at_all_begin (ompi_file_t *fh, MPI_Offset offset, void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_at_all_begin) (data->romio_fh, offset, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_at_all_end (ompi_file_t *fh, +mca_io_romio341_file_read_at_all_end (ompi_file_t *fh, void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_at_all_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_all_begin (ompi_file_t *fh, +mca_io_romio341_file_read_all_begin (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_all_begin) (data->romio_fh, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_all_end (ompi_file_t *fh, +mca_io_romio341_file_read_all_end (ompi_file_t *fh, void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_all_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_ordered_begin (ompi_file_t *fh, +mca_io_romio341_file_read_ordered_begin (ompi_file_t *fh, void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_ordered_begin) (data->romio_fh, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_read_ordered_end (ompi_file_t *fh, +mca_io_romio341_file_read_ordered_end (ompi_file_t *fh, void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_read_ordered_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } diff --git a/ompi/mca/io/romio321/src/io_romio321_file_write.c b/ompi/mca/io/romio341/src/io_romio341_file_write.c similarity index 65% rename from ompi/mca/io/romio321/src/io_romio321_file_write.c rename to ompi/mca/io/romio341/src/io_romio341_file_write.c index 2eb74d7f5a9232457fb7e94eee9e6d8c7a614351..a60c6d18be54fa351a051755779716cd5f46aec3 100644 --- a/ompi/mca/io/romio321/src/io_romio321_file_write.c +++ b/ompi/mca/io/romio341/src/io_romio341_file_write.c @@ -9,8 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -22,11 +22,11 @@ #include "ompi_config.h" #include "mpi.h" #include "ompi/file/file.h" -#include "io_romio321.h" +#include "io_romio341.h" int -mca_io_romio321_file_write_at (ompi_file_t *fh, +mca_io_romio341_file_write_at (ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, @@ -34,14 +34,14 @@ mca_io_romio321_file_write_at (ompi_file_t *fh, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_at) (data->romio_fh, offset, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } @@ -49,7 +49,7 @@ mca_io_romio321_file_write_at (ompi_file_t *fh, int -mca_io_romio321_file_write_at_all (ompi_file_t *fh, +mca_io_romio341_file_write_at_all (ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, @@ -57,14 +57,14 @@ mca_io_romio321_file_write_at_all (ompi_file_t *fh, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_at_all) (data->romio_fh, offset, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } @@ -72,7 +72,7 @@ mca_io_romio321_file_write_at_all (ompi_file_t *fh, int -mca_io_romio321_file_iwrite_at (ompi_file_t *fh, +mca_io_romio341_file_iwrite_at (ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, @@ -80,21 +80,21 @@ mca_io_romio321_file_iwrite_at (ompi_file_t *fh, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iwrite_at) (data->romio_fh, offset, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh, +mca_io_romio341_file_iwrite_at_all (ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, @@ -102,10 +102,10 @@ mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); // ---------------------------------------------------- // NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call. // ---------------------------------------------------- @@ -115,7 +115,7 @@ mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh, ret = ROMIO_PREFIX(MPI_File_iwrite_at_all) (data->romio_fh, offset, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } @@ -123,77 +123,77 @@ mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh, int -mca_io_romio321_file_write (ompi_file_t *fh, +mca_io_romio341_file_write (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_all (ompi_file_t *fh, +mca_io_romio341_file_write_all (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_all) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iwrite (ompi_file_t *fh, +mca_io_romio341_file_iwrite (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iwrite) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iwrite_all (ompi_file_t *fh, +mca_io_romio341_file_iwrite_all (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); // ---------------------------------------------------- // NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call. // ---------------------------------------------------- @@ -203,173 +203,173 @@ mca_io_romio321_file_iwrite_all (ompi_file_t *fh, ret = ROMIO_PREFIX(MPI_File_iwrite_all) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_shared (ompi_file_t *fh, +mca_io_romio341_file_write_shared (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_shared) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_iwrite_shared (ompi_file_t *fh, +mca_io_romio341_file_iwrite_shared (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_iwrite_shared) (data->romio_fh, buf, count, datatype, request); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_ordered (ompi_file_t *fh, +mca_io_romio341_file_write_ordered (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_ordered) (data->romio_fh, buf, count, datatype, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_at_all_begin (ompi_file_t *fh, +mca_io_romio341_file_write_at_all_begin (ompi_file_t *fh, MPI_Offset offset, const void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_at_all_begin) (data->romio_fh, offset, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_at_all_end (ompi_file_t *fh, +mca_io_romio341_file_write_at_all_end (ompi_file_t *fh, const void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_at_all_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_all_begin (ompi_file_t *fh, +mca_io_romio341_file_write_all_begin (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_all_begin) (data->romio_fh, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_all_end (ompi_file_t *fh, +mca_io_romio341_file_write_all_end (ompi_file_t *fh, const void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_all_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_ordered_begin (ompi_file_t *fh, +mca_io_romio341_file_write_ordered_begin (ompi_file_t *fh, const void *buf, int count, struct ompi_datatype_t *datatype) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_ordered_begin) (data->romio_fh, buf, count, datatype); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } int -mca_io_romio321_file_write_ordered_end (ompi_file_t *fh, +mca_io_romio341_file_write_ordered_end (ompi_file_t *fh, const void *buf, ompi_status_public_t * status) { int ret; - mca_io_romio321_data_t *data; + mca_io_romio341_data_t *data; - data = (mca_io_romio321_data_t *) fh->f_io_selected_data; - OPAL_THREAD_LOCK (&mca_io_romio321_mutex); + data = (mca_io_romio341_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio341_mutex); ret = ROMIO_PREFIX(MPI_File_write_ordered_end) (data->romio_fh, buf, status); - OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex); + OPAL_THREAD_UNLOCK (&mca_io_romio341_mutex); return ret; } diff --git a/ompi/mca/io/romio341/src/io_romio341_module.c b/ompi/mca/io/romio341/src/io_romio341_module.c new file mode 100644 index 0000000000000000000000000000000000000000..56ff8a135285e7d980b814f980001cdc2ff60e62 --- /dev/null +++ b/ompi/mca/io/romio341/src/io_romio341_module.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2008 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 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2017-2021 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "mpi.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/io/io.h" +#include "io_romio341.h" + + +/* + * Global functions that do not need to be prototyped in a header + * because ROMIO just expects these functions to exist. + */ +int MPIR_Status_set_bytes(ompi_status_public_t *status, + struct ompi_datatype_t *datatype, MPI_Count size); +void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); + + +/* + * The ROMIO module operations + */ +mca_io_base_module_2_0_0_t mca_io_romio341_module = { + /* Back end to MPI API calls (pretty much a 1-to-1 mapping) */ + + mca_io_romio341_file_open, + mca_io_romio341_file_close, + + mca_io_romio341_file_set_size, + mca_io_romio341_file_preallocate, + mca_io_romio341_file_get_size, + mca_io_romio341_file_get_amode, + mca_io_romio341_file_set_info, + mca_io_romio341_file_get_info, + mca_io_romio341_file_set_view, + mca_io_romio341_file_get_view, + + /* Index IO operations */ + mca_io_romio341_file_read_at, + mca_io_romio341_file_read_at_all, + mca_io_romio341_file_write_at, + mca_io_romio341_file_write_at_all, + mca_io_romio341_file_iread_at, + mca_io_romio341_file_iwrite_at, + mca_io_romio341_file_iread_at_all, + mca_io_romio341_file_iwrite_at_all, + + /* non-indexed IO operations */ + mca_io_romio341_file_read, + mca_io_romio341_file_read_all, + mca_io_romio341_file_write, + mca_io_romio341_file_write_all, + mca_io_romio341_file_iread, + mca_io_romio341_file_iwrite, + mca_io_romio341_file_iread_all, + mca_io_romio341_file_iwrite_all, + + mca_io_romio341_file_seek, + mca_io_romio341_file_get_position, + mca_io_romio341_file_get_byte_offset, + + mca_io_romio341_file_read_shared, + mca_io_romio341_file_write_shared, + mca_io_romio341_file_iread_shared, + mca_io_romio341_file_iwrite_shared, + mca_io_romio341_file_read_ordered, + mca_io_romio341_file_write_ordered, + mca_io_romio341_file_seek_shared, + mca_io_romio341_file_get_position_shared, + + /* Split IO operations */ + mca_io_romio341_file_read_at_all_begin, + mca_io_romio341_file_read_at_all_end, + mca_io_romio341_file_write_at_all_begin, + mca_io_romio341_file_write_at_all_end, + mca_io_romio341_file_read_all_begin, + mca_io_romio341_file_read_all_end, + mca_io_romio341_file_write_all_begin, + mca_io_romio341_file_write_all_end, + mca_io_romio341_file_read_ordered_begin, + mca_io_romio341_file_read_ordered_end, + mca_io_romio341_file_write_ordered_begin, + mca_io_romio341_file_write_ordered_end, + + mca_io_romio341_file_get_type_extent, + + /* Sync/atomic IO operations */ + mca_io_romio341_file_set_atomicity, + mca_io_romio341_file_get_atomicity, + mca_io_romio341_file_sync +}; + + +void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) +{ + /* + * Open MPI contiguous check return true for datatype with + * gaps in the beginning and at the end. We have to provide + * a count of 2 in order to get these gaps taken into acount. + * In addition, if the data is contiguous but true_lb differes + * from zero, ROMIO will ignore the displacement. Thus, lie! + */ + *flag = ompi_datatype_is_contiguous_memory_layout(datatype, 2); + if (*flag) { + MPI_Aint true_extent, true_lb; + + ompi_datatype_get_true_extent(datatype, &true_lb, &true_extent); + + if (true_lb > 0) + *flag = 0; + } +}