/usr/include/ug/ppif.h is in libug-dev 3.12.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/****************************************************************************/
/* */
/* File: ppif.h */
/* */
/* Purpose: header file for parallel processor interface */
/* */
/* Author: Peter Bastian / Klaus Birken */
/* */
/* History: 17 Aug 1992 begin */
/* 14 Sep 1993 pass argc, argv from main to InitPPIF */
/* 16 Sep 1993 async send/recv return msgid now */
/* 951106 kb changed parameters for InitPPIF() */
/* 970213 kb added C++ class interface */
/* */
/* Remarks: */
/* */
/****************************************************************************/
/* RCS_ID
$Header$
*/
/****************************************************************************/
/* */
/* auto include mechanism and other include files */
/* */
/****************************************************************************/
#ifndef __PPIF__
#define __PPIF__
/****************************************************************************/
/* */
/* settings for switching PPIF_FRONTEND_C/PPIF_FRONTEND_CPP */
/* */
/****************************************************************************/
/* check PPIF_FRONTEND-setting for plausibility */
#if defined(PPIF_FRONTEND_C) && defined(PPIF_FRONTEND_CPP)
#error PPIF Configuration Error: PPIF_FRONTEND_C and PPIF_FRONTEND_CPP are set.
#endif
/* default frontend is PPIF_FRONTEND_C */
#ifndef PPIF_FRONTEND_C
#ifndef PPIF_FRONTEND_CPP
#define PPIF_FRONTEND_C
#endif
#endif
#ifdef CurrentTime
#undef CurrentTime
/* #error **** CurrentTime defined before **** */
#endif
/****************************************************************************/
/* */
/* data structures exported by the corresponding source file */
/* */
/****************************************************************************/
typedef void *VChannelPtr; /* dummy definition, any pointer type is ok */
typedef void *msgid; /* dummy definition, any pointer type is ok */
#define NO_MSGID ((msgid)-1L) /* a special value that should never be re- */
/* turned as a msgid, like NULL for pointers */
namespace PPIF {
enum directions {north,east,south,west,up,down};
#define RAND_MSG_SIZE 128 /* max size of random messages */
#define PPIF_SUCCESS 0 /* Return value for success */
#define PPIF_FAILURE 1 /* Return value for failure */
/****************************************************************************/
/* */
/* definition of exported global variables */
/* */
/****************************************************************************/
/* id's */
extern int me; /* my processor id */
extern int master; /* id of master processor */
extern int procs; /* number of processors in the network */
/* 3D array structure */
extern int DimX,DimY,DimZ; /* 3D array dimensions, may be 1 ! */
/* Tree structure */
extern int degree; /* degree of downtree nodes */
extern VChannelPtr uptree; /* channel uptree */
extern VChannelPtr downtree[]; /* channels downtree (may be empty) */
extern int slvcnt[]; /* number of processors in subtree */
/****************************************************************************/
/* */
/* macros */
/* */
/****************************************************************************/
#define APOS_TO_AID(x,y,z) ((z<<16)|(y<<8)|x) /* array pos to compact for*/
#define XPOS(aid) (aid&0xFF) /* xpos from compact form */
#define YPOS(aid) ((aid&0xFF00)>>8) /* ypos from compact form */
#define ZPOS(aid) ((aid&0xFF0000)>>16) /* zpos from compact form */
/****************************************************************************/
/* */
/* function declarations */
/* */
/****************************************************************************/
/* initialization & shutdown */
int InitPPIF (int *argcp, char ***argvp);
int ExitPPIF (void);
/* tree oriented functions */
int Broadcast (void *data, int size);
int Concentrate (void *data, int size);
int GetConcentrate (int slave, void *data, int size);
int Spread (int slave, void *data, int size);
int GetSpread (void *data, int size);
int Synchronize (void);
/* synchronous communication */
VChannelPtr ConnSync (int p, int id);
int DiscSync (VChannelPtr vc);
int SendSync (VChannelPtr vc, void *data, int size);
int RecvSync (VChannelPtr vc, void *data, int size);
/* asynchronous communication */
VChannelPtr ConnASync (int p, int id);
int DiscASync (VChannelPtr vc);
msgid SendASync (VChannelPtr vc, void *data, int size, int *error);
msgid RecvASync (VChannelPtr vc, void *data, int size, int *error);
int InfoAConn (VChannelPtr vc);
int InfoADisc (VChannelPtr vc);
int InfoASend (VChannelPtr vc, msgid m);
int InfoARecv (VChannelPtr vc, msgid m);
/* random communication */
int SendMail (int destId, int reqId, void *data, int size);
int GetMail (int *sourceId, int *reqId, void *data, int *size);
/* miscellaneous */
int UsedSpace (void);
void PrintHostMessage (const char *s);
double CurrentTime (void);
int Distance (int p, int q);
int aid_to_pid (int x, int y, int z);
int pid_to_aid (int p);
/****************************************************************************/
#ifdef PPIF_FRONTEND_CPP
class PPIF_Library
{
public:
// constructor/destructor
PPIF_Library (int* argc, char*** argv) {
::InitPPIF(argc, argv);
}
~PPIF_Library () {
::ExitPPIF();
}
// tree oriented functions
int Broadcast (void *data, int size) {
return ::Broadcast(data, size);
}
int Concentrate (void *data, int size) {
return ::Concentrate(data, size);
}
int GetConcentrate (int slave, void *data, int size) {
return ::GetConcentrate(slave, data, size);
}
int Spread (int slave, void *data, int size) {
return ::Spread(slave, data, size);
}
int GetSpread (void *data, int size) {
return ::GetSpread(data, size);
}
int Synchronize (void) {
return ::Synchronize();
}
// synchronous communication
VChannelPtr ConnSync (int p, int id) {
return ::ConnSync(p, id);
}
int DiscSync (VChannelPtr vc) {
return ::DiscSync(vc);
}
int SendSync (VChannelPtr vc, void *data, int size) {
return ::SendSync(vc, data, size);
}
int RecvSync (VChannelPtr vc, void *data, int size) {
return ::RecvSync(vc, data, size);
}
// asynchronous communication
VChannelPtr ConnASync (int p, int id) {
return ::ConnASync(p, id);
}
int DiscASync (VChannelPtr vc) {
return ::DiscASync(vc);
}
msgid SendASync (VChannelPtr vc, void *data, int size, int *error) {
return ::SendASync(vc, data, size, error);
}
msgid RecvASync (VChannelPtr vc, void *data, int size, int *error) {
return ::RecvASync(vc, data, size, error);
}
int InfoAConn (VChannelPtr vc) {
return ::InfoAConn(vc);
}
int InfoADisc (VChannelPtr vc) {
return ::InfoADisc(vc);
}
int InfoASend (VChannelPtr vc, msgid m) {
return ::InfoASend(vc, m);
}
int InfoARecv (VChannelPtr vc, msgid m) {
return ::InfoARecv(vc, m);
}
// random communication
int SendMail (int destId, int reqId, void *data, int size) {
return ::SendMail(destId, reqId, data, size);
}
int GetMail (int *sourceId, int *reqId, void *data, int *size) {
return ::GetMail(sourceId, reqId, data, size);
}
// miscellaneous
int UsedSpace (void) {
return ::UsedSpace();
}
void PrintHostMessage (const char *s) {
::PrintHostMessage(s);
}
double CurrentTime (void) {
return ::CurrentTime();
}
int Distance (int p, int q) {
return ::Distance(p, q);
}
int aid_to_pid (int x, int y, int z) {
return ::aid_to_pid(x, y, z);
}
int pid_to_aid (int p) {
return ::pid_to_aid(p);
}
};
template<class T> void PPIF_ReduceSum (T * val)
{
T tmp;
int l;
for (l=degree-1; l>=0; l--)
{
GetConcentrate(l,&tmp,sizeof(T));
*val = *val + tmp;
}
Concentrate(val, sizeof(T));
Broadcast(val, sizeof(T));
}
template<class T> void PPIF_ReduceMax (T * val)
{
T tmp;
int l;
for (l=degree-1; l>=0; l--)
{
GetConcentrate(l,&tmp,sizeof(T));
if (tmp>*val)
*val = tmp;
}
Concentrate(val, sizeof(T));
Broadcast(val, sizeof(T));
}
template<class T> void PPIF_ReduceMin (T * val)
{
T tmp;
int l;
for (l=degree-1; l>=0; l--)
{
GetConcentrate(l,&tmp,sizeof(T));
if (tmp<*val)
*val = tmp;
}
Concentrate(val, sizeof(T));
Broadcast(val, sizeof(T));
}
#endif
} // end namespace PPIF
/****************************************************************************/
#endif
|