1
1
- otfmerge-mpi:
		- use the MPI-2 versions of MPI_Address and MPI_Type_struct

Changes to VT:
	- VT libs:
		- suppress warnings about usage of deprecated MPI functions (OMPI_WANT_MPI_INTERFACE_WARNING=0)
	- vtunify-mpi:
		- use the MPI-2 versions of MPI_Address and MPI_Type_struct
		- removed unused MPI wrappers

This commit was SVN r26051.
Этот коммит содержится в:
Matthias Jurenz 2012-02-24 15:48:51 +00:00
родитель e77653511b
Коммит f245ed965a
6 изменённых файлов: 24 добавлений и 790 удалений

Просмотреть файл

@ -290,10 +290,12 @@ AC_DEFUN([ACVT_MPI],
ac_cv_func_MPI_Add_error_class="yes" ac_cv_func_MPI_Add_error_class="yes"
ac_cv_func_MPI_Add_error_code="yes" ac_cv_func_MPI_Add_error_code="yes"
ac_cv_func_MPI_Add_error_string="yes" ac_cv_func_MPI_Add_error_string="yes"
ac_cv_func_MPI_Get_address="yes"
ac_cv_func_MPI_Finalized="yes" ac_cv_func_MPI_Finalized="yes"
ac_cv_func_MPI_Type_create_f90_complex="yes" ac_cv_func_MPI_Type_create_f90_complex="yes"
ac_cv_func_MPI_Type_create_f90_integer="yes" ac_cv_func_MPI_Type_create_f90_integer="yes"
ac_cv_func_MPI_Type_create_f90_real="yes" ac_cv_func_MPI_Type_create_f90_real="yes"
ac_cv_func_MPI_Type_create_struct="yes"
ac_cv_func_MPI_Type_match_size="yes" ac_cv_func_MPI_Type_match_size="yes"
ac_cv_func_PMPI_Win_test="yes" ac_cv_func_PMPI_Win_test="yes"
ac_cv_func_PMPI_Win_lock="yes" ac_cv_func_PMPI_Win_lock="yes"
@ -710,10 +712,12 @@ dnl check for MPI-2 functions
AC_CHECK_FUNCS([MPI_Add_error_class \ AC_CHECK_FUNCS([MPI_Add_error_class \
MPI_Add_error_code \ MPI_Add_error_code \
MPI_Add_error_string \ MPI_Add_error_string \
MPI_Get_address \
MPI_Finalized \ MPI_Finalized \
MPI_Type_create_f90_complex \ MPI_Type_create_f90_complex \
MPI_Type_create_f90_integer \ MPI_Type_create_f90_integer \
MPI_Type_create_f90_real \ MPI_Type_create_f90_real \
MPI_Type_create_struct \
MPI_Type_match_size]) MPI_Type_match_size])
dnl check for MPI-2 Thread support dnl check for MPI-2 Thread support

Просмотреть файл

@ -91,7 +91,7 @@ AC_DEFUN([ACVT_OTF],
esac esac
otf_conf_cmd="$otf_srcdir/configure" otf_conf_cmd="$otf_srcdir/configure"
otf_conf_args="--enable-static=$enable_static --enable-shared=$enable_shared" otf_conf_args="--with-openmpi-inside=$inside_openmpi --enable-static=$enable_static --enable-shared=$enable_shared"
sav_CPPFLAGS=$CPPFLAGS sav_CPPFLAGS=$CPPFLAGS

Просмотреть файл

@ -12,18 +12,14 @@ include $(srcdir)/../Makefile.common
CC = $(MPICC) CC = $(MPICC)
CXX = $(MPICXX) CXX = $(MPICXX)
#MPIWRAPSOURCES = vt_unify_mpi.c
#MPIWRAPCXXFLAGS = -DVT_UNIFY_MPI_WRAP
vtunify_mpi_CFLAGS = -DVT_MPI $(MPICFLAGS) $(MPIINCDIR) vtunify_mpi_CFLAGS = -DVT_MPI $(MPICFLAGS) $(MPIINCDIR)
vtunify_mpi_CXXFLAGS = $(COMMONCXXFLAGS) -DVT_MPI $(MPIWRAPCXXFLAGS) $(MPICXXFLAGS) $(MPIINCDIR) vtunify_mpi_CXXFLAGS = $(COMMONCXXFLAGS) -DVT_MPI $(MPICXXFLAGS) $(MPIINCDIR)
vtunify_mpi_LDFLAGS = $(COMMONLDFLAGS) $(MPICXXFLAGS) vtunify_mpi_LDFLAGS = $(COMMONLDFLAGS) $(MPICXXFLAGS)
vtunify_mpi_SOURCES = \ vtunify_mpi_SOURCES = \
$(COMMONSOURCES) \ $(COMMONSOURCES) \
vt_unify_lib.h \ vt_unify_lib.h \
vt_unify_mpi.h \ vt_unify_mpi.h
$(MPIWRAPSOURCES)
vtunify_mpi_LDADD = \ vtunify_mpi_LDADD = \
$(COMMONLDADD) \ $(COMMONLDADD) \
@ -33,11 +29,9 @@ vtunify_mpi_DEPENDENCIES = \
$(COMMONDEPENDENCIES) $(COMMONDEPENDENCIES)
libvt_mpi_unify_la_CFLAGS = -DVT_LIB $(vtunify_mpi_CFLAGS) libvt_mpi_unify_la_CFLAGS = -DVT_LIB $(vtunify_mpi_CFLAGS)
libvt_mpi_unify_la_CXXFLAGS = -DVT_LIB -DVT_MPI $(MPIWRAPCXXFLAGS) $(HOOKSCXXFLAGS) $(ETIMESYNCCXXFLAGS) $(MPICXXFLAGS) $(MPIINCDIR) libvt_mpi_unify_la_CXXFLAGS = -DVT_LIB -DVT_MPI $(HOOKSCXXFLAGS) $(ETIMESYNCCXXFLAGS) $(MPICXXFLAGS) $(MPIINCDIR)
libvt_mpi_unify_la_LDFLAGS = $(MPICXXFLAGS) libvt_mpi_unify_la_LDFLAGS = $(MPICXXFLAGS)
libvt_mpi_unify_la_SOURCES = $(vtunify_mpi_SOURCES) libvt_mpi_unify_la_SOURCES = $(vtunify_mpi_SOURCES)
libvt_mpi_unify_la_LIBADD = $(COMMONLDADD) $(MPILIBDIR) $(PMPILIB) libvt_mpi_unify_la_LIBADD = $(COMMONLDADD) $(MPILIBDIR) $(PMPILIB)
libvt_mpi_unify_la_DEPENDENCIES = $(vtunify_mpi_DEPENDENCIES) libvt_mpi_unify_la_DEPENDENCIES = $(vtunify_mpi_DEPENDENCIES)
EXTRA_DIST = vt_unify_mpi.c

Просмотреть файл

@ -1,599 +0,0 @@
/**
* VampirTrace
* http://www.tu-dresden.de/zih/vampirtrace
*
* Copyright (c) 2005-2011, ZIH, TU Dresden, Federal Republic of Germany
*
* Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
* Centre, Federal Republic of Germany
*
* See the file COPYING in the package base directory for details
**/
#define VT_UNIFY_MPI_WRAP
#define VT_UNIFY_MPI_WRAP_NODEF
#include "vt_unify_mpi.h"
#include "mpi.h"
#include <stdlib.h>
#define MAX_TYPES 50
#define MAX_OPS 3
#define MAX_REQ 1000
/* array of MPI datatypes */
static MPI_Datatype typev[MAX_TYPES] =
{
MPI_CHAR,
MPI_INT,
MPI_LONG_LONG_INT,
MPI_DOUBLE,
MPI_UNSIGNED,
MPI_UNSIGNED_SHORT,
MPI_PACKED
};
static int typen = 7;
/* array of MPI ops (read-only) */
static const MPI_Op opv[MAX_OPS] =
{
MPI_MIN,
MPI_MAX,
MPI_SUM
};
static const int opn = 3;
/* array of MPI requests */
static MPI_Request reqv[MAX_REQ];
static int reqn = 0;
/* last created MPI_Status */
static MPI_Status last_status;
static MPI_Comm get_mpi_comm( VTUnify_MPI_Comm ucomm )
{
assert( ucomm == 0 );
return MPI_COMM_WORLD;
}
static VTUnify_MPI_Datatype add_mpi_type( MPI_Datatype type )
{
VTUnify_MPI_Datatype utype;
assert( typen < MAX_TYPES );
utype = typen++;
typev[utype] = type;
return utype;
}
static MPI_Datatype get_mpi_type( VTUnify_MPI_Datatype utype )
{
assert( utype >= 0 && utype < typen );
return typev[utype];
}
static MPI_Op get_mpi_op( VTUnify_MPI_Op uop )
{
assert( uop >= 0 && uop < opn );
return opv[uop];
}
static VTUnify_MPI_Request add_mpi_request( MPI_Request request )
{
VTUnify_MPI_Request urequest;
assert( reqn < MAX_REQ );
urequest = reqn++;
reqv[urequest] = request;
return urequest;
}
static MPI_Request get_mpi_request( VTUnify_MPI_Request urequest )
{
assert( urequest >= 0 && urequest < reqn );
return reqv[urequest];
}
/*** MPI wrapper functions ***/
/* MPI_Abort */
VT_MPI_INT VTUnify_MPI_Abort( VTUnify_MPI_Comm ucomm, VT_MPI_INT errorcode )
{
VT_MPI_INT error;
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Abort( comm, errorcode ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Address */
VT_MPI_INT VTUnify_MPI_Address( void * location, VTUnify_MPI_Aint * address )
{
VT_MPI_INT error;
error = CALL_MPI( MPI_Address( location, (MPI_Aint*)address ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Allgather */
VT_MPI_INT VTUnify_MPI_Allgather( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf, VT_MPI_INT recvcount,
VTUnify_MPI_Datatype urecvtype, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Allgather( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcount, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcount, recvtype, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Allgatherv */
VT_MPI_INT VTUnify_MPI_Allgatherv( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf, VT_MPI_INT * recvcount,
VT_MPI_INT * displs, VTUnify_MPI_Datatype urecvtype, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Allgatherv( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcount, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcount, displs, recvtype, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Allreduce */
VT_MPI_INT VTUnify_MPI_Allreduce( void * sendbuf, void * recvbuf, int count,
VTUnify_MPI_Datatype utype, VTUnify_MPI_Op uop, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Op op = get_mpi_op( uop );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Allreduce( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
count, type, op, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Alltoall */
VT_MPI_INT VTUnify_MPI_Alltoall( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf, VT_MPI_INT recvcount,
VTUnify_MPI_Datatype urecvtype, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Alltoall( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcount, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcount, recvtype, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Alltoallv */
VT_MPI_INT VTUnify_MPI_Alltoallv( void * sendbuf, VT_MPI_INT * sendcounts,
VT_MPI_INT * sdispls, VTUnify_MPI_Datatype usendtype, void * recvbuf,
VT_MPI_INT * recvcounts, VT_MPI_INT * rdispls,
VTUnify_MPI_Datatype urecvtype, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Alltoallv( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcounts, sdispls, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcounts, rdispls, recvtype, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Barrier */
VT_MPI_INT VTUnify_MPI_Barrier( VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Barrier( comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Bcast */
VT_MPI_INT VTUnify_MPI_Bcast( void * buffer, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT root, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Bcast( (buffer == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : buffer,
count, type, root, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Comm_rank */
VT_MPI_INT VTUnify_MPI_Comm_rank( VTUnify_MPI_Comm ucomm, VT_MPI_INT * rank )
{
VT_MPI_INT error;
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Comm_rank( comm, rank ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Comm_size */
VT_MPI_INT VTUnify_MPI_Comm_size( VTUnify_MPI_Comm ucomm, VT_MPI_INT * size )
{
VT_MPI_INT error;
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Comm_size( comm, size ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Gather */
VT_MPI_INT VTUnify_MPI_Gather( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf, VT_MPI_INT recvcount,
VTUnify_MPI_Datatype urecvtype, VT_MPI_INT root, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Gather( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcount, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcount, recvtype, root, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Gatherv */
VT_MPI_INT VTUnify_MPI_Gatherv( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf, VT_MPI_INT * recvcount,
VT_MPI_INT * displs, VTUnify_MPI_Datatype urecvtype, VT_MPI_INT root,
VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype sendtype = get_mpi_type( usendtype );
MPI_Datatype recvtype = get_mpi_type( urecvtype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Gatherv( (sendbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : sendbuf,
sendcount, sendtype,
(recvbuf == VTUnify_MPI_BOTTOM) ?
MPI_BOTTOM : recvbuf,
recvcount, displs, recvtype, root, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Get_count */
VT_MPI_INT VTUnify_MPI_Get_count( VTUnify_MPI_Status * ustatus,
VTUnify_MPI_Datatype utype, VT_MPI_INT * count )
{
VT_MPI_INT error;
MPI_Status status;
MPI_Datatype type = get_mpi_type( utype );
/* ignore given status object; use last created one instead */
(void)ustatus;
status = last_status;
error = CALL_MPI( MPI_Get_count( &status, type, count ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Finalize */
VT_MPI_INT VTUnify_MPI_Finalize()
{
VT_MPI_INT error;
error = CALL_MPI( MPI_Finalize() );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Init */
VT_MPI_INT VTUnify_MPI_Init( VT_MPI_INT * argc, char *** argv )
{
VT_MPI_INT error;
error = CALL_MPI( MPI_Init( argc, argv ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
VT_MPI_INT VTUnify_MPI_Isend( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT dest, VT_MPI_INT tag,
VTUnify_MPI_Comm ucomm, VTUnify_MPI_Request * newurequest )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
MPI_Request newrequest;
error = CALL_MPI( MPI_Isend( buf, count, type, dest, tag, comm,
&newrequest ) );
if( error == MPI_SUCCESS )
{
*newurequest = add_mpi_request( newrequest );
return 1;
}
else
{
return 0;
}
}
/* MPI_Pack */
VT_MPI_INT VTUnify_MPI_Pack( void * inbuf, VT_MPI_INT incount,
VTUnify_MPI_Datatype utype, void * outbuf, VT_MPI_INT outsize,
VT_MPI_INT * position, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Pack( inbuf, incount, type, outbuf, outsize, position,
comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Pack_size */
VT_MPI_INT VTUnify_MPI_Pack_size( VT_MPI_INT incount,
VTUnify_MPI_Datatype utype, VTUnify_MPI_Comm ucomm, VT_MPI_INT * size )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Pack_size( incount, type, comm, size ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Probe */
VT_MPI_INT VTUnify_MPI_Probe( VT_MPI_INT source, VT_MPI_INT tag,
VTUnify_MPI_Comm ucomm, VTUnify_MPI_Status * ustatus )
{
VT_MPI_INT error;
MPI_Comm comm = get_mpi_comm( ucomm );
MPI_Status status;
error = CALL_MPI( MPI_Probe( (source == VTUnify_MPI_ANY_SOURCE) ?
MPI_ANY_SOURCE : source,
tag, comm, &status ) );
if( ustatus != VTUnify_MPI_STATUS_IGNORE )
{
ustatus->MPI_SOURCE = status.MPI_SOURCE;
ustatus->MPI_TAG = status.MPI_TAG;
last_status = status;
}
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Recv */
VT_MPI_INT VTUnify_MPI_Recv( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT source, VT_MPI_INT tag,
VTUnify_MPI_Comm ucomm, VTUnify_MPI_Status * ustatus )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
MPI_Status status;
error = CALL_MPI( MPI_Recv( buf, count, type,
(source == VTUnify_MPI_ANY_SOURCE) ?
MPI_ANY_SOURCE : source,
tag, comm, &status ) );
if( ustatus != VTUnify_MPI_STATUS_IGNORE )
{
ustatus->MPI_SOURCE = status.MPI_SOURCE;
ustatus->MPI_TAG = status.MPI_TAG;
last_status = status;
}
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Send */
VT_MPI_INT VTUnify_MPI_Send( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT dest, VT_MPI_INT tag,
VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Send( buf, count, type, dest, tag, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Test */
VT_MPI_INT VTUnify_MPI_Test( VTUnify_MPI_Request * urequest, VT_MPI_INT * flag,
VTUnify_MPI_Status * ustatus )
{
VT_MPI_INT error;
MPI_Request request = get_mpi_request( *urequest );
MPI_Status status;
error = CALL_MPI( MPI_Test( &request, flag, &status ) );
if( ustatus != VTUnify_MPI_STATUS_IGNORE )
{
ustatus->MPI_SOURCE = status.MPI_SOURCE;
ustatus->MPI_TAG = status.MPI_TAG;
last_status = status;
}
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Type_commit */
VT_MPI_INT VTUnify_MPI_Type_commit( VTUnify_MPI_Datatype * utype )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( *utype );
error = CALL_MPI( MPI_Type_commit( &type ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Type_free */
VT_MPI_INT VTUnify_MPI_Type_free( VTUnify_MPI_Datatype * utype )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( *utype );
error = CALL_MPI( MPI_Type_free( &type ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Type_struct */
VT_MPI_INT VTUnify_MPI_Type_struct( VT_MPI_INT count,
VT_MPI_INT * array_of_blocklengths,
VTUnify_MPI_Aint * array_of_udisplacements,
VTUnify_MPI_Datatype * array_of_utypes, VTUnify_MPI_Datatype * newutype )
{
VT_MPI_INT error, i;
MPI_Aint * array_of_displacements;
MPI_Datatype * array_of_types;
MPI_Datatype newtype;
array_of_displacements = (MPI_Aint*)malloc( count * sizeof( MPI_Aint ));
assert( array_of_displacements );
for( i = 0; i < count; i++ )
array_of_displacements[i] = (MPI_Aint)array_of_udisplacements[i];
array_of_types = (MPI_Datatype*)malloc( count * sizeof( MPI_Datatype ));
assert( array_of_types );
for( i = 0; i < count; i++ )
array_of_types[i] = get_mpi_type( array_of_utypes[i] );
error = CALL_MPI( MPI_Type_struct( count, array_of_blocklengths,
array_of_displacements, array_of_types,
&newtype ) );
free( array_of_displacements );
free( array_of_types );
if( error == MPI_SUCCESS )
{
*newutype = add_mpi_type( newtype );
return 1;
}
else
{
return 0;
}
}
/* MPI_Unpack */
VT_MPI_INT VTUnify_MPI_Unpack( void * inbuf, VT_MPI_INT insize,
VT_MPI_INT * position, void * outbuf, VT_MPI_INT outcount,
VTUnify_MPI_Datatype utype, VTUnify_MPI_Comm ucomm )
{
VT_MPI_INT error;
MPI_Datatype type = get_mpi_type( utype );
MPI_Comm comm = get_mpi_comm( ucomm );
error = CALL_MPI( MPI_Unpack( inbuf, insize, position, outbuf, outcount,
type, comm ) );
return (error == MPI_SUCCESS) ? 1 : 0;
}
/* MPI_Wait */
VT_MPI_INT VTUnify_MPI_Wait( VTUnify_MPI_Request * urequest,
VTUnify_MPI_Status * ustatus )
{
VT_MPI_INT error;
MPI_Request request = get_mpi_request( *urequest );
MPI_Status status;
error = CALL_MPI( MPI_Wait( &request, &status ) );
if( ustatus != VTUnify_MPI_STATUS_IGNORE )
{
ustatus->MPI_SOURCE = status.MPI_SOURCE;
ustatus->MPI_TAG = status.MPI_TAG;
last_status = status;
}
return (error == MPI_SUCCESS) ? 1 : 0;
}

Просмотреть файл

@ -24,188 +24,16 @@
# define CALL_MPI( call ) call # define CALL_MPI( call ) call
#endif /* VT_LIB */ #endif /* VT_LIB */
#ifndef VT_UNIFY_MPI_WRAP
#include "mpi.h" #include "mpi.h"
#else /* VT_UNIFY_MPI_WRAP */ #if defined(HAVE_MPI_GET_ADDRESS) && HAVE_MPI_GET_ADDRESS
# define MPI_Address MPI_Get_address
# define PMPI_Address PMPI_Get_address
#endif /* HAVE_MPI_GET_ADDRESS */
# ifdef __cplusplus #if defined(HAVE_MPI_TYPE_CREATE_STRUCT) && HAVE_MPI_TYPE_CREATE_STRUCT
# define EXTERN extern "C" # define MPI_Type_struct MPI_Type_create_struct
# else # define PMPI_Type_struct PMPI_Type_create_struct
# define EXTERN extern #endif /* HAVE_MPI_TYPE_CREATE_STRUCT */
# endif
# define VTUnify_MPI_COMM_WORLD 0
# define VTUnify_MPI_CHAR 0
# define VTUnify_MPI_INT 1
# define VTUnify_MPI_LONG_LONG_INT 2
# define VTUnify_MPI_DOUBLE 3
# define VTUnify_MPI_UNSIGNED 4
# define VTUnify_MPI_UNSIGNED_SHORT 5
# define VTUnify_MPI_PACKED 6
# define VTUnify_MPI_MIN 0
# define VTUnify_MPI_MAX 1
# define VTUnify_MPI_SUM 2
# define VTUnify_MPI_ANY_SOURCE -1
# define VTUnify_MPI_BOTTOM ((void*)0)
# define VTUnify_MPI_STATUS_IGNORE ((VTUnify_MPI_Status*)0)
typedef struct {
VT_MPI_INT MPI_SOURCE;
VT_MPI_INT MPI_TAG;
} VTUnify_MPI_Status;
typedef long long VTUnify_MPI_Aint;
typedef int VTUnify_MPI_Comm;
typedef int VTUnify_MPI_Datatype;
typedef int VTUnify_MPI_Op;
typedef int VTUnify_MPI_Request;
EXTERN VT_MPI_INT VTUnify_MPI_Abort( VTUnify_MPI_Comm ucomm,
VT_MPI_INT errorcode );
EXTERN VT_MPI_INT VTUnify_MPI_Address( void * location,
VTUnify_MPI_Aint * address );
EXTERN VT_MPI_INT VTUnify_MPI_Allgather( void * sendbuf,
VT_MPI_INT sendcount, VTUnify_MPI_Datatype usendtype,
void * recvbuf, VT_MPI_INT recvcount,
VTUnify_MPI_Datatype urecvtype,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Allgatherv( void * sendbuf,
VT_MPI_INT sendcount, VTUnify_MPI_Datatype usendtype,
void * recvbuf, VT_MPI_INT * recvcount,
VT_MPI_INT * displs, VTUnify_MPI_Datatype urecvtype,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Allreduce( void * sendbuf, void * recvbuf,
int count, VTUnify_MPI_Datatype utype, VTUnify_MPI_Op uop,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Alltoall( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf,
VT_MPI_INT recvcount, VTUnify_MPI_Datatype urecvtype,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Alltoallv( void * sendbuf,
VT_MPI_INT * sendcounts, VT_MPI_INT * sdispls,
VTUnify_MPI_Datatype usendtype, void * recvbuf,
VT_MPI_INT * recvcounts, VT_MPI_INT * rdispls,
VTUnify_MPI_Datatype urecvtype,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Barrier( VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Bcast( void * buffer, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT root,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Comm_rank( VTUnify_MPI_Comm ucomm,
VT_MPI_INT * rank );
EXTERN VT_MPI_INT VTUnify_MPI_Comm_size( VTUnify_MPI_Comm ucomm,
VT_MPI_INT * size );
EXTERN VT_MPI_INT VTUnify_MPI_Gather( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf,
VT_MPI_INT recvcount, VTUnify_MPI_Datatype urecvtype,
VT_MPI_INT root, VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Gatherv( void * sendbuf, VT_MPI_INT sendcount,
VTUnify_MPI_Datatype usendtype, void * recvbuf,
VT_MPI_INT * recvcount, VT_MPI_INT * displs,
VTUnify_MPI_Datatype urecvtype, VT_MPI_INT root,
VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Get_count( VTUnify_MPI_Status * ustatus,
VTUnify_MPI_Datatype utype, VT_MPI_INT * count );
EXTERN VT_MPI_INT VTUnify_MPI_Finalize( void );
EXTERN VT_MPI_INT VTUnify_MPI_Init( VT_MPI_INT * argc, char *** argv );
EXTERN VT_MPI_INT VTUnify_MPI_Isend( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT dest,
VT_MPI_INT tag, VTUnify_MPI_Comm ucomm,
VTUnify_MPI_Request * urequest );
EXTERN VT_MPI_INT VTUnify_MPI_Pack( void * inbuf, VT_MPI_INT incount,
VTUnify_MPI_Datatype utype, void * outbuf,
VT_MPI_INT outsize, VT_MPI_INT * position,
VTUnify_MPI_Comm ucomm);
EXTERN VT_MPI_INT VTUnify_MPI_Pack_size( VT_MPI_INT incount,
VTUnify_MPI_Datatype utype, VTUnify_MPI_Comm ucomm,
VT_MPI_INT * size );
EXTERN VT_MPI_INT VTUnify_MPI_Probe( VT_MPI_INT source, VT_MPI_INT tag,
VTUnify_MPI_Comm ucomm, VTUnify_MPI_Status * ustatus );
EXTERN VT_MPI_INT VTUnify_MPI_Recv( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT source,
VT_MPI_INT tag, VTUnify_MPI_Comm ucomm,
VTUnify_MPI_Status * ustatus );
EXTERN VT_MPI_INT VTUnify_MPI_Send( void * buf, VT_MPI_INT count,
VTUnify_MPI_Datatype utype, VT_MPI_INT dest,
VT_MPI_INT tag, VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Test( VTUnify_MPI_Request * urequest,
VT_MPI_INT * flag, VTUnify_MPI_Status * ustatus );
EXTERN VT_MPI_INT VTUnify_MPI_Type_commit( VTUnify_MPI_Datatype * utype );
EXTERN VT_MPI_INT VTUnify_MPI_Type_free( VTUnify_MPI_Datatype * utype );
EXTERN VT_MPI_INT VTUnify_MPI_Type_struct( VT_MPI_INT count,
VT_MPI_INT * array_of_blocklengths,
VTUnify_MPI_Aint * array_of_udisplacements,
VTUnify_MPI_Datatype * array_of_utypes,
VTUnify_MPI_Datatype * newutype );
EXTERN VT_MPI_INT VTUnify_MPI_Unpack( void * inbuf, VT_MPI_INT insize,
VT_MPI_INT * position, void * outbuf, VT_MPI_INT outcount,
VTUnify_MPI_Datatype utype, VTUnify_MPI_Comm ucomm );
EXTERN VT_MPI_INT VTUnify_MPI_Wait( VTUnify_MPI_Request * urequest,
VTUnify_MPI_Status * ustatus );
# ifndef VT_UNIFY_MPI_WRAP_NODEF
# undef CALL_MPI
# define CALL_MPI( call ) VTUnify_##call
# define MPI_COMM_WORLD VTUnify_MPI_COMM_WORLD
# define MPI_CHAR VTUnify_MPI_CHAR
# define MPI_INT VTUnify_MPI_INT
# define MPI_LONG_LONG_INT VTUnify_MPI_LONG_LONG_INT
# define MPI_DOUBLE VTUnify_MPI_DOUBLE
# define MPI_UNSIGNED VTUnify_MPI_UNSIGNED
# define MPI_UNSIGNED_SHORT VTUnify_MPI_UNSIGNED_SHORT
# define MPI_PACKED VTUnify_MPI_PACKED
# define MPI_MIN VTUnify_MPI_MIN
# define MPI_MAX VTUnify_MPI_MAX
# define MPI_SUM VTUnify_MPI_SUM
# define MPI_ANY_SOURCE VTUnify_MPI_ANY_SOURCE
# define MPI_BOTTOM VTUnify_MPI_BOTTOM
# define MPI_STATUS_IGNORE VTUnify_MPI_STATUS_IGNORE
# define MPI_Aint VTUnify_MPI_Aint
# define MPI_Comm VTUnify_MPI_Comm
# define MPI_Datatype VTUnify_MPI_Datatype
# define MPI_Op VTUnify_MPI_Op
# define MPI_Request VTUnify_MPI_Request
# define MPI_Status VTUnify_MPI_Status
# endif /* VT_UNIFY_MPI_WRAP_NODEF */
#endif /* VT_UNIFY_MPI_WRAP */
#endif /* _VT_UNIFY_MPI_H_ */ #endif /* _VT_UNIFY_MPI_H_ */

Просмотреть файл

@ -10,6 +10,13 @@
* See the file COPYING in the package base directory for details * See the file COPYING in the package base directory for details
**/ **/
/* if compiling inside Open MPI, suppress warnings about usage of
deprecated MPI functions (e.g. MPI_Address) */
#ifdef INSIDE_OPENMPI
# undef OMPI_WANT_MPI_INTERFACE_WARNING
# define OMPI_WANT_MPI_INTERFACE_WARNING 0
#endif /* INSIDE_OPENMPI */
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>