OpenMPI  0.1.1
attribute_predefined.c File Reference

Setup the predefined attributes in MPI. More...

#include "ompi_config.h"
#include "mpi.h"
#include "ompi/attribute/attribute.h"
#include "ompi/errhandler/errcode.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mca/pml/pml.h"
#include "orte/util/proc_info.h"

Functions

static int create_comm (int target_keyval, bool want_inherit)
 
static int free_comm (int keyval)
 
static int create_win (int target_keyval)
 
static int free_win (int keyval)
 
static int set_f (int keyval, MPI_Fint value)
 
int ompi_attr_create_predefined (void)
 
int ompi_attr_free_predefined (void)
 

Detailed Description

Setup the predefined attributes in MPI.

A number of pre-defined attributes are created here, most of which are exactly what one would expect, but there are a few exceptions – so they're documented here.

Predefined attributes are integer-valued or address-valued (per MPI-2; see section 4.12.7, keeping in mind that Example 4.13 is totally wrong – see src/attribute/attribute.h for a lengthy explanation of this).

The only address-valued attribute is MPI_WIN_BASE. We treat it as if it were set from C. All other attributes are integer-valued. We treat them as if they were set from Fortran MPI-1 (i.e., MPI_ATTR_PUT) or Fortran MPI-2 (i.e., MPI_xxx_ATTR_SET). Most attributes are MPI-1 integer-valued, meaning that they are the size of MPI_Fint (INTEGER). But MPI_WIN_SIZE and MPI_WIN_DISP_UNIT are MPI-2 integer-valued, meaning that they are the size of MPI_Aint (INTEGER(KIND=MPI_ADDRESS_KIND)).

MPI_TAG_UB is set to a fixed upper limit.

MPI_HOST is set to MPI_PROC_NULL (per MPI-1, see 7.1.1, p192).

MPI_IO is set to MPI_ANY_SOURCE. We may need to revist this.

MPI_WTIME_IS_GLOBAL is set to 0 (a conservative answer).

MPI_APPNUM is set as the result of a GPR subscription.

MPI_LASTUSEDCODE is set to an initial value and is reset every time MPI_ADD_ERROR_CLASS or MPI_ADD_ERROR_CODE is invoked. Its copy function is set to MPI_COMM_NULL_COPY_FN, meaning that only MPI_COMM_WORLD will have this attribute value. As such, we only have to update MPI_COMM_WORLD when this value changes (i.e., since this is an integer-valued attribute, we have to update this attribute on every communicator – using NULL_COPY_FN ensures that only MPI_COMM_WORLD has this attribute value set).

MPI_UNIVERSE_SIZE is set as the result of a GPR subscription.

MPI_WIN_BASE is an address-valued attribute, and is set directly from MPI_WIN_CREATE. MPI_WIN_SIZE and MPI_WIN_DISP_UNIT are both integer-valued attributes, BUT at least the MPI_WIN_SIZE is an MPI_Aint, so in terms of consistency, both should be the same – hence, we treat them as MPI-2 Fortran integer-valued attributes. All three of these atrributes have NULL_COPY_FN copy functions; it doesn't make sense to copy them to new windows (because they're values specific and unique to each window) – especially when WIN_CREATE will explicitly set them on new windows anyway.

These are not supported yet, but are included here for consistency:

MPI_IMPI_CLIENT_SIZE, MPI_IMPI_CLIENT_COLOR, MPI_IMPI_HOST_SIZE, and MPI_IMPI_HOST_COLOR are integer-valued attributes.