Dendro  5.01
Dendro in Greek language means tree. The Dendro library is a large scale (262K cores on ORNL's Titan) distributed memory adaptive octree framework. The main goal of Dendro is to perform large scale multiphysics simulations efficeiently in mordern supercomputers. Dendro consists of efficient parallel data structures and algorithms to perform variational ( finite element) methods and finite difference mthods on 2:1 balanced arbitary adaptive octrees which enables the users to perform simulations raning from black holes (binary black hole mergers) to blood flow in human body, where applications ranging from relativity, astrophysics to biomedical engineering.
zoltan_hilbert.h
1 
2 /*
3  * @author: Majid Rasoeli
4  * School of Computing, University of Utah
5 
6  *
7  * Benchmark to access the zoltan implementation of Hilbert Curve.
8  *
9  * */
10 
11 
12 #ifndef SFCSORTBENCH_ZOLTAN_HILBERT_H
13 #define SFCSORTBENCH_ZOLTAN_HILBERT_H
14 
15 #include <mpi.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <ctype.h>
19 #include <ctime>
20 #include "zoltan.h"
21 #include <iostream>
22 #include "genPts_par.h"
23 
24 //#define MESH_RANGE 1<<30 // points in the mesh will be generated randomly between 0 and MESH_RANGE
25 
26 typedef struct
27 {
28  ZOLTAN_ID_TYPE x;
29  ZOLTAN_ID_TYPE y;
30  ZOLTAN_ID_TYPE z;
31  ZOLTAN_ID_TYPE globalID;
32 
33 } Node_Type;
34 
35 
36 /* Structure to hold mesh data */
37 
38 typedef struct{
39  ZOLTAN_ID_TYPE numGlobalPoints;
40  ZOLTAN_ID_TYPE numLocalPts;
41  ZOLTAN_ID_TYPE *globalIds;
42  ZOLTAN_ID_TYPE *localIds;
43  ZOLTAN_ID_TYPE *x;
44  ZOLTAN_ID_TYPE *y;
45  ZOLTAN_ID_TYPE *z;
46 } MESH_DATA;
47 
48 
49 
50 
51 
52 
53 void ZoltanHibertLBandSort(DendroIntL grainSz,unsigned int dim ,unsigned int maxDepth,double tol, std::vector<double>& stats,unsigned int distribution,MPI_Comm comm);
54 
55 int get_number_of_objects(void *data, int *ierr);
56 void get_object_list(void *data, int sizeGID, int sizeLID,
57  ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
58  int wgt_dim, float *obj_wgts, int *ierr);
59 int get_num_geometry(void *data, int *ierr);
60 void get_geometry_list(void *data, int sizeGID, int sizeLID,
61  int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
62  int num_dim, double *geom_vec, int *ierr);
63 
64 
65 void user_sizes_node(void *data,int num_gid_entries,int num_lid_entries, int nids, ZOLTAN_ID_PTR global_id, ZOLTAN_ID_PTR local_id, int* nbytes, int *ierr);
66 void user_pack_node(void *data,int num_gid_entries,int num_lid_entries, int nids, ZOLTAN_ID_PTR global_id, ZOLTAN_ID_PTR local_id, int* dest, int* size, int* index, char *buf, int *ierr);
67 void user_unpack_node(void *data,int gidSize,int num_ids, ZOLTAN_ID_PTR global_id, int * size,int * idx , char *buf, int *ierr);
68 
69 
70 
71 
72 namespace par {
73 
74  //Forward Declaration
75  template <typename T>
76  class Mpi_datatype;
77 
82  template <>
84 /*
85 
86  static void Node_MAX_LEVEL(void *in, void *inout, int* len, MPI_Datatype * dptr) {
87  for(int i = 0; i < (*len); i++) {
88  ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
89  ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
90  (static_cast<ot::TreeNode*>(inout))[i] =
91  ( ( (first.getLevel()) > (second.getLevel()) )? first : second );
92  }//end for
93  }//end function
94 
95  static void Node_MAX(void *in, void *inout, int* len, MPI_Datatype * dptr) {
96  for(int i = 0; i < (*len); i++) {
97  ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
98  ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
99  (static_cast<ot::TreeNode*>(inout))[i] = ( ( first > second )? first : second );
100  }//end for
101  }//end function
102 
103  static void Node_MIN(void *in, void *inout, int* len, MPI_Datatype * dptr) {
104  for(int i = 0; i < (*len); i++) {
105  ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
106  ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
107  (static_cast<ot::TreeNode*>(inout))[i] = ( ( first < second )? first : second );
108  }//end for
109  }//end function
110 */
111 
112  /* static void Node_NCA(void *in, void *inout, int* len, MPI_Datatype * dptr) {
113  for(int i = 0; i < (*len); i++) {
114  ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
115  ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
116  if( first != second ) {
117  (static_cast<ot::TreeNode*>(inout))[i] = ot::getNCA(first, second);
118  }//end if
119  }//end for
120  }//end function*/
121 
122  public:
127  /*static MPI_Op MAX_LEVEL(){
128  static bool first = true;
129  static MPI_Op maxLev;
130  if (first) {
131  first = false;
132  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MAX_LEVEL ,true ,&maxLev);
133  }
134  return maxLev;
135  }*/
136 
142  /*static MPI_Op _MAX() {
143  static bool first = true;
144  static MPI_Op max;
145  if (first) {
146  first = false;
147  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MAX ,true ,&max);
148  }
149  return max;
150  }*/
151 
157  /*static MPI_Op _MIN() {
158  static bool first = true;
159  static MPI_Op min;
160  if (first) {
161  first = false;
162  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MIN ,true ,&min);
163  }
164  return min;
165  }*/
166 
172  /*static MPI_Op NCA() {
173  static bool first = true;
174  static MPI_Op nca;
175  if (first) {
176  first = false;
177  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_NCA ,true ,&nca);
178  }
179  return nca;
180  }*/
181 
185  static MPI_Datatype value()
186  {
187  static bool first = true;
188  static MPI_Datatype datatype;
189 
190  if (first)
191  {
192  first = false;
193  MPI_Type_contiguous(sizeof(Node_Type), MPI_BYTE, &datatype);
194  MPI_Type_commit(&datatype);
195  }
196 
197  return datatype;
198  }
199 
200  };
201 
202 }//end namespace par
203 
204 
205 
206 #endif //SFCSORTBENCH_ZOLTAN_HILBERT_H
Definition: zoltan_hilbert.h:26
An abstract class used for communicating messages using user-defined datatypes. The user must impleme...
Definition: zoltan_hilbert.h:76
static MPI_Datatype value()
User defined MPI_Operation that sets second[i] to first[i] if first[i] is at a greater level than sec...
Definition: zoltan_hilbert.h:185
Collection of Generic Parallel Functions: Sorting, Partitioning, Searching,...
Definition: zoltan_hilbert.h:72
Definition: zoltan_hilbert.h:38