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.
dtypes.h
Go to the documentation of this file.
1 #ifndef __DTYPES_H_
2 #define __DTYPES_H_
3 
4 #include <mpi.h>
5 #include <complex>
6 
18 namespace par {
19 
28  template <typename T>
29  class Mpi_datatype;
30 
31 #define HS_MPIDATATYPE(CTYPE, MPITYPE) \
32  template <> \
33  class Mpi_datatype<CTYPE> \
34  { \
35  public: \
36  static MPI_Datatype value() {\
37  return MPITYPE;\
38  } \
39  };
40 
41  HS_MPIDATATYPE(short, MPI_SHORT)
42  HS_MPIDATATYPE(int, MPI_INT)
43  HS_MPIDATATYPE(long, MPI_LONG)
44  HS_MPIDATATYPE(unsigned short, MPI_UNSIGNED_SHORT)
45  HS_MPIDATATYPE(unsigned int, MPI_UNSIGNED)
46  HS_MPIDATATYPE(unsigned long, MPI_UNSIGNED_LONG)
47  HS_MPIDATATYPE(float, MPI_FLOAT)
48  HS_MPIDATATYPE(double, MPI_DOUBLE)
49  HS_MPIDATATYPE(long double, MPI_LONG_DOUBLE)
50  HS_MPIDATATYPE(long long, MPI_LONG_LONG_INT)
51  HS_MPIDATATYPE(char, MPI_CHAR)
52  HS_MPIDATATYPE(unsigned char, MPI_UNSIGNED_CHAR)
53 
54  //PetscScalar is simply a typedef for double. Hence no need to explicitly
55  //define an mpi_datatype for it.
56 
57 #undef HS_MPIDATATYPE
58 
59  template <typename T>
60  class Mpi_datatype<std::complex<T> > {
61  public:
62  static MPI_Datatype value()
63  {
64  static bool first = true;
65  static MPI_Datatype datatype;
66 
67  if (first) {
68  first = false;
69  MPI_Type_contiguous(2, Mpi_datatype<T>::value(), &datatype);
70  MPI_Type_commit(&datatype);
71  }
72 
73  return datatype;
74  }
75  };
76 
81  template <>
82  class Mpi_datatype<bool> {
83  static void bool_LOR(void *in, void *inout, int* len, MPI_Datatype * dptr) {
84  for (int i = 0; i < (*len); i++) {
85  ((static_cast<bool*>(inout))[i]) =
86  ( ((static_cast<bool*>(in))[i]) ||
87  ((static_cast<bool*>(inout))[i]) );
88  }//end for
89  }//end function
90 
91 
92  static void bool_LAND(void *in, void *inout, int* len, MPI_Datatype * dptr) {
93  for (int i = 0; i < (*len); i++) {
94  ((static_cast<bool*>(inout))[i]) =
95  ( ((static_cast<bool*>(in))[i]) && ((static_cast<bool*>(inout))[i]));
96  }//end for
97  }//end function
98 
99  public:
104  static MPI_Op LAND() {
105  static bool first = true;
106  static MPI_Op land;
107  if (first) {
108  first = false;
109  MPI_Op_create(Mpi_datatype<bool>::bool_LAND ,true ,&land);
110  }
111 
112  return land;
113  }
114 
119  static MPI_Op LOR() {
120  static bool first = true;
121  static MPI_Op lor;
122  if (first) {
123  first = false;
124  MPI_Op_create(Mpi_datatype<bool>::bool_LOR ,true ,&lor);
125  }
126 
127  return lor;
128  }
129 
133  static MPI_Datatype value() {
134  static bool first = true;
135  static MPI_Datatype datatype;
136  if (first) {
137  first = false;
138  MPI_Type_contiguous(sizeof(bool), MPI_BYTE, &datatype);
139  MPI_Type_commit(&datatype);
140  }
141  return datatype;
142  }
143  };
144 
145 } //end namespace
146 
147 #endif
148 
static MPI_Op LAND()
User defined MPI_Operation to perform: second[i] = (first[i] && second[i]),.
Definition: dtypes.h:104
Definition: json.hpp:17186
static MPI_Datatype value()
Definition: dtypes.h:133
static MPI_Op LOR()
User defined MPI_Operation to perform: second[i] = (first[i] || second[i]),.
Definition: dtypes.h:119
An abstract class used for communicating messages using user-defined datatypes. The user must impleme...
Definition: zoltan_hilbert.h:76
Collection of Generic Parallel Functions: Sorting, Partitioning, Searching,...
Definition: zoltan_hilbert.h:72