barbagroup/PetIBM

Error returned by PETSc function `PetscTableCreateHashSize`

piyueh opened this issue · 2 comments

With PETSC 3.7.5, when the matrix is big, PETSc might return an error from the function PetscTableCreateHashSize.

A really huge hash is being requested.. cannot process: [size of the matrix here]

For example, a 3D cylinder simulation with a mesh of size 186x186x128 and a total of 16128 Lagrangian points.

Not sure what that PETSc function is for. But some other guys also complained about that. There might be some solutions that don't involve modifying PETSc source code in that discussion. I haven't checked every post in that discussion.

I simply patched the difference between the git version and 3.7.5 to the source file ${PETSC_SOURCE}/src/sys/utils/ctable.c, and the patched PETSc-3.7.5 now works well. Here is the patch

27a28,42
>   else if (sz < 6553600) *hsz = 9179113;
>   else if (sz < 13107200)*hsz = 18350009;
>   else if (sz < 26214400)*hsz = 36700021;
>   else if (sz < 52428800)*hsz = 73400279;
>   else if (sz < 104857600)*hsz = 146800471;
>   else if (sz < 209715200)*hsz = 293601569;
>   else if (sz < 419430400)*hsz = 587202269;
>   else if (sz < 838860800)*hsz = 1175862839;
>   else if (sz < 1677721600)*hsz = 2147321881;
> #if defined(PETSC_USE_64BIT_INDICES)
>   else if (sz < 3355443200l)*hsz = 4695452647l;
>   else if (sz < 6710886400l)*hsz = 9384888067l;
>   else if (sz < 13421772800l)*hsz = 18787024237l;
>   else if (sz < 26843545600l)*hsz = 32416190071l;
> #endif
52c67
<   ierr       = PetscTableCreateHashSize(n,&ta->tablesize);
---
>   ierr       = PetscTableCreateHashSize(n,&ta->tablesize);CHKERRQ(ierr);
148c163
<   ierr = PetscTableCreateHashSize(ta->tablesize,&ta->tablesize);
---
>   ierr = PetscTableCreateHashSize(ta->tablesize,&ta->tablesize);CHKERRQ(ierr);

It's not a problem from our side, so nothing to be fixed in PetIBM. We just wait for a new version of PETSc, or we can release the patch together with PetIBM.

Update:
PetscTableCreateHashSize does not exist before PETSc 3.7.5. So before they release a new version of PETSc, we can probably just use PETSc 3.7.4 or 3.7.3.

We have moved on to PETSc 3.8.1, so this issue doesn't exist anymore.