00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <string.h>
00022
00023
00024
00025
00026
00027 inline void
00028 MPI::Attach_buffer(void* buffer, int size)
00029 {
00030 (void)MPI_Buffer_attach(buffer, size);
00031 }
00032
00033 inline int
00034 MPI::Detach_buffer(void*& buffer)
00035 {
00036 int size;
00037 (void)MPI_Buffer_detach(&buffer, &size);
00038 return size;
00039 }
00040
00041
00042
00043
00044
00045 inline void
00046 MPI::Compute_dims(int nnodes, int ndims, int dims[])
00047 {
00048 (void)MPI_Dims_create(nnodes, ndims, dims);
00049 }
00050
00051
00052
00053
00054
00055
00056 inline void
00057 MPI::Get_processor_name(char* name, int& resultlen)
00058 {
00059 (void)MPI_Get_processor_name(name, &resultlen);
00060 }
00061
00062 inline void
00063 MPI::Get_error_string(int errorcode, char* string, int& resultlen)
00064 {
00065 (void)MPI_Error_string(errorcode, string, &resultlen);
00066 }
00067
00068 inline int
00069 MPI::Get_error_class(int errorcode)
00070 {
00071 int errorclass;
00072 (void)MPI_Error_class(errorcode, &errorclass);
00073 return errorclass;
00074 }
00075
00076 inline double
00077 MPI::Wtime()
00078 {
00079 return (MPI_Wtime());
00080 }
00081
00082 inline double
00083 MPI::Wtick()
00084 {
00085 return (MPI_Wtick());
00086 }
00087
00088 inline void
00089 MPI::Real_init()
00090 {
00091 MPI::InitializeIntercepts();
00092 }
00093
00094
00095 inline void
00096 MPI::Init(int& argc, char**& argv)
00097 {
00098 (void)MPI_Init(&argc, &argv);
00099 Real_init();
00100 }
00101
00102 inline void
00103 MPI::Init()
00104 {
00105 (void)MPI_Init(0, 0);
00106 Real_init();
00107 }
00108
00109 inline void
00110 MPI::Finalize()
00111 {
00112 (void)MPI_Finalize();
00113 }
00114
00115 inline bool
00116 MPI::Is_initialized()
00117 {
00118 int t;
00119 (void)MPI_Initialized(&t);
00120 return OPAL_INT_TO_BOOL(t);
00121 }
00122
00123 inline bool
00124 MPI::Is_finalized()
00125 {
00126 int t;
00127 (void)MPI_Finalized(&t);
00128 return OPAL_INT_TO_BOOL(t);
00129 }
00130
00131
00132
00133
00134
00135
00136 inline int
00137 MPI::Init_thread(int required)
00138 {
00139 int provided;
00140 (void) MPI_Init_thread(0, NULL, required, &provided);
00141 Real_init();
00142 return provided;
00143 }
00144
00145
00146 inline int
00147 MPI::Init_thread(int& argc, char**& argv, int required)
00148 {
00149 int provided;
00150 (void) MPI_Init_thread(&argc, &argv, required, &provided);
00151 Real_init();
00152 return provided;
00153 }
00154
00155
00156 inline bool
00157 MPI::Is_thread_main()
00158 {
00159 int flag;
00160 (void) MPI_Is_thread_main(&flag);
00161 return OPAL_INT_TO_BOOL(flag == 1);
00162 }
00163
00164
00165 inline int
00166 MPI::Query_thread()
00167 {
00168 int provided;
00169 (void) MPI_Query_thread(&provided);
00170 return provided;
00171 }
00172
00173
00174
00175
00176
00177
00178
00179 inline void*
00180 MPI::Alloc_mem(MPI::Aint size, const MPI::Info& info)
00181 {
00182 void* baseptr;
00183 (void) MPI_Alloc_mem(size, info, &baseptr);
00184 return baseptr;
00185 }
00186
00187
00188 inline void
00189 MPI::Free_mem(void* base)
00190 {
00191 (void) MPI_Free_mem(base);
00192 }
00193
00194
00195
00196
00197
00198
00199
00200 inline void
00201 MPI::Close_port(const char* port_name)
00202 {
00203 (void) MPI_Close_port(const_cast<char *>(port_name));
00204 }
00205
00206
00207 inline void
00208 MPI::Lookup_name(const char * service_name,
00209 const MPI::Info& info,
00210 char* port_name)
00211 {
00212 (void) MPI_Lookup_name(const_cast<char *>(service_name), info, port_name);
00213 }
00214
00215
00216 inline void
00217 MPI::Open_port(const MPI::Info& info, char* port_name)
00218 {
00219 (void) MPI_Open_port(info, port_name);
00220 }
00221
00222
00223 inline void
00224 MPI::Publish_name(const char* service_name,
00225 const MPI::Info& info,
00226 const char* port_name)
00227 {
00228 (void) MPI_Publish_name(const_cast<char *>(service_name), info,
00229 const_cast<char *>(port_name));
00230 }
00231
00232
00233 inline void
00234 MPI::Unpublish_name(const char* service_name,
00235 const MPI::Info& info,
00236 const char* port_name)
00237 {
00238 (void)MPI_Unpublish_name(const_cast<char *>(service_name), info,
00239 const_cast<char *>(port_name));
00240 }
00241
00242
00243
00244
00245
00246
00247
00248 inline void
00249 MPI::Pcontrol(const int level, ...)
00250 {
00251 va_list ap;
00252 va_start(ap, level);
00253
00254 (void)MPI_Pcontrol(level, ap);
00255 va_end(ap);
00256 }
00257
00258
00259 inline void
00260 MPI::Get_version(int& version, int& subversion)
00261 {
00262 (void)MPI_Get_version(&version, &subversion);
00263 }
00264
00265
00266 inline MPI::Aint
00267 MPI::Get_address(void* location)
00268 {
00269 MPI::Aint ret;
00270 MPI_Get_address(location, &ret);
00271 return ret;
00272 }