OpenAtom  Version1.5a
FindProcessor.h
Go to the documentation of this file.
1 /** \file FindProcessor.h
2  * Author: Abhinav S Bhatele
3  * Date Created: November 30th, 2005
4  * Finds the nearest processor from a given processor in different topologies.
5  */
6 
7 #ifndef _FINDPROCESSOR_H
8 #define _FINDPROCESSOR_H
9 
10 #include <cmath>
11 #include <iostream>
12 /*class inttriple {
13  private:
14  int x, y,z;
15  public:
16  inttriple(){x=y=z=0;}
17 
18  inttriple(int _x,int _y, int _z) : x(_x), y(_y), z(_z){}
19  void pup(PUP::er &p)
20  {
21  p|x;
22  p|y;
23  p|z;
24  }
25  inline int getx(){return x;};
26  inline int gety(){return y;};
27  inline int getz(){return z;};
28  inline CkHashCode hash() const {
29  return (CkHashCode)(x+y+z);
30  }
31  static CkHashCode staticHash(const void *k,size_t){
32  return ((inttriple *)k)->hash();
33  }
34  inline int compare(inttriple &t) const{
35  return (t.getx() == x && t.gety() == y && t.getz() ==z);
36  }
37  static int staticCompare(const void *a,const void *b,size_t){
38  return ((inttriple *)a)->compare((*(inttriple *)b));
39  }
40 
41 };
42 */
44 {
45  public:
46  int option; // input about which topology is it
47  int nop; // total no. of processors
48  int nopX, nopY, nopZ; // processors in X, Y and Z dimension respectively
49  int start[3]; // starting processor
50  int next[3]; // next processor w.r.t start
51  int w; // the fourth dimension for bluegene in virtual node mode
52  int count; // no. of processors output till now
53  int negXL, negYL, negZL; //necessary for FindNextInIter
54  int posXL, posYL, posZL;
55  int distance;
56  // CkVec <inttriple> *avoidList; // list of processors <x,y,z> to avoid
57 
58 
59  public:
60  FindProcessor(); // default constructor
61  FindProcessor(int a[]); // set start[] to a[]
62  void init(); // setup torus constants
63  void findNext(int a[]); // for infinite no. of processors in 3D
64  int findNextInMIter(int a[]); // helper function for 3D mesh
65  int findNextInMesh(int a[]); // for 3D mesh
66  int findNextIter(int a[]); // helper funtion for 3D torus
67  int findNextInTorus(int a[]); // for 3D torus in CO mode
68  int findNextInTorusV(int t, int a[]); // for 3D torus in VN mode
69  int compare(int n, int a, int b); // helper function
70  void printSome(int n);
71  void printing(int a, int b, int c);
72  void printing_sp(int a, int b, int c);
73  void printing(int w, int a, int b, int c);
74  //int main(int argc, char*argv[]);
75 };
76 
77 #endif
void printing(int a, int b, int c)
void printSome(int n)
int findNextInMIter(int a[])
int findNextIter(int a[])