Compile PETSc and Slepc "in place"
So far, all of my libraries were compiled "out of place" (to use the denomination on PETSc website): the sources were unpacked (in a temporary location), then make/make install was called and only the installed libraries were kept.
However, I didn't manage to run properly Slepc installed that way:
- The code failed in the
SlepcInitialize()
call - I could work around this by adding a call toPetscInitialize()
beforehand - The instruction
EPSSetOperators()
failed with the following message:
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Wrong type of object: Parameter # 2
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.18.1, Oct 26, 2022
[0]PETSC ERROR: /Users/sgilles/Codes/MoReFEM/CoreLibrary/build_clang_debug/Sources/TestSlepcHandsOn1 on a named Sebastiens-MacBook-Pro-3.local by sgilles Fri Nov 11 09:50:17 2022
[0]PETSC ERROR: Configure options CXXFLAGS=" -m64 -g -stdlib=libc++" CFLAGS=" -m64 -g -Wno-implicit-function-declaration" FFLAGS=" -g " FCFLAGS=" -g " LDFLAGS=" " --with-mpi-dir=/Users/sgilles/opt/clang_debug/Openmpi --download-mumps --download-superlu_dist --download-scalapack --with-clib-autodetect=0 --with-debugging=yes --prefix=/Users/sgilles/opt/clang_debug/Petsc --download-sowing-cc=clang ---download-sowing-cxx=clang++ --with-cxx-dialect=C++17
Trying to compile the code entirely outside of MoReFEM yielded the exact same result.
However, if inside the Slepc directories ("in place", i.e. where the source were decompressed) the same code was present in a tutorial directory... and it works flawlessly. By trial-and-error in my sandbox directory I managed to figure out it was due to the were we fetched the library: if using the in-place Petsc (not Slepc) directory it works, but if I'm using the out of place PETSc it fails with the above message.
It is therefore wiser to modify the installation for PETSc and Slepc to use the inplace method only (I have already struggled with something similar in PETSc alone years ago: I remember having to play around PetscInitialize()
without understanding why I had to do it - now I know...)