2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-01-10 01:09:51 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2011-10-04 18:50:31 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
== Highlights ==
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.
2012-04-18 19:57:29 +04:00
|
|
|
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
2010-01-07 19:26:30 +03:00
|
|
|
* Copyright (c) 2006-2010 University of Houston. All rights reserved.
|
2009-02-24 20:17:33 +03:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-10 01:09:51 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#ifndef OMPI_COMMUNICATOR_H
|
|
|
|
#define OMPI_COMMUNICATOR_H
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2009-03-04 18:35:54 +03:00
|
|
|
#include "ompi_config.h"
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/errhandler/errhandler.h"
|
2005-07-04 02:45:48 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2004-01-11 03:13:22 +03:00
|
|
|
#include "mpi.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/group/group.h"
|
|
|
|
#include "ompi/mca/coll/coll.h"
|
2005-10-24 14:36:16 +04:00
|
|
|
#include "ompi/proc/proc.h"
|
2004-02-06 07:20:13 +03:00
|
|
|
|
2007-08-19 07:37:49 +04:00
|
|
|
BEGIN_C_DECLS
|
2006-08-24 20:38:08 +04:00
|
|
|
|
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_communicator_t);
|
2004-02-13 16:56:55 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
#define OMPI_COMM_INTER 0x00000001
|
|
|
|
#define OMPI_COMM_CART 0x00000002
|
|
|
|
#define OMPI_COMM_GRAPH 0x00000004
|
|
|
|
#define OMPI_COMM_NAMEISSET 0x00000008
|
|
|
|
#define OMPI_COMM_ISFREED 0x00000010
|
|
|
|
#define OMPI_COMM_INTRINSIC 0x00000020
|
2006-09-21 00:57:10 +04:00
|
|
|
#define OMPI_COMM_DYNAMIC 0x00000040
|
|
|
|
#define OMPI_COMM_INVALID 0x00000080
|
|
|
|
#define OMPI_COMM_PML_ADDED 0x00000100
|
2010-02-24 00:24:07 +03:00
|
|
|
#define OMPI_COMM_EXTRA_RETAIN 0x00000200
|
2004-02-13 16:56:55 +03:00
|
|
|
|
2004-04-21 04:16:05 +04:00
|
|
|
/* some utility #defines */
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_COMM_IS_INTER(comm) ((comm)->c_flags & OMPI_COMM_INTER)
|
|
|
|
#define OMPI_COMM_IS_INTRA(comm) (!((comm)->c_flags & OMPI_COMM_INTER))
|
|
|
|
#define OMPI_COMM_IS_CART(comm) ((comm)->c_flags & OMPI_COMM_CART)
|
|
|
|
#define OMPI_COMM_IS_GRAPH(comm) ((comm)->c_flags & OMPI_COMM_GRAPH)
|
2004-06-15 04:09:40 +04:00
|
|
|
#define OMPI_COMM_IS_INTRINSIC(comm) ((comm)->c_flags & OMPI_COMM_INTRINSIC)
|
2004-08-13 22:55:07 +04:00
|
|
|
#define OMPI_COMM_IS_FREED(comm) ((comm)->c_flags & OMPI_COMM_ISFREED)
|
2006-09-21 02:20:10 +04:00
|
|
|
#define OMPI_COMM_IS_DYNAMIC(comm) ((comm)->c_flags & OMPI_COMM_DYNAMIC)
|
|
|
|
#define OMPI_COMM_IS_INVALID(comm) ((comm)->c_flags & OMPI_COMM_INVALID)
|
|
|
|
#define OMPI_COMM_IS_PML_ADDED(comm) ((comm)->c_flags & OMPI_COMM_PML_ADDED)
|
2010-02-24 00:24:07 +03:00
|
|
|
#define OMPI_COMM_IS_EXTRA_RETAIN(comm) ((comm)->c_flags & OMPI_COMM_EXTRA_RETAIN)
|
2004-08-06 18:33:23 +04:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
#define OMPI_COMM_SET_DYNAMIC(comm) ((comm)->c_flags |= OMPI_COMM_DYNAMIC)
|
2004-10-26 21:25:49 +04:00
|
|
|
#define OMPI_COMM_SET_INVALID(comm) ((comm)->c_flags |= OMPI_COMM_INVALID)
|
2004-10-26 15:37:58 +04:00
|
|
|
|
2005-03-26 04:49:14 +03:00
|
|
|
#define OMPI_COMM_SET_PML_ADDED(comm) ((comm)->c_flags |= OMPI_COMM_PML_ADDED)
|
2010-02-24 00:24:07 +03:00
|
|
|
#define OMPI_COMM_SET_EXTRA_RETAIN(comm) ((comm)->c_flags |= OMPI_COMM_EXTRA_RETAIN)
|
2005-03-26 04:49:14 +03:00
|
|
|
|
2004-10-26 19:06:51 +04:00
|
|
|
/* a set of special tags: */
|
|
|
|
|
|
|
|
/* to recognize an MPI_Comm_join in the comm_connect_accept routine. */
|
|
|
|
|
|
|
|
#define OMPI_COMM_ALLGATHER_TAG -31078
|
|
|
|
#define OMPI_COMM_BARRIER_TAG -31079
|
|
|
|
#define OMPI_COMM_ALLREDUCE_TAG -31080
|
|
|
|
|
2005-10-24 14:36:16 +04:00
|
|
|
/**
|
|
|
|
* Modes required for acquiring the new comm-id.
|
2004-05-21 23:36:19 +04:00
|
|
|
* The first (INTER/INTRA) indicates whether the
|
|
|
|
* input comm was an inter/intra-comm, the second
|
2005-10-24 14:36:16 +04:00
|
|
|
* whether the new communicator will be an inter/intra
|
|
|
|
* comm
|
2004-05-21 23:36:19 +04:00
|
|
|
*/
|
2004-08-06 18:33:23 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA 0x00000020
|
|
|
|
#define OMPI_COMM_CID_INTER 0x00000040
|
2004-06-17 02:37:03 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA_BRIDGE 0x00000080
|
2004-08-06 18:33:23 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA_OOB 0x00000100
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2006-12-13 01:01:39 +03:00
|
|
|
/**
|
|
|
|
* The block of CIDs allocated for MPI_COMM_WORLD
|
|
|
|
* and other communicators
|
|
|
|
*/
|
|
|
|
#define OMPI_COMM_BLOCK_WORLD 16
|
|
|
|
#define OMPI_COMM_BLOCK_OTHERS 8
|
|
|
|
|
2010-02-20 02:45:30 +03:00
|
|
|
/* A macro comparing two CIDs */
|
|
|
|
#define OMPI_COMM_CID_IS_LOWER(comm1,comm2) ( ((comm1)->c_contextid < (comm2)->c_contextid)? 1:0)
|
|
|
|
|
|
|
|
|
2007-12-21 09:02:00 +03:00
|
|
|
OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_communicators;
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
struct ompi_communicator_t {
|
2005-10-24 14:36:16 +04:00
|
|
|
opal_object_t c_base;
|
|
|
|
opal_mutex_t c_lock; /* mutex for name and potentially
|
2004-10-26 21:25:49 +04:00
|
|
|
attributes */
|
2004-03-26 23:02:42 +03:00
|
|
|
char c_name[MPI_MAX_OBJECT_NAME];
|
|
|
|
uint32_t c_contextid;
|
|
|
|
int c_my_rank;
|
2005-10-24 14:36:16 +04:00
|
|
|
uint32_t c_flags; /* flags, e.g. intercomm,
|
2004-03-26 23:02:42 +03:00
|
|
|
topology, etc. */
|
|
|
|
|
2006-12-13 01:01:39 +03:00
|
|
|
int c_id_available; /* the currently available Cid for allocation
|
2007-04-06 23:18:31 +04:00
|
|
|
to a child*/
|
2006-12-13 01:01:39 +03:00
|
|
|
int c_id_start_index; /* the starting index of the block of cids
|
2009-02-24 20:17:33 +03:00
|
|
|
allocated to this communicator*/
|
2006-12-13 01:01:39 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_group_t *c_local_group;
|
|
|
|
ompi_group_t *c_remote_group;
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2007-03-27 06:06:42 +04:00
|
|
|
struct ompi_communicator_t *c_local_comm; /* a duplicate of the local
|
2007-04-06 23:18:31 +04:00
|
|
|
communicator in case the comm
|
|
|
|
is an inter-comm*/
|
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Attributes */
|
2005-12-09 08:14:18 +03:00
|
|
|
struct opal_hash_table_t *c_keyhash;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/**< inscribing cube dimension */
|
2005-10-24 14:36:16 +04:00
|
|
|
int c_cube_dim;
|
2004-04-21 04:16:05 +04:00
|
|
|
|
2004-04-17 00:54:48 +04:00
|
|
|
/* Hooks for topo module to hang things */
|
2004-10-05 20:32:52 +04:00
|
|
|
mca_base_component_t *c_topo_component;
|
|
|
|
|
2005-12-09 08:14:18 +03:00
|
|
|
const struct mca_topo_base_module_1_0_0_t* c_topo;
|
2004-08-02 04:24:22 +04:00
|
|
|
/**< structure of function pointers */
|
2004-07-21 02:21:47 +04:00
|
|
|
|
2005-12-09 08:14:18 +03:00
|
|
|
struct mca_topo_base_comm_1_0_0_t* c_topo_comm;
|
2004-08-02 04:24:22 +04:00
|
|
|
/**< structure containing basic information about the topology */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2005-10-24 14:36:16 +04:00
|
|
|
struct mca_topo_base_module_comm_t *c_topo_module;
|
2004-08-02 04:24:22 +04:00
|
|
|
/**< module specific data */
|
2004-07-21 02:21:47 +04:00
|
|
|
|
2004-03-19 03:00:09 +03:00
|
|
|
/* index in Fortran <-> C translation array */
|
|
|
|
|
|
|
|
int c_f_to_c_index;
|
|
|
|
|
2006-03-23 08:00:55 +03:00
|
|
|
#ifdef OMPI_WANT_PERUSE
|
|
|
|
/*
|
|
|
|
* Place holder for the PERUSE events.
|
|
|
|
*/
|
|
|
|
struct ompi_peruse_handle_t** c_peruse_handles;
|
|
|
|
#endif
|
|
|
|
|
2004-03-19 09:12:43 +03:00
|
|
|
/* Error handling. This field does not have the "c_" prefix so
|
2004-06-07 19:33:53 +04:00
|
|
|
that the OMPI_ERRHDL_* macros can find it, regardless of whether
|
2004-03-19 09:12:43 +03:00
|
|
|
it's a comm, window, or file. */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-09-06 16:06:27 +04:00
|
|
|
ompi_errhandler_t *error_handler;
|
|
|
|
ompi_errhandler_type_t errhandler_type;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Hooks for PML to hang things */
|
2005-05-09 23:37:10 +04:00
|
|
|
struct mca_pml_comm_t *c_pml_comm;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2007-08-19 07:37:49 +04:00
|
|
|
/* Collectives module interface and data */
|
|
|
|
mca_coll_base_comm_coll_t c_coll;
|
2004-01-10 20:05:04 +03:00
|
|
|
};
|
2008-11-05 00:58:06 +03:00
|
|
|
typedef struct ompi_communicator_t ompi_communicator_t;
|
2009-02-24 20:17:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Padded struct to maintain back compatibiltiy.
|
|
|
|
*
|
|
|
|
* The following ompi_predefined_xxx_t structure is used to maintain
|
|
|
|
* backwards binary compatibility for MPI applications compiled
|
|
|
|
* against one version of OMPI library but dynamically linked at
|
|
|
|
* runtime with another. The issue is between versions the actual
|
|
|
|
* structure may change in size (even between debug and optimized
|
|
|
|
* compilation -- the structure contents change, and therefore the
|
|
|
|
* overall size changes).
|
|
|
|
*
|
|
|
|
* This is problematic with predefined handles because the storage of
|
|
|
|
* the structure ends up being located to an application's BSS. This
|
|
|
|
* causes problems because if one version has the predefined as size X
|
|
|
|
* and then the application is dynamically linked with a version that
|
|
|
|
* has a size of Y (where X != Y) then the application will
|
|
|
|
* unintentionally overrun the memory initially allocated for the
|
|
|
|
* structure.
|
|
|
|
*
|
|
|
|
* The solution we are using below creates a parent structure
|
|
|
|
* (ompi_predefined_xxx_t) that contains the base structure
|
|
|
|
* (ompi_xxx_t) followed by a character padding that is the size of
|
|
|
|
* the total size we choose to preallocate for the structure minus the
|
|
|
|
* amount used by the base structure. In this way, we've normalized
|
|
|
|
* the size of each predefined handle across multiple versions and
|
|
|
|
* configurations of Open MPI (e.g., MPI_COMM_WORLD will refer to a
|
|
|
|
* back-end struct that is X bytes long, even if we change the
|
|
|
|
* back-end ompi_communicator_t between version A.B and version C.D in
|
|
|
|
* Open MPI). When we come close to filling up the the padding we can
|
|
|
|
* add a pointer at the back end of the base structure to point to an
|
|
|
|
* extension of the type. Or we can just increase the padding and
|
|
|
|
* break backwards binary compatibility.
|
|
|
|
*
|
|
|
|
* The above method was decided after several failed attempts
|
|
|
|
* described below.
|
|
|
|
*
|
|
|
|
* - Original implementation - suffered that the base structure seemed
|
|
|
|
* to always change in size between Open MPI versions and/or
|
|
|
|
* configurations (e.g., optimized vs. debugging build).
|
|
|
|
*
|
|
|
|
* - Convert all predefined handles to run-time-assigned pointers
|
|
|
|
* (i.e., global variables) - This worked except in cases where an MPI
|
|
|
|
* application wanted to assign the predefined handle value to a
|
|
|
|
* global variable -- we could not guarantee to have the global
|
|
|
|
* variable filled until MPI_INIT was called (recall that MPI
|
|
|
|
* predefined handles must be assignable before MPI_INIT; e.g.,
|
|
|
|
* "MPI_Comm foo = MPI_COMM_WORLD").
|
|
|
|
*
|
|
|
|
* - union of struct and padding - Similar to current implementation
|
|
|
|
* except using a union for the parent. This worked except in cases
|
|
|
|
* where the compilers did not support C99 union static initalizers.
|
|
|
|
* It would have been a pain to convert a bunch of the code to use
|
|
|
|
* non-static initializers (e.g., MPI datatypes).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Define for the preallocated size of the predefined handle.
|
|
|
|
* Note that we are using a pointer type as the base memory chunk
|
|
|
|
* size so when the bitness changes the size of the handle changes.
|
|
|
|
* This is done so we don't end up needing a structure that is
|
|
|
|
* incredibly larger than necessary because of the bitness.
|
|
|
|
*/
|
2009-03-04 22:54:58 +03:00
|
|
|
#define PREDEFINED_COMMUNICATOR_PAD (sizeof(void*) * 128)
|
2009-02-24 20:17:33 +03:00
|
|
|
|
|
|
|
struct ompi_predefined_communicator_t {
|
|
|
|
struct ompi_communicator_t comm;
|
|
|
|
char padding[PREDEFINED_COMMUNICATOR_PAD - sizeof(ompi_communicator_t)];
|
|
|
|
};
|
|
|
|
typedef struct ompi_predefined_communicator_t ompi_predefined_communicator_t;
|
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
OMPI_DECLSPEC extern ompi_communicator_t *ompi_mpi_comm_parent;
|
2009-03-18 00:34:30 +03:00
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_world;
|
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_self;
|
2009-02-24 20:17:33 +03:00
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_null;
|
|
|
|
|
== Highlights ==
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.
2012-04-18 19:57:29 +04:00
|
|
|
/*
|
|
|
|
* These variables are for the MPI F03 bindings (F03 must bind Fortran
|
|
|
|
* varaiables to symbols; it cannot bind Fortran variables to the
|
|
|
|
* address of a C variable).
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_world_addr;
|
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_self_addr;
|
|
|
|
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_null_addr;
|
2004-03-03 19:44:41 +03:00
|
|
|
|
2004-01-11 02:12:43 +03:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* Is this a valid communicator? This is a complicated question.
|
|
|
|
* :-)
|
|
|
|
*
|
|
|
|
* According to MPI-1:5.2.4 (p137):
|
|
|
|
*
|
|
|
|
* "The predefined constant MPI_COMM_NULL is the value used for
|
|
|
|
* invalid communicator handles."
|
|
|
|
*
|
|
|
|
* Hence, MPI_COMM_NULL is not valid. However, MPI-2:4.12.4 (p50)
|
|
|
|
* clearly states that the MPI_*_C2F and MPI_*_F2C functions
|
|
|
|
* should treat MPI_COMM_NULL as a valid communicator -- it
|
|
|
|
* distinctly differentiates between "invalid" handles and
|
|
|
|
* "MPI_*_NULL" handles. Some feel that the MPI-1 definition
|
|
|
|
* still holds for all other MPI functions; others feel that the
|
|
|
|
* MPi-2 definitions trump the MPI-1 definition. Regardless of
|
|
|
|
* who is right, there is ambiguity here. So we have left
|
|
|
|
* ompi_comm_invalid() as originally coded -- per the MPI-1
|
|
|
|
* definition, where MPI_COMM_NULL is an invalid communicator.
|
|
|
|
* The MPI_Comm_c2f() function, therefore, calls
|
|
|
|
* ompi_comm_invalid() but also explictily checks to see if the
|
|
|
|
* handle is MPI_COMM_NULL.
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_invalid(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
if ((NULL == comm) || (MPI_COMM_NULL == comm) ||
|
|
|
|
(OMPI_COMM_IS_FREED(comm)) || (OMPI_COMM_IS_INVALID(comm)) )
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* rank w/in the communicator
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_rank(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
return comm->c_my_rank;
|
|
|
|
}
|
2007-07-11 21:14:57 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* size of the communicator
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_size(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
return comm->c_local_group->grp_proc_count;
|
|
|
|
}
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* size of the remote group for inter-communicators.
|
|
|
|
* returns zero for an intra-communicator
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_remote_size(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
return (comm->c_flags & OMPI_COMM_INTER ? comm->c_remote_group->grp_proc_count : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context ID for the communicator, suitable for passing to
|
|
|
|
* ompi_comm_lookup for getting the communicator back
|
|
|
|
*/
|
|
|
|
static inline uint32_t ompi_comm_get_cid(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
return comm->c_contextid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return pointer to communicator associated with context id cid,
|
|
|
|
* No error checking is done*/
|
|
|
|
static inline ompi_communicator_t *ompi_comm_lookup(uint32_t cid)
|
|
|
|
{
|
|
|
|
/* array of pointers to communicators, indexed by context ID */
|
|
|
|
return (ompi_communicator_t*)opal_pointer_array_get_item(&ompi_mpi_communicators, cid);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct ompi_proc_t* ompi_comm_peer_lookup(ompi_communicator_t* comm, int peer_id)
|
|
|
|
{
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_ENABLE_DEBUG
|
2008-11-05 00:58:06 +03:00
|
|
|
if(peer_id >= comm->c_remote_group->grp_proc_count) {
|
2009-09-10 12:11:38 +04:00
|
|
|
opal_output(0, "ompi_comm_peer_lookup: invalid peer index (%d)", peer_id);
|
2008-11-05 00:58:06 +03:00
|
|
|
return (struct ompi_proc_t *) NULL;
|
|
|
|
}
|
2004-01-12 21:47:12 +03:00
|
|
|
#endif
|
2008-11-05 00:58:06 +03:00
|
|
|
/*return comm->c_remote_group->grp_proc_pointers[peer_id];*/
|
|
|
|
return ompi_group_peer_lookup(comm->c_remote_group,peer_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool ompi_comm_peer_invalid(ompi_communicator_t* comm, int peer_id)
|
|
|
|
{
|
|
|
|
if(peer_id < 0 || peer_id >= comm->c_remote_group->grp_proc_count) {
|
|
|
|
return true;
|
2004-03-17 00:56:19 +03:00
|
|
|
}
|
2008-11-05 00:58:06 +03:00
|
|
|
return false;
|
|
|
|
}
|
2005-10-24 14:36:16 +04:00
|
|
|
|
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* Initialise MPI_COMM_WORLD and MPI_COMM_SELF
|
|
|
|
*/
|
|
|
|
int ompi_comm_init(void);
|
|
|
|
OMPI_DECLSPEC int ompi_comm_link_function(void);
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* extract the local group from a communicator
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_group (ompi_communicator_t *comm, ompi_group_t **group);
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* create a communicator based on a group
|
|
|
|
*/
|
|
|
|
int ompi_comm_create (ompi_communicator_t* comm, ompi_group_t *group,
|
|
|
|
ompi_communicator_t** newcomm);
|
2005-10-24 14:36:16 +04:00
|
|
|
|
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* create a cartesian communicator
|
|
|
|
*/
|
|
|
|
int ompi_topo_create (ompi_communicator_t *old_comm,
|
|
|
|
int ndims_or_nnodes,
|
|
|
|
int *dims_or_index,
|
|
|
|
int *periods_or_edges,
|
|
|
|
bool reorder,
|
|
|
|
ompi_communicator_t **comm_cart,
|
|
|
|
int cart_or_graph);
|
2005-10-24 14:36:16 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* split a communicator based on color and key. Parameters
|
|
|
|
* are identical to the MPI-counterpart of the function.
|
|
|
|
*
|
|
|
|
* @param comm: input communicator
|
|
|
|
* @param color
|
|
|
|
* @param key
|
|
|
|
*
|
|
|
|
* @
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_split (ompi_communicator_t *comm, int color, int key,
|
|
|
|
ompi_communicator_t** newcomm, bool pass_on_topo);
|
2005-06-27 12:32:18 +04:00
|
|
|
|
2012-01-19 03:35:21 +04:00
|
|
|
/**
|
|
|
|
* split a communicator based on type and key. Parameters
|
|
|
|
* are identical to the MPI-counterpart of the function.
|
|
|
|
*
|
|
|
|
* @param comm: input communicator
|
|
|
|
* @param color
|
|
|
|
* @param key
|
|
|
|
*
|
|
|
|
* @
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_split_type(ompi_communicator_t *comm,
|
|
|
|
int split_type, int key,
|
|
|
|
struct ompi_info_t *info,
|
|
|
|
ompi_communicator_t** newcomm);
|
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* dup a communicator. Parameter are identical to the MPI-counterpart
|
|
|
|
* of the function. It has been extracted, since we need to be able
|
|
|
|
* to dup a communicator internally as well.
|
|
|
|
*
|
|
|
|
* @param comm: input communicator
|
|
|
|
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_dup (ompi_communicator_t *comm, ompi_communicator_t **newcomm);
|
|
|
|
/**
|
|
|
|
* compare two communicators.
|
|
|
|
*
|
|
|
|
* @param comm1,comm2: input communicators
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int ompi_comm_compare(ompi_communicator_t *comm1, ompi_communicator_t *comm2, int *result);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* free a communicator
|
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_free (ompi_communicator_t **comm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* allocate a new communicator structure
|
|
|
|
* @param local_group_size
|
|
|
|
* @param remote_group_size
|
|
|
|
*
|
|
|
|
* This routine allocates the structure, the according local and
|
|
|
|
* remote groups, the proc-arrays in the local and remote group.
|
|
|
|
* It furthermore sets the fortran index correctly,
|
|
|
|
* and sets all other elements to zero.
|
|
|
|
*/
|
|
|
|
ompi_communicator_t* ompi_comm_allocate (int local_group_size,
|
|
|
|
int remote_group_size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* allocate new communicator ID
|
|
|
|
* @param newcomm: pointer to the new communicator
|
|
|
|
* @param oldcomm: original comm
|
|
|
|
* @param bridgecomm: bridge comm for intercomm_create
|
|
|
|
* @param mode: combination of input
|
|
|
|
* OMPI_COMM_CID_INTRA: intra-comm
|
|
|
|
* OMPI_COMM_CID_INTER: inter-comm
|
|
|
|
* OMPI_COMM_CID_INTRA_BRIDGE: 2 intracomms connected by
|
|
|
|
* a bridge comm. local_leader
|
|
|
|
* and remote leader are in this
|
|
|
|
* case an int (rank in bridge-comm).
|
|
|
|
* OMPI_COMM_CID_INTRA_OOB: 2 intracomms, leaders talk
|
|
|
|
* through OOB. lleader and rleader
|
|
|
|
* are the required contact information.
|
|
|
|
* @param send_first: to avoid a potential deadlock for
|
|
|
|
* the OOB version.
|
|
|
|
* This routine has to be thread safe in the final version.
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
OMPI_DECLSPEC int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
2008-11-05 00:58:06 +03:00
|
|
|
ompi_communicator_t* oldcomm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int mode,
|
|
|
|
int send_first);
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* shut down the communicator infrastructure.
|
|
|
|
*/
|
|
|
|
int ompi_comm_finalize (void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is THE routine, where all the communicator stuff
|
|
|
|
* is really set.
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
OMPI_DECLSPEC int ompi_comm_set ( ompi_communicator_t** newcomm,
|
2008-11-05 00:58:06 +03:00
|
|
|
ompi_communicator_t* oldcomm,
|
|
|
|
int local_size,
|
|
|
|
int *local_ranks,
|
|
|
|
int remote_size,
|
|
|
|
int *remote_ranks,
|
|
|
|
opal_hash_table_t *attr,
|
|
|
|
ompi_errhandler_t *errh,
|
|
|
|
mca_base_component_t *topocomponent,
|
|
|
|
ompi_group_t *local_group,
|
|
|
|
ompi_group_t *remote_group );
|
|
|
|
/**
|
|
|
|
* This is a short-hand routine used in intercomm_create.
|
|
|
|
* The routine makes sure, that all processes have afterwards
|
|
|
|
* a list of ompi_proc_t pointers for the remote group.
|
|
|
|
*/
|
|
|
|
struct ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
|
|
|
|
ompi_communicator_t *bridge_comm,
|
|
|
|
int local_leader,
|
|
|
|
int remote_leader,
|
2011-10-04 18:50:31 +04:00
|
|
|
int tag,
|
2008-11-05 00:58:06 +03:00
|
|
|
int rsize);
|
2005-02-09 18:43:17 +03:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* This routine verifies, whether local_group and remote group are overlapping
|
|
|
|
* in intercomm_create
|
|
|
|
*/
|
|
|
|
int ompi_comm_overlapping_groups (int size, struct ompi_proc_t ** lprocs,
|
|
|
|
int rsize, struct ompi_proc_t ** rprocs);
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* This is a routine determining whether the local or the
|
|
|
|
* remote group will be first in the new intra-comm.
|
|
|
|
* Just used from within MPI_Intercomm_merge.
|
|
|
|
*/
|
|
|
|
int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
|
|
|
|
int high );
|
2004-06-16 01:29:29 +04:00
|
|
|
|
2005-10-24 14:36:16 +04:00
|
|
|
|
so here is what happens:
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.
in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.
in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.
in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that).
The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.
This commit was SVN r21970.
2009-09-17 18:37:02 +04:00
|
|
|
OMPI_DECLSPEC int ompi_comm_activate ( ompi_communicator_t** newcomm,
|
|
|
|
ompi_communicator_t* comm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
|
|
|
int mode,
|
|
|
|
int send_first );
|
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/**
|
|
|
|
* a simple function to dump the structure
|
|
|
|
*/
|
|
|
|
int ompi_comm_dump ( ompi_communicator_t *comm );
|
2004-06-16 01:29:29 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/* setting name */
|
|
|
|
int ompi_comm_set_name (ompi_communicator_t *comm, char *name );
|
2004-08-04 23:46:29 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/*
|
|
|
|
* these are the init and finalize functions for the comm_reg
|
|
|
|
* stuff. These routines are necessary for handling multi-threading
|
|
|
|
* scenarious in the communicator_cid allocation
|
|
|
|
*/
|
|
|
|
void ompi_comm_reg_init(void);
|
|
|
|
void ompi_comm_reg_finalize(void);
|
2004-09-21 22:39:06 +04:00
|
|
|
|
2008-11-05 00:58:06 +03:00
|
|
|
/* global variable to save the number od dynamic communicators */
|
|
|
|
extern int ompi_comm_num_dyncomm;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
|
2009-07-07 22:32:14 +04:00
|
|
|
/* check whether any of the processes has requested support for
|
2010-01-07 19:26:30 +03:00
|
|
|
MPI_THREAD_MULTIPLE. Note, that this produces global
|
|
|
|
information across MPI_COMM_WORLD, in contrary to the local
|
|
|
|
flag ompi_mpi_thread_provided
|
2009-07-07 22:32:14 +04:00
|
|
|
*/
|
|
|
|
OMPI_DECLSPEC int ompi_comm_cid_init ( void );
|
|
|
|
|
|
|
|
|
2007-08-19 07:37:49 +04:00
|
|
|
END_C_DECLS
|
2004-02-05 04:52:56 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#endif /* OMPI_COMMUNICATOR_H */
|
2008-11-05 00:58:06 +03:00
|
|
|
|