📄 mpicxx.h
字号:
/* -*- Mode: C++; c-basic-offset:4 ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*
* This file is automatically generated by buildiface -nosep
* DO NOT EDIT
*/
/* style: c++ header */
#ifdef MPI
#error "You cannot define MPI; that name is reserved for the MPI namespace"
#endif
// There is a name conflict between stdio.h and the MPI C++ binding
// with respect to the names SEEK_SET, SEEK_CUR, and SEEK_END. MPI
// wants these in the MPI namespace, but stdio.h will #define these
// to integer values. #undef'ing these can cause obscure problems
// with other include files (such as iostream), so we instead use
// #error to indicate a fatal error. Users can either #undef
// the names before including mpi.h or include mpi.h *before* stdio.h
// or iostream.
#ifndef MPICH_IGNORE_CXX_SEEK
#ifdef SEEK_SET
#error "SEEK_SET is #defined but must not be for the C++ binding of MPI"
//#undef SEEK_SET
#endif
#ifdef SEEK_CUR
#error "SEEK_CUR is #defined but must not be for the C++ binding of MPI"
//#undef SEEK_CUR
#endif
#ifdef SEEK_END
//#undef SEEK_END
#error "SEEK_END is #defined but must not be for the C++ binding of MPI"
#endif
#endif
namespace MPI {
#if 1
#define MPIX_CALL( fnc ) \
{int err; err = fnc ; if (err) throw Exception(err);}
#else
#define MPIX_CALL( fnc ) (void)fnc
#endif
// Typedefs for basic int types
typedef MPI_Offset Offset;
typedef MPI_Aint Aint;
typedef MPI_Fint Fint;
// Forward class declarations
class Comm;
class Intercomm;
class Intracomm;
class Cartcomm;
class Graphcomm;
extern void Get_version( int &v1, int &v2 ) ;
extern void Finalize( void ) ;
extern bool Is_initialized( void ) ;
extern void Compute_dims( int v1, int v2, int * v3 ) ;
extern void Attach_buffer( void* v1, int v2 ) ;
extern void Get_processor_name( char * v1, int &v2 ) ;
extern void Get_error_string( int v1, char * v2, int &v3 ) ;
extern int Detach_buffer( void *&v1 ) ;
extern void Pcontrol( const int v1, ... ) ;
extern int Get_error_class( int v1 ) ;
class Exception {
protected:
int the_real_exception;
public:
// new/delete
inline Exception(int obj) { the_real_exception = obj; }
inline Exception(void) {the_real_exception = 0;}
virtual ~Exception() {}
// copy/assignment
Exception(const Exception &obj) {
the_real_exception = obj.the_real_exception; }
Exception& operator=(const Exception &obj) {
the_real_exception = obj.the_real_exception; return *this; }
// logical
bool operator== (const Exception &obj) {
return (the_real_exception == obj.the_real_exception); }
bool operator!= (const Exception &obj) {
return (the_real_exception != obj.the_real_exception); }
// C/C++ cast and assignment
inline operator int*() { return &the_real_exception; }
inline operator int() const { return the_real_exception; }
Exception& operator=(const int& obj) {
the_real_exception = obj; return *this; }
protected:
char the_error_message[MPI_MAX_ERROR_STRING];
public:
int Get_error_code(void) { return the_real_exception; }
int Get_error_class(void) { return MPI::Get_error_class(the_real_exception); }
const char *Get_error_string(void)
{
int len;
MPI_Error_string(the_real_exception, the_error_message, &len);
return the_error_message;
}
};
class Datatype {
friend class Comm;
friend class Status;
friend class Intracomm;
friend class Intercomm;
friend class Win;
friend class File;
protected:
MPI_Datatype the_real_datatype;
public:
// new/delete
inline Datatype(MPI_Datatype obj) { the_real_datatype = obj; }
inline Datatype(void) {the_real_datatype = MPI_DATATYPE_NULL;}
virtual ~Datatype() {}
// copy/assignment
Datatype(const Datatype &obj) {
the_real_datatype = obj.the_real_datatype; }
Datatype& operator=(const Datatype &obj) {
the_real_datatype = obj.the_real_datatype; return *this; }
// logical
bool operator== (const Datatype &obj) {
return (the_real_datatype == obj.the_real_datatype); }
bool operator!= (const Datatype &obj) {
return (the_real_datatype != obj.the_real_datatype); }
// C/C++ cast and assignment
inline operator MPI_Datatype*() { return &the_real_datatype; }
inline operator MPI_Datatype() const { return the_real_datatype; }
Datatype& operator=(const MPI_Datatype& obj) {
the_real_datatype = obj; return *this; }
void Free( void )
{
MPIX_CALL( MPI_Type_free( (MPI_Datatype *) &the_real_datatype ));
}
void Commit( void )
{
MPIX_CALL( MPI_Type_commit( (MPI_Datatype *) &the_real_datatype ));
}
Datatype Create_contiguous( int v1 ) const
{
Datatype *v3 = new Datatype;
MPIX_CALL( MPI_Type_contiguous( v1, (MPI_Datatype) the_real_datatype, &(v3->the_real_datatype) ));
return *v3;
}
Datatype Create_vector( int v1, int v2, int v3 ) const
{
Datatype *v5 = new Datatype;
MPIX_CALL( MPI_Type_vector( v1, v2, v3, (MPI_Datatype) the_real_datatype, &(v5->the_real_datatype) ));
return *v5;
}
Datatype Create_indexed( int v1, const int * v2, const int * v3 ) const
{
Datatype *v5 = new Datatype;
MPIX_CALL( MPI_Type_indexed( v1, (int *)v2, (int *)v3, (MPI_Datatype) the_real_datatype, &(v5->the_real_datatype) ));
return *v5;
}
int Pack_size( int v1, const Comm &v3 ) const;
static Datatype Create_struct( int v1, int v2[], MPI_Aint v3[], const Datatype v4[] )
{
Datatype *v5 = new Datatype;
MPI_Datatype *l4 = new MPI_Datatype[v1];
{
int i4;
for (i4=0;i4<v1;i4++) {
l4[i4] = v4[i4].the_real_datatype;
}
}
MPIX_CALL( MPI_Type_create_struct( v1, (int *)v2, (MPI_Aint *)v3, l4, &(v5->the_real_datatype) ));
delete[] l4;
return *v5;
}
void Pack( const void* v1, int v2, void * v4, int v5, int &v6, const Comm &v7 ) const;
int Get_size( void ) const
{
int v2;
MPIX_CALL( MPI_Type_size( (MPI_Datatype) the_real_datatype, &v2 ));
return v2;
}
Datatype Create_subarray( int v1, int v2[], const int v3[], const int v4[], const int v5 ) const
{
Datatype *v7 = new Datatype;
MPIX_CALL( MPI_Type_create_subarray( v1, v2, (int *)v3, (int *)v4, (int)v5, (MPI_Datatype) the_real_datatype, &(v7->the_real_datatype) ));
return *v7;
}
bool Get_attr( int v2, void * v3 ) const
{
int v4;
MPIX_CALL( MPI_Type_get_attr( (MPI_Datatype) the_real_datatype, v2, v3, &v4 ));
return v4!= 0;
}
void Get_name( char * v2, int &v3 ) const
{
MPIX_CALL( MPI_Type_get_name( (MPI_Datatype) the_real_datatype, v2, &v3 ));
}
void Set_name( const char * v2 )
{
MPIX_CALL( MPI_Type_set_name( (MPI_Datatype) the_real_datatype, (char *)v2 ));
}
Datatype Create_indexed_block( int v1, int v2, const int v3[] ) const
{
Datatype *v5 = new Datatype;
MPIX_CALL( MPI_Type_create_indexed_block( v1, v2, (int *)v3, (MPI_Datatype) the_real_datatype, &(v5->the_real_datatype) ));
return *v5;
}
void Set_attr( int v2, const void * v3 )
{
MPIX_CALL( MPI_Type_set_attr( (MPI_Datatype) the_real_datatype, v2, (void *)v3 ));
}
Datatype Create_hvector( int v1, int v2, Aint v3 ) const
{
Datatype *v5 = new Datatype;
MPIX_CALL( MPI_Type_create_hvector( v1, v2, v3, (MPI_Datatype) the_real_datatype, &(v5->the_real_datatype) ));
return *v5;
}
void Get_contents( int v2, int v3, int v4, int v5[], MPI_Aint v6[], Datatype v7[] ) const
{
MPI_Datatype *l7 = new MPI_Datatype[v4];
MPIX_CALL( MPI_Type_get_contents( (MPI_Datatype) the_real_datatype, v2, v3, v4, v5, v6, l7 ));
{
int i7;
for (i7=0;i7<v4;i7++) {
v7[i7].the_real_datatype = l7[i7];
}
delete[] l7;
}
}
void Get_true_extent( Aint & v2, Aint & v3 ) const
{
MPIX_CALL( MPI_Type_get_true_extent( (MPI_Datatype) the_real_datatype, &v2, &v3 ));
}
void Pack_external( char * v1, const void * v2, const int v3, void * v5, Aint v6, Aint & v7 ) const
{
MPIX_CALL( MPI_Pack_external( v1, (void *)v2, (int)v3, (MPI_Datatype) the_real_datatype, v5, v6, &v7 ));
}
Datatype Dup( void ) const
{
Datatype *v2 = new Datatype;
MPIX_CALL( MPI_Type_dup( (MPI_Datatype) the_real_datatype, &(v2->the_real_datatype) ));
return *v2;
}
Datatype Create_resized( const Aint v2, const Aint v3 ) const
{
Datatype *v4 = new Datatype;
MPIX_CALL( MPI_Type_create_resized( (MPI_Datatype) the_real_datatype, (MPI_Aint)v2, (MPI_Aint)v3, &(v4->the_real_datatype) ));
return *v4;
}
void Get_extent( Aint & v2, Aint & v3 ) const
{
MPIX_CALL( MPI_Type_get_extent( (MPI_Datatype) the_real_datatype, &v2, &v3 ));
}
void Unpack_external( char * v1, const void * v2, const Aint v3, Aint & v4, void * v5, int v6 ) const
{
MPIX_CALL( MPI_Unpack_external( v1, (void *)v2, (MPI_Aint)v3, &v4, v5, v6, (MPI_Datatype) the_real_datatype ));
}
Datatype Create_darray( int v1, int v2, int v3, const int v4[], const int v5[], const int v6[], const int v7[], int v8 ) const
{
Datatype *v10 = new Datatype;
MPIX_CALL( MPI_Type_create_darray( v1, v2, v3, (int *)v4, (int *)v5, (int *)v6, (int *)v7, v8, (MPI_Datatype) the_real_datatype, &(v10->the_real_datatype) ));
return *v10;
}
void Delete_attr( int v2 )
{
MPIX_CALL( MPI_Type_delete_attr( (MPI_Datatype) the_real_datatype, v2 ));
}
static void Free_keyval( int &v1 )
{
MPIX_CALL( MPI_Type_free_keyval( &v1 ));
}
static Datatype Create_struct( int v1, const int v2[], const Aint v3[], const Datatype v4[] )
{
Datatype *v5 = new Datatype;
MPI_Datatype *l4 = new MPI_Datatype[v1];
{
int i4;
for (i4=0;i4<v1;i4++) {
l4[i4] = v4[i4].the_real_datatype;
}
}
MPIX_CALL( MPI_Type_create_struct( v1, (int *)v2, (MPI_Aint *)v3, l4, &(v5->the_real_datatype) ));
delete[] l4;
return *v5;
}
void Get_envelope( int &v2, int &v3, int &v4, int &v5 ) const
{
MPIX_CALL( MPI_Type_get_envelope( (MPI_Datatype) the_real_datatype, &v2, &v3, &v4, &v5 ));
}
Datatype Create_hindexed( int v1, const int v2[], const Aint v3[] ) const
{
Datatype *v5 = new Datatype;
MPIX_CALL( MPI_Type_create_hindexed( v1, (int *)v2, (MPI_Aint *)v3, (MPI_Datatype) the_real_datatype, &(v5->the_real_datatype) ));
return *v5;
}
Aint Pack_external_size( char * v1, const int v2 ) const
{
MPI_Aint v4;
MPIX_CALL( MPI_Pack_external_size( v1, (int)v2, (MPI_Datatype) the_real_datatype, &v4 ));
return v4;
}
void Unpack( const void *, int, void *, int, int &, const Comm & ) const;
typedef int Copy_attr_function(const Datatype& oldtype, int type_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, bool& flag);
typedef int Delete_attr_function(Datatype& type, int type_keyval, void* attribute_val, void* extra_state);
static int Create_keyval( Copy_attr_function *, Delete_attr_function *,
void * );
// These functions are *not* part of MPI-2 but are provided
// because they should have been included
static int NULL_COPY_FN( const Datatype &oldtype, int keyval, void *ex, void *attr_in, void *attr_out, bool &flag ) { oldtype; keyval; ex; attr_in; attr_out; flag = 1; return 0; }
static int NULL_DELETE_FN( Datatype &type, int keyval, void * attr, void *ex ) { type; keyval; attr; ex; return 0; }
static int DUP_FN( const Datatype &oldtype, int keyval, void *ex, void *attr_in, void *attr_out, bool &flag ) { oldtype; keyval; ex; flag = 1; *(void **)attr_out = attr_in; return 0; }
};
typedef void User_function(const void *, void*, int, const Datatype&);
class Info {
friend class File;
friend class Win;
friend class Comm;
friend class Intracomm;
protected:
MPI_Info the_real_info;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -