Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit 2620c115 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Some performance issues, part III. ElementObjectDatabase requires now onl 10% of the memory.

parent 2d6d2384
......@@ -23,6 +23,14 @@ namespace AMDiS {
macroElementRankMap = &rankMap;
levelData = &ld;
// === Reset temporary data ===
tmpVertexElements.clear();
tmpEdgeElements.clear();
tmpFaceElements.clear();
// === Fills macro element data structures. ===
TraverseStack stack;
......@@ -42,6 +50,26 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo);
}
// === Move temporary data to original one ===
for (map<DegreeOfFreedom, vector<ElementObjectData> >::iterator it = tmpVertexElements.begin();
it != tmpVertexElements.end(); ++it)
vertexElements[it->first] = it->second;
tmpVertexElements.clear();
for (map<DofEdge, vector<ElementObjectData> >::iterator it = tmpEdgeElements.begin();
it != tmpEdgeElements.end(); ++it)
edgeElements[it->first] = it->second;
tmpEdgeElements.clear();
for (map<DofFace, vector<ElementObjectData> >::iterator it = tmpFaceElements.begin();
it != tmpFaceElements.end(); ++it)
faceElements[it->first] = it->second;
tmpFaceElements.clear();
// Handle periodic boudaries
createPeriodicData();
......@@ -186,7 +214,7 @@ namespace AMDiS {
int elIndex = el->getIndex();
ElementObjectData elObj(elIndex, ith);
vertexElements[vertex].push_back(elObj);
tmpVertexElements[vertex].push_back(elObj);
vertexLocalMap[elObj] = vertex;
}
......@@ -199,7 +227,7 @@ namespace AMDiS {
int elIndex = el->getIndex();
ElementObjectData elObj(elIndex, ith);
edgeElements[edge].push_back(elObj);
tmpEdgeElements[edge].push_back(elObj);
edgeLocalMap[elObj] = edge;
}
......@@ -210,7 +238,7 @@ namespace AMDiS {
int elIndex = el->getIndex();
ElementObjectData elObj(elIndex, ith);
faceElements[face].push_back(elObj);
tmpFaceElements[face].push_back(elObj);
faceLocalMap[elObj] = face;
}
......@@ -469,7 +497,7 @@ namespace AMDiS {
TEST_EXIT(macroElementRankMap)("Should not happen!\n");
vertexInRank.clear();
for (map<DegreeOfFreedom, vector<ElementObjectData> >::iterator it = vertexElements.begin();
for (flat_map<DegreeOfFreedom, vector<ElementObjectData> >::iterator it = vertexElements.begin();
it != vertexElements.end(); ++it) {
for (vector<ElementObjectData>::iterator it2 = it->second.begin();
it2 != it->second.end(); ++it2) {
......@@ -480,7 +508,7 @@ namespace AMDiS {
}
edgeInRank.clear();
for (map<DofEdge, vector<ElementObjectData> >::iterator it = edgeElements.begin();
for (flat_map<DofEdge, vector<ElementObjectData> >::iterator it = edgeElements.begin();
it != edgeElements.end(); ++it) {
for (vector<ElementObjectData>::iterator it2 = it->second.begin();
it2 != it->second.end(); ++it2) {
......@@ -491,7 +519,7 @@ namespace AMDiS {
}
faceInRank.clear();
for (map<DofFace, vector<ElementObjectData> >::iterator it = faceElements.begin();
for (flat_map<DofFace, vector<ElementObjectData> >::iterator it = faceElements.begin();
it != faceElements.end(); ++it) {
for (vector<ElementObjectData>::iterator it2 = it->second.begin();
it2 != it->second.end(); ++it2) {
......@@ -547,7 +575,7 @@ namespace AMDiS {
// === First, create reverse modes for all "directly" neighbouring elements. ===
for (map<DofEdge, vector<ElementObjectData> >::iterator edgeIt = edgeElements.begin();
for (flat_map<DofEdge, vector<ElementObjectData> >::iterator edgeIt = edgeElements.begin();
edgeIt != edgeElements.end(); ++edgeIt) {
vector<ElementObjectData>& els = edgeIt->second;
......@@ -572,7 +600,7 @@ namespace AMDiS {
}
}
for (map<DofFace, vector<ElementObjectData> >::iterator faceIt = faceElements.begin();
for (flat_map<DofFace, vector<ElementObjectData> >::iterator faceIt = faceElements.begin();
faceIt != faceElements.end(); ++faceIt) {
vector<ElementObjectData>& els = faceIt->second;
......@@ -771,7 +799,7 @@ namespace AMDiS {
int nSize = vertexElements.size();
SerUtil::serialize(out, nSize);
for (map<DegreeOfFreedom, vector<ElementObjectData> >::iterator it = vertexElements.begin();
for (flat_map<DegreeOfFreedom, vector<ElementObjectData> >::iterator it = vertexElements.begin();
it != vertexElements.end(); ++it) {
SerUtil::serialize(out, it->first);
serialize(out, it->second);
......@@ -779,7 +807,7 @@ namespace AMDiS {
nSize = edgeElements.size();
SerUtil::serialize(out, nSize);
for (map<DofEdge, vector<ElementObjectData> >::iterator it = edgeElements.begin();
for (flat_map<DofEdge, vector<ElementObjectData> >::iterator it = edgeElements.begin();
it != edgeElements.end(); ++it) {
SerUtil::serialize(out, it->first);
serialize(out, it->second);
......@@ -787,7 +815,7 @@ namespace AMDiS {
nSize = faceElements.size();
SerUtil::serialize(out, nSize);
for (map<DofFace, vector<ElementObjectData> >::iterator it = faceElements.begin();
for (flat_map<DofFace, vector<ElementObjectData> >::iterator it = faceElements.begin();
it != faceElements.end(); ++it) {
SerUtil::serialize(out, it->first);
serialize(out, it->second);
......@@ -1104,24 +1132,24 @@ namespace AMDiS {
unsigned long tmp = 0;
// vertexElements
tmp = mapOverhead + vertexElements.size() * mapEntryOverhead;
for (map<DegreeOfFreedom, vector<ElementObjectData> >::iterator mapIt =
tmp = flatMapOverhead;
for (flat_map<DegreeOfFreedom, vector<ElementObjectData> >::iterator mapIt =
vertexElements.begin(); mapIt != vertexElements.end(); ++mapIt)
tmp += dofSize + vectorOverhead + mapIt->second.size() * structElObjDataSize;
MSG("EL-OBJ-DB MEM 01: %d\n", tmp);
value += tmp;
// edgeElements
tmp = mapOverhead + edgeElements.size() * mapEntryOverhead;
for (map<DofEdge, vector<ElementObjectData> >::iterator mapIt =
tmp = flatMapOverhead;
for (flat_map<DofEdge, vector<ElementObjectData> >::iterator mapIt =
edgeElements.begin(); mapIt != edgeElements.end(); ++mapIt)
tmp += dofSize + vectorOverhead + mapIt->second.size() * structElObjDataSize;
MSG("EL-OBJ-DB MEM 02: %d\n", tmp);
value += tmp;
// faceElements
tmp += mapOverhead + faceElements.size() * mapEntryOverhead;
for (map<DofFace, vector<ElementObjectData> >::iterator mapIt =
tmp = flatMapOverhead;
for (flat_map<DofFace, vector<ElementObjectData> >::iterator mapIt =
faceElements.begin(); mapIt != faceElements.end(); ++mapIt)
tmp += dofSize + vectorOverhead + mapIt->second.size() * structElObjDataSize;
MSG("EL-OBJ-DB MEM 03: %d\n", tmp);
......@@ -1176,10 +1204,10 @@ namespace AMDiS {
tmp += setOverhead + faceReverseMode.size() * (setEntryOverhead + 2 * structElObjDataSize);
// macroElIndexMap
tmp += mapOverhead + macroElIndexMap.size() * (mapEntryOverhead + sizeof(int) + sizeof(int*));
tmp += flatMapOverhead + macroElIndexMap.size() * (sizeof(int) + sizeof(int*));
// macroElIndexTypeMap
tmp += mapOverhead + macroElIndexTypeMap.size() * (mapEntryOverhead + sizeof(int) + sizeof(int*));
tmp += flatMapOverhead + macroElIndexTypeMap.size() * (sizeof(int) + sizeof(int));
MSG("EL-OBJ-DB MEM 08: %d\n", tmp);
value += tmp;
......
......@@ -50,6 +50,8 @@ namespace AMDiS {
};
#pragma pack(push)
#pragma pack(1)
/// Defines one element object. This may be either a vertex, edge or face.
struct ElementObjectData {
ElementObjectData(int a = -1, int b = 0)
......@@ -61,7 +63,7 @@ namespace AMDiS {
int elIndex;
/// Index of the object within the element.
int ithObject;
char ithObject;
/// Write this element object to disk.
void serialize(ostream &out) const
......@@ -90,7 +92,7 @@ namespace AMDiS {
(elIndex == rhs.elIndex && ithObject < rhs.ithObject));
}
};
#pragma pack(pop)
/** \brief
......@@ -498,15 +500,27 @@ namespace AMDiS {
/// The mesh that is used to store all its element information in
/// the database.
Mesh *mesh;
/// Maps to each vertex DOF all element objects that represent this vertex.
map<DegreeOfFreedom, vector<ElementObjectData> > vertexElements;
flat_map<DegreeOfFreedom, vector<ElementObjectData> > vertexElements;
/// Maps to each edge all element objects that represent this edge.
map<DofEdge, vector<ElementObjectData> > edgeElements;
flat_map<DofEdge, vector<ElementObjectData> > edgeElements;
/// Maps to each face all element objects that represent this edge.
map<DofFace, vector<ElementObjectData> > faceElements;
flat_map<DofFace, vector<ElementObjectData> > faceElements;
/// Temporary object to speed up creation of \ref vertexElements
map<DegreeOfFreedom, vector<ElementObjectData> > tmpVertexElements;
/// Temporary object to speed up creation of \ref edgeElements
map<DofEdge, vector<ElementObjectData> > tmpEdgeElements;
/// Temporary object to speed up creation of \ref faceElements
map<DofFace, vector<ElementObjectData> > tmpFaceElements;
/// Maps to an element object the corresponding vertex DOF.
......@@ -576,10 +590,10 @@ namespace AMDiS {
map<int, int> *macroElementRankMap;
/// Maps to each macro element index a pointer to the corresponding element.
map<int, Element*> macroElIndexMap;
flat_map<int, Element*> macroElIndexMap;
/// Maps to each macro element index the type of this element.
map<int, int> macroElIndexTypeMap;
flat_map<int, int> macroElIndexTypeMap;
MeshLevelData* levelData;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment