En raison d'une défaillance matérielle, les jobs d'intégration continue peuvent échouer sans raison évidente sur les runners partagés. Les disques incriminés devraient être changés en fin de semaine. Merci de votre compréhension.

Commit a982ace7 authored by remicres's avatar remicres
Browse files

FIX: simplify the function prototype for memory estimation, fix estimation function

parent 879e7ccb
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream); void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream);
void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream); void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream);
long long unsigned int GetNodeMemory(NodePointerType &node); long long unsigned int GetSpecificAttributesMemory(NodePointerType &node);
}; };
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -44,16 +44,13 @@ BaatzSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node, FILE * node ...@@ -44,16 +44,13 @@ BaatzSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node, FILE * node
template<class TImage> template<class TImage>
long long unsigned int long long unsigned int
BaatzSegmenter<TImage>::GetNodeMemory(NodePointerType &node) BaatzSegmenter<TImage>::GetSpecificAttributesMemory(NodePointerType &node)
{ {
long long unsigned int memory = 0;
unsigned int nBands = node->m_Means.size(); //this->m_InputImage->GetNumberOfComponentsPerPixel(); memory += 4 * node->m_Means.size() * sizeof(float); // 4 vectors values
memory += 4 * sizeof(std::vector<float>); // 4 vector containers
long long unsigned int memory = 0;
memory += sizeof(NodePointerType); // size of the node pointer
memory += sizeof(NodeType); // size of the node (actually, size of the base node)
memory += 4 * nBands * sizeof(float); // size of the 4 attributes, multiplied by the nb. of bands
memory += node->m_Edges.size() * sizeof(EdgeType); // size of the edges
return memory; return memory;
} }
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream); void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream);
void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream); void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream);
long long unsigned int GetNodeMemory(NodePointerType &node); long long unsigned int GetSpecificAttributesMemory(NodePointerType &node);
}; };
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -35,16 +35,13 @@ FullLambdaScheduleSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node ...@@ -35,16 +35,13 @@ FullLambdaScheduleSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node
template<class TImage> template<class TImage>
long long unsigned int long long unsigned int
FullLambdaScheduleSegmenter<TImage>::GetNodeMemory(NodePointerType &node) FullLambdaScheduleSegmenter<TImage>::GetSpecificAttributesMemory(NodePointerType &node)
{ {
long long unsigned int memory = 0;
unsigned int nBands = node->m_Means.size(); //this->m_InputImage->GetNumberOfComponentsPerPixel(); memory += node->m_Means.size() * sizeof(float); // vector values
memory += sizeof(std::vector<float>); // vector container
long long unsigned int memory = 0;
memory += sizeof(NodePointerType); // size of the node pointer
memory += sizeof(NodeType); // size of the node (actually, size of the base node)
memory += 1 * nBands * sizeof(float); // size of the 1 attribute, multiplied by the nb. of bands
memory += node->m_Edges.size() * sizeof(EdgeType); // size of the edges
return memory; return memory;
} }
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -17,6 +17,7 @@ public: ...@@ -17,6 +17,7 @@ public:
typedef typename TSegmenterType::ParamType ParamType; typedef typename TSegmenterType::ParamType ParamType;
typedef grm::Graph<NodeType> GraphType; typedef grm::Graph<NodeType> GraphType;
typedef typename GraphType::EdgeType EdgeType; typedef typename GraphType::EdgeType EdgeType;
typedef typename GraphType::EdgeListType EdgeListType;
typedef typename grm::GraphOperations<TSegmenterType> GraphOperatorType; typedef typename grm::GraphOperations<TSegmenterType> GraphOperatorType;
typedef typename GraphOperatorType::NodePointerType NodePointerType; typedef typename GraphOperatorType::NodePointerType NodePointerType;
typedef GraphToOtbImage<GraphType> IOType; typedef GraphToOtbImage<GraphType> IOType;
...@@ -163,9 +164,9 @@ public: ...@@ -163,9 +164,9 @@ public:
} }
/* /*
* Returns the memory (in bytes) occupied by one node of the graph * Returns the memory (in bytes) occupied by the specific attributes of the node
*/ */
virtual long long unsigned int GetNodeMemory(NodePointerType &node) = 0; virtual long long unsigned int GetSpecificAttributesMemory(NodePointerType &node) = 0;
/* /*
* Returns the memory (in bytes) occupied by the entire graph * Returns the memory (in bytes) occupied by the entire graph
...@@ -173,13 +174,31 @@ public: ...@@ -173,13 +174,31 @@ public:
long long unsigned int GetGraphMemory() long long unsigned int GetGraphMemory()
{ {
long long unsigned int memory = 0; long long unsigned int memory = 0;
long long unsigned int numberOfMoves = 0;
for(auto& node : this->m_Graph.m_Nodes) for(auto& node : this->m_Graph.m_Nodes)
{ {
numberOfMoves += node->m_Contour.size(); // size of the contour (boost::dynamic_bitset)
memory += this->GetNodeMemory(node); memory += sizeof(lp::Contour);
#ifdef ENVIRONMENT64
memory += 8 * ((node->m_Contour.size() + 63) / 64);
#endif
#ifdef ENVIRONMENT32
memory += 8 * ((node->m_Contour.size() + 31) / 32);
#endif
// size of specific attributes
memory += this->GetSpecificAttributesMemory(node);
// size of the node pointer
memory += sizeof(NodePointerType);
// size of the node (actually, size of the base node)
memory += sizeof(NodeType);
// size of the edges
memory += node->m_Edges.capacity() * sizeof(EdgeType);
memory += sizeof(EdgeListType);
} }
memory += std::ceil(numberOfMoves / 4);
return memory; return memory;
} }
......
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream); void WriteSpecificAttributes(NodePointerType node, FILE * nodeStream);
void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream); void ReadSpecificAttributes(NodePointerType node, FILE * nodeStream);
long long unsigned int GetNodeMemory(NodePointerType &node); long long unsigned int GetSpecificAttributesMemory(NodePointerType &node);
}; };
} // end of namespace lsrm } // end of namespace lsrm
......
...@@ -35,16 +35,13 @@ SpringSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node, FILE * nod ...@@ -35,16 +35,13 @@ SpringSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node, FILE * nod
template<class TImage> template<class TImage>
long long unsigned int long long unsigned int
SpringSegmenter<TImage>::GetNodeMemory(NodePointerType &node) SpringSegmenter<TImage>::GetSpecificAttributesMemory(NodePointerType &node)
{ {
long long unsigned int memory = 0;
unsigned int nBands = node->m_Means.size(); //this->m_InputImage->GetNumberOfComponentsPerPixel(); memory += node->m_Means.size() * sizeof(float); // vector values
memory += sizeof(std::vector<float>); // vector container
long long unsigned int memory = 0;
memory += sizeof(NodePointerType); // size of the node pointer
memory += sizeof(NodeType); // size of the node (actually, size of the base node)
memory += 1 * nBands * sizeof(float); // size of the 1 attribute, multiplied by the nb. of bands
memory += node->m_Edges.size() * sizeof(EdgeType); // size of the edges
return memory; return memory;
} }
} // end of namespace lsrm } // end of namespace lsrm
......
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