mpicxx.h
来自「Parallel Processing, Important document 」· C头文件 代码 · 共 1,691 行 · 第 1/5 页
H
1,691 行
static int NULL_COPY_FN( const Comm &oldcomm, int keyval, void *ex, void *attr_in, void *attr_out, bool &flag ) { oldcomm; keyval; ex; attr_in; attr_out; flag = 1; return 0; }
static int NULL_DELETE_FN( Comm &comm, int keyval, void * attr, void *ex ) { comm; keyval; attr; ex; return 0; }
static int DUP_FN( const Comm &oldcomm, int keyval, void *ex, void *attr_in, void *attr_out, bool &flag ) { oldcomm; keyval; ex; flag = 1; *(void **)attr_out = attr_in; return 0; }
static Errhandler Create_errhandler( Errhandler_fn * );
};
class Intercomm : public Comm {
friend class Intracomm;
public:
// new/delete
inline Intercomm(MPI_Comm obj) { the_real_comm = obj; }
inline Intercomm(void) {the_real_comm = MPI_COMM_NULL;}
virtual ~Intercomm() {}
// copy/assignment
Intercomm(const Intercomm &obj) {
the_real_comm = obj.the_real_comm; }
Intercomm& operator=(const Intercomm &obj) {
the_real_comm = obj.the_real_comm; return *this; }
// C/C++ cast and assignment
inline operator MPI_Comm*() { return &the_real_comm; }
inline operator MPI_Comm() const { return the_real_comm; }
Intercomm& operator=(const MPI_Comm& obj) {
the_real_comm = obj; return *this; }
Group Get_remote_group( void ) const
{
Group *v2 = new Group;
MPIX_CALL( MPI_Comm_remote_group( (MPI_Comm) the_real_comm, &(v2->the_real_group) ));
return *v2;
}
int Get_remote_size( void ) const
{
int v2;
MPIX_CALL( MPI_Comm_remote_size( (MPI_Comm) the_real_comm, &v2 ));
return v2;
}
Intracomm Merge( bool v2 ) const;
Comm Dup( void ) const
{
Comm *v2 = new Comm;
MPIX_CALL( MPI_Comm_dup( (MPI_Comm) the_real_comm, &(v2->the_real_comm) ));
return *v2;
}
void Bcast( void* v1, int v2, Datatype v3, int v4 )
{
MPIX_CALL( MPI_Bcast( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, (MPI_Comm) the_real_comm ));
}
void Barrier( void )
{
MPIX_CALL( MPI_Barrier( (MPI_Comm) the_real_comm ));
}
void Alltoall( void* v1, int v2, Datatype v3, void* v4, int v5, Datatype v6 )
{
MPIX_CALL( MPI_Alltoall( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Gather( void* v1, int v2, Datatype v3, void* v4, int v5, Datatype v6, int v7 )
{
MPIX_CALL( MPI_Gather( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), v7, (MPI_Comm) the_real_comm ));
}
void Reduce_scatter( void* v1, void* v2, int * v3, Datatype v4, Op v5 )
{
MPIX_CALL( MPI_Reduce_scatter( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
void Scatterv( void* v1, int * v2, int * v3, Datatype v4, void* v5, int v6, Datatype v7, int v8 )
{
MPIX_CALL( MPI_Scatterv( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), v5, v6, (MPI_Datatype)(v7.the_real_datatype), v8, (MPI_Comm) the_real_comm ));
}
void Allgather( void* v1, int v2, Datatype v3, void* v4, int v5, Datatype v6 )
{
MPIX_CALL( MPI_Allgather( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Exscan( void * v1, void * v2, int v3, Datatype v4, Op v5 )
{
MPIX_CALL( MPI_Exscan( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
void Reduce( void* v1, void* v2, int v3, Datatype v4, Op v5, int v6 )
{
MPIX_CALL( MPI_Reduce( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), v6, (MPI_Comm) the_real_comm ));
}
void Scan( void* v1, void* v2, int v3, Datatype v4, Op v5 )
{
MPIX_CALL( MPI_Scan( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
void Alltoallv( void* v1, int * v2, int * v3, Datatype v4, void* v5, int * v6, int * v7, Datatype v8 )
{
MPIX_CALL( MPI_Alltoallv( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), v5, v6, v7, (MPI_Datatype)(v8.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Allreduce( void* v1, void* v2, int v3, Datatype v4, Op v5 )
{
MPIX_CALL( MPI_Allreduce( v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
Comm Split( int v2, int v3 ) const
{
Comm *v4 = new Comm;
MPIX_CALL( MPI_Comm_split( (MPI_Comm) the_real_comm, v2, v3, &(v4->the_real_comm) ));
return *v4;
}
void Allgatherv( void* v1, int v2, Datatype v3, void* v4, int * v5, int * v6, Datatype v7 )
{
MPIX_CALL( MPI_Allgatherv( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, (MPI_Datatype)(v7.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Scatter( void* v1, int v2, Datatype v3, void* v4, int v5, Datatype v6, int v7 )
{
MPIX_CALL( MPI_Scatter( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), v7, (MPI_Comm) the_real_comm ));
}
void Gatherv( void* v1, int v2, Datatype v3, void* v4, int * v5, int * v6, Datatype v7, int v8 )
{
MPIX_CALL( MPI_Gatherv( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, (MPI_Datatype)(v7.the_real_datatype), v8, (MPI_Comm) the_real_comm ));
}
Intercomm & Clone(void) const {
MPI_Comm ncomm;
MPI_Comm_dup( (MPI_Comm)the_real_comm, &ncomm);
Intercomm *clone = new Intercomm(ncomm);
return *clone; };
};
class Intracomm : public Comm {
friend class Cartcomm;
friend class Graphcomm;
friend class Datatype;
public:
// new/delete
inline Intracomm(MPI_Comm obj) { the_real_comm = obj; }
inline Intracomm(void) {the_real_comm = MPI_COMM_NULL;}
virtual ~Intracomm() {}
// copy/assignment
Intracomm(const Intracomm &obj) {
the_real_comm = obj.the_real_comm; }
Intracomm& operator=(const Intracomm &obj) {
the_real_comm = obj.the_real_comm; return *this; }
// C/C++ cast and assignment
inline operator MPI_Comm*() { return &the_real_comm; }
inline operator MPI_Comm() const { return the_real_comm; }
Intracomm& operator=(const MPI_Comm& obj) {
the_real_comm = obj; return *this; }
Comm Create( const Group &v2 ) const
{
Comm *v3 = new Comm;
MPIX_CALL( MPI_Comm_create( (MPI_Comm) the_real_comm, (MPI_Group)(v2.the_real_group), &(v3->the_real_comm) ));
return *v3;
}
void Bcast( void* v1, int v2, const Datatype &v3, int v4 ) const
{
MPIX_CALL( MPI_Bcast( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, (MPI_Comm) the_real_comm ));
}
void Barrier( void ) const
{
MPIX_CALL( MPI_Barrier( (MPI_Comm) the_real_comm ));
}
void Alltoall( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6 ) const
{
MPIX_CALL( MPI_Alltoall( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Gather( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6, int v7 ) const
{
MPIX_CALL( MPI_Gather( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), v7, (MPI_Comm) the_real_comm ));
}
Intercomm Create_intercomm( int v2, const Comm &v3, int v4, int v5 ) const
{
Intercomm *v6 = new Intercomm;
MPIX_CALL( MPI_Intercomm_create( (MPI_Comm) the_real_comm, v2, (MPI_Comm)(v3.the_real_comm), v4, v5, &(v6->the_real_comm) ));
return *v6;
}
void Reduce_scatter( const void* v1, void* v2, int * v3, const Datatype &v4, const Op &v5 ) const
{
MPIX_CALL( MPI_Reduce_scatter( (void*)v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
void Scatterv( const void* v1, const int * v2, const int * v3, const Datatype &v4, void* v5, int v6, const Datatype &v7, int v8 ) const
{
MPIX_CALL( MPI_Scatterv( (void*)v1, (int *)v2, (int *)v3, (MPI_Datatype)(v4.the_real_datatype), v5, v6, (MPI_Datatype)(v7.the_real_datatype), v8, (MPI_Comm) the_real_comm ));
}
void Allgather( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6 ) const
{
MPIX_CALL( MPI_Allgather( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), (MPI_Comm) the_real_comm ));
}
Comm Dup( void ) const
{
Comm *v2 = new Comm;
MPIX_CALL( MPI_Comm_dup( (MPI_Comm) the_real_comm, &(v2->the_real_comm) ));
return *v2;
}
void Reduce( const void* v1, void* v2, int v3, const Datatype &v4, const Op &v5, int v6 ) const
{
MPIX_CALL( MPI_Reduce( (void*)v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), v6, (MPI_Comm) the_real_comm ));
}
void Scan( const void* v1, void* v2, int v3, const Datatype &v4, const Op &v5 ) const
{
MPIX_CALL( MPI_Scan( (void*)v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
void Alltoallv( const void* v1, const int * v2, const int * v3, const Datatype &v4, void* v5, const int * v6, const int * v7, const Datatype &v8 ) const
{
MPIX_CALL( MPI_Alltoallv( (void*)v1, (int *)v2, (int *)v3, (MPI_Datatype)(v4.the_real_datatype), v5, (int *)v6, (int *)v7, (MPI_Datatype)(v8.the_real_datatype), (MPI_Comm) the_real_comm ));
}
Cartcomm Create_cart( int v2, const int * v3, const bool v4[], bool v5 ) const;
void Allreduce( const void* v1, void* v2, int v3, const Datatype &v4, const Op &v5 ) const
{
MPIX_CALL( MPI_Allreduce( (void*)v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
Comm Split( int v2, int v3 ) const
{
Comm *v4 = new Comm;
MPIX_CALL( MPI_Comm_split( (MPI_Comm) the_real_comm, v2, v3, &(v4->the_real_comm) ));
return *v4;
}
void Allgatherv( const void* v1, int v2, const Datatype &v3, void* v4, const int * v5, const int * v6, const Datatype &v7 ) const
{
MPIX_CALL( MPI_Allgatherv( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, (int *)v5, (int *)v6, (MPI_Datatype)(v7.the_real_datatype), (MPI_Comm) the_real_comm ));
}
void Scatter( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6, int v7 ) const
{
MPIX_CALL( MPI_Scatter( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Datatype)(v6.the_real_datatype), v7, (MPI_Comm) the_real_comm ));
}
void Gatherv( const void* v1, int v2, const Datatype &v3, void* v4, const int * v5, const int * v6, const Datatype &v7, int v8 ) const
{
MPIX_CALL( MPI_Gatherv( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, (int *)v5, (int *)v6, (MPI_Datatype)(v7.the_real_datatype), v8, (MPI_Comm) the_real_comm ));
}
Graphcomm Create_graph( int v2, const int * v3, const int * v4, bool v5 ) const;
Intercomm Connect( const char * v1, const Info &v2, int v3 ) const
{
Intercomm *v5 = new Intercomm;
MPIX_CALL( MPI_Comm_connect( (char *)v1, (MPI_Info)(v2.the_real_info), v3, (MPI_Comm) the_real_comm, &(v5->the_real_comm) ));
return *v5;
}
Intercomm Accept( const char * v1, const Info &v2, int v3 ) const
{
Intercomm *v5 = new Intercomm;
MPIX_CALL( MPI_Comm_accept( (char *)v1, (MPI_Info)(v2.the_real_info), v3, (MPI_Comm) the_real_comm, &(v5->the_real_comm) ));
return *v5;
}
void Exscan( const void * v1, void * v2, int v3, const Datatype &v4, const Op &v5 ) const
{
MPIX_CALL( MPI_Exscan( (void *)v1, v2, v3, (MPI_Datatype)(v4.the_real_datatype), (MPI_Op)(v5.the_real_op), (MPI_Comm) the_real_comm ));
}
Intracomm & Clone(void) const {
MPI_Comm ncomm;
MPI_Comm_dup( (MPI_Comm)the_real_comm, &ncomm);
Intracomm *clone = new Intracomm(ncomm);
return *clone; };
Intercomm Spawn(const char* command, const char* argv[], int maxprocs, const MPI::Info& info, int root) const {
Intercomm *ic = new Intercomm;
MPIX_CALL( MPI_Comm_spawn( (char *)command, (char **)argv,
maxprocs, info.the_real_info, root, the_real_comm,
&(ic->the_real_comm), MPI_ERRCODES_IGNORE ) );
return *ic;
}
Intercomm Spawn(const char* command, const char* argv[], int maxprocs, const MPI::Info& info, int root, int array_of_errcodes[]) const {
Intercomm *ic = new Intercomm;
MPIX_CALL( MPI_Comm_spawn( (char *)command, (char **)argv,
maxprocs, info.the_real_info, root, the_real_comm,
&(ic->the_real_comm), array_of_errcodes ) );
return *ic;
}
Intercomm Spawn_multiple(int count, const char* array_of_commands[], const char** array_of_argv[], const int array_of_maxprocs[], const MPI::Info array_of_info[], int root) {
Intercomm *ic = new Intercomm;
MPI_Info *li = new MPI_Info [count];
int i;
for (i=0; i<count; i++) {
li[i] = array_of_info[i].the_real_info;
}
MPIX_CALL( MPI_Comm_spawn_multiple( count, (char **)array_of_commands,
(char ***)array_of_argv, (int *)array_of_maxprocs,
li, root, the_real_comm, &(ic->the_real_comm),
MPI_ERRCODES_IGNORE ) );
delete [] li;
return *ic;
}
Intercomm Spawn_multiple(int count, const char* array_of_commands[], const char** array_of_argv[], const int array_of_maxprocs[], const MPI::Info array_of_info[], int root, int array_of_errcodes[]) {
Intercomm *ic = new Intercomm;
MPI_Info *li = new MPI_Info [count];
int i;
for (i=0; i<count; i++) {
li[i] = array_of_info[i].the_real_info;
}
MPIX_CALL( MPI_Comm_spawn_multiple( count, (char **)array_of_commands,
(char ***)array_of_argv, (int *)array_of_maxprocs,
li, root, the_real_comm, &(ic->the_real_comm),
array_of_errcodes ) );
delete [] li;
return *ic;
}
};
class Grequest : public Request {
public:
// new/delete
inline Grequest(MPI_Request obj) { the_real_request = obj; }
inline Grequest(void) {the_real_request = MPI_REQUEST_NULL;}
virtual ~Grequest() {}
// copy/assignment
Grequest(const Grequest &obj) {
the_real_request = obj.the_real_request; }
Grequest& operator=(const Grequest &obj) {
the_real_request = obj.the_real_request; return *this; }
// logical
bool operator== (const Grequest &obj) {
return (the_real_request == obj.the_real_request); }
bool operator!= (const Grequest &obj) {
return (the_real_request != obj.the_real_request); }
// C/C++ cast and assignment
inline operator MPI_Request*() { return &the_real_request; }
inline operator MPI_Request() const { return the_real_request; }
Grequest& operator=(const MPI_Request& obj) {
the_real_request = obj; return *this; }
void Complete( void )
{
MPIX_CALL( MPI_Grequest_complete( (MPI_Request) the_real_request ));
}
};
class Win {
protected:
MPI_Win the_real_win;
public:
// new/delete
inline Win(MPI_Win obj) { the_real_win = obj; }
inline Win(void) {the_real_win = MPI_WIN_NULL;}
virtual ~Win() {}
// copy/assignment
Win(const Win &obj) {
the_real_win = obj.the_real_win; }
W
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?