Commit c3c26dfc authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed memory bug in arh reader.

parent 5a800fbe
...@@ -110,7 +110,7 @@ namespace AMDiS { ...@@ -110,7 +110,7 @@ namespace AMDiS {
TEST_EXIT(file.is_open()) TEST_EXIT(file.is_open())
("Cannot open file %s\n", filename.c_str()); ("Cannot open file %s\n", filename.c_str());
string typeId = ""; string typeId(4, ' ');
uint32_t nMacroElements = 0; uint32_t nMacroElements = 0;
uint32_t nValueVectors = 0; uint32_t nValueVectors = 0;
uint32_t nAllValues = 0; uint32_t nAllValues = 0;
......
...@@ -58,6 +58,8 @@ namespace AMDiS { ...@@ -58,6 +58,8 @@ namespace AMDiS {
} }
#endif #endif
exit(0);
ofstream file; ofstream file;
file.open(filename.c_str(), ios::out | ios::binary | ios::trunc); file.open(filename.c_str(), ios::out | ios::binary | ios::trunc);
......
...@@ -84,6 +84,17 @@ namespace AMDiS { ...@@ -84,6 +84,17 @@ namespace AMDiS {
MatAssemblyBegin(matIntInt, MAT_FINAL_ASSEMBLY); MatAssemblyBegin(matIntInt, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(matIntInt, MAT_FINAL_ASSEMBLY); MatAssemblyEnd(matIntInt, MAT_FINAL_ASSEMBLY);
if (printMatInfo) {
MatInfo matInfo;
MatGetInfo(matIntInt, MAT_GLOBAL_SUM, &matInfo);
MSG("Matrix info:\n");
MSG(" memory usage: %e MB\n", matInfo.memory / (1024.0 * 1024.0));
MSG(" mallocs: %d\n", static_cast<int>(matInfo.mallocs));
MSG(" nz allocated: %d\n", static_cast<int>(matInfo.nz_allocated));
MSG(" nz used: %d\n", static_cast<int>(matInfo.nz_used));
MSG(" nz unneeded: %d\n", static_cast<int>(matInfo.nz_unneeded));
}
// === Remove Dirichlet BC DOFs. === // === Remove Dirichlet BC DOFs. ===
......
...@@ -41,11 +41,13 @@ namespace AMDiS { ...@@ -41,11 +41,13 @@ namespace AMDiS {
petscSolVec(PETSC_NULL), petscSolVec(PETSC_NULL),
lastMeshNnz(0), lastMeshNnz(0),
zeroStartVector(false), zeroStartVector(false),
alwaysCreateNnzStructure(false) alwaysCreateNnzStructure(false),
printMatInfo(false)
{ {
Parameters::get("parallel->use zero start vector", zeroStartVector); Parameters::get("parallel->use zero start vector", zeroStartVector);
Parameters::get("parallel->always create nnz structure", Parameters::get("parallel->always create nnz structure",
alwaysCreateNnzStructure); alwaysCreateNnzStructure);
Parameters::get("parallel->print matrix info", printMatInfo);
} }
void fillPetscMatrix(Matrix<DOFMatrix*> *mat); void fillPetscMatrix(Matrix<DOFMatrix*> *mat);
...@@ -118,6 +120,10 @@ namespace AMDiS { ...@@ -118,6 +120,10 @@ namespace AMDiS {
/// operators using DOFVectors from old timestep containing many zeros due to /// operators using DOFVectors from old timestep containing many zeros due to
/// some phase fields. /// some phase fields.
bool alwaysCreateNnzStructure; bool alwaysCreateNnzStructure;
/// If true, after parallel assembling, information about the matrix
/// are printed.
bool printMatInfo;
}; };
......
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