253444c6d0
1. New mpifort wrapper compiler: you can utilize mpif.h, use mpi, and use mpi_f08 through this one wrapper compiler 1. mpif77 and mpif90 still exist, but are sym links to mpifort and may be removed in a future release 1. The mpi module has been re-implemented and is significantly "mo' bettah" 1. The mpi_f08 module offers many, many improvements over mpif.h and the mpi module This stuff is coming from a VERY long-lived mercurial branch (3 years!); it'll almost certainly take a few SVN commits and a bunch of testing before I get it correctly committed to the SVN trunk. == More details == Craig Rasmussen and I have been working with the MPI-3 Fortran WG and Fortran J3 committees for a long, long time to make a prototype MPI-3 Fortran bindings implementation. We think we're at a stable enough state to bring this stuff back to the trunk, with the goal of including it in OMPI v1.7. Special thanks go out to everyone who has been incredibly patient and helpful to us in this journey: * Rolf Rabenseifner/HLRS (mastermind/genius behind the entire MPI-3 Fortran effort) * The Fortran J3 committee * Tobias Burnus/gfortran * Tony !Goetz/Absoft * Terry !Donte/Oracle * ...and probably others whom I'm forgetting :-( There's still opportunities for optimization in the mpi_f08 implementation, but by and large, it is as far along as it can be until Fortran compilers start implementing the new F08 dimension(..) syntax. Note that gfortran is currently unsupported for the mpi_f08 module and the new mpi module. gfortran users will a) fall back to the same mpi module implementation that is in OMPI v1.5.x, and b) not get the new mpi_f08 module. The gfortran maintainers are actively working hard to add the necessary features to support both the new mpi_f08 module and the new mpi module implementations. This will take some time. As mentioned above, ompi/mpi/f77 and ompi/mpi/f90 no longer exist. All the fortran bindings implementations have been collated under ompi/mpi/fortran; each implementation has its own subdirectory: {{{ ompi/mpi/fortran/ base/ - glue code mpif-h/ - what used to be ompi/mpi/f77 use-mpi-tkr/ - what used to be ompi/mpi/f90 use-mpi-ignore-tkr/ - new mpi module implementation use-mpi-f08/ - new mpi_f08 module implementation }}} There's also a prototype 6-function-MPI implementation under use-mpi-f08-desc that emulates the new F08 dimension(..) syntax that isn't fully available in Fortran compilers yet. We did that to prove it to ourselves that it could be done once the compilers fully support it. This directory/implementation will likely eventually replace the use-mpi-f08 version. Other things that were done: * ompi_info grew a few new output fields to describe what level of Fortran support is included * Existing Fortran examples in examples/ were renamed; new mpi_f08 examples were added * The old Fortran MPI libraries were renamed: * libmpi_f77 -> libmpi_mpifh * libmpi_f90 -> libmpi_usempi * The configury for Fortran was consolidated and significantly slimmed down. Note that the F77 env variable is now IGNORED for configure; you should only use FC. Example: {{{ shell$ ./configure CC=icc CXX=icpc FC=ifort ... }}} All of this work was done in a Mercurial branch off the SVN trunk, and hosted at Bitbucket. This branch has got to be one of OMPI's longest-running branches. Its first commit was Tue Apr 07 23:01:46 2009 -0400 -- it's over 3 years old! :-) We think we've pulled in all relevant changes from the OMPI trunk (e.g., Fortran implementations of the new MPI-3 MPROBE stuff for mpif.h, use mpi, and use mpi_f08, and the recent Fujitsu Fortran patches). I anticipate some instability when we bring this stuff into the trunk, simply because it touches a LOT of code in the MPI layer in the OMPI code base. We'll try our best to make it as pain-free as possible, but please bear with us when it is committed. This commit was SVN r26283.
213 строки
6.3 KiB
C
213 строки
6.3 KiB
C
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
|
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
|
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#ifndef OMPI_FILE_H
|
|
#define OMPI_FILE_H
|
|
|
|
#include "ompi_config.h"
|
|
#include "mpi.h"
|
|
#include "opal/class/opal_list.h"
|
|
#include "ompi/errhandler/errhandler.h"
|
|
#include "opal/threads/mutex.h"
|
|
#include "ompi/mca/io/io.h"
|
|
|
|
/*
|
|
* Flags
|
|
*/
|
|
#define OMPI_FILE_ISCLOSED 0x00000001
|
|
#define OMPI_FILE_HIDDEN 0x00000002
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
/**
|
|
* Back-end structure for MPI_File
|
|
*/
|
|
struct ompi_file_t {
|
|
/** Base of OBJ_* interface */
|
|
opal_object_t super;
|
|
|
|
/** Communicator that this file was created with */
|
|
struct ompi_communicator_t *f_comm;
|
|
|
|
/** Filename that this file was created with */
|
|
char *f_filename;
|
|
|
|
/** Amode that this file was created with */
|
|
int f_amode;
|
|
|
|
/** MPI_Info that this file was created with. Note that this is
|
|
*NOT* what should be returned from OMPI_FILE_GET_INFO! */
|
|
struct ompi_info_t *f_info;
|
|
|
|
/** Bit flags */
|
|
int32_t f_flags;
|
|
|
|
/** Index in Fortran <-> C translation array */
|
|
int f_f_to_c_index;
|
|
|
|
/** Error handler. This field does not have the "f_" prefix so
|
|
that the OMPI_ERRHDL_* macros can find it, regardless of
|
|
whether it's a comm, window, or file. */
|
|
struct ompi_errhandler_t *error_handler;
|
|
|
|
/** Type of the error handler. This field does not have the "f_"
|
|
prefix for the same reason as the field error_handler. */
|
|
ompi_errhandler_type_t errhandler_type;
|
|
|
|
/** Indicate what version of the IO component we're using (this
|
|
indicates what member to look at in the union, below) */
|
|
mca_io_base_version_t f_io_version;
|
|
|
|
/** The selected component (note that this is a union) -- we need
|
|
this to add and remove the component from the list of
|
|
components currently in use by the io framework for
|
|
progression porpoises. */
|
|
mca_io_base_components_t f_io_selected_component;
|
|
|
|
/** The selected module (note that this is a union) */
|
|
mca_io_base_modules_t f_io_selected_module;
|
|
|
|
/** Allow the selected module to cache data on the file */
|
|
struct mca_io_base_file_t *f_io_selected_data;
|
|
};
|
|
/**
|
|
* Convenience typedef
|
|
*/
|
|
typedef struct ompi_file_t ompi_file_t;
|
|
|
|
/**
|
|
* Padded struct to maintain back compatibiltiy.
|
|
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
|
|
* for full explanation why we chose the following padding construct for predefines.
|
|
*/
|
|
#define PREDEFINED_FILE_PAD (sizeof(void*) * 192)
|
|
|
|
struct ompi_predefined_file_t {
|
|
struct ompi_file_t file;
|
|
char padding[PREDEFINED_FILE_PAD - sizeof(ompi_file_t)];
|
|
};
|
|
typedef struct ompi_predefined_file_t ompi_predefined_file_t;
|
|
|
|
/**
|
|
* Back-end instances for MPI_FILE_NULL (_addr flavor is for F03 bindings)
|
|
*/
|
|
OMPI_DECLSPEC extern ompi_predefined_file_t ompi_mpi_file_null;
|
|
OMPI_DECLSPEC extern ompi_predefined_file_t *ompi_mpi_file_null_addr;
|
|
|
|
|
|
/**
|
|
* Fortran to C conversion table
|
|
*/
|
|
extern opal_pointer_array_t ompi_file_f_to_c_table;
|
|
|
|
/**
|
|
* Initialize MPI_File handling.
|
|
*
|
|
* @retval OMPI_SUCCESS Always.
|
|
*
|
|
* Invoked during ompi_mpi_init().
|
|
*/
|
|
int ompi_file_init(void);
|
|
|
|
/**
|
|
* Back-end to MPI_FILE_OPEN: create a file handle, select an io
|
|
* component to use, and have that componet open the file.
|
|
*
|
|
* @param comm Communicator
|
|
* @param filename String filename
|
|
* @param amode Mode flags
|
|
* @param info Info
|
|
* @param fh Output file handle
|
|
*
|
|
* @retval OMPI_SUCCESS Upon success
|
|
* @retval OMPI_ERR* Upon error
|
|
*
|
|
* Create a file handle and select an io module to be paired with
|
|
* it. There is a corresponding ompi_file_close() function; it
|
|
* mainly calls OBJ_RELEASE() but also does some other error
|
|
* handling as well.
|
|
*/
|
|
int ompi_file_open(struct ompi_communicator_t *comm, char *filename,
|
|
int amode, struct ompi_info_t *info,
|
|
ompi_file_t **fh);
|
|
|
|
/**
|
|
* Atomicly set a name on a file handle.
|
|
*
|
|
* @param file MPI_File handle to set the name on
|
|
* @param name NULL-terminated string to use
|
|
*
|
|
* @returns OMPI_SUCCESS Always.
|
|
*
|
|
* At most (MPI_MAX_OBJECT_NAME-1) characters will be copied over to
|
|
* the file name's name. This function is performed atomically -- a
|
|
* lock is used to ensure that there are not multiple writers to the
|
|
* name to ensure that we don't end up with an erroneous name (e.g.,
|
|
* a name without a \0 at the end). After invoking this function,
|
|
* ompi_file_is_name_set() will return true.
|
|
*/
|
|
int ompi_file_set_name(ompi_file_t *file, char *name);
|
|
|
|
/**
|
|
* Back-end to MPI_FILE_CLOSE: destroy an ompi_file_t handle and
|
|
* close the file.
|
|
*
|
|
* @param file Pointer to ompi_file_t
|
|
*
|
|
* @returns OMPI_SUCCESS Always.
|
|
*
|
|
* This is the preferred mechanism for freeing an ompi_file_t.
|
|
* Although the main action that it performs is OBJ_RELEASE(), it
|
|
* also does some additional handling for error checking, etc.
|
|
*/
|
|
int ompi_file_close(ompi_file_t **file);
|
|
|
|
/**
|
|
* Tear down MPI_File handling.
|
|
*
|
|
* @retval OMPI_SUCCESS Always.
|
|
*
|
|
* Invoked during ompi_mpi_finalize().
|
|
*/
|
|
int ompi_file_finalize(void);
|
|
|
|
/**
|
|
* Check to see if an MPI_File handle is valid.
|
|
*
|
|
* @param file The MPI file handle
|
|
*
|
|
* @retval true If the file handle is not valid
|
|
* @retval false If the file handle is valid
|
|
*
|
|
* This is a convenience function, mainly for error checking in
|
|
* top-level MPI API functions.
|
|
*/
|
|
static inline bool ompi_file_invalid(ompi_file_t *file)
|
|
{
|
|
return (NULL == file ||
|
|
&ompi_mpi_file_null.file == file ||
|
|
0 != (file->f_flags & OMPI_FILE_ISCLOSED));
|
|
}
|
|
|
|
END_C_DECLS
|
|
|
|
#endif /* OMPI_FILE_H */
|