Skip to content
Snippets Groups Projects
Commit 17ab9b01 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix prealloc (make sure it's smaller than matrix size)

parent cc10eb4a
No related branches found
No related tags found
No related merge requests found
...@@ -103,9 +103,10 @@ void linearSystemPETSc<scalar>::preAllocateEntries() ...@@ -103,9 +103,10 @@ void linearSystemPETSc<scalar>::preAllocateEntries()
int blockSize = _getBlockSizeFromParameters(); int blockSize = _getBlockSizeFromParameters();
std::vector<int> nByRowDiag (_localSize), nByRowOffDiag (_localSize); std::vector<int> nByRowDiag (_localSize), nByRowOffDiag (_localSize);
if (_sparsity.getNbRows() == 0) { if (_sparsity.getNbRows() == 0) {
PetscInt prealloc = std::min(300,_localSize); PetscInt prealloc = 300;
PetscBool set; PetscBool set;
PetscOptionsGetInt(PETSC_NULL, "-petsc_prealloc", &prealloc, &set); PetscOptionsGetInt(PETSC_NULL, "-petsc_prealloc", &prealloc, &set);
prealloc = std::min(prealloc, _localSize);
nByRowDiag.resize(0); nByRowDiag.resize(0);
nByRowDiag.resize(_localSize, prealloc); nByRowDiag.resize(_localSize, prealloc);
} else { } else {
......
ss = Sprintf(" (CPU = %g s, Memory = %g Mb)", Cpu, Memory);
Printf( StrCat(Today, ss) );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment