# How to switch PETSc to 64 bit?

**URL:** <https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768>\
**Category:** FreeFEM installation\
**Created:** [January 27, 2021, 8:35am UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768 "2021-01-27T08:35:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![dajopez](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dajopez](https://community.freefem.org/u/dajopez)\
**Post date:** [January 27, 2021, 8:35am UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/1 "2021-01-27T08:35:07Z")

</div>

Hello,

I need to switch PETSc to 64 bit indices. I need to run ./configure --with-64-bit-indices, but where do I run it? Do i just input it into the command prompt before I run the file or does it go in the .edp?

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 27, 2021, 9:30am UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/2 "2021-01-27T09:30:32Z")

</div>

Hello,  
Are you sure you need that? Are you solving problems with more than 4,294,967,296 unknowns? On how many MPI processes?  
You can edit `3rdparty/ff-petsc/Makefile` and add `--with-64-bit-indices=true` in the [configure line](https://github.com/FreeFem/FreeFem-sources/blob/master/3rdparty/ff-petsc/Makefile#L85).

---

<div class="post-metadata">

**Author:** ![dajopez](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dajopez](https://community.freefem.org/u/dajopez)\
**Post date:** [January 27, 2021, 5:23pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/3 "2021-01-27T17:23:56Z")

</div>

Im solving a eigenvector problem of the Laplacian on a triangle. I want to do the first 1250 eigenvalues and have 450 nodes on each side. When I try to run the file that is the error it says. Does this sound like I should have to use 64 bit?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 27, 2021, 5:53pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/4 "2021-01-27T17:53:34Z")

</div>

No, clearly you shouldn’t need 64 bit integers for such a problem. Could you please share a [MWE](https://en.wikipedia.org/wiki/Minimal_working_example)?

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 20, 2021, 2:33pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/5 "2021-09-20T14:33:47Z")

</div>

Hello,  
I tried adding the line --with-64-bit-indices=true  
in the makefile file for petsc gives an error for SuperLU.

It is needed to modify other parts in the configuration file for the compilation to work?  
Thanks

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 20, 2021, 2:41pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/6 "2021-09-20T14:41:48Z")

</div>

SuperLU does not support 64-bit indices, so you need to remove any SuperLU-related flags in `3rdparty/ff-petsc/Makefile`.

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 20, 2021, 4:30pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/7 "2021-09-20T16:30:26Z")

</div>

Removing SuperLU gives error with ARPACK: `ERROR: ARPACK cannot be used with 64-bit integers`

Should all references to ARPACK be removed also?

Thanks!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 20, 2021, 4:32pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/8 "2021-09-20T16:32:30Z")

</div>

Yes, you are correct.

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 20, 2021, 6:25pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/9 "2021-09-20T18:25:37Z")

</div>

Now the compilation of petsc-slepc runs fine, but the compilation of FreeFem doesn’t. The following type of errors appears a lot:

`PETSc-code.hpp: In instantiation of ‘AnyType PETSc::initCSR<HpddmType, C>::E_initCSR::operator()(Stack) const [with HpddmType = HPDDM::Schur<double>; bool C = false; AnyType = AnyTypeWithOutCheck; Stack = void*]’: PETSc-code.hpp:1186:11: required from here PETSc-code.hpp:1223:52: error: cannot convert ‘int*’ to ‘const PetscInt*’ {aka ‘const long int*’} `

`In file included from SLEPc-complex.cpp:6: PETSc-code.hpp: In instantiation of ‘AnyType PETSc::initCSR<HpddmType, C>::E_initCSR::operator()(Stack) const [with HpddmType = HPDDM::Schwarz<std::complex<double> >; bool C = true; AnyType = AnyTypeWithOutCheck; Stack = void*]’: PETSc-code.hpp:1186:11: required from here PETSc-code.hpp:1223:52: error: cannot convert ‘int*’ to ‘const PetscInt*’ {aka ‘const long int*’} `

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 20, 2021, 7:02pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/10 "2021-09-20T19:02:29Z")

</div>

Just to be sure, what version are you using? `master`/`develop` branch? 4.9 tarball?

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 20, 2021, 7:57pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/11 "2021-09-20T19:57:14Z")

</div>

The latest one from github obtained with git clone [GitHub - FreeFem/FreeFem-sources: FreeFEM source code](https://github.com/FreeFem/FreeFem-sources.git)

I followed the usual installation instructions and modified the Makefile for the petsc-slepc compilation.

Should additional options be added to the initial ./configure ?

Thank you.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 20, 2021, 8:07pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/12 "2021-09-20T20:07:58Z")

</div>

For now, could you please simply comment out this line [FreeFem-sources/PETSc-code.hpp at master · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/master/plugin/mpi/PETSc-code.hpp#L1223)? I’ll come up with a proper fix tomorrow.

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 20, 2021, 8:28pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/13 "2021-09-20T20:28:48Z")

</div>

Thank you. I will do this. Please let me know when the fix is online.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 21, 2021, 7:16am UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/14 "2021-09-21T07:16:06Z")

</div>

This should be addressed in [--with-64-bit-indices · FreeFem/FreeFem-sources@a3ee108 · GitHub](https://github.com/FreeFem/FreeFem-sources/commit/a3ee108c8fe1720625d9f4b73dc7fca8e3eb895b). You can switch to the `develop` branch (`git checkout develop`). Thanks for your report.

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 22, 2021, 3:28pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/15 "2021-09-22T15:28:54Z")

</div>

Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 22, 2021, 3:36pm UTC](https://community.freefem.org/t/how-to-switch-petsc-to-64-bit/768/16 "2021-09-22T15:36:09Z")

</div>

You are very welcome. Some functionalities are disabled for 64 bit integers (because FreeFEM is only 32 bit capable), let me know if you run into issues and I’ll try my best to sort them out.
