mpicxx.h
来自「Parallel Processing, Important document 」· C头文件 代码 · 共 1,691 行 · 第 1/5 页
H
1,691 行
l2[i2] = v2[i2].the_real_request;
}
}
MPIX_CALL( MPI_Startall( v1, l2 ));
{
int i2;
for (i2=0;i2<v1;i2++) {
v2[i2].the_real_request = l2[i2];
}
delete[] l2;
}
}
};
class Comm {
friend class Cartcomm;
friend class Intercomm;
friend class Intracomm;
friend class Graphcomm;
friend class Datatype;
friend class Win;
friend class File;
protected:
MPI_Comm the_real_comm;
public:
// new/delete
inline Comm(MPI_Comm obj) { the_real_comm = obj; }
inline Comm(void) {the_real_comm = MPI_COMM_NULL;}
virtual ~Comm() {}
// copy/assignment
Comm(const Comm &obj) {
the_real_comm = obj.the_real_comm; }
Comm& operator=(const Comm &obj) {
the_real_comm = obj.the_real_comm; return *this; }
// logical
bool operator== (const Comm &obj) {
return (the_real_comm == obj.the_real_comm); }
bool operator!= (const Comm &obj) {
return (the_real_comm != obj.the_real_comm); }
// C/C++ cast and assignment
inline operator MPI_Comm*() { return &the_real_comm; }
inline operator MPI_Comm() const { return the_real_comm; }
Comm& operator=(const MPI_Comm& obj) {
the_real_comm = obj; return *this; }
void Abort( int v2 )
{
MPIX_CALL( MPI_Abort( (MPI_Comm) the_real_comm, v2 ));
}
Request Issend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Request *v7 = new Request;
MPIX_CALL( MPI_Issend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
void Rsend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
MPIX_CALL( MPI_Rsend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm ));
}
int Get_size( void ) const
{
int v2;
MPIX_CALL( MPI_Comm_size( (MPI_Comm) the_real_comm, &v2 ));
return v2;
}
void Send( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
MPIX_CALL( MPI_Send( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm ));
}
int Get_topology( void ) const
{
int v2;
MPIX_CALL( MPI_Topo_test( (MPI_Comm) the_real_comm, &v2 ));
return v2;
}
void Free( void )
{
MPIX_CALL( MPI_Comm_free( (MPI_Comm *) &the_real_comm ));
}
void Ssend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
MPIX_CALL( MPI_Ssend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm ));
}
Errhandler Get_errhandler( void ) const
{
Errhandler *v2 = new Errhandler;
MPIX_CALL( MPI_Comm_get_errhandler( (MPI_Comm) the_real_comm, &(v2->the_real_errhandler) ));
return *v2;
}
Request Ibsend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Request *v7 = new Request;
MPIX_CALL( MPI_Ibsend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
void Sendrecv( const void * v1, int v2, const Datatype &v3, int v4, int v5, void * v6, int v7, const Datatype &v8, int v9, int v10, Status & v12 ) const
{
MPIX_CALL( MPI_Sendrecv( (void *)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, v7, (MPI_Datatype)(v8.the_real_datatype), v9, v10, (MPI_Comm) the_real_comm, (MPI_Status *)&(v12.the_real_status ) ));
}
void Sendrecv( const void * v1, int v2, const Datatype &v3, int v4, int v5, void * v6, int v7, const Datatype &v8, int v9, int v10 )
{
MPIX_CALL( MPI_Sendrecv( (void *)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, v7, (MPI_Datatype)(v8.the_real_datatype), v9, v10, (MPI_Comm) the_real_comm, MPI_STATUS_IGNORE ));
}
Prequest Recv_init( void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Prequest *v7 = new Prequest;
MPIX_CALL( MPI_Recv_init( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
Prequest Bsend_init( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Prequest *v7 = new Prequest;
MPIX_CALL( MPI_Bsend_init( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
Request Irecv( void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Request *v7 = new Request;
MPIX_CALL( MPI_Irecv( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
Prequest Rsend_init( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Prequest *v7 = new Prequest;
MPIX_CALL( MPI_Rsend_init( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
static int Compare( const Comm &v1, const Comm &v2 )
{
int v3;
MPIX_CALL( MPI_Comm_compare( (MPI_Comm)(v1.the_real_comm), (MPI_Comm)(v2.the_real_comm), &v3 ));
return v3;
}
void Bsend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
MPIX_CALL( MPI_Bsend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm ));
}
void Set_errhandler( const Errhandler &v2 )
{
MPIX_CALL( MPI_Comm_set_errhandler( (MPI_Comm) the_real_comm, (MPI_Errhandler)(v2.the_real_errhandler) ));
}
Request Isend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Request *v7 = new Request;
MPIX_CALL( MPI_Isend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
bool Iprobe( int v1, int v2, Status & v5 ) const
{
int v4;
MPIX_CALL( MPI_Iprobe( v1, v2, (MPI_Comm) the_real_comm, &v4, (MPI_Status *)&(v5.the_real_status ) ));
return v4!= 0;
}
bool Iprobe( int v1, int v2 )
{
int v4;
MPIX_CALL( MPI_Iprobe( v1, v2, (MPI_Comm) the_real_comm, &v4, MPI_STATUS_IGNORE ));
return v4!= 0;
}
Prequest Send_init( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Prequest *v7 = new Prequest;
MPIX_CALL( MPI_Send_init( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
int Get_rank( void ) const
{
int v2;
MPIX_CALL( MPI_Comm_rank( (MPI_Comm) the_real_comm, &v2 ));
return v2;
}
Prequest Ssend_init( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Prequest *v7 = new Prequest;
MPIX_CALL( MPI_Ssend_init( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
void Sendrecv_replace( void* v1, int v2, const Datatype &v3, int v4, int v5, int v6, int v7, Status & v9 ) const
{
MPIX_CALL( MPI_Sendrecv_replace( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, v7, (MPI_Comm) the_real_comm, (MPI_Status *)&(v9.the_real_status ) ));
}
void Sendrecv_replace( void* v1, int v2, const Datatype &v3, int v4, int v5, int v6, int v7 )
{
MPIX_CALL( MPI_Sendrecv_replace( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, v6, v7, (MPI_Comm) the_real_comm, MPI_STATUS_IGNORE ));
}
Group Get_group( void ) const
{
Group *v2 = new Group;
MPIX_CALL( MPI_Comm_group( (MPI_Comm) the_real_comm, &(v2->the_real_group) ));
return *v2;
}
bool Is_inter( void ) const
{
int v2;
MPIX_CALL( MPI_Comm_test_inter( (MPI_Comm) the_real_comm, &v2 ));
return v2!= 0;
}
void Probe( int v1, int v2, Status & v4 ) const
{
MPIX_CALL( MPI_Probe( v1, v2, (MPI_Comm) the_real_comm, (MPI_Status *)&(v4.the_real_status ) ));
}
void Probe( int v1, int v2 )
{
MPIX_CALL( MPI_Probe( v1, v2, (MPI_Comm) the_real_comm, MPI_STATUS_IGNORE ));
}
Request Irsend( const void* v1, int v2, const Datatype &v3, int v4, int v5 ) const
{
Request *v7 = new Request;
MPIX_CALL( MPI_Irsend( (void*)v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, &(v7->the_real_request) ));
return *v7;
}
void Recv( void* v1, int v2, const Datatype &v3, int v4, int v5, Status & v7 ) const
{
MPIX_CALL( MPI_Recv( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, (MPI_Status *)&(v7.the_real_status ) ));
}
void Recv( void* v1, int v2, const Datatype &v3, int v4, int v5 )
{
MPIX_CALL( MPI_Recv( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, v5, (MPI_Comm) the_real_comm, MPI_STATUS_IGNORE ));
}
static Intercomm Join( const int v1 ) ;
void Get_name( char * v2, int &v3 ) const
{
MPIX_CALL( MPI_Comm_get_name( (MPI_Comm) the_real_comm, v2, &v3 ));
}
void Set_name( const char * v2 )
{
MPIX_CALL( MPI_Comm_set_name( (MPI_Comm) the_real_comm, (char *)v2 ));
}
bool Get_attr( int v2, void * v3 ) const
{
int v4;
MPIX_CALL( MPI_Comm_get_attr( (MPI_Comm) the_real_comm, v2, v3, &v4 ));
return v4!= 0;
}
void Bcast( void* v1, int v2, const Datatype &v3, int v4 )
{
MPIX_CALL( MPI_Bcast( v1, v2, (MPI_Datatype)(v3.the_real_datatype), v4, (MPI_Comm) the_real_comm ));
}
void Set_attr( int v2, const void * v3 ) const
{
MPIX_CALL( MPI_Comm_set_attr( (MPI_Comm) the_real_comm, v2, (void *)v3 ));
}
void Alltoall( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6 )
{
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 Call_errhandler( int v2 ) const
{
MPIX_CALL( MPI_Comm_call_errhandler( (MPI_Comm) the_real_comm, v2 ));
}
void Gather( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6, int v7 )
{
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 ));
}
void Disconnect( void )
{
MPIX_CALL( MPI_Comm_disconnect( (MPI_Comm *) &the_real_comm ));
}
void Reduce_scatter( const void* v1, void* v2, int * v3, const Datatype &v4, const Op &v5 )
{
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 )
{
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 )
{
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 ));
}
void Reduce( const void* v1, void* v2, int v3, const Datatype &v4, const Op &v5, int v6 )
{
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 Alltoallv( const void* v1, const int * v2, const int * v3, const Datatype &v4, void* v5, const int * v6, const int * v7, const Datatype &v8 )
{
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 ));
}
void Delete_attr( int v2 )
{
MPIX_CALL( MPI_Comm_delete_attr( (MPI_Comm) the_real_comm, v2 ));
}
void Alltoallw( const void * v1, const int v2[], const int v3[], const Datatype v4[], void * v5, const int v6[], const int v7[], const Datatype v8[] )
{
MPI_Datatype *l4 = new MPI_Datatype[Get_size()];
MPI_Datatype *l8 = new MPI_Datatype[Get_size()];
{
int i4;
for (i4=0;i4<Get_size();i4++) {
l4[i4] = v4[i4].the_real_datatype;
}
}
{
int i8;
for (i8=0;i8<Get_size();i8++) {
l8[i8] = v8[i8].the_real_datatype;
}
}
MPIX_CALL( MPI_Alltoallw( (void *)v1, (int *)v2, (int *)v3, l4, v5, (int *)v6, (int *)v7, l8, (MPI_Comm) the_real_comm ));
delete[] l4;
delete[] l8;
}
static void Free_keyval( int &v1 )
{
MPIX_CALL( MPI_Comm_free_keyval( &v1 ));
}
static Intercomm Get_parent( void ) ;
void Allreduce( const void* v1, void* v2, int v3, const Datatype &v4, const Op &v5 )
{
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 ));
}
void Scatter( const void* v1, int v2, const Datatype &v3, void* v4, int v5, const Datatype &v6, int v7 )
{
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 )
{
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 ));
}
void Allgatherv( const void* v1, int v2, const Datatype &v3, void* v4, const int * v5, const int * v6, const Datatype &v7 )
{
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 ));
}
Comm & Clone(void) const {
MPI_Comm ncomm;
MPI_Comm_dup( (MPI_Comm)the_real_comm, &ncomm);
Comm *clone = new Comm(ncomm);
return *clone; };
typedef int Copy_attr_function(const Comm& oldcomm, int comm_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, bool& flag);
typedef int Delete_attr_function(Comm& comm, int comm_keyval, void* attribute_val, void* extra_state);
typedef void Errhandler_fn(Comm &, int *, ... );
static int Create_keyval( Copy_attr_function *, Delete_attr_function *,
void * );
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?