/[escript]/trunk/paso/src/SystemMatrix_MIS.c
ViewVC logotype

Diff of /trunk/paso/src/SystemMatrix_MIS.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3641 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3642 by caltinay, Thu Oct 27 03:41:51 2011 UTC
# Line 12  Line 12 
12  #define MISSTRING(x) ((x==MISIN)?"IN":((x==MISOUT)?"OUT":"UNKNOWN"))  #define MISSTRING(x) ((x==MISIN)?"IN":((x==MISOUT)?"OUT":"UNKNOWN"))
13    
14    
15  /* returns the nodes in this system matrix which connect to things outside the main block  /* Returns the nodes in this system matrix which connect to things outside the main block.
16     the reference parameter count will be set to the number of nodes in the return value.     The reference parameter count will be set to the number of nodes in the return value.
17     Cleanup of return value is the callers responsibility.     Cleanup of return value is the caller's responsibility.
18        
19     This routine assumes that the System matrix is in default format with a CSR col_coupleBlock     This routine assumes that the System matrix is in default format with a CSR col_coupleBlock.
20  */  */
21  index_t* Paso_SparseMatrix_getBorderNodes(Paso_SystemMatrix* A, index_t* count) {  index_t* Paso_SparseMatrix_getBorderNodes(Paso_SystemMatrix* A, index_t* count) {
22     const index_t MAXNEIGHBOURS=A->col_coupleBlock->len;     const index_t MAXNEIGHBOURS=A->col_coupleBlock->len;
# Line 38  index_t* Paso_SparseMatrix_getBorderNode Line 38  index_t* Paso_SparseMatrix_getBorderNode
38  }  }
39    
40    
41  /* takes in a list of border nodes and weights and computes the MIS for all border ndoes  /* Takes in a list of border nodes and weights and computes the MIS for all
42     on all ranks. It does this one node at a time. Later this should use rank colouring   * border nodes on all ranks. It does this one node at a time. Later this
43     to do a number of ranks at once.   * should use rank colouring to do a number of ranks at once.
44  */  */
45  void Paso_SystemMatrix_CalcBorderMIS(Paso_SystemMatrix* A, index_t* border, index_t bordercount, double* weights, index_t n) {  void Paso_SystemMatrix_CalcBorderMIS(Paso_SystemMatrix* A, index_t* border, index_t bordercount, double* weights, index_t n) {
46      index_t i=0;      index_t i=0;
# Line 52  void Paso_SystemMatrix_CalcBorderMIS(Pas Line 52  void Paso_SystemMatrix_CalcBorderMIS(Pas
52      double *remote_values=NULL;      double *remote_values=NULL;
53      #endif      #endif
54            
55      if (A->type!=MATRIX_FORMAT_DEFAULT) {       /* We only support CSR matricies here */      if (A->type!=MATRIX_FORMAT_DEFAULT) {       /* We only support CSR matrices here */
56          Esys_setError(TYPE_ERROR,"Paso_SystemMatrix_CalcBorderMIS: Symmetric matrix patterns are not supported.");                Esys_setError(TYPE_ERROR,"Paso_SystemMatrix_CalcBorderMIS: Symmetric matrix patterns are not supported.");      
57      }      }
58            
# Line 105  void Paso_SystemMatrix_CalcBorderMIS(Pas Line 105  void Paso_SystemMatrix_CalcBorderMIS(Pas
105    
106  static double Paso_Pattern_mis_seed=.4142135623730951;  static double Paso_Pattern_mis_seed=.4142135623730951;
107    
108  /* Return a list of nodes which belong the a maximal independent set.  /* Return a list of nodes which belong to a maximal independent set.
109     Note: Only nodes local to this rank will be returned.     Note: Only nodes local to this rank will be returned.
110    
111     Caller is responsible for cleaning up return value.     Caller is responsible for cleaning up return value.
# Line 140  index_t Paso_SystemMatrix_getMIS(Paso_Sy Line 140  index_t Paso_SystemMatrix_getMIS(Paso_Sy
140      weights[i]=0.5;      weights[i]=0.5;
141      }      }
142     /* This loop will use a different memory access pattern to the setup     /* This loop will use a different memory access pattern to the setup
143        ie a NUMA problem. However I'm gambling that the border is small and        i.e. a NUMA problem. However I'm gambling that the border is small and
144        that the memory won't be relocated.        that the memory won't be relocated.
145     */     */
146      #pragma omp parallel for schedule(static) private(i)      #pragma omp parallel for schedule(static) private(i)
# Line 181  index_t Paso_SystemMatrix_getMIS(Paso_Sy Line 181  index_t Paso_SystemMatrix_getMIS(Paso_Sy
181          }          }
182      }      }
183    
184          /* Go through and mark all the neighbours of nodes definitly in */          /* Go through and mark all the neighbours of nodes definitely in */
185      #pragma omp parallel for schedule(static) private(i)      #pragma omp parallel for schedule(static) private(i)
186      for (i=0;i<n;++i) {      for (i=0;i<n;++i) {
187          if (weights[i]==MISIN) {          if (weights[i]==MISIN) {
# Line 219  index_t Paso_SystemMatrix_getMIS(Paso_Sy Line 219  index_t Paso_SystemMatrix_getMIS(Paso_Sy
219      }      }
220      *set=mis;      *set=mis;
221      return missize;      return missize;
 }  
222    }
223    

Legend:
Removed from v.3641  
changed lines
  Added in v.3642

  ViewVC Help
Powered by ViewVC 1.1.26