1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
// -*- c++ -*-
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include <string.h>
//
// Point-to-Point Communication
//
inline void
MPI::Attach_buffer(void* buffer, int size)
{
(void)MPI_Buffer_attach(buffer, size);
}
inline int
MPI::Detach_buffer(void*& buffer)
{
int size;
(void)MPI_Buffer_detach(&buffer, &size);
return size;
}
//
// Process Topologies
//
inline void
MPI::Compute_dims(int nnodes, int ndims, int dims[])
{
(void)MPI_Dims_create(nnodes, ndims, dims);
}
//
// Environmental Inquiry
//
inline int
MPI::Add_error_class()
{
int errcls;
(void)MPI_Add_error_class(&errcls);
return errcls;
}
inline int
MPI::Add_error_code(int errorclass)
{
int errcode;
(void)MPI_Add_error_code(errorclass, &errcode);
return errcode;
}
inline void
MPI::Add_error_string(int errorcode, const char* string)
{
(void)MPI_Add_error_string(errorcode, const_cast<char *>(string));
}
inline void
MPI::Get_processor_name(char* name, int& resultlen)
{
(void)MPI_Get_processor_name(name, &resultlen);
}
inline void
MPI::Get_error_string(int errorcode, char* string, int& resultlen)
{
(void)MPI_Error_string(errorcode, string, &resultlen);
}
inline int
MPI::Get_error_class(int errorcode)
{
int errorclass;
(void)MPI_Error_class(errorcode, &errorclass);
return errorclass;
}
inline double
MPI::Wtime()
{
return (MPI_Wtime());
}
inline double
MPI::Wtick()
{
return (MPI_Wtick());
}
inline void
MPI::Real_init()
{
MPI::InitializeIntercepts();
}
inline void
MPI::Init(int& argc, char**& argv)
{
(void)MPI_Init(&argc, &argv);
Real_init();
}
inline void
MPI::Init()
{
(void)MPI_Init(0, 0);
Real_init();
}
inline void
MPI::Finalize()
{
(void)MPI_Finalize();
}
inline bool
MPI::Is_initialized()
{
int t;
(void)MPI_Initialized(&t);
return OPAL_INT_TO_BOOL(t);
}
inline bool
MPI::Is_finalized()
{
int t;
(void)MPI_Finalized(&t);
return OPAL_INT_TO_BOOL(t);
}
//
// External Interfaces
//
inline int
MPI::Init_thread(int required)
{
int provided;
(void) MPI_Init_thread(0, NULL, required, &provided);
Real_init();
return provided;
}
inline int
MPI::Init_thread(int& argc, char**& argv, int required)
{
int provided;
(void) MPI_Init_thread(&argc, &argv, required, &provided);
Real_init();
return provided;
}
inline bool
MPI::Is_thread_main()
{
int flag;
(void) MPI_Is_thread_main(&flag);
return OPAL_INT_TO_BOOL(flag == 1);
}
inline int
MPI::Query_thread()
{
int provided;
(void) MPI_Query_thread(&provided);
return provided;
}
//
// Miscellany
//
inline void*
MPI::Alloc_mem(MPI::Aint size, const MPI::Info& info)
{
void* baseptr;
(void) MPI_Alloc_mem(size, info, &baseptr);
return baseptr;
}
inline void
MPI::Free_mem(void* base)
{
(void) MPI_Free_mem(base);
}
//
// Process Creation
//
inline void
MPI::Close_port(const char* port_name)
{
(void) MPI_Close_port(const_cast<char *>(port_name));
}
inline void
MPI::Lookup_name(const char * service_name,
const MPI::Info& info,
char* port_name)
{
(void) MPI_Lookup_name(const_cast<char *>(service_name), info, port_name);
}
inline void
MPI::Open_port(const MPI::Info& info, char* port_name)
{
(void) MPI_Open_port(info, port_name);
}
inline void
MPI::Publish_name(const char* service_name,
const MPI::Info& info,
const char* port_name)
{
(void) MPI_Publish_name(const_cast<char *>(service_name), info,
const_cast<char *>(port_name));
}
inline void
MPI::Unpublish_name(const char* service_name,
const MPI::Info& info,
const char* port_name)
{
(void)MPI_Unpublish_name(const_cast<char *>(service_name), info,
const_cast<char *>(port_name));
}
//
// Profiling
//
inline void
MPI::Pcontrol(const int level, ...)
{
va_list ap;
va_start(ap, level);
(void)MPI_Pcontrol(level, ap);
va_end(ap);
}
inline void
MPI::Get_version(int& version, int& subversion)
{
(void)MPI_Get_version(&version, &subversion);
}
inline MPI::Aint
MPI::Get_address(void* location)
{
MPI::Aint ret;
MPI_Get_address(location, &ret);
return ret;
}
|