FindProcessor.h

Go to the documentation of this file.
00001 /** \file FindProcessor.h
00002  *  Author: Abhinav S Bhatele
00003  *  Date Created: November 30th, 2005
00004  *  Finds the nearest processor from a given processor in different topologies.
00005  */
00006 
00007 #ifndef _FINDPROCESSOR_H
00008 #define _FINDPROCESSOR_H
00009 
00010 #include <math.h>
00011 #include <iostream.h>
00012 /*class inttriple {
00013  private:
00014   int x, y,z;
00015  public:
00016     inttriple(){x=y=z=0;}
00017 
00018     inttriple(int _x,int _y, int _z) : x(_x), y(_y), z(_z){}
00019   void pup(PUP::er &p)
00020       {
00021           p|x;
00022           p|y;
00023           p|z;
00024       }
00025     inline int getx(){return x;};
00026     inline int gety(){return y;};
00027     inline int getz(){return z;};
00028     inline CkHashCode hash() const {
00029         return (CkHashCode)(x+y+z);
00030     }
00031     static CkHashCode staticHash(const void *k,size_t){
00032         return ((inttriple *)k)->hash();
00033     }
00034     inline int compare(inttriple &t) const{
00035         return (t.getx() == x && t.gety() == y && t.getz() ==z);
00036     }
00037     static int staticCompare(const void *a,const void *b,size_t){
00038         return ((inttriple *)a)->compare((*(inttriple *)b));
00039     }
00040    
00041 };
00042 */
00043 class FindProcessor 
00044 {
00045         public:
00046                 int option;             // input about which topology is it
00047                 int nop;                // total no. of processors
00048                 int nopX, nopY, nopZ;   // processors in X, Y and Z dimension respectively 
00049                 int start[3];           // starting processor
00050                 int next[3];            // next processor w.r.t start
00051                 int w;                  // the fourth dimension for bluegene in virtual node mode
00052                 int count;              // no. of processors output till now 
00053                 int negXL, negYL, negZL; //necessary for FindNextInIter
00054                 int posXL, posYL, posZL;
00055                 int distance;
00056                 //              CkVec <inttriple> *avoidList; // list of processors <x,y,z> to avoid
00057                 
00058 
00059         public:
00060                 FindProcessor();                        // default constructor
00061                 FindProcessor(int a[]);                 // set start[] to a[] 
00062                 void init();  // setup torus constants
00063                 void findNext(int a[]);                 // for infinite no. of processors in 3D
00064                 int findNextInMIter(int a[]);           // helper function for 3D mesh
00065                 int findNextInMesh(int a[]);            // for 3D mesh
00066                 int findNextIter(int a[]);              // helper funtion for 3D torus
00067                 int findNextInTorus(int a[]);           // for 3D torus in CO mode
00068                 int findNextInTorusV(int t, int a[]);   // for 3D torus in VN mode
00069                 int compare(int n, int a, int b);       // helper function
00070                 void printSome(int n);                  
00071                 void printing(int a, int b, int c);
00072                 void printing_sp(int a, int b, int c);
00073                 void printing(int w, int a, int b, int c);
00074                 //int main(int argc, char*argv[]);
00075 };
00076 
00077 #endif
00078 

Generated on Thu Dec 6 18:25:31 2007 for leanCP by  doxygen 1.5.3